@epam/ai-dial-conversation-input 1.1.0-dev.58 → 1.1.0-dev.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/AddAttachmentButton/AddAttachmentButton.d.ts +9 -0
- package/components/AddAttachmentButton/AddAttachmentButton.d.ts.map +1 -1
- package/components/Input/Input.d.ts.map +1 -1
- package/components/SelectedToolsChips/SelectedToolsChips.d.ts +18 -0
- package/components/SelectedToolsChips/SelectedToolsChips.d.ts.map +1 -0
- package/components/ToolsBottomSheet/ToolsBottomSheet.d.ts +29 -0
- package/components/ToolsBottomSheet/ToolsBottomSheet.d.ts.map +1 -0
- package/index.css +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +592 -435
- package/models/ConversationInput.d.ts +12 -2
- package/models/ConversationInput.d.ts.map +1 -1
- package/models/Input.d.ts +18 -1
- package/models/Input.d.ts.map +1 -1
- package/package.json +4 -4
package/index.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
import { AttachmentErrorReason as e, AttachmentType as t, DeploymentIcon as n, RequestStatus as r, ResponseFormat as i, buildCssVars as a, mergeClasses as o, useIsMobile as s } from "@epam/ai-dial-chat-shared";
|
|
2
|
-
import { BASE_ICON_SIZE as c, ButtonAppearance as l, ButtonVariant as u, DIAL_ICON_SIZE as d, DialButton as f, DialCloseButton as p, DialDropdown as m, DialDropdownIcon as h, DialErrorText as g, DialGhostIconButton as _, DialInput as v, DialPopup as y, DialPrimaryButton as b, DialRadioGroup as x, DialSearch as S, DialSkeleton as C, DialSkeletonVariant as w, DialSlider as T, DialTag as E, DialTooltip as D, ElementSize as O, Highlight as k, PopupSize as
|
|
3
|
-
import { IconArrowLeft as te, IconArrowNarrowRight as ne, IconCheck as re, IconChevronDown as ie, IconChevronRight as ae, IconFile as oe, IconMicrophone as se, IconPaperclip as j, IconPlayerStopFilled as ce, IconPlaystationSquare as le, IconPlus as ue, IconSettings as de,
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { createElement as
|
|
6
|
-
import { Fragment as
|
|
7
|
-
import { AttachmentCard as _e, AttachmentGroup as ve, AttachmentTray as ye, AttachmentTray as be, FileDndOverlay as
|
|
2
|
+
import { BASE_ICON_SIZE as c, ButtonAppearance as l, ButtonVariant as u, DIAL_ICON_SIZE as d, DialButton as f, DialCloseButton as p, DialDropdown as m, DialDropdownIcon as h, DialErrorText as g, DialGhostIconButton as _, DialInput as v, DialPopup as y, DialPrimaryButton as b, DialRadioGroup as x, DialSearch as S, DialSkeleton as C, DialSkeletonVariant as w, DialSlider as T, DialTag as E, DialTooltip as D, ElementSize as O, Highlight as k, PopupSize as A, RadioGroupOrientation as ee } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { IconArrowLeft as te, IconArrowNarrowRight as ne, IconCheck as re, IconChevronDown as ie, IconChevronRight as ae, IconFile as oe, IconMicrophone as se, IconPaperclip as j, IconPlayerStopFilled as ce, IconPlaystationSquare as le, IconPlus as ue, IconSettings as de, IconTool as fe, IconX as pe } from "@tabler/icons-react";
|
|
4
|
+
import { createPortal as me } from "react-dom";
|
|
5
|
+
import { createElement as he, memo as M, useCallback as N, useEffect as P, useImperativeHandle as ge, useLayoutEffect as F, useMemo as I, useRef as L, useState as R } from "react";
|
|
6
|
+
import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
|
|
7
|
+
import { AttachmentCard as _e, AttachmentGroup as ve, AttachmentTray as ye, AttachmentTray as be, FileDndOverlay as xe, MAX_UPLOADS_PER_MINUTE as Se, generateAttachmentId as Ce, getAttachmentIcon as we, useClipboardPaste as Te } from "@epam/ai-dial-attachment-input";
|
|
8
8
|
//#region src/hooks/useBottomSheet.ts
|
|
9
|
-
var
|
|
10
|
-
|
|
9
|
+
var Ee = (e, t) => {
|
|
10
|
+
P(() => {
|
|
11
11
|
if (!e) return;
|
|
12
12
|
let n = (e) => {
|
|
13
13
|
e.key === "Escape" && t();
|
|
14
14
|
};
|
|
15
15
|
return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
|
|
16
|
-
}, [e, t]),
|
|
16
|
+
}, [e, t]), P(() => {
|
|
17
17
|
if (e) return document.body.style.overflow = "hidden", () => {
|
|
18
18
|
document.body.style.overflow = "";
|
|
19
19
|
};
|
|
20
20
|
}, [e]);
|
|
21
|
-
},
|
|
21
|
+
}, De = {
|
|
22
22
|
backdrop: "_backdrop_3xrn0_9",
|
|
23
23
|
sheet: "_sheet_3xrn0_13",
|
|
24
24
|
"slide-up": "_slide-up_3xrn0_1",
|
|
25
25
|
title: "_title_3xrn0_18",
|
|
26
26
|
divider: "_divider_3xrn0_22"
|
|
27
|
-
},
|
|
28
|
-
className: o(
|
|
27
|
+
}, H = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: a, "aria-label": s, style: c, titleClassName: l = "dial-body-semi-text", className: u, children: f }) => (Ee(e, r), !e || typeof document > "u" ? null : me(/* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("div", {
|
|
28
|
+
className: o(De.backdrop, "fixed inset-0 z-[55]"),
|
|
29
29
|
onPointerDown: r,
|
|
30
30
|
"aria-hidden": !0
|
|
31
|
-
}), /* @__PURE__ */
|
|
31
|
+
}), /* @__PURE__ */ V("div", {
|
|
32
32
|
role: "dialog",
|
|
33
33
|
"aria-modal": !0,
|
|
34
34
|
"aria-label": t ?? s,
|
|
35
35
|
style: c,
|
|
36
|
-
className: o(
|
|
37
|
-
children: [t != null && /* @__PURE__ */
|
|
36
|
+
className: o(De.sheet, "fixed inset-x-0 bottom-0 z-[60] flex max-h-[85dvh] flex-col", u),
|
|
37
|
+
children: [t != null && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ V("div", {
|
|
38
38
|
className: "relative flex h-[60px] flex-shrink-0 items-center justify-center px-4",
|
|
39
39
|
children: [
|
|
40
|
-
i && /* @__PURE__ */
|
|
40
|
+
i && /* @__PURE__ */ B("div", {
|
|
41
41
|
className: "absolute start-4",
|
|
42
|
-
children: /* @__PURE__ */
|
|
43
|
-
icon: /* @__PURE__ */
|
|
42
|
+
children: /* @__PURE__ */ B(_, {
|
|
43
|
+
icon: /* @__PURE__ */ B(te, {
|
|
44
44
|
size: d.LG,
|
|
45
45
|
stroke: 1.5,
|
|
46
46
|
className: "rtl:scale-x-[-1]"
|
|
@@ -49,40 +49,40 @@ var Te = (e, t) => {
|
|
|
49
49
|
onClick: i
|
|
50
50
|
})
|
|
51
51
|
}),
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
className: o(
|
|
52
|
+
/* @__PURE__ */ B("span", {
|
|
53
|
+
className: o(De.title, l),
|
|
54
54
|
children: t
|
|
55
55
|
}),
|
|
56
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ B("div", {
|
|
57
57
|
className: "absolute end-4 m-2",
|
|
58
|
-
children: /* @__PURE__ */
|
|
58
|
+
children: /* @__PURE__ */ B(p, {
|
|
59
59
|
ariaLabel: n,
|
|
60
60
|
size: d.LG,
|
|
61
61
|
onClose: r
|
|
62
62
|
})
|
|
63
63
|
})
|
|
64
64
|
]
|
|
65
|
-
}), /* @__PURE__ */
|
|
65
|
+
}), /* @__PURE__ */ B("div", { className: "h-px flex-shrink-0" })] }), /* @__PURE__ */ B("div", {
|
|
66
66
|
className: "overflow-y-auto",
|
|
67
67
|
children: f
|
|
68
68
|
})]
|
|
69
|
-
})] }), document.body)),
|
|
69
|
+
})] }), document.body)), Oe = async (e, t, n) => {
|
|
70
70
|
let r = 6e4 / t, i = [];
|
|
71
71
|
for (let t = 0; t < e.length; t++) t > 0 && await new Promise((e) => setTimeout(e, r)), i.push(n(e[t]));
|
|
72
72
|
await Promise.allSettled(i);
|
|
73
|
-
},
|
|
74
|
-
let [h, g] =
|
|
75
|
-
|
|
73
|
+
}, ke = ({ initialAttachments: n, onUploadAttachment: i, onAttachmentsChange: a, validateAttachment: o, pendingDropFiles: s, onDropFilesConsumed: c, pendingAttachments: l, onPendingAttachmentsConsumed: u, onExpandPastedText: d, maximumAttachmentsAmount: f, baseAttachmentsAmount: p = 0, onAttachmentsLimitExceeded: m }) => {
|
|
74
|
+
let [h, g] = R(n), _ = L(h);
|
|
75
|
+
P(() => {
|
|
76
76
|
_.current = h;
|
|
77
|
-
}, [h]),
|
|
77
|
+
}, [h]), P(() => () => {
|
|
78
78
|
_.current.forEach((e) => {
|
|
79
79
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
80
80
|
});
|
|
81
81
|
}, []);
|
|
82
|
-
let v =
|
|
82
|
+
let v = N((e) => e.map((e) => {
|
|
83
83
|
let n = e.type.startsWith("image/"), i = e.type.startsWith("audio/"), a = n ? URL.createObjectURL(e) : void 0, o = i ? URL.createObjectURL(e) : void 0;
|
|
84
84
|
return {
|
|
85
|
-
id:
|
|
85
|
+
id: Ce(),
|
|
86
86
|
name: e.name,
|
|
87
87
|
contentType: e.type,
|
|
88
88
|
file: e,
|
|
@@ -91,14 +91,14 @@ var Te = (e, t) => {
|
|
|
91
91
|
previewUrl: a,
|
|
92
92
|
playUrl: o
|
|
93
93
|
};
|
|
94
|
-
}), []), y =
|
|
94
|
+
}), []), y = N((e) => {
|
|
95
95
|
g((t) => {
|
|
96
96
|
let n = e(t);
|
|
97
97
|
return n !== t && a?.(n), n;
|
|
98
98
|
});
|
|
99
|
-
}, [a]), b =
|
|
99
|
+
}, [a]), b = N((e) => {
|
|
100
100
|
g(e), a?.(e);
|
|
101
|
-
}, [a]), x =
|
|
101
|
+
}, [a]), x = N(async (t) => {
|
|
102
102
|
if (i) {
|
|
103
103
|
y((e) => e.map((e) => e.id === t.id ? {
|
|
104
104
|
...e,
|
|
@@ -120,7 +120,7 @@ var Te = (e, t) => {
|
|
|
120
120
|
} : e));
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
}, [i, y]), S =
|
|
123
|
+
}, [i, y]), S = N((e, t = !0) => {
|
|
124
124
|
let n = new Set(_.current.map((e) => e.id)), i = e.filter((e) => !n.has(e.id));
|
|
125
125
|
if (i.length !== 0) {
|
|
126
126
|
if (f != null && f > 0 && Number.isFinite(f)) {
|
|
@@ -141,7 +141,7 @@ var Te = (e, t) => {
|
|
|
141
141
|
status: r.Error,
|
|
142
142
|
errorReason: n
|
|
143
143
|
} : e));
|
|
144
|
-
}),
|
|
144
|
+
}), Oe(e, Se, x);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
}, [
|
|
@@ -152,20 +152,20 @@ var Te = (e, t) => {
|
|
|
152
152
|
x,
|
|
153
153
|
o
|
|
154
154
|
]);
|
|
155
|
-
|
|
155
|
+
P(() => {
|
|
156
156
|
s.length !== 0 && (S(v(s)), c?.());
|
|
157
157
|
}, [
|
|
158
158
|
S,
|
|
159
159
|
v,
|
|
160
160
|
c,
|
|
161
161
|
s
|
|
162
|
-
]),
|
|
162
|
+
]), P(() => {
|
|
163
163
|
l.length !== 0 && (S(l, !1), u?.());
|
|
164
164
|
}, [
|
|
165
165
|
S,
|
|
166
166
|
u,
|
|
167
167
|
l
|
|
168
|
-
]),
|
|
168
|
+
]), P(() => {
|
|
169
169
|
if (!o) return;
|
|
170
170
|
let t = !1, n = [], i = _.current.map((i) => {
|
|
171
171
|
if (i.status === r.Loading) return i;
|
|
@@ -192,7 +192,7 @@ var Te = (e, t) => {
|
|
|
192
192
|
y,
|
|
193
193
|
x
|
|
194
194
|
]);
|
|
195
|
-
let C =
|
|
195
|
+
let C = N((e) => {
|
|
196
196
|
y((t) => {
|
|
197
197
|
let n = t.find((t) => t.id === e);
|
|
198
198
|
return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), n?.playUrl && URL.revokeObjectURL(n.playUrl), t.filter((t) => t.id !== e);
|
|
@@ -204,11 +204,11 @@ var Te = (e, t) => {
|
|
|
204
204
|
addAttachments: S,
|
|
205
205
|
resetAttachments: b,
|
|
206
206
|
handleRemove: C,
|
|
207
|
-
handleRetry:
|
|
207
|
+
handleRetry: N((e) => {
|
|
208
208
|
let t = h.find((t) => t.id === e);
|
|
209
209
|
t && x(t);
|
|
210
210
|
}, [h, x]),
|
|
211
|
-
handleExpand:
|
|
211
|
+
handleExpand: N(async (e) => {
|
|
212
212
|
let n = h.find((t) => t.id === e);
|
|
213
213
|
if (!n || n.type !== t.Pasted) return;
|
|
214
214
|
let r = await n.file.text();
|
|
@@ -220,9 +220,9 @@ var Te = (e, t) => {
|
|
|
220
220
|
]),
|
|
221
221
|
hasBlockedAttachments: h.some((e) => e.status === r.Loading || e.status === r.Error)
|
|
222
222
|
};
|
|
223
|
-
},
|
|
224
|
-
let [n, r] =
|
|
225
|
-
return
|
|
223
|
+
}, Ae = (e, t) => {
|
|
224
|
+
let [n, r] = R(e), [i, a] = R(!1), [o, s] = R(0);
|
|
225
|
+
return P(() => {
|
|
226
226
|
if (e) {
|
|
227
227
|
r(!0), a(!1), s((e) => e + 1);
|
|
228
228
|
return;
|
|
@@ -238,18 +238,18 @@ var Te = (e, t) => {
|
|
|
238
238
|
isExiting: i,
|
|
239
239
|
instanceKey: o
|
|
240
240
|
};
|
|
241
|
-
},
|
|
242
|
-
let t =
|
|
241
|
+
}, je = (e, t) => !e.slice(0, t).includes("\n"), Me = (e, t) => !e.slice(t).includes("\n"), Ne = (e) => {
|
|
242
|
+
let t = L(e);
|
|
243
243
|
t.current = e;
|
|
244
|
-
let n =
|
|
244
|
+
let n = L(-1), r = L(""), i = N((e, i, a) => {
|
|
245
245
|
let o = t.current;
|
|
246
|
-
return !o || o.length === 0 ? null : e === "up" ? !
|
|
247
|
-
}, []), a =
|
|
246
|
+
return !o || o.length === 0 ? null : e === "up" ? !je(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 || !Me(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
|
|
247
|
+
}, []), a = N(() => {
|
|
248
248
|
n.current = -1, r.current = "";
|
|
249
|
-
}, []), o =
|
|
249
|
+
}, []), o = N(() => {
|
|
250
250
|
n.current = -1, r.current = "";
|
|
251
251
|
}, []);
|
|
252
|
-
return
|
|
252
|
+
return I(() => ({
|
|
253
253
|
navigate: i,
|
|
254
254
|
notifyChange: a,
|
|
255
255
|
reset: o
|
|
@@ -258,13 +258,13 @@ var Te = (e, t) => {
|
|
|
258
258
|
a,
|
|
259
259
|
o
|
|
260
260
|
]);
|
|
261
|
-
},
|
|
262
|
-
let [n, r] =
|
|
263
|
-
return
|
|
261
|
+
}, Pe = ({ messageProp: e, messageRevision: t }) => {
|
|
262
|
+
let [n, r] = R(e), i = L(null), a = L(0), [o, s] = R(!1);
|
|
263
|
+
return P(() => {
|
|
264
264
|
r(e);
|
|
265
|
-
}, [e, t]),
|
|
265
|
+
}, [e, t]), P(() => {
|
|
266
266
|
i.current && (a.current = i.current.offsetHeight);
|
|
267
|
-
}, []),
|
|
267
|
+
}, []), F(() => {
|
|
268
268
|
if (!i.current || a.current === 0) return;
|
|
269
269
|
let e = i.current.offsetHeight > a.current;
|
|
270
270
|
s((t) => e ? !0 : n === "" ? !1 : t);
|
|
@@ -274,20 +274,20 @@ var Te = (e, t) => {
|
|
|
274
274
|
textareaRef: i,
|
|
275
275
|
isMultiLine: o
|
|
276
276
|
};
|
|
277
|
-
},
|
|
277
|
+
}, Fe = /* @__PURE__ */ function(e) {
|
|
278
278
|
return e.Idle = "idle", e.Recording = "recording", e.Error = "error", e;
|
|
279
|
-
}({}),
|
|
279
|
+
}({}), Ie = [
|
|
280
280
|
"audio/webm;codecs=opus",
|
|
281
281
|
"audio/ogg;codecs=opus",
|
|
282
282
|
"audio/webm"
|
|
283
|
-
],
|
|
284
|
-
let [t, n] =
|
|
283
|
+
], Le = () => Ie.find((e) => MediaRecorder.isTypeSupported(e)) ?? "", Re = ({ onAttachAudio: e }) => {
|
|
284
|
+
let [t, n] = R("idle"), [r, i] = R(null), [a, o] = R(0), s = L(null), c = L(null), l = L(null), u = L(null), d = L([]), f = L(""), p = L(null), m = L(e);
|
|
285
285
|
m.current = e;
|
|
286
|
-
let h =
|
|
286
|
+
let h = N(() => {
|
|
287
287
|
p.current != null && (clearInterval(p.current), p.current = null);
|
|
288
|
-
}, []), g =
|
|
288
|
+
}, []), g = N(() => {
|
|
289
289
|
h(), s.current &&= (s.current.getTracks().forEach((e) => e.stop()), null), c.current &&= (c.current.close(), null), l.current = null, u.current = null;
|
|
290
|
-
}, [h]), _ =
|
|
290
|
+
}, [h]), _ = N(() => {
|
|
291
291
|
(async () => {
|
|
292
292
|
try {
|
|
293
293
|
let e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
@@ -296,7 +296,7 @@ var Te = (e, t) => {
|
|
|
296
296
|
c.current = t;
|
|
297
297
|
let r = t.createAnalyser();
|
|
298
298
|
r.fftSize = 256, l.current = r, t.createMediaStreamSource(e).connect(r);
|
|
299
|
-
let i =
|
|
299
|
+
let i = Le();
|
|
300
300
|
f.current = i, d.current = [];
|
|
301
301
|
let a = new MediaRecorder(e, i ? { mimeType: i } : void 0);
|
|
302
302
|
u.current = a, a.ondataavailable = (e) => {
|
|
@@ -308,17 +308,17 @@ var Te = (e, t) => {
|
|
|
308
308
|
i(e instanceof Error ? e.message : "Microphone access denied"), n("error");
|
|
309
309
|
}
|
|
310
310
|
})();
|
|
311
|
-
}, []), v =
|
|
311
|
+
}, []), v = N(() => {
|
|
312
312
|
let e = u.current;
|
|
313
313
|
!e || e.state !== "recording" || (h(), e.onstop = () => {
|
|
314
314
|
let e = f.current || "audio/webm", t = new Blob(d.current, { type: e }), r = e.split(";")[0], a = r.split("/")[1] ?? "webm", s = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, -1), c = new File([t], `voice-${s}.${a}`, { type: r });
|
|
315
315
|
m.current(c), g(), o(0), i(null), n("idle");
|
|
316
316
|
}, e.stop());
|
|
317
|
-
}, [h, g]), y =
|
|
317
|
+
}, [h, g]), y = N(() => {
|
|
318
318
|
let e = u.current;
|
|
319
319
|
e && e.state === "recording" && (e.ondataavailable = null, e.onstop = null, e.stop()), g(), o(0), i(null), n("idle");
|
|
320
320
|
}, [g]);
|
|
321
|
-
return
|
|
321
|
+
return P(() => () => {
|
|
322
322
|
g();
|
|
323
323
|
}, [g]), {
|
|
324
324
|
state: t,
|
|
@@ -329,16 +329,16 @@ var Te = (e, t) => {
|
|
|
329
329
|
stopRecording: v,
|
|
330
330
|
discardRecording: y
|
|
331
331
|
};
|
|
332
|
-
},
|
|
332
|
+
}, ze = /* @__PURE__ */ function(e) {
|
|
333
333
|
return e.Enter = "enter", e.MetaEnter = "meta-enter", e;
|
|
334
|
-
}({}),
|
|
334
|
+
}({}), Be = {
|
|
335
335
|
item: "_item_vou13_1",
|
|
336
336
|
itemIcon: "_itemIcon_vou13_11"
|
|
337
|
-
},
|
|
337
|
+
}, Ve = ({ isOpen: e, title: t, closeLabel: n, onClose: r, style: i, items: a, className: s, titleClassName: c = "dial-body-semi-text", itemLabelClassName: l = "dial-small-text", btnTextClassName: u = "" }) => {
|
|
338
338
|
let d = (e) => {
|
|
339
339
|
e(), r();
|
|
340
340
|
};
|
|
341
|
-
return /* @__PURE__ */
|
|
341
|
+
return /* @__PURE__ */ B(H, {
|
|
342
342
|
isOpen: e,
|
|
343
343
|
title: t,
|
|
344
344
|
closeLabel: n,
|
|
@@ -346,22 +346,22 @@ var Te = (e, t) => {
|
|
|
346
346
|
style: i,
|
|
347
347
|
className: s,
|
|
348
348
|
titleClassName: c,
|
|
349
|
-
children: /* @__PURE__ */
|
|
349
|
+
children: /* @__PURE__ */ B("ul", {
|
|
350
350
|
role: "list",
|
|
351
351
|
className: "flex flex-col",
|
|
352
|
-
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */
|
|
352
|
+
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(f, {
|
|
353
353
|
type: "button",
|
|
354
|
-
className: o(
|
|
355
|
-
iconBefore: /* @__PURE__ */
|
|
356
|
-
className:
|
|
354
|
+
className: o(Be.item, "flex w-full items-center gap-3 px-4 py-[10px] text-start"),
|
|
355
|
+
iconBefore: /* @__PURE__ */ B("span", {
|
|
356
|
+
className: Be.itemIcon,
|
|
357
357
|
children: n
|
|
358
358
|
}),
|
|
359
|
-
iconAfter: r ? /* @__PURE__ */
|
|
359
|
+
iconAfter: r ? /* @__PURE__ */ B("span", {
|
|
360
360
|
className: "ms-auto",
|
|
361
361
|
children: r
|
|
362
362
|
}) : null,
|
|
363
363
|
textClassName: u,
|
|
364
|
-
label: /* @__PURE__ */
|
|
364
|
+
label: /* @__PURE__ */ B("span", {
|
|
365
365
|
className: l,
|
|
366
366
|
children: t
|
|
367
367
|
}),
|
|
@@ -369,53 +369,53 @@ var Te = (e, t) => {
|
|
|
369
369
|
}) }, e))
|
|
370
370
|
})
|
|
371
371
|
});
|
|
372
|
-
},
|
|
372
|
+
}, He = ({ gradientId: e = "gradient-check-icon" }) => /* @__PURE__ */ V("svg", {
|
|
373
373
|
width: d.SM,
|
|
374
374
|
height: d.SM,
|
|
375
375
|
viewBox: "0 0 24 24",
|
|
376
376
|
fill: "none",
|
|
377
377
|
"aria-hidden": !0,
|
|
378
|
-
children: [/* @__PURE__ */
|
|
378
|
+
children: [/* @__PURE__ */ B("defs", { children: /* @__PURE__ */ V("linearGradient", {
|
|
379
379
|
id: e,
|
|
380
380
|
x1: "0",
|
|
381
381
|
y1: "0",
|
|
382
382
|
x2: "24",
|
|
383
383
|
y2: "24",
|
|
384
384
|
gradientUnits: "userSpaceOnUse",
|
|
385
|
-
children: [/* @__PURE__ */
|
|
385
|
+
children: [/* @__PURE__ */ B("stop", {
|
|
386
386
|
offset: "0%",
|
|
387
387
|
stopColor: "#4b7be6"
|
|
388
|
-
}), /* @__PURE__ */
|
|
388
|
+
}), /* @__PURE__ */ B("stop", {
|
|
389
389
|
offset: "100%",
|
|
390
390
|
stopColor: "#9355f4"
|
|
391
391
|
})]
|
|
392
|
-
}) }), /* @__PURE__ */
|
|
392
|
+
}) }), /* @__PURE__ */ B("path", {
|
|
393
393
|
d: "M5 12l5 5L20 7",
|
|
394
394
|
stroke: `url(#${e})`,
|
|
395
395
|
strokeWidth: "2",
|
|
396
396
|
strokeLinecap: "round",
|
|
397
397
|
strokeLinejoin: "round"
|
|
398
398
|
})]
|
|
399
|
-
}),
|
|
399
|
+
}), Ue = {
|
|
400
400
|
tabContainer: "_tabContainer_rzv03_1",
|
|
401
401
|
tabActive: "_tabActive_rzv03_13"
|
|
402
402
|
};
|
|
403
|
-
|
|
403
|
+
M(({ tabs: e, activeTabId: t, onTabChange: n, styles: r }) => {
|
|
404
404
|
let { tabClassName: i = "dial-tiny-semi-text" } = r?.typography ?? {};
|
|
405
|
-
return /* @__PURE__ */
|
|
405
|
+
return /* @__PURE__ */ B("div", {
|
|
406
406
|
className: "flex flex-nowrap gap-1",
|
|
407
407
|
role: "tablist",
|
|
408
408
|
children: e.map((e) => {
|
|
409
409
|
let r = t === e.id;
|
|
410
|
-
return /* @__PURE__ */
|
|
410
|
+
return /* @__PURE__ */ B("div", {
|
|
411
411
|
role: "tab",
|
|
412
412
|
"aria-selected": r,
|
|
413
413
|
className: "contents",
|
|
414
|
-
children: /* @__PURE__ */
|
|
414
|
+
children: /* @__PURE__ */ B(E, {
|
|
415
415
|
label: e.label,
|
|
416
416
|
selected: r,
|
|
417
417
|
onClick: () => n(e.id),
|
|
418
|
-
className: o("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", i,
|
|
418
|
+
className: o("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", i, Ue.tabContainer, r && Ue.tabActive)
|
|
419
419
|
})
|
|
420
420
|
}, e.id);
|
|
421
421
|
})
|
|
@@ -423,13 +423,13 @@ he(({ tabs: e, activeTabId: t, onTabChange: n, styles: r }) => {
|
|
|
423
423
|
});
|
|
424
424
|
//#endregion
|
|
425
425
|
//#region ../ai-dial-kit/src/components/Button/Buttons.tsx
|
|
426
|
-
var
|
|
426
|
+
var We = (e) => /* @__PURE__ */ B(b, { ...e }), Ge = (e) => /* @__PURE__ */ B(f, {
|
|
427
427
|
...e,
|
|
428
428
|
variant: u.Neutral,
|
|
429
429
|
appearance: l.Outlined
|
|
430
|
-
}),
|
|
431
|
-
let [s, c] =
|
|
432
|
-
|
|
430
|
+
}), Ke = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
431
|
+
let [s, c] = R(t), [l, u] = R(n), [d, f] = R(r), p = L(o);
|
|
432
|
+
P(() => {
|
|
433
433
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
434
434
|
}, [
|
|
435
435
|
o,
|
|
@@ -446,7 +446,7 @@ var W = (e) => /* @__PURE__ */ z(b, { ...e }), He = (e) => /* @__PURE__ */ z(f,
|
|
|
446
446
|
setResponseFormat: c,
|
|
447
447
|
setSystemPrompt: u,
|
|
448
448
|
setTemperature: f,
|
|
449
|
-
handleSubmit:
|
|
449
|
+
handleSubmit: N(() => {
|
|
450
450
|
if (!m) return;
|
|
451
451
|
let t = {};
|
|
452
452
|
e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
|
|
@@ -460,18 +460,18 @@ var W = (e) => /* @__PURE__ */ z(b, { ...e }), He = (e) => /* @__PURE__ */ z(f,
|
|
|
460
460
|
a
|
|
461
461
|
])
|
|
462
462
|
};
|
|
463
|
-
},
|
|
463
|
+
}, U = "!dial-small-semi-text !text-primary gap-1", qe = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: a, onSystemPromptChange: o, onTemperatureChange: s, responseFormatLabel: c = "Response format", responseFormatHint: l = "Applies to new and existing messages", responseFormatMarkdownLabel: u = "Markdown", responseFormatPlainTextLabel: d = "Plain text", systemPromptLabel: f = "System prompt", systemPromptTooltip: p = "Enter a prompt", temperatureLabel: m = "Temperature", temperatureLabels: h = [
|
|
464
464
|
"Precise",
|
|
465
465
|
"Neutral",
|
|
466
466
|
"Creative"
|
|
467
|
-
], temperatureHint: g }) => /* @__PURE__ */
|
|
467
|
+
], temperatureHint: g }) => /* @__PURE__ */ V("div", {
|
|
468
468
|
className: "flex flex-col gap-4 px-6 py-3",
|
|
469
469
|
children: [
|
|
470
|
-
e.responseFormat && /* @__PURE__ */
|
|
470
|
+
e.responseFormat && /* @__PURE__ */ B(x, {
|
|
471
471
|
fieldTitle: c,
|
|
472
|
-
labelClassName:
|
|
472
|
+
labelClassName: U,
|
|
473
473
|
elementId: "response-format",
|
|
474
|
-
orientation:
|
|
474
|
+
orientation: ee.Column,
|
|
475
475
|
activeRadioButton: t ?? i.Markdown,
|
|
476
476
|
labelDescription: l,
|
|
477
477
|
radioButtons: [{
|
|
@@ -483,19 +483,19 @@ var W = (e) => /* @__PURE__ */ z(b, { ...e }), He = (e) => /* @__PURE__ */ z(f,
|
|
|
483
483
|
}],
|
|
484
484
|
onChange: (e) => a(e)
|
|
485
485
|
}),
|
|
486
|
-
e.systemPrompt && /* @__PURE__ */
|
|
486
|
+
e.systemPrompt && /* @__PURE__ */ B(v, {
|
|
487
487
|
value: n,
|
|
488
488
|
placeholder: p,
|
|
489
489
|
labelProps: {
|
|
490
|
-
className:
|
|
490
|
+
className: U,
|
|
491
491
|
label: f
|
|
492
492
|
},
|
|
493
493
|
onChange: (e) => o(e ?? "")
|
|
494
494
|
}),
|
|
495
|
-
e.temperature && /* @__PURE__ */
|
|
495
|
+
e.temperature && /* @__PURE__ */ B(T, {
|
|
496
496
|
labelProps: {
|
|
497
497
|
label: m,
|
|
498
|
-
className:
|
|
498
|
+
className: U,
|
|
499
499
|
caption: g
|
|
500
500
|
},
|
|
501
501
|
value: r,
|
|
@@ -506,8 +506,8 @@ var W = (e) => /* @__PURE__ */ z(b, { ...e }), He = (e) => /* @__PURE__ */ z(f,
|
|
|
506
506
|
onChange: s
|
|
507
507
|
})
|
|
508
508
|
]
|
|
509
|
-
}),
|
|
510
|
-
let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: O, setResponseFormat: k, setSystemPrompt:
|
|
509
|
+
}), Je = ({ isOpen: e, onBack: t, backLabel: n, onClose: r, closeLabel: i, style: a, features: s, initialResponseFormat: c, initialSystemPrompt: l, initialTemperature: u, onSave: d, title: f = "Chat settings", responseFormatLabel: p, responseFormatHint: m, responseFormatMarkdownLabel: h, responseFormatPlainTextLabel: g, systemPromptLabel: _, systemPromptTooltip: v, temperatureLabel: y, temperatureLabels: b, temperatureHint: x, saveLabel: S = "Apply changes", saveDisabledTooltip: C }) => {
|
|
510
|
+
let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: O, setResponseFormat: k, setSystemPrompt: A, setTemperature: ee, handleSubmit: te } = Ke({
|
|
511
511
|
isOpen: e,
|
|
512
512
|
features: s,
|
|
513
513
|
initialResponseFormat: c,
|
|
@@ -516,7 +516,7 @@ var W = (e) => /* @__PURE__ */ z(b, { ...e }), He = (e) => /* @__PURE__ */ z(f,
|
|
|
516
516
|
onSave: d,
|
|
517
517
|
onClose: r
|
|
518
518
|
});
|
|
519
|
-
return /* @__PURE__ */
|
|
519
|
+
return /* @__PURE__ */ V(H, {
|
|
520
520
|
isOpen: e,
|
|
521
521
|
title: f,
|
|
522
522
|
closeLabel: i,
|
|
@@ -524,14 +524,14 @@ var W = (e) => /* @__PURE__ */ z(b, { ...e }), He = (e) => /* @__PURE__ */ z(f,
|
|
|
524
524
|
onBack: t,
|
|
525
525
|
backLabel: n,
|
|
526
526
|
style: a,
|
|
527
|
-
children: [/* @__PURE__ */
|
|
527
|
+
children: [/* @__PURE__ */ B(qe, {
|
|
528
528
|
features: s,
|
|
529
529
|
responseFormat: w,
|
|
530
530
|
systemPrompt: T,
|
|
531
531
|
temperature: E,
|
|
532
532
|
onResponseFormatChange: k,
|
|
533
|
-
onSystemPromptChange:
|
|
534
|
-
onTemperatureChange:
|
|
533
|
+
onSystemPromptChange: A,
|
|
534
|
+
onTemperatureChange: ee,
|
|
535
535
|
responseFormatLabel: p,
|
|
536
536
|
responseFormatHint: m,
|
|
537
537
|
responseFormatMarkdownLabel: h,
|
|
@@ -541,13 +541,13 @@ var W = (e) => /* @__PURE__ */ z(b, { ...e }), He = (e) => /* @__PURE__ */ z(f,
|
|
|
541
541
|
temperatureLabel: y,
|
|
542
542
|
temperatureLabels: b,
|
|
543
543
|
temperatureHint: x
|
|
544
|
-
}), /* @__PURE__ */
|
|
544
|
+
}), /* @__PURE__ */ B("div", {
|
|
545
545
|
className: o("px-6 py-4 mobile:pb-8"),
|
|
546
|
-
children: /* @__PURE__ */
|
|
546
|
+
children: /* @__PURE__ */ B(D, {
|
|
547
547
|
tooltip: C,
|
|
548
548
|
hideTooltip: O || !C,
|
|
549
549
|
triggerClassName: "w-full",
|
|
550
|
-
children: /* @__PURE__ */
|
|
550
|
+
children: /* @__PURE__ */ B(We, {
|
|
551
551
|
label: S,
|
|
552
552
|
onClick: te,
|
|
553
553
|
disabled: !O,
|
|
@@ -556,8 +556,8 @@ var W = (e) => /* @__PURE__ */ z(b, { ...e }), He = (e) => /* @__PURE__ */ z(f,
|
|
|
556
556
|
})
|
|
557
557
|
})]
|
|
558
558
|
});
|
|
559
|
-
},
|
|
560
|
-
let { responseFormat: v, systemPrompt: b, temperature: x, canSubmit: S, setResponseFormat: C, setSystemPrompt: w, setTemperature: T, handleSubmit: E } =
|
|
559
|
+
}, W = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", responseFormatLabel: s, responseFormatHint: c, responseFormatMarkdownLabel: l, responseFormatPlainTextLabel: u, systemPromptLabel: d, systemPromptTooltip: f, temperatureLabel: p, temperatureLabels: m, temperatureHint: h, saveLabel: g = "Apply changes", saveDisabledTooltip: _ }) => {
|
|
560
|
+
let { responseFormat: v, systemPrompt: b, temperature: x, canSubmit: S, setResponseFormat: C, setSystemPrompt: w, setTemperature: T, handleSubmit: E } = Ke({
|
|
561
561
|
features: e,
|
|
562
562
|
initialResponseFormat: t,
|
|
563
563
|
initialSystemPrompt: n,
|
|
@@ -565,25 +565,25 @@ var W = (e) => /* @__PURE__ */ z(b, { ...e }), He = (e) => /* @__PURE__ */ z(f,
|
|
|
565
565
|
onSave: i,
|
|
566
566
|
onClose: a
|
|
567
567
|
});
|
|
568
|
-
return /* @__PURE__ */
|
|
568
|
+
return /* @__PURE__ */ B(y, {
|
|
569
569
|
open: !0,
|
|
570
570
|
header: o,
|
|
571
|
-
size:
|
|
571
|
+
size: A.Sm,
|
|
572
572
|
onClose: a,
|
|
573
573
|
className: "!bg-layer-2",
|
|
574
|
-
footer: /* @__PURE__ */
|
|
574
|
+
footer: /* @__PURE__ */ B("div", {
|
|
575
575
|
className: "flex justify-end px-6 py-4",
|
|
576
|
-
children: /* @__PURE__ */
|
|
576
|
+
children: /* @__PURE__ */ B(D, {
|
|
577
577
|
tooltip: _,
|
|
578
578
|
hideTooltip: S || !_,
|
|
579
|
-
children: /* @__PURE__ */
|
|
579
|
+
children: /* @__PURE__ */ B(We, {
|
|
580
580
|
label: g,
|
|
581
581
|
onClick: E,
|
|
582
582
|
disabled: !S
|
|
583
583
|
})
|
|
584
584
|
})
|
|
585
585
|
}),
|
|
586
|
-
children: /* @__PURE__ */
|
|
586
|
+
children: /* @__PURE__ */ B(qe, {
|
|
587
587
|
features: e,
|
|
588
588
|
responseFormat: v,
|
|
589
589
|
systemPrompt: b,
|
|
@@ -603,71 +603,159 @@ var W = (e) => /* @__PURE__ */ z(b, { ...e }), He = (e) => /* @__PURE__ */ z(f,
|
|
|
603
603
|
})
|
|
604
604
|
});
|
|
605
605
|
};
|
|
606
|
-
|
|
606
|
+
M(W);
|
|
607
607
|
//#endregion
|
|
608
|
-
//#region src/components/
|
|
609
|
-
var
|
|
610
|
-
|
|
608
|
+
//#region src/components/ToolsBottomSheet/ToolsBottomSheet.tsx
|
|
609
|
+
var G = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel: i = "Close", style: a, title: o = "Tools", items: s, onToolToggle: l }) => /* @__PURE__ */ B(H, {
|
|
610
|
+
isOpen: e,
|
|
611
|
+
title: o,
|
|
612
|
+
closeLabel: i,
|
|
613
|
+
onClose: r,
|
|
614
|
+
onBack: t,
|
|
615
|
+
backLabel: n,
|
|
616
|
+
style: a,
|
|
617
|
+
children: /* @__PURE__ */ B("ul", {
|
|
618
|
+
role: "menu",
|
|
619
|
+
className: "flex flex-col pb-4",
|
|
620
|
+
children: s.map((e) => /* @__PURE__ */ B("li", {
|
|
621
|
+
role: "none",
|
|
622
|
+
children: /* @__PURE__ */ B(f, {
|
|
623
|
+
type: "button",
|
|
624
|
+
role: "menuitemcheckbox",
|
|
625
|
+
"aria-checked": e.isSelected,
|
|
626
|
+
className: "flex w-full items-center gap-3 px-4 py-[10px] text-start",
|
|
627
|
+
iconBefore: /* @__PURE__ */ B("span", {
|
|
628
|
+
className: "flex items-center text-secondary",
|
|
629
|
+
children: e.icon
|
|
630
|
+
}),
|
|
631
|
+
iconAfter: e.isSelected ? /* @__PURE__ */ B("span", {
|
|
632
|
+
className: "ms-auto text-accent-primary",
|
|
633
|
+
children: /* @__PURE__ */ B(re, {
|
|
634
|
+
size: c,
|
|
635
|
+
"aria-hidden": !0
|
|
636
|
+
})
|
|
637
|
+
}) : null,
|
|
638
|
+
label: /* @__PURE__ */ B("span", {
|
|
639
|
+
className: "dial-small-text",
|
|
640
|
+
children: e.label
|
|
641
|
+
}),
|
|
642
|
+
onClick: () => l(e.id)
|
|
643
|
+
})
|
|
644
|
+
}, e.id))
|
|
645
|
+
})
|
|
646
|
+
}), Ye = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, menuCloseLabel: a, style: l, listClassName: u = "cp-dropdown-overlay !w-[240px]", isDisabled: f = !1, chatSettings: p, extraMenuItems: h, toolsMenuItems: g = [], onToolToggle: v, toolsMenuTitle: y = "Tools", toolsBackLabel: b = "Back" }) => {
|
|
647
|
+
let x = s(), [S, C] = R(!1), [w, T] = R(!1), [E, D] = R(!1), O = g.length > 0 && v != null, k = I(() => g.map((e) => ({
|
|
648
|
+
key: e.id,
|
|
649
|
+
label: /* @__PURE__ */ V("span", {
|
|
650
|
+
className: "flex flex-1 items-center gap-2",
|
|
651
|
+
children: [/* @__PURE__ */ B("span", {
|
|
652
|
+
className: "flex-1",
|
|
653
|
+
children: e.label
|
|
654
|
+
}), e.isSelected && /* @__PURE__ */ B(re, {
|
|
655
|
+
size: c,
|
|
656
|
+
className: "text-accent-primary",
|
|
657
|
+
"aria-hidden": !0
|
|
658
|
+
})]
|
|
659
|
+
}),
|
|
660
|
+
icon: /* @__PURE__ */ B("span", {
|
|
661
|
+
className: "flex items-center text-secondary",
|
|
662
|
+
children: e.icon
|
|
663
|
+
}),
|
|
664
|
+
onClick: () => v?.(e.id)
|
|
665
|
+
})), [g, v]), A = I(() => [
|
|
611
666
|
...e == null ? [] : [{
|
|
612
667
|
key: "attach",
|
|
613
668
|
label: t,
|
|
614
|
-
icon: /* @__PURE__ */
|
|
669
|
+
icon: /* @__PURE__ */ B(j, {
|
|
615
670
|
size: c,
|
|
616
671
|
"aria-hidden": !0
|
|
617
672
|
}),
|
|
618
673
|
onClick: e
|
|
619
674
|
}],
|
|
620
675
|
...h ?? [],
|
|
676
|
+
...O ? [{
|
|
677
|
+
key: "tools",
|
|
678
|
+
label: y,
|
|
679
|
+
icon: /* @__PURE__ */ B(fe, {
|
|
680
|
+
size: c,
|
|
681
|
+
"aria-hidden": !0
|
|
682
|
+
}),
|
|
683
|
+
onClick: x ? () => {
|
|
684
|
+
D(!0), C(!1);
|
|
685
|
+
} : () => void 0,
|
|
686
|
+
...x ? { iconAfter: /* @__PURE__ */ B(ae, {
|
|
687
|
+
size: c,
|
|
688
|
+
stroke: 1.5,
|
|
689
|
+
className: "text-secondary rtl:scale-x-[-1]",
|
|
690
|
+
"aria-hidden": !0
|
|
691
|
+
}) } : { children: k }
|
|
692
|
+
}] : [],
|
|
621
693
|
...p == null ? [] : [{
|
|
622
694
|
key: "chat-settings",
|
|
623
695
|
label: p.menuItemLabel ?? "Chat settings",
|
|
624
|
-
icon: /* @__PURE__ */
|
|
696
|
+
icon: /* @__PURE__ */ B(de, {
|
|
625
697
|
size: c,
|
|
626
698
|
"aria-hidden": !0
|
|
627
699
|
}),
|
|
628
|
-
iconAfter:
|
|
700
|
+
iconAfter: x ? /* @__PURE__ */ B(ae, {
|
|
629
701
|
size: c,
|
|
630
702
|
stroke: 1.5,
|
|
631
703
|
className: "text-secondary rtl:scale-x-[-1]",
|
|
632
704
|
"aria-hidden": !0
|
|
633
705
|
}) : null,
|
|
634
|
-
onClick: () =>
|
|
706
|
+
onClick: () => T(!0)
|
|
635
707
|
}]
|
|
636
708
|
], [
|
|
637
709
|
t,
|
|
638
710
|
e,
|
|
639
711
|
p,
|
|
640
712
|
h,
|
|
641
|
-
|
|
713
|
+
x,
|
|
714
|
+
O,
|
|
715
|
+
y,
|
|
716
|
+
k
|
|
642
717
|
]);
|
|
643
|
-
return
|
|
644
|
-
/* @__PURE__ */
|
|
645
|
-
icon: /* @__PURE__ */
|
|
718
|
+
return A.length === 0 ? null : /* @__PURE__ */ B(z, { children: x ? /* @__PURE__ */ V(z, { children: [
|
|
719
|
+
/* @__PURE__ */ B(_, {
|
|
720
|
+
icon: /* @__PURE__ */ B(ue, {
|
|
646
721
|
size: d.LG,
|
|
647
722
|
"aria-hidden": !0
|
|
648
723
|
}),
|
|
649
724
|
"aria-label": n,
|
|
650
725
|
tooltipProps: { tooltip: n },
|
|
651
726
|
className: o("size-10 flex-shrink-0", f && "pointer-events-none opacity-50"),
|
|
652
|
-
onClick: () =>
|
|
727
|
+
onClick: () => C(!0)
|
|
653
728
|
}),
|
|
654
|
-
/* @__PURE__ */
|
|
655
|
-
isOpen:
|
|
729
|
+
/* @__PURE__ */ B(Ve, {
|
|
730
|
+
isOpen: S,
|
|
656
731
|
title: r,
|
|
657
732
|
closeLabel: a,
|
|
658
|
-
onClose: () =>
|
|
733
|
+
onClose: () => C(!1),
|
|
659
734
|
style: l,
|
|
660
|
-
items:
|
|
735
|
+
items: A,
|
|
661
736
|
className: "pb-4",
|
|
662
737
|
btnTextClassName: "flex-1"
|
|
663
738
|
}),
|
|
664
|
-
|
|
665
|
-
isOpen:
|
|
739
|
+
O && /* @__PURE__ */ B(G, {
|
|
740
|
+
isOpen: E,
|
|
741
|
+
onBack: () => {
|
|
742
|
+
D(!1), C(!0);
|
|
743
|
+
},
|
|
744
|
+
backLabel: b,
|
|
745
|
+
onClose: () => D(!1),
|
|
746
|
+
closeLabel: a,
|
|
747
|
+
style: l,
|
|
748
|
+
title: y,
|
|
749
|
+
items: g,
|
|
750
|
+
onToolToggle: v
|
|
751
|
+
}),
|
|
752
|
+
p != null && /* @__PURE__ */ B(Je, {
|
|
753
|
+
isOpen: w,
|
|
666
754
|
onBack: () => {
|
|
667
|
-
|
|
755
|
+
T(!1), C(!0);
|
|
668
756
|
},
|
|
669
757
|
backLabel: p.backLabel ?? "Back",
|
|
670
|
-
onClose: () =>
|
|
758
|
+
onClose: () => T(!1),
|
|
671
759
|
closeLabel: a,
|
|
672
760
|
style: l,
|
|
673
761
|
features: p.features,
|
|
@@ -688,13 +776,13 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
688
776
|
saveLabel: p.saveLabel,
|
|
689
777
|
saveDisabledTooltip: p.saveDisabledTooltip
|
|
690
778
|
})
|
|
691
|
-
] }) : /* @__PURE__ */
|
|
779
|
+
] }) : /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B(m, {
|
|
692
780
|
matchReferenceWidth: !1,
|
|
693
781
|
placement: "bottom-start",
|
|
694
782
|
listClassName: u,
|
|
695
|
-
items:
|
|
696
|
-
children: /* @__PURE__ */
|
|
697
|
-
icon: /* @__PURE__ */
|
|
783
|
+
items: A,
|
|
784
|
+
children: /* @__PURE__ */ B(_, {
|
|
785
|
+
icon: /* @__PURE__ */ B(ue, {
|
|
698
786
|
size: d.LG,
|
|
699
787
|
"aria-hidden": !0
|
|
700
788
|
}),
|
|
@@ -703,13 +791,13 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
703
791
|
className: "size-10 flex-shrink-0",
|
|
704
792
|
disabled: f
|
|
705
793
|
})
|
|
706
|
-
}), p != null &&
|
|
794
|
+
}), p != null && w && /* @__PURE__ */ B(W, {
|
|
707
795
|
features: p.features,
|
|
708
796
|
initialResponseFormat: p.responseFormat ?? i.Markdown,
|
|
709
797
|
initialSystemPrompt: p.systemPrompt,
|
|
710
798
|
initialTemperature: p.temperature,
|
|
711
799
|
onSave: p.onSave,
|
|
712
|
-
onClose: () =>
|
|
800
|
+
onClose: () => T(!1),
|
|
713
801
|
title: p.title,
|
|
714
802
|
responseFormatLabel: p.responseFormatLabel,
|
|
715
803
|
responseFormatHint: p.responseFormatHint,
|
|
@@ -723,6 +811,61 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
723
811
|
saveLabel: p.saveLabel,
|
|
724
812
|
saveDisabledTooltip: p.saveDisabledTooltip
|
|
725
813
|
})] }) });
|
|
814
|
+
}, K = {
|
|
815
|
+
chip: "_chip_1y9qv_1",
|
|
816
|
+
chipIcon: "_chipIcon_1y9qv_6",
|
|
817
|
+
chipText: "_chipText_1y9qv_10",
|
|
818
|
+
chipClose: "_chipClose_1y9qv_14"
|
|
819
|
+
}, Xe = (e) => `${e} tool${e === 1 ? "" : "s"}`, q = (e) => `Remove ${e}`, Ze = ({ items: e, onToolToggle: t, isMobile: n, countLabel: r = Xe, removeLabel: i = q }) => {
|
|
820
|
+
let a = e.filter((e) => e.isSelected);
|
|
821
|
+
if (a.length === 0) return null;
|
|
822
|
+
if (n) {
|
|
823
|
+
let e = a.length === 1 ? a[0].icon : /* @__PURE__ */ B(fe, {
|
|
824
|
+
size: c,
|
|
825
|
+
"aria-hidden": !0
|
|
826
|
+
});
|
|
827
|
+
return /* @__PURE__ */ B("div", {
|
|
828
|
+
className: "flex flex-wrap items-center gap-2",
|
|
829
|
+
children: /* @__PURE__ */ V("div", {
|
|
830
|
+
className: o(K.chip, "flex items-center gap-1.5 rounded border px-2 py-1"),
|
|
831
|
+
children: [/* @__PURE__ */ B("span", {
|
|
832
|
+
className: K.chipIcon,
|
|
833
|
+
"aria-hidden": !0,
|
|
834
|
+
children: e
|
|
835
|
+
}), /* @__PURE__ */ B("span", {
|
|
836
|
+
className: o(K.chipText, "dial-small-text"),
|
|
837
|
+
children: r(a.length)
|
|
838
|
+
})]
|
|
839
|
+
})
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
return /* @__PURE__ */ B("div", {
|
|
843
|
+
className: "flex flex-wrap items-center gap-2",
|
|
844
|
+
children: a.map((e) => /* @__PURE__ */ V("div", {
|
|
845
|
+
className: o(K.chip, "flex items-center gap-1.5 rounded border py-1 pe-1 ps-2"),
|
|
846
|
+
children: [
|
|
847
|
+
/* @__PURE__ */ B("span", {
|
|
848
|
+
className: K.chipIcon,
|
|
849
|
+
"aria-hidden": !0,
|
|
850
|
+
children: e.icon
|
|
851
|
+
}),
|
|
852
|
+
/* @__PURE__ */ B("span", {
|
|
853
|
+
className: o(K.chipText, "dial-small-text"),
|
|
854
|
+
children: e.label
|
|
855
|
+
}),
|
|
856
|
+
/* @__PURE__ */ B("button", {
|
|
857
|
+
type: "button",
|
|
858
|
+
onClick: () => t(e.id),
|
|
859
|
+
className: o(K.chipClose, "flex items-center rounded p-0.5 transition-colors"),
|
|
860
|
+
"aria-label": i(e.label),
|
|
861
|
+
children: /* @__PURE__ */ B(pe, {
|
|
862
|
+
size: 12,
|
|
863
|
+
"aria-hidden": !0
|
|
864
|
+
})
|
|
865
|
+
})
|
|
866
|
+
]
|
|
867
|
+
}, e.id))
|
|
868
|
+
});
|
|
726
869
|
}, J = {
|
|
727
870
|
container: "_container_8j81i_1",
|
|
728
871
|
containerError: "_containerError_8j81i_14",
|
|
@@ -731,29 +874,29 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
731
874
|
stopRecordingIcon: "_stopRecordingIcon_8j81i_28",
|
|
732
875
|
recordingDot: "_recordingDot_8j81i_42",
|
|
733
876
|
"recording-pulse": "_recording-pulse_8j81i_1"
|
|
734
|
-
},
|
|
735
|
-
let p =
|
|
877
|
+
}, Qe = 3, $e = 4, Y = 200, et = (e) => `${String(Math.floor(e / 60)).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`, tt = ({ state: e, analyserNodeRef: t, elapsedSeconds: n, errorMessage: r, onStop: i, onDiscard: a, stopLabel: s = "Stop recording", discardLabel: c = "Discard recording", timerLabel: l = "Recording time", style: u, className: f }) => {
|
|
878
|
+
let p = L(null), m = L(new Float32Array(Y)), h = L(0), v = L(0), y = e === Fe.Recording, b = e === Fe.Error, x = N((e) => {
|
|
736
879
|
let t = e.getContext("2d");
|
|
737
880
|
if (!t) return;
|
|
738
881
|
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
739
882
|
let { width: n, height: r } = e;
|
|
740
883
|
t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
|
|
741
|
-
let i = Math.min(Math.max(1, Math.floor(n /
|
|
884
|
+
let i = Math.min(Math.max(1, Math.floor(n / $e)), Y - 1), a = h.current, o = v.current;
|
|
742
885
|
t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
|
|
743
886
|
for (let e = 0; e <= i; e++) {
|
|
744
|
-
let n = ((a - i + e) %
|
|
745
|
-
t.fillRect(e *
|
|
887
|
+
let n = ((a - i + e) % Y + Y) % Y, o = m.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
|
|
888
|
+
t.fillRect(e * $e, (r - c) / 2, Qe, c);
|
|
746
889
|
}
|
|
747
890
|
t.restore();
|
|
748
891
|
}, []);
|
|
749
|
-
|
|
892
|
+
P(() => {
|
|
750
893
|
if (!y) return;
|
|
751
894
|
let e = p.current;
|
|
752
895
|
if (!e) return;
|
|
753
896
|
m.current.fill(0), h.current = 0, v.current = 0;
|
|
754
897
|
let n, r = () => {
|
|
755
|
-
if (v.current += 1, v.current >=
|
|
756
|
-
v.current -=
|
|
898
|
+
if (v.current += 1, v.current >= $e) {
|
|
899
|
+
v.current -= $e;
|
|
757
900
|
let e = t.current;
|
|
758
901
|
if (e) {
|
|
759
902
|
let t = new Uint8Array(e.frequencyBinCount);
|
|
@@ -763,7 +906,7 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
763
906
|
let r = (t[e] - 128) / 128;
|
|
764
907
|
n += r * r;
|
|
765
908
|
}
|
|
766
|
-
m.current[h.current %
|
|
909
|
+
m.current[h.current % Y] = Math.sqrt(n / t.length), h.current++;
|
|
767
910
|
}
|
|
768
911
|
}
|
|
769
912
|
x(e), n = requestAnimationFrame(r);
|
|
@@ -775,7 +918,7 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
775
918
|
y,
|
|
776
919
|
t,
|
|
777
920
|
x
|
|
778
|
-
]),
|
|
921
|
+
]), P(() => {
|
|
779
922
|
let e = p.current;
|
|
780
923
|
if (!e) return;
|
|
781
924
|
let t = new ResizeObserver(() => {
|
|
@@ -783,18 +926,18 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
783
926
|
});
|
|
784
927
|
return t.observe(e), () => t.disconnect();
|
|
785
928
|
}, [x]);
|
|
786
|
-
let S = /* @__PURE__ */
|
|
929
|
+
let S = /* @__PURE__ */ V("div", {
|
|
787
930
|
className: "flex flex-shrink-0 items-center justify-end gap-1",
|
|
788
|
-
children: [/* @__PURE__ */
|
|
789
|
-
icon: /* @__PURE__ */
|
|
931
|
+
children: [/* @__PURE__ */ B(_, {
|
|
932
|
+
icon: /* @__PURE__ */ B(pe, {
|
|
790
933
|
size: d.LG,
|
|
791
934
|
"aria-hidden": !0
|
|
792
935
|
}),
|
|
793
936
|
"aria-label": c,
|
|
794
937
|
className: "size-10 flex-shrink-0",
|
|
795
938
|
onClick: a
|
|
796
|
-
}), y && /* @__PURE__ */
|
|
797
|
-
icon: /* @__PURE__ */
|
|
939
|
+
}), y && /* @__PURE__ */ B(_, {
|
|
940
|
+
icon: /* @__PURE__ */ B(ce, {
|
|
798
941
|
size: d.LG,
|
|
799
942
|
className: J.stopRecordingIcon,
|
|
800
943
|
"aria-hidden": !0
|
|
@@ -804,32 +947,32 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
804
947
|
onClick: i
|
|
805
948
|
})]
|
|
806
949
|
});
|
|
807
|
-
return /* @__PURE__ */
|
|
950
|
+
return /* @__PURE__ */ V("div", {
|
|
808
951
|
className: f,
|
|
809
|
-
children: [/* @__PURE__ */
|
|
952
|
+
children: [/* @__PURE__ */ V("div", {
|
|
810
953
|
style: u,
|
|
811
954
|
className: o(J.container, "flex min-h-[56px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border px-3 desktop:flex-row desktop:items-center desktop:gap-2 desktop:py-2", b && J.containerError),
|
|
812
|
-
children: [/* @__PURE__ */
|
|
955
|
+
children: [/* @__PURE__ */ V("div", {
|
|
813
956
|
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
814
|
-
children: [y && /* @__PURE__ */
|
|
957
|
+
children: [y && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("span", {
|
|
815
958
|
className: J.recordingDot,
|
|
816
959
|
"aria-hidden": !0
|
|
817
|
-
}), /* @__PURE__ */
|
|
960
|
+
}), /* @__PURE__ */ B("span", {
|
|
818
961
|
className: o(J.timer, "flex-shrink-0"),
|
|
819
962
|
"aria-label": l,
|
|
820
|
-
children:
|
|
821
|
-
})] }), /* @__PURE__ */
|
|
963
|
+
children: et(n)
|
|
964
|
+
})] }), /* @__PURE__ */ B("canvas", {
|
|
822
965
|
ref: p,
|
|
823
966
|
height: 32,
|
|
824
967
|
className: o(J.waveformCanvas, "h-8 min-w-0 flex-1 desktop:h-6")
|
|
825
968
|
})]
|
|
826
969
|
}), S]
|
|
827
|
-
}), b && r && /* @__PURE__ */
|
|
970
|
+
}), b && r && /* @__PURE__ */ B(g, {
|
|
828
971
|
text: r,
|
|
829
972
|
className: "mt-1 px-1"
|
|
830
973
|
})]
|
|
831
974
|
});
|
|
832
|
-
},
|
|
975
|
+
}, X = {
|
|
833
976
|
wrapper: "_wrapper_1q2nu_2",
|
|
834
977
|
wrapperDisabled: "_wrapperDisabled_1q2nu_15",
|
|
835
978
|
textarea: "_textarea_1q2nu_20",
|
|
@@ -841,73 +984,73 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
841
984
|
sendButtonEnter: "_sendButtonEnter_1q2nu_1",
|
|
842
985
|
sendButtonExiting: "_sendButtonExiting_1q2nu_55",
|
|
843
986
|
sendButtonExit: "_sendButtonExit_1q2nu_55"
|
|
844
|
-
},
|
|
987
|
+
}, nt = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", title: r, isExiting: i = !1 }) => /* @__PURE__ */ B(D, {
|
|
845
988
|
tooltip: r,
|
|
846
989
|
hideTooltip: !r,
|
|
847
|
-
children: /* @__PURE__ */
|
|
848
|
-
className: o("flex size-[32px] cursor-pointer items-center justify-center rounded-full disabled:cursor-not-allowed",
|
|
990
|
+
children: /* @__PURE__ */ B("button", {
|
|
991
|
+
className: o("flex size-[32px] cursor-pointer items-center justify-center rounded-full disabled:cursor-not-allowed", X.sendButton, i && X.sendButtonExiting),
|
|
849
992
|
"aria-label": n,
|
|
850
993
|
onClick: () => e?.(),
|
|
851
994
|
type: "button",
|
|
852
995
|
disabled: t,
|
|
853
996
|
"aria-hidden": i,
|
|
854
|
-
children: /* @__PURE__ */
|
|
997
|
+
children: /* @__PURE__ */ B(ne, {
|
|
855
998
|
size: d.LG,
|
|
856
999
|
className: "rtl:scale-x-[-1]"
|
|
857
1000
|
})
|
|
858
1001
|
})
|
|
859
|
-
}),
|
|
1002
|
+
}), rt = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ B("button", {
|
|
860
1003
|
className: o("flex cursor-pointer items-center justify-center disabled:cursor-not-allowed"),
|
|
861
1004
|
"aria-label": t,
|
|
862
1005
|
onClick: () => e?.(),
|
|
863
1006
|
type: "button",
|
|
864
|
-
children: /* @__PURE__ */
|
|
1007
|
+
children: /* @__PURE__ */ B(le, {
|
|
865
1008
|
size: d.LG,
|
|
866
|
-
className:
|
|
1009
|
+
className: X.stopIcon
|
|
867
1010
|
})
|
|
868
|
-
}),
|
|
1011
|
+
}), it = ({ size: e = 20 }) => /* @__PURE__ */ B(C, {
|
|
869
1012
|
variant: w.Circular,
|
|
870
1013
|
width: e,
|
|
871
1014
|
height: e,
|
|
872
1015
|
active: !0
|
|
873
|
-
}),
|
|
1016
|
+
}), at = ({ loadingLabel: e }) => /* @__PURE__ */ V("span", {
|
|
874
1017
|
className: "flex min-w-0 flex-1 items-center",
|
|
875
|
-
children: [/* @__PURE__ */
|
|
1018
|
+
children: [/* @__PURE__ */ B(C, {
|
|
876
1019
|
variant: w.Text,
|
|
877
1020
|
width: "100%",
|
|
878
1021
|
height: 16,
|
|
879
1022
|
active: !0
|
|
880
|
-
}), e && /* @__PURE__ */
|
|
1023
|
+
}), e && /* @__PURE__ */ B("span", {
|
|
881
1024
|
className: "sr-only",
|
|
882
1025
|
children: e
|
|
883
1026
|
})]
|
|
884
|
-
}),
|
|
1027
|
+
}), ot = ({ loadingLabel: e }) => /* @__PURE__ */ B("div", {
|
|
885
1028
|
role: "status",
|
|
886
1029
|
"aria-label": e,
|
|
887
|
-
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */
|
|
1030
|
+
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ V("div", {
|
|
888
1031
|
className: "flex h-11 items-center gap-3 px-4",
|
|
889
1032
|
"aria-hidden": "true",
|
|
890
|
-
children: [/* @__PURE__ */
|
|
1033
|
+
children: [/* @__PURE__ */ B(it, {}), /* @__PURE__ */ B(at, {})]
|
|
891
1034
|
}, t))
|
|
892
|
-
}),
|
|
1035
|
+
}), st = (e) => e.displayName ?? e.id, ct = (e, t) => {
|
|
893
1036
|
let n = t.trim().toLowerCase();
|
|
894
|
-
return n ? e.filter((e) =>
|
|
895
|
-
},
|
|
1037
|
+
return n ? e.filter((e) => st(e).toLowerCase().includes(n)) : e;
|
|
1038
|
+
}, lt = (e, t, r, i = 18, a) => /* @__PURE__ */ B(n, {
|
|
896
1039
|
src: e,
|
|
897
1040
|
size: i,
|
|
898
1041
|
labels: { tooltip: a },
|
|
899
1042
|
initialsName: r
|
|
900
|
-
}),
|
|
901
|
-
let [a, s] =
|
|
1043
|
+
}), ut = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, searchHeaderClassName: i = "bg-layer-0" }) => {
|
|
1044
|
+
let [a, s] = R(""), c = I(() => e?.find((e) => e.id === t), [e, t]), l = r?.loading !== void 0, u = I(() => l ? /* @__PURE__ */ B(it, { size: d.LG }) : lt(c?.iconUrl, c?.type, c?.displayName ?? c?.id ?? "", d.LG), [l, c]), f = c?.displayName ?? c?.id;
|
|
902
1045
|
return {
|
|
903
1046
|
selectorIcon: u,
|
|
904
1047
|
selectorAriaLabel: f ? `${r?.ariaLabel ?? "Select model"}: ${f}` : r?.ariaLabel ?? "Select model",
|
|
905
1048
|
selectedLabel: f,
|
|
906
|
-
menuItems:
|
|
1049
|
+
menuItems: I(() => {
|
|
907
1050
|
if (l) return Array.from({ length: 7 }, (e, t) => ({
|
|
908
1051
|
key: `__loading-${t}`,
|
|
909
|
-
icon: /* @__PURE__ */
|
|
910
|
-
label: /* @__PURE__ */
|
|
1052
|
+
icon: /* @__PURE__ */ B(it, {}),
|
|
1053
|
+
label: /* @__PURE__ */ B(at, { loadingLabel: t === 0 ? r?.loading : void 0 }),
|
|
911
1054
|
disabled: !0
|
|
912
1055
|
}));
|
|
913
1056
|
if (!e || e.length === 0) {
|
|
@@ -918,19 +1061,19 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
918
1061
|
disabled: !0
|
|
919
1062
|
}] : [];
|
|
920
1063
|
}
|
|
921
|
-
return
|
|
1064
|
+
return ct(e, a).map((e) => {
|
|
922
1065
|
let r = e.id === t;
|
|
923
1066
|
return {
|
|
924
1067
|
key: e.id,
|
|
925
|
-
label: /* @__PURE__ */
|
|
1068
|
+
label: /* @__PURE__ */ V("span", {
|
|
926
1069
|
className: "flex w-full items-center justify-between gap-2",
|
|
927
|
-
children: [/* @__PURE__ */
|
|
928
|
-
text:
|
|
1070
|
+
children: [/* @__PURE__ */ B(k, {
|
|
1071
|
+
text: st(e),
|
|
929
1072
|
query: a,
|
|
930
1073
|
maxLines: 1
|
|
931
|
-
}), r && /* @__PURE__ */
|
|
1074
|
+
}), r && /* @__PURE__ */ B(He, { gradientId: "ms-check-grad" })]
|
|
932
1075
|
}),
|
|
933
|
-
icon:
|
|
1076
|
+
icon: lt(e.iconUrl, e.type, e.displayName ?? e.id),
|
|
934
1077
|
onClick: () => n?.(e.id),
|
|
935
1078
|
className: r ? "bg-accent-primary-alpha" : void 0
|
|
936
1079
|
};
|
|
@@ -943,9 +1086,9 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
943
1086
|
r,
|
|
944
1087
|
n
|
|
945
1088
|
]),
|
|
946
|
-
menuHeader:
|
|
1089
|
+
menuHeader: I(() => !l && e && e.length > 0 ? /* @__PURE__ */ B("div", {
|
|
947
1090
|
className: o("sticky top-0 z-10 pb-1 pe-2 pt-2", i),
|
|
948
|
-
children: /* @__PURE__ */
|
|
1091
|
+
children: /* @__PURE__ */ B(S, {
|
|
949
1092
|
value: a,
|
|
950
1093
|
placeholder: r?.searchPlaceholder ?? "Search",
|
|
951
1094
|
size: O.Small,
|
|
@@ -963,8 +1106,8 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
|
|
|
963
1106
|
e || s("");
|
|
964
1107
|
}
|
|
965
1108
|
};
|
|
966
|
-
},
|
|
967
|
-
function
|
|
1109
|
+
}, dt = typeof window < "u" ? F : P;
|
|
1110
|
+
function ft(e) {
|
|
968
1111
|
if (e !== void 0) switch (typeof e) {
|
|
969
1112
|
case "number": return e;
|
|
970
1113
|
case "string":
|
|
@@ -972,15 +1115,15 @@ function at(e) {
|
|
|
972
1115
|
break;
|
|
973
1116
|
}
|
|
974
1117
|
}
|
|
975
|
-
function
|
|
976
|
-
let { styleHeight: s, styleWidth: c } =
|
|
977
|
-
styleHeight:
|
|
978
|
-
styleWidth:
|
|
979
|
-
}), [o?.height, o?.width]), [l, u] =
|
|
1118
|
+
function pt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
|
|
1119
|
+
let { styleHeight: s, styleWidth: c } = I(() => ({
|
|
1120
|
+
styleHeight: ft(o?.height),
|
|
1121
|
+
styleWidth: ft(o?.width)
|
|
1122
|
+
}), [o?.height, o?.width]), [l, u] = R({
|
|
980
1123
|
height: t,
|
|
981
1124
|
width: n
|
|
982
1125
|
}), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
|
|
983
|
-
return
|
|
1126
|
+
return dt(() => {
|
|
984
1127
|
if (i === null || d) return;
|
|
985
1128
|
let t = new ResizeObserver((e) => {
|
|
986
1129
|
for (let t of e) {
|
|
@@ -1000,7 +1143,7 @@ function ot({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1000
1143
|
i,
|
|
1001
1144
|
s,
|
|
1002
1145
|
c
|
|
1003
|
-
]),
|
|
1146
|
+
]), I(() => ({
|
|
1004
1147
|
height: s ?? l.height,
|
|
1005
1148
|
width: c ?? l.width
|
|
1006
1149
|
}), [
|
|
@@ -1009,26 +1152,26 @@ function ot({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1009
1152
|
c
|
|
1010
1153
|
]);
|
|
1011
1154
|
}
|
|
1012
|
-
function
|
|
1013
|
-
let t =
|
|
1155
|
+
function mt(e) {
|
|
1156
|
+
let t = L(() => {
|
|
1014
1157
|
throw Error("Cannot call during render.");
|
|
1015
1158
|
});
|
|
1016
|
-
return
|
|
1159
|
+
return dt(() => {
|
|
1017
1160
|
t.current = e;
|
|
1018
|
-
}, [e]),
|
|
1161
|
+
}, [e]), N((e) => t.current?.(e), [t]);
|
|
1019
1162
|
}
|
|
1020
|
-
var
|
|
1021
|
-
function
|
|
1022
|
-
if (
|
|
1163
|
+
var ht = null;
|
|
1164
|
+
function gt(e = !1) {
|
|
1165
|
+
if (ht === null || e) {
|
|
1023
1166
|
let e = document.createElement("div"), t = e.style;
|
|
1024
1167
|
t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
|
|
1025
1168
|
let n = document.createElement("div"), r = n.style;
|
|
1026
|
-
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ?
|
|
1169
|
+
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? ht = "positive-descending" : (e.scrollLeft = 1, ht = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), ht;
|
|
1027
1170
|
}
|
|
1028
|
-
return
|
|
1171
|
+
return ht;
|
|
1029
1172
|
}
|
|
1030
|
-
function
|
|
1031
|
-
if (t === "horizontal" && n) switch (
|
|
1173
|
+
function _t({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
1174
|
+
if (t === "horizontal" && n) switch (gt()) {
|
|
1032
1175
|
case "negative": return -r;
|
|
1033
1176
|
case "positive-descending":
|
|
1034
1177
|
if (e) {
|
|
@@ -1039,26 +1182,26 @@ function ut({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
|
1039
1182
|
}
|
|
1040
1183
|
return r;
|
|
1041
1184
|
}
|
|
1042
|
-
function
|
|
1185
|
+
function Z(e, t = "Assertion error") {
|
|
1043
1186
|
if (!e) throw console.error(t), Error(t);
|
|
1044
1187
|
}
|
|
1045
|
-
function
|
|
1188
|
+
function Q(e, t) {
|
|
1046
1189
|
if (e === t) return !0;
|
|
1047
|
-
if (!!e != !!t || (
|
|
1190
|
+
if (!!e != !!t || (Z(e !== void 0), Z(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
|
|
1048
1191
|
for (let n in e) if (!Object.is(t[n], e[n])) return !1;
|
|
1049
1192
|
return !0;
|
|
1050
1193
|
}
|
|
1051
|
-
function
|
|
1194
|
+
function vt({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
1052
1195
|
if (t === 0) return 0;
|
|
1053
1196
|
if (typeof n == "number") return t * n;
|
|
1054
1197
|
{
|
|
1055
1198
|
let n = e.get(e.size === 0 ? 0 : e.size - 1);
|
|
1056
|
-
return
|
|
1199
|
+
return Z(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
|
|
1057
1200
|
}
|
|
1058
1201
|
}
|
|
1059
|
-
function
|
|
1202
|
+
function yt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
|
|
1060
1203
|
if (n < 0 || n >= r) throw RangeError(`Invalid index specified: ${n}`, { cause: `Index ${n} is not within the range of 0 - ${r - 1}` });
|
|
1061
|
-
let s =
|
|
1204
|
+
let s = vt({
|
|
1062
1205
|
cachedBounds: t,
|
|
1063
1206
|
itemCount: r,
|
|
1064
1207
|
itemSize: i
|
|
@@ -1070,7 +1213,7 @@ function ft({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, co
|
|
|
1070
1213
|
default: return a >= u && a <= l ? a : a < u ? u : l;
|
|
1071
1214
|
}
|
|
1072
1215
|
}
|
|
1073
|
-
function
|
|
1216
|
+
function $({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
|
|
1074
1217
|
let a = r - 1, o = 0, s = -1, c = 0, l = -1, u = 0;
|
|
1075
1218
|
for (; u < a;) {
|
|
1076
1219
|
let n = e.get(u);
|
|
@@ -1089,11 +1232,11 @@ function pt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemC
|
|
|
1089
1232
|
stopIndexOverscan: l
|
|
1090
1233
|
};
|
|
1091
1234
|
}
|
|
1092
|
-
function
|
|
1235
|
+
function bt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1093
1236
|
let r = /* @__PURE__ */ new Map();
|
|
1094
1237
|
return {
|
|
1095
1238
|
get(i) {
|
|
1096
|
-
for (
|
|
1239
|
+
for (Z(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
|
|
1097
1240
|
let e = r.size, a;
|
|
1098
1241
|
switch (typeof n) {
|
|
1099
1242
|
case "function":
|
|
@@ -1109,14 +1252,14 @@ function mt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1109
1252
|
});
|
|
1110
1253
|
else {
|
|
1111
1254
|
let t = r.get(e - 1);
|
|
1112
|
-
|
|
1255
|
+
Z(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
|
|
1113
1256
|
scrollOffset: t.scrollOffset + t.size,
|
|
1114
1257
|
size: a
|
|
1115
1258
|
});
|
|
1116
1259
|
}
|
|
1117
1260
|
}
|
|
1118
1261
|
let a = r.get(i);
|
|
1119
|
-
return
|
|
1262
|
+
return Z(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
|
|
1120
1263
|
},
|
|
1121
1264
|
set(e, t) {
|
|
1122
1265
|
r.set(e, t);
|
|
@@ -1126,8 +1269,8 @@ function mt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1126
1269
|
}
|
|
1127
1270
|
};
|
|
1128
1271
|
}
|
|
1129
|
-
function
|
|
1130
|
-
return
|
|
1272
|
+
function xt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1273
|
+
return I(() => bt({
|
|
1131
1274
|
itemCount: e,
|
|
1132
1275
|
itemProps: t,
|
|
1133
1276
|
itemSize: n
|
|
@@ -1137,11 +1280,11 @@ function ht({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1137
1280
|
n
|
|
1138
1281
|
]);
|
|
1139
1282
|
}
|
|
1140
|
-
function
|
|
1283
|
+
function St({ containerSize: e, itemSize: t }) {
|
|
1141
1284
|
let n;
|
|
1142
1285
|
switch (typeof t) {
|
|
1143
1286
|
case "string":
|
|
1144
|
-
|
|
1287
|
+
Z(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), Z(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseInt(t) / 100;
|
|
1145
1288
|
break;
|
|
1146
1289
|
default:
|
|
1147
1290
|
n = t;
|
|
@@ -1149,21 +1292,21 @@ function gt({ containerSize: e, itemSize: t }) {
|
|
|
1149
1292
|
}
|
|
1150
1293
|
return n;
|
|
1151
1294
|
}
|
|
1152
|
-
function
|
|
1153
|
-
let { height: u = n, width: d = n } =
|
|
1295
|
+
function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
|
|
1296
|
+
let { height: u = n, width: d = n } = pt({
|
|
1154
1297
|
defaultHeight: r === "vertical" ? n : void 0,
|
|
1155
1298
|
defaultWidth: r === "horizontal" ? n : void 0,
|
|
1156
1299
|
element: e,
|
|
1157
1300
|
mode: r === "vertical" ? "only-height" : "only-width",
|
|
1158
1301
|
style: t
|
|
1159
|
-
}), f =
|
|
1302
|
+
}), f = L({
|
|
1160
1303
|
height: 0,
|
|
1161
1304
|
width: 0
|
|
1162
|
-
}), p = r === "vertical" ? u : d, m =
|
|
1305
|
+
}), p = r === "vertical" ? u : d, m = St({
|
|
1163
1306
|
containerSize: p,
|
|
1164
1307
|
itemSize: s
|
|
1165
1308
|
});
|
|
1166
|
-
|
|
1309
|
+
F(() => {
|
|
1167
1310
|
if (typeof c == "function") {
|
|
1168
1311
|
let e = f.current;
|
|
1169
1312
|
(e.height !== u || e.width !== d) && (c({
|
|
@@ -1176,11 +1319,11 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1176
1319
|
c,
|
|
1177
1320
|
d
|
|
1178
1321
|
]);
|
|
1179
|
-
let h =
|
|
1322
|
+
let h = xt({
|
|
1180
1323
|
itemCount: a,
|
|
1181
1324
|
itemProps: o,
|
|
1182
1325
|
itemSize: m
|
|
1183
|
-
}), g =
|
|
1326
|
+
}), g = N((e) => h.get(e), [h]), [_, v] = R(() => $({
|
|
1184
1327
|
cachedBounds: h,
|
|
1185
1328
|
containerScrollOffset: 0,
|
|
1186
1329
|
containerSize: p,
|
|
@@ -1191,7 +1334,7 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1191
1334
|
startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
|
|
1192
1335
|
stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
|
|
1193
1336
|
stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
|
|
1194
|
-
}, C =
|
|
1337
|
+
}, C = N(() => vt({
|
|
1195
1338
|
cachedBounds: h,
|
|
1196
1339
|
itemCount: a,
|
|
1197
1340
|
itemSize: m
|
|
@@ -1199,9 +1342,9 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1199
1342
|
h,
|
|
1200
1343
|
a,
|
|
1201
1344
|
m
|
|
1202
|
-
]), w =
|
|
1345
|
+
]), w = N((t) => $({
|
|
1203
1346
|
cachedBounds: h,
|
|
1204
|
-
containerScrollOffset:
|
|
1347
|
+
containerScrollOffset: _t({
|
|
1205
1348
|
containerElement: e,
|
|
1206
1349
|
direction: r,
|
|
1207
1350
|
isRtl: i,
|
|
@@ -1219,19 +1362,19 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1219
1362
|
a,
|
|
1220
1363
|
l
|
|
1221
1364
|
]);
|
|
1222
|
-
return
|
|
1365
|
+
return dt(() => {
|
|
1223
1366
|
v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
|
|
1224
1367
|
}, [
|
|
1225
1368
|
e,
|
|
1226
1369
|
r,
|
|
1227
1370
|
w
|
|
1228
|
-
]),
|
|
1371
|
+
]), dt(() => {
|
|
1229
1372
|
if (!e) return;
|
|
1230
1373
|
let t = () => {
|
|
1231
1374
|
v((t) => {
|
|
1232
|
-
let { scrollLeft: n, scrollTop: o } = e, s =
|
|
1375
|
+
let { scrollLeft: n, scrollTop: o } = e, s = $({
|
|
1233
1376
|
cachedBounds: h,
|
|
1234
|
-
containerScrollOffset:
|
|
1377
|
+
containerScrollOffset: _t({
|
|
1235
1378
|
containerElement: e,
|
|
1236
1379
|
direction: r,
|
|
1237
1380
|
isRtl: i,
|
|
@@ -1241,7 +1384,7 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1241
1384
|
itemCount: a,
|
|
1242
1385
|
overscanCount: l
|
|
1243
1386
|
});
|
|
1244
|
-
return
|
|
1387
|
+
return Q(s, t) ? t : s;
|
|
1245
1388
|
});
|
|
1246
1389
|
};
|
|
1247
1390
|
return e.addEventListener("scroll", t), () => {
|
|
@@ -1257,8 +1400,8 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1257
1400
|
]), {
|
|
1258
1401
|
getCellBounds: g,
|
|
1259
1402
|
getEstimatedSize: C,
|
|
1260
|
-
scrollToIndex:
|
|
1261
|
-
let s =
|
|
1403
|
+
scrollToIndex: mt(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
|
|
1404
|
+
let s = yt({
|
|
1262
1405
|
align: t,
|
|
1263
1406
|
cachedBounds: h,
|
|
1264
1407
|
containerScrollOffset: n,
|
|
@@ -1268,14 +1411,14 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1268
1411
|
itemSize: m
|
|
1269
1412
|
});
|
|
1270
1413
|
if (e) {
|
|
1271
|
-
if (s =
|
|
1414
|
+
if (s = _t({
|
|
1272
1415
|
containerElement: e,
|
|
1273
1416
|
direction: r,
|
|
1274
1417
|
isRtl: i,
|
|
1275
1418
|
scrollOffset: s
|
|
1276
1419
|
}), typeof e.scrollTo != "function") {
|
|
1277
1420
|
let e = w(s);
|
|
1278
|
-
|
|
1421
|
+
Q(_, e) || v(e);
|
|
1279
1422
|
}
|
|
1280
1423
|
return s;
|
|
1281
1424
|
}
|
|
@@ -1286,30 +1429,30 @@ function _t({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1286
1429
|
stopIndexVisible: x
|
|
1287
1430
|
};
|
|
1288
1431
|
}
|
|
1289
|
-
function
|
|
1290
|
-
return
|
|
1432
|
+
function wt(e) {
|
|
1433
|
+
return I(() => e, Object.values(e));
|
|
1291
1434
|
}
|
|
1292
|
-
function
|
|
1435
|
+
function Tt(e, t) {
|
|
1293
1436
|
let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
|
|
1294
|
-
return
|
|
1437
|
+
return Q(n, a) && Q(r, o) && Q(i, s);
|
|
1295
1438
|
}
|
|
1296
|
-
function
|
|
1439
|
+
function Et(e) {
|
|
1297
1440
|
return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
1298
1441
|
}
|
|
1299
|
-
var
|
|
1300
|
-
function
|
|
1301
|
-
let m =
|
|
1442
|
+
var Dt = "data-react-window-index";
|
|
1443
|
+
function Ot({ children: e, className: t, defaultHeight: n = 0, listRef: r, onResize: i, onRowsRendered: a, overscanCount: o = 3, rowComponent: s, rowCount: c, rowHeight: l, rowProps: u, tagName: d = "div", style: f, ...p }) {
|
|
1444
|
+
let m = wt(u), h = I(() => M(s, Tt), [s]), [g, _] = R(null), v = Et(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = Ct({
|
|
1302
1445
|
containerElement: g,
|
|
1303
1446
|
containerStyle: f,
|
|
1304
1447
|
defaultContainerSize: n,
|
|
1305
1448
|
direction: "vertical",
|
|
1306
1449
|
itemCount: c,
|
|
1307
1450
|
itemProps: m,
|
|
1308
|
-
itemSize:
|
|
1451
|
+
itemSize: I(() => v ? (e) => l.getRowHeight(e) ?? l.getAverageRowHeight() : l, [v, l]),
|
|
1309
1452
|
onResize: i,
|
|
1310
1453
|
overscanCount: o
|
|
1311
1454
|
});
|
|
1312
|
-
|
|
1455
|
+
ge(r, () => ({
|
|
1313
1456
|
get element() {
|
|
1314
1457
|
return g;
|
|
1315
1458
|
},
|
|
@@ -1324,12 +1467,12 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1324
1467
|
top: r
|
|
1325
1468
|
});
|
|
1326
1469
|
}
|
|
1327
|
-
}), [g, x]),
|
|
1470
|
+
}), [g, x]), dt(() => {
|
|
1328
1471
|
if (!g) return;
|
|
1329
1472
|
let e = Array.from(g.children).filter((e, t) => {
|
|
1330
1473
|
if (e.hasAttribute("aria-hidden")) return !1;
|
|
1331
1474
|
let n = `${S + t}`;
|
|
1332
|
-
return e.setAttribute(
|
|
1475
|
+
return e.setAttribute(Dt, n), !0;
|
|
1333
1476
|
});
|
|
1334
1477
|
if (v) return l.observeRowElements(e);
|
|
1335
1478
|
}, [
|
|
@@ -1338,7 +1481,7 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1338
1481
|
l,
|
|
1339
1482
|
S,
|
|
1340
1483
|
w
|
|
1341
|
-
]),
|
|
1484
|
+
]), P(() => {
|
|
1342
1485
|
S >= 0 && w >= 0 && a && a({
|
|
1343
1486
|
startIndex: C,
|
|
1344
1487
|
stopIndex: T
|
|
@@ -1353,11 +1496,11 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1353
1496
|
w,
|
|
1354
1497
|
T
|
|
1355
1498
|
]);
|
|
1356
|
-
let E =
|
|
1499
|
+
let E = I(() => {
|
|
1357
1500
|
let e = [];
|
|
1358
1501
|
if (c > 0) for (let t = S; t <= w; t++) {
|
|
1359
1502
|
let n = y(t);
|
|
1360
|
-
e.push(/* @__PURE__ */
|
|
1503
|
+
e.push(/* @__PURE__ */ he(h, {
|
|
1361
1504
|
...m,
|
|
1362
1505
|
ariaAttributes: {
|
|
1363
1506
|
"aria-posinset": t + 1,
|
|
@@ -1384,7 +1527,7 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1384
1527
|
m,
|
|
1385
1528
|
S,
|
|
1386
1529
|
w
|
|
1387
|
-
]), D = /* @__PURE__ */
|
|
1530
|
+
]), D = /* @__PURE__ */ B("div", {
|
|
1388
1531
|
"aria-hidden": !0,
|
|
1389
1532
|
style: {
|
|
1390
1533
|
height: b(),
|
|
@@ -1392,7 +1535,7 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1392
1535
|
zIndex: -1
|
|
1393
1536
|
}
|
|
1394
1537
|
});
|
|
1395
|
-
return
|
|
1538
|
+
return he(d, {
|
|
1396
1539
|
role: "list",
|
|
1397
1540
|
...p,
|
|
1398
1541
|
className: t,
|
|
@@ -1406,47 +1549,47 @@ function St({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1406
1549
|
}
|
|
1407
1550
|
}, E, e, D);
|
|
1408
1551
|
}
|
|
1409
|
-
var
|
|
1552
|
+
var kt = {
|
|
1410
1553
|
divider: "_divider_3wv6u_1",
|
|
1411
1554
|
item: "_item_3wv6u_5",
|
|
1412
1555
|
itemIcon: "_itemIcon_3wv6u_15",
|
|
1413
1556
|
checkIcon: "_checkIcon_3wv6u_19",
|
|
1414
1557
|
stateLabel: "_stateLabel_3wv6u_23"
|
|
1415
|
-
},
|
|
1416
|
-
let l = r[e], u =
|
|
1417
|
-
return /* @__PURE__ */
|
|
1558
|
+
}, At = 44, jt = 8, Mt = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: s, onSelect: c }) => {
|
|
1559
|
+
let l = r[e], u = lt(l.iconUrl, l.type, l.displayName ?? l.id, d.SM), p = l.id === i;
|
|
1560
|
+
return /* @__PURE__ */ B("div", {
|
|
1418
1561
|
style: t,
|
|
1419
1562
|
...n,
|
|
1420
|
-
children: /* @__PURE__ */
|
|
1563
|
+
children: /* @__PURE__ */ B(f, {
|
|
1421
1564
|
type: "button",
|
|
1422
|
-
className: o(
|
|
1423
|
-
iconBefore: /* @__PURE__ */
|
|
1424
|
-
className:
|
|
1565
|
+
className: o(kt.item, "flex h-full w-full items-center gap-3 px-4"),
|
|
1566
|
+
iconBefore: /* @__PURE__ */ B("span", {
|
|
1567
|
+
className: kt.itemIcon,
|
|
1425
1568
|
children: u
|
|
1426
1569
|
}),
|
|
1427
|
-
label: /* @__PURE__ */
|
|
1570
|
+
label: /* @__PURE__ */ V("span", {
|
|
1428
1571
|
className: "flex flex-1 items-center justify-between gap-2",
|
|
1429
|
-
children: [/* @__PURE__ */
|
|
1572
|
+
children: [/* @__PURE__ */ B(k, {
|
|
1430
1573
|
text: l.displayName ?? l.id,
|
|
1431
1574
|
query: s,
|
|
1432
1575
|
maxLines: 1,
|
|
1433
1576
|
className: o(a, "min-w-0 flex-1 text-start")
|
|
1434
|
-
}), p && /* @__PURE__ */
|
|
1577
|
+
}), p && /* @__PURE__ */ B(re, {
|
|
1435
1578
|
size: d.SM,
|
|
1436
|
-
className:
|
|
1579
|
+
className: kt.checkIcon,
|
|
1437
1580
|
"aria-hidden": !0
|
|
1438
1581
|
})]
|
|
1439
1582
|
}),
|
|
1440
1583
|
onClick: () => c(l.id)
|
|
1441
1584
|
})
|
|
1442
1585
|
});
|
|
1443
|
-
},
|
|
1444
|
-
let [h, g] =
|
|
1445
|
-
|
|
1586
|
+
}, Nt = ({ isOpen: e, title: t, closeLabel: n, searchPlaceholder: r = "Search", onClose: i, deployments: a, selectedDeploymentId: s, onSelect: c, loadingLabel: l, errorLabel: u, emptyLabel: d, style: f, titleClassName: p = "dial-body-semi-text", labelClassName: m = "dial-small-text" }) => {
|
|
1587
|
+
let [h, g] = R("");
|
|
1588
|
+
P(() => {
|
|
1446
1589
|
e || g("");
|
|
1447
1590
|
}, [e]);
|
|
1448
|
-
let _ = a && a.length > 0, v = l !== void 0, y = !_ && !v ? u ?? d : void 0, b = _ ?
|
|
1449
|
-
return /* @__PURE__ */
|
|
1591
|
+
let _ = a && a.length > 0, v = l !== void 0, y = !_ && !v ? u ?? d : void 0, b = _ ? ct(a, h) : [];
|
|
1592
|
+
return /* @__PURE__ */ V(H, {
|
|
1450
1593
|
isOpen: e,
|
|
1451
1594
|
title: t,
|
|
1452
1595
|
closeLabel: n,
|
|
@@ -1454,25 +1597,25 @@ var Ct = {
|
|
|
1454
1597
|
style: f,
|
|
1455
1598
|
titleClassName: p,
|
|
1456
1599
|
className: "max-h-[80dvh]",
|
|
1457
|
-
children: [_ && !v && /* @__PURE__ */
|
|
1600
|
+
children: [_ && !v && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("div", {
|
|
1458
1601
|
className: "flex-shrink-0 px-4 py-[10px]",
|
|
1459
|
-
children: /* @__PURE__ */
|
|
1602
|
+
children: /* @__PURE__ */ B(S, {
|
|
1460
1603
|
value: h,
|
|
1461
1604
|
placeholder: r,
|
|
1462
1605
|
size: O.Standard,
|
|
1463
1606
|
onChange: g
|
|
1464
1607
|
})
|
|
1465
|
-
}), /* @__PURE__ */
|
|
1608
|
+
}), /* @__PURE__ */ B("div", { className: o(kt.divider, "h-px flex-shrink-0") })] }), v ? /* @__PURE__ */ B(ot, { loadingLabel: l }) : y ? /* @__PURE__ */ B("div", {
|
|
1466
1609
|
role: "list",
|
|
1467
|
-
className: o(
|
|
1610
|
+
className: o(kt.stateLabel, m, "px-4 py-4"),
|
|
1468
1611
|
children: y
|
|
1469
|
-
}) : /* @__PURE__ */
|
|
1612
|
+
}) : /* @__PURE__ */ B(Ot, {
|
|
1470
1613
|
role: "list",
|
|
1471
1614
|
className: "overflow-y-auto",
|
|
1472
|
-
style: { height: Math.min(b.length,
|
|
1473
|
-
rowComponent:
|
|
1615
|
+
style: { height: Math.min(b.length, jt) * At },
|
|
1616
|
+
rowComponent: Mt,
|
|
1474
1617
|
rowCount: b.length,
|
|
1475
|
-
rowHeight:
|
|
1618
|
+
rowHeight: At,
|
|
1476
1619
|
rowProps: {
|
|
1477
1620
|
items: b,
|
|
1478
1621
|
selectedDeploymentId: s,
|
|
@@ -1484,23 +1627,23 @@ var Ct = {
|
|
|
1484
1627
|
}
|
|
1485
1628
|
})]
|
|
1486
1629
|
});
|
|
1487
|
-
},
|
|
1488
|
-
let [v, y] =
|
|
1630
|
+
}, Pt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, isStreaming: i, isMobile: a, isInputDisabled: s = !1, isDisabled: c = !1, style: l, modelPickerOverlay: u, isPickerOpen: f, onPickerToggle: p, onPickerOpenChange: g }) => {
|
|
1631
|
+
let [v, y] = R(!1), { selectorIcon: b, selectorAriaLabel: x, selectedLabel: S, menuItems: C, menuHeader: w, onOpenChange: T } = ut({
|
|
1489
1632
|
deployments: e,
|
|
1490
1633
|
selectedDeploymentId: t,
|
|
1491
1634
|
onDeploymentChange: n,
|
|
1492
1635
|
modelSelectorLabels: r
|
|
1493
1636
|
});
|
|
1494
1637
|
if (!e) return null;
|
|
1495
|
-
let E = i || c ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, k = /* @__PURE__ */
|
|
1638
|
+
let E = i || c ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, k = /* @__PURE__ */ B(ie, {
|
|
1496
1639
|
size: d.SM,
|
|
1497
|
-
className:
|
|
1640
|
+
className: X.modelSelectorCaret,
|
|
1498
1641
|
"aria-hidden": !0
|
|
1499
1642
|
});
|
|
1500
|
-
return a ? /* @__PURE__ */
|
|
1643
|
+
return a ? /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B(D, {
|
|
1501
1644
|
tooltip: S,
|
|
1502
|
-
children: /* @__PURE__ */
|
|
1503
|
-
icon: /* @__PURE__ */
|
|
1645
|
+
children: /* @__PURE__ */ B(_, {
|
|
1646
|
+
icon: /* @__PURE__ */ V("div", {
|
|
1504
1647
|
className: "flex items-center gap-1",
|
|
1505
1648
|
children: [b, k]
|
|
1506
1649
|
}),
|
|
@@ -1508,16 +1651,16 @@ var Ct = {
|
|
|
1508
1651
|
onClick: () => {
|
|
1509
1652
|
c || y(!0);
|
|
1510
1653
|
},
|
|
1511
|
-
className: o(
|
|
1654
|
+
className: o(X.modelSelectorButton, E)
|
|
1512
1655
|
})
|
|
1513
|
-
}), u ? /* @__PURE__ */
|
|
1656
|
+
}), u ? /* @__PURE__ */ B(H, {
|
|
1514
1657
|
isOpen: v,
|
|
1515
1658
|
title: r?.ariaLabel ?? "Select model",
|
|
1516
1659
|
closeLabel: r?.closeLabel ?? "Close",
|
|
1517
1660
|
onClose: () => y(!1),
|
|
1518
1661
|
style: l,
|
|
1519
1662
|
children: u(() => y(!1))
|
|
1520
|
-
}) : /* @__PURE__ */
|
|
1663
|
+
}) : /* @__PURE__ */ B(Nt, {
|
|
1521
1664
|
isOpen: v,
|
|
1522
1665
|
title: r?.ariaLabel ?? "Select model",
|
|
1523
1666
|
closeLabel: r?.closeLabel ?? "Close",
|
|
@@ -1530,7 +1673,7 @@ var Ct = {
|
|
|
1530
1673
|
errorLabel: r?.error,
|
|
1531
1674
|
emptyLabel: r?.empty,
|
|
1532
1675
|
style: l
|
|
1533
|
-
})] }) : u ? /* @__PURE__ */
|
|
1676
|
+
})] }) : u ? /* @__PURE__ */ B(m, {
|
|
1534
1677
|
placement: "top-end",
|
|
1535
1678
|
matchReferenceWidth: !1,
|
|
1536
1679
|
open: f,
|
|
@@ -1539,24 +1682,24 @@ var Ct = {
|
|
|
1539
1682
|
outsideClosable: !0,
|
|
1540
1683
|
renderOverlay: () => u(() => g?.(!1)),
|
|
1541
1684
|
listClassName: "cp-dropdown-overlay !w-[320px]",
|
|
1542
|
-
children: /* @__PURE__ */
|
|
1685
|
+
children: /* @__PURE__ */ B(D, {
|
|
1543
1686
|
tooltip: S,
|
|
1544
|
-
children: /* @__PURE__ */
|
|
1687
|
+
children: /* @__PURE__ */ V("button", {
|
|
1545
1688
|
type: "button",
|
|
1546
1689
|
"aria-label": x,
|
|
1547
|
-
className: o("flex items-center justify-center gap-1 rounded-md p-2",
|
|
1690
|
+
className: o("flex items-center justify-center gap-1 rounded-md p-2", X.modelSelectorButton, s || i || c ? E : void 0, (s || c) && X.modelSelectorButtonDisabled),
|
|
1548
1691
|
onClick: () => {
|
|
1549
1692
|
!s && !i && !c && p?.();
|
|
1550
1693
|
},
|
|
1551
1694
|
children: [b, k]
|
|
1552
1695
|
})
|
|
1553
1696
|
})
|
|
1554
|
-
}) : /* @__PURE__ */
|
|
1697
|
+
}) : /* @__PURE__ */ B("div", {
|
|
1555
1698
|
className: o(c && E),
|
|
1556
1699
|
"aria-disabled": c || void 0,
|
|
1557
|
-
children: /* @__PURE__ */
|
|
1700
|
+
children: /* @__PURE__ */ B(D, {
|
|
1558
1701
|
tooltip: S,
|
|
1559
|
-
children: /* @__PURE__ */
|
|
1702
|
+
children: /* @__PURE__ */ B(h, {
|
|
1560
1703
|
icon: b,
|
|
1561
1704
|
ariaLabel: x,
|
|
1562
1705
|
items: C,
|
|
@@ -1568,12 +1711,12 @@ var Ct = {
|
|
|
1568
1711
|
size: O.Standard,
|
|
1569
1712
|
caretIcon: k,
|
|
1570
1713
|
iconClassName: s || c ? E : void 0,
|
|
1571
|
-
buttonClassName: o("bg-transparent",
|
|
1714
|
+
buttonClassName: o("bg-transparent", X.modelSelectorButton, (s || c) && E && X.modelSelectorButtonDisabled)
|
|
1572
1715
|
})
|
|
1573
1716
|
})
|
|
1574
1717
|
});
|
|
1575
|
-
},
|
|
1576
|
-
let
|
|
1718
|
+
}, Ft = 160, It = ({ message: e = "", messageRevision: t, onSend: n, onUploadAttachment: r, onStop: i, isStreaming: l = !1, onChange: u, onAttachmentsChange: f, placeholder: p = "Type a message...", ariaLabel: m, attachLabel: h = "Attach file", fileAccept: g, addMenuTitle: v = "Add", menuTitle: y = "Menu", menuCloseLabel: b = "Close", removeLabel: x, retryLabel: S, sendLabel: C, stopLabel: w, micLabel: T = "Record voice message", stopRecordingLabel: E, discardRecordingLabel: D, timerAriaLabel: O, colors: k, typography: A, className: ee, pendingDropFiles: te = [], onDropFilesConsumed: ne, pendingAttachments: re = [], onPendingAttachmentsConsumed: ie, pasteTextThreshold: ae = 4e3, deployments: j, selectedDeploymentId: ce, onDeploymentChange: le, modelSelectorLabels: ue, initialAttachments: de = [], isStacked: fe = !1, hideAddButton: pe = !1, hideAttachFile: me = !1, hideActionBar: he = !1, renderFooterActions: M, isInputDisabled: P = !1, isModelSelectorDisabled: ge = !1, isSendDisabled: F = !1, isAudioMessageSupported: _e = !1, sendOnEnter: ve = ze.Enter, prefixAttachments: ye = [], onRemovePrefixAttachment: xe, chatSettings: Se, toolsMenuItems: Ce, onToolToggle: we, toolsMenuTitle: Ee, toolsBackLabel: De, toolsChipLabels: H, autoFocus: Oe = !1, messageHistory: je, onDialFileSystemClick: Me, dialFileSystemLabel: Fe, validateAttachment: Ie, onAttachmentClick: Le, modelPickerOverlay: Be, maximumAttachmentsAmount: Ve, onAttachmentsLimitExceeded: He, isAttachmentsEnabled: Ue = !0 }) => {
|
|
1719
|
+
let We = s(), [Ge, Ke] = R(!1), U = Ne(je), qe = I(() => a({
|
|
1577
1720
|
"--ci-bg": k?.background,
|
|
1578
1721
|
"--ci-text": k?.text,
|
|
1579
1722
|
"--ci-border": k?.border,
|
|
@@ -1585,192 +1728,206 @@ var Ct = {
|
|
|
1585
1728
|
"--ci-send-bg": k?.sendBackground,
|
|
1586
1729
|
"--ci-send-text": k?.sendText,
|
|
1587
1730
|
"--ci-stop-color": k?.stopColor
|
|
1588
|
-
}), [k]),
|
|
1731
|
+
}), [k]), Je = I(() => Me ? [{
|
|
1589
1732
|
key: "dial-fs",
|
|
1590
|
-
label:
|
|
1591
|
-
icon: /* @__PURE__ */
|
|
1733
|
+
label: Fe ?? "DIAL file system",
|
|
1734
|
+
icon: /* @__PURE__ */ B(oe, {
|
|
1592
1735
|
size: c,
|
|
1593
1736
|
"aria-hidden": !0
|
|
1594
1737
|
}),
|
|
1595
|
-
onClick:
|
|
1596
|
-
}] : [], [
|
|
1738
|
+
onClick: Me
|
|
1739
|
+
}] : [], [Me, Fe]), { message: W, setMessage: G, textareaRef: K, isMultiLine: Xe } = Pe({
|
|
1597
1740
|
messageProp: e,
|
|
1598
1741
|
messageRevision: t
|
|
1599
|
-
}), { attachments: q, buildAttachments: J, addAttachments:
|
|
1742
|
+
}), { attachments: q, buildAttachments: J, addAttachments: Qe, resetAttachments: $e, handleRemove: Y, handleRetry: et, handleExpand: it, hasBlockedAttachments: at } = ke({
|
|
1600
1743
|
initialAttachments: de,
|
|
1601
1744
|
onUploadAttachment: r,
|
|
1602
1745
|
onAttachmentsChange: f,
|
|
1603
|
-
validateAttachment:
|
|
1746
|
+
validateAttachment: Ie,
|
|
1604
1747
|
pendingDropFiles: te,
|
|
1605
1748
|
onDropFilesConsumed: ne,
|
|
1606
1749
|
pendingAttachments: re,
|
|
1607
1750
|
onPendingAttachmentsConsumed: ie,
|
|
1608
|
-
onExpandPastedText:
|
|
1609
|
-
|
|
1610
|
-
}, [
|
|
1611
|
-
maximumAttachmentsAmount:
|
|
1612
|
-
baseAttachmentsAmount:
|
|
1613
|
-
onAttachmentsLimitExceeded:
|
|
1614
|
-
}), { state:
|
|
1615
|
-
|
|
1616
|
-
}, [
|
|
1617
|
-
if (
|
|
1618
|
-
let e =
|
|
1619
|
-
|
|
1751
|
+
onExpandPastedText: N((e) => {
|
|
1752
|
+
G((t) => t ? `${t}\n${e}` : e);
|
|
1753
|
+
}, [G]),
|
|
1754
|
+
maximumAttachmentsAmount: Ve,
|
|
1755
|
+
baseAttachmentsAmount: ye.length,
|
|
1756
|
+
onAttachmentsLimitExceeded: He
|
|
1757
|
+
}), { state: ot, analyserNodeRef: st, elapsedSeconds: ct, errorMessage: lt, startRecording: ut, stopRecording: dt, discardRecording: ft } = Re({ onAttachAudio: N((e) => {
|
|
1758
|
+
Qe(J([e]));
|
|
1759
|
+
}, [Qe, J]) }), pt = L(null), mt = L(null), { handlePaste: ht } = Te(Qe, Ue ? ae : Infinity), gt = W.trim().length > 0 || q.length > 0, _t = gt && !at && !F, { shouldRender: Z, isExiting: Q, instanceKey: vt } = Ae(!l && gt, Ft), yt = (Ce?.some((e) => e.isSelected) ?? !1) && we != null, $ = fe || q.length > 0 || W.includes("\n") || Xe || yt, bt = j === void 0 || ce != null, xt = async () => {
|
|
1760
|
+
if (F) return;
|
|
1761
|
+
let e = W, t = q;
|
|
1762
|
+
G(""), U.reset();
|
|
1620
1763
|
try {
|
|
1621
1764
|
await n?.(e, t), t.forEach((e) => {
|
|
1622
1765
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
1623
|
-
}),
|
|
1766
|
+
}), $e([]);
|
|
1624
1767
|
} catch {
|
|
1625
|
-
|
|
1768
|
+
G(e), $e(t);
|
|
1626
1769
|
}
|
|
1627
|
-
},
|
|
1770
|
+
}, St = (e) => {
|
|
1628
1771
|
if (!e.nativeEvent.isComposing && !P && !l && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
|
|
1629
|
-
let t = e.currentTarget.selectionStart ?? 0, n =
|
|
1772
|
+
let t = e.currentTarget.selectionStart ?? 0, n = U.navigate(e.key === "ArrowUp" ? "up" : "down", W, t);
|
|
1630
1773
|
if (n !== null) {
|
|
1631
|
-
e.preventDefault(),
|
|
1774
|
+
e.preventDefault(), G(n);
|
|
1632
1775
|
return;
|
|
1633
1776
|
}
|
|
1634
1777
|
}
|
|
1635
|
-
e.key === "Enter" && (
|
|
1636
|
-
},
|
|
1778
|
+
e.key === "Enter" && (ve === ze.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey) && (e.preventDefault(), !l && _t && bt && !P && xt());
|
|
1779
|
+
}, Ct = (e) => {
|
|
1637
1780
|
let t = Array.from(e.target.files ?? []);
|
|
1638
1781
|
if (t.length === 0) return;
|
|
1639
1782
|
let n = J(t);
|
|
1640
|
-
e.target.value = "",
|
|
1783
|
+
e.target.value = "", Qe(n);
|
|
1641
1784
|
};
|
|
1642
|
-
if (
|
|
1643
|
-
state:
|
|
1644
|
-
analyserNodeRef:
|
|
1645
|
-
elapsedSeconds:
|
|
1646
|
-
errorMessage:
|
|
1647
|
-
onStop:
|
|
1648
|
-
onDiscard:
|
|
1785
|
+
if (ot !== "idle") return /* @__PURE__ */ B(tt, {
|
|
1786
|
+
state: ot,
|
|
1787
|
+
analyserNodeRef: st,
|
|
1788
|
+
elapsedSeconds: ct,
|
|
1789
|
+
errorMessage: lt,
|
|
1790
|
+
onStop: dt,
|
|
1791
|
+
onDiscard: ft,
|
|
1649
1792
|
stopLabel: E,
|
|
1650
1793
|
discardLabel: D,
|
|
1651
1794
|
timerLabel: O,
|
|
1652
|
-
style:
|
|
1653
|
-
className:
|
|
1795
|
+
style: qe,
|
|
1796
|
+
className: ee
|
|
1654
1797
|
});
|
|
1655
|
-
let
|
|
1656
|
-
className: o(
|
|
1657
|
-
ref:
|
|
1658
|
-
autoFocus:
|
|
1659
|
-
value:
|
|
1798
|
+
let wt = /* @__PURE__ */ B("textarea", {
|
|
1799
|
+
className: o(X.textarea, A?.fontClassName, "max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent outline-none [field-sizing:content]"),
|
|
1800
|
+
ref: K,
|
|
1801
|
+
autoFocus: Oe,
|
|
1802
|
+
value: W,
|
|
1660
1803
|
onChange: (e) => {
|
|
1661
|
-
|
|
1804
|
+
G(e.target.value), U.notifyChange(), u?.(e.target.value);
|
|
1662
1805
|
},
|
|
1663
|
-
onKeyDown:
|
|
1664
|
-
onPaste:
|
|
1806
|
+
onKeyDown: St,
|
|
1807
|
+
onPaste: ht,
|
|
1665
1808
|
placeholder: p,
|
|
1666
1809
|
"aria-label": m,
|
|
1667
1810
|
disabled: P,
|
|
1668
1811
|
rows: 1
|
|
1669
1812
|
});
|
|
1670
|
-
return /* @__PURE__ */
|
|
1671
|
-
ref:
|
|
1672
|
-
style:
|
|
1673
|
-
className: o(
|
|
1674
|
-
children: [(
|
|
1675
|
-
attachments: [...
|
|
1813
|
+
return /* @__PURE__ */ V("div", {
|
|
1814
|
+
ref: mt,
|
|
1815
|
+
style: qe,
|
|
1816
|
+
className: o(X.wrapper, P && X.wrapperDisabled, "flex min-h-[56px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border", q.length > 6 ? "py-3 ps-3" : "p-3", ee),
|
|
1817
|
+
children: [(ye.length > 0 || q.length > 0) && /* @__PURE__ */ B(be, {
|
|
1818
|
+
attachments: [...ye, ...q],
|
|
1676
1819
|
onRemove: (e) => {
|
|
1677
|
-
|
|
1820
|
+
ye.some((t) => t.id === e) ? xe?.(e) : Y(e);
|
|
1678
1821
|
},
|
|
1679
|
-
onRetry:
|
|
1680
|
-
onExpand:
|
|
1822
|
+
onRetry: et,
|
|
1823
|
+
onExpand: it,
|
|
1681
1824
|
labels: {
|
|
1682
1825
|
removeLabel: x,
|
|
1683
1826
|
retryLabel: S
|
|
1684
1827
|
},
|
|
1685
|
-
onAttachmentClick:
|
|
1686
|
-
let t = [...
|
|
1687
|
-
t != null &&
|
|
1828
|
+
onAttachmentClick: Le == null ? void 0 : (e) => {
|
|
1829
|
+
let t = [...ye, ...q].find((t) => t.id === e);
|
|
1830
|
+
t != null && Le(t);
|
|
1688
1831
|
}
|
|
1689
|
-
}), he ?
|
|
1690
|
-
className: o("flex items-center gap-2",
|
|
1832
|
+
}), he ? $ && wt : /* @__PURE__ */ V("div", {
|
|
1833
|
+
className: o("flex items-center gap-2", $ ? "flex-wrap" : "flex-wrap desktop:flex-nowrap"),
|
|
1691
1834
|
children: [
|
|
1692
|
-
!pe && /* @__PURE__ */
|
|
1693
|
-
className: o("order-2
|
|
1694
|
-
children: [/* @__PURE__ */
|
|
1695
|
-
ref:
|
|
1835
|
+
!pe && /* @__PURE__ */ V("div", {
|
|
1836
|
+
className: o("flex", "order-2", !$ && "desktop:order-1"),
|
|
1837
|
+
children: [/* @__PURE__ */ B("input", {
|
|
1838
|
+
ref: pt,
|
|
1696
1839
|
type: "file",
|
|
1697
1840
|
multiple: !0,
|
|
1698
1841
|
accept: g,
|
|
1699
1842
|
className: "sr-only",
|
|
1700
1843
|
"aria-hidden": !0,
|
|
1701
1844
|
tabIndex: -1,
|
|
1702
|
-
onChange:
|
|
1703
|
-
}), /* @__PURE__ */
|
|
1704
|
-
onAttachClick: me ? void 0 : () =>
|
|
1845
|
+
onChange: Ct
|
|
1846
|
+
}), /* @__PURE__ */ B(Ye, {
|
|
1847
|
+
onAttachClick: me ? void 0 : () => pt.current?.click(),
|
|
1705
1848
|
attachLabel: h,
|
|
1706
1849
|
addMenuTitle: v,
|
|
1707
1850
|
menuTitle: y,
|
|
1708
1851
|
menuCloseLabel: b,
|
|
1709
|
-
style:
|
|
1852
|
+
style: qe,
|
|
1710
1853
|
isDisabled: P,
|
|
1711
1854
|
chatSettings: Se,
|
|
1712
|
-
extraMenuItems:
|
|
1855
|
+
extraMenuItems: Je,
|
|
1856
|
+
toolsMenuItems: Ce,
|
|
1857
|
+
onToolToggle: we,
|
|
1858
|
+
toolsMenuTitle: Ee,
|
|
1859
|
+
toolsBackLabel: De
|
|
1713
1860
|
})]
|
|
1714
1861
|
}),
|
|
1715
|
-
/* @__PURE__ */
|
|
1716
|
-
className:
|
|
1717
|
-
children:
|
|
1862
|
+
$ && yt && /* @__PURE__ */ B("div", {
|
|
1863
|
+
className: "order-3 min-w-0 flex-1",
|
|
1864
|
+
children: /* @__PURE__ */ B(Ze, {
|
|
1865
|
+
items: Ce ?? [],
|
|
1866
|
+
onToolToggle: we,
|
|
1867
|
+
isMobile: We,
|
|
1868
|
+
countLabel: H?.countLabel,
|
|
1869
|
+
removeLabel: H?.removeLabel
|
|
1870
|
+
})
|
|
1718
1871
|
}),
|
|
1719
1872
|
/* @__PURE__ */ B("div", {
|
|
1720
|
-
className: o("flex
|
|
1721
|
-
children:
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1873
|
+
className: o("order-1 flex w-full min-w-0 items-center self-stretch", !$ && "desktop:order-2 desktop:w-auto desktop:flex-1"),
|
|
1874
|
+
children: wt
|
|
1875
|
+
}),
|
|
1876
|
+
/* @__PURE__ */ V("div", {
|
|
1877
|
+
className: o("flex flex-shrink-0 items-center gap-2", $ && yt ? "order-4" : "order-3", "ms-auto", !$ && "desktop:ms-0"),
|
|
1878
|
+
children: [M ? M({
|
|
1879
|
+
canSend: _t,
|
|
1880
|
+
onSend: xt
|
|
1881
|
+
}) : /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B(Pt, {
|
|
1725
1882
|
deployments: j,
|
|
1726
1883
|
selectedDeploymentId: ce,
|
|
1727
1884
|
onDeploymentChange: le,
|
|
1728
1885
|
modelSelectorLabels: ue,
|
|
1729
1886
|
isStreaming: l,
|
|
1730
|
-
isMobile:
|
|
1887
|
+
isMobile: We,
|
|
1731
1888
|
isInputDisabled: P,
|
|
1732
1889
|
isDisabled: ge,
|
|
1733
|
-
style:
|
|
1734
|
-
modelPickerOverlay:
|
|
1735
|
-
isPickerOpen:
|
|
1736
|
-
onPickerToggle: () =>
|
|
1737
|
-
onPickerOpenChange:
|
|
1738
|
-
}), l && i ? /* @__PURE__ */
|
|
1890
|
+
style: qe,
|
|
1891
|
+
modelPickerOverlay: Be,
|
|
1892
|
+
isPickerOpen: Ge,
|
|
1893
|
+
onPickerToggle: () => Ke((e) => !e),
|
|
1894
|
+
onPickerOpenChange: Ke
|
|
1895
|
+
}), l && i ? /* @__PURE__ */ B(rt, {
|
|
1739
1896
|
onStop: i,
|
|
1740
1897
|
ariaLabel: w
|
|
1741
|
-
}) : !l &&
|
|
1742
|
-
onSend:
|
|
1743
|
-
isDisabled: !
|
|
1898
|
+
}) : !l && Z && /* @__PURE__ */ B(nt, {
|
|
1899
|
+
onSend: xt,
|
|
1900
|
+
isDisabled: !bt || at || F,
|
|
1744
1901
|
ariaLabel: C,
|
|
1745
|
-
isExiting:
|
|
1746
|
-
},
|
|
1747
|
-
icon: /* @__PURE__ */
|
|
1902
|
+
isExiting: Q
|
|
1903
|
+
}, vt)] }), _e && !Q && /* @__PURE__ */ B(_, {
|
|
1904
|
+
icon: /* @__PURE__ */ B(se, {
|
|
1748
1905
|
size: d.LG,
|
|
1749
1906
|
"aria-hidden": !0
|
|
1750
1907
|
}),
|
|
1751
1908
|
"aria-label": T,
|
|
1752
1909
|
className: "size-8 flex-shrink-0",
|
|
1753
|
-
onClick:
|
|
1910
|
+
onClick: ut,
|
|
1754
1911
|
disabled: P || l
|
|
1755
1912
|
})]
|
|
1756
1913
|
})
|
|
1757
1914
|
]
|
|
1758
1915
|
})]
|
|
1759
1916
|
});
|
|
1760
|
-
},
|
|
1917
|
+
}, Lt = { welcome: "_welcome_n2ph8_1" }, Rt = ({ isStreaming: e = !1, placeholder: t = "Type a prompt or use \"/\" to select one", welcomeText: n, styles: r, className: i, inputClassName: s, isInputDisabled: c = !1, ...l }) => {
|
|
1761
1918
|
let { colors: u, typography: d } = r ?? {};
|
|
1762
|
-
return /* @__PURE__ */
|
|
1919
|
+
return /* @__PURE__ */ V("div", {
|
|
1763
1920
|
style: a({
|
|
1764
1921
|
"--ci-root-bg": u?.background,
|
|
1765
1922
|
"--ci-welcome-color": u?.welcomeText
|
|
1766
1923
|
}),
|
|
1767
1924
|
className: o("relative flex w-full flex-col items-center gap-6 px-4 py-5 desktop:p-5", i),
|
|
1768
|
-
children: [n && /* @__PURE__ */
|
|
1769
|
-
className: o(
|
|
1925
|
+
children: [n && /* @__PURE__ */ B("h1", {
|
|
1926
|
+
className: o(Lt.welcome, "m-0 text-center", d?.welcomeClassName),
|
|
1770
1927
|
children: n
|
|
1771
|
-
}), /* @__PURE__ */
|
|
1928
|
+
}), /* @__PURE__ */ B("div", {
|
|
1772
1929
|
className: "relative w-full max-w-[748px]",
|
|
1773
|
-
children: /* @__PURE__ */
|
|
1930
|
+
children: /* @__PURE__ */ B(It, {
|
|
1774
1931
|
placeholder: t,
|
|
1775
1932
|
isStreaming: e,
|
|
1776
1933
|
isInputDisabled: c,
|
|
@@ -1781,32 +1938,32 @@ var Ct = {
|
|
|
1781
1938
|
})
|
|
1782
1939
|
})]
|
|
1783
1940
|
});
|
|
1784
|
-
},
|
|
1785
|
-
let
|
|
1786
|
-
|
|
1941
|
+
}, zt = ({ message: e, initialAttachments: t = [], onCancel: n, onSave: i, onUploadAttachment: a, cancelLabel: s = "Cancel", saveLabel: l = "Save & Submit", ariaLabel: u, removeLabel: d, retryLabel: f, addMenuTitle: p = "Add", attachLabel: m = "Attach file", menuTitle: h = "Menu", menuCloseLabel: g = "Close", className: _, pendingDropFiles: v, onDropFilesConsumed: y, validateAttachment: b, isAttachmentsEnabled: x, hideAttachFile: S = !1, fileAccept: C, maximumAttachmentsAmount: w, onAttachmentsLimitExceeded: T, onDialFileSystemClick: E, dialFileSystemLabel: D, pendingAttachments: O, onPendingAttachmentsConsumed: k, onAttachmentClick: A }) => {
|
|
1942
|
+
let ee = L(null), [te, ne] = R([]);
|
|
1943
|
+
P(() => {
|
|
1787
1944
|
v?.length && (ne(v), y?.());
|
|
1788
1945
|
}, [v, y]);
|
|
1789
|
-
let [re, ie] =
|
|
1946
|
+
let [re, ie] = R(e ?? ""), [ae, se] = R([]), [j, ce] = R(t), le = ae.some((e) => e.status === r.Loading || e.status === r.Error), ue = (re.trim().length > 0 || ae.length > 0 || j.length > 0) && !le, de = (e) => {
|
|
1790
1947
|
ce((t) => t.filter((t) => t.id !== e));
|
|
1791
|
-
}, fe =
|
|
1948
|
+
}, fe = N((e, t) => {
|
|
1792
1949
|
i(e, j, t);
|
|
1793
1950
|
}, [j, i]), pe = () => {
|
|
1794
1951
|
ue && fe(re, ae);
|
|
1795
|
-
}, me =
|
|
1952
|
+
}, me = N(() => ne([]), []), he = N((e) => {
|
|
1796
1953
|
let t = Array.from(e.target.files ?? []);
|
|
1797
1954
|
t.length !== 0 && (e.target.value = "", ne(t));
|
|
1798
|
-
}, []),
|
|
1955
|
+
}, []), M = I(() => E ? [{
|
|
1799
1956
|
key: "dial-fs",
|
|
1800
1957
|
label: D ?? "DIAL file system",
|
|
1801
|
-
icon: /* @__PURE__ */
|
|
1958
|
+
icon: /* @__PURE__ */ B(oe, {
|
|
1802
1959
|
size: c,
|
|
1803
1960
|
"aria-hidden": !0
|
|
1804
1961
|
}),
|
|
1805
1962
|
onClick: E
|
|
1806
1963
|
}] : [], [E, D]);
|
|
1807
|
-
return /* @__PURE__ */
|
|
1964
|
+
return /* @__PURE__ */ V("div", {
|
|
1808
1965
|
className: o("flex w-full flex-col gap-2", _),
|
|
1809
|
-
children: [/* @__PURE__ */
|
|
1966
|
+
children: [/* @__PURE__ */ B(It, {
|
|
1810
1967
|
message: e,
|
|
1811
1968
|
ariaLabel: u,
|
|
1812
1969
|
isStacked: !0,
|
|
@@ -1828,13 +1985,13 @@ var Ct = {
|
|
|
1828
1985
|
onAttachmentsLimitExceeded: T,
|
|
1829
1986
|
pendingAttachments: O,
|
|
1830
1987
|
onPendingAttachmentsConsumed: k,
|
|
1831
|
-
onAttachmentClick:
|
|
1832
|
-
}), /* @__PURE__ */
|
|
1988
|
+
onAttachmentClick: A
|
|
1989
|
+
}), /* @__PURE__ */ V("div", {
|
|
1833
1990
|
className: "flex items-center justify-between",
|
|
1834
|
-
children: [/* @__PURE__ */
|
|
1991
|
+
children: [/* @__PURE__ */ B("div", {
|
|
1835
1992
|
className: "flex",
|
|
1836
|
-
children: !S && /* @__PURE__ */
|
|
1837
|
-
ref:
|
|
1993
|
+
children: !S && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("input", {
|
|
1994
|
+
ref: ee,
|
|
1838
1995
|
type: "file",
|
|
1839
1996
|
multiple: !0,
|
|
1840
1997
|
accept: C,
|
|
@@ -1842,20 +1999,20 @@ var Ct = {
|
|
|
1842
1999
|
"aria-hidden": !0,
|
|
1843
2000
|
tabIndex: -1,
|
|
1844
2001
|
onChange: he
|
|
1845
|
-
}), /* @__PURE__ */
|
|
1846
|
-
onAttachClick: () =>
|
|
2002
|
+
}), /* @__PURE__ */ B(Ye, {
|
|
2003
|
+
onAttachClick: () => ee.current?.click(),
|
|
1847
2004
|
attachLabel: m,
|
|
1848
2005
|
addMenuTitle: p,
|
|
1849
2006
|
menuTitle: h,
|
|
1850
2007
|
menuCloseLabel: g,
|
|
1851
|
-
extraMenuItems:
|
|
2008
|
+
extraMenuItems: M
|
|
1852
2009
|
})] })
|
|
1853
|
-
}), /* @__PURE__ */
|
|
2010
|
+
}), /* @__PURE__ */ V("div", {
|
|
1854
2011
|
className: "flex gap-2",
|
|
1855
|
-
children: [/* @__PURE__ */
|
|
2012
|
+
children: [/* @__PURE__ */ B(Ge, {
|
|
1856
2013
|
label: s,
|
|
1857
2014
|
onClick: n
|
|
1858
|
-
}), /* @__PURE__ */
|
|
2015
|
+
}), /* @__PURE__ */ B(We, {
|
|
1859
2016
|
label: l,
|
|
1860
2017
|
onClick: pe,
|
|
1861
2018
|
disabled: !ue
|
|
@@ -1865,4 +2022,4 @@ var Ct = {
|
|
|
1865
2022
|
});
|
|
1866
2023
|
};
|
|
1867
2024
|
//#endregion
|
|
1868
|
-
export { _e as AttachmentCard, ve as AttachmentGroup, ye as AttachmentTray,
|
|
2025
|
+
export { _e as AttachmentCard, ve as AttachmentGroup, ye as AttachmentTray, H as BottomSheetShell, W as ChatSettingsModal, Rt as ConversationInput, zt as EditMessageInput, xe as FileDndOverlay, It as Input, ze as SendOnEnter, we as getAttachmentIcon };
|