@epam/ai-dial-conversation-input 1.3.0-dev.343 → 1.3.0-dev.348
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/Input/Input.d.ts.map +1 -1
- package/components/Input/InputAttachButton.d.ts +45 -0
- package/components/Input/InputAttachButton.d.ts.map +1 -0
- package/components/Input/InputCommandMenuArea.d.ts +48 -0
- package/components/Input/InputCommandMenuArea.d.ts.map +1 -0
- package/components/Input/InputTextareaArea.d.ts +22 -0
- package/components/Input/InputTextareaArea.d.ts.map +1 -0
- package/components/Input/hooks/useCommandMenuAnchor.d.ts +36 -0
- package/components/Input/hooks/useCommandMenuAnchor.d.ts.map +1 -0
- package/components/Input/hooks/useCommandMenuController.d.ts +49 -0
- package/components/Input/hooks/useCommandMenuController.d.ts.map +1 -0
- package/components/Input/hooks/useDismissibleTools.d.ts +18 -0
- package/components/Input/hooks/useDismissibleTools.d.ts.map +1 -0
- package/components/Input/hooks/usePasteHandling.d.ts +21 -0
- package/components/Input/hooks/usePasteHandling.d.ts.map +1 -0
- package/components/Input/hooks/useSendKeyboard.d.ts +41 -0
- package/components/Input/hooks/useSendKeyboard.d.ts.map +1 -0
- package/components/Input/hooks/useVoiceInput.d.ts +39 -0
- package/components/Input/hooks/useVoiceInput.d.ts.map +1 -0
- package/components/Input/input-css-vars.d.ts +8 -0
- package/components/Input/input-css-vars.d.ts.map +1 -0
- package/index.css +1 -1
- package/index.js +1711 -1535
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AttachmentErrorReason as e, AttachmentType as t, DeploymentIcon as n, MIME_TYPE_EXT_MAP as r, RESIZABLE_TEXTAREA_CLASS_NAME as i, RequestStatus as a, ResponseFormat as o, SELECT_LIST_MAX_HEIGHT_PX as s, buildCssVars as c, mergeClasses as l, normalizeMimeType as u, useIsMobile as d, useIsPhone as f } from "@epam/ai-dial-chat-shared";
|
|
2
|
-
import { BASE_ICON_SIZE as p, BottomSheet as m, Button as h, ButtonVariant as g, CloseButton as _, DIAL_ICON_SIZE as v, DIAL_KIT_ICON_STROKE as y, Dropdown as b, DropdownOverlayRole as x, ElementSize as S, ErrorText as C, GhostIconButton as w, Highlight as T, LiveRegion as E, LiveRegionElement as D, LiveRegionPoliteness as O, MenuItem as k, MenuItemMark as
|
|
3
|
-
import { Fragment as
|
|
4
|
-
import { AttachmentTray as
|
|
5
|
-
import { IconArrowNarrowRight as
|
|
6
|
-
import { Fragment as
|
|
2
|
+
import { BASE_ICON_SIZE as p, BottomSheet as m, Button as h, ButtonVariant as g, CloseButton as _, DIAL_ICON_SIZE as v, DIAL_KIT_ICON_STROKE as y, Dropdown as b, DropdownOverlayRole as x, ElementSize as S, ErrorText as C, GhostIconButton as w, Highlight as T, LiveRegion as E, LiveRegionElement as D, LiveRegionPoliteness as O, MenuItem as k, MenuItemMark as A, NeutralButton as j, NeutralIconButton as M, Notification as N, NotificationType as P, NotificationVariant as ee, Popup as F, PopupSize as I, PrimaryButton as L, PrimaryIconButton as R, RadioGroup as z, RadioGroupOrientation as B, Search as V, Skeleton as te, SkeletonVariant as ne, Slider as re, Spinner as ie, Textarea as ae, TextareaResize as oe, ToggleChip as se, Tooltip as ce } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { Fragment as le, jsx as H, jsxs as U } from "react/jsx-runtime";
|
|
4
|
+
import { AttachmentTray as ue, MAX_UPLOADS_PER_MINUTE as de, generateAttachmentId as fe, useClipboardPaste as pe } from "@epam/ai-dial-attachment-input";
|
|
5
|
+
import { IconArrowNarrowRight as me, IconCheck as he, IconChevronDown as ge, IconChevronRight as _e, IconFile as ve, IconMicrophone as ye, IconPaperclip as be, IconPlayerStop as xe, IconPlus as Se, IconSettings as Ce, IconTool as we, IconX as Te } from "@tabler/icons-react";
|
|
6
|
+
import { Fragment as Ee, createElement as De, forwardRef as Oe, memo as ke, useCallback as W, useEffect as G, useId as Ae, useImperativeHandle as je, useLayoutEffect as Me, useMemo as K, useRef as q, useState as J, useSyncExternalStore as Ne } from "react";
|
|
7
7
|
//#region src/constants/public-class-names.ts
|
|
8
|
-
var
|
|
8
|
+
var Y = {
|
|
9
9
|
wrapper: "dial-ci-wrapper",
|
|
10
10
|
actionRow: "dial-ci-action-row",
|
|
11
11
|
textareaWrap: "dial-ci-textarea-wrap",
|
|
@@ -20,19 +20,19 @@ var q = {
|
|
|
20
20
|
modelMenuItem: "dial-ci-model-menu-item",
|
|
21
21
|
modelMenuItemSelected: "dial-ci-model-menu-item-selected",
|
|
22
22
|
usageBanner: "dial-ci-usage-banner"
|
|
23
|
-
},
|
|
23
|
+
}, Pe = {
|
|
24
24
|
backdrop: "_backdrop_1ym62_8",
|
|
25
25
|
sheet: "_sheet_1ym62_12",
|
|
26
26
|
title: "_title_1ym62_16",
|
|
27
27
|
divider: "_divider_1ym62_20"
|
|
28
|
-
},
|
|
28
|
+
}, Fe = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: a, "aria-label": o, style: s, titleClassName: u = "dial-body-semi-text", className: d, colors: f, portalId: p, overlayClassName: h, overlayStyle: g, children: _ }) => {
|
|
29
29
|
let v = c({
|
|
30
30
|
"--ci-backdrop": f?.backdrop,
|
|
31
31
|
"--ci-sheet-bg": f?.sheetBg,
|
|
32
32
|
"--ci-sheet-text": f?.sheetText,
|
|
33
33
|
"--ci-sheet-divider": f?.divider
|
|
34
34
|
});
|
|
35
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ H(m, {
|
|
36
36
|
open: e,
|
|
37
37
|
onClose: r,
|
|
38
38
|
title: t,
|
|
@@ -48,30 +48,30 @@ var q = {
|
|
|
48
48
|
...v,
|
|
49
49
|
...g
|
|
50
50
|
},
|
|
51
|
-
className: l(
|
|
52
|
-
overlayClassName: l(
|
|
51
|
+
className: l(Pe.sheet, d),
|
|
52
|
+
overlayClassName: l(Pe.backdrop, h),
|
|
53
53
|
portalId: p,
|
|
54
|
-
headerClassName:
|
|
55
|
-
titleClassName: l(
|
|
54
|
+
headerClassName: Pe.divider,
|
|
55
|
+
titleClassName: l(Pe.title, u),
|
|
56
56
|
children: _
|
|
57
57
|
});
|
|
58
|
-
},
|
|
58
|
+
}, Ie = async (e, t, n) => {
|
|
59
59
|
let r = 6e4 / t, i = [];
|
|
60
60
|
for (let t = 0; t < e.length; t++) t > 0 && await new Promise((e) => setTimeout(e, r)), i.push(n(e[t]));
|
|
61
61
|
await Promise.allSettled(i);
|
|
62
|
-
},
|
|
63
|
-
let [g, _] =
|
|
64
|
-
|
|
62
|
+
}, Le = ({ initialAttachments: n, onUploadAttachment: r, onAttachmentsChange: i, validateAttachment: o, pendingDropFiles: s, onDropFilesConsumed: c, isDropDisabled: l = !1, pendingAttachments: u, onPendingAttachmentsConsumed: d, onExpandPastedText: f, maximumAttachmentsAmount: p, baseAttachmentsAmount: m = 0, onAttachmentsLimitExceeded: h }) => {
|
|
63
|
+
let [g, _] = J(n), v = q(g);
|
|
64
|
+
G(() => {
|
|
65
65
|
v.current = g;
|
|
66
|
-
}, [g]),
|
|
66
|
+
}, [g]), G(() => () => {
|
|
67
67
|
v.current.forEach((e) => {
|
|
68
68
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
69
69
|
});
|
|
70
70
|
}, []);
|
|
71
|
-
let y =
|
|
71
|
+
let y = W((e) => e.map((e) => {
|
|
72
72
|
let n = e.type.startsWith("image/"), r = e.type.startsWith("audio/"), i = n ? URL.createObjectURL(e) : void 0, o = r ? URL.createObjectURL(e) : void 0;
|
|
73
73
|
return {
|
|
74
|
-
id:
|
|
74
|
+
id: fe(),
|
|
75
75
|
name: e.name,
|
|
76
76
|
contentType: e.type,
|
|
77
77
|
file: e,
|
|
@@ -80,22 +80,22 @@ var q = {
|
|
|
80
80
|
previewUrl: i,
|
|
81
81
|
playUrl: o
|
|
82
82
|
};
|
|
83
|
-
}), []), b =
|
|
84
|
-
|
|
83
|
+
}), []), b = q(i);
|
|
84
|
+
G(() => {
|
|
85
85
|
b.current = i;
|
|
86
86
|
}, [i]);
|
|
87
|
-
let x =
|
|
87
|
+
let x = q(!0), S = W((e) => {
|
|
88
88
|
_((t) => {
|
|
89
89
|
let n = e(t);
|
|
90
90
|
return n === t ? t : n;
|
|
91
91
|
});
|
|
92
92
|
}, []);
|
|
93
|
-
|
|
93
|
+
G(() => {
|
|
94
94
|
x.current ? x.current = !1 : b.current?.(g);
|
|
95
95
|
}, [g]);
|
|
96
|
-
let C =
|
|
96
|
+
let C = W((e) => {
|
|
97
97
|
_(e);
|
|
98
|
-
}, []), w =
|
|
98
|
+
}, []), w = W(async (t) => {
|
|
99
99
|
if (r) {
|
|
100
100
|
S((e) => e.map((e) => e.id === t.id ? {
|
|
101
101
|
...e,
|
|
@@ -118,7 +118,7 @@ var q = {
|
|
|
118
118
|
} : e));
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
}, [r, S]), T =
|
|
121
|
+
}, [r, S]), T = W((e, t = !0) => {
|
|
122
122
|
let n = new Set(v.current.map((e) => e.id)), r = e.filter((e) => !n.has(e.id));
|
|
123
123
|
if (r.length !== 0) {
|
|
124
124
|
if (p != null && p > 0 && Number.isFinite(p)) {
|
|
@@ -139,7 +139,7 @@ var q = {
|
|
|
139
139
|
status: a.Error,
|
|
140
140
|
errorReason: n
|
|
141
141
|
} : e));
|
|
142
|
-
}),
|
|
142
|
+
}), Ie(e, de, w);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
}, [
|
|
@@ -149,8 +149,8 @@ var q = {
|
|
|
149
149
|
S,
|
|
150
150
|
w,
|
|
151
151
|
o
|
|
152
|
-
]), E =
|
|
153
|
-
|
|
152
|
+
]), E = q(/* @__PURE__ */ new WeakSet());
|
|
153
|
+
G(() => {
|
|
154
154
|
if (s.length === 0) {
|
|
155
155
|
E.current = /* @__PURE__ */ new WeakSet();
|
|
156
156
|
return;
|
|
@@ -163,13 +163,13 @@ var q = {
|
|
|
163
163
|
l,
|
|
164
164
|
c,
|
|
165
165
|
s
|
|
166
|
-
]),
|
|
166
|
+
]), G(() => {
|
|
167
167
|
u.length !== 0 && (T(u, !1), d?.());
|
|
168
168
|
}, [
|
|
169
169
|
T,
|
|
170
170
|
d,
|
|
171
171
|
u
|
|
172
|
-
]),
|
|
172
|
+
]), G(() => {
|
|
173
173
|
if (!o) return;
|
|
174
174
|
let t = !1, n = [], r = v.current.map((r) => {
|
|
175
175
|
if (r.status === a.Loading) return r;
|
|
@@ -196,7 +196,7 @@ var q = {
|
|
|
196
196
|
S,
|
|
197
197
|
w
|
|
198
198
|
]);
|
|
199
|
-
let D =
|
|
199
|
+
let D = W((e) => {
|
|
200
200
|
S((t) => {
|
|
201
201
|
let n = t.find((t) => t.id === e);
|
|
202
202
|
return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), n?.playUrl && URL.revokeObjectURL(n.playUrl), t.filter((t) => t.id !== e);
|
|
@@ -208,11 +208,11 @@ var q = {
|
|
|
208
208
|
addAttachments: T,
|
|
209
209
|
resetAttachments: C,
|
|
210
210
|
handleRemove: D,
|
|
211
|
-
handleRetry:
|
|
211
|
+
handleRetry: W((e) => {
|
|
212
212
|
let t = g.find((t) => t.id === e);
|
|
213
213
|
t && w(t);
|
|
214
214
|
}, [g, w]),
|
|
215
|
-
handleExpand:
|
|
215
|
+
handleExpand: W(async (e) => {
|
|
216
216
|
let n = g.find((t) => t.id === e);
|
|
217
217
|
if (!n || n.type !== t.Pasted) return;
|
|
218
218
|
let r = await n.file.text();
|
|
@@ -224,91 +224,18 @@ var q = {
|
|
|
224
224
|
]),
|
|
225
225
|
hasBlockedAttachments: g.some((e) => e.status === a.Loading || e.status === a.Error)
|
|
226
226
|
};
|
|
227
|
-
},
|
|
228
|
-
let
|
|
229
|
-
for (; n < e.length && !/\s/.test(e[n]);) n++;
|
|
230
|
-
return n;
|
|
231
|
-
}, Ve = (e, t) => {
|
|
232
|
-
let n = t;
|
|
233
|
-
for (; n > 0 && !/\s/.test(e[n - 1]);) n--;
|
|
234
|
-
return {
|
|
235
|
-
start: n,
|
|
236
|
-
end: Be(e, n)
|
|
237
|
-
};
|
|
238
|
-
}, He = (e, t) => e.startsWith(t) && !e.slice(t.length).includes(t), Ue = "[role=\"option\"]:not([aria-disabled=\"true\"])", We = /* @__PURE__ */ function(e) {
|
|
239
|
-
return e.Next = "next", e.Previous = "previous", e;
|
|
240
|
-
}({}), Ge = ({ config: e, message: t }) => {
|
|
241
|
-
let [n, r] = K(!1), [i, a] = K(null), [o, s] = K(null), c = G(null);
|
|
242
|
-
c.current = i;
|
|
243
|
-
let l = e != null && i != null && i <= t.length ? (() => {
|
|
244
|
-
let n = t.slice(i, Be(t, i));
|
|
245
|
-
return He(n, e.triggerPrefix) ? n.slice(e.triggerPrefix.length) : "";
|
|
246
|
-
})() : "", u = H((t, n, i) => {
|
|
247
|
-
if (e == null || i) return;
|
|
248
|
-
let { start: c, end: l } = Ve(t, n), u = t.slice(c, l);
|
|
249
|
-
He(u, e.triggerPrefix) ? (a(c), u === e.triggerPrefix || o !== c ? (r(!0), s(null)) : r(!1)) : (r(!1), s(null), a(null));
|
|
250
|
-
}, [e, o]);
|
|
251
|
-
U(() => {
|
|
252
|
-
if (e == null) {
|
|
253
|
-
r(!1), s(null), a(null);
|
|
254
|
-
return;
|
|
255
|
-
}
|
|
256
|
-
let n = c.current;
|
|
257
|
-
if (n == null) return;
|
|
258
|
-
let i = Math.min(n, t.length);
|
|
259
|
-
He(t.slice(i, Be(t, i)), e.triggerPrefix) || (r(!1), s(null), a(null));
|
|
260
|
-
}, [e, t]);
|
|
261
|
-
let d = H(() => {
|
|
262
|
-
r(!1), s(i);
|
|
263
|
-
}, [i]), f = H(() => {
|
|
264
|
-
r(!1);
|
|
265
|
-
}, []), p = H((n) => {
|
|
266
|
-
if (e == null) return;
|
|
267
|
-
let { start: i, end: s } = Ve(t, n);
|
|
268
|
-
He(t.slice(i, s), e.triggerPrefix) ? (a(i), r(o !== i)) : (a(null), r(!1));
|
|
269
|
-
}, [
|
|
270
|
-
e,
|
|
271
|
-
t,
|
|
272
|
-
o
|
|
273
|
-
]), m = Me(), h = G(null), [g, _] = K(null);
|
|
274
|
-
U(() => {
|
|
275
|
-
_(null);
|
|
276
|
-
}, [n, l]);
|
|
277
|
-
let v = H(() => Array.from(h.current?.querySelectorAll(Ue) ?? []), []), y = H((e) => {
|
|
278
|
-
let t = v();
|
|
279
|
-
if (t.length === 0) {
|
|
280
|
-
_(null);
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
let n = t.findIndex((e) => e.id === g), r = t[e === "next" ? (n + 1) % t.length : (n <= 0 ? t.length : n) - 1];
|
|
284
|
-
_(r.id), r.scrollIntoView?.({ block: "nearest" });
|
|
285
|
-
}, [v, g]), b = H(() => v().find((e) => e.id === g) ?? null, [v, g]);
|
|
286
|
-
return {
|
|
287
|
-
isMenuOpen: n,
|
|
288
|
-
query: l,
|
|
289
|
-
activeWordStart: i,
|
|
290
|
-
dismiss: d,
|
|
291
|
-
closeOnOutsidePress: f,
|
|
292
|
-
handleCaretMove: p,
|
|
293
|
-
handleValueChange: u,
|
|
294
|
-
listboxId: m,
|
|
295
|
-
overlayRef: h,
|
|
296
|
-
activeOptionId: n ? g : null,
|
|
297
|
-
moveActiveOption: y,
|
|
298
|
-
getActiveOption: b
|
|
299
|
-
};
|
|
300
|
-
}, Ke = (e, t) => !e.slice(0, t).includes("\n"), qe = (e, t) => !e.slice(t).includes("\n"), Je = (e) => {
|
|
301
|
-
let t = G(e);
|
|
227
|
+
}, Re = (e, t) => !e.slice(0, t).includes("\n"), ze = (e, t) => !e.slice(t).includes("\n"), Be = (e) => {
|
|
228
|
+
let t = q(e);
|
|
302
229
|
t.current = e;
|
|
303
|
-
let n =
|
|
230
|
+
let n = q(-1), r = q(""), i = W((e, i, a) => {
|
|
304
231
|
let o = t.current;
|
|
305
|
-
return !o || o.length === 0 ? null : e === "up" ? !
|
|
306
|
-
}, []), a =
|
|
232
|
+
return !o || o.length === 0 ? null : e === "up" ? !Re(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 || !ze(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
|
|
233
|
+
}, []), a = W(() => {
|
|
307
234
|
n.current = -1, r.current = "";
|
|
308
|
-
}, []), o =
|
|
235
|
+
}, []), o = W(() => {
|
|
309
236
|
n.current = -1, r.current = "";
|
|
310
237
|
}, []);
|
|
311
|
-
return
|
|
238
|
+
return K(() => ({
|
|
312
239
|
navigate: i,
|
|
313
240
|
notifyChange: a,
|
|
314
241
|
reset: o
|
|
@@ -317,117 +244,29 @@ var q = {
|
|
|
317
244
|
a,
|
|
318
245
|
o
|
|
319
246
|
]);
|
|
320
|
-
},
|
|
321
|
-
let
|
|
322
|
-
|
|
323
|
-
let r = t;
|
|
324
|
-
o.filter((e) => e.offset >= t && e.offset <= n).forEach((t) => {
|
|
325
|
-
t.offset > r && s.push(/* @__PURE__ */ B("span", {
|
|
326
|
-
"aria-hidden": !0,
|
|
327
|
-
children: e.slice(r, t.offset)
|
|
328
|
-
}, `text-${l++}`)), s.push(t.node), r = t.offset;
|
|
329
|
-
}), r < n && s.push(/* @__PURE__ */ B("span", {
|
|
330
|
-
"aria-hidden": !0,
|
|
331
|
-
children: e.slice(r, n)
|
|
332
|
-
}, `text-${l++}`));
|
|
333
|
-
};
|
|
334
|
-
return a.forEach((t, n) => {
|
|
335
|
-
if (u(c, t.start), t.start + t.length <= c) return;
|
|
336
|
-
let a = e.slice(t.start, t.start + t.length);
|
|
337
|
-
s.push(t.render ? /* @__PURE__ */ B("span", {
|
|
338
|
-
className: "pointer-events-auto",
|
|
339
|
-
children: t.render()
|
|
340
|
-
}, `range-${n}`) : /* @__PURE__ */ B("span", {
|
|
341
|
-
"aria-hidden": !0,
|
|
342
|
-
className: t.isUnsupported ? i : r,
|
|
343
|
-
children: a
|
|
344
|
-
}, `range-${n}`)), c = Math.max(c, t.start + t.length);
|
|
345
|
-
}), u(c, e.length), s;
|
|
346
|
-
}, Xe = (e, t) => {
|
|
347
|
-
let n = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, { acceptNode: (e) => e.parentElement?.closest("[data-mirror-synthetic]") == null ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT }), r = 0;
|
|
348
|
-
for (let e = n.nextNode(); e != null; e = n.nextNode()) {
|
|
349
|
-
let n = e.textContent?.length ?? 0;
|
|
350
|
-
if (t <= r + n) return {
|
|
351
|
-
node: e,
|
|
352
|
-
offset: t - r
|
|
353
|
-
};
|
|
354
|
-
r += n;
|
|
355
|
-
}
|
|
356
|
-
return null;
|
|
357
|
-
}, Ze = (e, t, n) => {
|
|
358
|
-
let r = Xe(e, t), i = Xe(e, n);
|
|
359
|
-
if (r == null || i == null) return null;
|
|
360
|
-
let a = document.createRange();
|
|
361
|
-
return a.setStart(r.node, r.offset), a.setEnd(i.node, i.offset), a;
|
|
362
|
-
}, Qe = ({ textareaRef: e, message: t, isMirrorActive: n }) => {
|
|
363
|
-
let r = G(null), [i, a] = K([]), o = H(() => {
|
|
364
|
-
let t = e.current, n = r.current;
|
|
365
|
-
if (t == null || n == null) return;
|
|
366
|
-
let i = t.offsetWidth > t.clientWidth;
|
|
367
|
-
n.style.scrollbarGutter = i ? "stable" : "", n.scrollTop = t.scrollTop;
|
|
368
|
-
}, [e]), s = H(() => {
|
|
369
|
-
let t = e.current, i = r.current, o = t?.selectionStart, s = t?.selectionEnd;
|
|
370
|
-
if (!n || t == null || i == null || o == null || s == null || o === s) {
|
|
371
|
-
a((e) => e.length === 0 ? e : []);
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
let c = Ze(i, o, s);
|
|
375
|
-
if (c == null) {
|
|
376
|
-
a((e) => e.length === 0 ? e : []);
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
let l = i.getBoundingClientRect();
|
|
380
|
-
a(Array.from(c.getClientRects()).map((e) => new DOMRect(e.left - l.left, e.top - l.top + i.scrollTop, e.width, e.height)));
|
|
381
|
-
}, [n, e]);
|
|
382
|
-
return Pe(() => {
|
|
383
|
-
n && o(), s();
|
|
384
|
-
}, [
|
|
385
|
-
n,
|
|
386
|
-
o,
|
|
387
|
-
s,
|
|
388
|
-
t
|
|
389
|
-
]), U(() => {
|
|
390
|
-
if (!n) return;
|
|
391
|
-
let t = e.current;
|
|
392
|
-
if (t == null || typeof ResizeObserver > "u") return;
|
|
393
|
-
let r = new ResizeObserver(() => {
|
|
394
|
-
o(), s();
|
|
395
|
-
});
|
|
396
|
-
return r.observe(t), () => r.disconnect();
|
|
397
|
-
}, [
|
|
398
|
-
n,
|
|
399
|
-
e,
|
|
400
|
-
o,
|
|
401
|
-
s
|
|
402
|
-
]), {
|
|
403
|
-
mirrorRef: r,
|
|
404
|
-
selectionRects: i,
|
|
405
|
-
updateSelectionRects: s,
|
|
406
|
-
syncMirrorToTextarea: o
|
|
407
|
-
};
|
|
408
|
-
}, $e = ({ messageProp: e, messageRevision: t }) => {
|
|
409
|
-
let [n, r] = K(e), i = G(null);
|
|
410
|
-
return U(() => {
|
|
247
|
+
}, Ve = ({ messageProp: e, messageRevision: t }) => {
|
|
248
|
+
let [n, r] = J(e), i = q(null);
|
|
249
|
+
return G(() => {
|
|
411
250
|
r(e);
|
|
412
251
|
}, [e, t]), {
|
|
413
252
|
message: n,
|
|
414
253
|
setMessage: r,
|
|
415
254
|
textareaRef: i
|
|
416
255
|
};
|
|
417
|
-
},
|
|
256
|
+
}, He = (e, t, n, r = n) => {
|
|
418
257
|
let i = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value")?.set;
|
|
419
258
|
i ? i.call(e, t) : e.value = t, e.setSelectionRange(n, r), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
420
|
-
},
|
|
421
|
-
let n = e?.revision, r =
|
|
259
|
+
}, Ue = (e) => e.key.toLowerCase() === "z" && (e.ctrlKey || e.metaKey) && !e.shiftKey && !e.altKey, We = ({ insertion: e, textareaRef: t }) => {
|
|
260
|
+
let n = e?.revision, r = q(e?.text);
|
|
422
261
|
r.current = e?.text;
|
|
423
|
-
let i =
|
|
424
|
-
return
|
|
262
|
+
let i = q(n), a = q(null), o = q(!1);
|
|
263
|
+
return G(() => {
|
|
425
264
|
document.activeElement === t.current && (o.current = !0);
|
|
426
265
|
let e = (e) => {
|
|
427
266
|
e.target === t.current && (o.current = !0);
|
|
428
267
|
};
|
|
429
268
|
return document.addEventListener("focusin", e), () => document.removeEventListener("focusin", e);
|
|
430
|
-
}, [t]),
|
|
269
|
+
}, [t]), G(() => {
|
|
431
270
|
if (n === i.current) return;
|
|
432
271
|
i.current = n;
|
|
433
272
|
let e = r.current;
|
|
@@ -437,7 +276,7 @@ var q = {
|
|
|
437
276
|
let { value: r, selectionStart: i, selectionEnd: s } = n, c = !o.current && r.length > 0 && i === 0 && s === 0, l = c ? r.length : i ?? r.length, u = c ? l : s ?? l;
|
|
438
277
|
if (n.focus(), c && n.setSelectionRange(l, u), a.current = null, typeof document.execCommand == "function" && document.execCommand("insertText", !1, e)) return;
|
|
439
278
|
let d = `${r.slice(0, l)}${e}${r.slice(u)}`;
|
|
440
|
-
|
|
279
|
+
He(n, d, l + e.length), a.current = {
|
|
441
280
|
insertedValue: d,
|
|
442
281
|
previousValue: r,
|
|
443
282
|
previousSelectionStart: l,
|
|
@@ -447,22 +286,22 @@ var q = {
|
|
|
447
286
|
}, [n, t]), {
|
|
448
287
|
handleUndoKeyDown: (e) => {
|
|
449
288
|
let n = a.current, r = t.current;
|
|
450
|
-
return n == null || r == null || !
|
|
289
|
+
return n == null || r == null || !Ue(e) || (a.current = null, r.value !== n.insertedValue) ? !1 : (e.preventDefault(), He(r, n.previousValue, n.previousSelectionStart, n.previousSelectionEnd), !0);
|
|
451
290
|
},
|
|
452
291
|
markCaretPlaced: () => {
|
|
453
292
|
o.current = !0;
|
|
454
293
|
}
|
|
455
294
|
};
|
|
456
|
-
},
|
|
295
|
+
}, Ge = /* @__PURE__ */ function(e) {
|
|
457
296
|
return e.Idle = "idle", e.Recording = "recording", e.Processing = "processing", e.Error = "error", e;
|
|
458
|
-
}({}),
|
|
297
|
+
}({}), Ke = /* @__PURE__ */ function(e) {
|
|
459
298
|
return e.Dictation = "dictation", e.Attachment = "attachment", e;
|
|
460
|
-
}({}),
|
|
299
|
+
}({}), qe = [
|
|
461
300
|
"audio/webm;codecs=opus",
|
|
462
301
|
"audio/ogg;codecs=opus",
|
|
463
302
|
"audio/webm"
|
|
464
|
-
],
|
|
465
|
-
let [a, o] =
|
|
303
|
+
], Je = 100, Ye = 100, Xe = .01, Ze = ({ onAttachAudio: e, onTranscribeAudio: t, onTranscript: n, errorLabel: i = "Voice input failed" }) => {
|
|
304
|
+
let [a, o] = J("idle"), [s, c] = J(null), l = q(null), d = q(null), f = q({
|
|
466
305
|
onAttachAudio: e,
|
|
467
306
|
onTranscribeAudio: t,
|
|
468
307
|
onTranscript: n,
|
|
@@ -474,7 +313,7 @@ var q = {
|
|
|
474
313
|
onTranscript: n,
|
|
475
314
|
errorLabel: i
|
|
476
315
|
};
|
|
477
|
-
let p =
|
|
316
|
+
let p = W((e = "dictation") => {
|
|
478
317
|
if (d.current) return;
|
|
479
318
|
let t = { controller: new AbortController() };
|
|
480
319
|
d.current = t, c(null), o("recording");
|
|
@@ -492,7 +331,7 @@ var q = {
|
|
|
492
331
|
n.aborted || (t.controller.abort(), d.current = null, c(e instanceof Error ? e.message : f.current.errorLabel), o("error"));
|
|
493
332
|
}, S = () => {
|
|
494
333
|
if (!a || n.aborted) return;
|
|
495
|
-
let e =
|
|
334
|
+
let e = qe.find((e) => MediaRecorder.isTypeSupported(e)), t = new MediaRecorder(a, e ? { mimeType: e } : void 0);
|
|
496
335
|
p = t;
|
|
497
336
|
let s = Date.now(), c = !1, d = !1, S = new Uint8Array(l.current?.fftSize ?? 256), C = async () => {
|
|
498
337
|
if (!(g || n.aborted)) {
|
|
@@ -500,7 +339,7 @@ var q = {
|
|
|
500
339
|
try {
|
|
501
340
|
let a = t.mimeType || e || "audio/webm", l = new Blob(_, { type: a });
|
|
502
341
|
_.length = 0, y();
|
|
503
|
-
let p = Date.now() - s >=
|
|
342
|
+
let p = Date.now() - s >= Ye;
|
|
504
343
|
if (l.size && (!i || p && (!c || d))) {
|
|
505
344
|
let e = u(a), t = r[e] ?? e.split("/")[1] ?? "webm", s = new File([l], "voice-" + crypto.randomUUID() + "." + t, { type: a });
|
|
506
345
|
if (i) {
|
|
@@ -526,8 +365,8 @@ var q = {
|
|
|
526
365
|
e.getByteTimeDomainData(S), c = !0;
|
|
527
366
|
let t = 0;
|
|
528
367
|
for (let e of S) t += ((e - 128) / 128) ** 2;
|
|
529
|
-
Math.sqrt(t / S.length) >=
|
|
530
|
-
},
|
|
368
|
+
Math.sqrt(t / S.length) >= Xe && (d = !0, v());
|
|
369
|
+
}, Je));
|
|
531
370
|
};
|
|
532
371
|
t.stop = () => {
|
|
533
372
|
h || n.aborted || (h = !0, v(), o("processing"), p?.state === "recording" && p.stop());
|
|
@@ -538,34 +377,693 @@ var q = {
|
|
|
538
377
|
e.getTracks().forEach((e) => e.stop()), b();
|
|
539
378
|
return;
|
|
540
379
|
}
|
|
541
|
-
a = e, s = new AudioContext();
|
|
542
|
-
let t = s.createAnalyser();
|
|
543
|
-
t.fftSize = 256, l.current = t, s.createMediaStreamSource(a).connect(t), S(), o("recording");
|
|
544
|
-
} catch (e) {
|
|
545
|
-
x(e);
|
|
380
|
+
a = e, s = new AudioContext();
|
|
381
|
+
let t = s.createAnalyser();
|
|
382
|
+
t.fftSize = 256, l.current = t, s.createMediaStreamSource(a).connect(t), S(), o("recording");
|
|
383
|
+
} catch (e) {
|
|
384
|
+
x(e);
|
|
385
|
+
}
|
|
386
|
+
})();
|
|
387
|
+
}, []), m = W(() => d.current?.stop?.(), []), h = W(() => {
|
|
388
|
+
d.current?.controller.abort(), d.current = null, c(null), o("idle");
|
|
389
|
+
}, []);
|
|
390
|
+
return G(() => () => {
|
|
391
|
+
d.current?.controller.abort(), d.current = null;
|
|
392
|
+
}, []), {
|
|
393
|
+
state: a,
|
|
394
|
+
analyserNodeRef: l,
|
|
395
|
+
errorMessage: s,
|
|
396
|
+
startRecording: p,
|
|
397
|
+
stopRecording: m,
|
|
398
|
+
discardRecording: h
|
|
399
|
+
};
|
|
400
|
+
}, Qe = /* @__PURE__ */ function(e) {
|
|
401
|
+
return e.Enter = "enter", e.MetaEnter = "meta-enter", e;
|
|
402
|
+
}({}), $e = /* @__PURE__ */ function(e) {
|
|
403
|
+
return e.Stacked = "stacked", e.Inline = "inline", e;
|
|
404
|
+
}({}), et = {
|
|
405
|
+
chip: "_chip_1lvv5_1",
|
|
406
|
+
chipSelected: "_chipSelected_1lvv5_9",
|
|
407
|
+
chipIcon: "_chipIcon_1lvv5_16",
|
|
408
|
+
chipText: "_chipText_1lvv5_19",
|
|
409
|
+
chipState: "_chipState_1lvv5_22",
|
|
410
|
+
chipClose: "_chipClose_1lvv5_25"
|
|
411
|
+
}, tt = (e) => `Remove ${e}`, nt = ({ items: e, onToolToggle: t, onToolDismiss: n, canRemove: r = !0, removeLabel: i = tt, stateOnLabel: a, stateOffLabel: o, typography: s, colors: u }) => {
|
|
412
|
+
if (e.length === 0) return null;
|
|
413
|
+
let d = !!(a && o), f = c({
|
|
414
|
+
"--ci-chip-bg": u?.chipBg,
|
|
415
|
+
"--ci-chip-border": u?.chipBorder,
|
|
416
|
+
"--ci-chip-icon": u?.chipIcon,
|
|
417
|
+
"--ci-chip-text": u?.chipText,
|
|
418
|
+
"--ci-chip-hover-bg": u?.chipHoverBg,
|
|
419
|
+
"--ci-chip-selected-bg": u?.chipSelectedBg,
|
|
420
|
+
"--ci-chip-selected-bg-hover": u?.chipSelectedHoverBg,
|
|
421
|
+
"--ci-chip-selected-border": u?.chipSelectedBorder,
|
|
422
|
+
"--ci-chip-selected-icon": u?.chipSelectedIcon,
|
|
423
|
+
"--ci-chip-selected-text": u?.chipSelectedText,
|
|
424
|
+
"--ci-chip-state-text": u?.chipStateText,
|
|
425
|
+
"--ci-chip-close": u?.chipClose,
|
|
426
|
+
"--ci-chip-close-hover": u?.chipCloseHover
|
|
427
|
+
}), p = (e) => /* @__PURE__ */ H("span", {
|
|
428
|
+
className: l(et.chipIcon, "flex shrink-0"),
|
|
429
|
+
children: e.icon
|
|
430
|
+
}), m = (e) => /* @__PURE__ */ U("span", {
|
|
431
|
+
className: "flex min-w-0 items-center",
|
|
432
|
+
children: [/* @__PURE__ */ U("span", {
|
|
433
|
+
className: l(et.chipText, s?.fontClassName || "dial-small-paragraph-text", "truncate"),
|
|
434
|
+
children: [e.label, d && /* @__PURE__ */ H("span", {
|
|
435
|
+
"aria-hidden": !0,
|
|
436
|
+
children: ":"
|
|
437
|
+
})]
|
|
438
|
+
}), d && /* @__PURE__ */ H("span", {
|
|
439
|
+
className: l(et.chipState, s?.stateClassName || "dial-tiny-lead-text", "ms-1 shrink-0"),
|
|
440
|
+
"aria-hidden": !0,
|
|
441
|
+
children: e.isSelected ? a : o
|
|
442
|
+
})]
|
|
443
|
+
});
|
|
444
|
+
return /* @__PURE__ */ H("div", {
|
|
445
|
+
className: "flex flex-wrap items-center gap-2",
|
|
446
|
+
style: f,
|
|
447
|
+
children: e.map((e) => r ? /* @__PURE__ */ U("div", {
|
|
448
|
+
className: l(et.chip, e.isSelected && et.chipSelected, "flex min-w-0 items-center gap-1.5 rounded-full border py-1 ps-2 pe-1 transition-colors"),
|
|
449
|
+
children: [/* @__PURE__ */ U("button", {
|
|
450
|
+
type: "button",
|
|
451
|
+
onClick: () => t(e.id),
|
|
452
|
+
"aria-pressed": e.isSelected,
|
|
453
|
+
className: "flex min-w-0 items-center gap-1.5",
|
|
454
|
+
children: [/* @__PURE__ */ H("span", {
|
|
455
|
+
className: "flex shrink-0",
|
|
456
|
+
"aria-hidden": !0,
|
|
457
|
+
children: p(e)
|
|
458
|
+
}), m(e)]
|
|
459
|
+
}), /* @__PURE__ */ H("button", {
|
|
460
|
+
type: "button",
|
|
461
|
+
onClick: () => n(e.id),
|
|
462
|
+
"aria-label": i(e.label),
|
|
463
|
+
className: l(et.chipClose, "flex shrink-0 items-center rounded p-0.5 transition-colors"),
|
|
464
|
+
children: /* @__PURE__ */ H(Te, {
|
|
465
|
+
size: 12,
|
|
466
|
+
"aria-hidden": !0,
|
|
467
|
+
stroke: y
|
|
468
|
+
})
|
|
469
|
+
})]
|
|
470
|
+
}, e.id) : /* @__PURE__ */ H(se, {
|
|
471
|
+
icon: p(e),
|
|
472
|
+
label: m(e),
|
|
473
|
+
isSelected: e.isSelected,
|
|
474
|
+
onToggle: () => t(e.id),
|
|
475
|
+
className: l(et.chip, e.isSelected && et.chipSelected, "h-auto min-w-0 gap-1.5 border px-2 py-1 transition-colors")
|
|
476
|
+
}, e.id))
|
|
477
|
+
});
|
|
478
|
+
}, X = {
|
|
479
|
+
wrapper: "_wrapper_13067_2",
|
|
480
|
+
wrapperDisabled: "_wrapperDisabled_13067_9",
|
|
481
|
+
textarea: "_textarea_13067_13",
|
|
482
|
+
textareaMentionMode: "_textareaMentionMode_13067_19",
|
|
483
|
+
commandHint: "_commandHint_13067_53",
|
|
484
|
+
mentionHighlight: "_mentionHighlight_13067_57",
|
|
485
|
+
mentionHighlightUnsupported: "_mentionHighlightUnsupported_13067_63",
|
|
486
|
+
selectionHighlight: "_selectionHighlight_13067_69",
|
|
487
|
+
modelOverlayPanel: "_modelOverlayPanel_13067_78",
|
|
488
|
+
modelSelectorButton: "_modelSelectorButton_13067_82",
|
|
489
|
+
modelSelectorCaret: "_modelSelectorCaret_13067_82",
|
|
490
|
+
modelSelectorName: "_modelSelectorName_13067_85",
|
|
491
|
+
modelSelectorVersion: "_modelSelectorVersion_13067_88",
|
|
492
|
+
modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_13067_97"
|
|
493
|
+
}, rt = {
|
|
494
|
+
waveformCanvas: "_waveformCanvas_18zb5_1",
|
|
495
|
+
recordingDot: "_recordingDot_18zb5_15",
|
|
496
|
+
"recording-pulse": "_recording-pulse_18zb5_1"
|
|
497
|
+
}, it = 3, at = 4, ot = 200, st = ({ state: e, analyserNodeRef: t, onStop: n, onDiscard: r, attachButton: i, stopLabel: a = "Stop recording", discardLabel: o = "Discard recording", processingLabel: s = "Transcribing audio…", style: c, className: u, embedded: d = !1 }) => {
|
|
498
|
+
let f = q(null), p = q(new Float32Array(ot)), m = q(0), h = q(0), g = e === Ge.Recording, _ = e === Ge.Processing, b = W((e) => {
|
|
499
|
+
let t = e.getContext("2d");
|
|
500
|
+
if (!t) return;
|
|
501
|
+
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
502
|
+
let { width: n, height: r } = e;
|
|
503
|
+
t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
|
|
504
|
+
let i = Math.min(Math.max(1, Math.floor(n / at)), 199), a = m.current, o = h.current;
|
|
505
|
+
t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
|
|
506
|
+
for (let e = 0; e <= i; e++) {
|
|
507
|
+
let n = ((a - i + e) % ot + ot) % ot, o = p.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
|
|
508
|
+
t.fillRect(e * at, (r - c) / 2, it, c);
|
|
509
|
+
}
|
|
510
|
+
t.restore();
|
|
511
|
+
}, []);
|
|
512
|
+
G(() => {
|
|
513
|
+
if (!g) return;
|
|
514
|
+
let e = f.current;
|
|
515
|
+
if (!e) return;
|
|
516
|
+
p.current.fill(0), m.current = 0, h.current = 0;
|
|
517
|
+
let n, r = () => {
|
|
518
|
+
if (h.current += 1, h.current >= at) {
|
|
519
|
+
h.current -= at;
|
|
520
|
+
let e = t.current;
|
|
521
|
+
if (e) {
|
|
522
|
+
let t = new Uint8Array(e.frequencyBinCount);
|
|
523
|
+
e.getByteTimeDomainData(t);
|
|
524
|
+
let n = 0;
|
|
525
|
+
for (let e = 0; e < t.length; e++) {
|
|
526
|
+
let r = (t[e] - 128) / 128;
|
|
527
|
+
n += r * r;
|
|
528
|
+
}
|
|
529
|
+
p.current[m.current % ot] = Math.sqrt(n / t.length), m.current++;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
b(e), n = requestAnimationFrame(r);
|
|
533
|
+
};
|
|
534
|
+
return n = requestAnimationFrame(r), () => {
|
|
535
|
+
cancelAnimationFrame(n);
|
|
536
|
+
};
|
|
537
|
+
}, [
|
|
538
|
+
g,
|
|
539
|
+
t,
|
|
540
|
+
b
|
|
541
|
+
]), G(() => {
|
|
542
|
+
let e = f.current;
|
|
543
|
+
if (!e) return;
|
|
544
|
+
let t = new ResizeObserver(() => {
|
|
545
|
+
b(e);
|
|
546
|
+
});
|
|
547
|
+
return t.observe(e), () => t.disconnect();
|
|
548
|
+
}, [b]);
|
|
549
|
+
let x = /* @__PURE__ */ U("div", {
|
|
550
|
+
className: "flex shrink-0 items-center justify-end gap-1",
|
|
551
|
+
children: [
|
|
552
|
+
/* @__PURE__ */ H(M, {
|
|
553
|
+
icon: /* @__PURE__ */ H(Te, {
|
|
554
|
+
size: v.LG,
|
|
555
|
+
"aria-hidden": !0,
|
|
556
|
+
stroke: y
|
|
557
|
+
}),
|
|
558
|
+
"aria-label": o,
|
|
559
|
+
className: "mobile:min-h-11 mobile:min-w-11",
|
|
560
|
+
onClick: r
|
|
561
|
+
}),
|
|
562
|
+
g && /* @__PURE__ */ H(R, {
|
|
563
|
+
icon: /* @__PURE__ */ H(he, {
|
|
564
|
+
size: v.LG,
|
|
565
|
+
"aria-hidden": !0,
|
|
566
|
+
stroke: y
|
|
567
|
+
}),
|
|
568
|
+
onClick: () => n?.(),
|
|
569
|
+
autoFocus: !0,
|
|
570
|
+
"aria-label": a,
|
|
571
|
+
className: "mobile:min-h-11 mobile:min-w-11"
|
|
572
|
+
}),
|
|
573
|
+
_ && /* @__PURE__ */ H("span", {
|
|
574
|
+
className: "flex size-[40px] shrink-0 items-center justify-center mobile:min-h-11 mobile:min-w-11",
|
|
575
|
+
children: /* @__PURE__ */ H(ie, {
|
|
576
|
+
size: 20,
|
|
577
|
+
ariaLabel: s
|
|
578
|
+
})
|
|
579
|
+
})
|
|
580
|
+
]
|
|
581
|
+
});
|
|
582
|
+
return /* @__PURE__ */ H("div", {
|
|
583
|
+
className: u,
|
|
584
|
+
children: /* @__PURE__ */ U("div", {
|
|
585
|
+
style: c,
|
|
586
|
+
className: l("flex w-full min-w-0 flex-col justify-center gap-2", !d && X.wrapper, !d && "min-h-[64px] max-w-[748px] rounded-xl border px-3 shadow-md"),
|
|
587
|
+
children: [/* @__PURE__ */ U("div", {
|
|
588
|
+
className: "flex min-w-0 flex-1 items-center gap-3",
|
|
589
|
+
children: [g && /* @__PURE__ */ H("span", {
|
|
590
|
+
className: l(rt.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
|
|
591
|
+
"aria-hidden": !0
|
|
592
|
+
}), /* @__PURE__ */ H("canvas", {
|
|
593
|
+
ref: f,
|
|
594
|
+
height: 26,
|
|
595
|
+
"aria-hidden": !0,
|
|
596
|
+
className: l(rt.waveformCanvas, "h-[26px] min-w-0 flex-1")
|
|
597
|
+
})]
|
|
598
|
+
}), /* @__PURE__ */ U("div", {
|
|
599
|
+
className: "flex items-center justify-between gap-2",
|
|
600
|
+
children: [i ?? /* @__PURE__ */ H("span", { "aria-hidden": !0 }), x]
|
|
601
|
+
})]
|
|
602
|
+
})
|
|
603
|
+
});
|
|
604
|
+
}, ct = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", sendTooltip: r }) => /* @__PURE__ */ H(R, {
|
|
605
|
+
"aria-label": n,
|
|
606
|
+
onClick: () => e?.(),
|
|
607
|
+
disabled: t,
|
|
608
|
+
tooltipProps: r ? { tooltip: r } : void 0,
|
|
609
|
+
icon: /* @__PURE__ */ H(me, {
|
|
610
|
+
size: v.LG,
|
|
611
|
+
className: "rtl:scale-x-[-1]",
|
|
612
|
+
stroke: y
|
|
613
|
+
})
|
|
614
|
+
}), lt = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ H(M, {
|
|
615
|
+
icon: /* @__PURE__ */ H(xe, {
|
|
616
|
+
size: v.LG,
|
|
617
|
+
stroke: y
|
|
618
|
+
}),
|
|
619
|
+
onClick: () => e?.(),
|
|
620
|
+
"aria-label": t
|
|
621
|
+
}), ut = (e, t, n, r, i) => {
|
|
622
|
+
let a = [...t].sort((e, t) => e.start - t.start), o = [...n].sort((e, t) => e.offset - t.offset), s = [], c = 0, l = 0, u = (t, n) => {
|
|
623
|
+
if (n <= t) return;
|
|
624
|
+
let r = t;
|
|
625
|
+
o.filter((e) => e.offset >= t && e.offset <= n).forEach((t) => {
|
|
626
|
+
t.offset > r && s.push(/* @__PURE__ */ H("span", {
|
|
627
|
+
"aria-hidden": !0,
|
|
628
|
+
children: e.slice(r, t.offset)
|
|
629
|
+
}, `text-${l++}`)), s.push(t.node), r = t.offset;
|
|
630
|
+
}), r < n && s.push(/* @__PURE__ */ H("span", {
|
|
631
|
+
"aria-hidden": !0,
|
|
632
|
+
children: e.slice(r, n)
|
|
633
|
+
}, `text-${l++}`));
|
|
634
|
+
};
|
|
635
|
+
return a.forEach((t, n) => {
|
|
636
|
+
if (u(c, t.start), t.start + t.length <= c) return;
|
|
637
|
+
let a = e.slice(t.start, t.start + t.length);
|
|
638
|
+
s.push(t.render ? /* @__PURE__ */ H("span", {
|
|
639
|
+
className: "pointer-events-auto",
|
|
640
|
+
children: t.render()
|
|
641
|
+
}, `range-${n}`) : /* @__PURE__ */ H("span", {
|
|
642
|
+
"aria-hidden": !0,
|
|
643
|
+
className: t.isUnsupported ? i : r,
|
|
644
|
+
children: a
|
|
645
|
+
}, `range-${n}`)), c = Math.max(c, t.start + t.length);
|
|
646
|
+
}), u(c, e.length), s;
|
|
647
|
+
}, dt = (e, t) => {
|
|
648
|
+
let n = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, { acceptNode: (e) => e.parentElement?.closest("[data-mirror-synthetic]") == null ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT }), r = 0;
|
|
649
|
+
for (let e = n.nextNode(); e != null; e = n.nextNode()) {
|
|
650
|
+
let n = e.textContent?.length ?? 0;
|
|
651
|
+
if (t <= r + n) return {
|
|
652
|
+
node: e,
|
|
653
|
+
offset: t - r
|
|
654
|
+
};
|
|
655
|
+
r += n;
|
|
656
|
+
}
|
|
657
|
+
return null;
|
|
658
|
+
}, ft = (e, t, n) => {
|
|
659
|
+
let r = dt(e, t), i = dt(e, n);
|
|
660
|
+
if (r == null || i == null) return null;
|
|
661
|
+
let a = document.createRange();
|
|
662
|
+
return a.setStart(r.node, r.offset), a.setEnd(i.node, i.offset), a;
|
|
663
|
+
}, pt = ({ textareaRef: e, message: t, isMirrorActive: n }) => {
|
|
664
|
+
let r = q(null), [i, a] = J([]), o = W(() => {
|
|
665
|
+
let t = e.current, n = r.current;
|
|
666
|
+
if (t == null || n == null) return;
|
|
667
|
+
let i = t.offsetWidth > t.clientWidth;
|
|
668
|
+
n.style.scrollbarGutter = i ? "stable" : "", n.scrollTop = t.scrollTop;
|
|
669
|
+
}, [e]), s = W(() => {
|
|
670
|
+
let t = e.current, i = r.current, o = t?.selectionStart, s = t?.selectionEnd;
|
|
671
|
+
if (!n || t == null || i == null || o == null || s == null || o === s) {
|
|
672
|
+
a((e) => e.length === 0 ? e : []);
|
|
673
|
+
return;
|
|
674
|
+
}
|
|
675
|
+
let c = ft(i, o, s);
|
|
676
|
+
if (c == null) {
|
|
677
|
+
a((e) => e.length === 0 ? e : []);
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
let l = i.getBoundingClientRect();
|
|
681
|
+
a(Array.from(c.getClientRects()).map((e) => new DOMRect(e.left - l.left, e.top - l.top + i.scrollTop, e.width, e.height)));
|
|
682
|
+
}, [n, e]);
|
|
683
|
+
return Me(() => {
|
|
684
|
+
n && o(), s();
|
|
685
|
+
}, [
|
|
686
|
+
n,
|
|
687
|
+
o,
|
|
688
|
+
s,
|
|
689
|
+
t
|
|
690
|
+
]), G(() => {
|
|
691
|
+
if (!n) return;
|
|
692
|
+
let t = e.current;
|
|
693
|
+
if (t == null || typeof ResizeObserver > "u") return;
|
|
694
|
+
let r = new ResizeObserver(() => {
|
|
695
|
+
o(), s();
|
|
696
|
+
});
|
|
697
|
+
return r.observe(t), () => r.disconnect();
|
|
698
|
+
}, [
|
|
699
|
+
n,
|
|
700
|
+
e,
|
|
701
|
+
o,
|
|
702
|
+
s
|
|
703
|
+
]), {
|
|
704
|
+
mirrorRef: r,
|
|
705
|
+
selectionRects: i,
|
|
706
|
+
updateSelectionRects: s,
|
|
707
|
+
syncMirrorToTextarea: o
|
|
708
|
+
};
|
|
709
|
+
}, mt = ({ commandMenu: e, message: t, textareaRef: n, hasActiveMentions: r, markerOffset: i, triggerEnd: a, hasCommandEmptyQueryHint: o }) => {
|
|
710
|
+
let s = q(null), c = q(null), [l, u] = J(null), d = W(() => {
|
|
711
|
+
let e = s.current, t = c.current;
|
|
712
|
+
if (e == null || t == null) {
|
|
713
|
+
u(null);
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
717
|
+
u({
|
|
718
|
+
left: n.left - r.left,
|
|
719
|
+
top: n.top - r.top
|
|
720
|
+
});
|
|
721
|
+
}, []);
|
|
722
|
+
G(() => {
|
|
723
|
+
if (i == null) return;
|
|
724
|
+
let e = n.current;
|
|
725
|
+
if (e == null || typeof ResizeObserver > "u") return;
|
|
726
|
+
let t = new ResizeObserver(d);
|
|
727
|
+
return t.observe(e), () => t.disconnect();
|
|
728
|
+
}, [
|
|
729
|
+
i,
|
|
730
|
+
n,
|
|
731
|
+
d
|
|
732
|
+
]);
|
|
733
|
+
let f = K(() => {
|
|
734
|
+
let t = [];
|
|
735
|
+
return i != null && t.push({
|
|
736
|
+
offset: i,
|
|
737
|
+
node: /* @__PURE__ */ H("span", {
|
|
738
|
+
ref: s,
|
|
739
|
+
"aria-hidden": !0,
|
|
740
|
+
className: "inline-block h-lh w-0 align-text-top"
|
|
741
|
+
}, "caret-marker")
|
|
742
|
+
}), o && e != null && a != null && t.push({
|
|
743
|
+
offset: a,
|
|
744
|
+
node: /* @__PURE__ */ H("span", {
|
|
745
|
+
className: X.commandHint,
|
|
746
|
+
"aria-hidden": !0,
|
|
747
|
+
"data-mirror-synthetic": !0,
|
|
748
|
+
children: e.emptyQueryHint
|
|
749
|
+
}, "command-hint")
|
|
750
|
+
}), t;
|
|
751
|
+
}, [
|
|
752
|
+
i,
|
|
753
|
+
o,
|
|
754
|
+
e,
|
|
755
|
+
a
|
|
756
|
+
]), p = r || f.length > 0, { mirrorRef: m, selectionRects: h, updateSelectionRects: g, syncMirrorToTextarea: _ } = pt({
|
|
757
|
+
textareaRef: n,
|
|
758
|
+
message: t,
|
|
759
|
+
isMirrorActive: p
|
|
760
|
+
});
|
|
761
|
+
return Me(() => {
|
|
762
|
+
d();
|
|
763
|
+
}, [
|
|
764
|
+
d,
|
|
765
|
+
i,
|
|
766
|
+
t
|
|
767
|
+
]), {
|
|
768
|
+
textareaAreaRef: c,
|
|
769
|
+
caretAnchor: l,
|
|
770
|
+
mirrorInsertions: f,
|
|
771
|
+
isMirrorActive: p,
|
|
772
|
+
mirrorRef: m,
|
|
773
|
+
selectionRects: h,
|
|
774
|
+
updateSelectionRects: g,
|
|
775
|
+
handleTextareaScroll: () => {
|
|
776
|
+
_(), i != null && d();
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
}, ht = (e, t) => {
|
|
780
|
+
let n = t;
|
|
781
|
+
for (; n < e.length && !/\s/.test(e[n]);) n++;
|
|
782
|
+
return n;
|
|
783
|
+
}, gt = (e, t) => {
|
|
784
|
+
let n = t;
|
|
785
|
+
for (; n > 0 && !/\s/.test(e[n - 1]);) n--;
|
|
786
|
+
return {
|
|
787
|
+
start: n,
|
|
788
|
+
end: ht(e, n)
|
|
789
|
+
};
|
|
790
|
+
}, _t = (e, t) => e.startsWith(t) && !e.slice(t.length).includes(t), vt = "[role=\"option\"]:not([aria-disabled=\"true\"])", yt = /* @__PURE__ */ function(e) {
|
|
791
|
+
return e.Next = "next", e.Previous = "previous", e;
|
|
792
|
+
}({}), bt = ({ config: e, message: t }) => {
|
|
793
|
+
let [n, r] = J(!1), [i, a] = J(null), [o, s] = J(null), c = q(null);
|
|
794
|
+
c.current = i;
|
|
795
|
+
let l = e != null && i != null && i <= t.length ? (() => {
|
|
796
|
+
let n = t.slice(i, ht(t, i));
|
|
797
|
+
return _t(n, e.triggerPrefix) ? n.slice(e.triggerPrefix.length) : "";
|
|
798
|
+
})() : "", u = W((t, n, i) => {
|
|
799
|
+
if (e == null || i) return;
|
|
800
|
+
let { start: c, end: l } = gt(t, n), u = t.slice(c, l);
|
|
801
|
+
_t(u, e.triggerPrefix) ? (a(c), u === e.triggerPrefix || o !== c ? (r(!0), s(null)) : r(!1)) : (r(!1), s(null), a(null));
|
|
802
|
+
}, [e, o]);
|
|
803
|
+
G(() => {
|
|
804
|
+
if (e == null) {
|
|
805
|
+
r(!1), s(null), a(null);
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
let n = c.current;
|
|
809
|
+
if (n == null) return;
|
|
810
|
+
let i = Math.min(n, t.length);
|
|
811
|
+
_t(t.slice(i, ht(t, i)), e.triggerPrefix) || (r(!1), s(null), a(null));
|
|
812
|
+
}, [e, t]);
|
|
813
|
+
let d = W(() => {
|
|
814
|
+
r(!1), s(i);
|
|
815
|
+
}, [i]), f = W(() => {
|
|
816
|
+
r(!1);
|
|
817
|
+
}, []), p = W((n) => {
|
|
818
|
+
if (e == null) return;
|
|
819
|
+
let { start: i, end: s } = gt(t, n);
|
|
820
|
+
_t(t.slice(i, s), e.triggerPrefix) ? (a(i), r(o !== i)) : (a(null), r(!1));
|
|
821
|
+
}, [
|
|
822
|
+
e,
|
|
823
|
+
t,
|
|
824
|
+
o
|
|
825
|
+
]), m = Ae(), h = q(null), [g, _] = J(null);
|
|
826
|
+
G(() => {
|
|
827
|
+
_(null);
|
|
828
|
+
}, [n, l]);
|
|
829
|
+
let v = W(() => Array.from(h.current?.querySelectorAll(vt) ?? []), []), y = W((e) => {
|
|
830
|
+
let t = v();
|
|
831
|
+
if (t.length === 0) {
|
|
832
|
+
_(null);
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
let n = t.findIndex((e) => e.id === g), r = t[e === "next" ? (n + 1) % t.length : (n <= 0 ? t.length : n) - 1];
|
|
836
|
+
_(r.id), r.scrollIntoView?.({ block: "nearest" });
|
|
837
|
+
}, [v, g]), b = W(() => v().find((e) => e.id === g) ?? null, [v, g]);
|
|
838
|
+
return {
|
|
839
|
+
isMenuOpen: n,
|
|
840
|
+
query: l,
|
|
841
|
+
activeWordStart: i,
|
|
842
|
+
dismiss: d,
|
|
843
|
+
closeOnOutsidePress: f,
|
|
844
|
+
handleCaretMove: p,
|
|
845
|
+
handleValueChange: u,
|
|
846
|
+
listboxId: m,
|
|
847
|
+
overlayRef: h,
|
|
848
|
+
activeOptionId: n ? g : null,
|
|
849
|
+
moveActiveOption: y,
|
|
850
|
+
getActiveOption: b
|
|
851
|
+
};
|
|
852
|
+
}, xt = ({ commandMenu: e, message: t, setMessage: n, textareaRef: r, historyNav: i, onChange: a, caretPositionOverride: o, messageRevision: s, markCaretPlaced: c, sendOnEnter: l }) => {
|
|
853
|
+
let { isMenuOpen: u, query: d, activeWordStart: f, dismiss: p, closeOnOutsidePress: m, handleCaretMove: h, handleValueChange: g, listboxId: _, overlayRef: v, activeOptionId: y, moveActiveOption: b, getActiveOption: x } = bt({
|
|
854
|
+
config: e,
|
|
855
|
+
message: t
|
|
856
|
+
}), S = q(h);
|
|
857
|
+
S.current = h;
|
|
858
|
+
let C = () => {
|
|
859
|
+
h(r.current?.selectionStart ?? t.length);
|
|
860
|
+
}, w = q(!1), T = () => {
|
|
861
|
+
w.current ? w.current = !1 : requestAnimationFrame(() => {
|
|
862
|
+
let e = r.current;
|
|
863
|
+
S.current(e?.selectionStart ?? e?.value.length ?? 0);
|
|
864
|
+
});
|
|
865
|
+
}, E = (e) => {
|
|
866
|
+
(e.key === "ArrowLeft" || e.key === "ArrowRight" || e.key === "Home" || e.key === "End" || e.key === "PageUp" || e.key === "PageDown") && h(e.currentTarget.selectionStart ?? t.length);
|
|
867
|
+
}, D = e?.emptyQueryHint != null, O = e != null && f != null ? f + e.triggerPrefix.length : null, k = O != null && t.slice(O).split("\n", 1)[0] !== "", A = D && u && d === "" && O != null && !k, j = e != null && u ? f ?? 0 : null, M = W((o) => {
|
|
868
|
+
if (e == null || (p(), !o?.consumeQuery) || (o.returnFocus !== !1 && r.current?.focus(), f == null)) return;
|
|
869
|
+
let s = `${e.triggerPrefix}${d}`, c = f + s.length;
|
|
870
|
+
if (t.slice(f, c) !== s) return;
|
|
871
|
+
let l = t.slice(0, f) + t.slice(c);
|
|
872
|
+
n(l), i.notifyChange(), a?.(l);
|
|
873
|
+
}, [
|
|
874
|
+
e,
|
|
875
|
+
p,
|
|
876
|
+
d,
|
|
877
|
+
t,
|
|
878
|
+
f,
|
|
879
|
+
n,
|
|
880
|
+
i,
|
|
881
|
+
a,
|
|
882
|
+
r
|
|
883
|
+
]), N = q(void 0);
|
|
884
|
+
G(() => {
|
|
885
|
+
o != null && N.current !== s && (N.current = s, r.current?.setSelectionRange(o, o), c(), h(o));
|
|
886
|
+
}, [t]);
|
|
887
|
+
let P = (e) => l === Qe.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey;
|
|
888
|
+
return {
|
|
889
|
+
isMenuOpen: u,
|
|
890
|
+
query: d,
|
|
891
|
+
activeWordStart: f,
|
|
892
|
+
closeOnOutsidePress: m,
|
|
893
|
+
handleValueChange: g,
|
|
894
|
+
commandMenuListboxId: _,
|
|
895
|
+
commandMenuOverlayRef: v,
|
|
896
|
+
activeCommandOptionId: y,
|
|
897
|
+
handleTextareaClick: C,
|
|
898
|
+
handleTextareaFocus: T,
|
|
899
|
+
handleTextareaKeyUp: E,
|
|
900
|
+
skipFocusMenuEvaluationRef: w,
|
|
901
|
+
triggerEnd: O,
|
|
902
|
+
hasCommandEmptyQueryHint: A,
|
|
903
|
+
markerOffset: j,
|
|
904
|
+
handleCloseCommandMenu: M,
|
|
905
|
+
isSendGesture: P,
|
|
906
|
+
handleCommandMenuKeyDown: (e) => {
|
|
907
|
+
if (!u || e.nativeEvent.isComposing) return !1;
|
|
908
|
+
if (e.key === "Escape") return e.preventDefault(), e.stopPropagation(), p(), !0;
|
|
909
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") return e.preventDefault(), b(e.key === "ArrowDown" ? yt.Next : yt.Previous), !0;
|
|
910
|
+
if (e.key !== "Enter" || e.shiftKey) return !1;
|
|
911
|
+
let t = x();
|
|
912
|
+
return t == null ? P(e) ? (e.preventDefault(), !0) : !1 : (e.preventDefault(), t.click(), !0);
|
|
913
|
+
}
|
|
914
|
+
};
|
|
915
|
+
}, St = ({ toolsMenuItems: e, canRemoveTools: t, isPhone: n, onToolToggle: r }) => {
|
|
916
|
+
let [i, a] = J([]), o = (e ?? []).map((e) => e.id).join("|");
|
|
917
|
+
return G(() => {
|
|
918
|
+
a([]);
|
|
919
|
+
}, [o]), {
|
|
920
|
+
visibleTools: K(() => {
|
|
921
|
+
let r = e ?? [];
|
|
922
|
+
return n ? r.filter((e) => e.isSelected) : t ? r.filter((e) => e.isSelected || !i.includes(e.id)) : r;
|
|
923
|
+
}, [
|
|
924
|
+
e,
|
|
925
|
+
i,
|
|
926
|
+
t,
|
|
927
|
+
n
|
|
928
|
+
]),
|
|
929
|
+
handleToolDismiss: W((t) => {
|
|
930
|
+
a((e) => e.includes(t) ? e : [...e, t]), e?.find((e) => e.id === t)?.isSelected && r?.(t);
|
|
931
|
+
}, [e, r])
|
|
932
|
+
};
|
|
933
|
+
}, Ct = ({ addAttachments: e, isAttachmentsEnabled: t, isTextAttachmentsAllowed: n, pasteTextThreshold: r, maxMessageLength: i, onMessageTooLong: a, commandMenu: o }) => {
|
|
934
|
+
let s = t && n, { handlePaste: c } = pe(e, s ? r : Infinity);
|
|
935
|
+
return W((e) => {
|
|
936
|
+
if (!s) {
|
|
937
|
+
let t = e.clipboardData.getData("text/plain");
|
|
938
|
+
t.length >= i && a?.(t.length, i);
|
|
939
|
+
}
|
|
940
|
+
if (c(e), e.defaultPrevented) return;
|
|
941
|
+
let t = e.clipboardData.getData("text/plain").replace(/\r\n?/g, "\n");
|
|
942
|
+
t !== "" && o?.onTextPaste?.(t);
|
|
943
|
+
}, [
|
|
944
|
+
s,
|
|
945
|
+
i,
|
|
946
|
+
a,
|
|
947
|
+
c,
|
|
948
|
+
o
|
|
949
|
+
]);
|
|
950
|
+
}, wt = ({ message: e, setMessage: t, attachments: n, resetAttachments: r, historyNav: i, onSend: a, onMessageTooLong: o, maxMessageLength: s, isSendDisabled: c, isVoiceActive: l, isInputDisabled: u, isStreaming: d, canSend: f, hasModelSelected: p, handleUndoKeyDown: m, handleCommandMenuKeyDown: h, isSendGesture: g, onBackspaceAtCaret: _ }) => {
|
|
951
|
+
let v = async () => {
|
|
952
|
+
if (c || l) return;
|
|
953
|
+
if (e.length >= s) {
|
|
954
|
+
o?.(e.length, s);
|
|
955
|
+
return;
|
|
956
|
+
}
|
|
957
|
+
let u = e, d = n;
|
|
958
|
+
t(""), i.reset();
|
|
959
|
+
try {
|
|
960
|
+
await a?.(u, d), d.forEach((e) => {
|
|
961
|
+
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
962
|
+
}), r([]);
|
|
963
|
+
} catch {
|
|
964
|
+
t(u), r(d);
|
|
965
|
+
}
|
|
966
|
+
};
|
|
967
|
+
return {
|
|
968
|
+
handleSend: v,
|
|
969
|
+
handleKeyDown: (n) => {
|
|
970
|
+
if (!l && !m(n) && !h(n)) {
|
|
971
|
+
if (!n.nativeEvent.isComposing && !u && !d) {
|
|
972
|
+
if (n.key === "ArrowUp" || n.key === "ArrowDown") {
|
|
973
|
+
let r = n.currentTarget.selectionStart ?? 0, a = i.navigate(n.key === "ArrowUp" ? "up" : "down", e, r);
|
|
974
|
+
if (a !== null) {
|
|
975
|
+
n.preventDefault(), t(a);
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
if (n.key === "Backspace" && _ != null && n.currentTarget.selectionStart === n.currentTarget.selectionEnd && n.currentTarget.selectionStart != null) {
|
|
980
|
+
let t = _(n.currentTarget.selectionStart);
|
|
981
|
+
if (t != null) {
|
|
982
|
+
n.preventDefault();
|
|
983
|
+
let r = n.currentTarget;
|
|
984
|
+
r.setSelectionRange(t.start, t.start + t.length), typeof document.execCommand == "function" && document.execCommand("delete", !1) || He(r, e.slice(0, t.start) + e.slice(t.start + t.length), t.start);
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
n.key === "Enter" && g(n) && (n.preventDefault(), !d && f && p && !u && v());
|
|
546
990
|
}
|
|
547
|
-
}
|
|
548
|
-
}, []), m = H(() => d.current?.stop?.(), []), h = H(() => {
|
|
549
|
-
d.current?.controller.abort(), d.current = null, c(null), o("idle");
|
|
550
|
-
}, []);
|
|
551
|
-
return U(() => () => {
|
|
552
|
-
d.current?.controller.abort(), d.current = null;
|
|
553
|
-
}, []), {
|
|
554
|
-
state: a,
|
|
555
|
-
analyserNodeRef: l,
|
|
556
|
-
errorMessage: s,
|
|
557
|
-
startRecording: p,
|
|
558
|
-
stopRecording: m,
|
|
559
|
-
discardRecording: h
|
|
991
|
+
}
|
|
560
992
|
};
|
|
561
|
-
},
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
993
|
+
}, Tt = ({ addAttachments: e, buildAttachments: t, draftRef: n, setMessage: r, historyNav: i, onChange: a, onTranscribeAudio: o, voiceErrorLabel: s, textareaRef: c, skipFocusMenuEvaluationRef: l }) => {
|
|
994
|
+
let u = W((n) => {
|
|
995
|
+
e(t([n]));
|
|
996
|
+
}, [e, t]), d = q(!1), [f, p] = J({
|
|
997
|
+
text: "",
|
|
998
|
+
revision: 0
|
|
999
|
+
}), { state: m, analyserNodeRef: h, errorMessage: g, startRecording: _, stopRecording: v, discardRecording: y } = Ze({
|
|
1000
|
+
onAttachAudio: u,
|
|
1001
|
+
onTranscribeAudio: o,
|
|
1002
|
+
onTranscript: W((e) => {
|
|
1003
|
+
let t = e.trim();
|
|
1004
|
+
if (t) {
|
|
1005
|
+
let e = n.current, o = `${e}${e && !/\s$/.test(e) ? " " : ""}${t}`;
|
|
1006
|
+
n.current = o, r(o), p((e) => ({
|
|
1007
|
+
text: t,
|
|
1008
|
+
revision: e.revision + 1
|
|
1009
|
+
})), i.notifyChange(), a?.(o);
|
|
1010
|
+
}
|
|
1011
|
+
d.current = !0;
|
|
1012
|
+
}, [
|
|
1013
|
+
n,
|
|
1014
|
+
r,
|
|
1015
|
+
i,
|
|
1016
|
+
a
|
|
1017
|
+
]),
|
|
1018
|
+
errorLabel: s
|
|
1019
|
+
}), b = m === Ge.Recording || m === Ge.Processing;
|
|
1020
|
+
return G(() => {
|
|
1021
|
+
if (m === Ge.Error || m === Ge.Idle && d.current) {
|
|
1022
|
+
d.current = !1;
|
|
1023
|
+
let e = c.current;
|
|
1024
|
+
if (e != null) {
|
|
1025
|
+
l.current = document.activeElement !== e, e.focus();
|
|
1026
|
+
let t = e.value.length;
|
|
1027
|
+
e.setSelectionRange(t, t);
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
}, [
|
|
1031
|
+
m,
|
|
1032
|
+
c,
|
|
1033
|
+
l
|
|
1034
|
+
]), {
|
|
1035
|
+
voiceState: m,
|
|
1036
|
+
analyserNodeRef: h,
|
|
1037
|
+
voiceError: g,
|
|
1038
|
+
startRecording: _,
|
|
1039
|
+
stopRecording: v,
|
|
1040
|
+
discardRecording: y,
|
|
1041
|
+
isVoiceActive: b,
|
|
1042
|
+
latestTranscript: f
|
|
1043
|
+
};
|
|
1044
|
+
}, Et = (e) => c({
|
|
1045
|
+
"--ci-bg": e?.background,
|
|
1046
|
+
"--ci-text": e?.text,
|
|
1047
|
+
"--ci-border": e?.border,
|
|
1048
|
+
"--ci-border-focus": e?.borderFocus,
|
|
1049
|
+
"--ci-placeholder": e?.placeholder,
|
|
1050
|
+
"--ci-text-disabled": e?.textDisabled,
|
|
1051
|
+
"--ci-model-selector-caret-color": e?.modelSelectorCaret,
|
|
1052
|
+
"--ci-model-selector-hover-bg": e?.modelSelectorHoverBg,
|
|
1053
|
+
"--ci-model-selector-disabled-color": e?.modelSelectorDisabled,
|
|
1054
|
+
"--ci-model-selector-name-color": e?.modelSelectorName,
|
|
1055
|
+
"--ci-model-selector-version-color": e?.modelSelectorVersion,
|
|
1056
|
+
"--ci-voice-waveform": e?.voiceWaveform,
|
|
1057
|
+
"--ci-voice-accent": e?.voiceAccent,
|
|
1058
|
+
"--ci-mention-highlight-bg": e?.mentionHighlightBg,
|
|
1059
|
+
"--ci-mention-highlight-text": e?.mentionHighlightText,
|
|
1060
|
+
"--ci-mention-highlight-unsupported-bg": e?.mentionHighlightUnsupportedBg,
|
|
1061
|
+
"--ci-mention-highlight-unsupported-text": e?.mentionHighlightUnsupportedText,
|
|
1062
|
+
"--ci-selection-highlight-bg": e?.selectionHighlightBg
|
|
1063
|
+
}), Dt = {
|
|
566
1064
|
item: "_item_1sr2n_1",
|
|
567
1065
|
itemIcon: "_itemIcon_1sr2n_11"
|
|
568
|
-
},
|
|
1066
|
+
}, Ot = ({ isOpen: e, title: t, closeLabel: n, onClose: r, style: i, items: a, className: o, titleClassName: s = "dial-body-semi-text", itemLabelClassName: u = "dial-small-text", btnTextClassName: d = "", colors: f }) => {
|
|
569
1067
|
let p = (e) => {
|
|
570
1068
|
e(), r();
|
|
571
1069
|
}, m = c({
|
|
@@ -574,7 +1072,7 @@ var q = {
|
|
|
574
1072
|
"--ci-sheet-item-active": f?.itemActiveBg,
|
|
575
1073
|
"--ci-sheet-icon": f?.itemIcon
|
|
576
1074
|
});
|
|
577
|
-
return /* @__PURE__ */
|
|
1075
|
+
return /* @__PURE__ */ H(Fe, {
|
|
578
1076
|
isOpen: e,
|
|
579
1077
|
title: t,
|
|
580
1078
|
closeLabel: n,
|
|
@@ -583,23 +1081,23 @@ var q = {
|
|
|
583
1081
|
className: o,
|
|
584
1082
|
titleClassName: s,
|
|
585
1083
|
colors: f?.shell,
|
|
586
|
-
children: /* @__PURE__ */
|
|
1084
|
+
children: /* @__PURE__ */ H("ul", {
|
|
587
1085
|
role: "list",
|
|
588
1086
|
className: "flex flex-col",
|
|
589
1087
|
style: m,
|
|
590
|
-
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */
|
|
1088
|
+
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ H("li", { children: /* @__PURE__ */ H(h, {
|
|
591
1089
|
type: "button",
|
|
592
|
-
className: l(
|
|
593
|
-
iconBefore: /* @__PURE__ */
|
|
594
|
-
className:
|
|
1090
|
+
className: l(Dt.item, "w-full gap-3 px-4 py-[10px] text-start"),
|
|
1091
|
+
iconBefore: /* @__PURE__ */ H("span", {
|
|
1092
|
+
className: Dt.itemIcon,
|
|
595
1093
|
children: n
|
|
596
1094
|
}),
|
|
597
|
-
iconAfter: r ? /* @__PURE__ */
|
|
1095
|
+
iconAfter: r ? /* @__PURE__ */ H("span", {
|
|
598
1096
|
className: "ms-auto",
|
|
599
1097
|
children: r
|
|
600
1098
|
}) : null,
|
|
601
1099
|
textClassName: d,
|
|
602
|
-
label: /* @__PURE__ */
|
|
1100
|
+
label: /* @__PURE__ */ H("span", {
|
|
603
1101
|
className: u,
|
|
604
1102
|
children: t
|
|
605
1103
|
}),
|
|
@@ -607,9 +1105,9 @@ var q = {
|
|
|
607
1105
|
}) }, e))
|
|
608
1106
|
})
|
|
609
1107
|
});
|
|
610
|
-
},
|
|
611
|
-
let [s, c] =
|
|
612
|
-
|
|
1108
|
+
}, kt = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
1109
|
+
let [s, c] = J(t), [l, u] = J(n), [d, f] = J(r), p = q(o);
|
|
1110
|
+
G(() => {
|
|
613
1111
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
614
1112
|
}, [
|
|
615
1113
|
o,
|
|
@@ -626,7 +1124,7 @@ var q = {
|
|
|
626
1124
|
setResponseFormat: c,
|
|
627
1125
|
setSystemPrompt: u,
|
|
628
1126
|
setTemperature: f,
|
|
629
|
-
handleSubmit:
|
|
1127
|
+
handleSubmit: W(() => {
|
|
630
1128
|
if (!m) return;
|
|
631
1129
|
let t = {};
|
|
632
1130
|
e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
|
|
@@ -640,17 +1138,17 @@ var q = {
|
|
|
640
1138
|
a
|
|
641
1139
|
])
|
|
642
1140
|
};
|
|
643
|
-
},
|
|
1141
|
+
}, At = { label: "_label_14i7c_1" }, jt = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: a, onSystemPromptChange: s, onTemperatureChange: u, responseFormatLabel: d = "Response format", responseFormatHint: f = "Applies to new and existing messages", responseFormatMarkdownLabel: p = "Markdown", responseFormatPlainTextLabel: m = "Plain text", systemPromptLabel: h = "System prompt", systemPromptTooltip: g = "Enter a prompt", temperatureLabel: _ = "Temperature", temperatureLabels: v = [
|
|
644
1142
|
"Precise",
|
|
645
1143
|
"Neutral",
|
|
646
1144
|
"Creative"
|
|
647
1145
|
], temperatureHint: y, labelClassName: b = "!dial-small-semi-text", colors: x }) => {
|
|
648
|
-
let S = c({ "--csf-label-text": x?.labelText }), C = l(b,
|
|
649
|
-
return /* @__PURE__ */
|
|
1146
|
+
let S = c({ "--csf-label-text": x?.labelText }), C = l(b, At.label, "gap-1");
|
|
1147
|
+
return /* @__PURE__ */ U("div", {
|
|
650
1148
|
className: "flex flex-col gap-4 px-6 pb-3",
|
|
651
1149
|
style: S,
|
|
652
1150
|
children: [
|
|
653
|
-
e.responseFormat && /* @__PURE__ */
|
|
1151
|
+
e.responseFormat && /* @__PURE__ */ H(z, {
|
|
654
1152
|
id: "response-format",
|
|
655
1153
|
labelProps: {
|
|
656
1154
|
label: d,
|
|
@@ -658,7 +1156,7 @@ var q = {
|
|
|
658
1156
|
caption: f
|
|
659
1157
|
},
|
|
660
1158
|
optionsClassName: "mb-2",
|
|
661
|
-
orientation:
|
|
1159
|
+
orientation: B.Column,
|
|
662
1160
|
value: t ?? o.Markdown,
|
|
663
1161
|
items: [{
|
|
664
1162
|
value: o.Markdown,
|
|
@@ -669,18 +1167,18 @@ var q = {
|
|
|
669
1167
|
}],
|
|
670
1168
|
onChange: (e) => a(e)
|
|
671
1169
|
}),
|
|
672
|
-
e.systemPrompt && /* @__PURE__ */
|
|
1170
|
+
e.systemPrompt && /* @__PURE__ */ H(ae, {
|
|
673
1171
|
value: n,
|
|
674
1172
|
placeholder: g,
|
|
675
1173
|
className: i,
|
|
676
|
-
resize:
|
|
1174
|
+
resize: oe.Vertical,
|
|
677
1175
|
labelProps: {
|
|
678
1176
|
className: C,
|
|
679
1177
|
label: h
|
|
680
1178
|
},
|
|
681
1179
|
onChange: (e) => s(e ?? "")
|
|
682
1180
|
}),
|
|
683
|
-
e.temperature && /* @__PURE__ */
|
|
1181
|
+
e.temperature && /* @__PURE__ */ H(re, {
|
|
684
1182
|
labelProps: {
|
|
685
1183
|
label: _,
|
|
686
1184
|
className: C,
|
|
@@ -697,8 +1195,8 @@ var q = {
|
|
|
697
1195
|
})
|
|
698
1196
|
]
|
|
699
1197
|
});
|
|
700
|
-
},
|
|
701
|
-
let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat: O, setSystemPrompt: k, setTemperature:
|
|
1198
|
+
}, Mt = ({ 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 }) => {
|
|
1199
|
+
let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat: O, setSystemPrompt: k, setTemperature: A, handleSubmit: j } = kt({
|
|
702
1200
|
isOpen: e,
|
|
703
1201
|
features: o,
|
|
704
1202
|
initialResponseFormat: s,
|
|
@@ -707,7 +1205,7 @@ var q = {
|
|
|
707
1205
|
onSave: d,
|
|
708
1206
|
onClose: r
|
|
709
1207
|
});
|
|
710
|
-
return /* @__PURE__ */
|
|
1208
|
+
return /* @__PURE__ */ U(Fe, {
|
|
711
1209
|
isOpen: e,
|
|
712
1210
|
title: f,
|
|
713
1211
|
closeLabel: i,
|
|
@@ -715,14 +1213,14 @@ var q = {
|
|
|
715
1213
|
onBack: t,
|
|
716
1214
|
backLabel: n,
|
|
717
1215
|
style: a,
|
|
718
|
-
children: [/* @__PURE__ */
|
|
1216
|
+
children: [/* @__PURE__ */ H(jt, {
|
|
719
1217
|
features: o,
|
|
720
1218
|
responseFormat: w,
|
|
721
1219
|
systemPrompt: T,
|
|
722
1220
|
temperature: E,
|
|
723
1221
|
onResponseFormatChange: O,
|
|
724
1222
|
onSystemPromptChange: k,
|
|
725
|
-
onTemperatureChange:
|
|
1223
|
+
onTemperatureChange: A,
|
|
726
1224
|
responseFormatLabel: p,
|
|
727
1225
|
responseFormatHint: m,
|
|
728
1226
|
responseFormatMarkdownLabel: h,
|
|
@@ -732,23 +1230,23 @@ var q = {
|
|
|
732
1230
|
temperatureLabel: y,
|
|
733
1231
|
temperatureLabels: b,
|
|
734
1232
|
temperatureHint: x
|
|
735
|
-
}), /* @__PURE__ */
|
|
1233
|
+
}), /* @__PURE__ */ H("div", {
|
|
736
1234
|
className: l("px-6 py-4 mobile:pb-8"),
|
|
737
|
-
children: /* @__PURE__ */
|
|
1235
|
+
children: /* @__PURE__ */ H(ce, {
|
|
738
1236
|
tooltip: C,
|
|
739
1237
|
hideTooltip: D || !C,
|
|
740
1238
|
triggerClassName: "w-full",
|
|
741
|
-
children: /* @__PURE__ */
|
|
1239
|
+
children: /* @__PURE__ */ H(L, {
|
|
742
1240
|
label: S,
|
|
743
|
-
onClick:
|
|
1241
|
+
onClick: j,
|
|
744
1242
|
disabled: !D,
|
|
745
1243
|
className: "w-full"
|
|
746
1244
|
})
|
|
747
1245
|
})
|
|
748
1246
|
})]
|
|
749
1247
|
});
|
|
750
|
-
},
|
|
751
|
-
let { responseFormat: C, systemPrompt: w, temperature: T, canSubmit: E, setResponseFormat: D, setSystemPrompt: O, setTemperature: k, handleSubmit:
|
|
1248
|
+
}, Nt = { modal: "_modal_kl0h0_1" }, Pt = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", titleClassName: s = "dial-h1-text", responseFormatLabel: l, responseFormatHint: u, responseFormatMarkdownLabel: d, responseFormatPlainTextLabel: f, systemPromptLabel: p, systemPromptTooltip: m, temperatureLabel: h, temperatureLabels: _, temperatureHint: v, saveLabel: y = "Apply changes", saveDisabledTooltip: b, backgroundClassName: x = Nt.modal, colors: S }) => {
|
|
1249
|
+
let { responseFormat: C, systemPrompt: w, temperature: T, canSubmit: E, setResponseFormat: D, setSystemPrompt: O, setTemperature: k, handleSubmit: A } = kt({
|
|
752
1250
|
features: e,
|
|
753
1251
|
initialResponseFormat: t,
|
|
754
1252
|
initialSystemPrompt: n,
|
|
@@ -756,25 +1254,25 @@ var q = {
|
|
|
756
1254
|
onSave: i,
|
|
757
1255
|
onClose: a
|
|
758
1256
|
});
|
|
759
|
-
return /* @__PURE__ */
|
|
1257
|
+
return /* @__PURE__ */ H(F, {
|
|
760
1258
|
open: !0,
|
|
761
1259
|
header: o,
|
|
762
1260
|
titleClassName: s,
|
|
763
|
-
size:
|
|
1261
|
+
size: I.Sm,
|
|
764
1262
|
onClose: a,
|
|
765
1263
|
className: x,
|
|
766
1264
|
overlayStyle: c({ "--csm-bg": S?.background }),
|
|
767
1265
|
mainButtons: [{
|
|
768
1266
|
label: y,
|
|
769
1267
|
variant: g.Primary,
|
|
770
|
-
onClick:
|
|
1268
|
+
onClick: A,
|
|
771
1269
|
disabled: !E,
|
|
772
1270
|
tooltipProps: b ? {
|
|
773
1271
|
tooltip: b,
|
|
774
1272
|
hideTooltip: E
|
|
775
1273
|
} : void 0
|
|
776
1274
|
}],
|
|
777
|
-
children: /* @__PURE__ */
|
|
1275
|
+
children: /* @__PURE__ */ H(jt, {
|
|
778
1276
|
features: e,
|
|
779
1277
|
responseFormat: C,
|
|
780
1278
|
systemPrompt: w,
|
|
@@ -793,15 +1291,15 @@ var q = {
|
|
|
793
1291
|
temperatureHint: v
|
|
794
1292
|
})
|
|
795
1293
|
});
|
|
796
|
-
},
|
|
1294
|
+
}, Z = {
|
|
797
1295
|
icon: "_icon_1fv6z_1",
|
|
798
1296
|
selectedIcon: "_selectedIcon_1fv6z_5"
|
|
799
|
-
},
|
|
1297
|
+
}, Ft = ({ 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: f }) => {
|
|
800
1298
|
let m = c({
|
|
801
1299
|
"--tbs-icon-text": f?.iconText,
|
|
802
1300
|
"--tbs-selected-icon-text": f?.selectedIconText
|
|
803
1301
|
});
|
|
804
|
-
return /* @__PURE__ */
|
|
1302
|
+
return /* @__PURE__ */ H(Fe, {
|
|
805
1303
|
isOpen: e,
|
|
806
1304
|
title: o,
|
|
807
1305
|
closeLabel: i,
|
|
@@ -809,23 +1307,23 @@ var q = {
|
|
|
809
1307
|
onBack: t,
|
|
810
1308
|
backLabel: n,
|
|
811
1309
|
style: a,
|
|
812
|
-
children: /* @__PURE__ */
|
|
1310
|
+
children: /* @__PURE__ */ H("div", {
|
|
813
1311
|
role: "menu",
|
|
814
1312
|
"aria-label": o,
|
|
815
1313
|
className: "flex flex-col px-2 pb-4",
|
|
816
1314
|
style: m,
|
|
817
|
-
children: s.map((e) => /* @__PURE__ */
|
|
1315
|
+
children: s.map((e) => /* @__PURE__ */ H(k, {
|
|
818
1316
|
role: "menuitemcheckbox",
|
|
819
1317
|
"aria-checked": e.isSelected,
|
|
820
|
-
icon: /* @__PURE__ */
|
|
821
|
-
className: l("flex items-center",
|
|
1318
|
+
icon: /* @__PURE__ */ H("span", {
|
|
1319
|
+
className: l("flex items-center", Z.icon),
|
|
822
1320
|
children: e.icon
|
|
823
1321
|
}),
|
|
824
1322
|
label: e.label,
|
|
825
1323
|
labelClassName: d,
|
|
826
|
-
trailing: e.isSelected ? /* @__PURE__ */
|
|
827
|
-
className: l("flex",
|
|
828
|
-
children: /* @__PURE__ */
|
|
1324
|
+
trailing: e.isSelected ? /* @__PURE__ */ H("span", {
|
|
1325
|
+
className: l("flex", Z.selectedIcon),
|
|
1326
|
+
children: /* @__PURE__ */ H(he, {
|
|
829
1327
|
size: p,
|
|
830
1328
|
"aria-hidden": !0,
|
|
831
1329
|
stroke: y
|
|
@@ -835,46 +1333,46 @@ var q = {
|
|
|
835
1333
|
}, e.id))
|
|
836
1334
|
})
|
|
837
1335
|
});
|
|
838
|
-
},
|
|
1336
|
+
}, Q = {
|
|
839
1337
|
toolIcon: "_toolIcon_ma5s5_1",
|
|
840
1338
|
chevronIcon: "_chevronIcon_ma5s5_5"
|
|
841
|
-
},
|
|
842
|
-
let k = d(),
|
|
843
|
-
e && (
|
|
844
|
-
}, []),
|
|
845
|
-
|
|
846
|
-
|
|
1339
|
+
}, It = ({ onAttachClick: e, onRecordVoice: t, recordVoiceLabel: n = "Record voice", attachLabel: r, addMenuTitle: i, menuTitle: a, menuCloseLabel: s, style: u, listClassName: m = "w-[240px]", isDisabled: h = !1, chatSettings: g, extraMenuItems: _, toolsMenuItems: x = [], onToolToggle: S, toolsMenuTitle: C = "Tools", toolsBackLabel: T = "Back", menuOverlays: E, getCaretPosition: D, colors: O }) => {
|
|
1340
|
+
let k = d(), j = f(), [M, N] = J(!1), P = q(0), [ee, F] = J(!1), [I, L] = J(!1), [R, z] = J(!1), [B, V] = J(null), te = W((e) => {
|
|
1341
|
+
e && (P.current = 0), F(e), e || (z(!1), V(null));
|
|
1342
|
+
}, []), ne = q(j);
|
|
1343
|
+
G(() => {
|
|
1344
|
+
ne.current !== j && (ne.current = j, j ? (N(ee && !R && B === null), F(!1)) : (P.current = R || B !== null ? -1 : 0, F(M || R || B !== null), N(!1)));
|
|
847
1345
|
}, [
|
|
848
|
-
A,
|
|
849
|
-
ne,
|
|
850
1346
|
j,
|
|
851
|
-
|
|
852
|
-
|
|
1347
|
+
ee,
|
|
1348
|
+
M,
|
|
1349
|
+
R,
|
|
1350
|
+
B
|
|
853
1351
|
]);
|
|
854
|
-
let
|
|
1352
|
+
let re = K(() => c({
|
|
855
1353
|
"--aab-tool-icon": O?.toolIcon,
|
|
856
1354
|
"--aab-chevron-icon": O?.chevronIcon
|
|
857
|
-
}), [O?.toolIcon, O?.chevronIcon]),
|
|
1355
|
+
}), [O?.toolIcon, O?.chevronIcon]), ie = x.length > 0 && S != null, ae = K(() => x.map((e) => ({
|
|
858
1356
|
key: e.id,
|
|
859
1357
|
label: e.label,
|
|
860
|
-
icon: /* @__PURE__ */
|
|
861
|
-
style:
|
|
862
|
-
className: l("flex items-center",
|
|
1358
|
+
icon: /* @__PURE__ */ H("span", {
|
|
1359
|
+
style: re,
|
|
1360
|
+
className: l("flex items-center", Q.toolIcon),
|
|
863
1361
|
children: e.icon
|
|
864
1362
|
}),
|
|
865
1363
|
selectable: !0,
|
|
866
|
-
mark:
|
|
1364
|
+
mark: A.Check,
|
|
867
1365
|
checked: e.isSelected,
|
|
868
1366
|
onClick: () => S?.(e.id)
|
|
869
1367
|
})), [
|
|
870
1368
|
x,
|
|
871
1369
|
S,
|
|
872
|
-
|
|
873
|
-
]),
|
|
1370
|
+
re
|
|
1371
|
+
]), oe = K(() => [
|
|
874
1372
|
...e == null ? [] : [{
|
|
875
1373
|
key: "attach",
|
|
876
1374
|
label: r,
|
|
877
|
-
icon: /* @__PURE__ */
|
|
1375
|
+
icon: /* @__PURE__ */ H(be, {
|
|
878
1376
|
size: p,
|
|
879
1377
|
"aria-hidden": !0,
|
|
880
1378
|
stroke: y
|
|
@@ -882,28 +1380,28 @@ var q = {
|
|
|
882
1380
|
onClick: e
|
|
883
1381
|
}],
|
|
884
1382
|
..._ ?? [],
|
|
885
|
-
...
|
|
1383
|
+
...ie ? [{
|
|
886
1384
|
key: "tools",
|
|
887
1385
|
label: C,
|
|
888
|
-
icon: /* @__PURE__ */
|
|
1386
|
+
icon: /* @__PURE__ */ H(we, {
|
|
889
1387
|
size: p,
|
|
890
1388
|
"aria-hidden": !0,
|
|
891
1389
|
stroke: y
|
|
892
1390
|
}),
|
|
893
|
-
onClick:
|
|
894
|
-
|
|
1391
|
+
onClick: j ? () => {
|
|
1392
|
+
z(!0);
|
|
895
1393
|
} : () => void 0,
|
|
896
|
-
...
|
|
1394
|
+
...j ? { iconAfter: /* @__PURE__ */ H(_e, {
|
|
897
1395
|
size: p,
|
|
898
1396
|
stroke: y,
|
|
899
|
-
style:
|
|
900
|
-
className: l("rtl:scale-x-[-1]",
|
|
1397
|
+
style: re,
|
|
1398
|
+
className: l("rtl:scale-x-[-1]", Q.chevronIcon),
|
|
901
1399
|
"aria-hidden": !0
|
|
902
1400
|
}) } : {
|
|
903
|
-
children:
|
|
904
|
-
subMenuOpen:
|
|
1401
|
+
children: ae,
|
|
1402
|
+
subMenuOpen: R,
|
|
905
1403
|
onSubMenuOpenChange: (e) => {
|
|
906
|
-
|
|
1404
|
+
z(e), e && V(null);
|
|
907
1405
|
}
|
|
908
1406
|
}
|
|
909
1407
|
}] : [],
|
|
@@ -911,461 +1409,329 @@ var q = {
|
|
|
911
1409
|
key: e.key,
|
|
912
1410
|
label: e.title,
|
|
913
1411
|
icon: e.icon,
|
|
914
|
-
onClick:
|
|
915
|
-
|
|
1412
|
+
onClick: j ? () => {
|
|
1413
|
+
V(e.key);
|
|
916
1414
|
} : () => void 0,
|
|
917
|
-
...
|
|
1415
|
+
...j ? { iconAfter: /* @__PURE__ */ H(_e, {
|
|
918
1416
|
size: p,
|
|
919
1417
|
stroke: y,
|
|
920
|
-
style:
|
|
921
|
-
className: l("rtl:scale-x-[-1]",
|
|
1418
|
+
style: re,
|
|
1419
|
+
className: l("rtl:scale-x-[-1]", Q.chevronIcon),
|
|
922
1420
|
"aria-hidden": !0
|
|
923
1421
|
}) } : {
|
|
924
|
-
subMenuOpen:
|
|
1422
|
+
subMenuOpen: B === e.key,
|
|
925
1423
|
onSubMenuOpenChange: (t) => {
|
|
926
|
-
|
|
1424
|
+
V((n) => t ? e.key : n === e.key ? null : n), t && z(!1);
|
|
927
1425
|
},
|
|
928
|
-
renderSubMenu: () => e.renderOverlay(() =>
|
|
1426
|
+
renderSubMenu: () => e.renderOverlay(() => te(!1), D?.() ?? 0)
|
|
929
1427
|
}
|
|
930
1428
|
})),
|
|
931
1429
|
...t == null ? [] : [{
|
|
932
1430
|
key: "record-voice",
|
|
933
1431
|
label: n,
|
|
934
|
-
icon: /* @__PURE__ */
|
|
1432
|
+
icon: /* @__PURE__ */ H(ye, {
|
|
935
1433
|
size: p,
|
|
936
1434
|
"aria-hidden": !0,
|
|
937
1435
|
stroke: y
|
|
938
1436
|
}),
|
|
939
1437
|
onClick: () => {
|
|
940
|
-
|
|
1438
|
+
te(!1), t();
|
|
941
1439
|
}
|
|
942
1440
|
}],
|
|
943
1441
|
...g == null ? [] : [{
|
|
944
1442
|
key: "chat-settings",
|
|
945
1443
|
label: g.menuItemLabel ?? "Chat settings",
|
|
946
|
-
icon: /* @__PURE__ */
|
|
1444
|
+
icon: /* @__PURE__ */ H(Ce, {
|
|
947
1445
|
size: p,
|
|
948
1446
|
"aria-hidden": !0,
|
|
949
1447
|
stroke: y
|
|
950
1448
|
}),
|
|
951
|
-
iconAfter: k ? /* @__PURE__ */
|
|
1449
|
+
iconAfter: k ? /* @__PURE__ */ H(_e, {
|
|
952
1450
|
size: p,
|
|
953
1451
|
stroke: y,
|
|
954
|
-
style:
|
|
955
|
-
className: l("rtl:scale-x-[-1]",
|
|
1452
|
+
style: re,
|
|
1453
|
+
className: l("rtl:scale-x-[-1]", Q.chevronIcon),
|
|
956
1454
|
"aria-hidden": !0
|
|
957
1455
|
}) : null,
|
|
958
|
-
onClick: () =>
|
|
1456
|
+
onClick: () => L(!0)
|
|
959
1457
|
}]
|
|
960
1458
|
], [
|
|
961
|
-
|
|
962
|
-
r,
|
|
963
|
-
e,
|
|
964
|
-
t,
|
|
965
|
-
n,
|
|
966
|
-
g,
|
|
967
|
-
_,
|
|
968
|
-
k,
|
|
969
|
-
A,
|
|
970
|
-
oe,
|
|
971
|
-
F,
|
|
972
|
-
L,
|
|
973
|
-
C,
|
|
974
|
-
se,
|
|
975
|
-
E,
|
|
976
|
-
D,
|
|
977
|
-
z
|
|
978
|
-
]);
|
|
979
|
-
if (ce.length === 0) return null;
|
|
980
|
-
let le = /* @__PURE__ */ B(b, {
|
|
981
|
-
matchReferenceWidth: !1,
|
|
982
|
-
placement: "bottom-start",
|
|
983
|
-
listClassName: m,
|
|
984
|
-
initialFocus: te.current,
|
|
985
|
-
overlayAriaLabel: i,
|
|
986
|
-
items: ce,
|
|
987
|
-
disabled: h,
|
|
988
|
-
open: ne,
|
|
989
|
-
onOpenChange: ae,
|
|
990
|
-
children: /* @__PURE__ */ B(w, {
|
|
991
|
-
icon: /* @__PURE__ */ B(we, {
|
|
992
|
-
size: v.LG,
|
|
993
|
-
"aria-hidden": !0,
|
|
994
|
-
stroke: y
|
|
995
|
-
}),
|
|
996
|
-
"aria-label": i,
|
|
997
|
-
"aria-haspopup": "menu",
|
|
998
|
-
tooltipProps: { tooltip: i },
|
|
999
|
-
disabled: h
|
|
1000
|
-
})
|
|
1001
|
-
});
|
|
1002
|
-
return /* @__PURE__ */ V(de, { children: [
|
|
1003
|
-
A ? /* @__PURE__ */ V(de, { children: [
|
|
1004
|
-
/* @__PURE__ */ B(w, {
|
|
1005
|
-
icon: /* @__PURE__ */ B(we, {
|
|
1006
|
-
size: v.LG,
|
|
1007
|
-
"aria-hidden": !0,
|
|
1008
|
-
stroke: y
|
|
1009
|
-
}),
|
|
1010
|
-
"aria-label": i,
|
|
1011
|
-
tooltipProps: { tooltip: i },
|
|
1012
|
-
disabled: h,
|
|
1013
|
-
onClick: () => M(!0)
|
|
1014
|
-
}),
|
|
1015
|
-
/* @__PURE__ */ B(pt, {
|
|
1016
|
-
isOpen: j,
|
|
1017
|
-
title: a,
|
|
1018
|
-
closeLabel: s,
|
|
1019
|
-
onClose: () => M(!1),
|
|
1020
|
-
style: u,
|
|
1021
|
-
items: ce,
|
|
1022
|
-
className: "pb-4",
|
|
1023
|
-
btnTextClassName: "flex-1"
|
|
1024
|
-
}),
|
|
1025
|
-
oe && /* @__PURE__ */ B(bt, {
|
|
1026
|
-
isOpen: F,
|
|
1027
|
-
onBack: () => {
|
|
1028
|
-
I(!1), M(!0);
|
|
1029
|
-
},
|
|
1030
|
-
backLabel: T,
|
|
1031
|
-
onClose: () => ae(!1),
|
|
1032
|
-
closeLabel: s,
|
|
1033
|
-
style: u,
|
|
1034
|
-
title: C,
|
|
1035
|
-
items: x,
|
|
1036
|
-
onToolToggle: S
|
|
1037
|
-
}),
|
|
1038
|
-
E?.map((e) => /* @__PURE__ */ B(Le, {
|
|
1039
|
-
isOpen: L === e.key,
|
|
1040
|
-
title: e.title,
|
|
1041
|
-
closeLabel: s,
|
|
1042
|
-
onBack: () => {
|
|
1043
|
-
ie(null), M(!0);
|
|
1044
|
-
},
|
|
1045
|
-
backLabel: e.backLabel ?? "Back",
|
|
1046
|
-
onClose: () => ae(!1),
|
|
1047
|
-
style: u,
|
|
1048
|
-
children: /* @__PURE__ */ B("div", {
|
|
1049
|
-
role: "menu",
|
|
1050
|
-
"aria-label": e.title,
|
|
1051
|
-
children: e.renderOverlay(() => ae(!1), D?.() ?? 0)
|
|
1052
|
-
})
|
|
1053
|
-
}, e.key))
|
|
1054
|
-
] }) : /* @__PURE__ */ B(de, { children: le }),
|
|
1055
|
-
k && g != null && /* @__PURE__ */ B(gt, {
|
|
1056
|
-
isOpen: N,
|
|
1057
|
-
onBack: () => {
|
|
1058
|
-
P(!1), A ? M(!0) : re(!0);
|
|
1059
|
-
},
|
|
1060
|
-
backLabel: g.backLabel ?? "Back",
|
|
1061
|
-
onClose: () => P(!1),
|
|
1062
|
-
closeLabel: s,
|
|
1063
|
-
style: u,
|
|
1064
|
-
features: g.features,
|
|
1065
|
-
initialResponseFormat: g.responseFormat ?? o.Markdown,
|
|
1066
|
-
initialSystemPrompt: g.systemPrompt,
|
|
1067
|
-
initialTemperature: g.temperature,
|
|
1068
|
-
onSave: g.onSave,
|
|
1069
|
-
title: g.title,
|
|
1070
|
-
responseFormatLabel: g.responseFormatLabel,
|
|
1071
|
-
responseFormatHint: g.responseFormatHint,
|
|
1072
|
-
responseFormatMarkdownLabel: g.responseFormatMarkdownLabel,
|
|
1073
|
-
responseFormatPlainTextLabel: g.responseFormatPlainTextLabel,
|
|
1074
|
-
systemPromptLabel: g.systemPromptLabel,
|
|
1075
|
-
systemPromptTooltip: g.systemPromptTooltip,
|
|
1076
|
-
temperatureLabel: g.temperatureLabel,
|
|
1077
|
-
temperatureLabels: g.temperatureLabels,
|
|
1078
|
-
temperatureHint: g.temperatureHint,
|
|
1079
|
-
saveLabel: g.saveLabel,
|
|
1080
|
-
saveDisabledTooltip: g.saveDisabledTooltip
|
|
1081
|
-
}),
|
|
1082
|
-
!k && g != null && N && /* @__PURE__ */ B(vt, {
|
|
1083
|
-
features: g.features,
|
|
1084
|
-
initialResponseFormat: g.responseFormat ?? o.Markdown,
|
|
1085
|
-
initialSystemPrompt: g.systemPrompt,
|
|
1086
|
-
initialTemperature: g.temperature,
|
|
1087
|
-
onSave: g.onSave,
|
|
1088
|
-
onClose: () => P(!1),
|
|
1089
|
-
title: g.title,
|
|
1090
|
-
responseFormatLabel: g.responseFormatLabel,
|
|
1091
|
-
responseFormatHint: g.responseFormatHint,
|
|
1092
|
-
responseFormatMarkdownLabel: g.responseFormatMarkdownLabel,
|
|
1093
|
-
responseFormatPlainTextLabel: g.responseFormatPlainTextLabel,
|
|
1094
|
-
systemPromptLabel: g.systemPromptLabel,
|
|
1095
|
-
systemPromptTooltip: g.systemPromptTooltip,
|
|
1096
|
-
temperatureLabel: g.temperatureLabel,
|
|
1097
|
-
temperatureLabels: g.temperatureLabels,
|
|
1098
|
-
temperatureHint: g.temperatureHint,
|
|
1099
|
-
saveLabel: g.saveLabel,
|
|
1100
|
-
saveDisabledTooltip: g.saveDisabledTooltip,
|
|
1101
|
-
colors: g.modalColors
|
|
1102
|
-
})
|
|
1103
|
-
] });
|
|
1104
|
-
}, Ct = {
|
|
1105
|
-
chip: "_chip_1lvv5_1",
|
|
1106
|
-
chipSelected: "_chipSelected_1lvv5_9",
|
|
1107
|
-
chipIcon: "_chipIcon_1lvv5_16",
|
|
1108
|
-
chipText: "_chipText_1lvv5_19",
|
|
1109
|
-
chipState: "_chipState_1lvv5_22",
|
|
1110
|
-
chipClose: "_chipClose_1lvv5_25"
|
|
1111
|
-
}, wt = (e) => `Remove ${e}`, Tt = ({ items: e, onToolToggle: t, onToolDismiss: n, canRemove: r = !0, removeLabel: i = wt, stateOnLabel: a, stateOffLabel: o, typography: s, colors: u }) => {
|
|
1112
|
-
if (e.length === 0) return null;
|
|
1113
|
-
let d = !!(a && o), f = c({
|
|
1114
|
-
"--ci-chip-bg": u?.chipBg,
|
|
1115
|
-
"--ci-chip-border": u?.chipBorder,
|
|
1116
|
-
"--ci-chip-icon": u?.chipIcon,
|
|
1117
|
-
"--ci-chip-text": u?.chipText,
|
|
1118
|
-
"--ci-chip-hover-bg": u?.chipHoverBg,
|
|
1119
|
-
"--ci-chip-selected-bg": u?.chipSelectedBg,
|
|
1120
|
-
"--ci-chip-selected-bg-hover": u?.chipSelectedHoverBg,
|
|
1121
|
-
"--ci-chip-selected-border": u?.chipSelectedBorder,
|
|
1122
|
-
"--ci-chip-selected-icon": u?.chipSelectedIcon,
|
|
1123
|
-
"--ci-chip-selected-text": u?.chipSelectedText,
|
|
1124
|
-
"--ci-chip-state-text": u?.chipStateText,
|
|
1125
|
-
"--ci-chip-close": u?.chipClose,
|
|
1126
|
-
"--ci-chip-close-hover": u?.chipCloseHover
|
|
1127
|
-
}), p = (e) => /* @__PURE__ */ B("span", {
|
|
1128
|
-
className: l(Ct.chipIcon, "flex shrink-0"),
|
|
1129
|
-
children: e.icon
|
|
1130
|
-
}), m = (e) => /* @__PURE__ */ V("span", {
|
|
1131
|
-
className: "flex min-w-0 items-center",
|
|
1132
|
-
children: [/* @__PURE__ */ V("span", {
|
|
1133
|
-
className: l(Ct.chipText, s?.fontClassName || "dial-small-paragraph-text", "truncate"),
|
|
1134
|
-
children: [e.label, d && /* @__PURE__ */ B("span", {
|
|
1135
|
-
"aria-hidden": !0,
|
|
1136
|
-
children: ":"
|
|
1137
|
-
})]
|
|
1138
|
-
}), d && /* @__PURE__ */ B("span", {
|
|
1139
|
-
className: l(Ct.chipState, s?.stateClassName || "dial-tiny-lead-text", "ms-1 shrink-0"),
|
|
1140
|
-
"aria-hidden": !0,
|
|
1141
|
-
children: e.isSelected ? a : o
|
|
1142
|
-
})]
|
|
1143
|
-
});
|
|
1144
|
-
return /* @__PURE__ */ B("div", {
|
|
1145
|
-
className: "flex flex-wrap items-center gap-2",
|
|
1146
|
-
style: f,
|
|
1147
|
-
children: e.map((e) => r ? /* @__PURE__ */ V("div", {
|
|
1148
|
-
className: l(Ct.chip, e.isSelected && Ct.chipSelected, "flex min-w-0 items-center gap-1.5 rounded-full border py-1 ps-2 pe-1 transition-colors"),
|
|
1149
|
-
children: [/* @__PURE__ */ V("button", {
|
|
1150
|
-
type: "button",
|
|
1151
|
-
onClick: () => t(e.id),
|
|
1152
|
-
"aria-pressed": e.isSelected,
|
|
1153
|
-
className: "flex min-w-0 items-center gap-1.5",
|
|
1154
|
-
children: [/* @__PURE__ */ B("span", {
|
|
1155
|
-
className: "flex shrink-0",
|
|
1156
|
-
"aria-hidden": !0,
|
|
1157
|
-
children: p(e)
|
|
1158
|
-
}), m(e)]
|
|
1159
|
-
}), /* @__PURE__ */ B("button", {
|
|
1160
|
-
type: "button",
|
|
1161
|
-
onClick: () => n(e.id),
|
|
1162
|
-
"aria-label": i(e.label),
|
|
1163
|
-
className: l(Ct.chipClose, "flex shrink-0 items-center rounded p-0.5 transition-colors"),
|
|
1164
|
-
children: /* @__PURE__ */ B(De, {
|
|
1165
|
-
size: 12,
|
|
1166
|
-
"aria-hidden": !0,
|
|
1167
|
-
stroke: y
|
|
1168
|
-
})
|
|
1169
|
-
})]
|
|
1170
|
-
}, e.id) : /* @__PURE__ */ B(le, {
|
|
1171
|
-
icon: p(e),
|
|
1172
|
-
label: m(e),
|
|
1173
|
-
isSelected: e.isSelected,
|
|
1174
|
-
onToggle: () => t(e.id),
|
|
1175
|
-
className: l(Ct.chip, e.isSelected && Ct.chipSelected, "h-auto min-w-0 gap-1.5 border px-2 py-1 transition-colors")
|
|
1176
|
-
}, e.id))
|
|
1177
|
-
});
|
|
1178
|
-
}, Y = {
|
|
1179
|
-
wrapper: "_wrapper_13067_2",
|
|
1180
|
-
wrapperDisabled: "_wrapperDisabled_13067_9",
|
|
1181
|
-
textarea: "_textarea_13067_13",
|
|
1182
|
-
textareaMentionMode: "_textareaMentionMode_13067_19",
|
|
1183
|
-
commandHint: "_commandHint_13067_53",
|
|
1184
|
-
mentionHighlight: "_mentionHighlight_13067_57",
|
|
1185
|
-
mentionHighlightUnsupported: "_mentionHighlightUnsupported_13067_63",
|
|
1186
|
-
selectionHighlight: "_selectionHighlight_13067_69",
|
|
1187
|
-
modelOverlayPanel: "_modelOverlayPanel_13067_78",
|
|
1188
|
-
modelSelectorButton: "_modelSelectorButton_13067_82",
|
|
1189
|
-
modelSelectorCaret: "_modelSelectorCaret_13067_82",
|
|
1190
|
-
modelSelectorName: "_modelSelectorName_13067_85",
|
|
1191
|
-
modelSelectorVersion: "_modelSelectorVersion_13067_88",
|
|
1192
|
-
modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_13067_97"
|
|
1193
|
-
}, Et = {
|
|
1194
|
-
waveformCanvas: "_waveformCanvas_18zb5_1",
|
|
1195
|
-
recordingDot: "_recordingDot_18zb5_15",
|
|
1196
|
-
"recording-pulse": "_recording-pulse_18zb5_1"
|
|
1197
|
-
}, Dt = 3, Ot = 4, kt = 200, At = ({ state: e, analyserNodeRef: t, onStop: n, onDiscard: r, attachButton: i, stopLabel: a = "Stop recording", discardLabel: o = "Discard recording", processingLabel: s = "Transcribing audio…", style: c, className: u, embedded: d = !1 }) => {
|
|
1198
|
-
let f = G(null), p = G(new Float32Array(kt)), m = G(0), h = G(0), g = e === rt.Recording, _ = e === rt.Processing, b = H((e) => {
|
|
1199
|
-
let t = e.getContext("2d");
|
|
1200
|
-
if (!t) return;
|
|
1201
|
-
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
1202
|
-
let { width: n, height: r } = e;
|
|
1203
|
-
t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
|
|
1204
|
-
let i = Math.min(Math.max(1, Math.floor(n / Ot)), 199), a = m.current, o = h.current;
|
|
1205
|
-
t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
|
|
1206
|
-
for (let e = 0; e <= i; e++) {
|
|
1207
|
-
let n = ((a - i + e) % kt + kt) % kt, o = p.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
|
|
1208
|
-
t.fillRect(e * Ot, (r - c) / 2, Dt, c);
|
|
1209
|
-
}
|
|
1210
|
-
t.restore();
|
|
1211
|
-
}, []);
|
|
1212
|
-
U(() => {
|
|
1213
|
-
if (!g) return;
|
|
1214
|
-
let e = f.current;
|
|
1215
|
-
if (!e) return;
|
|
1216
|
-
p.current.fill(0), m.current = 0, h.current = 0;
|
|
1217
|
-
let n, r = () => {
|
|
1218
|
-
if (h.current += 1, h.current >= Ot) {
|
|
1219
|
-
h.current -= Ot;
|
|
1220
|
-
let e = t.current;
|
|
1221
|
-
if (e) {
|
|
1222
|
-
let t = new Uint8Array(e.frequencyBinCount);
|
|
1223
|
-
e.getByteTimeDomainData(t);
|
|
1224
|
-
let n = 0;
|
|
1225
|
-
for (let e = 0; e < t.length; e++) {
|
|
1226
|
-
let r = (t[e] - 128) / 128;
|
|
1227
|
-
n += r * r;
|
|
1228
|
-
}
|
|
1229
|
-
p.current[m.current % kt] = Math.sqrt(n / t.length), m.current++;
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
b(e), n = requestAnimationFrame(r);
|
|
1233
|
-
};
|
|
1234
|
-
return n = requestAnimationFrame(r), () => {
|
|
1235
|
-
cancelAnimationFrame(n);
|
|
1236
|
-
};
|
|
1237
|
-
}, [
|
|
1238
|
-
g,
|
|
1459
|
+
te,
|
|
1460
|
+
r,
|
|
1461
|
+
e,
|
|
1239
1462
|
t,
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1463
|
+
n,
|
|
1464
|
+
g,
|
|
1465
|
+
_,
|
|
1466
|
+
k,
|
|
1467
|
+
j,
|
|
1468
|
+
ie,
|
|
1469
|
+
R,
|
|
1470
|
+
B,
|
|
1471
|
+
C,
|
|
1472
|
+
ae,
|
|
1473
|
+
E,
|
|
1474
|
+
D,
|
|
1475
|
+
re
|
|
1476
|
+
]);
|
|
1477
|
+
if (oe.length === 0) return null;
|
|
1478
|
+
let se = /* @__PURE__ */ H(b, {
|
|
1479
|
+
matchReferenceWidth: !1,
|
|
1480
|
+
placement: "bottom-start",
|
|
1481
|
+
listClassName: m,
|
|
1482
|
+
initialFocus: P.current,
|
|
1483
|
+
overlayAriaLabel: i,
|
|
1484
|
+
items: oe,
|
|
1485
|
+
disabled: h,
|
|
1486
|
+
open: ee,
|
|
1487
|
+
onOpenChange: te,
|
|
1488
|
+
children: /* @__PURE__ */ H(w, {
|
|
1489
|
+
icon: /* @__PURE__ */ H(Se, {
|
|
1490
|
+
size: v.LG,
|
|
1491
|
+
"aria-hidden": !0,
|
|
1492
|
+
stroke: y
|
|
1261
1493
|
}),
|
|
1262
|
-
|
|
1263
|
-
|
|
1494
|
+
"aria-label": i,
|
|
1495
|
+
"aria-haspopup": "menu",
|
|
1496
|
+
tooltipProps: { tooltip: i },
|
|
1497
|
+
disabled: h
|
|
1498
|
+
})
|
|
1499
|
+
});
|
|
1500
|
+
return /* @__PURE__ */ U(le, { children: [
|
|
1501
|
+
j ? /* @__PURE__ */ U(le, { children: [
|
|
1502
|
+
/* @__PURE__ */ H(w, {
|
|
1503
|
+
icon: /* @__PURE__ */ H(Se, {
|
|
1264
1504
|
size: v.LG,
|
|
1265
1505
|
"aria-hidden": !0,
|
|
1266
1506
|
stroke: y
|
|
1267
1507
|
}),
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1508
|
+
"aria-label": i,
|
|
1509
|
+
tooltipProps: { tooltip: i },
|
|
1510
|
+
disabled: h,
|
|
1511
|
+
onClick: () => N(!0)
|
|
1272
1512
|
}),
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1513
|
+
/* @__PURE__ */ H(Ot, {
|
|
1514
|
+
isOpen: M,
|
|
1515
|
+
title: a,
|
|
1516
|
+
closeLabel: s,
|
|
1517
|
+
onClose: () => N(!1),
|
|
1518
|
+
style: u,
|
|
1519
|
+
items: oe,
|
|
1520
|
+
className: "pb-4",
|
|
1521
|
+
btnTextClassName: "flex-1"
|
|
1522
|
+
}),
|
|
1523
|
+
ie && /* @__PURE__ */ H(Ft, {
|
|
1524
|
+
isOpen: R,
|
|
1525
|
+
onBack: () => {
|
|
1526
|
+
z(!1), N(!0);
|
|
1527
|
+
},
|
|
1528
|
+
backLabel: T,
|
|
1529
|
+
onClose: () => te(!1),
|
|
1530
|
+
closeLabel: s,
|
|
1531
|
+
style: u,
|
|
1532
|
+
title: C,
|
|
1533
|
+
items: x,
|
|
1534
|
+
onToolToggle: S
|
|
1535
|
+
}),
|
|
1536
|
+
E?.map((e) => /* @__PURE__ */ H(Fe, {
|
|
1537
|
+
isOpen: B === e.key,
|
|
1538
|
+
title: e.title,
|
|
1539
|
+
closeLabel: s,
|
|
1540
|
+
onBack: () => {
|
|
1541
|
+
V(null), N(!0);
|
|
1542
|
+
},
|
|
1543
|
+
backLabel: e.backLabel ?? "Back",
|
|
1544
|
+
onClose: () => te(!1),
|
|
1545
|
+
style: u,
|
|
1546
|
+
children: /* @__PURE__ */ H("div", {
|
|
1547
|
+
role: "menu",
|
|
1548
|
+
"aria-label": e.title,
|
|
1549
|
+
children: e.renderOverlay(() => te(!1), D?.() ?? 0)
|
|
1278
1550
|
})
|
|
1279
|
-
})
|
|
1280
|
-
]
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1551
|
+
}, e.key))
|
|
1552
|
+
] }) : /* @__PURE__ */ H(le, { children: se }),
|
|
1553
|
+
k && g != null && /* @__PURE__ */ H(Mt, {
|
|
1554
|
+
isOpen: I,
|
|
1555
|
+
onBack: () => {
|
|
1556
|
+
L(!1), j ? N(!0) : F(!0);
|
|
1557
|
+
},
|
|
1558
|
+
backLabel: g.backLabel ?? "Back",
|
|
1559
|
+
onClose: () => L(!1),
|
|
1560
|
+
closeLabel: s,
|
|
1561
|
+
style: u,
|
|
1562
|
+
features: g.features,
|
|
1563
|
+
initialResponseFormat: g.responseFormat ?? o.Markdown,
|
|
1564
|
+
initialSystemPrompt: g.systemPrompt,
|
|
1565
|
+
initialTemperature: g.temperature,
|
|
1566
|
+
onSave: g.onSave,
|
|
1567
|
+
title: g.title,
|
|
1568
|
+
responseFormatLabel: g.responseFormatLabel,
|
|
1569
|
+
responseFormatHint: g.responseFormatHint,
|
|
1570
|
+
responseFormatMarkdownLabel: g.responseFormatMarkdownLabel,
|
|
1571
|
+
responseFormatPlainTextLabel: g.responseFormatPlainTextLabel,
|
|
1572
|
+
systemPromptLabel: g.systemPromptLabel,
|
|
1573
|
+
systemPromptTooltip: g.systemPromptTooltip,
|
|
1574
|
+
temperatureLabel: g.temperatureLabel,
|
|
1575
|
+
temperatureLabels: g.temperatureLabels,
|
|
1576
|
+
temperatureHint: g.temperatureHint,
|
|
1577
|
+
saveLabel: g.saveLabel,
|
|
1578
|
+
saveDisabledTooltip: g.saveDisabledTooltip
|
|
1579
|
+
}),
|
|
1580
|
+
!k && g != null && I && /* @__PURE__ */ H(Pt, {
|
|
1581
|
+
features: g.features,
|
|
1582
|
+
initialResponseFormat: g.responseFormat ?? o.Markdown,
|
|
1583
|
+
initialSystemPrompt: g.systemPrompt,
|
|
1584
|
+
initialTemperature: g.temperature,
|
|
1585
|
+
onSave: g.onSave,
|
|
1586
|
+
onClose: () => L(!1),
|
|
1587
|
+
title: g.title,
|
|
1588
|
+
responseFormatLabel: g.responseFormatLabel,
|
|
1589
|
+
responseFormatHint: g.responseFormatHint,
|
|
1590
|
+
responseFormatMarkdownLabel: g.responseFormatMarkdownLabel,
|
|
1591
|
+
responseFormatPlainTextLabel: g.responseFormatPlainTextLabel,
|
|
1592
|
+
systemPromptLabel: g.systemPromptLabel,
|
|
1593
|
+
systemPromptTooltip: g.systemPromptTooltip,
|
|
1594
|
+
temperatureLabel: g.temperatureLabel,
|
|
1595
|
+
temperatureLabels: g.temperatureLabels,
|
|
1596
|
+
temperatureHint: g.temperatureHint,
|
|
1597
|
+
saveLabel: g.saveLabel,
|
|
1598
|
+
saveDisabledTooltip: g.saveDisabledTooltip,
|
|
1599
|
+
colors: g.modalColors
|
|
1302
1600
|
})
|
|
1601
|
+
] });
|
|
1602
|
+
}, Lt = ({ fileInputRef: e, textareaRef: t, message: n, style: r, hideAttachFile: i, isInputDisabled: a, isStreaming: o, isAttachmentsEnabled: s, isVoiceRecordingSupported: c, isVoiceActive: l, startRecording: u, isPhone: d, canRemoveTools: f, toolsMenuItems: m, onToolToggle: h, chatSettings: g, menuOverlays: _, onDialFileSystemClick: v, dialFileSystemLabel: b, attachLabel: x, addMenuTitle: S, menuTitle: C, menuCloseLabel: w, recordVoiceLabel: T, toolsMenuTitle: E, toolsBackLabel: D }) => {
|
|
1603
|
+
let O = K(() => v ? [{
|
|
1604
|
+
key: "dial-fs",
|
|
1605
|
+
label: b ?? "DIAL file system",
|
|
1606
|
+
icon: /* @__PURE__ */ H(ve, {
|
|
1607
|
+
size: p,
|
|
1608
|
+
"aria-hidden": !0,
|
|
1609
|
+
stroke: y
|
|
1610
|
+
}),
|
|
1611
|
+
onClick: v
|
|
1612
|
+
}] : [], [v, b]);
|
|
1613
|
+
return /* @__PURE__ */ H(It, {
|
|
1614
|
+
onAttachClick: i ? void 0 : () => e.current?.click(),
|
|
1615
|
+
attachLabel: x,
|
|
1616
|
+
addMenuTitle: S,
|
|
1617
|
+
menuTitle: C,
|
|
1618
|
+
menuCloseLabel: w,
|
|
1619
|
+
style: r,
|
|
1620
|
+
isDisabled: a || l,
|
|
1621
|
+
chatSettings: g,
|
|
1622
|
+
extraMenuItems: O,
|
|
1623
|
+
onRecordVoice: c && s && !o && !l ? () => u(Ke.Attachment) : void 0,
|
|
1624
|
+
recordVoiceLabel: T,
|
|
1625
|
+
toolsMenuItems: f || d ? m : void 0,
|
|
1626
|
+
onToolToggle: h,
|
|
1627
|
+
toolsMenuTitle: E,
|
|
1628
|
+
toolsBackLabel: D,
|
|
1629
|
+
menuOverlays: _,
|
|
1630
|
+
getCaretPosition: () => t.current?.selectionStart ?? n.length
|
|
1303
1631
|
});
|
|
1304
|
-
},
|
|
1305
|
-
"aria-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1632
|
+
}, Rt = ({ textarea: e, textareaRef: t, commandMenu: n, caretAnchor: r, fontClassName: i, isMenuOpen: a, query: o, activeWordStart: s, listboxId: c, activeOptionId: u, overlayRef: d, onOutsidePress: f, onClose: p }) => /* @__PURE__ */ U(le, { children: [e, n != null && /* @__PURE__ */ H("div", {
|
|
1633
|
+
"aria-hidden": !0,
|
|
1634
|
+
className: l("pointer-events-none absolute", i || "dial-body-paragraph-text"),
|
|
1635
|
+
style: {
|
|
1636
|
+
left: r?.left ?? 0,
|
|
1637
|
+
top: r?.top ?? 0
|
|
1638
|
+
},
|
|
1639
|
+
children: /* @__PURE__ */ H(b, {
|
|
1640
|
+
open: a,
|
|
1641
|
+
onOpenChange: (e) => {
|
|
1642
|
+
e || f();
|
|
1643
|
+
},
|
|
1644
|
+
placement: "top-start",
|
|
1645
|
+
trigger: [],
|
|
1646
|
+
initialFocus: -1,
|
|
1647
|
+
overlayRole: x.None,
|
|
1648
|
+
matchReferenceWidth: !1,
|
|
1649
|
+
outsidePressIgnoreRef: t,
|
|
1650
|
+
renderOverlay: () => {
|
|
1651
|
+
let e = n.menuLabel != null;
|
|
1652
|
+
return /* @__PURE__ */ H("div", {
|
|
1653
|
+
ref: d,
|
|
1654
|
+
role: e ? "group" : void 0,
|
|
1655
|
+
"aria-label": n.menuLabel,
|
|
1656
|
+
children: n.renderMenu({
|
|
1657
|
+
query: o,
|
|
1658
|
+
caretPosition: s ?? 0,
|
|
1659
|
+
close: p,
|
|
1660
|
+
listboxId: c,
|
|
1661
|
+
activeOptionId: u
|
|
1662
|
+
})
|
|
1663
|
+
});
|
|
1664
|
+
},
|
|
1665
|
+
children: /* @__PURE__ */ H("span", {
|
|
1666
|
+
"aria-hidden": !0,
|
|
1667
|
+
className: "inline-block h-lh w-0"
|
|
1668
|
+
})
|
|
1313
1669
|
})
|
|
1314
|
-
}),
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1670
|
+
})] }), zt = ({ areaRef: e, mirrorRef: t, isMirrorActive: n, fontClassName: r, message: i, mentionRanges: a, mirrorInsertions: o, selectionRects: s, children: c }) => /* @__PURE__ */ U("div", {
|
|
1671
|
+
ref: e,
|
|
1672
|
+
className: "relative -ms-1 -me-1 w-[calc(100%+8px)]",
|
|
1673
|
+
children: [n && /* @__PURE__ */ U("div", {
|
|
1674
|
+
ref: t,
|
|
1675
|
+
className: l(X.textarea, r || "dial-body-paragraph-text", "pointer-events-none absolute inset-0 z-10 max-h-[272px] w-full overflow-hidden ps-1 pe-1 wrap-anywhere whitespace-pre-wrap"),
|
|
1676
|
+
children: [ut(i, a, o, X.mentionHighlight, X.mentionHighlightUnsupported), s.map((e, t) => /* @__PURE__ */ H("div", {
|
|
1677
|
+
"aria-hidden": !0,
|
|
1678
|
+
className: l("pointer-events-none absolute rounded-sm", X.selectionHighlight),
|
|
1679
|
+
style: {
|
|
1680
|
+
left: e.left,
|
|
1681
|
+
top: e.top,
|
|
1682
|
+
width: e.width,
|
|
1683
|
+
height: e.height
|
|
1684
|
+
}
|
|
1685
|
+
}, `selection-${t}`))]
|
|
1686
|
+
}), c]
|
|
1687
|
+
}), Bt = ({ size: e = 20 }) => /* @__PURE__ */ H(te, {
|
|
1688
|
+
variant: ne.Circular,
|
|
1323
1689
|
width: e,
|
|
1324
1690
|
height: e,
|
|
1325
1691
|
active: !0
|
|
1326
|
-
}),
|
|
1692
|
+
}), Vt = ({ loadingLabel: e }) => /* @__PURE__ */ U("span", {
|
|
1327
1693
|
className: "flex min-w-0 flex-1 items-center",
|
|
1328
|
-
children: [/* @__PURE__ */
|
|
1329
|
-
variant:
|
|
1694
|
+
children: [/* @__PURE__ */ H(te, {
|
|
1695
|
+
variant: ne.Text,
|
|
1330
1696
|
width: "100%",
|
|
1331
1697
|
height: 16,
|
|
1332
1698
|
active: !0
|
|
1333
|
-
}), e && /* @__PURE__ */
|
|
1699
|
+
}), e && /* @__PURE__ */ H("span", {
|
|
1334
1700
|
className: "sr-only",
|
|
1335
1701
|
children: e
|
|
1336
1702
|
})]
|
|
1337
|
-
}),
|
|
1703
|
+
}), Ht = () => /* @__PURE__ */ H("div", {
|
|
1338
1704
|
"aria-hidden": "true",
|
|
1339
|
-
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */
|
|
1705
|
+
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ U("div", {
|
|
1340
1706
|
className: "flex h-11 items-center gap-3 px-4",
|
|
1341
|
-
children: [/* @__PURE__ */
|
|
1707
|
+
children: [/* @__PURE__ */ H(Bt, {}), /* @__PURE__ */ H(Vt, {})]
|
|
1342
1708
|
}, t))
|
|
1343
|
-
}),
|
|
1709
|
+
}), Ut = (e) => e.displayName ?? e.id, Wt = (e, t) => {
|
|
1344
1710
|
let n = t.trim().toLowerCase();
|
|
1345
|
-
return n ? e.filter((e) =>
|
|
1346
|
-
},
|
|
1711
|
+
return n ? e.filter((e) => Ut(e).toLowerCase().includes(n)) : e;
|
|
1712
|
+
}, Gt = (e, t, r, i = 18, a) => /* @__PURE__ */ H(n, {
|
|
1347
1713
|
src: e,
|
|
1348
1714
|
size: i,
|
|
1349
1715
|
labels: { tooltip: a },
|
|
1350
1716
|
initialsName: r
|
|
1351
|
-
}),
|
|
1717
|
+
}), Kt = {
|
|
1352
1718
|
searchHeader: "_searchHeader_1u7db_1",
|
|
1353
1719
|
itemText: "_itemText_1u7db_13",
|
|
1354
1720
|
itemHover: "_itemHover_1u7db_17",
|
|
1355
1721
|
selectedItemBackground: "_selectedItemBackground_1u7db_22",
|
|
1356
1722
|
selectedItemText: "_selectedItemText_1u7db_26",
|
|
1357
1723
|
checkIcon: "_checkIcon_1u7db_30"
|
|
1358
|
-
},
|
|
1359
|
-
let [a, o] =
|
|
1724
|
+
}, qt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, styles: i }) => {
|
|
1725
|
+
let [a, o] = J(""), s = K(() => e?.find((e) => e.id === t), [e, t]), u = r?.loading !== void 0, d = !u && !s && !!t, f = K(() => u ? /* @__PURE__ */ H(Bt, { size: v.LG }) : Gt(s?.iconUrl, s?.type, s?.displayName ?? s?.id ?? "", v.LG, d ? r?.unavailableTooltip ?? "This deployment is no longer available" : void 0), [
|
|
1360
1726
|
u,
|
|
1361
1727
|
s,
|
|
1362
1728
|
d,
|
|
1363
1729
|
r?.unavailableTooltip
|
|
1364
|
-
]), p = s?.displayName ?? s?.id, m = s?.displayVersion, h = p ? `${r?.ariaLabel ?? "Select model"}: ${p}` : r?.ariaLabel ?? "Select model", g =
|
|
1730
|
+
]), p = s?.displayName ?? s?.id, m = s?.displayVersion, h = p ? `${r?.ariaLabel ?? "Select model"}: ${p}` : r?.ariaLabel ?? "Select model", g = K(() => {
|
|
1365
1731
|
if (u) return Array.from({ length: 7 }, (e, t) => ({
|
|
1366
1732
|
key: `__loading-${t}`,
|
|
1367
|
-
icon: /* @__PURE__ */
|
|
1368
|
-
label: /* @__PURE__ */
|
|
1733
|
+
icon: /* @__PURE__ */ H(Bt, {}),
|
|
1734
|
+
label: /* @__PURE__ */ H(Vt, { loadingLabel: t === 0 ? r?.loading : void 0 }),
|
|
1369
1735
|
disabled: !0
|
|
1370
1736
|
}));
|
|
1371
1737
|
if (!e || e.length === 0) {
|
|
@@ -1377,19 +1743,19 @@ var q = {
|
|
|
1377
1743
|
}] : [];
|
|
1378
1744
|
}
|
|
1379
1745
|
let o = i?.colors;
|
|
1380
|
-
return
|
|
1746
|
+
return Wt(e, a).map((e) => {
|
|
1381
1747
|
let r = e.id === t;
|
|
1382
1748
|
return {
|
|
1383
1749
|
key: e.id,
|
|
1384
|
-
label: /* @__PURE__ */
|
|
1385
|
-
text:
|
|
1750
|
+
label: /* @__PURE__ */ H(T, {
|
|
1751
|
+
text: Ut(e),
|
|
1386
1752
|
query: a,
|
|
1387
1753
|
maxLines: 1
|
|
1388
1754
|
}),
|
|
1389
|
-
icon:
|
|
1390
|
-
mark:
|
|
1755
|
+
icon: Gt(e.iconUrl, e.type, e.displayName ?? e.id),
|
|
1756
|
+
mark: A.Check,
|
|
1391
1757
|
checked: r,
|
|
1392
|
-
className: l(o?.itemText &&
|
|
1758
|
+
className: l(o?.itemText && Kt.itemText, o?.itemHoverBackground && Kt.itemHover, r && o?.selectedItemBackground && Kt.selectedItemBackground, r && o?.selectedItemText && Kt.selectedItemText, r && o?.checkIcon && Kt.checkIcon, i?.itemClassName, r && i?.selectedItemClassName, Y.modelMenuItem, r && Y.modelMenuItemSelected),
|
|
1393
1759
|
onClick: () => n?.(e.id)
|
|
1394
1760
|
};
|
|
1395
1761
|
});
|
|
@@ -1403,7 +1769,7 @@ var q = {
|
|
|
1403
1769
|
i?.itemClassName,
|
|
1404
1770
|
i?.selectedItemClassName,
|
|
1405
1771
|
i?.colors
|
|
1406
|
-
]), _ =
|
|
1772
|
+
]), _ = K(() => c({
|
|
1407
1773
|
"--ms-item-text": i?.colors?.itemText,
|
|
1408
1774
|
"--ms-item-hover-bg": i?.colors?.itemHoverBackground,
|
|
1409
1775
|
"--ms-selected-item-bg": i?.colors?.selectedItemBackground,
|
|
@@ -1418,10 +1784,10 @@ var q = {
|
|
|
1418
1784
|
selectedLabel: p,
|
|
1419
1785
|
selectedVersion: m,
|
|
1420
1786
|
menuItems: g,
|
|
1421
|
-
menuHeader:
|
|
1787
|
+
menuHeader: K(() => !u && e && e.length > 0 ? /* @__PURE__ */ H("div", {
|
|
1422
1788
|
style: c({ "--ms-search-header-bg": i?.colors?.searchHeaderBackground }),
|
|
1423
|
-
className: l("sticky top-0 z-10 pe-2 pt-2 pb-1",
|
|
1424
|
-
children: /* @__PURE__ */
|
|
1789
|
+
className: l("sticky top-0 z-10 pe-2 pt-2 pb-1", Kt.searchHeader, i?.searchHeaderClassName, Y.modelMenuSearch),
|
|
1790
|
+
children: /* @__PURE__ */ H(V, {
|
|
1425
1791
|
value: a,
|
|
1426
1792
|
placeholder: r?.searchPlaceholder ?? "Search",
|
|
1427
1793
|
size: S.Small,
|
|
@@ -1441,8 +1807,8 @@ var q = {
|
|
|
1441
1807
|
e || o("");
|
|
1442
1808
|
}
|
|
1443
1809
|
};
|
|
1444
|
-
},
|
|
1445
|
-
function
|
|
1810
|
+
}, $ = typeof window < "u" ? Me : G;
|
|
1811
|
+
function Jt(e) {
|
|
1446
1812
|
let t = e;
|
|
1447
1813
|
for (; t;) {
|
|
1448
1814
|
if (t.dir) return t.dir === "rtl";
|
|
@@ -1450,35 +1816,35 @@ function Vt(e) {
|
|
|
1450
1816
|
}
|
|
1451
1817
|
return !1;
|
|
1452
1818
|
}
|
|
1453
|
-
function
|
|
1819
|
+
function Yt() {
|
|
1454
1820
|
return () => {};
|
|
1455
1821
|
}
|
|
1456
|
-
function
|
|
1457
|
-
return
|
|
1822
|
+
function Xt() {
|
|
1823
|
+
return Ne(Yt, () => !1, () => !0);
|
|
1458
1824
|
}
|
|
1459
|
-
function
|
|
1825
|
+
function Zt(e) {
|
|
1460
1826
|
return e?.ownerDocument.defaultView ?? window;
|
|
1461
1827
|
}
|
|
1462
|
-
function
|
|
1463
|
-
return
|
|
1828
|
+
function Qt(e) {
|
|
1829
|
+
return Zt(e).ResizeObserver ?? (typeof ResizeObserver < "u" ? ResizeObserver : void 0);
|
|
1464
1830
|
}
|
|
1465
|
-
function
|
|
1831
|
+
function $t(e) {
|
|
1466
1832
|
if (e !== void 0) switch (typeof e) {
|
|
1467
1833
|
case "number": return e;
|
|
1468
1834
|
case "string": if (e.endsWith("px")) return parseFloat(e);
|
|
1469
1835
|
}
|
|
1470
1836
|
}
|
|
1471
|
-
function
|
|
1472
|
-
let { styleHeight: s, styleWidth: c } =
|
|
1473
|
-
styleHeight:
|
|
1474
|
-
styleWidth:
|
|
1475
|
-
}), [o?.height, o?.width]), [l, u] =
|
|
1837
|
+
function en({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
|
|
1838
|
+
let { styleHeight: s, styleWidth: c } = K(() => ({
|
|
1839
|
+
styleHeight: $t(o?.height),
|
|
1840
|
+
styleWidth: $t(o?.width)
|
|
1841
|
+
}), [o?.height, o?.width]), [l, u] = J({
|
|
1476
1842
|
height: t,
|
|
1477
1843
|
width: n
|
|
1478
1844
|
}), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
|
|
1479
|
-
return
|
|
1845
|
+
return $(() => {
|
|
1480
1846
|
if (i === null || d) return;
|
|
1481
|
-
let t =
|
|
1847
|
+
let t = Qt(i);
|
|
1482
1848
|
if (!t) return;
|
|
1483
1849
|
let n = new t((e) => {
|
|
1484
1850
|
for (let t of e) {
|
|
@@ -1498,7 +1864,7 @@ function Gt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1498
1864
|
i,
|
|
1499
1865
|
s,
|
|
1500
1866
|
c
|
|
1501
|
-
]),
|
|
1867
|
+
]), K(() => ({
|
|
1502
1868
|
height: s ?? l.height,
|
|
1503
1869
|
width: c ?? l.width
|
|
1504
1870
|
}), [
|
|
@@ -1507,27 +1873,27 @@ function Gt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1507
1873
|
c
|
|
1508
1874
|
]);
|
|
1509
1875
|
}
|
|
1510
|
-
function
|
|
1511
|
-
let t =
|
|
1876
|
+
function tn(e) {
|
|
1877
|
+
let t = q(() => {
|
|
1512
1878
|
throw Error("Cannot call an event handler while rendering.");
|
|
1513
1879
|
});
|
|
1514
|
-
return
|
|
1880
|
+
return $(() => {
|
|
1515
1881
|
t.current = e;
|
|
1516
|
-
}, [e]),
|
|
1882
|
+
}, [e]), W((...e) => t.current?.(...e), [t]);
|
|
1517
1883
|
}
|
|
1518
|
-
var
|
|
1519
|
-
function
|
|
1520
|
-
let n =
|
|
1884
|
+
var nn = /* @__PURE__ */ new WeakMap();
|
|
1885
|
+
function rn(e = !1, t = document) {
|
|
1886
|
+
let n = nn.get(t);
|
|
1521
1887
|
if (n === void 0 || e) {
|
|
1522
1888
|
let e = t.createElement("div"), r = e.style;
|
|
1523
1889
|
r.width = "50px", r.height = "50px", r.overflow = "scroll", r.direction = "rtl";
|
|
1524
1890
|
let i = t.createElement("div"), a = i.style;
|
|
1525
|
-
a.width = "100px", a.height = "100px", e.appendChild(i), t.body.appendChild(e), e.scrollLeft > 0 ? n = "positive-descending" : (e.scrollLeft = 1, n = e.scrollLeft === 0 ? "negative" : "positive-ascending"), t.body.removeChild(e),
|
|
1891
|
+
a.width = "100px", a.height = "100px", e.appendChild(i), t.body.appendChild(e), e.scrollLeft > 0 ? n = "positive-descending" : (e.scrollLeft = 1, n = e.scrollLeft === 0 ? "negative" : "positive-ascending"), t.body.removeChild(e), nn.set(t, n);
|
|
1526
1892
|
}
|
|
1527
1893
|
return n;
|
|
1528
1894
|
}
|
|
1529
|
-
function
|
|
1530
|
-
if (t === "horizontal" && n) switch (
|
|
1895
|
+
function an({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
1896
|
+
if (t === "horizontal" && n) switch (rn(!1, e?.ownerDocument ?? document)) {
|
|
1531
1897
|
case "negative": return -r;
|
|
1532
1898
|
case "positive-descending": if (e) {
|
|
1533
1899
|
let { clientWidth: t, scrollWidth: n } = e;
|
|
@@ -1536,8 +1902,8 @@ function $({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
|
1536
1902
|
}
|
|
1537
1903
|
return r;
|
|
1538
1904
|
}
|
|
1539
|
-
function
|
|
1540
|
-
let r =
|
|
1905
|
+
function on({ container: e, element: t, onChange: n }) {
|
|
1906
|
+
let r = Zt(t), i = Qt(t), a = r.MutationObserver ?? (typeof MutationObserver < "u" ? MutationObserver : void 0), o = i ? new i(n) : void 0, s = (e) => !e.isConnected || (e.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0, c = a ? new a((e) => {
|
|
1541
1907
|
e.some((e) => Array.from(e.addedNodes).some(s) || e.removedNodes.length > 0 && e.nextSibling !== null && s(e.nextSibling)) && (u(), n());
|
|
1542
1908
|
}) : void 0, l = /* @__PURE__ */ new Set(), u = () => {
|
|
1543
1909
|
for (let e of l) o?.unobserve(e);
|
|
@@ -1554,33 +1920,33 @@ function Yt({ container: e, element: t, onChange: n }) {
|
|
|
1554
1920
|
o?.disconnect(), c?.disconnect();
|
|
1555
1921
|
};
|
|
1556
1922
|
}
|
|
1557
|
-
function
|
|
1923
|
+
function sn(e) {
|
|
1558
1924
|
return e.window === e;
|
|
1559
1925
|
}
|
|
1560
|
-
function
|
|
1561
|
-
return t === "window" ? e ?
|
|
1926
|
+
function cn(e, t) {
|
|
1927
|
+
return t === "window" ? e ? Zt(e) : null : t ?? null;
|
|
1562
1928
|
}
|
|
1563
|
-
function
|
|
1564
|
-
return
|
|
1929
|
+
function ln(e, t) {
|
|
1930
|
+
return sn(e) ? t === "vertical" ? e.scrollY : e.scrollX : t === "vertical" ? e.scrollTop : e.scrollLeft;
|
|
1565
1931
|
}
|
|
1566
|
-
function
|
|
1567
|
-
let n =
|
|
1932
|
+
function un(e, t) {
|
|
1933
|
+
let n = sn(e) ? e.document.scrollingElement ?? e.document.documentElement : e;
|
|
1568
1934
|
return t === "vertical" ? n.scrollHeight - n.clientHeight : n.scrollWidth - n.clientWidth;
|
|
1569
1935
|
}
|
|
1570
|
-
function
|
|
1571
|
-
let { overflowX: n, overflowY: r } =
|
|
1936
|
+
function dn(e, t) {
|
|
1937
|
+
let { overflowX: n, overflowY: r } = Zt(e).getComputedStyle(e), i = t === "vertical" ? r : n;
|
|
1572
1938
|
return i === "visible" || i === "clip" ? !1 : t === "vertical" ? e.scrollHeight - e.clientHeight > 1 : e.scrollWidth - e.clientWidth > 1;
|
|
1573
1939
|
}
|
|
1574
|
-
function
|
|
1940
|
+
function fn({ containerElement: e, direction: t, isRtl: n, scrollTarget: r }) {
|
|
1575
1941
|
let i = t === "vertical", a, o;
|
|
1576
|
-
if (
|
|
1942
|
+
if (sn(r)) {
|
|
1577
1943
|
let { documentElement: e } = r.document;
|
|
1578
1944
|
a = 0, o = i ? e.clientHeight : e.clientWidth;
|
|
1579
1945
|
} else {
|
|
1580
1946
|
let e = r.getBoundingClientRect();
|
|
1581
1947
|
a = i ? e.top + r.clientTop : e.left + r.clientLeft, o = i ? r.clientHeight : r.clientWidth;
|
|
1582
1948
|
}
|
|
1583
|
-
let s = a + o, c = e.getBoundingClientRect(), l = i ? c.top + e.clientTop : c.left + e.clientLeft, u = i ? e.clientHeight : e.clientWidth, d = l + u, f =
|
|
1949
|
+
let s = a + o, c = e.getBoundingClientRect(), l = i ? c.top + e.clientTop : c.left + e.clientLeft, u = i ? e.clientHeight : e.clientWidth, d = l + u, f = an({
|
|
1584
1950
|
containerElement: e,
|
|
1585
1951
|
direction: t,
|
|
1586
1952
|
isRtl: n,
|
|
@@ -1593,8 +1959,8 @@ function tn({ containerElement: e, direction: t, isRtl: n, scrollTarget: r }) {
|
|
|
1593
1959
|
viewportSize: o
|
|
1594
1960
|
};
|
|
1595
1961
|
}
|
|
1596
|
-
function
|
|
1597
|
-
let i =
|
|
1962
|
+
function pn({ direction: e, isRtl: t, scrollTarget: n, viewportSize: r }) {
|
|
1963
|
+
let i = sn(n) ? n.document.documentElement : n, a = Zt(i).getComputedStyle(i), o = (e) => {
|
|
1598
1964
|
let t = parseFloat(e ?? "");
|
|
1599
1965
|
return !Number.isFinite(t) || t < 0 ? 0 : e.endsWith("px") ? t : e.endsWith("%") ? t * r / 100 : 0;
|
|
1600
1966
|
};
|
|
@@ -1611,26 +1977,26 @@ function nn({ direction: e, isRtl: t, scrollTarget: n, viewportSize: r }) {
|
|
|
1611
1977
|
start: s
|
|
1612
1978
|
};
|
|
1613
1979
|
}
|
|
1614
|
-
function
|
|
1980
|
+
function mn(e, t = "Assertion error") {
|
|
1615
1981
|
if (!e) throw console.error(t), Error(t);
|
|
1616
1982
|
}
|
|
1617
|
-
function
|
|
1983
|
+
function hn(e, t) {
|
|
1618
1984
|
if (e === t) return !0;
|
|
1619
|
-
if (!!e != !!t || (
|
|
1985
|
+
if (!!e != !!t || (mn(e !== void 0), mn(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
|
|
1620
1986
|
for (let n in e) if (!Object.hasOwn(t, n) || !Object.is(t[n], e[n])) return !1;
|
|
1621
1987
|
return !0;
|
|
1622
1988
|
}
|
|
1623
|
-
function
|
|
1989
|
+
function gn({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
1624
1990
|
if (t === 0) return 0;
|
|
1625
1991
|
if (typeof n == "number") return t * n;
|
|
1626
1992
|
{
|
|
1627
1993
|
let n = e.get(e.size === 0 ? 0 : e.size - 1);
|
|
1628
|
-
return
|
|
1994
|
+
return mn(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
|
|
1629
1995
|
}
|
|
1630
1996
|
}
|
|
1631
|
-
function
|
|
1997
|
+
function _n({ align: e, cachedBounds: t, clamp: n = !0, index: r, itemCount: i, itemSize: a, containerScrollOffset: o, containerSize: s }) {
|
|
1632
1998
|
if (r < 0 || r >= i) throw RangeError(`Invalid index specified: ${r}`, { cause: `Index ${r} is not within the range of 0 - ${i - 1}` });
|
|
1633
|
-
let c = t.get(r), l =
|
|
1999
|
+
let c = t.get(r), l = gn({
|
|
1634
2000
|
cachedBounds: t,
|
|
1635
2001
|
itemCount: i,
|
|
1636
2002
|
itemSize: a
|
|
@@ -1642,7 +2008,7 @@ function sn({ align: e, cachedBounds: t, clamp: n = !0, index: r, itemCount: i,
|
|
|
1642
2008
|
default: return p ? o : o < f ? f : d;
|
|
1643
2009
|
}
|
|
1644
2010
|
}
|
|
1645
|
-
function
|
|
2011
|
+
function vn({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
|
|
1646
2012
|
let a = r - 1;
|
|
1647
2013
|
if (r === 0) return {
|
|
1648
2014
|
startIndexVisible: 0,
|
|
@@ -1676,12 +2042,12 @@ function cn({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemC
|
|
|
1676
2042
|
stopIndexOverscan: Math.min(a, s + i)
|
|
1677
2043
|
};
|
|
1678
2044
|
}
|
|
1679
|
-
function
|
|
2045
|
+
function yn({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1680
2046
|
let r = /* @__PURE__ */ new Map();
|
|
1681
2047
|
return {
|
|
1682
2048
|
itemSize: typeof n == "number" ? n : void 0,
|
|
1683
2049
|
get(i) {
|
|
1684
|
-
if (
|
|
2050
|
+
if (mn(i < e, `Invalid index ${i}`), typeof n == "number") return mn(i >= 0, `Invalid index ${i}`), {
|
|
1685
2051
|
size: n,
|
|
1686
2052
|
scrollOffset: i * n
|
|
1687
2053
|
};
|
|
@@ -1693,14 +2059,14 @@ function ln({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1693
2059
|
});
|
|
1694
2060
|
else {
|
|
1695
2061
|
let t = r.get(e - 1);
|
|
1696
|
-
|
|
2062
|
+
mn(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
|
|
1697
2063
|
scrollOffset: t.scrollOffset + t.size,
|
|
1698
2064
|
size: a
|
|
1699
2065
|
});
|
|
1700
2066
|
}
|
|
1701
2067
|
}
|
|
1702
2068
|
let a = r.get(i);
|
|
1703
|
-
return
|
|
2069
|
+
return mn(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
|
|
1704
2070
|
},
|
|
1705
2071
|
set(e, t) {
|
|
1706
2072
|
r.set(e, t);
|
|
@@ -1710,8 +2076,8 @@ function ln({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1710
2076
|
}
|
|
1711
2077
|
};
|
|
1712
2078
|
}
|
|
1713
|
-
function
|
|
1714
|
-
return
|
|
2079
|
+
function bn({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
2080
|
+
return K(() => yn({
|
|
1715
2081
|
itemCount: e,
|
|
1716
2082
|
itemProps: t,
|
|
1717
2083
|
itemSize: n
|
|
@@ -1721,31 +2087,31 @@ function un({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1721
2087
|
n
|
|
1722
2088
|
]);
|
|
1723
2089
|
}
|
|
1724
|
-
function
|
|
2090
|
+
function xn({ containerSize: e, itemSize: t }) {
|
|
1725
2091
|
let n;
|
|
1726
2092
|
switch (typeof t) {
|
|
1727
2093
|
case "string":
|
|
1728
|
-
|
|
2094
|
+
mn(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), mn(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseFloat(t) / 100;
|
|
1729
2095
|
break;
|
|
1730
2096
|
default: n = t;
|
|
1731
2097
|
}
|
|
1732
2098
|
return typeof n == "number" && !(Number.isFinite(n) && n > 0) && (n = 0), n;
|
|
1733
2099
|
}
|
|
1734
|
-
function
|
|
1735
|
-
let f = d !== void 0, p = f ?
|
|
2100
|
+
function Sn({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, defaultScrollOffset: r = 0, direction: i, isRtl: a = !1, itemCount: o, itemProps: s, itemSize: c, onResize: l, overscanCount: u, scrollElement: d }) {
|
|
2101
|
+
let f = d !== void 0, p = f ? cn(e, d) : e, { height: m = n, width: h = n } = en({
|
|
1736
2102
|
defaultHeight: i === "vertical" ? n : void 0,
|
|
1737
2103
|
defaultWidth: i === "horizontal" ? n : void 0,
|
|
1738
2104
|
element: e,
|
|
1739
2105
|
mode: i === "vertical" ? "only-height" : "only-width",
|
|
1740
2106
|
style: t
|
|
1741
|
-
}), g =
|
|
2107
|
+
}), g = q({
|
|
1742
2108
|
height: 0,
|
|
1743
2109
|
width: 0
|
|
1744
|
-
}), [_, v] =
|
|
2110
|
+
}), [_, v] = J(n), y = f ? _ : i === "vertical" ? m : h, b = xn({
|
|
1745
2111
|
containerSize: y,
|
|
1746
2112
|
itemSize: c
|
|
1747
2113
|
});
|
|
1748
|
-
|
|
2114
|
+
$(() => {
|
|
1749
2115
|
if (typeof l == "function") {
|
|
1750
2116
|
let e = g.current;
|
|
1751
2117
|
(e.height !== m || e.width !== h) && (l({
|
|
@@ -1758,22 +2124,22 @@ function fn({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1758
2124
|
l,
|
|
1759
2125
|
h
|
|
1760
2126
|
]);
|
|
1761
|
-
let x =
|
|
2127
|
+
let x = bn({
|
|
1762
2128
|
itemCount: o,
|
|
1763
2129
|
itemProps: s,
|
|
1764
2130
|
itemSize: b
|
|
1765
|
-
}), S =
|
|
2131
|
+
}), S = Xt(), [C] = J(() => S || f ? 0 : r), w = W((e) => x.get(e), [x]), [T, E] = J(() => vn({
|
|
1766
2132
|
cachedBounds: x,
|
|
1767
2133
|
containerScrollOffset: C,
|
|
1768
2134
|
containerSize: y,
|
|
1769
2135
|
itemCount: o,
|
|
1770
2136
|
overscanCount: u
|
|
1771
|
-
})), { startIndexVisible: D, startIndexOverscan: O, stopIndexVisible: k, stopIndexOverscan:
|
|
2137
|
+
})), { startIndexVisible: D, startIndexOverscan: O, stopIndexVisible: k, stopIndexOverscan: A } = {
|
|
1772
2138
|
startIndexVisible: Math.min(o - 1, T.startIndexVisible),
|
|
1773
2139
|
startIndexOverscan: Math.min(o - 1, T.startIndexOverscan),
|
|
1774
2140
|
stopIndexVisible: Math.min(o - 1, T.stopIndexVisible),
|
|
1775
2141
|
stopIndexOverscan: Math.min(o - 1, T.stopIndexOverscan)
|
|
1776
|
-
},
|
|
2142
|
+
}, j = W(() => gn({
|
|
1777
2143
|
cachedBounds: x,
|
|
1778
2144
|
itemCount: o,
|
|
1779
2145
|
itemSize: b
|
|
@@ -1781,14 +2147,14 @@ function fn({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1781
2147
|
x,
|
|
1782
2148
|
o,
|
|
1783
2149
|
b
|
|
1784
|
-
]),
|
|
1785
|
-
let n =
|
|
2150
|
+
]), M = W((t) => {
|
|
2151
|
+
let n = an({
|
|
1786
2152
|
containerElement: e,
|
|
1787
2153
|
direction: i,
|
|
1788
2154
|
isRtl: a,
|
|
1789
2155
|
scrollOffset: t
|
|
1790
2156
|
});
|
|
1791
|
-
return
|
|
2157
|
+
return vn({
|
|
1792
2158
|
cachedBounds: x,
|
|
1793
2159
|
containerScrollOffset: n,
|
|
1794
2160
|
containerSize: y,
|
|
@@ -1803,17 +2169,17 @@ function fn({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1803
2169
|
a,
|
|
1804
2170
|
o,
|
|
1805
2171
|
u
|
|
1806
|
-
]),
|
|
1807
|
-
|
|
1808
|
-
if (!e || o === 0 || f ||
|
|
1809
|
-
let t = i === "horizontal" &&
|
|
1810
|
-
if (
|
|
2172
|
+
]), N = q(!1);
|
|
2173
|
+
$(() => {
|
|
2174
|
+
if (!e || o === 0 || f || N.current || (N.current = !0, r <= 0)) return;
|
|
2175
|
+
let t = i === "horizontal" && Jt(e);
|
|
2176
|
+
if (an({
|
|
1811
2177
|
containerElement: e,
|
|
1812
2178
|
direction: i,
|
|
1813
2179
|
isRtl: t,
|
|
1814
2180
|
scrollOffset: i === "vertical" ? e.scrollTop : e.scrollLeft
|
|
1815
2181
|
}) !== 0) return;
|
|
1816
|
-
let n =
|
|
2182
|
+
let n = an({
|
|
1817
2183
|
containerElement: e,
|
|
1818
2184
|
direction: i,
|
|
1819
2185
|
isRtl: t,
|
|
@@ -1823,44 +2189,44 @@ function fn({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1823
2189
|
behavior: "instant",
|
|
1824
2190
|
[i === "vertical" ? "top" : "left"]: n
|
|
1825
2191
|
}) : i === "vertical" ? e.scrollTop = n : e.scrollLeft = n;
|
|
1826
|
-
}, [e, o]),
|
|
2192
|
+
}, [e, o]), $(() => {
|
|
1827
2193
|
if (f && e && p) return;
|
|
1828
|
-
let t = e && !f ?
|
|
2194
|
+
let t = e && !f ? M(i === "vertical" ? e.scrollTop : e.scrollLeft) : vn({
|
|
1829
2195
|
cachedBounds: x,
|
|
1830
2196
|
containerScrollOffset: C,
|
|
1831
2197
|
containerSize: y,
|
|
1832
2198
|
itemCount: o,
|
|
1833
2199
|
overscanCount: u
|
|
1834
2200
|
});
|
|
1835
|
-
E((e) =>
|
|
2201
|
+
E((e) => hn(t, e) ? e : t);
|
|
1836
2202
|
}, [
|
|
1837
2203
|
x,
|
|
1838
2204
|
e,
|
|
1839
2205
|
y,
|
|
1840
2206
|
i,
|
|
1841
|
-
|
|
2207
|
+
M,
|
|
1842
2208
|
C,
|
|
1843
2209
|
f,
|
|
1844
2210
|
o,
|
|
1845
2211
|
u,
|
|
1846
2212
|
p
|
|
1847
|
-
]),
|
|
2213
|
+
]), $(() => {
|
|
1848
2214
|
if (!e || f) return;
|
|
1849
2215
|
let t = () => {
|
|
1850
2216
|
E((t) => {
|
|
1851
|
-
let { scrollLeft: n, scrollTop: r } = e, s =
|
|
2217
|
+
let { scrollLeft: n, scrollTop: r } = e, s = an({
|
|
1852
2218
|
containerElement: e,
|
|
1853
2219
|
direction: i,
|
|
1854
2220
|
isRtl: a,
|
|
1855
2221
|
scrollOffset: i === "vertical" ? r : n
|
|
1856
|
-
}), c =
|
|
2222
|
+
}), c = vn({
|
|
1857
2223
|
cachedBounds: x,
|
|
1858
2224
|
containerScrollOffset: s,
|
|
1859
2225
|
containerSize: y,
|
|
1860
2226
|
itemCount: o,
|
|
1861
2227
|
overscanCount: u
|
|
1862
2228
|
});
|
|
1863
|
-
return
|
|
2229
|
+
return hn(c, t) ? t : c;
|
|
1864
2230
|
});
|
|
1865
2231
|
};
|
|
1866
2232
|
return e.addEventListener("scroll", t), () => {
|
|
@@ -1876,34 +2242,34 @@ function fn({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1876
2242
|
o,
|
|
1877
2243
|
u
|
|
1878
2244
|
]);
|
|
1879
|
-
let
|
|
2245
|
+
let P = tn(() => {
|
|
1880
2246
|
if (!e || !p) return;
|
|
1881
|
-
let { offset: t, size: n, viewportSize: r } =
|
|
2247
|
+
let { offset: t, size: n, viewportSize: r } = fn({
|
|
1882
2248
|
containerElement: e,
|
|
1883
2249
|
direction: i,
|
|
1884
2250
|
isRtl: a,
|
|
1885
2251
|
scrollTarget: p
|
|
1886
2252
|
});
|
|
1887
2253
|
v(r);
|
|
1888
|
-
let s =
|
|
2254
|
+
let s = vn({
|
|
1889
2255
|
cachedBounds: x,
|
|
1890
2256
|
containerScrollOffset: t,
|
|
1891
2257
|
containerSize: n,
|
|
1892
2258
|
itemCount: o,
|
|
1893
2259
|
overscanCount: u
|
|
1894
2260
|
});
|
|
1895
|
-
E((e) =>
|
|
2261
|
+
E((e) => hn(s, e) ? e : s);
|
|
1896
2262
|
});
|
|
1897
|
-
return
|
|
1898
|
-
f &&
|
|
1899
|
-
}),
|
|
2263
|
+
return $(() => {
|
|
2264
|
+
f && P();
|
|
2265
|
+
}), $(() => {
|
|
1900
2266
|
if (!f || !e || !p) return;
|
|
1901
|
-
let t =
|
|
2267
|
+
let t = Zt(e), n = () => P();
|
|
1902
2268
|
p.addEventListener("scroll", n, { passive: !0 }), e.addEventListener("scroll", n, { passive: !0 }), t.addEventListener("resize", n);
|
|
1903
|
-
let r, i =
|
|
1904
|
-
i && !
|
|
1905
|
-
let a =
|
|
1906
|
-
container:
|
|
2269
|
+
let r, i = Qt(e);
|
|
2270
|
+
i && !sn(p) && (r = new i(n), r.observe(p));
|
|
2271
|
+
let a = on({
|
|
2272
|
+
container: sn(p) ? p.document.documentElement : p,
|
|
1907
2273
|
element: e,
|
|
1908
2274
|
onChange: n
|
|
1909
2275
|
});
|
|
@@ -1914,13 +2280,13 @@ function fn({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1914
2280
|
e,
|
|
1915
2281
|
f,
|
|
1916
2282
|
p,
|
|
1917
|
-
|
|
2283
|
+
P
|
|
1918
2284
|
]), {
|
|
1919
2285
|
getCellBounds: w,
|
|
1920
|
-
getEstimatedSize:
|
|
1921
|
-
getScrollPositionForIndex:
|
|
2286
|
+
getEstimatedSize: j,
|
|
2287
|
+
getScrollPositionForIndex: tn(({ align: t = "auto", index: n }) => {
|
|
1922
2288
|
let r = ({ clamp: e, containerScrollOffset: r, containerSize: i, padding: a }) => {
|
|
1923
|
-
if (a.start === 0 && a.end === 0) return
|
|
2289
|
+
if (a.start === 0 && a.end === 0) return _n({
|
|
1924
2290
|
align: t,
|
|
1925
2291
|
cachedBounds: x,
|
|
1926
2292
|
clamp: e,
|
|
@@ -1930,7 +2296,7 @@ function fn({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1930
2296
|
itemCount: o,
|
|
1931
2297
|
itemSize: b
|
|
1932
2298
|
});
|
|
1933
|
-
let s =
|
|
2299
|
+
let s = _n({
|
|
1934
2300
|
align: t,
|
|
1935
2301
|
cachedBounds: x,
|
|
1936
2302
|
clamp: !1,
|
|
@@ -1940,10 +2306,10 @@ function fn({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1940
2306
|
itemCount: o,
|
|
1941
2307
|
itemSize: b
|
|
1942
2308
|
}) - a.start;
|
|
1943
|
-
return e ? Math.max(0, Math.min(
|
|
2309
|
+
return e ? Math.max(0, Math.min(j() - i, s)) : s;
|
|
1944
2310
|
};
|
|
1945
|
-
if (f && e && p && !
|
|
1946
|
-
let { viewportOffset: t, viewportSize: n } =
|
|
2311
|
+
if (f && e && p && !dn(e, i)) {
|
|
2312
|
+
let { viewportOffset: t, viewportSize: n } = fn({
|
|
1947
2313
|
containerElement: e,
|
|
1948
2314
|
direction: i,
|
|
1949
2315
|
isRtl: a,
|
|
@@ -1952,7 +2318,7 @@ function fn({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1952
2318
|
clamp: !1,
|
|
1953
2319
|
containerScrollOffset: t,
|
|
1954
2320
|
containerSize: n,
|
|
1955
|
-
padding:
|
|
2321
|
+
padding: pn({
|
|
1956
2322
|
direction: i,
|
|
1957
2323
|
isRtl: a,
|
|
1958
2324
|
scrollTarget: p,
|
|
@@ -1960,20 +2326,20 @@ function fn({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1960
2326
|
})
|
|
1961
2327
|
}) - t, s = i === "horizontal" && a ? -o : o;
|
|
1962
2328
|
return {
|
|
1963
|
-
scrollOffset:
|
|
2329
|
+
scrollOffset: ln(p, i) + s,
|
|
1964
2330
|
scrollTarget: p
|
|
1965
2331
|
};
|
|
1966
2332
|
}
|
|
1967
2333
|
let s = e ? i === "vertical" ? e.scrollTop : e.scrollLeft : 0, c = f && e ? i === "vertical" ? e.clientHeight : e.clientWidth : y, l = r({
|
|
1968
2334
|
clamp: !0,
|
|
1969
|
-
containerScrollOffset:
|
|
2335
|
+
containerScrollOffset: an({
|
|
1970
2336
|
containerElement: e,
|
|
1971
2337
|
direction: i,
|
|
1972
2338
|
isRtl: a,
|
|
1973
2339
|
scrollOffset: s
|
|
1974
2340
|
}),
|
|
1975
2341
|
containerSize: c,
|
|
1976
|
-
padding: e ?
|
|
2342
|
+
padding: e ? pn({
|
|
1977
2343
|
direction: i,
|
|
1978
2344
|
isRtl: a,
|
|
1979
2345
|
scrollTarget: e,
|
|
@@ -1984,14 +2350,14 @@ function fn({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1984
2350
|
}
|
|
1985
2351
|
});
|
|
1986
2352
|
if (e && (!f || p)) {
|
|
1987
|
-
if (l =
|
|
2353
|
+
if (l = an({
|
|
1988
2354
|
containerElement: e,
|
|
1989
2355
|
direction: i,
|
|
1990
2356
|
isRtl: a,
|
|
1991
2357
|
scrollOffset: l
|
|
1992
2358
|
}), !f && typeof e.scrollTo != "function") {
|
|
1993
|
-
let e =
|
|
1994
|
-
|
|
2359
|
+
let e = M(l);
|
|
2360
|
+
hn(T, e) || E(e);
|
|
1995
2361
|
}
|
|
1996
2362
|
return {
|
|
1997
2363
|
scrollOffset: l,
|
|
@@ -2002,37 +2368,37 @@ function fn({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
2002
2368
|
scrollTarget: p,
|
|
2003
2369
|
startIndexOverscan: O,
|
|
2004
2370
|
startIndexVisible: D,
|
|
2005
|
-
stopIndexOverscan:
|
|
2371
|
+
stopIndexOverscan: A,
|
|
2006
2372
|
stopIndexVisible: k
|
|
2007
2373
|
};
|
|
2008
2374
|
}
|
|
2009
|
-
function
|
|
2010
|
-
let [t, n] =
|
|
2011
|
-
return
|
|
2375
|
+
function Cn(e) {
|
|
2376
|
+
let [t, n] = J(e);
|
|
2377
|
+
return hn(t, e) ? t : (n(e), e);
|
|
2012
2378
|
}
|
|
2013
|
-
function
|
|
2379
|
+
function wn(e, t) {
|
|
2014
2380
|
let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
|
|
2015
|
-
return
|
|
2381
|
+
return hn(n, a) && hn(r, o) && hn(i, s);
|
|
2016
2382
|
}
|
|
2017
|
-
var
|
|
2018
|
-
function
|
|
2019
|
-
let t = e.getAttribute(
|
|
2383
|
+
var Tn = "data-react-window-index", En = "data-index";
|
|
2384
|
+
function Dn(e) {
|
|
2385
|
+
let t = e.getAttribute(Tn) ?? e.getAttribute(En);
|
|
2020
2386
|
return t !== null && /^\d+$/.test(t) ? Number(t) : void 0;
|
|
2021
2387
|
}
|
|
2022
|
-
var
|
|
2023
|
-
function
|
|
2388
|
+
var On = 1e3, kn = 500;
|
|
2389
|
+
function An(e) {
|
|
2024
2390
|
return 1 - (1 - e) ** 3;
|
|
2025
2391
|
}
|
|
2026
|
-
function
|
|
2027
|
-
let c = e === "vertical", l =
|
|
2392
|
+
function jn({ direction: e, element: t, getCellBounds: n, isDynamicSize: r, itemCount: i, itemElements: a, scrollTarget: o, getScrollPositionForIndex: s }) {
|
|
2393
|
+
let c = e === "vertical", l = q(null), u = q(void 0), d = tn(() => {
|
|
2028
2394
|
l.current = null, u.current !== void 0 && (u.current.view.cancelAnimationFrame(u.current.id), u.current = void 0);
|
|
2029
|
-
}), f =
|
|
2030
|
-
let e =
|
|
2395
|
+
}), f = tn(() => {
|
|
2396
|
+
let e = Zt(t);
|
|
2031
2397
|
u.current = {
|
|
2032
2398
|
id: e.requestAnimationFrame(p),
|
|
2033
2399
|
view: e
|
|
2034
2400
|
};
|
|
2035
|
-
}), p =
|
|
2401
|
+
}), p = tn(() => {
|
|
2036
2402
|
u.current = void 0;
|
|
2037
2403
|
let o = l.current;
|
|
2038
2404
|
if (!o) return;
|
|
@@ -2046,27 +2412,27 @@ function xn({ direction: e, element: t, getCellBounds: n, isDynamicSize: r, item
|
|
|
2046
2412
|
index: o.index
|
|
2047
2413
|
});
|
|
2048
2414
|
if (m !== void 0) {
|
|
2049
|
-
let { scrollOffset: t, scrollTarget: r } = m, s = Math.max(0, Math.min(t,
|
|
2415
|
+
let { scrollOffset: t, scrollTarget: r } = m, s = Math.max(0, Math.min(t, un(r, e)));
|
|
2050
2416
|
o.animation === void 0 && (o.animation = {
|
|
2051
|
-
deadline: p + (o.smooth ?
|
|
2052
|
-
startOffset:
|
|
2417
|
+
deadline: p + (o.smooth ? kn : 0) + On,
|
|
2418
|
+
startOffset: ln(r, e),
|
|
2053
2419
|
startTime: p
|
|
2054
2420
|
});
|
|
2055
|
-
let l = o.smooth ? (p - o.animation.startTime) /
|
|
2421
|
+
let l = o.smooth ? (p - o.animation.startTime) / kn : 1;
|
|
2056
2422
|
if (l < 1) {
|
|
2057
2423
|
let { startOffset: e } = o.animation;
|
|
2058
2424
|
o.stableFrames = 0, r.scrollTo({
|
|
2059
2425
|
behavior: "instant",
|
|
2060
|
-
[c ? "top" : "left"]: e + (s - e) *
|
|
2426
|
+
[c ? "top" : "left"]: e + (s - e) * An(l)
|
|
2061
2427
|
});
|
|
2062
|
-
} else if (Math.abs(s -
|
|
2428
|
+
} else if (Math.abs(s - ln(r, e)) > 1) o.stableFrames = 0, r.scrollTo({
|
|
2063
2429
|
behavior: "instant",
|
|
2064
2430
|
[c ? "top" : "left"]: s
|
|
2065
2431
|
});
|
|
2066
2432
|
else {
|
|
2067
2433
|
let e = a.current;
|
|
2068
|
-
if (!(e.some((e) =>
|
|
2069
|
-
let t =
|
|
2434
|
+
if (!(e.some((e) => Dn(e) === o.index) && e.every((e) => {
|
|
2435
|
+
let t = Dn(e);
|
|
2070
2436
|
if (t === void 0 || t >= i) return !0;
|
|
2071
2437
|
let r = c ? e.offsetHeight : e.offsetWidth;
|
|
2072
2438
|
return Math.abs(n(t).size - r) <= 1;
|
|
@@ -2079,7 +2445,7 @@ function xn({ direction: e, element: t, getCellBounds: n, isDynamicSize: r, item
|
|
|
2079
2445
|
}
|
|
2080
2446
|
f();
|
|
2081
2447
|
});
|
|
2082
|
-
return
|
|
2448
|
+
return $(() => {
|
|
2083
2449
|
let e = o ?? t;
|
|
2084
2450
|
if (!e) return;
|
|
2085
2451
|
let n = (e) => {
|
|
@@ -2102,13 +2468,13 @@ function xn({ direction: e, element: t, getCellBounds: n, isDynamicSize: r, item
|
|
|
2102
2468
|
d,
|
|
2103
2469
|
t,
|
|
2104
2470
|
o
|
|
2105
|
-
]),
|
|
2471
|
+
]), W(({ align: n = "auto", behavior: i = "auto", index: a }) => {
|
|
2106
2472
|
if (r && n === "smart") {
|
|
2107
2473
|
let t = s({
|
|
2108
2474
|
align: "auto",
|
|
2109
2475
|
index: a
|
|
2110
2476
|
});
|
|
2111
|
-
n = t === void 0 || t.scrollOffset ===
|
|
2477
|
+
n = t === void 0 || t.scrollOffset === ln(t.scrollTarget, e) ? "auto" : "center";
|
|
2112
2478
|
}
|
|
2113
2479
|
let o = s({
|
|
2114
2480
|
align: n,
|
|
@@ -2140,11 +2506,11 @@ function xn({ direction: e, element: t, getCellBounds: n, isDynamicSize: r, item
|
|
|
2140
2506
|
s
|
|
2141
2507
|
]);
|
|
2142
2508
|
}
|
|
2143
|
-
function
|
|
2144
|
-
let r =
|
|
2145
|
-
|
|
2509
|
+
function Mn({ callback: e, element: t, enabled: n = !0 }) {
|
|
2510
|
+
let r = tn(e);
|
|
2511
|
+
G(() => {
|
|
2146
2512
|
if (!n || !t) return;
|
|
2147
|
-
let e =
|
|
2513
|
+
let e = Zt(t), i = e.requestAnimationFrame(() => {
|
|
2148
2514
|
i = e.requestAnimationFrame(r);
|
|
2149
2515
|
});
|
|
2150
2516
|
return () => {
|
|
@@ -2156,7 +2522,7 @@ function Sn({ callback: e, element: t, enabled: n = !0 }) {
|
|
|
2156
2522
|
r
|
|
2157
2523
|
]);
|
|
2158
2524
|
}
|
|
2159
|
-
function
|
|
2525
|
+
function Nn({ elements: e, isFlowLayout: t, rowCount: n, startIndex: r, stopIndex: i }) {
|
|
2160
2526
|
if (r < 0 || i < r) return [];
|
|
2161
2527
|
let a = [], o = /* @__PURE__ */ new Set(), s = !0;
|
|
2162
2528
|
for (let t of e) {
|
|
@@ -2179,20 +2545,20 @@ function Cn({ elements: e, isFlowLayout: t, rowCount: n, startIndex: r, stopInde
|
|
|
2179
2545
|
index: r + t
|
|
2180
2546
|
}));
|
|
2181
2547
|
}
|
|
2182
|
-
function
|
|
2548
|
+
function Pn(e) {
|
|
2183
2549
|
return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
2184
2550
|
}
|
|
2185
|
-
var
|
|
2186
|
-
function
|
|
2187
|
-
let _ =
|
|
2188
|
-
|
|
2551
|
+
var Fn = "data-react-window-sizer";
|
|
2552
|
+
function In({ children: e, className: t, defaultHeight: n = 0, defaultScrollOffset: r = 0, listRef: i, onResize: a, onRowsRendered: o, overscanCount: s = 3, rowComponent: c, rowCount: l, rowHeight: u, rowKey: d, rowProps: f, scrollElement: p, tagName: m = "div", style: h, ...g }) {
|
|
2553
|
+
let _ = Cn(f), v = K(() => ke(c, wn), [c]), [y, b] = J(null), x = Pn(u), S = K(() => x ? (e) => u.getRowHeight(e) ?? u.getAverageRowHeight() : u, [x, u]), C = Xt(), [w, T] = J(() => C && x), E = q(u);
|
|
2554
|
+
$(() => {
|
|
2189
2555
|
w && E.current !== u && T(!1);
|
|
2190
|
-
}, [w, u]),
|
|
2556
|
+
}, [w, u]), Mn({
|
|
2191
2557
|
callback: () => T(!1),
|
|
2192
2558
|
element: y,
|
|
2193
2559
|
enabled: w
|
|
2194
2560
|
});
|
|
2195
|
-
let { getCellBounds: D, getEstimatedSize: O, scrollTarget: k, getScrollPositionForIndex:
|
|
2561
|
+
let { getCellBounds: D, getEstimatedSize: O, scrollTarget: k, getScrollPositionForIndex: A, startIndexOverscan: j, startIndexVisible: M, stopIndexOverscan: N, stopIndexVisible: P } = Sn({
|
|
2196
2562
|
containerElement: y,
|
|
2197
2563
|
containerStyle: h,
|
|
2198
2564
|
defaultContainerSize: n,
|
|
@@ -2204,68 +2570,68 @@ function En({ children: e, className: t, defaultHeight: n = 0, defaultScrollOffs
|
|
|
2204
2570
|
onResize: a,
|
|
2205
2571
|
overscanCount: s,
|
|
2206
2572
|
scrollElement: p
|
|
2207
|
-
}),
|
|
2573
|
+
}), ee = q([]), F = jn({
|
|
2208
2574
|
direction: "vertical",
|
|
2209
2575
|
element: y,
|
|
2210
2576
|
getCellBounds: D,
|
|
2211
2577
|
isDynamicSize: x,
|
|
2212
2578
|
itemCount: l,
|
|
2213
|
-
itemElements:
|
|
2579
|
+
itemElements: ee,
|
|
2214
2580
|
scrollTarget: k,
|
|
2215
|
-
getScrollPositionForIndex:
|
|
2581
|
+
getScrollPositionForIndex: A
|
|
2216
2582
|
});
|
|
2217
|
-
|
|
2583
|
+
je(i, () => ({
|
|
2218
2584
|
get element() {
|
|
2219
2585
|
return y;
|
|
2220
2586
|
},
|
|
2221
|
-
scrollToRow:
|
|
2222
|
-
}), [y,
|
|
2223
|
-
let
|
|
2224
|
-
|
|
2587
|
+
scrollToRow: F
|
|
2588
|
+
}), [y, F]);
|
|
2589
|
+
let I = w && x && j === 0;
|
|
2590
|
+
$(() => {
|
|
2225
2591
|
if (!y) return;
|
|
2226
|
-
let e = Array.from(y.children).filter((e) => !e.hasAttribute(
|
|
2592
|
+
let e = Array.from(y.children).filter((e) => !e.hasAttribute(Fn)), t = Nn({
|
|
2227
2593
|
elements: e,
|
|
2228
|
-
isFlowLayout:
|
|
2594
|
+
isFlowLayout: I,
|
|
2229
2595
|
rowCount: l,
|
|
2230
|
-
startIndex:
|
|
2231
|
-
stopIndex:
|
|
2596
|
+
startIndex: j,
|
|
2597
|
+
stopIndex: N
|
|
2232
2598
|
}), n = t.map(({ element: e }) => e);
|
|
2233
2599
|
if (e.forEach((e) => {
|
|
2234
|
-
n.includes(e) || e.removeAttribute(
|
|
2600
|
+
n.includes(e) || e.removeAttribute(Tn);
|
|
2235
2601
|
}), t.forEach(({ element: e, index: t }) => {
|
|
2236
|
-
e.setAttribute(
|
|
2237
|
-
}),
|
|
2602
|
+
e.setAttribute(Tn, `${t}`);
|
|
2603
|
+
}), ee.current = n, x) return u.observeRowElements(n);
|
|
2238
2604
|
}, [
|
|
2239
2605
|
v,
|
|
2240
2606
|
y,
|
|
2241
2607
|
x,
|
|
2242
|
-
|
|
2608
|
+
I,
|
|
2243
2609
|
l,
|
|
2244
2610
|
u,
|
|
2245
2611
|
d,
|
|
2246
2612
|
_,
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
]),
|
|
2250
|
-
|
|
2251
|
-
startIndex:
|
|
2252
|
-
stopIndex:
|
|
2613
|
+
j,
|
|
2614
|
+
N
|
|
2615
|
+
]), G(() => {
|
|
2616
|
+
j >= 0 && N >= 0 && o && o({
|
|
2617
|
+
startIndex: M,
|
|
2618
|
+
stopIndex: P
|
|
2253
2619
|
}, {
|
|
2254
|
-
startIndex:
|
|
2255
|
-
stopIndex:
|
|
2620
|
+
startIndex: j,
|
|
2621
|
+
stopIndex: N
|
|
2256
2622
|
});
|
|
2257
2623
|
}, [
|
|
2258
2624
|
o,
|
|
2259
|
-
A,
|
|
2260
2625
|
j,
|
|
2261
2626
|
M,
|
|
2262
|
-
|
|
2627
|
+
N,
|
|
2628
|
+
P
|
|
2263
2629
|
]);
|
|
2264
|
-
let
|
|
2630
|
+
let L = K(() => {
|
|
2265
2631
|
let e = [];
|
|
2266
|
-
if (l > 0) for (let t =
|
|
2632
|
+
if (l > 0) for (let t = j; t <= N; t++) {
|
|
2267
2633
|
let n = D(t);
|
|
2268
|
-
e.push(/* @__PURE__ */
|
|
2634
|
+
e.push(/* @__PURE__ */ De(v, {
|
|
2269
2635
|
..._,
|
|
2270
2636
|
ariaAttributes: {
|
|
2271
2637
|
"aria-posinset": t + 1,
|
|
@@ -2274,7 +2640,7 @@ function En({ children: e, className: t, defaultHeight: n = 0, defaultScrollOffs
|
|
|
2274
2640
|
},
|
|
2275
2641
|
key: d ? d(t, _) : t,
|
|
2276
2642
|
index: t,
|
|
2277
|
-
style:
|
|
2643
|
+
style: I ? { width: "100%" } : {
|
|
2278
2644
|
position: "absolute",
|
|
2279
2645
|
left: 0,
|
|
2280
2646
|
transform: `translateY(${n.scrollOffset}px)`,
|
|
@@ -2288,24 +2654,24 @@ function En({ children: e, className: t, defaultHeight: n = 0, defaultScrollOffs
|
|
|
2288
2654
|
v,
|
|
2289
2655
|
D,
|
|
2290
2656
|
x,
|
|
2291
|
-
|
|
2657
|
+
I,
|
|
2292
2658
|
l,
|
|
2293
2659
|
d,
|
|
2294
2660
|
_,
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
]),
|
|
2661
|
+
j,
|
|
2662
|
+
N
|
|
2663
|
+
]), R = /* @__PURE__ */ H("div", {
|
|
2298
2664
|
"aria-hidden": !0,
|
|
2299
|
-
[
|
|
2665
|
+
[Fn]: "",
|
|
2300
2666
|
style: {
|
|
2301
|
-
position:
|
|
2302
|
-
top:
|
|
2667
|
+
position: I ? "absolute" : void 0,
|
|
2668
|
+
top: I ? 0 : void 0,
|
|
2303
2669
|
height: O(),
|
|
2304
2670
|
width: "100%",
|
|
2305
2671
|
zIndex: -1
|
|
2306
2672
|
}
|
|
2307
|
-
}, "sizer"),
|
|
2308
|
-
return
|
|
2673
|
+
}, "sizer"), z = /* @__PURE__ */ H(Ee, { children: e }, "children"), B = /* @__PURE__ */ H(Ee, { children: L }, "rows");
|
|
2674
|
+
return De(m, {
|
|
2309
2675
|
role: "list",
|
|
2310
2676
|
...g,
|
|
2311
2677
|
className: t,
|
|
@@ -2319,9 +2685,9 @@ function En({ children: e, className: t, defaultHeight: n = 0, defaultScrollOffs
|
|
|
2319
2685
|
},
|
|
2320
2686
|
...h
|
|
2321
2687
|
}
|
|
2322
|
-
}, ...
|
|
2688
|
+
}, ...I ? [z, B] : [B, z], R);
|
|
2323
2689
|
}
|
|
2324
|
-
var
|
|
2690
|
+
var Ln = /* @__PURE__ */ Object.assign(In, { displayName: "List" }), Rn = {
|
|
2325
2691
|
search: "_search_5skzl_1",
|
|
2326
2692
|
divider: "_divider_5skzl_5",
|
|
2327
2693
|
item: "_item_5skzl_9",
|
|
@@ -2330,29 +2696,29 @@ var Dn = /* @__PURE__ */ Object.assign(En, { displayName: "List" }), On = {
|
|
|
2330
2696
|
stateLabel: "_stateLabel_5skzl_27",
|
|
2331
2697
|
itemSelectedBackground: "_itemSelectedBackground_5skzl_37",
|
|
2332
2698
|
itemSelectedText: "_itemSelectedText_5skzl_41"
|
|
2333
|
-
},
|
|
2334
|
-
let p = r[e], m =
|
|
2335
|
-
return /* @__PURE__ */
|
|
2699
|
+
}, zn = 44, Bn = 8, Vn = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: o, itemClassName: s, selectedItemClassName: c, hasSelectedBackground: u, hasSelectedText: d, onSelect: f }) => {
|
|
2700
|
+
let p = r[e], m = Gt(p.iconUrl, p.type, p.displayName ?? p.id, v.SM), g = p.id === i;
|
|
2701
|
+
return /* @__PURE__ */ H("div", {
|
|
2336
2702
|
style: t,
|
|
2337
2703
|
...n,
|
|
2338
|
-
children: /* @__PURE__ */
|
|
2704
|
+
children: /* @__PURE__ */ H(h, {
|
|
2339
2705
|
type: "button",
|
|
2340
2706
|
"aria-current": g ? "true" : void 0,
|
|
2341
|
-
className: l(
|
|
2342
|
-
iconBefore: /* @__PURE__ */
|
|
2343
|
-
className:
|
|
2707
|
+
className: l(Rn.item, "h-full w-full gap-3 px-4", g && u && Rn.itemSelectedBackground, g && d && Rn.itemSelectedText, s, g && c, Y.modelMenuItem, g && Y.modelMenuItemSelected),
|
|
2708
|
+
iconBefore: /* @__PURE__ */ H("span", {
|
|
2709
|
+
className: Rn.itemIcon,
|
|
2344
2710
|
children: m
|
|
2345
2711
|
}),
|
|
2346
|
-
label: /* @__PURE__ */
|
|
2712
|
+
label: /* @__PURE__ */ U("span", {
|
|
2347
2713
|
className: "flex flex-1 items-center justify-between gap-2",
|
|
2348
|
-
children: [/* @__PURE__ */
|
|
2714
|
+
children: [/* @__PURE__ */ H(T, {
|
|
2349
2715
|
text: p.displayName ?? p.id,
|
|
2350
2716
|
query: o,
|
|
2351
2717
|
maxLines: 1,
|
|
2352
2718
|
className: l(a, "min-w-0 flex-1 text-start")
|
|
2353
|
-
}), g && /* @__PURE__ */
|
|
2719
|
+
}), g && /* @__PURE__ */ H(he, {
|
|
2354
2720
|
size: v.SM,
|
|
2355
|
-
className:
|
|
2721
|
+
className: Rn.checkIcon,
|
|
2356
2722
|
"aria-hidden": !0,
|
|
2357
2723
|
stroke: y
|
|
2358
2724
|
})]
|
|
@@ -2360,61 +2726,61 @@ var Dn = /* @__PURE__ */ Object.assign(En, { displayName: "List" }), On = {
|
|
|
2360
2726
|
onClick: () => f(p.id)
|
|
2361
2727
|
})
|
|
2362
2728
|
});
|
|
2363
|
-
},
|
|
2364
|
-
let [b, x] =
|
|
2365
|
-
|
|
2729
|
+
}, Hn = ({ isOpen: e, title: t, closeLabel: n, searchPlaceholder: r = "Search", onClose: i, deployments: a, selectedDeploymentId: o, onSelect: s, loadingLabel: u, errorLabel: d, emptyLabel: f, style: p, titleClassName: m = "dial-body-semi-text", labelClassName: h = "dial-small-text", colors: g, menuStyles: _, searchQuery: v, onSearchQueryChange: y }) => {
|
|
2730
|
+
let [b, x] = J(""), C = v ?? b, w = y ?? x;
|
|
2731
|
+
G(() => {
|
|
2366
2732
|
e || x("");
|
|
2367
2733
|
}, [e]);
|
|
2368
|
-
let T = a && a.length > 0, D = u !== void 0, O = !T && !D ? d ?? f : void 0, k = T ?
|
|
2734
|
+
let T = a && a.length > 0, D = u !== void 0, O = !T && !D ? d ?? f : void 0, k = T ? Wt(a, C) : [], A = (e) => {
|
|
2369
2735
|
s(e), i();
|
|
2370
|
-
},
|
|
2736
|
+
}, j = _?.colors, M = c({
|
|
2371
2737
|
"--ci-sheet-divider": g?.divider,
|
|
2372
|
-
"--ci-sheet-text":
|
|
2373
|
-
"--ci-sheet-item-hover":
|
|
2738
|
+
"--ci-sheet-text": j?.itemText ?? g?.itemText,
|
|
2739
|
+
"--ci-sheet-item-hover": j?.itemHoverBackground ?? g?.itemHoverBg,
|
|
2374
2740
|
"--ci-sheet-item-active": g?.itemActiveBg,
|
|
2375
|
-
"--ci-sheet-icon":
|
|
2376
|
-
"--ci-check-icon":
|
|
2377
|
-
"--ci-sheet-selected-bg":
|
|
2378
|
-
"--ci-sheet-selected-text":
|
|
2741
|
+
"--ci-sheet-icon": j?.itemText ?? g?.itemIcon,
|
|
2742
|
+
"--ci-check-icon": j?.checkIcon ?? g?.checkIcon,
|
|
2743
|
+
"--ci-sheet-selected-bg": j?.selectedItemBackground,
|
|
2744
|
+
"--ci-sheet-selected-text": j?.selectedItemText
|
|
2379
2745
|
});
|
|
2380
|
-
return /* @__PURE__ */
|
|
2746
|
+
return /* @__PURE__ */ H(Fe, {
|
|
2381
2747
|
isOpen: e,
|
|
2382
2748
|
title: t,
|
|
2383
2749
|
closeLabel: n,
|
|
2384
2750
|
onClose: i,
|
|
2385
2751
|
style: p,
|
|
2386
2752
|
titleClassName: m,
|
|
2387
|
-
className: l("max-h-[80dvh]", _?.className,
|
|
2753
|
+
className: l("max-h-[80dvh]", _?.className, Y.modelMenu),
|
|
2388
2754
|
colors: g?.shell,
|
|
2389
|
-
children: /* @__PURE__ */
|
|
2755
|
+
children: /* @__PURE__ */ U("div", {
|
|
2390
2756
|
className: "contents",
|
|
2391
|
-
style:
|
|
2757
|
+
style: M,
|
|
2392
2758
|
children: [
|
|
2393
|
-
/* @__PURE__ */
|
|
2759
|
+
/* @__PURE__ */ H(E, {
|
|
2394
2760
|
visuallyHidden: !0,
|
|
2395
2761
|
children: D ? u : null
|
|
2396
2762
|
}),
|
|
2397
|
-
T && !D && /* @__PURE__ */
|
|
2763
|
+
T && !D && /* @__PURE__ */ U(le, { children: [/* @__PURE__ */ H("div", {
|
|
2398
2764
|
style: c({ "--ci-sheet-search-bg": _?.colors?.searchHeaderBackground }),
|
|
2399
|
-
className: l("shrink-0 px-4 py-[10px]",
|
|
2400
|
-
children: /* @__PURE__ */
|
|
2765
|
+
className: l("shrink-0 px-4 py-[10px]", Rn.search, _?.searchHeaderClassName, Y.modelMenuSearch),
|
|
2766
|
+
children: /* @__PURE__ */ H(V, {
|
|
2401
2767
|
value: C,
|
|
2402
2768
|
placeholder: r,
|
|
2403
2769
|
size: S.Standard,
|
|
2404
2770
|
onChange: (e) => w(e ?? "")
|
|
2405
2771
|
})
|
|
2406
|
-
}), /* @__PURE__ */
|
|
2407
|
-
D ? /* @__PURE__ */
|
|
2772
|
+
}), /* @__PURE__ */ H("div", { className: l(Rn.divider, "h-px shrink-0") })] }),
|
|
2773
|
+
D ? /* @__PURE__ */ H(Ht, {}) : O ? /* @__PURE__ */ H("div", {
|
|
2408
2774
|
role: "list",
|
|
2409
|
-
className: l(
|
|
2775
|
+
className: l(Rn.stateLabel, h, "px-4 py-4"),
|
|
2410
2776
|
children: O
|
|
2411
|
-
}) : /* @__PURE__ */
|
|
2777
|
+
}) : /* @__PURE__ */ H(Ln, {
|
|
2412
2778
|
role: "list",
|
|
2413
2779
|
className: "overflow-y-auto",
|
|
2414
|
-
style: { height: Math.min(k.length,
|
|
2415
|
-
rowComponent:
|
|
2780
|
+
style: { height: Math.min(k.length, Bn) * zn },
|
|
2781
|
+
rowComponent: Vn,
|
|
2416
2782
|
rowCount: k.length,
|
|
2417
|
-
rowHeight:
|
|
2783
|
+
rowHeight: zn,
|
|
2418
2784
|
rowProps: {
|
|
2419
2785
|
items: k,
|
|
2420
2786
|
selectedDeploymentId: o,
|
|
@@ -2422,18 +2788,18 @@ var Dn = /* @__PURE__ */ Object.assign(En, { displayName: "List" }), On = {
|
|
|
2422
2788
|
query: C,
|
|
2423
2789
|
itemClassName: _?.itemClassName,
|
|
2424
2790
|
selectedItemClassName: _?.selectedItemClassName,
|
|
2425
|
-
hasSelectedBackground: !!
|
|
2426
|
-
hasSelectedText: !!
|
|
2427
|
-
onSelect:
|
|
2791
|
+
hasSelectedBackground: !!j?.selectedItemBackground,
|
|
2792
|
+
hasSelectedText: !!j?.selectedItemText,
|
|
2793
|
+
onSelect: A
|
|
2428
2794
|
}
|
|
2429
2795
|
})
|
|
2430
2796
|
]
|
|
2431
2797
|
})
|
|
2432
2798
|
});
|
|
2433
|
-
},
|
|
2434
|
-
let [C, T] =
|
|
2435
|
-
T(e), S?.(e),
|
|
2436
|
-
}, { searchQuery: O, onSearchQueryChange: k, selectorIcon:
|
|
2799
|
+
}, Un = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, menuStyles: i, nameClassName: a = "dial-small-text", versionClassName: o = "dial-tiny-text", isStreaming: u, isMobile: d, isDisabled: f = !1, style: p, modelPickerOverlay: m, isPickerOpen: g, onPickerToggle: _, onPickerOpenChange: S }) => {
|
|
2800
|
+
let [C, T] = J(!1), E = g ?? C, D = (e) => {
|
|
2801
|
+
T(e), S?.(e), I(e);
|
|
2802
|
+
}, { searchQuery: O, onSearchQueryChange: k, selectorIcon: A, selectorAriaLabel: j, selectedLabel: M, selectedVersion: N, menuItems: P, menuHeader: ee, menuStyle: F, onOpenChange: I } = qt({
|
|
2437
2803
|
deployments: e,
|
|
2438
2804
|
selectedDeploymentId: t,
|
|
2439
2805
|
onDeploymentChange: n,
|
|
@@ -2441,36 +2807,36 @@ var Dn = /* @__PURE__ */ Object.assign(En, { displayName: "List" }), On = {
|
|
|
2441
2807
|
styles: i
|
|
2442
2808
|
});
|
|
2443
2809
|
if (!e) return null;
|
|
2444
|
-
let
|
|
2810
|
+
let L = u || f, R = L ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, z = /* @__PURE__ */ H(ge, {
|
|
2445
2811
|
size: v.SM,
|
|
2446
|
-
className: l(
|
|
2812
|
+
className: l(X.modelSelectorCaret, Y.modelSelectorCaret),
|
|
2447
2813
|
"aria-hidden": !0,
|
|
2448
2814
|
stroke: y
|
|
2449
|
-
}),
|
|
2450
|
-
className: l("flex shrink-0 items-center",
|
|
2451
|
-
children:
|
|
2815
|
+
}), B = /* @__PURE__ */ H("span", {
|
|
2816
|
+
className: l("flex shrink-0 items-center", Y.modelSelectorIcon),
|
|
2817
|
+
children: A
|
|
2452
2818
|
});
|
|
2453
|
-
if (d) return /* @__PURE__ */
|
|
2454
|
-
tooltipProps: { tooltip:
|
|
2455
|
-
icon: /* @__PURE__ */
|
|
2819
|
+
if (d) return /* @__PURE__ */ U(le, { children: [/* @__PURE__ */ H(w, {
|
|
2820
|
+
tooltipProps: { tooltip: M },
|
|
2821
|
+
icon: /* @__PURE__ */ U("div", {
|
|
2456
2822
|
className: "flex items-center gap-1",
|
|
2457
|
-
children: [
|
|
2823
|
+
children: [B, z]
|
|
2458
2824
|
}),
|
|
2459
|
-
"aria-label":
|
|
2460
|
-
"aria-disabled":
|
|
2825
|
+
"aria-label": j,
|
|
2826
|
+
"aria-disabled": L || void 0,
|
|
2461
2827
|
onClick: () => {
|
|
2462
|
-
|
|
2828
|
+
L || D(!0);
|
|
2463
2829
|
},
|
|
2464
|
-
className: l("w-[50px]",
|
|
2465
|
-
}), m ? /* @__PURE__ */
|
|
2830
|
+
className: l("w-[50px]", X.modelSelectorButton, R, Y.modelSelectorButton)
|
|
2831
|
+
}), m ? /* @__PURE__ */ H(Fe, {
|
|
2466
2832
|
isOpen: E,
|
|
2467
2833
|
title: r?.ariaLabel ?? "Select model",
|
|
2468
2834
|
closeLabel: r?.closeLabel ?? "Close",
|
|
2469
2835
|
onClose: () => D(!1),
|
|
2470
2836
|
style: p,
|
|
2471
|
-
className: l(i?.className,
|
|
2837
|
+
className: l(i?.className, Y.modelMenu),
|
|
2472
2838
|
children: m(() => D(!1))
|
|
2473
|
-
}) : /* @__PURE__ */
|
|
2839
|
+
}) : /* @__PURE__ */ H(Hn, {
|
|
2474
2840
|
searchQuery: O,
|
|
2475
2841
|
onSearchQueryChange: k,
|
|
2476
2842
|
isOpen: E,
|
|
@@ -2488,8 +2854,8 @@ var Dn = /* @__PURE__ */ Object.assign(En, { displayName: "List" }), On = {
|
|
|
2488
2854
|
menuStyles: i
|
|
2489
2855
|
})] });
|
|
2490
2856
|
if (m) {
|
|
2491
|
-
let e =
|
|
2492
|
-
return /* @__PURE__ */
|
|
2857
|
+
let e = N ? `${M} · ${N}` : M;
|
|
2858
|
+
return /* @__PURE__ */ H(b, {
|
|
2493
2859
|
placement: "top-end",
|
|
2494
2860
|
matchReferenceWidth: !1,
|
|
2495
2861
|
open: E,
|
|
@@ -2499,600 +2865,410 @@ var Dn = /* @__PURE__ */ Object.assign(En, { displayName: "List" }), On = {
|
|
|
2499
2865
|
overlayRole: x.Dialog,
|
|
2500
2866
|
overlayAriaLabel: r?.ariaLabel ?? "Select model",
|
|
2501
2867
|
renderOverlay: () => m(() => D(!1)),
|
|
2502
|
-
listClassName: l("w-[368px]!",
|
|
2868
|
+
listClassName: l("w-[368px]!", X.modelOverlayPanel, i?.className, Y.modelMenu),
|
|
2503
2869
|
listStyle: c({ "--ci-model-overlay-bg": i?.colors?.overlayBackground }),
|
|
2504
|
-
children: /* @__PURE__ */
|
|
2505
|
-
"aria-label":
|
|
2506
|
-
"aria-disabled":
|
|
2870
|
+
children: /* @__PURE__ */ H(h, {
|
|
2871
|
+
"aria-label": j,
|
|
2872
|
+
"aria-disabled": L || void 0,
|
|
2507
2873
|
tooltipProps: { tooltip: e },
|
|
2508
|
-
className: l("h-auto min-w-0 gap-1.5 rounded-full! border-0! px-0 py-1.5 ps-1.5 pe-2",
|
|
2874
|
+
className: l("h-auto min-w-0 gap-1.5 rounded-full! border-0! px-0 py-1.5 ps-1.5 pe-2", X.modelSelectorButton, R, L && X.modelSelectorButtonDisabled, Y.modelSelectorButton),
|
|
2509
2875
|
onClick: () => {
|
|
2510
|
-
|
|
2876
|
+
L || (_ ? _() : D(!E));
|
|
2511
2877
|
},
|
|
2512
|
-
iconBefore:
|
|
2513
|
-
iconAfter:
|
|
2878
|
+
iconBefore: B,
|
|
2879
|
+
iconAfter: z,
|
|
2514
2880
|
textClassName: "min-w-0",
|
|
2515
|
-
label: /* @__PURE__ */
|
|
2881
|
+
label: /* @__PURE__ */ U("span", {
|
|
2516
2882
|
className: "flex max-w-[180px] min-w-0 items-baseline gap-1",
|
|
2517
|
-
children: [/* @__PURE__ */
|
|
2518
|
-
className: l("max-w-[180px] shrink-0 truncate", a,
|
|
2519
|
-
children: j
|
|
2520
|
-
}), M && /* @__PURE__ */ B("span", {
|
|
2521
|
-
className: l("min-w-0 truncate", o, Y.modelSelectorVersion),
|
|
2883
|
+
children: [/* @__PURE__ */ H("span", {
|
|
2884
|
+
className: l("max-w-[180px] shrink-0 truncate", a, X.modelSelectorName),
|
|
2522
2885
|
children: M
|
|
2886
|
+
}), N && /* @__PURE__ */ H("span", {
|
|
2887
|
+
className: l("min-w-0 truncate", o, X.modelSelectorVersion),
|
|
2888
|
+
children: N
|
|
2523
2889
|
})]
|
|
2524
2890
|
})
|
|
2525
2891
|
})
|
|
2526
2892
|
});
|
|
2527
2893
|
}
|
|
2528
|
-
return /* @__PURE__ */
|
|
2529
|
-
className: l(
|
|
2530
|
-
"aria-disabled":
|
|
2531
|
-
children: /* @__PURE__ */
|
|
2532
|
-
items:
|
|
2533
|
-
menuHeader:
|
|
2894
|
+
return /* @__PURE__ */ H("div", {
|
|
2895
|
+
className: l(R),
|
|
2896
|
+
"aria-disabled": L || void 0,
|
|
2897
|
+
children: /* @__PURE__ */ H(b, {
|
|
2898
|
+
items: P,
|
|
2899
|
+
menuHeader: ee,
|
|
2534
2900
|
placement: "bottom-end",
|
|
2535
2901
|
matchReferenceWidth: !1,
|
|
2536
2902
|
maxDropdownHeight: s,
|
|
2537
|
-
listClassName: l("w-[240px]!", i?.className,
|
|
2538
|
-
listStyle:
|
|
2539
|
-
disabled:
|
|
2903
|
+
listClassName: l("w-[240px]!", i?.className, Y.modelMenu),
|
|
2904
|
+
listStyle: F,
|
|
2905
|
+
disabled: L,
|
|
2540
2906
|
open: E,
|
|
2541
|
-
onOpenChange:
|
|
2542
|
-
children: /* @__PURE__ */
|
|
2543
|
-
"aria-label":
|
|
2544
|
-
"aria-disabled":
|
|
2545
|
-
tooltipProps: { tooltip:
|
|
2546
|
-
iconBefore:
|
|
2547
|
-
iconAfter:
|
|
2548
|
-
className: l("h-auto gap-1 rounded-full! border-0! p-1.5",
|
|
2907
|
+
onOpenChange: L ? void 0 : D,
|
|
2908
|
+
children: /* @__PURE__ */ H(h, {
|
|
2909
|
+
"aria-label": j,
|
|
2910
|
+
"aria-disabled": L || void 0,
|
|
2911
|
+
tooltipProps: { tooltip: M },
|
|
2912
|
+
iconBefore: B,
|
|
2913
|
+
iconAfter: z,
|
|
2914
|
+
className: l("h-auto gap-1 rounded-full! border-0! p-1.5", X.modelSelectorButton, L && X.modelSelectorButtonDisabled, Y.modelSelectorButton)
|
|
2549
2915
|
})
|
|
2550
2916
|
})
|
|
2551
2917
|
});
|
|
2552
|
-
},
|
|
2553
|
-
let
|
|
2554
|
-
|
|
2555
|
-
},
|
|
2556
|
-
"--ci-bg": R?.background,
|
|
2557
|
-
"--ci-text": R?.text,
|
|
2558
|
-
"--ci-border": R?.border,
|
|
2559
|
-
"--ci-border-focus": R?.borderFocus,
|
|
2560
|
-
"--ci-placeholder": R?.placeholder,
|
|
2561
|
-
"--ci-text-disabled": R?.textDisabled,
|
|
2562
|
-
"--ci-model-selector-caret-color": R?.modelSelectorCaret,
|
|
2563
|
-
"--ci-model-selector-hover-bg": R?.modelSelectorHoverBg,
|
|
2564
|
-
"--ci-model-selector-disabled-color": R?.modelSelectorDisabled,
|
|
2565
|
-
"--ci-model-selector-name-color": R?.modelSelectorName,
|
|
2566
|
-
"--ci-model-selector-version-color": R?.modelSelectorVersion,
|
|
2567
|
-
"--ci-voice-waveform": R?.voiceWaveform,
|
|
2568
|
-
"--ci-voice-accent": R?.voiceAccent,
|
|
2569
|
-
"--ci-mention-highlight-bg": R?.mentionHighlightBg,
|
|
2570
|
-
"--ci-mention-highlight-text": R?.mentionHighlightText,
|
|
2571
|
-
"--ci-mention-highlight-unsupported-bg": R?.mentionHighlightUnsupportedBg,
|
|
2572
|
-
"--ci-mention-highlight-unsupported-text": R?.mentionHighlightUnsupportedText,
|
|
2573
|
-
"--ci-selection-highlight-bg": R?.selectionHighlightBg
|
|
2574
|
-
}), [R]), Ut = W(() => _t ? [{
|
|
2575
|
-
key: "dial-fs",
|
|
2576
|
-
label: vt ?? "DIAL file system",
|
|
2577
|
-
icon: /* @__PURE__ */ B(be, {
|
|
2578
|
-
size: p,
|
|
2579
|
-
"aria-hidden": !0,
|
|
2580
|
-
stroke: y
|
|
2581
|
-
}),
|
|
2582
|
-
onClick: _t
|
|
2583
|
-
}] : [], [_t, vt]), { message: Z, setMessage: Wt, textareaRef: Q } = $e({
|
|
2918
|
+
}, Wn = Oe(({ message: e = "", messageRevision: t, focusRequestId: n, textInsertion: r, onSend: i, onUploadAttachment: a, onStop: o, isStreaming: s = !1, onChange: c, onAttachmentsChange: u, placeholder: p = "Type a message...", ariaLabel: m, attachLabel: h = "Attach file", fileAccept: g, addMenuTitle: _ = "Add", menuTitle: b = "Menu", menuCloseLabel: x = "Close", removeLabel: S, retryLabel: T, uploadingLabel: k, expandLabel: A, clickLabel: j, sendLabel: M, sendTooltip: N, emptyMessageTooltip: P, stopLabel: ee, micLabel: F = "Dictate", recordVoiceLabel: I = "Record voice", stopRecordingLabel: L, discardRecordingLabel: R, colors: z, typography: B, attachmentTray: V, modelMenu: te, className: ne, pendingDropFiles: re = [], onDropFilesConsumed: ie, pendingAttachments: ae = [], onPendingAttachmentsConsumed: oe, pasteTextThreshold: se = 4e3, maxMessageLength: ce = 5e4, deployments: de, selectedDeploymentId: fe, onDeploymentChange: pe, modelSelectorLabels: me, initialAttachments: he = [], hideAddButton: ge = !1, hideAttachFile: _e = !1, hideActionBar: ve = !1, actionRowLayout: be = $e.Stacked, isInlineActionRowAllowedBelowDesktop: xe = !1, renderFooterActions: Se, isInputDisabled: Ce = !1, isModelSelectorDisabled: we = !1, isSendDisabled: Te = !1, isAudioMessageSupported: Ee = !1, isVoiceRecordingSupported: De = Ee, onTranscribeAudio: Oe, transcribingLabel: ke, voiceErrorLabel: Ae, sendOnEnter: Me = Qe.Enter, prefixAttachments: Ne = [], onRemovePrefixAttachment: Pe, chatSettings: Fe, toolsMenuItems: Ie, onToolToggle: Re, canRemoveTools: ze = !0, toolsMenuTitle: He, toolsBackLabel: Ue, toolsChipLabels: Ge, menuOverlays: qe, activeMentions: Je, onBackspaceAtCaret: Ye, caretPositionOverride: Xe, commandMenu: Ze, autoFocus: et = !1, messageHistory: tt, onDialFileSystemClick: rt, dialFileSystemLabel: it, validateAttachment: at, onAttachmentClick: ot, modelPickerOverlay: ut, onModelPickerOpenChange: dt, maximumAttachmentsAmount: ft, onAttachmentsLimitExceeded: pt, isAttachmentsEnabled: ht = !0, isTextAttachmentsAllowed: gt = !0, usageLimitsSlot: _t, onMessageTooLong: vt }, yt) => {
|
|
2919
|
+
let bt = d(), Dt = f(), [Ot, kt] = J(!1), At = (e) => {
|
|
2920
|
+
kt(e), dt?.(e);
|
|
2921
|
+
}, jt = Be(tt), Mt = Je ?? [], Nt = Mt.length > 0, Pt = K(() => Et(z), [z]), { message: Z, setMessage: Ft, textareaRef: Q } = Ve({
|
|
2584
2922
|
messageProp: e,
|
|
2585
2923
|
messageRevision: t
|
|
2586
2924
|
});
|
|
2587
|
-
|
|
2925
|
+
G(() => {
|
|
2588
2926
|
let e = Q.current;
|
|
2589
2927
|
e != null && e.value.length !== 0 && document.activeElement === e && e.setSelectionRange(e.value.length, e.value.length);
|
|
2590
|
-
}, [Q]),
|
|
2928
|
+
}, [Q]), G(() => {
|
|
2591
2929
|
n !== void 0 && Q.current?.focus();
|
|
2592
|
-
}, [n, Q]),
|
|
2593
|
-
let { handleUndoKeyDown:
|
|
2930
|
+
}, [n, Q]), je(yt, () => ({ getCaretPosition: () => Q.current?.selectionStart ?? Z.length }), [Z, Q]);
|
|
2931
|
+
let { handleUndoKeyDown: It, markCaretPlaced: Bt } = We({
|
|
2594
2932
|
insertion: r,
|
|
2595
2933
|
textareaRef: Q
|
|
2596
|
-
}), { isMenuOpen:
|
|
2597
|
-
|
|
2598
|
-
message: Z
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
let e = hn.current, t = gn.current;
|
|
2612
|
-
if (e == null || t == null) {
|
|
2613
|
-
vn(null);
|
|
2614
|
-
return;
|
|
2615
|
-
}
|
|
2616
|
-
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
2617
|
-
vn({
|
|
2618
|
-
left: n.left - r.left,
|
|
2619
|
-
top: n.top - r.top
|
|
2620
|
-
});
|
|
2621
|
-
}, []);
|
|
2622
|
-
U(() => {
|
|
2623
|
-
if (mn == null) return;
|
|
2624
|
-
let e = Q.current;
|
|
2625
|
-
if (e == null || typeof ResizeObserver > "u") return;
|
|
2626
|
-
let t = new ResizeObserver(yn);
|
|
2627
|
-
return t.observe(e), () => t.disconnect();
|
|
2628
|
-
}, [
|
|
2629
|
-
mn,
|
|
2630
|
-
Q,
|
|
2631
|
-
yn
|
|
2632
|
-
]);
|
|
2633
|
-
let bn = H((e) => {
|
|
2634
|
-
if (J == null || (Yt(), !e?.consumeQuery) || (e.returnFocus !== !1 && Q.current?.focus(), $ == null)) return;
|
|
2635
|
-
let t = `${J.triggerPrefix}${Jt}`, n = $ + t.length;
|
|
2636
|
-
if (Z.slice($, n) !== t) return;
|
|
2637
|
-
let r = Z.slice(0, $) + Z.slice(n);
|
|
2638
|
-
Wt(r), Bt.notifyChange(), u?.(r);
|
|
2639
|
-
}, [
|
|
2640
|
-
J,
|
|
2641
|
-
Yt,
|
|
2642
|
-
Jt,
|
|
2643
|
-
Z,
|
|
2644
|
-
$,
|
|
2645
|
-
Wt,
|
|
2646
|
-
Bt,
|
|
2647
|
-
u,
|
|
2648
|
-
Q
|
|
2649
|
-
]), xn = G(void 0);
|
|
2650
|
-
U(() => {
|
|
2651
|
-
mt != null && xn.current !== t && (xn.current = t, Q.current?.setSelectionRange(mt, mt), Kt(), Zt(mt));
|
|
2652
|
-
}, [Z]);
|
|
2653
|
-
let Sn = G(Z);
|
|
2654
|
-
Sn.current = Z;
|
|
2655
|
-
let { attachments: Cn, buildAttachments: wn, addAttachments: Tn, resetAttachments: En, handleRemove: Dn, handleRetry: On, handleExpand: kn, hasBlockedAttachments: An } = ze({
|
|
2656
|
-
initialAttachments: we,
|
|
2934
|
+
}), { isMenuOpen: Vt, query: Ht, activeWordStart: Ut, closeOnOutsidePress: Wt, handleValueChange: Gt, commandMenuListboxId: Kt, commandMenuOverlayRef: qt, activeCommandOptionId: $, handleTextareaClick: Jt, handleTextareaFocus: Yt, handleTextareaKeyUp: Xt, skipFocusMenuEvaluationRef: Zt, triggerEnd: Qt, hasCommandEmptyQueryHint: $t, markerOffset: en, handleCloseCommandMenu: tn, isSendGesture: nn, handleCommandMenuKeyDown: rn } = xt({
|
|
2935
|
+
commandMenu: Ze,
|
|
2936
|
+
message: Z,
|
|
2937
|
+
setMessage: Ft,
|
|
2938
|
+
textareaRef: Q,
|
|
2939
|
+
historyNav: jt,
|
|
2940
|
+
onChange: c,
|
|
2941
|
+
caretPositionOverride: Xe,
|
|
2942
|
+
messageRevision: t,
|
|
2943
|
+
markCaretPlaced: Bt,
|
|
2944
|
+
sendOnEnter: Me
|
|
2945
|
+
}), an = q(Z);
|
|
2946
|
+
an.current = Z;
|
|
2947
|
+
let { attachments: on, buildAttachments: sn, addAttachments: cn, resetAttachments: ln, handleRemove: un, handleRetry: dn, handleExpand: fn, hasBlockedAttachments: pn } = Le({
|
|
2948
|
+
initialAttachments: he,
|
|
2657
2949
|
onUploadAttachment: a,
|
|
2658
|
-
onAttachmentsChange:
|
|
2659
|
-
validateAttachment:
|
|
2660
|
-
pendingDropFiles:
|
|
2661
|
-
onDropFilesConsumed:
|
|
2662
|
-
isDropDisabled:
|
|
2663
|
-
pendingAttachments:
|
|
2664
|
-
onPendingAttachmentsConsumed:
|
|
2665
|
-
onExpandPastedText:
|
|
2666
|
-
let t =
|
|
2667
|
-
|
|
2668
|
-
}, [
|
|
2669
|
-
maximumAttachmentsAmount:
|
|
2670
|
-
baseAttachmentsAmount:
|
|
2671
|
-
onAttachmentsLimitExceeded:
|
|
2672
|
-
}),
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
onTranscribeAudio:
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
}),
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
}, [
|
|
2717
|
-
Gn,
|
|
2718
|
-
_e,
|
|
2719
|
-
Nt,
|
|
2720
|
-
Kn,
|
|
2721
|
-
J
|
|
2722
|
-
]), Jn = Z.trim().length > 0 || Cn.length > 0, Yn = Jn && !An && !Fe && !Hn, [Xn, Zn] = K([]), Qn = (Xe ?? []).map((e) => e.id).join("|");
|
|
2723
|
-
U(() => {
|
|
2724
|
-
Zn([]);
|
|
2725
|
-
}, [Qn]);
|
|
2726
|
-
let $n = W(() => {
|
|
2727
|
-
let e = Xe ?? [];
|
|
2728
|
-
return It ? e.filter((e) => e.isSelected) : tt ? e.filter((e) => e.isSelected || !Xn.includes(e.id)) : e;
|
|
2729
|
-
}, [
|
|
2730
|
-
Xe,
|
|
2731
|
-
Xn,
|
|
2732
|
-
tt,
|
|
2733
|
-
It
|
|
2734
|
-
]), er = H((e) => {
|
|
2735
|
-
Zn((t) => t.includes(e) ? t : [...t, e]), Xe?.find((t) => t.id === e)?.isSelected && Ze?.(e);
|
|
2736
|
-
}, [Xe, Ze]), tr = ve === void 0 || ye != null, nr = Ie && !s, rr = async () => {
|
|
2737
|
-
if (Fe || Hn) return;
|
|
2738
|
-
if (Z.length >= _e) {
|
|
2739
|
-
Nt?.(Z.length, _e);
|
|
2740
|
-
return;
|
|
2741
|
-
}
|
|
2742
|
-
let e = Z, t = Cn;
|
|
2743
|
-
Wt(""), Bt.reset();
|
|
2744
|
-
try {
|
|
2745
|
-
await i?.(e, t), t.forEach((e) => {
|
|
2746
|
-
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
2747
|
-
}), En([]);
|
|
2748
|
-
} catch {
|
|
2749
|
-
Wt(e), En(t);
|
|
2750
|
-
}
|
|
2751
|
-
}, ir = (e) => He === ut.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey, ar = (e) => {
|
|
2752
|
-
if (!qt || e.nativeEvent.isComposing) return !1;
|
|
2753
|
-
if (e.key === "Escape") return e.preventDefault(), e.stopPropagation(), Yt(), !0;
|
|
2754
|
-
if (e.key === "ArrowDown" || e.key === "ArrowUp") return e.preventDefault(), nn(e.key === "ArrowDown" ? We.Next : We.Previous), !0;
|
|
2755
|
-
if (e.key !== "Enter" || e.shiftKey) return !1;
|
|
2756
|
-
let t = rn();
|
|
2757
|
-
return t == null ? ir(e) ? (e.preventDefault(), !0) : !1 : (e.preventDefault(), t.click(), !0);
|
|
2758
|
-
}, or = (e) => {
|
|
2759
|
-
if (!Hn && !Gt(e) && !ar(e)) {
|
|
2760
|
-
if (!e.nativeEvent.isComposing && !je && !s) {
|
|
2761
|
-
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
2762
|
-
let t = e.currentTarget.selectionStart ?? 0, n = Bt.navigate(e.key === "ArrowUp" ? "up" : "down", Z, t);
|
|
2763
|
-
if (n !== null) {
|
|
2764
|
-
e.preventDefault(), Wt(n);
|
|
2765
|
-
return;
|
|
2766
|
-
}
|
|
2767
|
-
}
|
|
2768
|
-
if (e.key === "Backspace" && pt != null && e.currentTarget.selectionStart === e.currentTarget.selectionEnd && e.currentTarget.selectionStart != null) {
|
|
2769
|
-
let t = pt(e.currentTarget.selectionStart);
|
|
2770
|
-
if (t != null) {
|
|
2771
|
-
e.preventDefault();
|
|
2772
|
-
let n = e.currentTarget;
|
|
2773
|
-
n.setSelectionRange(t.start, t.start + t.length), typeof document.execCommand == "function" && document.execCommand("delete", !1) || et(n, Z.slice(0, t.start) + Z.slice(t.start + t.length), t.start);
|
|
2774
|
-
return;
|
|
2775
|
-
}
|
|
2776
|
-
}
|
|
2777
|
-
}
|
|
2778
|
-
e.key === "Enter" && ir(e) && (e.preventDefault(), !s && Yn && tr && !je && rr());
|
|
2779
|
-
}
|
|
2780
|
-
}, sr = (e) => {
|
|
2950
|
+
onAttachmentsChange: u,
|
|
2951
|
+
validateAttachment: at,
|
|
2952
|
+
pendingDropFiles: re,
|
|
2953
|
+
onDropFilesConsumed: ie,
|
|
2954
|
+
isDropDisabled: Ce,
|
|
2955
|
+
pendingAttachments: ae,
|
|
2956
|
+
onPendingAttachmentsConsumed: oe,
|
|
2957
|
+
onExpandPastedText: W((e) => {
|
|
2958
|
+
let t = an.current, n = t ? `${t}\n${e}` : e;
|
|
2959
|
+
an.current = n, Ft(n), c?.(n);
|
|
2960
|
+
}, [Ft, c]),
|
|
2961
|
+
maximumAttachmentsAmount: ft,
|
|
2962
|
+
baseAttachmentsAmount: Ne.length,
|
|
2963
|
+
onAttachmentsLimitExceeded: pt
|
|
2964
|
+
}), { voiceState: mn, analyserNodeRef: hn, voiceError: gn, startRecording: _n, stopRecording: vn, discardRecording: yn, isVoiceActive: bn, latestTranscript: xn } = Tt({
|
|
2965
|
+
addAttachments: cn,
|
|
2966
|
+
buildAttachments: sn,
|
|
2967
|
+
draftRef: an,
|
|
2968
|
+
setMessage: Ft,
|
|
2969
|
+
historyNav: jt,
|
|
2970
|
+
onChange: c,
|
|
2971
|
+
onTranscribeAudio: Oe,
|
|
2972
|
+
voiceErrorLabel: Ae,
|
|
2973
|
+
textareaRef: Q,
|
|
2974
|
+
skipFocusMenuEvaluationRef: Zt
|
|
2975
|
+
}), Sn = q(null), Cn = q(null), wn = Ct({
|
|
2976
|
+
addAttachments: cn,
|
|
2977
|
+
isAttachmentsEnabled: ht,
|
|
2978
|
+
isTextAttachmentsAllowed: gt,
|
|
2979
|
+
pasteTextThreshold: se,
|
|
2980
|
+
maxMessageLength: ce,
|
|
2981
|
+
onMessageTooLong: vt,
|
|
2982
|
+
commandMenu: Ze
|
|
2983
|
+
}), Tn = Z.trim().length > 0 || on.length > 0, En = Tn && !pn && !Te && !bn, { visibleTools: Dn, handleToolDismiss: On } = St({
|
|
2984
|
+
toolsMenuItems: Ie,
|
|
2985
|
+
canRemoveTools: ze,
|
|
2986
|
+
isPhone: Dt,
|
|
2987
|
+
onToolToggle: Re
|
|
2988
|
+
}), kn = de === void 0 || fe != null, An = Ee && !s, { handleSend: jn, handleKeyDown: Mn } = wt({
|
|
2989
|
+
message: Z,
|
|
2990
|
+
setMessage: Ft,
|
|
2991
|
+
attachments: on,
|
|
2992
|
+
resetAttachments: ln,
|
|
2993
|
+
historyNav: jt,
|
|
2994
|
+
onSend: i,
|
|
2995
|
+
onMessageTooLong: vt,
|
|
2996
|
+
maxMessageLength: ce,
|
|
2997
|
+
isSendDisabled: Te,
|
|
2998
|
+
isVoiceActive: bn,
|
|
2999
|
+
isInputDisabled: Ce,
|
|
3000
|
+
isStreaming: s,
|
|
3001
|
+
canSend: En,
|
|
3002
|
+
hasModelSelected: kn,
|
|
3003
|
+
handleUndoKeyDown: It,
|
|
3004
|
+
handleCommandMenuKeyDown: rn,
|
|
3005
|
+
isSendGesture: nn,
|
|
3006
|
+
onBackspaceAtCaret: Ye
|
|
3007
|
+
}), Nn = (e) => {
|
|
2781
3008
|
let t = Array.from(e.target.files ?? []);
|
|
2782
3009
|
if (t.length === 0) return;
|
|
2783
|
-
let n =
|
|
2784
|
-
e.target.value = "",
|
|
2785
|
-
},
|
|
2786
|
-
|
|
2787
|
-
return mn != null && e.push({
|
|
2788
|
-
offset: mn,
|
|
2789
|
-
node: /* @__PURE__ */ B("span", {
|
|
2790
|
-
ref: hn,
|
|
2791
|
-
"aria-hidden": !0,
|
|
2792
|
-
className: "inline-block h-lh w-0 align-text-top"
|
|
2793
|
-
}, "caret-marker")
|
|
2794
|
-
}), pn && J != null && dn != null && e.push({
|
|
2795
|
-
offset: dn,
|
|
2796
|
-
node: /* @__PURE__ */ B("span", {
|
|
2797
|
-
className: Y.commandHint,
|
|
2798
|
-
"aria-hidden": !0,
|
|
2799
|
-
"data-mirror-synthetic": !0,
|
|
2800
|
-
children: J.emptyQueryHint
|
|
2801
|
-
}, "command-hint")
|
|
2802
|
-
}), e;
|
|
2803
|
-
}, [
|
|
2804
|
-
mn,
|
|
2805
|
-
pn,
|
|
2806
|
-
J,
|
|
2807
|
-
dn
|
|
2808
|
-
]), lr = Vt || cr.length > 0, { mirrorRef: ur, selectionRects: dr, updateSelectionRects: fr, syncMirrorToTextarea: pr } = Qe({
|
|
2809
|
-
textareaRef: Q,
|
|
3010
|
+
let n = sn(t);
|
|
3011
|
+
e.target.value = "", cn(n);
|
|
3012
|
+
}, { textareaAreaRef: Pn, caretAnchor: Fn, mirrorInsertions: In, isMirrorActive: Ln, mirrorRef: Rn, selectionRects: zn, updateSelectionRects: Bn, handleTextareaScroll: Vn } = mt({
|
|
3013
|
+
commandMenu: Ze,
|
|
2810
3014
|
message: Z,
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
Z
|
|
2819
|
-
]);
|
|
2820
|
-
let mr = /* @__PURE__ */ B("textarea", {
|
|
2821
|
-
className: l(Y.textarea, lr && Y.textareaMentionMode, z?.fontClassName || "dial-body-paragraph-text", "relative z-0 field-sizing-content max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent ps-1 pe-1 outline-hidden", "disabled:cursor-not-allowed"),
|
|
3015
|
+
textareaRef: Q,
|
|
3016
|
+
hasActiveMentions: Nt,
|
|
3017
|
+
markerOffset: en,
|
|
3018
|
+
triggerEnd: Qt,
|
|
3019
|
+
hasCommandEmptyQueryHint: $t
|
|
3020
|
+
}), Hn = /* @__PURE__ */ H("textarea", {
|
|
3021
|
+
className: l(X.textarea, Ln && X.textareaMentionMode, B?.fontClassName || "dial-body-paragraph-text", "relative z-0 field-sizing-content max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent ps-1 pe-1 outline-hidden", "disabled:cursor-not-allowed"),
|
|
2822
3022
|
ref: Q,
|
|
2823
|
-
autoFocus:
|
|
3023
|
+
autoFocus: et,
|
|
2824
3024
|
value: Z,
|
|
2825
3025
|
onChange: (e) => {
|
|
2826
|
-
|
|
3026
|
+
Ft(e.target.value), jt.notifyChange();
|
|
2827
3027
|
let t = e.nativeEvent instanceof InputEvent ? e.nativeEvent : void 0;
|
|
2828
|
-
|
|
2829
|
-
},
|
|
2830
|
-
onSelect: fr,
|
|
2831
|
-
onScroll: () => {
|
|
2832
|
-
pr(), mn != null && yn();
|
|
3028
|
+
Gt(e.target.value, e.target.selectionStart ?? e.target.value.length, t?.isComposing ?? !1), c?.(e.target.value);
|
|
2833
3029
|
},
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
"aria-
|
|
2843
|
-
"aria-
|
|
2844
|
-
"aria-
|
|
2845
|
-
|
|
2846
|
-
|
|
3030
|
+
onSelect: Bn,
|
|
3031
|
+
onScroll: Vn,
|
|
3032
|
+
onFocus: Yt,
|
|
3033
|
+
onClick: Jt,
|
|
3034
|
+
onKeyDown: Mn,
|
|
3035
|
+
onKeyUp: Xt,
|
|
3036
|
+
onPaste: wn,
|
|
3037
|
+
placeholder: p,
|
|
3038
|
+
"aria-label": m,
|
|
3039
|
+
"aria-autocomplete": Ze == null ? void 0 : "list",
|
|
3040
|
+
"aria-controls": Vt ? Kt : void 0,
|
|
3041
|
+
"aria-activedescendant": $ ?? void 0,
|
|
3042
|
+
"aria-hidden": Nt ? !0 : void 0,
|
|
3043
|
+
disabled: Ce,
|
|
3044
|
+
readOnly: bn,
|
|
2847
3045
|
rows: 1
|
|
2848
|
-
}),
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
"aria-label": J.menuLabel,
|
|
2872
|
-
children: J.renderMenu({
|
|
2873
|
-
query: Jt,
|
|
2874
|
-
caretPosition: $ ?? 0,
|
|
2875
|
-
close: bn,
|
|
2876
|
-
listboxId: $t,
|
|
2877
|
-
activeOptionId: tn
|
|
2878
|
-
})
|
|
2879
|
-
});
|
|
2880
|
-
},
|
|
2881
|
-
children: /* @__PURE__ */ B("span", {
|
|
2882
|
-
"aria-hidden": !0,
|
|
2883
|
-
className: "inline-block h-lh w-0"
|
|
2884
|
-
})
|
|
3046
|
+
}), Wn = /* @__PURE__ */ H(zt, {
|
|
3047
|
+
areaRef: Pn,
|
|
3048
|
+
mirrorRef: Rn,
|
|
3049
|
+
isMirrorActive: Ln,
|
|
3050
|
+
fontClassName: B?.fontClassName,
|
|
3051
|
+
message: Z,
|
|
3052
|
+
mentionRanges: Mt,
|
|
3053
|
+
mirrorInsertions: In,
|
|
3054
|
+
selectionRects: zn,
|
|
3055
|
+
children: /* @__PURE__ */ H(Rt, {
|
|
3056
|
+
textarea: Hn,
|
|
3057
|
+
textareaRef: Q,
|
|
3058
|
+
commandMenu: Ze,
|
|
3059
|
+
caretAnchor: Fn,
|
|
3060
|
+
fontClassName: B?.fontClassName,
|
|
3061
|
+
isMenuOpen: Vt,
|
|
3062
|
+
query: Ht,
|
|
3063
|
+
activeWordStart: Ut,
|
|
3064
|
+
listboxId: Kt,
|
|
3065
|
+
activeOptionId: $,
|
|
3066
|
+
overlayRef: qt,
|
|
3067
|
+
onOutsidePress: Wt,
|
|
3068
|
+
onClose: tn
|
|
2885
3069
|
})
|
|
2886
|
-
})
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
children: /* @__PURE__ */ B(Tt, {
|
|
2927
|
-
items: $n,
|
|
2928
|
-
onToolToggle: Ze,
|
|
2929
|
-
onToolDismiss: er,
|
|
2930
|
-
canRemove: tt,
|
|
2931
|
-
removeLabel: st?.removeLabel,
|
|
2932
|
-
stateOnLabel: st?.stateOnLabel,
|
|
2933
|
-
stateOffLabel: st?.stateOffLabel
|
|
3070
|
+
}), Gn = ge ? void 0 : /* @__PURE__ */ H(Lt, {
|
|
3071
|
+
fileInputRef: Sn,
|
|
3072
|
+
textareaRef: Q,
|
|
3073
|
+
message: Z,
|
|
3074
|
+
style: Pt,
|
|
3075
|
+
hideAttachFile: _e,
|
|
3076
|
+
isInputDisabled: Ce,
|
|
3077
|
+
isStreaming: s,
|
|
3078
|
+
isAttachmentsEnabled: ht,
|
|
3079
|
+
isVoiceRecordingSupported: De,
|
|
3080
|
+
isVoiceActive: bn,
|
|
3081
|
+
startRecording: _n,
|
|
3082
|
+
isPhone: Dt,
|
|
3083
|
+
canRemoveTools: ze,
|
|
3084
|
+
toolsMenuItems: Ie,
|
|
3085
|
+
onToolToggle: Re,
|
|
3086
|
+
chatSettings: Fe,
|
|
3087
|
+
menuOverlays: qe,
|
|
3088
|
+
onDialFileSystemClick: rt,
|
|
3089
|
+
dialFileSystemLabel: it,
|
|
3090
|
+
attachLabel: h,
|
|
3091
|
+
addMenuTitle: _,
|
|
3092
|
+
menuTitle: b,
|
|
3093
|
+
menuCloseLabel: x,
|
|
3094
|
+
recordVoiceLabel: I,
|
|
3095
|
+
toolsMenuTitle: He,
|
|
3096
|
+
toolsBackLabel: Ue
|
|
3097
|
+
}), Kn = be === $e.Inline && (!bt || xe), qn = Gn && /* @__PURE__ */ H("div", {
|
|
3098
|
+
className: l("flex", Y.addCluster),
|
|
3099
|
+
children: Gn
|
|
3100
|
+
}), Jn = Dn.length > 0 && Re != null && /* @__PURE__ */ H("div", {
|
|
3101
|
+
className: l("min-w-0", Kn ? "flex-1" : "max-w-full flex-[1_0_auto]", Y.toolsChips),
|
|
3102
|
+
children: /* @__PURE__ */ H(nt, {
|
|
3103
|
+
items: Dn,
|
|
3104
|
+
onToolToggle: Re,
|
|
3105
|
+
onToolDismiss: On,
|
|
3106
|
+
canRemove: ze,
|
|
3107
|
+
removeLabel: Ge?.removeLabel,
|
|
3108
|
+
stateOnLabel: Ge?.stateOnLabel,
|
|
3109
|
+
stateOffLabel: Ge?.stateOffLabel
|
|
2934
3110
|
})
|
|
2935
3111
|
});
|
|
2936
|
-
return /* @__PURE__ */
|
|
2937
|
-
ref:
|
|
2938
|
-
style:
|
|
2939
|
-
className: l(
|
|
3112
|
+
return /* @__PURE__ */ U("div", {
|
|
3113
|
+
ref: Cn,
|
|
3114
|
+
style: Pt,
|
|
3115
|
+
className: l(X.wrapper, Ce && X.wrapperDisabled, Ce && "cursor-not-allowed", "flex w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border", "p-4 focus-within:outline focus-within:-outline-offset-1 active:outline active:-outline-offset-1", ne, Y.wrapper),
|
|
2940
3116
|
children: [
|
|
2941
|
-
(
|
|
2942
|
-
attachments: [...
|
|
3117
|
+
(Ne.length > 0 || on.length > 0) && /* @__PURE__ */ H(ue, {
|
|
3118
|
+
attachments: [...Ne, ...on],
|
|
2943
3119
|
onRemove: (e) => {
|
|
2944
|
-
|
|
3120
|
+
Ne.some((t) => t.id === e) ? Pe?.(e) : un(e);
|
|
2945
3121
|
},
|
|
2946
|
-
onRetry:
|
|
2947
|
-
onExpand:
|
|
3122
|
+
onRetry: dn,
|
|
3123
|
+
onExpand: fn,
|
|
2948
3124
|
labels: {
|
|
2949
|
-
removeLabel:
|
|
2950
|
-
retryLabel:
|
|
2951
|
-
uploadingLabel:
|
|
2952
|
-
expandLabel:
|
|
2953
|
-
clickLabel:
|
|
3125
|
+
removeLabel: S,
|
|
3126
|
+
retryLabel: T,
|
|
3127
|
+
uploadingLabel: k,
|
|
3128
|
+
expandLabel: A,
|
|
3129
|
+
clickLabel: j
|
|
2954
3130
|
},
|
|
2955
3131
|
styles: {
|
|
2956
|
-
...
|
|
2957
|
-
className: l(
|
|
3132
|
+
...V,
|
|
3133
|
+
className: l(on.length > 6 && "-me-4", V?.className)
|
|
2958
3134
|
},
|
|
2959
|
-
onAttachmentClick:
|
|
2960
|
-
let t = [...
|
|
2961
|
-
t != null &&
|
|
3135
|
+
onAttachmentClick: ot == null ? void 0 : (e) => {
|
|
3136
|
+
let t = [...Ne, ...on].find((t) => t.id === e);
|
|
3137
|
+
t != null && ot(t);
|
|
2962
3138
|
}
|
|
2963
3139
|
}),
|
|
2964
|
-
!
|
|
2965
|
-
ref:
|
|
3140
|
+
!ge && /* @__PURE__ */ H("input", {
|
|
3141
|
+
ref: Sn,
|
|
2966
3142
|
type: "file",
|
|
2967
3143
|
multiple: !0,
|
|
2968
|
-
accept:
|
|
3144
|
+
accept: g,
|
|
2969
3145
|
className: "sr-only",
|
|
2970
3146
|
"aria-hidden": !0,
|
|
2971
3147
|
tabIndex: -1,
|
|
2972
|
-
onChange:
|
|
3148
|
+
onChange: Nn
|
|
2973
3149
|
}),
|
|
2974
|
-
/* @__PURE__ */
|
|
3150
|
+
/* @__PURE__ */ H(E, {
|
|
2975
3151
|
politeness: O.Assertive,
|
|
2976
3152
|
className: "min-w-0 px-1 wrap-break-word",
|
|
2977
|
-
children:
|
|
3153
|
+
children: gn && /* @__PURE__ */ H(C, { text: gn })
|
|
2978
3154
|
}),
|
|
2979
|
-
|
|
3155
|
+
bn && /* @__PURE__ */ H(st, {
|
|
2980
3156
|
embedded: !0,
|
|
2981
|
-
state:
|
|
2982
|
-
analyserNodeRef:
|
|
2983
|
-
onStop:
|
|
2984
|
-
onDiscard:
|
|
2985
|
-
attachButton:
|
|
2986
|
-
stopLabel:
|
|
2987
|
-
discardLabel:
|
|
2988
|
-
processingLabel:
|
|
3157
|
+
state: mn,
|
|
3158
|
+
analyserNodeRef: hn,
|
|
3159
|
+
onStop: vn,
|
|
3160
|
+
onDiscard: yn,
|
|
3161
|
+
attachButton: Gn,
|
|
3162
|
+
stopLabel: L,
|
|
3163
|
+
discardLabel: R,
|
|
3164
|
+
processingLabel: ke
|
|
2989
3165
|
}),
|
|
2990
|
-
!
|
|
2991
|
-
!
|
|
3166
|
+
!bn && ve && Wn,
|
|
3167
|
+
!bn && !ve && Kn && Jn && /* @__PURE__ */ H("div", {
|
|
2992
3168
|
className: "flex",
|
|
2993
|
-
children:
|
|
3169
|
+
children: Jn
|
|
2994
3170
|
}),
|
|
2995
|
-
!
|
|
2996
|
-
className: l("flex items-center gap-2",
|
|
3171
|
+
!bn && !ve && /* @__PURE__ */ U("div", {
|
|
3172
|
+
className: l("flex items-center gap-2", Kn ? "flex-nowrap" : "flex-wrap", Y.actionRow),
|
|
2997
3173
|
children: [
|
|
2998
|
-
|
|
2999
|
-
/* @__PURE__ */
|
|
3000
|
-
className: l("flex min-w-0 items-center self-stretch",
|
|
3001
|
-
children:
|
|
3174
|
+
Kn && qn,
|
|
3175
|
+
/* @__PURE__ */ H("div", {
|
|
3176
|
+
className: l("flex min-w-0 items-center self-stretch", Kn ? "flex-1" : "w-full", Y.textareaWrap),
|
|
3177
|
+
children: Wn
|
|
3002
3178
|
}),
|
|
3003
|
-
!
|
|
3004
|
-
!
|
|
3005
|
-
/* @__PURE__ */
|
|
3006
|
-
className: l("ms-auto flex shrink-0 items-center gap-2",
|
|
3007
|
-
children:
|
|
3008
|
-
canSend:
|
|
3009
|
-
onSend:
|
|
3010
|
-
}) : /* @__PURE__ */
|
|
3011
|
-
|
|
3012
|
-
/* @__PURE__ */
|
|
3013
|
-
deployments:
|
|
3014
|
-
selectedDeploymentId:
|
|
3015
|
-
onDeploymentChange:
|
|
3016
|
-
modelSelectorLabels:
|
|
3017
|
-
menuStyles:
|
|
3018
|
-
nameClassName:
|
|
3019
|
-
versionClassName:
|
|
3179
|
+
!Kn && qn,
|
|
3180
|
+
!Kn && Jn,
|
|
3181
|
+
/* @__PURE__ */ H("div", {
|
|
3182
|
+
className: l("ms-auto flex shrink-0 items-center gap-2", Y.footerActions),
|
|
3183
|
+
children: Se ? Se({
|
|
3184
|
+
canSend: En,
|
|
3185
|
+
onSend: jn
|
|
3186
|
+
}) : /* @__PURE__ */ U(le, { children: [
|
|
3187
|
+
_t,
|
|
3188
|
+
/* @__PURE__ */ H(Un, {
|
|
3189
|
+
deployments: de,
|
|
3190
|
+
selectedDeploymentId: fe,
|
|
3191
|
+
onDeploymentChange: pe,
|
|
3192
|
+
modelSelectorLabels: me,
|
|
3193
|
+
menuStyles: te,
|
|
3194
|
+
nameClassName: B?.modelSelectorNameClassName,
|
|
3195
|
+
versionClassName: B?.modelSelectorVersionClassName,
|
|
3020
3196
|
isStreaming: s,
|
|
3021
|
-
isMobile:
|
|
3022
|
-
isDisabled:
|
|
3023
|
-
style:
|
|
3024
|
-
modelPickerOverlay:
|
|
3025
|
-
isPickerOpen:
|
|
3026
|
-
onPickerToggle: () =>
|
|
3027
|
-
onPickerOpenChange:
|
|
3197
|
+
isMobile: Dt,
|
|
3198
|
+
isDisabled: we,
|
|
3199
|
+
style: Pt,
|
|
3200
|
+
modelPickerOverlay: ut,
|
|
3201
|
+
isPickerOpen: Ot,
|
|
3202
|
+
onPickerToggle: () => At(!Ot),
|
|
3203
|
+
onPickerOpenChange: At
|
|
3028
3204
|
}),
|
|
3029
|
-
|
|
3030
|
-
icon: /* @__PURE__ */
|
|
3205
|
+
An && /* @__PURE__ */ H(w, {
|
|
3206
|
+
icon: /* @__PURE__ */ H(ye, {
|
|
3031
3207
|
size: v.LG,
|
|
3032
3208
|
stroke: y,
|
|
3033
3209
|
"aria-hidden": !0
|
|
3034
3210
|
}),
|
|
3035
|
-
"aria-label":
|
|
3036
|
-
tooltipProps: { tooltip:
|
|
3211
|
+
"aria-label": F,
|
|
3212
|
+
tooltipProps: { tooltip: F },
|
|
3037
3213
|
className: "shrink-0",
|
|
3038
|
-
onClick: () =>
|
|
3039
|
-
disabled:
|
|
3214
|
+
onClick: () => _n(Ke.Dictation),
|
|
3215
|
+
disabled: Ce || s
|
|
3040
3216
|
}),
|
|
3041
|
-
s && o ? /* @__PURE__ */
|
|
3217
|
+
s && o ? /* @__PURE__ */ H(lt, {
|
|
3042
3218
|
onStop: o,
|
|
3043
|
-
ariaLabel:
|
|
3044
|
-
}) : !s && /* @__PURE__ */
|
|
3045
|
-
onSend:
|
|
3046
|
-
isDisabled: !
|
|
3047
|
-
ariaLabel:
|
|
3048
|
-
sendTooltip:
|
|
3219
|
+
ariaLabel: ee
|
|
3220
|
+
}) : !s && /* @__PURE__ */ H(ct, {
|
|
3221
|
+
onSend: jn,
|
|
3222
|
+
isDisabled: !kn || !En,
|
|
3223
|
+
ariaLabel: M,
|
|
3224
|
+
sendTooltip: Tn ? N : P ?? N
|
|
3049
3225
|
})
|
|
3050
3226
|
] })
|
|
3051
3227
|
})
|
|
3052
3228
|
]
|
|
3053
3229
|
}),
|
|
3054
|
-
/* @__PURE__ */
|
|
3230
|
+
/* @__PURE__ */ H(E, {
|
|
3055
3231
|
visuallyHidden: !0,
|
|
3056
3232
|
atomic: !0,
|
|
3057
3233
|
as: D.Span,
|
|
3058
|
-
children: /* @__PURE__ */
|
|
3234
|
+
children: /* @__PURE__ */ H("span", { children: xn.text }, xn.revision)
|
|
3059
3235
|
})
|
|
3060
3236
|
]
|
|
3061
3237
|
});
|
|
3062
3238
|
});
|
|
3063
|
-
|
|
3064
|
-
var
|
|
3239
|
+
Wn.displayName = "Input";
|
|
3240
|
+
var Gn = {
|
|
3065
3241
|
welcome: "_welcome_1icyo_1",
|
|
3066
3242
|
description: "_description_1icyo_5"
|
|
3067
|
-
},
|
|
3243
|
+
}, Kn = ({ isStreaming: e = !1, placeholder: t = "Type a prompt or use \"/\" to select one", welcomeText: n, descriptionText: r, belowWelcomeSlot: i, aboveInputSlot: a, styles: o, className: s, inputClassName: u, isInputDisabled: d = !1, ...f }) => {
|
|
3068
3244
|
let { colors: p, typography: m, attachmentTray: h, modelMenu: g } = o ?? {}, _ = c({
|
|
3069
3245
|
"--ci-welcome-color": p?.welcomeText,
|
|
3070
3246
|
"--ci-description-color": p?.descriptionText
|
|
3071
3247
|
});
|
|
3072
|
-
return /* @__PURE__ */
|
|
3248
|
+
return /* @__PURE__ */ U("div", {
|
|
3073
3249
|
style: _,
|
|
3074
3250
|
className: l("relative flex w-full flex-col items-center gap-9 px-4 py-5 desktop:p-5", s),
|
|
3075
3251
|
children: [
|
|
3076
|
-
n && /* @__PURE__ */
|
|
3252
|
+
n && /* @__PURE__ */ U("div", {
|
|
3077
3253
|
className: "flex max-w-full flex-col items-center gap-4 text-center",
|
|
3078
|
-
children: [/* @__PURE__ */
|
|
3079
|
-
className: l(
|
|
3254
|
+
children: [/* @__PURE__ */ H("h1", {
|
|
3255
|
+
className: l(Gn.welcome, "m-0 max-w-full wrap-anywhere", m?.welcomeClassName || "dial-display2-text"),
|
|
3080
3256
|
children: n
|
|
3081
|
-
}), r && /* @__PURE__ */
|
|
3082
|
-
className: l(
|
|
3257
|
+
}), r && /* @__PURE__ */ H("p", {
|
|
3258
|
+
className: l(Gn.description, "m-0 max-w-[540px]", m?.descriptionClassName || "dial-body-paragraph-text"),
|
|
3083
3259
|
children: r
|
|
3084
3260
|
})]
|
|
3085
3261
|
}),
|
|
3086
|
-
i != null && /* @__PURE__ */
|
|
3262
|
+
i != null && /* @__PURE__ */ H("div", {
|
|
3087
3263
|
className: "flex w-full max-w-[700px] flex-col items-center empty:hidden",
|
|
3088
3264
|
children: i
|
|
3089
3265
|
}),
|
|
3090
|
-
/* @__PURE__ */
|
|
3266
|
+
/* @__PURE__ */ U("div", {
|
|
3091
3267
|
className: l("relative w-full", n ? "max-w-[700px]" : "max-w-[748px]"),
|
|
3092
|
-
children: [a != null && /* @__PURE__ */
|
|
3268
|
+
children: [a != null && /* @__PURE__ */ H("div", {
|
|
3093
3269
|
className: "mb-2",
|
|
3094
3270
|
children: a
|
|
3095
|
-
}), /* @__PURE__ */
|
|
3271
|
+
}), /* @__PURE__ */ H(Wn, {
|
|
3096
3272
|
placeholder: t,
|
|
3097
3273
|
isStreaming: e,
|
|
3098
3274
|
isInputDisabled: d,
|
|
@@ -3106,36 +3282,36 @@ var Fn = {
|
|
|
3106
3282
|
})
|
|
3107
3283
|
]
|
|
3108
3284
|
});
|
|
3109
|
-
},
|
|
3110
|
-
let
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
}, [
|
|
3114
|
-
let [
|
|
3115
|
-
|
|
3116
|
-
},
|
|
3117
|
-
m(e,
|
|
3118
|
-
}, [
|
|
3119
|
-
|
|
3120
|
-
},
|
|
3121
|
-
|
|
3122
|
-
}, [n]),
|
|
3285
|
+
}, qn = ({ message: e, messageRevision: t, onChange: n, activeMentions: r, onBackspaceAtCaret: i, caretPositionOverride: o, commandMenu: s, menuOverlays: c, sendOnEnter: u, initialAttachments: d = [], onCancel: f, onSave: m, onUploadAttachment: h, cancelLabel: g = "Cancel", saveLabel: _ = "Save & Submit", ariaLabel: v, removeLabel: b, retryLabel: x, uploadingLabel: S, expandLabel: C, clickLabel: w, addMenuTitle: T = "Add", attachLabel: E = "Attach file", menuTitle: D = "Menu", menuCloseLabel: O = "Close", className: k, pendingDropFiles: A, onDropFilesConsumed: M, validateAttachment: N, isAttachmentsEnabled: P, isTextAttachmentsAllowed: ee, hideAttachFile: F = !1, fileAccept: I, maximumAttachmentsAmount: R, onAttachmentsLimitExceeded: z, onDialFileSystemClick: B, dialFileSystemLabel: V, pendingAttachments: te, onPendingAttachmentsConsumed: ne, onAttachmentClick: re, pasteTextThreshold: ie, maxMessageLength: ae = 5e4, onMessageTooLong: oe }) => {
|
|
3286
|
+
let se = q(null), ce = q(null), [le, ue] = J([]);
|
|
3287
|
+
G(() => {
|
|
3288
|
+
A?.length && (ue(A), M?.());
|
|
3289
|
+
}, [A, M]);
|
|
3290
|
+
let [de, fe] = J(e ?? ""), [pe, me] = J([]), [he, ge] = J(d), _e = pe.some((e) => e.status === a.Loading || e.status === a.Error), ye = (de.trim().length > 0 || pe.length > 0 || he.length > 0) && !_e, be = (e) => {
|
|
3291
|
+
ge((t) => t.filter((t) => t.id !== e));
|
|
3292
|
+
}, xe = W((e, t) => {
|
|
3293
|
+
m(e, he, t);
|
|
3294
|
+
}, [he, m]), Se = () => {
|
|
3295
|
+
ye && (de.length >= ae ? oe?.(de.length, ae) : xe(de, pe));
|
|
3296
|
+
}, Ce = W(() => ue([]), []), we = W((e) => {
|
|
3297
|
+
fe(e), n?.(e);
|
|
3298
|
+
}, [n]), Te = W((e) => {
|
|
3123
3299
|
let t = Array.from(e.target.files ?? []);
|
|
3124
|
-
t.length !== 0 && (e.target.value = "",
|
|
3125
|
-
}, []),
|
|
3300
|
+
t.length !== 0 && (e.target.value = "", ue(t));
|
|
3301
|
+
}, []), Ee = K(() => B ? [{
|
|
3126
3302
|
key: "dial-fs",
|
|
3127
|
-
label:
|
|
3128
|
-
icon: /* @__PURE__ */
|
|
3303
|
+
label: V ?? "DIAL file system",
|
|
3304
|
+
icon: /* @__PURE__ */ H(ve, {
|
|
3129
3305
|
size: p,
|
|
3130
3306
|
"aria-hidden": !0,
|
|
3131
3307
|
stroke: y
|
|
3132
3308
|
}),
|
|
3133
|
-
onClick:
|
|
3134
|
-
}] : [], [
|
|
3135
|
-
return /* @__PURE__ */
|
|
3309
|
+
onClick: B
|
|
3310
|
+
}] : [], [B, V]);
|
|
3311
|
+
return /* @__PURE__ */ U("div", {
|
|
3136
3312
|
className: l("flex w-full flex-col gap-2", k),
|
|
3137
|
-
children: [/* @__PURE__ */
|
|
3138
|
-
ref:
|
|
3313
|
+
children: [/* @__PURE__ */ H(Wn, {
|
|
3314
|
+
ref: ce,
|
|
3139
3315
|
message: e,
|
|
3140
3316
|
messageRevision: t,
|
|
3141
3317
|
activeMentions: r,
|
|
@@ -3145,108 +3321,108 @@ var Fn = {
|
|
|
3145
3321
|
ariaLabel: v,
|
|
3146
3322
|
hideActionBar: !0,
|
|
3147
3323
|
sendOnEnter: u,
|
|
3148
|
-
pendingDropFiles:
|
|
3149
|
-
onDropFilesConsumed:
|
|
3150
|
-
onSend:
|
|
3324
|
+
pendingDropFiles: le,
|
|
3325
|
+
onDropFilesConsumed: Ce,
|
|
3326
|
+
onSend: xe,
|
|
3151
3327
|
onUploadAttachment: h,
|
|
3152
|
-
onChange:
|
|
3153
|
-
onAttachmentsChange:
|
|
3328
|
+
onChange: we,
|
|
3329
|
+
onAttachmentsChange: me,
|
|
3154
3330
|
removeLabel: b,
|
|
3155
3331
|
retryLabel: x,
|
|
3156
3332
|
uploadingLabel: S,
|
|
3157
3333
|
expandLabel: C,
|
|
3158
3334
|
clickLabel: w,
|
|
3159
3335
|
className: "max-w-full",
|
|
3160
|
-
prefixAttachments:
|
|
3161
|
-
onRemovePrefixAttachment:
|
|
3162
|
-
validateAttachment:
|
|
3163
|
-
isAttachmentsEnabled:
|
|
3164
|
-
isTextAttachmentsAllowed:
|
|
3165
|
-
maximumAttachmentsAmount:
|
|
3166
|
-
onAttachmentsLimitExceeded:
|
|
3167
|
-
pendingAttachments:
|
|
3168
|
-
onPendingAttachmentsConsumed:
|
|
3169
|
-
onAttachmentClick:
|
|
3170
|
-
pasteTextThreshold:
|
|
3171
|
-
maxMessageLength:
|
|
3172
|
-
onMessageTooLong:
|
|
3173
|
-
}), /* @__PURE__ */
|
|
3336
|
+
prefixAttachments: he,
|
|
3337
|
+
onRemovePrefixAttachment: be,
|
|
3338
|
+
validateAttachment: N,
|
|
3339
|
+
isAttachmentsEnabled: P,
|
|
3340
|
+
isTextAttachmentsAllowed: ee,
|
|
3341
|
+
maximumAttachmentsAmount: R,
|
|
3342
|
+
onAttachmentsLimitExceeded: z,
|
|
3343
|
+
pendingAttachments: te,
|
|
3344
|
+
onPendingAttachmentsConsumed: ne,
|
|
3345
|
+
onAttachmentClick: re,
|
|
3346
|
+
pasteTextThreshold: ie,
|
|
3347
|
+
maxMessageLength: ae,
|
|
3348
|
+
onMessageTooLong: oe
|
|
3349
|
+
}), /* @__PURE__ */ U("div", {
|
|
3174
3350
|
className: "flex items-center justify-between",
|
|
3175
|
-
children: [/* @__PURE__ */
|
|
3351
|
+
children: [/* @__PURE__ */ U("div", {
|
|
3176
3352
|
className: "flex",
|
|
3177
|
-
children: [!
|
|
3178
|
-
ref:
|
|
3353
|
+
children: [!F && /* @__PURE__ */ H("input", {
|
|
3354
|
+
ref: se,
|
|
3179
3355
|
type: "file",
|
|
3180
3356
|
multiple: !0,
|
|
3181
|
-
accept:
|
|
3357
|
+
accept: I,
|
|
3182
3358
|
className: "sr-only",
|
|
3183
3359
|
"aria-hidden": !0,
|
|
3184
3360
|
tabIndex: -1,
|
|
3185
|
-
onChange:
|
|
3186
|
-
}), (!
|
|
3187
|
-
onAttachClick:
|
|
3361
|
+
onChange: Te
|
|
3362
|
+
}), (!F || (c?.length ?? 0) > 0) && /* @__PURE__ */ H(It, {
|
|
3363
|
+
onAttachClick: F ? void 0 : () => se.current?.click(),
|
|
3188
3364
|
attachLabel: E,
|
|
3189
3365
|
addMenuTitle: T,
|
|
3190
3366
|
menuTitle: D,
|
|
3191
3367
|
menuCloseLabel: O,
|
|
3192
|
-
extraMenuItems:
|
|
3368
|
+
extraMenuItems: Ee,
|
|
3193
3369
|
menuOverlays: c,
|
|
3194
|
-
getCaretPosition: () =>
|
|
3370
|
+
getCaretPosition: () => ce.current?.getCaretPosition() ?? 0
|
|
3195
3371
|
})]
|
|
3196
|
-
}), /* @__PURE__ */
|
|
3372
|
+
}), /* @__PURE__ */ U("div", {
|
|
3197
3373
|
className: "flex gap-2",
|
|
3198
|
-
children: [/* @__PURE__ */
|
|
3374
|
+
children: [/* @__PURE__ */ H(j, {
|
|
3199
3375
|
label: g,
|
|
3200
3376
|
onClick: f
|
|
3201
|
-
}), /* @__PURE__ */
|
|
3377
|
+
}), /* @__PURE__ */ H(L, {
|
|
3202
3378
|
label: _,
|
|
3203
|
-
onClick:
|
|
3204
|
-
disabled: !
|
|
3379
|
+
onClick: Se,
|
|
3380
|
+
disabled: !ye
|
|
3205
3381
|
})]
|
|
3206
3382
|
})]
|
|
3207
3383
|
})]
|
|
3208
3384
|
});
|
|
3209
|
-
},
|
|
3385
|
+
}, Jn = /* @__PURE__ */ function(e) {
|
|
3210
3386
|
return e.Warning = "warning", e.Reached = "reached", e;
|
|
3211
|
-
}({}),
|
|
3212
|
-
[
|
|
3213
|
-
[
|
|
3214
|
-
},
|
|
3215
|
-
let f = /* @__PURE__ */
|
|
3387
|
+
}({}), Yn = { banner: "_banner_180n6_2" }, Xn = {
|
|
3388
|
+
[Jn.Warning]: ee.Warning,
|
|
3389
|
+
[Jn.Reached]: ee.Error
|
|
3390
|
+
}, Zn = ({ severity: e, limitText: t, reset: n, onClose: r, closeAriaLabel: i = "Close notification", limitTextClassName: a = "dial-small-paragraph-semi-text", resetTextClassName: o = "dial-small-paragraph-text", isLiveRegion: s = !0, className: u, colors: d }) => {
|
|
3391
|
+
let f = /* @__PURE__ */ H("span", {
|
|
3216
3392
|
className: a,
|
|
3217
3393
|
children: t
|
|
3218
|
-
}), p = n != null && /* @__PURE__ */
|
|
3394
|
+
}), p = n != null && /* @__PURE__ */ U(le, { children: [
|
|
3219
3395
|
" ",
|
|
3220
|
-
/* @__PURE__ */
|
|
3396
|
+
/* @__PURE__ */ H("time", {
|
|
3221
3397
|
dateTime: n.isoValue,
|
|
3222
3398
|
"aria-hidden": n.ariaLabel != null || void 0,
|
|
3223
3399
|
className: o,
|
|
3224
3400
|
children: n.label
|
|
3225
3401
|
}),
|
|
3226
|
-
n.ariaLabel != null && /* @__PURE__ */
|
|
3402
|
+
n.ariaLabel != null && /* @__PURE__ */ H("span", {
|
|
3227
3403
|
className: "sr-only",
|
|
3228
3404
|
children: n.ariaLabel
|
|
3229
3405
|
})
|
|
3230
3406
|
] });
|
|
3231
|
-
return /* @__PURE__ */
|
|
3407
|
+
return /* @__PURE__ */ H(N, {
|
|
3232
3408
|
role: s ? "status" : "none",
|
|
3233
|
-
variant:
|
|
3234
|
-
type:
|
|
3409
|
+
variant: Xn[e],
|
|
3410
|
+
type: P.SectionMessage,
|
|
3235
3411
|
title: p ? f : void 0,
|
|
3236
3412
|
message: p || f,
|
|
3237
|
-
className: l(
|
|
3413
|
+
className: l(Yn.banner, Y.usageBanner, u),
|
|
3238
3414
|
style: c({ "--ci-usage-banner-bg": d?.background }),
|
|
3239
|
-
children: r != null && /* @__PURE__ */
|
|
3415
|
+
children: r != null && /* @__PURE__ */ H(_, {
|
|
3240
3416
|
className: "shrink-0 self-start",
|
|
3241
3417
|
ariaLabel: i,
|
|
3242
3418
|
onClose: () => r()
|
|
3243
3419
|
})
|
|
3244
3420
|
});
|
|
3245
|
-
},
|
|
3246
|
-
let [t, n] =
|
|
3421
|
+
}, Qn = (e) => {
|
|
3422
|
+
let [t, n] = J({
|
|
3247
3423
|
text: e?.text,
|
|
3248
3424
|
revision: e?.revision ?? 0
|
|
3249
|
-
}), r =
|
|
3425
|
+
}), r = W((e) => {
|
|
3250
3426
|
n((t) => ({
|
|
3251
3427
|
text: e,
|
|
3252
3428
|
revision: t.revision + 1
|
|
@@ -3257,11 +3433,11 @@ var Fn = {
|
|
|
3257
3433
|
messageRevision: t.revision,
|
|
3258
3434
|
seedMessage: r
|
|
3259
3435
|
};
|
|
3260
|
-
},
|
|
3261
|
-
let n =
|
|
3262
|
-
r.current = t,
|
|
3436
|
+
}, $n = (e, t) => {
|
|
3437
|
+
let n = q(e), r = q(t);
|
|
3438
|
+
r.current = t, G(() => {
|
|
3263
3439
|
e !== n.current && (n.current = e, r.current());
|
|
3264
3440
|
}, [e]);
|
|
3265
3441
|
};
|
|
3266
3442
|
//#endregion
|
|
3267
|
-
export {
|
|
3443
|
+
export { $e as ActionRowLayout, Fe as BottomSheetShell, Y as CONVERSATION_INPUT_CLASS, Pt as ChatSettingsModal, Kn as ConversationInput, qn as EditMessageInput, Wn as Input, Qe as SendOnEnter, Jn as UsageLimitBannerSeverity, Zn as UsageLimitBannerView, Qn as useComposerSeed, $n as useComposerSeedSource };
|