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

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