@epam/ai-dial-conversation-input 1.2.0-dev.99 → 1.2.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/AddAttachmentButton/AddAttachmentButton.d.ts +6 -0
- package/components/AddAttachmentButton/AddAttachmentButton.d.ts.map +1 -1
- package/components/BottomSheetShell/BottomSheetShell.d.ts +2 -2
- package/components/BottomSheetShell/BottomSheetShell.d.ts.map +1 -1
- package/components/ChatSettingsFields/ChatSettingsFields.d.ts.map +1 -1
- package/components/ChatSettingsModal/ChatSettingsModal.d.ts.map +1 -1
- package/components/ConversationInput/ConversationInput.d.ts.map +1 -1
- package/components/EditMessageInput/EditMessageInput.d.ts.map +1 -1
- package/components/Input/Input.d.ts +2 -3
- package/components/Input/Input.d.ts.map +1 -1
- package/components/Input/ModelSelectorControl.d.ts +3 -1
- package/components/Input/ModelSelectorControl.d.ts.map +1 -1
- package/components/ModelSelectorBottomSheet/ModelSelectorBottomSheet.d.ts +3 -0
- package/components/ModelSelectorBottomSheet/ModelSelectorBottomSheet.d.ts.map +1 -1
- package/components/ToolsChips/ToolsChips.d.ts +11 -0
- package/components/ToolsChips/ToolsChips.d.ts.map +1 -1
- package/components/VoiceBar/VoiceBar.d.ts +1 -3
- package/components/VoiceBar/VoiceBar.d.ts.map +1 -1
- package/hooks/useAttachments.d.ts +8 -1
- package/hooks/useAttachments.d.ts.map +1 -1
- package/hooks/useCommandMenu/useCommandMenu.d.ts +35 -5
- package/hooks/useCommandMenu/useCommandMenu.d.ts.map +1 -1
- package/hooks/useComposerSeed.d.ts +32 -0
- package/hooks/useComposerSeed.d.ts.map +1 -0
- package/hooks/useMentionSelectionMirror.d.ts +22 -0
- package/hooks/useMentionSelectionMirror.d.ts.map +1 -0
- package/hooks/useModelSelector.d.ts +7 -13
- package/hooks/useModelSelector.d.ts.map +1 -1
- package/hooks/useTextInsertion.d.ts +7 -1
- package/hooks/useTextInsertion.d.ts.map +1 -1
- package/index.css +2 -2
- package/index.d.ts +3 -1
- package/index.d.ts.map +1 -1
- package/index.js +1423 -1160
- package/models/ConversationInput.d.ts +89 -17
- package/models/ConversationInput.d.ts.map +1 -1
- package/models/Input.d.ts +195 -41
- package/models/Input.d.ts.map +1 -1
- package/package.json +4 -5
- package/utils/highlight-mirror.d.ts +17 -0
- package/utils/highlight-mirror.d.ts.map +1 -0
- package/hooks/useBottomSheet.d.ts +0 -9
- package/hooks/useBottomSheet.d.ts.map +0 -1
package/index.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { AttachmentErrorReason as e, AttachmentType as t, DeploymentIcon as n, MIME_TYPE_EXT_MAP as r, RESIZABLE_TEXTAREA_CLASS_NAME as i, RequestStatus as a, ResponseFormat as o, SELECT_LIST_MAX_HEIGHT_PX as s, buildCssVars as c, mergeClasses as l, normalizeMimeType as u, useIsMobile as d } from "@epam/ai-dial-chat-shared";
|
|
2
|
-
import { BASE_ICON_SIZE as f,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { AttachmentTray as xe, MAX_UPLOADS_PER_MINUTE as Se, generateAttachmentId as G, useClipboardPaste as Ce } from "@epam/ai-dial-attachment-input";
|
|
2
|
+
import { BASE_ICON_SIZE as f, BottomSheet as p, Button as m, ButtonVariant as h, DIAL_ICON_SIZE as g, DIAL_KIT_ICON_STROKE as _, Dropdown as v, ElementSize as y, ErrorText as b, GhostIconButton as x, Highlight as S, MenuItemMark as C, NeutralButton as w, NeutralIconButton as T, Popup as E, PopupSize as D, PrimaryButton as ee, PrimaryIconButton as O, RadioGroup as k, RadioGroupOrientation as A, Search as j, Skeleton as te, SkeletonVariant as ne, Slider as re, Spinner as ie, Textarea as ae, TextareaResize as oe, Tooltip as M } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { Fragment as N, jsx as P, jsxs as F } from "react/jsx-runtime";
|
|
4
|
+
import { AttachmentTray as se, MAX_UPLOADS_PER_MINUTE as I, generateAttachmentId as ce, useClipboardPaste as le } from "@epam/ai-dial-attachment-input";
|
|
5
|
+
import { IconArrowNarrowRight as ue, IconCheck as de, IconChevronDown as fe, IconChevronRight as pe, IconFile as me, IconMicrophone as he, IconPaperclip as ge, IconPlayerStop as _e, IconPlus as ve, IconSettings as ye, IconTool as be, IconX as xe } from "@tabler/icons-react";
|
|
6
|
+
import { createElement as Se, forwardRef as Ce, memo as we, useCallback as L, useEffect as R, useId as Te, useImperativeHandle as Ee, useLayoutEffect as De, useMemo as z, useRef as B, useState as V } from "react";
|
|
8
7
|
//#region src/constants/public-class-names.ts
|
|
9
|
-
var
|
|
8
|
+
var H = {
|
|
10
9
|
wrapper: "dial-ci-wrapper",
|
|
11
10
|
actionRow: "dial-ci-action-row",
|
|
12
11
|
textareaWrap: "dial-ci-textarea-wrap",
|
|
@@ -20,116 +19,54 @@ var K = {
|
|
|
20
19
|
modelMenuSearch: "dial-ci-model-menu-search",
|
|
21
20
|
modelMenuItem: "dial-ci-model-menu-item",
|
|
22
21
|
modelMenuItemSelected: "dial-ci-model-menu-item-selected"
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}, [e, t]), R(() => {
|
|
31
|
-
if (e) return document.body.style.overflow = "hidden", () => {
|
|
32
|
-
document.body.style.overflow = "";
|
|
33
|
-
};
|
|
34
|
-
}, [e]), R(() => {
|
|
35
|
-
if (!e || n?.current == null) return;
|
|
36
|
-
let t = n.current, r = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
37
|
-
(t.querySelector(we) ?? t).focus();
|
|
38
|
-
let i = (e) => {
|
|
39
|
-
if (e.key !== "Tab") return;
|
|
40
|
-
let n = Array.from(t.querySelectorAll(we));
|
|
41
|
-
if (n.length === 0) {
|
|
42
|
-
e.preventDefault(), t.focus();
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
let r = n[0], i = n[n.length - 1], a = document.activeElement, o = a === t || a === null || !t.contains(a);
|
|
46
|
-
e.shiftKey ? (a === r || o) && (e.preventDefault(), i.focus()) : (a === i || o) && (e.preventDefault(), r.focus());
|
|
47
|
-
};
|
|
48
|
-
return document.addEventListener("keydown", i), () => {
|
|
49
|
-
document.removeEventListener("keydown", i), r?.focus();
|
|
50
|
-
};
|
|
51
|
-
}, [e, n]);
|
|
52
|
-
}, Ee = {
|
|
53
|
-
backdrop: "_backdrop_1d50f_9",
|
|
54
|
-
sheet: "_sheet_1d50f_13",
|
|
55
|
-
"slide-up": "_slide-up_1d50f_1",
|
|
56
|
-
title: "_title_1d50f_18",
|
|
57
|
-
divider: "_divider_1d50f_22"
|
|
58
|
-
}, De = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: a, "aria-label": o, style: s, titleClassName: u = "dial-body-semi-text", className: d, colors: f, children: p }) => {
|
|
59
|
-
let _ = B(null);
|
|
60
|
-
if (Te(e, r, _), !e || typeof document > "u") return null;
|
|
61
|
-
let y = c({
|
|
22
|
+
}, Oe = {
|
|
23
|
+
backdrop: "_backdrop_1ym62_8",
|
|
24
|
+
sheet: "_sheet_1ym62_12",
|
|
25
|
+
title: "_title_1ym62_16",
|
|
26
|
+
divider: "_divider_1ym62_20"
|
|
27
|
+
}, U = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: a, "aria-label": o, style: s, titleClassName: u = "dial-body-semi-text", className: d, colors: f, children: m }) => {
|
|
28
|
+
let h = c({
|
|
62
29
|
"--ci-backdrop": f?.backdrop,
|
|
63
30
|
"--ci-sheet-bg": f?.sheetBg,
|
|
64
31
|
"--ci-sheet-text": f?.sheetText,
|
|
65
32
|
"--ci-sheet-divider": f?.divider
|
|
66
33
|
});
|
|
67
|
-
return
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
"aria-modal": !0,
|
|
76
|
-
"aria-label": t ?? o,
|
|
77
|
-
tabIndex: -1,
|
|
34
|
+
return /* @__PURE__ */ P(p, {
|
|
35
|
+
open: e,
|
|
36
|
+
onClose: r,
|
|
37
|
+
title: t,
|
|
38
|
+
ariaLabel: o,
|
|
39
|
+
onBack: i,
|
|
40
|
+
backAriaLabel: a,
|
|
41
|
+
closeAriaLabel: n,
|
|
78
42
|
style: {
|
|
79
|
-
...
|
|
43
|
+
...h,
|
|
80
44
|
...s
|
|
81
45
|
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
size: h.LG,
|
|
91
|
-
stroke: g,
|
|
92
|
-
className: "rtl:scale-x-[-1]"
|
|
93
|
-
}),
|
|
94
|
-
"aria-label": a,
|
|
95
|
-
onClick: i
|
|
96
|
-
})
|
|
97
|
-
}),
|
|
98
|
-
/* @__PURE__ */ U("span", {
|
|
99
|
-
className: l(Ee.title, u),
|
|
100
|
-
children: t
|
|
101
|
-
}),
|
|
102
|
-
/* @__PURE__ */ U("div", {
|
|
103
|
-
className: "absolute end-4 m-2",
|
|
104
|
-
children: /* @__PURE__ */ U(m, {
|
|
105
|
-
ariaLabel: n,
|
|
106
|
-
onClose: r,
|
|
107
|
-
size: v.Standard
|
|
108
|
-
})
|
|
109
|
-
})
|
|
110
|
-
]
|
|
111
|
-
}), /* @__PURE__ */ U("div", { className: l(Ee.divider, "h-px flex-shrink-0") })] }), /* @__PURE__ */ U("div", {
|
|
112
|
-
className: "overflow-y-auto",
|
|
113
|
-
children: p
|
|
114
|
-
})]
|
|
115
|
-
})] }), document.body);
|
|
116
|
-
}, Oe = async (e, t, n) => {
|
|
46
|
+
overlayStyle: h,
|
|
47
|
+
className: l(Oe.sheet, d),
|
|
48
|
+
overlayClassName: Oe.backdrop,
|
|
49
|
+
headerClassName: Oe.divider,
|
|
50
|
+
titleClassName: l(Oe.title, u),
|
|
51
|
+
children: m
|
|
52
|
+
});
|
|
53
|
+
}, ke = async (e, t, n) => {
|
|
117
54
|
let r = 6e4 / t, i = [];
|
|
118
55
|
for (let t = 0; t < e.length; t++) t > 0 && await new Promise((e) => setTimeout(e, r)), i.push(n(e[t]));
|
|
119
56
|
await Promise.allSettled(i);
|
|
120
|
-
},
|
|
121
|
-
let [
|
|
57
|
+
}, Ae = ({ initialAttachments: n, onUploadAttachment: r, onAttachmentsChange: i, validateAttachment: o, pendingDropFiles: s, onDropFilesConsumed: c, isDropDisabled: l = !1, pendingAttachments: u, onPendingAttachmentsConsumed: d, onExpandPastedText: f, maximumAttachmentsAmount: p, baseAttachmentsAmount: m = 0, onAttachmentsLimitExceeded: h }) => {
|
|
58
|
+
let [g, _] = V(n), v = B(g);
|
|
122
59
|
R(() => {
|
|
123
|
-
|
|
124
|
-
}, [
|
|
125
|
-
|
|
60
|
+
v.current = g;
|
|
61
|
+
}, [g]), R(() => () => {
|
|
62
|
+
v.current.forEach((e) => {
|
|
126
63
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
127
64
|
});
|
|
128
65
|
}, []);
|
|
129
|
-
let
|
|
66
|
+
let y = L((e) => e.map((e) => {
|
|
130
67
|
let n = e.type.startsWith("image/"), r = e.type.startsWith("audio/"), i = n ? URL.createObjectURL(e) : void 0, o = r ? URL.createObjectURL(e) : void 0;
|
|
131
68
|
return {
|
|
132
|
-
id:
|
|
69
|
+
id: ce(),
|
|
133
70
|
name: e.name,
|
|
134
71
|
contentType: e.type,
|
|
135
72
|
file: e,
|
|
@@ -138,34 +75,34 @@ var K = {
|
|
|
138
75
|
previewUrl: i,
|
|
139
76
|
playUrl: o
|
|
140
77
|
};
|
|
141
|
-
}), []),
|
|
78
|
+
}), []), b = B(i);
|
|
142
79
|
R(() => {
|
|
143
|
-
|
|
80
|
+
b.current = i;
|
|
144
81
|
}, [i]);
|
|
145
|
-
let
|
|
146
|
-
|
|
82
|
+
let x = B(!0), S = L((e) => {
|
|
83
|
+
_((t) => {
|
|
147
84
|
let n = e(t);
|
|
148
85
|
return n === t ? t : n;
|
|
149
86
|
});
|
|
150
87
|
}, []);
|
|
151
88
|
R(() => {
|
|
152
|
-
if (
|
|
153
|
-
|
|
89
|
+
if (x.current) {
|
|
90
|
+
x.current = !1;
|
|
154
91
|
return;
|
|
155
92
|
}
|
|
156
|
-
|
|
157
|
-
}, [
|
|
158
|
-
let
|
|
159
|
-
|
|
160
|
-
}, []),
|
|
93
|
+
b.current?.(g);
|
|
94
|
+
}, [g]);
|
|
95
|
+
let C = L((e) => {
|
|
96
|
+
_(e);
|
|
97
|
+
}, []), w = L(async (t) => {
|
|
161
98
|
if (r) {
|
|
162
|
-
|
|
99
|
+
S((e) => e.map((e) => e.id === t.id ? {
|
|
163
100
|
...e,
|
|
164
101
|
status: a.Loading
|
|
165
102
|
} : e));
|
|
166
103
|
try {
|
|
167
104
|
let { url: e, name: n } = await r(t);
|
|
168
|
-
|
|
105
|
+
S((r) => r.map((r) => r.id === t.id ? {
|
|
169
106
|
...r,
|
|
170
107
|
status: a.Idle,
|
|
171
108
|
url: e,
|
|
@@ -173,61 +110,67 @@ var K = {
|
|
|
173
110
|
} : r));
|
|
174
111
|
} catch (n) {
|
|
175
112
|
let r = typeof n == "object" && n && "errorReason" in n && Object.values(e).includes(n.errorReason) ? n.errorReason : void 0;
|
|
176
|
-
|
|
113
|
+
S((e) => e.map((e) => e.id === t.id ? {
|
|
177
114
|
...e,
|
|
178
115
|
status: a.Error,
|
|
179
116
|
...r != null && { errorReason: r }
|
|
180
117
|
} : e));
|
|
181
118
|
}
|
|
182
119
|
}
|
|
183
|
-
}, [r,
|
|
184
|
-
let n = new Set(
|
|
120
|
+
}, [r, S]), T = L((e, t = !0) => {
|
|
121
|
+
let n = new Set(v.current.map((e) => e.id)), r = e.filter((e) => !n.has(e.id));
|
|
185
122
|
if (r.length !== 0) {
|
|
186
|
-
if (
|
|
187
|
-
let e =
|
|
188
|
-
if (e >
|
|
123
|
+
if (p != null && p > 0 && Number.isFinite(p)) {
|
|
124
|
+
let e = m + v.current.length + r.length;
|
|
125
|
+
if (e > p) {
|
|
189
126
|
r.forEach((e) => {
|
|
190
127
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
191
|
-
}),
|
|
128
|
+
}), h?.(e, p);
|
|
192
129
|
return;
|
|
193
130
|
}
|
|
194
131
|
}
|
|
195
|
-
if (
|
|
132
|
+
if (S((e) => [...e, ...r]), t) {
|
|
196
133
|
let e = [];
|
|
197
134
|
r.forEach((t) => {
|
|
198
135
|
let n = o?.(t);
|
|
199
|
-
n == null ? e.push(t) :
|
|
136
|
+
n == null ? e.push(t) : S((e) => e.map((e) => e.id === t.id ? {
|
|
200
137
|
...e,
|
|
201
138
|
status: a.Error,
|
|
202
139
|
errorReason: n
|
|
203
140
|
} : e));
|
|
204
|
-
}),
|
|
141
|
+
}), ke(e, I, w);
|
|
205
142
|
}
|
|
206
143
|
}
|
|
207
144
|
}, [
|
|
208
|
-
p,
|
|
209
|
-
f,
|
|
210
145
|
m,
|
|
211
|
-
|
|
212
|
-
|
|
146
|
+
p,
|
|
147
|
+
h,
|
|
148
|
+
S,
|
|
149
|
+
w,
|
|
213
150
|
o
|
|
214
|
-
]);
|
|
151
|
+
]), E = B(/* @__PURE__ */ new WeakSet());
|
|
215
152
|
R(() => {
|
|
216
|
-
s.length
|
|
153
|
+
if (s.length === 0) {
|
|
154
|
+
E.current = /* @__PURE__ */ new WeakSet();
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
let e = s.filter((e) => !E.current.has(e));
|
|
158
|
+
e.length !== 0 && (e.forEach((e) => E.current.add(e)), l || T(y(e)), c?.());
|
|
217
159
|
}, [
|
|
218
|
-
|
|
219
|
-
|
|
160
|
+
T,
|
|
161
|
+
y,
|
|
162
|
+
l,
|
|
220
163
|
c,
|
|
221
164
|
s
|
|
222
165
|
]), R(() => {
|
|
223
|
-
|
|
166
|
+
u.length !== 0 && (T(u, !1), d?.());
|
|
224
167
|
}, [
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
168
|
+
T,
|
|
169
|
+
d,
|
|
170
|
+
u
|
|
228
171
|
]), R(() => {
|
|
229
172
|
if (!o) return;
|
|
230
|
-
let t = !1, n = [], r =
|
|
173
|
+
let t = !1, n = [], r = v.current.map((r) => {
|
|
231
174
|
if (r.status === a.Loading) return r;
|
|
232
175
|
let i = o(r);
|
|
233
176
|
if (i != null) return r.status === a.Error && r.errorReason === i ? r : (t = !0, {
|
|
@@ -246,74 +189,131 @@ var K = {
|
|
|
246
189
|
}
|
|
247
190
|
return r;
|
|
248
191
|
});
|
|
249
|
-
t &&
|
|
192
|
+
t && S(() => r), n.forEach((e) => void w(e));
|
|
250
193
|
}, [
|
|
251
194
|
o,
|
|
252
|
-
|
|
253
|
-
|
|
195
|
+
S,
|
|
196
|
+
w
|
|
254
197
|
]);
|
|
255
|
-
let
|
|
256
|
-
|
|
198
|
+
let D = L((e) => {
|
|
199
|
+
S((t) => {
|
|
257
200
|
let n = t.find((t) => t.id === e);
|
|
258
201
|
return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), n?.playUrl && URL.revokeObjectURL(n.playUrl), t.filter((t) => t.id !== e);
|
|
259
202
|
});
|
|
260
|
-
}, [
|
|
203
|
+
}, [S]);
|
|
261
204
|
return {
|
|
262
|
-
attachments:
|
|
263
|
-
buildAttachments:
|
|
264
|
-
addAttachments:
|
|
265
|
-
resetAttachments:
|
|
266
|
-
handleRemove:
|
|
205
|
+
attachments: g,
|
|
206
|
+
buildAttachments: y,
|
|
207
|
+
addAttachments: T,
|
|
208
|
+
resetAttachments: C,
|
|
209
|
+
handleRemove: D,
|
|
267
210
|
handleRetry: L((e) => {
|
|
268
|
-
let t =
|
|
269
|
-
t &&
|
|
270
|
-
}, [
|
|
211
|
+
let t = g.find((t) => t.id === e);
|
|
212
|
+
t && w(t);
|
|
213
|
+
}, [g, w]),
|
|
271
214
|
handleExpand: L(async (e) => {
|
|
272
|
-
let n =
|
|
215
|
+
let n = g.find((t) => t.id === e);
|
|
273
216
|
if (!n || n.type !== t.Pasted) return;
|
|
274
217
|
let r = await n.file.text();
|
|
275
|
-
|
|
218
|
+
f?.(r), D(e);
|
|
276
219
|
}, [
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
220
|
+
g,
|
|
221
|
+
D,
|
|
222
|
+
f
|
|
280
223
|
]),
|
|
281
|
-
hasBlockedAttachments:
|
|
224
|
+
hasBlockedAttachments: g.some((e) => e.status === a.Loading || e.status === a.Error)
|
|
225
|
+
};
|
|
226
|
+
}, je = (e, t) => {
|
|
227
|
+
let n = t;
|
|
228
|
+
for (; n < e.length && !/\s/.test(e[n]);) n++;
|
|
229
|
+
return n;
|
|
230
|
+
}, Me = (e, t) => {
|
|
231
|
+
let n = t;
|
|
232
|
+
for (; n > 0 && !/\s/.test(e[n - 1]);) n--;
|
|
233
|
+
return {
|
|
234
|
+
start: n,
|
|
235
|
+
end: je(e, n)
|
|
282
236
|
};
|
|
283
|
-
},
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
let
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
237
|
+
}, W = (e, t) => e.startsWith(t) && !e.slice(t.length).includes(t), Ne = "[role=\"option\"]:not([aria-disabled=\"true\"])", Pe = /* @__PURE__ */ function(e) {
|
|
238
|
+
return e.Next = "next", e.Previous = "previous", e;
|
|
239
|
+
}({}), Fe = ({ config: e, message: t }) => {
|
|
240
|
+
let [n, r] = V(!1), [i, a] = V(null), [o, s] = V(null), c = B(null);
|
|
241
|
+
c.current = i;
|
|
242
|
+
let l = e != null && i != null && i <= t.length ? (() => {
|
|
243
|
+
let n = t.slice(i, je(t, i));
|
|
244
|
+
return W(n, e.triggerPrefix) ? n.slice(e.triggerPrefix.length) : "";
|
|
245
|
+
})() : "", u = L((t, n, i) => {
|
|
246
|
+
if (e == null || i) return;
|
|
247
|
+
let { start: c, end: l } = Me(t, n), u = t.slice(c, l);
|
|
248
|
+
if (!W(u, e.triggerPrefix)) {
|
|
249
|
+
r(!1), s(null), a(null);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (a(c), u === e.triggerPrefix || o !== c) {
|
|
253
|
+
r(!0), s(null);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
r(!1);
|
|
257
|
+
}, [e, o]);
|
|
258
|
+
R(() => {
|
|
259
|
+
if (e == null) {
|
|
260
|
+
r(!1), s(null), a(null);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
let n = c.current;
|
|
264
|
+
if (n == null) return;
|
|
265
|
+
let i = Math.min(n, t.length);
|
|
266
|
+
W(t.slice(i, je(t, i)), e.triggerPrefix) || (r(!1), s(null), a(null));
|
|
267
|
+
}, [e, t]);
|
|
268
|
+
let d = L(() => {
|
|
269
|
+
r(!1), s(i);
|
|
270
|
+
}, [i]), f = L(() => {
|
|
271
|
+
r(!1);
|
|
272
|
+
}, []), p = L((n) => {
|
|
273
|
+
if (e == null) return;
|
|
274
|
+
let { start: i, end: s } = Me(t, n);
|
|
275
|
+
if (!W(t.slice(i, s), e.triggerPrefix)) {
|
|
276
|
+
a(null), r(!1);
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
a(i), r(o !== i);
|
|
292
280
|
}, [
|
|
293
281
|
e,
|
|
294
282
|
t,
|
|
295
|
-
|
|
296
|
-
]);
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
283
|
+
o
|
|
284
|
+
]), m = Te(), h = B(null), [g, _] = V(null);
|
|
285
|
+
R(() => {
|
|
286
|
+
_(null);
|
|
287
|
+
}, [n, l]);
|
|
288
|
+
let v = L(() => Array.from(h.current?.querySelectorAll(Ne) ?? []), []), y = L((e) => {
|
|
289
|
+
let t = v();
|
|
290
|
+
if (t.length === 0) {
|
|
291
|
+
_(null);
|
|
300
292
|
return;
|
|
301
293
|
}
|
|
302
|
-
|
|
303
|
-
|
|
294
|
+
let n = t.findIndex((e) => e.id === g), r = t[e === "next" ? (n + 1) % t.length : (n <= 0 ? t.length : n) - 1];
|
|
295
|
+
_(r.id), r.scrollIntoView?.({ block: "nearest" });
|
|
296
|
+
}, [v, g]), b = L(() => v().find((e) => e.id === g) ?? null, [v, g]);
|
|
297
|
+
return {
|
|
304
298
|
isMenuOpen: n,
|
|
305
|
-
query:
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
299
|
+
query: l,
|
|
300
|
+
activeWordStart: i,
|
|
301
|
+
dismiss: d,
|
|
302
|
+
closeOnOutsidePress: f,
|
|
303
|
+
handleCaretMove: p,
|
|
304
|
+
handleValueChange: u,
|
|
305
|
+
listboxId: m,
|
|
306
|
+
overlayRef: h,
|
|
307
|
+
activeOptionId: n ? g : null,
|
|
308
|
+
moveActiveOption: y,
|
|
309
|
+
getActiveOption: b
|
|
310
310
|
};
|
|
311
|
-
},
|
|
311
|
+
}, Ie = (e, t) => !e.slice(0, t).includes("\n"), Le = (e, t) => !e.slice(t).includes("\n"), Re = (e) => {
|
|
312
312
|
let t = B(e);
|
|
313
313
|
t.current = e;
|
|
314
314
|
let n = B(-1), r = B(""), i = L((e, i, a) => {
|
|
315
315
|
let o = t.current;
|
|
316
|
-
return !o || o.length === 0 ? null : e === "up" ? !
|
|
316
|
+
return !o || o.length === 0 ? null : e === "up" ? !Ie(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 || !Le(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
|
|
317
317
|
}, []), a = L(() => {
|
|
318
318
|
n.current = -1, r.current = "";
|
|
319
319
|
}, []), o = L(() => {
|
|
@@ -328,7 +328,81 @@ var K = {
|
|
|
328
328
|
a,
|
|
329
329
|
o
|
|
330
330
|
]);
|
|
331
|
-
},
|
|
331
|
+
}, ze = (e, t, n, r, i) => {
|
|
332
|
+
let a = [...t].sort((e, t) => e.start - t.start), o = [...n].sort((e, t) => e.offset - t.offset), s = [], c = 0, l = 0, u = (t, n) => {
|
|
333
|
+
if (n <= t) return;
|
|
334
|
+
let r = t;
|
|
335
|
+
o.filter((e) => e.offset >= t && e.offset <= n).forEach((t) => {
|
|
336
|
+
t.offset > r && s.push(/* @__PURE__ */ P("span", {
|
|
337
|
+
"aria-hidden": !0,
|
|
338
|
+
children: e.slice(r, t.offset)
|
|
339
|
+
}, `text-${l++}`)), s.push(t.node), r = t.offset;
|
|
340
|
+
}), r < n && s.push(/* @__PURE__ */ P("span", {
|
|
341
|
+
"aria-hidden": !0,
|
|
342
|
+
children: e.slice(r, n)
|
|
343
|
+
}, `text-${l++}`));
|
|
344
|
+
};
|
|
345
|
+
return a.forEach((t, n) => {
|
|
346
|
+
if (u(c, t.start), t.start + t.length <= c) return;
|
|
347
|
+
let a = e.slice(t.start, t.start + t.length);
|
|
348
|
+
s.push(t.render ? /* @__PURE__ */ P("span", {
|
|
349
|
+
className: "pointer-events-auto",
|
|
350
|
+
children: t.render()
|
|
351
|
+
}, `range-${n}`) : /* @__PURE__ */ P("span", {
|
|
352
|
+
"aria-hidden": !0,
|
|
353
|
+
className: t.isUnsupported ? i : r,
|
|
354
|
+
children: a
|
|
355
|
+
}, `range-${n}`)), c = Math.max(c, t.start + t.length);
|
|
356
|
+
}), u(c, e.length), s;
|
|
357
|
+
}, Be = (e, t) => {
|
|
358
|
+
let n = document.createTreeWalker(e, NodeFilter.SHOW_TEXT, { acceptNode: (e) => e.parentElement?.closest("[data-mirror-synthetic]") == null ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT }), r = 0;
|
|
359
|
+
for (let e = n.nextNode(); e != null; e = n.nextNode()) {
|
|
360
|
+
let n = e.textContent?.length ?? 0;
|
|
361
|
+
if (t <= r + n) return {
|
|
362
|
+
node: e,
|
|
363
|
+
offset: t - r
|
|
364
|
+
};
|
|
365
|
+
r += n;
|
|
366
|
+
}
|
|
367
|
+
return null;
|
|
368
|
+
}, Ve = (e, t, n) => {
|
|
369
|
+
let r = Be(e, t), i = Be(e, n);
|
|
370
|
+
if (r == null || i == null) return null;
|
|
371
|
+
let a = document.createRange();
|
|
372
|
+
return a.setStart(r.node, r.offset), a.setEnd(i.node, i.offset), a;
|
|
373
|
+
}, He = ({ textareaRef: e, message: t, isMirrorActive: n }) => {
|
|
374
|
+
let r = B(null), [i, a] = V([]), o = L(() => {
|
|
375
|
+
let t = e.current, i = r.current, o = t?.selectionStart, s = t?.selectionEnd;
|
|
376
|
+
if (!n || t == null || i == null || o == null || s == null || o === s) {
|
|
377
|
+
a((e) => e.length === 0 ? e : []);
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
let c = Ve(i, o, s);
|
|
381
|
+
if (c == null) {
|
|
382
|
+
a((e) => e.length === 0 ? e : []);
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
let l = i.getBoundingClientRect();
|
|
386
|
+
a(Array.from(c.getClientRects()).map((e) => new DOMRect(e.left - l.left, e.top - l.top, e.width, e.height)));
|
|
387
|
+
}, [n, e]);
|
|
388
|
+
return De(() => {
|
|
389
|
+
o();
|
|
390
|
+
}, [o, t]), R(() => {
|
|
391
|
+
if (!n) return;
|
|
392
|
+
let t = e.current;
|
|
393
|
+
if (t == null || typeof ResizeObserver > "u") return;
|
|
394
|
+
let r = new ResizeObserver(o);
|
|
395
|
+
return r.observe(t), () => r.disconnect();
|
|
396
|
+
}, [
|
|
397
|
+
n,
|
|
398
|
+
e,
|
|
399
|
+
o
|
|
400
|
+
]), {
|
|
401
|
+
mirrorRef: r,
|
|
402
|
+
selectionRects: i,
|
|
403
|
+
updateSelectionRects: o
|
|
404
|
+
};
|
|
405
|
+
}, Ue = ({ messageProp: e, messageRevision: t }) => {
|
|
332
406
|
let [n, r] = V(e), i = B(null);
|
|
333
407
|
return R(() => {
|
|
334
408
|
r(e);
|
|
@@ -337,10 +411,10 @@ var K = {
|
|
|
337
411
|
setMessage: r,
|
|
338
412
|
textareaRef: i
|
|
339
413
|
};
|
|
340
|
-
},
|
|
414
|
+
}, We = (e, t, n, r = n) => {
|
|
341
415
|
let i = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value")?.set;
|
|
342
416
|
i ? i.call(e, t) : e.value = t, e.setSelectionRange(n, r), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
343
|
-
},
|
|
417
|
+
}, Ge = (e) => e.key.toLowerCase() === "z" && (e.ctrlKey || e.metaKey) && !e.shiftKey && !e.altKey, Ke = ({ insertion: e, textareaRef: t }) => {
|
|
344
418
|
let n = e?.revision, r = B(e?.text);
|
|
345
419
|
r.current = e?.text;
|
|
346
420
|
let i = B(n), a = B(null);
|
|
@@ -354,7 +428,7 @@ var K = {
|
|
|
354
428
|
let { value: r, selectionStart: i, selectionEnd: o } = n, s = i ?? r.length, c = o ?? s;
|
|
355
429
|
if (n.focus(), a.current = null, typeof document.execCommand == "function" && document.execCommand("insertText", !1, e)) return;
|
|
356
430
|
let l = `${r.slice(0, s)}${e}${r.slice(c)}`;
|
|
357
|
-
|
|
431
|
+
We(n, l, s + e.length), a.current = {
|
|
358
432
|
insertedValue: l,
|
|
359
433
|
previousValue: r,
|
|
360
434
|
previousSelectionStart: s,
|
|
@@ -363,17 +437,17 @@ var K = {
|
|
|
363
437
|
});
|
|
364
438
|
}, [n, t]), { handleUndoKeyDown: (e) => {
|
|
365
439
|
let n = a.current, r = t.current;
|
|
366
|
-
return n == null || r == null || !
|
|
440
|
+
return n == null || r == null || !Ge(e) || (a.current = null, r.value !== n.insertedValue) ? !1 : (e.preventDefault(), We(r, n.previousValue, n.previousSelectionStart, n.previousSelectionEnd), !0);
|
|
367
441
|
} };
|
|
368
|
-
},
|
|
442
|
+
}, qe = /* @__PURE__ */ function(e) {
|
|
369
443
|
return e.Idle = "idle", e.Recording = "recording", e.Processing = "processing", e.Error = "error", e;
|
|
370
|
-
}({}),
|
|
444
|
+
}({}), Je = /* @__PURE__ */ function(e) {
|
|
371
445
|
return e.Dictation = "dictation", e.Attachment = "attachment", e;
|
|
372
|
-
}({}),
|
|
446
|
+
}({}), Ye = [
|
|
373
447
|
"audio/webm;codecs=opus",
|
|
374
448
|
"audio/ogg;codecs=opus",
|
|
375
449
|
"audio/webm"
|
|
376
|
-
],
|
|
450
|
+
], Xe = 100, Ze = 100, Qe = .01, $e = ({ onAttachAudio: e, onTranscribeAudio: t, onTranscript: n, errorLabel: i = "Voice input failed" }) => {
|
|
377
451
|
let [a, o] = V("idle"), [s, c] = V(null), l = B(null), d = B(null), f = B({
|
|
378
452
|
onAttachAudio: e,
|
|
379
453
|
onTranscribeAudio: t,
|
|
@@ -404,7 +478,7 @@ var K = {
|
|
|
404
478
|
n.aborted || (t.controller.abort(), d.current = null, c(e instanceof Error ? e.message : f.current.errorLabel), o("error"));
|
|
405
479
|
}, S = () => {
|
|
406
480
|
if (!a || n.aborted) return;
|
|
407
|
-
let e =
|
|
481
|
+
let e = Ye.find((e) => MediaRecorder.isTypeSupported(e)), t = new MediaRecorder(a, e ? { mimeType: e } : void 0);
|
|
408
482
|
p = t;
|
|
409
483
|
let s = Date.now(), c = !1, d = !1, S = new Uint8Array(l.current?.fftSize ?? 256), C = async () => {
|
|
410
484
|
if (!(g || n.aborted)) {
|
|
@@ -412,7 +486,7 @@ var K = {
|
|
|
412
486
|
try {
|
|
413
487
|
let a = t.mimeType || e || "audio/webm", l = new Blob(_, { type: a });
|
|
414
488
|
_.length = 0, y();
|
|
415
|
-
let p = Date.now() - s >=
|
|
489
|
+
let p = Date.now() - s >= Ze;
|
|
416
490
|
if (l.size && (!i || p && (!c || d))) {
|
|
417
491
|
let e = u(a), t = r[e] ?? e.split("/")[1] ?? "webm", s = new File([l], "voice-" + crypto.randomUUID() + "." + t, { type: a });
|
|
418
492
|
if (i) {
|
|
@@ -438,8 +512,8 @@ var K = {
|
|
|
438
512
|
e.getByteTimeDomainData(S), c = !0;
|
|
439
513
|
let t = 0;
|
|
440
514
|
for (let e of S) t += ((e - 128) / 128) ** 2;
|
|
441
|
-
Math.sqrt(t / S.length) >=
|
|
442
|
-
},
|
|
515
|
+
Math.sqrt(t / S.length) >= Qe && (d = !0, v());
|
|
516
|
+
}, Xe));
|
|
443
517
|
};
|
|
444
518
|
t.stop = () => {
|
|
445
519
|
h || n.aborted || (h = !0, v(), o("processing"), p?.state === "recording" && p.stop());
|
|
@@ -470,15 +544,15 @@ var K = {
|
|
|
470
544
|
stopRecording: m,
|
|
471
545
|
discardRecording: h
|
|
472
546
|
};
|
|
473
|
-
},
|
|
547
|
+
}, et = /* @__PURE__ */ function(e) {
|
|
474
548
|
return e.Enter = "enter", e.MetaEnter = "meta-enter", e;
|
|
475
|
-
}({}),
|
|
549
|
+
}({}), tt = /* @__PURE__ */ function(e) {
|
|
476
550
|
return e.Stacked = "stacked", e.Inline = "inline", e;
|
|
477
|
-
}({}),
|
|
551
|
+
}({}), nt = {
|
|
478
552
|
item: "_item_1sr2n_1",
|
|
479
553
|
itemIcon: "_itemIcon_1sr2n_11"
|
|
480
|
-
},
|
|
481
|
-
let
|
|
554
|
+
}, rt = ({ isOpen: e, title: t, closeLabel: n, onClose: r, style: i, items: a, className: o, titleClassName: s = "dial-body-semi-text", itemLabelClassName: u = "dial-small-text", btnTextClassName: d = "", colors: f }) => {
|
|
555
|
+
let p = (e) => {
|
|
482
556
|
e(), r();
|
|
483
557
|
}, h = c({
|
|
484
558
|
"--ci-sheet-text": f?.itemText,
|
|
@@ -486,7 +560,7 @@ var K = {
|
|
|
486
560
|
"--ci-sheet-item-active": f?.itemActiveBg,
|
|
487
561
|
"--ci-sheet-icon": f?.itemIcon
|
|
488
562
|
});
|
|
489
|
-
return /* @__PURE__ */ U
|
|
563
|
+
return /* @__PURE__ */ P(U, {
|
|
490
564
|
isOpen: e,
|
|
491
565
|
title: t,
|
|
492
566
|
closeLabel: n,
|
|
@@ -495,31 +569,31 @@ var K = {
|
|
|
495
569
|
className: o,
|
|
496
570
|
titleClassName: s,
|
|
497
571
|
colors: f?.shell,
|
|
498
|
-
children: /* @__PURE__ */
|
|
572
|
+
children: /* @__PURE__ */ P("ul", {
|
|
499
573
|
role: "list",
|
|
500
574
|
className: "flex flex-col",
|
|
501
575
|
style: h,
|
|
502
|
-
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */
|
|
576
|
+
children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ P("li", { children: /* @__PURE__ */ P(m, {
|
|
503
577
|
type: "button",
|
|
504
|
-
className: l(
|
|
505
|
-
iconBefore: /* @__PURE__ */
|
|
506
|
-
className:
|
|
578
|
+
className: l(nt.item, "w-full gap-3 px-4 py-[10px] text-start"),
|
|
579
|
+
iconBefore: /* @__PURE__ */ P("span", {
|
|
580
|
+
className: nt.itemIcon,
|
|
507
581
|
children: n
|
|
508
582
|
}),
|
|
509
|
-
iconAfter: r ? /* @__PURE__ */
|
|
583
|
+
iconAfter: r ? /* @__PURE__ */ P("span", {
|
|
510
584
|
className: "ms-auto",
|
|
511
585
|
children: r
|
|
512
586
|
}) : null,
|
|
513
587
|
textClassName: d,
|
|
514
|
-
label: /* @__PURE__ */
|
|
588
|
+
label: /* @__PURE__ */ P("span", {
|
|
515
589
|
className: u,
|
|
516
590
|
children: t
|
|
517
591
|
}),
|
|
518
|
-
onClick: () =>
|
|
592
|
+
onClick: () => p(i)
|
|
519
593
|
}) }, e))
|
|
520
594
|
})
|
|
521
595
|
});
|
|
522
|
-
},
|
|
596
|
+
}, it = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
|
|
523
597
|
let [s, c] = V(t), [l, u] = V(n), [d, f] = V(r), p = B(o);
|
|
524
598
|
R(() => {
|
|
525
599
|
o && !p.current && (c(t), u(n), f(r)), p.current = o;
|
|
@@ -552,17 +626,17 @@ var K = {
|
|
|
552
626
|
a
|
|
553
627
|
])
|
|
554
628
|
};
|
|
555
|
-
},
|
|
629
|
+
}, at = { label: "_label_14i7c_1" }, ot = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: a, onSystemPromptChange: s, onTemperatureChange: u, responseFormatLabel: d = "Response format", responseFormatHint: f = "Applies to new and existing messages", responseFormatMarkdownLabel: p = "Markdown", responseFormatPlainTextLabel: m = "Plain text", systemPromptLabel: h = "System prompt", systemPromptTooltip: g = "Enter a prompt", temperatureLabel: _ = "Temperature", temperatureLabels: v = [
|
|
556
630
|
"Precise",
|
|
557
631
|
"Neutral",
|
|
558
632
|
"Creative"
|
|
559
633
|
], temperatureHint: y, labelClassName: b = "!dial-small-semi-text", colors: x }) => {
|
|
560
|
-
let S = c({ "--csf-label-text": x?.labelText }), C = l(b,
|
|
561
|
-
return /* @__PURE__ */
|
|
634
|
+
let S = c({ "--csf-label-text": x?.labelText }), C = l(b, at.label, "gap-1");
|
|
635
|
+
return /* @__PURE__ */ F("div", {
|
|
562
636
|
className: "flex flex-col gap-4 px-6 pb-3",
|
|
563
637
|
style: S,
|
|
564
638
|
children: [
|
|
565
|
-
e.responseFormat && /* @__PURE__ */
|
|
639
|
+
e.responseFormat && /* @__PURE__ */ P(k, {
|
|
566
640
|
id: "response-format",
|
|
567
641
|
labelProps: {
|
|
568
642
|
label: d,
|
|
@@ -570,7 +644,7 @@ var K = {
|
|
|
570
644
|
caption: f
|
|
571
645
|
},
|
|
572
646
|
optionsClassName: "mb-2",
|
|
573
|
-
orientation:
|
|
647
|
+
orientation: A.Column,
|
|
574
648
|
value: t ?? o.Markdown,
|
|
575
649
|
items: [{
|
|
576
650
|
value: o.Markdown,
|
|
@@ -581,18 +655,18 @@ var K = {
|
|
|
581
655
|
}],
|
|
582
656
|
onChange: (e) => a(e)
|
|
583
657
|
}),
|
|
584
|
-
e.systemPrompt && /* @__PURE__ */
|
|
658
|
+
e.systemPrompt && /* @__PURE__ */ P(ae, {
|
|
585
659
|
value: n,
|
|
586
660
|
placeholder: g,
|
|
587
661
|
className: i,
|
|
588
|
-
resize:
|
|
662
|
+
resize: oe.Vertical,
|
|
589
663
|
labelProps: {
|
|
590
664
|
className: C,
|
|
591
665
|
label: h
|
|
592
666
|
},
|
|
593
667
|
onChange: (e) => s(e ?? "")
|
|
594
668
|
}),
|
|
595
|
-
e.temperature && /* @__PURE__ */
|
|
669
|
+
e.temperature && /* @__PURE__ */ P(re, {
|
|
596
670
|
labelProps: {
|
|
597
671
|
label: _,
|
|
598
672
|
className: C,
|
|
@@ -603,13 +677,14 @@ var K = {
|
|
|
603
677
|
max: 1,
|
|
604
678
|
step: .1,
|
|
605
679
|
labels: v,
|
|
606
|
-
|
|
680
|
+
showTooltip: !0,
|
|
681
|
+
showTicks: !0,
|
|
607
682
|
onChange: u
|
|
608
683
|
})
|
|
609
684
|
]
|
|
610
685
|
});
|
|
611
|
-
},
|
|
612
|
-
let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat: O, setSystemPrompt:
|
|
686
|
+
}, st = ({ isOpen: e, onBack: t, backLabel: n, onClose: r, closeLabel: i, style: a, features: o, initialResponseFormat: s, initialSystemPrompt: c, initialTemperature: u, onSave: d, title: f = "Chat settings", responseFormatLabel: p, responseFormatHint: m, responseFormatMarkdownLabel: h, responseFormatPlainTextLabel: g, systemPromptLabel: _, systemPromptTooltip: v, temperatureLabel: y, temperatureLabels: b, temperatureHint: x, saveLabel: S = "Apply changes", saveDisabledTooltip: C }) => {
|
|
687
|
+
let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat: O, setSystemPrompt: k, setTemperature: A, handleSubmit: j } = it({
|
|
613
688
|
isOpen: e,
|
|
614
689
|
features: o,
|
|
615
690
|
initialResponseFormat: s,
|
|
@@ -618,7 +693,7 @@ var K = {
|
|
|
618
693
|
onSave: d,
|
|
619
694
|
onClose: r
|
|
620
695
|
});
|
|
621
|
-
return /* @__PURE__ */
|
|
696
|
+
return /* @__PURE__ */ F(U, {
|
|
622
697
|
isOpen: e,
|
|
623
698
|
title: f,
|
|
624
699
|
closeLabel: i,
|
|
@@ -626,14 +701,14 @@ var K = {
|
|
|
626
701
|
onBack: t,
|
|
627
702
|
backLabel: n,
|
|
628
703
|
style: a,
|
|
629
|
-
children: [/* @__PURE__ */
|
|
704
|
+
children: [/* @__PURE__ */ P(ot, {
|
|
630
705
|
features: o,
|
|
631
706
|
responseFormat: w,
|
|
632
707
|
systemPrompt: T,
|
|
633
708
|
temperature: E,
|
|
634
709
|
onResponseFormatChange: O,
|
|
635
|
-
onSystemPromptChange:
|
|
636
|
-
onTemperatureChange:
|
|
710
|
+
onSystemPromptChange: k,
|
|
711
|
+
onTemperatureChange: A,
|
|
637
712
|
responseFormatLabel: p,
|
|
638
713
|
responseFormatHint: m,
|
|
639
714
|
responseFormatMarkdownLabel: h,
|
|
@@ -643,23 +718,23 @@ var K = {
|
|
|
643
718
|
temperatureLabel: y,
|
|
644
719
|
temperatureLabels: b,
|
|
645
720
|
temperatureHint: x
|
|
646
|
-
}), /* @__PURE__ */
|
|
721
|
+
}), /* @__PURE__ */ P("div", {
|
|
647
722
|
className: l("px-6 py-4 mobile:pb-8"),
|
|
648
|
-
children: /* @__PURE__ */
|
|
723
|
+
children: /* @__PURE__ */ P(M, {
|
|
649
724
|
tooltip: C,
|
|
650
725
|
hideTooltip: D || !C,
|
|
651
726
|
triggerClassName: "w-full",
|
|
652
|
-
children: /* @__PURE__ */
|
|
727
|
+
children: /* @__PURE__ */ P(ee, {
|
|
653
728
|
label: S,
|
|
654
|
-
onClick:
|
|
729
|
+
onClick: j,
|
|
655
730
|
disabled: !D,
|
|
656
731
|
className: "w-full"
|
|
657
732
|
})
|
|
658
733
|
})
|
|
659
734
|
})]
|
|
660
735
|
});
|
|
661
|
-
},
|
|
662
|
-
let { responseFormat:
|
|
736
|
+
}, ct = { modal: "_modal_kl0h0_1" }, lt = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", titleClassName: s = "dial-h1-text", responseFormatLabel: c, responseFormatHint: l, responseFormatMarkdownLabel: u, responseFormatPlainTextLabel: d, systemPromptLabel: f, systemPromptTooltip: p, temperatureLabel: m, temperatureLabels: g, temperatureHint: _, saveLabel: v = "Apply changes", saveDisabledTooltip: y, backgroundClassName: b = ct.modal }) => {
|
|
737
|
+
let { responseFormat: x, systemPrompt: S, temperature: C, canSubmit: w, setResponseFormat: T, setSystemPrompt: ee, setTemperature: O, handleSubmit: k } = it({
|
|
663
738
|
features: e,
|
|
664
739
|
initialResponseFormat: t,
|
|
665
740
|
initialSystemPrompt: n,
|
|
@@ -667,32 +742,30 @@ var K = {
|
|
|
667
742
|
onSave: i,
|
|
668
743
|
onClose: a
|
|
669
744
|
});
|
|
670
|
-
return /* @__PURE__ */
|
|
745
|
+
return /* @__PURE__ */ P(E, {
|
|
671
746
|
open: !0,
|
|
672
747
|
header: o,
|
|
673
748
|
titleClassName: s,
|
|
674
|
-
size:
|
|
749
|
+
size: D.Sm,
|
|
675
750
|
onClose: a,
|
|
676
|
-
className:
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
}),
|
|
689
|
-
children: /* @__PURE__ */ U(Qe, {
|
|
751
|
+
className: b,
|
|
752
|
+
mainButtons: [{
|
|
753
|
+
label: v,
|
|
754
|
+
variant: h.Primary,
|
|
755
|
+
onClick: k,
|
|
756
|
+
disabled: !w,
|
|
757
|
+
tooltipProps: y ? {
|
|
758
|
+
tooltip: y,
|
|
759
|
+
hideTooltip: w
|
|
760
|
+
} : void 0
|
|
761
|
+
}],
|
|
762
|
+
children: /* @__PURE__ */ P(ot, {
|
|
690
763
|
features: e,
|
|
691
|
-
responseFormat:
|
|
692
|
-
systemPrompt:
|
|
693
|
-
temperature:
|
|
694
|
-
onResponseFormatChange:
|
|
695
|
-
onSystemPromptChange:
|
|
764
|
+
responseFormat: x,
|
|
765
|
+
systemPrompt: S,
|
|
766
|
+
temperature: C,
|
|
767
|
+
onResponseFormatChange: T,
|
|
768
|
+
onSystemPromptChange: ee,
|
|
696
769
|
onTemperatureChange: O,
|
|
697
770
|
responseFormatLabel: c,
|
|
698
771
|
responseFormatHint: l,
|
|
@@ -701,14 +774,14 @@ var K = {
|
|
|
701
774
|
systemPromptLabel: f,
|
|
702
775
|
systemPromptTooltip: p,
|
|
703
776
|
temperatureLabel: m,
|
|
704
|
-
temperatureLabels:
|
|
705
|
-
temperatureHint:
|
|
777
|
+
temperatureLabels: g,
|
|
778
|
+
temperatureHint: _
|
|
706
779
|
})
|
|
707
780
|
});
|
|
708
|
-
},
|
|
781
|
+
}, ut = {
|
|
709
782
|
icon: "_icon_1fv6z_1",
|
|
710
783
|
selectedIcon: "_selectedIcon_1fv6z_5"
|
|
711
|
-
},
|
|
784
|
+
}, dt = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel: i = "Close", style: a, title: o = "Tools", items: s, onToolToggle: u, itemLabelClassName: d = "dial-small-text", colors: p }) => /* @__PURE__ */ P(U, {
|
|
712
785
|
isOpen: e,
|
|
713
786
|
title: o,
|
|
714
787
|
closeLabel: i,
|
|
@@ -716,33 +789,33 @@ var K = {
|
|
|
716
789
|
onBack: t,
|
|
717
790
|
backLabel: n,
|
|
718
791
|
style: a,
|
|
719
|
-
children: /* @__PURE__ */
|
|
792
|
+
children: /* @__PURE__ */ P("ul", {
|
|
720
793
|
role: "menu",
|
|
721
794
|
className: "flex flex-col pb-4",
|
|
722
795
|
style: c({
|
|
723
|
-
"--tbs-icon-text":
|
|
724
|
-
"--tbs-selected-icon-text":
|
|
796
|
+
"--tbs-icon-text": p?.iconText,
|
|
797
|
+
"--tbs-selected-icon-text": p?.selectedIconText
|
|
725
798
|
}),
|
|
726
|
-
children: s.map((e) => /* @__PURE__ */
|
|
799
|
+
children: s.map((e) => /* @__PURE__ */ P("li", {
|
|
727
800
|
role: "none",
|
|
728
|
-
children: /* @__PURE__ */
|
|
801
|
+
children: /* @__PURE__ */ P(m, {
|
|
729
802
|
type: "button",
|
|
730
803
|
role: "menuitemcheckbox",
|
|
731
804
|
"aria-checked": e.isSelected,
|
|
732
805
|
className: "w-full gap-3 px-4 py-[10px] text-start",
|
|
733
|
-
iconBefore: /* @__PURE__ */
|
|
734
|
-
className: l("flex items-center",
|
|
806
|
+
iconBefore: /* @__PURE__ */ P("span", {
|
|
807
|
+
className: l("flex items-center", ut.icon),
|
|
735
808
|
children: e.icon
|
|
736
809
|
}),
|
|
737
|
-
iconAfter: e.isSelected ? /* @__PURE__ */
|
|
738
|
-
className: l("ms-auto",
|
|
739
|
-
children: /* @__PURE__ */
|
|
810
|
+
iconAfter: e.isSelected ? /* @__PURE__ */ P("span", {
|
|
811
|
+
className: l("ms-auto", ut.selectedIcon),
|
|
812
|
+
children: /* @__PURE__ */ P(de, {
|
|
740
813
|
size: f,
|
|
741
814
|
"aria-hidden": !0,
|
|
742
|
-
stroke:
|
|
815
|
+
stroke: _
|
|
743
816
|
})
|
|
744
817
|
}) : null,
|
|
745
|
-
label: /* @__PURE__ */
|
|
818
|
+
label: /* @__PURE__ */ P("span", {
|
|
746
819
|
className: d,
|
|
747
820
|
children: e.label
|
|
748
821
|
}),
|
|
@@ -750,325 +823,350 @@ var K = {
|
|
|
750
823
|
})
|
|
751
824
|
}, e.id))
|
|
752
825
|
})
|
|
753
|
-
}),
|
|
826
|
+
}), ft = {
|
|
754
827
|
toolIcon: "_toolIcon_ma5s5_1",
|
|
755
828
|
chevronIcon: "_chevronIcon_ma5s5_5"
|
|
756
|
-
},
|
|
757
|
-
let
|
|
758
|
-
"--aab-tool-icon":
|
|
759
|
-
"--aab-chevron-icon":
|
|
760
|
-
}), [
|
|
829
|
+
}, pt = ({ onAttachClick: e, onRecordVoice: t, recordVoiceLabel: n = "Record voice", attachLabel: r, addMenuTitle: i, menuTitle: a, menuCloseLabel: s, style: u, listClassName: p = "w-[240px]", isDisabled: m = !1, chatSettings: h, extraMenuItems: b, toolsMenuItems: S = [], onToolToggle: w, toolsMenuTitle: T = "Tools", toolsBackLabel: E = "Back", menuOverlays: D, getCaretPosition: ee, colors: O }) => {
|
|
830
|
+
let k = d(), [A, j] = V(!1), [te, ne] = V(!1), [re, ie] = V(!1), [ae, oe] = V(null), [M, se] = V(!1), I = z(() => c({
|
|
831
|
+
"--aab-tool-icon": O?.toolIcon,
|
|
832
|
+
"--aab-chevron-icon": O?.chevronIcon
|
|
833
|
+
}), [O?.toolIcon, O?.chevronIcon]), ce = S.length > 0 && w != null, le = D != null && D.length > 0, ue = z(() => S.map((e) => ({
|
|
761
834
|
key: e.id,
|
|
762
835
|
label: e.label,
|
|
763
|
-
icon: /* @__PURE__ */
|
|
764
|
-
style:
|
|
765
|
-
className: l("flex items-center",
|
|
836
|
+
icon: /* @__PURE__ */ P("span", {
|
|
837
|
+
style: I,
|
|
838
|
+
className: l("flex items-center", ft.toolIcon),
|
|
766
839
|
children: e.icon
|
|
767
840
|
}),
|
|
768
841
|
selectable: !0,
|
|
769
|
-
mark:
|
|
842
|
+
mark: C.Check,
|
|
770
843
|
checked: e.isSelected,
|
|
771
844
|
onClick: () => w?.(e.id)
|
|
772
845
|
})), [
|
|
773
|
-
|
|
846
|
+
S,
|
|
774
847
|
w,
|
|
775
|
-
|
|
776
|
-
]),
|
|
848
|
+
I
|
|
849
|
+
]), de = z(() => [
|
|
777
850
|
...e == null ? [] : [{
|
|
778
851
|
key: "attach",
|
|
779
852
|
label: r,
|
|
780
|
-
icon: /* @__PURE__ */
|
|
853
|
+
icon: /* @__PURE__ */ P(ge, {
|
|
781
854
|
size: f,
|
|
782
855
|
"aria-hidden": !0,
|
|
783
|
-
stroke:
|
|
856
|
+
stroke: _
|
|
784
857
|
}),
|
|
785
858
|
onClick: e
|
|
786
859
|
}],
|
|
787
|
-
...
|
|
788
|
-
...
|
|
860
|
+
...b ?? [],
|
|
861
|
+
...ce ? [{
|
|
789
862
|
key: "tools",
|
|
790
863
|
label: T,
|
|
791
|
-
icon: /* @__PURE__ */
|
|
864
|
+
icon: /* @__PURE__ */ P(be, {
|
|
792
865
|
size: f,
|
|
793
866
|
"aria-hidden": !0,
|
|
794
|
-
stroke:
|
|
867
|
+
stroke: _
|
|
795
868
|
}),
|
|
796
|
-
onClick:
|
|
797
|
-
ie(!0),
|
|
869
|
+
onClick: k ? () => {
|
|
870
|
+
ie(!0), j(!1);
|
|
798
871
|
} : () => void 0,
|
|
799
|
-
...
|
|
872
|
+
...k ? { iconAfter: /* @__PURE__ */ P(pe, {
|
|
800
873
|
size: f,
|
|
801
|
-
stroke:
|
|
802
|
-
style:
|
|
803
|
-
className: l("rtl:scale-x-[-1]",
|
|
874
|
+
stroke: _,
|
|
875
|
+
style: I,
|
|
876
|
+
className: l("rtl:scale-x-[-1]", ft.chevronIcon),
|
|
804
877
|
"aria-hidden": !0
|
|
805
|
-
}) } : { children:
|
|
878
|
+
}) } : { children: ue }
|
|
806
879
|
}] : [],
|
|
807
|
-
...(
|
|
880
|
+
...(D ?? []).map((e) => ({
|
|
808
881
|
key: e.key,
|
|
809
882
|
label: e.title,
|
|
810
883
|
icon: e.icon,
|
|
811
|
-
onClick:
|
|
812
|
-
|
|
884
|
+
onClick: k ? () => {
|
|
885
|
+
oe(e.key), j(!1);
|
|
813
886
|
} : () => void 0,
|
|
814
|
-
...
|
|
887
|
+
...k ? { iconAfter: /* @__PURE__ */ P(pe, {
|
|
815
888
|
size: f,
|
|
816
|
-
stroke:
|
|
817
|
-
style:
|
|
818
|
-
className: l("rtl:scale-x-[-1]",
|
|
889
|
+
stroke: _,
|
|
890
|
+
style: I,
|
|
891
|
+
className: l("rtl:scale-x-[-1]", ft.chevronIcon),
|
|
819
892
|
"aria-hidden": !0
|
|
820
893
|
}) } : {
|
|
821
894
|
children: [{
|
|
822
895
|
key: `${e.key}-panel`,
|
|
823
896
|
label: ""
|
|
824
897
|
}],
|
|
825
|
-
renderSubMenu: () => e.renderOverlay(() =>
|
|
898
|
+
renderSubMenu: () => e.renderOverlay(() => se(!1), ee?.() ?? 0)
|
|
826
899
|
}
|
|
827
900
|
})),
|
|
828
901
|
...t == null ? [] : [{
|
|
829
902
|
key: "record-voice",
|
|
830
903
|
label: n,
|
|
831
|
-
icon: /* @__PURE__ */
|
|
904
|
+
icon: /* @__PURE__ */ P(he, {
|
|
832
905
|
size: f,
|
|
833
906
|
"aria-hidden": !0,
|
|
834
|
-
stroke:
|
|
907
|
+
stroke: _
|
|
835
908
|
}),
|
|
836
909
|
onClick: () => {
|
|
837
|
-
|
|
910
|
+
j(!1), se(!1), t();
|
|
838
911
|
}
|
|
839
912
|
}],
|
|
840
|
-
...
|
|
913
|
+
...h == null ? [] : [{
|
|
841
914
|
key: "chat-settings",
|
|
842
|
-
label:
|
|
843
|
-
icon: /* @__PURE__ */
|
|
915
|
+
label: h.menuItemLabel ?? "Chat settings",
|
|
916
|
+
icon: /* @__PURE__ */ P(ye, {
|
|
844
917
|
size: f,
|
|
845
918
|
"aria-hidden": !0,
|
|
846
|
-
stroke:
|
|
919
|
+
stroke: _
|
|
847
920
|
}),
|
|
848
|
-
iconAfter:
|
|
921
|
+
iconAfter: k ? /* @__PURE__ */ P(pe, {
|
|
849
922
|
size: f,
|
|
850
|
-
stroke:
|
|
851
|
-
style:
|
|
852
|
-
className: l("rtl:scale-x-[-1]",
|
|
923
|
+
stroke: _,
|
|
924
|
+
style: I,
|
|
925
|
+
className: l("rtl:scale-x-[-1]", ft.chevronIcon),
|
|
853
926
|
"aria-hidden": !0
|
|
854
927
|
}) : null,
|
|
855
|
-
onClick: () =>
|
|
928
|
+
onClick: () => ne(!0)
|
|
856
929
|
}]
|
|
857
930
|
], [
|
|
858
931
|
r,
|
|
859
932
|
e,
|
|
860
933
|
t,
|
|
861
934
|
n,
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
ae,
|
|
866
|
-
T,
|
|
935
|
+
h,
|
|
936
|
+
b,
|
|
937
|
+
k,
|
|
867
938
|
ce,
|
|
868
|
-
|
|
869
|
-
|
|
939
|
+
T,
|
|
940
|
+
ue,
|
|
941
|
+
D,
|
|
942
|
+
ee,
|
|
943
|
+
I
|
|
870
944
|
]);
|
|
871
|
-
if (
|
|
872
|
-
let
|
|
945
|
+
if (de.length === 0) return null;
|
|
946
|
+
let fe = /* @__PURE__ */ P(v, {
|
|
873
947
|
matchReferenceWidth: !1,
|
|
874
948
|
placement: "bottom-start",
|
|
875
949
|
listClassName: p,
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
950
|
+
overlayContentClassName: "flex flex-col gap-1",
|
|
951
|
+
items: de,
|
|
952
|
+
disabled: m,
|
|
953
|
+
open: le ? M : void 0,
|
|
954
|
+
onOpenChange: le ? se : void 0,
|
|
955
|
+
children: /* @__PURE__ */ P(x, {
|
|
956
|
+
icon: /* @__PURE__ */ P(ve, {
|
|
957
|
+
size: g.LG,
|
|
882
958
|
"aria-hidden": !0,
|
|
883
|
-
stroke:
|
|
959
|
+
stroke: _
|
|
884
960
|
}),
|
|
885
961
|
"aria-label": i,
|
|
886
962
|
tooltipProps: { tooltip: i },
|
|
887
963
|
disabled: m
|
|
888
964
|
})
|
|
889
965
|
});
|
|
890
|
-
return /* @__PURE__ */
|
|
891
|
-
/* @__PURE__ */
|
|
892
|
-
icon: /* @__PURE__ */
|
|
893
|
-
size:
|
|
966
|
+
return /* @__PURE__ */ P(N, { children: k ? /* @__PURE__ */ F(N, { children: [
|
|
967
|
+
/* @__PURE__ */ P(x, {
|
|
968
|
+
icon: /* @__PURE__ */ P(ve, {
|
|
969
|
+
size: g.LG,
|
|
894
970
|
"aria-hidden": !0,
|
|
895
|
-
stroke:
|
|
971
|
+
stroke: _
|
|
896
972
|
}),
|
|
897
973
|
"aria-label": i,
|
|
898
|
-
size:
|
|
974
|
+
size: y.Large,
|
|
899
975
|
tooltipProps: { tooltip: i },
|
|
900
976
|
disabled: m,
|
|
901
|
-
onClick: () =>
|
|
977
|
+
onClick: () => j(!0)
|
|
902
978
|
}),
|
|
903
|
-
/* @__PURE__ */
|
|
904
|
-
isOpen:
|
|
979
|
+
/* @__PURE__ */ P(rt, {
|
|
980
|
+
isOpen: A,
|
|
905
981
|
title: a,
|
|
906
982
|
closeLabel: s,
|
|
907
|
-
onClose: () =>
|
|
983
|
+
onClose: () => j(!1),
|
|
908
984
|
style: u,
|
|
909
|
-
items:
|
|
985
|
+
items: de,
|
|
910
986
|
className: "pb-4",
|
|
911
987
|
btnTextClassName: "flex-1"
|
|
912
988
|
}),
|
|
913
|
-
|
|
989
|
+
ce && /* @__PURE__ */ P(dt, {
|
|
914
990
|
isOpen: re,
|
|
915
991
|
onBack: () => {
|
|
916
|
-
ie(!1),
|
|
992
|
+
ie(!1), j(!0);
|
|
917
993
|
},
|
|
918
|
-
backLabel:
|
|
994
|
+
backLabel: E,
|
|
919
995
|
onClose: () => ie(!1),
|
|
920
996
|
closeLabel: s,
|
|
921
997
|
style: u,
|
|
922
998
|
title: T,
|
|
923
|
-
items:
|
|
999
|
+
items: S,
|
|
924
1000
|
onToolToggle: w
|
|
925
1001
|
}),
|
|
926
|
-
|
|
927
|
-
isOpen:
|
|
1002
|
+
D?.map((e) => /* @__PURE__ */ P(U, {
|
|
1003
|
+
isOpen: ae === e.key,
|
|
928
1004
|
title: e.title,
|
|
929
1005
|
closeLabel: s,
|
|
930
1006
|
onBack: () => {
|
|
931
|
-
|
|
1007
|
+
oe(null), j(!0);
|
|
932
1008
|
},
|
|
933
1009
|
backLabel: e.backLabel ?? "Back",
|
|
934
|
-
onClose: () =>
|
|
1010
|
+
onClose: () => oe(null),
|
|
935
1011
|
style: u,
|
|
936
|
-
children:
|
|
1012
|
+
children: /* @__PURE__ */ P("div", {
|
|
1013
|
+
role: "menu",
|
|
1014
|
+
"aria-label": e.title,
|
|
1015
|
+
children: e.renderOverlay(() => oe(null), ee?.() ?? 0)
|
|
1016
|
+
})
|
|
937
1017
|
}, e.key)),
|
|
938
|
-
|
|
939
|
-
isOpen:
|
|
1018
|
+
h != null && /* @__PURE__ */ P(st, {
|
|
1019
|
+
isOpen: te,
|
|
940
1020
|
onBack: () => {
|
|
941
|
-
|
|
1021
|
+
ne(!1), j(!0);
|
|
942
1022
|
},
|
|
943
|
-
backLabel:
|
|
944
|
-
onClose: () =>
|
|
1023
|
+
backLabel: h.backLabel ?? "Back",
|
|
1024
|
+
onClose: () => ne(!1),
|
|
945
1025
|
closeLabel: s,
|
|
946
1026
|
style: u,
|
|
947
|
-
features:
|
|
948
|
-
initialResponseFormat:
|
|
949
|
-
initialSystemPrompt:
|
|
950
|
-
initialTemperature:
|
|
951
|
-
onSave:
|
|
952
|
-
title:
|
|
953
|
-
responseFormatLabel:
|
|
954
|
-
responseFormatHint:
|
|
955
|
-
responseFormatMarkdownLabel:
|
|
956
|
-
responseFormatPlainTextLabel:
|
|
957
|
-
systemPromptLabel:
|
|
958
|
-
systemPromptTooltip:
|
|
959
|
-
temperatureLabel:
|
|
960
|
-
temperatureLabels:
|
|
961
|
-
temperatureHint:
|
|
962
|
-
saveLabel:
|
|
963
|
-
saveDisabledTooltip:
|
|
1027
|
+
features: h.features,
|
|
1028
|
+
initialResponseFormat: h.responseFormat ?? o.Markdown,
|
|
1029
|
+
initialSystemPrompt: h.systemPrompt,
|
|
1030
|
+
initialTemperature: h.temperature,
|
|
1031
|
+
onSave: h.onSave,
|
|
1032
|
+
title: h.title,
|
|
1033
|
+
responseFormatLabel: h.responseFormatLabel,
|
|
1034
|
+
responseFormatHint: h.responseFormatHint,
|
|
1035
|
+
responseFormatMarkdownLabel: h.responseFormatMarkdownLabel,
|
|
1036
|
+
responseFormatPlainTextLabel: h.responseFormatPlainTextLabel,
|
|
1037
|
+
systemPromptLabel: h.systemPromptLabel,
|
|
1038
|
+
systemPromptTooltip: h.systemPromptTooltip,
|
|
1039
|
+
temperatureLabel: h.temperatureLabel,
|
|
1040
|
+
temperatureLabels: h.temperatureLabels,
|
|
1041
|
+
temperatureHint: h.temperatureHint,
|
|
1042
|
+
saveLabel: h.saveLabel,
|
|
1043
|
+
saveDisabledTooltip: h.saveDisabledTooltip
|
|
964
1044
|
})
|
|
965
|
-
] }) : /* @__PURE__ */
|
|
966
|
-
features:
|
|
967
|
-
initialResponseFormat:
|
|
968
|
-
initialSystemPrompt:
|
|
969
|
-
initialTemperature:
|
|
970
|
-
onSave:
|
|
971
|
-
onClose: () =>
|
|
972
|
-
title:
|
|
973
|
-
responseFormatLabel:
|
|
974
|
-
responseFormatHint:
|
|
975
|
-
responseFormatMarkdownLabel:
|
|
976
|
-
responseFormatPlainTextLabel:
|
|
977
|
-
systemPromptLabel:
|
|
978
|
-
systemPromptTooltip:
|
|
979
|
-
temperatureLabel:
|
|
980
|
-
temperatureLabels:
|
|
981
|
-
temperatureHint:
|
|
982
|
-
saveLabel:
|
|
983
|
-
saveDisabledTooltip:
|
|
1045
|
+
] }) : /* @__PURE__ */ F(N, { children: [fe, h != null && te && /* @__PURE__ */ P(lt, {
|
|
1046
|
+
features: h.features,
|
|
1047
|
+
initialResponseFormat: h.responseFormat ?? o.Markdown,
|
|
1048
|
+
initialSystemPrompt: h.systemPrompt,
|
|
1049
|
+
initialTemperature: h.temperature,
|
|
1050
|
+
onSave: h.onSave,
|
|
1051
|
+
onClose: () => ne(!1),
|
|
1052
|
+
title: h.title,
|
|
1053
|
+
responseFormatLabel: h.responseFormatLabel,
|
|
1054
|
+
responseFormatHint: h.responseFormatHint,
|
|
1055
|
+
responseFormatMarkdownLabel: h.responseFormatMarkdownLabel,
|
|
1056
|
+
responseFormatPlainTextLabel: h.responseFormatPlainTextLabel,
|
|
1057
|
+
systemPromptLabel: h.systemPromptLabel,
|
|
1058
|
+
systemPromptTooltip: h.systemPromptTooltip,
|
|
1059
|
+
temperatureLabel: h.temperatureLabel,
|
|
1060
|
+
temperatureLabels: h.temperatureLabels,
|
|
1061
|
+
temperatureHint: h.temperatureHint,
|
|
1062
|
+
saveLabel: h.saveLabel,
|
|
1063
|
+
saveDisabledTooltip: h.saveDisabledTooltip
|
|
984
1064
|
})] }) });
|
|
985
|
-
},
|
|
986
|
-
chip: "
|
|
987
|
-
chipSelected: "
|
|
988
|
-
chipIcon: "
|
|
989
|
-
chipText: "
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
"
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
className: "flex min-w-0 items-center gap-1.5",
|
|
1013
|
-
children: [/* @__PURE__ */
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1065
|
+
}, G = {
|
|
1066
|
+
chip: "_chip_1lvv5_1",
|
|
1067
|
+
chipSelected: "_chipSelected_1lvv5_9",
|
|
1068
|
+
chipIcon: "_chipIcon_1lvv5_16",
|
|
1069
|
+
chipText: "_chipText_1lvv5_19",
|
|
1070
|
+
chipState: "_chipState_1lvv5_22",
|
|
1071
|
+
chipClose: "_chipClose_1lvv5_25"
|
|
1072
|
+
}, mt = (e) => `Remove ${e}`, ht = ({ items: e, onToolToggle: t, onToolDismiss: n, canRemove: r = !0, removeLabel: i = mt, stateOnLabel: a, stateOffLabel: o, typography: s, colors: u }) => {
|
|
1073
|
+
if (e.length === 0) return null;
|
|
1074
|
+
let d = !!(a && o);
|
|
1075
|
+
return /* @__PURE__ */ P("div", {
|
|
1076
|
+
className: "flex flex-wrap items-center gap-2",
|
|
1077
|
+
style: c({
|
|
1078
|
+
"--ci-chip-bg": u?.chipBg,
|
|
1079
|
+
"--ci-chip-border": u?.chipBorder,
|
|
1080
|
+
"--ci-chip-icon": u?.chipIcon,
|
|
1081
|
+
"--ci-chip-text": u?.chipText,
|
|
1082
|
+
"--ci-chip-hover-bg": u?.chipHoverBg,
|
|
1083
|
+
"--ci-chip-selected-bg": u?.chipSelectedBg,
|
|
1084
|
+
"--ci-chip-selected-border": u?.chipSelectedBorder,
|
|
1085
|
+
"--ci-chip-selected-icon": u?.chipSelectedIcon,
|
|
1086
|
+
"--ci-chip-selected-text": u?.chipSelectedText,
|
|
1087
|
+
"--ci-chip-state-text": u?.chipStateText,
|
|
1088
|
+
"--ci-chip-close": u?.chipClose,
|
|
1089
|
+
"--ci-chip-close-hover": u?.chipCloseHover
|
|
1090
|
+
}),
|
|
1091
|
+
children: e.map((e) => /* @__PURE__ */ F("div", {
|
|
1092
|
+
className: l(G.chip, e.isSelected && G.chipSelected, "flex min-w-0 items-center gap-1.5 rounded-full border py-1 transition-colors", r ? "pe-1 ps-2" : "px-2"),
|
|
1093
|
+
children: [/* @__PURE__ */ F("button", {
|
|
1094
|
+
type: "button",
|
|
1095
|
+
onClick: () => t(e.id),
|
|
1096
|
+
"aria-pressed": e.isSelected,
|
|
1097
|
+
className: "flex min-w-0 items-center gap-1.5",
|
|
1098
|
+
children: [
|
|
1099
|
+
/* @__PURE__ */ P("span", {
|
|
1100
|
+
className: l(G.chipIcon, "shrink-0"),
|
|
1101
|
+
"aria-hidden": !0,
|
|
1102
|
+
children: e.icon
|
|
1103
|
+
}),
|
|
1104
|
+
/* @__PURE__ */ F("span", {
|
|
1105
|
+
className: l(G.chipText, s?.fontClassName || "dial-small-paragraph-text", "truncate"),
|
|
1106
|
+
children: [e.label, d && /* @__PURE__ */ P("span", {
|
|
1107
|
+
"aria-hidden": !0,
|
|
1108
|
+
children: ":"
|
|
1109
|
+
})]
|
|
1110
|
+
}),
|
|
1111
|
+
d && /* @__PURE__ */ P("span", {
|
|
1112
|
+
className: l(G.chipState, s?.fontClassName || "dial-small-paragraph-text", "ms-1 shrink-0 uppercase tracking-wider"),
|
|
1113
|
+
"aria-hidden": !0,
|
|
1114
|
+
children: e.isSelected ? a : o
|
|
1115
|
+
})
|
|
1116
|
+
]
|
|
1117
|
+
}), r && /* @__PURE__ */ P("button", {
|
|
1118
|
+
type: "button",
|
|
1119
|
+
onClick: () => n(e.id),
|
|
1120
|
+
"aria-label": i(e.label),
|
|
1121
|
+
className: l(G.chipClose, "flex shrink-0 items-center rounded p-0.5 transition-colors"),
|
|
1122
|
+
children: /* @__PURE__ */ P(xe, {
|
|
1123
|
+
size: 12,
|
|
1124
|
+
"aria-hidden": !0,
|
|
1125
|
+
stroke: _
|
|
1126
|
+
})
|
|
1020
1127
|
})]
|
|
1021
|
-
}
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
modelSelectorVersion: "_modelSelectorVersion_q1jcl_53",
|
|
1043
|
-
modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_q1jcl_62"
|
|
1044
|
-
}, ct = {
|
|
1045
|
-
wrapperError: "_wrapperError_129ri_1",
|
|
1046
|
-
waveformCanvas: "_waveformCanvas_129ri_5",
|
|
1047
|
-
recordingDot: "_recordingDot_129ri_19",
|
|
1048
|
-
"recording-pulse": "_recording-pulse_129ri_1"
|
|
1049
|
-
}, lt = 3, ut = 4, dt = 200, ft = ({ state: e, analyserNodeRef: t, errorMessage: n, onStop: r, onDiscard: i, attachButton: a, stopLabel: o = "Stop recording", discardLabel: s = "Discard recording", processingLabel: c = "Transcribing audio…", style: u, className: d, embedded: f = !1 }) => {
|
|
1050
|
-
let p = B(null), m = B(new Float32Array(dt)), _ = B(0), v = B(0), x = e === ze.Recording, S = e === ze.Error, C = e === ze.Processing, w = L((e) => {
|
|
1128
|
+
}, e.id))
|
|
1129
|
+
});
|
|
1130
|
+
}, K = {
|
|
1131
|
+
wrapper: "_wrapper_19a9k_2",
|
|
1132
|
+
wrapperDisabled: "_wrapperDisabled_19a9k_9",
|
|
1133
|
+
textarea: "_textarea_19a9k_13",
|
|
1134
|
+
textareaMentionMode: "_textareaMentionMode_19a9k_19",
|
|
1135
|
+
commandHint: "_commandHint_19a9k_53",
|
|
1136
|
+
mentionHighlight: "_mentionHighlight_19a9k_57",
|
|
1137
|
+
mentionHighlightUnsupported: "_mentionHighlightUnsupported_19a9k_63",
|
|
1138
|
+
modelSelectorButton: "_modelSelectorButton_19a9k_69",
|
|
1139
|
+
modelSelectorCaret: "_modelSelectorCaret_19a9k_69",
|
|
1140
|
+
modelSelectorName: "_modelSelectorName_19a9k_72",
|
|
1141
|
+
modelSelectorVersion: "_modelSelectorVersion_19a9k_75",
|
|
1142
|
+
modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_19a9k_84"
|
|
1143
|
+
}, gt = {
|
|
1144
|
+
waveformCanvas: "_waveformCanvas_18zb5_1",
|
|
1145
|
+
recordingDot: "_recordingDot_18zb5_15",
|
|
1146
|
+
"recording-pulse": "_recording-pulse_18zb5_1"
|
|
1147
|
+
}, _t = 3, vt = 4, yt = 200, bt = ({ state: e, analyserNodeRef: t, onStop: n, onDiscard: r, attachButton: i, stopLabel: a = "Stop recording", discardLabel: o = "Discard recording", processingLabel: s = "Transcribing audio…", style: c, className: u, embedded: d = !1 }) => {
|
|
1148
|
+
let f = B(null), p = B(new Float32Array(yt)), m = B(0), h = B(0), v = e === qe.Recording, y = e === qe.Processing, b = L((e) => {
|
|
1051
1149
|
let t = e.getContext("2d");
|
|
1052
1150
|
if (!t) return;
|
|
1053
1151
|
e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
|
|
1054
1152
|
let { width: n, height: r } = e;
|
|
1055
1153
|
t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
|
|
1056
|
-
let i = Math.min(Math.max(1, Math.floor(n /
|
|
1154
|
+
let i = Math.min(Math.max(1, Math.floor(n / vt)), yt - 1), a = m.current, o = h.current;
|
|
1057
1155
|
t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
|
|
1058
1156
|
for (let e = 0; e <= i; e++) {
|
|
1059
|
-
let n = ((a - i + e) %
|
|
1060
|
-
t.fillRect(e *
|
|
1157
|
+
let n = ((a - i + e) % yt + yt) % yt, o = p.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
|
|
1158
|
+
t.fillRect(e * vt, (r - c) / 2, _t, c);
|
|
1061
1159
|
}
|
|
1062
1160
|
t.restore();
|
|
1063
1161
|
}, []);
|
|
1064
1162
|
R(() => {
|
|
1065
|
-
if (!
|
|
1066
|
-
let e =
|
|
1163
|
+
if (!v) return;
|
|
1164
|
+
let e = f.current;
|
|
1067
1165
|
if (!e) return;
|
|
1068
|
-
|
|
1166
|
+
p.current.fill(0), m.current = 0, h.current = 0;
|
|
1069
1167
|
let n, r = () => {
|
|
1070
|
-
if (
|
|
1071
|
-
|
|
1168
|
+
if (h.current += 1, h.current >= vt) {
|
|
1169
|
+
h.current -= vt;
|
|
1072
1170
|
let e = t.current;
|
|
1073
1171
|
if (e) {
|
|
1074
1172
|
let t = new Uint8Array(e.frequencyBinCount);
|
|
@@ -1078,207 +1176,223 @@ var K = {
|
|
|
1078
1176
|
let r = (t[e] - 128) / 128;
|
|
1079
1177
|
n += r * r;
|
|
1080
1178
|
}
|
|
1081
|
-
|
|
1179
|
+
p.current[m.current % yt] = Math.sqrt(n / t.length), m.current++;
|
|
1082
1180
|
}
|
|
1083
1181
|
}
|
|
1084
|
-
|
|
1182
|
+
b(e), n = requestAnimationFrame(r);
|
|
1085
1183
|
};
|
|
1086
1184
|
return n = requestAnimationFrame(r), () => {
|
|
1087
1185
|
cancelAnimationFrame(n);
|
|
1088
1186
|
};
|
|
1089
1187
|
}, [
|
|
1090
|
-
|
|
1188
|
+
v,
|
|
1091
1189
|
t,
|
|
1092
|
-
|
|
1190
|
+
b
|
|
1093
1191
|
]), R(() => {
|
|
1094
|
-
let e =
|
|
1192
|
+
let e = f.current;
|
|
1095
1193
|
if (!e) return;
|
|
1096
1194
|
let t = new ResizeObserver(() => {
|
|
1097
|
-
|
|
1195
|
+
b(e);
|
|
1098
1196
|
});
|
|
1099
1197
|
return t.observe(e), () => t.disconnect();
|
|
1100
|
-
}, [
|
|
1101
|
-
let
|
|
1198
|
+
}, [b]);
|
|
1199
|
+
let x = /* @__PURE__ */ F("div", {
|
|
1102
1200
|
className: "flex flex-shrink-0 items-center justify-end gap-1",
|
|
1103
1201
|
children: [
|
|
1104
|
-
/* @__PURE__ */
|
|
1105
|
-
icon: /* @__PURE__ */
|
|
1106
|
-
size:
|
|
1202
|
+
/* @__PURE__ */ P(T, {
|
|
1203
|
+
icon: /* @__PURE__ */ P(xe, {
|
|
1204
|
+
size: g.LG,
|
|
1107
1205
|
"aria-hidden": !0,
|
|
1108
|
-
stroke:
|
|
1206
|
+
stroke: _
|
|
1109
1207
|
}),
|
|
1110
|
-
"aria-label":
|
|
1208
|
+
"aria-label": o,
|
|
1111
1209
|
className: "mobile:min-h-11 mobile:min-w-11",
|
|
1112
|
-
onClick:
|
|
1210
|
+
onClick: r
|
|
1113
1211
|
}),
|
|
1114
|
-
|
|
1115
|
-
icon: /* @__PURE__ */
|
|
1116
|
-
size:
|
|
1117
|
-
"aria-hidden": !0
|
|
1212
|
+
v && /* @__PURE__ */ P(O, {
|
|
1213
|
+
icon: /* @__PURE__ */ P(de, {
|
|
1214
|
+
size: g.LG,
|
|
1215
|
+
"aria-hidden": !0,
|
|
1216
|
+
stroke: _
|
|
1118
1217
|
}),
|
|
1119
|
-
onClick: () =>
|
|
1218
|
+
onClick: () => n?.(),
|
|
1120
1219
|
autoFocus: !0,
|
|
1121
|
-
"aria-label":
|
|
1220
|
+
"aria-label": a,
|
|
1122
1221
|
className: "mobile:min-h-11 mobile:min-w-11"
|
|
1123
1222
|
}),
|
|
1124
|
-
|
|
1223
|
+
y && /* @__PURE__ */ P("span", {
|
|
1125
1224
|
className: "flex size-[40px] flex-shrink-0 items-center justify-center mobile:min-h-11 mobile:min-w-11",
|
|
1126
|
-
children: /* @__PURE__ */
|
|
1225
|
+
children: /* @__PURE__ */ P(ie, {
|
|
1127
1226
|
size: 20,
|
|
1128
|
-
ariaLabel:
|
|
1227
|
+
ariaLabel: s
|
|
1129
1228
|
})
|
|
1130
1229
|
})
|
|
1131
1230
|
]
|
|
1132
1231
|
});
|
|
1133
|
-
return /* @__PURE__ */
|
|
1134
|
-
className:
|
|
1135
|
-
children:
|
|
1136
|
-
style:
|
|
1137
|
-
className: l("flex w-full min-w-0 flex-col justify-center gap-2", !
|
|
1138
|
-
children: [/* @__PURE__ */
|
|
1232
|
+
return /* @__PURE__ */ P("div", {
|
|
1233
|
+
className: u,
|
|
1234
|
+
children: /* @__PURE__ */ F("div", {
|
|
1235
|
+
style: c,
|
|
1236
|
+
className: l("flex w-full min-w-0 flex-col justify-center gap-2", !d && K.wrapper, !d && "min-h-[64px] max-w-[748px] rounded-xl border px-3 shadow-md"),
|
|
1237
|
+
children: [/* @__PURE__ */ F("div", {
|
|
1139
1238
|
className: "flex min-w-0 flex-1 items-center gap-3",
|
|
1140
|
-
children: [
|
|
1141
|
-
className: l(
|
|
1239
|
+
children: [v && /* @__PURE__ */ P("span", {
|
|
1240
|
+
className: l(gt.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
|
|
1142
1241
|
"aria-hidden": !0
|
|
1143
|
-
}), /* @__PURE__ */
|
|
1144
|
-
ref:
|
|
1242
|
+
}), /* @__PURE__ */ P("canvas", {
|
|
1243
|
+
ref: f,
|
|
1145
1244
|
height: 26,
|
|
1146
1245
|
"aria-hidden": !0,
|
|
1147
|
-
className: l(
|
|
1246
|
+
className: l(gt.waveformCanvas, "h-[26px] min-w-0 flex-1")
|
|
1148
1247
|
})]
|
|
1149
|
-
}), /* @__PURE__ */
|
|
1248
|
+
}), /* @__PURE__ */ F("div", {
|
|
1150
1249
|
className: "flex items-center justify-between gap-2",
|
|
1151
|
-
children: [
|
|
1250
|
+
children: [i ?? /* @__PURE__ */ P("span", { "aria-hidden": !0 }), x]
|
|
1152
1251
|
})]
|
|
1153
|
-
})
|
|
1154
|
-
role: "alert",
|
|
1155
|
-
children: /* @__PURE__ */ U(y, {
|
|
1156
|
-
text: n,
|
|
1157
|
-
className: "mt-1 px-1"
|
|
1158
|
-
})
|
|
1159
|
-
})]
|
|
1252
|
+
})
|
|
1160
1253
|
});
|
|
1161
|
-
},
|
|
1254
|
+
}, xt = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", sendTooltip: r }) => /* @__PURE__ */ P(O, {
|
|
1162
1255
|
"aria-label": n,
|
|
1163
1256
|
onClick: () => e?.(),
|
|
1164
1257
|
disabled: t,
|
|
1165
1258
|
tooltipProps: r ? { tooltip: r } : void 0,
|
|
1166
|
-
icon: /* @__PURE__ */
|
|
1167
|
-
size:
|
|
1259
|
+
icon: /* @__PURE__ */ P(ue, {
|
|
1260
|
+
size: g.LG,
|
|
1168
1261
|
className: "rtl:scale-x-[-1]",
|
|
1169
|
-
stroke:
|
|
1262
|
+
stroke: _
|
|
1170
1263
|
})
|
|
1171
|
-
}),
|
|
1172
|
-
icon: /* @__PURE__ */
|
|
1173
|
-
size:
|
|
1174
|
-
stroke:
|
|
1264
|
+
}), St = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ P(T, {
|
|
1265
|
+
icon: /* @__PURE__ */ P(_e, {
|
|
1266
|
+
size: g.LG,
|
|
1267
|
+
stroke: _
|
|
1175
1268
|
}),
|
|
1176
1269
|
onClick: () => e?.(),
|
|
1177
1270
|
"aria-label": t
|
|
1178
|
-
}),
|
|
1271
|
+
}), Ct = ({ size: e = 20 }) => /* @__PURE__ */ P(te, {
|
|
1179
1272
|
variant: ne.Circular,
|
|
1180
1273
|
width: e,
|
|
1181
1274
|
height: e,
|
|
1182
1275
|
active: !0
|
|
1183
|
-
}),
|
|
1276
|
+
}), wt = ({ loadingLabel: e }) => /* @__PURE__ */ F("span", {
|
|
1184
1277
|
className: "flex min-w-0 flex-1 items-center",
|
|
1185
|
-
children: [/* @__PURE__ */
|
|
1278
|
+
children: [/* @__PURE__ */ P(te, {
|
|
1186
1279
|
variant: ne.Text,
|
|
1187
1280
|
width: "100%",
|
|
1188
1281
|
height: 16,
|
|
1189
1282
|
active: !0
|
|
1190
|
-
}), e && /* @__PURE__ */
|
|
1283
|
+
}), e && /* @__PURE__ */ P("span", {
|
|
1191
1284
|
className: "sr-only",
|
|
1192
1285
|
children: e
|
|
1193
1286
|
})]
|
|
1194
|
-
}),
|
|
1287
|
+
}), Tt = ({ loadingLabel: e }) => /* @__PURE__ */ P("div", {
|
|
1195
1288
|
role: "status",
|
|
1196
1289
|
"aria-label": e,
|
|
1197
|
-
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */
|
|
1290
|
+
children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ F("div", {
|
|
1198
1291
|
className: "flex h-11 items-center gap-3 px-4",
|
|
1199
1292
|
"aria-hidden": "true",
|
|
1200
|
-
children: [/* @__PURE__ */
|
|
1293
|
+
children: [/* @__PURE__ */ P(Ct, {}), /* @__PURE__ */ P(wt, {})]
|
|
1201
1294
|
}, t))
|
|
1202
|
-
}),
|
|
1295
|
+
}), Et = (e) => e.displayName ?? e.id, Dt = (e, t) => {
|
|
1203
1296
|
let n = t.trim().toLowerCase();
|
|
1204
|
-
return n ? e.filter((e) =>
|
|
1205
|
-
},
|
|
1297
|
+
return n ? e.filter((e) => Et(e).toLowerCase().includes(n)) : e;
|
|
1298
|
+
}, Ot = (e, t, r, i = 18, a) => /* @__PURE__ */ P(n, {
|
|
1206
1299
|
src: e,
|
|
1207
1300
|
size: i,
|
|
1208
1301
|
labels: { tooltip: a },
|
|
1209
1302
|
initialsName: r
|
|
1210
|
-
}),
|
|
1211
|
-
|
|
1212
|
-
|
|
1303
|
+
}), kt = {
|
|
1304
|
+
searchHeader: "_searchHeader_1u7db_1",
|
|
1305
|
+
itemText: "_itemText_1u7db_13",
|
|
1306
|
+
itemHover: "_itemHover_1u7db_17",
|
|
1307
|
+
selectedItemBackground: "_selectedItemBackground_1u7db_22",
|
|
1308
|
+
selectedItemText: "_selectedItemText_1u7db_26",
|
|
1309
|
+
checkIcon: "_checkIcon_1u7db_30"
|
|
1310
|
+
}, At = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, styles: i }) => {
|
|
1311
|
+
let [a, o] = V(""), s = z(() => e?.find((e) => e.id === t), [e, t]), u = r?.loading !== void 0, d = !u && !s && !!t, f = z(() => u ? /* @__PURE__ */ P(Ct, { size: g.LG }) : Ot(s?.iconUrl, s?.type, s?.displayName ?? s?.id ?? "", g.LG, d ? r?.unavailableTooltip ?? "This deployment is no longer available" : void 0), [
|
|
1213
1312
|
u,
|
|
1214
|
-
|
|
1313
|
+
s,
|
|
1314
|
+
d,
|
|
1215
1315
|
r?.unavailableTooltip
|
|
1216
|
-
]),
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1316
|
+
]), p = s?.displayName ?? s?.id, m = s?.displayVersion, h = p ? `${r?.ariaLabel ?? "Select model"}: ${p}` : r?.ariaLabel ?? "Select model", _ = z(() => {
|
|
1317
|
+
if (u) return Array.from({ length: 7 }, (e, t) => ({
|
|
1318
|
+
key: `__loading-${t}`,
|
|
1319
|
+
icon: /* @__PURE__ */ P(Ct, {}),
|
|
1320
|
+
label: /* @__PURE__ */ P(wt, { loadingLabel: t === 0 ? r?.loading : void 0 }),
|
|
1321
|
+
disabled: !0
|
|
1322
|
+
}));
|
|
1323
|
+
if (!e || e.length === 0) {
|
|
1324
|
+
let e = r?.error ?? r?.empty;
|
|
1325
|
+
return e ? [{
|
|
1326
|
+
key: "__state",
|
|
1327
|
+
label: e,
|
|
1227
1328
|
disabled: !0
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
disabled: !0
|
|
1235
|
-
}] : [];
|
|
1236
|
-
}
|
|
1237
|
-
return yt(e, o).map((e) => ({
|
|
1329
|
+
}] : [];
|
|
1330
|
+
}
|
|
1331
|
+
let o = i?.colors;
|
|
1332
|
+
return Dt(e, a).map((e) => {
|
|
1333
|
+
let r = e.id === t;
|
|
1334
|
+
return {
|
|
1238
1335
|
key: e.id,
|
|
1239
|
-
label: /* @__PURE__ */
|
|
1240
|
-
text:
|
|
1241
|
-
query:
|
|
1336
|
+
label: /* @__PURE__ */ P(S, {
|
|
1337
|
+
text: Et(e),
|
|
1338
|
+
query: a,
|
|
1242
1339
|
maxLines: 1
|
|
1243
1340
|
}),
|
|
1244
|
-
icon:
|
|
1245
|
-
mark:
|
|
1246
|
-
checked:
|
|
1247
|
-
className: l(
|
|
1341
|
+
icon: Ot(e.iconUrl, e.type, e.displayName ?? e.id),
|
|
1342
|
+
mark: C.Check,
|
|
1343
|
+
checked: r,
|
|
1344
|
+
className: l(o?.itemText && kt.itemText, o?.itemHoverBackground && kt.itemHover, r && o?.selectedItemBackground && kt.selectedItemBackground, r && o?.selectedItemText && kt.selectedItemText, r && o?.checkIcon && kt.checkIcon, i?.itemClassName, r && i?.selectedItemClassName, H.modelMenuItem, r && H.modelMenuItemSelected),
|
|
1248
1345
|
onClick: () => n?.(e.id)
|
|
1249
|
-
}
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1346
|
+
};
|
|
1347
|
+
});
|
|
1348
|
+
}, [
|
|
1349
|
+
e,
|
|
1350
|
+
u,
|
|
1351
|
+
a,
|
|
1352
|
+
t,
|
|
1353
|
+
r,
|
|
1354
|
+
n,
|
|
1355
|
+
i?.itemClassName,
|
|
1356
|
+
i?.selectedItemClassName,
|
|
1357
|
+
i?.colors
|
|
1358
|
+
]), v = z(() => c({
|
|
1359
|
+
"--ms-item-text": i?.colors?.itemText,
|
|
1360
|
+
"--ms-item-hover-bg": i?.colors?.itemHoverBackground,
|
|
1361
|
+
"--ms-selected-item-bg": i?.colors?.selectedItemBackground,
|
|
1362
|
+
"--ms-selected-item-text": i?.colors?.selectedItemText,
|
|
1363
|
+
"--ms-check-icon": i?.colors?.checkIcon
|
|
1364
|
+
}), [i?.colors]);
|
|
1365
|
+
return {
|
|
1366
|
+
selectorIcon: f,
|
|
1367
|
+
selectorAriaLabel: h,
|
|
1368
|
+
selectedLabel: p,
|
|
1369
|
+
selectedVersion: m,
|
|
1370
|
+
menuItems: _,
|
|
1371
|
+
menuHeader: z(() => !u && e && e.length > 0 ? /* @__PURE__ */ P("div", {
|
|
1372
|
+
style: c({ "--ms-search-header-bg": i?.colors?.searchHeaderBackground }),
|
|
1373
|
+
className: l("sticky top-0 z-10 pb-1 pe-2 pt-2", kt.searchHeader, i?.searchHeaderClassName, H.modelMenuSearch),
|
|
1374
|
+
children: /* @__PURE__ */ P(j, {
|
|
1375
|
+
value: a,
|
|
1263
1376
|
placeholder: r?.searchPlaceholder ?? "Search",
|
|
1264
|
-
size:
|
|
1377
|
+
size: y.Small,
|
|
1265
1378
|
wrapperClassName: "border-0",
|
|
1266
|
-
onChange: (e) =>
|
|
1379
|
+
onChange: (e) => o(e ?? "")
|
|
1267
1380
|
})
|
|
1268
1381
|
}) : void 0, [
|
|
1269
1382
|
e,
|
|
1270
|
-
|
|
1271
|
-
|
|
1383
|
+
u,
|
|
1384
|
+
a,
|
|
1272
1385
|
r,
|
|
1273
|
-
i,
|
|
1274
|
-
|
|
1386
|
+
i?.searchHeaderClassName,
|
|
1387
|
+
i?.colors?.searchHeaderBackground
|
|
1275
1388
|
]),
|
|
1389
|
+
menuStyle: v,
|
|
1276
1390
|
onOpenChange: (e) => {
|
|
1277
|
-
e ||
|
|
1391
|
+
e || o("");
|
|
1278
1392
|
}
|
|
1279
1393
|
};
|
|
1280
|
-
},
|
|
1281
|
-
function
|
|
1394
|
+
}, jt = typeof window < "u" ? De : R;
|
|
1395
|
+
function Mt(e) {
|
|
1282
1396
|
if (e !== void 0) switch (typeof e) {
|
|
1283
1397
|
case "number": return e;
|
|
1284
1398
|
case "string":
|
|
@@ -1286,15 +1400,15 @@ function Ct(e) {
|
|
|
1286
1400
|
break;
|
|
1287
1401
|
}
|
|
1288
1402
|
}
|
|
1289
|
-
function
|
|
1403
|
+
function Nt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
|
|
1290
1404
|
let { styleHeight: s, styleWidth: c } = z(() => ({
|
|
1291
|
-
styleHeight:
|
|
1292
|
-
styleWidth:
|
|
1405
|
+
styleHeight: Mt(o?.height),
|
|
1406
|
+
styleWidth: Mt(o?.width)
|
|
1293
1407
|
}), [o?.height, o?.width]), [l, u] = V({
|
|
1294
1408
|
height: t,
|
|
1295
1409
|
width: n
|
|
1296
1410
|
}), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
|
|
1297
|
-
return
|
|
1411
|
+
return jt(() => {
|
|
1298
1412
|
if (i === null || d) return;
|
|
1299
1413
|
let t = new ResizeObserver((e) => {
|
|
1300
1414
|
for (let t of e) {
|
|
@@ -1323,26 +1437,26 @@ function wt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
|
|
|
1323
1437
|
c
|
|
1324
1438
|
]);
|
|
1325
1439
|
}
|
|
1326
|
-
function
|
|
1440
|
+
function Pt(e) {
|
|
1327
1441
|
let t = B(() => {
|
|
1328
1442
|
throw Error("Cannot call during render.");
|
|
1329
1443
|
});
|
|
1330
|
-
return
|
|
1444
|
+
return jt(() => {
|
|
1331
1445
|
t.current = e;
|
|
1332
1446
|
}, [e]), L((e) => t.current?.(e), [t]);
|
|
1333
1447
|
}
|
|
1334
|
-
var
|
|
1335
|
-
function
|
|
1336
|
-
if (
|
|
1448
|
+
var q = null;
|
|
1449
|
+
function Ft(e = !1) {
|
|
1450
|
+
if (q === null || e) {
|
|
1337
1451
|
let e = document.createElement("div"), t = e.style;
|
|
1338
1452
|
t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
|
|
1339
1453
|
let n = document.createElement("div"), r = n.style;
|
|
1340
|
-
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ?
|
|
1454
|
+
return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? q = "positive-descending" : (e.scrollLeft = 1, q = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), q;
|
|
1341
1455
|
}
|
|
1342
|
-
return
|
|
1456
|
+
return q;
|
|
1343
1457
|
}
|
|
1344
|
-
function
|
|
1345
|
-
if (t === "horizontal" && n) switch (
|
|
1458
|
+
function It({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
1459
|
+
if (t === "horizontal" && n) switch (Ft()) {
|
|
1346
1460
|
case "negative": return -r;
|
|
1347
1461
|
case "positive-descending":
|
|
1348
1462
|
if (e) {
|
|
@@ -1353,26 +1467,26 @@ function X({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
|
|
|
1353
1467
|
}
|
|
1354
1468
|
return r;
|
|
1355
1469
|
}
|
|
1356
|
-
function
|
|
1470
|
+
function J(e, t = "Assertion error") {
|
|
1357
1471
|
if (!e) throw console.error(t), Error(t);
|
|
1358
1472
|
}
|
|
1359
|
-
function
|
|
1473
|
+
function Lt(e, t) {
|
|
1360
1474
|
if (e === t) return !0;
|
|
1361
|
-
if (!!e != !!t || (
|
|
1475
|
+
if (!!e != !!t || (J(e !== void 0), J(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
|
|
1362
1476
|
for (let n in e) if (!Object.is(t[n], e[n])) return !1;
|
|
1363
1477
|
return !0;
|
|
1364
1478
|
}
|
|
1365
|
-
function
|
|
1479
|
+
function Y({ cachedBounds: e, itemCount: t, itemSize: n }) {
|
|
1366
1480
|
if (t === 0) return 0;
|
|
1367
1481
|
if (typeof n == "number") return t * n;
|
|
1368
1482
|
{
|
|
1369
1483
|
let n = e.get(e.size === 0 ? 0 : e.size - 1);
|
|
1370
|
-
return
|
|
1484
|
+
return J(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
|
|
1371
1485
|
}
|
|
1372
1486
|
}
|
|
1373
|
-
function
|
|
1487
|
+
function X({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
|
|
1374
1488
|
if (n < 0 || n >= r) throw RangeError(`Invalid index specified: ${n}`, { cause: `Index ${n} is not within the range of 0 - ${r - 1}` });
|
|
1375
|
-
let s =
|
|
1489
|
+
let s = Y({
|
|
1376
1490
|
cachedBounds: t,
|
|
1377
1491
|
itemCount: r,
|
|
1378
1492
|
itemSize: i
|
|
@@ -1384,7 +1498,7 @@ function kt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, co
|
|
|
1384
1498
|
default: return a >= u && a <= l ? a : a < u ? u : l;
|
|
1385
1499
|
}
|
|
1386
1500
|
}
|
|
1387
|
-
function
|
|
1501
|
+
function Z({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
|
|
1388
1502
|
let a = r - 1, o = 0, s = -1, c = 0, l = -1, u = 0;
|
|
1389
1503
|
for (; u < a;) {
|
|
1390
1504
|
let n = e.get(u);
|
|
@@ -1403,11 +1517,11 @@ function At({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemC
|
|
|
1403
1517
|
stopIndexOverscan: l
|
|
1404
1518
|
};
|
|
1405
1519
|
}
|
|
1406
|
-
function
|
|
1520
|
+
function Rt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1407
1521
|
let r = /* @__PURE__ */ new Map();
|
|
1408
1522
|
return {
|
|
1409
1523
|
get(i) {
|
|
1410
|
-
for (
|
|
1524
|
+
for (J(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
|
|
1411
1525
|
let e = r.size, a;
|
|
1412
1526
|
switch (typeof n) {
|
|
1413
1527
|
case "function":
|
|
@@ -1423,14 +1537,14 @@ function jt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1423
1537
|
});
|
|
1424
1538
|
else {
|
|
1425
1539
|
let t = r.get(e - 1);
|
|
1426
|
-
|
|
1540
|
+
J(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
|
|
1427
1541
|
scrollOffset: t.scrollOffset + t.size,
|
|
1428
1542
|
size: a
|
|
1429
1543
|
});
|
|
1430
1544
|
}
|
|
1431
1545
|
}
|
|
1432
1546
|
let a = r.get(i);
|
|
1433
|
-
return
|
|
1547
|
+
return J(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
|
|
1434
1548
|
},
|
|
1435
1549
|
set(e, t) {
|
|
1436
1550
|
r.set(e, t);
|
|
@@ -1440,8 +1554,8 @@ function jt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1440
1554
|
}
|
|
1441
1555
|
};
|
|
1442
1556
|
}
|
|
1443
|
-
function
|
|
1444
|
-
return z(() =>
|
|
1557
|
+
function zt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
1558
|
+
return z(() => Rt({
|
|
1445
1559
|
itemCount: e,
|
|
1446
1560
|
itemProps: t,
|
|
1447
1561
|
itemSize: n
|
|
@@ -1451,11 +1565,11 @@ function Mt({ itemCount: e, itemProps: t, itemSize: n }) {
|
|
|
1451
1565
|
n
|
|
1452
1566
|
]);
|
|
1453
1567
|
}
|
|
1454
|
-
function
|
|
1568
|
+
function Bt({ containerSize: e, itemSize: t }) {
|
|
1455
1569
|
let n;
|
|
1456
1570
|
switch (typeof t) {
|
|
1457
1571
|
case "string":
|
|
1458
|
-
|
|
1572
|
+
J(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), J(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseInt(t) / 100;
|
|
1459
1573
|
break;
|
|
1460
1574
|
default:
|
|
1461
1575
|
n = t;
|
|
@@ -1463,8 +1577,8 @@ function Nt({ containerSize: e, itemSize: t }) {
|
|
|
1463
1577
|
}
|
|
1464
1578
|
return n;
|
|
1465
1579
|
}
|
|
1466
|
-
function
|
|
1467
|
-
let { height: u = n, width: d = n } =
|
|
1580
|
+
function Q({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
|
|
1581
|
+
let { height: u = n, width: d = n } = Nt({
|
|
1468
1582
|
defaultHeight: r === "vertical" ? n : void 0,
|
|
1469
1583
|
defaultWidth: r === "horizontal" ? n : void 0,
|
|
1470
1584
|
element: e,
|
|
@@ -1473,11 +1587,11 @@ function Pt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1473
1587
|
}), f = B({
|
|
1474
1588
|
height: 0,
|
|
1475
1589
|
width: 0
|
|
1476
|
-
}), p = r === "vertical" ? u : d, m =
|
|
1590
|
+
}), p = r === "vertical" ? u : d, m = Bt({
|
|
1477
1591
|
containerSize: p,
|
|
1478
1592
|
itemSize: s
|
|
1479
1593
|
});
|
|
1480
|
-
|
|
1594
|
+
De(() => {
|
|
1481
1595
|
if (typeof c == "function") {
|
|
1482
1596
|
let e = f.current;
|
|
1483
1597
|
(e.height !== u || e.width !== d) && (c({
|
|
@@ -1490,11 +1604,11 @@ function Pt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1490
1604
|
c,
|
|
1491
1605
|
d
|
|
1492
1606
|
]);
|
|
1493
|
-
let h =
|
|
1607
|
+
let h = zt({
|
|
1494
1608
|
itemCount: a,
|
|
1495
1609
|
itemProps: o,
|
|
1496
1610
|
itemSize: m
|
|
1497
|
-
}), g = L((e) => h.get(e), [h]), [_, v] = V(() =>
|
|
1611
|
+
}), g = L((e) => h.get(e), [h]), [_, v] = V(() => Z({
|
|
1498
1612
|
cachedBounds: h,
|
|
1499
1613
|
containerScrollOffset: 0,
|
|
1500
1614
|
containerSize: p,
|
|
@@ -1505,7 +1619,7 @@ function Pt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1505
1619
|
startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
|
|
1506
1620
|
stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
|
|
1507
1621
|
stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
|
|
1508
|
-
}, C = L(() =>
|
|
1622
|
+
}, C = L(() => Y({
|
|
1509
1623
|
cachedBounds: h,
|
|
1510
1624
|
itemCount: a,
|
|
1511
1625
|
itemSize: m
|
|
@@ -1513,9 +1627,9 @@ function Pt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1513
1627
|
h,
|
|
1514
1628
|
a,
|
|
1515
1629
|
m
|
|
1516
|
-
]), w = L((t) =>
|
|
1630
|
+
]), w = L((t) => Z({
|
|
1517
1631
|
cachedBounds: h,
|
|
1518
|
-
containerScrollOffset:
|
|
1632
|
+
containerScrollOffset: It({
|
|
1519
1633
|
containerElement: e,
|
|
1520
1634
|
direction: r,
|
|
1521
1635
|
isRtl: i,
|
|
@@ -1533,19 +1647,19 @@ function Pt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1533
1647
|
a,
|
|
1534
1648
|
l
|
|
1535
1649
|
]);
|
|
1536
|
-
return
|
|
1650
|
+
return jt(() => {
|
|
1537
1651
|
v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
|
|
1538
1652
|
}, [
|
|
1539
1653
|
e,
|
|
1540
1654
|
r,
|
|
1541
1655
|
w
|
|
1542
|
-
]),
|
|
1656
|
+
]), jt(() => {
|
|
1543
1657
|
if (!e) return;
|
|
1544
1658
|
let t = () => {
|
|
1545
1659
|
v((t) => {
|
|
1546
|
-
let { scrollLeft: n, scrollTop: o } = e, s =
|
|
1660
|
+
let { scrollLeft: n, scrollTop: o } = e, s = Z({
|
|
1547
1661
|
cachedBounds: h,
|
|
1548
|
-
containerScrollOffset:
|
|
1662
|
+
containerScrollOffset: It({
|
|
1549
1663
|
containerElement: e,
|
|
1550
1664
|
direction: r,
|
|
1551
1665
|
isRtl: i,
|
|
@@ -1555,7 +1669,7 @@ function Pt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1555
1669
|
itemCount: a,
|
|
1556
1670
|
overscanCount: l
|
|
1557
1671
|
});
|
|
1558
|
-
return
|
|
1672
|
+
return Lt(s, t) ? t : s;
|
|
1559
1673
|
});
|
|
1560
1674
|
};
|
|
1561
1675
|
return e.addEventListener("scroll", t), () => {
|
|
@@ -1571,8 +1685,8 @@ function Pt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1571
1685
|
]), {
|
|
1572
1686
|
getCellBounds: g,
|
|
1573
1687
|
getEstimatedSize: C,
|
|
1574
|
-
scrollToIndex:
|
|
1575
|
-
let s =
|
|
1688
|
+
scrollToIndex: Pt(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
|
|
1689
|
+
let s = X({
|
|
1576
1690
|
align: t,
|
|
1577
1691
|
cachedBounds: h,
|
|
1578
1692
|
containerScrollOffset: n,
|
|
@@ -1582,14 +1696,14 @@ function Pt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1582
1696
|
itemSize: m
|
|
1583
1697
|
});
|
|
1584
1698
|
if (e) {
|
|
1585
|
-
if (s =
|
|
1699
|
+
if (s = It({
|
|
1586
1700
|
containerElement: e,
|
|
1587
1701
|
direction: r,
|
|
1588
1702
|
isRtl: i,
|
|
1589
1703
|
scrollOffset: s
|
|
1590
1704
|
}), typeof e.scrollTo != "function") {
|
|
1591
1705
|
let e = w(s);
|
|
1592
|
-
|
|
1706
|
+
Lt(_, e) || v(e);
|
|
1593
1707
|
}
|
|
1594
1708
|
return s;
|
|
1595
1709
|
}
|
|
@@ -1600,19 +1714,19 @@ function Pt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
|
|
|
1600
1714
|
stopIndexVisible: x
|
|
1601
1715
|
};
|
|
1602
1716
|
}
|
|
1603
|
-
function
|
|
1717
|
+
function Vt(e) {
|
|
1604
1718
|
return z(() => e, Object.values(e));
|
|
1605
1719
|
}
|
|
1606
|
-
function
|
|
1720
|
+
function Ht(e, t) {
|
|
1607
1721
|
let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
|
|
1608
|
-
return
|
|
1722
|
+
return Lt(n, a) && Lt(r, o) && Lt(i, s);
|
|
1609
1723
|
}
|
|
1610
|
-
function
|
|
1724
|
+
function Ut(e) {
|
|
1611
1725
|
return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
|
|
1612
1726
|
}
|
|
1613
|
-
var
|
|
1614
|
-
function
|
|
1615
|
-
let m =
|
|
1727
|
+
var Wt = "data-react-window-index";
|
|
1728
|
+
function Gt({ 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 }) {
|
|
1729
|
+
let m = Vt(u), h = z(() => we(s, Ht), [s]), [g, _] = V(null), v = Ut(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = Q({
|
|
1616
1730
|
containerElement: g,
|
|
1617
1731
|
containerStyle: f,
|
|
1618
1732
|
defaultContainerSize: n,
|
|
@@ -1623,7 +1737,7 @@ function zt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1623
1737
|
onResize: i,
|
|
1624
1738
|
overscanCount: o
|
|
1625
1739
|
});
|
|
1626
|
-
|
|
1740
|
+
Ee(r, () => ({
|
|
1627
1741
|
get element() {
|
|
1628
1742
|
return g;
|
|
1629
1743
|
},
|
|
@@ -1638,12 +1752,12 @@ function zt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1638
1752
|
top: r
|
|
1639
1753
|
});
|
|
1640
1754
|
}
|
|
1641
|
-
}), [g, x]),
|
|
1755
|
+
}), [g, x]), jt(() => {
|
|
1642
1756
|
if (!g) return;
|
|
1643
1757
|
let e = Array.from(g.children).filter((e, t) => {
|
|
1644
1758
|
if (e.hasAttribute("aria-hidden")) return !1;
|
|
1645
1759
|
let n = `${S + t}`;
|
|
1646
|
-
return e.setAttribute(
|
|
1760
|
+
return e.setAttribute(Wt, n), !0;
|
|
1647
1761
|
});
|
|
1648
1762
|
if (v) return l.observeRowElements(e);
|
|
1649
1763
|
}, [
|
|
@@ -1667,11 +1781,11 @@ function zt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1667
1781
|
w,
|
|
1668
1782
|
T
|
|
1669
1783
|
]);
|
|
1670
|
-
let
|
|
1784
|
+
let E = z(() => {
|
|
1671
1785
|
let e = [];
|
|
1672
1786
|
if (c > 0) for (let t = S; t <= w; t++) {
|
|
1673
1787
|
let n = y(t);
|
|
1674
|
-
e.push(/* @__PURE__ */
|
|
1788
|
+
e.push(/* @__PURE__ */ Se(h, {
|
|
1675
1789
|
...m,
|
|
1676
1790
|
ariaAttributes: {
|
|
1677
1791
|
"aria-posinset": t + 1,
|
|
@@ -1698,7 +1812,7 @@ function zt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1698
1812
|
m,
|
|
1699
1813
|
S,
|
|
1700
1814
|
w
|
|
1701
|
-
]),
|
|
1815
|
+
]), D = /* @__PURE__ */ P("div", {
|
|
1702
1816
|
"aria-hidden": !0,
|
|
1703
1817
|
style: {
|
|
1704
1818
|
height: b(),
|
|
@@ -1706,7 +1820,7 @@ function zt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1706
1820
|
zIndex: -1
|
|
1707
1821
|
}
|
|
1708
1822
|
});
|
|
1709
|
-
return
|
|
1823
|
+
return Se(d, {
|
|
1710
1824
|
role: "list",
|
|
1711
1825
|
...p,
|
|
1712
1826
|
className: t,
|
|
@@ -1718,721 +1832,870 @@ function zt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
|
|
|
1718
1832
|
overflowY: "auto",
|
|
1719
1833
|
...f
|
|
1720
1834
|
}
|
|
1721
|
-
},
|
|
1835
|
+
}, E, e, D);
|
|
1722
1836
|
}
|
|
1723
|
-
var
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1837
|
+
var Kt = {
|
|
1838
|
+
search: "_search_5skzl_1",
|
|
1839
|
+
divider: "_divider_5skzl_5",
|
|
1840
|
+
item: "_item_5skzl_9",
|
|
1841
|
+
itemIcon: "_itemIcon_5skzl_19",
|
|
1842
|
+
checkIcon: "_checkIcon_5skzl_23",
|
|
1843
|
+
stateLabel: "_stateLabel_5skzl_27",
|
|
1844
|
+
itemSelectedBackground: "_itemSelectedBackground_5skzl_37",
|
|
1845
|
+
itemSelectedText: "_itemSelectedText_5skzl_41"
|
|
1846
|
+
}, qt = 44, Jt = 8, Yt = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: o, itemClassName: s, selectedItemClassName: c, hasSelectedBackground: u, hasSelectedText: d, onSelect: f }) => {
|
|
1847
|
+
let p = r[e], h = Ot(p.iconUrl, p.type, p.displayName ?? p.id, g.SM), v = p.id === i;
|
|
1848
|
+
return /* @__PURE__ */ P("div", {
|
|
1732
1849
|
style: t,
|
|
1733
1850
|
...n,
|
|
1734
|
-
children: /* @__PURE__ */
|
|
1851
|
+
children: /* @__PURE__ */ P(m, {
|
|
1735
1852
|
type: "button",
|
|
1736
|
-
"aria-current":
|
|
1737
|
-
className: l(
|
|
1738
|
-
iconBefore: /* @__PURE__ */
|
|
1739
|
-
className:
|
|
1740
|
-
children:
|
|
1853
|
+
"aria-current": v ? "true" : void 0,
|
|
1854
|
+
className: l(Kt.item, "h-full w-full gap-3 px-4", v && u && Kt.itemSelectedBackground, v && d && Kt.itemSelectedText, s, v && c, H.modelMenuItem, v && H.modelMenuItemSelected),
|
|
1855
|
+
iconBefore: /* @__PURE__ */ P("span", {
|
|
1856
|
+
className: Kt.itemIcon,
|
|
1857
|
+
children: h
|
|
1741
1858
|
}),
|
|
1742
|
-
label: /* @__PURE__ */
|
|
1859
|
+
label: /* @__PURE__ */ F("span", {
|
|
1743
1860
|
className: "flex flex-1 items-center justify-between gap-2",
|
|
1744
|
-
children: [/* @__PURE__ */
|
|
1745
|
-
text:
|
|
1861
|
+
children: [/* @__PURE__ */ P(S, {
|
|
1862
|
+
text: p.displayName ?? p.id,
|
|
1746
1863
|
query: o,
|
|
1747
1864
|
maxLines: 1,
|
|
1748
1865
|
className: l(a, "min-w-0 flex-1 text-start")
|
|
1749
|
-
}),
|
|
1750
|
-
size:
|
|
1751
|
-
className:
|
|
1866
|
+
}), v && /* @__PURE__ */ P(de, {
|
|
1867
|
+
size: g.SM,
|
|
1868
|
+
className: Kt.checkIcon,
|
|
1752
1869
|
"aria-hidden": !0,
|
|
1753
|
-
stroke:
|
|
1870
|
+
stroke: _
|
|
1754
1871
|
})]
|
|
1755
1872
|
}),
|
|
1756
|
-
onClick: () =>
|
|
1873
|
+
onClick: () => f(p.id)
|
|
1757
1874
|
})
|
|
1758
1875
|
});
|
|
1759
|
-
},
|
|
1760
|
-
let [
|
|
1876
|
+
}, Xt = ({ isOpen: e, title: t, closeLabel: n, searchPlaceholder: r = "Search", onClose: i, deployments: a, selectedDeploymentId: o, onSelect: s, loadingLabel: u, errorLabel: d, emptyLabel: f, style: p, titleClassName: m = "dial-body-semi-text", labelClassName: h = "dial-small-text", colors: g, menuStyles: _ }) => {
|
|
1877
|
+
let [v, b] = V("");
|
|
1761
1878
|
R(() => {
|
|
1762
|
-
e ||
|
|
1879
|
+
e || b("");
|
|
1763
1880
|
}, [e]);
|
|
1764
|
-
let
|
|
1881
|
+
let x = a && a.length > 0, S = u !== void 0, C = !x && !S ? d ?? f : void 0, w = x ? Dt(a, v) : [], T = (e) => {
|
|
1765
1882
|
s(e), i();
|
|
1766
|
-
},
|
|
1883
|
+
}, E = _?.colors, D = c({
|
|
1767
1884
|
"--ci-sheet-divider": g?.divider,
|
|
1768
|
-
"--ci-sheet-text": g?.itemText,
|
|
1769
|
-
"--ci-sheet-item-hover": g?.itemHoverBg,
|
|
1885
|
+
"--ci-sheet-text": E?.itemText ?? g?.itemText,
|
|
1886
|
+
"--ci-sheet-item-hover": E?.itemHoverBackground ?? g?.itemHoverBg,
|
|
1770
1887
|
"--ci-sheet-item-active": g?.itemActiveBg,
|
|
1771
|
-
"--ci-sheet-icon": g?.itemIcon,
|
|
1772
|
-
"--ci-check-icon": g?.checkIcon
|
|
1888
|
+
"--ci-sheet-icon": E?.itemText ?? g?.itemIcon,
|
|
1889
|
+
"--ci-check-icon": E?.checkIcon ?? g?.checkIcon,
|
|
1890
|
+
"--ci-sheet-selected-bg": E?.selectedItemBackground,
|
|
1891
|
+
"--ci-sheet-selected-text": E?.selectedItemText
|
|
1773
1892
|
});
|
|
1774
|
-
return /* @__PURE__ */ U
|
|
1893
|
+
return /* @__PURE__ */ P(U, {
|
|
1775
1894
|
isOpen: e,
|
|
1776
1895
|
title: t,
|
|
1777
1896
|
closeLabel: n,
|
|
1778
1897
|
onClose: i,
|
|
1779
1898
|
style: p,
|
|
1780
1899
|
titleClassName: m,
|
|
1781
|
-
className: l("max-h-[80dvh]",
|
|
1900
|
+
className: l("max-h-[80dvh]", _?.className, H.modelMenu),
|
|
1782
1901
|
colors: g?.shell,
|
|
1783
|
-
children: /* @__PURE__ */
|
|
1902
|
+
children: /* @__PURE__ */ F("div", {
|
|
1784
1903
|
className: "contents",
|
|
1785
|
-
style:
|
|
1786
|
-
children: [
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1904
|
+
style: D,
|
|
1905
|
+
children: [x && !S && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P("div", {
|
|
1906
|
+
style: c({ "--ci-sheet-search-bg": _?.colors?.searchHeaderBackground }),
|
|
1907
|
+
className: l("flex-shrink-0 px-4 py-[10px]", Kt.search, _?.searchHeaderClassName, H.modelMenuSearch),
|
|
1908
|
+
children: /* @__PURE__ */ P(j, {
|
|
1909
|
+
value: v,
|
|
1790
1910
|
placeholder: r,
|
|
1791
|
-
size:
|
|
1792
|
-
onChange: (e) =>
|
|
1911
|
+
size: y.Standard,
|
|
1912
|
+
onChange: (e) => b(e ?? "")
|
|
1793
1913
|
})
|
|
1794
|
-
}), /* @__PURE__ */
|
|
1914
|
+
}), /* @__PURE__ */ P("div", { className: l(Kt.divider, "h-px flex-shrink-0") })] }), S ? /* @__PURE__ */ P(Tt, { loadingLabel: u }) : C ? /* @__PURE__ */ P("div", {
|
|
1795
1915
|
role: "list",
|
|
1796
|
-
className: l(
|
|
1797
|
-
children:
|
|
1798
|
-
}) : /* @__PURE__ */
|
|
1916
|
+
className: l(Kt.stateLabel, h, "px-4 py-4"),
|
|
1917
|
+
children: C
|
|
1918
|
+
}) : /* @__PURE__ */ P(Gt, {
|
|
1799
1919
|
role: "list",
|
|
1800
1920
|
className: "overflow-y-auto",
|
|
1801
|
-
style: { height: Math.min(
|
|
1802
|
-
rowComponent:
|
|
1803
|
-
rowCount:
|
|
1804
|
-
rowHeight:
|
|
1921
|
+
style: { height: Math.min(w.length, Jt) * qt },
|
|
1922
|
+
rowComponent: Yt,
|
|
1923
|
+
rowCount: w.length,
|
|
1924
|
+
rowHeight: qt,
|
|
1805
1925
|
rowProps: {
|
|
1806
|
-
items:
|
|
1926
|
+
items: w,
|
|
1807
1927
|
selectedDeploymentId: o,
|
|
1808
1928
|
labelClassName: h,
|
|
1809
|
-
query:
|
|
1810
|
-
|
|
1929
|
+
query: v,
|
|
1930
|
+
itemClassName: _?.itemClassName,
|
|
1931
|
+
selectedItemClassName: _?.selectedItemClassName,
|
|
1932
|
+
hasSelectedBackground: !!E?.selectedItemBackground,
|
|
1933
|
+
hasSelectedText: !!E?.selectedItemText,
|
|
1934
|
+
onSelect: T
|
|
1811
1935
|
}
|
|
1812
1936
|
})]
|
|
1813
1937
|
})
|
|
1814
1938
|
});
|
|
1815
|
-
},
|
|
1816
|
-
let [
|
|
1939
|
+
}, Zt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, menuStyles: i, isStreaming: a, isMobile: o, isDisabled: c = !1, style: u, modelPickerOverlay: d, isPickerOpen: f, onPickerToggle: p, onPickerOpenChange: h }) => {
|
|
1940
|
+
let [y, b] = V(!1), { selectorIcon: S, selectorAriaLabel: C, selectedLabel: w, selectedVersion: T, menuItems: E, menuHeader: D, menuStyle: ee, onOpenChange: O } = At({
|
|
1817
1941
|
deployments: e,
|
|
1818
1942
|
selectedDeploymentId: t,
|
|
1819
1943
|
onDeploymentChange: n,
|
|
1820
|
-
modelSelectorLabels: r
|
|
1944
|
+
modelSelectorLabels: r,
|
|
1945
|
+
styles: i
|
|
1821
1946
|
});
|
|
1822
1947
|
if (!e) return null;
|
|
1823
|
-
let
|
|
1824
|
-
size:
|
|
1825
|
-
className: l(
|
|
1948
|
+
let k = a || c, A = k ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, j = /* @__PURE__ */ P(fe, {
|
|
1949
|
+
size: g.SM,
|
|
1950
|
+
className: l(K.modelSelectorCaret, H.modelSelectorCaret),
|
|
1826
1951
|
"aria-hidden": !0,
|
|
1827
|
-
stroke:
|
|
1828
|
-
}),
|
|
1829
|
-
className: l("flex shrink-0 items-center",
|
|
1830
|
-
children:
|
|
1952
|
+
stroke: _
|
|
1953
|
+
}), te = /* @__PURE__ */ P("span", {
|
|
1954
|
+
className: l("flex shrink-0 items-center", H.modelSelectorIcon),
|
|
1955
|
+
children: S
|
|
1831
1956
|
});
|
|
1832
|
-
if (
|
|
1833
|
-
tooltip:
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
isOpen: m,
|
|
1957
|
+
if (o) return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(x, {
|
|
1958
|
+
tooltipProps: { tooltip: w },
|
|
1959
|
+
icon: /* @__PURE__ */ F("div", {
|
|
1960
|
+
className: "flex items-center gap-1",
|
|
1961
|
+
children: [te, j]
|
|
1962
|
+
}),
|
|
1963
|
+
"aria-label": C,
|
|
1964
|
+
"aria-disabled": k || void 0,
|
|
1965
|
+
onClick: () => {
|
|
1966
|
+
k || b(!0);
|
|
1967
|
+
},
|
|
1968
|
+
className: l("w-[50px]", K.modelSelectorButton, A, H.modelSelectorButton)
|
|
1969
|
+
}), d ? /* @__PURE__ */ P(U, {
|
|
1970
|
+
isOpen: y,
|
|
1847
1971
|
title: r?.ariaLabel ?? "Select model",
|
|
1848
1972
|
closeLabel: r?.closeLabel ?? "Close",
|
|
1849
|
-
onClose: () =>
|
|
1850
|
-
style:
|
|
1851
|
-
className:
|
|
1852
|
-
children:
|
|
1853
|
-
}) : /* @__PURE__ */
|
|
1854
|
-
isOpen:
|
|
1973
|
+
onClose: () => b(!1),
|
|
1974
|
+
style: u,
|
|
1975
|
+
className: l(i?.className, H.modelMenu),
|
|
1976
|
+
children: d(() => b(!1))
|
|
1977
|
+
}) : /* @__PURE__ */ P(Xt, {
|
|
1978
|
+
isOpen: y,
|
|
1855
1979
|
title: r?.ariaLabel ?? "Select model",
|
|
1856
1980
|
closeLabel: r?.closeLabel ?? "Close",
|
|
1857
1981
|
searchPlaceholder: r?.searchPlaceholder ?? "Search",
|
|
1858
|
-
onClose: () =>
|
|
1982
|
+
onClose: () => b(!1),
|
|
1859
1983
|
deployments: e,
|
|
1860
1984
|
selectedDeploymentId: t,
|
|
1861
1985
|
onSelect: (e) => n?.(e),
|
|
1862
1986
|
loadingLabel: r?.loading,
|
|
1863
1987
|
errorLabel: r?.error,
|
|
1864
1988
|
emptyLabel: r?.empty,
|
|
1865
|
-
style:
|
|
1989
|
+
style: u,
|
|
1990
|
+
menuStyles: i
|
|
1866
1991
|
})] });
|
|
1867
|
-
if (
|
|
1868
|
-
let e =
|
|
1869
|
-
return /* @__PURE__ */
|
|
1992
|
+
if (d) {
|
|
1993
|
+
let e = T ? `${w} · ${T}` : w;
|
|
1994
|
+
return /* @__PURE__ */ P(v, {
|
|
1870
1995
|
placement: "top-end",
|
|
1871
1996
|
matchReferenceWidth: !1,
|
|
1872
|
-
open:
|
|
1873
|
-
onOpenChange:
|
|
1997
|
+
open: f,
|
|
1998
|
+
onOpenChange: h,
|
|
1874
1999
|
trigger: [],
|
|
1875
2000
|
outsideClosable: !0,
|
|
1876
|
-
renderOverlay: () =>
|
|
1877
|
-
listClassName: l("!w-[368px] !bg-layer-raised",
|
|
1878
|
-
children: /* @__PURE__ */
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
})]
|
|
1899
|
-
}),
|
|
1900
|
-
D
|
|
1901
|
-
]
|
|
2001
|
+
renderOverlay: () => d(() => h?.(!1)),
|
|
2002
|
+
listClassName: l("!w-[368px] !bg-layer-raised", i?.className, H.modelMenu),
|
|
2003
|
+
children: /* @__PURE__ */ P(m, {
|
|
2004
|
+
"aria-label": C,
|
|
2005
|
+
"aria-disabled": k || void 0,
|
|
2006
|
+
tooltipProps: { tooltip: e },
|
|
2007
|
+
className: l("h-auto min-w-0 gap-1.5 !rounded-full !border-0 px-0 py-1.5 pe-2 ps-1.5", K.modelSelectorButton, A, k && K.modelSelectorButtonDisabled, H.modelSelectorButton),
|
|
2008
|
+
onClick: () => {
|
|
2009
|
+
k || p?.();
|
|
2010
|
+
},
|
|
2011
|
+
iconBefore: te,
|
|
2012
|
+
iconAfter: j,
|
|
2013
|
+
textClassName: "min-w-0",
|
|
2014
|
+
label: /* @__PURE__ */ F("span", {
|
|
2015
|
+
className: "flex min-w-0 max-w-[180px] items-baseline gap-1",
|
|
2016
|
+
children: [/* @__PURE__ */ P("span", {
|
|
2017
|
+
className: l("dial-small-text max-w-[180px] shrink-0 truncate", K.modelSelectorName),
|
|
2018
|
+
children: w
|
|
2019
|
+
}), T && /* @__PURE__ */ P("span", {
|
|
2020
|
+
className: l("dial-tiny-text min-w-0 truncate", K.modelSelectorVersion),
|
|
2021
|
+
children: T
|
|
2022
|
+
})]
|
|
1902
2023
|
})
|
|
1903
2024
|
})
|
|
1904
2025
|
});
|
|
1905
2026
|
}
|
|
1906
|
-
return /* @__PURE__ */
|
|
1907
|
-
className: l(
|
|
1908
|
-
"aria-disabled":
|
|
1909
|
-
children: /* @__PURE__ */
|
|
1910
|
-
items:
|
|
1911
|
-
menuHeader:
|
|
2027
|
+
return /* @__PURE__ */ P("div", {
|
|
2028
|
+
className: l(A),
|
|
2029
|
+
"aria-disabled": k || void 0,
|
|
2030
|
+
children: /* @__PURE__ */ P(v, {
|
|
2031
|
+
items: E,
|
|
2032
|
+
menuHeader: D,
|
|
1912
2033
|
placement: "bottom-end",
|
|
1913
2034
|
matchReferenceWidth: !1,
|
|
1914
2035
|
maxDropdownHeight: s,
|
|
1915
|
-
listClassName: l("!w-[240px]",
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
})
|
|
2036
|
+
listClassName: l("!w-[240px]", i?.className, H.modelMenu),
|
|
2037
|
+
listStyle: ee,
|
|
2038
|
+
disabled: k,
|
|
2039
|
+
onOpenChange: k ? void 0 : O,
|
|
2040
|
+
children: /* @__PURE__ */ P(m, {
|
|
2041
|
+
"aria-label": C,
|
|
2042
|
+
"aria-disabled": k || void 0,
|
|
2043
|
+
tooltipProps: { tooltip: w },
|
|
2044
|
+
iconBefore: te,
|
|
2045
|
+
iconAfter: j,
|
|
2046
|
+
className: l("h-auto gap-1 !rounded-full !border-0 p-1.5", K.modelSelectorButton, k && K.modelSelectorButtonDisabled, H.modelSelectorButton)
|
|
1927
2047
|
})
|
|
1928
2048
|
})
|
|
1929
2049
|
});
|
|
1930
|
-
},
|
|
1931
|
-
let
|
|
1932
|
-
"--ci-bg":
|
|
1933
|
-
"--ci-text":
|
|
1934
|
-
"--ci-border":
|
|
1935
|
-
"--ci-border-focus":
|
|
1936
|
-
"--ci-placeholder":
|
|
1937
|
-
"--ci-text-disabled":
|
|
1938
|
-
"--ci-model-selector-caret-color":
|
|
1939
|
-
"--ci-model-selector-hover-bg":
|
|
1940
|
-
"--ci-model-selector-disabled-color":
|
|
1941
|
-
"--ci-model-selector-name-color":
|
|
1942
|
-
"--ci-model-selector-version-color":
|
|
1943
|
-
"--ci-voice-
|
|
1944
|
-
"--ci-voice-
|
|
1945
|
-
"--ci-
|
|
1946
|
-
"--ci-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
wt
|
|
1951
|
-
]), Dt = z(() => nt ? [{
|
|
2050
|
+
}, Qt = Ce(({ message: e = "", messageRevision: t, focusRequestId: n, textInsertion: r, onSend: i, onUploadAttachment: a, onStop: o, isStreaming: s = !1, onChange: u, onAttachmentsChange: p, placeholder: m = "Type a message...", ariaLabel: h, attachLabel: y = "Attach file", fileAccept: S, addMenuTitle: C = "Add", menuTitle: w = "Menu", menuCloseLabel: T = "Close", removeLabel: E, retryLabel: D, uploadingLabel: ee, expandLabel: O, clickLabel: k, sendLabel: A, sendTooltip: j, emptyMessageTooltip: te, stopLabel: ne, micLabel: re = "Dictate", recordVoiceLabel: ie = "Record voice", stopRecordingLabel: ae, discardRecordingLabel: oe, colors: M, typography: I, attachmentTray: ce, modelMenu: ue, className: de, pendingDropFiles: fe = [], onDropFilesConsumed: pe, pendingAttachments: ge = [], onPendingAttachmentsConsumed: _e, pasteTextThreshold: ve = 4e3, maxMessageLength: ye = 5e4, deployments: be, selectedDeploymentId: xe, onDeploymentChange: Se, modelSelectorLabels: Ce, initialAttachments: we = [], hideAddButton: Te = !1, hideAttachFile: Oe = !1, hideActionBar: U = !1, actionRowLayout: ke = tt.Stacked, isInlineActionRowAllowedBelowDesktop: je = !1, renderFooterActions: Me, isInputDisabled: W = !1, isModelSelectorDisabled: Ne = !1, isSendDisabled: Ie = !1, isAudioMessageSupported: Le = !1, isVoiceRecordingSupported: Be = Le, onTranscribeAudio: Ve, transcribingLabel: Ge, voiceErrorLabel: Ye, sendOnEnter: Xe = et.Enter, prefixAttachments: Ze = [], onRemovePrefixAttachment: Qe, chatSettings: nt, toolsMenuItems: rt, onToolToggle: it, canRemoveTools: at = !0, toolsMenuTitle: ot, toolsBackLabel: st, toolsChipLabels: ct, menuOverlays: lt, activeMentions: ut, onBackspaceAtCaret: dt, caretPositionOverride: ft, commandMenu: G, autoFocus: mt = !1, messageHistory: gt, onDialFileSystemClick: _t, dialFileSystemLabel: vt, validateAttachment: yt, onAttachmentClick: Ct, modelPickerOverlay: wt, maximumAttachmentsAmount: Tt, onAttachmentsLimitExceeded: Et, isAttachmentsEnabled: Dt = !0, isTextAttachmentsAllowed: Ot = !0, usageLimitsSlot: kt, onMessageTooLong: At }, jt) => {
|
|
2051
|
+
let Mt = d(), [Nt, Pt] = V(!1), q = Re(gt), Ft = ut ?? [], It = Ft.length > 0, J = z(() => c({
|
|
2052
|
+
"--ci-bg": M?.background,
|
|
2053
|
+
"--ci-text": M?.text,
|
|
2054
|
+
"--ci-border": M?.border,
|
|
2055
|
+
"--ci-border-focus": M?.borderFocus,
|
|
2056
|
+
"--ci-placeholder": M?.placeholder,
|
|
2057
|
+
"--ci-text-disabled": M?.textDisabled,
|
|
2058
|
+
"--ci-model-selector-caret-color": M?.modelSelectorCaret,
|
|
2059
|
+
"--ci-model-selector-hover-bg": M?.modelSelectorHoverBg,
|
|
2060
|
+
"--ci-model-selector-disabled-color": M?.modelSelectorDisabled,
|
|
2061
|
+
"--ci-model-selector-name-color": M?.modelSelectorName,
|
|
2062
|
+
"--ci-model-selector-version-color": M?.modelSelectorVersion,
|
|
2063
|
+
"--ci-voice-waveform": M?.voiceWaveform,
|
|
2064
|
+
"--ci-voice-accent": M?.voiceAccent,
|
|
2065
|
+
"--ci-mention-highlight-bg": M?.mentionHighlightBg,
|
|
2066
|
+
"--ci-mention-highlight-text": M?.mentionHighlightText,
|
|
2067
|
+
"--ci-mention-highlight-unsupported-bg": M?.mentionHighlightUnsupportedBg,
|
|
2068
|
+
"--ci-mention-highlight-unsupported-text": M?.mentionHighlightUnsupportedText
|
|
2069
|
+
}), [M]), Lt = z(() => _t ? [{
|
|
1952
2070
|
key: "dial-fs",
|
|
1953
|
-
label:
|
|
1954
|
-
icon: /* @__PURE__ */
|
|
2071
|
+
label: vt ?? "DIAL file system",
|
|
2072
|
+
icon: /* @__PURE__ */ P(me, {
|
|
1955
2073
|
size: f,
|
|
1956
2074
|
"aria-hidden": !0,
|
|
1957
|
-
stroke:
|
|
2075
|
+
stroke: _
|
|
1958
2076
|
}),
|
|
1959
|
-
onClick:
|
|
1960
|
-
}] : [], [
|
|
2077
|
+
onClick: _t
|
|
2078
|
+
}] : [], [_t, vt]), { message: Y, setMessage: X, textareaRef: Z } = Ue({
|
|
1961
2079
|
messageProp: e,
|
|
1962
2080
|
messageRevision: t
|
|
1963
|
-
})
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
}
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
2081
|
+
});
|
|
2082
|
+
R(() => {
|
|
2083
|
+
n !== void 0 && Z.current?.focus();
|
|
2084
|
+
}, [n, Z]), Ee(jt, () => ({ getCaretPosition: () => Z.current?.selectionStart ?? Y.length }), [Y, Z]);
|
|
2085
|
+
let { handleUndoKeyDown: Rt } = Ke({
|
|
2086
|
+
insertion: r,
|
|
2087
|
+
textareaRef: Z
|
|
2088
|
+
}), { isMenuOpen: zt, query: Bt, activeWordStart: Q, dismiss: Vt, closeOnOutsidePress: Ht, handleCaretMove: Ut, handleValueChange: Wt, listboxId: Gt, overlayRef: Kt, activeOptionId: qt, moveActiveOption: Jt, getActiveOption: Yt } = Fe({
|
|
2089
|
+
config: G,
|
|
2090
|
+
message: Y
|
|
2091
|
+
}), Xt = B(Ut);
|
|
2092
|
+
Xt.current = Ut;
|
|
2093
|
+
let Qt = () => {
|
|
2094
|
+
Ut(Z.current?.selectionStart ?? Y.length);
|
|
2095
|
+
}, $t = () => {
|
|
2096
|
+
requestAnimationFrame(() => {
|
|
2097
|
+
let e = Z.current;
|
|
2098
|
+
Xt.current(e?.selectionStart ?? e?.value.length ?? 0);
|
|
2099
|
+
});
|
|
2100
|
+
}, en = (e) => {
|
|
2101
|
+
e.key !== "ArrowLeft" && e.key !== "ArrowRight" && e.key !== "Home" && e.key !== "End" && e.key !== "PageUp" && e.key !== "PageDown" || Ut(e.currentTarget.selectionStart ?? Y.length);
|
|
2102
|
+
}, tn = G?.emptyQueryHint != null, nn = G != null && Q != null ? Q + G.triggerPrefix.length : null, rn = nn != null && Y.slice(nn).split("\n", 1)[0] !== "", an = tn && zt && Bt === "" && nn != null && !rn, on = G != null && zt ? Q ?? 0 : null, sn = B(null), cn = B(null), [ln, un] = V(null), dn = L(() => {
|
|
2103
|
+
let e = sn.current, t = cn.current;
|
|
2104
|
+
if (e == null || t == null) {
|
|
2105
|
+
un(null);
|
|
2106
|
+
return;
|
|
2107
|
+
}
|
|
2108
|
+
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
2109
|
+
un({
|
|
2110
|
+
left: n.left - r.left,
|
|
2111
|
+
top: n.top - r.top
|
|
2112
|
+
});
|
|
2113
|
+
}, []);
|
|
2114
|
+
De(() => {
|
|
2115
|
+
dn();
|
|
1976
2116
|
}, [
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
2117
|
+
dn,
|
|
2118
|
+
on,
|
|
2119
|
+
Y
|
|
2120
|
+
]), R(() => {
|
|
2121
|
+
if (on == null) return;
|
|
2122
|
+
let e = Z.current;
|
|
2123
|
+
if (e == null || typeof ResizeObserver > "u") return;
|
|
2124
|
+
let t = new ResizeObserver(dn);
|
|
2125
|
+
return t.observe(e), () => t.disconnect();
|
|
2126
|
+
}, [
|
|
2127
|
+
on,
|
|
1981
2128
|
Z,
|
|
1982
|
-
|
|
1983
|
-
s,
|
|
1984
|
-
Q
|
|
2129
|
+
dn
|
|
1985
2130
|
]);
|
|
2131
|
+
let fn = L((e) => {
|
|
2132
|
+
if (G == null || (Vt(), !e?.consumeQuery) || (e.returnFocus !== !1 && Z.current?.focus(), Q == null)) return;
|
|
2133
|
+
let t = `${G.triggerPrefix}${Bt}`, n = Q + t.length;
|
|
2134
|
+
if (Y.slice(Q, n) !== t) return;
|
|
2135
|
+
let r = Y.slice(0, Q) + Y.slice(n);
|
|
2136
|
+
X(r), q.notifyChange(), u?.(r);
|
|
2137
|
+
}, [
|
|
2138
|
+
G,
|
|
2139
|
+
Vt,
|
|
2140
|
+
Bt,
|
|
2141
|
+
Y,
|
|
2142
|
+
Q,
|
|
2143
|
+
X,
|
|
2144
|
+
q,
|
|
2145
|
+
u,
|
|
2146
|
+
Z
|
|
2147
|
+
]), pn = B(void 0);
|
|
1986
2148
|
R(() => {
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
pendingDropFiles: F,
|
|
2000
|
-
onDropFilesConsumed: ae,
|
|
2001
|
-
pendingAttachments: oe,
|
|
2002
|
-
onPendingAttachmentsConsumed: se,
|
|
2149
|
+
ft == null || pn.current === t || (pn.current = t, Z.current?.setSelectionRange(ft, ft), Ut(ft));
|
|
2150
|
+
}, [Y]);
|
|
2151
|
+
let { attachments: mn, buildAttachments: hn, addAttachments: gn, resetAttachments: _n, handleRemove: vn, handleRetry: yn, handleExpand: bn, hasBlockedAttachments: xn } = Ae({
|
|
2152
|
+
initialAttachments: we,
|
|
2153
|
+
onUploadAttachment: a,
|
|
2154
|
+
onAttachmentsChange: p,
|
|
2155
|
+
validateAttachment: yt,
|
|
2156
|
+
pendingDropFiles: fe,
|
|
2157
|
+
onDropFilesConsumed: pe,
|
|
2158
|
+
isDropDisabled: W,
|
|
2159
|
+
pendingAttachments: ge,
|
|
2160
|
+
onPendingAttachmentsConsumed: _e,
|
|
2003
2161
|
onExpandPastedText: L((e) => {
|
|
2004
|
-
|
|
2005
|
-
}, [
|
|
2006
|
-
maximumAttachmentsAmount:
|
|
2007
|
-
baseAttachmentsAmount:
|
|
2008
|
-
onAttachmentsLimitExceeded:
|
|
2009
|
-
}),
|
|
2010
|
-
|
|
2011
|
-
}, [
|
|
2012
|
-
|
|
2013
|
-
let [
|
|
2162
|
+
X((t) => t ? `${t}\n${e}` : e);
|
|
2163
|
+
}, [X]),
|
|
2164
|
+
maximumAttachmentsAmount: Tt,
|
|
2165
|
+
baseAttachmentsAmount: Ze.length,
|
|
2166
|
+
onAttachmentsLimitExceeded: Et
|
|
2167
|
+
}), Sn = L((e) => {
|
|
2168
|
+
gn(hn([e]));
|
|
2169
|
+
}, [gn, hn]), Cn = B(!1), wn = B(Y);
|
|
2170
|
+
wn.current = Y;
|
|
2171
|
+
let [Tn, En] = V({
|
|
2014
2172
|
text: "",
|
|
2015
2173
|
revision: 0
|
|
2016
|
-
}), { state:
|
|
2017
|
-
onAttachAudio:
|
|
2018
|
-
onTranscribeAudio:
|
|
2174
|
+
}), { state: Dn, analyserNodeRef: On, errorMessage: kn, startRecording: An, stopRecording: jn, discardRecording: Mn } = $e({
|
|
2175
|
+
onAttachAudio: Sn,
|
|
2176
|
+
onTranscribeAudio: Ve,
|
|
2019
2177
|
onTranscript: L((e) => {
|
|
2020
2178
|
let t = e.trim();
|
|
2021
2179
|
if (t) {
|
|
2022
|
-
let e =
|
|
2023
|
-
|
|
2180
|
+
let e = wn.current, n = `${e}${e && !/\s$/.test(e) ? " " : ""}${t}`;
|
|
2181
|
+
wn.current = n, X(n), En((e) => ({
|
|
2024
2182
|
text: t,
|
|
2025
2183
|
revision: e.revision + 1
|
|
2026
|
-
})),
|
|
2184
|
+
})), q.notifyChange(), u?.(n);
|
|
2027
2185
|
}
|
|
2028
|
-
|
|
2186
|
+
Cn.current = !0;
|
|
2029
2187
|
}, [
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2188
|
+
X,
|
|
2189
|
+
q,
|
|
2190
|
+
u
|
|
2033
2191
|
]),
|
|
2034
|
-
errorLabel:
|
|
2035
|
-
}), $ =
|
|
2192
|
+
errorLabel: Ye
|
|
2193
|
+
}), $ = Dn === qe.Recording || Dn === qe.Processing;
|
|
2036
2194
|
R(() => {
|
|
2037
|
-
(
|
|
2038
|
-
}, [
|
|
2039
|
-
let
|
|
2040
|
-
if (!
|
|
2195
|
+
(Dn === qe.Error || Dn === qe.Idle && Cn.current) && (Cn.current = !1, Z.current?.focus());
|
|
2196
|
+
}, [Dn, Z]);
|
|
2197
|
+
let Nn = B(null), Pn = B(null), Fn = Dt && Ot, { handlePaste: In } = le(gn, Fn ? ve : Infinity), Ln = L((e) => {
|
|
2198
|
+
if (!Fn) {
|
|
2041
2199
|
let t = e.clipboardData.getData("text/plain");
|
|
2042
|
-
t.length >=
|
|
2200
|
+
t.length >= ye && At?.(t.length, ye);
|
|
2043
2201
|
}
|
|
2044
|
-
|
|
2202
|
+
In(e);
|
|
2045
2203
|
}, [
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
]),
|
|
2204
|
+
Fn,
|
|
2205
|
+
ye,
|
|
2206
|
+
At,
|
|
2207
|
+
In
|
|
2208
|
+
]), Rn = Y.trim().length > 0 || mn.length > 0, zn = Rn && !xn && !Ie && !$, [Bn, Vn] = V([]);
|
|
2051
2209
|
R(() => {
|
|
2052
|
-
|
|
2053
|
-
}, [(
|
|
2054
|
-
let
|
|
2055
|
-
let e =
|
|
2056
|
-
return
|
|
2210
|
+
Vn([]);
|
|
2211
|
+
}, [(rt ?? []).map((e) => e.id).join("|")]);
|
|
2212
|
+
let Hn = z(() => {
|
|
2213
|
+
let e = rt ?? [];
|
|
2214
|
+
return at ? e.filter((e) => e.isSelected || !Bn.includes(e.id)) : e;
|
|
2057
2215
|
}, [
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
]),
|
|
2062
|
-
|
|
2063
|
-
}, [
|
|
2064
|
-
if (
|
|
2065
|
-
if (
|
|
2066
|
-
|
|
2216
|
+
rt,
|
|
2217
|
+
Bn,
|
|
2218
|
+
at
|
|
2219
|
+
]), Un = L((e) => {
|
|
2220
|
+
Vn((t) => t.includes(e) ? t : [...t, e]), rt?.find((t) => t.id === e)?.isSelected && it?.(e);
|
|
2221
|
+
}, [rt, it]), Wn = be === void 0 || xe != null, Gn = Le && !s, Kn = async () => {
|
|
2222
|
+
if (Ie || $) return;
|
|
2223
|
+
if (Y.length >= ye) {
|
|
2224
|
+
At?.(Y.length, ye);
|
|
2067
2225
|
return;
|
|
2068
2226
|
}
|
|
2069
|
-
let e =
|
|
2070
|
-
|
|
2227
|
+
let e = Y, t = mn;
|
|
2228
|
+
X(""), q.reset();
|
|
2071
2229
|
try {
|
|
2072
|
-
await
|
|
2230
|
+
await i?.(e, t), t.forEach((e) => {
|
|
2073
2231
|
e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
|
|
2074
|
-
}),
|
|
2232
|
+
}), _n([]);
|
|
2075
2233
|
} catch {
|
|
2076
|
-
|
|
2234
|
+
X(e), _n(t);
|
|
2077
2235
|
}
|
|
2078
|
-
},
|
|
2079
|
-
if (
|
|
2080
|
-
|
|
2236
|
+
}, qn = (e) => Xe === et.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey, Jn = (e) => {
|
|
2237
|
+
if (!zt || e.nativeEvent.isComposing) return !1;
|
|
2238
|
+
if (e.key === "Escape") return e.preventDefault(), e.stopPropagation(), Vt(), !0;
|
|
2239
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") return e.preventDefault(), Jt(e.key === "ArrowDown" ? Pe.Next : Pe.Previous), !0;
|
|
2240
|
+
if (e.key !== "Enter" || e.shiftKey) return !1;
|
|
2241
|
+
let t = Yt();
|
|
2242
|
+
return t == null ? qn(e) ? (e.preventDefault(), !0) : !1 : (e.preventDefault(), t.click(), !0);
|
|
2243
|
+
}, Yn = (e) => {
|
|
2244
|
+
if (!$ && !Rt(e) && !Jn(e)) {
|
|
2245
|
+
if (!e.nativeEvent.isComposing && !W && !s) {
|
|
2081
2246
|
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
2082
|
-
let t = e.currentTarget.selectionStart ?? 0, n =
|
|
2247
|
+
let t = e.currentTarget.selectionStart ?? 0, n = q.navigate(e.key === "ArrowUp" ? "up" : "down", Y, t);
|
|
2083
2248
|
if (n !== null) {
|
|
2084
|
-
e.preventDefault(),
|
|
2249
|
+
e.preventDefault(), X(n);
|
|
2085
2250
|
return;
|
|
2086
2251
|
}
|
|
2087
2252
|
}
|
|
2088
|
-
if (e.key === "Backspace" &&
|
|
2089
|
-
e.
|
|
2090
|
-
|
|
2253
|
+
if (e.key === "Backspace" && dt != null && e.currentTarget.selectionStart === e.currentTarget.selectionEnd && e.currentTarget.selectionStart != null) {
|
|
2254
|
+
let t = dt(e.currentTarget.selectionStart);
|
|
2255
|
+
if (t != null) {
|
|
2256
|
+
e.preventDefault();
|
|
2257
|
+
let n = e.currentTarget;
|
|
2258
|
+
n.setSelectionRange(t.start, t.start + t.length), typeof document.execCommand == "function" && document.execCommand("delete", !1) || We(n, Y.slice(0, t.start) + Y.slice(t.start + t.length), t.start);
|
|
2259
|
+
return;
|
|
2260
|
+
}
|
|
2091
2261
|
}
|
|
2092
2262
|
}
|
|
2093
|
-
e.key === "Enter" && (
|
|
2263
|
+
e.key === "Enter" && qn(e) && (e.preventDefault(), !s && zn && Wn && !W && Kn());
|
|
2094
2264
|
}
|
|
2095
|
-
},
|
|
2265
|
+
}, Xn = (e) => {
|
|
2096
2266
|
let t = Array.from(e.target.files ?? []);
|
|
2097
2267
|
if (t.length === 0) return;
|
|
2098
|
-
let n =
|
|
2099
|
-
e.target.value = "",
|
|
2100
|
-
},
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2268
|
+
let n = hn(t);
|
|
2269
|
+
e.target.value = "", gn(n);
|
|
2270
|
+
}, Zn = z(() => {
|
|
2271
|
+
let e = [];
|
|
2272
|
+
return on != null && e.push({
|
|
2273
|
+
offset: on,
|
|
2274
|
+
node: /* @__PURE__ */ P("span", {
|
|
2275
|
+
ref: sn,
|
|
2276
|
+
"aria-hidden": !0,
|
|
2277
|
+
className: "inline-block h-[1lh] w-0 align-text-top"
|
|
2278
|
+
}, "caret-marker")
|
|
2279
|
+
}), an && G != null && nn != null && e.push({
|
|
2280
|
+
offset: nn,
|
|
2281
|
+
node: /* @__PURE__ */ P("span", {
|
|
2282
|
+
className: K.commandHint,
|
|
2283
|
+
"aria-hidden": !0,
|
|
2284
|
+
"data-mirror-synthetic": !0,
|
|
2285
|
+
children: G.emptyQueryHint
|
|
2286
|
+
}, "command-hint")
|
|
2287
|
+
}), e;
|
|
2288
|
+
}, [
|
|
2289
|
+
on,
|
|
2290
|
+
an,
|
|
2291
|
+
G,
|
|
2292
|
+
nn
|
|
2293
|
+
]), Qn = It || Zn.length > 0, { mirrorRef: $n, selectionRects: er, updateSelectionRects: tr } = He({
|
|
2294
|
+
textareaRef: Z,
|
|
2295
|
+
message: Y,
|
|
2296
|
+
isMirrorActive: Qn
|
|
2297
|
+
}), nr = /* @__PURE__ */ P("textarea", {
|
|
2298
|
+
className: l(K.textarea, Qn && K.textareaMentionMode, I?.fontClassName || "dial-body-paragraph-text", "relative z-0 max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent pe-1 ps-1 outline-none [field-sizing:content]", "disabled:cursor-not-allowed"),
|
|
2299
|
+
ref: Z,
|
|
2300
|
+
autoFocus: mt,
|
|
2301
|
+
value: Y,
|
|
2105
2302
|
onChange: (e) => {
|
|
2106
|
-
|
|
2303
|
+
X(e.target.value), q.notifyChange();
|
|
2107
2304
|
let t = e.nativeEvent instanceof InputEvent ? e.nativeEvent : void 0;
|
|
2108
|
-
|
|
2305
|
+
Wt(e.target.value, e.target.selectionStart ?? e.target.value.length, t?.isComposing ?? !1), u?.(e.target.value);
|
|
2109
2306
|
},
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2307
|
+
onSelect: tr,
|
|
2308
|
+
onFocus: $t,
|
|
2309
|
+
onClick: Qt,
|
|
2310
|
+
onKeyDown: Yn,
|
|
2311
|
+
onKeyUp: en,
|
|
2312
|
+
onPaste: Ln,
|
|
2313
|
+
placeholder: m,
|
|
2314
|
+
"aria-label": h,
|
|
2315
|
+
"aria-autocomplete": G == null ? void 0 : "list",
|
|
2316
|
+
"aria-controls": zt ? Gt : void 0,
|
|
2317
|
+
"aria-activedescendant": qt ?? void 0,
|
|
2318
|
+
"aria-hidden": It ? !0 : void 0,
|
|
2319
|
+
disabled: W,
|
|
2115
2320
|
readOnly: $,
|
|
2116
2321
|
rows: 1
|
|
2117
|
-
}),
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
placement: "top-start",
|
|
2124
|
-
trigger: [],
|
|
2125
|
-
initialFocus: -1,
|
|
2126
|
-
matchReferenceWidth: !1,
|
|
2127
|
-
outsidePressIgnoreRef: Q,
|
|
2128
|
-
renderOverlay: () => {
|
|
2129
|
-
let e = q.renderMenu({
|
|
2130
|
-
query: At,
|
|
2131
|
-
close: Ft
|
|
2132
|
-
});
|
|
2133
|
-
return q.menuLabel == null ? e : /* @__PURE__ */ U("div", {
|
|
2134
|
-
role: "group",
|
|
2135
|
-
"aria-label": q.menuLabel,
|
|
2136
|
-
children: e
|
|
2137
|
-
});
|
|
2322
|
+
}), rr = G == null ? nr : /* @__PURE__ */ F(N, { children: [nr, /* @__PURE__ */ P("div", {
|
|
2323
|
+
"aria-hidden": !0,
|
|
2324
|
+
className: l("pointer-events-none absolute", I?.fontClassName || "dial-body-paragraph-text"),
|
|
2325
|
+
style: {
|
|
2326
|
+
left: ln?.left ?? 0,
|
|
2327
|
+
top: ln?.top ?? 0
|
|
2138
2328
|
},
|
|
2139
|
-
children:
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2329
|
+
children: /* @__PURE__ */ P(v, {
|
|
2330
|
+
open: zt,
|
|
2331
|
+
onOpenChange: (e) => {
|
|
2332
|
+
e || Ht();
|
|
2333
|
+
},
|
|
2334
|
+
placement: "top-start",
|
|
2335
|
+
trigger: [],
|
|
2336
|
+
initialFocus: -1,
|
|
2337
|
+
matchReferenceWidth: !1,
|
|
2338
|
+
outsidePressIgnoreRef: Z,
|
|
2339
|
+
renderOverlay: () => /* @__PURE__ */ P("div", {
|
|
2340
|
+
ref: Kt,
|
|
2341
|
+
role: G.menuLabel == null ? void 0 : "group",
|
|
2342
|
+
"aria-label": G.menuLabel,
|
|
2343
|
+
children: G.renderMenu({
|
|
2344
|
+
query: Bt,
|
|
2345
|
+
caretPosition: Q ?? 0,
|
|
2346
|
+
close: fn,
|
|
2347
|
+
listboxId: Gt,
|
|
2348
|
+
activeOptionId: qt
|
|
2349
|
+
})
|
|
2147
2350
|
}),
|
|
2148
|
-
|
|
2149
|
-
className: l(J.commandHint, "pointer-events-none absolute start-[var(--ci-first-line-indent,0px)] top-0", M?.fontClassName || "dial-body-paragraph-text"),
|
|
2351
|
+
children: /* @__PURE__ */ P("span", {
|
|
2150
2352
|
"aria-hidden": !0,
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2353
|
+
className: "inline-block h-[1lh] w-0"
|
|
2354
|
+
})
|
|
2355
|
+
})
|
|
2356
|
+
})] }), ir = /* @__PURE__ */ F("div", {
|
|
2357
|
+
ref: cn,
|
|
2358
|
+
className: "relative -me-1 -ms-1 w-[calc(100%+8px)]",
|
|
2359
|
+
children: [Qn && /* @__PURE__ */ F("div", {
|
|
2360
|
+
ref: $n,
|
|
2361
|
+
className: l(K.textarea, I?.fontClassName || "dial-body-paragraph-text", "pointer-events-none absolute inset-0 z-10 max-h-[272px] w-full overflow-hidden whitespace-pre-wrap pe-1 ps-1 [overflow-wrap:anywhere]"),
|
|
2362
|
+
children: [ze(Y, Ft, Zn, K.mentionHighlight, K.mentionHighlightUnsupported), er.map((e, t) => /* @__PURE__ */ P("div", {
|
|
2363
|
+
"aria-hidden": !0,
|
|
2364
|
+
className: "pointer-events-none absolute rounded-sm bg-control-accent-alpha-active",
|
|
2365
|
+
style: {
|
|
2366
|
+
left: e.left,
|
|
2367
|
+
top: e.top,
|
|
2368
|
+
width: e.width,
|
|
2369
|
+
height: e.height
|
|
2370
|
+
}
|
|
2371
|
+
}, `selection-${t}`))]
|
|
2372
|
+
}), rr]
|
|
2373
|
+
}), ar = Te ? void 0 : /* @__PURE__ */ P(pt, {
|
|
2374
|
+
onAttachClick: Oe ? void 0 : () => Nn.current?.click(),
|
|
2375
|
+
attachLabel: y,
|
|
2376
|
+
addMenuTitle: C,
|
|
2377
|
+
menuTitle: w,
|
|
2378
|
+
menuCloseLabel: T,
|
|
2379
|
+
style: J,
|
|
2380
|
+
isDisabled: W || $,
|
|
2381
|
+
chatSettings: nt,
|
|
2382
|
+
extraMenuItems: Lt,
|
|
2383
|
+
onRecordVoice: Be && Dt && !s && !$ ? () => An(Je.Attachment) : void 0,
|
|
2384
|
+
recordVoiceLabel: ie,
|
|
2385
|
+
toolsMenuItems: at ? rt : void 0,
|
|
2386
|
+
onToolToggle: it,
|
|
2387
|
+
toolsMenuTitle: ot,
|
|
2388
|
+
toolsBackLabel: st,
|
|
2389
|
+
menuOverlays: lt,
|
|
2390
|
+
getCaretPosition: () => Z.current?.selectionStart ?? Y.length
|
|
2391
|
+
}), or = ke === tt.Inline && (!Mt || je), sr = ar && /* @__PURE__ */ P("div", {
|
|
2392
|
+
className: l("flex", H.addCluster),
|
|
2393
|
+
children: ar
|
|
2394
|
+
}), cr = Hn.length > 0 && it != null && /* @__PURE__ */ P("div", {
|
|
2395
|
+
className: l("min-w-0 flex-1", H.toolsChips),
|
|
2396
|
+
children: /* @__PURE__ */ P(ht, {
|
|
2397
|
+
items: Hn,
|
|
2398
|
+
onToolToggle: it,
|
|
2399
|
+
onToolDismiss: Un,
|
|
2400
|
+
canRemove: at,
|
|
2401
|
+
removeLabel: ct?.removeLabel,
|
|
2402
|
+
stateOnLabel: ct?.stateOnLabel,
|
|
2403
|
+
stateOffLabel: ct?.stateOffLabel
|
|
2186
2404
|
})
|
|
2187
2405
|
});
|
|
2188
|
-
return /* @__PURE__ */
|
|
2189
|
-
ref:
|
|
2190
|
-
style:
|
|
2191
|
-
className: l(
|
|
2406
|
+
return /* @__PURE__ */ F("div", {
|
|
2407
|
+
ref: Pn,
|
|
2408
|
+
style: J,
|
|
2409
|
+
className: l(K.wrapper, W && K.wrapperDisabled, W && "cursor-not-allowed", "flex w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border", "p-4 focus-within:outline focus-within:-outline-offset-1 active:outline active:-outline-offset-1", de, H.wrapper),
|
|
2192
2410
|
children: [
|
|
2193
|
-
(
|
|
2194
|
-
attachments: [...
|
|
2411
|
+
(Ze.length > 0 || mn.length > 0) && /* @__PURE__ */ P(se, {
|
|
2412
|
+
attachments: [...Ze, ...mn],
|
|
2195
2413
|
onRemove: (e) => {
|
|
2196
|
-
|
|
2414
|
+
Ze.some((t) => t.id === e) ? Qe?.(e) : vn(e);
|
|
2197
2415
|
},
|
|
2198
|
-
onRetry:
|
|
2199
|
-
onExpand:
|
|
2416
|
+
onRetry: yn,
|
|
2417
|
+
onExpand: bn,
|
|
2200
2418
|
labels: {
|
|
2201
|
-
removeLabel:
|
|
2202
|
-
retryLabel:
|
|
2203
|
-
uploadingLabel:
|
|
2419
|
+
removeLabel: E,
|
|
2420
|
+
retryLabel: D,
|
|
2421
|
+
uploadingLabel: ee,
|
|
2422
|
+
expandLabel: O,
|
|
2423
|
+
clickLabel: k
|
|
2424
|
+
},
|
|
2425
|
+
styles: {
|
|
2426
|
+
...ce,
|
|
2427
|
+
className: l(mn.length > 6 && "-me-4 w-[calc(100%+1rem)]", ce?.className)
|
|
2204
2428
|
},
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
t != null && ot(t);
|
|
2429
|
+
onAttachmentClick: Ct == null ? void 0 : (e) => {
|
|
2430
|
+
let t = [...Ze, ...mn].find((t) => t.id === e);
|
|
2431
|
+
t != null && Ct(t);
|
|
2209
2432
|
}
|
|
2210
2433
|
}),
|
|
2211
|
-
!
|
|
2212
|
-
ref:
|
|
2434
|
+
!Te && /* @__PURE__ */ P("input", {
|
|
2435
|
+
ref: Nn,
|
|
2213
2436
|
type: "file",
|
|
2214
2437
|
multiple: !0,
|
|
2215
|
-
accept:
|
|
2438
|
+
accept: S,
|
|
2216
2439
|
className: "sr-only",
|
|
2217
2440
|
"aria-hidden": !0,
|
|
2218
2441
|
tabIndex: -1,
|
|
2219
|
-
onChange:
|
|
2442
|
+
onChange: Xn
|
|
2220
2443
|
}),
|
|
2221
|
-
|
|
2222
|
-
text:
|
|
2444
|
+
kn && /* @__PURE__ */ P(b, {
|
|
2445
|
+
text: kn,
|
|
2223
2446
|
className: "min-w-0 break-words px-1"
|
|
2224
2447
|
}),
|
|
2225
|
-
$ && /* @__PURE__ */
|
|
2448
|
+
$ && /* @__PURE__ */ P(bt, {
|
|
2226
2449
|
embedded: !0,
|
|
2227
|
-
state:
|
|
2228
|
-
analyserNodeRef:
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
processingLabel: Ae
|
|
2450
|
+
state: Dn,
|
|
2451
|
+
analyserNodeRef: On,
|
|
2452
|
+
onStop: jn,
|
|
2453
|
+
onDiscard: Mn,
|
|
2454
|
+
attachButton: ar,
|
|
2455
|
+
stopLabel: ae,
|
|
2456
|
+
discardLabel: oe,
|
|
2457
|
+
processingLabel: Ge
|
|
2236
2458
|
}),
|
|
2237
|
-
!$ &&
|
|
2238
|
-
!$ && !
|
|
2459
|
+
!$ && U && ir,
|
|
2460
|
+
!$ && !U && or && cr && /* @__PURE__ */ P("div", {
|
|
2239
2461
|
className: "flex",
|
|
2240
|
-
children:
|
|
2462
|
+
children: cr
|
|
2241
2463
|
}),
|
|
2242
|
-
!$ && !
|
|
2243
|
-
className: l("flex items-center gap-2",
|
|
2464
|
+
!$ && !U && /* @__PURE__ */ F("div", {
|
|
2465
|
+
className: l("flex items-center gap-2", or ? "flex-nowrap" : "flex-wrap", H.actionRow),
|
|
2244
2466
|
children: [
|
|
2245
|
-
|
|
2246
|
-
/* @__PURE__ */
|
|
2247
|
-
className: l("flex min-w-0 items-center self-stretch",
|
|
2248
|
-
children:
|
|
2467
|
+
or && sr,
|
|
2468
|
+
/* @__PURE__ */ P("div", {
|
|
2469
|
+
className: l("flex min-w-0 items-center self-stretch", or ? "flex-1" : "w-full", H.textareaWrap),
|
|
2470
|
+
children: ir
|
|
2249
2471
|
}),
|
|
2250
|
-
!
|
|
2251
|
-
!
|
|
2252
|
-
/* @__PURE__ */
|
|
2253
|
-
className: l("ms-auto flex flex-shrink-0 items-center gap-2",
|
|
2254
|
-
children:
|
|
2255
|
-
canSend:
|
|
2256
|
-
onSend:
|
|
2257
|
-
}) : /* @__PURE__ */
|
|
2258
|
-
|
|
2259
|
-
/* @__PURE__ */
|
|
2260
|
-
deployments:
|
|
2261
|
-
selectedDeploymentId:
|
|
2262
|
-
onDeploymentChange:
|
|
2263
|
-
modelSelectorLabels:
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2472
|
+
!or && sr,
|
|
2473
|
+
!or && cr,
|
|
2474
|
+
/* @__PURE__ */ P("div", {
|
|
2475
|
+
className: l("ms-auto flex flex-shrink-0 items-center gap-2", H.footerActions),
|
|
2476
|
+
children: Me ? Me({
|
|
2477
|
+
canSend: zn,
|
|
2478
|
+
onSend: Kn
|
|
2479
|
+
}) : /* @__PURE__ */ F(N, { children: [
|
|
2480
|
+
kt,
|
|
2481
|
+
/* @__PURE__ */ P(Zt, {
|
|
2482
|
+
deployments: be,
|
|
2483
|
+
selectedDeploymentId: xe,
|
|
2484
|
+
onDeploymentChange: Se,
|
|
2485
|
+
modelSelectorLabels: Ce,
|
|
2486
|
+
menuStyles: ue,
|
|
2487
|
+
isStreaming: s,
|
|
2488
|
+
isMobile: Mt,
|
|
2489
|
+
isDisabled: Ne,
|
|
2490
|
+
style: J,
|
|
2491
|
+
modelPickerOverlay: wt,
|
|
2492
|
+
isPickerOpen: Nt,
|
|
2493
|
+
onPickerToggle: () => Pt((e) => !e),
|
|
2494
|
+
onPickerOpenChange: Pt
|
|
2272
2495
|
}),
|
|
2273
|
-
|
|
2274
|
-
icon: /* @__PURE__ */
|
|
2275
|
-
size:
|
|
2276
|
-
stroke:
|
|
2496
|
+
Gn && /* @__PURE__ */ P(x, {
|
|
2497
|
+
icon: /* @__PURE__ */ P(he, {
|
|
2498
|
+
size: g.LG,
|
|
2499
|
+
stroke: _,
|
|
2277
2500
|
"aria-hidden": !0
|
|
2278
2501
|
}),
|
|
2279
|
-
"aria-label":
|
|
2280
|
-
tooltipProps: { tooltip:
|
|
2502
|
+
"aria-label": re,
|
|
2503
|
+
tooltipProps: { tooltip: re },
|
|
2281
2504
|
className: "size-[40px] flex-shrink-0 mobile:min-h-11 mobile:min-w-11",
|
|
2282
|
-
onClick: () =>
|
|
2283
|
-
disabled:
|
|
2505
|
+
onClick: () => An(Je.Dictation),
|
|
2506
|
+
disabled: W || s
|
|
2284
2507
|
}),
|
|
2285
|
-
|
|
2286
|
-
onStop:
|
|
2287
|
-
ariaLabel:
|
|
2288
|
-
}) : !
|
|
2289
|
-
onSend:
|
|
2290
|
-
isDisabled: !
|
|
2291
|
-
ariaLabel:
|
|
2292
|
-
sendTooltip:
|
|
2508
|
+
s && o ? /* @__PURE__ */ P(St, {
|
|
2509
|
+
onStop: o,
|
|
2510
|
+
ariaLabel: ne
|
|
2511
|
+
}) : !s && /* @__PURE__ */ P(xt, {
|
|
2512
|
+
onSend: Kn,
|
|
2513
|
+
isDisabled: !Wn || !zn,
|
|
2514
|
+
ariaLabel: A,
|
|
2515
|
+
sendTooltip: Rn ? j : te ?? j
|
|
2293
2516
|
})
|
|
2294
2517
|
] })
|
|
2295
2518
|
})
|
|
2296
2519
|
]
|
|
2297
2520
|
}),
|
|
2298
|
-
/* @__PURE__ */
|
|
2521
|
+
/* @__PURE__ */ P("span", {
|
|
2299
2522
|
className: "sr-only",
|
|
2300
2523
|
role: "status",
|
|
2301
2524
|
"aria-live": "polite",
|
|
2302
2525
|
"aria-atomic": "true",
|
|
2303
|
-
children: /* @__PURE__ */
|
|
2526
|
+
children: /* @__PURE__ */ P("span", { children: Tn.text }, Tn.revision)
|
|
2304
2527
|
})
|
|
2305
2528
|
]
|
|
2306
2529
|
});
|
|
2307
|
-
}
|
|
2530
|
+
});
|
|
2531
|
+
Qt.displayName = "Input";
|
|
2532
|
+
var $t = {
|
|
2308
2533
|
welcome: "_welcome_1icyo_1",
|
|
2309
2534
|
description: "_description_1icyo_5"
|
|
2310
|
-
},
|
|
2311
|
-
let { colors:
|
|
2312
|
-
return /* @__PURE__ */
|
|
2535
|
+
}, en = ({ isStreaming: e = !1, placeholder: t = "Type a prompt or use \"/\" to select one", welcomeText: n, descriptionText: r, belowWelcomeSlot: i, styles: a, className: o, inputClassName: s, isInputDisabled: u = !1, ...d }) => {
|
|
2536
|
+
let { colors: f, typography: p, attachmentTray: m, modelMenu: h } = a ?? {};
|
|
2537
|
+
return /* @__PURE__ */ F("div", {
|
|
2313
2538
|
style: c({
|
|
2314
|
-
"--ci-welcome-color":
|
|
2315
|
-
"--ci-description-color":
|
|
2539
|
+
"--ci-welcome-color": f?.welcomeText,
|
|
2540
|
+
"--ci-description-color": f?.descriptionText
|
|
2316
2541
|
}),
|
|
2317
|
-
className: l("relative flex w-full flex-col items-center gap-9 px-4 py-5 desktop:p-5",
|
|
2318
|
-
children: [
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
className:
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2542
|
+
className: l("relative flex w-full flex-col items-center gap-9 px-4 py-5 desktop:p-5", o),
|
|
2543
|
+
children: [
|
|
2544
|
+
n && /* @__PURE__ */ F("div", {
|
|
2545
|
+
className: "flex flex-col items-center gap-4 text-center",
|
|
2546
|
+
children: [/* @__PURE__ */ P("h1", {
|
|
2547
|
+
className: l($t.welcome, "m-0", p?.welcomeClassName || "dial-display2-text"),
|
|
2548
|
+
children: n
|
|
2549
|
+
}), r && /* @__PURE__ */ P("p", {
|
|
2550
|
+
className: l($t.description, "m-0 max-w-[540px]", p?.descriptionClassName || "dial-body-paragraph-text"),
|
|
2551
|
+
children: r
|
|
2552
|
+
})]
|
|
2553
|
+
}),
|
|
2554
|
+
i != null && /* @__PURE__ */ P("div", {
|
|
2555
|
+
className: "flex w-full max-w-[700px] flex-col items-center empty:hidden",
|
|
2556
|
+
children: i
|
|
2557
|
+
}),
|
|
2558
|
+
/* @__PURE__ */ P("div", {
|
|
2559
|
+
className: l("relative w-full", n ? "max-w-[700px]" : "max-w-[748px]"),
|
|
2560
|
+
children: /* @__PURE__ */ P(Qt, {
|
|
2561
|
+
placeholder: t,
|
|
2562
|
+
isStreaming: e,
|
|
2563
|
+
isInputDisabled: u,
|
|
2564
|
+
...d,
|
|
2565
|
+
className: s,
|
|
2566
|
+
colors: f?.input,
|
|
2567
|
+
typography: p?.input,
|
|
2568
|
+
attachmentTray: m,
|
|
2569
|
+
modelMenu: h
|
|
2570
|
+
})
|
|
2338
2571
|
})
|
|
2339
|
-
|
|
2572
|
+
]
|
|
2340
2573
|
});
|
|
2341
|
-
},
|
|
2342
|
-
let
|
|
2574
|
+
}, tn = ({ message: e, messageRevision: t, onChange: n, activeMentions: r, onBackspaceAtCaret: i, caretPositionOverride: o, commandMenu: s, menuOverlays: c, initialAttachments: u = [], onCancel: d, onSave: p, onUploadAttachment: m, cancelLabel: h = "Cancel", saveLabel: g = "Save & Submit", ariaLabel: v, removeLabel: y, retryLabel: b, uploadingLabel: x, expandLabel: S, clickLabel: C, addMenuTitle: T = "Add", attachLabel: E = "Attach file", menuTitle: D = "Menu", menuCloseLabel: O = "Close", className: k, pendingDropFiles: A, onDropFilesConsumed: j, validateAttachment: te, isAttachmentsEnabled: ne, isTextAttachmentsAllowed: re, hideAttachFile: ie = !1, fileAccept: ae, maximumAttachmentsAmount: oe, onAttachmentsLimitExceeded: M, onDialFileSystemClick: N, dialFileSystemLabel: se, pendingAttachments: I, onPendingAttachmentsConsumed: ce, onAttachmentClick: le, pasteTextThreshold: ue, maxMessageLength: de = 5e4, onMessageTooLong: fe }) => {
|
|
2575
|
+
let pe = B(null), he = B(null), [ge, _e] = V([]);
|
|
2343
2576
|
R(() => {
|
|
2344
|
-
|
|
2345
|
-
}, [
|
|
2346
|
-
let [
|
|
2347
|
-
|
|
2348
|
-
},
|
|
2349
|
-
|
|
2350
|
-
}, [
|
|
2351
|
-
if (
|
|
2352
|
-
if (
|
|
2353
|
-
|
|
2577
|
+
A?.length && (_e(A), j?.());
|
|
2578
|
+
}, [A, j]);
|
|
2579
|
+
let [ve, ye] = V(e ?? ""), [be, xe] = V([]), [Se, Ce] = V(u), we = be.some((e) => e.status === a.Loading || e.status === a.Error), Te = (ve.trim().length > 0 || be.length > 0 || Se.length > 0) && !we, Ee = (e) => {
|
|
2580
|
+
Ce((t) => t.filter((t) => t.id !== e));
|
|
2581
|
+
}, De = L((e, t) => {
|
|
2582
|
+
p(e, Se, t);
|
|
2583
|
+
}, [Se, p]), H = () => {
|
|
2584
|
+
if (Te) {
|
|
2585
|
+
if (ve.length >= de) {
|
|
2586
|
+
fe?.(ve.length, de);
|
|
2354
2587
|
return;
|
|
2355
2588
|
}
|
|
2356
|
-
|
|
2589
|
+
De(ve, be);
|
|
2357
2590
|
}
|
|
2358
|
-
},
|
|
2591
|
+
}, Oe = L(() => _e([]), []), U = L((e) => {
|
|
2592
|
+
ye(e), n?.(e);
|
|
2593
|
+
}, [n]), ke = L((e) => {
|
|
2359
2594
|
let t = Array.from(e.target.files ?? []);
|
|
2360
|
-
t.length !== 0 && (e.target.value = "",
|
|
2361
|
-
}, []),
|
|
2595
|
+
t.length !== 0 && (e.target.value = "", _e(t));
|
|
2596
|
+
}, []), Ae = z(() => N ? [{
|
|
2362
2597
|
key: "dial-fs",
|
|
2363
|
-
label:
|
|
2364
|
-
icon: /* @__PURE__ */
|
|
2598
|
+
label: se ?? "DIAL file system",
|
|
2599
|
+
icon: /* @__PURE__ */ P(me, {
|
|
2365
2600
|
size: f,
|
|
2366
2601
|
"aria-hidden": !0,
|
|
2367
|
-
stroke:
|
|
2602
|
+
stroke: _
|
|
2368
2603
|
}),
|
|
2369
|
-
onClick:
|
|
2370
|
-
}] : [], [
|
|
2371
|
-
return /* @__PURE__ */
|
|
2372
|
-
className: l("flex w-full flex-col gap-2",
|
|
2373
|
-
children: [/* @__PURE__ */
|
|
2604
|
+
onClick: N
|
|
2605
|
+
}] : [], [N, se]);
|
|
2606
|
+
return /* @__PURE__ */ F("div", {
|
|
2607
|
+
className: l("flex w-full flex-col gap-2", k),
|
|
2608
|
+
children: [/* @__PURE__ */ P(Qt, {
|
|
2609
|
+
ref: he,
|
|
2374
2610
|
message: e,
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2611
|
+
messageRevision: t,
|
|
2612
|
+
activeMentions: r,
|
|
2613
|
+
onBackspaceAtCaret: i,
|
|
2614
|
+
caretPositionOverride: o,
|
|
2615
|
+
commandMenu: s,
|
|
2616
|
+
ariaLabel: v,
|
|
2378
2617
|
hideActionBar: !0,
|
|
2379
|
-
pendingDropFiles:
|
|
2380
|
-
onDropFilesConsumed:
|
|
2381
|
-
onSend:
|
|
2382
|
-
onUploadAttachment:
|
|
2383
|
-
onChange:
|
|
2384
|
-
onAttachmentsChange:
|
|
2385
|
-
removeLabel:
|
|
2386
|
-
retryLabel:
|
|
2387
|
-
uploadingLabel:
|
|
2618
|
+
pendingDropFiles: ge,
|
|
2619
|
+
onDropFilesConsumed: Oe,
|
|
2620
|
+
onSend: De,
|
|
2621
|
+
onUploadAttachment: m,
|
|
2622
|
+
onChange: U,
|
|
2623
|
+
onAttachmentsChange: xe,
|
|
2624
|
+
removeLabel: y,
|
|
2625
|
+
retryLabel: b,
|
|
2626
|
+
uploadingLabel: x,
|
|
2627
|
+
expandLabel: S,
|
|
2628
|
+
clickLabel: C,
|
|
2388
2629
|
className: "max-w-full",
|
|
2389
|
-
prefixAttachments:
|
|
2390
|
-
onRemovePrefixAttachment:
|
|
2391
|
-
validateAttachment:
|
|
2392
|
-
isAttachmentsEnabled:
|
|
2393
|
-
isTextAttachmentsAllowed:
|
|
2394
|
-
maximumAttachmentsAmount:
|
|
2395
|
-
onAttachmentsLimitExceeded:
|
|
2396
|
-
pendingAttachments:
|
|
2397
|
-
onPendingAttachmentsConsumed:
|
|
2398
|
-
onAttachmentClick:
|
|
2399
|
-
pasteTextThreshold:
|
|
2400
|
-
maxMessageLength:
|
|
2401
|
-
onMessageTooLong:
|
|
2402
|
-
}), /* @__PURE__ */
|
|
2630
|
+
prefixAttachments: Se,
|
|
2631
|
+
onRemovePrefixAttachment: Ee,
|
|
2632
|
+
validateAttachment: te,
|
|
2633
|
+
isAttachmentsEnabled: ne,
|
|
2634
|
+
isTextAttachmentsAllowed: re,
|
|
2635
|
+
maximumAttachmentsAmount: oe,
|
|
2636
|
+
onAttachmentsLimitExceeded: M,
|
|
2637
|
+
pendingAttachments: I,
|
|
2638
|
+
onPendingAttachmentsConsumed: ce,
|
|
2639
|
+
onAttachmentClick: le,
|
|
2640
|
+
pasteTextThreshold: ue,
|
|
2641
|
+
maxMessageLength: de,
|
|
2642
|
+
onMessageTooLong: fe
|
|
2643
|
+
}), /* @__PURE__ */ F("div", {
|
|
2403
2644
|
className: "flex items-center justify-between",
|
|
2404
|
-
children: [/* @__PURE__ */
|
|
2645
|
+
children: [/* @__PURE__ */ F("div", {
|
|
2405
2646
|
className: "flex",
|
|
2406
|
-
children: !
|
|
2407
|
-
ref:
|
|
2647
|
+
children: [!ie && /* @__PURE__ */ P("input", {
|
|
2648
|
+
ref: pe,
|
|
2408
2649
|
type: "file",
|
|
2409
2650
|
multiple: !0,
|
|
2410
|
-
accept:
|
|
2651
|
+
accept: ae,
|
|
2411
2652
|
className: "sr-only",
|
|
2412
2653
|
"aria-hidden": !0,
|
|
2413
2654
|
tabIndex: -1,
|
|
2414
|
-
onChange:
|
|
2415
|
-
}), /* @__PURE__ */
|
|
2416
|
-
onAttachClick: () =>
|
|
2417
|
-
attachLabel:
|
|
2418
|
-
addMenuTitle:
|
|
2419
|
-
menuTitle:
|
|
2420
|
-
menuCloseLabel:
|
|
2421
|
-
extraMenuItems:
|
|
2422
|
-
|
|
2423
|
-
|
|
2655
|
+
onChange: ke
|
|
2656
|
+
}), (!ie || (c?.length ?? 0) > 0) && /* @__PURE__ */ P(pt, {
|
|
2657
|
+
onAttachClick: ie ? void 0 : () => pe.current?.click(),
|
|
2658
|
+
attachLabel: E,
|
|
2659
|
+
addMenuTitle: T,
|
|
2660
|
+
menuTitle: D,
|
|
2661
|
+
menuCloseLabel: O,
|
|
2662
|
+
extraMenuItems: Ae,
|
|
2663
|
+
menuOverlays: c,
|
|
2664
|
+
getCaretPosition: () => he.current?.getCaretPosition() ?? 0
|
|
2665
|
+
})]
|
|
2666
|
+
}), /* @__PURE__ */ F("div", {
|
|
2424
2667
|
className: "flex gap-2",
|
|
2425
|
-
children: [/* @__PURE__ */
|
|
2426
|
-
label:
|
|
2427
|
-
onClick:
|
|
2428
|
-
}), /* @__PURE__ */
|
|
2429
|
-
label:
|
|
2430
|
-
onClick:
|
|
2431
|
-
disabled: !
|
|
2668
|
+
children: [/* @__PURE__ */ P(w, {
|
|
2669
|
+
label: h,
|
|
2670
|
+
onClick: d
|
|
2671
|
+
}), /* @__PURE__ */ P(ee, {
|
|
2672
|
+
label: g,
|
|
2673
|
+
onClick: H,
|
|
2674
|
+
disabled: !Te
|
|
2432
2675
|
})]
|
|
2433
2676
|
})]
|
|
2434
2677
|
})]
|
|
2435
2678
|
});
|
|
2679
|
+
}, nn = (e) => {
|
|
2680
|
+
let [t, n] = V({
|
|
2681
|
+
text: e?.text,
|
|
2682
|
+
revision: e?.revision ?? 0
|
|
2683
|
+
}), r = L((e) => {
|
|
2684
|
+
n((t) => ({
|
|
2685
|
+
text: e,
|
|
2686
|
+
revision: t.revision + 1
|
|
2687
|
+
}));
|
|
2688
|
+
}, []);
|
|
2689
|
+
return {
|
|
2690
|
+
message: t.text,
|
|
2691
|
+
messageRevision: t.revision,
|
|
2692
|
+
seedMessage: r
|
|
2693
|
+
};
|
|
2694
|
+
}, rn = (e, t) => {
|
|
2695
|
+
let n = B(e), r = B(t);
|
|
2696
|
+
r.current = t, R(() => {
|
|
2697
|
+
e !== n.current && (n.current = e, r.current());
|
|
2698
|
+
}, [e]);
|
|
2436
2699
|
};
|
|
2437
2700
|
//#endregion
|
|
2438
|
-
export {
|
|
2701
|
+
export { tt as ActionRowLayout, U as BottomSheetShell, H as CONVERSATION_INPUT_CLASS, lt as ChatSettingsModal, en as ConversationInput, tn as EditMessageInput, Qt as Input, et as SendOnEnter, nn as useComposerSeed, rn as useComposerSeedSource };
|