@epam/ai-dial-conversation-input 1.3.0-dev.32 → 1.3.0-dev.321

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 (36) hide show
  1. package/components/AddAttachmentButton/AddAttachmentButton.d.ts +1 -1
  2. package/components/AddAttachmentButton/AddAttachmentButton.d.ts.map +1 -1
  3. package/components/BottomSheetShell/BottomSheetShell.d.ts +9 -0
  4. package/components/BottomSheetShell/BottomSheetShell.d.ts.map +1 -1
  5. package/components/ChatSettingsModal/ChatSettingsModal.d.ts +4 -7
  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.map +1 -1
  10. package/components/Input/ModelSelectorControl.d.ts +2 -0
  11. package/components/Input/ModelSelectorControl.d.ts.map +1 -1
  12. package/components/ModelSelectorBottomSheet/ModelSelectorBottomSheet.d.ts +5 -1
  13. package/components/ModelSelectorBottomSheet/ModelSelectorBottomSheet.d.ts.map +1 -1
  14. package/components/ModelSelectorSkeleton/ModelSelectorSkeleton.d.ts +6 -5
  15. package/components/ModelSelectorSkeleton/ModelSelectorSkeleton.d.ts.map +1 -1
  16. package/components/ToolsChips/ToolsChips.d.ts +7 -3
  17. package/components/ToolsChips/ToolsChips.d.ts.map +1 -1
  18. package/components/UsageLimitBannerView/UsageLimitBannerView.d.ts +5 -0
  19. package/components/UsageLimitBannerView/UsageLimitBannerView.d.ts.map +1 -0
  20. package/constants/public-class-names.d.ts +2 -0
  21. package/constants/public-class-names.d.ts.map +1 -1
  22. package/hooks/useModelSelector.d.ts +4 -0
  23. package/hooks/useModelSelector.d.ts.map +1 -1
  24. package/hooks/useTextInsertion.d.ts +6 -0
  25. package/hooks/useTextInsertion.d.ts.map +1 -1
  26. package/index.css +3 -2
  27. package/index.d.ts +4 -1
  28. package/index.d.ts.map +1 -1
  29. package/index.js +1935 -1389
  30. package/models/ConversationInput.d.ts +11 -0
  31. package/models/ConversationInput.d.ts.map +1 -1
  32. package/models/Input.d.ts +17 -0
  33. package/models/Input.d.ts.map +1 -1
  34. package/models/UsageLimitBanner.d.ts +45 -0
  35. package/models/UsageLimitBanner.d.ts.map +1 -0
  36. package/package.json +6 -6
package/index.js CHANGED
@@ -1,11 +1,11 @@
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, 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";
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, useIsPhone as f } from "@epam/ai-dial-chat-shared";
2
+ import { BASE_ICON_SIZE as p, BottomSheet as m, Button as h, ButtonVariant as g, CloseButton as _, DIAL_ICON_SIZE as v, DIAL_KIT_ICON_STROKE as y, Dropdown as b, ElementSize as x, ErrorText as S, GhostIconButton as C, Highlight as w, LiveRegion as T, LiveRegionElement as E, LiveRegionPoliteness as D, MenuItemMark as ee, NeutralButton as O, NeutralIconButton as k, Notification as A, NotificationType as j, NotificationVariant as M, Popup as N, PopupSize as te, PrimaryButton as ne, PrimaryIconButton as P, RadioGroup as F, RadioGroupOrientation as I, Search as L, Skeleton as R, SkeletonVariant as re, Slider as z, Spinner as ie, Textarea as ae, TextareaResize as oe, ToggleChip as se, Tooltip as ce } from "@epam/ai-dial-ui-kit";
3
+ import { Fragment as le, jsx as B, jsxs as V } from "react/jsx-runtime";
4
+ import { AttachmentTray as ue, MAX_UPLOADS_PER_MINUTE as de, generateAttachmentId as fe, useClipboardPaste as pe } from "@epam/ai-dial-attachment-input";
5
+ import { IconArrowNarrowRight as me, IconCheck as he, IconChevronDown as ge, IconChevronRight as _e, IconFile as ve, IconMicrophone as ye, IconPaperclip as be, IconPlayerStop as xe, IconPlus as Se, IconSettings as Ce, IconTool as we, IconX as Te } from "@tabler/icons-react";
6
+ import { Fragment as Ee, createElement as De, forwardRef as Oe, memo as ke, useCallback as H, useEffect as U, useId as Ae, useImperativeHandle as je, useLayoutEffect as Me, useMemo as W, useRef as G, useState as K, useSyncExternalStore as Ne } from "react";
7
7
  //#region src/constants/public-class-names.ts
8
- var H = {
8
+ var q = {
9
9
  wrapper: "dial-ci-wrapper",
10
10
  actionRow: "dial-ci-action-row",
11
11
  textareaWrap: "dial-ci-textarea-wrap",
@@ -18,20 +18,21 @@ var H = {
18
18
  modelMenu: "dial-ci-model-menu",
19
19
  modelMenuSearch: "dial-ci-model-menu-search",
20
20
  modelMenuItem: "dial-ci-model-menu-item",
21
- modelMenuItemSelected: "dial-ci-model-menu-item-selected"
22
- }, Oe = {
21
+ modelMenuItemSelected: "dial-ci-model-menu-item-selected",
22
+ usageBanner: "dial-ci-usage-banner"
23
+ }, Pe = {
23
24
  backdrop: "_backdrop_1ym62_8",
24
25
  sheet: "_sheet_1ym62_12",
25
26
  title: "_title_1ym62_16",
26
27
  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({
28
+ }, Fe = ({ 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, portalId: p, overlayClassName: h, overlayStyle: g, children: _ }) => {
29
+ let v = c({
29
30
  "--ci-backdrop": f?.backdrop,
30
31
  "--ci-sheet-bg": f?.sheetBg,
31
32
  "--ci-sheet-text": f?.sheetText,
32
33
  "--ci-sheet-divider": f?.divider
33
34
  });
34
- return /* @__PURE__ */ P(p, {
35
+ return /* @__PURE__ */ B(m, {
35
36
  open: e,
36
37
  onClose: r,
37
38
  title: t,
@@ -40,33 +41,37 @@ var H = {
40
41
  backAriaLabel: a,
41
42
  closeAriaLabel: n,
42
43
  style: {
43
- ...h,
44
+ ...v,
44
45
  ...s
45
46
  },
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
47
+ overlayStyle: {
48
+ ...v,
49
+ ...g
50
+ },
51
+ className: l(Pe.sheet, d),
52
+ overlayClassName: l(Pe.backdrop, h),
53
+ portalId: p,
54
+ headerClassName: Pe.divider,
55
+ titleClassName: l(Pe.title, u),
56
+ children: _
52
57
  });
53
- }, ke = async (e, t, n) => {
58
+ }, Ie = async (e, t, n) => {
54
59
  let r = 6e4 / t, i = [];
55
60
  for (let t = 0; t < e.length; t++) t > 0 && await new Promise((e) => setTimeout(e, r)), i.push(n(e[t]));
56
61
  await Promise.allSettled(i);
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);
59
- R(() => {
62
+ }, Le = ({ 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 }) => {
63
+ let [g, _] = K(n), v = G(g);
64
+ U(() => {
60
65
  v.current = g;
61
- }, [g]), R(() => () => {
66
+ }, [g]), U(() => () => {
62
67
  v.current.forEach((e) => {
63
68
  e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
64
69
  });
65
70
  }, []);
66
- let y = L((e) => e.map((e) => {
71
+ let y = H((e) => e.map((e) => {
67
72
  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;
68
73
  return {
69
- id: ce(),
74
+ id: fe(),
70
75
  name: e.name,
71
76
  contentType: e.type,
72
77
  file: e,
@@ -75,26 +80,22 @@ var H = {
75
80
  previewUrl: i,
76
81
  playUrl: o
77
82
  };
78
- }), []), b = B(i);
79
- R(() => {
83
+ }), []), b = G(i);
84
+ U(() => {
80
85
  b.current = i;
81
86
  }, [i]);
82
- let x = B(!0), S = L((e) => {
87
+ let x = G(!0), S = H((e) => {
83
88
  _((t) => {
84
89
  let n = e(t);
85
90
  return n === t ? t : n;
86
91
  });
87
92
  }, []);
88
- R(() => {
89
- if (x.current) {
90
- x.current = !1;
91
- return;
92
- }
93
- b.current?.(g);
93
+ U(() => {
94
+ x.current ? x.current = !1 : b.current?.(g);
94
95
  }, [g]);
95
- let C = L((e) => {
96
+ let C = H((e) => {
96
97
  _(e);
97
- }, []), w = L(async (t) => {
98
+ }, []), w = H(async (t) => {
98
99
  if (r) {
99
100
  S((e) => e.map((e) => e.id === t.id ? {
100
101
  ...e,
@@ -117,7 +118,7 @@ var H = {
117
118
  } : e));
118
119
  }
119
120
  }
120
- }, [r, S]), T = L((e, t = !0) => {
121
+ }, [r, S]), T = H((e, t = !0) => {
121
122
  let n = new Set(v.current.map((e) => e.id)), r = e.filter((e) => !n.has(e.id));
122
123
  if (r.length !== 0) {
123
124
  if (p != null && p > 0 && Number.isFinite(p)) {
@@ -138,7 +139,7 @@ var H = {
138
139
  status: a.Error,
139
140
  errorReason: n
140
141
  } : e));
141
- }), ke(e, I, w);
142
+ }), Ie(e, de, w);
142
143
  }
143
144
  }
144
145
  }, [
@@ -148,8 +149,8 @@ var H = {
148
149
  S,
149
150
  w,
150
151
  o
151
- ]), E = B(/* @__PURE__ */ new WeakSet());
152
- R(() => {
152
+ ]), E = G(/* @__PURE__ */ new WeakSet());
153
+ U(() => {
153
154
  if (s.length === 0) {
154
155
  E.current = /* @__PURE__ */ new WeakSet();
155
156
  return;
@@ -162,13 +163,13 @@ var H = {
162
163
  l,
163
164
  c,
164
165
  s
165
- ]), R(() => {
166
+ ]), U(() => {
166
167
  u.length !== 0 && (T(u, !1), d?.());
167
168
  }, [
168
169
  T,
169
170
  d,
170
171
  u
171
- ]), R(() => {
172
+ ]), U(() => {
172
173
  if (!o) return;
173
174
  let t = !1, n = [], r = v.current.map((r) => {
174
175
  if (r.status === a.Loading) return r;
@@ -195,7 +196,7 @@ var H = {
195
196
  S,
196
197
  w
197
198
  ]);
198
- let D = L((e) => {
199
+ let D = H((e) => {
199
200
  S((t) => {
200
201
  let n = t.find((t) => t.id === e);
201
202
  return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), n?.playUrl && URL.revokeObjectURL(n.playUrl), t.filter((t) => t.id !== e);
@@ -207,11 +208,11 @@ var H = {
207
208
  addAttachments: T,
208
209
  resetAttachments: C,
209
210
  handleRemove: D,
210
- handleRetry: L((e) => {
211
+ handleRetry: H((e) => {
211
212
  let t = g.find((t) => t.id === e);
212
213
  t && w(t);
213
214
  }, [g, w]),
214
- handleExpand: L(async (e) => {
215
+ handleExpand: H(async (e) => {
215
216
  let n = g.find((t) => t.id === e);
216
217
  if (!n || n.type !== t.Pasted) return;
217
218
  let r = await n.file.text();
@@ -223,39 +224,31 @@ var H = {
223
224
  ]),
224
225
  hasBlockedAttachments: g.some((e) => e.status === a.Loading || e.status === a.Error)
225
226
  };
226
- }, je = (e, t) => {
227
+ }, Re = (e, t) => {
227
228
  let n = t;
228
229
  for (; n < e.length && !/\s/.test(e[n]);) n++;
229
230
  return n;
230
- }, Me = (e, t) => {
231
+ }, ze = (e, t) => {
231
232
  let n = t;
232
233
  for (; n > 0 && !/\s/.test(e[n - 1]);) n--;
233
234
  return {
234
235
  start: n,
235
- end: je(e, n)
236
+ end: Re(e, n)
236
237
  };
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
+ }, Be = (e, t) => e.startsWith(t) && !e.slice(t.length).includes(t), Ve = "[role=\"option\"]:not([aria-disabled=\"true\"])", He = /* @__PURE__ */ function(e) {
238
239
  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);
240
+ }({}), Ue = ({ config: e, message: t }) => {
241
+ let [n, r] = K(!1), [i, a] = K(null), [o, s] = K(null), c = G(null);
241
242
  c.current = i;
242
243
  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) => {
244
+ let n = t.slice(i, Re(t, i));
245
+ return Be(n, e.triggerPrefix) ? n.slice(e.triggerPrefix.length) : "";
246
+ })() : "", u = H((t, n, i) => {
246
247
  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);
248
+ let { start: c, end: l } = ze(t, n), u = t.slice(c, l);
249
+ Be(u, e.triggerPrefix) ? (a(c), u === e.triggerPrefix || o !== c ? (r(!0), s(null)) : r(!1)) : (r(!1), s(null), a(null));
257
250
  }, [e, o]);
258
- R(() => {
251
+ U(() => {
259
252
  if (e == null) {
260
253
  r(!1), s(null), a(null);
261
254
  return;
@@ -263,29 +256,25 @@ var H = {
263
256
  let n = c.current;
264
257
  if (n == null) return;
265
258
  let i = Math.min(n, t.length);
266
- W(t.slice(i, je(t, i)), e.triggerPrefix) || (r(!1), s(null), a(null));
259
+ Be(t.slice(i, Re(t, i)), e.triggerPrefix) || (r(!1), s(null), a(null));
267
260
  }, [e, t]);
268
- let d = L(() => {
261
+ let d = H(() => {
269
262
  r(!1), s(i);
270
- }, [i]), f = L(() => {
263
+ }, [i]), f = H(() => {
271
264
  r(!1);
272
- }, []), p = L((n) => {
265
+ }, []), p = H((n) => {
273
266
  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);
267
+ let { start: i, end: s } = ze(t, n);
268
+ Be(t.slice(i, s), e.triggerPrefix) ? (a(i), r(o !== i)) : (a(null), r(!1));
280
269
  }, [
281
270
  e,
282
271
  t,
283
272
  o
284
- ]), m = Te(), h = B(null), [g, _] = V(null);
285
- R(() => {
273
+ ]), m = Ae(), h = G(null), [g, _] = K(null);
274
+ U(() => {
286
275
  _(null);
287
276
  }, [n, l]);
288
- let v = L(() => Array.from(h.current?.querySelectorAll(Ne) ?? []), []), y = L((e) => {
277
+ let v = H(() => Array.from(h.current?.querySelectorAll(Ve) ?? []), []), y = H((e) => {
289
278
  let t = v();
290
279
  if (t.length === 0) {
291
280
  _(null);
@@ -293,7 +282,7 @@ var H = {
293
282
  }
294
283
  let n = t.findIndex((e) => e.id === g), r = t[e === "next" ? (n + 1) % t.length : (n <= 0 ? t.length : n) - 1];
295
284
  _(r.id), r.scrollIntoView?.({ block: "nearest" });
296
- }, [v, g]), b = L(() => v().find((e) => e.id === g) ?? null, [v, g]);
285
+ }, [v, g]), b = H(() => v().find((e) => e.id === g) ?? null, [v, g]);
297
286
  return {
298
287
  isMenuOpen: n,
299
288
  query: l,
@@ -308,18 +297,18 @@ var H = {
308
297
  moveActiveOption: y,
309
298
  getActiveOption: b
310
299
  };
311
- }, Ie = (e, t) => !e.slice(0, t).includes("\n"), Le = (e, t) => !e.slice(t).includes("\n"), Re = (e) => {
312
- let t = B(e);
300
+ }, We = (e, t) => !e.slice(0, t).includes("\n"), Ge = (e, t) => !e.slice(t).includes("\n"), Ke = (e) => {
301
+ let t = G(e);
313
302
  t.current = e;
314
- let n = B(-1), r = B(""), i = L((e, i, a) => {
303
+ let n = G(-1), r = G(""), i = H((e, i, a) => {
315
304
  let o = t.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
- }, []), a = L(() => {
305
+ return !o || o.length === 0 ? null : e === "up" ? !We(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 || !Ge(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
306
+ }, []), a = H(() => {
318
307
  n.current = -1, r.current = "";
319
- }, []), o = L(() => {
308
+ }, []), o = H(() => {
320
309
  n.current = -1, r.current = "";
321
310
  }, []);
322
- return z(() => ({
311
+ return W(() => ({
323
312
  navigate: i,
324
313
  notifyChange: a,
325
314
  reset: o
@@ -328,16 +317,16 @@ var H = {
328
317
  a,
329
318
  o
330
319
  ]);
331
- }, ze = (e, t, n, r, i) => {
320
+ }, qe = (e, t, n, r, i) => {
332
321
  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
322
  if (n <= t) return;
334
323
  let r = t;
335
324
  o.filter((e) => e.offset >= t && e.offset <= n).forEach((t) => {
336
- t.offset > r && s.push(/* @__PURE__ */ P("span", {
325
+ t.offset > r && s.push(/* @__PURE__ */ B("span", {
337
326
  "aria-hidden": !0,
338
327
  children: e.slice(r, t.offset)
339
328
  }, `text-${l++}`)), s.push(t.node), r = t.offset;
340
- }), r < n && s.push(/* @__PURE__ */ P("span", {
329
+ }), r < n && s.push(/* @__PURE__ */ B("span", {
341
330
  "aria-hidden": !0,
342
331
  children: e.slice(r, n)
343
332
  }, `text-${l++}`));
@@ -345,16 +334,16 @@ var H = {
345
334
  return a.forEach((t, n) => {
346
335
  if (u(c, t.start), t.start + t.length <= c) return;
347
336
  let a = e.slice(t.start, t.start + t.length);
348
- s.push(t.render ? /* @__PURE__ */ P("span", {
337
+ s.push(t.render ? /* @__PURE__ */ B("span", {
349
338
  className: "pointer-events-auto",
350
339
  children: t.render()
351
- }, `range-${n}`) : /* @__PURE__ */ P("span", {
340
+ }, `range-${n}`) : /* @__PURE__ */ B("span", {
352
341
  "aria-hidden": !0,
353
342
  className: t.isUnsupported ? i : r,
354
343
  children: a
355
344
  }, `range-${n}`)), c = Math.max(c, t.start + t.length);
356
345
  }), u(c, e.length), s;
357
- }, Be = (e, t) => {
346
+ }, Je = (e, t) => {
358
347
  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
348
  for (let e = n.nextNode(); e != null; e = n.nextNode()) {
360
349
  let n = e.textContent?.length ?? 0;
@@ -365,24 +354,24 @@ var H = {
365
354
  r += n;
366
355
  }
367
356
  return null;
368
- }, Ve = (e, t, n) => {
369
- let r = Be(e, t), i = Be(e, n);
357
+ }, Ye = (e, t, n) => {
358
+ let r = Je(e, t), i = Je(e, n);
370
359
  if (r == null || i == null) return null;
371
360
  let a = document.createRange();
372
361
  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(() => {
362
+ }, Xe = ({ textareaRef: e, message: t, isMirrorActive: n }) => {
363
+ let r = G(null), [i, a] = K([]), o = H(() => {
375
364
  let t = e.current, n = r.current;
376
365
  if (t == null || n == null) return;
377
366
  let i = t.offsetWidth > t.clientWidth;
378
367
  n.style.scrollbarGutter = i ? "stable" : "", n.scrollTop = t.scrollTop;
379
- }, [e]), s = L(() => {
368
+ }, [e]), s = H(() => {
380
369
  let t = e.current, i = r.current, o = t?.selectionStart, s = t?.selectionEnd;
381
370
  if (!n || t == null || i == null || o == null || s == null || o === s) {
382
371
  a((e) => e.length === 0 ? e : []);
383
372
  return;
384
373
  }
385
- let c = Ve(i, o, s);
374
+ let c = Ye(i, o, s);
386
375
  if (c == null) {
387
376
  a((e) => e.length === 0 ? e : []);
388
377
  return;
@@ -390,14 +379,14 @@ var H = {
390
379
  let l = i.getBoundingClientRect();
391
380
  a(Array.from(c.getClientRects()).map((e) => new DOMRect(e.left - l.left, e.top - l.top + i.scrollTop, e.width, e.height)));
392
381
  }, [n, e]);
393
- return De(() => {
382
+ return Me(() => {
394
383
  n && o(), s();
395
384
  }, [
396
385
  n,
397
386
  o,
398
387
  s,
399
388
  t
400
- ]), R(() => {
389
+ ]), U(() => {
401
390
  if (!n) return;
402
391
  let t = e.current;
403
392
  if (t == null || typeof ResizeObserver > "u") return;
@@ -416,53 +405,64 @@ var H = {
416
405
  updateSelectionRects: s,
417
406
  syncMirrorToTextarea: o
418
407
  };
419
- }, Ue = ({ messageProp: e, messageRevision: t }) => {
420
- let [n, r] = V(e), i = B(null);
421
- return R(() => {
408
+ }, Ze = ({ messageProp: e, messageRevision: t }) => {
409
+ let [n, r] = K(e), i = G(null);
410
+ return U(() => {
422
411
  r(e);
423
412
  }, [e, t]), {
424
413
  message: n,
425
414
  setMessage: r,
426
415
  textareaRef: i
427
416
  };
428
- }, We = (e, t, n, r = n) => {
417
+ }, Qe = (e, t, n, r = n) => {
429
418
  let i = Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, "value")?.set;
430
419
  i ? i.call(e, t) : e.value = t, e.setSelectionRange(n, r), e.dispatchEvent(new Event("input", { bubbles: !0 }));
431
- }, Ge = (e) => e.key.toLowerCase() === "z" && (e.ctrlKey || e.metaKey) && !e.shiftKey && !e.altKey, Ke = ({ insertion: e, textareaRef: t }) => {
432
- let n = e?.revision, r = B(e?.text);
420
+ }, $e = (e) => e.key.toLowerCase() === "z" && (e.ctrlKey || e.metaKey) && !e.shiftKey && !e.altKey, et = ({ insertion: e, textareaRef: t }) => {
421
+ let n = e?.revision, r = G(e?.text);
433
422
  r.current = e?.text;
434
- let i = B(n), a = B(null);
435
- return R(() => {
423
+ let i = G(n), a = G(null), o = G(!1);
424
+ return U(() => {
425
+ document.activeElement === t.current && (o.current = !0);
426
+ let e = (e) => {
427
+ e.target === t.current && (o.current = !0);
428
+ };
429
+ return document.addEventListener("focusin", e), () => document.removeEventListener("focusin", e);
430
+ }, [t]), U(() => {
436
431
  if (n === i.current) return;
437
432
  i.current = n;
438
433
  let e = r.current;
439
- !t.current || !e || queueMicrotask(() => {
434
+ t.current && e && queueMicrotask(() => {
440
435
  let n = t.current;
441
436
  if (!n) return;
442
- let { value: r, selectionStart: i, selectionEnd: o } = n, s = i ?? r.length, c = o ?? s;
443
- if (n.focus(), a.current = null, typeof document.execCommand == "function" && document.execCommand("insertText", !1, e)) return;
444
- let l = `${r.slice(0, s)}${e}${r.slice(c)}`;
445
- We(n, l, s + e.length), a.current = {
446
- insertedValue: l,
437
+ let { value: r, selectionStart: i, selectionEnd: s } = n, c = !o.current && r.length > 0 && i === 0 && s === 0, l = c ? r.length : i ?? r.length, u = c ? l : s ?? l;
438
+ if (n.focus(), c && n.setSelectionRange(l, u), a.current = null, typeof document.execCommand == "function" && document.execCommand("insertText", !1, e)) return;
439
+ let d = `${r.slice(0, l)}${e}${r.slice(u)}`;
440
+ Qe(n, d, l + e.length), a.current = {
441
+ insertedValue: d,
447
442
  previousValue: r,
448
- previousSelectionStart: s,
449
- previousSelectionEnd: c
443
+ previousSelectionStart: l,
444
+ previousSelectionEnd: u
450
445
  };
451
446
  });
452
- }, [n, t]), { handleUndoKeyDown: (e) => {
453
- let n = a.current, r = t.current;
454
- return n == null || r == null || !Ge(e) || (a.current = null, r.value !== n.insertedValue) ? !1 : (e.preventDefault(), We(r, n.previousValue, n.previousSelectionStart, n.previousSelectionEnd), !0);
455
- } };
456
- }, qe = /* @__PURE__ */ function(e) {
447
+ }, [n, t]), {
448
+ handleUndoKeyDown: (e) => {
449
+ let n = a.current, r = t.current;
450
+ return n == null || r == null || !$e(e) || (a.current = null, r.value !== n.insertedValue) ? !1 : (e.preventDefault(), Qe(r, n.previousValue, n.previousSelectionStart, n.previousSelectionEnd), !0);
451
+ },
452
+ markCaretPlaced: () => {
453
+ o.current = !0;
454
+ }
455
+ };
456
+ }, tt = /* @__PURE__ */ function(e) {
457
457
  return e.Idle = "idle", e.Recording = "recording", e.Processing = "processing", e.Error = "error", e;
458
- }({}), Je = /* @__PURE__ */ function(e) {
458
+ }({}), nt = /* @__PURE__ */ function(e) {
459
459
  return e.Dictation = "dictation", e.Attachment = "attachment", e;
460
- }({}), Ye = [
460
+ }({}), rt = [
461
461
  "audio/webm;codecs=opus",
462
462
  "audio/ogg;codecs=opus",
463
463
  "audio/webm"
464
- ], Xe = 100, Ze = 100, Qe = .01, $e = ({ onAttachAudio: e, onTranscribeAudio: t, onTranscript: n, errorLabel: i = "Voice input failed" }) => {
465
- let [a, o] = V("idle"), [s, c] = V(null), l = B(null), d = B(null), f = B({
464
+ ], it = 100, at = 100, ot = .01, st = ({ onAttachAudio: e, onTranscribeAudio: t, onTranscript: n, errorLabel: i = "Voice input failed" }) => {
465
+ let [a, o] = K("idle"), [s, c] = K(null), l = G(null), d = G(null), f = G({
466
466
  onAttachAudio: e,
467
467
  onTranscribeAudio: t,
468
468
  onTranscript: n,
@@ -474,7 +474,7 @@ var H = {
474
474
  onTranscript: n,
475
475
  errorLabel: i
476
476
  };
477
- let p = L((e = "dictation") => {
477
+ let p = H((e = "dictation") => {
478
478
  if (d.current) return;
479
479
  let t = { controller: new AbortController() };
480
480
  d.current = t, c(null), o("recording");
@@ -492,7 +492,7 @@ var H = {
492
492
  n.aborted || (t.controller.abort(), d.current = null, c(e instanceof Error ? e.message : f.current.errorLabel), o("error"));
493
493
  }, S = () => {
494
494
  if (!a || n.aborted) return;
495
- let e = Ye.find((e) => MediaRecorder.isTypeSupported(e)), t = new MediaRecorder(a, e ? { mimeType: e } : void 0);
495
+ let e = rt.find((e) => MediaRecorder.isTypeSupported(e)), t = new MediaRecorder(a, e ? { mimeType: e } : void 0);
496
496
  p = t;
497
497
  let s = Date.now(), c = !1, d = !1, S = new Uint8Array(l.current?.fftSize ?? 256), C = async () => {
498
498
  if (!(g || n.aborted)) {
@@ -500,7 +500,7 @@ var H = {
500
500
  try {
501
501
  let a = t.mimeType || e || "audio/webm", l = new Blob(_, { type: a });
502
502
  _.length = 0, y();
503
- let p = Date.now() - s >= Ze;
503
+ let p = Date.now() - s >= at;
504
504
  if (l.size && (!i || p && (!c || d))) {
505
505
  let e = u(a), t = r[e] ?? e.split("/")[1] ?? "webm", s = new File([l], "voice-" + crypto.randomUUID() + "." + t, { type: a });
506
506
  if (i) {
@@ -526,8 +526,8 @@ var H = {
526
526
  e.getByteTimeDomainData(S), c = !0;
527
527
  let t = 0;
528
528
  for (let e of S) t += ((e - 128) / 128) ** 2;
529
- Math.sqrt(t / S.length) >= Qe && (d = !0, v());
530
- }, Xe));
529
+ Math.sqrt(t / S.length) >= ot && (d = !0, v());
530
+ }, it));
531
531
  };
532
532
  t.stop = () => {
533
533
  h || n.aborted || (h = !0, v(), o("processing"), p?.state === "recording" && p.stop());
@@ -545,10 +545,10 @@ var H = {
545
545
  x(e);
546
546
  }
547
547
  })();
548
- }, []), m = L(() => d.current?.stop?.(), []), h = L(() => {
548
+ }, []), m = H(() => d.current?.stop?.(), []), h = H(() => {
549
549
  d.current?.controller.abort(), d.current = null, c(null), o("idle");
550
550
  }, []);
551
- return R(() => () => {
551
+ return U(() => () => {
552
552
  d.current?.controller.abort(), d.current = null;
553
553
  }, []), {
554
554
  state: a,
@@ -558,23 +558,23 @@ var H = {
558
558
  stopRecording: m,
559
559
  discardRecording: h
560
560
  };
561
- }, et = /* @__PURE__ */ function(e) {
561
+ }, ct = /* @__PURE__ */ function(e) {
562
562
  return e.Enter = "enter", e.MetaEnter = "meta-enter", e;
563
- }({}), tt = /* @__PURE__ */ function(e) {
563
+ }({}), lt = /* @__PURE__ */ function(e) {
564
564
  return e.Stacked = "stacked", e.Inline = "inline", e;
565
- }({}), nt = {
565
+ }({}), ut = {
566
566
  item: "_item_1sr2n_1",
567
567
  itemIcon: "_itemIcon_1sr2n_11"
568
- }, rt = ({ isOpen: e, title: t, closeLabel: n, onClose: r, style: i, items: a, className: o, titleClassName: s = "dial-body-semi-text", itemLabelClassName: u = "dial-small-text", btnTextClassName: d = "", colors: f }) => {
568
+ }, dt = ({ isOpen: e, title: t, closeLabel: n, onClose: r, style: i, items: a, className: o, titleClassName: s = "dial-body-semi-text", itemLabelClassName: u = "dial-small-text", btnTextClassName: d = "", colors: f }) => {
569
569
  let p = (e) => {
570
570
  e(), r();
571
- }, h = c({
571
+ }, m = c({
572
572
  "--ci-sheet-text": f?.itemText,
573
573
  "--ci-sheet-item-hover": f?.itemHoverBg,
574
574
  "--ci-sheet-item-active": f?.itemActiveBg,
575
575
  "--ci-sheet-icon": f?.itemIcon
576
576
  });
577
- return /* @__PURE__ */ P(U, {
577
+ return /* @__PURE__ */ B(Fe, {
578
578
  isOpen: e,
579
579
  title: t,
580
580
  closeLabel: n,
@@ -583,23 +583,23 @@ var H = {
583
583
  className: o,
584
584
  titleClassName: s,
585
585
  colors: f?.shell,
586
- children: /* @__PURE__ */ P("ul", {
586
+ children: /* @__PURE__ */ B("ul", {
587
587
  role: "list",
588
588
  className: "flex flex-col",
589
- style: h,
590
- children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ P("li", { children: /* @__PURE__ */ P(m, {
589
+ style: m,
590
+ children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ B("li", { children: /* @__PURE__ */ B(h, {
591
591
  type: "button",
592
- className: l(nt.item, "w-full gap-3 px-4 py-[10px] text-start"),
593
- iconBefore: /* @__PURE__ */ P("span", {
594
- className: nt.itemIcon,
592
+ className: l(ut.item, "w-full gap-3 px-4 py-[10px] text-start"),
593
+ iconBefore: /* @__PURE__ */ B("span", {
594
+ className: ut.itemIcon,
595
595
  children: n
596
596
  }),
597
- iconAfter: r ? /* @__PURE__ */ P("span", {
597
+ iconAfter: r ? /* @__PURE__ */ B("span", {
598
598
  className: "ms-auto",
599
599
  children: r
600
600
  }) : null,
601
601
  textClassName: d,
602
- label: /* @__PURE__ */ P("span", {
602
+ label: /* @__PURE__ */ B("span", {
603
603
  className: u,
604
604
  children: t
605
605
  }),
@@ -607,9 +607,9 @@ var H = {
607
607
  }) }, e))
608
608
  })
609
609
  });
610
- }, it = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
611
- let [s, c] = V(t), [l, u] = V(n), [d, f] = V(r), p = B(o);
612
- R(() => {
610
+ }, ft = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
611
+ let [s, c] = K(t), [l, u] = K(n), [d, f] = K(r), p = G(o);
612
+ U(() => {
613
613
  o && !p.current && (c(t), u(n), f(r)), p.current = o;
614
614
  }, [
615
615
  o,
@@ -626,7 +626,7 @@ var H = {
626
626
  setResponseFormat: c,
627
627
  setSystemPrompt: u,
628
628
  setTemperature: f,
629
- handleSubmit: L(() => {
629
+ handleSubmit: H(() => {
630
630
  if (!m) return;
631
631
  let t = {};
632
632
  e.responseFormat && s != null && (t.responseFormat = s), e.systemPrompt && (t.systemPrompt = l), e.temperature && (t.temperature = d), i(t), a();
@@ -640,17 +640,17 @@ var H = {
640
640
  a
641
641
  ])
642
642
  };
643
- }, at = { label: "_label_14i7c_1" }, ot = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: a, onSystemPromptChange: s, onTemperatureChange: u, responseFormatLabel: d = "Response format", responseFormatHint: f = "Applies to new and existing messages", responseFormatMarkdownLabel: p = "Markdown", responseFormatPlainTextLabel: m = "Plain text", systemPromptLabel: h = "System prompt", systemPromptTooltip: g = "Enter a prompt", temperatureLabel: _ = "Temperature", temperatureLabels: v = [
643
+ }, pt = { label: "_label_14i7c_1" }, J = ({ 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 = [
644
644
  "Precise",
645
645
  "Neutral",
646
646
  "Creative"
647
647
  ], temperatureHint: y, labelClassName: b = "!dial-small-semi-text", colors: x }) => {
648
- let S = c({ "--csf-label-text": x?.labelText }), C = l(b, at.label, "gap-1");
649
- return /* @__PURE__ */ F("div", {
648
+ let S = c({ "--csf-label-text": x?.labelText }), C = l(b, pt.label, "gap-1");
649
+ return /* @__PURE__ */ V("div", {
650
650
  className: "flex flex-col gap-4 px-6 pb-3",
651
651
  style: S,
652
652
  children: [
653
- e.responseFormat && /* @__PURE__ */ P(k, {
653
+ e.responseFormat && /* @__PURE__ */ B(F, {
654
654
  id: "response-format",
655
655
  labelProps: {
656
656
  label: d,
@@ -658,7 +658,7 @@ var H = {
658
658
  caption: f
659
659
  },
660
660
  optionsClassName: "mb-2",
661
- orientation: A.Column,
661
+ orientation: I.Column,
662
662
  value: t ?? o.Markdown,
663
663
  items: [{
664
664
  value: o.Markdown,
@@ -669,7 +669,7 @@ var H = {
669
669
  }],
670
670
  onChange: (e) => a(e)
671
671
  }),
672
- e.systemPrompt && /* @__PURE__ */ P(ae, {
672
+ e.systemPrompt && /* @__PURE__ */ B(ae, {
673
673
  value: n,
674
674
  placeholder: g,
675
675
  className: i,
@@ -680,7 +680,7 @@ var H = {
680
680
  },
681
681
  onChange: (e) => s(e ?? "")
682
682
  }),
683
- e.temperature && /* @__PURE__ */ P(re, {
683
+ e.temperature && /* @__PURE__ */ B(z, {
684
684
  labelProps: {
685
685
  label: _,
686
686
  className: C,
@@ -697,8 +697,8 @@ var H = {
697
697
  })
698
698
  ]
699
699
  });
700
- }, st = ({ isOpen: e, onBack: t, backLabel: n, onClose: r, closeLabel: i, style: a, features: o, initialResponseFormat: s, initialSystemPrompt: c, initialTemperature: u, onSave: d, title: f = "Chat settings", responseFormatLabel: p, responseFormatHint: m, responseFormatMarkdownLabel: h, responseFormatPlainTextLabel: g, systemPromptLabel: _, systemPromptTooltip: v, temperatureLabel: y, temperatureLabels: b, temperatureHint: x, saveLabel: S = "Apply changes", saveDisabledTooltip: C }) => {
701
- let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat: O, setSystemPrompt: k, setTemperature: A, handleSubmit: j } = it({
700
+ }, mt = ({ isOpen: e, onBack: t, backLabel: n, onClose: r, closeLabel: i, style: a, features: o, initialResponseFormat: s, initialSystemPrompt: c, initialTemperature: u, onSave: d, title: f = "Chat settings", responseFormatLabel: p, responseFormatHint: m, responseFormatMarkdownLabel: h, responseFormatPlainTextLabel: g, systemPromptLabel: _, systemPromptTooltip: v, temperatureLabel: y, temperatureLabels: b, temperatureHint: x, saveLabel: S = "Apply changes", saveDisabledTooltip: C }) => {
701
+ let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat: ee, setSystemPrompt: O, setTemperature: k, handleSubmit: A } = ft({
702
702
  isOpen: e,
703
703
  features: o,
704
704
  initialResponseFormat: s,
@@ -707,7 +707,7 @@ var H = {
707
707
  onSave: d,
708
708
  onClose: r
709
709
  });
710
- return /* @__PURE__ */ F(U, {
710
+ return /* @__PURE__ */ V(Fe, {
711
711
  isOpen: e,
712
712
  title: f,
713
713
  closeLabel: i,
@@ -715,14 +715,14 @@ var H = {
715
715
  onBack: t,
716
716
  backLabel: n,
717
717
  style: a,
718
- children: [/* @__PURE__ */ P(ot, {
718
+ children: [/* @__PURE__ */ B(J, {
719
719
  features: o,
720
720
  responseFormat: w,
721
721
  systemPrompt: T,
722
722
  temperature: E,
723
- onResponseFormatChange: O,
724
- onSystemPromptChange: k,
725
- onTemperatureChange: A,
723
+ onResponseFormatChange: ee,
724
+ onSystemPromptChange: O,
725
+ onTemperatureChange: k,
726
726
  responseFormatLabel: p,
727
727
  responseFormatHint: m,
728
728
  responseFormatMarkdownLabel: h,
@@ -732,23 +732,23 @@ var H = {
732
732
  temperatureLabel: y,
733
733
  temperatureLabels: b,
734
734
  temperatureHint: x
735
- }), /* @__PURE__ */ P("div", {
735
+ }), /* @__PURE__ */ B("div", {
736
736
  className: l("px-6 py-4 mobile:pb-8"),
737
- children: /* @__PURE__ */ P(M, {
737
+ children: /* @__PURE__ */ B(ce, {
738
738
  tooltip: C,
739
739
  hideTooltip: D || !C,
740
740
  triggerClassName: "w-full",
741
- children: /* @__PURE__ */ P(ee, {
741
+ children: /* @__PURE__ */ B(ne, {
742
742
  label: S,
743
- onClick: j,
743
+ onClick: A,
744
744
  disabled: !D,
745
745
  className: "w-full"
746
746
  })
747
747
  })
748
748
  })]
749
749
  });
750
- }, ct = { modal: "_modal_kl0h0_1" }, lt = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", titleClassName: s = "dial-h1-text", responseFormatLabel: c, responseFormatHint: l, responseFormatMarkdownLabel: u, responseFormatPlainTextLabel: d, systemPromptLabel: f, systemPromptTooltip: p, temperatureLabel: m, temperatureLabels: g, temperatureHint: _, saveLabel: v = "Apply changes", saveDisabledTooltip: y, backgroundClassName: b = ct.modal }) => {
751
- let { responseFormat: x, systemPrompt: S, temperature: C, canSubmit: w, setResponseFormat: T, setSystemPrompt: ee, setTemperature: O, handleSubmit: k } = it({
750
+ }, ht = { modal: "_modal_kl0h0_1" }, gt = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", titleClassName: s = "dial-h1-text", responseFormatLabel: l, responseFormatHint: u, responseFormatMarkdownLabel: d, responseFormatPlainTextLabel: f, systemPromptLabel: p, systemPromptTooltip: m, temperatureLabel: h, temperatureLabels: _, temperatureHint: v, saveLabel: y = "Apply changes", saveDisabledTooltip: b, backgroundClassName: x = ht.modal, colors: S }) => {
751
+ let { responseFormat: C, systemPrompt: w, temperature: T, canSubmit: E, setResponseFormat: D, setSystemPrompt: ee, setTemperature: O, handleSubmit: k } = ft({
752
752
  features: e,
753
753
  initialResponseFormat: t,
754
754
  initialSystemPrompt: n,
@@ -756,431 +756,473 @@ var H = {
756
756
  onSave: i,
757
757
  onClose: a
758
758
  });
759
- return /* @__PURE__ */ P(E, {
759
+ return /* @__PURE__ */ B(N, {
760
760
  open: !0,
761
761
  header: o,
762
762
  titleClassName: s,
763
- size: D.Sm,
763
+ size: te.Sm,
764
764
  onClose: a,
765
- className: b,
765
+ className: x,
766
+ overlayStyle: c({ "--csm-bg": S?.background }),
766
767
  mainButtons: [{
767
- label: v,
768
- variant: h.Primary,
768
+ label: y,
769
+ variant: g.Primary,
769
770
  onClick: k,
770
- disabled: !w,
771
- tooltipProps: y ? {
772
- tooltip: y,
773
- hideTooltip: w
771
+ disabled: !E,
772
+ tooltipProps: b ? {
773
+ tooltip: b,
774
+ hideTooltip: E
774
775
  } : void 0
775
776
  }],
776
- children: /* @__PURE__ */ P(ot, {
777
+ children: /* @__PURE__ */ B(J, {
777
778
  features: e,
778
- responseFormat: x,
779
- systemPrompt: S,
780
- temperature: C,
781
- onResponseFormatChange: T,
779
+ responseFormat: C,
780
+ systemPrompt: w,
781
+ temperature: T,
782
+ onResponseFormatChange: D,
782
783
  onSystemPromptChange: ee,
783
784
  onTemperatureChange: O,
784
- responseFormatLabel: c,
785
- responseFormatHint: l,
786
- responseFormatMarkdownLabel: u,
787
- responseFormatPlainTextLabel: d,
788
- systemPromptLabel: f,
789
- systemPromptTooltip: p,
790
- temperatureLabel: m,
791
- temperatureLabels: g,
792
- temperatureHint: _
785
+ responseFormatLabel: l,
786
+ responseFormatHint: u,
787
+ responseFormatMarkdownLabel: d,
788
+ responseFormatPlainTextLabel: f,
789
+ systemPromptLabel: p,
790
+ systemPromptTooltip: m,
791
+ temperatureLabel: h,
792
+ temperatureLabels: _,
793
+ temperatureHint: v
793
794
  })
794
795
  });
795
- }, ut = {
796
+ }, _t = {
796
797
  icon: "_icon_1fv6z_1",
797
798
  selectedIcon: "_selectedIcon_1fv6z_5"
798
- }, dt = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel: i = "Close", style: a, title: o = "Tools", items: s, onToolToggle: u, itemLabelClassName: d = "dial-small-text", colors: p }) => /* @__PURE__ */ P(U, {
799
- isOpen: e,
800
- title: o,
801
- closeLabel: i,
802
- onClose: r,
803
- onBack: t,
804
- backLabel: n,
805
- style: a,
806
- children: /* @__PURE__ */ P("ul", {
807
- role: "menu",
808
- className: "flex flex-col pb-4",
809
- style: c({
810
- "--tbs-icon-text": p?.iconText,
811
- "--tbs-selected-icon-text": p?.selectedIconText
812
- }),
813
- children: s.map((e) => /* @__PURE__ */ P("li", {
814
- role: "none",
815
- children: /* @__PURE__ */ P(m, {
816
- type: "button",
817
- role: "menuitemcheckbox",
818
- "aria-checked": e.isSelected,
819
- className: "w-full gap-3 px-4 py-[10px] text-start",
820
- iconBefore: /* @__PURE__ */ P("span", {
821
- className: l("flex items-center", ut.icon),
822
- children: e.icon
823
- }),
824
- iconAfter: e.isSelected ? /* @__PURE__ */ P("span", {
825
- className: l("ms-auto", ut.selectedIcon),
826
- children: /* @__PURE__ */ P(de, {
827
- size: f,
828
- "aria-hidden": !0,
829
- stroke: _
830
- })
831
- }) : null,
832
- label: /* @__PURE__ */ P("span", {
833
- className: d,
834
- children: e.label
835
- }),
836
- onClick: () => u(e.id)
837
- })
838
- }, e.id))
839
- })
840
- }), ft = {
799
+ }, vt = ({ 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: f }) => {
800
+ let m = c({
801
+ "--tbs-icon-text": f?.iconText,
802
+ "--tbs-selected-icon-text": f?.selectedIconText
803
+ });
804
+ return /* @__PURE__ */ B(Fe, {
805
+ isOpen: e,
806
+ title: o,
807
+ closeLabel: i,
808
+ onClose: r,
809
+ onBack: t,
810
+ backLabel: n,
811
+ style: a,
812
+ children: /* @__PURE__ */ B("ul", {
813
+ role: "menu",
814
+ className: "flex flex-col pb-4",
815
+ style: m,
816
+ children: s.map((e) => /* @__PURE__ */ B("li", {
817
+ role: "none",
818
+ children: /* @__PURE__ */ B(h, {
819
+ type: "button",
820
+ role: "menuitemcheckbox",
821
+ "aria-checked": e.isSelected,
822
+ className: "w-full gap-3 px-4 py-[10px] text-start",
823
+ iconBefore: /* @__PURE__ */ B("span", {
824
+ className: l("flex items-center", _t.icon),
825
+ children: e.icon
826
+ }),
827
+ iconAfter: e.isSelected ? /* @__PURE__ */ B("span", {
828
+ className: l("ms-auto", _t.selectedIcon),
829
+ children: /* @__PURE__ */ B(he, {
830
+ size: p,
831
+ "aria-hidden": !0,
832
+ stroke: y
833
+ })
834
+ }) : null,
835
+ label: /* @__PURE__ */ B("span", {
836
+ className: d,
837
+ children: e.label
838
+ }),
839
+ onClick: () => u(e.id)
840
+ })
841
+ }, e.id))
842
+ })
843
+ });
844
+ }, yt = {
841
845
  toolIcon: "_toolIcon_ma5s5_1",
842
846
  chevronIcon: "_chevronIcon_ma5s5_5"
843
- }, pt = ({ onAttachClick: e, onRecordVoice: t, recordVoiceLabel: n = "Record voice", attachLabel: r, addMenuTitle: i, menuTitle: a, menuCloseLabel: s, style: u, listClassName: p = "w-[240px]", isDisabled: m = !1, chatSettings: h, extraMenuItems: b, toolsMenuItems: S = [], onToolToggle: w, toolsMenuTitle: T = "Tools", toolsBackLabel: E = "Back", menuOverlays: D, getCaretPosition: ee, colors: O }) => {
844
- let k = d(), [A, j] = V(!1), [te, ne] = V(!1), [re, ie] = V(!1), [ae, oe] = V(null), [M, se] = V(!1), I = z(() => c({
847
+ }, bt = ({ onAttachClick: e, onRecordVoice: t, recordVoiceLabel: n = "Record voice", attachLabel: r, addMenuTitle: i, menuTitle: a, menuCloseLabel: s, style: u, listClassName: m = "w-[240px]", isDisabled: h = !1, chatSettings: g, extraMenuItems: _, toolsMenuItems: x = [], onToolToggle: S, toolsMenuTitle: w = "Tools", toolsBackLabel: T = "Back", menuOverlays: E, getCaretPosition: D, colors: O }) => {
848
+ let k = d(), A = f(), [j, M] = K(!1), N = G(0), [te, ne] = K(!1), [P, F] = K(!1), [I, L] = K(!1), [R, re] = K(null), z = H((e) => {
849
+ e && (N.current = 0), ne(e), e || (L(!1), re(null));
850
+ }, []), ie = G(A);
851
+ U(() => {
852
+ ie.current !== A && (ie.current = A, A ? (M(te && !I && R === null), ne(!1)) : (N.current = I || R !== null ? -1 : 0, ne(j || I || R !== null), M(!1)));
853
+ }, [
854
+ A,
855
+ te,
856
+ j,
857
+ I,
858
+ R
859
+ ]);
860
+ let ae = W(() => c({
845
861
  "--aab-tool-icon": O?.toolIcon,
846
862
  "--aab-chevron-icon": O?.chevronIcon
847
- }), [O?.toolIcon, O?.chevronIcon]), ce = S.length > 0 && w != null, le = D != null && D.length > 0, ue = z(() => S.map((e) => ({
863
+ }), [O?.toolIcon, O?.chevronIcon]), oe = x.length > 0 && S != null, se = W(() => x.map((e) => ({
848
864
  key: e.id,
849
865
  label: e.label,
850
- icon: /* @__PURE__ */ P("span", {
851
- style: I,
852
- className: l("flex items-center", ft.toolIcon),
866
+ icon: /* @__PURE__ */ B("span", {
867
+ style: ae,
868
+ className: l("flex items-center", yt.toolIcon),
853
869
  children: e.icon
854
870
  }),
855
871
  selectable: !0,
856
- mark: C.Check,
872
+ mark: ee.Check,
857
873
  checked: e.isSelected,
858
- onClick: () => w?.(e.id)
874
+ onClick: () => S?.(e.id)
859
875
  })), [
876
+ x,
860
877
  S,
861
- w,
862
- I
863
- ]), de = z(() => [
878
+ ae
879
+ ]), ce = W(() => [
864
880
  ...e == null ? [] : [{
865
881
  key: "attach",
866
882
  label: r,
867
- icon: /* @__PURE__ */ P(ge, {
868
- size: f,
883
+ icon: /* @__PURE__ */ B(be, {
884
+ size: p,
869
885
  "aria-hidden": !0,
870
- stroke: _
886
+ stroke: y
871
887
  }),
872
888
  onClick: e
873
889
  }],
874
- ...b ?? [],
875
- ...ce ? [{
890
+ ..._ ?? [],
891
+ ...oe ? [{
876
892
  key: "tools",
877
- label: T,
878
- icon: /* @__PURE__ */ P(be, {
879
- size: f,
893
+ label: w,
894
+ icon: /* @__PURE__ */ B(we, {
895
+ size: p,
880
896
  "aria-hidden": !0,
881
- stroke: _
897
+ stroke: y
882
898
  }),
883
- onClick: k ? () => {
884
- ie(!0), j(!1);
899
+ onClick: A ? () => {
900
+ L(!0);
885
901
  } : () => void 0,
886
- ...k ? { iconAfter: /* @__PURE__ */ P(pe, {
887
- size: f,
888
- stroke: _,
889
- style: I,
890
- className: l("rtl:scale-x-[-1]", ft.chevronIcon),
902
+ ...A ? { iconAfter: /* @__PURE__ */ B(_e, {
903
+ size: p,
904
+ stroke: y,
905
+ style: ae,
906
+ className: l("rtl:scale-x-[-1]", yt.chevronIcon),
891
907
  "aria-hidden": !0
892
- }) } : { children: ue }
908
+ }) } : {
909
+ children: se,
910
+ subMenuOpen: I,
911
+ onSubMenuOpenChange: (e) => {
912
+ L(e), e && re(null);
913
+ }
914
+ }
893
915
  }] : [],
894
- ...(D ?? []).map((e) => ({
916
+ ...(E ?? []).map((e) => ({
895
917
  key: e.key,
896
918
  label: e.title,
897
919
  icon: e.icon,
898
- onClick: k ? () => {
899
- oe(e.key), j(!1);
920
+ onClick: A ? () => {
921
+ re(e.key);
900
922
  } : () => void 0,
901
- ...k ? { iconAfter: /* @__PURE__ */ P(pe, {
902
- size: f,
903
- stroke: _,
904
- style: I,
905
- className: l("rtl:scale-x-[-1]", ft.chevronIcon),
923
+ ...A ? { iconAfter: /* @__PURE__ */ B(_e, {
924
+ size: p,
925
+ stroke: y,
926
+ style: ae,
927
+ className: l("rtl:scale-x-[-1]", yt.chevronIcon),
906
928
  "aria-hidden": !0
907
929
  }) } : {
908
- children: [{
909
- key: `${e.key}-panel`,
910
- label: ""
911
- }],
912
- renderSubMenu: () => e.renderOverlay(() => se(!1), ee?.() ?? 0)
930
+ subMenuOpen: R === e.key,
931
+ onSubMenuOpenChange: (t) => {
932
+ re((n) => t ? e.key : n === e.key ? null : n), t && L(!1);
933
+ },
934
+ renderSubMenu: () => e.renderOverlay(() => z(!1), D?.() ?? 0)
913
935
  }
914
936
  })),
915
937
  ...t == null ? [] : [{
916
938
  key: "record-voice",
917
939
  label: n,
918
- icon: /* @__PURE__ */ P(he, {
919
- size: f,
940
+ icon: /* @__PURE__ */ B(ye, {
941
+ size: p,
920
942
  "aria-hidden": !0,
921
- stroke: _
943
+ stroke: y
922
944
  }),
923
945
  onClick: () => {
924
- j(!1), se(!1), t();
946
+ z(!1), t();
925
947
  }
926
948
  }],
927
- ...h == null ? [] : [{
949
+ ...g == null ? [] : [{
928
950
  key: "chat-settings",
929
- label: h.menuItemLabel ?? "Chat settings",
930
- icon: /* @__PURE__ */ P(ye, {
931
- size: f,
951
+ label: g.menuItemLabel ?? "Chat settings",
952
+ icon: /* @__PURE__ */ B(Ce, {
953
+ size: p,
932
954
  "aria-hidden": !0,
933
- stroke: _
955
+ stroke: y
934
956
  }),
935
- iconAfter: k ? /* @__PURE__ */ P(pe, {
936
- size: f,
937
- stroke: _,
938
- style: I,
939
- className: l("rtl:scale-x-[-1]", ft.chevronIcon),
957
+ iconAfter: k ? /* @__PURE__ */ B(_e, {
958
+ size: p,
959
+ stroke: y,
960
+ style: ae,
961
+ className: l("rtl:scale-x-[-1]", yt.chevronIcon),
940
962
  "aria-hidden": !0
941
963
  }) : null,
942
- onClick: () => ne(!0)
964
+ onClick: () => F(!0)
943
965
  }]
944
966
  ], [
967
+ z,
945
968
  r,
946
969
  e,
947
970
  t,
948
971
  n,
949
- h,
950
- b,
972
+ g,
973
+ _,
951
974
  k,
952
- ce,
953
- T,
954
- ue,
975
+ A,
976
+ oe,
977
+ I,
978
+ R,
979
+ w,
980
+ se,
981
+ E,
955
982
  D,
956
- ee,
957
- I
983
+ ae
958
984
  ]);
959
- if (de.length === 0) return null;
960
- let fe = /* @__PURE__ */ P(v, {
985
+ if (ce.length === 0) return null;
986
+ let ue = /* @__PURE__ */ B(b, {
961
987
  matchReferenceWidth: !1,
962
988
  placement: "bottom-start",
963
- listClassName: p,
964
- overlayContentClassName: "flex flex-col gap-1",
965
- items: de,
966
- disabled: m,
967
- open: le ? M : void 0,
968
- onOpenChange: le ? se : void 0,
969
- children: /* @__PURE__ */ P(x, {
970
- icon: /* @__PURE__ */ P(ve, {
971
- size: g.LG,
989
+ listClassName: m,
990
+ initialFocus: N.current,
991
+ overlayAriaLabel: i,
992
+ items: ce,
993
+ disabled: h,
994
+ open: te,
995
+ onOpenChange: z,
996
+ children: /* @__PURE__ */ B(C, {
997
+ icon: /* @__PURE__ */ B(Se, {
998
+ size: v.LG,
972
999
  "aria-hidden": !0,
973
- stroke: _
1000
+ stroke: y
974
1001
  }),
975
1002
  "aria-label": i,
1003
+ "aria-haspopup": "menu",
976
1004
  tooltipProps: { tooltip: i },
977
- disabled: m
1005
+ disabled: h
978
1006
  })
979
1007
  });
980
- return /* @__PURE__ */ P(N, { children: k ? /* @__PURE__ */ F(N, { children: [
981
- /* @__PURE__ */ P(x, {
982
- icon: /* @__PURE__ */ P(ve, {
983
- size: g.LG,
984
- "aria-hidden": !0,
985
- stroke: _
1008
+ return /* @__PURE__ */ V(le, { children: [
1009
+ A ? /* @__PURE__ */ V(le, { children: [
1010
+ /* @__PURE__ */ B(C, {
1011
+ icon: /* @__PURE__ */ B(Se, {
1012
+ size: v.LG,
1013
+ "aria-hidden": !0,
1014
+ stroke: y
1015
+ }),
1016
+ "aria-label": i,
1017
+ tooltipProps: { tooltip: i },
1018
+ disabled: h,
1019
+ onClick: () => M(!0)
986
1020
  }),
987
- "aria-label": i,
988
- size: y.Large,
989
- tooltipProps: { tooltip: i },
990
- disabled: m,
991
- onClick: () => j(!0)
992
- }),
993
- /* @__PURE__ */ P(rt, {
994
- isOpen: A,
995
- title: a,
996
- closeLabel: s,
997
- onClose: () => j(!1),
998
- style: u,
999
- items: de,
1000
- className: "pb-4",
1001
- btnTextClassName: "flex-1"
1002
- }),
1003
- ce && /* @__PURE__ */ P(dt, {
1004
- isOpen: re,
1021
+ /* @__PURE__ */ B(dt, {
1022
+ isOpen: j,
1023
+ title: a,
1024
+ closeLabel: s,
1025
+ onClose: () => M(!1),
1026
+ style: u,
1027
+ items: ce,
1028
+ className: "pb-4",
1029
+ btnTextClassName: "flex-1"
1030
+ }),
1031
+ oe && /* @__PURE__ */ B(vt, {
1032
+ isOpen: I,
1033
+ onBack: () => {
1034
+ L(!1), M(!0);
1035
+ },
1036
+ backLabel: T,
1037
+ onClose: () => z(!1),
1038
+ closeLabel: s,
1039
+ style: u,
1040
+ title: w,
1041
+ items: x,
1042
+ onToolToggle: S
1043
+ }),
1044
+ E?.map((e) => /* @__PURE__ */ B(Fe, {
1045
+ isOpen: R === e.key,
1046
+ title: e.title,
1047
+ closeLabel: s,
1048
+ onBack: () => {
1049
+ re(null), M(!0);
1050
+ },
1051
+ backLabel: e.backLabel ?? "Back",
1052
+ onClose: () => z(!1),
1053
+ style: u,
1054
+ children: /* @__PURE__ */ B("div", {
1055
+ role: "menu",
1056
+ "aria-label": e.title,
1057
+ children: e.renderOverlay(() => z(!1), D?.() ?? 0)
1058
+ })
1059
+ }, e.key))
1060
+ ] }) : /* @__PURE__ */ B(le, { children: ue }),
1061
+ k && g != null && /* @__PURE__ */ B(mt, {
1062
+ isOpen: P,
1005
1063
  onBack: () => {
1006
- ie(!1), j(!0);
1064
+ F(!1), A ? M(!0) : ne(!0);
1007
1065
  },
1008
- backLabel: E,
1009
- onClose: () => ie(!1),
1066
+ backLabel: g.backLabel ?? "Back",
1067
+ onClose: () => F(!1),
1010
1068
  closeLabel: s,
1011
1069
  style: u,
1012
- title: T,
1013
- items: S,
1014
- onToolToggle: w
1070
+ features: g.features,
1071
+ initialResponseFormat: g.responseFormat ?? o.Markdown,
1072
+ initialSystemPrompt: g.systemPrompt,
1073
+ initialTemperature: g.temperature,
1074
+ onSave: g.onSave,
1075
+ title: g.title,
1076
+ responseFormatLabel: g.responseFormatLabel,
1077
+ responseFormatHint: g.responseFormatHint,
1078
+ responseFormatMarkdownLabel: g.responseFormatMarkdownLabel,
1079
+ responseFormatPlainTextLabel: g.responseFormatPlainTextLabel,
1080
+ systemPromptLabel: g.systemPromptLabel,
1081
+ systemPromptTooltip: g.systemPromptTooltip,
1082
+ temperatureLabel: g.temperatureLabel,
1083
+ temperatureLabels: g.temperatureLabels,
1084
+ temperatureHint: g.temperatureHint,
1085
+ saveLabel: g.saveLabel,
1086
+ saveDisabledTooltip: g.saveDisabledTooltip
1015
1087
  }),
1016
- D?.map((e) => /* @__PURE__ */ P(U, {
1017
- isOpen: ae === e.key,
1018
- title: e.title,
1019
- closeLabel: s,
1020
- onBack: () => {
1021
- oe(null), j(!0);
1022
- },
1023
- backLabel: e.backLabel ?? "Back",
1024
- onClose: () => oe(null),
1025
- style: u,
1026
- children: /* @__PURE__ */ P("div", {
1027
- role: "menu",
1028
- "aria-label": e.title,
1029
- children: e.renderOverlay(() => oe(null), ee?.() ?? 0)
1030
- })
1031
- }, e.key)),
1032
- h != null && /* @__PURE__ */ P(st, {
1033
- isOpen: te,
1034
- onBack: () => {
1035
- ne(!1), j(!0);
1036
- },
1037
- backLabel: h.backLabel ?? "Back",
1038
- onClose: () => ne(!1),
1039
- closeLabel: s,
1040
- style: u,
1041
- features: h.features,
1042
- initialResponseFormat: h.responseFormat ?? o.Markdown,
1043
- initialSystemPrompt: h.systemPrompt,
1044
- initialTemperature: h.temperature,
1045
- onSave: h.onSave,
1046
- title: h.title,
1047
- responseFormatLabel: h.responseFormatLabel,
1048
- responseFormatHint: h.responseFormatHint,
1049
- responseFormatMarkdownLabel: h.responseFormatMarkdownLabel,
1050
- responseFormatPlainTextLabel: h.responseFormatPlainTextLabel,
1051
- systemPromptLabel: h.systemPromptLabel,
1052
- systemPromptTooltip: h.systemPromptTooltip,
1053
- temperatureLabel: h.temperatureLabel,
1054
- temperatureLabels: h.temperatureLabels,
1055
- temperatureHint: h.temperatureHint,
1056
- saveLabel: h.saveLabel,
1057
- saveDisabledTooltip: h.saveDisabledTooltip
1088
+ !k && g != null && P && /* @__PURE__ */ B(gt, {
1089
+ features: g.features,
1090
+ initialResponseFormat: g.responseFormat ?? o.Markdown,
1091
+ initialSystemPrompt: g.systemPrompt,
1092
+ initialTemperature: g.temperature,
1093
+ onSave: g.onSave,
1094
+ onClose: () => F(!1),
1095
+ title: g.title,
1096
+ responseFormatLabel: g.responseFormatLabel,
1097
+ responseFormatHint: g.responseFormatHint,
1098
+ responseFormatMarkdownLabel: g.responseFormatMarkdownLabel,
1099
+ responseFormatPlainTextLabel: g.responseFormatPlainTextLabel,
1100
+ systemPromptLabel: g.systemPromptLabel,
1101
+ systemPromptTooltip: g.systemPromptTooltip,
1102
+ temperatureLabel: g.temperatureLabel,
1103
+ temperatureLabels: g.temperatureLabels,
1104
+ temperatureHint: g.temperatureHint,
1105
+ saveLabel: g.saveLabel,
1106
+ saveDisabledTooltip: g.saveDisabledTooltip,
1107
+ colors: g.modalColors
1058
1108
  })
1059
- ] }) : /* @__PURE__ */ F(N, { children: [fe, h != null && te && /* @__PURE__ */ P(lt, {
1060
- features: h.features,
1061
- initialResponseFormat: h.responseFormat ?? o.Markdown,
1062
- initialSystemPrompt: h.systemPrompt,
1063
- initialTemperature: h.temperature,
1064
- onSave: h.onSave,
1065
- onClose: () => ne(!1),
1066
- title: h.title,
1067
- responseFormatLabel: h.responseFormatLabel,
1068
- responseFormatHint: h.responseFormatHint,
1069
- responseFormatMarkdownLabel: h.responseFormatMarkdownLabel,
1070
- responseFormatPlainTextLabel: h.responseFormatPlainTextLabel,
1071
- systemPromptLabel: h.systemPromptLabel,
1072
- systemPromptTooltip: h.systemPromptTooltip,
1073
- temperatureLabel: h.temperatureLabel,
1074
- temperatureLabels: h.temperatureLabels,
1075
- temperatureHint: h.temperatureHint,
1076
- saveLabel: h.saveLabel,
1077
- saveDisabledTooltip: h.saveDisabledTooltip
1078
- })] }) });
1079
- }, G = {
1109
+ ] });
1110
+ }, xt = {
1080
1111
  chip: "_chip_1lvv5_1",
1081
1112
  chipSelected: "_chipSelected_1lvv5_9",
1082
1113
  chipIcon: "_chipIcon_1lvv5_16",
1083
1114
  chipText: "_chipText_1lvv5_19",
1084
1115
  chipState: "_chipState_1lvv5_22",
1085
1116
  chipClose: "_chipClose_1lvv5_25"
1086
- }, mt = (e) => `Remove ${e}`, ht = ({ items: e, onToolToggle: t, onToolDismiss: n, canRemove: r = !0, removeLabel: i = mt, stateOnLabel: a, stateOffLabel: o, typography: s, colors: u }) => {
1117
+ }, St = (e) => `Remove ${e}`, Ct = ({ items: e, onToolToggle: t, onToolDismiss: n, canRemove: r = !0, removeLabel: i = St, stateOnLabel: a, stateOffLabel: o, typography: s, colors: u }) => {
1087
1118
  if (e.length === 0) return null;
1088
- let d = !!(a && o);
1089
- return /* @__PURE__ */ P("div", {
1119
+ let d = !!(a && o), f = c({
1120
+ "--ci-chip-bg": u?.chipBg,
1121
+ "--ci-chip-border": u?.chipBorder,
1122
+ "--ci-chip-icon": u?.chipIcon,
1123
+ "--ci-chip-text": u?.chipText,
1124
+ "--ci-chip-hover-bg": u?.chipHoverBg,
1125
+ "--ci-chip-selected-bg": u?.chipSelectedBg,
1126
+ "--ci-chip-selected-bg-hover": u?.chipSelectedHoverBg,
1127
+ "--ci-chip-selected-border": u?.chipSelectedBorder,
1128
+ "--ci-chip-selected-icon": u?.chipSelectedIcon,
1129
+ "--ci-chip-selected-text": u?.chipSelectedText,
1130
+ "--ci-chip-state-text": u?.chipStateText,
1131
+ "--ci-chip-close": u?.chipClose,
1132
+ "--ci-chip-close-hover": u?.chipCloseHover
1133
+ }), p = (e) => /* @__PURE__ */ B("span", {
1134
+ className: l(xt.chipIcon, "flex shrink-0"),
1135
+ children: e.icon
1136
+ }), m = (e) => /* @__PURE__ */ V("span", {
1137
+ className: "flex min-w-0 items-center",
1138
+ children: [/* @__PURE__ */ V("span", {
1139
+ className: l(xt.chipText, s?.fontClassName || "dial-small-paragraph-text", "truncate"),
1140
+ children: [e.label, d && /* @__PURE__ */ B("span", {
1141
+ "aria-hidden": !0,
1142
+ children: ":"
1143
+ })]
1144
+ }), d && /* @__PURE__ */ B("span", {
1145
+ className: l(xt.chipState, s?.stateClassName || "dial-tiny-lead-text", "ms-1 shrink-0"),
1146
+ "aria-hidden": !0,
1147
+ children: e.isSelected ? a : o
1148
+ })]
1149
+ });
1150
+ return /* @__PURE__ */ B("div", {
1090
1151
  className: "flex flex-wrap items-center gap-2",
1091
- style: c({
1092
- "--ci-chip-bg": u?.chipBg,
1093
- "--ci-chip-border": u?.chipBorder,
1094
- "--ci-chip-icon": u?.chipIcon,
1095
- "--ci-chip-text": u?.chipText,
1096
- "--ci-chip-hover-bg": u?.chipHoverBg,
1097
- "--ci-chip-selected-bg": u?.chipSelectedBg,
1098
- "--ci-chip-selected-border": u?.chipSelectedBorder,
1099
- "--ci-chip-selected-icon": u?.chipSelectedIcon,
1100
- "--ci-chip-selected-text": u?.chipSelectedText,
1101
- "--ci-chip-state-text": u?.chipStateText,
1102
- "--ci-chip-close": u?.chipClose,
1103
- "--ci-chip-close-hover": u?.chipCloseHover
1104
- }),
1105
- children: e.map((e) => /* @__PURE__ */ F("div", {
1106
- className: l(G.chip, e.isSelected && G.chipSelected, "flex min-w-0 items-center gap-1.5 rounded-full border py-1 transition-colors", r ? "pe-1 ps-2" : "px-2"),
1107
- children: [/* @__PURE__ */ F("button", {
1152
+ style: f,
1153
+ children: e.map((e) => r ? /* @__PURE__ */ V("div", {
1154
+ className: l(xt.chip, e.isSelected && xt.chipSelected, "flex min-w-0 items-center gap-1.5 rounded-full border py-1 ps-2 pe-1 transition-colors"),
1155
+ children: [/* @__PURE__ */ V("button", {
1108
1156
  type: "button",
1109
1157
  onClick: () => t(e.id),
1110
1158
  "aria-pressed": e.isSelected,
1111
1159
  className: "flex min-w-0 items-center gap-1.5",
1112
- children: [
1113
- /* @__PURE__ */ P("span", {
1114
- className: l(G.chipIcon, "shrink-0"),
1115
- "aria-hidden": !0,
1116
- children: e.icon
1117
- }),
1118
- /* @__PURE__ */ F("span", {
1119
- className: l(G.chipText, s?.fontClassName || "dial-small-paragraph-text", "truncate"),
1120
- children: [e.label, d && /* @__PURE__ */ P("span", {
1121
- "aria-hidden": !0,
1122
- children: ":"
1123
- })]
1124
- }),
1125
- d && /* @__PURE__ */ P("span", {
1126
- className: l(G.chipState, s?.fontClassName || "dial-small-paragraph-text", "ms-1 shrink-0 uppercase tracking-wider"),
1127
- "aria-hidden": !0,
1128
- children: e.isSelected ? a : o
1129
- })
1130
- ]
1131
- }), r && /* @__PURE__ */ P("button", {
1160
+ children: [/* @__PURE__ */ B("span", {
1161
+ className: "flex shrink-0",
1162
+ "aria-hidden": !0,
1163
+ children: p(e)
1164
+ }), m(e)]
1165
+ }), /* @__PURE__ */ B("button", {
1132
1166
  type: "button",
1133
1167
  onClick: () => n(e.id),
1134
1168
  "aria-label": i(e.label),
1135
- className: l(G.chipClose, "flex shrink-0 items-center rounded p-0.5 transition-colors"),
1136
- children: /* @__PURE__ */ P(xe, {
1169
+ className: l(xt.chipClose, "flex shrink-0 items-center rounded p-0.5 transition-colors"),
1170
+ children: /* @__PURE__ */ B(Te, {
1137
1171
  size: 12,
1138
1172
  "aria-hidden": !0,
1139
- stroke: _
1173
+ stroke: y
1140
1174
  })
1141
1175
  })]
1176
+ }, e.id) : /* @__PURE__ */ B(se, {
1177
+ icon: p(e),
1178
+ label: m(e),
1179
+ isSelected: e.isSelected,
1180
+ onToggle: () => t(e.id),
1181
+ className: l(xt.chip, e.isSelected && xt.chipSelected, "h-auto min-w-0 gap-1.5 border px-2 py-1 transition-colors")
1142
1182
  }, e.id))
1143
1183
  });
1144
- }, K = {
1145
- wrapper: "_wrapper_19a9k_2",
1146
- wrapperDisabled: "_wrapperDisabled_19a9k_9",
1147
- textarea: "_textarea_19a9k_13",
1148
- textareaMentionMode: "_textareaMentionMode_19a9k_19",
1149
- commandHint: "_commandHint_19a9k_53",
1150
- mentionHighlight: "_mentionHighlight_19a9k_57",
1151
- mentionHighlightUnsupported: "_mentionHighlightUnsupported_19a9k_63",
1152
- modelSelectorButton: "_modelSelectorButton_19a9k_69",
1153
- modelSelectorCaret: "_modelSelectorCaret_19a9k_69",
1154
- modelSelectorName: "_modelSelectorName_19a9k_72",
1155
- modelSelectorVersion: "_modelSelectorVersion_19a9k_75",
1156
- modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_19a9k_84"
1157
- }, gt = {
1184
+ }, Y = {
1185
+ wrapper: "_wrapper_13067_2",
1186
+ wrapperDisabled: "_wrapperDisabled_13067_9",
1187
+ textarea: "_textarea_13067_13",
1188
+ textareaMentionMode: "_textareaMentionMode_13067_19",
1189
+ commandHint: "_commandHint_13067_53",
1190
+ mentionHighlight: "_mentionHighlight_13067_57",
1191
+ mentionHighlightUnsupported: "_mentionHighlightUnsupported_13067_63",
1192
+ selectionHighlight: "_selectionHighlight_13067_69",
1193
+ modelOverlayPanel: "_modelOverlayPanel_13067_78",
1194
+ modelSelectorButton: "_modelSelectorButton_13067_82",
1195
+ modelSelectorCaret: "_modelSelectorCaret_13067_82",
1196
+ modelSelectorName: "_modelSelectorName_13067_85",
1197
+ modelSelectorVersion: "_modelSelectorVersion_13067_88",
1198
+ modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_13067_97"
1199
+ }, wt = {
1158
1200
  waveformCanvas: "_waveformCanvas_18zb5_1",
1159
1201
  recordingDot: "_recordingDot_18zb5_15",
1160
1202
  "recording-pulse": "_recording-pulse_18zb5_1"
1161
- }, _t = 3, vt = 4, yt = 200, bt = ({ state: e, analyserNodeRef: t, onStop: n, onDiscard: r, attachButton: i, stopLabel: a = "Stop recording", discardLabel: o = "Discard recording", processingLabel: s = "Transcribing audio…", style: c, className: u, embedded: d = !1 }) => {
1162
- let f = B(null), p = B(new Float32Array(yt)), m = B(0), h = B(0), v = e === qe.Recording, y = e === qe.Processing, b = L((e) => {
1203
+ }, Tt = 3, Et = 4, Dt = 200, Ot = ({ 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 }) => {
1204
+ let f = G(null), p = G(new Float32Array(Dt)), m = G(0), h = G(0), g = e === tt.Recording, _ = e === tt.Processing, b = H((e) => {
1163
1205
  let t = e.getContext("2d");
1164
1206
  if (!t) return;
1165
1207
  e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
1166
1208
  let { width: n, height: r } = e;
1167
1209
  t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
1168
- let i = Math.min(Math.max(1, Math.floor(n / vt)), yt - 1), a = m.current, o = h.current;
1210
+ let i = Math.min(Math.max(1, Math.floor(n / Et)), 199), a = m.current, o = h.current;
1169
1211
  t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
1170
1212
  for (let e = 0; e <= i; e++) {
1171
- let n = ((a - i + e) % yt + yt) % yt, o = p.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
1172
- t.fillRect(e * vt, (r - c) / 2, _t, c);
1213
+ let n = ((a - i + e) % Dt + Dt) % Dt, o = p.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
1214
+ t.fillRect(e * Et, (r - c) / 2, Tt, c);
1173
1215
  }
1174
1216
  t.restore();
1175
1217
  }, []);
1176
- R(() => {
1177
- if (!v) return;
1218
+ U(() => {
1219
+ if (!g) return;
1178
1220
  let e = f.current;
1179
1221
  if (!e) return;
1180
1222
  p.current.fill(0), m.current = 0, h.current = 0;
1181
1223
  let n, r = () => {
1182
- if (h.current += 1, h.current >= vt) {
1183
- h.current -= vt;
1224
+ if (h.current += 1, h.current >= Et) {
1225
+ h.current -= Et;
1184
1226
  let e = t.current;
1185
1227
  if (e) {
1186
1228
  let t = new Uint8Array(e.frequencyBinCount);
@@ -1190,7 +1232,7 @@ var H = {
1190
1232
  let r = (t[e] - 128) / 128;
1191
1233
  n += r * r;
1192
1234
  }
1193
- p.current[m.current % yt] = Math.sqrt(n / t.length), m.current++;
1235
+ p.current[m.current % Dt] = Math.sqrt(n / t.length), m.current++;
1194
1236
  }
1195
1237
  }
1196
1238
  b(e), n = requestAnimationFrame(r);
@@ -1199,10 +1241,10 @@ var H = {
1199
1241
  cancelAnimationFrame(n);
1200
1242
  };
1201
1243
  }, [
1202
- v,
1244
+ g,
1203
1245
  t,
1204
1246
  b
1205
- ]), R(() => {
1247
+ ]), U(() => {
1206
1248
  let e = f.current;
1207
1249
  if (!e) return;
1208
1250
  let t = new ResizeObserver(() => {
@@ -1210,128 +1252,126 @@ var H = {
1210
1252
  });
1211
1253
  return t.observe(e), () => t.disconnect();
1212
1254
  }, [b]);
1213
- let x = /* @__PURE__ */ F("div", {
1214
- className: "flex flex-shrink-0 items-center justify-end gap-1",
1255
+ let x = /* @__PURE__ */ V("div", {
1256
+ className: "flex shrink-0 items-center justify-end gap-1",
1215
1257
  children: [
1216
- /* @__PURE__ */ P(T, {
1217
- icon: /* @__PURE__ */ P(xe, {
1218
- size: g.LG,
1258
+ /* @__PURE__ */ B(k, {
1259
+ icon: /* @__PURE__ */ B(Te, {
1260
+ size: v.LG,
1219
1261
  "aria-hidden": !0,
1220
- stroke: _
1262
+ stroke: y
1221
1263
  }),
1222
1264
  "aria-label": o,
1223
1265
  className: "mobile:min-h-11 mobile:min-w-11",
1224
1266
  onClick: r
1225
1267
  }),
1226
- v && /* @__PURE__ */ P(O, {
1227
- icon: /* @__PURE__ */ P(de, {
1228
- size: g.LG,
1268
+ g && /* @__PURE__ */ B(P, {
1269
+ icon: /* @__PURE__ */ B(he, {
1270
+ size: v.LG,
1229
1271
  "aria-hidden": !0,
1230
- stroke: _
1272
+ stroke: y
1231
1273
  }),
1232
1274
  onClick: () => n?.(),
1233
1275
  autoFocus: !0,
1234
1276
  "aria-label": a,
1235
1277
  className: "mobile:min-h-11 mobile:min-w-11"
1236
1278
  }),
1237
- y && /* @__PURE__ */ P("span", {
1238
- className: "flex size-[40px] flex-shrink-0 items-center justify-center mobile:min-h-11 mobile:min-w-11",
1239
- children: /* @__PURE__ */ P(ie, {
1279
+ _ && /* @__PURE__ */ B("span", {
1280
+ className: "flex size-[40px] shrink-0 items-center justify-center mobile:min-h-11 mobile:min-w-11",
1281
+ children: /* @__PURE__ */ B(ie, {
1240
1282
  size: 20,
1241
1283
  ariaLabel: s
1242
1284
  })
1243
1285
  })
1244
1286
  ]
1245
1287
  });
1246
- return /* @__PURE__ */ P("div", {
1288
+ return /* @__PURE__ */ B("div", {
1247
1289
  className: u,
1248
- children: /* @__PURE__ */ F("div", {
1290
+ children: /* @__PURE__ */ V("div", {
1249
1291
  style: c,
1250
- className: l("flex w-full min-w-0 flex-col justify-center gap-2", !d && K.wrapper, !d && "min-h-[64px] max-w-[748px] rounded-xl border px-3 shadow-md"),
1251
- children: [/* @__PURE__ */ F("div", {
1292
+ className: l("flex w-full min-w-0 flex-col justify-center gap-2", !d && Y.wrapper, !d && "min-h-[64px] max-w-[748px] rounded-xl border px-3 shadow-md"),
1293
+ children: [/* @__PURE__ */ V("div", {
1252
1294
  className: "flex min-w-0 flex-1 items-center gap-3",
1253
- children: [v && /* @__PURE__ */ P("span", {
1254
- className: l(gt.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
1295
+ children: [g && /* @__PURE__ */ B("span", {
1296
+ className: l(wt.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
1255
1297
  "aria-hidden": !0
1256
- }), /* @__PURE__ */ P("canvas", {
1298
+ }), /* @__PURE__ */ B("canvas", {
1257
1299
  ref: f,
1258
1300
  height: 26,
1259
1301
  "aria-hidden": !0,
1260
- className: l(gt.waveformCanvas, "h-[26px] min-w-0 flex-1")
1302
+ className: l(wt.waveformCanvas, "h-[26px] min-w-0 flex-1")
1261
1303
  })]
1262
- }), /* @__PURE__ */ F("div", {
1304
+ }), /* @__PURE__ */ V("div", {
1263
1305
  className: "flex items-center justify-between gap-2",
1264
- children: [i ?? /* @__PURE__ */ P("span", { "aria-hidden": !0 }), x]
1306
+ children: [i ?? /* @__PURE__ */ B("span", { "aria-hidden": !0 }), x]
1265
1307
  })]
1266
1308
  })
1267
1309
  });
1268
- }, xt = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", sendTooltip: r }) => /* @__PURE__ */ P(O, {
1310
+ }, kt = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", sendTooltip: r }) => /* @__PURE__ */ B(P, {
1269
1311
  "aria-label": n,
1270
1312
  onClick: () => e?.(),
1271
1313
  disabled: t,
1272
1314
  tooltipProps: r ? { tooltip: r } : void 0,
1273
- icon: /* @__PURE__ */ P(ue, {
1274
- size: g.LG,
1315
+ icon: /* @__PURE__ */ B(me, {
1316
+ size: v.LG,
1275
1317
  className: "rtl:scale-x-[-1]",
1276
- stroke: _
1318
+ stroke: y
1277
1319
  })
1278
- }), St = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ P(T, {
1279
- icon: /* @__PURE__ */ P(_e, {
1280
- size: g.LG,
1281
- stroke: _
1320
+ }), At = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ B(k, {
1321
+ icon: /* @__PURE__ */ B(xe, {
1322
+ size: v.LG,
1323
+ stroke: y
1282
1324
  }),
1283
1325
  onClick: () => e?.(),
1284
1326
  "aria-label": t
1285
- }), Ct = ({ size: e = 20 }) => /* @__PURE__ */ P(te, {
1286
- variant: ne.Circular,
1327
+ }), jt = ({ size: e = 20 }) => /* @__PURE__ */ B(R, {
1328
+ variant: re.Circular,
1287
1329
  width: e,
1288
1330
  height: e,
1289
1331
  active: !0
1290
- }), wt = ({ loadingLabel: e }) => /* @__PURE__ */ F("span", {
1332
+ }), Mt = ({ loadingLabel: e }) => /* @__PURE__ */ V("span", {
1291
1333
  className: "flex min-w-0 flex-1 items-center",
1292
- children: [/* @__PURE__ */ P(te, {
1293
- variant: ne.Text,
1334
+ children: [/* @__PURE__ */ B(R, {
1335
+ variant: re.Text,
1294
1336
  width: "100%",
1295
1337
  height: 16,
1296
1338
  active: !0
1297
- }), e && /* @__PURE__ */ P("span", {
1339
+ }), e && /* @__PURE__ */ B("span", {
1298
1340
  className: "sr-only",
1299
1341
  children: e
1300
1342
  })]
1301
- }), Tt = ({ loadingLabel: e }) => /* @__PURE__ */ P("div", {
1302
- role: "status",
1303
- "aria-label": e,
1304
- children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ F("div", {
1343
+ }), Nt = () => /* @__PURE__ */ B("div", {
1344
+ "aria-hidden": "true",
1345
+ children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ V("div", {
1305
1346
  className: "flex h-11 items-center gap-3 px-4",
1306
- "aria-hidden": "true",
1307
- children: [/* @__PURE__ */ P(Ct, {}), /* @__PURE__ */ P(wt, {})]
1347
+ children: [/* @__PURE__ */ B(jt, {}), /* @__PURE__ */ B(Mt, {})]
1308
1348
  }, t))
1309
- }), Et = (e) => e.displayName ?? e.id, Dt = (e, t) => {
1349
+ }), Pt = (e) => e.displayName ?? e.id, Ft = (e, t) => {
1310
1350
  let n = t.trim().toLowerCase();
1311
- return n ? e.filter((e) => Et(e).toLowerCase().includes(n)) : e;
1312
- }, Ot = (e, t, r, i = 18, a) => /* @__PURE__ */ P(n, {
1351
+ return n ? e.filter((e) => Pt(e).toLowerCase().includes(n)) : e;
1352
+ }, It = (e, t, r, i = 18, a) => /* @__PURE__ */ B(n, {
1313
1353
  src: e,
1314
1354
  size: i,
1315
1355
  labels: { tooltip: a },
1316
1356
  initialsName: r
1317
- }), kt = {
1357
+ }), Lt = {
1318
1358
  searchHeader: "_searchHeader_1u7db_1",
1319
1359
  itemText: "_itemText_1u7db_13",
1320
1360
  itemHover: "_itemHover_1u7db_17",
1321
1361
  selectedItemBackground: "_selectedItemBackground_1u7db_22",
1322
1362
  selectedItemText: "_selectedItemText_1u7db_26",
1323
1363
  checkIcon: "_checkIcon_1u7db_30"
1324
- }, At = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, styles: i }) => {
1325
- let [a, o] = V(""), s = z(() => e?.find((e) => e.id === t), [e, t]), u = r?.loading !== void 0, d = !u && !s && !!t, f = z(() => u ? /* @__PURE__ */ P(Ct, { size: g.LG }) : Ot(s?.iconUrl, s?.type, s?.displayName ?? s?.id ?? "", g.LG, d ? r?.unavailableTooltip ?? "This deployment is no longer available" : void 0), [
1364
+ }, Rt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, styles: i }) => {
1365
+ let [a, o] = K(""), s = W(() => e?.find((e) => e.id === t), [e, t]), u = r?.loading !== void 0, d = !u && !s && !!t, f = W(() => u ? /* @__PURE__ */ B(jt, { size: v.LG }) : It(s?.iconUrl, s?.type, s?.displayName ?? s?.id ?? "", v.LG, d ? r?.unavailableTooltip ?? "This deployment is no longer available" : void 0), [
1326
1366
  u,
1327
1367
  s,
1328
1368
  d,
1329
1369
  r?.unavailableTooltip
1330
- ]), p = s?.displayName ?? s?.id, m = s?.displayVersion, h = p ? `${r?.ariaLabel ?? "Select model"}: ${p}` : r?.ariaLabel ?? "Select model", _ = z(() => {
1370
+ ]), p = s?.displayName ?? s?.id, m = s?.displayVersion, h = p ? `${r?.ariaLabel ?? "Select model"}: ${p}` : r?.ariaLabel ?? "Select model", g = W(() => {
1331
1371
  if (u) return Array.from({ length: 7 }, (e, t) => ({
1332
1372
  key: `__loading-${t}`,
1333
- icon: /* @__PURE__ */ P(Ct, {}),
1334
- label: /* @__PURE__ */ P(wt, { loadingLabel: t === 0 ? r?.loading : void 0 }),
1373
+ icon: /* @__PURE__ */ B(jt, {}),
1374
+ label: /* @__PURE__ */ B(Mt, { loadingLabel: t === 0 ? r?.loading : void 0 }),
1335
1375
  disabled: !0
1336
1376
  }));
1337
1377
  if (!e || e.length === 0) {
@@ -1343,19 +1383,19 @@ var H = {
1343
1383
  }] : [];
1344
1384
  }
1345
1385
  let o = i?.colors;
1346
- return Dt(e, a).map((e) => {
1386
+ return Ft(e, a).map((e) => {
1347
1387
  let r = e.id === t;
1348
1388
  return {
1349
1389
  key: e.id,
1350
- label: /* @__PURE__ */ P(S, {
1351
- text: Et(e),
1390
+ label: /* @__PURE__ */ B(w, {
1391
+ text: Pt(e),
1352
1392
  query: a,
1353
1393
  maxLines: 1
1354
1394
  }),
1355
- icon: Ot(e.iconUrl, e.type, e.displayName ?? e.id),
1356
- mark: C.Check,
1395
+ icon: It(e.iconUrl, e.type, e.displayName ?? e.id),
1396
+ mark: ee.Check,
1357
1397
  checked: r,
1358
- className: l(o?.itemText && kt.itemText, o?.itemHoverBackground && kt.itemHover, r && o?.selectedItemBackground && kt.selectedItemBackground, r && o?.selectedItemText && kt.selectedItemText, r && o?.checkIcon && kt.checkIcon, i?.itemClassName, r && i?.selectedItemClassName, H.modelMenuItem, r && H.modelMenuItemSelected),
1398
+ className: l(o?.itemText && Lt.itemText, o?.itemHoverBackground && Lt.itemHover, r && o?.selectedItemBackground && Lt.selectedItemBackground, r && o?.selectedItemText && Lt.selectedItemText, r && o?.checkIcon && Lt.checkIcon, i?.itemClassName, r && i?.selectedItemClassName, q.modelMenuItem, r && q.modelMenuItemSelected),
1359
1399
  onClick: () => n?.(e.id)
1360
1400
  };
1361
1401
  });
@@ -1369,7 +1409,7 @@ var H = {
1369
1409
  i?.itemClassName,
1370
1410
  i?.selectedItemClassName,
1371
1411
  i?.colors
1372
- ]), v = z(() => c({
1412
+ ]), _ = W(() => c({
1373
1413
  "--ms-item-text": i?.colors?.itemText,
1374
1414
  "--ms-item-hover-bg": i?.colors?.itemHoverBackground,
1375
1415
  "--ms-selected-item-bg": i?.colors?.selectedItemBackground,
@@ -1377,18 +1417,20 @@ var H = {
1377
1417
  "--ms-check-icon": i?.colors?.checkIcon
1378
1418
  }), [i?.colors]);
1379
1419
  return {
1420
+ searchQuery: a,
1421
+ onSearchQueryChange: o,
1380
1422
  selectorIcon: f,
1381
1423
  selectorAriaLabel: h,
1382
1424
  selectedLabel: p,
1383
1425
  selectedVersion: m,
1384
- menuItems: _,
1385
- menuHeader: z(() => !u && e && e.length > 0 ? /* @__PURE__ */ P("div", {
1426
+ menuItems: g,
1427
+ menuHeader: W(() => !u && e && e.length > 0 ? /* @__PURE__ */ B("div", {
1386
1428
  style: c({ "--ms-search-header-bg": i?.colors?.searchHeaderBackground }),
1387
- className: l("sticky top-0 z-10 pb-1 pe-2 pt-2", kt.searchHeader, i?.searchHeaderClassName, H.modelMenuSearch),
1388
- children: /* @__PURE__ */ P(j, {
1429
+ className: l("sticky top-0 z-10 pe-2 pt-2 pb-1", Lt.searchHeader, i?.searchHeaderClassName, q.modelMenuSearch),
1430
+ children: /* @__PURE__ */ B(L, {
1389
1431
  value: a,
1390
1432
  placeholder: r?.searchPlaceholder ?? "Search",
1391
- size: y.Small,
1433
+ size: x.Small,
1392
1434
  wrapperClassName: "border-0",
1393
1435
  onChange: (e) => o(e ?? "")
1394
1436
  })
@@ -1400,31 +1442,51 @@ var H = {
1400
1442
  i?.searchHeaderClassName,
1401
1443
  i?.colors?.searchHeaderBackground
1402
1444
  ]),
1403
- menuStyle: v,
1445
+ menuStyle: _,
1404
1446
  onOpenChange: (e) => {
1405
1447
  e || o("");
1406
1448
  }
1407
1449
  };
1408
- }, jt = typeof window < "u" ? De : R;
1409
- function Mt(e) {
1450
+ }, X = typeof window < "u" ? Me : U;
1451
+ function zt(e) {
1452
+ let t = e;
1453
+ for (; t;) {
1454
+ if (t.dir) return t.dir === "rtl";
1455
+ t = t.parentElement;
1456
+ }
1457
+ return !1;
1458
+ }
1459
+ function Bt() {
1460
+ return () => {};
1461
+ }
1462
+ function Vt() {
1463
+ return Ne(Bt, () => !1, () => !0);
1464
+ }
1465
+ function Ht(e) {
1466
+ return e?.ownerDocument.defaultView ?? window;
1467
+ }
1468
+ function Z(e) {
1469
+ return Ht(e).ResizeObserver ?? (typeof ResizeObserver < "u" ? ResizeObserver : void 0);
1470
+ }
1471
+ function Q(e) {
1410
1472
  if (e !== void 0) switch (typeof e) {
1411
1473
  case "number": return e;
1412
- case "string":
1413
- if (e.endsWith("px")) return parseFloat(e);
1414
- break;
1474
+ case "string": if (e.endsWith("px")) return parseFloat(e);
1415
1475
  }
1416
1476
  }
1417
- function Nt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
1418
- let { styleHeight: s, styleWidth: c } = z(() => ({
1419
- styleHeight: Mt(o?.height),
1420
- styleWidth: Mt(o?.width)
1421
- }), [o?.height, o?.width]), [l, u] = V({
1477
+ function $({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
1478
+ let { styleHeight: s, styleWidth: c } = W(() => ({
1479
+ styleHeight: Q(o?.height),
1480
+ styleWidth: Q(o?.width)
1481
+ }), [o?.height, o?.width]), [l, u] = K({
1422
1482
  height: t,
1423
1483
  width: n
1424
1484
  }), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
1425
- return jt(() => {
1485
+ return X(() => {
1426
1486
  if (i === null || d) return;
1427
- let t = new ResizeObserver((e) => {
1487
+ let t = Z(i);
1488
+ if (!t) return;
1489
+ let n = new t((e) => {
1428
1490
  for (let t of e) {
1429
1491
  let { contentRect: e, target: n } = t;
1430
1492
  i === n && u((t) => t.height === e.height && t.width === e.width ? t : {
@@ -1433,8 +1495,8 @@ function Nt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
1433
1495
  });
1434
1496
  }
1435
1497
  });
1436
- return t.observe(i, { box: e }), () => {
1437
- t?.unobserve(i);
1498
+ return n.observe(i, { box: e }), () => {
1499
+ n?.unobserve(i);
1438
1500
  };
1439
1501
  }, [
1440
1502
  e,
@@ -1442,7 +1504,7 @@ function Nt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
1442
1504
  i,
1443
1505
  s,
1444
1506
  c
1445
- ]), z(() => ({
1507
+ ]), W(() => ({
1446
1508
  height: s ?? l.height,
1447
1509
  width: c ?? l.width
1448
1510
  }), [
@@ -1451,114 +1513,200 @@ function Nt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
1451
1513
  c
1452
1514
  ]);
1453
1515
  }
1454
- function Pt(e) {
1455
- let t = B(() => {
1456
- throw Error("Cannot call during render.");
1516
+ function Ut(e) {
1517
+ let t = G(() => {
1518
+ throw Error("Cannot call an event handler while rendering.");
1457
1519
  });
1458
- return jt(() => {
1520
+ return X(() => {
1459
1521
  t.current = e;
1460
- }, [e]), L((e) => t.current?.(e), [t]);
1522
+ }, [e]), H((...e) => t.current?.(...e), [t]);
1461
1523
  }
1462
- var q = null;
1463
- function Ft(e = !1) {
1464
- if (q === null || e) {
1465
- let e = document.createElement("div"), t = e.style;
1466
- t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
1467
- let n = document.createElement("div"), r = n.style;
1468
- return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? q = "positive-descending" : (e.scrollLeft = 1, q = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), q;
1524
+ var Wt = /* @__PURE__ */ new WeakMap();
1525
+ function Gt(e = !1, t = document) {
1526
+ let n = Wt.get(t);
1527
+ if (n === void 0 || e) {
1528
+ let e = t.createElement("div"), r = e.style;
1529
+ r.width = "50px", r.height = "50px", r.overflow = "scroll", r.direction = "rtl";
1530
+ let i = t.createElement("div"), a = i.style;
1531
+ a.width = "100px", a.height = "100px", e.appendChild(i), t.body.appendChild(e), e.scrollLeft > 0 ? n = "positive-descending" : (e.scrollLeft = 1, n = e.scrollLeft === 0 ? "negative" : "positive-ascending"), t.body.removeChild(e), Wt.set(t, n);
1469
1532
  }
1470
- return q;
1533
+ return n;
1471
1534
  }
1472
- function It({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
1473
- if (t === "horizontal" && n) switch (Ft()) {
1535
+ function Kt({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
1536
+ if (t === "horizontal" && n) switch (Gt(!1, e?.ownerDocument ?? document)) {
1474
1537
  case "negative": return -r;
1475
- case "positive-descending":
1476
- if (e) {
1477
- let { clientWidth: t, scrollLeft: n, scrollWidth: r } = e;
1478
- return r - t - n;
1479
- }
1480
- break;
1538
+ case "positive-descending": if (e) {
1539
+ let { clientWidth: t, scrollWidth: n } = e;
1540
+ return n - t - r;
1541
+ }
1481
1542
  }
1482
1543
  return r;
1483
1544
  }
1484
- function J(e, t = "Assertion error") {
1545
+ function qt({ container: e, element: t, onChange: n }) {
1546
+ let r = Ht(t), i = Z(t), a = r.MutationObserver ?? (typeof MutationObserver < "u" ? MutationObserver : void 0), o = i ? new i(n) : void 0, s = (e) => !e.isConnected || (e.compareDocumentPosition(t) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0, c = a ? new a((e) => {
1547
+ e.some((e) => Array.from(e.addedNodes).some(s) || e.removedNodes.length > 0 && e.nextSibling !== null && s(e.nextSibling)) && (u(), n());
1548
+ }) : void 0, l = /* @__PURE__ */ new Set(), u = () => {
1549
+ for (let e of l) o?.unobserve(e);
1550
+ l.clear(), c?.disconnect();
1551
+ let n = t;
1552
+ for (; n !== e;) {
1553
+ let e = n.parentElement;
1554
+ if (e === null) break;
1555
+ if (o) for (let e = n.previousElementSibling; e !== null; e = e.previousElementSibling) l.add(e), o.observe(e);
1556
+ c?.observe(e, { childList: !0 }), n = e;
1557
+ }
1558
+ };
1559
+ return u(), () => {
1560
+ o?.disconnect(), c?.disconnect();
1561
+ };
1562
+ }
1563
+ function Jt(e) {
1564
+ return e.window === e;
1565
+ }
1566
+ function Yt(e, t) {
1567
+ return t === "window" ? e ? Ht(e) : null : t ?? null;
1568
+ }
1569
+ function Xt(e, t) {
1570
+ return Jt(e) ? t === "vertical" ? e.scrollY : e.scrollX : t === "vertical" ? e.scrollTop : e.scrollLeft;
1571
+ }
1572
+ function Zt(e, t) {
1573
+ let n = Jt(e) ? e.document.scrollingElement ?? e.document.documentElement : e;
1574
+ return t === "vertical" ? n.scrollHeight - n.clientHeight : n.scrollWidth - n.clientWidth;
1575
+ }
1576
+ function Qt(e, t) {
1577
+ let { overflowX: n, overflowY: r } = Ht(e).getComputedStyle(e), i = t === "vertical" ? r : n;
1578
+ return i === "visible" || i === "clip" ? !1 : t === "vertical" ? e.scrollHeight - e.clientHeight > 1 : e.scrollWidth - e.clientWidth > 1;
1579
+ }
1580
+ function $t({ containerElement: e, direction: t, isRtl: n, scrollTarget: r }) {
1581
+ let i = t === "vertical", a, o;
1582
+ if (Jt(r)) {
1583
+ let { documentElement: e } = r.document;
1584
+ a = 0, o = i ? e.clientHeight : e.clientWidth;
1585
+ } else {
1586
+ let e = r.getBoundingClientRect();
1587
+ a = i ? e.top + r.clientTop : e.left + r.clientLeft, o = i ? r.clientHeight : r.clientWidth;
1588
+ }
1589
+ let s = a + o, c = e.getBoundingClientRect(), l = i ? c.top + e.clientTop : c.left + e.clientLeft, u = i ? e.clientHeight : e.clientWidth, d = l + u, f = Kt({
1590
+ containerElement: e,
1591
+ direction: t,
1592
+ isRtl: n,
1593
+ scrollOffset: i ? e.scrollTop : e.scrollLeft
1594
+ }), p = !i && n ? d - s : a - l, m = p + o, h = Math.max(0, p), g = Math.min(u, m);
1595
+ return {
1596
+ offset: f + h,
1597
+ size: Math.max(0, g - h),
1598
+ viewportOffset: f + p,
1599
+ viewportSize: o
1600
+ };
1601
+ }
1602
+ function en({ direction: e, isRtl: t, scrollTarget: n, viewportSize: r }) {
1603
+ let i = Jt(n) ? n.document.documentElement : n, a = Ht(i).getComputedStyle(i), o = (e) => {
1604
+ let t = parseFloat(e ?? "");
1605
+ return !Number.isFinite(t) || t < 0 ? 0 : e.endsWith("px") ? t : e.endsWith("%") ? t * r / 100 : 0;
1606
+ };
1607
+ if (e === "vertical") return {
1608
+ end: o(a.scrollPaddingBottom),
1609
+ start: o(a.scrollPaddingTop)
1610
+ };
1611
+ let s = o(a.scrollPaddingLeft), c = o(a.scrollPaddingRight);
1612
+ return t ? {
1613
+ end: s,
1614
+ start: c
1615
+ } : {
1616
+ end: c,
1617
+ start: s
1618
+ };
1619
+ }
1620
+ function tn(e, t = "Assertion error") {
1485
1621
  if (!e) throw console.error(t), Error(t);
1486
1622
  }
1487
- function Lt(e, t) {
1623
+ function nn(e, t) {
1488
1624
  if (e === t) return !0;
1489
- if (!!e != !!t || (J(e !== void 0), J(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
1490
- for (let n in e) if (!Object.is(t[n], e[n])) return !1;
1625
+ if (!!e != !!t || (tn(e !== void 0), tn(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
1626
+ for (let n in e) if (!Object.hasOwn(t, n) || !Object.is(t[n], e[n])) return !1;
1491
1627
  return !0;
1492
1628
  }
1493
- function Y({ cachedBounds: e, itemCount: t, itemSize: n }) {
1629
+ function rn({ cachedBounds: e, itemCount: t, itemSize: n }) {
1494
1630
  if (t === 0) return 0;
1495
1631
  if (typeof n == "number") return t * n;
1496
1632
  {
1497
1633
  let n = e.get(e.size === 0 ? 0 : e.size - 1);
1498
- return J(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
1634
+ return tn(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
1499
1635
  }
1500
1636
  }
1501
- function X({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
1502
- if (n < 0 || n >= r) throw RangeError(`Invalid index specified: ${n}`, { cause: `Index ${n} is not within the range of 0 - ${r - 1}` });
1503
- let s = Y({
1637
+ function an({ align: e, cachedBounds: t, clamp: n = !0, index: r, itemCount: i, itemSize: a, containerScrollOffset: o, containerSize: s }) {
1638
+ if (r < 0 || r >= i) throw RangeError(`Invalid index specified: ${r}`, { cause: `Index ${r} is not within the range of 0 - ${i - 1}` });
1639
+ let c = t.get(r), l = rn({
1504
1640
  cachedBounds: t,
1505
- itemCount: r,
1506
- itemSize: i
1507
- }), c = t.get(n), l = Math.max(0, Math.min(s - o, c.scrollOffset)), u = Math.max(0, c.scrollOffset - o + c.size);
1508
- switch (e === "smart" && (e = a >= u && a <= l ? "auto" : "center"), e) {
1509
- case "start": return l;
1510
- case "end": return u;
1511
- case "center": return c.scrollOffset <= o / 2 ? 0 : c.scrollOffset + c.size / 2 >= s - o / 2 ? s - o : c.scrollOffset + c.size / 2 - o / 2;
1512
- default: return a >= u && a <= l ? a : a < u ? u : l;
1641
+ itemCount: i,
1642
+ itemSize: a
1643
+ }), u = (e) => n ? Math.max(0, Math.min(l - s, e)) : e, d = u(c.scrollOffset), f = n ? Math.max(0, c.scrollOffset - s + c.size) : c.scrollOffset - s + c.size, p = c.size > s ? o >= c.scrollOffset && o <= f : o >= f && o <= c.scrollOffset;
1644
+ switch (e === "smart" && (e = p ? "auto" : "center"), e) {
1645
+ case "start": return d;
1646
+ case "end": return f;
1647
+ case "center": return u(c.scrollOffset + c.size / 2 - s / 2);
1648
+ default: return p ? o : o < f ? f : d;
1513
1649
  }
1514
1650
  }
1515
- function Z({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
1516
- let a = r - 1, o = 0, s = -1, c = 0, l = -1, u = 0;
1517
- for (; u < a;) {
1518
- let n = e.get(u);
1519
- if (n.scrollOffset + n.size > t) break;
1520
- u++;
1521
- }
1522
- for (o = u, c = Math.max(0, o - i); u < a;) {
1523
- let r = e.get(u);
1524
- if (r.scrollOffset + r.size >= t + n) break;
1525
- u++;
1651
+ function on({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
1652
+ let a = r - 1;
1653
+ if (r === 0) return {
1654
+ startIndexVisible: 0,
1655
+ stopIndexVisible: -1,
1656
+ startIndexOverscan: 0,
1657
+ stopIndexOverscan: -1
1658
+ };
1659
+ let o, s, { itemSize: c } = e;
1660
+ if (c !== void 0) c > 0 ? (o = Math.max(0, Math.min(a, Math.floor(t / c))), s = Math.max(o, Math.min(a, Math.ceil((t + n) / c) - 1))) : (o = 0, s = 0);
1661
+ else {
1662
+ let r = 0, i = Math.min(a, Math.max(0, e.size - 1));
1663
+ for (; r < i;) {
1664
+ let n = Math.floor((r + i) / 2), a = e.get(n);
1665
+ a.scrollOffset + a.size > t ? i = n : r = n + 1;
1666
+ }
1667
+ for (; r < a;) {
1668
+ let n = e.get(r);
1669
+ if (n.scrollOffset + n.size > t) break;
1670
+ r++;
1671
+ }
1672
+ for (o = r, s = r; s < a;) {
1673
+ let r = e.get(s);
1674
+ if (r.scrollOffset + r.size >= t + n) break;
1675
+ s++;
1676
+ }
1526
1677
  }
1527
- return s = Math.min(a, u), l = Math.min(r - 1, s + i), o < 0 && (o = 0, s = -1, c = 0, l = -1), {
1678
+ return {
1528
1679
  startIndexVisible: o,
1529
1680
  stopIndexVisible: s,
1530
- startIndexOverscan: c,
1531
- stopIndexOverscan: l
1681
+ startIndexOverscan: Math.max(0, o - i),
1682
+ stopIndexOverscan: Math.min(a, s + i)
1532
1683
  };
1533
1684
  }
1534
- function Rt({ itemCount: e, itemProps: t, itemSize: n }) {
1685
+ function sn({ itemCount: e, itemProps: t, itemSize: n }) {
1535
1686
  let r = /* @__PURE__ */ new Map();
1536
1687
  return {
1688
+ itemSize: typeof n == "number" ? n : void 0,
1537
1689
  get(i) {
1538
- for (J(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
1539
- let e = r.size, a;
1540
- switch (typeof n) {
1541
- case "function":
1542
- a = n(e, t);
1543
- break;
1544
- case "number":
1545
- a = n;
1546
- break;
1547
- }
1690
+ if (tn(i < e, `Invalid index ${i}`), typeof n == "number") return tn(i >= 0, `Invalid index ${i}`), {
1691
+ size: n,
1692
+ scrollOffset: i * n
1693
+ };
1694
+ for (; r.size - 1 < i;) {
1695
+ let e = r.size, a = n(e, t);
1548
1696
  if (e === 0) r.set(e, {
1549
1697
  size: a,
1550
1698
  scrollOffset: 0
1551
1699
  });
1552
1700
  else {
1553
1701
  let t = r.get(e - 1);
1554
- J(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
1702
+ tn(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
1555
1703
  scrollOffset: t.scrollOffset + t.size,
1556
1704
  size: a
1557
1705
  });
1558
1706
  }
1559
1707
  }
1560
1708
  let a = r.get(i);
1561
- return J(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
1709
+ return tn(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
1562
1710
  },
1563
1711
  set(e, t) {
1564
1712
  r.set(e, t);
@@ -1568,8 +1716,8 @@ function Rt({ itemCount: e, itemProps: t, itemSize: n }) {
1568
1716
  }
1569
1717
  };
1570
1718
  }
1571
- function zt({ itemCount: e, itemProps: t, itemSize: n }) {
1572
- return z(() => Rt({
1719
+ function cn({ itemCount: e, itemProps: t, itemSize: n }) {
1720
+ return W(() => sn({
1573
1721
  itemCount: e,
1574
1722
  itemProps: t,
1575
1723
  itemSize: n
@@ -1579,276 +1727,607 @@ function zt({ itemCount: e, itemProps: t, itemSize: n }) {
1579
1727
  n
1580
1728
  ]);
1581
1729
  }
1582
- function Bt({ containerSize: e, itemSize: t }) {
1730
+ function ln({ containerSize: e, itemSize: t }) {
1583
1731
  let n;
1584
1732
  switch (typeof t) {
1585
1733
  case "string":
1586
- J(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), J(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseInt(t) / 100;
1587
- break;
1588
- default:
1589
- n = t;
1734
+ tn(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), tn(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseFloat(t) / 100;
1590
1735
  break;
1736
+ default: n = t;
1591
1737
  }
1592
- return n;
1738
+ return typeof n == "number" && !(Number.isFinite(n) && n > 0) && (n = 0), n;
1593
1739
  }
1594
- function Q({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
1595
- let { height: u = n, width: d = n } = Nt({
1596
- defaultHeight: r === "vertical" ? n : void 0,
1597
- defaultWidth: r === "horizontal" ? n : void 0,
1740
+ function un({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, defaultScrollOffset: r = 0, direction: i, isRtl: a = !1, itemCount: o, itemProps: s, itemSize: c, onResize: l, overscanCount: u, scrollElement: d }) {
1741
+ let f = d !== void 0, p = f ? Yt(e, d) : e, { height: m = n, width: h = n } = $({
1742
+ defaultHeight: i === "vertical" ? n : void 0,
1743
+ defaultWidth: i === "horizontal" ? n : void 0,
1598
1744
  element: e,
1599
- mode: r === "vertical" ? "only-height" : "only-width",
1745
+ mode: i === "vertical" ? "only-height" : "only-width",
1600
1746
  style: t
1601
- }), f = B({
1747
+ }), g = G({
1602
1748
  height: 0,
1603
1749
  width: 0
1604
- }), p = r === "vertical" ? u : d, m = Bt({
1605
- containerSize: p,
1606
- itemSize: s
1750
+ }), [_, v] = K(n), y = f ? _ : i === "vertical" ? m : h, b = ln({
1751
+ containerSize: y,
1752
+ itemSize: c
1607
1753
  });
1608
- De(() => {
1609
- if (typeof c == "function") {
1610
- let e = f.current;
1611
- (e.height !== u || e.width !== d) && (c({
1612
- height: u,
1613
- width: d
1614
- }, { ...e }), e.height = u, e.width = d);
1754
+ X(() => {
1755
+ if (typeof l == "function") {
1756
+ let e = g.current;
1757
+ (e.height !== m || e.width !== h) && (l({
1758
+ height: m,
1759
+ width: h
1760
+ }, { ...e }), e.height = m, e.width = h);
1615
1761
  }
1616
1762
  }, [
1617
- u,
1618
- c,
1619
- d
1763
+ m,
1764
+ l,
1765
+ h
1620
1766
  ]);
1621
- let h = zt({
1622
- itemCount: a,
1623
- itemProps: o,
1624
- itemSize: m
1625
- }), g = L((e) => h.get(e), [h]), [_, v] = V(() => Z({
1626
- cachedBounds: h,
1627
- containerScrollOffset: 0,
1628
- containerSize: p,
1629
- itemCount: a,
1630
- overscanCount: l
1631
- })), { startIndexVisible: y, startIndexOverscan: b, stopIndexVisible: x, stopIndexOverscan: S } = {
1632
- startIndexVisible: Math.min(a - 1, _.startIndexVisible),
1633
- startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
1634
- stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
1635
- stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
1636
- }, C = L(() => Y({
1637
- cachedBounds: h,
1638
- itemCount: a,
1639
- itemSize: m
1767
+ let x = cn({
1768
+ itemCount: o,
1769
+ itemProps: s,
1770
+ itemSize: b
1771
+ }), S = Vt(), [C] = K(() => S || f ? 0 : r), w = H((e) => x.get(e), [x]), [T, E] = K(() => on({
1772
+ cachedBounds: x,
1773
+ containerScrollOffset: C,
1774
+ containerSize: y,
1775
+ itemCount: o,
1776
+ overscanCount: u
1777
+ })), { startIndexVisible: D, startIndexOverscan: ee, stopIndexVisible: O, stopIndexOverscan: k } = {
1778
+ startIndexVisible: Math.min(o - 1, T.startIndexVisible),
1779
+ startIndexOverscan: Math.min(o - 1, T.startIndexOverscan),
1780
+ stopIndexVisible: Math.min(o - 1, T.stopIndexVisible),
1781
+ stopIndexOverscan: Math.min(o - 1, T.stopIndexOverscan)
1782
+ }, A = H(() => rn({
1783
+ cachedBounds: x,
1784
+ itemCount: o,
1785
+ itemSize: b
1640
1786
  }), [
1641
- h,
1642
- a,
1643
- m
1644
- ]), w = L((t) => Z({
1645
- cachedBounds: h,
1646
- containerScrollOffset: It({
1787
+ x,
1788
+ o,
1789
+ b
1790
+ ]), j = H((t) => {
1791
+ let n = Kt({
1647
1792
  containerElement: e,
1648
- direction: r,
1649
- isRtl: i,
1793
+ direction: i,
1794
+ isRtl: a,
1650
1795
  scrollOffset: t
1651
- }),
1652
- containerSize: p,
1653
- itemCount: a,
1654
- overscanCount: l
1655
- }), [
1656
- h,
1796
+ });
1797
+ return on({
1798
+ cachedBounds: x,
1799
+ containerScrollOffset: n,
1800
+ containerSize: y,
1801
+ itemCount: o,
1802
+ overscanCount: u
1803
+ });
1804
+ }, [
1805
+ x,
1657
1806
  e,
1658
- p,
1659
- r,
1807
+ y,
1660
1808
  i,
1661
1809
  a,
1662
- l
1663
- ]);
1664
- return jt(() => {
1665
- v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
1810
+ o,
1811
+ u
1812
+ ]), M = G(!1);
1813
+ X(() => {
1814
+ if (!e || o === 0 || f || M.current || (M.current = !0, r <= 0)) return;
1815
+ let t = i === "horizontal" && zt(e);
1816
+ if (Kt({
1817
+ containerElement: e,
1818
+ direction: i,
1819
+ isRtl: t,
1820
+ scrollOffset: i === "vertical" ? e.scrollTop : e.scrollLeft
1821
+ }) !== 0) return;
1822
+ let n = Kt({
1823
+ containerElement: e,
1824
+ direction: i,
1825
+ isRtl: t,
1826
+ scrollOffset: r
1827
+ });
1828
+ typeof e.scrollTo == "function" ? e.scrollTo({
1829
+ behavior: "instant",
1830
+ [i === "vertical" ? "top" : "left"]: n
1831
+ }) : i === "vertical" ? e.scrollTop = n : e.scrollLeft = n;
1832
+ }, [e, o]), X(() => {
1833
+ if (f && e && p) return;
1834
+ let t = e && !f ? j(i === "vertical" ? e.scrollTop : e.scrollLeft) : on({
1835
+ cachedBounds: x,
1836
+ containerScrollOffset: C,
1837
+ containerSize: y,
1838
+ itemCount: o,
1839
+ overscanCount: u
1840
+ });
1841
+ E((e) => nn(t, e) ? e : t);
1666
1842
  }, [
1843
+ x,
1667
1844
  e,
1668
- r,
1669
- w
1670
- ]), jt(() => {
1671
- if (!e) return;
1845
+ y,
1846
+ i,
1847
+ j,
1848
+ C,
1849
+ f,
1850
+ o,
1851
+ u,
1852
+ p
1853
+ ]), X(() => {
1854
+ if (!e || f) return;
1672
1855
  let t = () => {
1673
- v((t) => {
1674
- let { scrollLeft: n, scrollTop: o } = e, s = Z({
1675
- cachedBounds: h,
1676
- containerScrollOffset: It({
1677
- containerElement: e,
1678
- direction: r,
1679
- isRtl: i,
1680
- scrollOffset: r === "vertical" ? o : n
1681
- }),
1682
- containerSize: p,
1683
- itemCount: a,
1684
- overscanCount: l
1856
+ E((t) => {
1857
+ let { scrollLeft: n, scrollTop: r } = e, s = Kt({
1858
+ containerElement: e,
1859
+ direction: i,
1860
+ isRtl: a,
1861
+ scrollOffset: i === "vertical" ? r : n
1862
+ }), c = on({
1863
+ cachedBounds: x,
1864
+ containerScrollOffset: s,
1865
+ containerSize: y,
1866
+ itemCount: o,
1867
+ overscanCount: u
1685
1868
  });
1686
- return Lt(s, t) ? t : s;
1869
+ return nn(c, t) ? t : c;
1687
1870
  });
1688
1871
  };
1689
1872
  return e.addEventListener("scroll", t), () => {
1690
1873
  e.removeEventListener("scroll", t);
1691
1874
  };
1692
1875
  }, [
1693
- h,
1876
+ x,
1694
1877
  e,
1695
- p,
1696
- r,
1878
+ y,
1879
+ i,
1697
1880
  a,
1698
- l
1881
+ f,
1882
+ o,
1883
+ u
1884
+ ]);
1885
+ let N = Ut(() => {
1886
+ if (!e || !p) return;
1887
+ let { offset: t, size: n, viewportSize: r } = $t({
1888
+ containerElement: e,
1889
+ direction: i,
1890
+ isRtl: a,
1891
+ scrollTarget: p
1892
+ });
1893
+ v(r);
1894
+ let s = on({
1895
+ cachedBounds: x,
1896
+ containerScrollOffset: t,
1897
+ containerSize: n,
1898
+ itemCount: o,
1899
+ overscanCount: u
1900
+ });
1901
+ E((e) => nn(s, e) ? e : s);
1902
+ });
1903
+ return X(() => {
1904
+ f && N();
1905
+ }), X(() => {
1906
+ if (!f || !e || !p) return;
1907
+ let t = Ht(e), n = () => N();
1908
+ p.addEventListener("scroll", n, { passive: !0 }), e.addEventListener("scroll", n, { passive: !0 }), t.addEventListener("resize", n);
1909
+ let r, i = Z(e);
1910
+ i && !Jt(p) && (r = new i(n), r.observe(p));
1911
+ let a = qt({
1912
+ container: Jt(p) ? p.document.documentElement : p,
1913
+ element: e,
1914
+ onChange: n
1915
+ });
1916
+ return () => {
1917
+ p.removeEventListener("scroll", n), e.removeEventListener("scroll", n), t.removeEventListener("resize", n), r?.disconnect(), a();
1918
+ };
1919
+ }, [
1920
+ e,
1921
+ f,
1922
+ p,
1923
+ N
1699
1924
  ]), {
1700
- getCellBounds: g,
1701
- getEstimatedSize: C,
1702
- scrollToIndex: Pt(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
1703
- let s = X({
1704
- align: t,
1705
- cachedBounds: h,
1706
- containerScrollOffset: n,
1707
- containerSize: p,
1708
- index: o,
1709
- itemCount: a,
1710
- itemSize: m
1711
- });
1712
- if (e) {
1713
- if (s = It({
1925
+ getCellBounds: w,
1926
+ getEstimatedSize: A,
1927
+ getScrollPositionForIndex: Ut(({ align: t = "auto", index: n }) => {
1928
+ let r = ({ clamp: e, containerScrollOffset: r, containerSize: i, padding: a }) => {
1929
+ if (a.start === 0 && a.end === 0) return an({
1930
+ align: t,
1931
+ cachedBounds: x,
1932
+ clamp: e,
1933
+ containerScrollOffset: r,
1934
+ containerSize: i,
1935
+ index: n,
1936
+ itemCount: o,
1937
+ itemSize: b
1938
+ });
1939
+ let s = an({
1940
+ align: t,
1941
+ cachedBounds: x,
1942
+ clamp: !1,
1943
+ containerScrollOffset: r + a.start,
1944
+ containerSize: Math.max(0, i - a.start - a.end),
1945
+ index: n,
1946
+ itemCount: o,
1947
+ itemSize: b
1948
+ }) - a.start;
1949
+ return e ? Math.max(0, Math.min(A() - i, s)) : s;
1950
+ };
1951
+ if (f && e && p && !Qt(e, i)) {
1952
+ let { viewportOffset: t, viewportSize: n } = $t({
1953
+ containerElement: e,
1954
+ direction: i,
1955
+ isRtl: a,
1956
+ scrollTarget: p
1957
+ }), o = r({
1958
+ clamp: !1,
1959
+ containerScrollOffset: t,
1960
+ containerSize: n,
1961
+ padding: en({
1962
+ direction: i,
1963
+ isRtl: a,
1964
+ scrollTarget: p,
1965
+ viewportSize: n
1966
+ })
1967
+ }) - t, s = i === "horizontal" && a ? -o : o;
1968
+ return {
1969
+ scrollOffset: Xt(p, i) + s,
1970
+ scrollTarget: p
1971
+ };
1972
+ }
1973
+ let s = e ? i === "vertical" ? e.scrollTop : e.scrollLeft : 0, c = f && e ? i === "vertical" ? e.clientHeight : e.clientWidth : y, l = r({
1974
+ clamp: !0,
1975
+ containerScrollOffset: Kt({
1714
1976
  containerElement: e,
1715
- direction: r,
1716
- isRtl: i,
1977
+ direction: i,
1978
+ isRtl: a,
1717
1979
  scrollOffset: s
1718
- }), typeof e.scrollTo != "function") {
1719
- let e = w(s);
1720
- Lt(_, e) || v(e);
1980
+ }),
1981
+ containerSize: c,
1982
+ padding: e ? en({
1983
+ direction: i,
1984
+ isRtl: a,
1985
+ scrollTarget: e,
1986
+ viewportSize: c
1987
+ }) : {
1988
+ end: 0,
1989
+ start: 0
1990
+ }
1991
+ });
1992
+ if (e && (!f || p)) {
1993
+ if (l = Kt({
1994
+ containerElement: e,
1995
+ direction: i,
1996
+ isRtl: a,
1997
+ scrollOffset: l
1998
+ }), !f && typeof e.scrollTo != "function") {
1999
+ let e = j(l);
2000
+ nn(T, e) || E(e);
1721
2001
  }
1722
- return s;
2002
+ return {
2003
+ scrollOffset: l,
2004
+ scrollTarget: e
2005
+ };
1723
2006
  }
1724
2007
  }),
1725
- startIndexOverscan: b,
1726
- startIndexVisible: y,
1727
- stopIndexOverscan: S,
1728
- stopIndexVisible: x
2008
+ scrollTarget: p,
2009
+ startIndexOverscan: ee,
2010
+ startIndexVisible: D,
2011
+ stopIndexOverscan: k,
2012
+ stopIndexVisible: O
1729
2013
  };
1730
2014
  }
1731
- function Vt(e) {
1732
- return z(() => e, Object.values(e));
2015
+ function dn(e) {
2016
+ let [t, n] = K(e);
2017
+ return nn(t, e) ? t : (n(e), e);
1733
2018
  }
1734
- function Ht(e, t) {
2019
+ function fn(e, t) {
1735
2020
  let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
1736
- return Lt(n, a) && Lt(r, o) && Lt(i, s);
2021
+ return nn(n, a) && nn(r, o) && nn(i, s);
1737
2022
  }
1738
- function Ut(e) {
2023
+ var pn = "data-react-window-index", mn = "data-index";
2024
+ function hn(e) {
2025
+ let t = e.getAttribute(pn) ?? e.getAttribute(mn);
2026
+ return t !== null && /^\d+$/.test(t) ? Number(t) : void 0;
2027
+ }
2028
+ var gn = 1e3, _n = 500;
2029
+ function vn(e) {
2030
+ return 1 - (1 - e) ** 3;
2031
+ }
2032
+ function yn({ direction: e, element: t, getCellBounds: n, isDynamicSize: r, itemCount: i, itemElements: a, scrollTarget: o, getScrollPositionForIndex: s }) {
2033
+ let c = e === "vertical", l = G(null), u = G(void 0), d = Ut(() => {
2034
+ l.current = null, u.current !== void 0 && (u.current.view.cancelAnimationFrame(u.current.id), u.current = void 0);
2035
+ }), f = Ut(() => {
2036
+ let e = Ht(t);
2037
+ u.current = {
2038
+ id: e.requestAnimationFrame(p),
2039
+ view: e
2040
+ };
2041
+ }), p = Ut(() => {
2042
+ u.current = void 0;
2043
+ let o = l.current;
2044
+ if (!o) return;
2045
+ let p = performance.now();
2046
+ if (!t || !r || o.index >= i || o.animation !== void 0 && p >= o.animation.deadline) {
2047
+ d();
2048
+ return;
2049
+ }
2050
+ let m = s({
2051
+ align: o.align,
2052
+ index: o.index
2053
+ });
2054
+ if (m !== void 0) {
2055
+ let { scrollOffset: t, scrollTarget: r } = m, s = Math.max(0, Math.min(t, Zt(r, e)));
2056
+ o.animation === void 0 && (o.animation = {
2057
+ deadline: p + (o.smooth ? _n : 0) + gn,
2058
+ startOffset: Xt(r, e),
2059
+ startTime: p
2060
+ });
2061
+ let l = o.smooth ? (p - o.animation.startTime) / _n : 1;
2062
+ if (l < 1) {
2063
+ let { startOffset: e } = o.animation;
2064
+ o.stableFrames = 0, r.scrollTo({
2065
+ behavior: "instant",
2066
+ [c ? "top" : "left"]: e + (s - e) * vn(l)
2067
+ });
2068
+ } else if (Math.abs(s - Xt(r, e)) > 1) o.stableFrames = 0, r.scrollTo({
2069
+ behavior: "instant",
2070
+ [c ? "top" : "left"]: s
2071
+ });
2072
+ else {
2073
+ let e = a.current;
2074
+ if (!(e.some((e) => hn(e) === o.index) && e.every((e) => {
2075
+ let t = hn(e);
2076
+ if (t === void 0 || t >= i) return !0;
2077
+ let r = c ? e.offsetHeight : e.offsetWidth;
2078
+ return Math.abs(n(t).size - r) <= 1;
2079
+ }))) o.stableFrames = 0;
2080
+ else if (++o.stableFrames >= 2) {
2081
+ d();
2082
+ return;
2083
+ }
2084
+ }
2085
+ }
2086
+ f();
2087
+ });
2088
+ return X(() => {
2089
+ let e = o ?? t;
2090
+ if (!e) return;
2091
+ let n = (e) => {
2092
+ switch (e.key) {
2093
+ case "ArrowUp":
2094
+ case "ArrowDown":
2095
+ case "ArrowLeft":
2096
+ case "ArrowRight":
2097
+ case "PageUp":
2098
+ case "PageDown":
2099
+ case "Home":
2100
+ case "End":
2101
+ case " ": d();
2102
+ }
2103
+ };
2104
+ return e.addEventListener("wheel", d, { passive: !0 }), e.addEventListener("touchstart", d, { passive: !0 }), e.addEventListener("pointerdown", d), e.addEventListener("keydown", n), () => {
2105
+ d(), e.removeEventListener("wheel", d), e.removeEventListener("touchstart", d), e.removeEventListener("pointerdown", d), e.removeEventListener("keydown", n);
2106
+ };
2107
+ }, [
2108
+ d,
2109
+ t,
2110
+ o
2111
+ ]), H(({ align: n = "auto", behavior: i = "auto", index: a }) => {
2112
+ if (r && n === "smart") {
2113
+ let t = s({
2114
+ align: "auto",
2115
+ index: a
2116
+ });
2117
+ n = t === void 0 || t.scrollOffset === Xt(t.scrollTarget, e) ? "auto" : "center";
2118
+ }
2119
+ let o = s({
2120
+ align: n,
2121
+ index: a
2122
+ });
2123
+ if (d(), o && typeof o.scrollTarget.scrollTo == "function") {
2124
+ let { scrollOffset: e, scrollTarget: s } = o;
2125
+ if (r) {
2126
+ let e = i === "smooth" && t?.ownerDocument.visibilityState !== "hidden";
2127
+ if (l.current = {
2128
+ align: n,
2129
+ index: a,
2130
+ smooth: e,
2131
+ stableFrames: 0
2132
+ }, f(), e) return;
2133
+ }
2134
+ s.scrollTo({
2135
+ behavior: r ? "instant" : i,
2136
+ [c ? "top" : "left"]: e
2137
+ });
2138
+ }
2139
+ }, [
2140
+ d,
2141
+ e,
2142
+ t,
2143
+ r,
2144
+ c,
2145
+ f,
2146
+ s
2147
+ ]);
2148
+ }
2149
+ function bn({ callback: e, element: t, enabled: n = !0 }) {
2150
+ let r = Ut(e);
2151
+ U(() => {
2152
+ if (!n || !t) return;
2153
+ let e = Ht(t), i = e.requestAnimationFrame(() => {
2154
+ i = e.requestAnimationFrame(r);
2155
+ });
2156
+ return () => {
2157
+ e.cancelAnimationFrame(i);
2158
+ };
2159
+ }, [
2160
+ t,
2161
+ n,
2162
+ r
2163
+ ]);
2164
+ }
2165
+ function xn({ elements: e, isFlowLayout: t, rowCount: n, startIndex: r, stopIndex: i }) {
2166
+ if (r < 0 || i < r) return [];
2167
+ let a = [], o = /* @__PURE__ */ new Set(), s = !0;
2168
+ for (let t of e) {
2169
+ let e = t.getAttribute("aria-posinset");
2170
+ if (e === null) continue;
2171
+ let c = Number(e) - 1;
2172
+ if (!/^\d+$/.test(e) || c < r || c > i || o.has(c) || t.getAttribute("aria-setsize") !== `${n}`) {
2173
+ s = !1;
2174
+ break;
2175
+ }
2176
+ o.add(c), a.push({
2177
+ element: t,
2178
+ index: c
2179
+ });
2180
+ }
2181
+ if (s && a.length > 0) return a;
2182
+ let c = Math.min(e.length, i - r + 1);
2183
+ return (t ? e.slice(e.length - c) : e.slice(0, c)).map((e, t) => ({
2184
+ element: e,
2185
+ index: r + t
2186
+ }));
2187
+ }
2188
+ function Sn(e) {
1739
2189
  return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
1740
2190
  }
1741
- var Wt = "data-react-window-index";
1742
- function Gt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onResize: i, onRowsRendered: a, overscanCount: o = 3, rowComponent: s, rowCount: c, rowHeight: l, rowProps: u, tagName: d = "div", style: f, ...p }) {
1743
- let m = Vt(u), h = z(() => we(s, Ht), [s]), [g, _] = V(null), v = Ut(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = Q({
1744
- containerElement: g,
1745
- containerStyle: f,
2191
+ var Cn = "data-react-window-sizer";
2192
+ function wn({ children: e, className: t, defaultHeight: n = 0, defaultScrollOffset: r = 0, listRef: i, onResize: a, onRowsRendered: o, overscanCount: s = 3, rowComponent: c, rowCount: l, rowHeight: u, rowKey: d, rowProps: f, scrollElement: p, tagName: m = "div", style: h, ...g }) {
2193
+ let _ = dn(f), v = W(() => ke(c, fn), [c]), [y, b] = K(null), x = Sn(u), S = W(() => x ? (e) => u.getRowHeight(e) ?? u.getAverageRowHeight() : u, [x, u]), C = Vt(), [w, T] = K(() => C && x), E = G(u);
2194
+ X(() => {
2195
+ w && E.current !== u && T(!1);
2196
+ }, [w, u]), bn({
2197
+ callback: () => T(!1),
2198
+ element: y,
2199
+ enabled: w
2200
+ });
2201
+ let { getCellBounds: D, getEstimatedSize: ee, scrollTarget: O, getScrollPositionForIndex: k, startIndexOverscan: A, startIndexVisible: j, stopIndexOverscan: M, stopIndexVisible: N } = un({
2202
+ containerElement: y,
2203
+ containerStyle: h,
1746
2204
  defaultContainerSize: n,
2205
+ defaultScrollOffset: r,
2206
+ direction: "vertical",
2207
+ itemCount: l,
2208
+ itemProps: _,
2209
+ itemSize: S,
2210
+ onResize: a,
2211
+ overscanCount: s,
2212
+ scrollElement: p
2213
+ }), te = G([]), ne = yn({
1747
2214
  direction: "vertical",
1748
- itemCount: c,
1749
- itemProps: m,
1750
- itemSize: z(() => v ? (e) => l.getRowHeight(e) ?? l.getAverageRowHeight() : l, [v, l]),
1751
- onResize: i,
1752
- overscanCount: o
2215
+ element: y,
2216
+ getCellBounds: D,
2217
+ isDynamicSize: x,
2218
+ itemCount: l,
2219
+ itemElements: te,
2220
+ scrollTarget: O,
2221
+ getScrollPositionForIndex: k
1753
2222
  });
1754
- Ee(r, () => ({
2223
+ je(i, () => ({
1755
2224
  get element() {
1756
- return g;
2225
+ return y;
1757
2226
  },
1758
- scrollToRow({ align: e = "auto", behavior: t = "auto", index: n }) {
1759
- let r = x({
1760
- align: e,
1761
- containerScrollOffset: g?.scrollTop ?? 0,
1762
- index: n
1763
- });
1764
- typeof g?.scrollTo == "function" && g.scrollTo({
1765
- behavior: t,
1766
- top: r
1767
- });
1768
- }
1769
- }), [g, x]), jt(() => {
1770
- if (!g) return;
1771
- let e = Array.from(g.children).filter((e, t) => {
1772
- if (e.hasAttribute("aria-hidden")) return !1;
1773
- let n = `${S + t}`;
1774
- return e.setAttribute(Wt, n), !0;
1775
- });
1776
- if (v) return l.observeRowElements(e);
2227
+ scrollToRow: ne
2228
+ }), [y, ne]);
2229
+ let P = w && x && A === 0;
2230
+ X(() => {
2231
+ if (!y) return;
2232
+ let e = Array.from(y.children).filter((e) => !e.hasAttribute(Cn)), t = xn({
2233
+ elements: e,
2234
+ isFlowLayout: P,
2235
+ rowCount: l,
2236
+ startIndex: A,
2237
+ stopIndex: M
2238
+ }), n = t.map(({ element: e }) => e);
2239
+ if (e.forEach((e) => {
2240
+ n.includes(e) || e.removeAttribute(pn);
2241
+ }), t.forEach(({ element: e, index: t }) => {
2242
+ e.setAttribute(pn, `${t}`);
2243
+ }), te.current = n, x) return u.observeRowElements(n);
1777
2244
  }, [
1778
- g,
1779
2245
  v,
2246
+ y,
2247
+ x,
2248
+ P,
1780
2249
  l,
1781
- S,
1782
- w
1783
- ]), R(() => {
1784
- S >= 0 && w >= 0 && a && a({
1785
- startIndex: C,
1786
- stopIndex: T
2250
+ u,
2251
+ d,
2252
+ _,
2253
+ A,
2254
+ M
2255
+ ]), U(() => {
2256
+ A >= 0 && M >= 0 && o && o({
2257
+ startIndex: j,
2258
+ stopIndex: N
1787
2259
  }, {
1788
- startIndex: S,
1789
- stopIndex: w
2260
+ startIndex: A,
2261
+ stopIndex: M
1790
2262
  });
1791
2263
  }, [
1792
- a,
1793
- S,
1794
- C,
1795
- w,
1796
- T
2264
+ o,
2265
+ A,
2266
+ j,
2267
+ M,
2268
+ N
1797
2269
  ]);
1798
- let E = z(() => {
2270
+ let F = W(() => {
1799
2271
  let e = [];
1800
- if (c > 0) for (let t = S; t <= w; t++) {
1801
- let n = y(t);
1802
- e.push(/* @__PURE__ */ Se(h, {
1803
- ...m,
2272
+ if (l > 0) for (let t = A; t <= M; t++) {
2273
+ let n = D(t);
2274
+ e.push(/* @__PURE__ */ De(v, {
2275
+ ..._,
1804
2276
  ariaAttributes: {
1805
2277
  "aria-posinset": t + 1,
1806
- "aria-setsize": c,
2278
+ "aria-setsize": l,
1807
2279
  role: "listitem"
1808
2280
  },
1809
- key: t,
2281
+ key: d ? d(t, _) : t,
1810
2282
  index: t,
1811
- style: {
2283
+ style: P ? { width: "100%" } : {
1812
2284
  position: "absolute",
1813
2285
  left: 0,
1814
2286
  transform: `translateY(${n.scrollOffset}px)`,
1815
- height: v ? void 0 : n.size,
2287
+ height: x ? void 0 : n.size,
1816
2288
  width: "100%"
1817
2289
  }
1818
2290
  }));
1819
2291
  }
1820
2292
  return e;
1821
2293
  }, [
1822
- h,
1823
- y,
1824
2294
  v,
1825
- c,
1826
- m,
1827
- S,
1828
- w
1829
- ]), D = /* @__PURE__ */ P("div", {
2295
+ D,
2296
+ x,
2297
+ P,
2298
+ l,
2299
+ d,
2300
+ _,
2301
+ A,
2302
+ M
2303
+ ]), I = /* @__PURE__ */ B("div", {
1830
2304
  "aria-hidden": !0,
2305
+ [Cn]: "",
1831
2306
  style: {
1832
- height: b(),
2307
+ position: P ? "absolute" : void 0,
2308
+ top: P ? 0 : void 0,
2309
+ height: ee(),
1833
2310
  width: "100%",
1834
2311
  zIndex: -1
1835
2312
  }
1836
- });
1837
- return Se(d, {
2313
+ }, "sizer"), L = /* @__PURE__ */ B(Ee, { children: e }, "children"), R = /* @__PURE__ */ B(Ee, { children: F }, "rows");
2314
+ return De(m, {
1838
2315
  role: "list",
1839
- ...p,
2316
+ ...g,
1840
2317
  className: t,
1841
- ref: _,
2318
+ ref: b,
1842
2319
  style: {
1843
2320
  position: "relative",
1844
- maxHeight: "100%",
1845
2321
  flexGrow: 1,
1846
- overflowY: "auto",
1847
- ...f
2322
+ ...p === void 0 && {
2323
+ maxHeight: "100%",
2324
+ overflowY: "auto"
2325
+ },
2326
+ ...h
1848
2327
  }
1849
- }, E, e, D);
2328
+ }, ...P ? [L, R] : [R, L], I);
1850
2329
  }
1851
- var Kt = {
2330
+ var Tn = /* @__PURE__ */ Object.assign(wn, { displayName: "List" }), En = {
1852
2331
  search: "_search_5skzl_1",
1853
2332
  divider: "_divider_5skzl_5",
1854
2333
  item: "_item_5skzl_9",
@@ -1857,101 +2336,110 @@ var Kt = {
1857
2336
  stateLabel: "_stateLabel_5skzl_27",
1858
2337
  itemSelectedBackground: "_itemSelectedBackground_5skzl_37",
1859
2338
  itemSelectedText: "_itemSelectedText_5skzl_41"
1860
- }, qt = 44, Jt = 8, Yt = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: o, itemClassName: s, selectedItemClassName: c, hasSelectedBackground: u, hasSelectedText: d, onSelect: f }) => {
1861
- let p = r[e], h = Ot(p.iconUrl, p.type, p.displayName ?? p.id, g.SM), v = p.id === i;
1862
- return /* @__PURE__ */ P("div", {
2339
+ }, Dn = 44, On = 8, kn = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: o, itemClassName: s, selectedItemClassName: c, hasSelectedBackground: u, hasSelectedText: d, onSelect: f }) => {
2340
+ let p = r[e], m = It(p.iconUrl, p.type, p.displayName ?? p.id, v.SM), g = p.id === i;
2341
+ return /* @__PURE__ */ B("div", {
1863
2342
  style: t,
1864
2343
  ...n,
1865
- children: /* @__PURE__ */ P(m, {
2344
+ children: /* @__PURE__ */ B(h, {
1866
2345
  type: "button",
1867
- "aria-current": v ? "true" : void 0,
1868
- className: l(Kt.item, "h-full w-full gap-3 px-4", v && u && Kt.itemSelectedBackground, v && d && Kt.itemSelectedText, s, v && c, H.modelMenuItem, v && H.modelMenuItemSelected),
1869
- iconBefore: /* @__PURE__ */ P("span", {
1870
- className: Kt.itemIcon,
1871
- children: h
2346
+ "aria-current": g ? "true" : void 0,
2347
+ className: l(En.item, "h-full w-full gap-3 px-4", g && u && En.itemSelectedBackground, g && d && En.itemSelectedText, s, g && c, q.modelMenuItem, g && q.modelMenuItemSelected),
2348
+ iconBefore: /* @__PURE__ */ B("span", {
2349
+ className: En.itemIcon,
2350
+ children: m
1872
2351
  }),
1873
- label: /* @__PURE__ */ F("span", {
2352
+ label: /* @__PURE__ */ V("span", {
1874
2353
  className: "flex flex-1 items-center justify-between gap-2",
1875
- children: [/* @__PURE__ */ P(S, {
2354
+ children: [/* @__PURE__ */ B(w, {
1876
2355
  text: p.displayName ?? p.id,
1877
2356
  query: o,
1878
2357
  maxLines: 1,
1879
2358
  className: l(a, "min-w-0 flex-1 text-start")
1880
- }), v && /* @__PURE__ */ P(de, {
1881
- size: g.SM,
1882
- className: Kt.checkIcon,
2359
+ }), g && /* @__PURE__ */ B(he, {
2360
+ size: v.SM,
2361
+ className: En.checkIcon,
1883
2362
  "aria-hidden": !0,
1884
- stroke: _
2363
+ stroke: y
1885
2364
  })]
1886
2365
  }),
1887
2366
  onClick: () => f(p.id)
1888
2367
  })
1889
2368
  });
1890
- }, Xt = ({ isOpen: e, title: t, closeLabel: n, searchPlaceholder: r = "Search", onClose: i, deployments: a, selectedDeploymentId: o, onSelect: s, loadingLabel: u, errorLabel: d, emptyLabel: f, style: p, titleClassName: m = "dial-body-semi-text", labelClassName: h = "dial-small-text", colors: g, menuStyles: _ }) => {
1891
- let [v, b] = V("");
1892
- R(() => {
1893
- e || b("");
2369
+ }, An = ({ 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: _, searchQuery: v, onSearchQueryChange: y }) => {
2370
+ let [b, S] = K(""), C = v ?? b, w = y ?? S;
2371
+ U(() => {
2372
+ e || S("");
1894
2373
  }, [e]);
1895
- let x = a && a.length > 0, S = u !== void 0, C = !x && !S ? d ?? f : void 0, w = x ? Dt(a, v) : [], T = (e) => {
2374
+ let E = a && a.length > 0, D = u !== void 0, ee = !E && !D ? d ?? f : void 0, O = E ? Ft(a, C) : [], k = (e) => {
1896
2375
  s(e), i();
1897
- }, E = _?.colors, D = c({
2376
+ }, A = _?.colors, j = c({
1898
2377
  "--ci-sheet-divider": g?.divider,
1899
- "--ci-sheet-text": E?.itemText ?? g?.itemText,
1900
- "--ci-sheet-item-hover": E?.itemHoverBackground ?? g?.itemHoverBg,
2378
+ "--ci-sheet-text": A?.itemText ?? g?.itemText,
2379
+ "--ci-sheet-item-hover": A?.itemHoverBackground ?? g?.itemHoverBg,
1901
2380
  "--ci-sheet-item-active": g?.itemActiveBg,
1902
- "--ci-sheet-icon": E?.itemText ?? g?.itemIcon,
1903
- "--ci-check-icon": E?.checkIcon ?? g?.checkIcon,
1904
- "--ci-sheet-selected-bg": E?.selectedItemBackground,
1905
- "--ci-sheet-selected-text": E?.selectedItemText
2381
+ "--ci-sheet-icon": A?.itemText ?? g?.itemIcon,
2382
+ "--ci-check-icon": A?.checkIcon ?? g?.checkIcon,
2383
+ "--ci-sheet-selected-bg": A?.selectedItemBackground,
2384
+ "--ci-sheet-selected-text": A?.selectedItemText
1906
2385
  });
1907
- return /* @__PURE__ */ P(U, {
2386
+ return /* @__PURE__ */ B(Fe, {
1908
2387
  isOpen: e,
1909
2388
  title: t,
1910
2389
  closeLabel: n,
1911
2390
  onClose: i,
1912
2391
  style: p,
1913
2392
  titleClassName: m,
1914
- className: l("max-h-[80dvh]", _?.className, H.modelMenu),
2393
+ className: l("max-h-[80dvh]", _?.className, q.modelMenu),
1915
2394
  colors: g?.shell,
1916
- children: /* @__PURE__ */ F("div", {
2395
+ children: /* @__PURE__ */ V("div", {
1917
2396
  className: "contents",
1918
- style: D,
1919
- children: [x && !S && /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P("div", {
1920
- style: c({ "--ci-sheet-search-bg": _?.colors?.searchHeaderBackground }),
1921
- className: l("flex-shrink-0 px-4 py-[10px]", Kt.search, _?.searchHeaderClassName, H.modelMenuSearch),
1922
- children: /* @__PURE__ */ P(j, {
1923
- value: v,
1924
- placeholder: r,
1925
- size: y.Standard,
1926
- onChange: (e) => b(e ?? "")
2397
+ style: j,
2398
+ children: [
2399
+ /* @__PURE__ */ B(T, {
2400
+ visuallyHidden: !0,
2401
+ children: D ? u : null
2402
+ }),
2403
+ E && !D && /* @__PURE__ */ V(le, { children: [/* @__PURE__ */ B("div", {
2404
+ style: c({ "--ci-sheet-search-bg": _?.colors?.searchHeaderBackground }),
2405
+ className: l("shrink-0 px-4 py-[10px]", En.search, _?.searchHeaderClassName, q.modelMenuSearch),
2406
+ children: /* @__PURE__ */ B(L, {
2407
+ value: C,
2408
+ placeholder: r,
2409
+ size: x.Standard,
2410
+ onChange: (e) => w(e ?? "")
2411
+ })
2412
+ }), /* @__PURE__ */ B("div", { className: l(En.divider, "h-px shrink-0") })] }),
2413
+ D ? /* @__PURE__ */ B(Nt, {}) : ee ? /* @__PURE__ */ B("div", {
2414
+ role: "list",
2415
+ className: l(En.stateLabel, h, "px-4 py-4"),
2416
+ children: ee
2417
+ }) : /* @__PURE__ */ B(Tn, {
2418
+ role: "list",
2419
+ className: "overflow-y-auto",
2420
+ style: { height: Math.min(O.length, On) * Dn },
2421
+ rowComponent: kn,
2422
+ rowCount: O.length,
2423
+ rowHeight: Dn,
2424
+ rowProps: {
2425
+ items: O,
2426
+ selectedDeploymentId: o,
2427
+ labelClassName: h,
2428
+ query: C,
2429
+ itemClassName: _?.itemClassName,
2430
+ selectedItemClassName: _?.selectedItemClassName,
2431
+ hasSelectedBackground: !!A?.selectedItemBackground,
2432
+ hasSelectedText: !!A?.selectedItemText,
2433
+ onSelect: k
2434
+ }
1927
2435
  })
1928
- }), /* @__PURE__ */ P("div", { className: l(Kt.divider, "h-px flex-shrink-0") })] }), S ? /* @__PURE__ */ P(Tt, { loadingLabel: u }) : C ? /* @__PURE__ */ P("div", {
1929
- role: "list",
1930
- className: l(Kt.stateLabel, h, "px-4 py-4"),
1931
- children: C
1932
- }) : /* @__PURE__ */ P(Gt, {
1933
- role: "list",
1934
- className: "overflow-y-auto",
1935
- style: { height: Math.min(w.length, Jt) * qt },
1936
- rowComponent: Yt,
1937
- rowCount: w.length,
1938
- rowHeight: qt,
1939
- rowProps: {
1940
- items: w,
1941
- selectedDeploymentId: o,
1942
- labelClassName: h,
1943
- query: v,
1944
- itemClassName: _?.itemClassName,
1945
- selectedItemClassName: _?.selectedItemClassName,
1946
- hasSelectedBackground: !!E?.selectedItemBackground,
1947
- hasSelectedText: !!E?.selectedItemText,
1948
- onSelect: T
1949
- }
1950
- })]
2436
+ ]
1951
2437
  })
1952
2438
  });
1953
- }, Zt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, menuStyles: i, isStreaming: a, isMobile: o, isDisabled: c = !1, style: u, modelPickerOverlay: d, isPickerOpen: f, onPickerToggle: p, onPickerOpenChange: h }) => {
1954
- let [y, b] = V(!1), { selectorIcon: S, selectorAriaLabel: C, selectedLabel: w, selectedVersion: T, menuItems: E, menuHeader: D, menuStyle: ee, onOpenChange: O } = At({
2439
+ }, jn = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, menuStyles: i, nameClassName: a = "dial-small-text", versionClassName: o = "dial-tiny-text", isStreaming: u, isMobile: d, isDisabled: f = !1, style: p, modelPickerOverlay: m, isPickerOpen: g, onPickerToggle: _, onPickerOpenChange: x }) => {
2440
+ let [S, w] = K(!1), T = g ?? S, E = (e) => {
2441
+ w(e), x?.(e), ne(e);
2442
+ }, { searchQuery: D, onSearchQueryChange: ee, selectorIcon: O, selectorAriaLabel: k, selectedLabel: A, selectedVersion: j, menuItems: M, menuHeader: N, menuStyle: te, onOpenChange: ne } = Rt({
1955
2443
  deployments: e,
1956
2444
  selectedDeploymentId: t,
1957
2445
  onDeploymentChange: n,
@@ -1959,431 +2447,453 @@ var Kt = {
1959
2447
  styles: i
1960
2448
  });
1961
2449
  if (!e) return null;
1962
- let k = a || c, A = k ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, j = /* @__PURE__ */ P(fe, {
1963
- size: g.SM,
1964
- className: l(K.modelSelectorCaret, H.modelSelectorCaret),
2450
+ let P = u || f, F = P ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, I = /* @__PURE__ */ B(ge, {
2451
+ size: v.SM,
2452
+ className: l(Y.modelSelectorCaret, q.modelSelectorCaret),
1965
2453
  "aria-hidden": !0,
1966
- stroke: _
1967
- }), te = /* @__PURE__ */ P("span", {
1968
- className: l("flex shrink-0 items-center", H.modelSelectorIcon),
1969
- children: S
2454
+ stroke: y
2455
+ }), L = /* @__PURE__ */ B("span", {
2456
+ className: l("flex shrink-0 items-center", q.modelSelectorIcon),
2457
+ children: O
1970
2458
  });
1971
- if (o) return /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P(x, {
1972
- tooltipProps: { tooltip: w },
1973
- icon: /* @__PURE__ */ F("div", {
2459
+ if (d) return /* @__PURE__ */ V(le, { children: [/* @__PURE__ */ B(C, {
2460
+ tooltipProps: { tooltip: A },
2461
+ icon: /* @__PURE__ */ V("div", {
1974
2462
  className: "flex items-center gap-1",
1975
- children: [te, j]
2463
+ children: [L, I]
1976
2464
  }),
1977
- "aria-label": C,
1978
- "aria-disabled": k || void 0,
2465
+ "aria-label": k,
2466
+ "aria-disabled": P || void 0,
1979
2467
  onClick: () => {
1980
- k || b(!0);
2468
+ P || E(!0);
1981
2469
  },
1982
- className: l("w-[50px]", K.modelSelectorButton, A, H.modelSelectorButton)
1983
- }), d ? /* @__PURE__ */ P(U, {
1984
- isOpen: y,
2470
+ className: l("w-[50px]", Y.modelSelectorButton, F, q.modelSelectorButton)
2471
+ }), m ? /* @__PURE__ */ B(Fe, {
2472
+ isOpen: T,
1985
2473
  title: r?.ariaLabel ?? "Select model",
1986
2474
  closeLabel: r?.closeLabel ?? "Close",
1987
- onClose: () => b(!1),
1988
- style: u,
1989
- className: l(i?.className, H.modelMenu),
1990
- children: d(() => b(!1))
1991
- }) : /* @__PURE__ */ P(Xt, {
1992
- isOpen: y,
2475
+ onClose: () => E(!1),
2476
+ style: p,
2477
+ className: l(i?.className, q.modelMenu),
2478
+ children: m(() => E(!1))
2479
+ }) : /* @__PURE__ */ B(An, {
2480
+ searchQuery: D,
2481
+ onSearchQueryChange: ee,
2482
+ isOpen: T,
1993
2483
  title: r?.ariaLabel ?? "Select model",
1994
2484
  closeLabel: r?.closeLabel ?? "Close",
1995
2485
  searchPlaceholder: r?.searchPlaceholder ?? "Search",
1996
- onClose: () => b(!1),
2486
+ onClose: () => E(!1),
1997
2487
  deployments: e,
1998
2488
  selectedDeploymentId: t,
1999
2489
  onSelect: (e) => n?.(e),
2000
2490
  loadingLabel: r?.loading,
2001
2491
  errorLabel: r?.error,
2002
2492
  emptyLabel: r?.empty,
2003
- style: u,
2493
+ style: p,
2004
2494
  menuStyles: i
2005
2495
  })] });
2006
- if (d) {
2007
- let e = T ? `${w} · ${T}` : w;
2008
- return /* @__PURE__ */ P(v, {
2496
+ if (m) {
2497
+ let e = j ? `${A} · ${j}` : A;
2498
+ return /* @__PURE__ */ B(b, {
2009
2499
  placement: "top-end",
2010
2500
  matchReferenceWidth: !1,
2011
- open: f,
2012
- onOpenChange: h,
2501
+ open: T,
2502
+ onOpenChange: E,
2013
2503
  trigger: [],
2014
2504
  outsideClosable: !0,
2015
- renderOverlay: () => d(() => h?.(!1)),
2016
- listClassName: l("!w-[368px] !bg-layer-raised", i?.className, H.modelMenu),
2017
- children: /* @__PURE__ */ P(m, {
2018
- "aria-label": C,
2019
- "aria-disabled": k || void 0,
2505
+ renderOverlay: () => m(() => E(!1)),
2506
+ listClassName: l("w-[368px]!", Y.modelOverlayPanel, i?.className, q.modelMenu),
2507
+ listStyle: c({ "--ci-model-overlay-bg": i?.colors?.overlayBackground }),
2508
+ children: /* @__PURE__ */ B(h, {
2509
+ "aria-label": k,
2510
+ "aria-disabled": P || void 0,
2020
2511
  tooltipProps: { tooltip: e },
2021
- className: l("h-auto min-w-0 gap-1.5 !rounded-full !border-0 px-0 py-1.5 pe-2 ps-1.5", K.modelSelectorButton, A, k && K.modelSelectorButtonDisabled, H.modelSelectorButton),
2512
+ className: l("h-auto min-w-0 gap-1.5 rounded-full! border-0! px-0 py-1.5 ps-1.5 pe-2", Y.modelSelectorButton, F, P && Y.modelSelectorButtonDisabled, q.modelSelectorButton),
2022
2513
  onClick: () => {
2023
- k || p?.();
2514
+ P || (_ ? _() : E(!T));
2024
2515
  },
2025
- iconBefore: te,
2026
- iconAfter: j,
2516
+ iconBefore: L,
2517
+ iconAfter: I,
2027
2518
  textClassName: "min-w-0",
2028
- label: /* @__PURE__ */ F("span", {
2029
- className: "flex min-w-0 max-w-[180px] items-baseline gap-1",
2030
- children: [/* @__PURE__ */ P("span", {
2031
- className: l("dial-small-text max-w-[180px] shrink-0 truncate", K.modelSelectorName),
2032
- children: w
2033
- }), T && /* @__PURE__ */ P("span", {
2034
- className: l("dial-tiny-text min-w-0 truncate", K.modelSelectorVersion),
2035
- children: T
2519
+ label: /* @__PURE__ */ V("span", {
2520
+ className: "flex max-w-[180px] min-w-0 items-baseline gap-1",
2521
+ children: [/* @__PURE__ */ B("span", {
2522
+ className: l("max-w-[180px] shrink-0 truncate", a, Y.modelSelectorName),
2523
+ children: A
2524
+ }), j && /* @__PURE__ */ B("span", {
2525
+ className: l("min-w-0 truncate", o, Y.modelSelectorVersion),
2526
+ children: j
2036
2527
  })]
2037
2528
  })
2038
2529
  })
2039
2530
  });
2040
2531
  }
2041
- return /* @__PURE__ */ P("div", {
2042
- className: l(A),
2043
- "aria-disabled": k || void 0,
2044
- children: /* @__PURE__ */ P(v, {
2045
- items: E,
2046
- menuHeader: D,
2532
+ return /* @__PURE__ */ B("div", {
2533
+ className: l(F),
2534
+ "aria-disabled": P || void 0,
2535
+ children: /* @__PURE__ */ B(b, {
2536
+ items: M,
2537
+ menuHeader: N,
2047
2538
  placement: "bottom-end",
2048
2539
  matchReferenceWidth: !1,
2049
2540
  maxDropdownHeight: s,
2050
- listClassName: l("!w-[240px]", i?.className, H.modelMenu),
2051
- listStyle: ee,
2052
- disabled: k,
2053
- onOpenChange: k ? void 0 : O,
2054
- children: /* @__PURE__ */ P(m, {
2055
- "aria-label": C,
2056
- "aria-disabled": k || void 0,
2057
- tooltipProps: { tooltip: w },
2058
- iconBefore: te,
2059
- iconAfter: j,
2060
- className: l("h-auto gap-1 !rounded-full !border-0 p-1.5", K.modelSelectorButton, k && K.modelSelectorButtonDisabled, H.modelSelectorButton)
2541
+ listClassName: l("w-[240px]!", i?.className, q.modelMenu),
2542
+ listStyle: te,
2543
+ disabled: P,
2544
+ open: T,
2545
+ onOpenChange: P ? void 0 : E,
2546
+ children: /* @__PURE__ */ B(h, {
2547
+ "aria-label": k,
2548
+ "aria-disabled": P || void 0,
2549
+ tooltipProps: { tooltip: A },
2550
+ iconBefore: L,
2551
+ iconAfter: I,
2552
+ className: l("h-auto gap-1 rounded-full! border-0! p-1.5", Y.modelSelectorButton, P && Y.modelSelectorButtonDisabled, q.modelSelectorButton)
2061
2553
  })
2062
2554
  })
2063
2555
  });
2064
- }, Qt = Ce(({ message: e = "", messageRevision: t, focusRequestId: n, textInsertion: r, onSend: i, onUploadAttachment: a, onStop: o, isStreaming: s = !1, onChange: u, onAttachmentsChange: p, placeholder: m = "Type a message...", ariaLabel: h, attachLabel: y = "Attach file", fileAccept: S, addMenuTitle: C = "Add", menuTitle: w = "Menu", menuCloseLabel: T = "Close", removeLabel: E, retryLabel: D, uploadingLabel: ee, expandLabel: O, clickLabel: k, sendLabel: A, sendTooltip: j, emptyMessageTooltip: te, stopLabel: ne, micLabel: re = "Dictate", recordVoiceLabel: ie = "Record voice", stopRecordingLabel: ae, discardRecordingLabel: oe, colors: M, typography: I, attachmentTray: ce, modelMenu: ue, className: de, pendingDropFiles: fe = [], onDropFilesConsumed: pe, pendingAttachments: ge = [], onPendingAttachmentsConsumed: _e, pasteTextThreshold: ve = 4e3, maxMessageLength: ye = 5e4, deployments: be, selectedDeploymentId: xe, onDeploymentChange: Se, modelSelectorLabels: Ce, initialAttachments: we = [], hideAddButton: Te = !1, hideAttachFile: Oe = !1, hideActionBar: U = !1, actionRowLayout: ke = tt.Stacked, isInlineActionRowAllowedBelowDesktop: je = !1, renderFooterActions: Me, isInputDisabled: W = !1, isModelSelectorDisabled: Ne = !1, isSendDisabled: Ie = !1, isAudioMessageSupported: Le = !1, isVoiceRecordingSupported: Be = Le, onTranscribeAudio: Ve, transcribingLabel: Ge, voiceErrorLabel: Ye, sendOnEnter: Xe = et.Enter, prefixAttachments: Ze = [], onRemovePrefixAttachment: Qe, chatSettings: nt, toolsMenuItems: rt, onToolToggle: it, canRemoveTools: at = !0, toolsMenuTitle: ot, toolsBackLabel: st, toolsChipLabels: ct, menuOverlays: lt, activeMentions: ut, onBackspaceAtCaret: dt, caretPositionOverride: ft, commandMenu: G, autoFocus: mt = !1, messageHistory: gt, onDialFileSystemClick: _t, dialFileSystemLabel: vt, validateAttachment: yt, onAttachmentClick: Ct, modelPickerOverlay: wt, maximumAttachmentsAmount: Tt, onAttachmentsLimitExceeded: Et, isAttachmentsEnabled: Dt = !0, isTextAttachmentsAllowed: Ot = !0, usageLimitsSlot: kt, onMessageTooLong: At }, jt) => {
2065
- let Mt = d(), [Nt, Pt] = V(!1), q = Re(gt), Ft = ut ?? [], It = Ft.length > 0, J = z(() => c({
2066
- "--ci-bg": M?.background,
2067
- "--ci-text": M?.text,
2068
- "--ci-border": M?.border,
2069
- "--ci-border-focus": M?.borderFocus,
2070
- "--ci-placeholder": M?.placeholder,
2071
- "--ci-text-disabled": M?.textDisabled,
2072
- "--ci-model-selector-caret-color": M?.modelSelectorCaret,
2073
- "--ci-model-selector-hover-bg": M?.modelSelectorHoverBg,
2074
- "--ci-model-selector-disabled-color": M?.modelSelectorDisabled,
2075
- "--ci-model-selector-name-color": M?.modelSelectorName,
2076
- "--ci-model-selector-version-color": M?.modelSelectorVersion,
2077
- "--ci-voice-waveform": M?.voiceWaveform,
2078
- "--ci-voice-accent": M?.voiceAccent,
2079
- "--ci-mention-highlight-bg": M?.mentionHighlightBg,
2080
- "--ci-mention-highlight-text": M?.mentionHighlightText,
2081
- "--ci-mention-highlight-unsupported-bg": M?.mentionHighlightUnsupportedBg,
2082
- "--ci-mention-highlight-unsupported-text": M?.mentionHighlightUnsupportedText
2083
- }), [M]), Lt = z(() => _t ? [{
2556
+ }, Mn = Oe(({ message: e = "", messageRevision: t, focusRequestId: n, textInsertion: r, onSend: i, onUploadAttachment: a, onStop: o, isStreaming: s = !1, onChange: u, onAttachmentsChange: m, placeholder: h = "Type a message...", ariaLabel: g, attachLabel: _ = "Attach file", fileAccept: x, addMenuTitle: w = "Add", menuTitle: ee = "Menu", menuCloseLabel: O = "Close", removeLabel: k, retryLabel: A, uploadingLabel: j, expandLabel: M, clickLabel: N, sendLabel: te, sendTooltip: ne, emptyMessageTooltip: P, stopLabel: F, micLabel: I = "Dictate", recordVoiceLabel: L = "Record voice", stopRecordingLabel: R, discardRecordingLabel: re, colors: z, typography: ie, attachmentTray: ae, modelMenu: oe, className: se, pendingDropFiles: ce = [], onDropFilesConsumed: de, pendingAttachments: fe = [], onPendingAttachmentsConsumed: me, pasteTextThreshold: he = 4e3, maxMessageLength: ge = 5e4, deployments: _e, selectedDeploymentId: be, onDeploymentChange: xe, modelSelectorLabels: Se, initialAttachments: Ce = [], hideAddButton: we = !1, hideAttachFile: Te = !1, hideActionBar: Ee = !1, actionRowLayout: De = lt.Stacked, isInlineActionRowAllowedBelowDesktop: Oe = !1, renderFooterActions: ke, isInputDisabled: Ae = !1, isModelSelectorDisabled: Ne = !1, isSendDisabled: Pe = !1, isAudioMessageSupported: Fe = !1, isVoiceRecordingSupported: Ie = Fe, onTranscribeAudio: Re, transcribingLabel: ze, voiceErrorLabel: Be, sendOnEnter: Ve = ct.Enter, prefixAttachments: We = [], onRemovePrefixAttachment: Ge, chatSettings: Je, toolsMenuItems: Ye, onToolToggle: $e, canRemoveTools: rt = !0, toolsMenuTitle: it, toolsBackLabel: at, toolsChipLabels: ot, menuOverlays: ut, activeMentions: dt, onBackspaceAtCaret: ft, caretPositionOverride: pt, commandMenu: J, autoFocus: mt = !1, messageHistory: ht, onDialFileSystemClick: gt, dialFileSystemLabel: _t, validateAttachment: vt, onAttachmentClick: yt, modelPickerOverlay: xt, onModelPickerOpenChange: St, maximumAttachmentsAmount: wt, onAttachmentsLimitExceeded: Tt, isAttachmentsEnabled: Et = !0, isTextAttachmentsAllowed: Dt = !0, usageLimitsSlot: jt, onMessageTooLong: Mt }, Nt) => {
2557
+ let Pt = d(), Ft = f(), [It, Lt] = K(!1), Rt = (e) => {
2558
+ Lt(e), St?.(e);
2559
+ }, X = Ke(ht), zt = dt ?? [], Bt = zt.length > 0, Vt = W(() => c({
2560
+ "--ci-bg": z?.background,
2561
+ "--ci-text": z?.text,
2562
+ "--ci-border": z?.border,
2563
+ "--ci-border-focus": z?.borderFocus,
2564
+ "--ci-placeholder": z?.placeholder,
2565
+ "--ci-text-disabled": z?.textDisabled,
2566
+ "--ci-model-selector-caret-color": z?.modelSelectorCaret,
2567
+ "--ci-model-selector-hover-bg": z?.modelSelectorHoverBg,
2568
+ "--ci-model-selector-disabled-color": z?.modelSelectorDisabled,
2569
+ "--ci-model-selector-name-color": z?.modelSelectorName,
2570
+ "--ci-model-selector-version-color": z?.modelSelectorVersion,
2571
+ "--ci-voice-waveform": z?.voiceWaveform,
2572
+ "--ci-voice-accent": z?.voiceAccent,
2573
+ "--ci-mention-highlight-bg": z?.mentionHighlightBg,
2574
+ "--ci-mention-highlight-text": z?.mentionHighlightText,
2575
+ "--ci-mention-highlight-unsupported-bg": z?.mentionHighlightUnsupportedBg,
2576
+ "--ci-mention-highlight-unsupported-text": z?.mentionHighlightUnsupportedText,
2577
+ "--ci-selection-highlight-bg": z?.selectionHighlightBg
2578
+ }), [z]), Ht = W(() => gt ? [{
2084
2579
  key: "dial-fs",
2085
- label: vt ?? "DIAL file system",
2086
- icon: /* @__PURE__ */ P(me, {
2087
- size: f,
2580
+ label: _t ?? "DIAL file system",
2581
+ icon: /* @__PURE__ */ B(ve, {
2582
+ size: p,
2088
2583
  "aria-hidden": !0,
2089
- stroke: _
2584
+ stroke: y
2090
2585
  }),
2091
- onClick: _t
2092
- }] : [], [_t, vt]), { message: Y, setMessage: X, textareaRef: Z } = Ue({
2586
+ onClick: gt
2587
+ }] : [], [gt, _t]), { message: Z, setMessage: Q, textareaRef: $ } = Ze({
2093
2588
  messageProp: e,
2094
2589
  messageRevision: t
2095
2590
  });
2096
- R(() => {
2097
- n !== void 0 && Z.current?.focus();
2098
- }, [n, Z]), Ee(jt, () => ({ getCaretPosition: () => Z.current?.selectionStart ?? Y.length }), [Y, Z]);
2099
- let { handleUndoKeyDown: Rt } = Ke({
2591
+ U(() => {
2592
+ let e = $.current;
2593
+ e != null && e.value.length !== 0 && document.activeElement === e && e.setSelectionRange(e.value.length, e.value.length);
2594
+ }, [$]), U(() => {
2595
+ n !== void 0 && $.current?.focus();
2596
+ }, [n, $]), je(Nt, () => ({ getCaretPosition: () => $.current?.selectionStart ?? Z.length }), [Z, $]);
2597
+ let { handleUndoKeyDown: Ut, markCaretPlaced: Wt } = et({
2100
2598
  insertion: r,
2101
- textareaRef: Z
2102
- }), { isMenuOpen: zt, query: Bt, activeWordStart: Q, dismiss: Vt, closeOnOutsidePress: Ht, handleCaretMove: Ut, handleValueChange: Wt, listboxId: Gt, overlayRef: Kt, activeOptionId: qt, moveActiveOption: Jt, getActiveOption: Yt } = Fe({
2103
- config: G,
2104
- message: Y
2105
- }), Xt = B(Ut);
2106
- Xt.current = Ut;
2107
- let Qt = () => {
2108
- Ut(Z.current?.selectionStart ?? Y.length);
2109
- }, $t = () => {
2110
- requestAnimationFrame(() => {
2111
- let e = Z.current;
2112
- Xt.current(e?.selectionStart ?? e?.value.length ?? 0);
2599
+ textareaRef: $
2600
+ }), { isMenuOpen: Gt, query: Kt, activeWordStart: qt, dismiss: Jt, closeOnOutsidePress: Yt, handleCaretMove: Xt, handleValueChange: Zt, listboxId: Qt, overlayRef: $t, activeOptionId: en, moveActiveOption: tn, getActiveOption: nn } = Ue({
2601
+ config: J,
2602
+ message: Z
2603
+ }), rn = G(Xt);
2604
+ rn.current = Xt;
2605
+ let an = () => {
2606
+ Xt($.current?.selectionStart ?? Z.length);
2607
+ }, on = G(!1), sn = () => {
2608
+ on.current ? on.current = !1 : requestAnimationFrame(() => {
2609
+ let e = $.current;
2610
+ rn.current(e?.selectionStart ?? e?.value.length ?? 0);
2113
2611
  });
2114
- }, en = (e) => {
2115
- e.key !== "ArrowLeft" && e.key !== "ArrowRight" && e.key !== "Home" && e.key !== "End" && e.key !== "PageUp" && e.key !== "PageDown" || Ut(e.currentTarget.selectionStart ?? Y.length);
2116
- }, tn = G?.emptyQueryHint != null, nn = G != null && Q != null ? Q + G.triggerPrefix.length : null, rn = nn != null && Y.slice(nn).split("\n", 1)[0] !== "", an = tn && zt && Bt === "" && nn != null && !rn, on = G != null && zt ? Q ?? 0 : null, sn = B(null), cn = B(null), [ln, un] = V(null), dn = L(() => {
2117
- let e = sn.current, t = cn.current;
2612
+ }, cn = (e) => {
2613
+ (e.key === "ArrowLeft" || e.key === "ArrowRight" || e.key === "Home" || e.key === "End" || e.key === "PageUp" || e.key === "PageDown") && Xt(e.currentTarget.selectionStart ?? Z.length);
2614
+ }, ln = J?.emptyQueryHint != null, un = J != null && qt != null ? qt + J.triggerPrefix.length : null, dn = un != null && Z.slice(un).split("\n", 1)[0] !== "", fn = ln && Gt && Kt === "" && un != null && !dn, pn = J != null && Gt ? qt ?? 0 : null, mn = G(null), hn = G(null), [gn, _n] = K(null), vn = H(() => {
2615
+ let e = mn.current, t = hn.current;
2118
2616
  if (e == null || t == null) {
2119
- un(null);
2617
+ _n(null);
2120
2618
  return;
2121
2619
  }
2122
2620
  let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
2123
- un({
2621
+ _n({
2124
2622
  left: n.left - r.left,
2125
2623
  top: n.top - r.top
2126
2624
  });
2127
2625
  }, []);
2128
- R(() => {
2129
- if (on == null) return;
2130
- let e = Z.current;
2626
+ U(() => {
2627
+ if (pn == null) return;
2628
+ let e = $.current;
2131
2629
  if (e == null || typeof ResizeObserver > "u") return;
2132
- let t = new ResizeObserver(dn);
2630
+ let t = new ResizeObserver(vn);
2133
2631
  return t.observe(e), () => t.disconnect();
2134
2632
  }, [
2135
- on,
2136
- Z,
2137
- dn
2633
+ pn,
2634
+ $,
2635
+ vn
2138
2636
  ]);
2139
- let fn = L((e) => {
2140
- if (G == null || (Vt(), !e?.consumeQuery) || (e.returnFocus !== !1 && Z.current?.focus(), Q == null)) return;
2141
- let t = `${G.triggerPrefix}${Bt}`, n = Q + t.length;
2142
- if (Y.slice(Q, n) !== t) return;
2143
- let r = Y.slice(0, Q) + Y.slice(n);
2144
- X(r), q.notifyChange(), u?.(r);
2637
+ let yn = H((e) => {
2638
+ if (J == null || (Jt(), !e?.consumeQuery) || (e.returnFocus !== !1 && $.current?.focus(), qt == null)) return;
2639
+ let t = `${J.triggerPrefix}${Kt}`, n = qt + t.length;
2640
+ if (Z.slice(qt, n) !== t) return;
2641
+ let r = Z.slice(0, qt) + Z.slice(n);
2642
+ Q(r), X.notifyChange(), u?.(r);
2145
2643
  }, [
2146
- G,
2147
- Vt,
2148
- Bt,
2149
- Y,
2644
+ J,
2645
+ Jt,
2646
+ Kt,
2647
+ Z,
2648
+ qt,
2150
2649
  Q,
2151
2650
  X,
2152
- q,
2153
2651
  u,
2154
- Z
2155
- ]), pn = B(void 0);
2156
- R(() => {
2157
- ft == null || pn.current === t || (pn.current = t, Z.current?.setSelectionRange(ft, ft), Ut(ft));
2158
- }, [Y]);
2159
- let { attachments: mn, buildAttachments: hn, addAttachments: gn, resetAttachments: _n, handleRemove: vn, handleRetry: yn, handleExpand: bn, hasBlockedAttachments: xn } = Ae({
2160
- initialAttachments: we,
2652
+ $
2653
+ ]), bn = G(void 0);
2654
+ U(() => {
2655
+ pt != null && bn.current !== t && (bn.current = t, $.current?.setSelectionRange(pt, pt), Wt(), Xt(pt));
2656
+ }, [Z]);
2657
+ let xn = G(Z);
2658
+ xn.current = Z;
2659
+ let { attachments: Sn, buildAttachments: Cn, addAttachments: wn, resetAttachments: Tn, handleRemove: En, handleRetry: Dn, handleExpand: On, hasBlockedAttachments: kn } = Le({
2660
+ initialAttachments: Ce,
2161
2661
  onUploadAttachment: a,
2162
- onAttachmentsChange: p,
2163
- validateAttachment: yt,
2164
- pendingDropFiles: fe,
2165
- onDropFilesConsumed: pe,
2166
- isDropDisabled: W,
2167
- pendingAttachments: ge,
2168
- onPendingAttachmentsConsumed: _e,
2169
- onExpandPastedText: L((e) => {
2170
- X((t) => t ? `${t}\n${e}` : e);
2171
- }, [X]),
2172
- maximumAttachmentsAmount: Tt,
2173
- baseAttachmentsAmount: Ze.length,
2174
- onAttachmentsLimitExceeded: Et
2175
- }), Sn = L((e) => {
2176
- gn(hn([e]));
2177
- }, [gn, hn]), Cn = B(!1), wn = B(Y);
2178
- wn.current = Y;
2179
- let [Tn, En] = V({
2662
+ onAttachmentsChange: m,
2663
+ validateAttachment: vt,
2664
+ pendingDropFiles: ce,
2665
+ onDropFilesConsumed: de,
2666
+ isDropDisabled: Ae,
2667
+ pendingAttachments: fe,
2668
+ onPendingAttachmentsConsumed: me,
2669
+ onExpandPastedText: H((e) => {
2670
+ let t = xn.current, n = t ? `${t}\n${e}` : e;
2671
+ xn.current = n, Q(n), u?.(n);
2672
+ }, [Q, u]),
2673
+ maximumAttachmentsAmount: wt,
2674
+ baseAttachmentsAmount: We.length,
2675
+ onAttachmentsLimitExceeded: Tt
2676
+ }), An = H((e) => {
2677
+ wn(Cn([e]));
2678
+ }, [wn, Cn]), Mn = G(!1), [Nn, Pn] = K({
2180
2679
  text: "",
2181
2680
  revision: 0
2182
- }), { state: Dn, analyserNodeRef: On, errorMessage: kn, startRecording: An, stopRecording: jn, discardRecording: Mn } = $e({
2183
- onAttachAudio: Sn,
2184
- onTranscribeAudio: Ve,
2185
- onTranscript: L((e) => {
2681
+ }), { state: Fn, analyserNodeRef: In, errorMessage: Ln, startRecording: Rn, stopRecording: zn, discardRecording: Bn } = st({
2682
+ onAttachAudio: An,
2683
+ onTranscribeAudio: Re,
2684
+ onTranscript: H((e) => {
2186
2685
  let t = e.trim();
2187
2686
  if (t) {
2188
- let e = wn.current, n = `${e}${e && !/\s$/.test(e) ? " " : ""}${t}`;
2189
- wn.current = n, X(n), En((e) => ({
2687
+ let e = xn.current, n = `${e}${e && !/\s$/.test(e) ? " " : ""}${t}`;
2688
+ xn.current = n, Q(n), Pn((e) => ({
2190
2689
  text: t,
2191
2690
  revision: e.revision + 1
2192
- })), q.notifyChange(), u?.(n);
2691
+ })), X.notifyChange(), u?.(n);
2193
2692
  }
2194
- Cn.current = !0;
2693
+ Mn.current = !0;
2195
2694
  }, [
2695
+ Q,
2196
2696
  X,
2197
- q,
2198
2697
  u
2199
2698
  ]),
2200
- errorLabel: Ye
2201
- }), $ = Dn === qe.Recording || Dn === qe.Processing;
2202
- R(() => {
2203
- (Dn === qe.Error || Dn === qe.Idle && Cn.current) && (Cn.current = !1, Z.current?.focus());
2204
- }, [Dn, Z]);
2205
- let Nn = B(null), Pn = B(null), Fn = Dt && Ot, { handlePaste: In } = le(gn, Fn ? ve : Infinity), Ln = L((e) => {
2206
- if (!Fn) {
2699
+ errorLabel: Be
2700
+ }), Vn = Fn === tt.Recording || Fn === tt.Processing;
2701
+ U(() => {
2702
+ if (Fn === tt.Error || Fn === tt.Idle && Mn.current) {
2703
+ Mn.current = !1;
2704
+ let e = $.current;
2705
+ if (e != null) {
2706
+ on.current = document.activeElement !== e, e.focus();
2707
+ let t = e.value.length;
2708
+ e.setSelectionRange(t, t);
2709
+ }
2710
+ }
2711
+ }, [Fn, $]);
2712
+ let Hn = G(null), Un = G(null), Wn = Et && Dt, { handlePaste: Gn } = pe(wn, Wn ? he : Infinity), Kn = H((e) => {
2713
+ if (!Wn) {
2207
2714
  let t = e.clipboardData.getData("text/plain");
2208
- t.length >= ye && At?.(t.length, ye);
2715
+ t.length >= ge && Mt?.(t.length, ge);
2209
2716
  }
2210
- if (In(e), e.defaultPrevented) return;
2717
+ if (Gn(e), e.defaultPrevented) return;
2211
2718
  let t = e.clipboardData.getData("text/plain").replace(/\r\n?/g, "\n");
2212
- t !== "" && G?.onTextPaste?.(t);
2719
+ t !== "" && J?.onTextPaste?.(t);
2213
2720
  }, [
2214
- Fn,
2215
- ye,
2216
- At,
2217
- In,
2218
- G
2219
- ]), Rn = Y.trim().length > 0 || mn.length > 0, zn = Rn && !xn && !Ie && !$, [Bn, Vn] = V([]);
2220
- R(() => {
2221
- Vn([]);
2222
- }, [(rt ?? []).map((e) => e.id).join("|")]);
2223
- let Hn = z(() => {
2224
- let e = rt ?? [];
2225
- return at ? e.filter((e) => e.isSelected || !Bn.includes(e.id)) : e;
2721
+ Wn,
2722
+ ge,
2723
+ Mt,
2724
+ Gn,
2725
+ J
2726
+ ]), qn = Z.trim().length > 0 || Sn.length > 0, Jn = qn && !kn && !Pe && !Vn, [Yn, Xn] = K([]), Zn = (Ye ?? []).map((e) => e.id).join("|");
2727
+ U(() => {
2728
+ Xn([]);
2729
+ }, [Zn]);
2730
+ let Qn = W(() => {
2731
+ let e = Ye ?? [];
2732
+ return rt ? e.filter((e) => e.isSelected || !Yn.includes(e.id)) : e;
2226
2733
  }, [
2227
- rt,
2228
- Bn,
2229
- at
2230
- ]), Un = L((e) => {
2231
- Vn((t) => t.includes(e) ? t : [...t, e]), rt?.find((t) => t.id === e)?.isSelected && it?.(e);
2232
- }, [rt, it]), Wn = be === void 0 || xe != null, Gn = Le && !s, Kn = async () => {
2233
- if (Ie || $) return;
2234
- if (Y.length >= ye) {
2235
- At?.(Y.length, ye);
2734
+ Ye,
2735
+ Yn,
2736
+ rt
2737
+ ]), $n = H((e) => {
2738
+ Xn((t) => t.includes(e) ? t : [...t, e]), Ye?.find((t) => t.id === e)?.isSelected && $e?.(e);
2739
+ }, [Ye, $e]), er = _e === void 0 || be != null, tr = Fe && !s, nr = async () => {
2740
+ if (Pe || Vn) return;
2741
+ if (Z.length >= ge) {
2742
+ Mt?.(Z.length, ge);
2236
2743
  return;
2237
2744
  }
2238
- let e = Y, t = mn;
2239
- X(""), q.reset();
2745
+ let e = Z, t = Sn;
2746
+ Q(""), X.reset();
2240
2747
  try {
2241
2748
  await i?.(e, t), t.forEach((e) => {
2242
2749
  e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
2243
- }), _n([]);
2750
+ }), Tn([]);
2244
2751
  } catch {
2245
- X(e), _n(t);
2752
+ Q(e), Tn(t);
2246
2753
  }
2247
- }, qn = (e) => Xe === et.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey, Jn = (e) => {
2248
- if (!zt || e.nativeEvent.isComposing) return !1;
2249
- if (e.key === "Escape") return e.preventDefault(), e.stopPropagation(), Vt(), !0;
2250
- if (e.key === "ArrowDown" || e.key === "ArrowUp") return e.preventDefault(), Jt(e.key === "ArrowDown" ? Pe.Next : Pe.Previous), !0;
2754
+ }, rr = (e) => Ve === ct.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey, ir = (e) => {
2755
+ if (!Gt || e.nativeEvent.isComposing) return !1;
2756
+ if (e.key === "Escape") return e.preventDefault(), e.stopPropagation(), Jt(), !0;
2757
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") return e.preventDefault(), tn(e.key === "ArrowDown" ? He.Next : He.Previous), !0;
2251
2758
  if (e.key !== "Enter" || e.shiftKey) return !1;
2252
- let t = Yt();
2253
- return t == null ? qn(e) ? (e.preventDefault(), !0) : !1 : (e.preventDefault(), t.click(), !0);
2254
- }, Yn = (e) => {
2255
- if (!$ && !Rt(e) && !Jn(e)) {
2256
- if (!e.nativeEvent.isComposing && !W && !s) {
2759
+ let t = nn();
2760
+ return t == null ? rr(e) ? (e.preventDefault(), !0) : !1 : (e.preventDefault(), t.click(), !0);
2761
+ }, ar = (e) => {
2762
+ if (!Vn && !Ut(e) && !ir(e)) {
2763
+ if (!e.nativeEvent.isComposing && !Ae && !s) {
2257
2764
  if (e.key === "ArrowUp" || e.key === "ArrowDown") {
2258
- let t = e.currentTarget.selectionStart ?? 0, n = q.navigate(e.key === "ArrowUp" ? "up" : "down", Y, t);
2765
+ let t = e.currentTarget.selectionStart ?? 0, n = X.navigate(e.key === "ArrowUp" ? "up" : "down", Z, t);
2259
2766
  if (n !== null) {
2260
- e.preventDefault(), X(n);
2767
+ e.preventDefault(), Q(n);
2261
2768
  return;
2262
2769
  }
2263
2770
  }
2264
- if (e.key === "Backspace" && dt != null && e.currentTarget.selectionStart === e.currentTarget.selectionEnd && e.currentTarget.selectionStart != null) {
2265
- let t = dt(e.currentTarget.selectionStart);
2771
+ if (e.key === "Backspace" && ft != null && e.currentTarget.selectionStart === e.currentTarget.selectionEnd && e.currentTarget.selectionStart != null) {
2772
+ let t = ft(e.currentTarget.selectionStart);
2266
2773
  if (t != null) {
2267
2774
  e.preventDefault();
2268
2775
  let n = e.currentTarget;
2269
- 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);
2776
+ n.setSelectionRange(t.start, t.start + t.length), typeof document.execCommand == "function" && document.execCommand("delete", !1) || Qe(n, Z.slice(0, t.start) + Z.slice(t.start + t.length), t.start);
2270
2777
  return;
2271
2778
  }
2272
2779
  }
2273
2780
  }
2274
- e.key === "Enter" && qn(e) && (e.preventDefault(), !s && zn && Wn && !W && Kn());
2781
+ e.key === "Enter" && rr(e) && (e.preventDefault(), !s && Jn && er && !Ae && nr());
2275
2782
  }
2276
- }, Xn = (e) => {
2783
+ }, or = (e) => {
2277
2784
  let t = Array.from(e.target.files ?? []);
2278
2785
  if (t.length === 0) return;
2279
- let n = hn(t);
2280
- e.target.value = "", gn(n);
2281
- }, Zn = z(() => {
2786
+ let n = Cn(t);
2787
+ e.target.value = "", wn(n);
2788
+ }, sr = W(() => {
2282
2789
  let e = [];
2283
- return on != null && e.push({
2284
- offset: on,
2285
- node: /* @__PURE__ */ P("span", {
2286
- ref: sn,
2790
+ return pn != null && e.push({
2791
+ offset: pn,
2792
+ node: /* @__PURE__ */ B("span", {
2793
+ ref: mn,
2287
2794
  "aria-hidden": !0,
2288
- className: "inline-block h-[1lh] w-0 align-text-top"
2795
+ className: "inline-block h-lh w-0 align-text-top"
2289
2796
  }, "caret-marker")
2290
- }), an && G != null && nn != null && e.push({
2291
- offset: nn,
2292
- node: /* @__PURE__ */ P("span", {
2293
- className: K.commandHint,
2797
+ }), fn && J != null && un != null && e.push({
2798
+ offset: un,
2799
+ node: /* @__PURE__ */ B("span", {
2800
+ className: Y.commandHint,
2294
2801
  "aria-hidden": !0,
2295
2802
  "data-mirror-synthetic": !0,
2296
- children: G.emptyQueryHint
2803
+ children: J.emptyQueryHint
2297
2804
  }, "command-hint")
2298
2805
  }), e;
2299
2806
  }, [
2300
- on,
2301
- an,
2302
- G,
2303
- nn
2304
- ]), Qn = It || Zn.length > 0, { mirrorRef: $n, selectionRects: er, updateSelectionRects: tr, syncMirrorToTextarea: nr } = He({
2305
- textareaRef: Z,
2306
- message: Y,
2307
- isMirrorActive: Qn
2807
+ pn,
2808
+ fn,
2809
+ J,
2810
+ un
2811
+ ]), cr = Bt || sr.length > 0, { mirrorRef: lr, selectionRects: ur, updateSelectionRects: dr, syncMirrorToTextarea: fr } = Xe({
2812
+ textareaRef: $,
2813
+ message: Z,
2814
+ isMirrorActive: cr
2308
2815
  });
2309
- De(() => {
2310
- dn();
2816
+ Me(() => {
2817
+ vn();
2311
2818
  }, [
2312
- dn,
2313
- on,
2314
- Y
2819
+ vn,
2820
+ pn,
2821
+ Z
2315
2822
  ]);
2316
- let rr = /* @__PURE__ */ F(N, { children: [/* @__PURE__ */ P("textarea", {
2317
- 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"),
2318
- ref: Z,
2823
+ let pr = /* @__PURE__ */ B("textarea", {
2824
+ className: l(Y.textarea, cr && Y.textareaMentionMode, ie?.fontClassName || "dial-body-paragraph-text", "relative z-0 field-sizing-content max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent ps-1 pe-1 outline-hidden", "disabled:cursor-not-allowed"),
2825
+ ref: $,
2319
2826
  autoFocus: mt,
2320
- value: Y,
2827
+ value: Z,
2321
2828
  onChange: (e) => {
2322
- X(e.target.value), q.notifyChange();
2829
+ Q(e.target.value), X.notifyChange();
2323
2830
  let t = e.nativeEvent instanceof InputEvent ? e.nativeEvent : void 0;
2324
- Wt(e.target.value, e.target.selectionStart ?? e.target.value.length, t?.isComposing ?? !1), u?.(e.target.value);
2831
+ Zt(e.target.value, e.target.selectionStart ?? e.target.value.length, t?.isComposing ?? !1), u?.(e.target.value);
2325
2832
  },
2326
- onSelect: tr,
2833
+ onSelect: dr,
2327
2834
  onScroll: () => {
2328
- nr(), on != null && dn();
2835
+ fr(), pn != null && vn();
2329
2836
  },
2330
- onFocus: $t,
2331
- onClick: Qt,
2332
- onKeyDown: Yn,
2333
- onKeyUp: en,
2334
- onPaste: Ln,
2335
- placeholder: m,
2336
- "aria-label": h,
2337
- "aria-autocomplete": G == null ? void 0 : "list",
2338
- "aria-controls": zt ? Gt : void 0,
2339
- "aria-activedescendant": qt ?? void 0,
2340
- "aria-hidden": It ? !0 : void 0,
2341
- disabled: W,
2342
- readOnly: $,
2837
+ onFocus: sn,
2838
+ onClick: an,
2839
+ onKeyDown: ar,
2840
+ onKeyUp: cn,
2841
+ onPaste: Kn,
2842
+ placeholder: h,
2843
+ "aria-label": g,
2844
+ "aria-autocomplete": J == null ? void 0 : "list",
2845
+ "aria-controls": Gt ? Qt : void 0,
2846
+ "aria-activedescendant": en ?? void 0,
2847
+ "aria-hidden": Bt ? !0 : void 0,
2848
+ disabled: Ae,
2849
+ readOnly: Vn,
2343
2850
  rows: 1
2344
- }), G != null && /* @__PURE__ */ P("div", {
2851
+ }), mr = /* @__PURE__ */ V(le, { children: [pr, J != null && /* @__PURE__ */ B("div", {
2345
2852
  "aria-hidden": !0,
2346
- className: l("pointer-events-none absolute", I?.fontClassName || "dial-body-paragraph-text"),
2853
+ className: l("pointer-events-none absolute", ie?.fontClassName || "dial-body-paragraph-text"),
2347
2854
  style: {
2348
- left: ln?.left ?? 0,
2349
- top: ln?.top ?? 0
2855
+ left: gn?.left ?? 0,
2856
+ top: gn?.top ?? 0
2350
2857
  },
2351
- children: /* @__PURE__ */ P(v, {
2352
- open: zt,
2858
+ children: /* @__PURE__ */ B(b, {
2859
+ open: Gt,
2353
2860
  onOpenChange: (e) => {
2354
- e || Ht();
2861
+ e || Yt();
2355
2862
  },
2356
2863
  placement: "top-start",
2357
2864
  trigger: [],
2358
2865
  initialFocus: -1,
2359
2866
  matchReferenceWidth: !1,
2360
- outsidePressIgnoreRef: Z,
2361
- renderOverlay: () => /* @__PURE__ */ P("div", {
2362
- ref: Kt,
2363
- role: G.menuLabel == null ? void 0 : "group",
2364
- "aria-label": G.menuLabel,
2365
- children: G.renderMenu({
2366
- query: Bt,
2367
- caretPosition: Q ?? 0,
2368
- close: fn,
2369
- listboxId: Gt,
2370
- activeOptionId: qt
2371
- })
2372
- }),
2373
- children: /* @__PURE__ */ P("span", {
2867
+ outsidePressIgnoreRef: $,
2868
+ renderOverlay: () => {
2869
+ let e = J.menuLabel != null;
2870
+ return /* @__PURE__ */ B("div", {
2871
+ ref: $t,
2872
+ role: e ? "group" : void 0,
2873
+ "aria-label": J.menuLabel,
2874
+ children: J.renderMenu({
2875
+ query: Kt,
2876
+ caretPosition: qt ?? 0,
2877
+ close: yn,
2878
+ listboxId: Qt,
2879
+ activeOptionId: en
2880
+ })
2881
+ });
2882
+ },
2883
+ children: /* @__PURE__ */ B("span", {
2374
2884
  "aria-hidden": !0,
2375
- className: "inline-block h-[1lh] w-0"
2885
+ className: "inline-block h-lh w-0"
2376
2886
  })
2377
2887
  })
2378
- })] }), ir = /* @__PURE__ */ F("div", {
2379
- ref: cn,
2380
- className: "relative -me-1 -ms-1 w-[calc(100%+8px)]",
2381
- children: [Qn && /* @__PURE__ */ F("div", {
2382
- ref: $n,
2383
- 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]"),
2384
- children: [ze(Y, Ft, Zn, K.mentionHighlight, K.mentionHighlightUnsupported), er.map((e, t) => /* @__PURE__ */ P("div", {
2888
+ })] }), hr = /* @__PURE__ */ V("div", {
2889
+ ref: hn,
2890
+ className: "relative -ms-1 -me-1 w-[calc(100%+8px)]",
2891
+ children: [cr && /* @__PURE__ */ V("div", {
2892
+ ref: lr,
2893
+ className: l(Y.textarea, ie?.fontClassName || "dial-body-paragraph-text", "pointer-events-none absolute inset-0 z-10 max-h-[272px] w-full overflow-hidden ps-1 pe-1 wrap-anywhere whitespace-pre-wrap"),
2894
+ children: [qe(Z, zt, sr, Y.mentionHighlight, Y.mentionHighlightUnsupported), ur.map((e, t) => /* @__PURE__ */ B("div", {
2385
2895
  "aria-hidden": !0,
2386
- className: "pointer-events-none absolute rounded-sm bg-control-accent-alpha-active",
2896
+ className: l("pointer-events-none absolute rounded-sm", Y.selectionHighlight),
2387
2897
  style: {
2388
2898
  left: e.left,
2389
2899
  top: e.top,
@@ -2391,244 +2901,243 @@ var Kt = {
2391
2901
  height: e.height
2392
2902
  }
2393
2903
  }, `selection-${t}`))]
2394
- }), rr]
2395
- }), ar = Te ? void 0 : /* @__PURE__ */ P(pt, {
2396
- onAttachClick: Oe ? void 0 : () => Nn.current?.click(),
2397
- attachLabel: y,
2398
- addMenuTitle: C,
2399
- menuTitle: w,
2400
- menuCloseLabel: T,
2401
- style: J,
2402
- isDisabled: W || $,
2403
- chatSettings: nt,
2404
- extraMenuItems: Lt,
2405
- onRecordVoice: Be && Dt && !s && !$ ? () => An(Je.Attachment) : void 0,
2406
- recordVoiceLabel: ie,
2407
- toolsMenuItems: at ? rt : void 0,
2408
- onToolToggle: it,
2409
- toolsMenuTitle: ot,
2410
- toolsBackLabel: st,
2411
- menuOverlays: lt,
2412
- getCaretPosition: () => Z.current?.selectionStart ?? Y.length
2413
- }), or = ke === tt.Inline && (!Mt || je), sr = ar && /* @__PURE__ */ P("div", {
2414
- className: l("flex", H.addCluster),
2415
- children: ar
2416
- }), cr = Hn.length > 0 && it != null && /* @__PURE__ */ P("div", {
2417
- className: l("min-w-0 flex-1", H.toolsChips),
2418
- children: /* @__PURE__ */ P(ht, {
2419
- items: Hn,
2420
- onToolToggle: it,
2421
- onToolDismiss: Un,
2422
- canRemove: at,
2423
- removeLabel: ct?.removeLabel,
2424
- stateOnLabel: ct?.stateOnLabel,
2425
- stateOffLabel: ct?.stateOffLabel
2904
+ }), mr]
2905
+ }), gr = we ? void 0 : /* @__PURE__ */ B(bt, {
2906
+ onAttachClick: Te ? void 0 : () => Hn.current?.click(),
2907
+ attachLabel: _,
2908
+ addMenuTitle: w,
2909
+ menuTitle: ee,
2910
+ menuCloseLabel: O,
2911
+ style: Vt,
2912
+ isDisabled: Ae || Vn,
2913
+ chatSettings: Je,
2914
+ extraMenuItems: Ht,
2915
+ onRecordVoice: Ie && Et && !s && !Vn ? () => Rn(nt.Attachment) : void 0,
2916
+ recordVoiceLabel: L,
2917
+ toolsMenuItems: rt ? Ye : void 0,
2918
+ onToolToggle: $e,
2919
+ toolsMenuTitle: it,
2920
+ toolsBackLabel: at,
2921
+ menuOverlays: ut,
2922
+ getCaretPosition: () => $.current?.selectionStart ?? Z.length
2923
+ }), _r = De === lt.Inline && (!Pt || Oe), vr = gr && /* @__PURE__ */ B("div", {
2924
+ className: l("flex", q.addCluster),
2925
+ children: gr
2926
+ }), yr = Qn.length > 0 && $e != null && /* @__PURE__ */ B("div", {
2927
+ className: l("min-w-0", _r ? "flex-1" : "max-w-full flex-[1_0_auto]", q.toolsChips),
2928
+ children: /* @__PURE__ */ B(Ct, {
2929
+ items: Qn,
2930
+ onToolToggle: $e,
2931
+ onToolDismiss: $n,
2932
+ canRemove: rt,
2933
+ removeLabel: ot?.removeLabel,
2934
+ stateOnLabel: ot?.stateOnLabel,
2935
+ stateOffLabel: ot?.stateOffLabel
2426
2936
  })
2427
2937
  });
2428
- return /* @__PURE__ */ F("div", {
2429
- ref: Pn,
2430
- style: J,
2431
- 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),
2938
+ return /* @__PURE__ */ V("div", {
2939
+ ref: Un,
2940
+ style: Vt,
2941
+ className: l(Y.wrapper, Ae && Y.wrapperDisabled, Ae && "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", se, q.wrapper),
2432
2942
  children: [
2433
- (Ze.length > 0 || mn.length > 0) && /* @__PURE__ */ P(se, {
2434
- attachments: [...Ze, ...mn],
2943
+ (We.length > 0 || Sn.length > 0) && /* @__PURE__ */ B(ue, {
2944
+ attachments: [...We, ...Sn],
2435
2945
  onRemove: (e) => {
2436
- Ze.some((t) => t.id === e) ? Qe?.(e) : vn(e);
2946
+ We.some((t) => t.id === e) ? Ge?.(e) : En(e);
2437
2947
  },
2438
- onRetry: yn,
2439
- onExpand: bn,
2948
+ onRetry: Dn,
2949
+ onExpand: On,
2440
2950
  labels: {
2441
- removeLabel: E,
2442
- retryLabel: D,
2443
- uploadingLabel: ee,
2444
- expandLabel: O,
2445
- clickLabel: k
2951
+ removeLabel: k,
2952
+ retryLabel: A,
2953
+ uploadingLabel: j,
2954
+ expandLabel: M,
2955
+ clickLabel: N
2446
2956
  },
2447
2957
  styles: {
2448
- ...ce,
2449
- className: l(mn.length > 6 && "-me-4 w-[calc(100%+1rem)]", ce?.className)
2958
+ ...ae,
2959
+ className: l(Sn.length > 6 && "-me-4", ae?.className)
2450
2960
  },
2451
- onAttachmentClick: Ct == null ? void 0 : (e) => {
2452
- let t = [...Ze, ...mn].find((t) => t.id === e);
2453
- t != null && Ct(t);
2961
+ onAttachmentClick: yt == null ? void 0 : (e) => {
2962
+ let t = [...We, ...Sn].find((t) => t.id === e);
2963
+ t != null && yt(t);
2454
2964
  }
2455
2965
  }),
2456
- !Te && /* @__PURE__ */ P("input", {
2457
- ref: Nn,
2966
+ !we && /* @__PURE__ */ B("input", {
2967
+ ref: Hn,
2458
2968
  type: "file",
2459
2969
  multiple: !0,
2460
- accept: S,
2970
+ accept: x,
2461
2971
  className: "sr-only",
2462
2972
  "aria-hidden": !0,
2463
2973
  tabIndex: -1,
2464
- onChange: Xn
2974
+ onChange: or
2465
2975
  }),
2466
- kn && /* @__PURE__ */ P(b, {
2467
- text: kn,
2468
- className: "min-w-0 break-words px-1"
2976
+ /* @__PURE__ */ B(T, {
2977
+ politeness: D.Assertive,
2978
+ className: "min-w-0 px-1 wrap-break-word",
2979
+ children: Ln && /* @__PURE__ */ B(S, { text: Ln })
2469
2980
  }),
2470
- $ && /* @__PURE__ */ P(bt, {
2981
+ Vn && /* @__PURE__ */ B(Ot, {
2471
2982
  embedded: !0,
2472
- state: Dn,
2473
- analyserNodeRef: On,
2474
- onStop: jn,
2475
- onDiscard: Mn,
2476
- attachButton: ar,
2477
- stopLabel: ae,
2478
- discardLabel: oe,
2479
- processingLabel: Ge
2983
+ state: Fn,
2984
+ analyserNodeRef: In,
2985
+ onStop: zn,
2986
+ onDiscard: Bn,
2987
+ attachButton: gr,
2988
+ stopLabel: R,
2989
+ discardLabel: re,
2990
+ processingLabel: ze
2480
2991
  }),
2481
- !$ && U && ir,
2482
- !$ && !U && or && cr && /* @__PURE__ */ P("div", {
2992
+ !Vn && Ee && hr,
2993
+ !Vn && !Ee && _r && yr && /* @__PURE__ */ B("div", {
2483
2994
  className: "flex",
2484
- children: cr
2995
+ children: yr
2485
2996
  }),
2486
- !$ && !U && /* @__PURE__ */ F("div", {
2487
- className: l("flex items-center gap-2", or ? "flex-nowrap" : "flex-wrap", H.actionRow),
2997
+ !Vn && !Ee && /* @__PURE__ */ V("div", {
2998
+ className: l("flex items-center gap-2", _r ? "flex-nowrap" : "flex-wrap", q.actionRow),
2488
2999
  children: [
2489
- or && sr,
2490
- /* @__PURE__ */ P("div", {
2491
- className: l("flex min-w-0 items-center self-stretch", or ? "flex-1" : "w-full", H.textareaWrap),
2492
- children: ir
3000
+ _r && vr,
3001
+ /* @__PURE__ */ B("div", {
3002
+ className: l("flex min-w-0 items-center self-stretch", _r ? "flex-1" : "w-full", q.textareaWrap),
3003
+ children: hr
2493
3004
  }),
2494
- !or && sr,
2495
- !or && cr,
2496
- /* @__PURE__ */ P("div", {
2497
- className: l("ms-auto flex flex-shrink-0 items-center gap-2", H.footerActions),
2498
- children: Me ? Me({
2499
- canSend: zn,
2500
- onSend: Kn
2501
- }) : /* @__PURE__ */ F(N, { children: [
2502
- kt,
2503
- /* @__PURE__ */ P(Zt, {
2504
- deployments: be,
2505
- selectedDeploymentId: xe,
2506
- onDeploymentChange: Se,
2507
- modelSelectorLabels: Ce,
2508
- menuStyles: ue,
3005
+ !_r && vr,
3006
+ !_r && yr,
3007
+ /* @__PURE__ */ B("div", {
3008
+ className: l("ms-auto flex shrink-0 items-center gap-2", q.footerActions),
3009
+ children: ke ? ke({
3010
+ canSend: Jn,
3011
+ onSend: nr
3012
+ }) : /* @__PURE__ */ V(le, { children: [
3013
+ jt,
3014
+ /* @__PURE__ */ B(jn, {
3015
+ deployments: _e,
3016
+ selectedDeploymentId: be,
3017
+ onDeploymentChange: xe,
3018
+ modelSelectorLabels: Se,
3019
+ menuStyles: oe,
3020
+ nameClassName: ie?.modelSelectorNameClassName,
3021
+ versionClassName: ie?.modelSelectorVersionClassName,
2509
3022
  isStreaming: s,
2510
- isMobile: Mt,
3023
+ isMobile: Ft,
2511
3024
  isDisabled: Ne,
2512
- style: J,
2513
- modelPickerOverlay: wt,
2514
- isPickerOpen: Nt,
2515
- onPickerToggle: () => Pt((e) => !e),
2516
- onPickerOpenChange: Pt
3025
+ style: Vt,
3026
+ modelPickerOverlay: xt,
3027
+ isPickerOpen: It,
3028
+ onPickerToggle: () => Rt(!It),
3029
+ onPickerOpenChange: Rt
2517
3030
  }),
2518
- Gn && /* @__PURE__ */ P(x, {
2519
- icon: /* @__PURE__ */ P(he, {
2520
- size: g.LG,
2521
- stroke: _,
3031
+ tr && /* @__PURE__ */ B(C, {
3032
+ icon: /* @__PURE__ */ B(ye, {
3033
+ size: v.LG,
3034
+ stroke: y,
2522
3035
  "aria-hidden": !0
2523
3036
  }),
2524
- "aria-label": re,
2525
- tooltipProps: { tooltip: re },
2526
- className: "size-[40px] flex-shrink-0 mobile:min-h-11 mobile:min-w-11",
2527
- onClick: () => An(Je.Dictation),
2528
- disabled: W || s
3037
+ "aria-label": I,
3038
+ tooltipProps: { tooltip: I },
3039
+ className: "shrink-0",
3040
+ onClick: () => Rn(nt.Dictation),
3041
+ disabled: Ae || s
2529
3042
  }),
2530
- s && o ? /* @__PURE__ */ P(St, {
3043
+ s && o ? /* @__PURE__ */ B(At, {
2531
3044
  onStop: o,
2532
- ariaLabel: ne
2533
- }) : !s && /* @__PURE__ */ P(xt, {
2534
- onSend: Kn,
2535
- isDisabled: !Wn || !zn,
2536
- ariaLabel: A,
2537
- sendTooltip: Rn ? j : te ?? j
3045
+ ariaLabel: F
3046
+ }) : !s && /* @__PURE__ */ B(kt, {
3047
+ onSend: nr,
3048
+ isDisabled: !er || !Jn,
3049
+ ariaLabel: te,
3050
+ sendTooltip: qn ? ne : P ?? ne
2538
3051
  })
2539
3052
  ] })
2540
3053
  })
2541
3054
  ]
2542
3055
  }),
2543
- /* @__PURE__ */ P("span", {
2544
- className: "sr-only",
2545
- role: "status",
2546
- "aria-live": "polite",
2547
- "aria-atomic": "true",
2548
- children: /* @__PURE__ */ P("span", { children: Tn.text }, Tn.revision)
3056
+ /* @__PURE__ */ B(T, {
3057
+ visuallyHidden: !0,
3058
+ atomic: !0,
3059
+ as: E.Span,
3060
+ children: /* @__PURE__ */ B("span", { children: Nn.text }, Nn.revision)
2549
3061
  })
2550
3062
  ]
2551
3063
  });
2552
3064
  });
2553
- Qt.displayName = "Input";
2554
- var $t = {
3065
+ Mn.displayName = "Input";
3066
+ var Nn = {
2555
3067
  welcome: "_welcome_1icyo_1",
2556
3068
  description: "_description_1icyo_5"
2557
- }, 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 }) => {
2558
- let { colors: f, typography: p, attachmentTray: m, modelMenu: h } = a ?? {};
2559
- return /* @__PURE__ */ F("div", {
2560
- style: c({
2561
- "--ci-welcome-color": f?.welcomeText,
2562
- "--ci-description-color": f?.descriptionText
2563
- }),
2564
- className: l("relative flex w-full flex-col items-center gap-9 px-4 py-5 desktop:p-5", o),
3069
+ }, Pn = ({ isStreaming: e = !1, placeholder: t = "Type a prompt or use \"/\" to select one", welcomeText: n, descriptionText: r, belowWelcomeSlot: i, aboveInputSlot: a, styles: o, className: s, inputClassName: u, isInputDisabled: d = !1, ...f }) => {
3070
+ let { colors: p, typography: m, attachmentTray: h, modelMenu: g } = o ?? {}, _ = c({
3071
+ "--ci-welcome-color": p?.welcomeText,
3072
+ "--ci-description-color": p?.descriptionText
3073
+ });
3074
+ return /* @__PURE__ */ V("div", {
3075
+ style: _,
3076
+ className: l("relative flex w-full flex-col items-center gap-9 px-4 py-5 desktop:p-5", s),
2565
3077
  children: [
2566
- n && /* @__PURE__ */ F("div", {
2567
- className: "flex flex-col items-center gap-4 text-center",
2568
- children: [/* @__PURE__ */ P("h1", {
2569
- className: l($t.welcome, "m-0", p?.welcomeClassName || "dial-display2-text"),
3078
+ n && /* @__PURE__ */ V("div", {
3079
+ className: "flex max-w-full flex-col items-center gap-4 text-center",
3080
+ children: [/* @__PURE__ */ B("h1", {
3081
+ className: l(Nn.welcome, "m-0 max-w-full wrap-anywhere", m?.welcomeClassName || "dial-display2-text"),
2570
3082
  children: n
2571
- }), r && /* @__PURE__ */ P("p", {
2572
- className: l($t.description, "m-0 max-w-[540px]", p?.descriptionClassName || "dial-body-paragraph-text"),
3083
+ }), r && /* @__PURE__ */ B("p", {
3084
+ className: l(Nn.description, "m-0 max-w-[540px]", m?.descriptionClassName || "dial-body-paragraph-text"),
2573
3085
  children: r
2574
3086
  })]
2575
3087
  }),
2576
- i != null && /* @__PURE__ */ P("div", {
3088
+ i != null && /* @__PURE__ */ B("div", {
2577
3089
  className: "flex w-full max-w-[700px] flex-col items-center empty:hidden",
2578
3090
  children: i
2579
3091
  }),
2580
- /* @__PURE__ */ P("div", {
3092
+ /* @__PURE__ */ V("div", {
2581
3093
  className: l("relative w-full", n ? "max-w-[700px]" : "max-w-[748px]"),
2582
- children: /* @__PURE__ */ P(Qt, {
3094
+ children: [a != null && /* @__PURE__ */ B("div", {
3095
+ className: "mb-2",
3096
+ children: a
3097
+ }), /* @__PURE__ */ B(Mn, {
2583
3098
  placeholder: t,
2584
3099
  isStreaming: e,
2585
- isInputDisabled: u,
2586
- ...d,
2587
- className: s,
2588
- colors: f?.input,
2589
- typography: p?.input,
2590
- attachmentTray: m,
2591
- modelMenu: h
2592
- })
3100
+ isInputDisabled: d,
3101
+ ...f,
3102
+ className: u,
3103
+ colors: p?.input,
3104
+ typography: m?.input,
3105
+ attachmentTray: h,
3106
+ modelMenu: g
3107
+ })]
2593
3108
  })
2594
3109
  ]
2595
3110
  });
2596
- }, 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 }) => {
2597
- let pe = B(null), he = B(null), [ge, _e] = V([]);
2598
- R(() => {
2599
- A?.length && (_e(A), j?.());
3111
+ }, Fn = ({ message: e, messageRevision: t, onChange: n, activeMentions: r, onBackspaceAtCaret: i, caretPositionOverride: o, commandMenu: s, menuOverlays: c, sendOnEnter: u, initialAttachments: d = [], onCancel: f, onSave: m, onUploadAttachment: h, cancelLabel: g = "Cancel", saveLabel: _ = "Save & Submit", ariaLabel: v, removeLabel: b, retryLabel: x, uploadingLabel: S, expandLabel: C, clickLabel: w, addMenuTitle: T = "Add", attachLabel: E = "Attach file", menuTitle: D = "Menu", menuCloseLabel: ee = "Close", className: k, pendingDropFiles: A, onDropFilesConsumed: j, validateAttachment: M, isAttachmentsEnabled: N, isTextAttachmentsAllowed: te, hideAttachFile: P = !1, fileAccept: F, maximumAttachmentsAmount: I, onAttachmentsLimitExceeded: L, onDialFileSystemClick: R, dialFileSystemLabel: re, pendingAttachments: z, onPendingAttachmentsConsumed: ie, onAttachmentClick: ae, pasteTextThreshold: oe, maxMessageLength: se = 5e4, onMessageTooLong: ce }) => {
3112
+ let le = G(null), ue = G(null), [de, fe] = K([]);
3113
+ U(() => {
3114
+ A?.length && (fe(A), j?.());
2600
3115
  }, [A, j]);
2601
- 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) => {
2602
- Ce((t) => t.filter((t) => t.id !== e));
2603
- }, De = L((e, t) => {
2604
- p(e, Se, t);
2605
- }, [Se, p]), H = () => {
2606
- if (Te) {
2607
- if (ve.length >= de) {
2608
- fe?.(ve.length, de);
2609
- return;
2610
- }
2611
- De(ve, be);
2612
- }
2613
- }, Oe = L(() => _e([]), []), U = L((e) => {
2614
- ye(e), n?.(e);
2615
- }, [n]), ke = L((e) => {
3116
+ let [pe, me] = K(e ?? ""), [he, ge] = K([]), [_e, ye] = K(d), be = he.some((e) => e.status === a.Loading || e.status === a.Error), xe = (pe.trim().length > 0 || he.length > 0 || _e.length > 0) && !be, Se = (e) => {
3117
+ ye((t) => t.filter((t) => t.id !== e));
3118
+ }, Ce = H((e, t) => {
3119
+ m(e, _e, t);
3120
+ }, [_e, m]), we = () => {
3121
+ xe && (pe.length >= se ? ce?.(pe.length, se) : Ce(pe, he));
3122
+ }, Te = H(() => fe([]), []), Ee = H((e) => {
3123
+ me(e), n?.(e);
3124
+ }, [n]), De = H((e) => {
2616
3125
  let t = Array.from(e.target.files ?? []);
2617
- t.length !== 0 && (e.target.value = "", _e(t));
2618
- }, []), Ae = z(() => N ? [{
3126
+ t.length !== 0 && (e.target.value = "", fe(t));
3127
+ }, []), Oe = W(() => R ? [{
2619
3128
  key: "dial-fs",
2620
- label: se ?? "DIAL file system",
2621
- icon: /* @__PURE__ */ P(me, {
2622
- size: f,
3129
+ label: re ?? "DIAL file system",
3130
+ icon: /* @__PURE__ */ B(ve, {
3131
+ size: p,
2623
3132
  "aria-hidden": !0,
2624
- stroke: _
3133
+ stroke: y
2625
3134
  }),
2626
- onClick: N
2627
- }] : [], [N, se]);
2628
- return /* @__PURE__ */ F("div", {
3135
+ onClick: R
3136
+ }] : [], [R, re]);
3137
+ return /* @__PURE__ */ V("div", {
2629
3138
  className: l("flex w-full flex-col gap-2", k),
2630
- children: [/* @__PURE__ */ P(Qt, {
2631
- ref: he,
3139
+ children: [/* @__PURE__ */ B(Mn, {
3140
+ ref: ue,
2632
3141
  message: e,
2633
3142
  messageRevision: t,
2634
3143
  activeMentions: r,
@@ -2637,72 +3146,109 @@ var $t = {
2637
3146
  commandMenu: s,
2638
3147
  ariaLabel: v,
2639
3148
  hideActionBar: !0,
2640
- pendingDropFiles: ge,
2641
- onDropFilesConsumed: Oe,
2642
- onSend: De,
2643
- onUploadAttachment: m,
2644
- onChange: U,
2645
- onAttachmentsChange: xe,
2646
- removeLabel: y,
2647
- retryLabel: b,
2648
- uploadingLabel: x,
2649
- expandLabel: S,
2650
- clickLabel: C,
3149
+ sendOnEnter: u,
3150
+ pendingDropFiles: de,
3151
+ onDropFilesConsumed: Te,
3152
+ onSend: Ce,
3153
+ onUploadAttachment: h,
3154
+ onChange: Ee,
3155
+ onAttachmentsChange: ge,
3156
+ removeLabel: b,
3157
+ retryLabel: x,
3158
+ uploadingLabel: S,
3159
+ expandLabel: C,
3160
+ clickLabel: w,
2651
3161
  className: "max-w-full",
2652
- prefixAttachments: Se,
2653
- onRemovePrefixAttachment: Ee,
2654
- validateAttachment: te,
2655
- isAttachmentsEnabled: ne,
2656
- isTextAttachmentsAllowed: re,
2657
- maximumAttachmentsAmount: oe,
2658
- onAttachmentsLimitExceeded: M,
2659
- pendingAttachments: I,
2660
- onPendingAttachmentsConsumed: ce,
2661
- onAttachmentClick: le,
2662
- pasteTextThreshold: ue,
2663
- maxMessageLength: de,
2664
- onMessageTooLong: fe
2665
- }), /* @__PURE__ */ F("div", {
3162
+ prefixAttachments: _e,
3163
+ onRemovePrefixAttachment: Se,
3164
+ validateAttachment: M,
3165
+ isAttachmentsEnabled: N,
3166
+ isTextAttachmentsAllowed: te,
3167
+ maximumAttachmentsAmount: I,
3168
+ onAttachmentsLimitExceeded: L,
3169
+ pendingAttachments: z,
3170
+ onPendingAttachmentsConsumed: ie,
3171
+ onAttachmentClick: ae,
3172
+ pasteTextThreshold: oe,
3173
+ maxMessageLength: se,
3174
+ onMessageTooLong: ce
3175
+ }), /* @__PURE__ */ V("div", {
2666
3176
  className: "flex items-center justify-between",
2667
- children: [/* @__PURE__ */ F("div", {
3177
+ children: [/* @__PURE__ */ V("div", {
2668
3178
  className: "flex",
2669
- children: [!ie && /* @__PURE__ */ P("input", {
2670
- ref: pe,
3179
+ children: [!P && /* @__PURE__ */ B("input", {
3180
+ ref: le,
2671
3181
  type: "file",
2672
3182
  multiple: !0,
2673
- accept: ae,
3183
+ accept: F,
2674
3184
  className: "sr-only",
2675
3185
  "aria-hidden": !0,
2676
3186
  tabIndex: -1,
2677
- onChange: ke
2678
- }), (!ie || (c?.length ?? 0) > 0) && /* @__PURE__ */ P(pt, {
2679
- onAttachClick: ie ? void 0 : () => pe.current?.click(),
3187
+ onChange: De
3188
+ }), (!P || (c?.length ?? 0) > 0) && /* @__PURE__ */ B(bt, {
3189
+ onAttachClick: P ? void 0 : () => le.current?.click(),
2680
3190
  attachLabel: E,
2681
3191
  addMenuTitle: T,
2682
3192
  menuTitle: D,
2683
- menuCloseLabel: O,
2684
- extraMenuItems: Ae,
3193
+ menuCloseLabel: ee,
3194
+ extraMenuItems: Oe,
2685
3195
  menuOverlays: c,
2686
- getCaretPosition: () => he.current?.getCaretPosition() ?? 0
3196
+ getCaretPosition: () => ue.current?.getCaretPosition() ?? 0
2687
3197
  })]
2688
- }), /* @__PURE__ */ F("div", {
3198
+ }), /* @__PURE__ */ V("div", {
2689
3199
  className: "flex gap-2",
2690
- children: [/* @__PURE__ */ P(w, {
2691
- label: h,
2692
- onClick: d
2693
- }), /* @__PURE__ */ P(ee, {
3200
+ children: [/* @__PURE__ */ B(O, {
2694
3201
  label: g,
2695
- onClick: H,
2696
- disabled: !Te
3202
+ onClick: f
3203
+ }), /* @__PURE__ */ B(ne, {
3204
+ label: _,
3205
+ onClick: we,
3206
+ disabled: !xe
2697
3207
  })]
2698
3208
  })]
2699
3209
  })]
2700
3210
  });
2701
- }, nn = (e) => {
2702
- let [t, n] = V({
3211
+ }, In = /* @__PURE__ */ function(e) {
3212
+ return e.Warning = "warning", e.Reached = "reached", e;
3213
+ }({}), Ln = { banner: "_banner_180n6_2" }, Rn = {
3214
+ [In.Warning]: M.Warning,
3215
+ [In.Reached]: M.Error
3216
+ }, zn = ({ severity: e, limitText: t, reset: n, onClose: r, closeAriaLabel: i = "Close notification", limitTextClassName: a = "dial-small-paragraph-semi-text", resetTextClassName: o = "dial-small-paragraph-text", isLiveRegion: s = !0, className: u, colors: d }) => {
3217
+ let f = /* @__PURE__ */ B("span", {
3218
+ className: a,
3219
+ children: t
3220
+ }), p = n != null && /* @__PURE__ */ V(le, { children: [
3221
+ " ",
3222
+ /* @__PURE__ */ B("time", {
3223
+ dateTime: n.isoValue,
3224
+ "aria-hidden": n.ariaLabel != null || void 0,
3225
+ className: o,
3226
+ children: n.label
3227
+ }),
3228
+ n.ariaLabel != null && /* @__PURE__ */ B("span", {
3229
+ className: "sr-only",
3230
+ children: n.ariaLabel
3231
+ })
3232
+ ] });
3233
+ return /* @__PURE__ */ B(A, {
3234
+ role: s ? "status" : "none",
3235
+ variant: Rn[e],
3236
+ type: j.SectionMessage,
3237
+ title: p ? f : void 0,
3238
+ message: p || f,
3239
+ className: l(Ln.banner, q.usageBanner, u),
3240
+ style: c({ "--ci-usage-banner-bg": d?.background }),
3241
+ children: r != null && /* @__PURE__ */ B(_, {
3242
+ className: "shrink-0 self-start",
3243
+ ariaLabel: i,
3244
+ onClose: () => r()
3245
+ })
3246
+ });
3247
+ }, Bn = (e) => {
3248
+ let [t, n] = K({
2703
3249
  text: e?.text,
2704
3250
  revision: e?.revision ?? 0
2705
- }), r = L((e) => {
3251
+ }), r = H((e) => {
2706
3252
  n((t) => ({
2707
3253
  text: e,
2708
3254
  revision: t.revision + 1
@@ -2713,11 +3259,11 @@ var $t = {
2713
3259
  messageRevision: t.revision,
2714
3260
  seedMessage: r
2715
3261
  };
2716
- }, rn = (e, t) => {
2717
- let n = B(e), r = B(t);
2718
- r.current = t, R(() => {
3262
+ }, Vn = (e, t) => {
3263
+ let n = G(e), r = G(t);
3264
+ r.current = t, U(() => {
2719
3265
  e !== n.current && (n.current = e, r.current());
2720
3266
  }, [e]);
2721
3267
  };
2722
3268
  //#endregion
2723
- 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 };
3269
+ export { lt as ActionRowLayout, Fe as BottomSheetShell, q as CONVERSATION_INPUT_CLASS, gt as ChatSettingsModal, Pn as ConversationInput, Fn as EditMessageInput, Mn as Input, ct as SendOnEnter, In as UsageLimitBannerSeverity, zn as UsageLimitBannerView, Bn as useComposerSeed, Vn as useComposerSeedSource };