@epam/ai-dial-conversation-input 1.2.0-dev.99 → 1.3.0-dev.5

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