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