@epam/ai-dial-conversation-input 1.1.0-dev.75 → 1.1.0-dev.78
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/BottomSheet/BottomSheet.d.ts +16 -0
- package/components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/components/BottomSheetShell/BottomSheetShell.d.ts +13 -0
- package/components/BottomSheetShell/BottomSheetShell.d.ts.map +1 -1
- package/components/ConversationInput/ConversationInput.d.ts.map +1 -1
- package/components/Input/Buttons/SendButton.d.ts.map +1 -1
- package/components/Input/Buttons/StopButton.d.ts.map +1 -1
- package/components/Input/Input.d.ts.map +1 -1
- package/components/Input/ModelSelectorControl.d.ts +8 -7
- package/components/Input/ModelSelectorControl.d.ts.map +1 -1
- package/components/ModelSelectorBottomSheet/ModelSelectorBottomSheet.d.ts +20 -0
- package/components/ModelSelectorBottomSheet/ModelSelectorBottomSheet.d.ts.map +1 -1
- package/components/SelectedToolsChips/SelectedToolsChips.d.ts +24 -0
- package/components/SelectedToolsChips/SelectedToolsChips.d.ts.map +1 -1
- package/components/VoiceBar/VoiceBar.d.ts.map +1 -1
- package/index.css +1 -1
- package/index.js +572 -542
- package/models/ConversationInput.d.ts +0 -2
- package/models/ConversationInput.d.ts.map +1 -1
- package/models/Input.d.ts +14 -12
- package/models/Input.d.ts.map +1 -1
- package/package.json +5 -5
package/index.js
CHANGED
|
@@ -1,88 +1,101 @@
|
|
|
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, Button as l, DIAL_ICON_SIZE as u, DialCloseButton as d, DialDropdown as f, DialDropdownIcon as p, DialErrorText as m, DialGhostIconButton as h, DialInput as g, DialPopup as _, DialRadioGroup as v, DialSearch as y, DialSkeleton as b, DialSkeletonVariant as x, DialSlider as S, DialTag as C, DialTooltip as w, ElementSize as T,
|
|
3
|
-
import { IconArrowLeft as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { createElement as
|
|
2
|
+
import { BASE_ICON_SIZE as c, Button as l, DIAL_ICON_SIZE as u, DialCloseButton as d, DialDropdown as f, DialDropdownIcon as p, DialErrorText as m, DialGhostIconButton as h, DialInput as g, DialPopup as _, DialRadioGroup as v, DialSearch as y, DialSkeleton as b, DialSkeletonVariant as x, DialSlider as S, DialTag as C, DialTooltip as w, ElementSize as T, GhostIconButton as E, Highlight as D, NeutralButton as O, PopupSize as k, PrimaryButton as A, PrimaryIconButton as ee, RadioGroupOrientation as te, StaticIconButton as ne } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { IconArrowLeft as re, IconArrowNarrowRight as ie, IconCheck as j, IconChevronDown as ae, IconChevronRight as M, IconFile as oe, IconMicrophone as se, IconPaperclip as ce, IconPlayerStopFilled as le, IconPlaystationSquare as N, 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 P, memo as he, useCallback as F, useEffect as I, useImperativeHandle as ge, useLayoutEffect as _e, useMemo as L, useRef as R, useState as z } from "react";
|
|
6
6
|
import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
|
|
7
|
-
import { AttachmentCard as
|
|
7
|
+
import { AttachmentCard as U, 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
|
+
I(() => {
|
|
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]), I(() => {
|
|
17
17
|
if (e) return document.body.style.overflow = "hidden", () => {
|
|
18
18
|
document.body.style.overflow = "";
|
|
19
19
|
};
|
|
20
20
|
}, [e]);
|
|
21
|
-
},
|
|
22
|
-
backdrop: "
|
|
23
|
-
sheet: "
|
|
24
|
-
"slide-up": "_slide-
|
|
25
|
-
title: "
|
|
26
|
-
divider: "
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
21
|
+
}, De = {
|
|
22
|
+
backdrop: "_backdrop_qmzqj_9",
|
|
23
|
+
sheet: "_sheet_qmzqj_13",
|
|
24
|
+
"slide-up": "_slide-up_qmzqj_1",
|
|
25
|
+
title: "_title_qmzqj_18",
|
|
26
|
+
divider: "_divider_qmzqj_22"
|
|
27
|
+
}, W = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: s, "aria-label": c, style: l, titleClassName: f = "dial-body-semi-text", className: p, colors: m, children: g }) => {
|
|
28
|
+
if (Ee(e, r), !e || typeof document > "u") return null;
|
|
29
|
+
let _ = a({
|
|
30
|
+
"--ci-backdrop": m?.backdrop,
|
|
31
|
+
"--ci-sheet-bg": m?.sheetBg,
|
|
32
|
+
"--ci-sheet-text": m?.sheetText,
|
|
33
|
+
"--ci-sheet-divider": m?.divider
|
|
34
|
+
});
|
|
35
|
+
return me(/* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("div", {
|
|
36
|
+
className: o(De.backdrop, "fixed inset-0 z-[55]"),
|
|
37
|
+
style: _,
|
|
38
|
+
onPointerDown: r,
|
|
39
|
+
"aria-hidden": !0
|
|
40
|
+
}), /* @__PURE__ */ H("div", {
|
|
41
|
+
role: "dialog",
|
|
42
|
+
"aria-modal": !0,
|
|
43
|
+
"aria-label": t ?? c,
|
|
44
|
+
style: {
|
|
45
|
+
..._,
|
|
46
|
+
...l
|
|
47
|
+
},
|
|
48
|
+
className: o(De.sheet, "fixed inset-x-0 bottom-0 z-[60] flex max-h-[85dvh] flex-col", p),
|
|
49
|
+
children: [t != null && /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ H("div", {
|
|
50
|
+
className: "relative flex h-[60px] flex-shrink-0 items-center justify-center px-4",
|
|
51
|
+
children: [
|
|
52
|
+
i && /* @__PURE__ */ V("div", {
|
|
53
|
+
className: "absolute start-4",
|
|
54
|
+
children: /* @__PURE__ */ V(h, {
|
|
55
|
+
icon: /* @__PURE__ */ V(re, {
|
|
56
|
+
size: u.LG,
|
|
57
|
+
stroke: 1.5,
|
|
58
|
+
className: "rtl:scale-x-[-1]"
|
|
59
|
+
}),
|
|
60
|
+
"aria-label": s,
|
|
61
|
+
onClick: i
|
|
62
|
+
})
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ V("span", {
|
|
65
|
+
className: o(De.title, f),
|
|
66
|
+
children: t
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ V("div", {
|
|
69
|
+
className: "absolute end-4 m-2",
|
|
70
|
+
children: /* @__PURE__ */ V(d, {
|
|
71
|
+
ariaLabel: n,
|
|
44
72
|
size: u.LG,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}),
|
|
48
|
-
"aria-label": a,
|
|
49
|
-
onClick: i
|
|
50
|
-
})
|
|
51
|
-
}),
|
|
52
|
-
/* @__PURE__ */ V("span", {
|
|
53
|
-
className: o(Ee.title, l),
|
|
54
|
-
children: t
|
|
55
|
-
}),
|
|
56
|
-
/* @__PURE__ */ V("div", {
|
|
57
|
-
className: "absolute end-4 m-2",
|
|
58
|
-
children: /* @__PURE__ */ V(d, {
|
|
59
|
-
ariaLabel: n,
|
|
60
|
-
size: u.LG,
|
|
61
|
-
onClose: r
|
|
73
|
+
onClose: r
|
|
74
|
+
})
|
|
62
75
|
})
|
|
63
|
-
|
|
64
|
-
]
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
})]
|
|
69
|
-
}
|
|
76
|
+
]
|
|
77
|
+
}), /* @__PURE__ */ V("div", { className: o(De.divider, "h-px flex-shrink-0") })] }), /* @__PURE__ */ V("div", {
|
|
78
|
+
className: "overflow-y-auto",
|
|
79
|
+
children: g
|
|
80
|
+
})]
|
|
81
|
+
})] }), document.body);
|
|
82
|
+
}, Oe = async (e, t, n) => {
|
|
70
83
|
let r = 6e4 / t, i = [];
|
|
71
84
|
for (let t = 0; t < e.length; t++) t > 0 && await new Promise((e) => setTimeout(e, r)), i.push(n(e[t]));
|
|
72
85
|
await Promise.allSettled(i);
|
|
73
|
-
},
|
|
86
|
+
}, 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
87
|
let [h, g] = z(n), _ = R(h);
|
|
75
|
-
|
|
88
|
+
I(() => {
|
|
76
89
|
_.current = h;
|
|
77
|
-
}, [h]),
|
|
90
|
+
}, [h]), I(() => () => {
|
|
78
91
|
_.current.forEach((e) => {
|
|
79
92
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
80
93
|
});
|
|
81
94
|
}, []);
|
|
82
|
-
let v =
|
|
95
|
+
let v = F((e) => e.map((e) => {
|
|
83
96
|
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
97
|
return {
|
|
85
|
-
id:
|
|
98
|
+
id: Ce(),
|
|
86
99
|
name: e.name,
|
|
87
100
|
contentType: e.type,
|
|
88
101
|
file: e,
|
|
@@ -92,25 +105,25 @@ var Te = (e, t) => {
|
|
|
92
105
|
playUrl: o
|
|
93
106
|
};
|
|
94
107
|
}), []), y = R(a);
|
|
95
|
-
|
|
108
|
+
I(() => {
|
|
96
109
|
y.current = a;
|
|
97
110
|
}, [a]);
|
|
98
|
-
let b = R(!0), x =
|
|
111
|
+
let b = R(!0), x = F((e) => {
|
|
99
112
|
g((t) => {
|
|
100
113
|
let n = e(t);
|
|
101
114
|
return n === t ? t : n;
|
|
102
115
|
});
|
|
103
116
|
}, []);
|
|
104
|
-
|
|
117
|
+
I(() => {
|
|
105
118
|
if (b.current) {
|
|
106
119
|
b.current = !1;
|
|
107
120
|
return;
|
|
108
121
|
}
|
|
109
122
|
y.current?.(h);
|
|
110
123
|
}, [h]);
|
|
111
|
-
let S =
|
|
124
|
+
let S = F((e) => {
|
|
112
125
|
g(e);
|
|
113
|
-
}, []), C =
|
|
126
|
+
}, []), C = F(async (t) => {
|
|
114
127
|
if (i) {
|
|
115
128
|
x((e) => e.map((e) => e.id === t.id ? {
|
|
116
129
|
...e,
|
|
@@ -132,7 +145,7 @@ var Te = (e, t) => {
|
|
|
132
145
|
} : e));
|
|
133
146
|
}
|
|
134
147
|
}
|
|
135
|
-
}, [i, x]), w =
|
|
148
|
+
}, [i, x]), w = F((e, t = !0) => {
|
|
136
149
|
let n = new Set(_.current.map((e) => e.id)), i = e.filter((e) => !n.has(e.id));
|
|
137
150
|
if (i.length !== 0) {
|
|
138
151
|
if (f != null && f > 0 && Number.isFinite(f)) {
|
|
@@ -153,7 +166,7 @@ var Te = (e, t) => {
|
|
|
153
166
|
status: r.Error,
|
|
154
167
|
errorReason: n
|
|
155
168
|
} : e));
|
|
156
|
-
}),
|
|
169
|
+
}), Oe(e, Se, C);
|
|
157
170
|
}
|
|
158
171
|
}
|
|
159
172
|
}, [
|
|
@@ -164,20 +177,20 @@ var Te = (e, t) => {
|
|
|
164
177
|
C,
|
|
165
178
|
o
|
|
166
179
|
]);
|
|
167
|
-
|
|
180
|
+
I(() => {
|
|
168
181
|
s.length !== 0 && (w(v(s)), c?.());
|
|
169
182
|
}, [
|
|
170
183
|
w,
|
|
171
184
|
v,
|
|
172
185
|
c,
|
|
173
186
|
s
|
|
174
|
-
]),
|
|
187
|
+
]), I(() => {
|
|
175
188
|
l.length !== 0 && (w(l, !1), u?.());
|
|
176
189
|
}, [
|
|
177
190
|
w,
|
|
178
191
|
u,
|
|
179
192
|
l
|
|
180
|
-
]),
|
|
193
|
+
]), I(() => {
|
|
181
194
|
if (!o) return;
|
|
182
195
|
let t = !1, n = [], i = _.current.map((i) => {
|
|
183
196
|
if (i.status === r.Loading) return i;
|
|
@@ -204,7 +217,7 @@ var Te = (e, t) => {
|
|
|
204
217
|
x,
|
|
205
218
|
C
|
|
206
219
|
]);
|
|
207
|
-
let T =
|
|
220
|
+
let T = F((e) => {
|
|
208
221
|
x((t) => {
|
|
209
222
|
let n = t.find((t) => t.id === e);
|
|
210
223
|
return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), n?.playUrl && URL.revokeObjectURL(n.playUrl), t.filter((t) => t.id !== e);
|
|
@@ -216,11 +229,11 @@ var Te = (e, t) => {
|
|
|
216
229
|
addAttachments: w,
|
|
217
230
|
resetAttachments: S,
|
|
218
231
|
handleRemove: T,
|
|
219
|
-
handleRetry:
|
|
232
|
+
handleRetry: F((e) => {
|
|
220
233
|
let t = h.find((t) => t.id === e);
|
|
221
234
|
t && C(t);
|
|
222
235
|
}, [h, C]),
|
|
223
|
-
handleExpand:
|
|
236
|
+
handleExpand: F(async (e) => {
|
|
224
237
|
let n = h.find((t) => t.id === e);
|
|
225
238
|
if (!n || n.type !== t.Pasted) return;
|
|
226
239
|
let r = await n.file.text();
|
|
@@ -232,9 +245,9 @@ var Te = (e, t) => {
|
|
|
232
245
|
]),
|
|
233
246
|
hasBlockedAttachments: h.some((e) => e.status === r.Loading || e.status === r.Error)
|
|
234
247
|
};
|
|
235
|
-
},
|
|
248
|
+
}, Ae = (e, t) => {
|
|
236
249
|
let [n, r] = z(e), [i, a] = z(!1), [o, s] = z(0);
|
|
237
|
-
return
|
|
250
|
+
return I(() => {
|
|
238
251
|
if (e) {
|
|
239
252
|
r(!0), a(!1), s((e) => e + 1);
|
|
240
253
|
return;
|
|
@@ -250,15 +263,15 @@ var Te = (e, t) => {
|
|
|
250
263
|
isExiting: i,
|
|
251
264
|
instanceKey: o
|
|
252
265
|
};
|
|
253
|
-
},
|
|
266
|
+
}, je = (e, t) => !e.slice(0, t).includes("\n"), Me = (e, t) => !e.slice(t).includes("\n"), Ne = (e) => {
|
|
254
267
|
let t = R(e);
|
|
255
268
|
t.current = e;
|
|
256
|
-
let n = R(-1), r = R(""), i =
|
|
269
|
+
let n = R(-1), r = R(""), i = F((e, i, a) => {
|
|
257
270
|
let o = t.current;
|
|
258
|
-
return !o || o.length === 0 ? null : e === "up" ? !
|
|
259
|
-
}, []), a =
|
|
271
|
+
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);
|
|
272
|
+
}, []), a = F(() => {
|
|
260
273
|
n.current = -1, r.current = "";
|
|
261
|
-
}, []), o =
|
|
274
|
+
}, []), o = F(() => {
|
|
262
275
|
n.current = -1, r.current = "";
|
|
263
276
|
}, []);
|
|
264
277
|
return L(() => ({
|
|
@@ -270,13 +283,13 @@ var Te = (e, t) => {
|
|
|
270
283
|
a,
|
|
271
284
|
o
|
|
272
285
|
]);
|
|
273
|
-
},
|
|
286
|
+
}, Pe = ({ messageProp: e, messageRevision: t }) => {
|
|
274
287
|
let [n, r] = z(e), i = R(null), a = R(0), [o, s] = z(!1);
|
|
275
|
-
return
|
|
288
|
+
return I(() => {
|
|
276
289
|
r(e);
|
|
277
|
-
}, [e, t]),
|
|
290
|
+
}, [e, t]), I(() => {
|
|
278
291
|
i.current && (a.current = i.current.offsetHeight);
|
|
279
|
-
}, []),
|
|
292
|
+
}, []), _e(() => {
|
|
280
293
|
if (!i.current || a.current === 0) return;
|
|
281
294
|
let e = i.current.offsetHeight > a.current;
|
|
282
295
|
s((t) => e ? !0 : n === "" ? !1 : t);
|
|
@@ -286,20 +299,20 @@ var Te = (e, t) => {
|
|
|
286
299
|
textareaRef: i,
|
|
287
300
|
isMultiLine: o
|
|
288
301
|
};
|
|
289
|
-
},
|
|
302
|
+
}, Fe = /* @__PURE__ */ function(e) {
|
|
290
303
|
return e.Idle = "idle", e.Recording = "recording", e.Error = "error", e;
|
|
291
|
-
}({}),
|
|
304
|
+
}({}), Ie = [
|
|
292
305
|
"audio/webm;codecs=opus",
|
|
293
306
|
"audio/ogg;codecs=opus",
|
|
294
307
|
"audio/webm"
|
|
295
|
-
],
|
|
308
|
+
], Le = () => Ie.find((e) => MediaRecorder.isTypeSupported(e)) ?? "", Re = ({ onAttachAudio: e }) => {
|
|
296
309
|
let [t, n] = z("idle"), [r, i] = z(null), [a, o] = z(0), s = R(null), c = R(null), l = R(null), u = R(null), d = R([]), f = R(""), p = R(null), m = R(e);
|
|
297
310
|
m.current = e;
|
|
298
|
-
let h =
|
|
311
|
+
let h = F(() => {
|
|
299
312
|
p.current != null && (clearInterval(p.current), p.current = null);
|
|
300
|
-
}, []), g =
|
|
313
|
+
}, []), g = F(() => {
|
|
301
314
|
h(), s.current &&= (s.current.getTracks().forEach((e) => e.stop()), null), c.current &&= (c.current.close(), null), l.current = null, u.current = null;
|
|
302
|
-
}, [h]), _ =
|
|
315
|
+
}, [h]), _ = F(() => {
|
|
303
316
|
(async () => {
|
|
304
317
|
try {
|
|
305
318
|
let e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
|
|
@@ -308,7 +321,7 @@ var Te = (e, t) => {
|
|
|
308
321
|
c.current = t;
|
|
309
322
|
let r = t.createAnalyser();
|
|
310
323
|
r.fftSize = 256, l.current = r, t.createMediaStreamSource(e).connect(r);
|
|
311
|
-
let i =
|
|
324
|
+
let i = Le();
|
|
312
325
|
f.current = i, d.current = [];
|
|
313
326
|
let a = new MediaRecorder(e, i ? { mimeType: i } : void 0);
|
|
314
327
|
u.current = a, a.ondataavailable = (e) => {
|
|
@@ -320,17 +333,17 @@ var Te = (e, t) => {
|
|
|
320
333
|
i(e instanceof Error ? e.message : "Microphone access denied"), n("error");
|
|
321
334
|
}
|
|
322
335
|
})();
|
|
323
|
-
}, []), v =
|
|
336
|
+
}, []), v = F(() => {
|
|
324
337
|
let e = u.current;
|
|
325
338
|
!e || e.state !== "recording" || (h(), e.onstop = () => {
|
|
326
339
|
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 });
|
|
327
340
|
m.current(c), g(), o(0), i(null), n("idle");
|
|
328
341
|
}, e.stop());
|
|
329
|
-
}, [h, g]), y =
|
|
342
|
+
}, [h, g]), y = F(() => {
|
|
330
343
|
let e = u.current;
|
|
331
344
|
e && e.state === "recording" && (e.ondataavailable = null, e.onstop = null, e.stop()), g(), o(0), i(null), n("idle");
|
|
332
345
|
}, [g]);
|
|
333
|
-
return
|
|
346
|
+
return I(() => () => {
|
|
334
347
|
g();
|
|
335
348
|
}, [g]), {
|
|
336
349
|
state: t,
|
|
@@ -341,49 +354,56 @@ var Te = (e, t) => {
|
|
|
341
354
|
stopRecording: v,
|
|
342
355
|
discardRecording: y
|
|
343
356
|
};
|
|
344
|
-
},
|
|
357
|
+
}, ze = /* @__PURE__ */ function(e) {
|
|
345
358
|
return e.Enter = "enter", e.MetaEnter = "meta-enter", e;
|
|
346
|
-
}({}),
|
|
359
|
+
}({}), Be = {
|
|
347
360
|
item: "_item_l2r5m_1",
|
|
348
361
|
itemIcon: "_itemIcon_l2r5m_11"
|
|
349
|
-
},
|
|
350
|
-
let
|
|
362
|
+
}, Ve = ({ isOpen: e, title: t, closeLabel: n, onClose: r, style: i, items: s, className: c, titleClassName: u = "dial-body-semi-text", itemLabelClassName: d = "dial-small-text", btnTextClassName: f = "", colors: p }) => {
|
|
363
|
+
let m = (e) => {
|
|
351
364
|
e(), r();
|
|
352
|
-
}
|
|
353
|
-
|
|
365
|
+
}, h = a({
|
|
366
|
+
"--ci-sheet-text": p?.itemText,
|
|
367
|
+
"--ci-sheet-item-hover": p?.itemHoverBg,
|
|
368
|
+
"--ci-sheet-item-active": p?.itemActiveBg,
|
|
369
|
+
"--ci-sheet-icon": p?.itemIcon
|
|
370
|
+
});
|
|
371
|
+
return /* @__PURE__ */ V(W, {
|
|
354
372
|
isOpen: e,
|
|
355
373
|
title: t,
|
|
356
374
|
closeLabel: n,
|
|
357
375
|
onClose: r,
|
|
358
376
|
style: i,
|
|
359
|
-
className:
|
|
360
|
-
titleClassName:
|
|
377
|
+
className: c,
|
|
378
|
+
titleClassName: u,
|
|
379
|
+
colors: p?.shell,
|
|
361
380
|
children: /* @__PURE__ */ V("ul", {
|
|
362
381
|
role: "list",
|
|
363
382
|
className: "flex flex-col",
|
|
364
|
-
|
|
383
|
+
style: h,
|
|
384
|
+
children: s.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ V("li", { children: /* @__PURE__ */ V(l, {
|
|
365
385
|
type: "button",
|
|
366
|
-
className: o(
|
|
386
|
+
className: o(Be.item, "w-full gap-3 px-4 py-[10px] text-start"),
|
|
367
387
|
iconBefore: /* @__PURE__ */ V("span", {
|
|
368
|
-
className:
|
|
388
|
+
className: Be.itemIcon,
|
|
369
389
|
children: n
|
|
370
390
|
}),
|
|
371
391
|
iconAfter: r ? /* @__PURE__ */ V("span", {
|
|
372
392
|
className: "ms-auto",
|
|
373
393
|
children: r
|
|
374
394
|
}) : null,
|
|
375
|
-
textClassName:
|
|
395
|
+
textClassName: f,
|
|
376
396
|
label: /* @__PURE__ */ V("span", {
|
|
377
|
-
className:
|
|
397
|
+
className: d,
|
|
378
398
|
children: t
|
|
379
399
|
}),
|
|
380
|
-
onClick: () =>
|
|
400
|
+
onClick: () => m(i)
|
|
381
401
|
}) }, e))
|
|
382
402
|
})
|
|
383
403
|
});
|
|
384
|
-
},
|
|
404
|
+
}, He = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
385
405
|
let [s, c] = z(t), [l, u] = z(n), [d, f] = z(r), p = R(o);
|
|
386
|
-
|
|
406
|
+
I(() => {
|
|
387
407
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
388
408
|
}, [
|
|
389
409
|
o,
|
|
@@ -400,7 +420,7 @@ var Te = (e, t) => {
|
|
|
400
420
|
setResponseFormat: c,
|
|
401
421
|
setSystemPrompt: u,
|
|
402
422
|
setTemperature: f,
|
|
403
|
-
handleSubmit:
|
|
423
|
+
handleSubmit: F(() => {
|
|
404
424
|
if (!m) return;
|
|
405
425
|
let t = {};
|
|
406
426
|
e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
|
|
@@ -414,7 +434,7 @@ var Te = (e, t) => {
|
|
|
414
434
|
a
|
|
415
435
|
])
|
|
416
436
|
};
|
|
417
|
-
},
|
|
437
|
+
}, Ue = "!dial-small-semi-text !text-primary gap-1", We = ({ 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 = [
|
|
418
438
|
"Precise",
|
|
419
439
|
"Neutral",
|
|
420
440
|
"Creative"
|
|
@@ -423,9 +443,9 @@ var Te = (e, t) => {
|
|
|
423
443
|
children: [
|
|
424
444
|
e.responseFormat && /* @__PURE__ */ V(v, {
|
|
425
445
|
fieldTitle: c,
|
|
426
|
-
labelClassName:
|
|
446
|
+
labelClassName: Ue,
|
|
427
447
|
elementId: "response-format",
|
|
428
|
-
orientation:
|
|
448
|
+
orientation: te.Column,
|
|
429
449
|
activeRadioButton: t ?? i.Markdown,
|
|
430
450
|
labelDescription: l,
|
|
431
451
|
radioButtons: [{
|
|
@@ -441,7 +461,7 @@ var Te = (e, t) => {
|
|
|
441
461
|
value: n,
|
|
442
462
|
placeholder: p,
|
|
443
463
|
labelProps: {
|
|
444
|
-
className:
|
|
464
|
+
className: Ue,
|
|
445
465
|
label: f
|
|
446
466
|
},
|
|
447
467
|
onChange: (e) => o(e ?? "")
|
|
@@ -449,7 +469,7 @@ var Te = (e, t) => {
|
|
|
449
469
|
e.temperature && /* @__PURE__ */ V(S, {
|
|
450
470
|
labelProps: {
|
|
451
471
|
label: m,
|
|
452
|
-
className:
|
|
472
|
+
className: Ue,
|
|
453
473
|
caption: _
|
|
454
474
|
},
|
|
455
475
|
value: r,
|
|
@@ -460,8 +480,8 @@ var Te = (e, t) => {
|
|
|
460
480
|
onChange: s
|
|
461
481
|
})
|
|
462
482
|
]
|
|
463
|
-
}),
|
|
464
|
-
let { responseFormat: T, systemPrompt: E, temperature: D, canSubmit: O, setResponseFormat:
|
|
483
|
+
}), Ge = ({ 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 }) => {
|
|
484
|
+
let { responseFormat: T, systemPrompt: E, temperature: D, canSubmit: O, setResponseFormat: k, setSystemPrompt: ee, setTemperature: te, handleSubmit: ne } = He({
|
|
465
485
|
isOpen: e,
|
|
466
486
|
features: s,
|
|
467
487
|
initialResponseFormat: c,
|
|
@@ -470,7 +490,7 @@ var Te = (e, t) => {
|
|
|
470
490
|
onSave: d,
|
|
471
491
|
onClose: r
|
|
472
492
|
});
|
|
473
|
-
return /* @__PURE__ */ H(
|
|
493
|
+
return /* @__PURE__ */ H(W, {
|
|
474
494
|
isOpen: e,
|
|
475
495
|
title: f,
|
|
476
496
|
closeLabel: i,
|
|
@@ -478,12 +498,12 @@ var Te = (e, t) => {
|
|
|
478
498
|
onBack: t,
|
|
479
499
|
backLabel: n,
|
|
480
500
|
style: a,
|
|
481
|
-
children: [/* @__PURE__ */ V(
|
|
501
|
+
children: [/* @__PURE__ */ V(We, {
|
|
482
502
|
features: s,
|
|
483
503
|
responseFormat: T,
|
|
484
504
|
systemPrompt: E,
|
|
485
505
|
temperature: D,
|
|
486
|
-
onResponseFormatChange:
|
|
506
|
+
onResponseFormatChange: k,
|
|
487
507
|
onSystemPromptChange: ee,
|
|
488
508
|
onTemperatureChange: te,
|
|
489
509
|
responseFormatLabel: p,
|
|
@@ -501,7 +521,7 @@ var Te = (e, t) => {
|
|
|
501
521
|
tooltip: C,
|
|
502
522
|
hideTooltip: O || !C,
|
|
503
523
|
triggerClassName: "w-full",
|
|
504
|
-
children: /* @__PURE__ */ V(
|
|
524
|
+
children: /* @__PURE__ */ V(A, {
|
|
505
525
|
label: S,
|
|
506
526
|
onClick: ne,
|
|
507
527
|
disabled: !O,
|
|
@@ -510,8 +530,8 @@ var Te = (e, t) => {
|
|
|
510
530
|
})
|
|
511
531
|
})]
|
|
512
532
|
});
|
|
513
|
-
},
|
|
514
|
-
let { responseFormat: y, systemPrompt: b, temperature: x, canSubmit: S, setResponseFormat: C, setSystemPrompt: T, setTemperature: E, handleSubmit: D } =
|
|
533
|
+
}, Ke = ({ 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: v }) => {
|
|
534
|
+
let { responseFormat: y, systemPrompt: b, temperature: x, canSubmit: S, setResponseFormat: C, setSystemPrompt: T, setTemperature: E, handleSubmit: D } = He({
|
|
515
535
|
features: e,
|
|
516
536
|
initialResponseFormat: t,
|
|
517
537
|
initialSystemPrompt: n,
|
|
@@ -522,7 +542,7 @@ var Te = (e, t) => {
|
|
|
522
542
|
return /* @__PURE__ */ V(_, {
|
|
523
543
|
open: !0,
|
|
524
544
|
header: o,
|
|
525
|
-
size:
|
|
545
|
+
size: k.Sm,
|
|
526
546
|
onClose: a,
|
|
527
547
|
className: "!bg-layer-2",
|
|
528
548
|
footer: /* @__PURE__ */ V("div", {
|
|
@@ -530,14 +550,14 @@ var Te = (e, t) => {
|
|
|
530
550
|
children: /* @__PURE__ */ V(w, {
|
|
531
551
|
tooltip: v,
|
|
532
552
|
hideTooltip: S || !v,
|
|
533
|
-
children: /* @__PURE__ */ V(
|
|
553
|
+
children: /* @__PURE__ */ V(A, {
|
|
534
554
|
label: g,
|
|
535
555
|
onClick: D,
|
|
536
556
|
disabled: !S
|
|
537
557
|
})
|
|
538
558
|
})
|
|
539
559
|
}),
|
|
540
|
-
children: /* @__PURE__ */ V(
|
|
560
|
+
children: /* @__PURE__ */ V(We, {
|
|
541
561
|
features: e,
|
|
542
562
|
responseFormat: y,
|
|
543
563
|
systemPrompt: b,
|
|
@@ -557,10 +577,10 @@ var Te = (e, t) => {
|
|
|
557
577
|
})
|
|
558
578
|
});
|
|
559
579
|
};
|
|
560
|
-
|
|
580
|
+
he(Ke);
|
|
561
581
|
//#endregion
|
|
562
582
|
//#region src/components/ToolsBottomSheet/ToolsBottomSheet.tsx
|
|
563
|
-
var
|
|
583
|
+
var qe = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel: i = "Close", style: a, title: o = "Tools", items: s, onToolToggle: u }) => /* @__PURE__ */ V(W, {
|
|
564
584
|
isOpen: e,
|
|
565
585
|
title: o,
|
|
566
586
|
closeLabel: i,
|
|
@@ -577,14 +597,14 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
577
597
|
type: "button",
|
|
578
598
|
role: "menuitemcheckbox",
|
|
579
599
|
"aria-checked": e.isSelected,
|
|
580
|
-
className: "
|
|
600
|
+
className: "w-full gap-3 px-4 py-[10px] text-start",
|
|
581
601
|
iconBefore: /* @__PURE__ */ V("span", {
|
|
582
602
|
className: "flex items-center text-secondary",
|
|
583
603
|
children: e.icon
|
|
584
604
|
}),
|
|
585
605
|
iconAfter: e.isSelected ? /* @__PURE__ */ V("span", {
|
|
586
606
|
className: "ms-auto text-accent-primary",
|
|
587
|
-
children: /* @__PURE__ */ V(
|
|
607
|
+
children: /* @__PURE__ */ V(j, {
|
|
588
608
|
size: c,
|
|
589
609
|
"aria-hidden": !0
|
|
590
610
|
})
|
|
@@ -597,7 +617,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
597
617
|
})
|
|
598
618
|
}, e.id))
|
|
599
619
|
})
|
|
600
|
-
}),
|
|
620
|
+
}), Je = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, menuCloseLabel: a, style: l, listClassName: d = "cp-dropdown-overlay !w-[240px]", isDisabled: p = !1, chatSettings: m, extraMenuItems: g, toolsMenuItems: _ = [], onToolToggle: v, toolsMenuTitle: y = "Tools", toolsBackLabel: b = "Back" }) => {
|
|
601
621
|
let x = s(), [S, C] = z(!1), [w, T] = z(!1), [E, D] = z(!1), O = _.length > 0 && v != null, k = L(() => _.map((e) => ({
|
|
602
622
|
key: e.id,
|
|
603
623
|
label: /* @__PURE__ */ H("span", {
|
|
@@ -605,7 +625,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
605
625
|
children: [/* @__PURE__ */ V("span", {
|
|
606
626
|
className: "flex-1",
|
|
607
627
|
children: e.label
|
|
608
|
-
}), e.isSelected && /* @__PURE__ */ V(
|
|
628
|
+
}), e.isSelected && /* @__PURE__ */ V(j, {
|
|
609
629
|
size: c,
|
|
610
630
|
className: "text-accent-primary",
|
|
611
631
|
"aria-hidden": !0
|
|
@@ -620,7 +640,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
620
640
|
...e == null ? [] : [{
|
|
621
641
|
key: "attach",
|
|
622
642
|
label: t,
|
|
623
|
-
icon: /* @__PURE__ */ V(
|
|
643
|
+
icon: /* @__PURE__ */ V(ce, {
|
|
624
644
|
size: c,
|
|
625
645
|
"aria-hidden": !0
|
|
626
646
|
}),
|
|
@@ -630,14 +650,14 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
630
650
|
...O ? [{
|
|
631
651
|
key: "tools",
|
|
632
652
|
label: y,
|
|
633
|
-
icon: /* @__PURE__ */ V(
|
|
653
|
+
icon: /* @__PURE__ */ V(fe, {
|
|
634
654
|
size: c,
|
|
635
655
|
"aria-hidden": !0
|
|
636
656
|
}),
|
|
637
657
|
onClick: x ? () => {
|
|
638
658
|
D(!0), C(!1);
|
|
639
659
|
} : () => void 0,
|
|
640
|
-
...x ? { iconAfter: /* @__PURE__ */ V(
|
|
660
|
+
...x ? { iconAfter: /* @__PURE__ */ V(M, {
|
|
641
661
|
size: c,
|
|
642
662
|
stroke: 1.5,
|
|
643
663
|
className: "text-secondary rtl:scale-x-[-1]",
|
|
@@ -647,11 +667,11 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
647
667
|
...m == null ? [] : [{
|
|
648
668
|
key: "chat-settings",
|
|
649
669
|
label: m.menuItemLabel ?? "Chat settings",
|
|
650
|
-
icon: /* @__PURE__ */ V(
|
|
670
|
+
icon: /* @__PURE__ */ V(de, {
|
|
651
671
|
size: c,
|
|
652
672
|
"aria-hidden": !0
|
|
653
673
|
}),
|
|
654
|
-
iconAfter: x ? /* @__PURE__ */ V(
|
|
674
|
+
iconAfter: x ? /* @__PURE__ */ V(M, {
|
|
655
675
|
size: c,
|
|
656
676
|
stroke: 1.5,
|
|
657
677
|
className: "text-secondary rtl:scale-x-[-1]",
|
|
@@ -671,7 +691,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
671
691
|
]);
|
|
672
692
|
return A.length === 0 ? null : /* @__PURE__ */ V(B, { children: x ? /* @__PURE__ */ H(B, { children: [
|
|
673
693
|
/* @__PURE__ */ V(h, {
|
|
674
|
-
icon: /* @__PURE__ */ V(
|
|
694
|
+
icon: /* @__PURE__ */ V(ue, {
|
|
675
695
|
size: u.LG,
|
|
676
696
|
"aria-hidden": !0
|
|
677
697
|
}),
|
|
@@ -680,7 +700,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
680
700
|
className: o("size-10 flex-shrink-0", p && "pointer-events-none opacity-50"),
|
|
681
701
|
onClick: () => C(!0)
|
|
682
702
|
}),
|
|
683
|
-
/* @__PURE__ */ V(
|
|
703
|
+
/* @__PURE__ */ V(Ve, {
|
|
684
704
|
isOpen: S,
|
|
685
705
|
title: r,
|
|
686
706
|
closeLabel: a,
|
|
@@ -690,7 +710,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
690
710
|
className: "pb-4",
|
|
691
711
|
btnTextClassName: "flex-1"
|
|
692
712
|
}),
|
|
693
|
-
O && /* @__PURE__ */ V(
|
|
713
|
+
O && /* @__PURE__ */ V(qe, {
|
|
694
714
|
isOpen: E,
|
|
695
715
|
onBack: () => {
|
|
696
716
|
D(!1), C(!0);
|
|
@@ -703,7 +723,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
703
723
|
items: _,
|
|
704
724
|
onToolToggle: v
|
|
705
725
|
}),
|
|
706
|
-
m != null && /* @__PURE__ */ V(
|
|
726
|
+
m != null && /* @__PURE__ */ V(Ge, {
|
|
707
727
|
isOpen: w,
|
|
708
728
|
onBack: () => {
|
|
709
729
|
T(!1), C(!0);
|
|
@@ -736,7 +756,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
736
756
|
listClassName: d,
|
|
737
757
|
items: A,
|
|
738
758
|
children: /* @__PURE__ */ V(h, {
|
|
739
|
-
icon: /* @__PURE__ */ V(
|
|
759
|
+
icon: /* @__PURE__ */ V(ue, {
|
|
740
760
|
size: u.LG,
|
|
741
761
|
"aria-hidden": !0
|
|
742
762
|
}),
|
|
@@ -745,7 +765,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
745
765
|
className: "size-10 flex-shrink-0",
|
|
746
766
|
disabled: p
|
|
747
767
|
})
|
|
748
|
-
}), m != null && w && /* @__PURE__ */ V(
|
|
768
|
+
}), m != null && w && /* @__PURE__ */ V(Ke, {
|
|
749
769
|
features: m.features,
|
|
750
770
|
initialResponseFormat: m.responseFormat ?? i.Markdown,
|
|
751
771
|
initialSystemPrompt: m.systemPrompt,
|
|
@@ -766,37 +786,47 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
766
786
|
saveDisabledTooltip: m.saveDisabledTooltip
|
|
767
787
|
})] }) });
|
|
768
788
|
}, G = {
|
|
769
|
-
chip: "
|
|
770
|
-
chipIcon: "
|
|
771
|
-
chipText: "
|
|
772
|
-
chipClose: "
|
|
773
|
-
},
|
|
774
|
-
let
|
|
775
|
-
if (
|
|
789
|
+
chip: "_chip_1gvzk_1",
|
|
790
|
+
chipIcon: "_chipIcon_1gvzk_6",
|
|
791
|
+
chipText: "_chipText_1gvzk_10",
|
|
792
|
+
chipClose: "_chipClose_1gvzk_14"
|
|
793
|
+
}, Ye = (e) => `${e} tool${e === 1 ? "" : "s"}`, K = (e) => `Remove ${e}`, Xe = ({ items: e, onToolToggle: t, isMobile: n, countLabel: r = Ye, removeLabel: i = K, typography: s, colors: l }) => {
|
|
794
|
+
let u = e.filter((e) => e.isSelected);
|
|
795
|
+
if (u.length === 0) return null;
|
|
796
|
+
let d = a({
|
|
797
|
+
"--ci-chip-bg": l?.chipBg,
|
|
798
|
+
"--ci-chip-border": l?.chipBorder,
|
|
799
|
+
"--ci-chip-icon": l?.chipIcon,
|
|
800
|
+
"--ci-chip-text": l?.chipText,
|
|
801
|
+
"--ci-chip-close": l?.chipClose,
|
|
802
|
+
"--ci-chip-close-hover": l?.chipCloseHover
|
|
803
|
+
});
|
|
776
804
|
if (n) {
|
|
777
|
-
let e =
|
|
805
|
+
let e = u.length === 1 ? u[0].icon : /* @__PURE__ */ V(fe, {
|
|
778
806
|
size: c,
|
|
779
807
|
"aria-hidden": !0
|
|
780
808
|
});
|
|
781
809
|
return /* @__PURE__ */ V("div", {
|
|
782
810
|
className: "flex flex-wrap items-center gap-2",
|
|
811
|
+
style: d,
|
|
783
812
|
children: /* @__PURE__ */ H("div", {
|
|
784
|
-
className: o(G.chip, "flex items-center gap-1.5 rounded border px-2 py-1"),
|
|
813
|
+
className: o(G.chip, "flex items-center gap-1.5 rounded-full border px-2 py-1"),
|
|
785
814
|
children: [/* @__PURE__ */ V("span", {
|
|
786
815
|
className: G.chipIcon,
|
|
787
816
|
"aria-hidden": !0,
|
|
788
817
|
children: e
|
|
789
818
|
}), /* @__PURE__ */ V("span", {
|
|
790
|
-
className: o(G.chipText, "dial-small-text"),
|
|
791
|
-
children: r(
|
|
819
|
+
className: o(G.chipText, s?.fontClassName || "dial-small-paragraph-text"),
|
|
820
|
+
children: r(u.length)
|
|
792
821
|
})]
|
|
793
822
|
})
|
|
794
823
|
});
|
|
795
824
|
}
|
|
796
825
|
return /* @__PURE__ */ V("div", {
|
|
797
826
|
className: "flex flex-wrap items-center gap-2",
|
|
798
|
-
|
|
799
|
-
|
|
827
|
+
style: d,
|
|
828
|
+
children: u.map((e) => /* @__PURE__ */ H("div", {
|
|
829
|
+
className: o(G.chip, "flex items-center gap-1.5 rounded-full border py-1 pe-1 ps-2"),
|
|
800
830
|
children: [
|
|
801
831
|
/* @__PURE__ */ V("span", {
|
|
802
832
|
className: G.chipIcon,
|
|
@@ -804,7 +834,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
804
834
|
children: e.icon
|
|
805
835
|
}),
|
|
806
836
|
/* @__PURE__ */ V("span", {
|
|
807
|
-
className: o(G.chipText, "dial-small-text"),
|
|
837
|
+
className: o(G.chipText, s?.fontClassName || "dial-small-paragraph-text"),
|
|
808
838
|
children: e.label
|
|
809
839
|
}),
|
|
810
840
|
/* @__PURE__ */ V("button", {
|
|
@@ -812,7 +842,7 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
812
842
|
onClick: () => t(e.id),
|
|
813
843
|
className: o(G.chipClose, "flex items-center rounded p-0.5 transition-colors"),
|
|
814
844
|
"aria-label": i(e.label),
|
|
815
|
-
children: /* @__PURE__ */ V(
|
|
845
|
+
children: /* @__PURE__ */ V(pe, {
|
|
816
846
|
size: 12,
|
|
817
847
|
"aria-hidden": !0
|
|
818
848
|
})
|
|
@@ -820,37 +850,43 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
820
850
|
]
|
|
821
851
|
}, e.id))
|
|
822
852
|
});
|
|
823
|
-
},
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
853
|
+
}, q = {
|
|
854
|
+
wrapper: "_wrapper_4e8i8_1",
|
|
855
|
+
wrapperDisabled: "_wrapperDisabled_4e8i8_8",
|
|
856
|
+
textarea: "_textarea_4e8i8_13",
|
|
857
|
+
modelSelectorButton: "_modelSelectorButton_4e8i8_24",
|
|
858
|
+
modelSelectorCaret: "_modelSelectorCaret_4e8i8_24",
|
|
859
|
+
modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_4e8i8_33"
|
|
860
|
+
}, J = {
|
|
861
|
+
wrapperError: "_wrapperError_5wiyg_1",
|
|
862
|
+
waveformCanvas: "_waveformCanvas_5wiyg_5",
|
|
863
|
+
timer: "_timer_5wiyg_9",
|
|
864
|
+
stopRecordingIcon: "_stopRecordingIcon_5wiyg_15",
|
|
865
|
+
recordingDot: "_recordingDot_5wiyg_29",
|
|
866
|
+
"recording-pulse": "_recording-pulse_5wiyg_1"
|
|
867
|
+
}, Ze = 3, Qe = 4, Y = 200, $e = (e) => `${String(Math.floor(e / 60)).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`, et = ({ 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: d, className: f }) => {
|
|
868
|
+
let p = R(null), h = R(new Float32Array(Y)), g = R(0), _ = R(0), v = e === Fe.Recording, y = e === Fe.Error, b = F((e) => {
|
|
833
869
|
let t = e.getContext("2d");
|
|
834
870
|
if (!t) return;
|
|
835
871
|
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
836
872
|
let { width: n, height: r } = e;
|
|
837
873
|
t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
|
|
838
|
-
let i = Math.min(Math.max(1, Math.floor(n /
|
|
874
|
+
let i = Math.min(Math.max(1, Math.floor(n / Qe)), Y - 1), a = g.current, o = _.current;
|
|
839
875
|
t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
|
|
840
876
|
for (let e = 0; e <= i; e++) {
|
|
841
|
-
let n = ((a - i + e) % Y + Y) % Y, o =
|
|
842
|
-
t.fillRect(e *
|
|
877
|
+
let n = ((a - i + e) % Y + Y) % Y, o = h.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
|
|
878
|
+
t.fillRect(e * Qe, (r - c) / 2, Ze, c);
|
|
843
879
|
}
|
|
844
880
|
t.restore();
|
|
845
881
|
}, []);
|
|
846
|
-
|
|
847
|
-
if (!
|
|
882
|
+
I(() => {
|
|
883
|
+
if (!v) return;
|
|
848
884
|
let e = p.current;
|
|
849
885
|
if (!e) return;
|
|
850
|
-
|
|
886
|
+
h.current.fill(0), g.current = 0, _.current = 0;
|
|
851
887
|
let n, r = () => {
|
|
852
|
-
if (
|
|
853
|
-
|
|
888
|
+
if (_.current += 1, _.current >= Qe) {
|
|
889
|
+
_.current -= Qe;
|
|
854
890
|
let e = t.current;
|
|
855
891
|
if (e) {
|
|
856
892
|
let t = new Uint8Array(e.frequencyBinCount);
|
|
@@ -860,100 +896,80 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
860
896
|
let r = (t[e] - 128) / 128;
|
|
861
897
|
n += r * r;
|
|
862
898
|
}
|
|
863
|
-
|
|
899
|
+
h.current[g.current % Y] = Math.sqrt(n / t.length), g.current++;
|
|
864
900
|
}
|
|
865
901
|
}
|
|
866
|
-
|
|
902
|
+
b(e), n = requestAnimationFrame(r);
|
|
867
903
|
};
|
|
868
904
|
return n = requestAnimationFrame(r), () => {
|
|
869
905
|
cancelAnimationFrame(n);
|
|
870
906
|
};
|
|
871
907
|
}, [
|
|
872
|
-
|
|
908
|
+
v,
|
|
873
909
|
t,
|
|
874
|
-
|
|
875
|
-
]),
|
|
910
|
+
b
|
|
911
|
+
]), I(() => {
|
|
876
912
|
let e = p.current;
|
|
877
913
|
if (!e) return;
|
|
878
914
|
let t = new ResizeObserver(() => {
|
|
879
|
-
|
|
915
|
+
b(e);
|
|
880
916
|
});
|
|
881
917
|
return t.observe(e), () => t.disconnect();
|
|
882
|
-
}, [
|
|
883
|
-
let
|
|
918
|
+
}, [b]);
|
|
919
|
+
let x = /* @__PURE__ */ H("div", {
|
|
884
920
|
className: "flex flex-shrink-0 items-center justify-end gap-1",
|
|
885
|
-
children: [/* @__PURE__ */ V(
|
|
886
|
-
icon: /* @__PURE__ */ V(
|
|
921
|
+
children: [/* @__PURE__ */ V(E, {
|
|
922
|
+
icon: /* @__PURE__ */ V(pe, {
|
|
887
923
|
size: u.LG,
|
|
888
924
|
"aria-hidden": !0
|
|
889
925
|
}),
|
|
890
926
|
"aria-label": c,
|
|
891
|
-
className: "size-10 flex-shrink-0",
|
|
892
927
|
onClick: a
|
|
893
|
-
}),
|
|
894
|
-
icon: /* @__PURE__ */ V(
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
"aria-hidden": !0
|
|
898
|
-
}),
|
|
899
|
-
"aria-label": s,
|
|
900
|
-
className: "size-10 flex-shrink-0",
|
|
901
|
-
onClick: i
|
|
928
|
+
}), v && /* @__PURE__ */ V(ee, {
|
|
929
|
+
icon: /* @__PURE__ */ V(le, { size: u.LG }),
|
|
930
|
+
onClick: () => i?.(),
|
|
931
|
+
"aria-label": s
|
|
902
932
|
})]
|
|
903
933
|
});
|
|
904
934
|
return /* @__PURE__ */ H("div", {
|
|
905
935
|
className: f,
|
|
906
936
|
children: [/* @__PURE__ */ H("div", {
|
|
907
937
|
style: d,
|
|
908
|
-
className: o(
|
|
938
|
+
className: o(q.wrapper, "flex min-h-[64px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border px-3 shadow-md desktop:flex-row desktop:items-center desktop:gap-2 desktop:py-2", y && J.wrapperError),
|
|
909
939
|
children: [/* @__PURE__ */ H("div", {
|
|
910
|
-
className: "flex min-w-0 flex-1 items-center gap-
|
|
911
|
-
children: [
|
|
912
|
-
className:
|
|
940
|
+
className: "flex min-w-0 flex-1 items-center gap-3",
|
|
941
|
+
children: [v && /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("span", {
|
|
942
|
+
className: o(J.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
|
|
913
943
|
"aria-hidden": !0
|
|
914
944
|
}), /* @__PURE__ */ V("span", {
|
|
915
|
-
className: o(
|
|
945
|
+
className: o(J.timer, "flex-shrink-0"),
|
|
916
946
|
"aria-label": l,
|
|
917
|
-
children:
|
|
947
|
+
children: $e(n)
|
|
918
948
|
})] }), /* @__PURE__ */ V("canvas", {
|
|
919
949
|
ref: p,
|
|
920
950
|
height: 32,
|
|
921
|
-
className: o(
|
|
951
|
+
className: o(J.waveformCanvas, "h-8 min-w-0 flex-1 desktop:h-6")
|
|
922
952
|
})]
|
|
923
|
-
}),
|
|
924
|
-
}),
|
|
953
|
+
}), x]
|
|
954
|
+
}), y && r && /* @__PURE__ */ V(m, {
|
|
925
955
|
text: r,
|
|
926
956
|
className: "mt-1 px-1"
|
|
927
957
|
})]
|
|
928
958
|
});
|
|
929
|
-
},
|
|
959
|
+
}, tt = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", isExiting: r = !1 }) => /* @__PURE__ */ V(ee, {
|
|
930
960
|
"aria-label": n,
|
|
931
961
|
onClick: () => e?.(),
|
|
932
|
-
type: "button",
|
|
933
962
|
disabled: t,
|
|
934
963
|
"aria-hidden": r,
|
|
935
|
-
icon: /* @__PURE__ */ V(
|
|
964
|
+
icon: /* @__PURE__ */ V(ie, {
|
|
936
965
|
size: u.LG,
|
|
937
966
|
className: "rtl:scale-x-[-1]"
|
|
938
967
|
})
|
|
939
|
-
}),
|
|
940
|
-
|
|
941
|
-
wrapperDisabled: "_wrapperDisabled_1mg30_14",
|
|
942
|
-
textarea: "_textarea_1mg30_19",
|
|
943
|
-
stopIcon: "_stopIcon_1mg30_33",
|
|
944
|
-
modelSelectorButton: "_modelSelectorButton_1mg30_37",
|
|
945
|
-
modelSelectorCaret: "_modelSelectorCaret_1mg30_37",
|
|
946
|
-
modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_1mg30_43"
|
|
947
|
-
}, $e = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ V("button", {
|
|
948
|
-
className: o("flex cursor-pointer items-center justify-center disabled:cursor-not-allowed"),
|
|
949
|
-
"aria-label": t,
|
|
968
|
+
}), nt = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ V(ne, {
|
|
969
|
+
icon: /* @__PURE__ */ V(N, { size: u.LG }),
|
|
950
970
|
onClick: () => e?.(),
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
size: u.LG,
|
|
954
|
-
className: X.stopIcon
|
|
955
|
-
})
|
|
956
|
-
}), Z = ({ gradientId: e = "gradient-check-icon" }) => /* @__PURE__ */ H("svg", {
|
|
971
|
+
"aria-label": t
|
|
972
|
+
}), rt = ({ gradientId: e = "gradient-check-icon" }) => /* @__PURE__ */ H("svg", {
|
|
957
973
|
width: u.SM,
|
|
958
974
|
height: u.SM,
|
|
959
975
|
viewBox: "0 0 24 24",
|
|
@@ -980,11 +996,11 @@ var Ge = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel:
|
|
|
980
996
|
strokeLinecap: "round",
|
|
981
997
|
strokeLinejoin: "round"
|
|
982
998
|
})]
|
|
983
|
-
}),
|
|
999
|
+
}), it = {
|
|
984
1000
|
tabContainer: "_tabContainer_153ct_1",
|
|
985
1001
|
tabActive: "_tabActive_153ct_13"
|
|
986
1002
|
};
|
|
987
|
-
|
|
1003
|
+
he(({ tabs: e, activeTabId: t, onTabChange: n, styles: r }) => {
|
|
988
1004
|
let { tabClassName: i = "dial-tiny-semi-text" } = r?.typography ?? {};
|
|
989
1005
|
return /* @__PURE__ */ V("div", {
|
|
990
1006
|
className: "flex flex-nowrap gap-1",
|
|
@@ -999,18 +1015,18 @@ N(({ tabs: e, activeTabId: t, onTabChange: n, styles: r }) => {
|
|
|
999
1015
|
label: e.label,
|
|
1000
1016
|
selected: r,
|
|
1001
1017
|
onClick: () => n(e.id),
|
|
1002
|
-
className: o("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", i,
|
|
1018
|
+
className: o("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", i, it.tabContainer, r && it.tabActive)
|
|
1003
1019
|
})
|
|
1004
1020
|
}, e.id);
|
|
1005
1021
|
})
|
|
1006
1022
|
});
|
|
1007
1023
|
});
|
|
1008
|
-
var
|
|
1024
|
+
var at = ({ size: e = 20 }) => /* @__PURE__ */ V(b, {
|
|
1009
1025
|
variant: x.Circular,
|
|
1010
1026
|
width: e,
|
|
1011
1027
|
height: e,
|
|
1012
1028
|
active: !0
|
|
1013
|
-
}),
|
|
1029
|
+
}), ot = ({ loadingLabel: e }) => /* @__PURE__ */ H("span", {
|
|
1014
1030
|
className: "flex min-w-0 flex-1 items-center",
|
|
1015
1031
|
children: [/* @__PURE__ */ V(b, {
|
|
1016
1032
|
variant: x.Text,
|
|
@@ -1021,24 +1037,24 @@ var tt = ({ size: e = 20 }) => /* @__PURE__ */ V(b, {
|
|
|
1021
1037
|
className: "sr-only",
|
|
1022
1038
|
children: e
|
|
1023
1039
|
})]
|
|
1024
|
-
}),
|
|
1040
|
+
}), st = ({ loadingLabel: e }) => /* @__PURE__ */ V("div", {
|
|
1025
1041
|
role: "status",
|
|
1026
1042
|
"aria-label": e,
|
|
1027
1043
|
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ H("div", {
|
|
1028
1044
|
className: "flex h-11 items-center gap-3 px-4",
|
|
1029
1045
|
"aria-hidden": "true",
|
|
1030
|
-
children: [/* @__PURE__ */ V(
|
|
1046
|
+
children: [/* @__PURE__ */ V(at, {}), /* @__PURE__ */ V(ot, {})]
|
|
1031
1047
|
}, t))
|
|
1032
|
-
}),
|
|
1048
|
+
}), ct = (e) => e.displayName ?? e.id, lt = (e, t) => {
|
|
1033
1049
|
let n = t.trim().toLowerCase();
|
|
1034
|
-
return n ? e.filter((e) =>
|
|
1035
|
-
},
|
|
1050
|
+
return n ? e.filter((e) => ct(e).toLowerCase().includes(n)) : e;
|
|
1051
|
+
}, ut = (e, t, r, i = 18, a) => /* @__PURE__ */ V(n, {
|
|
1036
1052
|
src: e,
|
|
1037
1053
|
size: i,
|
|
1038
1054
|
labels: { tooltip: a },
|
|
1039
1055
|
initialsName: r
|
|
1040
|
-
}),
|
|
1041
|
-
let [a, s] = z(""), c = L(() => e?.find((e) => e.id === t), [e, t]), l = r?.loading !== void 0, d = L(() => l ? /* @__PURE__ */ V(
|
|
1056
|
+
}), dt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, searchHeaderClassName: i = "bg-layer-0" }) => {
|
|
1057
|
+
let [a, s] = z(""), c = L(() => e?.find((e) => e.id === t), [e, t]), l = r?.loading !== void 0, d = L(() => l ? /* @__PURE__ */ V(at, { size: u.LG }) : ut(c?.iconUrl, c?.type, c?.displayName ?? c?.id ?? "", u.LG), [l, c]), f = c?.displayName ?? c?.id;
|
|
1042
1058
|
return {
|
|
1043
1059
|
selectorIcon: d,
|
|
1044
1060
|
selectorAriaLabel: f ? `${r?.ariaLabel ?? "Select model"}: ${f}` : r?.ariaLabel ?? "Select model",
|
|
@@ -1046,8 +1062,8 @@ var tt = ({ size: e = 20 }) => /* @__PURE__ */ V(b, {
|
|
|
1046
1062
|
menuItems: L(() => {
|
|
1047
1063
|
if (l) return Array.from({ length: 7 }, (e, t) => ({
|
|
1048
1064
|
key: `__loading-${t}`,
|
|
1049
|
-
icon: /* @__PURE__ */ V(
|
|
1050
|
-
label: /* @__PURE__ */ V(
|
|
1065
|
+
icon: /* @__PURE__ */ V(at, {}),
|
|
1066
|
+
label: /* @__PURE__ */ V(ot, { loadingLabel: t === 0 ? r?.loading : void 0 }),
|
|
1051
1067
|
disabled: !0
|
|
1052
1068
|
}));
|
|
1053
1069
|
if (!e || e.length === 0) {
|
|
@@ -1058,19 +1074,19 @@ var tt = ({ size: e = 20 }) => /* @__PURE__ */ V(b, {
|
|
|
1058
1074
|
disabled: !0
|
|
1059
1075
|
}] : [];
|
|
1060
1076
|
}
|
|
1061
|
-
return
|
|
1077
|
+
return lt(e, a).map((e) => {
|
|
1062
1078
|
let r = e.id === t;
|
|
1063
1079
|
return {
|
|
1064
1080
|
key: e.id,
|
|
1065
1081
|
label: /* @__PURE__ */ H("span", {
|
|
1066
1082
|
className: "flex w-full items-center justify-between gap-2",
|
|
1067
|
-
children: [/* @__PURE__ */ V(
|
|
1068
|
-
text:
|
|
1083
|
+
children: [/* @__PURE__ */ V(D, {
|
|
1084
|
+
text: ct(e),
|
|
1069
1085
|
query: a,
|
|
1070
1086
|
maxLines: 1
|
|
1071
|
-
}), r && /* @__PURE__ */ V(
|
|
1087
|
+
}), r && /* @__PURE__ */ V(rt, { gradientId: "ms-check-grad" })]
|
|
1072
1088
|
}),
|
|
1073
|
-
icon:
|
|
1089
|
+
icon: ut(e.iconUrl, e.type, e.displayName ?? e.id),
|
|
1074
1090
|
onClick: () => n?.(e.id),
|
|
1075
1091
|
className: r ? "bg-accent-primary-alpha" : void 0
|
|
1076
1092
|
};
|
|
@@ -1103,8 +1119,8 @@ var tt = ({ size: e = 20 }) => /* @__PURE__ */ V(b, {
|
|
|
1103
1119
|
e || s("");
|
|
1104
1120
|
}
|
|
1105
1121
|
};
|
|
1106
|
-
},
|
|
1107
|
-
function
|
|
1122
|
+
}, ft = typeof window < "u" ? _e : I;
|
|
1123
|
+
function pt(e) {
|
|
1108
1124
|
if (e !== void 0) switch (typeof e) {
|
|
1109
1125
|
case "number": return e;
|
|
1110
1126
|
case "string":
|
|
@@ -1112,15 +1128,15 @@ function lt(e) {
|
|
|
1112
1128
|
break;
|
|
1113
1129
|
}
|
|
1114
1130
|
}
|
|
1115
|
-
function
|
|
1131
|
+
function mt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
|
|
1116
1132
|
let { styleHeight: s, styleWidth: c } = L(() => ({
|
|
1117
|
-
styleHeight:
|
|
1118
|
-
styleWidth:
|
|
1133
|
+
styleHeight: pt(o?.height),
|
|
1134
|
+
styleWidth: pt(o?.width)
|
|
1119
1135
|
}), [o?.height, o?.width]), [l, u] = z({
|
|
1120
1136
|
height: t,
|
|
1121
1137
|
width: n
|
|
1122
1138
|
}), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
|
|
1123
|
-
return
|
|
1139
|
+
return ft(() => {
|
|
1124
1140
|
if (i === null || d) return;
|
|
1125
1141
|
let t = new ResizeObserver((e) => {
|
|
1126
1142
|
for (let t of e) {
|
|
@@ -1149,26 +1165,26 @@ function ut({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1149
1165
|
c
|
|
1150
1166
|
]);
|
|
1151
1167
|
}
|
|
1152
|
-
function
|
|
1168
|
+
function ht(e) {
|
|
1153
1169
|
let t = R(() => {
|
|
1154
1170
|
throw Error("Cannot call during render.");
|
|
1155
1171
|
});
|
|
1156
|
-
return
|
|
1172
|
+
return ft(() => {
|
|
1157
1173
|
t.current = e;
|
|
1158
|
-
}, [e]),
|
|
1174
|
+
}, [e]), F((e) => t.current?.(e), [t]);
|
|
1159
1175
|
}
|
|
1160
|
-
var
|
|
1161
|
-
function
|
|
1162
|
-
if (
|
|
1176
|
+
var X = null;
|
|
1177
|
+
function gt(e = !1) {
|
|
1178
|
+
if (X === null || e) {
|
|
1163
1179
|
let e = document.createElement("div"), t = e.style;
|
|
1164
1180
|
t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
|
|
1165
1181
|
let n = document.createElement("div"), r = n.style;
|
|
1166
|
-
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ?
|
|
1182
|
+
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? X = "positive-descending" : (e.scrollLeft = 1, X = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), X;
|
|
1167
1183
|
}
|
|
1168
|
-
return
|
|
1184
|
+
return X;
|
|
1169
1185
|
}
|
|
1170
|
-
function
|
|
1171
|
-
if (t === "horizontal" && n) switch (
|
|
1186
|
+
function _t({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
1187
|
+
if (t === "horizontal" && n) switch (gt()) {
|
|
1172
1188
|
case "negative": return -r;
|
|
1173
1189
|
case "positive-descending":
|
|
1174
1190
|
if (e) {
|
|
@@ -1179,26 +1195,26 @@ function mt({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
|
1179
1195
|
}
|
|
1180
1196
|
return r;
|
|
1181
1197
|
}
|
|
1182
|
-
function
|
|
1198
|
+
function Z(e, t = "Assertion error") {
|
|
1183
1199
|
if (!e) throw console.error(t), Error(t);
|
|
1184
1200
|
}
|
|
1185
|
-
function
|
|
1201
|
+
function Q(e, t) {
|
|
1186
1202
|
if (e === t) return !0;
|
|
1187
|
-
if (!!e != !!t || (
|
|
1203
|
+
if (!!e != !!t || (Z(e !== void 0), Z(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
|
|
1188
1204
|
for (let n in e) if (!Object.is(t[n], e[n])) return !1;
|
|
1189
1205
|
return !0;
|
|
1190
1206
|
}
|
|
1191
|
-
function
|
|
1207
|
+
function vt({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
1192
1208
|
if (t === 0) return 0;
|
|
1193
1209
|
if (typeof n == "number") return t * n;
|
|
1194
1210
|
{
|
|
1195
1211
|
let n = e.get(e.size === 0 ? 0 : e.size - 1);
|
|
1196
|
-
return
|
|
1212
|
+
return Z(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
|
|
1197
1213
|
}
|
|
1198
1214
|
}
|
|
1199
|
-
function
|
|
1215
|
+
function yt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
|
|
1200
1216
|
if (n < 0 || n >= r) throw RangeError(`Invalid index specified: ${n}`, { cause: `Index ${n} is not within the range of 0 - ${r - 1}` });
|
|
1201
|
-
let s =
|
|
1217
|
+
let s = vt({
|
|
1202
1218
|
cachedBounds: t,
|
|
1203
1219
|
itemCount: r,
|
|
1204
1220
|
itemSize: i
|
|
@@ -1210,7 +1226,7 @@ function _t({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, co
|
|
|
1210
1226
|
default: return a >= u && a <= l ? a : a < u ? u : l;
|
|
1211
1227
|
}
|
|
1212
1228
|
}
|
|
1213
|
-
function
|
|
1229
|
+
function bt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
|
|
1214
1230
|
let a = r - 1, o = 0, s = -1, c = 0, l = -1, u = 0;
|
|
1215
1231
|
for (; u < a;) {
|
|
1216
1232
|
let n = e.get(u);
|
|
@@ -1229,11 +1245,11 @@ function vt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemC
|
|
|
1229
1245
|
stopIndexOverscan: l
|
|
1230
1246
|
};
|
|
1231
1247
|
}
|
|
1232
|
-
function
|
|
1248
|
+
function xt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1233
1249
|
let r = /* @__PURE__ */ new Map();
|
|
1234
1250
|
return {
|
|
1235
1251
|
get(i) {
|
|
1236
|
-
for (
|
|
1252
|
+
for (Z(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
|
|
1237
1253
|
let e = r.size, a;
|
|
1238
1254
|
switch (typeof n) {
|
|
1239
1255
|
case "function":
|
|
@@ -1249,14 +1265,14 @@ function yt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1249
1265
|
});
|
|
1250
1266
|
else {
|
|
1251
1267
|
let t = r.get(e - 1);
|
|
1252
|
-
|
|
1268
|
+
Z(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
|
|
1253
1269
|
scrollOffset: t.scrollOffset + t.size,
|
|
1254
1270
|
size: a
|
|
1255
1271
|
});
|
|
1256
1272
|
}
|
|
1257
1273
|
}
|
|
1258
1274
|
let a = r.get(i);
|
|
1259
|
-
return
|
|
1275
|
+
return Z(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
|
|
1260
1276
|
},
|
|
1261
1277
|
set(e, t) {
|
|
1262
1278
|
r.set(e, t);
|
|
@@ -1266,8 +1282,8 @@ function yt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1266
1282
|
}
|
|
1267
1283
|
};
|
|
1268
1284
|
}
|
|
1269
|
-
function
|
|
1270
|
-
return L(() =>
|
|
1285
|
+
function St({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1286
|
+
return L(() => xt({
|
|
1271
1287
|
itemCount: e,
|
|
1272
1288
|
itemProps: t,
|
|
1273
1289
|
itemSize: n
|
|
@@ -1277,11 +1293,11 @@ function bt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1277
1293
|
n
|
|
1278
1294
|
]);
|
|
1279
1295
|
}
|
|
1280
|
-
function
|
|
1296
|
+
function $({ containerSize: e, itemSize: t }) {
|
|
1281
1297
|
let n;
|
|
1282
1298
|
switch (typeof t) {
|
|
1283
1299
|
case "string":
|
|
1284
|
-
|
|
1300
|
+
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;
|
|
1285
1301
|
break;
|
|
1286
1302
|
default:
|
|
1287
1303
|
n = t;
|
|
@@ -1289,8 +1305,8 @@ function xt({ containerSize: e, itemSize: t }) {
|
|
|
1289
1305
|
}
|
|
1290
1306
|
return n;
|
|
1291
1307
|
}
|
|
1292
|
-
function
|
|
1293
|
-
let { height: u = n, width: d = n } =
|
|
1308
|
+
function Ct({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
|
|
1309
|
+
let { height: u = n, width: d = n } = mt({
|
|
1294
1310
|
defaultHeight: r === "vertical" ? n : void 0,
|
|
1295
1311
|
defaultWidth: r === "horizontal" ? n : void 0,
|
|
1296
1312
|
element: e,
|
|
@@ -1299,11 +1315,11 @@ function St({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1299
1315
|
}), f = R({
|
|
1300
1316
|
height: 0,
|
|
1301
1317
|
width: 0
|
|
1302
|
-
}), p = r === "vertical" ? u : d, m =
|
|
1318
|
+
}), p = r === "vertical" ? u : d, m = $({
|
|
1303
1319
|
containerSize: p,
|
|
1304
1320
|
itemSize: s
|
|
1305
1321
|
});
|
|
1306
|
-
|
|
1322
|
+
_e(() => {
|
|
1307
1323
|
if (typeof c == "function") {
|
|
1308
1324
|
let e = f.current;
|
|
1309
1325
|
(e.height !== u || e.width !== d) && (c({
|
|
@@ -1316,11 +1332,11 @@ function St({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1316
1332
|
c,
|
|
1317
1333
|
d
|
|
1318
1334
|
]);
|
|
1319
|
-
let h =
|
|
1335
|
+
let h = St({
|
|
1320
1336
|
itemCount: a,
|
|
1321
1337
|
itemProps: o,
|
|
1322
1338
|
itemSize: m
|
|
1323
|
-
}), g =
|
|
1339
|
+
}), g = F((e) => h.get(e), [h]), [_, v] = z(() => bt({
|
|
1324
1340
|
cachedBounds: h,
|
|
1325
1341
|
containerScrollOffset: 0,
|
|
1326
1342
|
containerSize: p,
|
|
@@ -1331,7 +1347,7 @@ function St({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1331
1347
|
startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
|
|
1332
1348
|
stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
|
|
1333
1349
|
stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
|
|
1334
|
-
}, C =
|
|
1350
|
+
}, C = F(() => vt({
|
|
1335
1351
|
cachedBounds: h,
|
|
1336
1352
|
itemCount: a,
|
|
1337
1353
|
itemSize: m
|
|
@@ -1339,9 +1355,9 @@ function St({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1339
1355
|
h,
|
|
1340
1356
|
a,
|
|
1341
1357
|
m
|
|
1342
|
-
]), w =
|
|
1358
|
+
]), w = F((t) => bt({
|
|
1343
1359
|
cachedBounds: h,
|
|
1344
|
-
containerScrollOffset:
|
|
1360
|
+
containerScrollOffset: _t({
|
|
1345
1361
|
containerElement: e,
|
|
1346
1362
|
direction: r,
|
|
1347
1363
|
isRtl: i,
|
|
@@ -1359,19 +1375,19 @@ function St({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1359
1375
|
a,
|
|
1360
1376
|
l
|
|
1361
1377
|
]);
|
|
1362
|
-
return
|
|
1378
|
+
return ft(() => {
|
|
1363
1379
|
v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
|
|
1364
1380
|
}, [
|
|
1365
1381
|
e,
|
|
1366
1382
|
r,
|
|
1367
1383
|
w
|
|
1368
|
-
]),
|
|
1384
|
+
]), ft(() => {
|
|
1369
1385
|
if (!e) return;
|
|
1370
1386
|
let t = () => {
|
|
1371
1387
|
v((t) => {
|
|
1372
|
-
let { scrollLeft: n, scrollTop: o } = e, s =
|
|
1388
|
+
let { scrollLeft: n, scrollTop: o } = e, s = bt({
|
|
1373
1389
|
cachedBounds: h,
|
|
1374
|
-
containerScrollOffset:
|
|
1390
|
+
containerScrollOffset: _t({
|
|
1375
1391
|
containerElement: e,
|
|
1376
1392
|
direction: r,
|
|
1377
1393
|
isRtl: i,
|
|
@@ -1381,7 +1397,7 @@ function St({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1381
1397
|
itemCount: a,
|
|
1382
1398
|
overscanCount: l
|
|
1383
1399
|
});
|
|
1384
|
-
return
|
|
1400
|
+
return Q(s, t) ? t : s;
|
|
1385
1401
|
});
|
|
1386
1402
|
};
|
|
1387
1403
|
return e.addEventListener("scroll", t), () => {
|
|
@@ -1397,8 +1413,8 @@ function St({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1397
1413
|
]), {
|
|
1398
1414
|
getCellBounds: g,
|
|
1399
1415
|
getEstimatedSize: C,
|
|
1400
|
-
scrollToIndex:
|
|
1401
|
-
let s =
|
|
1416
|
+
scrollToIndex: ht(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
|
|
1417
|
+
let s = yt({
|
|
1402
1418
|
align: t,
|
|
1403
1419
|
cachedBounds: h,
|
|
1404
1420
|
containerScrollOffset: n,
|
|
@@ -1408,14 +1424,14 @@ function St({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1408
1424
|
itemSize: m
|
|
1409
1425
|
});
|
|
1410
1426
|
if (e) {
|
|
1411
|
-
if (s =
|
|
1427
|
+
if (s = _t({
|
|
1412
1428
|
containerElement: e,
|
|
1413
1429
|
direction: r,
|
|
1414
1430
|
isRtl: i,
|
|
1415
1431
|
scrollOffset: s
|
|
1416
1432
|
}), typeof e.scrollTo != "function") {
|
|
1417
1433
|
let e = w(s);
|
|
1418
|
-
|
|
1434
|
+
Q(_, e) || v(e);
|
|
1419
1435
|
}
|
|
1420
1436
|
return s;
|
|
1421
1437
|
}
|
|
@@ -1426,19 +1442,19 @@ function St({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1426
1442
|
stopIndexVisible: x
|
|
1427
1443
|
};
|
|
1428
1444
|
}
|
|
1429
|
-
function
|
|
1445
|
+
function wt(e) {
|
|
1430
1446
|
return L(() => e, Object.values(e));
|
|
1431
1447
|
}
|
|
1432
|
-
function
|
|
1448
|
+
function Tt(e, t) {
|
|
1433
1449
|
let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
|
|
1434
|
-
return
|
|
1450
|
+
return Q(n, a) && Q(r, o) && Q(i, s);
|
|
1435
1451
|
}
|
|
1436
|
-
function
|
|
1452
|
+
function Et(e) {
|
|
1437
1453
|
return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
1438
1454
|
}
|
|
1439
|
-
var
|
|
1440
|
-
function
|
|
1441
|
-
let m =
|
|
1455
|
+
var Dt = "data-react-window-index";
|
|
1456
|
+
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 }) {
|
|
1457
|
+
let m = wt(u), h = L(() => he(s, Tt), [s]), [g, _] = z(null), v = Et(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = Ct({
|
|
1442
1458
|
containerElement: g,
|
|
1443
1459
|
containerStyle: f,
|
|
1444
1460
|
defaultContainerSize: n,
|
|
@@ -1449,7 +1465,7 @@ function Et({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1449
1465
|
onResize: i,
|
|
1450
1466
|
overscanCount: o
|
|
1451
1467
|
});
|
|
1452
|
-
|
|
1468
|
+
ge(r, () => ({
|
|
1453
1469
|
get element() {
|
|
1454
1470
|
return g;
|
|
1455
1471
|
},
|
|
@@ -1464,12 +1480,12 @@ function Et({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1464
1480
|
top: r
|
|
1465
1481
|
});
|
|
1466
1482
|
}
|
|
1467
|
-
}), [g, x]),
|
|
1483
|
+
}), [g, x]), ft(() => {
|
|
1468
1484
|
if (!g) return;
|
|
1469
1485
|
let e = Array.from(g.children).filter((e, t) => {
|
|
1470
1486
|
if (e.hasAttribute("aria-hidden")) return !1;
|
|
1471
1487
|
let n = `${S + t}`;
|
|
1472
|
-
return e.setAttribute(
|
|
1488
|
+
return e.setAttribute(Dt, n), !0;
|
|
1473
1489
|
});
|
|
1474
1490
|
if (v) return l.observeRowElements(e);
|
|
1475
1491
|
}, [
|
|
@@ -1478,7 +1494,7 @@ function Et({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1478
1494
|
l,
|
|
1479
1495
|
S,
|
|
1480
1496
|
w
|
|
1481
|
-
]),
|
|
1497
|
+
]), I(() => {
|
|
1482
1498
|
S >= 0 && w >= 0 && a && a({
|
|
1483
1499
|
startIndex: C,
|
|
1484
1500
|
stopIndex: T
|
|
@@ -1497,7 +1513,7 @@ function Et({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1497
1513
|
let e = [];
|
|
1498
1514
|
if (c > 0) for (let t = S; t <= w; t++) {
|
|
1499
1515
|
let n = y(t);
|
|
1500
|
-
e.push(/* @__PURE__ */
|
|
1516
|
+
e.push(/* @__PURE__ */ P(h, {
|
|
1501
1517
|
...m,
|
|
1502
1518
|
ariaAttributes: {
|
|
1503
1519
|
"aria-posinset": t + 1,
|
|
@@ -1532,7 +1548,7 @@ function Et({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1532
1548
|
zIndex: -1
|
|
1533
1549
|
}
|
|
1534
1550
|
});
|
|
1535
|
-
return
|
|
1551
|
+
return P(d, {
|
|
1536
1552
|
role: "list",
|
|
1537
1553
|
...p,
|
|
1538
1554
|
className: t,
|
|
@@ -1546,123 +1562,135 @@ function Et({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1546
1562
|
}
|
|
1547
1563
|
}, E, e, D);
|
|
1548
1564
|
}
|
|
1549
|
-
var
|
|
1565
|
+
var kt = {
|
|
1550
1566
|
divider: "_divider_13nxz_1",
|
|
1551
1567
|
item: "_item_13nxz_5",
|
|
1552
1568
|
itemIcon: "_itemIcon_13nxz_15",
|
|
1553
1569
|
checkIcon: "_checkIcon_13nxz_19",
|
|
1554
1570
|
stateLabel: "_stateLabel_13nxz_23"
|
|
1555
|
-
},
|
|
1556
|
-
let d = r[e], f =
|
|
1571
|
+
}, At = 44, jt = 8, Mt = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: s, onSelect: c }) => {
|
|
1572
|
+
let d = r[e], f = ut(d.iconUrl, d.type, d.displayName ?? d.id, u.SM), p = d.id === i;
|
|
1557
1573
|
return /* @__PURE__ */ V("div", {
|
|
1558
1574
|
style: t,
|
|
1559
1575
|
...n,
|
|
1560
1576
|
children: /* @__PURE__ */ V(l, {
|
|
1561
1577
|
type: "button",
|
|
1562
|
-
className: o(
|
|
1578
|
+
className: o(kt.item, "h-full w-full gap-3 px-4"),
|
|
1563
1579
|
iconBefore: /* @__PURE__ */ V("span", {
|
|
1564
|
-
className:
|
|
1580
|
+
className: kt.itemIcon,
|
|
1565
1581
|
children: f
|
|
1566
1582
|
}),
|
|
1567
1583
|
label: /* @__PURE__ */ H("span", {
|
|
1568
1584
|
className: "flex flex-1 items-center justify-between gap-2",
|
|
1569
|
-
children: [/* @__PURE__ */ V(
|
|
1585
|
+
children: [/* @__PURE__ */ V(D, {
|
|
1570
1586
|
text: d.displayName ?? d.id,
|
|
1571
1587
|
query: s,
|
|
1572
1588
|
maxLines: 1,
|
|
1573
1589
|
className: o(a, "min-w-0 flex-1 text-start")
|
|
1574
|
-
}), p && /* @__PURE__ */ V(
|
|
1590
|
+
}), p && /* @__PURE__ */ V(j, {
|
|
1575
1591
|
size: u.SM,
|
|
1576
|
-
className:
|
|
1592
|
+
className: kt.checkIcon,
|
|
1577
1593
|
"aria-hidden": !0
|
|
1578
1594
|
})]
|
|
1579
1595
|
}),
|
|
1580
1596
|
onClick: () => c(d.id)
|
|
1581
1597
|
})
|
|
1582
1598
|
});
|
|
1583
|
-
},
|
|
1584
|
-
let [
|
|
1585
|
-
|
|
1586
|
-
e ||
|
|
1599
|
+
}, Nt = ({ isOpen: e, title: t, closeLabel: n, searchPlaceholder: r = "Search", onClose: i, deployments: s, selectedDeploymentId: c, onSelect: l, loadingLabel: u, errorLabel: d, emptyLabel: f, style: p, titleClassName: m = "dial-body-semi-text", labelClassName: h = "dial-small-text", colors: g }) => {
|
|
1600
|
+
let [_, v] = z("");
|
|
1601
|
+
I(() => {
|
|
1602
|
+
e || v("");
|
|
1587
1603
|
}, [e]);
|
|
1588
|
-
let
|
|
1589
|
-
|
|
1604
|
+
let b = s && s.length > 0, x = u !== void 0, S = !b && !x ? d ?? f : void 0, C = b ? lt(s, _) : [], w = (e) => {
|
|
1605
|
+
l(e), i();
|
|
1606
|
+
}, E = a({
|
|
1607
|
+
"--ci-sheet-divider": g?.divider,
|
|
1608
|
+
"--ci-sheet-text": g?.itemText,
|
|
1609
|
+
"--ci-sheet-item-hover": g?.itemHoverBg,
|
|
1610
|
+
"--ci-sheet-item-active": g?.itemActiveBg,
|
|
1611
|
+
"--ci-sheet-icon": g?.itemIcon,
|
|
1612
|
+
"--ci-check-icon": g?.checkIcon
|
|
1613
|
+
});
|
|
1614
|
+
return /* @__PURE__ */ V(W, {
|
|
1590
1615
|
isOpen: e,
|
|
1591
1616
|
title: t,
|
|
1592
1617
|
closeLabel: n,
|
|
1593
1618
|
onClose: i,
|
|
1594
|
-
style:
|
|
1595
|
-
titleClassName:
|
|
1619
|
+
style: p,
|
|
1620
|
+
titleClassName: m,
|
|
1596
1621
|
className: "max-h-[80dvh]",
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
c
|
|
1622
|
+
colors: g?.shell,
|
|
1623
|
+
children: /* @__PURE__ */ H("div", {
|
|
1624
|
+
className: "contents",
|
|
1625
|
+
style: E,
|
|
1626
|
+
children: [b && !x && /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("div", {
|
|
1627
|
+
className: "flex-shrink-0 px-4 py-[10px]",
|
|
1628
|
+
children: /* @__PURE__ */ V(y, {
|
|
1629
|
+
value: _,
|
|
1630
|
+
placeholder: r,
|
|
1631
|
+
size: T.Standard,
|
|
1632
|
+
onChange: v
|
|
1633
|
+
})
|
|
1634
|
+
}), /* @__PURE__ */ V("div", { className: o(kt.divider, "h-px flex-shrink-0") })] }), x ? /* @__PURE__ */ V(st, { loadingLabel: u }) : S ? /* @__PURE__ */ V("div", {
|
|
1635
|
+
role: "list",
|
|
1636
|
+
className: o(kt.stateLabel, h, "px-4 py-4"),
|
|
1637
|
+
children: S
|
|
1638
|
+
}) : /* @__PURE__ */ V(Ot, {
|
|
1639
|
+
role: "list",
|
|
1640
|
+
className: "overflow-y-auto",
|
|
1641
|
+
style: { height: Math.min(C.length, jt) * At },
|
|
1642
|
+
rowComponent: Mt,
|
|
1643
|
+
rowCount: C.length,
|
|
1644
|
+
rowHeight: At,
|
|
1645
|
+
rowProps: {
|
|
1646
|
+
items: C,
|
|
1647
|
+
selectedDeploymentId: c,
|
|
1648
|
+
labelClassName: h,
|
|
1649
|
+
query: _,
|
|
1650
|
+
onSelect: w
|
|
1623
1651
|
}
|
|
1624
|
-
}
|
|
1625
|
-
})
|
|
1652
|
+
})]
|
|
1653
|
+
})
|
|
1626
1654
|
});
|
|
1627
|
-
},
|
|
1628
|
-
let [
|
|
1655
|
+
}, Pt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, isStreaming: i, isMobile: a, isInputDisabled: s = !1, isDisabled: c = !1, style: l, modelPickerOverlay: d, isPickerOpen: m, onPickerToggle: h, onPickerOpenChange: g }) => {
|
|
1656
|
+
let [_, v] = z(!1), { selectorIcon: y, selectorAriaLabel: b, selectedLabel: x, menuItems: S, menuHeader: C, onOpenChange: D } = dt({
|
|
1629
1657
|
deployments: e,
|
|
1630
1658
|
selectedDeploymentId: t,
|
|
1631
1659
|
onDeploymentChange: n,
|
|
1632
1660
|
modelSelectorLabels: r
|
|
1633
1661
|
});
|
|
1634
1662
|
if (!e) return null;
|
|
1635
|
-
let O = i || c ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, k = /* @__PURE__ */ V(
|
|
1663
|
+
let O = i || c ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, k = /* @__PURE__ */ V(ae, {
|
|
1636
1664
|
size: u.SM,
|
|
1637
|
-
className:
|
|
1665
|
+
className: q.modelSelectorCaret,
|
|
1638
1666
|
"aria-hidden": !0
|
|
1639
1667
|
});
|
|
1640
1668
|
return a ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(w, {
|
|
1641
|
-
tooltip:
|
|
1642
|
-
children: /* @__PURE__ */ V(
|
|
1669
|
+
tooltip: x,
|
|
1670
|
+
children: /* @__PURE__ */ V(E, {
|
|
1643
1671
|
icon: /* @__PURE__ */ H("div", {
|
|
1644
1672
|
className: "flex items-center gap-1",
|
|
1645
|
-
children: [
|
|
1673
|
+
children: [y, k]
|
|
1646
1674
|
}),
|
|
1647
|
-
"aria-label":
|
|
1675
|
+
"aria-label": b,
|
|
1648
1676
|
onClick: () => {
|
|
1649
|
-
c ||
|
|
1677
|
+
c || v(!0);
|
|
1650
1678
|
},
|
|
1651
|
-
className: o(
|
|
1679
|
+
className: o(q.modelSelectorButton, O)
|
|
1652
1680
|
})
|
|
1653
|
-
}), d ? /* @__PURE__ */ V(
|
|
1654
|
-
isOpen:
|
|
1681
|
+
}), d ? /* @__PURE__ */ V(W, {
|
|
1682
|
+
isOpen: _,
|
|
1655
1683
|
title: r?.ariaLabel ?? "Select model",
|
|
1656
1684
|
closeLabel: r?.closeLabel ?? "Close",
|
|
1657
|
-
onClose: () =>
|
|
1685
|
+
onClose: () => v(!1),
|
|
1658
1686
|
style: l,
|
|
1659
|
-
children: d(() =>
|
|
1660
|
-
}) : /* @__PURE__ */ V(
|
|
1661
|
-
isOpen:
|
|
1687
|
+
children: d(() => v(!1))
|
|
1688
|
+
}) : /* @__PURE__ */ V(Nt, {
|
|
1689
|
+
isOpen: _,
|
|
1662
1690
|
title: r?.ariaLabel ?? "Select model",
|
|
1663
1691
|
closeLabel: r?.closeLabel ?? "Close",
|
|
1664
1692
|
searchPlaceholder: r?.searchPlaceholder ?? "Search",
|
|
1665
|
-
onClose: () =>
|
|
1693
|
+
onClose: () => v(!1),
|
|
1666
1694
|
deployments: e,
|
|
1667
1695
|
selectedDeploymentId: t,
|
|
1668
1696
|
onSelect: (e) => n?.(e),
|
|
@@ -1674,33 +1702,33 @@ var Dt = {
|
|
|
1674
1702
|
placement: "top-end",
|
|
1675
1703
|
matchReferenceWidth: !1,
|
|
1676
1704
|
open: m,
|
|
1677
|
-
onOpenChange:
|
|
1705
|
+
onOpenChange: g,
|
|
1678
1706
|
trigger: [],
|
|
1679
1707
|
outsideClosable: !0,
|
|
1680
|
-
renderOverlay: () => d(() =>
|
|
1708
|
+
renderOverlay: () => d(() => g?.(!1)),
|
|
1681
1709
|
listClassName: "cp-dropdown-overlay !w-[320px]",
|
|
1682
1710
|
children: /* @__PURE__ */ V(w, {
|
|
1683
|
-
tooltip:
|
|
1711
|
+
tooltip: x,
|
|
1684
1712
|
children: /* @__PURE__ */ H("button", {
|
|
1685
1713
|
type: "button",
|
|
1686
|
-
"aria-label":
|
|
1687
|
-
className: o("flex items-center justify-center gap-1 rounded-
|
|
1714
|
+
"aria-label": b,
|
|
1715
|
+
className: o("flex items-center justify-center gap-1 rounded-full p-2", q.modelSelectorButton, s || i || c ? O : void 0, (s || c) && q.modelSelectorButtonDisabled),
|
|
1688
1716
|
onClick: () => {
|
|
1689
|
-
!s && !i && !c &&
|
|
1717
|
+
!s && !i && !c && h?.();
|
|
1690
1718
|
},
|
|
1691
|
-
children: [
|
|
1719
|
+
children: [y, k]
|
|
1692
1720
|
})
|
|
1693
1721
|
})
|
|
1694
1722
|
}) : /* @__PURE__ */ V("div", {
|
|
1695
1723
|
className: o(c && O),
|
|
1696
1724
|
"aria-disabled": c || void 0,
|
|
1697
1725
|
children: /* @__PURE__ */ V(w, {
|
|
1698
|
-
tooltip:
|
|
1726
|
+
tooltip: x,
|
|
1699
1727
|
children: /* @__PURE__ */ V(p, {
|
|
1700
|
-
icon:
|
|
1701
|
-
ariaLabel:
|
|
1702
|
-
items:
|
|
1703
|
-
menuHeader:
|
|
1728
|
+
icon: y,
|
|
1729
|
+
ariaLabel: b,
|
|
1730
|
+
items: S,
|
|
1731
|
+
menuHeader: C,
|
|
1704
1732
|
placement: "bottom-end",
|
|
1705
1733
|
matchReferenceWidth: !1,
|
|
1706
1734
|
listClassName: "cp-dropdown-overlay !w-[240px] !max-h-80",
|
|
@@ -1708,242 +1736,244 @@ var Dt = {
|
|
|
1708
1736
|
size: T.Standard,
|
|
1709
1737
|
caretIcon: k,
|
|
1710
1738
|
iconClassName: s || c ? O : void 0,
|
|
1711
|
-
buttonClassName: o("bg-transparent",
|
|
1739
|
+
buttonClassName: o("bg-transparent", q.modelSelectorButton, (s || c) && O && q.modelSelectorButtonDisabled)
|
|
1712
1740
|
})
|
|
1713
1741
|
})
|
|
1714
1742
|
});
|
|
1715
|
-
},
|
|
1716
|
-
let We = s(), [Ge,
|
|
1717
|
-
"--ci-bg":
|
|
1718
|
-
"--ci-text":
|
|
1719
|
-
"--ci-border":
|
|
1720
|
-
"--ci-border-
|
|
1721
|
-
"--ci-
|
|
1722
|
-
"--ci-
|
|
1723
|
-
"--ci-
|
|
1724
|
-
"--ci-
|
|
1725
|
-
"--ci-
|
|
1726
|
-
"--ci-
|
|
1727
|
-
"--ci-
|
|
1728
|
-
|
|
1743
|
+
}, Ft = 160, It = ({ message: e = "", messageRevision: t, onSend: n, onUploadAttachment: r, onStop: i, isStreaming: l = !1, onChange: d, onAttachmentsChange: f, placeholder: p = "Type a message...", ariaLabel: m, attachLabel: h = "Attach file", fileAccept: g, addMenuTitle: _ = "Add", menuTitle: v = "Menu", menuCloseLabel: y = "Close", removeLabel: b, retryLabel: x, sendLabel: S, stopLabel: C, micLabel: w = "Record voice message", stopRecordingLabel: T, discardRecordingLabel: E, timerAriaLabel: D, colors: O, typography: k, className: A, pendingDropFiles: ee = [], onDropFilesConsumed: te, pendingAttachments: re = [], onPendingAttachmentsConsumed: ie, pasteTextThreshold: j = 4e3, deployments: ae, selectedDeploymentId: M, onDeploymentChange: ce, modelSelectorLabels: le, initialAttachments: N = [], isStacked: ue = !1, hideAddButton: de = !1, hideAttachFile: fe = !1, hideActionBar: pe = !1, renderFooterActions: me, isInputDisabled: P = !1, isModelSelectorDisabled: he = !1, isSendDisabled: I = !1, isAudioMessageSupported: ge = !1, sendOnEnter: _e = ze.Enter, prefixAttachments: U = [], onRemovePrefixAttachment: ve, chatSettings: ye, toolsMenuItems: xe, onToolToggle: Se, toolsMenuTitle: Ce, toolsBackLabel: we, toolsChipLabels: Ee, autoFocus: De = !1, messageHistory: W, onDialFileSystemClick: Oe, dialFileSystemLabel: je, validateAttachment: Me, onAttachmentClick: Fe, modelPickerOverlay: Ie, maximumAttachmentsAmount: Le, onAttachmentsLimitExceeded: Be, isAttachmentsEnabled: Ve = !0, usageLimitsSlot: He, onMessageTooLong: Ue }) => {
|
|
1744
|
+
let We = s(), [Ge, Ke] = z(!1), qe = Ne(W), G = L(() => a({
|
|
1745
|
+
"--ci-bg": O?.background,
|
|
1746
|
+
"--ci-text": O?.text,
|
|
1747
|
+
"--ci-border": O?.border,
|
|
1748
|
+
"--ci-border-focus": O?.borderFocus,
|
|
1749
|
+
"--ci-placeholder": O?.placeholder,
|
|
1750
|
+
"--ci-text-disabled": O?.textDisabled,
|
|
1751
|
+
"--ci-model-selector-caret-color": O?.modelSelectorCaret,
|
|
1752
|
+
"--ci-model-selector-hover-bg": O?.modelSelectorHoverBg,
|
|
1753
|
+
"--ci-model-selector-disabled-color": O?.modelSelectorDisabled,
|
|
1754
|
+
"--ci-voice-error": O?.voiceError,
|
|
1755
|
+
"--ci-voice-waveform": O?.voiceWaveform,
|
|
1756
|
+
"--ci-voice-accent": O?.voiceAccent
|
|
1757
|
+
}), [O]), Ye = L(() => Oe ? [{
|
|
1729
1758
|
key: "dial-fs",
|
|
1730
|
-
label:
|
|
1731
|
-
icon: /* @__PURE__ */ V(
|
|
1759
|
+
label: je ?? "DIAL file system",
|
|
1760
|
+
icon: /* @__PURE__ */ V(oe, {
|
|
1732
1761
|
size: c,
|
|
1733
1762
|
"aria-hidden": !0
|
|
1734
1763
|
}),
|
|
1735
|
-
onClick:
|
|
1736
|
-
}] : [], [
|
|
1764
|
+
onClick: Oe
|
|
1765
|
+
}] : [], [Oe, je]), { message: K, setMessage: J, textareaRef: Ze, isMultiLine: Qe } = Pe({
|
|
1737
1766
|
messageProp: e,
|
|
1738
1767
|
messageRevision: t
|
|
1739
|
-
}), { attachments:
|
|
1740
|
-
initialAttachments:
|
|
1768
|
+
}), { attachments: Y, buildAttachments: $e, addAttachments: rt, resetAttachments: it, handleRemove: at, handleRetry: ot, handleExpand: st, hasBlockedAttachments: ct } = ke({
|
|
1769
|
+
initialAttachments: N,
|
|
1741
1770
|
onUploadAttachment: r,
|
|
1742
1771
|
onAttachmentsChange: f,
|
|
1743
|
-
validateAttachment:
|
|
1744
|
-
pendingDropFiles:
|
|
1745
|
-
onDropFilesConsumed:
|
|
1772
|
+
validateAttachment: Me,
|
|
1773
|
+
pendingDropFiles: ee,
|
|
1774
|
+
onDropFilesConsumed: te,
|
|
1746
1775
|
pendingAttachments: re,
|
|
1747
1776
|
onPendingAttachmentsConsumed: ie,
|
|
1748
|
-
onExpandPastedText:
|
|
1777
|
+
onExpandPastedText: F((e) => {
|
|
1749
1778
|
J((t) => t ? `${t}\n${e}` : e);
|
|
1750
1779
|
}, [J]),
|
|
1751
|
-
maximumAttachmentsAmount:
|
|
1752
|
-
baseAttachmentsAmount:
|
|
1753
|
-
onAttachmentsLimitExceeded:
|
|
1754
|
-
}), { state:
|
|
1755
|
-
|
|
1756
|
-
}, [
|
|
1757
|
-
if (!
|
|
1780
|
+
maximumAttachmentsAmount: Le,
|
|
1781
|
+
baseAttachmentsAmount: U.length,
|
|
1782
|
+
onAttachmentsLimitExceeded: Be
|
|
1783
|
+
}), { state: lt, analyserNodeRef: ut, elapsedSeconds: dt, errorMessage: ft, startRecording: pt, stopRecording: mt, discardRecording: ht } = Re({ onAttachAudio: F((e) => {
|
|
1784
|
+
rt($e([e]));
|
|
1785
|
+
}, [rt, $e]) }), X = R(null), gt = R(null), { handlePaste: _t } = Te(rt, Ve ? j : Infinity), Z = F((e) => {
|
|
1786
|
+
if (!Ve) {
|
|
1758
1787
|
let t = e.clipboardData.getData("text/plain");
|
|
1759
1788
|
t.length >= j && Ue?.(t.length, j);
|
|
1760
1789
|
}
|
|
1761
|
-
|
|
1790
|
+
_t(e);
|
|
1762
1791
|
}, [
|
|
1763
|
-
|
|
1792
|
+
Ve,
|
|
1764
1793
|
j,
|
|
1765
1794
|
Ue,
|
|
1766
|
-
|
|
1767
|
-
]),
|
|
1795
|
+
_t
|
|
1796
|
+
]), Q = K.trim().length > 0 || Y.length > 0, vt = Q && !ct && !I, { shouldRender: yt, isExiting: bt, instanceKey: xt } = Ae(!l && Q, Ft), St = (xe?.some((e) => e.isSelected) ?? !1) && Se != null, $ = ue || K.includes("\n") || Qe || St, Ct = ae === void 0 || M != null, wt = L(() => ge && !bt && !l, [
|
|
1797
|
+
ge,
|
|
1798
|
+
bt,
|
|
1799
|
+
l
|
|
1800
|
+
]), Tt = async () => {
|
|
1768
1801
|
if (I) return;
|
|
1769
|
-
if (!
|
|
1770
|
-
Ue?.(
|
|
1802
|
+
if (!Ve && K.length >= j) {
|
|
1803
|
+
Ue?.(K.length, j);
|
|
1771
1804
|
return;
|
|
1772
1805
|
}
|
|
1773
|
-
let e =
|
|
1806
|
+
let e = K, t = Y;
|
|
1774
1807
|
J(""), qe.reset();
|
|
1775
1808
|
try {
|
|
1776
1809
|
await n?.(e, t), t.forEach((e) => {
|
|
1777
1810
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
1778
|
-
}),
|
|
1811
|
+
}), it([]);
|
|
1779
1812
|
} catch {
|
|
1780
|
-
J(e),
|
|
1813
|
+
J(e), it(t);
|
|
1781
1814
|
}
|
|
1782
|
-
},
|
|
1783
|
-
if (!e.nativeEvent.isComposing && !
|
|
1784
|
-
let t = e.currentTarget.selectionStart ?? 0, n = qe.navigate(e.key === "ArrowUp" ? "up" : "down",
|
|
1815
|
+
}, Et = (e) => {
|
|
1816
|
+
if (!e.nativeEvent.isComposing && !P && !l && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
|
|
1817
|
+
let t = e.currentTarget.selectionStart ?? 0, n = qe.navigate(e.key === "ArrowUp" ? "up" : "down", K, t);
|
|
1785
1818
|
if (n !== null) {
|
|
1786
1819
|
e.preventDefault(), J(n);
|
|
1787
1820
|
return;
|
|
1788
1821
|
}
|
|
1789
1822
|
}
|
|
1790
|
-
e.key === "Enter" && (_e ===
|
|
1791
|
-
},
|
|
1823
|
+
e.key === "Enter" && (_e === ze.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey) && (e.preventDefault(), !l && vt && Ct && !P && Tt());
|
|
1824
|
+
}, Dt = (e) => {
|
|
1792
1825
|
let t = Array.from(e.target.files ?? []);
|
|
1793
1826
|
if (t.length === 0) return;
|
|
1794
|
-
let n =
|
|
1795
|
-
e.target.value = "",
|
|
1827
|
+
let n = $e(t);
|
|
1828
|
+
e.target.value = "", rt(n);
|
|
1796
1829
|
};
|
|
1797
|
-
if (
|
|
1798
|
-
state:
|
|
1799
|
-
analyserNodeRef:
|
|
1800
|
-
elapsedSeconds:
|
|
1801
|
-
errorMessage:
|
|
1802
|
-
onStop:
|
|
1803
|
-
onDiscard:
|
|
1804
|
-
stopLabel:
|
|
1805
|
-
discardLabel:
|
|
1806
|
-
timerLabel:
|
|
1807
|
-
style:
|
|
1808
|
-
className:
|
|
1830
|
+
if (lt !== "idle") return /* @__PURE__ */ V(et, {
|
|
1831
|
+
state: lt,
|
|
1832
|
+
analyserNodeRef: ut,
|
|
1833
|
+
elapsedSeconds: dt,
|
|
1834
|
+
errorMessage: ft,
|
|
1835
|
+
onStop: mt,
|
|
1836
|
+
onDiscard: ht,
|
|
1837
|
+
stopLabel: T,
|
|
1838
|
+
discardLabel: E,
|
|
1839
|
+
timerLabel: D,
|
|
1840
|
+
style: G,
|
|
1841
|
+
className: A
|
|
1809
1842
|
});
|
|
1810
|
-
let
|
|
1811
|
-
className: o(
|
|
1812
|
-
ref:
|
|
1843
|
+
let Ot = /* @__PURE__ */ V("textarea", {
|
|
1844
|
+
className: o(q.textarea, k?.fontClassName || "dial-body-paragraph-text", "max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent outline-none [field-sizing:content]"),
|
|
1845
|
+
ref: Ze,
|
|
1813
1846
|
autoFocus: De,
|
|
1814
|
-
value:
|
|
1847
|
+
value: K,
|
|
1815
1848
|
onChange: (e) => {
|
|
1816
1849
|
J(e.target.value), qe.notifyChange(), d?.(e.target.value);
|
|
1817
1850
|
},
|
|
1818
|
-
onKeyDown:
|
|
1819
|
-
onPaste:
|
|
1851
|
+
onKeyDown: Et,
|
|
1852
|
+
onPaste: Z,
|
|
1820
1853
|
placeholder: p,
|
|
1821
1854
|
"aria-label": m,
|
|
1822
|
-
disabled:
|
|
1855
|
+
disabled: P,
|
|
1823
1856
|
rows: 1
|
|
1824
1857
|
});
|
|
1825
1858
|
return /* @__PURE__ */ H("div", {
|
|
1826
|
-
ref:
|
|
1827
|
-
style:
|
|
1828
|
-
className: o(
|
|
1829
|
-
children: [(
|
|
1830
|
-
attachments: [...
|
|
1859
|
+
ref: gt,
|
|
1860
|
+
style: G,
|
|
1861
|
+
className: o(q.wrapper, P && q.wrapperDisabled, "flex min-h-[64px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border shadow-md", Y.length > 6 ? "py-3 ps-3" : "p-3", A),
|
|
1862
|
+
children: [(U.length > 0 || Y.length > 0) && /* @__PURE__ */ V(be, {
|
|
1863
|
+
attachments: [...U, ...Y],
|
|
1831
1864
|
onRemove: (e) => {
|
|
1832
|
-
|
|
1865
|
+
U.some((t) => t.id === e) ? ve?.(e) : at(e);
|
|
1833
1866
|
},
|
|
1834
|
-
onRetry:
|
|
1835
|
-
onExpand:
|
|
1867
|
+
onRetry: ot,
|
|
1868
|
+
onExpand: st,
|
|
1836
1869
|
labels: {
|
|
1837
|
-
removeLabel:
|
|
1838
|
-
retryLabel:
|
|
1870
|
+
removeLabel: b,
|
|
1871
|
+
retryLabel: x
|
|
1839
1872
|
},
|
|
1840
|
-
onAttachmentClick:
|
|
1841
|
-
let t = [...
|
|
1842
|
-
t != null &&
|
|
1873
|
+
onAttachmentClick: Fe == null ? void 0 : (e) => {
|
|
1874
|
+
let t = [...U, ...Y].find((t) => t.id === e);
|
|
1875
|
+
t != null && Fe(t);
|
|
1843
1876
|
}
|
|
1844
|
-
}),
|
|
1877
|
+
}), pe ? $ && Ot : /* @__PURE__ */ H("div", {
|
|
1845
1878
|
className: o("flex items-center gap-2", $ ? "flex-wrap" : "flex-wrap desktop:flex-nowrap"),
|
|
1846
1879
|
children: [
|
|
1847
|
-
!
|
|
1880
|
+
!de && /* @__PURE__ */ H("div", {
|
|
1848
1881
|
className: o("flex", "order-2", !$ && "desktop:order-1"),
|
|
1849
1882
|
children: [/* @__PURE__ */ V("input", {
|
|
1850
|
-
ref:
|
|
1883
|
+
ref: X,
|
|
1851
1884
|
type: "file",
|
|
1852
1885
|
multiple: !0,
|
|
1853
|
-
accept:
|
|
1886
|
+
accept: g,
|
|
1854
1887
|
className: "sr-only",
|
|
1855
1888
|
"aria-hidden": !0,
|
|
1856
1889
|
tabIndex: -1,
|
|
1857
|
-
onChange:
|
|
1858
|
-
}), /* @__PURE__ */ V(
|
|
1859
|
-
onAttachClick:
|
|
1860
|
-
attachLabel:
|
|
1861
|
-
addMenuTitle:
|
|
1862
|
-
menuTitle:
|
|
1863
|
-
menuCloseLabel:
|
|
1864
|
-
style:
|
|
1865
|
-
isDisabled:
|
|
1866
|
-
chatSettings:
|
|
1867
|
-
extraMenuItems:
|
|
1868
|
-
toolsMenuItems:
|
|
1869
|
-
onToolToggle:
|
|
1870
|
-
toolsMenuTitle:
|
|
1871
|
-
toolsBackLabel:
|
|
1890
|
+
onChange: Dt
|
|
1891
|
+
}), /* @__PURE__ */ V(Je, {
|
|
1892
|
+
onAttachClick: fe ? void 0 : () => X.current?.click(),
|
|
1893
|
+
attachLabel: h,
|
|
1894
|
+
addMenuTitle: _,
|
|
1895
|
+
menuTitle: v,
|
|
1896
|
+
menuCloseLabel: y,
|
|
1897
|
+
style: G,
|
|
1898
|
+
isDisabled: P,
|
|
1899
|
+
chatSettings: ye,
|
|
1900
|
+
extraMenuItems: Ye,
|
|
1901
|
+
toolsMenuItems: xe,
|
|
1902
|
+
onToolToggle: Se,
|
|
1903
|
+
toolsMenuTitle: Ce,
|
|
1904
|
+
toolsBackLabel: we
|
|
1872
1905
|
})]
|
|
1873
1906
|
}),
|
|
1874
1907
|
$ && St && /* @__PURE__ */ V("div", {
|
|
1875
1908
|
className: "order-3 min-w-0 flex-1",
|
|
1876
|
-
children: /* @__PURE__ */ V(
|
|
1877
|
-
items:
|
|
1878
|
-
onToolToggle:
|
|
1909
|
+
children: /* @__PURE__ */ V(Xe, {
|
|
1910
|
+
items: xe ?? [],
|
|
1911
|
+
onToolToggle: Se,
|
|
1879
1912
|
isMobile: We,
|
|
1880
|
-
countLabel:
|
|
1881
|
-
removeLabel:
|
|
1913
|
+
countLabel: Ee?.countLabel,
|
|
1914
|
+
removeLabel: Ee?.removeLabel
|
|
1882
1915
|
})
|
|
1883
1916
|
}),
|
|
1884
1917
|
/* @__PURE__ */ V("div", {
|
|
1885
1918
|
className: o("order-1 flex w-full min-w-0 items-center self-stretch", !$ && "desktop:order-2 desktop:w-auto desktop:flex-1"),
|
|
1886
|
-
children:
|
|
1919
|
+
children: Ot
|
|
1887
1920
|
}),
|
|
1888
1921
|
/* @__PURE__ */ H("div", {
|
|
1889
1922
|
className: o("flex flex-shrink-0 items-center gap-2", $ && St ? "order-4" : "order-3", "ms-auto", !$ && "desktop:ms-0"),
|
|
1890
|
-
children: [
|
|
1923
|
+
children: [me ? me({
|
|
1891
1924
|
canSend: vt,
|
|
1892
|
-
onSend:
|
|
1925
|
+
onSend: Tt
|
|
1893
1926
|
}) : /* @__PURE__ */ H(B, { children: [
|
|
1894
1927
|
He,
|
|
1895
|
-
/* @__PURE__ */ V(
|
|
1896
|
-
deployments:
|
|
1897
|
-
selectedDeploymentId:
|
|
1928
|
+
/* @__PURE__ */ V(Pt, {
|
|
1929
|
+
deployments: ae,
|
|
1930
|
+
selectedDeploymentId: M,
|
|
1898
1931
|
onDeploymentChange: ce,
|
|
1899
1932
|
modelSelectorLabels: le,
|
|
1900
1933
|
isStreaming: l,
|
|
1901
1934
|
isMobile: We,
|
|
1902
|
-
isInputDisabled:
|
|
1935
|
+
isInputDisabled: P,
|
|
1903
1936
|
isDisabled: he,
|
|
1904
|
-
style:
|
|
1905
|
-
modelPickerOverlay:
|
|
1937
|
+
style: G,
|
|
1938
|
+
modelPickerOverlay: Ie,
|
|
1906
1939
|
isPickerOpen: Ge,
|
|
1907
|
-
onPickerToggle: () =>
|
|
1908
|
-
onPickerOpenChange:
|
|
1940
|
+
onPickerToggle: () => Ke((e) => !e),
|
|
1941
|
+
onPickerOpenChange: Ke
|
|
1909
1942
|
}),
|
|
1910
|
-
l && i ? /* @__PURE__ */ V(
|
|
1943
|
+
l && i ? /* @__PURE__ */ V(nt, {
|
|
1911
1944
|
onStop: i,
|
|
1912
|
-
ariaLabel:
|
|
1913
|
-
}) : !l && yt && /* @__PURE__ */ V(
|
|
1914
|
-
onSend:
|
|
1915
|
-
isDisabled: !Ct ||
|
|
1916
|
-
ariaLabel:
|
|
1945
|
+
ariaLabel: C
|
|
1946
|
+
}) : !l && yt && /* @__PURE__ */ V(tt, {
|
|
1947
|
+
onSend: Tt,
|
|
1948
|
+
isDisabled: !Ct || ct || I,
|
|
1949
|
+
ariaLabel: S,
|
|
1917
1950
|
isExiting: bt
|
|
1918
1951
|
}, xt)
|
|
1919
|
-
] }),
|
|
1920
|
-
icon: /* @__PURE__ */ V(
|
|
1952
|
+
] }), wt && /* @__PURE__ */ V(ne, {
|
|
1953
|
+
icon: /* @__PURE__ */ V(se, {
|
|
1921
1954
|
size: u.LG,
|
|
1922
1955
|
"aria-hidden": !0
|
|
1923
1956
|
}),
|
|
1924
|
-
"aria-label":
|
|
1957
|
+
"aria-label": w,
|
|
1925
1958
|
className: "size-8 flex-shrink-0",
|
|
1926
|
-
onClick:
|
|
1927
|
-
disabled:
|
|
1959
|
+
onClick: pt,
|
|
1960
|
+
disabled: P || l
|
|
1928
1961
|
})]
|
|
1929
1962
|
})
|
|
1930
1963
|
]
|
|
1931
1964
|
})]
|
|
1932
1965
|
});
|
|
1933
|
-
},
|
|
1966
|
+
}, 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 }) => {
|
|
1934
1967
|
let { colors: u, typography: d } = r ?? {};
|
|
1935
1968
|
return /* @__PURE__ */ H("div", {
|
|
1936
|
-
style: a({
|
|
1937
|
-
"--ci-root-bg": u?.background,
|
|
1938
|
-
"--ci-welcome-color": u?.welcomeText
|
|
1939
|
-
}),
|
|
1969
|
+
style: a({ "--ci-welcome-color": u?.welcomeText }),
|
|
1940
1970
|
className: o("relative flex w-full flex-col items-center gap-6 px-4 py-5 desktop:p-5", i),
|
|
1941
1971
|
children: [n && /* @__PURE__ */ V("h1", {
|
|
1942
|
-
className: o(
|
|
1972
|
+
className: o(Lt.welcome, "m-0 text-center", d?.welcomeClassName || "dial-display2-text"),
|
|
1943
1973
|
children: n
|
|
1944
1974
|
}), /* @__PURE__ */ V("div", {
|
|
1945
1975
|
className: "relative w-full max-w-[748px]",
|
|
1946
|
-
children: /* @__PURE__ */ V(
|
|
1976
|
+
children: /* @__PURE__ */ V(It, {
|
|
1947
1977
|
placeholder: t,
|
|
1948
1978
|
isStreaming: e,
|
|
1949
1979
|
isInputDisabled: c,
|
|
@@ -1954,58 +1984,58 @@ var Dt = {
|
|
|
1954
1984
|
})
|
|
1955
1985
|
})]
|
|
1956
1986
|
});
|
|
1957
|
-
},
|
|
1958
|
-
let ie = R(null), [j,
|
|
1959
|
-
|
|
1960
|
-
v?.length && (
|
|
1987
|
+
}, 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: k, onPendingAttachmentsConsumed: ee, onAttachmentClick: te, pasteTextThreshold: ne, onMessageTooLong: re }) => {
|
|
1988
|
+
let ie = R(null), [j, ae] = z([]);
|
|
1989
|
+
I(() => {
|
|
1990
|
+
v?.length && (ae(v), y?.());
|
|
1961
1991
|
}, [v, y]);
|
|
1962
|
-
let [M, se] = z(e ?? ""), [ce, le] = z([]), [
|
|
1963
|
-
|
|
1964
|
-
},
|
|
1965
|
-
i(e,
|
|
1966
|
-
}, [
|
|
1967
|
-
if (
|
|
1992
|
+
let [M, se] = z(e ?? ""), [ce, le] = z([]), [N, ue] = z(t), de = ce.some((e) => e.status === r.Loading || e.status === r.Error), fe = (M.trim().length > 0 || ce.length > 0 || N.length > 0) && !de, pe = (e) => {
|
|
1993
|
+
ue((t) => t.filter((t) => t.id !== e));
|
|
1994
|
+
}, me = F((e, t) => {
|
|
1995
|
+
i(e, N, t);
|
|
1996
|
+
}, [N, i]), P = () => {
|
|
1997
|
+
if (fe) {
|
|
1968
1998
|
if (!x && M.length >= (ne ?? 4e3)) {
|
|
1969
1999
|
re?.(M.length, ne ?? 4e3);
|
|
1970
2000
|
return;
|
|
1971
2001
|
}
|
|
1972
|
-
|
|
2002
|
+
me(M, ce);
|
|
1973
2003
|
}
|
|
1974
|
-
},
|
|
2004
|
+
}, he = F(() => ae([]), []), ge = F((e) => {
|
|
1975
2005
|
let t = Array.from(e.target.files ?? []);
|
|
1976
|
-
t.length !== 0 && (e.target.value = "",
|
|
2006
|
+
t.length !== 0 && (e.target.value = "", ae(t));
|
|
1977
2007
|
}, []), _e = L(() => E ? [{
|
|
1978
2008
|
key: "dial-fs",
|
|
1979
|
-
label:
|
|
1980
|
-
icon: /* @__PURE__ */ V(
|
|
2009
|
+
label: D ?? "DIAL file system",
|
|
2010
|
+
icon: /* @__PURE__ */ V(oe, {
|
|
1981
2011
|
size: c,
|
|
1982
2012
|
"aria-hidden": !0
|
|
1983
2013
|
}),
|
|
1984
2014
|
onClick: E
|
|
1985
|
-
}] : [], [E,
|
|
2015
|
+
}] : [], [E, D]);
|
|
1986
2016
|
return /* @__PURE__ */ H("div", {
|
|
1987
2017
|
className: o("flex w-full flex-col gap-2", _),
|
|
1988
|
-
children: [/* @__PURE__ */ V(
|
|
2018
|
+
children: [/* @__PURE__ */ V(It, {
|
|
1989
2019
|
message: e,
|
|
1990
2020
|
ariaLabel: u,
|
|
1991
2021
|
isStacked: !0,
|
|
1992
2022
|
hideActionBar: !0,
|
|
1993
2023
|
pendingDropFiles: j,
|
|
1994
|
-
onDropFilesConsumed:
|
|
1995
|
-
onSend:
|
|
2024
|
+
onDropFilesConsumed: he,
|
|
2025
|
+
onSend: me,
|
|
1996
2026
|
onUploadAttachment: a,
|
|
1997
2027
|
onChange: se,
|
|
1998
2028
|
onAttachmentsChange: le,
|
|
1999
2029
|
removeLabel: d,
|
|
2000
2030
|
retryLabel: f,
|
|
2001
2031
|
className: "max-w-full",
|
|
2002
|
-
prefixAttachments:
|
|
2003
|
-
onRemovePrefixAttachment:
|
|
2032
|
+
prefixAttachments: N,
|
|
2033
|
+
onRemovePrefixAttachment: pe,
|
|
2004
2034
|
validateAttachment: b,
|
|
2005
2035
|
isAttachmentsEnabled: x,
|
|
2006
2036
|
maximumAttachmentsAmount: w,
|
|
2007
2037
|
onAttachmentsLimitExceeded: T,
|
|
2008
|
-
pendingAttachments:
|
|
2038
|
+
pendingAttachments: k,
|
|
2009
2039
|
onPendingAttachmentsConsumed: ee,
|
|
2010
2040
|
onAttachmentClick: te,
|
|
2011
2041
|
pasteTextThreshold: ne,
|
|
@@ -2023,7 +2053,7 @@ var Dt = {
|
|
|
2023
2053
|
"aria-hidden": !0,
|
|
2024
2054
|
tabIndex: -1,
|
|
2025
2055
|
onChange: ge
|
|
2026
|
-
}), /* @__PURE__ */ V(
|
|
2056
|
+
}), /* @__PURE__ */ V(Je, {
|
|
2027
2057
|
onAttachClick: () => ie.current?.click(),
|
|
2028
2058
|
attachLabel: m,
|
|
2029
2059
|
addMenuTitle: p,
|
|
@@ -2033,17 +2063,17 @@ var Dt = {
|
|
|
2033
2063
|
})] })
|
|
2034
2064
|
}), /* @__PURE__ */ H("div", {
|
|
2035
2065
|
className: "flex gap-2",
|
|
2036
|
-
children: [/* @__PURE__ */ V(
|
|
2066
|
+
children: [/* @__PURE__ */ V(O, {
|
|
2037
2067
|
label: s,
|
|
2038
2068
|
onClick: n
|
|
2039
|
-
}), /* @__PURE__ */ V(
|
|
2069
|
+
}), /* @__PURE__ */ V(A, {
|
|
2040
2070
|
label: l,
|
|
2041
|
-
onClick:
|
|
2042
|
-
disabled: !
|
|
2071
|
+
onClick: P,
|
|
2072
|
+
disabled: !fe
|
|
2043
2073
|
})]
|
|
2044
2074
|
})]
|
|
2045
2075
|
})]
|
|
2046
2076
|
});
|
|
2047
2077
|
};
|
|
2048
2078
|
//#endregion
|
|
2049
|
-
export {
|
|
2079
|
+
export { U as AttachmentCard, ve as AttachmentGroup, ye as AttachmentTray, W as BottomSheetShell, Ke as ChatSettingsModal, Rt as ConversationInput, zt as EditMessageInput, xe as FileDndOverlay, It as Input, ze as SendOnEnter, we as getAttachmentIcon };
|