@epam/ai-dial-conversation-input 1.2.0-dev.2 → 1.2.0-dev.201

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