@epam/ai-dial-conversation-input 1.2.0-dev.99 → 1.2.0-rc.0

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