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