@epam/ai-dial-conversation-input 1.2.0-dev.6 → 1.2.0-dev.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Input/Buttons/SendButton.d.ts +2 -0
- package/components/Input/Buttons/SendButton.d.ts.map +1 -1
- package/components/Input/Input.d.ts.map +1 -1
- package/components/Input/ModelSelectorControl.d.ts.map +1 -1
- package/components/ModelSelectorBottomSheet/ModelSelectorBottomSheet.d.ts.map +1 -1
- package/constants/public-class-names.d.ts +33 -0
- package/constants/public-class-names.d.ts.map +1 -0
- package/hooks/useModelSelector.d.ts.map +1 -1
- package/hooks/useTextInsertion.d.ts +18 -2
- package/hooks/useTextInsertion.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.d.ts +2 -1
- package/index.d.ts.map +1 -1
- package/index.js +698 -660
- package/models/ConversationInput.d.ts +10 -2
- package/models/ConversationInput.d.ts.map +1 -1
- package/models/Input.d.ts +19 -3
- package/models/Input.d.ts.map +1 -1
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -1,29 +1,41 @@
|
|
|
1
1
|
import { AttachmentErrorReason as e, AttachmentType as t, DeploymentIcon as n, RESIZABLE_TEXTAREA_CLASS_NAME as r, RequestStatus as i, ResponseFormat as a, SELECT_LIST_MAX_HEIGHT_PX as o, buildCssVars as s, mergeClasses as c, useIsMobile as l } from "@epam/ai-dial-chat-shared";
|
|
2
|
-
import { BASE_ICON_SIZE as u, Button as d, CloseButton as f, DIAL_ICON_SIZE as p, DIAL_KIT_ICON_STROKE as m, Dropdown as h, ElementSize as g, ErrorText as _, GhostIconButton as v, Highlight as y, MenuItemMark as b, NeutralButton as x, Popup as S, PopupSize as C, PrimaryButton as w, PrimaryIconButton as T, RadioGroup as E, RadioGroupOrientation as D, Search as O, Skeleton as k, SkeletonVariant as ee, Slider as A, Spinner as te, StaticIconButton as j, Textarea as
|
|
3
|
-
import { IconArrowLeft as ie, IconArrowNarrowRight as ae, IconCheck as N, IconChevronDown as P, IconChevronRight as oe, IconFile as se, IconMicrophone as ce, IconPaperclip as
|
|
4
|
-
import { createElement as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { AttachmentTray as
|
|
8
|
-
//#region src/
|
|
9
|
-
var
|
|
10
|
-
|
|
2
|
+
import { BASE_ICON_SIZE as u, Button as d, CloseButton as f, DIAL_ICON_SIZE as p, DIAL_KIT_ICON_STROKE as m, Dropdown as h, ElementSize as g, ErrorText as _, GhostIconButton as v, Highlight as y, MenuItemMark as b, NeutralButton as x, Popup as S, PopupSize as C, PrimaryButton as w, PrimaryIconButton as T, RadioGroup as E, RadioGroupOrientation as D, Search as O, Skeleton as k, SkeletonVariant as ee, Slider as A, Spinner as te, StaticIconButton as j, Textarea as ne, TextareaResize as re, Tooltip as M } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { IconArrowLeft as ie, IconArrowNarrowRight as ae, IconCheck as N, IconChevronDown as P, IconChevronRight as oe, IconFile as se, IconMicrophone as ce, IconPaperclip as le, IconPlayerStopFilled as ue, IconPlaystationSquare as F, IconPlus as de, IconSettings as fe, IconTool as pe, IconX as me } from "@tabler/icons-react";
|
|
4
|
+
import { createElement as he, memo as ge, useCallback as I, useEffect as L, useImperativeHandle as _e, useLayoutEffect as ve, useMemo as R, useRef as z, useState as B } from "react";
|
|
5
|
+
import { createPortal as ye } from "react-dom";
|
|
6
|
+
import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
|
|
7
|
+
import { AttachmentTray as be, MAX_UPLOADS_PER_MINUTE as xe, generateAttachmentId as W, useClipboardPaste as Se } from "@epam/ai-dial-attachment-input";
|
|
8
|
+
//#region src/constants/public-class-names.ts
|
|
9
|
+
var G = {
|
|
10
|
+
wrapper: "dial-ci-wrapper",
|
|
11
|
+
actionRow: "dial-ci-action-row",
|
|
12
|
+
textareaWrap: "dial-ci-textarea-wrap",
|
|
13
|
+
addCluster: "dial-ci-add-cluster",
|
|
14
|
+
toolsChips: "dial-ci-tools-chips",
|
|
15
|
+
footerActions: "dial-ci-footer-actions",
|
|
16
|
+
modelSelectorButton: "dial-ci-model-selector-button",
|
|
17
|
+
modelMenu: "dial-ci-model-menu",
|
|
18
|
+
modelMenuSearch: "dial-ci-model-menu-search",
|
|
19
|
+
modelMenuItem: "dial-ci-model-menu-item",
|
|
20
|
+
modelMenuItemSelected: "dial-ci-model-menu-item-selected"
|
|
21
|
+
}, Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", we = (e, t, n) => {
|
|
22
|
+
L(() => {
|
|
11
23
|
if (!e) return;
|
|
12
24
|
let n = (e) => {
|
|
13
25
|
e.key === "Escape" && t();
|
|
14
26
|
};
|
|
15
27
|
return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
|
|
16
|
-
}, [e, t]),
|
|
28
|
+
}, [e, t]), L(() => {
|
|
17
29
|
if (e) return document.body.style.overflow = "hidden", () => {
|
|
18
30
|
document.body.style.overflow = "";
|
|
19
31
|
};
|
|
20
|
-
}, [e]),
|
|
32
|
+
}, [e]), L(() => {
|
|
21
33
|
if (!e || n?.current == null) return;
|
|
22
34
|
let t = n.current, r = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
23
|
-
(t.querySelector(
|
|
35
|
+
(t.querySelector(Ce) ?? t).focus();
|
|
24
36
|
let i = (e) => {
|
|
25
37
|
if (e.key !== "Tab") return;
|
|
26
|
-
let n = Array.from(t.querySelectorAll(
|
|
38
|
+
let n = Array.from(t.querySelectorAll(Ce));
|
|
27
39
|
if (n.length === 0) {
|
|
28
40
|
e.preventDefault(), t.focus();
|
|
29
41
|
return;
|
|
@@ -35,27 +47,27 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
35
47
|
document.removeEventListener("keydown", i), r?.focus();
|
|
36
48
|
};
|
|
37
49
|
}, [e, n]);
|
|
38
|
-
},
|
|
50
|
+
}, Te = {
|
|
39
51
|
backdrop: "_backdrop_1d50f_9",
|
|
40
52
|
sheet: "_sheet_1d50f_13",
|
|
41
53
|
"slide-up": "_slide-up_1d50f_1",
|
|
42
54
|
title: "_title_1d50f_18",
|
|
43
55
|
divider: "_divider_1d50f_22"
|
|
44
|
-
},
|
|
45
|
-
let y =
|
|
46
|
-
if (
|
|
56
|
+
}, K = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: a, "aria-label": o, style: l, titleClassName: u = "dial-body-semi-text", className: d, colors: h, children: _ }) => {
|
|
57
|
+
let y = z(null);
|
|
58
|
+
if (we(e, r, y), !e || typeof document > "u") return null;
|
|
47
59
|
let b = s({
|
|
48
60
|
"--ci-backdrop": h?.backdrop,
|
|
49
61
|
"--ci-sheet-bg": h?.sheetBg,
|
|
50
62
|
"--ci-sheet-text": h?.sheetText,
|
|
51
63
|
"--ci-sheet-divider": h?.divider
|
|
52
64
|
});
|
|
53
|
-
return
|
|
54
|
-
className: c(
|
|
65
|
+
return ye(/* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("div", {
|
|
66
|
+
className: c(Te.backdrop, "fixed inset-0 z-[55]"),
|
|
55
67
|
style: b,
|
|
56
68
|
onPointerDown: r,
|
|
57
69
|
"aria-hidden": !0
|
|
58
|
-
}), /* @__PURE__ */
|
|
70
|
+
}), /* @__PURE__ */ U("div", {
|
|
59
71
|
ref: y,
|
|
60
72
|
role: "dialog",
|
|
61
73
|
"aria-modal": !0,
|
|
@@ -65,14 +77,14 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
65
77
|
...b,
|
|
66
78
|
...l
|
|
67
79
|
},
|
|
68
|
-
className: c(
|
|
69
|
-
children: [t != null && /* @__PURE__ */
|
|
80
|
+
className: c(Te.sheet, "fixed inset-x-0 bottom-0 z-[60] flex max-h-[85dvh] flex-col rounded-t-lg", d),
|
|
81
|
+
children: [t != null && /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ U("div", {
|
|
70
82
|
className: "relative flex h-[60px] flex-shrink-0 items-center justify-center px-4",
|
|
71
83
|
children: [
|
|
72
|
-
i && /* @__PURE__ */
|
|
84
|
+
i && /* @__PURE__ */ H("div", {
|
|
73
85
|
className: "absolute start-4",
|
|
74
|
-
children: /* @__PURE__ */
|
|
75
|
-
icon: /* @__PURE__ */
|
|
86
|
+
children: /* @__PURE__ */ H(v, {
|
|
87
|
+
icon: /* @__PURE__ */ H(ie, {
|
|
76
88
|
size: p.LG,
|
|
77
89
|
stroke: m,
|
|
78
90
|
className: "rtl:scale-x-[-1]"
|
|
@@ -81,20 +93,20 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
81
93
|
onClick: i
|
|
82
94
|
})
|
|
83
95
|
}),
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
className: c(
|
|
96
|
+
/* @__PURE__ */ H("span", {
|
|
97
|
+
className: c(Te.title, u),
|
|
86
98
|
children: t
|
|
87
99
|
}),
|
|
88
|
-
/* @__PURE__ */
|
|
100
|
+
/* @__PURE__ */ H("div", {
|
|
89
101
|
className: "absolute end-4 m-2",
|
|
90
|
-
children: /* @__PURE__ */
|
|
102
|
+
children: /* @__PURE__ */ H(f, {
|
|
91
103
|
ariaLabel: n,
|
|
92
104
|
onClose: r,
|
|
93
105
|
size: g.Standard
|
|
94
106
|
})
|
|
95
107
|
})
|
|
96
108
|
]
|
|
97
|
-
}), /* @__PURE__ */
|
|
109
|
+
}), /* @__PURE__ */ H("div", { className: c(Te.divider, "h-px flex-shrink-0") })] }), /* @__PURE__ */ H("div", {
|
|
98
110
|
className: "overflow-y-auto",
|
|
99
111
|
children: _
|
|
100
112
|
})]
|
|
@@ -104,18 +116,18 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
104
116
|
for (let t = 0; t < e.length; t++) t > 0 && await new Promise((e) => setTimeout(e, r)), i.push(n(e[t]));
|
|
105
117
|
await Promise.allSettled(i);
|
|
106
118
|
}, De = ({ initialAttachments: n, onUploadAttachment: r, onAttachmentsChange: a, validateAttachment: o, pendingDropFiles: s, onDropFilesConsumed: c, pendingAttachments: l, onPendingAttachmentsConsumed: u, onExpandPastedText: d, maximumAttachmentsAmount: f, baseAttachmentsAmount: p = 0, onAttachmentsLimitExceeded: m }) => {
|
|
107
|
-
let [h, g] =
|
|
108
|
-
|
|
119
|
+
let [h, g] = B(n), _ = z(h);
|
|
120
|
+
L(() => {
|
|
109
121
|
_.current = h;
|
|
110
|
-
}, [h]),
|
|
122
|
+
}, [h]), L(() => () => {
|
|
111
123
|
_.current.forEach((e) => {
|
|
112
124
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
113
125
|
});
|
|
114
126
|
}, []);
|
|
115
|
-
let v =
|
|
127
|
+
let v = I((e) => e.map((e) => {
|
|
116
128
|
let n = e.type.startsWith("image/"), r = e.type.startsWith("audio/"), a = n ? URL.createObjectURL(e) : void 0, o = r ? URL.createObjectURL(e) : void 0;
|
|
117
129
|
return {
|
|
118
|
-
id:
|
|
130
|
+
id: W(),
|
|
119
131
|
name: e.name,
|
|
120
132
|
contentType: e.type,
|
|
121
133
|
file: e,
|
|
@@ -124,26 +136,26 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
124
136
|
previewUrl: a,
|
|
125
137
|
playUrl: o
|
|
126
138
|
};
|
|
127
|
-
}), []), y =
|
|
128
|
-
|
|
139
|
+
}), []), y = z(a);
|
|
140
|
+
L(() => {
|
|
129
141
|
y.current = a;
|
|
130
142
|
}, [a]);
|
|
131
|
-
let b =
|
|
143
|
+
let b = z(!0), x = I((e) => {
|
|
132
144
|
g((t) => {
|
|
133
145
|
let n = e(t);
|
|
134
146
|
return n === t ? t : n;
|
|
135
147
|
});
|
|
136
148
|
}, []);
|
|
137
|
-
|
|
149
|
+
L(() => {
|
|
138
150
|
if (b.current) {
|
|
139
151
|
b.current = !1;
|
|
140
152
|
return;
|
|
141
153
|
}
|
|
142
154
|
y.current?.(h);
|
|
143
155
|
}, [h]);
|
|
144
|
-
let S =
|
|
156
|
+
let S = I((e) => {
|
|
145
157
|
g(e);
|
|
146
|
-
}, []), C =
|
|
158
|
+
}, []), C = I(async (t) => {
|
|
147
159
|
if (r) {
|
|
148
160
|
x((e) => e.map((e) => e.id === t.id ? {
|
|
149
161
|
...e,
|
|
@@ -166,7 +178,7 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
166
178
|
} : e));
|
|
167
179
|
}
|
|
168
180
|
}
|
|
169
|
-
}, [r, x]), w =
|
|
181
|
+
}, [r, x]), w = I((e, t = !0) => {
|
|
170
182
|
let n = new Set(_.current.map((e) => e.id)), r = e.filter((e) => !n.has(e.id));
|
|
171
183
|
if (r.length !== 0) {
|
|
172
184
|
if (f != null && f > 0 && Number.isFinite(f)) {
|
|
@@ -187,7 +199,7 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
187
199
|
status: i.Error,
|
|
188
200
|
errorReason: n
|
|
189
201
|
} : e));
|
|
190
|
-
}), Ee(e,
|
|
202
|
+
}), Ee(e, xe, C);
|
|
191
203
|
}
|
|
192
204
|
}
|
|
193
205
|
}, [
|
|
@@ -198,20 +210,20 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
198
210
|
C,
|
|
199
211
|
o
|
|
200
212
|
]);
|
|
201
|
-
|
|
213
|
+
L(() => {
|
|
202
214
|
s.length !== 0 && (w(v(s)), c?.());
|
|
203
215
|
}, [
|
|
204
216
|
w,
|
|
205
217
|
v,
|
|
206
218
|
c,
|
|
207
219
|
s
|
|
208
|
-
]),
|
|
220
|
+
]), L(() => {
|
|
209
221
|
l.length !== 0 && (w(l, !1), u?.());
|
|
210
222
|
}, [
|
|
211
223
|
w,
|
|
212
224
|
u,
|
|
213
225
|
l
|
|
214
|
-
]),
|
|
226
|
+
]), L(() => {
|
|
215
227
|
if (!o) return;
|
|
216
228
|
let t = !1, n = [], r = _.current.map((r) => {
|
|
217
229
|
if (r.status === i.Loading) return r;
|
|
@@ -238,7 +250,7 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
238
250
|
x,
|
|
239
251
|
C
|
|
240
252
|
]);
|
|
241
|
-
let T =
|
|
253
|
+
let T = I((e) => {
|
|
242
254
|
x((t) => {
|
|
243
255
|
let n = t.find((t) => t.id === e);
|
|
244
256
|
return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), n?.playUrl && URL.revokeObjectURL(n.playUrl), t.filter((t) => t.id !== e);
|
|
@@ -250,11 +262,11 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
250
262
|
addAttachments: w,
|
|
251
263
|
resetAttachments: S,
|
|
252
264
|
handleRemove: T,
|
|
253
|
-
handleRetry:
|
|
265
|
+
handleRetry: I((e) => {
|
|
254
266
|
let t = h.find((t) => t.id === e);
|
|
255
267
|
t && C(t);
|
|
256
268
|
}, [h, C]),
|
|
257
|
-
handleExpand:
|
|
269
|
+
handleExpand: I(async (e) => {
|
|
258
270
|
let n = h.find((t) => t.id === e);
|
|
259
271
|
if (!n || n.type !== t.Pasted) return;
|
|
260
272
|
let r = await n.file.text();
|
|
@@ -271,7 +283,7 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
271
283
|
let n = e.slice(t.length);
|
|
272
284
|
return !/\s/.test(n) && !n.includes(t);
|
|
273
285
|
}, ke = ({ config: e, message: t }) => {
|
|
274
|
-
let [n, r] =
|
|
286
|
+
let [n, r] = B(!1), [i, a] = B(!1), o = e != null && Oe(t, e.triggerPrefix) ? t.slice(e.triggerPrefix.length) : "", s = I((n, a, o) => {
|
|
275
287
|
if (e == null || a || t !== "" || i) return;
|
|
276
288
|
let s = n === e.triggerPrefix, c = o === "insertFromPaste" && Oe(n, e.triggerPrefix);
|
|
277
289
|
(s || c) && r(!0);
|
|
@@ -280,7 +292,7 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
280
292
|
t,
|
|
281
293
|
i
|
|
282
294
|
]);
|
|
283
|
-
return
|
|
295
|
+
return L(() => {
|
|
284
296
|
if (e == null) {
|
|
285
297
|
r(!1), a(!1);
|
|
286
298
|
return;
|
|
@@ -289,23 +301,23 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
289
301
|
}, [e, t]), {
|
|
290
302
|
isMenuOpen: n,
|
|
291
303
|
query: o,
|
|
292
|
-
dismiss:
|
|
304
|
+
dismiss: I(() => {
|
|
293
305
|
r(!1), a(!0);
|
|
294
306
|
}, []),
|
|
295
307
|
handleValueChange: s
|
|
296
308
|
};
|
|
297
309
|
}, Ae = (e, t) => !e.slice(0, t).includes("\n"), je = (e, t) => !e.slice(t).includes("\n"), Me = (e) => {
|
|
298
|
-
let t =
|
|
310
|
+
let t = z(e);
|
|
299
311
|
t.current = e;
|
|
300
|
-
let n =
|
|
312
|
+
let n = z(-1), r = z(""), i = I((e, i, a) => {
|
|
301
313
|
let o = t.current;
|
|
302
314
|
return !o || o.length === 0 ? null : e === "up" ? !Ae(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 || !je(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
|
|
303
|
-
}, []), a =
|
|
315
|
+
}, []), a = I(() => {
|
|
304
316
|
n.current = -1, r.current = "";
|
|
305
|
-
}, []), o =
|
|
317
|
+
}, []), o = I(() => {
|
|
306
318
|
n.current = -1, r.current = "";
|
|
307
319
|
}, []);
|
|
308
|
-
return
|
|
320
|
+
return R(() => ({
|
|
309
321
|
navigate: i,
|
|
310
322
|
notifyChange: a,
|
|
311
323
|
reset: o
|
|
@@ -315,39 +327,52 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
315
327
|
o
|
|
316
328
|
]);
|
|
317
329
|
}, Ne = ({ messageProp: e, messageRevision: t }) => {
|
|
318
|
-
let [n, r] =
|
|
319
|
-
return
|
|
330
|
+
let [n, r] = B(e), i = z(null);
|
|
331
|
+
return L(() => {
|
|
320
332
|
r(e);
|
|
321
333
|
}, [e, t]), {
|
|
322
334
|
message: n,
|
|
323
335
|
setMessage: r,
|
|
324
336
|
textareaRef: i
|
|
325
337
|
};
|
|
326
|
-
}, Pe = (e, t, n) => {
|
|
327
|
-
let
|
|
328
|
-
|
|
329
|
-
}, Fe = ({ insertion: e, textareaRef: t }) => {
|
|
330
|
-
let n = e?.revision, r =
|
|
338
|
+
}, Pe = (e, t, n, r = n) => {
|
|
339
|
+
let i = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value")?.set;
|
|
340
|
+
i ? i.call(e, t) : e.value = t, e.setSelectionRange(n, r), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
341
|
+
}, Fe = (e) => e.key.toLowerCase() === "z" && (e.ctrlKey || e.metaKey) && !e.shiftKey && !e.altKey, Ie = ({ insertion: e, textareaRef: t }) => {
|
|
342
|
+
let n = e?.revision, r = z(e?.text);
|
|
331
343
|
r.current = e?.text;
|
|
332
|
-
let i =
|
|
333
|
-
|
|
344
|
+
let i = z(n), a = z(null);
|
|
345
|
+
return L(() => {
|
|
334
346
|
if (n === i.current) return;
|
|
335
347
|
i.current = n;
|
|
336
|
-
let e =
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
348
|
+
let e = r.current;
|
|
349
|
+
!t.current || !e || queueMicrotask(() => {
|
|
350
|
+
let n = t.current;
|
|
351
|
+
if (!n) return;
|
|
352
|
+
let { value: r, selectionStart: i, selectionEnd: o } = n, s = i ?? r.length, c = o ?? s;
|
|
353
|
+
if (n.focus(), a.current = null, typeof document.execCommand == "function" && document.execCommand("insertText", !1, e)) return;
|
|
354
|
+
let l = `${r.slice(0, s)}${e}${r.slice(c)}`;
|
|
355
|
+
Pe(n, l, s + e.length), a.current = {
|
|
356
|
+
insertedValue: l,
|
|
357
|
+
previousValue: r,
|
|
358
|
+
previousSelectionStart: s,
|
|
359
|
+
previousSelectionEnd: c
|
|
360
|
+
};
|
|
361
|
+
});
|
|
362
|
+
}, [n, t]), { handleUndoKeyDown: (e) => {
|
|
363
|
+
let n = a.current, r = t.current;
|
|
364
|
+
return n == null || r == null || !Fe(e) || (a.current = null, r.value !== n.insertedValue) ? !1 : (e.preventDefault(), Pe(r, n.previousValue, n.previousSelectionStart, n.previousSelectionEnd), !0);
|
|
365
|
+
} };
|
|
366
|
+
}, Le = /* @__PURE__ */ function(e) {
|
|
342
367
|
return e.Idle = "idle", e.Recording = "recording", e.Processing = "processing", e.Error = "error", e;
|
|
343
|
-
}({}),
|
|
368
|
+
}({}), Re = /* @__PURE__ */ function(e) {
|
|
344
369
|
return e.Dictation = "dictation", e.Attachment = "attachment", e;
|
|
345
|
-
}({}),
|
|
370
|
+
}({}), ze = [
|
|
346
371
|
"audio/webm;codecs=opus",
|
|
347
372
|
"audio/ogg;codecs=opus",
|
|
348
373
|
"audio/webm"
|
|
349
|
-
],
|
|
350
|
-
let [i, a] =
|
|
374
|
+
], Be = 100, Ve = 100, He = .01, Ue = ({ onAttachAudio: e, onTranscribeAudio: t, onTranscript: n, errorLabel: r = "Voice input failed" }) => {
|
|
375
|
+
let [i, a] = B("idle"), [o, s] = B(null), c = z(null), l = z(null), u = z({
|
|
351
376
|
onAttachAudio: e,
|
|
352
377
|
onTranscribeAudio: t,
|
|
353
378
|
onTranscript: n,
|
|
@@ -359,7 +384,7 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
359
384
|
onTranscript: n,
|
|
360
385
|
errorLabel: r
|
|
361
386
|
};
|
|
362
|
-
let d =
|
|
387
|
+
let d = I((e = "dictation") => {
|
|
363
388
|
if (l.current) return;
|
|
364
389
|
let t = { controller: new AbortController() };
|
|
365
390
|
l.current = t, s(null), a("recording");
|
|
@@ -377,7 +402,7 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
377
402
|
n.aborted || (t.controller.abort(), l.current = null, s(e instanceof Error ? e.message : u.current.errorLabel), a("error"));
|
|
378
403
|
}, b = () => {
|
|
379
404
|
if (!i || n.aborted) return;
|
|
380
|
-
let e =
|
|
405
|
+
let e = ze.find((e) => MediaRecorder.isTypeSupported(e)), t = new MediaRecorder(i, e ? { mimeType: e } : void 0);
|
|
381
406
|
d = t;
|
|
382
407
|
let o = Date.now(), s = !1, l = !1, b = new Uint8Array(c.current?.fftSize ?? 256), x = async () => {
|
|
383
408
|
if (!(m || n.aborted)) {
|
|
@@ -385,7 +410,7 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
385
410
|
try {
|
|
386
411
|
let i = t.mimeType || e || "audio/webm", c = new Blob(h, { type: i });
|
|
387
412
|
h.length = 0, _();
|
|
388
|
-
let d = Date.now() - o >=
|
|
413
|
+
let d = Date.now() - o >= Ve;
|
|
389
414
|
if (c.size && (!r || d && (!s || l))) {
|
|
390
415
|
let e = i.split(";")[0].split("/")[1] ?? "webm", t = new File([c], "voice-" + crypto.randomUUID() + "." + e, { type: i });
|
|
391
416
|
if (r) {
|
|
@@ -411,8 +436,8 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
411
436
|
e.getByteTimeDomainData(b), s = !0;
|
|
412
437
|
let t = 0;
|
|
413
438
|
for (let e of b) t += ((e - 128) / 128) ** 2;
|
|
414
|
-
Math.sqrt(t / b.length) >=
|
|
415
|
-
},
|
|
439
|
+
Math.sqrt(t / b.length) >= He && (l = !0, g());
|
|
440
|
+
}, Be));
|
|
416
441
|
};
|
|
417
442
|
t.stop = () => {
|
|
418
443
|
p || n.aborted || (p = !0, g(), a("processing"), d?.state === "recording" && d.stop());
|
|
@@ -430,10 +455,10 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
430
455
|
y(e);
|
|
431
456
|
}
|
|
432
457
|
})();
|
|
433
|
-
}, []), f =
|
|
458
|
+
}, []), f = I(() => l.current?.stop?.(), []), p = I(() => {
|
|
434
459
|
l.current?.controller.abort(), l.current = null, s(null), a("idle");
|
|
435
460
|
}, []);
|
|
436
|
-
return
|
|
461
|
+
return L(() => () => {
|
|
437
462
|
l.current?.controller.abort(), l.current = null;
|
|
438
463
|
}, []), {
|
|
439
464
|
state: i,
|
|
@@ -443,12 +468,14 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
443
468
|
stopRecording: f,
|
|
444
469
|
discardRecording: p
|
|
445
470
|
};
|
|
446
|
-
},
|
|
471
|
+
}, We = /* @__PURE__ */ function(e) {
|
|
447
472
|
return e.Enter = "enter", e.MetaEnter = "meta-enter", e;
|
|
448
|
-
}({}),
|
|
473
|
+
}({}), Ge = /* @__PURE__ */ function(e) {
|
|
474
|
+
return e.Stacked = "stacked", e.Inline = "inline", e;
|
|
475
|
+
}({}), Ke = {
|
|
449
476
|
item: "_item_1sr2n_1",
|
|
450
477
|
itemIcon: "_itemIcon_1sr2n_11"
|
|
451
|
-
},
|
|
478
|
+
}, qe = ({ isOpen: e, title: t, closeLabel: n, onClose: r, style: i, items: a, className: o, titleClassName: l = "dial-body-semi-text", itemLabelClassName: u = "dial-small-text", btnTextClassName: f = "", colors: p }) => {
|
|
452
479
|
let m = (e) => {
|
|
453
480
|
e(), r();
|
|
454
481
|
}, h = s({
|
|
@@ -457,7 +484,7 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
457
484
|
"--ci-sheet-item-active": p?.itemActiveBg,
|
|
458
485
|
"--ci-sheet-icon": p?.itemIcon
|
|
459
486
|
});
|
|
460
|
-
return /* @__PURE__ */
|
|
487
|
+
return /* @__PURE__ */ H(K, {
|
|
461
488
|
isOpen: e,
|
|
462
489
|
title: t,
|
|
463
490
|
closeLabel: n,
|
|
@@ -466,23 +493,23 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
466
493
|
className: o,
|
|
467
494
|
titleClassName: l,
|
|
468
495
|
colors: p?.shell,
|
|
469
|
-
children: /* @__PURE__ */
|
|
496
|
+
children: /* @__PURE__ */ H("ul", {
|
|
470
497
|
role: "list",
|
|
471
498
|
className: "flex flex-col",
|
|
472
499
|
style: h,
|
|
473
|
-
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */
|
|
500
|
+
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ H("li", { children: /* @__PURE__ */ H(d, {
|
|
474
501
|
type: "button",
|
|
475
|
-
className: c(
|
|
476
|
-
iconBefore: /* @__PURE__ */
|
|
477
|
-
className:
|
|
502
|
+
className: c(Ke.item, "w-full gap-3 px-4 py-[10px] text-start"),
|
|
503
|
+
iconBefore: /* @__PURE__ */ H("span", {
|
|
504
|
+
className: Ke.itemIcon,
|
|
478
505
|
children: n
|
|
479
506
|
}),
|
|
480
|
-
iconAfter: r ? /* @__PURE__ */
|
|
507
|
+
iconAfter: r ? /* @__PURE__ */ H("span", {
|
|
481
508
|
className: "ms-auto",
|
|
482
509
|
children: r
|
|
483
510
|
}) : null,
|
|
484
511
|
textClassName: f,
|
|
485
|
-
label: /* @__PURE__ */
|
|
512
|
+
label: /* @__PURE__ */ H("span", {
|
|
486
513
|
className: u,
|
|
487
514
|
children: t
|
|
488
515
|
}),
|
|
@@ -490,9 +517,9 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
490
517
|
}) }, e))
|
|
491
518
|
})
|
|
492
519
|
});
|
|
493
|
-
},
|
|
494
|
-
let [s, c] =
|
|
495
|
-
|
|
520
|
+
}, Je = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
521
|
+
let [s, c] = B(t), [l, u] = B(n), [d, f] = B(r), p = z(o);
|
|
522
|
+
L(() => {
|
|
496
523
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
497
524
|
}, [
|
|
498
525
|
o,
|
|
@@ -509,7 +536,7 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
509
536
|
setResponseFormat: c,
|
|
510
537
|
setSystemPrompt: u,
|
|
511
538
|
setTemperature: f,
|
|
512
|
-
handleSubmit:
|
|
539
|
+
handleSubmit: I(() => {
|
|
513
540
|
if (!m) return;
|
|
514
541
|
let t = {};
|
|
515
542
|
e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
|
|
@@ -523,17 +550,17 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
523
550
|
a
|
|
524
551
|
])
|
|
525
552
|
};
|
|
526
|
-
},
|
|
553
|
+
}, Ye = { label: "_label_14i7c_1" }, Xe = ({ features: e, responseFormat: t, systemPrompt: n, temperature: i, onResponseFormatChange: o, onSystemPromptChange: l, 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 = [
|
|
527
554
|
"Precise",
|
|
528
555
|
"Neutral",
|
|
529
556
|
"Creative"
|
|
530
557
|
], temperatureHint: y, labelClassName: b = "!dial-small-semi-text", colors: x }) => {
|
|
531
|
-
let S = s({ "--csf-label-text": x?.labelText }), C = c(b,
|
|
532
|
-
return /* @__PURE__ */
|
|
558
|
+
let S = s({ "--csf-label-text": x?.labelText }), C = c(b, Ye.label, "gap-1");
|
|
559
|
+
return /* @__PURE__ */ U("div", {
|
|
533
560
|
className: "flex flex-col gap-4 px-6 pb-3",
|
|
534
561
|
style: S,
|
|
535
562
|
children: [
|
|
536
|
-
e.responseFormat && /* @__PURE__ */
|
|
563
|
+
e.responseFormat && /* @__PURE__ */ H(E, {
|
|
537
564
|
id: "response-format",
|
|
538
565
|
labelProps: {
|
|
539
566
|
label: d,
|
|
@@ -552,18 +579,18 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
552
579
|
}],
|
|
553
580
|
onChange: (e) => o(e)
|
|
554
581
|
}),
|
|
555
|
-
e.systemPrompt && /* @__PURE__ */
|
|
582
|
+
e.systemPrompt && /* @__PURE__ */ H(ne, {
|
|
556
583
|
value: n,
|
|
557
584
|
placeholder: g,
|
|
558
585
|
className: r,
|
|
559
|
-
resize:
|
|
586
|
+
resize: re.Vertical,
|
|
560
587
|
labelProps: {
|
|
561
588
|
className: C,
|
|
562
589
|
label: h
|
|
563
590
|
},
|
|
564
591
|
onChange: (e) => l(e ?? "")
|
|
565
592
|
}),
|
|
566
|
-
e.temperature && /* @__PURE__ */
|
|
593
|
+
e.temperature && /* @__PURE__ */ H(A, {
|
|
567
594
|
labelProps: {
|
|
568
595
|
label: _,
|
|
569
596
|
className: C,
|
|
@@ -579,8 +606,8 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
579
606
|
})
|
|
580
607
|
]
|
|
581
608
|
});
|
|
582
|
-
},
|
|
583
|
-
let { responseFormat: T, systemPrompt: E, temperature: D, canSubmit: O, setResponseFormat: k, setSystemPrompt: ee, setTemperature: A, handleSubmit: te } =
|
|
609
|
+
}, Ze = ({ isOpen: e, onBack: t, backLabel: n, onClose: r, closeLabel: i, style: a, features: o, initialResponseFormat: s, initialSystemPrompt: l, 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 }) => {
|
|
610
|
+
let { responseFormat: T, systemPrompt: E, temperature: D, canSubmit: O, setResponseFormat: k, setSystemPrompt: ee, setTemperature: A, handleSubmit: te } = Je({
|
|
584
611
|
isOpen: e,
|
|
585
612
|
features: o,
|
|
586
613
|
initialResponseFormat: s,
|
|
@@ -589,7 +616,7 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
589
616
|
onSave: d,
|
|
590
617
|
onClose: r
|
|
591
618
|
});
|
|
592
|
-
return /* @__PURE__ */
|
|
619
|
+
return /* @__PURE__ */ U(K, {
|
|
593
620
|
isOpen: e,
|
|
594
621
|
title: f,
|
|
595
622
|
closeLabel: i,
|
|
@@ -597,7 +624,7 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
597
624
|
onBack: t,
|
|
598
625
|
backLabel: n,
|
|
599
626
|
style: a,
|
|
600
|
-
children: [/* @__PURE__ */
|
|
627
|
+
children: [/* @__PURE__ */ H(Xe, {
|
|
601
628
|
features: o,
|
|
602
629
|
responseFormat: T,
|
|
603
630
|
systemPrompt: E,
|
|
@@ -614,13 +641,13 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
614
641
|
temperatureLabel: y,
|
|
615
642
|
temperatureLabels: b,
|
|
616
643
|
temperatureHint: x
|
|
617
|
-
}), /* @__PURE__ */
|
|
644
|
+
}), /* @__PURE__ */ H("div", {
|
|
618
645
|
className: c("px-6 py-4 mobile:pb-8"),
|
|
619
|
-
children: /* @__PURE__ */
|
|
646
|
+
children: /* @__PURE__ */ H(M, {
|
|
620
647
|
tooltip: C,
|
|
621
648
|
hideTooltip: O || !C,
|
|
622
649
|
triggerClassName: "w-full",
|
|
623
|
-
children: /* @__PURE__ */
|
|
650
|
+
children: /* @__PURE__ */ H(w, {
|
|
624
651
|
label: S,
|
|
625
652
|
onClick: te,
|
|
626
653
|
disabled: !O,
|
|
@@ -629,8 +656,8 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
629
656
|
})
|
|
630
657
|
})]
|
|
631
658
|
});
|
|
632
|
-
},
|
|
633
|
-
let { responseFormat: b, systemPrompt: x, temperature: T, canSubmit: E, setResponseFormat: D, setSystemPrompt: O, setTemperature: k, handleSubmit: ee } =
|
|
659
|
+
}, q = { modal: "_modal_kl0h0_1" }, Qe = ({ 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: h, temperatureHint: g, saveLabel: _ = "Apply changes", saveDisabledTooltip: v, backgroundClassName: y = q.modal }) => {
|
|
660
|
+
let { responseFormat: b, systemPrompt: x, temperature: T, canSubmit: E, setResponseFormat: D, setSystemPrompt: O, setTemperature: k, handleSubmit: ee } = Je({
|
|
634
661
|
features: e,
|
|
635
662
|
initialResponseFormat: t,
|
|
636
663
|
initialSystemPrompt: n,
|
|
@@ -638,26 +665,26 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
638
665
|
onSave: i,
|
|
639
666
|
onClose: a
|
|
640
667
|
});
|
|
641
|
-
return /* @__PURE__ */
|
|
668
|
+
return /* @__PURE__ */ H(S, {
|
|
642
669
|
open: !0,
|
|
643
670
|
header: o,
|
|
644
671
|
titleClassName: s,
|
|
645
672
|
size: C.Sm,
|
|
646
673
|
onClose: a,
|
|
647
674
|
className: y,
|
|
648
|
-
footer: /* @__PURE__ */
|
|
675
|
+
footer: /* @__PURE__ */ H("div", {
|
|
649
676
|
className: "flex justify-end px-6 py-4",
|
|
650
|
-
children: /* @__PURE__ */
|
|
677
|
+
children: /* @__PURE__ */ H(M, {
|
|
651
678
|
tooltip: v,
|
|
652
679
|
hideTooltip: E || !v,
|
|
653
|
-
children: /* @__PURE__ */
|
|
680
|
+
children: /* @__PURE__ */ H(w, {
|
|
654
681
|
label: _,
|
|
655
682
|
onClick: ee,
|
|
656
683
|
disabled: !E
|
|
657
684
|
})
|
|
658
685
|
})
|
|
659
686
|
}),
|
|
660
|
-
children: /* @__PURE__ */
|
|
687
|
+
children: /* @__PURE__ */ H(Xe, {
|
|
661
688
|
features: e,
|
|
662
689
|
responseFormat: b,
|
|
663
690
|
systemPrompt: x,
|
|
@@ -676,10 +703,10 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
676
703
|
temperatureHint: g
|
|
677
704
|
})
|
|
678
705
|
});
|
|
679
|
-
},
|
|
706
|
+
}, $e = {
|
|
680
707
|
icon: "_icon_1fv6z_1",
|
|
681
708
|
selectedIcon: "_selectedIcon_1fv6z_5"
|
|
682
|
-
},
|
|
709
|
+
}, et = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel: i = "Close", style: a, title: o = "Tools", items: l, onToolToggle: f, itemLabelClassName: p = "dial-small-text", colors: h }) => /* @__PURE__ */ H(K, {
|
|
683
710
|
isOpen: e,
|
|
684
711
|
title: o,
|
|
685
712
|
closeLabel: i,
|
|
@@ -687,33 +714,33 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
687
714
|
onBack: t,
|
|
688
715
|
backLabel: n,
|
|
689
716
|
style: a,
|
|
690
|
-
children: /* @__PURE__ */
|
|
717
|
+
children: /* @__PURE__ */ H("ul", {
|
|
691
718
|
role: "menu",
|
|
692
719
|
className: "flex flex-col pb-4",
|
|
693
720
|
style: s({
|
|
694
721
|
"--tbs-icon-text": h?.iconText,
|
|
695
722
|
"--tbs-selected-icon-text": h?.selectedIconText
|
|
696
723
|
}),
|
|
697
|
-
children: l.map((e) => /* @__PURE__ */
|
|
724
|
+
children: l.map((e) => /* @__PURE__ */ H("li", {
|
|
698
725
|
role: "none",
|
|
699
|
-
children: /* @__PURE__ */
|
|
726
|
+
children: /* @__PURE__ */ H(d, {
|
|
700
727
|
type: "button",
|
|
701
728
|
role: "menuitemcheckbox",
|
|
702
729
|
"aria-checked": e.isSelected,
|
|
703
730
|
className: "w-full gap-3 px-4 py-[10px] text-start",
|
|
704
|
-
iconBefore: /* @__PURE__ */
|
|
705
|
-
className: c("flex items-center",
|
|
731
|
+
iconBefore: /* @__PURE__ */ H("span", {
|
|
732
|
+
className: c("flex items-center", $e.icon),
|
|
706
733
|
children: e.icon
|
|
707
734
|
}),
|
|
708
|
-
iconAfter: e.isSelected ? /* @__PURE__ */
|
|
709
|
-
className: c("ms-auto",
|
|
710
|
-
children: /* @__PURE__ */
|
|
735
|
+
iconAfter: e.isSelected ? /* @__PURE__ */ H("span", {
|
|
736
|
+
className: c("ms-auto", $e.selectedIcon),
|
|
737
|
+
children: /* @__PURE__ */ H(N, {
|
|
711
738
|
size: u,
|
|
712
739
|
"aria-hidden": !0,
|
|
713
740
|
stroke: m
|
|
714
741
|
})
|
|
715
742
|
}) : null,
|
|
716
|
-
label: /* @__PURE__ */
|
|
743
|
+
label: /* @__PURE__ */ H("span", {
|
|
717
744
|
className: p,
|
|
718
745
|
children: e.label
|
|
719
746
|
}),
|
|
@@ -721,19 +748,19 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
721
748
|
})
|
|
722
749
|
}, e.id))
|
|
723
750
|
})
|
|
724
|
-
}),
|
|
751
|
+
}), tt = {
|
|
725
752
|
toolIcon: "_toolIcon_ma5s5_1",
|
|
726
753
|
chevronIcon: "_chevronIcon_ma5s5_5"
|
|
727
|
-
},
|
|
728
|
-
let k = l(), [ee, A] =
|
|
754
|
+
}, nt = ({ onAttachClick: e, onRecordVoice: t, recordVoiceLabel: n = "Record voice", attachLabel: r, addMenuTitle: i, menuTitle: o, menuCloseLabel: d, style: f, listClassName: _ = "w-[240px]", isDisabled: y = !1, chatSettings: x, extraMenuItems: S, toolsMenuItems: C = [], onToolToggle: w, toolsMenuTitle: T = "Tools", toolsBackLabel: E = "Back", menuOverlays: D, colors: O }) => {
|
|
755
|
+
let k = l(), [ee, A] = B(!1), [te, j] = B(!1), [ne, re] = B(!1), [M, ie] = B(null), [ae, N] = B(!1), P = R(() => s({
|
|
729
756
|
"--aab-tool-icon": O?.toolIcon,
|
|
730
757
|
"--aab-chevron-icon": O?.chevronIcon
|
|
731
|
-
}), [O?.toolIcon, O?.chevronIcon]), se = C.length > 0 && w != null,
|
|
758
|
+
}), [O?.toolIcon, O?.chevronIcon]), se = C.length > 0 && w != null, ue = D != null && D.length > 0, F = R(() => C.map((e) => ({
|
|
732
759
|
key: e.id,
|
|
733
760
|
label: e.label,
|
|
734
|
-
icon: /* @__PURE__ */
|
|
761
|
+
icon: /* @__PURE__ */ H("span", {
|
|
735
762
|
style: P,
|
|
736
|
-
className: c("flex items-center",
|
|
763
|
+
className: c("flex items-center", tt.toolIcon),
|
|
737
764
|
children: e.icon
|
|
738
765
|
}),
|
|
739
766
|
selectable: !0,
|
|
@@ -744,11 +771,11 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
744
771
|
C,
|
|
745
772
|
w,
|
|
746
773
|
P
|
|
747
|
-
]),
|
|
774
|
+
]), me = R(() => [
|
|
748
775
|
...e == null ? [] : [{
|
|
749
776
|
key: "attach",
|
|
750
777
|
label: r,
|
|
751
|
-
icon: /* @__PURE__ */
|
|
778
|
+
icon: /* @__PURE__ */ H(le, {
|
|
752
779
|
size: u,
|
|
753
780
|
"aria-hidden": !0,
|
|
754
781
|
stroke: m
|
|
@@ -759,21 +786,21 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
759
786
|
...se ? [{
|
|
760
787
|
key: "tools",
|
|
761
788
|
label: T,
|
|
762
|
-
icon: /* @__PURE__ */
|
|
789
|
+
icon: /* @__PURE__ */ H(pe, {
|
|
763
790
|
size: u,
|
|
764
791
|
"aria-hidden": !0,
|
|
765
792
|
stroke: m
|
|
766
793
|
}),
|
|
767
794
|
onClick: k ? () => {
|
|
768
|
-
|
|
795
|
+
re(!0), A(!1);
|
|
769
796
|
} : () => void 0,
|
|
770
|
-
...k ? { iconAfter: /* @__PURE__ */
|
|
797
|
+
...k ? { iconAfter: /* @__PURE__ */ H(oe, {
|
|
771
798
|
size: u,
|
|
772
799
|
stroke: m,
|
|
773
800
|
style: P,
|
|
774
|
-
className: c("rtl:scale-x-[-1]",
|
|
801
|
+
className: c("rtl:scale-x-[-1]", tt.chevronIcon),
|
|
775
802
|
"aria-hidden": !0
|
|
776
|
-
}) } : { children:
|
|
803
|
+
}) } : { children: F }
|
|
777
804
|
}] : [],
|
|
778
805
|
...(D ?? []).map((e) => ({
|
|
779
806
|
key: e.key,
|
|
@@ -782,11 +809,11 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
782
809
|
onClick: k ? () => {
|
|
783
810
|
ie(e.key), A(!1);
|
|
784
811
|
} : () => void 0,
|
|
785
|
-
...k ? { iconAfter: /* @__PURE__ */
|
|
812
|
+
...k ? { iconAfter: /* @__PURE__ */ H(oe, {
|
|
786
813
|
size: u,
|
|
787
814
|
stroke: m,
|
|
788
815
|
style: P,
|
|
789
|
-
className: c("rtl:scale-x-[-1]",
|
|
816
|
+
className: c("rtl:scale-x-[-1]", tt.chevronIcon),
|
|
790
817
|
"aria-hidden": !0
|
|
791
818
|
}) } : {
|
|
792
819
|
children: [{
|
|
@@ -799,7 +826,7 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
799
826
|
...t == null ? [] : [{
|
|
800
827
|
key: "record-voice",
|
|
801
828
|
label: n,
|
|
802
|
-
icon: /* @__PURE__ */
|
|
829
|
+
icon: /* @__PURE__ */ H(ce, {
|
|
803
830
|
size: u,
|
|
804
831
|
"aria-hidden": !0,
|
|
805
832
|
stroke: m
|
|
@@ -811,16 +838,16 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
811
838
|
...x == null ? [] : [{
|
|
812
839
|
key: "chat-settings",
|
|
813
840
|
label: x.menuItemLabel ?? "Chat settings",
|
|
814
|
-
icon: /* @__PURE__ */
|
|
841
|
+
icon: /* @__PURE__ */ H(fe, {
|
|
815
842
|
size: u,
|
|
816
843
|
"aria-hidden": !0,
|
|
817
844
|
stroke: m
|
|
818
845
|
}),
|
|
819
|
-
iconAfter: k ? /* @__PURE__ */
|
|
846
|
+
iconAfter: k ? /* @__PURE__ */ H(oe, {
|
|
820
847
|
size: u,
|
|
821
848
|
stroke: m,
|
|
822
849
|
style: P,
|
|
823
|
-
className: c("rtl:scale-x-[-1]",
|
|
850
|
+
className: c("rtl:scale-x-[-1]", tt.chevronIcon),
|
|
824
851
|
"aria-hidden": !0
|
|
825
852
|
}) : null,
|
|
826
853
|
onClick: () => j(!0)
|
|
@@ -835,20 +862,20 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
835
862
|
k,
|
|
836
863
|
se,
|
|
837
864
|
T,
|
|
838
|
-
|
|
865
|
+
F,
|
|
839
866
|
D,
|
|
840
867
|
P
|
|
841
868
|
]);
|
|
842
|
-
if (
|
|
843
|
-
let
|
|
869
|
+
if (me.length === 0) return null;
|
|
870
|
+
let he = /* @__PURE__ */ H(h, {
|
|
844
871
|
matchReferenceWidth: !1,
|
|
845
872
|
placement: "bottom-start",
|
|
846
873
|
listClassName: _,
|
|
847
|
-
items:
|
|
848
|
-
open:
|
|
849
|
-
onOpenChange:
|
|
850
|
-
children: /* @__PURE__ */
|
|
851
|
-
icon: /* @__PURE__ */
|
|
874
|
+
items: me,
|
|
875
|
+
open: ue ? ae : void 0,
|
|
876
|
+
onOpenChange: ue ? N : void 0,
|
|
877
|
+
children: /* @__PURE__ */ H(v, {
|
|
878
|
+
icon: /* @__PURE__ */ H(de, {
|
|
852
879
|
size: p.LG,
|
|
853
880
|
"aria-hidden": !0,
|
|
854
881
|
stroke: m
|
|
@@ -858,9 +885,9 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
858
885
|
disabled: y
|
|
859
886
|
})
|
|
860
887
|
});
|
|
861
|
-
return /* @__PURE__ */
|
|
862
|
-
/* @__PURE__ */
|
|
863
|
-
icon: /* @__PURE__ */
|
|
888
|
+
return /* @__PURE__ */ H(V, { children: k ? /* @__PURE__ */ U(V, { children: [
|
|
889
|
+
/* @__PURE__ */ H(v, {
|
|
890
|
+
icon: /* @__PURE__ */ H(de, {
|
|
864
891
|
size: p.LG,
|
|
865
892
|
"aria-hidden": !0,
|
|
866
893
|
stroke: m
|
|
@@ -871,31 +898,31 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
871
898
|
disabled: y,
|
|
872
899
|
onClick: () => A(!0)
|
|
873
900
|
}),
|
|
874
|
-
/* @__PURE__ */
|
|
901
|
+
/* @__PURE__ */ H(qe, {
|
|
875
902
|
isOpen: ee,
|
|
876
903
|
title: o,
|
|
877
904
|
closeLabel: d,
|
|
878
905
|
onClose: () => A(!1),
|
|
879
906
|
style: f,
|
|
880
|
-
items:
|
|
907
|
+
items: me,
|
|
881
908
|
className: "pb-4",
|
|
882
909
|
btnTextClassName: "flex-1"
|
|
883
910
|
}),
|
|
884
|
-
se && /* @__PURE__ */
|
|
885
|
-
isOpen:
|
|
911
|
+
se && /* @__PURE__ */ H(et, {
|
|
912
|
+
isOpen: ne,
|
|
886
913
|
onBack: () => {
|
|
887
|
-
|
|
914
|
+
re(!1), A(!0);
|
|
888
915
|
},
|
|
889
916
|
backLabel: E,
|
|
890
|
-
onClose: () =>
|
|
917
|
+
onClose: () => re(!1),
|
|
891
918
|
closeLabel: d,
|
|
892
919
|
style: f,
|
|
893
920
|
title: T,
|
|
894
921
|
items: C,
|
|
895
922
|
onToolToggle: w
|
|
896
923
|
}),
|
|
897
|
-
D?.map((e) => /* @__PURE__ */
|
|
898
|
-
isOpen:
|
|
924
|
+
D?.map((e) => /* @__PURE__ */ H(K, {
|
|
925
|
+
isOpen: M === e.key,
|
|
899
926
|
title: e.title,
|
|
900
927
|
closeLabel: d,
|
|
901
928
|
onBack: () => {
|
|
@@ -906,7 +933,7 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
906
933
|
style: f,
|
|
907
934
|
children: e.renderOverlay(() => ie(null))
|
|
908
935
|
}, e.key)),
|
|
909
|
-
x != null && /* @__PURE__ */
|
|
936
|
+
x != null && /* @__PURE__ */ H(Ze, {
|
|
910
937
|
isOpen: te,
|
|
911
938
|
onBack: () => {
|
|
912
939
|
j(!1), A(!0);
|
|
@@ -933,7 +960,7 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
933
960
|
saveLabel: x.saveLabel,
|
|
934
961
|
saveDisabledTooltip: x.saveDisabledTooltip
|
|
935
962
|
})
|
|
936
|
-
] }) : /* @__PURE__ */
|
|
963
|
+
] }) : /* @__PURE__ */ U(V, { children: [he, x != null && te && /* @__PURE__ */ H(Qe, {
|
|
937
964
|
features: x.features,
|
|
938
965
|
initialResponseFormat: x.responseFormat ?? a.Markdown,
|
|
939
966
|
initialSystemPrompt: x.systemPrompt,
|
|
@@ -953,13 +980,13 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
953
980
|
saveLabel: x.saveLabel,
|
|
954
981
|
saveDisabledTooltip: x.saveDisabledTooltip
|
|
955
982
|
})] }) });
|
|
956
|
-
},
|
|
983
|
+
}, rt = {
|
|
957
984
|
chip: "_chip_ydmd8_1",
|
|
958
985
|
chipSelected: "_chipSelected_ydmd8_9",
|
|
959
986
|
chipIcon: "_chipIcon_ydmd8_16",
|
|
960
987
|
chipText: "_chipText_ydmd8_19",
|
|
961
988
|
chipClose: "_chipClose_ydmd8_22"
|
|
962
|
-
},
|
|
989
|
+
}, it = (e) => `Remove ${e}`, at = ({ items: e, onToolToggle: t, onToolDismiss: n, canRemove: r = !0, removeLabel: i = it, typography: a, colors: o }) => e.length === 0 ? null : /* @__PURE__ */ H("div", {
|
|
963
990
|
className: "flex flex-wrap items-center gap-2",
|
|
964
991
|
style: s({
|
|
965
992
|
"--ci-chip-bg": o?.chipBg,
|
|
@@ -974,34 +1001,34 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
974
1001
|
"--ci-chip-close": o?.chipClose,
|
|
975
1002
|
"--ci-chip-close-hover": o?.chipCloseHover
|
|
976
1003
|
}),
|
|
977
|
-
children: e.map((e) => /* @__PURE__ */
|
|
978
|
-
className: c(
|
|
979
|
-
children: [/* @__PURE__ */
|
|
1004
|
+
children: e.map((e) => /* @__PURE__ */ U("div", {
|
|
1005
|
+
className: c(rt.chip, e.isSelected && rt.chipSelected, "flex min-w-0 items-center gap-1.5 rounded-full border py-1 transition-colors", r ? "pe-1 ps-2" : "px-2"),
|
|
1006
|
+
children: [/* @__PURE__ */ U("button", {
|
|
980
1007
|
type: "button",
|
|
981
1008
|
onClick: () => t(e.id),
|
|
982
1009
|
"aria-pressed": e.isSelected,
|
|
983
1010
|
className: "flex min-w-0 items-center gap-1.5",
|
|
984
|
-
children: [/* @__PURE__ */
|
|
985
|
-
className: c(
|
|
1011
|
+
children: [/* @__PURE__ */ H("span", {
|
|
1012
|
+
className: c(rt.chipIcon, "shrink-0"),
|
|
986
1013
|
"aria-hidden": !0,
|
|
987
1014
|
children: e.icon
|
|
988
|
-
}), /* @__PURE__ */
|
|
989
|
-
className: c(
|
|
1015
|
+
}), /* @__PURE__ */ H("span", {
|
|
1016
|
+
className: c(rt.chipText, a?.fontClassName || "dial-small-paragraph-text", "truncate"),
|
|
990
1017
|
children: e.label
|
|
991
1018
|
})]
|
|
992
|
-
}), r && /* @__PURE__ */
|
|
1019
|
+
}), r && /* @__PURE__ */ H("button", {
|
|
993
1020
|
type: "button",
|
|
994
1021
|
onClick: () => n(e.id),
|
|
995
1022
|
"aria-label": i(e.label),
|
|
996
|
-
className: c(
|
|
997
|
-
children: /* @__PURE__ */
|
|
1023
|
+
className: c(rt.chipClose, "flex shrink-0 items-center rounded p-0.5 transition-colors"),
|
|
1024
|
+
children: /* @__PURE__ */ H(me, {
|
|
998
1025
|
size: 12,
|
|
999
1026
|
"aria-hidden": !0,
|
|
1000
1027
|
stroke: m
|
|
1001
1028
|
})
|
|
1002
1029
|
})]
|
|
1003
1030
|
}, e.id))
|
|
1004
|
-
}),
|
|
1031
|
+
}), J = {
|
|
1005
1032
|
wrapper: "_wrapper_q1jcl_2",
|
|
1006
1033
|
wrapperDisabled: "_wrapperDisabled_q1jcl_9",
|
|
1007
1034
|
textarea: "_textarea_q1jcl_13",
|
|
@@ -1012,34 +1039,34 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1012
1039
|
modelSelectorName: "_modelSelectorName_q1jcl_50",
|
|
1013
1040
|
modelSelectorVersion: "_modelSelectorVersion_q1jcl_53",
|
|
1014
1041
|
modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_q1jcl_62"
|
|
1015
|
-
},
|
|
1042
|
+
}, ot = {
|
|
1016
1043
|
wrapperError: "_wrapperError_129ri_1",
|
|
1017
1044
|
waveformCanvas: "_waveformCanvas_129ri_5",
|
|
1018
1045
|
recordingDot: "_recordingDot_129ri_19",
|
|
1019
1046
|
"recording-pulse": "_recording-pulse_129ri_1"
|
|
1020
|
-
},
|
|
1021
|
-
let h =
|
|
1047
|
+
}, st = 3, ct = 4, lt = 200, ut = ({ state: e, analyserNodeRef: t, errorMessage: n, onStop: r, onDiscard: i, attachButton: a, stopLabel: o = "Stop recording", discardLabel: s = "Discard recording", processingLabel: l = "Transcribing audio…", style: u, className: d, embedded: f = !1 }) => {
|
|
1048
|
+
let h = z(null), g = z(new Float32Array(lt)), y = z(0), b = z(0), x = e === Le.Recording, S = e === Le.Error, C = e === Le.Processing, w = I((e) => {
|
|
1022
1049
|
let t = e.getContext("2d");
|
|
1023
1050
|
if (!t) return;
|
|
1024
1051
|
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
1025
1052
|
let { width: n, height: r } = e;
|
|
1026
1053
|
t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
|
|
1027
|
-
let i = Math.min(Math.max(1, Math.floor(n /
|
|
1054
|
+
let i = Math.min(Math.max(1, Math.floor(n / ct)), lt - 1), a = y.current, o = b.current;
|
|
1028
1055
|
t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
|
|
1029
1056
|
for (let e = 0; e <= i; e++) {
|
|
1030
|
-
let n = ((a - i + e) %
|
|
1031
|
-
t.fillRect(e *
|
|
1057
|
+
let n = ((a - i + e) % lt + lt) % lt, o = g.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
|
|
1058
|
+
t.fillRect(e * ct, (r - c) / 2, st, c);
|
|
1032
1059
|
}
|
|
1033
1060
|
t.restore();
|
|
1034
1061
|
}, []);
|
|
1035
|
-
|
|
1062
|
+
L(() => {
|
|
1036
1063
|
if (!x) return;
|
|
1037
1064
|
let e = h.current;
|
|
1038
1065
|
if (!e) return;
|
|
1039
1066
|
g.current.fill(0), y.current = 0, b.current = 0;
|
|
1040
1067
|
let n, r = () => {
|
|
1041
|
-
if (b.current += 1, b.current >=
|
|
1042
|
-
b.current -=
|
|
1068
|
+
if (b.current += 1, b.current >= ct) {
|
|
1069
|
+
b.current -= ct;
|
|
1043
1070
|
let e = t.current;
|
|
1044
1071
|
if (e) {
|
|
1045
1072
|
let t = new Uint8Array(e.frequencyBinCount);
|
|
@@ -1049,7 +1076,7 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1049
1076
|
let r = (t[e] - 128) / 128;
|
|
1050
1077
|
n += r * r;
|
|
1051
1078
|
}
|
|
1052
|
-
g.current[y.current %
|
|
1079
|
+
g.current[y.current % lt] = Math.sqrt(n / t.length), y.current++;
|
|
1053
1080
|
}
|
|
1054
1081
|
}
|
|
1055
1082
|
w(e), n = requestAnimationFrame(r);
|
|
@@ -1061,7 +1088,7 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1061
1088
|
x,
|
|
1062
1089
|
t,
|
|
1063
1090
|
w
|
|
1064
|
-
]),
|
|
1091
|
+
]), L(() => {
|
|
1065
1092
|
let e = h.current;
|
|
1066
1093
|
if (!e) return;
|
|
1067
1094
|
let t = new ResizeObserver(() => {
|
|
@@ -1069,11 +1096,11 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1069
1096
|
});
|
|
1070
1097
|
return t.observe(e), () => t.disconnect();
|
|
1071
1098
|
}, [w]);
|
|
1072
|
-
let E = /* @__PURE__ */
|
|
1099
|
+
let E = /* @__PURE__ */ U("div", {
|
|
1073
1100
|
className: "flex flex-shrink-0 items-center justify-end gap-1",
|
|
1074
1101
|
children: [
|
|
1075
|
-
/* @__PURE__ */
|
|
1076
|
-
icon: /* @__PURE__ */
|
|
1102
|
+
/* @__PURE__ */ H(v, {
|
|
1103
|
+
icon: /* @__PURE__ */ H(me, {
|
|
1077
1104
|
size: p.LG,
|
|
1078
1105
|
"aria-hidden": !0,
|
|
1079
1106
|
stroke: m
|
|
@@ -1082,8 +1109,8 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1082
1109
|
className: "mobile:min-h-11 mobile:min-w-11",
|
|
1083
1110
|
onClick: i
|
|
1084
1111
|
}),
|
|
1085
|
-
x && /* @__PURE__ */
|
|
1086
|
-
icon: /* @__PURE__ */
|
|
1112
|
+
x && /* @__PURE__ */ H(T, {
|
|
1113
|
+
icon: /* @__PURE__ */ H(ue, {
|
|
1087
1114
|
size: p.LG,
|
|
1088
1115
|
"aria-hidden": !0
|
|
1089
1116
|
}),
|
|
@@ -1092,93 +1119,94 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1092
1119
|
"aria-label": o,
|
|
1093
1120
|
className: "mobile:min-h-11 mobile:min-w-11"
|
|
1094
1121
|
}),
|
|
1095
|
-
C && /* @__PURE__ */
|
|
1122
|
+
C && /* @__PURE__ */ H("span", {
|
|
1096
1123
|
className: "flex size-[40px] flex-shrink-0 items-center justify-center mobile:min-h-11 mobile:min-w-11",
|
|
1097
|
-
children: /* @__PURE__ */
|
|
1124
|
+
children: /* @__PURE__ */ H(te, {
|
|
1098
1125
|
size: 20,
|
|
1099
1126
|
ariaLabel: l
|
|
1100
1127
|
})
|
|
1101
1128
|
})
|
|
1102
1129
|
]
|
|
1103
1130
|
});
|
|
1104
|
-
return /* @__PURE__ */
|
|
1131
|
+
return /* @__PURE__ */ U("div", {
|
|
1105
1132
|
className: d,
|
|
1106
|
-
children: [/* @__PURE__ */
|
|
1133
|
+
children: [/* @__PURE__ */ U("div", {
|
|
1107
1134
|
style: u,
|
|
1108
|
-
className: c("flex w-full min-w-0 flex-col justify-center gap-2", !f &&
|
|
1109
|
-
children: [/* @__PURE__ */
|
|
1135
|
+
className: c("flex w-full min-w-0 flex-col justify-center gap-2", !f && J.wrapper, !f && "min-h-[64px] max-w-[748px] rounded-xl border px-3 shadow-md", S && ot.wrapperError),
|
|
1136
|
+
children: [/* @__PURE__ */ U("div", {
|
|
1110
1137
|
className: "flex min-w-0 flex-1 items-center gap-3",
|
|
1111
|
-
children: [x && /* @__PURE__ */
|
|
1112
|
-
className: c(
|
|
1138
|
+
children: [x && /* @__PURE__ */ H("span", {
|
|
1139
|
+
className: c(ot.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
|
|
1113
1140
|
"aria-hidden": !0
|
|
1114
|
-
}), /* @__PURE__ */
|
|
1141
|
+
}), /* @__PURE__ */ H("canvas", {
|
|
1115
1142
|
ref: h,
|
|
1116
1143
|
height: 26,
|
|
1117
1144
|
"aria-hidden": !0,
|
|
1118
|
-
className: c(
|
|
1145
|
+
className: c(ot.waveformCanvas, "h-[26px] min-w-0 flex-1")
|
|
1119
1146
|
})]
|
|
1120
|
-
}), /* @__PURE__ */
|
|
1147
|
+
}), /* @__PURE__ */ U("div", {
|
|
1121
1148
|
className: "flex items-center justify-between gap-2",
|
|
1122
|
-
children: [a ?? /* @__PURE__ */
|
|
1149
|
+
children: [a ?? /* @__PURE__ */ H("span", { "aria-hidden": !0 }), E]
|
|
1123
1150
|
})]
|
|
1124
|
-
}), S && n && /* @__PURE__ */
|
|
1151
|
+
}), S && n && /* @__PURE__ */ H("div", {
|
|
1125
1152
|
role: "alert",
|
|
1126
|
-
children: /* @__PURE__ */
|
|
1153
|
+
children: /* @__PURE__ */ H(_, {
|
|
1127
1154
|
text: n,
|
|
1128
1155
|
className: "mt-1 px-1"
|
|
1129
1156
|
})
|
|
1130
1157
|
})]
|
|
1131
1158
|
});
|
|
1132
|
-
},
|
|
1159
|
+
}, dt = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", sendTooltip: r }) => /* @__PURE__ */ H(T, {
|
|
1133
1160
|
"aria-label": n,
|
|
1134
1161
|
onClick: () => e?.(),
|
|
1135
1162
|
disabled: t,
|
|
1136
|
-
|
|
1163
|
+
tooltipProps: r ? { tooltip: r } : void 0,
|
|
1164
|
+
icon: /* @__PURE__ */ H(ae, {
|
|
1137
1165
|
size: p.LG,
|
|
1138
1166
|
className: "rtl:scale-x-[-1]",
|
|
1139
1167
|
stroke: m
|
|
1140
1168
|
})
|
|
1141
|
-
}),
|
|
1142
|
-
icon: /* @__PURE__ */
|
|
1169
|
+
}), ft = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ H(j, {
|
|
1170
|
+
icon: /* @__PURE__ */ H(F, {
|
|
1143
1171
|
size: p.LG,
|
|
1144
1172
|
stroke: m
|
|
1145
1173
|
}),
|
|
1146
1174
|
onClick: () => e?.(),
|
|
1147
1175
|
"aria-label": t
|
|
1148
|
-
}),
|
|
1176
|
+
}), pt = ({ size: e = 20 }) => /* @__PURE__ */ H(k, {
|
|
1149
1177
|
variant: ee.Circular,
|
|
1150
1178
|
width: e,
|
|
1151
1179
|
height: e,
|
|
1152
1180
|
active: !0
|
|
1153
|
-
}),
|
|
1181
|
+
}), mt = ({ loadingLabel: e }) => /* @__PURE__ */ U("span", {
|
|
1154
1182
|
className: "flex min-w-0 flex-1 items-center",
|
|
1155
|
-
children: [/* @__PURE__ */
|
|
1183
|
+
children: [/* @__PURE__ */ H(k, {
|
|
1156
1184
|
variant: ee.Text,
|
|
1157
1185
|
width: "100%",
|
|
1158
1186
|
height: 16,
|
|
1159
1187
|
active: !0
|
|
1160
|
-
}), e && /* @__PURE__ */
|
|
1188
|
+
}), e && /* @__PURE__ */ H("span", {
|
|
1161
1189
|
className: "sr-only",
|
|
1162
1190
|
children: e
|
|
1163
1191
|
})]
|
|
1164
|
-
}),
|
|
1192
|
+
}), ht = ({ loadingLabel: e }) => /* @__PURE__ */ H("div", {
|
|
1165
1193
|
role: "status",
|
|
1166
1194
|
"aria-label": e,
|
|
1167
|
-
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */
|
|
1195
|
+
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ U("div", {
|
|
1168
1196
|
className: "flex h-11 items-center gap-3 px-4",
|
|
1169
1197
|
"aria-hidden": "true",
|
|
1170
|
-
children: [/* @__PURE__ */
|
|
1198
|
+
children: [/* @__PURE__ */ H(pt, {}), /* @__PURE__ */ H(mt, {})]
|
|
1171
1199
|
}, t))
|
|
1172
|
-
}),
|
|
1200
|
+
}), gt = (e) => e.displayName ?? e.id, _t = (e, t) => {
|
|
1173
1201
|
let n = t.trim().toLowerCase();
|
|
1174
|
-
return n ? e.filter((e) =>
|
|
1175
|
-
},
|
|
1202
|
+
return n ? e.filter((e) => gt(e).toLowerCase().includes(n)) : e;
|
|
1203
|
+
}, vt = (e, t, r, i = 18, a) => /* @__PURE__ */ H(n, {
|
|
1176
1204
|
src: e,
|
|
1177
1205
|
size: i,
|
|
1178
1206
|
labels: { tooltip: a },
|
|
1179
1207
|
initialsName: r
|
|
1180
|
-
}),
|
|
1181
|
-
let [o, l] =
|
|
1208
|
+
}), yt = { searchHeader: "_searchHeader_1728o_1" }, Y = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, searchHeaderClassName: i = yt.searchHeader, colors: a }) => {
|
|
1209
|
+
let [o, l] = B(""), u = R(() => e?.find((e) => e.id === t), [e, t]), d = r?.loading !== void 0, f = !d && !u && !!t, m = R(() => d ? /* @__PURE__ */ H(pt, { size: p.LG }) : vt(u?.iconUrl, u?.type, u?.displayName ?? u?.id ?? "", p.LG, f ? r?.unavailableTooltip ?? "This deployment is no longer available" : void 0), [
|
|
1182
1210
|
d,
|
|
1183
1211
|
u,
|
|
1184
1212
|
f,
|
|
@@ -1189,11 +1217,11 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1189
1217
|
selectorAriaLabel: h ? `${r?.ariaLabel ?? "Select model"}: ${h}` : r?.ariaLabel ?? "Select model",
|
|
1190
1218
|
selectedLabel: h,
|
|
1191
1219
|
selectedVersion: _,
|
|
1192
|
-
menuItems:
|
|
1220
|
+
menuItems: R(() => {
|
|
1193
1221
|
if (d) return Array.from({ length: 7 }, (e, t) => ({
|
|
1194
1222
|
key: `__loading-${t}`,
|
|
1195
|
-
icon: /* @__PURE__ */
|
|
1196
|
-
label: /* @__PURE__ */
|
|
1223
|
+
icon: /* @__PURE__ */ H(pt, {}),
|
|
1224
|
+
label: /* @__PURE__ */ H(mt, { loadingLabel: t === 0 ? r?.loading : void 0 }),
|
|
1197
1225
|
disabled: !0
|
|
1198
1226
|
}));
|
|
1199
1227
|
if (!e || e.length === 0) {
|
|
@@ -1204,16 +1232,17 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1204
1232
|
disabled: !0
|
|
1205
1233
|
}] : [];
|
|
1206
1234
|
}
|
|
1207
|
-
return
|
|
1235
|
+
return _t(e, o).map((e) => ({
|
|
1208
1236
|
key: e.id,
|
|
1209
|
-
label: /* @__PURE__ */
|
|
1210
|
-
text:
|
|
1237
|
+
label: /* @__PURE__ */ H(y, {
|
|
1238
|
+
text: gt(e),
|
|
1211
1239
|
query: o,
|
|
1212
1240
|
maxLines: 1
|
|
1213
1241
|
}),
|
|
1214
|
-
icon:
|
|
1242
|
+
icon: vt(e.iconUrl, e.type, e.displayName ?? e.id),
|
|
1215
1243
|
mark: b.Check,
|
|
1216
1244
|
checked: e.id === t,
|
|
1245
|
+
className: c(G.modelMenuItem, e.id === t && G.modelMenuItemSelected),
|
|
1217
1246
|
onClick: () => n?.(e.id)
|
|
1218
1247
|
}));
|
|
1219
1248
|
}, [
|
|
@@ -1224,10 +1253,10 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1224
1253
|
r,
|
|
1225
1254
|
n
|
|
1226
1255
|
]),
|
|
1227
|
-
menuHeader:
|
|
1256
|
+
menuHeader: R(() => !d && e && e.length > 0 ? /* @__PURE__ */ H("div", {
|
|
1228
1257
|
style: s({ "--ms-search-header-bg": a?.searchHeaderBackground }),
|
|
1229
|
-
className: c("sticky top-0 z-10 pb-1 pe-2 pt-2", i),
|
|
1230
|
-
children: /* @__PURE__ */
|
|
1258
|
+
className: c("sticky top-0 z-10 pb-1 pe-2 pt-2", i, G.modelMenuSearch),
|
|
1259
|
+
children: /* @__PURE__ */ H(O, {
|
|
1231
1260
|
value: o,
|
|
1232
1261
|
placeholder: r?.searchPlaceholder ?? "Search",
|
|
1233
1262
|
size: g.Small,
|
|
@@ -1246,8 +1275,8 @@ var Se = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
|
|
|
1246
1275
|
e || l("");
|
|
1247
1276
|
}
|
|
1248
1277
|
};
|
|
1249
|
-
},
|
|
1250
|
-
function
|
|
1278
|
+
}, bt = typeof window < "u" ? ve : L;
|
|
1279
|
+
function xt(e) {
|
|
1251
1280
|
if (e !== void 0) switch (typeof e) {
|
|
1252
1281
|
case "number": return e;
|
|
1253
1282
|
case "string":
|
|
@@ -1255,15 +1284,15 @@ function vt(e) {
|
|
|
1255
1284
|
break;
|
|
1256
1285
|
}
|
|
1257
1286
|
}
|
|
1258
|
-
function
|
|
1259
|
-
let { styleHeight: s, styleWidth: c } =
|
|
1260
|
-
styleHeight:
|
|
1261
|
-
styleWidth:
|
|
1262
|
-
}), [o?.height, o?.width]), [l, u] =
|
|
1287
|
+
function St({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
|
|
1288
|
+
let { styleHeight: s, styleWidth: c } = R(() => ({
|
|
1289
|
+
styleHeight: xt(o?.height),
|
|
1290
|
+
styleWidth: xt(o?.width)
|
|
1291
|
+
}), [o?.height, o?.width]), [l, u] = B({
|
|
1263
1292
|
height: t,
|
|
1264
1293
|
width: n
|
|
1265
1294
|
}), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
|
|
1266
|
-
return
|
|
1295
|
+
return bt(() => {
|
|
1267
1296
|
if (i === null || d) return;
|
|
1268
1297
|
let t = new ResizeObserver((e) => {
|
|
1269
1298
|
for (let t of e) {
|
|
@@ -1283,7 +1312,7 @@ function yt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1283
1312
|
i,
|
|
1284
1313
|
s,
|
|
1285
1314
|
c
|
|
1286
|
-
]),
|
|
1315
|
+
]), R(() => ({
|
|
1287
1316
|
height: s ?? l.height,
|
|
1288
1317
|
width: c ?? l.width
|
|
1289
1318
|
}), [
|
|
@@ -1292,26 +1321,26 @@ function yt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1292
1321
|
c
|
|
1293
1322
|
]);
|
|
1294
1323
|
}
|
|
1295
|
-
function
|
|
1296
|
-
let t =
|
|
1324
|
+
function Ct(e) {
|
|
1325
|
+
let t = z(() => {
|
|
1297
1326
|
throw Error("Cannot call during render.");
|
|
1298
1327
|
});
|
|
1299
|
-
return
|
|
1328
|
+
return bt(() => {
|
|
1300
1329
|
t.current = e;
|
|
1301
|
-
}, [e]),
|
|
1330
|
+
}, [e]), I((e) => t.current?.(e), [t]);
|
|
1302
1331
|
}
|
|
1303
|
-
var
|
|
1304
|
-
function
|
|
1305
|
-
if (
|
|
1332
|
+
var wt = null;
|
|
1333
|
+
function Tt(e = !1) {
|
|
1334
|
+
if (wt === null || e) {
|
|
1306
1335
|
let e = document.createElement("div"), t = e.style;
|
|
1307
1336
|
t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
|
|
1308
1337
|
let n = document.createElement("div"), r = n.style;
|
|
1309
|
-
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ?
|
|
1338
|
+
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? wt = "positive-descending" : (e.scrollLeft = 1, wt = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), wt;
|
|
1310
1339
|
}
|
|
1311
|
-
return
|
|
1340
|
+
return wt;
|
|
1312
1341
|
}
|
|
1313
|
-
function
|
|
1314
|
-
if (t === "horizontal" && n) switch (
|
|
1342
|
+
function X({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
1343
|
+
if (t === "horizontal" && n) switch (Tt()) {
|
|
1315
1344
|
case "negative": return -r;
|
|
1316
1345
|
case "positive-descending":
|
|
1317
1346
|
if (e) {
|
|
@@ -1322,26 +1351,26 @@ function xt({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
|
1322
1351
|
}
|
|
1323
1352
|
return r;
|
|
1324
1353
|
}
|
|
1325
|
-
function
|
|
1354
|
+
function Z(e, t = "Assertion error") {
|
|
1326
1355
|
if (!e) throw console.error(t), Error(t);
|
|
1327
1356
|
}
|
|
1328
|
-
function
|
|
1357
|
+
function Q(e, t) {
|
|
1329
1358
|
if (e === t) return !0;
|
|
1330
|
-
if (!!e != !!t || (
|
|
1359
|
+
if (!!e != !!t || (Z(e !== void 0), Z(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
|
|
1331
1360
|
for (let n in e) if (!Object.is(t[n], e[n])) return !1;
|
|
1332
1361
|
return !0;
|
|
1333
1362
|
}
|
|
1334
|
-
function
|
|
1363
|
+
function Et({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
1335
1364
|
if (t === 0) return 0;
|
|
1336
1365
|
if (typeof n == "number") return t * n;
|
|
1337
1366
|
{
|
|
1338
1367
|
let n = e.get(e.size === 0 ? 0 : e.size - 1);
|
|
1339
|
-
return
|
|
1368
|
+
return Z(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
|
|
1340
1369
|
}
|
|
1341
1370
|
}
|
|
1342
|
-
function
|
|
1371
|
+
function Dt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
|
|
1343
1372
|
if (n < 0 || n >= r) throw RangeError(`Invalid index specified: ${n}`, { cause: `Index ${n} is not within the range of 0 - ${r - 1}` });
|
|
1344
|
-
let s =
|
|
1373
|
+
let s = Et({
|
|
1345
1374
|
cachedBounds: t,
|
|
1346
1375
|
itemCount: r,
|
|
1347
1376
|
itemSize: i
|
|
@@ -1353,7 +1382,7 @@ function wt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, co
|
|
|
1353
1382
|
default: return a >= u && a <= l ? a : a < u ? u : l;
|
|
1354
1383
|
}
|
|
1355
1384
|
}
|
|
1356
|
-
function
|
|
1385
|
+
function Ot({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
|
|
1357
1386
|
let a = r - 1, o = 0, s = -1, c = 0, l = -1, u = 0;
|
|
1358
1387
|
for (; u < a;) {
|
|
1359
1388
|
let n = e.get(u);
|
|
@@ -1372,11 +1401,11 @@ function Tt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemC
|
|
|
1372
1401
|
stopIndexOverscan: l
|
|
1373
1402
|
};
|
|
1374
1403
|
}
|
|
1375
|
-
function
|
|
1404
|
+
function kt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1376
1405
|
let r = /* @__PURE__ */ new Map();
|
|
1377
1406
|
return {
|
|
1378
1407
|
get(i) {
|
|
1379
|
-
for (
|
|
1408
|
+
for (Z(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
|
|
1380
1409
|
let e = r.size, a;
|
|
1381
1410
|
switch (typeof n) {
|
|
1382
1411
|
case "function":
|
|
@@ -1392,14 +1421,14 @@ function Et({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1392
1421
|
});
|
|
1393
1422
|
else {
|
|
1394
1423
|
let t = r.get(e - 1);
|
|
1395
|
-
|
|
1424
|
+
Z(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
|
|
1396
1425
|
scrollOffset: t.scrollOffset + t.size,
|
|
1397
1426
|
size: a
|
|
1398
1427
|
});
|
|
1399
1428
|
}
|
|
1400
1429
|
}
|
|
1401
1430
|
let a = r.get(i);
|
|
1402
|
-
return
|
|
1431
|
+
return Z(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
|
|
1403
1432
|
},
|
|
1404
1433
|
set(e, t) {
|
|
1405
1434
|
r.set(e, t);
|
|
@@ -1409,8 +1438,8 @@ function Et({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1409
1438
|
}
|
|
1410
1439
|
};
|
|
1411
1440
|
}
|
|
1412
|
-
function
|
|
1413
|
-
return
|
|
1441
|
+
function At({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1442
|
+
return R(() => kt({
|
|
1414
1443
|
itemCount: e,
|
|
1415
1444
|
itemProps: t,
|
|
1416
1445
|
itemSize: n
|
|
@@ -1420,11 +1449,11 @@ function Dt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1420
1449
|
n
|
|
1421
1450
|
]);
|
|
1422
1451
|
}
|
|
1423
|
-
function
|
|
1452
|
+
function jt({ containerSize: e, itemSize: t }) {
|
|
1424
1453
|
let n;
|
|
1425
1454
|
switch (typeof t) {
|
|
1426
1455
|
case "string":
|
|
1427
|
-
|
|
1456
|
+
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;
|
|
1428
1457
|
break;
|
|
1429
1458
|
default:
|
|
1430
1459
|
n = t;
|
|
@@ -1432,21 +1461,21 @@ function Ot({ containerSize: e, itemSize: t }) {
|
|
|
1432
1461
|
}
|
|
1433
1462
|
return n;
|
|
1434
1463
|
}
|
|
1435
|
-
function
|
|
1436
|
-
let { height: u = n, width: d = n } =
|
|
1464
|
+
function Mt({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
|
|
1465
|
+
let { height: u = n, width: d = n } = St({
|
|
1437
1466
|
defaultHeight: r === "vertical" ? n : void 0,
|
|
1438
1467
|
defaultWidth: r === "horizontal" ? n : void 0,
|
|
1439
1468
|
element: e,
|
|
1440
1469
|
mode: r === "vertical" ? "only-height" : "only-width",
|
|
1441
1470
|
style: t
|
|
1442
|
-
}), f =
|
|
1471
|
+
}), f = z({
|
|
1443
1472
|
height: 0,
|
|
1444
1473
|
width: 0
|
|
1445
|
-
}), p = r === "vertical" ? u : d, m =
|
|
1474
|
+
}), p = r === "vertical" ? u : d, m = jt({
|
|
1446
1475
|
containerSize: p,
|
|
1447
1476
|
itemSize: s
|
|
1448
1477
|
});
|
|
1449
|
-
|
|
1478
|
+
ve(() => {
|
|
1450
1479
|
if (typeof c == "function") {
|
|
1451
1480
|
let e = f.current;
|
|
1452
1481
|
(e.height !== u || e.width !== d) && (c({
|
|
@@ -1459,11 +1488,11 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1459
1488
|
c,
|
|
1460
1489
|
d
|
|
1461
1490
|
]);
|
|
1462
|
-
let h =
|
|
1491
|
+
let h = At({
|
|
1463
1492
|
itemCount: a,
|
|
1464
1493
|
itemProps: o,
|
|
1465
1494
|
itemSize: m
|
|
1466
|
-
}), g =
|
|
1495
|
+
}), g = I((e) => h.get(e), [h]), [_, v] = B(() => Ot({
|
|
1467
1496
|
cachedBounds: h,
|
|
1468
1497
|
containerScrollOffset: 0,
|
|
1469
1498
|
containerSize: p,
|
|
@@ -1474,7 +1503,7 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1474
1503
|
startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
|
|
1475
1504
|
stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
|
|
1476
1505
|
stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
|
|
1477
|
-
}, C =
|
|
1506
|
+
}, C = I(() => Et({
|
|
1478
1507
|
cachedBounds: h,
|
|
1479
1508
|
itemCount: a,
|
|
1480
1509
|
itemSize: m
|
|
@@ -1482,9 +1511,9 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1482
1511
|
h,
|
|
1483
1512
|
a,
|
|
1484
1513
|
m
|
|
1485
|
-
]), w =
|
|
1514
|
+
]), w = I((t) => Ot({
|
|
1486
1515
|
cachedBounds: h,
|
|
1487
|
-
containerScrollOffset:
|
|
1516
|
+
containerScrollOffset: X({
|
|
1488
1517
|
containerElement: e,
|
|
1489
1518
|
direction: r,
|
|
1490
1519
|
isRtl: i,
|
|
@@ -1502,19 +1531,19 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1502
1531
|
a,
|
|
1503
1532
|
l
|
|
1504
1533
|
]);
|
|
1505
|
-
return
|
|
1534
|
+
return bt(() => {
|
|
1506
1535
|
v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
|
|
1507
1536
|
}, [
|
|
1508
1537
|
e,
|
|
1509
1538
|
r,
|
|
1510
1539
|
w
|
|
1511
|
-
]),
|
|
1540
|
+
]), bt(() => {
|
|
1512
1541
|
if (!e) return;
|
|
1513
1542
|
let t = () => {
|
|
1514
1543
|
v((t) => {
|
|
1515
|
-
let { scrollLeft: n, scrollTop: o } = e, s =
|
|
1544
|
+
let { scrollLeft: n, scrollTop: o } = e, s = Ot({
|
|
1516
1545
|
cachedBounds: h,
|
|
1517
|
-
containerScrollOffset:
|
|
1546
|
+
containerScrollOffset: X({
|
|
1518
1547
|
containerElement: e,
|
|
1519
1548
|
direction: r,
|
|
1520
1549
|
isRtl: i,
|
|
@@ -1524,7 +1553,7 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1524
1553
|
itemCount: a,
|
|
1525
1554
|
overscanCount: l
|
|
1526
1555
|
});
|
|
1527
|
-
return
|
|
1556
|
+
return Q(s, t) ? t : s;
|
|
1528
1557
|
});
|
|
1529
1558
|
};
|
|
1530
1559
|
return e.addEventListener("scroll", t), () => {
|
|
@@ -1540,8 +1569,8 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1540
1569
|
]), {
|
|
1541
1570
|
getCellBounds: g,
|
|
1542
1571
|
getEstimatedSize: C,
|
|
1543
|
-
scrollToIndex:
|
|
1544
|
-
let s =
|
|
1572
|
+
scrollToIndex: Ct(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
|
|
1573
|
+
let s = Dt({
|
|
1545
1574
|
align: t,
|
|
1546
1575
|
cachedBounds: h,
|
|
1547
1576
|
containerScrollOffset: n,
|
|
@@ -1551,14 +1580,14 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1551
1580
|
itemSize: m
|
|
1552
1581
|
});
|
|
1553
1582
|
if (e) {
|
|
1554
|
-
if (s =
|
|
1583
|
+
if (s = X({
|
|
1555
1584
|
containerElement: e,
|
|
1556
1585
|
direction: r,
|
|
1557
1586
|
isRtl: i,
|
|
1558
1587
|
scrollOffset: s
|
|
1559
1588
|
}), typeof e.scrollTo != "function") {
|
|
1560
1589
|
let e = w(s);
|
|
1561
|
-
|
|
1590
|
+
Q(_, e) || v(e);
|
|
1562
1591
|
}
|
|
1563
1592
|
return s;
|
|
1564
1593
|
}
|
|
@@ -1569,30 +1598,30 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1569
1598
|
stopIndexVisible: x
|
|
1570
1599
|
};
|
|
1571
1600
|
}
|
|
1572
|
-
function
|
|
1573
|
-
return
|
|
1601
|
+
function Nt(e) {
|
|
1602
|
+
return R(() => e, Object.values(e));
|
|
1574
1603
|
}
|
|
1575
|
-
function
|
|
1604
|
+
function Pt(e, t) {
|
|
1576
1605
|
let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
|
|
1577
|
-
return
|
|
1606
|
+
return Q(n, a) && Q(r, o) && Q(i, s);
|
|
1578
1607
|
}
|
|
1579
|
-
function
|
|
1608
|
+
function Ft(e) {
|
|
1580
1609
|
return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
1581
1610
|
}
|
|
1582
|
-
var
|
|
1583
|
-
function
|
|
1584
|
-
let m =
|
|
1611
|
+
var It = "data-react-window-index";
|
|
1612
|
+
function Lt({ 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 }) {
|
|
1613
|
+
let m = Nt(u), h = R(() => ge(s, Pt), [s]), [g, _] = B(null), v = Ft(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = Mt({
|
|
1585
1614
|
containerElement: g,
|
|
1586
1615
|
containerStyle: f,
|
|
1587
1616
|
defaultContainerSize: n,
|
|
1588
1617
|
direction: "vertical",
|
|
1589
1618
|
itemCount: c,
|
|
1590
1619
|
itemProps: m,
|
|
1591
|
-
itemSize:
|
|
1620
|
+
itemSize: R(() => v ? (e) => l.getRowHeight(e) ?? l.getAverageRowHeight() : l, [v, l]),
|
|
1592
1621
|
onResize: i,
|
|
1593
1622
|
overscanCount: o
|
|
1594
1623
|
});
|
|
1595
|
-
|
|
1624
|
+
_e(r, () => ({
|
|
1596
1625
|
get element() {
|
|
1597
1626
|
return g;
|
|
1598
1627
|
},
|
|
@@ -1607,12 +1636,12 @@ function Pt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1607
1636
|
top: r
|
|
1608
1637
|
});
|
|
1609
1638
|
}
|
|
1610
|
-
}), [g, x]),
|
|
1639
|
+
}), [g, x]), bt(() => {
|
|
1611
1640
|
if (!g) return;
|
|
1612
1641
|
let e = Array.from(g.children).filter((e, t) => {
|
|
1613
1642
|
if (e.hasAttribute("aria-hidden")) return !1;
|
|
1614
1643
|
let n = `${S + t}`;
|
|
1615
|
-
return e.setAttribute(
|
|
1644
|
+
return e.setAttribute(It, n), !0;
|
|
1616
1645
|
});
|
|
1617
1646
|
if (v) return l.observeRowElements(e);
|
|
1618
1647
|
}, [
|
|
@@ -1621,7 +1650,7 @@ function Pt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1621
1650
|
l,
|
|
1622
1651
|
S,
|
|
1623
1652
|
w
|
|
1624
|
-
]),
|
|
1653
|
+
]), L(() => {
|
|
1625
1654
|
S >= 0 && w >= 0 && a && a({
|
|
1626
1655
|
startIndex: C,
|
|
1627
1656
|
stopIndex: T
|
|
@@ -1636,11 +1665,11 @@ function Pt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1636
1665
|
w,
|
|
1637
1666
|
T
|
|
1638
1667
|
]);
|
|
1639
|
-
let E =
|
|
1668
|
+
let E = R(() => {
|
|
1640
1669
|
let e = [];
|
|
1641
1670
|
if (c > 0) for (let t = S; t <= w; t++) {
|
|
1642
1671
|
let n = y(t);
|
|
1643
|
-
e.push(/* @__PURE__ */
|
|
1672
|
+
e.push(/* @__PURE__ */ he(h, {
|
|
1644
1673
|
...m,
|
|
1645
1674
|
ariaAttributes: {
|
|
1646
1675
|
"aria-posinset": t + 1,
|
|
@@ -1667,7 +1696,7 @@ function Pt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1667
1696
|
m,
|
|
1668
1697
|
S,
|
|
1669
1698
|
w
|
|
1670
|
-
]), D = /* @__PURE__ */
|
|
1699
|
+
]), D = /* @__PURE__ */ H("div", {
|
|
1671
1700
|
"aria-hidden": !0,
|
|
1672
1701
|
style: {
|
|
1673
1702
|
height: b(),
|
|
@@ -1675,7 +1704,7 @@ function Pt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1675
1704
|
zIndex: -1
|
|
1676
1705
|
}
|
|
1677
1706
|
});
|
|
1678
|
-
return
|
|
1707
|
+
return he(d, {
|
|
1679
1708
|
role: "list",
|
|
1680
1709
|
...p,
|
|
1681
1710
|
className: t,
|
|
@@ -1689,35 +1718,35 @@ function Pt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1689
1718
|
}
|
|
1690
1719
|
}, E, e, D);
|
|
1691
1720
|
}
|
|
1692
|
-
var
|
|
1721
|
+
var Rt = {
|
|
1693
1722
|
divider: "_divider_1tiyp_1",
|
|
1694
1723
|
item: "_item_1tiyp_5",
|
|
1695
1724
|
itemIcon: "_itemIcon_1tiyp_15",
|
|
1696
1725
|
checkIcon: "_checkIcon_1tiyp_19",
|
|
1697
1726
|
stateLabel: "_stateLabel_1tiyp_23"
|
|
1698
|
-
},
|
|
1699
|
-
let l = r[e], u =
|
|
1700
|
-
return /* @__PURE__ */
|
|
1727
|
+
}, zt = 44, Bt = 8, Vt = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: o, onSelect: s }) => {
|
|
1728
|
+
let l = r[e], u = vt(l.iconUrl, l.type, l.displayName ?? l.id, p.SM), f = l.id === i;
|
|
1729
|
+
return /* @__PURE__ */ H("div", {
|
|
1701
1730
|
style: t,
|
|
1702
1731
|
...n,
|
|
1703
|
-
children: /* @__PURE__ */
|
|
1732
|
+
children: /* @__PURE__ */ H(d, {
|
|
1704
1733
|
type: "button",
|
|
1705
1734
|
"aria-current": f ? "true" : void 0,
|
|
1706
|
-
className: c(
|
|
1707
|
-
iconBefore: /* @__PURE__ */
|
|
1708
|
-
className:
|
|
1735
|
+
className: c(Rt.item, "h-full w-full gap-3 px-4"),
|
|
1736
|
+
iconBefore: /* @__PURE__ */ H("span", {
|
|
1737
|
+
className: Rt.itemIcon,
|
|
1709
1738
|
children: u
|
|
1710
1739
|
}),
|
|
1711
|
-
label: /* @__PURE__ */
|
|
1740
|
+
label: /* @__PURE__ */ U("span", {
|
|
1712
1741
|
className: "flex flex-1 items-center justify-between gap-2",
|
|
1713
|
-
children: [/* @__PURE__ */
|
|
1742
|
+
children: [/* @__PURE__ */ H(y, {
|
|
1714
1743
|
text: l.displayName ?? l.id,
|
|
1715
1744
|
query: o,
|
|
1716
1745
|
maxLines: 1,
|
|
1717
1746
|
className: c(a, "min-w-0 flex-1 text-start")
|
|
1718
|
-
}), f && /* @__PURE__ */
|
|
1747
|
+
}), f && /* @__PURE__ */ H(N, {
|
|
1719
1748
|
size: p.SM,
|
|
1720
|
-
className:
|
|
1749
|
+
className: Rt.checkIcon,
|
|
1721
1750
|
"aria-hidden": !0,
|
|
1722
1751
|
stroke: m
|
|
1723
1752
|
})]
|
|
@@ -1725,12 +1754,12 @@ var Ft = {
|
|
|
1725
1754
|
onClick: () => s(l.id)
|
|
1726
1755
|
})
|
|
1727
1756
|
});
|
|
1728
|
-
},
|
|
1729
|
-
let [v, y] =
|
|
1730
|
-
|
|
1757
|
+
}, Ht = ({ isOpen: e, title: t, closeLabel: n, searchPlaceholder: r = "Search", onClose: i, deployments: a, selectedDeploymentId: o, onSelect: l, loadingLabel: u, errorLabel: d, emptyLabel: f, style: p, titleClassName: m = "dial-body-semi-text", labelClassName: h = "dial-small-text", colors: _ }) => {
|
|
1758
|
+
let [v, y] = B("");
|
|
1759
|
+
L(() => {
|
|
1731
1760
|
e || y("");
|
|
1732
1761
|
}, [e]);
|
|
1733
|
-
let b = a && a.length > 0, x = u !== void 0, S = !b && !x ? d ?? f : void 0, C = b ?
|
|
1762
|
+
let b = a && a.length > 0, x = u !== void 0, S = !b && !x ? d ?? f : void 0, C = b ? _t(a, v) : [], w = (e) => {
|
|
1734
1763
|
l(e), i();
|
|
1735
1764
|
}, T = s({
|
|
1736
1765
|
"--ci-sheet-divider": _?.divider,
|
|
@@ -1740,37 +1769,37 @@ var Ft = {
|
|
|
1740
1769
|
"--ci-sheet-icon": _?.itemIcon,
|
|
1741
1770
|
"--ci-check-icon": _?.checkIcon
|
|
1742
1771
|
});
|
|
1743
|
-
return /* @__PURE__ */
|
|
1772
|
+
return /* @__PURE__ */ H(K, {
|
|
1744
1773
|
isOpen: e,
|
|
1745
1774
|
title: t,
|
|
1746
1775
|
closeLabel: n,
|
|
1747
1776
|
onClose: i,
|
|
1748
1777
|
style: p,
|
|
1749
1778
|
titleClassName: m,
|
|
1750
|
-
className: "max-h-[80dvh]",
|
|
1779
|
+
className: c("max-h-[80dvh]", G.modelMenu),
|
|
1751
1780
|
colors: _?.shell,
|
|
1752
|
-
children: /* @__PURE__ */
|
|
1781
|
+
children: /* @__PURE__ */ U("div", {
|
|
1753
1782
|
className: "contents",
|
|
1754
1783
|
style: T,
|
|
1755
|
-
children: [b && !x && /* @__PURE__ */
|
|
1784
|
+
children: [b && !x && /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("div", {
|
|
1756
1785
|
className: "flex-shrink-0 px-4 py-[10px]",
|
|
1757
|
-
children: /* @__PURE__ */
|
|
1786
|
+
children: /* @__PURE__ */ H(O, {
|
|
1758
1787
|
value: v,
|
|
1759
1788
|
placeholder: r,
|
|
1760
1789
|
size: g.Standard,
|
|
1761
1790
|
onChange: (e) => y(e ?? "")
|
|
1762
1791
|
})
|
|
1763
|
-
}), /* @__PURE__ */
|
|
1792
|
+
}), /* @__PURE__ */ H("div", { className: c(Rt.divider, "h-px flex-shrink-0") })] }), x ? /* @__PURE__ */ H(ht, { loadingLabel: u }) : S ? /* @__PURE__ */ H("div", {
|
|
1764
1793
|
role: "list",
|
|
1765
|
-
className: c(
|
|
1794
|
+
className: c(Rt.stateLabel, h, "px-4 py-4"),
|
|
1766
1795
|
children: S
|
|
1767
|
-
}) : /* @__PURE__ */
|
|
1796
|
+
}) : /* @__PURE__ */ H(Lt, {
|
|
1768
1797
|
role: "list",
|
|
1769
1798
|
className: "overflow-y-auto",
|
|
1770
|
-
style: { height: Math.min(C.length,
|
|
1771
|
-
rowComponent:
|
|
1799
|
+
style: { height: Math.min(C.length, Bt) * zt },
|
|
1800
|
+
rowComponent: Vt,
|
|
1772
1801
|
rowCount: C.length,
|
|
1773
|
-
rowHeight:
|
|
1802
|
+
rowHeight: zt,
|
|
1774
1803
|
rowProps: {
|
|
1775
1804
|
items: C,
|
|
1776
1805
|
selectedDeploymentId: o,
|
|
@@ -1781,24 +1810,24 @@ var Ft = {
|
|
|
1781
1810
|
})]
|
|
1782
1811
|
})
|
|
1783
1812
|
});
|
|
1784
|
-
},
|
|
1785
|
-
let [_, y] =
|
|
1813
|
+
}, Ut = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, isStreaming: i, isMobile: a, isDisabled: s = !1, style: l, modelPickerOverlay: u, isPickerOpen: d, onPickerToggle: f, onPickerOpenChange: g }) => {
|
|
1814
|
+
let [_, y] = B(!1), { selectorIcon: b, selectorAriaLabel: x, selectedLabel: S, selectedVersion: C, menuItems: w, menuHeader: T, onOpenChange: E } = Y({
|
|
1786
1815
|
deployments: e,
|
|
1787
1816
|
selectedDeploymentId: t,
|
|
1788
1817
|
onDeploymentChange: n,
|
|
1789
1818
|
modelSelectorLabels: r
|
|
1790
1819
|
});
|
|
1791
1820
|
if (!e) return null;
|
|
1792
|
-
let D = i || s ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, O = /* @__PURE__ */
|
|
1821
|
+
let D = i || s ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, O = /* @__PURE__ */ H(P, {
|
|
1793
1822
|
size: p.SM,
|
|
1794
|
-
className:
|
|
1823
|
+
className: J.modelSelectorCaret,
|
|
1795
1824
|
"aria-hidden": !0,
|
|
1796
1825
|
stroke: m
|
|
1797
1826
|
});
|
|
1798
|
-
|
|
1827
|
+
if (a) return /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H(M, {
|
|
1799
1828
|
tooltip: S,
|
|
1800
|
-
children: /* @__PURE__ */
|
|
1801
|
-
icon: /* @__PURE__ */
|
|
1829
|
+
children: /* @__PURE__ */ H(v, {
|
|
1830
|
+
icon: /* @__PURE__ */ U("div", {
|
|
1802
1831
|
className: "flex items-center gap-1",
|
|
1803
1832
|
children: [b, O]
|
|
1804
1833
|
}),
|
|
@@ -1806,16 +1835,17 @@ var Ft = {
|
|
|
1806
1835
|
onClick: () => {
|
|
1807
1836
|
s || y(!0);
|
|
1808
1837
|
},
|
|
1809
|
-
className: c("w-[50px]",
|
|
1838
|
+
className: c("w-[50px]", J.modelSelectorButton, D, G.modelSelectorButton)
|
|
1810
1839
|
})
|
|
1811
|
-
}), u ? /* @__PURE__ */
|
|
1840
|
+
}), u ? /* @__PURE__ */ H(K, {
|
|
1812
1841
|
isOpen: _,
|
|
1813
1842
|
title: r?.ariaLabel ?? "Select model",
|
|
1814
1843
|
closeLabel: r?.closeLabel ?? "Close",
|
|
1815
1844
|
onClose: () => y(!1),
|
|
1816
1845
|
style: l,
|
|
1846
|
+
className: G.modelMenu,
|
|
1817
1847
|
children: u(() => y(!1))
|
|
1818
|
-
}) : /* @__PURE__ */
|
|
1848
|
+
}) : /* @__PURE__ */ H(Ht, {
|
|
1819
1849
|
isOpen: _,
|
|
1820
1850
|
title: r?.ariaLabel ?? "Select model",
|
|
1821
1851
|
closeLabel: r?.closeLabel ?? "Close",
|
|
@@ -1828,67 +1858,72 @@ var Ft = {
|
|
|
1828
1858
|
errorLabel: r?.error,
|
|
1829
1859
|
emptyLabel: r?.empty,
|
|
1830
1860
|
style: l
|
|
1831
|
-
})] })
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1861
|
+
})] });
|
|
1862
|
+
if (u) {
|
|
1863
|
+
let e = C ? `${S} · ${C}` : S;
|
|
1864
|
+
return /* @__PURE__ */ H(h, {
|
|
1865
|
+
placement: "top-end",
|
|
1866
|
+
matchReferenceWidth: !1,
|
|
1867
|
+
open: d,
|
|
1868
|
+
onOpenChange: g,
|
|
1869
|
+
trigger: [],
|
|
1870
|
+
outsideClosable: !0,
|
|
1871
|
+
renderOverlay: () => u(() => g?.(!1)),
|
|
1872
|
+
listClassName: c("!w-[368px] !bg-layer-raised", G.modelMenu),
|
|
1873
|
+
children: /* @__PURE__ */ H(M, {
|
|
1874
|
+
tooltip: e,
|
|
1875
|
+
children: /* @__PURE__ */ U("button", {
|
|
1876
|
+
type: "button",
|
|
1877
|
+
"aria-label": x,
|
|
1878
|
+
"aria-disabled": s || void 0,
|
|
1879
|
+
className: c("flex min-w-0 items-center gap-1.5 rounded-full py-1.5 pe-2 ps-1.5", J.modelSelectorButton, D, s && J.modelSelectorButtonDisabled, G.modelSelectorButton),
|
|
1880
|
+
onClick: () => {
|
|
1881
|
+
!i && !s && f?.();
|
|
1882
|
+
},
|
|
1883
|
+
children: [
|
|
1884
|
+
b,
|
|
1885
|
+
/* @__PURE__ */ U("span", {
|
|
1886
|
+
className: "flex min-w-0 max-w-[180px] items-baseline gap-1",
|
|
1887
|
+
children: [/* @__PURE__ */ H("span", {
|
|
1888
|
+
className: c("dial-small-text max-w-[180px] shrink-0 truncate", J.modelSelectorName),
|
|
1889
|
+
children: S
|
|
1890
|
+
}), C && /* @__PURE__ */ H("span", {
|
|
1891
|
+
className: c("dial-tiny-text min-w-0 truncate", J.modelSelectorVersion),
|
|
1892
|
+
children: C
|
|
1893
|
+
})]
|
|
1894
|
+
}),
|
|
1895
|
+
O
|
|
1896
|
+
]
|
|
1897
|
+
})
|
|
1864
1898
|
})
|
|
1865
|
-
})
|
|
1866
|
-
}
|
|
1899
|
+
});
|
|
1900
|
+
}
|
|
1901
|
+
return /* @__PURE__ */ H("div", {
|
|
1867
1902
|
className: c(s && D),
|
|
1868
1903
|
"aria-disabled": s || void 0,
|
|
1869
|
-
children: /* @__PURE__ */
|
|
1904
|
+
children: /* @__PURE__ */ H(h, {
|
|
1870
1905
|
items: w,
|
|
1871
1906
|
menuHeader: T,
|
|
1872
1907
|
placement: "bottom-end",
|
|
1873
1908
|
matchReferenceWidth: !1,
|
|
1874
1909
|
maxDropdownHeight: o,
|
|
1875
|
-
listClassName: "!w-[240px]",
|
|
1910
|
+
listClassName: c("!w-[240px]", G.modelMenu),
|
|
1876
1911
|
disabled: s,
|
|
1877
1912
|
onOpenChange: s ? void 0 : E,
|
|
1878
|
-
children: /* @__PURE__ */
|
|
1913
|
+
children: /* @__PURE__ */ H(M, {
|
|
1879
1914
|
tooltip: S,
|
|
1880
|
-
children: /* @__PURE__ */
|
|
1915
|
+
children: /* @__PURE__ */ U("button", {
|
|
1881
1916
|
type: "button",
|
|
1882
1917
|
"aria-label": x,
|
|
1883
1918
|
"aria-disabled": s || void 0,
|
|
1884
|
-
className: c("flex items-center gap-1 rounded-full p-1.5",
|
|
1919
|
+
className: c("flex items-center gap-1 rounded-full p-1.5", J.modelSelectorButton, s && J.modelSelectorButtonDisabled, G.modelSelectorButton),
|
|
1885
1920
|
children: [b, O]
|
|
1886
1921
|
})
|
|
1887
1922
|
})
|
|
1888
1923
|
})
|
|
1889
1924
|
});
|
|
1890
|
-
},
|
|
1891
|
-
let
|
|
1925
|
+
}, Wt = ({ message: e = "", messageRevision: t, textInsertion: n, onSend: r, onUploadAttachment: i, onStop: a, isStreaming: o = !1, onChange: d, onAttachmentsChange: f, placeholder: g = "Type a message...", ariaLabel: y, attachLabel: b = "Attach file", fileAccept: x, addMenuTitle: S = "Add", menuTitle: C = "Menu", menuCloseLabel: w = "Close", removeLabel: T, retryLabel: E, uploadingLabel: D, sendLabel: O, sendTooltip: k, emptyMessageTooltip: ee, stopLabel: A, micLabel: te = "Dictate", recordVoiceLabel: j = "Record voice", stopRecordingLabel: ne, discardRecordingLabel: re, colors: M, typography: ie, className: ae, pendingDropFiles: N = [], onDropFilesConsumed: P, pendingAttachments: oe = [], onPendingAttachmentsConsumed: le, pasteTextThreshold: ue = 4e3, maxMessageLength: F = 5e4, deployments: de, selectedDeploymentId: fe, onDeploymentChange: pe, modelSelectorLabels: me, initialAttachments: he = [], hideAddButton: ge = !1, hideAttachFile: _e = !1, hideActionBar: ve = !1, actionRowLayout: ye = Ge.Stacked, renderFooterActions: xe, isInputDisabled: W = !1, isModelSelectorDisabled: Ce = !1, isSendDisabled: we = !1, isAudioMessageSupported: Te = !1, isVoiceRecordingSupported: K = Te, onTranscribeAudio: Ee, transcribingLabel: Oe, voiceErrorLabel: Ae, sendOnEnter: je = We.Enter, prefixAttachments: Pe = [], onRemovePrefixAttachment: Fe, chatSettings: ze, toolsMenuItems: Be, onToolToggle: Ve, canRemoveTools: He = !0, toolsMenuTitle: Ke, toolsBackLabel: qe, toolsChipLabels: Je, menuOverlays: Ye, inlineStartSlot: Xe, onInlineStartRemove: Ze, commandMenu: q, autoFocus: Qe = !1, messageHistory: $e, onDialFileSystemClick: et, dialFileSystemLabel: tt, validateAttachment: rt, onAttachmentClick: it, modelPickerOverlay: ot, maximumAttachmentsAmount: st, onAttachmentsLimitExceeded: ct, isAttachmentsEnabled: lt = !0, isTextAttachmentsAllowed: pt = !0, usageLimitsSlot: mt, onMessageTooLong: ht }) => {
|
|
1926
|
+
let gt = l(), [_t, vt] = B(!1), yt = Me($e), Y = Xe != null, [bt, xt] = B(null), [St, Ct] = B(0), wt = R(() => s({
|
|
1892
1927
|
"--ci-bg": M?.background,
|
|
1893
1928
|
"--ci-text": M?.text,
|
|
1894
1929
|
"--ci-border": M?.border,
|
|
@@ -1903,386 +1938,389 @@ var Ft = {
|
|
|
1903
1938
|
"--ci-voice-error": M?.voiceError,
|
|
1904
1939
|
"--ci-voice-waveform": M?.voiceWaveform,
|
|
1905
1940
|
"--ci-voice-accent": M?.voiceAccent,
|
|
1906
|
-
"--ci-first-line-indent": Y ? `calc(${
|
|
1941
|
+
"--ci-first-line-indent": Y ? `calc(${St}px + 4px)` : void 0
|
|
1907
1942
|
}), [
|
|
1908
1943
|
M,
|
|
1909
1944
|
Y,
|
|
1910
|
-
|
|
1911
|
-
]),
|
|
1945
|
+
St
|
|
1946
|
+
]), Tt = R(() => et ? [{
|
|
1912
1947
|
key: "dial-fs",
|
|
1913
|
-
label:
|
|
1914
|
-
icon: /* @__PURE__ */
|
|
1948
|
+
label: tt ?? "DIAL file system",
|
|
1949
|
+
icon: /* @__PURE__ */ H(se, {
|
|
1915
1950
|
size: u,
|
|
1916
1951
|
"aria-hidden": !0,
|
|
1917
1952
|
stroke: m
|
|
1918
1953
|
}),
|
|
1919
|
-
onClick:
|
|
1920
|
-
}] : [], [
|
|
1954
|
+
onClick: et
|
|
1955
|
+
}] : [], [et, tt]), { message: X, setMessage: Z, textareaRef: Q } = Ne({
|
|
1921
1956
|
messageProp: e,
|
|
1922
1957
|
messageRevision: t
|
|
1923
|
-
})
|
|
1924
|
-
Fe({
|
|
1958
|
+
}), { handleUndoKeyDown: Et } = Ie({
|
|
1925
1959
|
insertion: n,
|
|
1926
|
-
textareaRef:
|
|
1927
|
-
})
|
|
1928
|
-
|
|
1929
|
-
config: K,
|
|
1960
|
+
textareaRef: Q
|
|
1961
|
+
}), { isMenuOpen: Dt, query: Ot, dismiss: kt, handleValueChange: At } = ke({
|
|
1962
|
+
config: q,
|
|
1930
1963
|
message: X
|
|
1931
|
-
}),
|
|
1932
|
-
if (
|
|
1933
|
-
|
|
1934
|
-
let t = `${
|
|
1964
|
+
}), jt = q?.emptyQueryHint != null, Mt = jt && Dt && Ot === "", Nt = I((e) => {
|
|
1965
|
+
if (q == null || (kt(), !e?.consumeQuery)) return;
|
|
1966
|
+
Q.current?.focus();
|
|
1967
|
+
let t = `${q.triggerPrefix}${Ot}`;
|
|
1935
1968
|
if (!X.startsWith(t)) return;
|
|
1936
1969
|
let n = X.slice(t.length);
|
|
1937
|
-
Z(n),
|
|
1970
|
+
Z(n), yt.notifyChange(), d?.(n);
|
|
1938
1971
|
}, [
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1972
|
+
q,
|
|
1973
|
+
kt,
|
|
1974
|
+
Ot,
|
|
1942
1975
|
X,
|
|
1943
1976
|
Z,
|
|
1944
|
-
|
|
1977
|
+
yt,
|
|
1945
1978
|
d,
|
|
1946
|
-
|
|
1979
|
+
Q
|
|
1947
1980
|
]);
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
let t = new ResizeObserver((e) => {
|
|
1981
|
+
L(() => {
|
|
1982
|
+
if (bt == null) return;
|
|
1983
|
+
let e = new ResizeObserver((e) => {
|
|
1952
1984
|
let t = e[0];
|
|
1953
|
-
t != null &&
|
|
1985
|
+
t != null && Ct(t.contentRect.width);
|
|
1954
1986
|
});
|
|
1955
|
-
return
|
|
1956
|
-
}, [
|
|
1957
|
-
let { attachments:
|
|
1958
|
-
initialAttachments:
|
|
1987
|
+
return e.observe(bt), () => e.disconnect();
|
|
1988
|
+
}, [bt]);
|
|
1989
|
+
let { attachments: Pt, buildAttachments: Ft, addAttachments: It, resetAttachments: Lt, handleRemove: Rt, handleRetry: zt, handleExpand: Bt, hasBlockedAttachments: Vt } = De({
|
|
1990
|
+
initialAttachments: he,
|
|
1959
1991
|
onUploadAttachment: i,
|
|
1960
1992
|
onAttachmentsChange: f,
|
|
1961
|
-
validateAttachment:
|
|
1962
|
-
pendingDropFiles:
|
|
1963
|
-
onDropFilesConsumed:
|
|
1964
|
-
pendingAttachments:
|
|
1965
|
-
onPendingAttachmentsConsumed:
|
|
1966
|
-
onExpandPastedText:
|
|
1993
|
+
validateAttachment: rt,
|
|
1994
|
+
pendingDropFiles: N,
|
|
1995
|
+
onDropFilesConsumed: P,
|
|
1996
|
+
pendingAttachments: oe,
|
|
1997
|
+
onPendingAttachmentsConsumed: le,
|
|
1998
|
+
onExpandPastedText: I((e) => {
|
|
1967
1999
|
Z((t) => t ? `${t}\n${e}` : e);
|
|
1968
2000
|
}, [Z]),
|
|
1969
|
-
maximumAttachmentsAmount:
|
|
1970
|
-
baseAttachmentsAmount:
|
|
1971
|
-
onAttachmentsLimitExceeded:
|
|
1972
|
-
}),
|
|
1973
|
-
|
|
1974
|
-
}, [
|
|
1975
|
-
|
|
1976
|
-
let [
|
|
2001
|
+
maximumAttachmentsAmount: st,
|
|
2002
|
+
baseAttachmentsAmount: Pe.length,
|
|
2003
|
+
onAttachmentsLimitExceeded: ct
|
|
2004
|
+
}), Ht = I((e) => {
|
|
2005
|
+
It(Ft([e]));
|
|
2006
|
+
}, [It, Ft]), Wt = z(!1), Gt = z(X);
|
|
2007
|
+
Gt.current = X;
|
|
2008
|
+
let [Kt, qt] = B({
|
|
1977
2009
|
text: "",
|
|
1978
2010
|
revision: 0
|
|
1979
|
-
}), { state:
|
|
1980
|
-
onAttachAudio:
|
|
1981
|
-
onTranscribeAudio:
|
|
1982
|
-
onTranscript:
|
|
2011
|
+
}), { state: Jt, analyserNodeRef: Yt, errorMessage: Xt, startRecording: Zt, stopRecording: Qt, discardRecording: $t } = Ue({
|
|
2012
|
+
onAttachAudio: Ht,
|
|
2013
|
+
onTranscribeAudio: Ee,
|
|
2014
|
+
onTranscript: I((e) => {
|
|
1983
2015
|
let t = e.trim();
|
|
1984
2016
|
if (t) {
|
|
1985
|
-
let e =
|
|
1986
|
-
|
|
2017
|
+
let e = Gt.current, n = `${e}${e && !/\s$/.test(e) ? " " : ""}${t}`;
|
|
2018
|
+
Gt.current = n, Z(n), qt((e) => ({
|
|
1987
2019
|
text: t,
|
|
1988
2020
|
revision: e.revision + 1
|
|
1989
|
-
})),
|
|
2021
|
+
})), yt.notifyChange(), d?.(n);
|
|
1990
2022
|
}
|
|
1991
|
-
|
|
2023
|
+
Wt.current = !0;
|
|
1992
2024
|
}, [
|
|
1993
2025
|
Z,
|
|
1994
|
-
|
|
2026
|
+
yt,
|
|
1995
2027
|
d
|
|
1996
2028
|
]),
|
|
1997
|
-
errorLabel:
|
|
1998
|
-
}),
|
|
1999
|
-
|
|
2000
|
-
(
|
|
2001
|
-
}, [
|
|
2002
|
-
let
|
|
2003
|
-
if (!
|
|
2029
|
+
errorLabel: Ae
|
|
2030
|
+
}), $ = Jt === Le.Recording || Jt === Le.Processing;
|
|
2031
|
+
L(() => {
|
|
2032
|
+
(Jt === Le.Error || Jt === Le.Idle && Wt.current) && (Wt.current = !1, Q.current?.focus());
|
|
2033
|
+
}, [Jt, Q]);
|
|
2034
|
+
let en = z(null), tn = z(null), nn = lt && pt, { handlePaste: rn } = Se(It, nn ? ue : Infinity), an = I((e) => {
|
|
2035
|
+
if (!nn) {
|
|
2004
2036
|
let t = e.clipboardData.getData("text/plain");
|
|
2005
|
-
t.length >= F &&
|
|
2037
|
+
t.length >= F && ht?.(t.length, F);
|
|
2006
2038
|
}
|
|
2007
|
-
|
|
2039
|
+
rn(e);
|
|
2008
2040
|
}, [
|
|
2009
|
-
|
|
2041
|
+
nn,
|
|
2010
2042
|
F,
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
]),
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
}, [(
|
|
2017
|
-
let
|
|
2018
|
-
let e =
|
|
2019
|
-
return
|
|
2043
|
+
ht,
|
|
2044
|
+
rn
|
|
2045
|
+
]), on = X.trim().length > 0 || Pt.length > 0 || Y, sn = on && !Vt && !we && !$, [cn, ln] = B([]);
|
|
2046
|
+
L(() => {
|
|
2047
|
+
ln([]);
|
|
2048
|
+
}, [(Be ?? []).map((e) => e.id).join("|")]);
|
|
2049
|
+
let un = R(() => {
|
|
2050
|
+
let e = Be ?? [];
|
|
2051
|
+
return He ? e.filter((e) => e.isSelected || !cn.includes(e.id)) : e;
|
|
2020
2052
|
}, [
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
]),
|
|
2025
|
-
|
|
2026
|
-
}, [
|
|
2027
|
-
if (
|
|
2053
|
+
Be,
|
|
2054
|
+
cn,
|
|
2055
|
+
He
|
|
2056
|
+
]), dn = I((e) => {
|
|
2057
|
+
ln((t) => t.includes(e) ? t : [...t, e]), Be?.find((t) => t.id === e)?.isSelected && Ve?.(e);
|
|
2058
|
+
}, [Be, Ve]), fn = de === void 0 || fe != null, pn = Te && !o, mn = async () => {
|
|
2059
|
+
if (we || $) return;
|
|
2028
2060
|
if (X.length >= F) {
|
|
2029
|
-
|
|
2061
|
+
ht?.(X.length, F);
|
|
2030
2062
|
return;
|
|
2031
2063
|
}
|
|
2032
|
-
let e = X, t =
|
|
2033
|
-
Z(""),
|
|
2064
|
+
let e = X, t = Pt;
|
|
2065
|
+
Z(""), yt.reset();
|
|
2034
2066
|
try {
|
|
2035
2067
|
await r?.(e, t), t.forEach((e) => {
|
|
2036
2068
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
2037
|
-
}),
|
|
2069
|
+
}), Lt([]);
|
|
2038
2070
|
} catch {
|
|
2039
|
-
Z(e),
|
|
2071
|
+
Z(e), Lt(t);
|
|
2040
2072
|
}
|
|
2041
|
-
},
|
|
2042
|
-
if (!
|
|
2043
|
-
if (!e.nativeEvent.isComposing && !
|
|
2073
|
+
}, hn = (e) => {
|
|
2074
|
+
if (!$ && !Et(e)) {
|
|
2075
|
+
if (!e.nativeEvent.isComposing && !W && !o) {
|
|
2044
2076
|
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
2045
|
-
let t = e.currentTarget.selectionStart ?? 0, n =
|
|
2077
|
+
let t = e.currentTarget.selectionStart ?? 0, n = yt.navigate(e.key === "ArrowUp" ? "up" : "down", X, t);
|
|
2046
2078
|
if (n !== null) {
|
|
2047
2079
|
e.preventDefault(), Z(n);
|
|
2048
2080
|
return;
|
|
2049
2081
|
}
|
|
2050
2082
|
}
|
|
2051
|
-
if (e.key === "Backspace" && Y &&
|
|
2052
|
-
e.preventDefault(),
|
|
2083
|
+
if (e.key === "Backspace" && Y && Ze != null && e.currentTarget.selectionStart === 0 && e.currentTarget.selectionEnd === 0) {
|
|
2084
|
+
e.preventDefault(), Ze();
|
|
2053
2085
|
return;
|
|
2054
2086
|
}
|
|
2055
2087
|
}
|
|
2056
|
-
e.key === "Enter" && (
|
|
2088
|
+
e.key === "Enter" && (je === We.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey) && (e.preventDefault(), !o && sn && fn && !W && mn());
|
|
2057
2089
|
}
|
|
2058
|
-
},
|
|
2090
|
+
}, gn = (e) => {
|
|
2059
2091
|
let t = Array.from(e.target.files ?? []);
|
|
2060
2092
|
if (t.length === 0) return;
|
|
2061
|
-
let n =
|
|
2062
|
-
e.target.value = "",
|
|
2063
|
-
},
|
|
2064
|
-
className: c(
|
|
2065
|
-
ref:
|
|
2066
|
-
autoFocus:
|
|
2093
|
+
let n = Ft(t);
|
|
2094
|
+
e.target.value = "", It(n);
|
|
2095
|
+
}, _n = /* @__PURE__ */ H("textarea", {
|
|
2096
|
+
className: c(J.textarea, Y && J.textareaIndented, ie?.fontClassName || "dial-body-paragraph-text", "max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent outline-none [field-sizing:content]", "disabled:cursor-not-allowed"),
|
|
2097
|
+
ref: Q,
|
|
2098
|
+
autoFocus: Qe,
|
|
2067
2099
|
value: X,
|
|
2068
2100
|
onChange: (e) => {
|
|
2069
|
-
Z(e.target.value),
|
|
2101
|
+
Z(e.target.value), yt.notifyChange();
|
|
2070
2102
|
let t = e.nativeEvent instanceof InputEvent ? e.nativeEvent : void 0;
|
|
2071
|
-
|
|
2103
|
+
At(e.target.value, t?.isComposing ?? !1, t?.inputType), d?.(e.target.value);
|
|
2072
2104
|
},
|
|
2073
|
-
onKeyDown:
|
|
2074
|
-
onPaste:
|
|
2105
|
+
onKeyDown: hn,
|
|
2106
|
+
onPaste: an,
|
|
2075
2107
|
placeholder: Y ? void 0 : g,
|
|
2076
2108
|
"aria-label": y,
|
|
2077
|
-
disabled:
|
|
2078
|
-
readOnly:
|
|
2109
|
+
disabled: W,
|
|
2110
|
+
readOnly: $,
|
|
2079
2111
|
rows: 1
|
|
2080
|
-
}),
|
|
2112
|
+
}), vn = q == null ? _n : /* @__PURE__ */ H(h, {
|
|
2081
2113
|
className: "w-full",
|
|
2082
|
-
open:
|
|
2114
|
+
open: Dt,
|
|
2083
2115
|
onOpenChange: (e) => {
|
|
2084
|
-
e ||
|
|
2116
|
+
e || kt();
|
|
2085
2117
|
},
|
|
2086
2118
|
placement: "top-start",
|
|
2087
2119
|
trigger: [],
|
|
2088
2120
|
initialFocus: -1,
|
|
2089
2121
|
matchReferenceWidth: !1,
|
|
2090
|
-
outsidePressIgnoreRef:
|
|
2122
|
+
outsidePressIgnoreRef: Q,
|
|
2091
2123
|
renderOverlay: () => {
|
|
2092
|
-
let e =
|
|
2093
|
-
query:
|
|
2094
|
-
close:
|
|
2124
|
+
let e = q.renderMenu({
|
|
2125
|
+
query: Ot,
|
|
2126
|
+
close: Nt
|
|
2095
2127
|
});
|
|
2096
|
-
return
|
|
2128
|
+
return q.menuLabel == null ? e : /* @__PURE__ */ H("div", {
|
|
2097
2129
|
role: "group",
|
|
2098
|
-
"aria-label":
|
|
2130
|
+
"aria-label": q.menuLabel,
|
|
2099
2131
|
children: e
|
|
2100
2132
|
});
|
|
2101
2133
|
},
|
|
2102
|
-
children:
|
|
2103
|
-
}),
|
|
2134
|
+
children: _n
|
|
2135
|
+
}), yn = Y || jt ? /* @__PURE__ */ U("div", {
|
|
2104
2136
|
className: "relative w-full",
|
|
2105
2137
|
children: [
|
|
2106
|
-
Y && /* @__PURE__ */
|
|
2107
|
-
ref:
|
|
2138
|
+
Y && /* @__PURE__ */ H("div", {
|
|
2139
|
+
ref: xt,
|
|
2108
2140
|
className: "absolute start-0 top-0",
|
|
2109
|
-
children:
|
|
2141
|
+
children: Xe
|
|
2110
2142
|
}),
|
|
2111
|
-
|
|
2112
|
-
className: c(
|
|
2143
|
+
Mt && q != null && /* @__PURE__ */ U("span", {
|
|
2144
|
+
className: c(J.commandHint, "pointer-events-none absolute start-[var(--ci-first-line-indent,0px)] top-0", ie?.fontClassName || "dial-body-paragraph-text"),
|
|
2113
2145
|
"aria-hidden": !0,
|
|
2114
|
-
children: [/* @__PURE__ */
|
|
2146
|
+
children: [/* @__PURE__ */ H("span", {
|
|
2115
2147
|
className: "invisible",
|
|
2116
|
-
children:
|
|
2117
|
-
}),
|
|
2148
|
+
children: q.triggerPrefix
|
|
2149
|
+
}), q.emptyQueryHint]
|
|
2118
2150
|
}),
|
|
2119
|
-
|
|
2151
|
+
vn
|
|
2120
2152
|
]
|
|
2121
|
-
}) :
|
|
2122
|
-
onAttachClick:
|
|
2153
|
+
}) : vn, bn = ge ? void 0 : /* @__PURE__ */ H(nt, {
|
|
2154
|
+
onAttachClick: _e ? void 0 : () => en.current?.click(),
|
|
2123
2155
|
attachLabel: b,
|
|
2124
2156
|
addMenuTitle: S,
|
|
2125
2157
|
menuTitle: C,
|
|
2126
2158
|
menuCloseLabel: w,
|
|
2127
|
-
style:
|
|
2128
|
-
isDisabled:
|
|
2129
|
-
chatSettings:
|
|
2130
|
-
extraMenuItems:
|
|
2131
|
-
onRecordVoice:
|
|
2132
|
-
recordVoiceLabel:
|
|
2133
|
-
toolsMenuItems:
|
|
2134
|
-
onToolToggle:
|
|
2135
|
-
toolsMenuTitle:
|
|
2136
|
-
toolsBackLabel:
|
|
2137
|
-
menuOverlays:
|
|
2159
|
+
style: wt,
|
|
2160
|
+
isDisabled: W || $,
|
|
2161
|
+
chatSettings: ze,
|
|
2162
|
+
extraMenuItems: Tt,
|
|
2163
|
+
onRecordVoice: K && lt && !o && !$ ? () => Zt(Re.Attachment) : void 0,
|
|
2164
|
+
recordVoiceLabel: j,
|
|
2165
|
+
toolsMenuItems: He ? Be : void 0,
|
|
2166
|
+
onToolToggle: Ve,
|
|
2167
|
+
toolsMenuTitle: Ke,
|
|
2168
|
+
toolsBackLabel: qe,
|
|
2169
|
+
menuOverlays: Ye
|
|
2170
|
+
}), xn = ye === Ge.Inline && !gt, Sn = bn && /* @__PURE__ */ H("div", {
|
|
2171
|
+
className: c("flex", G.addCluster),
|
|
2172
|
+
children: bn
|
|
2173
|
+
}), Cn = un.length > 0 && Ve != null && /* @__PURE__ */ H("div", {
|
|
2174
|
+
className: c("min-w-0 flex-1", G.toolsChips),
|
|
2175
|
+
children: /* @__PURE__ */ H(at, {
|
|
2176
|
+
items: un,
|
|
2177
|
+
onToolToggle: Ve,
|
|
2178
|
+
onToolDismiss: dn,
|
|
2179
|
+
canRemove: He,
|
|
2180
|
+
removeLabel: Je?.removeLabel
|
|
2181
|
+
})
|
|
2138
2182
|
});
|
|
2139
|
-
return /* @__PURE__ */
|
|
2140
|
-
ref:
|
|
2141
|
-
style:
|
|
2142
|
-
className: c(
|
|
2183
|
+
return /* @__PURE__ */ U("div", {
|
|
2184
|
+
ref: tn,
|
|
2185
|
+
style: wt,
|
|
2186
|
+
className: c(J.wrapper, W && J.wrapperDisabled, W && "cursor-not-allowed", "flex w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border", "focus-within:outline focus-within:-outline-offset-1 active:outline active:-outline-offset-1", Pt.length > 6 ? "py-4 ps-4" : "p-4", ae, G.wrapper),
|
|
2143
2187
|
children: [
|
|
2144
|
-
(
|
|
2145
|
-
attachments: [...
|
|
2188
|
+
(Pe.length > 0 || Pt.length > 0) && /* @__PURE__ */ H(be, {
|
|
2189
|
+
attachments: [...Pe, ...Pt],
|
|
2146
2190
|
onRemove: (e) => {
|
|
2147
|
-
|
|
2191
|
+
Pe.some((t) => t.id === e) ? Fe?.(e) : Rt(e);
|
|
2148
2192
|
},
|
|
2149
|
-
onRetry:
|
|
2150
|
-
onExpand:
|
|
2193
|
+
onRetry: zt,
|
|
2194
|
+
onExpand: Bt,
|
|
2151
2195
|
labels: {
|
|
2152
2196
|
removeLabel: T,
|
|
2153
2197
|
retryLabel: E,
|
|
2154
2198
|
uploadingLabel: D
|
|
2155
2199
|
},
|
|
2156
|
-
onAttachmentClick:
|
|
2157
|
-
let t = [...
|
|
2158
|
-
t != null &&
|
|
2200
|
+
onAttachmentClick: it == null ? void 0 : (e) => {
|
|
2201
|
+
let t = [...Pe, ...Pt].find((t) => t.id === e);
|
|
2202
|
+
t != null && it(t);
|
|
2159
2203
|
}
|
|
2160
2204
|
}),
|
|
2161
|
-
!
|
|
2162
|
-
ref:
|
|
2205
|
+
!ge && /* @__PURE__ */ H("input", {
|
|
2206
|
+
ref: en,
|
|
2163
2207
|
type: "file",
|
|
2164
2208
|
multiple: !0,
|
|
2165
2209
|
accept: x,
|
|
2166
2210
|
className: "sr-only",
|
|
2167
2211
|
"aria-hidden": !0,
|
|
2168
2212
|
tabIndex: -1,
|
|
2169
|
-
onChange:
|
|
2213
|
+
onChange: gn
|
|
2170
2214
|
}),
|
|
2171
|
-
|
|
2172
|
-
text:
|
|
2215
|
+
Xt && /* @__PURE__ */ H(_, {
|
|
2216
|
+
text: Xt,
|
|
2173
2217
|
className: "min-w-0 break-words px-1"
|
|
2174
2218
|
}),
|
|
2175
|
-
|
|
2219
|
+
$ && /* @__PURE__ */ H(ut, {
|
|
2176
2220
|
embedded: !0,
|
|
2177
|
-
state:
|
|
2178
|
-
analyserNodeRef:
|
|
2179
|
-
errorMessage:
|
|
2180
|
-
onStop:
|
|
2181
|
-
onDiscard:
|
|
2182
|
-
attachButton:
|
|
2183
|
-
stopLabel:
|
|
2184
|
-
discardLabel:
|
|
2185
|
-
processingLabel:
|
|
2221
|
+
state: Jt,
|
|
2222
|
+
analyserNodeRef: Yt,
|
|
2223
|
+
errorMessage: Xt,
|
|
2224
|
+
onStop: Qt,
|
|
2225
|
+
onDiscard: $t,
|
|
2226
|
+
attachButton: bn,
|
|
2227
|
+
stopLabel: ne,
|
|
2228
|
+
discardLabel: re,
|
|
2229
|
+
processingLabel: Oe
|
|
2186
2230
|
}),
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
className: "flex
|
|
2231
|
+
!$ && ve && yn,
|
|
2232
|
+
!$ && !ve && xn && Cn && /* @__PURE__ */ H("div", {
|
|
2233
|
+
className: "flex",
|
|
2234
|
+
children: Cn
|
|
2235
|
+
}),
|
|
2236
|
+
!$ && !ve && /* @__PURE__ */ U("div", {
|
|
2237
|
+
className: c("flex items-center gap-2", xn ? "flex-nowrap" : "flex-wrap", G.actionRow),
|
|
2190
2238
|
children: [
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
fn && /* @__PURE__ */ W("div", {
|
|
2196
|
-
className: "flex",
|
|
2197
|
-
children: fn
|
|
2198
|
-
}),
|
|
2199
|
-
tn.length > 0 && Re != null && /* @__PURE__ */ W("div", {
|
|
2200
|
-
className: "min-w-0 flex-1",
|
|
2201
|
-
children: /* @__PURE__ */ W(rt, {
|
|
2202
|
-
items: tn,
|
|
2203
|
-
onToolToggle: Re,
|
|
2204
|
-
onToolDismiss: nn,
|
|
2205
|
-
canRemove: ze,
|
|
2206
|
-
removeLabel: We?.removeLabel
|
|
2207
|
-
})
|
|
2239
|
+
xn && Sn,
|
|
2240
|
+
/* @__PURE__ */ H("div", {
|
|
2241
|
+
className: c("flex min-w-0 items-center self-stretch", xn ? "flex-1" : "w-full", G.textareaWrap),
|
|
2242
|
+
children: yn
|
|
2208
2243
|
}),
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2244
|
+
!xn && Sn,
|
|
2245
|
+
!xn && Cn,
|
|
2246
|
+
/* @__PURE__ */ H("div", {
|
|
2247
|
+
className: c("ms-auto flex flex-shrink-0 items-center gap-2", G.footerActions),
|
|
2248
|
+
children: xe ? xe({
|
|
2249
|
+
canSend: sn,
|
|
2250
|
+
onSend: mn
|
|
2251
|
+
}) : /* @__PURE__ */ U(V, { children: [
|
|
2252
|
+
mt,
|
|
2253
|
+
/* @__PURE__ */ H(Ut, {
|
|
2254
|
+
deployments: de,
|
|
2255
|
+
selectedDeploymentId: fe,
|
|
2256
|
+
onDeploymentChange: pe,
|
|
2257
|
+
modelSelectorLabels: me,
|
|
2221
2258
|
isStreaming: o,
|
|
2222
|
-
isMobile:
|
|
2223
|
-
isDisabled:
|
|
2224
|
-
style:
|
|
2225
|
-
modelPickerOverlay:
|
|
2226
|
-
isPickerOpen:
|
|
2227
|
-
onPickerToggle: () =>
|
|
2228
|
-
onPickerOpenChange:
|
|
2259
|
+
isMobile: gt,
|
|
2260
|
+
isDisabled: Ce,
|
|
2261
|
+
style: wt,
|
|
2262
|
+
modelPickerOverlay: ot,
|
|
2263
|
+
isPickerOpen: _t,
|
|
2264
|
+
onPickerToggle: () => vt((e) => !e),
|
|
2265
|
+
onPickerOpenChange: vt
|
|
2229
2266
|
}),
|
|
2230
|
-
|
|
2231
|
-
icon: /* @__PURE__ */
|
|
2267
|
+
pn && /* @__PURE__ */ H(v, {
|
|
2268
|
+
icon: /* @__PURE__ */ H(ce, {
|
|
2232
2269
|
size: p.LG,
|
|
2233
2270
|
stroke: m,
|
|
2234
2271
|
"aria-hidden": !0
|
|
2235
2272
|
}),
|
|
2236
|
-
"aria-label":
|
|
2237
|
-
tooltipProps: { tooltip:
|
|
2273
|
+
"aria-label": te,
|
|
2274
|
+
tooltipProps: { tooltip: te },
|
|
2238
2275
|
className: "size-[40px] flex-shrink-0 mobile:min-h-11 mobile:min-w-11",
|
|
2239
|
-
onClick: () =>
|
|
2240
|
-
disabled:
|
|
2276
|
+
onClick: () => Zt(Re.Dictation),
|
|
2277
|
+
disabled: W || o
|
|
2241
2278
|
}),
|
|
2242
|
-
o && a ? /* @__PURE__ */
|
|
2279
|
+
o && a ? /* @__PURE__ */ H(ft, {
|
|
2243
2280
|
onStop: a,
|
|
2244
|
-
ariaLabel:
|
|
2245
|
-
}) : !o && /* @__PURE__ */
|
|
2246
|
-
onSend:
|
|
2247
|
-
isDisabled: !
|
|
2248
|
-
ariaLabel: O
|
|
2281
|
+
ariaLabel: A
|
|
2282
|
+
}) : !o && /* @__PURE__ */ H(dt, {
|
|
2283
|
+
onSend: mn,
|
|
2284
|
+
isDisabled: !fn || !sn,
|
|
2285
|
+
ariaLabel: O,
|
|
2286
|
+
sendTooltip: on ? k : ee ?? k
|
|
2249
2287
|
})
|
|
2250
2288
|
] })
|
|
2251
2289
|
})
|
|
2252
2290
|
]
|
|
2253
2291
|
}),
|
|
2254
|
-
/* @__PURE__ */
|
|
2292
|
+
/* @__PURE__ */ H("span", {
|
|
2255
2293
|
className: "sr-only",
|
|
2256
2294
|
role: "status",
|
|
2257
2295
|
"aria-live": "polite",
|
|
2258
2296
|
"aria-atomic": "true",
|
|
2259
|
-
children: /* @__PURE__ */
|
|
2297
|
+
children: /* @__PURE__ */ H("span", { children: Kt.text }, Kt.revision)
|
|
2260
2298
|
})
|
|
2261
2299
|
]
|
|
2262
2300
|
});
|
|
2263
|
-
},
|
|
2301
|
+
}, Gt = {
|
|
2264
2302
|
welcome: "_welcome_1icyo_1",
|
|
2265
2303
|
description: "_description_1icyo_5"
|
|
2266
|
-
},
|
|
2304
|
+
}, Kt = ({ isStreaming: e = !1, placeholder: t = "Type a prompt or use \"/\" to select one", welcomeText: n, descriptionText: r, styles: i, className: a, inputClassName: o, isInputDisabled: l = !1, ...u }) => {
|
|
2267
2305
|
let { colors: d, typography: f } = i ?? {};
|
|
2268
|
-
return /* @__PURE__ */
|
|
2306
|
+
return /* @__PURE__ */ U("div", {
|
|
2269
2307
|
style: s({
|
|
2270
2308
|
"--ci-welcome-color": d?.welcomeText,
|
|
2271
2309
|
"--ci-description-color": d?.descriptionText
|
|
2272
2310
|
}),
|
|
2273
2311
|
className: c("relative flex w-full flex-col items-center gap-9 px-4 py-5 desktop:p-5", a),
|
|
2274
|
-
children: [n && /* @__PURE__ */
|
|
2312
|
+
children: [n && /* @__PURE__ */ U("div", {
|
|
2275
2313
|
className: "flex flex-col items-center gap-4 text-center",
|
|
2276
|
-
children: [/* @__PURE__ */
|
|
2277
|
-
className: c(
|
|
2314
|
+
children: [/* @__PURE__ */ H("h1", {
|
|
2315
|
+
className: c(Gt.welcome, "m-0", f?.welcomeClassName || "dial-display2-text"),
|
|
2278
2316
|
children: n
|
|
2279
|
-
}), r && /* @__PURE__ */
|
|
2280
|
-
className: c(
|
|
2317
|
+
}), r && /* @__PURE__ */ H("p", {
|
|
2318
|
+
className: c(Gt.description, "m-0 max-w-[540px]", f?.descriptionClassName || "dial-body-paragraph-text"),
|
|
2281
2319
|
children: r
|
|
2282
2320
|
})]
|
|
2283
|
-
}), /* @__PURE__ */
|
|
2321
|
+
}), /* @__PURE__ */ H("div", {
|
|
2284
2322
|
className: c("relative w-full", n ? "max-w-[700px]" : "max-w-[748px]"),
|
|
2285
|
-
children: /* @__PURE__ */
|
|
2323
|
+
children: /* @__PURE__ */ H(Wt, {
|
|
2286
2324
|
placeholder: t,
|
|
2287
2325
|
isStreaming: e,
|
|
2288
2326
|
isInputDisabled: l,
|
|
@@ -2293,72 +2331,72 @@ var Ft = {
|
|
|
2293
2331
|
})
|
|
2294
2332
|
})]
|
|
2295
2333
|
});
|
|
2296
|
-
},
|
|
2297
|
-
let oe =
|
|
2298
|
-
|
|
2299
|
-
C?.length && (
|
|
2334
|
+
}, qt = ({ message: e, inlineStartSlot: t, onInlineStartRemove: n, initialAttachments: r = [], onCancel: a, onSave: o, onUploadAttachment: s, cancelLabel: l = "Cancel", saveLabel: d = "Save & Submit", ariaLabel: f, removeLabel: p, retryLabel: h, uploadingLabel: g, addMenuTitle: _ = "Add", attachLabel: v = "Attach file", menuTitle: y = "Menu", menuCloseLabel: b = "Close", className: S, pendingDropFiles: C, onDropFilesConsumed: T, validateAttachment: E, isAttachmentsEnabled: D, isTextAttachmentsAllowed: O, hideAttachFile: k = !1, fileAccept: ee, maximumAttachmentsAmount: A, onAttachmentsLimitExceeded: te, onDialFileSystemClick: j, dialFileSystemLabel: ne, pendingAttachments: re, onPendingAttachmentsConsumed: M, onAttachmentClick: ie, pasteTextThreshold: ae, maxMessageLength: N = 5e4, onMessageTooLong: P }) => {
|
|
2335
|
+
let oe = z(null), [ce, le] = B([]);
|
|
2336
|
+
L(() => {
|
|
2337
|
+
C?.length && (le(C), T?.());
|
|
2300
2338
|
}, [C, T]);
|
|
2301
|
-
let [
|
|
2302
|
-
|
|
2303
|
-
},
|
|
2304
|
-
o(e,
|
|
2305
|
-
}, [
|
|
2306
|
-
if (
|
|
2307
|
-
if (
|
|
2308
|
-
P?.(
|
|
2339
|
+
let [ue, F] = B(e ?? ""), [de, fe] = B([]), [pe, me] = B(r), he = de.some((e) => e.status === i.Loading || e.status === i.Error), ge = (ue.trim().length > 0 || de.length > 0 || pe.length > 0) && !he, _e = (e) => {
|
|
2340
|
+
me((t) => t.filter((t) => t.id !== e));
|
|
2341
|
+
}, ve = I((e, t) => {
|
|
2342
|
+
o(e, pe, t);
|
|
2343
|
+
}, [pe, o]), ye = () => {
|
|
2344
|
+
if (ge) {
|
|
2345
|
+
if (ue.length >= N) {
|
|
2346
|
+
P?.(ue.length, N);
|
|
2309
2347
|
return;
|
|
2310
2348
|
}
|
|
2311
|
-
|
|
2349
|
+
ve(ue, de);
|
|
2312
2350
|
}
|
|
2313
|
-
},
|
|
2351
|
+
}, be = I(() => le([]), []), xe = I((e) => {
|
|
2314
2352
|
let t = Array.from(e.target.files ?? []);
|
|
2315
|
-
t.length !== 0 && (e.target.value = "",
|
|
2316
|
-
}, []),
|
|
2353
|
+
t.length !== 0 && (e.target.value = "", le(t));
|
|
2354
|
+
}, []), W = R(() => j ? [{
|
|
2317
2355
|
key: "dial-fs",
|
|
2318
|
-
label:
|
|
2319
|
-
icon: /* @__PURE__ */
|
|
2356
|
+
label: ne ?? "DIAL file system",
|
|
2357
|
+
icon: /* @__PURE__ */ H(se, {
|
|
2320
2358
|
size: u,
|
|
2321
2359
|
"aria-hidden": !0,
|
|
2322
2360
|
stroke: m
|
|
2323
2361
|
}),
|
|
2324
2362
|
onClick: j
|
|
2325
|
-
}] : [], [j,
|
|
2326
|
-
return /* @__PURE__ */
|
|
2363
|
+
}] : [], [j, ne]);
|
|
2364
|
+
return /* @__PURE__ */ U("div", {
|
|
2327
2365
|
className: c("flex w-full flex-col gap-2", S),
|
|
2328
|
-
children: [/* @__PURE__ */
|
|
2366
|
+
children: [/* @__PURE__ */ H(Wt, {
|
|
2329
2367
|
message: e,
|
|
2330
2368
|
inlineStartSlot: t,
|
|
2331
2369
|
onInlineStartRemove: n,
|
|
2332
2370
|
ariaLabel: f,
|
|
2333
2371
|
hideActionBar: !0,
|
|
2334
2372
|
pendingDropFiles: ce,
|
|
2335
|
-
onDropFilesConsumed:
|
|
2336
|
-
onSend:
|
|
2373
|
+
onDropFilesConsumed: be,
|
|
2374
|
+
onSend: ve,
|
|
2337
2375
|
onUploadAttachment: s,
|
|
2338
|
-
onChange:
|
|
2339
|
-
onAttachmentsChange:
|
|
2376
|
+
onChange: F,
|
|
2377
|
+
onAttachmentsChange: fe,
|
|
2340
2378
|
removeLabel: p,
|
|
2341
2379
|
retryLabel: h,
|
|
2342
2380
|
uploadingLabel: g,
|
|
2343
2381
|
className: "max-w-full",
|
|
2344
|
-
prefixAttachments:
|
|
2345
|
-
onRemovePrefixAttachment:
|
|
2382
|
+
prefixAttachments: pe,
|
|
2383
|
+
onRemovePrefixAttachment: _e,
|
|
2346
2384
|
validateAttachment: E,
|
|
2347
2385
|
isAttachmentsEnabled: D,
|
|
2348
2386
|
isTextAttachmentsAllowed: O,
|
|
2349
2387
|
maximumAttachmentsAmount: A,
|
|
2350
2388
|
onAttachmentsLimitExceeded: te,
|
|
2351
|
-
pendingAttachments:
|
|
2352
|
-
onPendingAttachmentsConsumed:
|
|
2389
|
+
pendingAttachments: re,
|
|
2390
|
+
onPendingAttachmentsConsumed: M,
|
|
2353
2391
|
onAttachmentClick: ie,
|
|
2354
2392
|
pasteTextThreshold: ae,
|
|
2355
2393
|
maxMessageLength: N,
|
|
2356
2394
|
onMessageTooLong: P
|
|
2357
|
-
}), /* @__PURE__ */
|
|
2395
|
+
}), /* @__PURE__ */ U("div", {
|
|
2358
2396
|
className: "flex items-center justify-between",
|
|
2359
|
-
children: [/* @__PURE__ */
|
|
2397
|
+
children: [/* @__PURE__ */ H("div", {
|
|
2360
2398
|
className: "flex",
|
|
2361
|
-
children: !k && /* @__PURE__ */
|
|
2399
|
+
children: !k && /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("input", {
|
|
2362
2400
|
ref: oe,
|
|
2363
2401
|
type: "file",
|
|
2364
2402
|
multiple: !0,
|
|
@@ -2366,28 +2404,28 @@ var Ft = {
|
|
|
2366
2404
|
className: "sr-only",
|
|
2367
2405
|
"aria-hidden": !0,
|
|
2368
2406
|
tabIndex: -1,
|
|
2369
|
-
onChange:
|
|
2370
|
-
}), /* @__PURE__ */
|
|
2407
|
+
onChange: xe
|
|
2408
|
+
}), /* @__PURE__ */ H(nt, {
|
|
2371
2409
|
onAttachClick: () => oe.current?.click(),
|
|
2372
2410
|
attachLabel: v,
|
|
2373
2411
|
addMenuTitle: _,
|
|
2374
2412
|
menuTitle: y,
|
|
2375
2413
|
menuCloseLabel: b,
|
|
2376
|
-
extraMenuItems:
|
|
2414
|
+
extraMenuItems: W
|
|
2377
2415
|
})] })
|
|
2378
|
-
}), /* @__PURE__ */
|
|
2416
|
+
}), /* @__PURE__ */ U("div", {
|
|
2379
2417
|
className: "flex gap-2",
|
|
2380
|
-
children: [/* @__PURE__ */
|
|
2418
|
+
children: [/* @__PURE__ */ H(x, {
|
|
2381
2419
|
label: l,
|
|
2382
2420
|
onClick: a
|
|
2383
|
-
}), /* @__PURE__ */
|
|
2421
|
+
}), /* @__PURE__ */ H(w, {
|
|
2384
2422
|
label: d,
|
|
2385
|
-
onClick:
|
|
2386
|
-
disabled: !
|
|
2423
|
+
onClick: ye,
|
|
2424
|
+
disabled: !ge
|
|
2387
2425
|
})]
|
|
2388
2426
|
})]
|
|
2389
2427
|
})]
|
|
2390
2428
|
});
|
|
2391
2429
|
};
|
|
2392
2430
|
//#endregion
|
|
2393
|
-
export {
|
|
2431
|
+
export { Ge as ActionRowLayout, K as BottomSheetShell, G as CONVERSATION_INPUT_CLASS, Qe as ChatSettingsModal, Kt as ConversationInput, qt as EditMessageInput, Wt as Input, We as SendOnEnter };
|