@epam/ai-dial-conversation-input 1.2.0-dev.21 → 1.2.0-dev.217

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/Input.d.ts +2 -3
  6. package/components/Input/Input.d.ts.map +1 -1
  7. package/components/Input/ModelSelectorControl.d.ts +3 -1
  8. package/components/Input/ModelSelectorControl.d.ts.map +1 -1
  9. package/components/ModelSelectorBottomSheet/ModelSelectorBottomSheet.d.ts +3 -0
  10. package/components/ModelSelectorBottomSheet/ModelSelectorBottomSheet.d.ts.map +1 -1
  11. package/components/ToolsChips/ToolsChips.d.ts +11 -0
  12. package/components/ToolsChips/ToolsChips.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 +1527 -1163
  31. package/models/ConversationInput.d.ts +99 -16
  32. package/models/ConversationInput.d.ts.map +1 -1
  33. package/models/Input.d.ts +201 -25
  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 M, Tooltip as N } from "@epam/ai-dial-ui-kit";
3
- import { IconArrowLeft as re, IconArrowNarrowRight as ie, IconCheck as ae, IconChevronDown as P, IconChevronRight as oe, 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 _e, useLayoutEffect as ve, useMemo as R, useRef as z, useState as B } from "react";
5
- import { createPortal as V } 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 = z(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 V(/* @__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(re, {
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] = B(n), _ = z(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 = z(a);
128
- L(() => {
129
- y.current = a;
130
- }, [a]);
131
- let b = z(!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)
287
+ };
288
+ }, Fe = (e, t) => {
289
+ let n = t;
290
+ for (; n < e.length && !/\s/.test(e[n]);) n++;
291
+ return n;
292
+ }, Ie = (e, t) => {
293
+ let n = t;
294
+ for (; n > 0 && !/\s/.test(e[n - 1]);) n--;
295
+ return {
296
+ start: n,
297
+ end: Fe(e, n)
268
298
  };
269
- }, 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] = B(!1), [i, a] = B(!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);
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 = z(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 = z(-1), r = z(""), 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 R(() => ({
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] = B(e), i = z(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 = z(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 = z(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] = B("idle"), [o, s] = B(null), c = z(null), l = z(null), u = z({
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, s(null), 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(), l.current = null, 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] = B(t), [l, u] = B(n), [d, f] = B(r), p = z(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
- }, Je = { label: "_label_14i7c_1" }, Ye = ({ 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, Je.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,
723
+ className: i,
559
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
- }, G = ({ 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(Ye, {
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(N, {
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(N, {
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(Ye, {
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,359 +852,384 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
687
852
  onBack: t,
688
853
  backLabel: n,
689
854
  style: a,
690
- children: /* @__PURE__ */ 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(ae, {
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] = B(!1), [te, j] = B(!1), [ne, M] = B(!1), [N, re] = B(null), [ie, ae] = B(!1), P = R(() => 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 = R(() => 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", {
899
+ icon: /* @__PURE__ */ V("span", {
735
900
  style: P,
736
- className: c("flex items-center", et.toolIcon),
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
911
  P
747
- ]), me = R(() => [
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
- M(!0), A(!1);
932
+ onClick: A ? () => {
933
+ ie(!0), j(!1);
769
934
  } : () => void 0,
770
- ...k ? { iconAfter: /* @__PURE__ */ U(oe, {
771
- size: u,
772
- stroke: m,
935
+ ...A ? { iconAfter: /* @__PURE__ */ V(ce, {
936
+ size: f,
937
+ stroke: g,
773
938
  style: P,
774
- className: c("rtl:scale-x-[-1]", et.chevronIcon),
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
- re(e.key), A(!1);
947
+ onClick: A ? () => {
948
+ N(e.key), j(!1);
784
949
  } : () => void 0,
785
- ...k ? { iconAfter: /* @__PURE__ */ U(oe, {
786
- size: u,
787
- stroke: m,
950
+ ...A ? { iconAfter: /* @__PURE__ */ V(ce, {
951
+ size: f,
952
+ stroke: g,
788
953
  style: P,
789
- className: c("rtl:scale-x-[-1]", et.chevronIcon),
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(() => ae(!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), ae(!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(oe, {
820
- size: u,
821
- stroke: m,
984
+ iconAfter: A ? /* @__PURE__ */ V(ce, {
985
+ size: f,
986
+ stroke: g,
822
987
  style: P,
823
- className: c("rtl:scale-x-[-1]", et.chevronIcon),
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,
1005
+ O,
840
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 ? ie : void 0,
849
- onOpenChange: F ? ae : 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
- M(!1), A(!0);
1054
+ ie(!1), j(!0);
888
1055
  },
889
1056
  backLabel: E,
890
- onClose: () => M(!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: N === 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
- re(null), A(!0);
1069
+ N(null), j(!0);
903
1070
  },
904
1071
  backLabel: e.backLabel ?? "Back",
905
- onClose: () => re(null),
906
- style: f,
907
- children: e.renderOverlay(() => re(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(G, {
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 = {
957
- chip: "_chip_ydmd8_1",
958
- chipSelected: "_chipSelected_ydmd8_9",
959
- chipIcon: "_chipIcon_ydmd8_16",
960
- chipText: "_chipText_ydmd8_19",
961
- 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", {
963
- className: "flex flex-wrap items-center gap-2",
964
- style: s({
965
- "--ci-chip-bg": o?.chipBg,
966
- "--ci-chip-border": o?.chipBorder,
967
- "--ci-chip-icon": o?.chipIcon,
968
- "--ci-chip-text": o?.chipText,
969
- "--ci-chip-hover-bg": o?.chipHoverBg,
970
- "--ci-chip-selected-bg": o?.chipSelectedBg,
971
- "--ci-chip-selected-border": o?.chipSelectedBorder,
972
- "--ci-chip-selected-icon": o?.chipSelectedIcon,
973
- "--ci-chip-selected-text": o?.chipSelectedText,
974
- "--ci-chip-close": o?.chipClose,
975
- "--ci-chip-close-hover": o?.chipCloseHover
976
- }),
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", {
980
- type: "button",
981
- onClick: () => t(e.id),
982
- "aria-pressed": e.isSelected,
983
- className: "flex min-w-0 items-center gap-1.5",
984
- children: [/* @__PURE__ */ U("span", {
985
- className: c(nt.chipIcon, "shrink-0"),
986
- "aria-hidden": !0,
987
- children: e.icon
988
- }), /* @__PURE__ */ U("span", {
989
- className: c(nt.chipText, a?.fontClassName || "dial-small-paragraph-text", "truncate"),
990
- children: e.label
1127
+ }, vt = {
1128
+ chip: "_chip_1lvv5_1",
1129
+ chipSelected: "_chipSelected_1lvv5_9",
1130
+ chipIcon: "_chipIcon_1lvv5_16",
1131
+ chipText: "_chipText_1lvv5_19",
1132
+ chipState: "_chipState_1lvv5_22",
1133
+ chipClose: "_chipClose_1lvv5_25"
1134
+ }, yt = (e) => `Remove ${e}`, bt = ({ items: e, onToolToggle: t, onToolDismiss: n, canRemove: r = !0, removeLabel: i = yt, stateOnLabel: a, stateOffLabel: o, typography: s, colors: u }) => {
1135
+ if (e.length === 0) return null;
1136
+ let d = !!(a && o);
1137
+ return /* @__PURE__ */ V("div", {
1138
+ className: "flex flex-wrap items-center gap-2",
1139
+ style: c({
1140
+ "--ci-chip-bg": u?.chipBg,
1141
+ "--ci-chip-border": u?.chipBorder,
1142
+ "--ci-chip-icon": u?.chipIcon,
1143
+ "--ci-chip-text": u?.chipText,
1144
+ "--ci-chip-hover-bg": u?.chipHoverBg,
1145
+ "--ci-chip-selected-bg": u?.chipSelectedBg,
1146
+ "--ci-chip-selected-border": u?.chipSelectedBorder,
1147
+ "--ci-chip-selected-icon": u?.chipSelectedIcon,
1148
+ "--ci-chip-selected-text": u?.chipSelectedText,
1149
+ "--ci-chip-state-text": u?.chipStateText,
1150
+ "--ci-chip-close": u?.chipClose,
1151
+ "--ci-chip-close-hover": u?.chipCloseHover
1152
+ }),
1153
+ children: e.map((e) => /* @__PURE__ */ H("div", {
1154
+ className: l(vt.chip, e.isSelected && vt.chipSelected, "flex min-w-0 items-center gap-1.5 rounded-full border py-1 transition-colors", r ? "pe-1 ps-2" : "px-2"),
1155
+ children: [/* @__PURE__ */ H("button", {
1156
+ type: "button",
1157
+ onClick: () => t(e.id),
1158
+ "aria-pressed": e.isSelected,
1159
+ className: "flex min-w-0 items-center gap-1.5",
1160
+ children: [
1161
+ /* @__PURE__ */ V("span", {
1162
+ className: l(vt.chipIcon, "shrink-0"),
1163
+ "aria-hidden": !0,
1164
+ children: e.icon
1165
+ }),
1166
+ /* @__PURE__ */ H("span", {
1167
+ className: l(vt.chipText, s?.fontClassName || "dial-small-paragraph-text", "truncate"),
1168
+ children: [e.label, d && /* @__PURE__ */ V("span", {
1169
+ "aria-hidden": !0,
1170
+ children: ":"
1171
+ })]
1172
+ }),
1173
+ d && /* @__PURE__ */ V("span", {
1174
+ className: l(vt.chipState, s?.fontClassName || "dial-small-paragraph-text", "ms-1 shrink-0 uppercase tracking-wider"),
1175
+ "aria-hidden": !0,
1176
+ children: e.isSelected ? a : o
1177
+ })
1178
+ ]
1179
+ }), r && /* @__PURE__ */ V("button", {
1180
+ type: "button",
1181
+ onClick: () => n(e.id),
1182
+ "aria-label": i(e.label),
1183
+ className: l(vt.chipClose, "flex shrink-0 items-center rounded p-0.5 transition-colors"),
1184
+ children: /* @__PURE__ */ V(_e, {
1185
+ size: 12,
1186
+ "aria-hidden": !0,
1187
+ stroke: g
1188
+ })
991
1189
  })]
992
- }), r && /* @__PURE__ */ U("button", {
993
- type: "button",
994
- onClick: () => n(e.id),
995
- "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, {
998
- size: 12,
999
- "aria-hidden": !0,
1000
- stroke: m
1001
- })
1002
- })]
1003
- }, 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 = {
1190
+ }, e.id))
1191
+ });
1192
+ }, G = {
1193
+ wrapper: "_wrapper_19a9k_2",
1194
+ wrapperDisabled: "_wrapperDisabled_19a9k_9",
1195
+ textarea: "_textarea_19a9k_13",
1196
+ textareaMentionMode: "_textareaMentionMode_19a9k_19",
1197
+ commandHint: "_commandHint_19a9k_53",
1198
+ mentionHighlight: "_mentionHighlight_19a9k_57",
1199
+ mentionHighlightUnsupported: "_mentionHighlightUnsupported_19a9k_63",
1200
+ modelSelectorButton: "_modelSelectorButton_19a9k_69",
1201
+ modelSelectorCaret: "_modelSelectorCaret_19a9k_69",
1202
+ modelSelectorName: "_modelSelectorName_19a9k_72",
1203
+ modelSelectorVersion: "_modelSelectorVersion_19a9k_75",
1204
+ modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_19a9k_84"
1205
+ }, xt = {
1016
1206
  wrapperError: "_wrapperError_129ri_1",
1017
1207
  waveformCanvas: "_waveformCanvas_129ri_5",
1018
1208
  recordingDot: "_recordingDot_129ri_19",
1019
1209
  "recording-pulse": "_recording-pulse_129ri_1"
1020
- }, ot = 3, st = 4, ct = 200, lt = ({ 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 = z(null), g = z(new Float32Array(ct)), y = z(0), b = z(0), x = e === Le.Recording, S = e === Le.Error, C = e === Le.Processing, w = I((e) => {
1210
+ }, St = 3, Ct = 4, wt = 200, Tt = ({ state: e, analyserNodeRef: t, errorMessage: n, onStop: r, onDiscard: i, attachButton: a, stopLabel: o = "Stop recording", discardLabel: s = "Discard recording", processingLabel: c = "Transcribing audio…", style: u, className: d, embedded: f = !1 }) => {
1211
+ let p = R(null), m = R(new Float32Array(wt)), _ = R(0), v = R(0), x = e === Qe.Recording, S = e === Qe.Error, C = e === Qe.Processing, w = F((e) => {
1022
1212
  let t = e.getContext("2d");
1023
1213
  if (!t) return;
1024
1214
  e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
1025
1215
  let { width: n, height: r } = e;
1026
1216
  t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
1027
- let i = Math.min(Math.max(1, Math.floor(n / st)), ct - 1), a = y.current, o = b.current;
1217
+ let i = Math.min(Math.max(1, Math.floor(n / Ct)), wt - 1), a = _.current, o = v.current;
1028
1218
  t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
1029
1219
  for (let e = 0; e <= i; e++) {
1030
- let n = ((a - i + e) % ct + ct) % ct, 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);
1220
+ let n = ((a - i + e) % wt + wt) % wt, o = m.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
1221
+ t.fillRect(e * Ct, (r - c) / 2, St, c);
1032
1222
  }
1033
1223
  t.restore();
1034
1224
  }, []);
1035
- L(() => {
1225
+ I(() => {
1036
1226
  if (!x) return;
1037
- let e = h.current;
1227
+ let e = p.current;
1038
1228
  if (!e) return;
1039
- g.current.fill(0), y.current = 0, b.current = 0;
1229
+ m.current.fill(0), _.current = 0, v.current = 0;
1040
1230
  let n, r = () => {
1041
- if (b.current += 1, b.current >= st) {
1042
- b.current -= st;
1231
+ if (v.current += 1, v.current >= Ct) {
1232
+ v.current -= Ct;
1043
1233
  let e = t.current;
1044
1234
  if (e) {
1045
1235
  let t = new Uint8Array(e.frequencyBinCount);
@@ -1049,7 +1239,7 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
1049
1239
  let r = (t[e] - 128) / 128;
1050
1240
  n += r * r;
1051
1241
  }
1052
- g.current[y.current % ct] = Math.sqrt(n / t.length), y.current++;
1242
+ m.current[_.current % wt] = Math.sqrt(n / t.length), _.current++;
1053
1243
  }
1054
1244
  }
1055
1245
  w(e), n = requestAnimationFrame(r);
@@ -1061,30 +1251,30 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
1061
1251
  x,
1062
1252
  t,
1063
1253
  w
1064
- ]), L(() => {
1065
- let e = h.current;
1254
+ ]), I(() => {
1255
+ let e = p.current;
1066
1256
  if (!e) return;
1067
1257
  let t = new ResizeObserver(() => {
1068
1258
  w(e);
1069
1259
  });
1070
1260
  return t.observe(e), () => t.disconnect();
1071
1261
  }, [w]);
1072
- let E = /* @__PURE__ */ W("div", {
1262
+ let T = /* @__PURE__ */ H("div", {
1073
1263
  className: "flex flex-shrink-0 items-center justify-end gap-1",
1074
1264
  children: [
1075
- /* @__PURE__ */ U(v, {
1076
- icon: /* @__PURE__ */ U(me, {
1077
- size: p.LG,
1265
+ /* @__PURE__ */ V(b, {
1266
+ icon: /* @__PURE__ */ V(_e, {
1267
+ size: h.LG,
1078
1268
  "aria-hidden": !0,
1079
- stroke: m
1269
+ stroke: g
1080
1270
  }),
1081
1271
  "aria-label": s,
1082
1272
  className: "mobile:min-h-11 mobile:min-w-11",
1083
1273
  onClick: i
1084
1274
  }),
1085
- x && /* @__PURE__ */ U(T, {
1086
- icon: /* @__PURE__ */ U(F, {
1087
- size: p.LG,
1275
+ x && /* @__PURE__ */ V(D, {
1276
+ icon: /* @__PURE__ */ V(fe, {
1277
+ size: h.LG,
1088
1278
  "aria-hidden": !0
1089
1279
  }),
1090
1280
  onClick: () => r?.(),
@@ -1092,163 +1282,185 @@ var Ce = "a[href], button:not([disabled]), input:not([disabled]), select:not([di
1092
1282
  "aria-label": o,
1093
1283
  className: "mobile:min-h-11 mobile:min-w-11"
1094
1284
  }),
1095
- C && /* @__PURE__ */ U("span", {
1285
+ C && /* @__PURE__ */ V("span", {
1096
1286
  className: "flex size-[40px] flex-shrink-0 items-center justify-center mobile:min-h-11 mobile:min-w-11",
1097
- children: /* @__PURE__ */ U(te, {
1287
+ children: /* @__PURE__ */ V(ne, {
1098
1288
  size: 20,
1099
- ariaLabel: l
1289
+ ariaLabel: c
1100
1290
  })
1101
1291
  })
1102
1292
  ]
1103
1293
  });
1104
- return /* @__PURE__ */ W("div", {
1294
+ return /* @__PURE__ */ H("div", {
1105
1295
  className: d,
1106
- children: [/* @__PURE__ */ W("div", {
1296
+ children: [/* @__PURE__ */ H("div", {
1107
1297
  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", {
1298
+ className: l("flex w-full min-w-0 flex-col justify-center gap-2", !f && G.wrapper, !f && "min-h-[64px] max-w-[748px] rounded-xl border px-3 shadow-md", S && xt.wrapperError),
1299
+ children: [/* @__PURE__ */ H("div", {
1110
1300
  className: "flex min-w-0 flex-1 items-center gap-3",
1111
- children: [x && /* @__PURE__ */ U("span", {
1112
- className: c(at.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
1301
+ children: [x && /* @__PURE__ */ V("span", {
1302
+ className: l(xt.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
1113
1303
  "aria-hidden": !0
1114
- }), /* @__PURE__ */ U("canvas", {
1115
- ref: h,
1304
+ }), /* @__PURE__ */ V("canvas", {
1305
+ ref: p,
1116
1306
  height: 26,
1117
1307
  "aria-hidden": !0,
1118
- className: c(at.waveformCanvas, "h-[26px] min-w-0 flex-1")
1308
+ className: l(xt.waveformCanvas, "h-[26px] min-w-0 flex-1")
1119
1309
  })]
1120
- }), /* @__PURE__ */ W("div", {
1310
+ }), /* @__PURE__ */ H("div", {
1121
1311
  className: "flex items-center justify-between gap-2",
1122
- children: [a ?? /* @__PURE__ */ U("span", { "aria-hidden": !0 }), E]
1312
+ children: [a ?? /* @__PURE__ */ V("span", { "aria-hidden": !0 }), T]
1123
1313
  })]
1124
- }), S && n && /* @__PURE__ */ U("div", {
1314
+ }), S && n && /* @__PURE__ */ V("div", {
1125
1315
  role: "alert",
1126
- children: /* @__PURE__ */ U(_, {
1316
+ children: /* @__PURE__ */ V(y, {
1127
1317
  text: n,
1128
1318
  className: "mt-1 px-1"
1129
1319
  })
1130
1320
  })]
1131
1321
  });
1132
- }, ut = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", sendTooltip: r }) => /* @__PURE__ */ U(T, {
1322
+ }, Et = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", sendTooltip: r }) => /* @__PURE__ */ V(D, {
1133
1323
  "aria-label": n,
1134
1324
  onClick: () => e?.(),
1135
1325
  disabled: t,
1136
1326
  tooltipProps: r ? { tooltip: r } : void 0,
1137
- icon: /* @__PURE__ */ U(ie, {
1138
- size: p.LG,
1327
+ icon: /* @__PURE__ */ V(oe, {
1328
+ size: h.LG,
1139
1329
  className: "rtl:scale-x-[-1]",
1140
- stroke: m
1330
+ stroke: g
1141
1331
  })
1142
- }), dt = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ U(j, {
1143
- icon: /* @__PURE__ */ U(ue, {
1144
- size: p.LG,
1145
- stroke: m
1332
+ }), Dt = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ V(re, {
1333
+ icon: /* @__PURE__ */ V(pe, {
1334
+ size: h.LG,
1335
+ stroke: g
1146
1336
  }),
1147
1337
  onClick: () => e?.(),
1148
1338
  "aria-label": t
1149
- }), ft = ({ size: e = 20 }) => /* @__PURE__ */ U(k, {
1150
- variant: ee.Circular,
1339
+ }), Ot = ({ size: e = 20 }) => /* @__PURE__ */ V(ee, {
1340
+ variant: j.Circular,
1151
1341
  width: e,
1152
1342
  height: e,
1153
1343
  active: !0
1154
- }), pt = ({ loadingLabel: e }) => /* @__PURE__ */ W("span", {
1344
+ }), kt = ({ loadingLabel: e }) => /* @__PURE__ */ H("span", {
1155
1345
  className: "flex min-w-0 flex-1 items-center",
1156
- children: [/* @__PURE__ */ U(k, {
1157
- variant: ee.Text,
1346
+ children: [/* @__PURE__ */ V(ee, {
1347
+ variant: j.Text,
1158
1348
  width: "100%",
1159
1349
  height: 16,
1160
1350
  active: !0
1161
- }), e && /* @__PURE__ */ U("span", {
1351
+ }), e && /* @__PURE__ */ V("span", {
1162
1352
  className: "sr-only",
1163
1353
  children: e
1164
1354
  })]
1165
- }), mt = ({ loadingLabel: e }) => /* @__PURE__ */ U("div", {
1355
+ }), At = ({ loadingLabel: e }) => /* @__PURE__ */ V("div", {
1166
1356
  role: "status",
1167
1357
  "aria-label": e,
1168
- children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ W("div", {
1358
+ children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ H("div", {
1169
1359
  className: "flex h-11 items-center gap-3 px-4",
1170
1360
  "aria-hidden": "true",
1171
- children: [/* @__PURE__ */ U(ft, {}), /* @__PURE__ */ U(pt, {})]
1361
+ children: [/* @__PURE__ */ V(Ot, {}), /* @__PURE__ */ V(kt, {})]
1172
1362
  }, t))
1173
- }), ht = (e) => e.displayName ?? e.id, gt = (e, t) => {
1363
+ }), jt = (e) => e.displayName ?? e.id, Mt = (e, t) => {
1174
1364
  let n = t.trim().toLowerCase();
1175
- return n ? e.filter((e) => ht(e).toLowerCase().includes(n)) : e;
1176
- }, q = (e, t, r, i = 18, a) => /* @__PURE__ */ U(n, {
1365
+ return n ? e.filter((e) => jt(e).toLowerCase().includes(n)) : e;
1366
+ }, Nt = (e, t, r, i = 18, a) => /* @__PURE__ */ V(n, {
1177
1367
  src: e,
1178
1368
  size: i,
1179
1369
  labels: { tooltip: a },
1180
1370
  initialsName: r
1181
- }), J = { searchHeader: "_searchHeader_1728o_1" }, _t = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, searchHeaderClassName: i = J.searchHeader, colors: a }) => {
1182
- let [o, l] = B(""), u = R(() => e?.find((e) => e.id === t), [e, t]), d = r?.loading !== void 0, f = !d && !u && !!t, m = R(() => d ? /* @__PURE__ */ U(ft, { size: p.LG }) : q(u?.iconUrl, u?.type, u?.displayName ?? u?.id ?? "", p.LG, f ? r?.unavailableTooltip ?? "This deployment is no longer available" : void 0), [
1183
- d,
1371
+ }), K = {
1372
+ searchHeader: "_searchHeader_1u7db_1",
1373
+ itemText: "_itemText_1u7db_13",
1374
+ itemHover: "_itemHover_1u7db_17",
1375
+ selectedItemBackground: "_selectedItemBackground_1u7db_22",
1376
+ selectedItemText: "_selectedItemText_1u7db_26",
1377
+ checkIcon: "_checkIcon_1u7db_30"
1378
+ }, Pt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, styles: i }) => {
1379
+ let [a, o] = z(""), s = L(() => e?.find((e) => e.id === t), [e, t]), u = r?.loading !== void 0, d = !u && !s && !!t, f = L(() => u ? /* @__PURE__ */ V(Ot, { size: h.LG }) : Nt(s?.iconUrl, s?.type, s?.displayName ?? s?.id ?? "", h.LG, d ? r?.unavailableTooltip ?? "This deployment is no longer available" : void 0), [
1184
1380
  u,
1185
- f,
1381
+ s,
1382
+ d,
1186
1383
  r?.unavailableTooltip
1187
- ]), h = u?.displayName ?? u?.id, _ = u?.displayVersion;
1188
- return {
1189
- selectorIcon: m,
1190
- selectorAriaLabel: h ? `${r?.ariaLabel ?? "Select model"}: ${h}` : r?.ariaLabel ?? "Select model",
1191
- selectedLabel: h,
1192
- selectedVersion: _,
1193
- menuItems: R(() => {
1194
- if (d) return Array.from({ length: 7 }, (e, t) => ({
1195
- key: `__loading-${t}`,
1196
- icon: /* @__PURE__ */ U(ft, {}),
1197
- label: /* @__PURE__ */ U(pt, { loadingLabel: t === 0 ? r?.loading : void 0 }),
1384
+ ]), p = s?.displayName ?? s?.id, m = s?.displayVersion, g = p ? `${r?.ariaLabel ?? "Select model"}: ${p}` : r?.ariaLabel ?? "Select model", _ = L(() => {
1385
+ if (u) return Array.from({ length: 7 }, (e, t) => ({
1386
+ key: `__loading-${t}`,
1387
+ icon: /* @__PURE__ */ V(Ot, {}),
1388
+ label: /* @__PURE__ */ V(kt, { loadingLabel: t === 0 ? r?.loading : void 0 }),
1389
+ disabled: !0
1390
+ }));
1391
+ if (!e || e.length === 0) {
1392
+ let e = r?.error ?? r?.empty;
1393
+ return e ? [{
1394
+ key: "__state",
1395
+ label: e,
1198
1396
  disabled: !0
1199
- }));
1200
- if (!e || e.length === 0) {
1201
- let e = r?.error ?? r?.empty;
1202
- return e ? [{
1203
- key: "__state",
1204
- label: e,
1205
- disabled: !0
1206
- }] : [];
1207
- }
1208
- return gt(e, o).map((e) => ({
1397
+ }] : [];
1398
+ }
1399
+ let o = i?.colors;
1400
+ return Mt(e, a).map((e) => {
1401
+ let r = e.id === t;
1402
+ return {
1209
1403
  key: e.id,
1210
- label: /* @__PURE__ */ U(y, {
1211
- text: ht(e),
1212
- query: o,
1404
+ label: /* @__PURE__ */ V(x, {
1405
+ text: jt(e),
1406
+ query: a,
1213
1407
  maxLines: 1
1214
1408
  }),
1215
- icon: q(e.iconUrl, e.type, e.displayName ?? e.id),
1216
- mark: b.Check,
1217
- checked: e.id === t,
1409
+ icon: Nt(e.iconUrl, e.type, e.displayName ?? e.id),
1410
+ mark: S.Check,
1411
+ checked: r,
1412
+ className: l(o?.itemText && K.itemText, o?.itemHoverBackground && K.itemHover, r && o?.selectedItemBackground && K.selectedItemBackground, r && o?.selectedItemText && K.selectedItemText, r && o?.checkIcon && K.checkIcon, i?.itemClassName, r && i?.selectedItemClassName, U.modelMenuItem, r && U.modelMenuItemSelected),
1218
1413
  onClick: () => n?.(e.id)
1219
- }));
1220
- }, [
1221
- e,
1222
- d,
1223
- o,
1224
- t,
1225
- r,
1226
- n
1227
- ]),
1228
- menuHeader: R(() => !d && e && e.length > 0 ? /* @__PURE__ */ U("div", {
1229
- style: s({ "--ms-search-header-bg": a?.searchHeaderBackground }),
1230
- className: c("sticky top-0 z-10 pb-1 pe-2 pt-2", i),
1231
- children: /* @__PURE__ */ U(O, {
1232
- value: o,
1414
+ };
1415
+ });
1416
+ }, [
1417
+ e,
1418
+ u,
1419
+ a,
1420
+ t,
1421
+ r,
1422
+ n,
1423
+ i?.itemClassName,
1424
+ i?.selectedItemClassName,
1425
+ i?.colors
1426
+ ]), y = L(() => c({
1427
+ "--ms-item-text": i?.colors?.itemText,
1428
+ "--ms-item-hover-bg": i?.colors?.itemHoverBackground,
1429
+ "--ms-selected-item-bg": i?.colors?.selectedItemBackground,
1430
+ "--ms-selected-item-text": i?.colors?.selectedItemText,
1431
+ "--ms-check-icon": i?.colors?.checkIcon
1432
+ }), [i?.colors]);
1433
+ return {
1434
+ selectorIcon: f,
1435
+ selectorAriaLabel: g,
1436
+ selectedLabel: p,
1437
+ selectedVersion: m,
1438
+ menuItems: _,
1439
+ menuHeader: L(() => !u && e && e.length > 0 ? /* @__PURE__ */ V("div", {
1440
+ style: c({ "--ms-search-header-bg": i?.colors?.searchHeaderBackground }),
1441
+ className: l("sticky top-0 z-10 pb-1 pe-2 pt-2", K.searchHeader, i?.searchHeaderClassName, U.modelMenuSearch),
1442
+ children: /* @__PURE__ */ V(A, {
1443
+ value: a,
1233
1444
  placeholder: r?.searchPlaceholder ?? "Search",
1234
- size: g.Small,
1445
+ size: v.Small,
1235
1446
  wrapperClassName: "border-0",
1236
- onChange: (e) => l(e ?? "")
1447
+ onChange: (e) => o(e ?? "")
1237
1448
  })
1238
1449
  }) : void 0, [
1239
1450
  e,
1240
- d,
1241
- o,
1451
+ u,
1452
+ a,
1242
1453
  r,
1243
- i,
1244
- a?.searchHeaderBackground
1454
+ i?.searchHeaderClassName,
1455
+ i?.colors?.searchHeaderBackground
1245
1456
  ]),
1457
+ menuStyle: y,
1246
1458
  onOpenChange: (e) => {
1247
- e || l("");
1459
+ e || o("");
1248
1460
  }
1249
1461
  };
1250
- }, vt = typeof window < "u" ? ve : L;
1251
- function yt(e) {
1462
+ }, Ft = typeof window < "u" ? Ce : I;
1463
+ function It(e) {
1252
1464
  if (e !== void 0) switch (typeof e) {
1253
1465
  case "number": return e;
1254
1466
  case "string":
@@ -1256,15 +1468,15 @@ function yt(e) {
1256
1468
  break;
1257
1469
  }
1258
1470
  }
1259
- function bt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
1260
- let { styleHeight: s, styleWidth: c } = R(() => ({
1261
- styleHeight: yt(o?.height),
1262
- styleWidth: yt(o?.width)
1263
- }), [o?.height, o?.width]), [l, u] = B({
1471
+ function Lt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
1472
+ let { styleHeight: s, styleWidth: c } = L(() => ({
1473
+ styleHeight: It(o?.height),
1474
+ styleWidth: It(o?.width)
1475
+ }), [o?.height, o?.width]), [l, u] = z({
1264
1476
  height: t,
1265
1477
  width: n
1266
1478
  }), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
1267
- return vt(() => {
1479
+ return Ft(() => {
1268
1480
  if (i === null || d) return;
1269
1481
  let t = new ResizeObserver((e) => {
1270
1482
  for (let t of e) {
@@ -1284,7 +1496,7 @@ function bt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
1284
1496
  i,
1285
1497
  s,
1286
1498
  c
1287
- ]), R(() => ({
1499
+ ]), L(() => ({
1288
1500
  height: s ?? l.height,
1289
1501
  width: c ?? l.width
1290
1502
  }), [
@@ -1293,26 +1505,26 @@ function bt({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
1293
1505
  c
1294
1506
  ]);
1295
1507
  }
1296
- function xt(e) {
1297
- let t = z(() => {
1508
+ function q(e) {
1509
+ let t = R(() => {
1298
1510
  throw Error("Cannot call during render.");
1299
1511
  });
1300
- return vt(() => {
1512
+ return Ft(() => {
1301
1513
  t.current = e;
1302
- }, [e]), I((e) => t.current?.(e), [t]);
1514
+ }, [e]), F((e) => t.current?.(e), [t]);
1303
1515
  }
1304
- var Y = null;
1305
- function X(e = !1) {
1306
- if (Y === null || e) {
1516
+ var J = null;
1517
+ function Y(e = !1) {
1518
+ if (J === null || e) {
1307
1519
  let e = document.createElement("div"), t = e.style;
1308
1520
  t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
1309
1521
  let n = document.createElement("div"), r = n.style;
1310
- return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? Y = "positive-descending" : (e.scrollLeft = 1, Y = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), Y;
1522
+ return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? J = "positive-descending" : (e.scrollLeft = 1, J = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), J;
1311
1523
  }
1312
- return Y;
1524
+ return J;
1313
1525
  }
1314
- function Z({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
1315
- if (t === "horizontal" && n) switch (X()) {
1526
+ function Rt({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
1527
+ if (t === "horizontal" && n) switch (Y()) {
1316
1528
  case "negative": return -r;
1317
1529
  case "positive-descending":
1318
1530
  if (e) {
@@ -1323,26 +1535,26 @@ function Z({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
1323
1535
  }
1324
1536
  return r;
1325
1537
  }
1326
- function Q(e, t = "Assertion error") {
1538
+ function X(e, t = "Assertion error") {
1327
1539
  if (!e) throw console.error(t), Error(t);
1328
1540
  }
1329
- function St(e, t) {
1541
+ function zt(e, t) {
1330
1542
  if (e === t) return !0;
1331
- if (!!e != !!t || (Q(e !== void 0), Q(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
1543
+ if (!!e != !!t || (X(e !== void 0), X(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
1332
1544
  for (let n in e) if (!Object.is(t[n], e[n])) return !1;
1333
1545
  return !0;
1334
1546
  }
1335
- function Ct({ cachedBounds: e, itemCount: t, itemSize: n }) {
1547
+ function Z({ cachedBounds: e, itemCount: t, itemSize: n }) {
1336
1548
  if (t === 0) return 0;
1337
1549
  if (typeof n == "number") return t * n;
1338
1550
  {
1339
1551
  let n = e.get(e.size === 0 ? 0 : e.size - 1);
1340
- return Q(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
1552
+ return X(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
1341
1553
  }
1342
1554
  }
1343
- function wt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
1555
+ function Bt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
1344
1556
  if (n < 0 || n >= r) throw RangeError(`Invalid index specified: ${n}`, { cause: `Index ${n} is not within the range of 0 - ${r - 1}` });
1345
- let s = Ct({
1557
+ let s = Z({
1346
1558
  cachedBounds: t,
1347
1559
  itemCount: r,
1348
1560
  itemSize: i
@@ -1354,7 +1566,7 @@ function wt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, co
1354
1566
  default: return a >= u && a <= l ? a : a < u ? u : l;
1355
1567
  }
1356
1568
  }
1357
- function Tt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
1569
+ function Vt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
1358
1570
  let a = r - 1, o = 0, s = -1, c = 0, l = -1, u = 0;
1359
1571
  for (; u < a;) {
1360
1572
  let n = e.get(u);
@@ -1373,11 +1585,11 @@ function Tt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemC
1373
1585
  stopIndexOverscan: l
1374
1586
  };
1375
1587
  }
1376
- function Et({ itemCount: e, itemProps: t, itemSize: n }) {
1588
+ function Ht({ itemCount: e, itemProps: t, itemSize: n }) {
1377
1589
  let r = /* @__PURE__ */ new Map();
1378
1590
  return {
1379
1591
  get(i) {
1380
- for (Q(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
1592
+ for (X(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
1381
1593
  let e = r.size, a;
1382
1594
  switch (typeof n) {
1383
1595
  case "function":
@@ -1393,14 +1605,14 @@ function Et({ itemCount: e, itemProps: t, itemSize: n }) {
1393
1605
  });
1394
1606
  else {
1395
1607
  let t = r.get(e - 1);
1396
- Q(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
1608
+ X(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
1397
1609
  scrollOffset: t.scrollOffset + t.size,
1398
1610
  size: a
1399
1611
  });
1400
1612
  }
1401
1613
  }
1402
1614
  let a = r.get(i);
1403
- return Q(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
1615
+ return X(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
1404
1616
  },
1405
1617
  set(e, t) {
1406
1618
  r.set(e, t);
@@ -1410,8 +1622,8 @@ function Et({ itemCount: e, itemProps: t, itemSize: n }) {
1410
1622
  }
1411
1623
  };
1412
1624
  }
1413
- function Dt({ itemCount: e, itemProps: t, itemSize: n }) {
1414
- return R(() => Et({
1625
+ function Ut({ itemCount: e, itemProps: t, itemSize: n }) {
1626
+ return L(() => Ht({
1415
1627
  itemCount: e,
1416
1628
  itemProps: t,
1417
1629
  itemSize: n
@@ -1421,11 +1633,11 @@ function Dt({ itemCount: e, itemProps: t, itemSize: n }) {
1421
1633
  n
1422
1634
  ]);
1423
1635
  }
1424
- function Ot({ containerSize: e, itemSize: t }) {
1636
+ function Wt({ containerSize: e, itemSize: t }) {
1425
1637
  let n;
1426
1638
  switch (typeof t) {
1427
1639
  case "string":
1428
- Q(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), Q(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseInt(t) / 100;
1640
+ X(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), X(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseInt(t) / 100;
1429
1641
  break;
1430
1642
  default:
1431
1643
  n = t;
@@ -1433,21 +1645,21 @@ function Ot({ containerSize: e, itemSize: t }) {
1433
1645
  }
1434
1646
  return n;
1435
1647
  }
1436
- function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
1437
- let { height: u = n, width: d = n } = bt({
1648
+ function Gt({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
1649
+ let { height: u = n, width: d = n } = Lt({
1438
1650
  defaultHeight: r === "vertical" ? n : void 0,
1439
1651
  defaultWidth: r === "horizontal" ? n : void 0,
1440
1652
  element: e,
1441
1653
  mode: r === "vertical" ? "only-height" : "only-width",
1442
1654
  style: t
1443
- }), f = z({
1655
+ }), f = R({
1444
1656
  height: 0,
1445
1657
  width: 0
1446
- }), p = r === "vertical" ? u : d, m = Ot({
1658
+ }), p = r === "vertical" ? u : d, m = Wt({
1447
1659
  containerSize: p,
1448
1660
  itemSize: s
1449
1661
  });
1450
- ve(() => {
1662
+ Ce(() => {
1451
1663
  if (typeof c == "function") {
1452
1664
  let e = f.current;
1453
1665
  (e.height !== u || e.width !== d) && (c({
@@ -1460,11 +1672,11 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1460
1672
  c,
1461
1673
  d
1462
1674
  ]);
1463
- let h = Dt({
1675
+ let h = Ut({
1464
1676
  itemCount: a,
1465
1677
  itemProps: o,
1466
1678
  itemSize: m
1467
- }), g = I((e) => h.get(e), [h]), [_, v] = B(() => Tt({
1679
+ }), g = F((e) => h.get(e), [h]), [_, v] = z(() => Vt({
1468
1680
  cachedBounds: h,
1469
1681
  containerScrollOffset: 0,
1470
1682
  containerSize: p,
@@ -1475,7 +1687,7 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1475
1687
  startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
1476
1688
  stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
1477
1689
  stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
1478
- }, C = I(() => Ct({
1690
+ }, C = F(() => Z({
1479
1691
  cachedBounds: h,
1480
1692
  itemCount: a,
1481
1693
  itemSize: m
@@ -1483,9 +1695,9 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1483
1695
  h,
1484
1696
  a,
1485
1697
  m
1486
- ]), w = I((t) => Tt({
1698
+ ]), w = F((t) => Vt({
1487
1699
  cachedBounds: h,
1488
- containerScrollOffset: Z({
1700
+ containerScrollOffset: Rt({
1489
1701
  containerElement: e,
1490
1702
  direction: r,
1491
1703
  isRtl: i,
@@ -1503,19 +1715,19 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1503
1715
  a,
1504
1716
  l
1505
1717
  ]);
1506
- return vt(() => {
1718
+ return Ft(() => {
1507
1719
  v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
1508
1720
  }, [
1509
1721
  e,
1510
1722
  r,
1511
1723
  w
1512
- ]), vt(() => {
1724
+ ]), Ft(() => {
1513
1725
  if (!e) return;
1514
1726
  let t = () => {
1515
1727
  v((t) => {
1516
- let { scrollLeft: n, scrollTop: o } = e, s = Tt({
1728
+ let { scrollLeft: n, scrollTop: o } = e, s = Vt({
1517
1729
  cachedBounds: h,
1518
- containerScrollOffset: Z({
1730
+ containerScrollOffset: Rt({
1519
1731
  containerElement: e,
1520
1732
  direction: r,
1521
1733
  isRtl: i,
@@ -1525,7 +1737,7 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1525
1737
  itemCount: a,
1526
1738
  overscanCount: l
1527
1739
  });
1528
- return St(s, t) ? t : s;
1740
+ return zt(s, t) ? t : s;
1529
1741
  });
1530
1742
  };
1531
1743
  return e.addEventListener("scroll", t), () => {
@@ -1541,8 +1753,8 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1541
1753
  ]), {
1542
1754
  getCellBounds: g,
1543
1755
  getEstimatedSize: C,
1544
- scrollToIndex: xt(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
1545
- let s = wt({
1756
+ scrollToIndex: q(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
1757
+ let s = Bt({
1546
1758
  align: t,
1547
1759
  cachedBounds: h,
1548
1760
  containerScrollOffset: n,
@@ -1552,14 +1764,14 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1552
1764
  itemSize: m
1553
1765
  });
1554
1766
  if (e) {
1555
- if (s = Z({
1767
+ if (s = Rt({
1556
1768
  containerElement: e,
1557
1769
  direction: r,
1558
1770
  isRtl: i,
1559
1771
  scrollOffset: s
1560
1772
  }), typeof e.scrollTo != "function") {
1561
1773
  let e = w(s);
1562
- St(_, e) || v(e);
1774
+ zt(_, e) || v(e);
1563
1775
  }
1564
1776
  return s;
1565
1777
  }
@@ -1570,30 +1782,30 @@ function kt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1570
1782
  stopIndexVisible: x
1571
1783
  };
1572
1784
  }
1573
- function At(e) {
1574
- return R(() => e, Object.values(e));
1785
+ function Kt(e) {
1786
+ return L(() => e, Object.values(e));
1575
1787
  }
1576
- function jt(e, t) {
1788
+ function qt(e, t) {
1577
1789
  let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
1578
- return St(n, a) && St(r, o) && St(i, s);
1790
+ return zt(n, a) && zt(r, o) && zt(i, s);
1579
1791
  }
1580
- function Mt(e) {
1792
+ function Jt(e) {
1581
1793
  return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
1582
1794
  }
1583
- var Nt = "data-react-window-index";
1584
- function Pt({ 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 }) {
1585
- let m = At(u), h = R(() => ge(s, jt), [s]), [g, _] = B(null), v = Mt(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = kt({
1795
+ var Yt = "data-react-window-index";
1796
+ function Xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onResize: i, onRowsRendered: a, overscanCount: o = 3, rowComponent: s, rowCount: c, rowHeight: l, rowProps: u, tagName: d = "div", style: f, ...p }) {
1797
+ let m = Kt(u), h = L(() => be(s, qt), [s]), [g, _] = z(null), v = Jt(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = Gt({
1586
1798
  containerElement: g,
1587
1799
  containerStyle: f,
1588
1800
  defaultContainerSize: n,
1589
1801
  direction: "vertical",
1590
1802
  itemCount: c,
1591
1803
  itemProps: m,
1592
- itemSize: R(() => v ? (e) => l.getRowHeight(e) ?? l.getAverageRowHeight() : l, [v, l]),
1804
+ itemSize: L(() => v ? (e) => l.getRowHeight(e) ?? l.getAverageRowHeight() : l, [v, l]),
1593
1805
  onResize: i,
1594
1806
  overscanCount: o
1595
1807
  });
1596
- _e(r, () => ({
1808
+ Se(r, () => ({
1597
1809
  get element() {
1598
1810
  return g;
1599
1811
  },
@@ -1608,12 +1820,12 @@ function Pt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1608
1820
  top: r
1609
1821
  });
1610
1822
  }
1611
- }), [g, x]), vt(() => {
1823
+ }), [g, x]), Ft(() => {
1612
1824
  if (!g) return;
1613
1825
  let e = Array.from(g.children).filter((e, t) => {
1614
1826
  if (e.hasAttribute("aria-hidden")) return !1;
1615
1827
  let n = `${S + t}`;
1616
- return e.setAttribute(Nt, n), !0;
1828
+ return e.setAttribute(Yt, n), !0;
1617
1829
  });
1618
1830
  if (v) return l.observeRowElements(e);
1619
1831
  }, [
@@ -1622,7 +1834,7 @@ function Pt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1622
1834
  l,
1623
1835
  S,
1624
1836
  w
1625
- ]), L(() => {
1837
+ ]), I(() => {
1626
1838
  S >= 0 && w >= 0 && a && a({
1627
1839
  startIndex: C,
1628
1840
  stopIndex: T
@@ -1637,11 +1849,11 @@ function Pt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1637
1849
  w,
1638
1850
  T
1639
1851
  ]);
1640
- let E = R(() => {
1852
+ let E = L(() => {
1641
1853
  let e = [];
1642
1854
  if (c > 0) for (let t = S; t <= w; t++) {
1643
1855
  let n = y(t);
1644
- e.push(/* @__PURE__ */ he(h, {
1856
+ e.push(/* @__PURE__ */ ve(h, {
1645
1857
  ...m,
1646
1858
  ariaAttributes: {
1647
1859
  "aria-posinset": t + 1,
@@ -1668,7 +1880,7 @@ function Pt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1668
1880
  m,
1669
1881
  S,
1670
1882
  w
1671
- ]), D = /* @__PURE__ */ U("div", {
1883
+ ]), D = /* @__PURE__ */ V("div", {
1672
1884
  "aria-hidden": !0,
1673
1885
  style: {
1674
1886
  height: b(),
@@ -1676,7 +1888,7 @@ function Pt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1676
1888
  zIndex: -1
1677
1889
  }
1678
1890
  });
1679
- return he(d, {
1891
+ return ve(d, {
1680
1892
  role: "list",
1681
1893
  ...p,
1682
1894
  className: t,
@@ -1690,206 +1902,220 @@ function Pt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1690
1902
  }
1691
1903
  }, E, e, D);
1692
1904
  }
1693
- var Ft = {
1694
- divider: "_divider_1tiyp_1",
1695
- item: "_item_1tiyp_5",
1696
- itemIcon: "_itemIcon_1tiyp_15",
1697
- checkIcon: "_checkIcon_1tiyp_19",
1698
- stateLabel: "_stateLabel_1tiyp_23"
1699
- }, It = 44, Lt = 8, Rt = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: o, onSelect: s }) => {
1700
- let l = r[e], u = q(l.iconUrl, l.type, l.displayName ?? l.id, p.SM), f = l.id === i;
1701
- return /* @__PURE__ */ U("div", {
1905
+ var Zt = {
1906
+ search: "_search_5skzl_1",
1907
+ divider: "_divider_5skzl_5",
1908
+ item: "_item_5skzl_9",
1909
+ itemIcon: "_itemIcon_5skzl_19",
1910
+ checkIcon: "_checkIcon_5skzl_23",
1911
+ stateLabel: "_stateLabel_5skzl_27",
1912
+ itemSelectedBackground: "_itemSelectedBackground_5skzl_37",
1913
+ itemSelectedText: "_itemSelectedText_5skzl_41"
1914
+ }, Qt = 44, $t = 8, en = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: o, itemClassName: s, selectedItemClassName: c, hasSelectedBackground: u, hasSelectedText: d, onSelect: f }) => {
1915
+ let m = r[e], _ = Nt(m.iconUrl, m.type, m.displayName ?? m.id, h.SM), v = m.id === i;
1916
+ return /* @__PURE__ */ V("div", {
1702
1917
  style: t,
1703
1918
  ...n,
1704
- children: /* @__PURE__ */ U(d, {
1919
+ children: /* @__PURE__ */ V(p, {
1705
1920
  type: "button",
1706
- "aria-current": f ? "true" : void 0,
1707
- className: c(Ft.item, "h-full w-full gap-3 px-4"),
1708
- iconBefore: /* @__PURE__ */ U("span", {
1709
- className: Ft.itemIcon,
1710
- children: u
1921
+ "aria-current": v ? "true" : void 0,
1922
+ className: l(Zt.item, "h-full w-full gap-3 px-4", v && u && Zt.itemSelectedBackground, v && d && Zt.itemSelectedText, s, v && c, U.modelMenuItem, v && U.modelMenuItemSelected),
1923
+ iconBefore: /* @__PURE__ */ V("span", {
1924
+ className: Zt.itemIcon,
1925
+ children: _
1711
1926
  }),
1712
- label: /* @__PURE__ */ W("span", {
1927
+ label: /* @__PURE__ */ H("span", {
1713
1928
  className: "flex flex-1 items-center justify-between gap-2",
1714
- children: [/* @__PURE__ */ U(y, {
1715
- text: l.displayName ?? l.id,
1929
+ children: [/* @__PURE__ */ V(x, {
1930
+ text: m.displayName ?? m.id,
1716
1931
  query: o,
1717
1932
  maxLines: 1,
1718
- className: c(a, "min-w-0 flex-1 text-start")
1719
- }), f && /* @__PURE__ */ U(ae, {
1720
- size: p.SM,
1721
- className: Ft.checkIcon,
1933
+ className: l(a, "min-w-0 flex-1 text-start")
1934
+ }), v && /* @__PURE__ */ V(P, {
1935
+ size: h.SM,
1936
+ className: Zt.checkIcon,
1722
1937
  "aria-hidden": !0,
1723
- stroke: m
1938
+ stroke: g
1724
1939
  })]
1725
1940
  }),
1726
- onClick: () => s(l.id)
1941
+ onClick: () => f(m.id)
1727
1942
  })
1728
1943
  });
1729
- }, zt = ({ 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: _ }) => {
1730
- let [v, y] = B("");
1731
- L(() => {
1732
- e || y("");
1944
+ }, tn = ({ isOpen: e, title: t, closeLabel: n, searchPlaceholder: r = "Search", onClose: i, deployments: a, selectedDeploymentId: o, onSelect: s, loadingLabel: u, errorLabel: d, emptyLabel: f, style: p, titleClassName: m = "dial-body-semi-text", labelClassName: h = "dial-small-text", colors: g, menuStyles: _ }) => {
1945
+ let [y, b] = z("");
1946
+ I(() => {
1947
+ e || b("");
1733
1948
  }, [e]);
1734
- let b = a && a.length > 0, x = u !== void 0, S = !b && !x ? d ?? f : void 0, C = b ? gt(a, v) : [], w = (e) => {
1735
- l(e), i();
1736
- }, T = s({
1737
- "--ci-sheet-divider": _?.divider,
1738
- "--ci-sheet-text": _?.itemText,
1739
- "--ci-sheet-item-hover": _?.itemHoverBg,
1740
- "--ci-sheet-item-active": _?.itemActiveBg,
1741
- "--ci-sheet-icon": _?.itemIcon,
1742
- "--ci-check-icon": _?.checkIcon
1949
+ let x = a && a.length > 0, S = u !== void 0, C = !x && !S ? d ?? f : void 0, w = x ? Mt(a, y) : [], T = (e) => {
1950
+ s(e), i();
1951
+ }, E = _?.colors, D = c({
1952
+ "--ci-sheet-divider": g?.divider,
1953
+ "--ci-sheet-text": E?.itemText ?? g?.itemText,
1954
+ "--ci-sheet-item-hover": E?.itemHoverBackground ?? g?.itemHoverBg,
1955
+ "--ci-sheet-item-active": g?.itemActiveBg,
1956
+ "--ci-sheet-icon": E?.itemText ?? g?.itemIcon,
1957
+ "--ci-check-icon": E?.checkIcon ?? g?.checkIcon,
1958
+ "--ci-sheet-selected-bg": E?.selectedItemBackground,
1959
+ "--ci-sheet-selected-text": E?.selectedItemText
1743
1960
  });
1744
- return /* @__PURE__ */ U(Ee, {
1961
+ return /* @__PURE__ */ V(Me, {
1745
1962
  isOpen: e,
1746
1963
  title: t,
1747
1964
  closeLabel: n,
1748
1965
  onClose: i,
1749
1966
  style: p,
1750
1967
  titleClassName: m,
1751
- className: "max-h-[80dvh]",
1752
- colors: _?.shell,
1753
- children: /* @__PURE__ */ W("div", {
1968
+ className: l("max-h-[80dvh]", _?.className, U.modelMenu),
1969
+ colors: g?.shell,
1970
+ children: /* @__PURE__ */ H("div", {
1754
1971
  className: "contents",
1755
- style: T,
1756
- children: [b && !x && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("div", {
1757
- className: "flex-shrink-0 px-4 py-[10px]",
1758
- children: /* @__PURE__ */ U(O, {
1759
- value: v,
1972
+ style: D,
1973
+ children: [x && !S && /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("div", {
1974
+ style: c({ "--ci-sheet-search-bg": _?.colors?.searchHeaderBackground }),
1975
+ className: l("flex-shrink-0 px-4 py-[10px]", Zt.search, _?.searchHeaderClassName, U.modelMenuSearch),
1976
+ children: /* @__PURE__ */ V(A, {
1977
+ value: y,
1760
1978
  placeholder: r,
1761
- size: g.Standard,
1762
- onChange: (e) => y(e ?? "")
1979
+ size: v.Standard,
1980
+ onChange: (e) => b(e ?? "")
1763
1981
  })
1764
- }), /* @__PURE__ */ U("div", { className: c(Ft.divider, "h-px flex-shrink-0") })] }), x ? /* @__PURE__ */ U(mt, { loadingLabel: u }) : S ? /* @__PURE__ */ U("div", {
1982
+ }), /* @__PURE__ */ V("div", { className: l(Zt.divider, "h-px flex-shrink-0") })] }), S ? /* @__PURE__ */ V(At, { loadingLabel: u }) : C ? /* @__PURE__ */ V("div", {
1765
1983
  role: "list",
1766
- className: c(Ft.stateLabel, h, "px-4 py-4"),
1767
- children: S
1768
- }) : /* @__PURE__ */ U(Pt, {
1984
+ className: l(Zt.stateLabel, h, "px-4 py-4"),
1985
+ children: C
1986
+ }) : /* @__PURE__ */ V(Xt, {
1769
1987
  role: "list",
1770
1988
  className: "overflow-y-auto",
1771
- style: { height: Math.min(C.length, Lt) * It },
1772
- rowComponent: Rt,
1773
- rowCount: C.length,
1774
- rowHeight: It,
1989
+ style: { height: Math.min(w.length, $t) * Qt },
1990
+ rowComponent: en,
1991
+ rowCount: w.length,
1992
+ rowHeight: Qt,
1775
1993
  rowProps: {
1776
- items: C,
1994
+ items: w,
1777
1995
  selectedDeploymentId: o,
1778
1996
  labelClassName: h,
1779
- query: v,
1780
- onSelect: w
1997
+ query: y,
1998
+ itemClassName: _?.itemClassName,
1999
+ selectedItemClassName: _?.selectedItemClassName,
2000
+ hasSelectedBackground: !!E?.selectedItemBackground,
2001
+ hasSelectedText: !!E?.selectedItemText,
2002
+ onSelect: T
1781
2003
  }
1782
2004
  })]
1783
2005
  })
1784
2006
  });
1785
- }, Bt = ({ 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 }) => {
1786
- let [_, y] = B(!1), { selectorIcon: b, selectorAriaLabel: x, selectedLabel: S, selectedVersion: C, menuItems: w, menuHeader: T, onOpenChange: E } = _t({
2007
+ }, nn = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, menuStyles: i, isStreaming: a, isMobile: o, isDisabled: c = !1, style: u, modelPickerOverlay: d, isPickerOpen: f, onPickerToggle: m, onPickerOpenChange: v }) => {
2008
+ let [y, x] = z(!1), { selectorIcon: S, selectorAriaLabel: C, selectedLabel: w, selectedVersion: T, menuItems: E, menuHeader: D, menuStyle: O, onOpenChange: k } = Pt({
1787
2009
  deployments: e,
1788
2010
  selectedDeploymentId: t,
1789
2011
  onDeploymentChange: n,
1790
- modelSelectorLabels: r
2012
+ modelSelectorLabels: r,
2013
+ styles: i
1791
2014
  });
1792
2015
  if (!e) return null;
1793
- let D = i || s ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, O = /* @__PURE__ */ U(P, {
1794
- size: p.SM,
1795
- className: K.modelSelectorCaret,
2016
+ let A = a || c ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, ee = /* @__PURE__ */ V(se, {
2017
+ size: h.SM,
2018
+ className: l(G.modelSelectorCaret, U.modelSelectorCaret),
1796
2019
  "aria-hidden": !0,
1797
- stroke: m
2020
+ stroke: g
2021
+ }), j = /* @__PURE__ */ V("span", {
2022
+ className: l("flex shrink-0 items-center", U.modelSelectorIcon),
2023
+ children: S
1798
2024
  });
1799
- return a ? /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U(N, {
1800
- tooltip: S,
1801
- children: /* @__PURE__ */ U(v, {
1802
- icon: /* @__PURE__ */ W("div", {
1803
- className: "flex items-center gap-1",
1804
- children: [b, O]
1805
- }),
1806
- "aria-label": x,
1807
- onClick: () => {
1808
- s || y(!0);
1809
- },
1810
- className: c("w-[50px]", K.modelSelectorButton, D)
1811
- })
1812
- }), u ? /* @__PURE__ */ U(Ee, {
1813
- isOpen: _,
2025
+ if (o) return /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(b, {
2026
+ tooltipProps: { tooltip: w },
2027
+ icon: /* @__PURE__ */ H("div", {
2028
+ className: "flex items-center gap-1",
2029
+ children: [j, ee]
2030
+ }),
2031
+ "aria-label": C,
2032
+ onClick: () => {
2033
+ c || x(!0);
2034
+ },
2035
+ className: l("w-[50px]", G.modelSelectorButton, A, U.modelSelectorButton)
2036
+ }), d ? /* @__PURE__ */ V(Me, {
2037
+ isOpen: y,
1814
2038
  title: r?.ariaLabel ?? "Select model",
1815
2039
  closeLabel: r?.closeLabel ?? "Close",
1816
- onClose: () => y(!1),
1817
- style: l,
1818
- children: u(() => y(!1))
1819
- }) : /* @__PURE__ */ U(zt, {
1820
- isOpen: _,
2040
+ onClose: () => x(!1),
2041
+ style: u,
2042
+ className: l(i?.className, U.modelMenu),
2043
+ children: d(() => x(!1))
2044
+ }) : /* @__PURE__ */ V(tn, {
2045
+ isOpen: y,
1821
2046
  title: r?.ariaLabel ?? "Select model",
1822
2047
  closeLabel: r?.closeLabel ?? "Close",
1823
2048
  searchPlaceholder: r?.searchPlaceholder ?? "Search",
1824
- onClose: () => y(!1),
2049
+ onClose: () => x(!1),
1825
2050
  deployments: e,
1826
2051
  selectedDeploymentId: t,
1827
2052
  onSelect: (e) => n?.(e),
1828
2053
  loadingLabel: r?.loading,
1829
2054
  errorLabel: r?.error,
1830
2055
  emptyLabel: r?.empty,
1831
- style: l
1832
- })] }) : u ? /* @__PURE__ */ U(h, {
1833
- placement: "top-end",
1834
- matchReferenceWidth: !1,
1835
- open: d,
1836
- onOpenChange: g,
1837
- trigger: [],
1838
- outsideClosable: !0,
1839
- renderOverlay: () => u(() => g?.(!1)),
1840
- listClassName: "!w-[368px] !bg-layer-raised",
1841
- children: /* @__PURE__ */ U(N, {
1842
- tooltip: C ? `${S} · ${C}` : S,
1843
- children: /* @__PURE__ */ W("button", {
1844
- type: "button",
1845
- "aria-label": x,
1846
- "aria-disabled": s || void 0,
1847
- 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),
2056
+ style: u,
2057
+ menuStyles: i
2058
+ })] });
2059
+ if (d) {
2060
+ let e = T ? `${w} · ${T}` : w;
2061
+ return /* @__PURE__ */ V(_, {
2062
+ placement: "top-end",
2063
+ matchReferenceWidth: !1,
2064
+ open: f,
2065
+ onOpenChange: v,
2066
+ trigger: [],
2067
+ outsideClosable: !0,
2068
+ renderOverlay: () => d(() => v?.(!1)),
2069
+ listClassName: l("!w-[368px] !bg-layer-raised", i?.className, U.modelMenu),
2070
+ children: /* @__PURE__ */ V(p, {
2071
+ "aria-label": C,
2072
+ "aria-disabled": c || void 0,
2073
+ tooltipProps: { tooltip: e },
2074
+ className: l("h-auto min-w-0 gap-1.5 !rounded-full !border-0 px-0 py-1.5 pe-2 ps-1.5", G.modelSelectorButton, A, c && G.modelSelectorButtonDisabled, U.modelSelectorButton),
1848
2075
  onClick: () => {
1849
- !i && !s && f?.();
2076
+ !a && !c && m?.();
1850
2077
  },
1851
- children: [
1852
- b,
1853
- /* @__PURE__ */ W("span", {
1854
- className: "flex min-w-0 max-w-[180px] items-baseline gap-1",
1855
- children: [/* @__PURE__ */ U("span", {
1856
- className: c("dial-small-text max-w-[180px] shrink-0 truncate", K.modelSelectorName),
1857
- children: S
1858
- }), C && /* @__PURE__ */ U("span", {
1859
- className: c("dial-tiny-text min-w-0 truncate", K.modelSelectorVersion),
1860
- children: C
1861
- })]
1862
- }),
1863
- O
1864
- ]
2078
+ iconBefore: j,
2079
+ iconAfter: ee,
2080
+ textClassName: "min-w-0",
2081
+ label: /* @__PURE__ */ H("span", {
2082
+ className: "flex min-w-0 max-w-[180px] items-baseline gap-1",
2083
+ children: [/* @__PURE__ */ V("span", {
2084
+ className: l("dial-small-text max-w-[180px] shrink-0 truncate", G.modelSelectorName),
2085
+ children: w
2086
+ }), T && /* @__PURE__ */ V("span", {
2087
+ className: l("dial-tiny-text min-w-0 truncate", G.modelSelectorVersion),
2088
+ children: T
2089
+ })]
2090
+ })
1865
2091
  })
1866
- })
1867
- }) : /* @__PURE__ */ U("div", {
1868
- className: c(s && D),
1869
- "aria-disabled": s || void 0,
1870
- children: /* @__PURE__ */ U(h, {
1871
- items: w,
1872
- menuHeader: T,
2092
+ });
2093
+ }
2094
+ return /* @__PURE__ */ V("div", {
2095
+ className: l(c && A),
2096
+ "aria-disabled": c || void 0,
2097
+ children: /* @__PURE__ */ V(_, {
2098
+ items: E,
2099
+ menuHeader: D,
1873
2100
  placement: "bottom-end",
1874
2101
  matchReferenceWidth: !1,
1875
- maxDropdownHeight: o,
1876
- listClassName: "!w-[240px]",
1877
- disabled: s,
1878
- onOpenChange: s ? void 0 : E,
1879
- children: /* @__PURE__ */ U(N, {
1880
- tooltip: S,
1881
- children: /* @__PURE__ */ W("button", {
1882
- type: "button",
1883
- "aria-label": x,
1884
- "aria-disabled": s || void 0,
1885
- className: c("flex items-center gap-1 rounded-full p-1.5", K.modelSelectorButton, s && K.modelSelectorButtonDisabled),
1886
- children: [b, O]
1887
- })
2102
+ maxDropdownHeight: s,
2103
+ listClassName: l("!w-[240px]", i?.className, U.modelMenu),
2104
+ listStyle: O,
2105
+ disabled: c,
2106
+ onOpenChange: c ? void 0 : k,
2107
+ children: /* @__PURE__ */ V(p, {
2108
+ "aria-label": C,
2109
+ "aria-disabled": c || void 0,
2110
+ tooltipProps: { tooltip: w },
2111
+ iconBefore: j,
2112
+ iconAfter: ee,
2113
+ className: l("h-auto gap-1 !rounded-full !border-0 p-1.5", G.modelSelectorButton, c && G.modelSelectorButtonDisabled, U.modelSelectorButton)
1888
2114
  })
1889
2115
  })
1890
2116
  });
1891
- }, Vt = ({ 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: y, attachLabel: b = "Attach file", fileAccept: x, addMenuTitle: S = "Add", menuTitle: C = "Menu", menuCloseLabel: w = "Close", removeLabel: T, retryLabel: E, uploadingLabel: D, sendLabel: O, sendTooltip: k, stopLabel: ee, micLabel: A = "Dictate", recordVoiceLabel: te = "Record voice", stopRecordingLabel: j, discardRecordingLabel: ne, colors: M, typography: N, className: re, pendingDropFiles: ie = [], onDropFilesConsumed: ae, pendingAttachments: P = [], onPendingAttachmentsConsumed: oe, pasteTextThreshold: le = 4e3, maxMessageLength: F = 5e4, deployments: ue, selectedDeploymentId: de, onDeploymentChange: fe, modelSelectorLabels: pe, initialAttachments: me = [], hideAddButton: he = !1, hideAttachFile: ge = !1, hideActionBar: _e = !1, renderFooterActions: ve, isInputDisabled: V = !1, isModelSelectorDisabled: be = !1, isSendDisabled: xe = !1, isAudioMessageSupported: Ce = !1, isVoiceRecordingSupported: we = Ce, onTranscribeAudio: Te, transcribingLabel: Ee, voiceErrorLabel: De, sendOnEnter: ke = We.Enter, prefixAttachments: je = [], onRemovePrefixAttachment: Me, chatSettings: Fe, toolsMenuItems: ze, onToolToggle: Be, canRemoveTools: Ve = !0, toolsMenuTitle: He, toolsBackLabel: Ge, toolsChipLabels: Ke, menuOverlays: qe, inlineStartSlot: Je, onInlineStartRemove: Ye, commandMenu: G, autoFocus: Xe = !1, messageHistory: Ze, onDialFileSystemClick: Qe, dialFileSystemLabel: $e, validateAttachment: et, onAttachmentClick: nt, modelPickerOverlay: rt, maximumAttachmentsAmount: at, onAttachmentsLimitExceeded: ot, isAttachmentsEnabled: st = !0, isTextAttachmentsAllowed: ct = !0, usageLimitsSlot: ft, onMessageTooLong: pt }) => {
1892
- let mt = l(), [ht, gt] = B(!1), q = Ne(Ze), J = Je != null, _t = z(null), [vt, yt] = B(0), bt = R(() => s({
2117
+ }, Q = ye(({ message: e = "", messageRevision: t, focusRequestId: n, textInsertion: r, onSend: i, onUploadAttachment: a, onStop: o, isStreaming: s = !1, onChange: u, onAttachmentsChange: p, placeholder: m = "Type a message...", ariaLabel: v, attachLabel: x = "Attach file", fileAccept: S, addMenuTitle: C = "Add", menuTitle: w = "Menu", menuCloseLabel: T = "Close", removeLabel: E, retryLabel: D, uploadingLabel: O, sendLabel: k, sendTooltip: A, emptyMessageTooltip: ee, stopLabel: j, micLabel: te = "Dictate", recordVoiceLabel: ne = "Record voice", stopRecordingLabel: re, discardRecordingLabel: ie, colors: M, typography: N, attachmentTray: ae, modelMenu: oe, className: P, pendingDropFiles: se = [], onDropFilesConsumed: ce, pendingAttachments: de = [], onPendingAttachmentsConsumed: fe, pasteTextThreshold: pe = 4e3, maxMessageLength: me = 5e4, deployments: he, selectedDeploymentId: ge, onDeploymentChange: _e, modelSelectorLabels: ve, initialAttachments: ye = [], hideAddButton: be = !1, hideAttachFile: xe = !1, hideActionBar: we = !1, actionRowLayout: Ee = ot.Stacked, isInlineActionRowAllowedBelowDesktop: De = !1, renderFooterActions: ke, isInputDisabled: Ae = !1, isModelSelectorDisabled: je = !1, isSendDisabled: Me = !1, isAudioMessageSupported: Ne = !1, isVoiceRecordingSupported: Fe = Ne, onTranscribeAudio: Ie, transcribingLabel: Le, voiceErrorLabel: Re, sendOnEnter: Ve = at.Enter, prefixAttachments: He = [], onRemovePrefixAttachment: Ge, chatSettings: Ke, toolsMenuItems: Xe, onToolToggle: et, canRemoveTools: tt = !0, toolsMenuTitle: nt, toolsBackLabel: rt, toolsChipLabels: st, menuOverlays: ct, activeMentions: lt, onBackspaceAtCaret: ut, caretPositionOverride: dt, commandMenu: W, autoFocus: ft = !1, messageHistory: pt, onDialFileSystemClick: mt, dialFileSystemLabel: ht, validateAttachment: gt, onAttachmentClick: vt, modelPickerOverlay: yt, maximumAttachmentsAmount: xt, onAttachmentsLimitExceeded: St, isAttachmentsEnabled: Ct = !0, isTextAttachmentsAllowed: wt = !0, usageLimitsSlot: Ot, onMessageTooLong: kt }, At) => {
2118
+ let jt = d(), [Mt, Nt] = z(!1), K = Ue(pt), Pt = lt ?? [], Ft = Pt.length > 0, It = L(() => c({
1893
2119
  "--ci-bg": M?.background,
1894
2120
  "--ci-text": M?.text,
1895
2121
  "--ci-border": M?.border,
@@ -1904,492 +2130,630 @@ var Ft = {
1904
2130
  "--ci-voice-error": M?.voiceError,
1905
2131
  "--ci-voice-waveform": M?.voiceWaveform,
1906
2132
  "--ci-voice-accent": M?.voiceAccent,
1907
- "--ci-first-line-indent": J ? `calc(${vt}px + 4px)` : void 0
1908
- }), [
1909
- M,
1910
- J,
1911
- vt
1912
- ]), xt = R(() => Qe ? [{
2133
+ "--ci-mention-highlight-bg": M?.mentionHighlightBg,
2134
+ "--ci-mention-highlight-text": M?.mentionHighlightText,
2135
+ "--ci-mention-highlight-unsupported-bg": M?.mentionHighlightUnsupportedBg,
2136
+ "--ci-mention-highlight-unsupported-text": M?.mentionHighlightUnsupportedText
2137
+ }), [M]), Lt = L(() => mt ? [{
1913
2138
  key: "dial-fs",
1914
- label: $e ?? "DIAL file system",
1915
- icon: /* @__PURE__ */ U(se, {
1916
- size: u,
2139
+ label: ht ?? "DIAL file system",
2140
+ icon: /* @__PURE__ */ V(le, {
2141
+ size: f,
1917
2142
  "aria-hidden": !0,
1918
- stroke: m
2143
+ stroke: g
1919
2144
  }),
1920
- onClick: Qe
1921
- }] : [], [Qe, $e]), { message: Y, setMessage: X, textareaRef: Z } = Pe({
2145
+ onClick: mt
2146
+ }] : [], [mt, ht]), { message: q, setMessage: J, textareaRef: Y } = Je({
1922
2147
  messageProp: e,
1923
2148
  messageRevision: t
1924
2149
  });
1925
- Ie({
1926
- insertion: n,
1927
- textareaRef: Z
1928
- });
1929
- let { isMenuOpen: Q, query: St, dismiss: Ct, handleValueChange: wt } = Ae({
1930
- config: G,
1931
- message: Y
1932
- }), Tt = G?.emptyQueryHint != null, Et = Tt && Q && St === "", Dt = I((e) => {
1933
- if (G == null || (Ct(), !e?.consumeQuery)) return;
1934
- Z.current?.focus();
1935
- let t = `${G.triggerPrefix}${St}`;
1936
- if (!Y.startsWith(t)) return;
1937
- let n = Y.slice(t.length);
1938
- X(n), q.notifyChange(), d?.(n);
2150
+ I(() => {
2151
+ n !== void 0 && Y.current?.focus();
2152
+ }, [n, Y]), Se(At, () => ({ getCaretPosition: () => Y.current?.selectionStart ?? q.length }), [q, Y]);
2153
+ let { handleUndoKeyDown: Rt } = Ze({
2154
+ insertion: r,
2155
+ textareaRef: Y
2156
+ }), { isMenuOpen: X, query: zt, activeWordStart: Z, dismiss: Bt, closeOnOutsidePress: Vt, handleCaretMove: Ht, handleValueChange: Ut, listboxId: Wt, overlayRef: Gt, activeOptionId: Kt, moveActiveOption: qt, getActiveOption: Jt } = Be({
2157
+ config: W,
2158
+ message: q
2159
+ }), Yt = () => {
2160
+ Ht(Y.current?.selectionStart ?? q.length);
2161
+ }, Xt = () => {
2162
+ requestAnimationFrame(() => {
2163
+ Ht(Y.current?.selectionStart ?? q.length);
2164
+ });
2165
+ }, Zt = (e) => {
2166
+ e.key !== "ArrowLeft" && e.key !== "ArrowRight" && e.key !== "Home" && e.key !== "End" && e.key !== "PageUp" && e.key !== "PageDown" || Ht(e.currentTarget.selectionStart ?? q.length);
2167
+ }, Qt = W?.emptyQueryHint != null, $t = W != null && Z != null ? Z + W.triggerPrefix.length : null, en = $t != null && q.slice($t).split("\n", 1)[0] !== "", tn = Qt && X && zt === "" && $t != null && !en, Q = W != null && X ? Z ?? 0 : null, rn = R(null), an = R(null), [on, sn] = z(null), cn = F(() => {
2168
+ let e = rn.current, t = an.current;
2169
+ if (e == null || t == null) {
2170
+ sn(null);
2171
+ return;
2172
+ }
2173
+ let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
2174
+ sn({
2175
+ left: n.left - r.left,
2176
+ top: n.top - r.top
2177
+ });
2178
+ }, []);
2179
+ Ce(() => {
2180
+ cn();
2181
+ }, [
2182
+ cn,
2183
+ Q,
2184
+ q
2185
+ ]), I(() => {
2186
+ if (Q == null) return;
2187
+ let e = Y.current;
2188
+ if (e == null || typeof ResizeObserver > "u") return;
2189
+ let t = new ResizeObserver(cn);
2190
+ return t.observe(e), () => t.disconnect();
1939
2191
  }, [
1940
- G,
1941
- Ct,
1942
- St,
2192
+ Q,
1943
2193
  Y,
1944
- X,
1945
- q,
1946
- d,
1947
- Z
2194
+ cn
1948
2195
  ]);
1949
- L(() => {
1950
- let e = _t.current;
1951
- if (e == null) return;
1952
- let t = new ResizeObserver((e) => {
1953
- let t = e[0];
1954
- t != null && yt(t.contentRect.width);
1955
- });
1956
- return t.observe(e), () => t.disconnect();
1957
- }, [J]);
1958
- let { attachments: Ot, buildAttachments: kt, addAttachments: At, resetAttachments: jt, handleRemove: Mt, handleRetry: Nt, handleExpand: Pt, hasBlockedAttachments: Ft } = Oe({
1959
- initialAttachments: me,
1960
- onUploadAttachment: i,
1961
- onAttachmentsChange: f,
1962
- validateAttachment: et,
1963
- pendingDropFiles: ie,
1964
- onDropFilesConsumed: ae,
1965
- pendingAttachments: P,
1966
- onPendingAttachmentsConsumed: oe,
1967
- onExpandPastedText: I((e) => {
1968
- X((t) => t ? `${t}\n${e}` : e);
1969
- }, [X]),
1970
- maximumAttachmentsAmount: at,
1971
- baseAttachmentsAmount: je.length,
1972
- onAttachmentsLimitExceeded: ot
1973
- }), It = I((e) => {
1974
- At(kt([e]));
1975
- }, [At, kt]), Lt = z(!1), Rt = z(Y);
1976
- Rt.current = Y;
1977
- let [zt, Vt] = B({
2196
+ let { mirrorRef: ln, selectionRects: un, updateSelectionRects: dn } = qe({
2197
+ textareaRef: Y,
2198
+ message: q,
2199
+ hasActiveMentions: Ft
2200
+ }), fn = F((e) => {
2201
+ if (W == null || (Bt(), !e?.consumeQuery) || (Y.current?.focus(), Z == null)) return;
2202
+ let t = `${W.triggerPrefix}${zt}`, n = Z + t.length;
2203
+ if (q.slice(Z, n) !== t) return;
2204
+ let r = q.slice(0, Z) + q.slice(n);
2205
+ J(r), K.notifyChange(), u?.(r);
2206
+ }, [
2207
+ W,
2208
+ Bt,
2209
+ zt,
2210
+ q,
2211
+ Z,
2212
+ J,
2213
+ K,
2214
+ u,
2215
+ Y
2216
+ ]), pn = R(void 0);
2217
+ I(() => {
2218
+ dt == null || pn.current === t || (pn.current = t, Y.current?.setSelectionRange(dt, dt));
2219
+ }, [q]);
2220
+ let { attachments: mn, buildAttachments: hn, addAttachments: gn, resetAttachments: _n, handleRemove: vn, handleRetry: yn, handleExpand: bn, hasBlockedAttachments: xn } = Pe({
2221
+ initialAttachments: ye,
2222
+ onUploadAttachment: a,
2223
+ onAttachmentsChange: p,
2224
+ validateAttachment: gt,
2225
+ pendingDropFiles: se,
2226
+ onDropFilesConsumed: ce,
2227
+ pendingAttachments: de,
2228
+ onPendingAttachmentsConsumed: fe,
2229
+ onExpandPastedText: F((e) => {
2230
+ J((t) => t ? `${t}\n${e}` : e);
2231
+ }, [J]),
2232
+ maximumAttachmentsAmount: xt,
2233
+ baseAttachmentsAmount: He.length,
2234
+ onAttachmentsLimitExceeded: St
2235
+ }), Sn = F((e) => {
2236
+ gn(hn([e]));
2237
+ }, [gn, hn]), Cn = R(!1), wn = R(q);
2238
+ wn.current = q;
2239
+ let [Tn, En] = z({
1978
2240
  text: "",
1979
2241
  revision: 0
1980
- }), { state: Ht, analyserNodeRef: Ut, errorMessage: Wt, startRecording: Gt, stopRecording: Kt, discardRecording: qt } = Ue({
1981
- onAttachAudio: It,
1982
- onTranscribeAudio: Te,
1983
- onTranscript: I((e) => {
2242
+ }), { state: Dn, analyserNodeRef: On, errorMessage: kn, startRecording: An, stopRecording: jn, discardRecording: Mn } = it({
2243
+ onAttachAudio: Sn,
2244
+ onTranscribeAudio: Ie,
2245
+ onTranscript: F((e) => {
1984
2246
  let t = e.trim();
1985
2247
  if (t) {
1986
- let e = Rt.current, n = `${e}${e && !/\s$/.test(e) ? " " : ""}${t}`;
1987
- Rt.current = n, X(n), Vt((e) => ({
2248
+ let e = wn.current, n = `${e}${e && !/\s$/.test(e) ? " " : ""}${t}`;
2249
+ wn.current = n, J(n), En((e) => ({
1988
2250
  text: t,
1989
2251
  revision: e.revision + 1
1990
- })), q.notifyChange(), d?.(n);
2252
+ })), K.notifyChange(), u?.(n);
1991
2253
  }
1992
- Lt.current = !0;
2254
+ Cn.current = !0;
1993
2255
  }, [
1994
- X,
1995
- q,
1996
- d
2256
+ J,
2257
+ K,
2258
+ u
1997
2259
  ]),
1998
- errorLabel: De
1999
- }), $ = Ht === Le.Recording || Ht === Le.Processing;
2000
- L(() => {
2001
- (Ht === Le.Error || Ht === Le.Idle && Lt.current) && (Lt.current = !1, Z.current?.focus());
2002
- }, [Ht, Z]);
2003
- let Jt = z(null), Yt = z(null), Xt = st && ct, { handlePaste: Zt } = Se(At, Xt ? le : Infinity), Qt = I((e) => {
2004
- if (!Xt) {
2260
+ errorLabel: Re
2261
+ }), $ = Dn === Qe.Recording || Dn === Qe.Processing;
2262
+ I(() => {
2263
+ (Dn === Qe.Error || Dn === Qe.Idle && Cn.current) && (Cn.current = !1, Y.current?.focus());
2264
+ }, [Dn, Y]);
2265
+ let Nn = R(null), Pn = R(null), Fn = Ct && wt, { handlePaste: In } = Oe(gn, Fn ? pe : Infinity), Ln = F((e) => {
2266
+ if (!Fn) {
2005
2267
  let t = e.clipboardData.getData("text/plain");
2006
- t.length >= F && pt?.(t.length, F);
2268
+ t.length >= me && kt?.(t.length, me);
2007
2269
  }
2008
- Zt(e);
2270
+ In(e);
2009
2271
  }, [
2010
- Xt,
2011
- F,
2012
- pt,
2013
- Zt
2014
- ]), $t = (Y.trim().length > 0 || Ot.length > 0 || J) && !Ft && !xe && !$, [en, tn] = B([]);
2015
- L(() => {
2016
- tn([]);
2017
- }, [(ze ?? []).map((e) => e.id).join("|")]);
2018
- let nn = R(() => {
2019
- let e = ze ?? [];
2020
- return Ve ? e.filter((e) => e.isSelected || !en.includes(e.id)) : e;
2272
+ Fn,
2273
+ me,
2274
+ kt,
2275
+ In
2276
+ ]), Rn = q.trim().length > 0 || mn.length > 0, zn = Rn && !xn && !Me && !$, [Bn, Vn] = z([]);
2277
+ I(() => {
2278
+ Vn([]);
2279
+ }, [(Xe ?? []).map((e) => e.id).join("|")]);
2280
+ let Hn = L(() => {
2281
+ let e = Xe ?? [];
2282
+ return tt ? e.filter((e) => e.isSelected || !Bn.includes(e.id)) : e;
2021
2283
  }, [
2022
- ze,
2023
- en,
2024
- Ve
2025
- ]), rn = I((e) => {
2026
- tn((t) => t.includes(e) ? t : [...t, e]), ze?.find((t) => t.id === e)?.isSelected && Be?.(e);
2027
- }, [ze, Be]), an = ue === void 0 || de != null, on = Ce && !o, sn = async () => {
2028
- if (xe || $) return;
2029
- if (Y.length >= F) {
2030
- pt?.(Y.length, F);
2284
+ Xe,
2285
+ Bn,
2286
+ tt
2287
+ ]), Un = F((e) => {
2288
+ Vn((t) => t.includes(e) ? t : [...t, e]), Xe?.find((t) => t.id === e)?.isSelected && et?.(e);
2289
+ }, [Xe, et]), Wn = he === void 0 || ge != null, Gn = Ne && !s, Kn = async () => {
2290
+ if (Me || $) return;
2291
+ if (q.length >= me) {
2292
+ kt?.(q.length, me);
2031
2293
  return;
2032
2294
  }
2033
- let e = Y, t = Ot;
2034
- X(""), q.reset();
2295
+ let e = q, t = mn;
2296
+ J(""), K.reset();
2035
2297
  try {
2036
- await r?.(e, t), t.forEach((e) => {
2298
+ await i?.(e, t), t.forEach((e) => {
2037
2299
  e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
2038
- }), jt([]);
2300
+ }), _n([]);
2039
2301
  } catch {
2040
- X(e), jt(t);
2302
+ J(e), _n(t);
2041
2303
  }
2042
- }, cn = (e) => {
2043
- if (!$) {
2044
- if (!e.nativeEvent.isComposing && !V && !o) {
2304
+ }, qn = (e) => Ve === at.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey, Jn = (e) => {
2305
+ if (!X || e.nativeEvent.isComposing) return !1;
2306
+ if (e.key === "Escape") return e.preventDefault(), e.stopPropagation(), Bt(), !0;
2307
+ if (e.key === "ArrowDown" || e.key === "ArrowUp") return e.preventDefault(), qt(e.key === "ArrowDown" ? ze.Next : ze.Previous), !0;
2308
+ if (e.key !== "Enter" || e.shiftKey) return !1;
2309
+ let t = Jt();
2310
+ return t == null ? qn(e) ? (e.preventDefault(), !0) : !1 : (e.preventDefault(), t.click(), !0);
2311
+ }, Yn = (e) => {
2312
+ if (!$ && !Rt(e) && !Jn(e)) {
2313
+ if (!e.nativeEvent.isComposing && !Ae && !s) {
2045
2314
  if (e.key === "ArrowUp" || e.key === "ArrowDown") {
2046
- let t = e.currentTarget.selectionStart ?? 0, n = q.navigate(e.key === "ArrowUp" ? "up" : "down", Y, t);
2315
+ let t = e.currentTarget.selectionStart ?? 0, n = K.navigate(e.key === "ArrowUp" ? "up" : "down", q, t);
2047
2316
  if (n !== null) {
2048
- e.preventDefault(), X(n);
2317
+ e.preventDefault(), J(n);
2049
2318
  return;
2050
2319
  }
2051
2320
  }
2052
- if (e.key === "Backspace" && J && Ye != null && e.currentTarget.selectionStart === 0 && e.currentTarget.selectionEnd === 0) {
2053
- e.preventDefault(), Ye();
2054
- return;
2321
+ if (e.key === "Backspace" && ut != null && e.currentTarget.selectionStart === e.currentTarget.selectionEnd && e.currentTarget.selectionStart != null) {
2322
+ let t = ut(e.currentTarget.selectionStart);
2323
+ if (t != null) {
2324
+ e.preventDefault();
2325
+ let n = e.currentTarget;
2326
+ n.setSelectionRange(t.start, t.start + t.length), typeof document.execCommand == "function" && document.execCommand("delete", !1) || Ye(n, q.slice(0, t.start) + q.slice(t.start + t.length), t.start);
2327
+ return;
2328
+ }
2055
2329
  }
2056
2330
  }
2057
- e.key === "Enter" && (ke === We.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey) && (e.preventDefault(), !o && $t && an && !V && sn());
2331
+ e.key === "Enter" && qn(e) && (e.preventDefault(), !s && zn && Wn && !Ae && Kn());
2058
2332
  }
2059
- }, ln = (e) => {
2333
+ }, Xn = (e) => {
2060
2334
  let t = Array.from(e.target.files ?? []);
2061
2335
  if (t.length === 0) return;
2062
- let n = kt(t);
2063
- e.target.value = "", At(n);
2064
- }, un = /* @__PURE__ */ U("textarea", {
2065
- className: c(K.textarea, J && K.textareaIndented, N?.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"),
2066
- ref: Z,
2067
- autoFocus: Xe,
2068
- value: Y,
2336
+ let n = hn(t);
2337
+ e.target.value = "", gn(n);
2338
+ }, Zn = L(() => {
2339
+ let e = [];
2340
+ return Q != null && e.push({
2341
+ offset: Q,
2342
+ node: /* @__PURE__ */ V("span", {
2343
+ ref: rn,
2344
+ "aria-hidden": !0,
2345
+ className: "inline-block h-[1lh] w-0 align-text-top"
2346
+ }, "caret-marker")
2347
+ }), tn && W != null && $t != null && e.push({
2348
+ offset: $t,
2349
+ node: /* @__PURE__ */ V("span", {
2350
+ className: G.commandHint,
2351
+ "aria-hidden": !0,
2352
+ "data-mirror-synthetic": !0,
2353
+ children: W.emptyQueryHint
2354
+ }, "command-hint")
2355
+ }), e;
2356
+ }, [
2357
+ Q,
2358
+ tn,
2359
+ W,
2360
+ $t
2361
+ ]), Qn = /* @__PURE__ */ V("textarea", {
2362
+ className: l(G.textarea, (Ft || Zn.length > 0) && G.textareaMentionMode, N?.fontClassName || "dial-body-paragraph-text", "relative z-0 max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent pe-1 ps-1 outline-none [field-sizing:content]", "disabled:cursor-not-allowed"),
2363
+ ref: Y,
2364
+ autoFocus: ft,
2365
+ value: q,
2069
2366
  onChange: (e) => {
2070
- X(e.target.value), q.notifyChange();
2367
+ J(e.target.value), K.notifyChange();
2071
2368
  let t = e.nativeEvent instanceof InputEvent ? e.nativeEvent : void 0;
2072
- wt(e.target.value, t?.isComposing ?? !1, t?.inputType), d?.(e.target.value);
2369
+ Ut(e.target.value, e.target.selectionStart ?? e.target.value.length, t?.isComposing ?? !1), u?.(e.target.value);
2073
2370
  },
2074
- onKeyDown: cn,
2075
- onPaste: Qt,
2076
- placeholder: J ? void 0 : g,
2077
- "aria-label": y,
2078
- disabled: V,
2371
+ onSelect: dn,
2372
+ onFocus: Xt,
2373
+ onClick: Yt,
2374
+ onKeyDown: Yn,
2375
+ onKeyUp: Zt,
2376
+ onPaste: Ln,
2377
+ placeholder: m,
2378
+ "aria-label": v,
2379
+ "aria-autocomplete": W == null ? void 0 : "list",
2380
+ "aria-controls": X ? Wt : void 0,
2381
+ "aria-activedescendant": Kt ?? void 0,
2382
+ "aria-hidden": Ft ? !0 : void 0,
2383
+ disabled: Ae,
2079
2384
  readOnly: $,
2080
2385
  rows: 1
2081
- }), dn = G == null ? un : /* @__PURE__ */ U(h, {
2082
- className: "w-full",
2083
- open: Q,
2084
- onOpenChange: (e) => {
2085
- e || Ct();
2086
- },
2087
- placement: "top-start",
2088
- trigger: [],
2089
- initialFocus: -1,
2090
- matchReferenceWidth: !1,
2091
- outsidePressIgnoreRef: Z,
2092
- renderOverlay: () => {
2093
- let e = G.renderMenu({
2094
- query: St,
2095
- close: Dt
2096
- });
2097
- return G.menuLabel == null ? e : /* @__PURE__ */ U("div", {
2098
- role: "group",
2099
- "aria-label": G.menuLabel,
2100
- children: e
2101
- });
2386
+ }), $n = W == null ? Qn : /* @__PURE__ */ H(B, { children: [Qn, /* @__PURE__ */ V("div", {
2387
+ "aria-hidden": !0,
2388
+ className: l("pointer-events-none absolute", N?.fontClassName || "dial-body-paragraph-text"),
2389
+ style: {
2390
+ left: on?.left ?? 0,
2391
+ top: on?.top ?? 0
2102
2392
  },
2103
- children: un
2104
- }), fn = J || Tt ? /* @__PURE__ */ W("div", {
2105
- className: "relative w-full",
2106
- children: [
2107
- J && /* @__PURE__ */ U("div", {
2108
- ref: _t,
2109
- className: "absolute start-0 top-0",
2110
- children: Je
2393
+ children: /* @__PURE__ */ V(_, {
2394
+ open: X,
2395
+ onOpenChange: (e) => {
2396
+ e || Vt();
2397
+ },
2398
+ placement: "top-start",
2399
+ trigger: [],
2400
+ initialFocus: -1,
2401
+ matchReferenceWidth: !1,
2402
+ outsidePressIgnoreRef: Y,
2403
+ renderOverlay: () => /* @__PURE__ */ V("div", {
2404
+ ref: Gt,
2405
+ role: W.menuLabel == null ? void 0 : "group",
2406
+ "aria-label": W.menuLabel,
2407
+ children: W.renderMenu({
2408
+ query: zt,
2409
+ caretPosition: Z ?? 0,
2410
+ close: fn,
2411
+ listboxId: Wt,
2412
+ activeOptionId: Kt
2413
+ })
2111
2414
  }),
2112
- Et && G != null && /* @__PURE__ */ W("span", {
2113
- className: c(K.commandHint, "pointer-events-none absolute start-[var(--ci-first-line-indent,0px)] top-0", N?.fontClassName || "dial-body-paragraph-text"),
2415
+ children: /* @__PURE__ */ V("span", {
2114
2416
  "aria-hidden": !0,
2115
- children: [/* @__PURE__ */ U("span", {
2116
- className: "invisible",
2117
- children: G.triggerPrefix
2118
- }), G.emptyQueryHint]
2119
- }),
2120
- dn
2121
- ]
2122
- }) : dn, pn = he ? void 0 : /* @__PURE__ */ U(tt, {
2123
- onAttachClick: ge ? void 0 : () => Jt.current?.click(),
2124
- attachLabel: b,
2125
- addMenuTitle: S,
2126
- menuTitle: C,
2127
- menuCloseLabel: w,
2128
- style: bt,
2129
- isDisabled: V || $,
2130
- chatSettings: Fe,
2131
- extraMenuItems: xt,
2132
- onRecordVoice: we && st && !o && !$ ? () => Gt(Re.Attachment) : void 0,
2133
- recordVoiceLabel: te,
2134
- toolsMenuItems: Ve ? ze : void 0,
2135
- onToolToggle: Be,
2136
- toolsMenuTitle: He,
2137
- toolsBackLabel: Ge,
2138
- menuOverlays: qe
2417
+ className: "inline-block h-[1lh] w-0"
2418
+ })
2419
+ })
2420
+ })] }), er = /* @__PURE__ */ H("div", {
2421
+ ref: an,
2422
+ className: "relative -me-1 -ms-1 w-[calc(100%+8px)]",
2423
+ children: [(Ft || Zn.length > 0) && /* @__PURE__ */ H("div", {
2424
+ ref: ln,
2425
+ className: l(G.textarea, N?.fontClassName || "dial-body-paragraph-text", "pointer-events-none absolute inset-0 z-10 max-h-[272px] w-full overflow-hidden whitespace-pre-wrap pe-1 ps-1 [overflow-wrap:anywhere]"),
2426
+ children: [We(q, Pt, Zn, G.mentionHighlight, G.mentionHighlightUnsupported), un.map((e, t) => /* @__PURE__ */ V("div", {
2427
+ "aria-hidden": !0,
2428
+ className: "pointer-events-none absolute rounded-sm bg-control-accent-alpha-active",
2429
+ style: {
2430
+ left: e.left,
2431
+ top: e.top,
2432
+ width: e.width,
2433
+ height: e.height
2434
+ }
2435
+ }, `selection-${t}`))]
2436
+ }), $n]
2437
+ }), tr = be ? void 0 : /* @__PURE__ */ V(_t, {
2438
+ onAttachClick: xe ? void 0 : () => Nn.current?.click(),
2439
+ attachLabel: x,
2440
+ addMenuTitle: C,
2441
+ menuTitle: w,
2442
+ menuCloseLabel: T,
2443
+ style: It,
2444
+ isDisabled: Ae || $,
2445
+ chatSettings: Ke,
2446
+ extraMenuItems: Lt,
2447
+ onRecordVoice: Fe && Ct && !s && !$ ? () => An($e.Attachment) : void 0,
2448
+ recordVoiceLabel: ne,
2449
+ toolsMenuItems: tt ? Xe : void 0,
2450
+ onToolToggle: et,
2451
+ toolsMenuTitle: nt,
2452
+ toolsBackLabel: rt,
2453
+ menuOverlays: ct,
2454
+ getCaretPosition: () => Y.current?.selectionStart ?? q.length
2455
+ }), nr = Ee === ot.Inline && (!jt || De), rr = tr && /* @__PURE__ */ V("div", {
2456
+ className: l("flex", U.addCluster),
2457
+ children: tr
2458
+ }), ir = Hn.length > 0 && et != null && /* @__PURE__ */ V("div", {
2459
+ className: l("min-w-0 flex-1", U.toolsChips),
2460
+ children: /* @__PURE__ */ V(bt, {
2461
+ items: Hn,
2462
+ onToolToggle: et,
2463
+ onToolDismiss: Un,
2464
+ canRemove: tt,
2465
+ removeLabel: st?.removeLabel,
2466
+ stateOnLabel: st?.stateOnLabel,
2467
+ stateOffLabel: st?.stateOffLabel
2468
+ })
2139
2469
  });
2140
- return /* @__PURE__ */ W("div", {
2141
- ref: Yt,
2142
- style: bt,
2143
- className: c(K.wrapper, V && K.wrapperDisabled, V && "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", Ot.length > 6 ? "py-4 ps-4" : "p-4", re),
2470
+ return /* @__PURE__ */ H("div", {
2471
+ ref: Pn,
2472
+ style: It,
2473
+ className: l(G.wrapper, Ae && G.wrapperDisabled, Ae && "cursor-not-allowed", "flex w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border", "focus-within:outline focus-within:-outline-offset-1 active:outline active:-outline-offset-1", mn.length > 6 ? "py-4 ps-4" : "p-4", P, U.wrapper),
2144
2474
  children: [
2145
- (je.length > 0 || Ot.length > 0) && /* @__PURE__ */ U(ye, {
2146
- attachments: [...je, ...Ot],
2475
+ (He.length > 0 || mn.length > 0) && /* @__PURE__ */ V(Te, {
2476
+ attachments: [...He, ...mn],
2147
2477
  onRemove: (e) => {
2148
- je.some((t) => t.id === e) ? Me?.(e) : Mt(e);
2478
+ He.some((t) => t.id === e) ? Ge?.(e) : vn(e);
2149
2479
  },
2150
- onRetry: Nt,
2151
- onExpand: Pt,
2480
+ onRetry: yn,
2481
+ onExpand: bn,
2152
2482
  labels: {
2153
- removeLabel: T,
2154
- retryLabel: E,
2155
- uploadingLabel: D
2483
+ removeLabel: E,
2484
+ retryLabel: D,
2485
+ uploadingLabel: O
2156
2486
  },
2157
- onAttachmentClick: nt == null ? void 0 : (e) => {
2158
- let t = [...je, ...Ot].find((t) => t.id === e);
2159
- t != null && nt(t);
2487
+ styles: ae,
2488
+ onAttachmentClick: vt == null ? void 0 : (e) => {
2489
+ let t = [...He, ...mn].find((t) => t.id === e);
2490
+ t != null && vt(t);
2160
2491
  }
2161
2492
  }),
2162
- !he && /* @__PURE__ */ U("input", {
2163
- ref: Jt,
2493
+ !be && /* @__PURE__ */ V("input", {
2494
+ ref: Nn,
2164
2495
  type: "file",
2165
2496
  multiple: !0,
2166
- accept: x,
2497
+ accept: S,
2167
2498
  className: "sr-only",
2168
2499
  "aria-hidden": !0,
2169
2500
  tabIndex: -1,
2170
- onChange: ln
2501
+ onChange: Xn
2171
2502
  }),
2172
- Wt && /* @__PURE__ */ U(_, {
2173
- text: Wt,
2503
+ kn && /* @__PURE__ */ V(y, {
2504
+ text: kn,
2174
2505
  className: "min-w-0 break-words px-1"
2175
2506
  }),
2176
- $ && /* @__PURE__ */ U(lt, {
2507
+ $ && /* @__PURE__ */ V(Tt, {
2177
2508
  embedded: !0,
2178
- state: Ht,
2179
- analyserNodeRef: Ut,
2180
- errorMessage: Wt,
2181
- onStop: Kt,
2182
- onDiscard: qt,
2183
- attachButton: pn,
2184
- stopLabel: j,
2185
- discardLabel: ne,
2186
- processingLabel: Ee
2509
+ state: Dn,
2510
+ analyserNodeRef: On,
2511
+ errorMessage: kn,
2512
+ onStop: jn,
2513
+ onDiscard: Mn,
2514
+ attachButton: tr,
2515
+ stopLabel: re,
2516
+ discardLabel: ie,
2517
+ processingLabel: Le
2518
+ }),
2519
+ !$ && we && er,
2520
+ !$ && !we && nr && ir && /* @__PURE__ */ V("div", {
2521
+ className: "flex",
2522
+ children: ir
2187
2523
  }),
2188
- !$ && _e && fn,
2189
- !$ && !_e && /* @__PURE__ */ W("div", {
2190
- className: "flex flex-wrap items-center gap-2",
2524
+ !$ && !we && /* @__PURE__ */ H("div", {
2525
+ className: l("flex items-center gap-2", nr ? "flex-nowrap" : "flex-wrap", U.actionRow),
2191
2526
  children: [
2192
- /* @__PURE__ */ U("div", {
2193
- className: "flex w-full min-w-0 items-center self-stretch",
2194
- children: fn
2195
- }),
2196
- pn && /* @__PURE__ */ U("div", {
2197
- className: "flex",
2198
- children: pn
2199
- }),
2200
- nn.length > 0 && Be != null && /* @__PURE__ */ U("div", {
2201
- className: "min-w-0 flex-1",
2202
- children: /* @__PURE__ */ U(it, {
2203
- items: nn,
2204
- onToolToggle: Be,
2205
- onToolDismiss: rn,
2206
- canRemove: Ve,
2207
- removeLabel: Ke?.removeLabel
2208
- })
2527
+ nr && rr,
2528
+ /* @__PURE__ */ V("div", {
2529
+ className: l("flex min-w-0 items-center self-stretch", nr ? "flex-1" : "w-full", U.textareaWrap),
2530
+ children: er
2209
2531
  }),
2210
- /* @__PURE__ */ U("div", {
2211
- className: "ms-auto flex flex-shrink-0 items-center gap-2",
2212
- children: ve ? ve({
2213
- canSend: $t,
2214
- onSend: sn
2215
- }) : /* @__PURE__ */ W(H, { children: [
2216
- ft,
2217
- /* @__PURE__ */ U(Bt, {
2218
- deployments: ue,
2219
- selectedDeploymentId: de,
2220
- onDeploymentChange: fe,
2221
- modelSelectorLabels: pe,
2222
- isStreaming: o,
2223
- isMobile: mt,
2224
- isDisabled: be,
2225
- style: bt,
2226
- modelPickerOverlay: rt,
2227
- isPickerOpen: ht,
2228
- onPickerToggle: () => gt((e) => !e),
2229
- onPickerOpenChange: gt
2532
+ !nr && rr,
2533
+ !nr && ir,
2534
+ /* @__PURE__ */ V("div", {
2535
+ className: l("ms-auto flex flex-shrink-0 items-center gap-2", U.footerActions),
2536
+ children: ke ? ke({
2537
+ canSend: zn,
2538
+ onSend: Kn
2539
+ }) : /* @__PURE__ */ H(B, { children: [
2540
+ Ot,
2541
+ /* @__PURE__ */ V(nn, {
2542
+ deployments: he,
2543
+ selectedDeploymentId: ge,
2544
+ onDeploymentChange: _e,
2545
+ modelSelectorLabels: ve,
2546
+ menuStyles: oe,
2547
+ isStreaming: s,
2548
+ isMobile: jt,
2549
+ isDisabled: je,
2550
+ style: It,
2551
+ modelPickerOverlay: yt,
2552
+ isPickerOpen: Mt,
2553
+ onPickerToggle: () => Nt((e) => !e),
2554
+ onPickerOpenChange: Nt
2230
2555
  }),
2231
- on && /* @__PURE__ */ U(v, {
2232
- icon: /* @__PURE__ */ U(ce, {
2233
- size: p.LG,
2234
- stroke: m,
2556
+ Gn && /* @__PURE__ */ V(b, {
2557
+ icon: /* @__PURE__ */ V(ue, {
2558
+ size: h.LG,
2559
+ stroke: g,
2235
2560
  "aria-hidden": !0
2236
2561
  }),
2237
- "aria-label": A,
2238
- tooltipProps: { tooltip: A },
2562
+ "aria-label": te,
2563
+ tooltipProps: { tooltip: te },
2239
2564
  className: "size-[40px] flex-shrink-0 mobile:min-h-11 mobile:min-w-11",
2240
- onClick: () => Gt(Re.Dictation),
2241
- disabled: V || o
2565
+ onClick: () => An($e.Dictation),
2566
+ disabled: Ae || s
2242
2567
  }),
2243
- o && a ? /* @__PURE__ */ U(dt, {
2244
- onStop: a,
2245
- ariaLabel: ee
2246
- }) : !o && /* @__PURE__ */ U(ut, {
2247
- onSend: sn,
2248
- isDisabled: !an || !$t,
2249
- ariaLabel: O,
2250
- sendTooltip: k
2568
+ s && o ? /* @__PURE__ */ V(Dt, {
2569
+ onStop: o,
2570
+ ariaLabel: j
2571
+ }) : !s && /* @__PURE__ */ V(Et, {
2572
+ onSend: Kn,
2573
+ isDisabled: !Wn || !zn,
2574
+ ariaLabel: k,
2575
+ sendTooltip: Rn ? A : ee ?? A
2251
2576
  })
2252
2577
  ] })
2253
2578
  })
2254
2579
  ]
2255
2580
  }),
2256
- /* @__PURE__ */ U("span", {
2581
+ /* @__PURE__ */ V("span", {
2257
2582
  className: "sr-only",
2258
2583
  role: "status",
2259
2584
  "aria-live": "polite",
2260
2585
  "aria-atomic": "true",
2261
- children: /* @__PURE__ */ U("span", { children: zt.text }, zt.revision)
2586
+ children: /* @__PURE__ */ V("span", { children: Tn.text }, Tn.revision)
2262
2587
  })
2263
2588
  ]
2264
2589
  });
2265
- }, Ht = {
2590
+ });
2591
+ Q.displayName = "Input";
2592
+ var rn = {
2266
2593
  welcome: "_welcome_1icyo_1",
2267
2594
  description: "_description_1icyo_5"
2268
- }, Ut = ({ 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 }) => {
2269
- let { colors: d, typography: f } = i ?? {};
2270
- return /* @__PURE__ */ W("div", {
2271
- style: s({
2272
- "--ci-welcome-color": d?.welcomeText,
2273
- "--ci-description-color": d?.descriptionText
2595
+ }, an = ({ isStreaming: e = !1, placeholder: t = "Type a prompt or use \"/\" to select one", welcomeText: n, descriptionText: r, belowWelcomeSlot: i, styles: a, className: o, inputClassName: s, isInputDisabled: u = !1, ...d }) => {
2596
+ let { colors: f, typography: p, attachmentTray: m, modelMenu: h } = a ?? {};
2597
+ return /* @__PURE__ */ H("div", {
2598
+ style: c({
2599
+ "--ci-welcome-color": f?.welcomeText,
2600
+ "--ci-description-color": f?.descriptionText
2274
2601
  }),
2275
- className: c("relative flex w-full flex-col items-center gap-9 px-4 py-5 desktop:p-5", a),
2276
- children: [n && /* @__PURE__ */ W("div", {
2277
- className: "flex flex-col items-center gap-4 text-center",
2278
- children: [/* @__PURE__ */ U("h1", {
2279
- className: c(Ht.welcome, "m-0", f?.welcomeClassName || "dial-display2-text"),
2280
- children: n
2281
- }), r && /* @__PURE__ */ U("p", {
2282
- className: c(Ht.description, "m-0 max-w-[540px]", f?.descriptionClassName || "dial-body-paragraph-text"),
2283
- children: r
2284
- })]
2285
- }), /* @__PURE__ */ U("div", {
2286
- className: c("relative w-full", n ? "max-w-[700px]" : "max-w-[748px]"),
2287
- children: /* @__PURE__ */ U(Vt, {
2288
- placeholder: t,
2289
- isStreaming: e,
2290
- isInputDisabled: l,
2291
- ...u,
2292
- className: o,
2293
- colors: d?.input,
2294
- typography: f?.input
2602
+ className: l("relative flex w-full flex-col items-center gap-9 px-4 py-5 desktop:p-5", o),
2603
+ children: [
2604
+ n && /* @__PURE__ */ H("div", {
2605
+ className: "flex flex-col items-center gap-4 text-center",
2606
+ children: [/* @__PURE__ */ V("h1", {
2607
+ className: l(rn.welcome, "m-0", p?.welcomeClassName || "dial-display2-text"),
2608
+ children: n
2609
+ }), r && /* @__PURE__ */ V("p", {
2610
+ className: l(rn.description, "m-0 max-w-[540px]", p?.descriptionClassName || "dial-body-paragraph-text"),
2611
+ children: r
2612
+ })]
2613
+ }),
2614
+ i != null && /* @__PURE__ */ V("div", {
2615
+ className: "flex w-full max-w-[700px] flex-col items-center empty:hidden",
2616
+ children: i
2617
+ }),
2618
+ /* @__PURE__ */ V("div", {
2619
+ className: l("relative w-full", n ? "max-w-[700px]" : "max-w-[748px]"),
2620
+ children: /* @__PURE__ */ V(Q, {
2621
+ placeholder: t,
2622
+ isStreaming: e,
2623
+ isInputDisabled: u,
2624
+ ...d,
2625
+ className: s,
2626
+ colors: f?.input,
2627
+ typography: p?.input,
2628
+ attachmentTray: m,
2629
+ modelMenu: h
2630
+ })
2295
2631
  })
2296
- })]
2632
+ ]
2297
2633
  });
2298
- }, Wt = ({ 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: M, onPendingAttachmentsConsumed: N, onAttachmentClick: re, pasteTextThreshold: ie, maxMessageLength: ae = 5e4, onMessageTooLong: P }) => {
2299
- let oe = z(null), [ce, le] = B([]);
2300
- L(() => {
2301
- C?.length && (le(C), T?.());
2302
- }, [C, T]);
2303
- let [F, ue] = B(e ?? ""), [de, fe] = B([]), [pe, me] = B(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, _e = (e) => {
2304
- me((t) => t.filter((t) => t.id !== e));
2305
- }, ve = I((e, t) => {
2306
- o(e, pe, t);
2307
- }, [pe, o]), V = () => {
2308
- if (ge) {
2309
- if (F.length >= ae) {
2310
- P?.(F.length, ae);
2634
+ }, on = ({ message: e, messageRevision: t, onChange: n, activeMentions: r, onBackspaceAtCaret: i, caretPositionOverride: o, commandMenu: s, menuOverlays: c, initialAttachments: u = [], onCancel: d, onSave: p, onUploadAttachment: m, cancelLabel: h = "Cancel", saveLabel: _ = "Save & Submit", ariaLabel: v, removeLabel: y, retryLabel: b, uploadingLabel: x, addMenuTitle: S = "Add", attachLabel: w = "Attach file", menuTitle: T = "Menu", menuCloseLabel: D = "Close", className: O, pendingDropFiles: k, onDropFilesConsumed: A, validateAttachment: ee, isAttachmentsEnabled: j, isTextAttachmentsAllowed: te, hideAttachFile: ne = !1, fileAccept: re, maximumAttachmentsAmount: ie, onAttachmentsLimitExceeded: M, onDialFileSystemClick: N, dialFileSystemLabel: ae, pendingAttachments: oe, onPendingAttachmentsConsumed: P, onAttachmentClick: se, pasteTextThreshold: ce, maxMessageLength: ue = 5e4, onMessageTooLong: de }) => {
2635
+ let fe = R(null), pe = R(null), [me, he] = z([]);
2636
+ I(() => {
2637
+ k?.length && (he(k), A?.());
2638
+ }, [k, A]);
2639
+ let [ge, _e] = z(e ?? ""), [ve, ye] = z([]), [be, xe] = z(u), Se = ve.some((e) => e.status === a.Loading || e.status === a.Error), Ce = (ge.trim().length > 0 || ve.length > 0 || be.length > 0) && !Se, we = (e) => {
2640
+ xe((t) => t.filter((t) => t.id !== e));
2641
+ }, B = F((e, t) => {
2642
+ p(e, be, t);
2643
+ }, [be, p]), Te = () => {
2644
+ if (Ce) {
2645
+ if (ge.length >= ue) {
2646
+ de?.(ge.length, ue);
2311
2647
  return;
2312
2648
  }
2313
- ve(F, de);
2649
+ B(ge, ve);
2314
2650
  }
2315
- }, ye = I(() => le([]), []), be = I((e) => {
2651
+ }, Ee = F(() => he([]), []), De = F((e) => {
2652
+ _e(e), n?.(e);
2653
+ }, [n]), Oe = F((e) => {
2316
2654
  let t = Array.from(e.target.files ?? []);
2317
- t.length !== 0 && (e.target.value = "", le(t));
2318
- }, []), xe = R(() => j ? [{
2655
+ t.length !== 0 && (e.target.value = "", he(t));
2656
+ }, []), U = L(() => N ? [{
2319
2657
  key: "dial-fs",
2320
- label: ne ?? "DIAL file system",
2321
- icon: /* @__PURE__ */ U(se, {
2322
- size: u,
2658
+ label: ae ?? "DIAL file system",
2659
+ icon: /* @__PURE__ */ V(le, {
2660
+ size: f,
2323
2661
  "aria-hidden": !0,
2324
- stroke: m
2662
+ stroke: g
2325
2663
  }),
2326
- onClick: j
2327
- }] : [], [j, ne]);
2328
- return /* @__PURE__ */ W("div", {
2329
- className: c("flex w-full flex-col gap-2", S),
2330
- children: [/* @__PURE__ */ U(Vt, {
2664
+ onClick: N
2665
+ }] : [], [N, ae]);
2666
+ return /* @__PURE__ */ H("div", {
2667
+ className: l("flex w-full flex-col gap-2", O),
2668
+ children: [/* @__PURE__ */ V(Q, {
2669
+ ref: pe,
2331
2670
  message: e,
2332
- inlineStartSlot: t,
2333
- onInlineStartRemove: n,
2334
- ariaLabel: f,
2671
+ messageRevision: t,
2672
+ activeMentions: r,
2673
+ onBackspaceAtCaret: i,
2674
+ caretPositionOverride: o,
2675
+ commandMenu: s,
2676
+ ariaLabel: v,
2335
2677
  hideActionBar: !0,
2336
- pendingDropFiles: ce,
2337
- onDropFilesConsumed: ye,
2338
- onSend: ve,
2339
- onUploadAttachment: s,
2340
- onChange: ue,
2341
- onAttachmentsChange: fe,
2342
- removeLabel: p,
2343
- retryLabel: h,
2344
- uploadingLabel: g,
2678
+ pendingDropFiles: me,
2679
+ onDropFilesConsumed: Ee,
2680
+ onSend: B,
2681
+ onUploadAttachment: m,
2682
+ onChange: De,
2683
+ onAttachmentsChange: ye,
2684
+ removeLabel: y,
2685
+ retryLabel: b,
2686
+ uploadingLabel: x,
2345
2687
  className: "max-w-full",
2346
- prefixAttachments: pe,
2347
- onRemovePrefixAttachment: _e,
2348
- validateAttachment: E,
2349
- isAttachmentsEnabled: D,
2350
- isTextAttachmentsAllowed: O,
2351
- maximumAttachmentsAmount: A,
2352
- onAttachmentsLimitExceeded: te,
2353
- pendingAttachments: M,
2354
- onPendingAttachmentsConsumed: N,
2355
- onAttachmentClick: re,
2356
- pasteTextThreshold: ie,
2357
- maxMessageLength: ae,
2358
- onMessageTooLong: P
2359
- }), /* @__PURE__ */ W("div", {
2688
+ prefixAttachments: be,
2689
+ onRemovePrefixAttachment: we,
2690
+ validateAttachment: ee,
2691
+ isAttachmentsEnabled: j,
2692
+ isTextAttachmentsAllowed: te,
2693
+ maximumAttachmentsAmount: ie,
2694
+ onAttachmentsLimitExceeded: M,
2695
+ pendingAttachments: oe,
2696
+ onPendingAttachmentsConsumed: P,
2697
+ onAttachmentClick: se,
2698
+ pasteTextThreshold: ce,
2699
+ maxMessageLength: ue,
2700
+ onMessageTooLong: de
2701
+ }), /* @__PURE__ */ H("div", {
2360
2702
  className: "flex items-center justify-between",
2361
- children: [/* @__PURE__ */ U("div", {
2703
+ children: [/* @__PURE__ */ H("div", {
2362
2704
  className: "flex",
2363
- children: !k && /* @__PURE__ */ W(H, { children: [/* @__PURE__ */ U("input", {
2364
- ref: oe,
2705
+ children: [!ne && /* @__PURE__ */ V("input", {
2706
+ ref: fe,
2365
2707
  type: "file",
2366
2708
  multiple: !0,
2367
- accept: ee,
2709
+ accept: re,
2368
2710
  className: "sr-only",
2369
2711
  "aria-hidden": !0,
2370
2712
  tabIndex: -1,
2371
- onChange: be
2372
- }), /* @__PURE__ */ U(tt, {
2373
- onAttachClick: () => oe.current?.click(),
2374
- attachLabel: v,
2375
- addMenuTitle: _,
2376
- menuTitle: y,
2377
- menuCloseLabel: b,
2378
- extraMenuItems: xe
2379
- })] })
2380
- }), /* @__PURE__ */ W("div", {
2713
+ onChange: Oe
2714
+ }), (!ne || (c?.length ?? 0) > 0) && /* @__PURE__ */ V(_t, {
2715
+ onAttachClick: ne ? void 0 : () => fe.current?.click(),
2716
+ attachLabel: w,
2717
+ addMenuTitle: S,
2718
+ menuTitle: T,
2719
+ menuCloseLabel: D,
2720
+ extraMenuItems: U,
2721
+ menuOverlays: c,
2722
+ getCaretPosition: () => pe.current?.getCaretPosition() ?? 0
2723
+ })]
2724
+ }), /* @__PURE__ */ H("div", {
2381
2725
  className: "flex gap-2",
2382
- children: [/* @__PURE__ */ U(x, {
2383
- label: l,
2384
- onClick: a
2385
- }), /* @__PURE__ */ U(w, {
2386
- label: d,
2387
- onClick: V,
2388
- disabled: !ge
2726
+ children: [/* @__PURE__ */ V(C, {
2727
+ label: h,
2728
+ onClick: d
2729
+ }), /* @__PURE__ */ V(E, {
2730
+ label: _,
2731
+ onClick: Te,
2732
+ disabled: !Ce
2389
2733
  })]
2390
2734
  })]
2391
2735
  })]
2392
2736
  });
2737
+ }, sn = (e) => {
2738
+ let [t, n] = z({
2739
+ text: e?.text,
2740
+ revision: e?.revision ?? 0
2741
+ }), r = F((e) => {
2742
+ n((t) => ({
2743
+ text: e,
2744
+ revision: t.revision + 1
2745
+ }));
2746
+ }, []);
2747
+ return {
2748
+ message: t.text,
2749
+ messageRevision: t.revision,
2750
+ seedMessage: r
2751
+ };
2752
+ }, cn = (e, t) => {
2753
+ let n = R(e), r = R(t);
2754
+ r.current = t, I(() => {
2755
+ e !== n.current && (n.current = e, r.current());
2756
+ }, [e]);
2393
2757
  };
2394
2758
  //#endregion
2395
- export { Ee as BottomSheetShell, Ze as ChatSettingsModal, Ut as ConversationInput, Wt as EditMessageInput, Vt as Input, We as SendOnEnter };
2759
+ export { ot as ActionRowLayout, Me as BottomSheetShell, U as CONVERSATION_INPUT_CLASS, pt as ChatSettingsModal, an as ConversationInput, on as EditMessageInput, Q as Input, at as SendOnEnter, sn as useComposerSeed, cn as useComposerSeedSource };