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