@epam/ai-dial-conversation-input 1.1.0-dev.8 → 1.1.0-dev.87

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 (58) hide show
  1. package/components/AddAttachmentButton/AddAttachmentButton.d.ts +10 -0
  2. package/components/AddAttachmentButton/AddAttachmentButton.d.ts.map +1 -1
  3. package/components/BottomSheet/BottomSheet.d.ts +17 -4
  4. package/components/BottomSheet/BottomSheet.d.ts.map +1 -1
  5. package/components/BottomSheetShell/BottomSheetShell.d.ts +16 -13
  6. package/components/BottomSheetShell/BottomSheetShell.d.ts.map +1 -1
  7. package/components/ChatSettingsBottomSheet/ChatSettingsBottomSheet.d.ts +1 -4
  8. package/components/ChatSettingsBottomSheet/ChatSettingsBottomSheet.d.ts.map +1 -1
  9. package/components/ChatSettingsModal/ChatSettingsModal.d.ts +1 -0
  10. package/components/ChatSettingsModal/ChatSettingsModal.d.ts.map +1 -1
  11. package/components/ConversationInput/ConversationInput.d.ts +1 -0
  12. package/components/ConversationInput/ConversationInput.d.ts.map +1 -1
  13. package/components/EditMessageInput/EditMessageInput.d.ts +1 -0
  14. package/components/EditMessageInput/EditMessageInput.d.ts.map +1 -1
  15. package/components/Input/Buttons/SendButton.d.ts +1 -2
  16. package/components/Input/Buttons/SendButton.d.ts.map +1 -1
  17. package/components/Input/Buttons/StopButton.d.ts +1 -0
  18. package/components/Input/Buttons/StopButton.d.ts.map +1 -1
  19. package/components/Input/Input.d.ts +1 -0
  20. package/components/Input/Input.d.ts.map +1 -1
  21. package/components/Input/ModelSelectorControl.d.ts +9 -10
  22. package/components/Input/ModelSelectorControl.d.ts.map +1 -1
  23. package/components/ModelSelectorBottomSheet/ModelSelectorBottomSheet.d.ts +21 -5
  24. package/components/ModelSelectorBottomSheet/ModelSelectorBottomSheet.d.ts.map +1 -1
  25. package/components/ModelSelectorSkeleton/ModelSelectorSkeleton.d.ts +4 -0
  26. package/components/ModelSelectorSkeleton/ModelSelectorSkeleton.d.ts.map +1 -1
  27. package/components/SelectedToolsChips/SelectedToolsChips.d.ts +42 -0
  28. package/components/SelectedToolsChips/SelectedToolsChips.d.ts.map +1 -0
  29. package/components/ToolsBottomSheet/ToolsBottomSheet.d.ts +29 -0
  30. package/components/ToolsBottomSheet/ToolsBottomSheet.d.ts.map +1 -0
  31. package/components/VoiceBar/VoiceBar.d.ts +11 -17
  32. package/components/VoiceBar/VoiceBar.d.ts.map +1 -1
  33. package/hooks/useAttachments.d.ts +1 -5
  34. package/hooks/useAttachments.d.ts.map +1 -1
  35. package/hooks/useBottomSheet.d.ts +1 -4
  36. package/hooks/useBottomSheet.d.ts.map +1 -1
  37. package/hooks/useDelayedUnmount.d.ts +3 -12
  38. package/hooks/useDelayedUnmount.d.ts.map +1 -1
  39. package/hooks/useInputHistoryNavigation.d.ts +1 -12
  40. package/hooks/useInputHistoryNavigation.d.ts.map +1 -1
  41. package/hooks/useMessageState.d.ts +1 -4
  42. package/hooks/useMessageState.d.ts.map +1 -1
  43. package/hooks/useModelSelector.d.ts.map +1 -1
  44. package/hooks/useVoiceRecorder.d.ts +16 -24
  45. package/hooks/useVoiceRecorder.d.ts.map +1 -1
  46. package/index.css +1 -1
  47. package/index.d.ts +1 -1
  48. package/index.d.ts.map +1 -1
  49. package/index.js +1047 -864
  50. package/models/ConversationInput.d.ts +67 -32
  51. package/models/ConversationInput.d.ts.map +1 -1
  52. package/models/Input.d.ts +67 -34
  53. package/models/Input.d.ts.map +1 -1
  54. package/package.json +5 -5
  55. package/utils/concurrency.d.ts +3 -12
  56. package/utils/concurrency.d.ts.map +1 -1
  57. package/utils/deployment.d.ts +1 -4
  58. package/utils/deployment.d.ts.map +1 -1
package/index.js CHANGED
@@ -1,12 +1,12 @@
1
- import { AttachmentErrorReason as e, AttachmentType as t, DeploymentIcon as n, Highlight as r, RequestStatus as i, ResponseFormat as a, buildCssVars as o, mergeClasses as s, useIsMobile as c } from "@epam/ai-dial-chat-shared";
2
- import { BASE_ICON_SIZE as l, ButtonAppearance as u, ButtonVariant as d, DIAL_ICON_SIZE as f, DialButton as p, DialCloseButton as m, DialDropdown as h, DialDropdownIcon as g, DialErrorText as _, DialGhostIconButton as v, DialInput as y, DialPopup as b, DialPrimaryButton as x, DialRadioGroup as S, DialSearch as C, DialSkeleton as w, DialSkeletonVariant as T, DialSlider as E, DialSpinner as D, DialTag as ee, DialTooltip as O, ElementSize as k, PopupSize as A, RadioGroupOrientation as te } from "@epam/ai-dial-ui-kit";
3
- import { IconArrowLeft as ne, IconArrowNarrowRight as j, IconCheck as M, IconChevronDown as N, IconChevronRight as re, IconFile as ie, IconMicrophone as ae, IconPaperclip as oe, IconPlaystationSquare as se, IconPlus as P, IconSettings as ce, IconX as le } from "@tabler/icons-react";
4
- import { createPortal as ue } from "react-dom";
5
- import { createElement as F, memo as de, useCallback as I, useEffect as L, useImperativeHandle as fe, useLayoutEffect as pe, useMemo as R, useRef as z, useState as B } from "react";
1
+ import { AttachmentErrorReason as e, AttachmentType as t, DeploymentIcon as n, RequestStatus as r, ResponseFormat as i, buildCssVars as a, mergeClasses as o, useIsMobile as s } from "@epam/ai-dial-chat-shared";
2
+ import { BASE_ICON_SIZE as c, Button as l, DIAL_ICON_SIZE as u, DialCloseButton as d, DialDropdown as f, DialDropdownIcon as p, DialErrorText as m, DialInput as h, DialPopup as g, DialRadioGroup as _, DialSearch as v, DialSkeleton as y, DialSkeletonVariant as b, DialSlider as x, DialTag as S, DialTooltip as C, ElementSize as w, GhostIconButton as T, Highlight as E, NeutralButton as D, PopupSize as O, PrimaryButton as k, PrimaryIconButton as A, RadioGroupOrientation as ee, StaticIconButton as te } from "@epam/ai-dial-ui-kit";
3
+ import { IconArrowLeft as ne, IconArrowNarrowRight as re, IconCheck as ie, IconChevronDown as j, IconChevronRight as M, IconFile as ae, IconMicrophone as oe, IconPaperclip as se, IconPlayerStopFilled as ce, IconPlaystationSquare as le, IconPlus as N, IconSettings as ue, IconTool as de, IconX as fe } from "@tabler/icons-react";
4
+ import { createPortal as pe } from "react-dom";
5
+ import { createElement as P, memo as F, useCallback as I, useEffect as L, useImperativeHandle as me, useLayoutEffect as he, useMemo as R, useRef as z, useState as B } from "react";
6
6
  import { Fragment as V, jsx as H, jsxs as U } from "react/jsx-runtime";
7
- import { AttachmentCard as me, AttachmentGroup as he, AttachmentTray as ge, AttachmentTray as _e, FileDndOverlay as ve, MAX_UPLOADS_PER_MINUTE as ye, generateAttachmentId as be, getAttachmentIcon as xe, useClipboardPaste as Se } from "@epam/ai-dial-attachment-input";
7
+ import { AttachmentCard as ge, AttachmentGroup as _e, AttachmentTray as ve, AttachmentTray as ye, FileDndOverlay as be, MAX_UPLOADS_PER_MINUTE as xe, generateAttachmentId as Se, getAttachmentIcon as Ce, useClipboardPaste as we } from "@epam/ai-dial-attachment-input";
8
8
  //#region src/hooks/useBottomSheet.ts
9
- var Ce = (e, t) => {
9
+ var Te = (e, t) => {
10
10
  L(() => {
11
11
  if (!e) return;
12
12
  let n = (e) => {
@@ -18,213 +18,234 @@ var Ce = (e, t) => {
18
18
  document.body.style.overflow = "";
19
19
  };
20
20
  }, [e]);
21
- }, we = {
22
- backdrop: "_backdrop_3xrn0_9",
23
- sheet: "_sheet_3xrn0_13",
24
- "slide-up": "_slide-up_3xrn0_1",
25
- title: "_title_3xrn0_18",
26
- divider: "_divider_3xrn0_22"
27
- }, W = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: a, "aria-label": o, style: c, titleClassName: l = "dial-body-semi-text", className: u, children: d }) => (Ce(e, r), !e || typeof document > "u" ? null : ue(/* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("div", {
28
- className: s(we.backdrop, "fixed inset-0 z-[55]"),
29
- onPointerDown: r,
30
- "aria-hidden": !0
31
- }), /* @__PURE__ */ U("div", {
32
- role: "dialog",
33
- "aria-modal": !0,
34
- "aria-label": t ?? o,
35
- style: c,
36
- className: s(we.sheet, "fixed inset-x-0 bottom-0 z-[60] flex max-h-[85dvh] flex-col", u),
37
- children: [t != null && /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ U("div", {
38
- className: "relative flex h-[60px] flex-shrink-0 items-center justify-center px-4",
39
- children: [
40
- i && /* @__PURE__ */ H("div", {
41
- className: "absolute start-4",
42
- children: /* @__PURE__ */ H(v, {
43
- icon: /* @__PURE__ */ H(ne, {
44
- size: f.LG,
45
- stroke: 1.5,
46
- className: "rtl:scale-x-[-1]"
47
- }),
48
- "aria-label": a,
49
- onClick: i
50
- })
51
- }),
52
- /* @__PURE__ */ H("span", {
53
- className: s(we.title, l),
54
- children: t
55
- }),
56
- /* @__PURE__ */ H("div", {
57
- className: "absolute end-4 m-2",
58
- children: /* @__PURE__ */ H(m, {
59
- ariaLabel: n,
60
- size: f.LG,
61
- onClose: r
21
+ }, Ee = {
22
+ backdrop: "_backdrop_qmzqj_9",
23
+ sheet: "_sheet_qmzqj_13",
24
+ "slide-up": "_slide-up_qmzqj_1",
25
+ title: "_title_qmzqj_18",
26
+ divider: "_divider_qmzqj_22"
27
+ }, W = ({ isOpen: e, title: t, closeLabel: n, onClose: r, onBack: i, backLabel: s, "aria-label": c, style: l, titleClassName: f = "dial-body-semi-text", className: p, colors: m, children: h }) => {
28
+ if (Te(e, r), !e || typeof document > "u") return null;
29
+ let g = a({
30
+ "--ci-backdrop": m?.backdrop,
31
+ "--ci-sheet-bg": m?.sheetBg,
32
+ "--ci-sheet-text": m?.sheetText,
33
+ "--ci-sheet-divider": m?.divider
34
+ });
35
+ return pe(/* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("div", {
36
+ className: o(Ee.backdrop, "fixed inset-0 z-[55]"),
37
+ style: g,
38
+ onPointerDown: r,
39
+ "aria-hidden": !0
40
+ }), /* @__PURE__ */ U("div", {
41
+ role: "dialog",
42
+ "aria-modal": !0,
43
+ "aria-label": t ?? c,
44
+ style: {
45
+ ...g,
46
+ ...l
47
+ },
48
+ className: o(Ee.sheet, "fixed inset-x-0 bottom-0 z-[60] flex max-h-[85dvh] flex-col", p),
49
+ children: [t != null && /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ U("div", {
50
+ className: "relative flex h-[60px] flex-shrink-0 items-center justify-center px-4",
51
+ children: [
52
+ i && /* @__PURE__ */ H("div", {
53
+ className: "absolute start-4",
54
+ children: /* @__PURE__ */ H(T, {
55
+ icon: /* @__PURE__ */ H(ne, {
56
+ size: u.LG,
57
+ stroke: 1.5,
58
+ className: "rtl:scale-x-[-1]"
59
+ }),
60
+ "aria-label": s,
61
+ onClick: i
62
+ })
63
+ }),
64
+ /* @__PURE__ */ H("span", {
65
+ className: o(Ee.title, f),
66
+ children: t
67
+ }),
68
+ /* @__PURE__ */ H("div", {
69
+ className: "absolute end-4 m-2",
70
+ children: /* @__PURE__ */ H(d, {
71
+ ariaLabel: n,
72
+ size: u.LG,
73
+ onClose: r
74
+ })
62
75
  })
63
- })
64
- ]
65
- }), /* @__PURE__ */ H("div", { className: "h-px flex-shrink-0" })] }), /* @__PURE__ */ H("div", {
66
- className: "overflow-y-auto",
67
- children: d
68
- })]
69
- })] }), document.body)), Te = async (e, t, n) => {
76
+ ]
77
+ }), /* @__PURE__ */ H("div", { className: o(Ee.divider, "h-px flex-shrink-0") })] }), /* @__PURE__ */ H("div", {
78
+ className: "overflow-y-auto",
79
+ children: h
80
+ })]
81
+ })] }), document.body);
82
+ }, De = async (e, t, n) => {
70
83
  let r = 6e4 / t, i = [];
71
84
  for (let t = 0; t < e.length; t++) t > 0 && await new Promise((e) => setTimeout(e, r)), i.push(n(e[t]));
72
85
  await Promise.allSettled(i);
73
- }, Ee = ({ 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 }) => {
86
+ }, Oe = ({ initialAttachments: n, onUploadAttachment: i, onAttachmentsChange: a, validateAttachment: o, pendingDropFiles: s, onDropFilesConsumed: c, pendingAttachments: l, onPendingAttachmentsConsumed: u, onExpandPastedText: d, maximumAttachmentsAmount: f, baseAttachmentsAmount: p = 0, onAttachmentsLimitExceeded: m }) => {
74
87
  let [h, g] = B(n), _ = z(h);
75
88
  L(() => {
76
89
  _.current = h;
77
90
  }, [h]), L(() => () => {
78
91
  _.current.forEach((e) => {
79
- e.previewUrl && URL.revokeObjectURL(e.previewUrl);
92
+ e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
80
93
  });
81
94
  }, []);
82
95
  let v = I((e) => e.map((e) => {
83
- let n = e.type.startsWith("image/"), r = n ? URL.createObjectURL(e) : void 0;
96
+ let n = e.type.startsWith("image/"), i = e.type.startsWith("audio/"), a = n ? URL.createObjectURL(e) : void 0, o = i ? URL.createObjectURL(e) : void 0;
84
97
  return {
85
- id: be(),
98
+ id: Se(),
86
99
  name: e.name,
87
100
  contentType: e.type,
88
101
  file: e,
89
- type: n ? t.Image : t.File,
90
- status: i.Idle,
91
- previewUrl: r
102
+ type: n ? t.Image : i ? t.Audio : t.File,
103
+ status: r.Idle,
104
+ previewUrl: a,
105
+ playUrl: o
92
106
  };
93
- }), []), y = I((e) => {
107
+ }), []), y = z(a);
108
+ L(() => {
109
+ y.current = a;
110
+ }, [a]);
111
+ let b = z(!0), x = I((e) => {
94
112
  g((t) => {
95
113
  let n = e(t);
96
- return n !== t && a?.(n), n;
114
+ return n === t ? t : n;
97
115
  });
98
- }, [a]), b = I((e) => {
99
- g(e), a?.(e);
100
- }, [a]), x = I(async (t) => {
101
- if (r) {
102
- y((e) => e.map((e) => e.id === t.id ? {
116
+ }, []);
117
+ L(() => {
118
+ if (b.current) {
119
+ b.current = !1;
120
+ return;
121
+ }
122
+ y.current?.(h);
123
+ }, [h]);
124
+ let S = I((e) => {
125
+ g(e);
126
+ }, []), C = I(async (t) => {
127
+ if (i) {
128
+ x((e) => e.map((e) => e.id === t.id ? {
103
129
  ...e,
104
- status: i.Loading
130
+ status: r.Loading
105
131
  } : e));
106
132
  try {
107
- let e = await r(t);
108
- y((n) => n.map((n) => n.id === t.id ? {
133
+ let e = await i(t);
134
+ x((n) => n.map((n) => n.id === t.id ? {
109
135
  ...n,
110
- status: i.Idle,
136
+ status: r.Idle,
111
137
  url: e
112
138
  } : n));
113
139
  } catch (n) {
114
- let r = typeof n == "object" && n && "errorReason" in n && Object.values(e).includes(n.errorReason) ? n.errorReason : void 0;
115
- y((e) => e.map((e) => e.id === t.id ? {
140
+ let i = typeof n == "object" && n && "errorReason" in n && Object.values(e).includes(n.errorReason) ? n.errorReason : void 0;
141
+ x((e) => e.map((e) => e.id === t.id ? {
116
142
  ...e,
117
- status: i.Error,
118
- ...r != null && { errorReason: r }
143
+ status: r.Error,
144
+ ...i != null && { errorReason: i }
119
145
  } : e));
120
146
  }
121
147
  }
122
- }, [r, y]), S = I((e, t = !0) => {
123
- let n = [], r;
124
- if (y((t) => {
125
- let i = new Set(t.map((e) => e.id));
126
- if (n = e.filter((e) => !i.has(e.id)), f != null && f > 0 && Number.isFinite(f)) {
127
- let e = p + t.length + n.length;
128
- if (e > f) return r = {
129
- count: e,
130
- limit: f
131
- }, t;
148
+ }, [i, x]), w = I((e, t = !0) => {
149
+ let n = new Set(_.current.map((e) => e.id)), i = e.filter((e) => !n.has(e.id));
150
+ if (i.length !== 0) {
151
+ if (f != null && f > 0 && Number.isFinite(f)) {
152
+ let e = p + _.current.length + i.length;
153
+ if (e > f) {
154
+ i.forEach((e) => {
155
+ e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
156
+ }), m?.(e, f);
157
+ return;
158
+ }
159
+ }
160
+ if (x((e) => [...e, ...i]), t) {
161
+ let e = [];
162
+ i.forEach((t) => {
163
+ let n = o?.(t);
164
+ n == null ? e.push(t) : x((e) => e.map((e) => e.id === t.id ? {
165
+ ...e,
166
+ status: r.Error,
167
+ errorReason: n
168
+ } : e));
169
+ }), De(e, xe, C);
132
170
  }
133
- return [...t, ...n];
134
- }), r != null) {
135
- n.forEach((e) => {
136
- e.previewUrl && URL.revokeObjectURL(e.previewUrl);
137
- }), m?.(r.count, r.limit);
138
- return;
139
- }
140
- if (t) {
141
- let e = [];
142
- n.forEach((t) => {
143
- let n = o?.(t);
144
- n == null ? e.push(t) : y((e) => e.map((e) => e.id === t.id ? {
145
- ...e,
146
- status: i.Error,
147
- errorReason: n
148
- } : e));
149
- }), Te(e, ye, x);
150
171
  }
151
172
  }, [
152
173
  p,
153
174
  f,
154
175
  m,
155
- y,
156
176
  x,
177
+ C,
157
178
  o
158
179
  ]);
159
180
  L(() => {
160
- s.length !== 0 && (S(v(s)), c?.());
181
+ s.length !== 0 && (w(v(s)), c?.());
161
182
  }, [
162
- S,
183
+ w,
163
184
  v,
164
185
  c,
165
186
  s
166
187
  ]), L(() => {
167
- l.length !== 0 && (S(l, !1), u?.());
188
+ l.length !== 0 && (w(l, !1), u?.());
168
189
  }, [
169
- S,
190
+ w,
170
191
  u,
171
192
  l
172
193
  ]), L(() => {
173
194
  if (!o) return;
174
- let t = !1, n = [], r = _.current.map((r) => {
175
- if (r.status === i.Loading) return r;
176
- let a = o(r);
177
- if (a != null) return r.status === i.Error && r.errorReason === a ? r : (t = !0, {
178
- ...r,
179
- status: i.Error,
195
+ let t = !1, n = [], i = _.current.map((i) => {
196
+ if (i.status === r.Loading) return i;
197
+ let a = o(i);
198
+ if (a != null) return i.status === r.Error && i.errorReason === a ? i : (t = !0, {
199
+ ...i,
200
+ status: r.Error,
180
201
  errorReason: a
181
202
  });
182
- if (r.errorReason === e.UnsupportedType) {
203
+ if (i.errorReason === e.UnsupportedType) {
183
204
  t = !0;
184
205
  let e = {
185
- ...r,
186
- status: i.Idle,
206
+ ...i,
207
+ status: r.Idle,
187
208
  errorReason: void 0
188
209
  };
189
210
  return e.url ?? n.push(e), e;
190
211
  }
191
- return r;
212
+ return i;
192
213
  });
193
- t && y(() => r), n.forEach((e) => void x(e));
214
+ t && x(() => i), n.forEach((e) => void C(e));
194
215
  }, [
195
216
  o,
196
- y,
197
- x
217
+ x,
218
+ C
198
219
  ]);
199
- let C = I((e) => {
200
- y((t) => {
220
+ let T = I((e) => {
221
+ x((t) => {
201
222
  let n = t.find((t) => t.id === e);
202
- return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), t.filter((t) => t.id !== e);
223
+ return n?.previewUrl && URL.revokeObjectURL(n.previewUrl), n?.playUrl && URL.revokeObjectURL(n.playUrl), t.filter((t) => t.id !== e);
203
224
  });
204
- }, [y]);
225
+ }, [x]);
205
226
  return {
206
227
  attachments: h,
207
228
  buildAttachments: v,
208
- addAttachments: S,
209
- resetAttachments: b,
210
- handleRemove: C,
229
+ addAttachments: w,
230
+ resetAttachments: S,
231
+ handleRemove: T,
211
232
  handleRetry: I((e) => {
212
233
  let t = h.find((t) => t.id === e);
213
- t && x(t);
214
- }, [h, x]),
234
+ t && C(t);
235
+ }, [h, C]),
215
236
  handleExpand: I(async (e) => {
216
237
  let n = h.find((t) => t.id === e);
217
238
  if (!n || n.type !== t.Pasted) return;
218
239
  let r = await n.file.text();
219
- d?.(r), C(e);
240
+ d?.(r), T(e);
220
241
  }, [
221
242
  h,
222
- C,
243
+ T,
223
244
  d
224
245
  ]),
225
- hasBlockedAttachments: h.some((e) => e.status === i.Loading || e.status === i.Error)
246
+ hasBlockedAttachments: h.some((e) => e.status === r.Loading || e.status === r.Error)
226
247
  };
227
- }, De = (e, t) => {
248
+ }, ke = (e, t) => {
228
249
  let [n, r] = B(e), [i, a] = B(!1), [o, s] = B(0);
229
250
  return L(() => {
230
251
  if (e) {
@@ -242,12 +263,12 @@ var Ce = (e, t) => {
242
263
  isExiting: i,
243
264
  instanceKey: o
244
265
  };
245
- }, Oe = (e, t) => !e.slice(0, t).includes("\n"), ke = (e, t) => !e.slice(t).includes("\n"), Ae = (e) => {
266
+ }, Ae = (e, t) => !e.slice(0, t).includes("\n"), je = (e, t) => !e.slice(t).includes("\n"), Me = (e) => {
246
267
  let t = z(e);
247
268
  t.current = e;
248
269
  let n = z(-1), r = z(""), i = I((e, i, a) => {
249
270
  let o = t.current;
250
- return !o || o.length === 0 ? null : e === "up" ? !Oe(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 || !ke(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
271
+ return !o || o.length === 0 ? null : e === "up" ? !Ae(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 || !je(i, a) ? null : n.current < o.length - 1 ? (n.current += 1, o[n.current]) : (n.current = -1, r.current);
251
272
  }, []), a = I(() => {
252
273
  n.current = -1, r.current = "";
253
274
  }, []), o = I(() => {
@@ -262,13 +283,13 @@ var Ce = (e, t) => {
262
283
  a,
263
284
  o
264
285
  ]);
265
- }, je = ({ messageProp: e, messageRevision: t }) => {
286
+ }, Ne = ({ messageProp: e, messageRevision: t }) => {
266
287
  let [n, r] = B(e), i = z(null), a = z(0), [o, s] = B(!1);
267
288
  return L(() => {
268
289
  r(e);
269
290
  }, [e, t]), L(() => {
270
291
  i.current && (a.current = i.current.offsetHeight);
271
- }, []), pe(() => {
292
+ }, []), he(() => {
272
293
  if (!i.current || a.current === 0) return;
273
294
  let e = i.current.offsetHeight > a.current;
274
295
  s((t) => e ? !0 : n === "" ? !1 : t);
@@ -278,182 +299,109 @@ var Ce = (e, t) => {
278
299
  textareaRef: i,
279
300
  isMultiLine: o
280
301
  };
281
- }, Me = /* @__PURE__ */ function(e) {
282
- return e.Idle = "idle", e.Recording = "recording", e.Stopped = "stopped", e.Uploading = "uploading", e.Error = "error", e;
283
- }({}), Ne = [
302
+ }, Pe = /* @__PURE__ */ function(e) {
303
+ return e.Idle = "idle", e.Recording = "recording", e.Error = "error", e;
304
+ }({}), Fe = [
284
305
  "audio/webm;codecs=opus",
285
306
  "audio/ogg;codecs=opus",
286
307
  "audio/webm"
287
- ], Pe = () => Ne.find((e) => MediaRecorder.isTypeSupported(e)) ?? "", Fe = ({ onUploadAudio: e, onTranscribeAudio: t, onTranscript: n }) => {
288
- let [r, i] = B("idle"), [a, o] = B(null), [s, c] = B(null), l = z(null), u = z(null), d = z(null), f = z(null), p = z([]), m = z(""), h = z(null), g = z(null), _ = z([]), v = z(!1), y = I(() => {
289
- h.current != null && (cancelAnimationFrame(h.current), h.current = null);
290
- }, []), b = I(() => {
291
- y(), l.current &&= (l.current.getTracks().forEach((e) => e.stop()), null), u.current &&= (u.current.close(), null), d.current = null, f.current = null;
292
- }, [y]), x = I(() => {
308
+ ], Ie = () => Fe.find((e) => MediaRecorder.isTypeSupported(e)) ?? "", Le = ({ onAttachAudio: e }) => {
309
+ let [t, n] = B("idle"), [r, i] = B(null), [a, o] = B(0), s = z(null), c = z(null), l = z(null), u = z(null), d = z([]), f = z(""), p = z(null), m = z(e);
310
+ m.current = e;
311
+ let h = I(() => {
312
+ p.current != null && (clearInterval(p.current), p.current = null);
313
+ }, []), g = I(() => {
314
+ h(), s.current &&= (s.current.getTracks().forEach((e) => e.stop()), null), c.current &&= (c.current.close(), null), l.current = null, u.current = null;
315
+ }, [h]), _ = I(() => {
293
316
  (async () => {
294
317
  try {
295
318
  let e = await navigator.mediaDevices.getUserMedia({ audio: !0 });
296
- l.current = e;
319
+ s.current = e;
297
320
  let t = new AudioContext();
298
- u.current = t;
299
- let n = t.createAnalyser();
300
- n.fftSize = 256, d.current = n, t.createMediaStreamSource(e).connect(n);
301
- let r = Pe();
302
- m.current = r, p.current = [], _.current = [];
303
- let a = new MediaRecorder(e, r ? { mimeType: r } : void 0);
304
- f.current = a, a.ondataavailable = (e) => {
305
- e.data.size > 0 && p.current.push(e.data);
306
- }, a.start(), i("recording");
307
- let s = () => {
308
- let e = d.current;
309
- if (!e) return;
310
- let t = new Uint8Array(e.frequencyBinCount);
311
- e.getByteTimeDomainData(t);
312
- let n = 0;
313
- for (let e = 0; e < t.length; e++) {
314
- let r = (t[e] - 128) / 128;
315
- n += r * r;
316
- }
317
- _.current.push(Math.sqrt(n / t.length)), o(new Float32Array(_.current)), h.current = requestAnimationFrame(s);
318
- };
319
- h.current = requestAnimationFrame(s);
321
+ c.current = t;
322
+ let r = t.createAnalyser();
323
+ r.fftSize = 256, l.current = r, t.createMediaStreamSource(e).connect(r);
324
+ let i = Ie();
325
+ f.current = i, d.current = [];
326
+ let a = new MediaRecorder(e, i ? { mimeType: i } : void 0);
327
+ u.current = a, a.ondataavailable = (e) => {
328
+ e.data.size > 0 && d.current.push(e.data);
329
+ }, a.start(), n("recording"), p.current = setInterval(() => {
330
+ o((e) => e + 1);
331
+ }, 1e3);
320
332
  } catch (e) {
321
- c(e instanceof Error ? e.message : "Microphone access denied"), i("error");
333
+ i(e instanceof Error ? e.message : "Microphone access denied"), n("error");
322
334
  }
323
335
  })();
324
- }, []), S = I(() => {
325
- let e = f.current;
326
- !e || e.state !== "recording" || (y(), e.onstop = () => {
327
- let e = m.current || "audio/webm", t = new Blob(p.current, { type: e }), n = e.split(";")[0].split("/")[1] ?? "webm";
328
- g.current = new File([t], `recording.${n}`, { type: e }), i("stopped");
336
+ }, []), v = I(() => {
337
+ let e = u.current;
338
+ !e || e.state !== "recording" || (h(), e.onstop = () => {
339
+ let e = f.current || "audio/webm", t = new Blob(d.current, { type: e }), r = e.split(";")[0], a = r.split("/")[1] ?? "webm", s = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, -1), c = new File([t], `voice-${s}.${a}`, { type: r });
340
+ m.current(c), g(), o(0), i(null), n("idle");
329
341
  }, e.stop());
330
- }, [y]), C = I(() => {
331
- let r = g.current;
332
- !r || !e || !t || (v.current = !1, i("uploading"), (async () => {
333
- try {
334
- let a = await e(r, m.current || "audio/webm");
335
- if (v.current) return;
336
- let s = await t(a);
337
- if (v.current) return;
338
- b(), g.current = null, o(null), c(null), i("idle"), n?.(s);
339
- } catch (e) {
340
- if (v.current) return;
341
- c(e instanceof Error ? e.message : "Transcription failed"), i("error");
342
- }
343
- })());
344
- }, [
345
- e,
346
- t,
347
- n,
348
- b
349
- ]), w = I(() => {
350
- v.current = !0, b(), g.current = null, o(null), c(null), i("idle");
351
- }, [b]);
342
+ }, [h, g]), y = I(() => {
343
+ let e = u.current;
344
+ e && e.state === "recording" && (e.ondataavailable = null, e.onstop = null, e.stop()), g(), o(0), i(null), n("idle");
345
+ }, [g]);
352
346
  return L(() => () => {
353
- v.current = !0, b();
354
- }, [b]), {
355
- state: r,
356
- waveformData: a,
357
- errorMessage: s,
358
- startRecording: x,
359
- stopRecording: S,
360
- confirmRecording: C,
361
- discardRecording: w
347
+ g();
348
+ }, [g]), {
349
+ state: t,
350
+ analyserNodeRef: l,
351
+ elapsedSeconds: a,
352
+ errorMessage: r,
353
+ startRecording: _,
354
+ stopRecording: v,
355
+ discardRecording: y
362
356
  };
363
- }, Ie = /* @__PURE__ */ function(e) {
357
+ }, Re = /* @__PURE__ */ function(e) {
364
358
  return e.Enter = "enter", e.MetaEnter = "meta-enter", e;
365
- }({}), Le = {
366
- item: "_item_vou13_1",
367
- itemIcon: "_itemIcon_vou13_11"
368
- }, Re = ({ isOpen: e, title: t, closeLabel: n, onClose: r, style: i, items: a, className: o, titleClassName: c = "dial-body-semi-text", itemLabelClassName: l = "dial-small-text", btnTextClassName: u = "" }) => {
369
- let d = (e) => {
359
+ }({}), ze = {
360
+ item: "_item_l2r5m_1",
361
+ itemIcon: "_itemIcon_l2r5m_11"
362
+ }, Be = ({ isOpen: e, title: t, closeLabel: n, onClose: r, style: i, items: s, className: c, titleClassName: u = "dial-body-semi-text", itemLabelClassName: d = "dial-small-text", btnTextClassName: f = "", colors: p }) => {
363
+ let m = (e) => {
370
364
  e(), r();
371
- };
365
+ }, h = a({
366
+ "--ci-sheet-text": p?.itemText,
367
+ "--ci-sheet-item-hover": p?.itemHoverBg,
368
+ "--ci-sheet-item-active": p?.itemActiveBg,
369
+ "--ci-sheet-icon": p?.itemIcon
370
+ });
372
371
  return /* @__PURE__ */ H(W, {
373
372
  isOpen: e,
374
373
  title: t,
375
374
  closeLabel: n,
376
375
  onClose: r,
377
376
  style: i,
378
- className: o,
379
- titleClassName: c,
377
+ className: c,
378
+ titleClassName: u,
379
+ colors: p?.shell,
380
380
  children: /* @__PURE__ */ H("ul", {
381
381
  role: "list",
382
382
  className: "flex flex-col",
383
- children: a.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ H("li", { children: /* @__PURE__ */ H(p, {
383
+ style: h,
384
+ children: s.map(({ key: e, label: t, icon: n, iconAfter: r, onClick: i }) => /* @__PURE__ */ H("li", { children: /* @__PURE__ */ H(l, {
384
385
  type: "button",
385
- className: s(Le.item, "flex w-full items-center gap-3 px-4 py-[10px] text-start"),
386
+ className: o(ze.item, "w-full gap-3 px-4 py-[10px] text-start"),
386
387
  iconBefore: /* @__PURE__ */ H("span", {
387
- className: Le.itemIcon,
388
+ className: ze.itemIcon,
388
389
  children: n
389
390
  }),
390
391
  iconAfter: r ? /* @__PURE__ */ H("span", {
391
392
  className: "ms-auto",
392
393
  children: r
393
394
  }) : null,
394
- textClassName: u,
395
+ textClassName: f,
395
396
  label: /* @__PURE__ */ H("span", {
396
- className: l,
397
+ className: d,
397
398
  children: t
398
399
  }),
399
- onClick: () => d(i)
400
+ onClick: () => m(i)
400
401
  }) }, e))
401
402
  })
402
403
  });
403
- }, ze = ({ gradientId: e = "gradient-check-icon" }) => /* @__PURE__ */ U("svg", {
404
- width: f.SM,
405
- height: f.SM,
406
- viewBox: "0 0 24 24",
407
- fill: "none",
408
- "aria-hidden": !0,
409
- children: [/* @__PURE__ */ H("defs", { children: /* @__PURE__ */ U("linearGradient", {
410
- id: e,
411
- x1: "0",
412
- y1: "0",
413
- x2: "24",
414
- y2: "24",
415
- gradientUnits: "userSpaceOnUse",
416
- children: [/* @__PURE__ */ H("stop", {
417
- offset: "0%",
418
- stopColor: "#4b7be6"
419
- }), /* @__PURE__ */ H("stop", {
420
- offset: "100%",
421
- stopColor: "#9355f4"
422
- })]
423
- }) }), /* @__PURE__ */ H("path", {
424
- d: "M5 12l5 5L20 7",
425
- stroke: `url(#${e})`,
426
- strokeWidth: "2",
427
- strokeLinecap: "round",
428
- strokeLinejoin: "round"
429
- })]
430
- }), G = {
431
- tabContainer: "_tabContainer_rzv03_1",
432
- tabActive: "_tabActive_rzv03_13"
433
- };
434
- de(({ tabs: e, activeTabId: t, onTabChange: n, styles: r }) => {
435
- let { tabClassName: i = "dial-tiny-semi-text" } = r?.typography ?? {};
436
- return /* @__PURE__ */ H("div", {
437
- className: "flex flex-nowrap gap-1",
438
- children: e.map((e) => {
439
- let r = t === e.id;
440
- return /* @__PURE__ */ H(ee, {
441
- label: e.label,
442
- selected: r,
443
- onClick: () => n(e.id),
444
- "aria-selected": r,
445
- className: s("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", i, G.tabContainer, r && G.tabActive)
446
- }, e.id);
447
- })
448
- });
449
- });
450
- //#endregion
451
- //#region ../ai-dial-kit/src/components/Button/Buttons.tsx
452
- var K = (e) => /* @__PURE__ */ H(x, { ...e }), Be = (e) => /* @__PURE__ */ H(p, {
453
- ...e,
454
- variant: d.Neutral,
455
- appearance: u.Outlined
456
- }), Ve = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
404
+ }, Ve = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, isOpen: o }) => {
457
405
  let [s, c] = B(t), [l, u] = B(n), [d, f] = B(r), p = z(o);
458
406
  L(() => {
459
407
  o && !p.current && (c(t), u(n), f(r)), p.current = o;
@@ -486,56 +434,56 @@ var K = (e) => /* @__PURE__ */ H(x, { ...e }), Be = (e) => /* @__PURE__ */ H(p,
486
434
  a
487
435
  ])
488
436
  };
489
- }, q = "!dial-small-semi-text !text-primary gap-1", He = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: i, onSystemPromptChange: o, onTemperatureChange: s, responseFormatLabel: c = "Response format", responseFormatHint: l = "Applies to new and existing messages", responseFormatMarkdownLabel: u = "Markdown", responseFormatPlainTextLabel: d = "Plain text", systemPromptLabel: f = "System prompt", systemPromptTooltip: p = "Enter a prompt", temperatureLabel: m = "Temperature", temperatureLabels: h = [
437
+ }, He = "!dial-small-semi-text !text-primary gap-1", Ue = ({ features: e, responseFormat: t, systemPrompt: n, temperature: r, onResponseFormatChange: a, onSystemPromptChange: o, onTemperatureChange: s, responseFormatLabel: c = "Response format", responseFormatHint: l = "Applies to new and existing messages", responseFormatMarkdownLabel: u = "Markdown", responseFormatPlainTextLabel: d = "Plain text", systemPromptLabel: f = "System prompt", systemPromptTooltip: p = "Enter a prompt", temperatureLabel: m = "Temperature", temperatureLabels: g = [
490
438
  "Precise",
491
439
  "Neutral",
492
440
  "Creative"
493
- ], temperatureHint: g }) => /* @__PURE__ */ U("div", {
441
+ ], temperatureHint: v }) => /* @__PURE__ */ U("div", {
494
442
  className: "flex flex-col gap-4 px-6 py-3",
495
443
  children: [
496
- e.responseFormat && /* @__PURE__ */ H(S, {
444
+ e.responseFormat && /* @__PURE__ */ H(_, {
497
445
  fieldTitle: c,
498
- labelClassName: q,
446
+ labelClassName: He,
499
447
  elementId: "response-format",
500
- orientation: te.Column,
501
- activeRadioButton: t ?? a.Markdown,
448
+ orientation: ee.Column,
449
+ activeRadioButton: t ?? i.Markdown,
502
450
  labelDescription: l,
503
451
  radioButtons: [{
504
- id: a.Markdown,
452
+ id: i.Markdown,
505
453
  name: u
506
454
  }, {
507
- id: a.PlainText,
455
+ id: i.PlainText,
508
456
  name: d
509
457
  }],
510
- onChange: (e) => i(e)
458
+ onChange: (e) => a(e)
511
459
  }),
512
- e.systemPrompt && /* @__PURE__ */ H(y, {
460
+ e.systemPrompt && /* @__PURE__ */ H(h, {
513
461
  value: n,
514
462
  placeholder: p,
515
463
  labelProps: {
516
- className: q,
464
+ className: He,
517
465
  label: f
518
466
  },
519
467
  onChange: (e) => o(e ?? "")
520
468
  }),
521
- e.temperature && /* @__PURE__ */ H(E, {
469
+ e.temperature && /* @__PURE__ */ H(x, {
522
470
  labelProps: {
523
471
  label: m,
524
- className: q,
525
- caption: g
472
+ className: He,
473
+ caption: v
526
474
  },
527
475
  value: r,
528
476
  min: 0,
529
477
  max: 1,
530
478
  step: .1,
531
- labels: h,
479
+ labels: g,
532
480
  onChange: s
533
481
  })
534
482
  ]
535
- }), Ue = ({ isOpen: e, onBack: t, backLabel: n, onClose: r, closeLabel: i, style: a, features: o, initialResponseFormat: c, 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 }) => {
536
- let { responseFormat: w, systemPrompt: T, temperature: E, canSubmit: D, setResponseFormat: ee, setSystemPrompt: k, setTemperature: A, handleSubmit: te } = Ve({
483
+ }), We = ({ isOpen: e, onBack: t, backLabel: n, onClose: r, closeLabel: i, style: a, features: s, initialResponseFormat: c, 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: w }) => {
484
+ let { responseFormat: T, systemPrompt: E, temperature: D, canSubmit: O, setResponseFormat: A, setSystemPrompt: ee, setTemperature: te, handleSubmit: ne } = Ve({
537
485
  isOpen: e,
538
- features: o,
486
+ features: s,
539
487
  initialResponseFormat: c,
540
488
  initialSystemPrompt: l,
541
489
  initialTemperature: u,
@@ -550,14 +498,14 @@ var K = (e) => /* @__PURE__ */ H(x, { ...e }), Be = (e) => /* @__PURE__ */ H(p,
550
498
  onBack: t,
551
499
  backLabel: n,
552
500
  style: a,
553
- children: [/* @__PURE__ */ H(He, {
554
- features: o,
555
- responseFormat: w,
556
- systemPrompt: T,
557
- temperature: E,
558
- onResponseFormatChange: ee,
559
- onSystemPromptChange: k,
560
- onTemperatureChange: A,
501
+ children: [/* @__PURE__ */ H(Ue, {
502
+ features: s,
503
+ responseFormat: T,
504
+ systemPrompt: E,
505
+ temperature: D,
506
+ onResponseFormatChange: A,
507
+ onSystemPromptChange: ee,
508
+ onTemperatureChange: te,
561
509
  responseFormatLabel: p,
562
510
  responseFormatHint: m,
563
511
  responseFormatMarkdownLabel: h,
@@ -568,22 +516,22 @@ var K = (e) => /* @__PURE__ */ H(x, { ...e }), Be = (e) => /* @__PURE__ */ H(p,
568
516
  temperatureLabels: b,
569
517
  temperatureHint: x
570
518
  }), /* @__PURE__ */ H("div", {
571
- className: s("px-6 py-4 mobile:pb-8"),
572
- children: /* @__PURE__ */ H(O, {
573
- tooltip: C,
574
- hideTooltip: D || !C,
519
+ className: o("px-6 py-4 mobile:pb-8"),
520
+ children: /* @__PURE__ */ H(C, {
521
+ tooltip: w,
522
+ hideTooltip: O || !w,
575
523
  triggerClassName: "w-full",
576
- children: /* @__PURE__ */ H(K, {
524
+ children: /* @__PURE__ */ H(k, {
577
525
  label: S,
578
- onClick: te,
579
- disabled: !D,
526
+ onClick: ne,
527
+ disabled: !O,
580
528
  className: "w-full"
581
529
  })
582
530
  })
583
531
  })]
584
532
  });
585
- }, We = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", responseFormatLabel: s, responseFormatHint: c, responseFormatMarkdownLabel: l, responseFormatPlainTextLabel: u, systemPromptLabel: d, systemPromptTooltip: f, temperatureLabel: p, temperatureLabels: m, temperatureHint: h, saveLabel: g = "Apply changes", saveDisabledTooltip: _ }) => {
586
- let { responseFormat: v, systemPrompt: y, temperature: x, canSubmit: S, setResponseFormat: C, setSystemPrompt: w, setTemperature: T, handleSubmit: E } = Ve({
533
+ }, Ge = ({ features: e, initialResponseFormat: t, initialSystemPrompt: n, initialTemperature: r, onSave: i, onClose: a, title: o = "Chat settings", responseFormatLabel: s, responseFormatHint: c, responseFormatMarkdownLabel: l, responseFormatPlainTextLabel: u, systemPromptLabel: d, systemPromptTooltip: f, temperatureLabel: p, temperatureLabels: m, temperatureHint: h, saveLabel: _ = "Apply changes", saveDisabledTooltip: v }) => {
534
+ let { responseFormat: y, systemPrompt: b, temperature: x, canSubmit: S, setResponseFormat: w, setSystemPrompt: T, setTemperature: E, handleSubmit: D } = Ve({
587
535
  features: e,
588
536
  initialResponseFormat: t,
589
537
  initialSystemPrompt: n,
@@ -591,32 +539,32 @@ var K = (e) => /* @__PURE__ */ H(x, { ...e }), Be = (e) => /* @__PURE__ */ H(p,
591
539
  onSave: i,
592
540
  onClose: a
593
541
  });
594
- return /* @__PURE__ */ H(b, {
542
+ return /* @__PURE__ */ H(g, {
595
543
  open: !0,
596
544
  header: o,
597
- size: A.Sm,
545
+ size: O.Sm,
598
546
  onClose: a,
599
547
  className: "!bg-layer-2",
600
548
  footer: /* @__PURE__ */ H("div", {
601
549
  className: "flex justify-end px-6 py-4",
602
- children: /* @__PURE__ */ H(O, {
603
- tooltip: _,
604
- hideTooltip: S || !_,
605
- children: /* @__PURE__ */ H(K, {
606
- label: g,
607
- onClick: E,
550
+ children: /* @__PURE__ */ H(C, {
551
+ tooltip: v,
552
+ hideTooltip: S || !v,
553
+ children: /* @__PURE__ */ H(k, {
554
+ label: _,
555
+ onClick: D,
608
556
  disabled: !S
609
557
  })
610
558
  })
611
559
  }),
612
- children: /* @__PURE__ */ H(He, {
560
+ children: /* @__PURE__ */ H(Ue, {
613
561
  features: e,
614
- responseFormat: v,
615
- systemPrompt: y,
562
+ responseFormat: y,
563
+ systemPrompt: b,
616
564
  temperature: x,
617
- onResponseFormatChange: C,
618
- onSystemPromptChange: w,
619
- onTemperatureChange: T,
565
+ onResponseFormatChange: w,
566
+ onSystemPromptChange: T,
567
+ onTemperatureChange: E,
620
568
  responseFormatLabel: s,
621
569
  responseFormatHint: c,
622
570
  responseFormatMarkdownLabel: l,
@@ -629,75 +577,164 @@ var K = (e) => /* @__PURE__ */ H(x, { ...e }), Be = (e) => /* @__PURE__ */ H(p,
629
577
  })
630
578
  });
631
579
  };
632
- de(We);
580
+ F(Ge);
633
581
  //#endregion
634
- //#region src/components/AddAttachmentButton/AddAttachmentButton.tsx
635
- var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, menuCloseLabel: i, style: o, listClassName: u = "cp-dropdown-overlay !w-[240px]", isDisabled: d = !1, chatSettings: p, extraMenuItems: m }) => {
636
- let g = c(), [_, y] = B(!1), [b, x] = B(!1), S = R(() => [
582
+ //#region src/components/ToolsBottomSheet/ToolsBottomSheet.tsx
583
+ var Ke = ({ isOpen: e, onBack: t, backLabel: n = "Back", onClose: r, closeLabel: i = "Close", style: a, title: o = "Tools", items: s, onToolToggle: u }) => /* @__PURE__ */ H(W, {
584
+ isOpen: e,
585
+ title: o,
586
+ closeLabel: i,
587
+ onClose: r,
588
+ onBack: t,
589
+ backLabel: n,
590
+ style: a,
591
+ children: /* @__PURE__ */ H("ul", {
592
+ role: "menu",
593
+ className: "flex flex-col pb-4",
594
+ children: s.map((e) => /* @__PURE__ */ H("li", {
595
+ role: "none",
596
+ children: /* @__PURE__ */ H(l, {
597
+ type: "button",
598
+ role: "menuitemcheckbox",
599
+ "aria-checked": e.isSelected,
600
+ className: "w-full gap-3 px-4 py-[10px] text-start",
601
+ iconBefore: /* @__PURE__ */ H("span", {
602
+ className: "flex items-center text-secondary",
603
+ children: e.icon
604
+ }),
605
+ iconAfter: e.isSelected ? /* @__PURE__ */ H("span", {
606
+ className: "ms-auto text-accent-primary",
607
+ children: /* @__PURE__ */ H(ie, {
608
+ size: c,
609
+ "aria-hidden": !0
610
+ })
611
+ }) : null,
612
+ label: /* @__PURE__ */ H("span", {
613
+ className: "dial-small-text",
614
+ children: e.label
615
+ }),
616
+ onClick: () => u(e.id)
617
+ })
618
+ }, e.id))
619
+ })
620
+ }), qe = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, menuCloseLabel: a, style: o, listClassName: l = "cp-dropdown-overlay !w-[240px]", isDisabled: d = !1, chatSettings: p, extraMenuItems: m, toolsMenuItems: h = [], onToolToggle: g, toolsMenuTitle: _ = "Tools", toolsBackLabel: v = "Back" }) => {
621
+ let y = s(), [b, x] = B(!1), [S, C] = B(!1), [E, D] = B(!1), O = h.length > 0 && g != null, k = R(() => h.map((e) => ({
622
+ key: e.id,
623
+ label: /* @__PURE__ */ U("span", {
624
+ className: "flex flex-1 items-center gap-2",
625
+ children: [/* @__PURE__ */ H("span", {
626
+ className: "flex-1",
627
+ children: e.label
628
+ }), e.isSelected && /* @__PURE__ */ H(ie, {
629
+ size: c,
630
+ className: "text-accent",
631
+ "aria-hidden": !0
632
+ })]
633
+ }),
634
+ icon: /* @__PURE__ */ H("span", {
635
+ className: "flex items-center text-secondary",
636
+ children: e.icon
637
+ }),
638
+ onClick: () => g?.(e.id)
639
+ })), [h, g]), A = R(() => [
637
640
  ...e == null ? [] : [{
638
641
  key: "attach",
639
642
  label: t,
640
- icon: /* @__PURE__ */ H(oe, {
641
- size: l,
643
+ icon: /* @__PURE__ */ H(se, {
644
+ size: c,
642
645
  "aria-hidden": !0
643
646
  }),
644
647
  onClick: e
645
648
  }],
646
649
  ...m ?? [],
650
+ ...O ? [{
651
+ key: "tools",
652
+ label: _,
653
+ icon: /* @__PURE__ */ H(de, {
654
+ size: c,
655
+ "aria-hidden": !0
656
+ }),
657
+ onClick: y ? () => {
658
+ D(!0), x(!1);
659
+ } : () => void 0,
660
+ ...y ? { iconAfter: /* @__PURE__ */ H(M, {
661
+ size: c,
662
+ stroke: 1.5,
663
+ className: "text-secondary rtl:scale-x-[-1]",
664
+ "aria-hidden": !0
665
+ }) } : { children: k }
666
+ }] : [],
647
667
  ...p == null ? [] : [{
648
668
  key: "chat-settings",
649
669
  label: p.menuItemLabel ?? "Chat settings",
650
- icon: /* @__PURE__ */ H(ce, {
651
- size: l,
670
+ icon: /* @__PURE__ */ H(ue, {
671
+ size: c,
652
672
  "aria-hidden": !0
653
673
  }),
654
- iconAfter: g ? /* @__PURE__ */ H(re, {
655
- size: l,
674
+ iconAfter: y ? /* @__PURE__ */ H(M, {
675
+ size: c,
656
676
  stroke: 1.5,
657
677
  className: "text-secondary rtl:scale-x-[-1]",
658
678
  "aria-hidden": !0
659
679
  }) : null,
660
- onClick: () => x(!0)
680
+ onClick: () => C(!0)
661
681
  }]
662
682
  ], [
663
683
  t,
664
684
  e,
665
685
  p,
666
686
  m,
667
- g
687
+ y,
688
+ O,
689
+ _,
690
+ k
668
691
  ]);
669
- return S.length === 0 ? null : /* @__PURE__ */ H(V, { children: g ? /* @__PURE__ */ U(V, { children: [
670
- /* @__PURE__ */ H(v, {
671
- icon: /* @__PURE__ */ H(P, {
672
- size: f.LG,
692
+ return A.length === 0 ? null : /* @__PURE__ */ H(V, { children: y ? /* @__PURE__ */ U(V, { children: [
693
+ /* @__PURE__ */ H(T, {
694
+ icon: /* @__PURE__ */ H(N, {
695
+ size: u.LG,
673
696
  "aria-hidden": !0
674
697
  }),
675
698
  "aria-label": n,
699
+ size: w.Large,
676
700
  tooltipProps: { tooltip: n },
677
- className: s("size-10 flex-shrink-0", d && "pointer-events-none opacity-50"),
678
- onClick: () => y(!0)
701
+ disabled: d,
702
+ onClick: () => x(!0)
679
703
  }),
680
- /* @__PURE__ */ H(Re, {
681
- isOpen: _,
704
+ /* @__PURE__ */ H(Be, {
705
+ isOpen: b,
682
706
  title: r,
683
- closeLabel: i,
684
- onClose: () => y(!1),
707
+ closeLabel: a,
708
+ onClose: () => x(!1),
685
709
  style: o,
686
- items: S,
710
+ items: A,
687
711
  className: "pb-4",
688
712
  btnTextClassName: "flex-1"
689
713
  }),
690
- p != null && /* @__PURE__ */ H(Ue, {
691
- isOpen: b,
714
+ O && /* @__PURE__ */ H(Ke, {
715
+ isOpen: E,
716
+ onBack: () => {
717
+ D(!1), x(!0);
718
+ },
719
+ backLabel: v,
720
+ onClose: () => D(!1),
721
+ closeLabel: a,
722
+ style: o,
723
+ title: _,
724
+ items: h,
725
+ onToolToggle: g
726
+ }),
727
+ p != null && /* @__PURE__ */ H(We, {
728
+ isOpen: S,
692
729
  onBack: () => {
693
- x(!1), y(!0);
730
+ C(!1), x(!0);
694
731
  },
695
732
  backLabel: p.backLabel ?? "Back",
696
- onClose: () => x(!1),
697
- closeLabel: i,
733
+ onClose: () => C(!1),
734
+ closeLabel: a,
698
735
  style: o,
699
736
  features: p.features,
700
- initialResponseFormat: p.responseFormat ?? a.Markdown,
737
+ initialResponseFormat: p.responseFormat ?? i.Markdown,
701
738
  initialSystemPrompt: p.systemPrompt,
702
739
  initialTemperature: p.temperature,
703
740
  onSave: p.onSave,
@@ -714,28 +751,27 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
714
751
  saveLabel: p.saveLabel,
715
752
  saveDisabledTooltip: p.saveDisabledTooltip
716
753
  })
717
- ] }) : /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H(h, {
754
+ ] }) : /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H(f, {
718
755
  matchReferenceWidth: !1,
719
756
  placement: "bottom-start",
720
- listClassName: u,
721
- items: S,
722
- children: /* @__PURE__ */ H(v, {
723
- icon: /* @__PURE__ */ H(P, {
724
- size: f.LG,
757
+ listClassName: l,
758
+ items: A,
759
+ children: /* @__PURE__ */ H(T, {
760
+ icon: /* @__PURE__ */ H(N, {
761
+ size: u.LG,
725
762
  "aria-hidden": !0
726
763
  }),
727
764
  "aria-label": n,
728
765
  tooltipProps: { tooltip: n },
729
- className: "size-10 flex-shrink-0",
730
766
  disabled: d
731
767
  })
732
- }), p != null && b && /* @__PURE__ */ H(We, {
768
+ }), p != null && S && /* @__PURE__ */ H(Ge, {
733
769
  features: p.features,
734
- initialResponseFormat: p.responseFormat ?? a.Markdown,
770
+ initialResponseFormat: p.responseFormat ?? i.Markdown,
735
771
  initialSystemPrompt: p.systemPrompt,
736
772
  initialTemperature: p.temperature,
737
773
  onSave: p.onSave,
738
- onClose: () => x(!1),
774
+ onClose: () => C(!1),
739
775
  title: p.title,
740
776
  responseFormatLabel: p.responseFormatLabel,
741
777
  responseFormatHint: p.responseFormatHint,
@@ -749,162 +785,251 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
749
785
  saveLabel: p.saveLabel,
750
786
  saveDisabledTooltip: p.saveDisabledTooltip
751
787
  })] }) });
752
- }, J = {
753
- container: "_container_9pzud_1",
754
- containerError: "_containerError_9pzud_14",
755
- waveformCanvas: "_waveformCanvas_9pzud_18",
756
- recordingDot: "_recordingDot_9pzud_22",
757
- micRecordingIcon: "_micRecordingIcon_9pzud_26"
758
- }, Ke = 3, qe = 6, Je = .12, Ye = ({ state: e, waveformData: t, errorMessage: n, onStop: r, onConfirm: i, onDiscard: a, stopLabel: o = "Stop recording", confirmLabel: c = "Send voice message", discardLabel: l = "Discard recording", uploadingLabel: u = "Uploading…", style: d, className: p }) => {
759
- let m = z(null), h = z(null), g = z(!1), y = e === Me.Recording, b = e === Me.Uploading, x = e === Me.Error;
760
- g.current = y;
761
- let S = I((e, t) => {
762
- let n = e.getContext("2d");
763
- if (!n) return;
764
- e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
765
- let { width: r, height: i } = e;
766
- n.clearRect(0, 0, r, i), n.fillStyle = getComputedStyle(e).color;
767
- let a = Math.min(1, t * 6), o = Math.max(1, Math.floor(r / 4));
768
- for (let e = 0; e < o; e++) {
769
- let t = e / o * qe * Math.PI, r = Math.max(Je, Math.abs(Math.sin(t)) * a), s = Math.max(3, r * i);
770
- n.fillRect(e * 4, (i - s) / 2, Ke, s);
771
- }
772
- }, []), C = I((e, t) => {
773
- let n = e.getContext("2d");
774
- if (!n) return;
788
+ }, G = {
789
+ chip: "_chip_1gvzk_1",
790
+ chipIcon: "_chipIcon_1gvzk_6",
791
+ chipText: "_chipText_1gvzk_10",
792
+ chipClose: "_chipClose_1gvzk_14"
793
+ }, Je = (e) => `${e} tool${e === 1 ? "" : "s"}`, Ye = (e) => `Remove ${e}`, Xe = ({ items: e, onToolToggle: t, isMobile: n, countLabel: r = Je, removeLabel: i = Ye, typography: s, colors: l }) => {
794
+ let u = e.filter((e) => e.isSelected);
795
+ if (u.length === 0) return null;
796
+ let d = a({
797
+ "--ci-chip-bg": l?.chipBg,
798
+ "--ci-chip-border": l?.chipBorder,
799
+ "--ci-chip-icon": l?.chipIcon,
800
+ "--ci-chip-text": l?.chipText,
801
+ "--ci-chip-close": l?.chipClose,
802
+ "--ci-chip-close-hover": l?.chipCloseHover
803
+ });
804
+ if (n) {
805
+ let e = u.length === 1 ? u[0].icon : /* @__PURE__ */ H(de, {
806
+ size: c,
807
+ "aria-hidden": !0
808
+ });
809
+ return /* @__PURE__ */ H("div", {
810
+ className: "flex flex-wrap items-center gap-2",
811
+ style: d,
812
+ children: /* @__PURE__ */ U("div", {
813
+ className: o(G.chip, "flex items-center gap-1.5 rounded-full border px-2 py-1"),
814
+ children: [/* @__PURE__ */ H("span", {
815
+ className: G.chipIcon,
816
+ "aria-hidden": !0,
817
+ children: e
818
+ }), /* @__PURE__ */ H("span", {
819
+ className: o(G.chipText, s?.fontClassName || "dial-small-paragraph-text"),
820
+ children: r(u.length)
821
+ })]
822
+ })
823
+ });
824
+ }
825
+ return /* @__PURE__ */ H("div", {
826
+ className: "flex flex-wrap items-center gap-2",
827
+ style: d,
828
+ children: u.map((e) => /* @__PURE__ */ U("div", {
829
+ className: o(G.chip, "flex items-center gap-1.5 rounded-full border py-1 pe-1 ps-2"),
830
+ children: [
831
+ /* @__PURE__ */ H("span", {
832
+ className: G.chipIcon,
833
+ "aria-hidden": !0,
834
+ children: e.icon
835
+ }),
836
+ /* @__PURE__ */ H("span", {
837
+ className: o(G.chipText, s?.fontClassName || "dial-small-paragraph-text"),
838
+ children: e.label
839
+ }),
840
+ /* @__PURE__ */ H("button", {
841
+ type: "button",
842
+ onClick: () => t(e.id),
843
+ className: o(G.chipClose, "flex items-center rounded p-0.5 transition-colors"),
844
+ "aria-label": i(e.label),
845
+ children: /* @__PURE__ */ H(fe, {
846
+ size: 12,
847
+ "aria-hidden": !0
848
+ })
849
+ })
850
+ ]
851
+ }, e.id))
852
+ });
853
+ }, K = {
854
+ wrapper: "_wrapper_4e8i8_1",
855
+ wrapperDisabled: "_wrapperDisabled_4e8i8_8",
856
+ textarea: "_textarea_4e8i8_13",
857
+ modelSelectorButton: "_modelSelectorButton_4e8i8_24",
858
+ modelSelectorCaret: "_modelSelectorCaret_4e8i8_24",
859
+ modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_4e8i8_33"
860
+ }, q = {
861
+ wrapperError: "_wrapperError_5wiyg_1",
862
+ waveformCanvas: "_waveformCanvas_5wiyg_5",
863
+ timer: "_timer_5wiyg_9",
864
+ stopRecordingIcon: "_stopRecordingIcon_5wiyg_15",
865
+ recordingDot: "_recordingDot_5wiyg_29",
866
+ "recording-pulse": "_recording-pulse_5wiyg_1"
867
+ }, J = 3, Ze = 4, Y = 200, X = (e) => `${String(Math.floor(e / 60)).padStart(2, "0")}:${String(e % 60).padStart(2, "0")}`, Qe = ({ state: e, analyserNodeRef: t, elapsedSeconds: n, errorMessage: r, onStop: i, onDiscard: a, stopLabel: s = "Stop recording", discardLabel: c = "Discard recording", timerLabel: l = "Recording time", style: d, className: f }) => {
868
+ let p = z(null), h = z(new Float32Array(Y)), g = z(0), _ = z(0), v = e === Pe.Recording, y = e === Pe.Error, b = I((e) => {
869
+ let t = e.getContext("2d");
870
+ if (!t) return;
775
871
  e.width = e.clientWidth || 200, e.height = e.clientHeight || 32;
776
- let { width: r, height: i } = e;
777
- if (n.clearRect(0, 0, r, i), !t || t.length === 0) return;
778
- n.fillStyle = getComputedStyle(e).color;
779
- let a = Math.max(1, Math.floor(r / 4));
780
- for (let e = 0; e < a; e++) {
781
- let r = t[Math.floor(e / a * t.length)] ?? 0, o = Math.min(1, r * 6), s = Math.max(3, o * i);
782
- n.fillRect(e * 4, (i - s) / 2, Ke, s);
872
+ let { width: n, height: r } = e;
873
+ t.clearRect(0, 0, n, r), t.fillStyle = getComputedStyle(e).color;
874
+ let i = Math.min(Math.max(1, Math.floor(n / Ze)), Y - 1), a = g.current, o = _.current;
875
+ t.save(), t.beginPath(), t.rect(0, 0, n, r), t.clip(), t.translate(-o, 0);
876
+ for (let e = 0; e <= i; e++) {
877
+ let n = ((a - i + e) % Y + Y) % Y, o = h.current[n] ?? 0, s = Math.min(1, o * 6), c = Math.max(3, s * r);
878
+ t.fillRect(e * Ze, (r - c) / 2, J, c);
783
879
  }
880
+ t.restore();
784
881
  }, []);
785
882
  L(() => {
786
- h.current = t;
787
- let e = m.current;
788
- e && (g.current ? S(e, t?.[t.length - 1] ?? 0) : C(e, t));
883
+ if (!v) return;
884
+ let e = p.current;
885
+ if (!e) return;
886
+ h.current.fill(0), g.current = 0, _.current = 0;
887
+ let n, r = () => {
888
+ if (_.current += 1, _.current >= Ze) {
889
+ _.current -= Ze;
890
+ let e = t.current;
891
+ if (e) {
892
+ let t = new Uint8Array(e.frequencyBinCount);
893
+ e.getByteTimeDomainData(t);
894
+ let n = 0;
895
+ for (let e = 0; e < t.length; e++) {
896
+ let r = (t[e] - 128) / 128;
897
+ n += r * r;
898
+ }
899
+ h.current[g.current % Y] = Math.sqrt(n / t.length), g.current++;
900
+ }
901
+ }
902
+ b(e), n = requestAnimationFrame(r);
903
+ };
904
+ return n = requestAnimationFrame(r), () => {
905
+ cancelAnimationFrame(n);
906
+ };
789
907
  }, [
908
+ v,
790
909
  t,
791
- S,
792
- C
910
+ b
793
911
  ]), L(() => {
794
- let e = m.current;
912
+ let e = p.current;
795
913
  if (!e) return;
796
914
  let t = new ResizeObserver(() => {
797
- if (g.current) {
798
- let t = h.current;
799
- S(e, t?.[t.length - 1] ?? 0);
800
- } else C(e, h.current);
915
+ b(e);
801
916
  });
802
917
  return t.observe(e), () => t.disconnect();
803
- }, [S, C]);
804
- let w = /* @__PURE__ */ H("div", {
918
+ }, [b]);
919
+ let x = /* @__PURE__ */ U("div", {
805
920
  className: "flex flex-shrink-0 items-center justify-end gap-1",
806
- children: y ? /* @__PURE__ */ H(v, {
807
- icon: /* @__PURE__ */ H(se, {
808
- size: f.LG,
809
- className: J.micRecordingIcon,
921
+ children: [/* @__PURE__ */ H(T, {
922
+ icon: /* @__PURE__ */ H(fe, {
923
+ size: u.LG,
810
924
  "aria-hidden": !0
811
925
  }),
812
- "aria-label": o,
813
- className: "size-10 flex-shrink-0",
814
- onClick: r
815
- }) : /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H(v, {
816
- icon: /* @__PURE__ */ H(le, {
817
- size: f.LG,
818
- "aria-hidden": !0
819
- }),
820
- "aria-label": l,
821
- className: "size-10 flex-shrink-0",
822
- onClick: a
823
- }), b ? /* @__PURE__ */ H(D, {
824
- fullWidth: !1,
825
- size: f.LG,
826
- ariaLabel: u,
827
- className: "flex size-10 flex-shrink-0 items-center justify-center"
828
- }) : /* @__PURE__ */ H(v, {
829
- icon: /* @__PURE__ */ H("div", {
830
- className: "flex size-8 items-center justify-center rounded-full bg-controls-accent-primary",
831
- children: /* @__PURE__ */ H(M, {
832
- size: 24,
833
- "aria-hidden": !0,
834
- className: "rounded-full bg-controls-accent-primary text-control-permanent"
835
- })
836
- }),
837
926
  "aria-label": c,
838
- className: "size-10 flex-shrink-0",
839
- onClick: i
840
- })] })
927
+ onClick: a
928
+ }), v && /* @__PURE__ */ H(A, {
929
+ icon: /* @__PURE__ */ H(ce, { size: u.LG }),
930
+ onClick: () => i?.(),
931
+ "aria-label": s
932
+ })]
841
933
  });
842
934
  return /* @__PURE__ */ U("div", {
843
- className: p,
935
+ className: f,
844
936
  children: [/* @__PURE__ */ U("div", {
845
937
  style: d,
846
- className: s(J.container, "flex min-h-[56px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border px-3 desktop:flex-row desktop:items-center desktop:gap-2 desktop:py-2", x && J.containerError),
938
+ className: o(K.wrapper, "flex min-h-[64px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border px-3 shadow-md desktop:flex-row desktop:items-center desktop:gap-2 desktop:py-2", y && q.wrapperError),
847
939
  children: [/* @__PURE__ */ U("div", {
848
- className: "flex min-w-0 flex-1 items-center gap-2",
849
- children: [y && /* @__PURE__ */ H("span", {
850
- className: s(J.recordingDot, "size-2 flex-shrink-0 rounded-full"),
940
+ className: "flex min-w-0 flex-1 items-center gap-3",
941
+ children: [v && /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("span", {
942
+ className: o(q.recordingDot, "pointer-events-none block size-[8px] rounded-3xl"),
851
943
  "aria-hidden": !0
852
- }), /* @__PURE__ */ H("canvas", {
853
- ref: m,
944
+ }), /* @__PURE__ */ H("span", {
945
+ className: o(q.timer, "flex-shrink-0"),
946
+ "aria-label": l,
947
+ children: X(n)
948
+ })] }), /* @__PURE__ */ H("canvas", {
949
+ ref: p,
854
950
  height: 32,
855
- className: s(J.waveformCanvas, "h-8 min-w-0 flex-1 desktop:h-6")
951
+ className: o(q.waveformCanvas, "h-8 min-w-0 flex-1 desktop:h-6")
856
952
  })]
857
- }), w]
858
- }), x && n && /* @__PURE__ */ H(_, {
859
- text: n,
953
+ }), x]
954
+ }), y && r && /* @__PURE__ */ H(m, {
955
+ text: r,
860
956
  className: "mt-1 px-1"
861
957
  })]
862
958
  });
863
- }, Y = {
864
- wrapper: "_wrapper_1q2nu_2",
865
- wrapperDisabled: "_wrapperDisabled_1q2nu_15",
866
- textarea: "_textarea_1q2nu_20",
867
- stopIcon: "_stopIcon_1q2nu_34",
868
- modelSelectorButton: "_modelSelectorButton_1q2nu_38",
869
- modelSelectorCaret: "_modelSelectorCaret_1q2nu_38",
870
- modelSelectorButtonDisabled: "_modelSelectorButtonDisabled_1q2nu_44",
871
- sendButton: "_sendButton_1q2nu_55",
872
- sendButtonEnter: "_sendButtonEnter_1q2nu_1",
873
- sendButtonExiting: "_sendButtonExiting_1q2nu_55",
874
- sendButtonExit: "_sendButtonExit_1q2nu_55"
875
- }, Xe = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", title: r, isExiting: i = !1 }) => /* @__PURE__ */ H(O, {
876
- tooltip: r,
877
- hideTooltip: !r,
878
- children: /* @__PURE__ */ H("button", {
879
- className: s("flex size-[32px] cursor-pointer items-center justify-center rounded-full disabled:cursor-not-allowed", Y.sendButton, i && Y.sendButtonExiting),
880
- "aria-label": n,
881
- onClick: () => e?.(),
882
- type: "button",
883
- disabled: t,
884
- "aria-hidden": i,
885
- children: /* @__PURE__ */ H(j, {
886
- size: f.LG,
887
- className: "rtl:scale-x-[-1]"
888
- })
889
- })
890
- }), Ze = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ H("button", {
891
- className: s("flex cursor-pointer items-center justify-center disabled:cursor-not-allowed"),
892
- "aria-label": t,
959
+ }, $e = ({ onSend: e, isDisabled: t = !1, ariaLabel: n = "Send message", isExiting: r = !1 }) => /* @__PURE__ */ H(A, {
960
+ "aria-label": n,
893
961
  onClick: () => e?.(),
894
- type: "button",
895
- children: /* @__PURE__ */ H(se, {
896
- size: f.LG,
897
- className: Y.stopIcon
962
+ disabled: t,
963
+ "aria-hidden": r,
964
+ icon: /* @__PURE__ */ H(re, {
965
+ size: u.LG,
966
+ className: "rtl:scale-x-[-1]"
898
967
  })
899
- }), Qe = ({ size: e = 20 }) => /* @__PURE__ */ H(w, {
900
- variant: T.Circular,
968
+ }), et = ({ onStop: e, ariaLabel: t = "Stop streaming" }) => /* @__PURE__ */ H(te, {
969
+ icon: /* @__PURE__ */ H(le, { size: u.LG }),
970
+ onClick: () => e?.(),
971
+ "aria-label": t
972
+ }), tt = ({ gradientId: e = "gradient-check-icon" }) => /* @__PURE__ */ U("svg", {
973
+ width: u.SM,
974
+ height: u.SM,
975
+ viewBox: "0 0 24 24",
976
+ fill: "none",
977
+ "aria-hidden": !0,
978
+ children: [/* @__PURE__ */ H("defs", { children: /* @__PURE__ */ U("linearGradient", {
979
+ id: e,
980
+ x1: "0",
981
+ y1: "0",
982
+ x2: "24",
983
+ y2: "24",
984
+ gradientUnits: "userSpaceOnUse",
985
+ children: [/* @__PURE__ */ H("stop", {
986
+ offset: "0%",
987
+ stopColor: "#4b7be6"
988
+ }), /* @__PURE__ */ H("stop", {
989
+ offset: "100%",
990
+ stopColor: "#9355f4"
991
+ })]
992
+ }) }), /* @__PURE__ */ H("path", {
993
+ d: "M5 12l5 5L20 7",
994
+ stroke: `url(#${e})`,
995
+ strokeWidth: "2",
996
+ strokeLinecap: "round",
997
+ strokeLinejoin: "round"
998
+ })]
999
+ }), nt = {
1000
+ tabContainer: "_tabContainer_153ct_1",
1001
+ tabActive: "_tabActive_153ct_13"
1002
+ };
1003
+ F(({ tabs: e, activeTabId: t, onTabChange: n, styles: r }) => {
1004
+ let { tabClassName: i = "dial-tiny-semi-text" } = r?.typography ?? {};
1005
+ return /* @__PURE__ */ H("div", {
1006
+ className: "flex flex-nowrap gap-1",
1007
+ role: "tablist",
1008
+ children: e.map((e) => {
1009
+ let r = t === e.id;
1010
+ return /* @__PURE__ */ H("div", {
1011
+ role: "tab",
1012
+ "aria-selected": r,
1013
+ className: "contents",
1014
+ children: /* @__PURE__ */ H(S, {
1015
+ label: e.label,
1016
+ selected: r,
1017
+ onClick: () => n(e.id),
1018
+ className: o("box-border h-auto shrink-0 justify-center rounded-full p-2 text-center", i, nt.tabContainer, r && nt.tabActive)
1019
+ })
1020
+ }, e.id);
1021
+ })
1022
+ });
1023
+ });
1024
+ var rt = ({ size: e = 20 }) => /* @__PURE__ */ H(y, {
1025
+ variant: b.Circular,
901
1026
  width: e,
902
1027
  height: e,
903
1028
  active: !0
904
- }), $e = ({ loadingLabel: e }) => /* @__PURE__ */ U("span", {
1029
+ }), it = ({ loadingLabel: e }) => /* @__PURE__ */ U("span", {
905
1030
  className: "flex min-w-0 flex-1 items-center",
906
- children: [/* @__PURE__ */ H(w, {
907
- variant: T.Text,
1031
+ children: [/* @__PURE__ */ H(y, {
1032
+ variant: b.Text,
908
1033
  width: "100%",
909
1034
  height: 16,
910
1035
  active: !0
@@ -912,90 +1037,90 @@ var Ge = ({ onAttachClick: e, attachLabel: t, addMenuTitle: n, menuTitle: r, men
912
1037
  className: "sr-only",
913
1038
  children: e
914
1039
  })]
915
- }), et = ({ loadingLabel: e }) => /* @__PURE__ */ H("div", {
1040
+ }), at = ({ loadingLabel: e }) => /* @__PURE__ */ H("div", {
916
1041
  role: "status",
917
1042
  "aria-label": e,
918
1043
  children: Array.from({ length: 7 }).map((e, t) => /* @__PURE__ */ U("div", {
919
1044
  className: "flex h-11 items-center gap-3 px-4",
920
1045
  "aria-hidden": "true",
921
- children: [/* @__PURE__ */ H(Qe, {}), /* @__PURE__ */ H($e, {})]
1046
+ children: [/* @__PURE__ */ H(rt, {}), /* @__PURE__ */ H(it, {})]
922
1047
  }, t))
923
- }), tt = (e) => e.displayName ?? e.id, nt = (e, t) => {
1048
+ }), ot = (e) => e.displayName ?? e.id, st = (e, t) => {
924
1049
  let n = t.trim().toLowerCase();
925
- return n ? e.filter((e) => tt(e).toLowerCase().includes(n)) : e;
926
- }, rt = (e, t, r, i = 18, a) => /* @__PURE__ */ H(n, {
1050
+ return n ? e.filter((e) => ot(e).toLowerCase().includes(n)) : e;
1051
+ }, ct = (e, t, r, i = 18, a) => /* @__PURE__ */ H(n, {
927
1052
  src: e,
928
1053
  size: i,
929
1054
  labels: { tooltip: a },
930
1055
  initialsName: r
931
- }), it = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: i, searchHeaderClassName: a = "bg-layer-0" }) => {
932
- let [o, c] = B(""), l = R(() => e?.find((e) => e.id === t), [e, t]), u = i?.loading !== void 0, d = R(() => u ? /* @__PURE__ */ H(Qe, { size: f.LG }) : rt(l?.iconUrl, l?.type, l?.displayName ?? l?.id ?? "", f.LG), [u, l]), p = l?.displayName ?? l?.id;
1056
+ }), lt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, searchHeaderClassName: i = "bg-layer-0" }) => {
1057
+ let [a, s] = B(""), c = R(() => e?.find((e) => e.id === t), [e, t]), l = r?.loading !== void 0, d = R(() => l ? /* @__PURE__ */ H(rt, { size: u.LG }) : ct(c?.iconUrl, c?.type, c?.displayName ?? c?.id ?? "", u.LG), [l, c]), f = c?.displayName ?? c?.id;
933
1058
  return {
934
1059
  selectorIcon: d,
935
- selectorAriaLabel: p ? `${i?.ariaLabel ?? "Select model"}: ${p}` : i?.ariaLabel ?? "Select model",
936
- selectedLabel: p,
1060
+ selectorAriaLabel: f ? `${r?.ariaLabel ?? "Select model"}: ${f}` : r?.ariaLabel ?? "Select model",
1061
+ selectedLabel: f,
937
1062
  menuItems: R(() => {
938
- if (u) return Array.from({ length: 7 }, (e, t) => ({
1063
+ if (l) return Array.from({ length: 7 }, (e, t) => ({
939
1064
  key: `__loading-${t}`,
940
- icon: /* @__PURE__ */ H(Qe, {}),
941
- label: /* @__PURE__ */ H($e, { loadingLabel: t === 0 ? i?.loading : void 0 }),
1065
+ icon: /* @__PURE__ */ H(rt, {}),
1066
+ label: /* @__PURE__ */ H(it, { loadingLabel: t === 0 ? r?.loading : void 0 }),
942
1067
  disabled: !0
943
1068
  }));
944
1069
  if (!e || e.length === 0) {
945
- let e = i?.error ?? i?.empty;
1070
+ let e = r?.error ?? r?.empty;
946
1071
  return e ? [{
947
1072
  key: "__state",
948
1073
  label: e,
949
1074
  disabled: !0
950
1075
  }] : [];
951
1076
  }
952
- return nt(e, o).map((e) => {
953
- let i = e.id === t;
1077
+ return st(e, a).map((e) => {
1078
+ let r = e.id === t;
954
1079
  return {
955
1080
  key: e.id,
956
1081
  label: /* @__PURE__ */ U("span", {
957
1082
  className: "flex w-full items-center justify-between gap-2",
958
- children: [/* @__PURE__ */ H(r, {
959
- text: tt(e),
960
- query: o,
1083
+ children: [/* @__PURE__ */ H(E, {
1084
+ text: ot(e),
1085
+ query: a,
961
1086
  maxLines: 1
962
- }), i && /* @__PURE__ */ H(ze, { gradientId: "ms-check-grad" })]
1087
+ }), r && /* @__PURE__ */ H(tt, { gradientId: "ms-check-grad" })]
963
1088
  }),
964
- icon: rt(e.iconUrl, e.type, e.displayName ?? e.id),
1089
+ icon: ct(e.iconUrl, e.type, e.displayName ?? e.id),
965
1090
  onClick: () => n?.(e.id),
966
- className: i ? "bg-accent-primary-alpha" : void 0
1091
+ className: r ? "bg-accent-primary-alpha" : void 0
967
1092
  };
968
1093
  });
969
1094
  }, [
970
1095
  e,
971
- u,
972
- o,
1096
+ l,
1097
+ a,
973
1098
  t,
974
- i,
1099
+ r,
975
1100
  n
976
1101
  ]),
977
- menuHeader: R(() => !u && e && e.length > 0 ? /* @__PURE__ */ H("div", {
978
- className: s("sticky top-0 z-10 pb-1 pe-2 pt-2", a),
979
- children: /* @__PURE__ */ H(C, {
980
- value: o,
981
- placeholder: i?.searchPlaceholder ?? "Search",
982
- size: k.Small,
1102
+ menuHeader: R(() => !l && e && e.length > 0 ? /* @__PURE__ */ H("div", {
1103
+ className: o("sticky top-0 z-10 pb-1 pe-2 pt-2", i),
1104
+ children: /* @__PURE__ */ H(v, {
1105
+ value: a,
1106
+ placeholder: r?.searchPlaceholder ?? "Search",
1107
+ size: w.Small,
983
1108
  wrapperClassName: "border-0",
984
- onChange: c
1109
+ onChange: s
985
1110
  })
986
1111
  }) : void 0, [
987
1112
  e,
988
- u,
989
- o,
990
- i,
991
- a
1113
+ l,
1114
+ a,
1115
+ r,
1116
+ i
992
1117
  ]),
993
1118
  onOpenChange: (e) => {
994
- e || c("");
1119
+ e || s("");
995
1120
  }
996
1121
  };
997
- }, X = typeof window < "u" ? pe : L;
998
- function at(e) {
1122
+ }, ut = typeof window < "u" ? he : L;
1123
+ function dt(e) {
999
1124
  if (e !== void 0) switch (typeof e) {
1000
1125
  case "number": return e;
1001
1126
  case "string":
@@ -1003,15 +1128,15 @@ function at(e) {
1003
1128
  break;
1004
1129
  }
1005
1130
  }
1006
- function ot({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
1131
+ function ft({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i, mode: a, style: o }) {
1007
1132
  let { styleHeight: s, styleWidth: c } = R(() => ({
1008
- styleHeight: at(o?.height),
1009
- styleWidth: at(o?.width)
1133
+ styleHeight: dt(o?.height),
1134
+ styleWidth: dt(o?.width)
1010
1135
  }), [o?.height, o?.width]), [l, u] = B({
1011
1136
  height: t,
1012
1137
  width: n
1013
1138
  }), d = r || a === "only-height" && s !== void 0 || a === "only-width" && c !== void 0 || s !== void 0 && c !== void 0;
1014
- return X(() => {
1139
+ return ut(() => {
1015
1140
  if (i === null || d) return;
1016
1141
  let t = new ResizeObserver((e) => {
1017
1142
  for (let t of e) {
@@ -1040,26 +1165,26 @@ function ot({ box: e, defaultHeight: t, defaultWidth: n, disabled: r, element: i
1040
1165
  c
1041
1166
  ]);
1042
1167
  }
1043
- function st(e) {
1168
+ function pt(e) {
1044
1169
  let t = z(() => {
1045
1170
  throw Error("Cannot call during render.");
1046
1171
  });
1047
- return X(() => {
1172
+ return ut(() => {
1048
1173
  t.current = e;
1049
1174
  }, [e]), I((e) => t.current?.(e), [t]);
1050
1175
  }
1051
- var Z = null;
1052
- function ct(e = !1) {
1053
- if (Z === null || e) {
1176
+ var mt = null;
1177
+ function ht(e = !1) {
1178
+ if (mt === null || e) {
1054
1179
  let e = document.createElement("div"), t = e.style;
1055
1180
  t.width = "50px", t.height = "50px", t.overflow = "scroll", t.direction = "rtl";
1056
1181
  let n = document.createElement("div"), r = n.style;
1057
- return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? Z = "positive-descending" : (e.scrollLeft = 1, Z = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), Z;
1182
+ return r.width = "100px", r.height = "100px", e.appendChild(n), document.body.appendChild(e), e.scrollLeft > 0 ? mt = "positive-descending" : (e.scrollLeft = 1, mt = e.scrollLeft === 0 ? "negative" : "positive-ascending"), document.body.removeChild(e), mt;
1058
1183
  }
1059
- return Z;
1184
+ return mt;
1060
1185
  }
1061
- function lt({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
1062
- if (t === "horizontal" && n) switch (ct()) {
1186
+ function gt({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
1187
+ if (t === "horizontal" && n) switch (ht()) {
1063
1188
  case "negative": return -r;
1064
1189
  case "positive-descending":
1065
1190
  if (e) {
@@ -1070,26 +1195,26 @@ function lt({ containerElement: e, direction: t, isRtl: n, scrollOffset: r }) {
1070
1195
  }
1071
1196
  return r;
1072
1197
  }
1073
- function Q(e, t = "Assertion error") {
1198
+ function Z(e, t = "Assertion error") {
1074
1199
  if (!e) throw console.error(t), Error(t);
1075
1200
  }
1076
- function $(e, t) {
1201
+ function _t(e, t) {
1077
1202
  if (e === t) return !0;
1078
- if (!!e != !!t || (Q(e !== void 0), Q(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
1203
+ if (!!e != !!t || (Z(e !== void 0), Z(t !== void 0), Object.keys(e).length !== Object.keys(t).length)) return !1;
1079
1204
  for (let n in e) if (!Object.is(t[n], e[n])) return !1;
1080
1205
  return !0;
1081
1206
  }
1082
- function ut({ cachedBounds: e, itemCount: t, itemSize: n }) {
1207
+ function vt({ cachedBounds: e, itemCount: t, itemSize: n }) {
1083
1208
  if (t === 0) return 0;
1084
1209
  if (typeof n == "number") return t * n;
1085
1210
  {
1086
1211
  let n = e.get(e.size === 0 ? 0 : e.size - 1);
1087
- return Q(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
1212
+ return Z(n !== void 0, "Unexpected bounds cache miss"), t * ((n.scrollOffset + n.size) / e.size);
1088
1213
  }
1089
1214
  }
1090
- function dt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
1215
+ function yt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, containerScrollOffset: a, containerSize: o }) {
1091
1216
  if (n < 0 || n >= r) throw RangeError(`Invalid index specified: ${n}`, { cause: `Index ${n} is not within the range of 0 - ${r - 1}` });
1092
- let s = ut({
1217
+ let s = vt({
1093
1218
  cachedBounds: t,
1094
1219
  itemCount: r,
1095
1220
  itemSize: i
@@ -1101,7 +1226,7 @@ function dt({ align: e, cachedBounds: t, index: n, itemCount: r, itemSize: i, co
1101
1226
  default: return a >= u && a <= l ? a : a < u ? u : l;
1102
1227
  }
1103
1228
  }
1104
- function ft({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
1229
+ function bt({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemCount: r, overscanCount: i }) {
1105
1230
  let a = r - 1, o = 0, s = -1, c = 0, l = -1, u = 0;
1106
1231
  for (; u < a;) {
1107
1232
  let n = e.get(u);
@@ -1120,11 +1245,11 @@ function ft({ cachedBounds: e, containerScrollOffset: t, containerSize: n, itemC
1120
1245
  stopIndexOverscan: l
1121
1246
  };
1122
1247
  }
1123
- function pt({ itemCount: e, itemProps: t, itemSize: n }) {
1248
+ function xt({ itemCount: e, itemProps: t, itemSize: n }) {
1124
1249
  let r = /* @__PURE__ */ new Map();
1125
1250
  return {
1126
1251
  get(i) {
1127
- for (Q(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
1252
+ for (Z(i < e, `Invalid index ${i}`); r.size - 1 < i;) {
1128
1253
  let e = r.size, a;
1129
1254
  switch (typeof n) {
1130
1255
  case "function":
@@ -1140,14 +1265,14 @@ function pt({ itemCount: e, itemProps: t, itemSize: n }) {
1140
1265
  });
1141
1266
  else {
1142
1267
  let t = r.get(e - 1);
1143
- Q(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
1268
+ Z(t !== void 0, `Unexpected bounds cache miss for index ${i}`), r.set(e, {
1144
1269
  scrollOffset: t.scrollOffset + t.size,
1145
1270
  size: a
1146
1271
  });
1147
1272
  }
1148
1273
  }
1149
1274
  let a = r.get(i);
1150
- return Q(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
1275
+ return Z(a !== void 0, `Unexpected bounds cache miss for index ${i}`), a;
1151
1276
  },
1152
1277
  set(e, t) {
1153
1278
  r.set(e, t);
@@ -1157,8 +1282,8 @@ function pt({ itemCount: e, itemProps: t, itemSize: n }) {
1157
1282
  }
1158
1283
  };
1159
1284
  }
1160
- function mt({ itemCount: e, itemProps: t, itemSize: n }) {
1161
- return R(() => pt({
1285
+ function St({ itemCount: e, itemProps: t, itemSize: n }) {
1286
+ return R(() => xt({
1162
1287
  itemCount: e,
1163
1288
  itemProps: t,
1164
1289
  itemSize: n
@@ -1168,11 +1293,11 @@ function mt({ itemCount: e, itemProps: t, itemSize: n }) {
1168
1293
  n
1169
1294
  ]);
1170
1295
  }
1171
- function ht({ containerSize: e, itemSize: t }) {
1296
+ function Ct({ containerSize: e, itemSize: t }) {
1172
1297
  let n;
1173
1298
  switch (typeof t) {
1174
1299
  case "string":
1175
- Q(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), Q(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseInt(t) / 100;
1300
+ Z(t.endsWith("%"), `Invalid item size: "${t}"; string values must be percentages (e.g. "100%")`), Z(e !== void 0, "Container size must be defined if a percentage item size is specified"), n = e * parseInt(t) / 100;
1176
1301
  break;
1177
1302
  default:
1178
1303
  n = t;
@@ -1180,8 +1305,8 @@ function ht({ containerSize: e, itemSize: t }) {
1180
1305
  }
1181
1306
  return n;
1182
1307
  }
1183
- function gt({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
1184
- let { height: u = n, width: d = n } = ot({
1308
+ function Q({ containerElement: e, containerStyle: t, defaultContainerSize: n = 0, direction: r, isRtl: i = !1, itemCount: a, itemProps: o, itemSize: s, onResize: c, overscanCount: l }) {
1309
+ let { height: u = n, width: d = n } = ft({
1185
1310
  defaultHeight: r === "vertical" ? n : void 0,
1186
1311
  defaultWidth: r === "horizontal" ? n : void 0,
1187
1312
  element: e,
@@ -1190,11 +1315,11 @@ function gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1190
1315
  }), f = z({
1191
1316
  height: 0,
1192
1317
  width: 0
1193
- }), p = r === "vertical" ? u : d, m = ht({
1318
+ }), p = r === "vertical" ? u : d, m = Ct({
1194
1319
  containerSize: p,
1195
1320
  itemSize: s
1196
1321
  });
1197
- pe(() => {
1322
+ he(() => {
1198
1323
  if (typeof c == "function") {
1199
1324
  let e = f.current;
1200
1325
  (e.height !== u || e.width !== d) && (c({
@@ -1207,11 +1332,11 @@ function gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1207
1332
  c,
1208
1333
  d
1209
1334
  ]);
1210
- let h = mt({
1335
+ let h = St({
1211
1336
  itemCount: a,
1212
1337
  itemProps: o,
1213
1338
  itemSize: m
1214
- }), g = I((e) => h.get(e), [h]), [_, v] = B(() => ft({
1339
+ }), g = I((e) => h.get(e), [h]), [_, v] = B(() => bt({
1215
1340
  cachedBounds: h,
1216
1341
  containerScrollOffset: 0,
1217
1342
  containerSize: p,
@@ -1222,7 +1347,7 @@ function gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1222
1347
  startIndexOverscan: Math.min(a - 1, _.startIndexOverscan),
1223
1348
  stopIndexVisible: Math.min(a - 1, _.stopIndexVisible),
1224
1349
  stopIndexOverscan: Math.min(a - 1, _.stopIndexOverscan)
1225
- }, C = I(() => ut({
1350
+ }, C = I(() => vt({
1226
1351
  cachedBounds: h,
1227
1352
  itemCount: a,
1228
1353
  itemSize: m
@@ -1230,9 +1355,9 @@ function gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1230
1355
  h,
1231
1356
  a,
1232
1357
  m
1233
- ]), w = I((t) => ft({
1358
+ ]), w = I((t) => bt({
1234
1359
  cachedBounds: h,
1235
- containerScrollOffset: lt({
1360
+ containerScrollOffset: gt({
1236
1361
  containerElement: e,
1237
1362
  direction: r,
1238
1363
  isRtl: i,
@@ -1250,19 +1375,19 @@ function gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1250
1375
  a,
1251
1376
  l
1252
1377
  ]);
1253
- return X(() => {
1378
+ return ut(() => {
1254
1379
  v(w((r === "vertical" ? e?.scrollTop : e?.scrollLeft) ?? 0));
1255
1380
  }, [
1256
1381
  e,
1257
1382
  r,
1258
1383
  w
1259
- ]), X(() => {
1384
+ ]), ut(() => {
1260
1385
  if (!e) return;
1261
1386
  let t = () => {
1262
1387
  v((t) => {
1263
- let { scrollLeft: n, scrollTop: o } = e, s = ft({
1388
+ let { scrollLeft: n, scrollTop: o } = e, s = bt({
1264
1389
  cachedBounds: h,
1265
- containerScrollOffset: lt({
1390
+ containerScrollOffset: gt({
1266
1391
  containerElement: e,
1267
1392
  direction: r,
1268
1393
  isRtl: i,
@@ -1272,7 +1397,7 @@ function gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1272
1397
  itemCount: a,
1273
1398
  overscanCount: l
1274
1399
  });
1275
- return $(s, t) ? t : s;
1400
+ return _t(s, t) ? t : s;
1276
1401
  });
1277
1402
  };
1278
1403
  return e.addEventListener("scroll", t), () => {
@@ -1288,8 +1413,8 @@ function gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1288
1413
  ]), {
1289
1414
  getCellBounds: g,
1290
1415
  getEstimatedSize: C,
1291
- scrollToIndex: st(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
1292
- let s = dt({
1416
+ scrollToIndex: pt(({ align: t = "auto", containerScrollOffset: n, index: o }) => {
1417
+ let s = yt({
1293
1418
  align: t,
1294
1419
  cachedBounds: h,
1295
1420
  containerScrollOffset: n,
@@ -1299,14 +1424,14 @@ function gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1299
1424
  itemSize: m
1300
1425
  });
1301
1426
  if (e) {
1302
- if (s = lt({
1427
+ if (s = gt({
1303
1428
  containerElement: e,
1304
1429
  direction: r,
1305
1430
  isRtl: i,
1306
1431
  scrollOffset: s
1307
1432
  }), typeof e.scrollTo != "function") {
1308
1433
  let e = w(s);
1309
- $(_, e) || v(e);
1434
+ _t(_, e) || v(e);
1310
1435
  }
1311
1436
  return s;
1312
1437
  }
@@ -1317,19 +1442,19 @@ function gt({ containerElement: e, containerStyle: t, defaultContainerSize: n =
1317
1442
  stopIndexVisible: x
1318
1443
  };
1319
1444
  }
1320
- function _t(e) {
1445
+ function wt(e) {
1321
1446
  return R(() => e, Object.values(e));
1322
1447
  }
1323
- function vt(e, t) {
1448
+ function Tt(e, t) {
1324
1449
  let { ariaAttributes: n, style: r, ...i } = e, { ariaAttributes: a, style: o, ...s } = t;
1325
- return $(n, a) && $(r, o) && $(i, s);
1450
+ return _t(n, a) && _t(r, o) && _t(i, s);
1326
1451
  }
1327
- function yt(e) {
1452
+ function Et(e) {
1328
1453
  return typeof e == "object" && !!e && "getAverageRowHeight" in e && typeof e.getAverageRowHeight == "function";
1329
1454
  }
1330
- var bt = "data-react-window-index";
1331
- function xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onResize: i, onRowsRendered: a, overscanCount: o = 3, rowComponent: s, rowCount: c, rowHeight: l, rowProps: u, tagName: d = "div", style: f, ...p }) {
1332
- let m = _t(u), h = R(() => de(s, vt), [s]), [g, _] = B(null), v = yt(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = gt({
1455
+ var Dt = "data-react-window-index";
1456
+ function Ot({ 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 }) {
1457
+ let m = wt(u), h = R(() => F(s, Tt), [s]), [g, _] = B(null), v = Et(l), { getCellBounds: y, getEstimatedSize: b, scrollToIndex: x, startIndexOverscan: S, startIndexVisible: C, stopIndexOverscan: w, stopIndexVisible: T } = Q({
1333
1458
  containerElement: g,
1334
1459
  containerStyle: f,
1335
1460
  defaultContainerSize: n,
@@ -1340,7 +1465,7 @@ function xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1340
1465
  onResize: i,
1341
1466
  overscanCount: o
1342
1467
  });
1343
- fe(r, () => ({
1468
+ me(r, () => ({
1344
1469
  get element() {
1345
1470
  return g;
1346
1471
  },
@@ -1355,12 +1480,12 @@ function xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1355
1480
  top: r
1356
1481
  });
1357
1482
  }
1358
- }), [g, x]), X(() => {
1483
+ }), [g, x]), ut(() => {
1359
1484
  if (!g) return;
1360
1485
  let e = Array.from(g.children).filter((e, t) => {
1361
1486
  if (e.hasAttribute("aria-hidden")) return !1;
1362
1487
  let n = `${S + t}`;
1363
- return e.setAttribute(bt, n), !0;
1488
+ return e.setAttribute(Dt, n), !0;
1364
1489
  });
1365
1490
  if (v) return l.observeRowElements(e);
1366
1491
  }, [
@@ -1388,7 +1513,7 @@ function xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1388
1513
  let e = [];
1389
1514
  if (c > 0) for (let t = S; t <= w; t++) {
1390
1515
  let n = y(t);
1391
- e.push(/* @__PURE__ */ F(h, {
1516
+ e.push(/* @__PURE__ */ P(h, {
1392
1517
  ...m,
1393
1518
  ariaAttributes: {
1394
1519
  "aria-posinset": t + 1,
@@ -1423,7 +1548,7 @@ function xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1423
1548
  zIndex: -1
1424
1549
  }
1425
1550
  });
1426
- return F(d, {
1551
+ return P(d, {
1427
1552
  role: "list",
1428
1553
  ...p,
1429
1554
  className: t,
@@ -1437,123 +1562,135 @@ function xt({ children: e, className: t, defaultHeight: n = 0, listRef: r, onRes
1437
1562
  }
1438
1563
  }, E, e, D);
1439
1564
  }
1440
- var St = {
1441
- divider: "_divider_3wv6u_1",
1442
- item: "_item_3wv6u_5",
1443
- itemIcon: "_itemIcon_3wv6u_15",
1444
- checkIcon: "_checkIcon_3wv6u_19",
1445
- stateLabel: "_stateLabel_3wv6u_23"
1446
- }, Ct = 44, wt = 8, Tt = ({ index: e, style: t, ariaAttributes: n, items: i, selectedDeploymentId: a, labelClassName: o, query: c, onSelect: l }) => {
1447
- let u = i[e], d = rt(u.iconUrl, u.type, u.displayName ?? u.id, f.SM), m = u.id === a;
1565
+ var $ = {
1566
+ divider: "_divider_13nxz_1",
1567
+ item: "_item_13nxz_5",
1568
+ itemIcon: "_itemIcon_13nxz_15",
1569
+ checkIcon: "_checkIcon_13nxz_19",
1570
+ stateLabel: "_stateLabel_13nxz_23"
1571
+ }, kt = 44, At = 8, jt = ({ index: e, style: t, ariaAttributes: n, items: r, selectedDeploymentId: i, labelClassName: a, query: s, onSelect: c }) => {
1572
+ let d = r[e], f = ct(d.iconUrl, d.type, d.displayName ?? d.id, u.SM), p = d.id === i;
1448
1573
  return /* @__PURE__ */ H("div", {
1449
1574
  style: t,
1450
1575
  ...n,
1451
- children: /* @__PURE__ */ H(p, {
1576
+ children: /* @__PURE__ */ H(l, {
1452
1577
  type: "button",
1453
- className: s(St.item, "flex h-full w-full items-center gap-3 px-4"),
1578
+ className: o($.item, "h-full w-full gap-3 px-4"),
1454
1579
  iconBefore: /* @__PURE__ */ H("span", {
1455
- className: St.itemIcon,
1456
- children: d
1580
+ className: $.itemIcon,
1581
+ children: f
1457
1582
  }),
1458
1583
  label: /* @__PURE__ */ U("span", {
1459
1584
  className: "flex flex-1 items-center justify-between gap-2",
1460
- children: [/* @__PURE__ */ H(r, {
1461
- text: u.displayName ?? u.id,
1462
- query: c,
1585
+ children: [/* @__PURE__ */ H(E, {
1586
+ text: d.displayName ?? d.id,
1587
+ query: s,
1463
1588
  maxLines: 1,
1464
- className: s(o, "min-w-0 flex-1 text-start")
1465
- }), m && /* @__PURE__ */ H(M, {
1466
- size: f.SM,
1467
- className: St.checkIcon,
1589
+ className: o(a, "min-w-0 flex-1 text-start")
1590
+ }), p && /* @__PURE__ */ H(ie, {
1591
+ size: u.SM,
1592
+ className: $.checkIcon,
1468
1593
  "aria-hidden": !0
1469
1594
  })]
1470
1595
  }),
1471
- onClick: () => l(u.id)
1596
+ onClick: () => c(d.id)
1472
1597
  })
1473
1598
  });
1474
- }, Et = ({ isOpen: e, title: t, closeLabel: n, searchPlaceholder: r = "Search", onClose: i, deployments: a, selectedDeploymentId: o, onSelect: c, loadingLabel: l, errorLabel: u, emptyLabel: d, style: f, titleClassName: p = "dial-body-semi-text", labelClassName: m = "dial-small-text" }) => {
1475
- let [h, g] = B("");
1599
+ }, Mt = ({ isOpen: e, title: t, closeLabel: n, searchPlaceholder: r = "Search", onClose: i, deployments: s, selectedDeploymentId: c, onSelect: l, loadingLabel: u, errorLabel: d, emptyLabel: f, style: p, titleClassName: m = "dial-body-semi-text", labelClassName: h = "dial-small-text", colors: g }) => {
1600
+ let [_, y] = B("");
1476
1601
  L(() => {
1477
- e || g("");
1602
+ e || y("");
1478
1603
  }, [e]);
1479
- let _ = a && a.length > 0, v = l !== void 0, y = !_ && !v ? u ?? d : void 0, b = _ ? nt(a, h) : [];
1480
- return /* @__PURE__ */ U(W, {
1604
+ let b = s && s.length > 0, x = u !== void 0, S = !b && !x ? d ?? f : void 0, C = b ? st(s, _) : [], T = (e) => {
1605
+ l(e), i();
1606
+ }, E = a({
1607
+ "--ci-sheet-divider": g?.divider,
1608
+ "--ci-sheet-text": g?.itemText,
1609
+ "--ci-sheet-item-hover": g?.itemHoverBg,
1610
+ "--ci-sheet-item-active": g?.itemActiveBg,
1611
+ "--ci-sheet-icon": g?.itemIcon,
1612
+ "--ci-check-icon": g?.checkIcon
1613
+ });
1614
+ return /* @__PURE__ */ H(W, {
1481
1615
  isOpen: e,
1482
1616
  title: t,
1483
1617
  closeLabel: n,
1484
1618
  onClose: i,
1485
- style: f,
1486
- titleClassName: p,
1619
+ style: p,
1620
+ titleClassName: m,
1487
1621
  className: "max-h-[80dvh]",
1488
- children: [_ && !v && /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("div", {
1489
- className: "flex-shrink-0 px-4 py-[10px]",
1490
- children: /* @__PURE__ */ H(C, {
1491
- value: h,
1492
- placeholder: r,
1493
- size: k.Standard,
1494
- onChange: g
1495
- })
1496
- }), /* @__PURE__ */ H("div", { className: s(St.divider, "h-px flex-shrink-0") })] }), v ? /* @__PURE__ */ H(et, { loadingLabel: l }) : y ? /* @__PURE__ */ H("div", {
1497
- role: "list",
1498
- className: s(St.stateLabel, m, "px-4 py-4"),
1499
- children: y
1500
- }) : /* @__PURE__ */ H(xt, {
1501
- role: "list",
1502
- className: "overflow-y-auto",
1503
- style: { height: Math.min(b.length, wt) * Ct },
1504
- rowComponent: Tt,
1505
- rowCount: b.length,
1506
- rowHeight: Ct,
1507
- rowProps: {
1508
- items: b,
1509
- selectedDeploymentId: o,
1510
- labelClassName: m,
1511
- query: h,
1512
- onSelect: (e) => {
1513
- c(e), i();
1622
+ colors: g?.shell,
1623
+ children: /* @__PURE__ */ U("div", {
1624
+ className: "contents",
1625
+ style: E,
1626
+ children: [b && !x && /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("div", {
1627
+ className: "flex-shrink-0 px-4 py-[10px]",
1628
+ children: /* @__PURE__ */ H(v, {
1629
+ value: _,
1630
+ placeholder: r,
1631
+ size: w.Standard,
1632
+ onChange: y
1633
+ })
1634
+ }), /* @__PURE__ */ H("div", { className: o($.divider, "h-px flex-shrink-0") })] }), x ? /* @__PURE__ */ H(at, { loadingLabel: u }) : S ? /* @__PURE__ */ H("div", {
1635
+ role: "list",
1636
+ className: o($.stateLabel, h, "px-4 py-4"),
1637
+ children: S
1638
+ }) : /* @__PURE__ */ H(Ot, {
1639
+ role: "list",
1640
+ className: "overflow-y-auto",
1641
+ style: { height: Math.min(C.length, At) * kt },
1642
+ rowComponent: jt,
1643
+ rowCount: C.length,
1644
+ rowHeight: kt,
1645
+ rowProps: {
1646
+ items: C,
1647
+ selectedDeploymentId: c,
1648
+ labelClassName: h,
1649
+ query: _,
1650
+ onSelect: T
1514
1651
  }
1515
- }
1516
- })]
1652
+ })]
1653
+ })
1517
1654
  });
1518
- }, Dt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, isStreaming: i, isMobile: a, isInputDisabled: o = !1, isDisabled: c = !1, style: l, modelPickerOverlay: u, isPickerOpen: d, onPickerToggle: p, onPickerOpenChange: m }) => {
1519
- let [_, y] = B(!1), { selectorIcon: b, selectorAriaLabel: x, selectedLabel: S, menuItems: C, menuHeader: w, onOpenChange: T } = it({
1655
+ }, Nt = ({ deployments: e, selectedDeploymentId: t, onDeploymentChange: n, modelSelectorLabels: r, isStreaming: i, isMobile: a, isInputDisabled: s = !1, isDisabled: c = !1, style: l, modelPickerOverlay: d, isPickerOpen: m, onPickerToggle: h, onPickerOpenChange: g }) => {
1656
+ let [_, v] = B(!1), { selectorIcon: y, selectorAriaLabel: b, selectedLabel: x, menuItems: S, menuHeader: E, onOpenChange: D } = lt({
1520
1657
  deployments: e,
1521
1658
  selectedDeploymentId: t,
1522
1659
  onDeploymentChange: n,
1523
1660
  modelSelectorLabels: r
1524
1661
  });
1525
1662
  if (!e) return null;
1526
- let E = i || c ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, D = /* @__PURE__ */ H(N, {
1527
- size: f.SM,
1528
- className: Y.modelSelectorCaret,
1663
+ let O = i || c ? "pointer-events-none opacity-50 cursor-not-allowed" : void 0, k = /* @__PURE__ */ H(j, {
1664
+ size: u.SM,
1665
+ className: K.modelSelectorCaret,
1529
1666
  "aria-hidden": !0
1530
1667
  });
1531
- return a ? /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H(O, {
1532
- tooltip: S,
1533
- children: /* @__PURE__ */ H(v, {
1668
+ return a ? /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H(C, {
1669
+ tooltip: x,
1670
+ children: /* @__PURE__ */ H(T, {
1534
1671
  icon: /* @__PURE__ */ U("div", {
1535
1672
  className: "flex items-center gap-1",
1536
- children: [b, D]
1673
+ children: [y, k]
1537
1674
  }),
1538
- "aria-label": x,
1675
+ "aria-label": b,
1539
1676
  onClick: () => {
1540
- c || y(!0);
1677
+ c || v(!0);
1541
1678
  },
1542
- className: s(Y.modelSelectorButton, E)
1679
+ className: o(K.modelSelectorButton, O)
1543
1680
  })
1544
- }), u ? /* @__PURE__ */ H(W, {
1681
+ }), d ? /* @__PURE__ */ H(W, {
1545
1682
  isOpen: _,
1546
1683
  title: r?.ariaLabel ?? "Select model",
1547
1684
  closeLabel: r?.closeLabel ?? "Close",
1548
- onClose: () => y(!1),
1685
+ onClose: () => v(!1),
1549
1686
  style: l,
1550
- children: u(() => y(!1))
1551
- }) : /* @__PURE__ */ H(Et, {
1687
+ children: d(() => v(!1))
1688
+ }) : /* @__PURE__ */ H(Mt, {
1552
1689
  isOpen: _,
1553
1690
  title: r?.ariaLabel ?? "Select model",
1554
1691
  closeLabel: r?.closeLabel ?? "Close",
1555
1692
  searchPlaceholder: r?.searchPlaceholder ?? "Search",
1556
- onClose: () => y(!1),
1693
+ onClose: () => v(!1),
1557
1694
  deployments: e,
1558
1695
  selectedDeploymentId: t,
1559
1696
  onSelect: (e) => n?.(e),
@@ -1561,336 +1698,382 @@ var St = {
1561
1698
  errorLabel: r?.error,
1562
1699
  emptyLabel: r?.empty,
1563
1700
  style: l
1564
- })] }) : u ? /* @__PURE__ */ H(h, {
1701
+ })] }) : d ? /* @__PURE__ */ H(f, {
1565
1702
  placement: "top-end",
1566
1703
  matchReferenceWidth: !1,
1567
- open: d,
1568
- onOpenChange: m,
1704
+ open: m,
1705
+ onOpenChange: g,
1569
1706
  trigger: [],
1570
1707
  outsideClosable: !0,
1571
- renderOverlay: () => u(() => m?.(!1)),
1708
+ renderOverlay: () => d(() => g?.(!1)),
1572
1709
  listClassName: "cp-dropdown-overlay !w-[320px]",
1573
- children: /* @__PURE__ */ H(O, {
1574
- tooltip: S,
1710
+ children: /* @__PURE__ */ H(C, {
1711
+ tooltip: x,
1575
1712
  children: /* @__PURE__ */ U("button", {
1576
1713
  type: "button",
1577
- "aria-label": x,
1578
- className: s("flex items-center justify-center gap-1 rounded-md p-2", Y.modelSelectorButton, o || i || c ? E : void 0, (o || c) && Y.modelSelectorButtonDisabled),
1714
+ "aria-label": b,
1715
+ className: o("flex items-center justify-center gap-1 rounded-full p-2", K.modelSelectorButton, s || i || c ? O : void 0, (s || c) && K.modelSelectorButtonDisabled),
1579
1716
  onClick: () => {
1580
- !o && !i && !c && p?.();
1717
+ !s && !i && !c && h?.();
1581
1718
  },
1582
- children: [b, D]
1719
+ children: [y, k]
1583
1720
  })
1584
1721
  })
1585
1722
  }) : /* @__PURE__ */ H("div", {
1586
- className: s(c && E),
1723
+ className: o(c && O),
1587
1724
  "aria-disabled": c || void 0,
1588
- children: /* @__PURE__ */ H(O, {
1589
- tooltip: S,
1590
- children: /* @__PURE__ */ H(g, {
1591
- icon: b,
1592
- ariaLabel: x,
1593
- items: C,
1594
- menuHeader: w,
1725
+ children: /* @__PURE__ */ H(C, {
1726
+ tooltip: x,
1727
+ children: /* @__PURE__ */ H(p, {
1728
+ icon: y,
1729
+ ariaLabel: b,
1730
+ items: S,
1731
+ menuHeader: E,
1595
1732
  placement: "bottom-end",
1596
1733
  matchReferenceWidth: !1,
1597
1734
  listClassName: "cp-dropdown-overlay !w-[240px] !max-h-80",
1598
- onOpenChange: c ? void 0 : T,
1599
- size: k.Standard,
1600
- caretIcon: D,
1601
- iconClassName: o || c ? E : void 0,
1602
- buttonClassName: s("bg-transparent", Y.modelSelectorButton, (o || c) && E && Y.modelSelectorButtonDisabled)
1735
+ onOpenChange: c ? void 0 : D,
1736
+ size: w.Standard,
1737
+ caretIcon: k,
1738
+ iconClassName: s || c ? O : void 0,
1739
+ buttonClassName: o("bg-transparent", K.modelSelectorButton, (s || c) && O && K.modelSelectorButtonDisabled)
1603
1740
  })
1604
1741
  })
1605
1742
  });
1606
- }, Ot = 160, kt = ({ message: e = "", messageRevision: t, onSend: n, onUploadAttachment: r, onStop: i, isStreaming: a = !1, onChange: u, onAttachmentsChange: d, placeholder: p = "Type a message...", ariaLabel: m, attachLabel: h = "Attach file", fileAccept: g, addMenuTitle: _ = "Add", menuTitle: y = "Menu", menuCloseLabel: b = "Close", removeLabel: x, retryLabel: S, sendLabel: C, stopLabel: w, micLabel: T = "Record voice message", colors: E, typography: D, className: ee, pendingDropFiles: O = [], onDropFilesConsumed: k, pendingAttachments: A = [], onPendingAttachmentsConsumed: te, pasteTextThreshold: ne = 4e3, deployments: j, selectedDeploymentId: M, onDeploymentChange: N, modelSelectorLabels: re, initialAttachments: oe = [], isStacked: se = !1, hideAddButton: P = !1, hideAttachFile: ce = !1, hideActionBar: le = !1, renderFooterActions: ue, isInputDisabled: F = !1, isModelSelectorDisabled: de = !1, isTranscriptionSupported: L = !1, onUploadAudio: fe, onTranscribeAudio: pe, sendOnEnter: me = Ie.Enter, prefixAttachments: he = [], onRemovePrefixAttachment: ge, chatSettings: ve, autoFocus: ye = !1, messageHistory: be, onDialFileSystemClick: xe, dialFileSystemLabel: Ce, validateAttachment: we, onAttachmentClick: W, modelPickerOverlay: Te, maximumAttachmentsAmount: Oe, onAttachmentsLimitExceeded: ke }) => {
1607
- let Me = c(), [Ne, Pe] = B(!1), Le = Ae(be), Re = R(() => o({
1608
- "--ci-bg": E?.background,
1609
- "--ci-text": E?.text,
1610
- "--ci-border": E?.border,
1611
- "--ci-border-hover": E?.borderHover,
1612
- "--ci-border-focus": E?.borderFocus,
1613
- "--ci-placeholder": E?.placeholder,
1614
- "--ci-shadow": E?.shadow,
1615
- "--ci-shadow-focus": E?.shadowFocus,
1616
- "--ci-send-bg": E?.sendBackground,
1617
- "--ci-send-text": E?.sendText,
1618
- "--ci-stop-color": E?.stopColor
1619
- }), [E]), ze = R(() => xe ? [{
1743
+ }, Pt = 160, Ft = ({ message: e = "", messageRevision: t, onSend: n, onUploadAttachment: r, onStop: i, isStreaming: l = !1, onChange: d, onAttachmentsChange: f, placeholder: p = "Type a message...", ariaLabel: m, attachLabel: h = "Attach file", fileAccept: g, addMenuTitle: _ = "Add", menuTitle: v = "Menu", menuCloseLabel: y = "Close", removeLabel: b, retryLabel: x, sendLabel: S, stopLabel: C, micLabel: w = "Record voice message", stopRecordingLabel: T, discardRecordingLabel: E, timerAriaLabel: D, colors: O, typography: k, className: A, pendingDropFiles: ee = [], onDropFilesConsumed: ne, pendingAttachments: re = [], onPendingAttachmentsConsumed: ie, pasteTextThreshold: j = 4e3, deployments: M, selectedDeploymentId: se, onDeploymentChange: ce, modelSelectorLabels: le, initialAttachments: N = [], isStacked: ue = !1, hideAddButton: de = !1, hideAttachFile: fe = !1, hideActionBar: pe = !1, renderFooterActions: P, isInputDisabled: F = !1, isModelSelectorDisabled: L = !1, isSendDisabled: me = !1, isAudioMessageSupported: he = !1, sendOnEnter: ge = Re.Enter, prefixAttachments: _e = [], onRemovePrefixAttachment: ve, chatSettings: be, toolsMenuItems: xe, onToolToggle: Se, toolsMenuTitle: Ce, toolsBackLabel: Te, toolsChipLabels: Ee, autoFocus: W = !1, messageHistory: De, onDialFileSystemClick: Ae, dialFileSystemLabel: je, validateAttachment: Pe, onAttachmentClick: Fe, modelPickerOverlay: Ie, maximumAttachmentsAmount: ze, onAttachmentsLimitExceeded: Be, isAttachmentsEnabled: Ve = !0, usageLimitsSlot: He, onMessageTooLong: Ue }) => {
1744
+ let We = s(), [Ge, Ke] = B(!1), G = Me(De), Je = R(() => a({
1745
+ "--ci-bg": O?.background,
1746
+ "--ci-text": O?.text,
1747
+ "--ci-border": O?.border,
1748
+ "--ci-border-focus": O?.borderFocus,
1749
+ "--ci-placeholder": O?.placeholder,
1750
+ "--ci-text-disabled": O?.textDisabled,
1751
+ "--ci-model-selector-caret-color": O?.modelSelectorCaret,
1752
+ "--ci-model-selector-hover-bg": O?.modelSelectorHoverBg,
1753
+ "--ci-model-selector-disabled-color": O?.modelSelectorDisabled,
1754
+ "--ci-voice-error": O?.voiceError,
1755
+ "--ci-voice-waveform": O?.voiceWaveform,
1756
+ "--ci-voice-accent": O?.voiceAccent
1757
+ }), [O]), Ye = R(() => Ae ? [{
1620
1758
  key: "dial-fs",
1621
- label: Ce ?? "DIAL file system",
1622
- icon: /* @__PURE__ */ H(ie, {
1623
- size: l,
1759
+ label: je ?? "DIAL file system",
1760
+ icon: /* @__PURE__ */ H(ae, {
1761
+ size: c,
1624
1762
  "aria-hidden": !0
1625
1763
  }),
1626
- onClick: xe
1627
- }] : [], [xe, Ce]), { message: G, setMessage: K, textareaRef: Be, isMultiLine: Ve } = je({
1764
+ onClick: Ae
1765
+ }] : [], [Ae, je]), { message: q, setMessage: J, textareaRef: Ze, isMultiLine: Y } = Ne({
1628
1766
  messageProp: e,
1629
1767
  messageRevision: t
1630
- }), { attachments: q, buildAttachments: He, addAttachments: Ue, resetAttachments: We, handleRemove: J, handleRetry: Ke, handleExpand: qe, hasBlockedAttachments: Je } = Ee({
1631
- initialAttachments: oe,
1768
+ }), { attachments: X, buildAttachments: tt, addAttachments: nt, resetAttachments: rt, handleRemove: it, handleRetry: at, handleExpand: ot, hasBlockedAttachments: st } = Oe({
1769
+ initialAttachments: N,
1632
1770
  onUploadAttachment: r,
1633
- onAttachmentsChange: d,
1634
- validateAttachment: we,
1635
- pendingDropFiles: O,
1636
- onDropFilesConsumed: k,
1637
- pendingAttachments: A,
1638
- onPendingAttachmentsConsumed: te,
1771
+ onAttachmentsChange: f,
1772
+ validateAttachment: Pe,
1773
+ pendingDropFiles: ee,
1774
+ onDropFilesConsumed: ne,
1775
+ pendingAttachments: re,
1776
+ onPendingAttachmentsConsumed: ie,
1639
1777
  onExpandPastedText: I((e) => {
1640
- K((t) => t ? `${t}\n${e}` : e);
1641
- }, [K]),
1642
- maximumAttachmentsAmount: Oe,
1643
- baseAttachmentsAmount: he.length,
1644
- onAttachmentsLimitExceeded: ke
1645
- }), { state: Qe, waveformData: $e, errorMessage: et, startRecording: tt, stopRecording: nt, confirmRecording: rt, discardRecording: it } = Fe({
1646
- onUploadAudio: fe,
1647
- onTranscribeAudio: pe,
1648
- onTranscript: I((e) => {
1649
- K(e), u?.(e);
1650
- }, [u, K])
1651
- }), X = z(null), at = z(null), { handlePaste: ot } = Se(Ue, ne), st = G.trim().length > 0 || q.length > 0, Z = st && !Je, { shouldRender: ct, isExiting: lt, instanceKey: Q } = De(!a && st, Ot), $ = se || q.length > 0 || G.includes("\n") || Ve, ut = j === void 0 || M != null, dt = async () => {
1652
- let e = G, t = q;
1653
- K(""), Le.reset();
1778
+ J((t) => t ? `${t}\n${e}` : e);
1779
+ }, [J]),
1780
+ maximumAttachmentsAmount: ze,
1781
+ baseAttachmentsAmount: _e.length,
1782
+ onAttachmentsLimitExceeded: Be
1783
+ }), { state: ct, analyserNodeRef: lt, elapsedSeconds: ut, errorMessage: dt, startRecording: ft, stopRecording: pt, discardRecording: mt } = Le({ onAttachAudio: I((e) => {
1784
+ nt(tt([e]));
1785
+ }, [nt, tt]) }), ht = z(null), gt = z(null), { handlePaste: Z } = we(nt, Ve ? j : Infinity), _t = I((e) => {
1786
+ if (!Ve) {
1787
+ let t = e.clipboardData.getData("text/plain");
1788
+ t.length >= j && Ue?.(t.length, j);
1789
+ }
1790
+ Z(e);
1791
+ }, [
1792
+ Ve,
1793
+ j,
1794
+ Ue,
1795
+ Z
1796
+ ]), vt = q.trim().length > 0 || X.length > 0, yt = vt && !st && !me, { shouldRender: bt, isExiting: xt, instanceKey: St } = ke(!l && vt, Pt), Ct = (xe?.some((e) => e.isSelected) ?? !1) && Se != null, Q = ue || q.includes("\n") || Y || Ct, wt = M === void 0 || se != null, Tt = R(() => he && !xt && !l, [
1797
+ he,
1798
+ xt,
1799
+ l
1800
+ ]), Et = async () => {
1801
+ if (me) return;
1802
+ if (!Ve && q.length >= j) {
1803
+ Ue?.(q.length, j);
1804
+ return;
1805
+ }
1806
+ let e = q, t = X;
1807
+ J(""), G.reset();
1654
1808
  try {
1655
1809
  await n?.(e, t), t.forEach((e) => {
1656
- e.previewUrl && URL.revokeObjectURL(e.previewUrl);
1657
- }), We([]);
1810
+ e.previewUrl && URL.revokeObjectURL(e.previewUrl), e.playUrl && URL.revokeObjectURL(e.playUrl);
1811
+ }), rt([]);
1658
1812
  } catch {
1659
- K(e), We(t);
1813
+ J(e), rt(t);
1660
1814
  }
1661
- }, ft = (e) => {
1662
- if (!e.nativeEvent.isComposing && !F && !a && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
1663
- let t = e.currentTarget.selectionStart ?? 0, n = Le.navigate(e.key === "ArrowUp" ? "up" : "down", G, t);
1815
+ }, Dt = (e) => {
1816
+ if (!e.nativeEvent.isComposing && !F && !l && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
1817
+ let t = e.currentTarget.selectionStart ?? 0, n = G.navigate(e.key === "ArrowUp" ? "up" : "down", q, t);
1664
1818
  if (n !== null) {
1665
- e.preventDefault(), K(n);
1819
+ e.preventDefault(), J(n);
1666
1820
  return;
1667
1821
  }
1668
1822
  }
1669
- e.key === "Enter" && (me === Ie.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey) && (e.preventDefault(), !a && Z && ut && !F && dt());
1670
- }, pt = (e) => {
1823
+ e.key === "Enter" && (ge === Re.MetaEnter ? (e.metaKey || e.ctrlKey) && !e.shiftKey : !e.shiftKey && !e.metaKey && !e.ctrlKey) && (e.preventDefault(), !l && yt && wt && !F && Et());
1824
+ }, Ot = (e) => {
1671
1825
  let t = Array.from(e.target.files ?? []);
1672
1826
  if (t.length === 0) return;
1673
- let n = He(t);
1674
- e.target.value = "", Ue(n);
1827
+ let n = tt(t);
1828
+ e.target.value = "", nt(n);
1675
1829
  };
1676
- if (Qe !== "idle") return /* @__PURE__ */ H(Ye, {
1677
- state: Qe,
1678
- waveformData: $e,
1679
- errorMessage: et,
1680
- onStop: nt,
1681
- onConfirm: rt,
1682
- onDiscard: it,
1683
- style: Re,
1684
- className: ee
1830
+ if (ct !== "idle") return /* @__PURE__ */ H(Qe, {
1831
+ state: ct,
1832
+ analyserNodeRef: lt,
1833
+ elapsedSeconds: ut,
1834
+ errorMessage: dt,
1835
+ onStop: pt,
1836
+ onDiscard: mt,
1837
+ stopLabel: T,
1838
+ discardLabel: E,
1839
+ timerLabel: D,
1840
+ style: Je,
1841
+ className: A
1685
1842
  });
1686
- let mt = /* @__PURE__ */ H("textarea", {
1687
- className: s(Y.textarea, D?.fontClassName, "max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent outline-none [field-sizing:content]"),
1688
- ref: Be,
1689
- autoFocus: ye,
1690
- value: G,
1843
+ let $ = /* @__PURE__ */ H("textarea", {
1844
+ className: o(K.textarea, k?.fontClassName || "dial-body-paragraph-text", "max-h-[272px] w-full resize-none overflow-y-auto border-0 bg-transparent outline-none [field-sizing:content]"),
1845
+ ref: Ze,
1846
+ autoFocus: W,
1847
+ value: q,
1691
1848
  onChange: (e) => {
1692
- K(e.target.value), Le.notifyChange(), u?.(e.target.value);
1849
+ J(e.target.value), G.notifyChange(), d?.(e.target.value);
1693
1850
  },
1694
- onKeyDown: ft,
1695
- onPaste: ot,
1851
+ onKeyDown: Dt,
1852
+ onPaste: _t,
1696
1853
  placeholder: p,
1697
1854
  "aria-label": m,
1698
1855
  disabled: F,
1699
1856
  rows: 1
1700
1857
  });
1701
1858
  return /* @__PURE__ */ U("div", {
1702
- ref: at,
1703
- style: Re,
1704
- className: s(Y.wrapper, F && Y.wrapperDisabled, "flex min-h-[56px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border", q.length > 6 ? "py-3 ps-3" : "p-3", ee),
1705
- children: [(he.length > 0 || q.length > 0) && /* @__PURE__ */ H(_e, {
1706
- attachments: [...he, ...q],
1859
+ ref: gt,
1860
+ style: Je,
1861
+ className: o(K.wrapper, F && K.wrapperDisabled, "flex min-h-[64px] w-full max-w-[748px] flex-col justify-center gap-3 rounded-xl border shadow-md", X.length > 6 ? "py-3 ps-3" : "p-3", A),
1862
+ children: [(_e.length > 0 || X.length > 0) && /* @__PURE__ */ H(ye, {
1863
+ attachments: [..._e, ...X],
1707
1864
  onRemove: (e) => {
1708
- he.some((t) => t.id === e) ? ge?.(e) : J(e);
1865
+ _e.some((t) => t.id === e) ? ve?.(e) : it(e);
1709
1866
  },
1710
- onRetry: Ke,
1711
- onExpand: qe,
1867
+ onRetry: at,
1868
+ onExpand: ot,
1712
1869
  labels: {
1713
- removeLabel: x,
1714
- retryLabel: S
1870
+ removeLabel: b,
1871
+ retryLabel: x
1715
1872
  },
1716
- onAttachmentClick: W == null ? void 0 : (e) => {
1717
- let t = q.find((t) => t.id === e);
1718
- t != null && W(t);
1873
+ onAttachmentClick: Fe == null ? void 0 : (e) => {
1874
+ let t = [..._e, ...X].find((t) => t.id === e);
1875
+ t != null && Fe(t);
1719
1876
  }
1720
- }), le ? $ && mt : /* @__PURE__ */ U("div", {
1721
- className: s("flex items-center gap-2", $ ? "flex-wrap" : "flex-wrap desktop:flex-nowrap"),
1877
+ }), pe ? Q && $ : /* @__PURE__ */ U("div", {
1878
+ className: o("flex items-center gap-2", Q ? "flex-wrap" : "flex-wrap desktop:flex-nowrap"),
1722
1879
  children: [
1723
- !P && /* @__PURE__ */ U("div", {
1724
- className: s("order-2 flex", !$ && "desktop:order-1"),
1880
+ !de && /* @__PURE__ */ U("div", {
1881
+ className: o("flex", "order-2", !Q && "desktop:order-1"),
1725
1882
  children: [/* @__PURE__ */ H("input", {
1726
- ref: X,
1883
+ ref: ht,
1727
1884
  type: "file",
1728
1885
  multiple: !0,
1729
1886
  accept: g,
1730
1887
  className: "sr-only",
1731
1888
  "aria-hidden": !0,
1732
1889
  tabIndex: -1,
1733
- onChange: pt
1734
- }), /* @__PURE__ */ H(Ge, {
1735
- onAttachClick: ce ? void 0 : () => X.current?.click(),
1890
+ onChange: Ot
1891
+ }), /* @__PURE__ */ H(qe, {
1892
+ onAttachClick: fe ? void 0 : () => ht.current?.click(),
1736
1893
  attachLabel: h,
1737
1894
  addMenuTitle: _,
1738
- menuTitle: y,
1739
- menuCloseLabel: b,
1740
- style: Re,
1895
+ menuTitle: v,
1896
+ menuCloseLabel: y,
1897
+ style: Je,
1741
1898
  isDisabled: F,
1742
- chatSettings: ve,
1743
- extraMenuItems: ze
1899
+ chatSettings: be,
1900
+ extraMenuItems: Ye,
1901
+ toolsMenuItems: xe,
1902
+ onToolToggle: Se,
1903
+ toolsMenuTitle: Ce,
1904
+ toolsBackLabel: Te
1744
1905
  })]
1745
1906
  }),
1907
+ Q && Ct && /* @__PURE__ */ H("div", {
1908
+ className: "order-3 min-w-0 flex-1",
1909
+ children: /* @__PURE__ */ H(Xe, {
1910
+ items: xe ?? [],
1911
+ onToolToggle: Se,
1912
+ isMobile: We,
1913
+ countLabel: Ee?.countLabel,
1914
+ removeLabel: Ee?.removeLabel
1915
+ })
1916
+ }),
1746
1917
  /* @__PURE__ */ H("div", {
1747
- className: s("order-1 flex w-full min-w-0 items-center self-stretch", !$ && "desktop:order-2 desktop:w-auto desktop:flex-1"),
1748
- children: mt
1918
+ className: o("order-1 flex w-full min-w-0 items-center self-stretch", !Q && "desktop:order-2 desktop:w-auto desktop:flex-1"),
1919
+ children: $
1749
1920
  }),
1750
1921
  /* @__PURE__ */ U("div", {
1751
- className: s("flex flex-shrink-0 items-center gap-2", "order-3 ms-auto", !$ && "desktop:ms-0"),
1752
- children: [ue ? ue({
1753
- canSend: Z,
1754
- onSend: dt
1755
- }) : /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H(Dt, {
1756
- deployments: j,
1757
- selectedDeploymentId: M,
1758
- onDeploymentChange: N,
1759
- modelSelectorLabels: re,
1760
- isStreaming: a,
1761
- isMobile: Me,
1762
- isInputDisabled: F,
1763
- isDisabled: de,
1764
- style: Re,
1765
- modelPickerOverlay: Te,
1766
- isPickerOpen: Ne,
1767
- onPickerToggle: () => Pe((e) => !e),
1768
- onPickerOpenChange: Pe
1769
- }), a && i ? /* @__PURE__ */ H(Ze, {
1770
- onStop: i,
1771
- ariaLabel: w
1772
- }) : !a && ct && /* @__PURE__ */ H(Xe, {
1773
- onSend: dt,
1774
- isDisabled: !ut || Je,
1775
- ariaLabel: C,
1776
- isExiting: lt
1777
- }, Q)] }), L && !G.trim() && !lt && /* @__PURE__ */ H(v, {
1778
- icon: /* @__PURE__ */ H(ae, {
1779
- size: f.LG,
1922
+ className: o("flex flex-shrink-0 items-center gap-2", Q && Ct ? "order-4" : "order-3", "ms-auto", !Q && "desktop:ms-0"),
1923
+ children: [P ? P({
1924
+ canSend: yt,
1925
+ onSend: Et
1926
+ }) : /* @__PURE__ */ U(V, { children: [
1927
+ He,
1928
+ /* @__PURE__ */ H(Nt, {
1929
+ deployments: M,
1930
+ selectedDeploymentId: se,
1931
+ onDeploymentChange: ce,
1932
+ modelSelectorLabels: le,
1933
+ isStreaming: l,
1934
+ isMobile: We,
1935
+ isInputDisabled: F,
1936
+ isDisabled: L,
1937
+ style: Je,
1938
+ modelPickerOverlay: Ie,
1939
+ isPickerOpen: Ge,
1940
+ onPickerToggle: () => Ke((e) => !e),
1941
+ onPickerOpenChange: Ke
1942
+ }),
1943
+ l && i ? /* @__PURE__ */ H(et, {
1944
+ onStop: i,
1945
+ ariaLabel: C
1946
+ }) : !l && bt && /* @__PURE__ */ H($e, {
1947
+ onSend: Et,
1948
+ isDisabled: !wt || st || me,
1949
+ ariaLabel: S,
1950
+ isExiting: xt
1951
+ }, St)
1952
+ ] }), Tt && /* @__PURE__ */ H(te, {
1953
+ icon: /* @__PURE__ */ H(oe, {
1954
+ size: u.LG,
1780
1955
  "aria-hidden": !0
1781
1956
  }),
1782
- "aria-label": T,
1957
+ "aria-label": w,
1783
1958
  className: "size-8 flex-shrink-0",
1784
- onClick: tt,
1785
- disabled: F || a
1959
+ onClick: ft,
1960
+ disabled: F || l
1786
1961
  })]
1787
1962
  })
1788
1963
  ]
1789
1964
  })]
1790
1965
  });
1791
- }, At = { welcome: "_welcome_n2ph8_1" }, jt = ({ isStreaming: e = !1, placeholder: t = "Type a prompt or use \"/\" to select one", welcomeText: n, styles: r, className: i, isInputDisabled: a = !1, ...c }) => {
1792
- let { colors: l, typography: u } = r ?? {};
1966
+ }, It = { welcome: "_welcome_n2ph8_1" }, Lt = ({ isStreaming: e = !1, placeholder: t = "Type a prompt or use \"/\" to select one", welcomeText: n, styles: r, className: i, inputClassName: s, isInputDisabled: c = !1, ...l }) => {
1967
+ let { colors: u, typography: d } = r ?? {};
1793
1968
  return /* @__PURE__ */ U("div", {
1794
- style: o({
1795
- "--ci-root-bg": l?.background,
1796
- "--ci-welcome-color": l?.welcomeText
1797
- }),
1798
- className: s("relative flex w-full flex-col items-center gap-6 px-4 py-5 desktop:p-5", i),
1969
+ style: a({ "--ci-welcome-color": u?.welcomeText }),
1970
+ className: o("relative flex w-full flex-col items-center gap-6 px-4 py-5 desktop:p-5", i),
1799
1971
  children: [n && /* @__PURE__ */ H("h1", {
1800
- className: s(At.welcome, "m-0 text-center", u?.welcomeClassName),
1972
+ className: o(It.welcome, "m-0 text-center", d?.welcomeClassName || "dial-display2-text"),
1801
1973
  children: n
1802
1974
  }), /* @__PURE__ */ H("div", {
1803
1975
  className: "relative w-full max-w-[748px]",
1804
- children: /* @__PURE__ */ H(kt, {
1976
+ children: /* @__PURE__ */ H(Ft, {
1805
1977
  placeholder: t,
1806
1978
  isStreaming: e,
1807
- isInputDisabled: a,
1808
- ...c,
1809
- colors: l?.input,
1810
- typography: u?.input
1979
+ isInputDisabled: c,
1980
+ ...l,
1981
+ className: s,
1982
+ colors: u?.input,
1983
+ typography: d?.input
1811
1984
  })
1812
1985
  })]
1813
1986
  });
1814
- }, Mt = ({ message: e, initialAttachments: t = [], onCancel: n, onSave: r, onUploadAttachment: a, cancelLabel: o = "Cancel", saveLabel: c = "Save & Submit", ariaLabel: u, removeLabel: d, retryLabel: f, addMenuTitle: p = "Add", attachLabel: m = "Attach file", menuTitle: h = "Menu", menuCloseLabel: g = "Close", className: _, pendingDropFiles: v, onDropFilesConsumed: y, validateAttachment: b, hideAttachFile: x = !1, fileAccept: S, maximumAttachmentsAmount: C, onAttachmentsLimitExceeded: w, onDialFileSystemClick: T, dialFileSystemLabel: E, pendingAttachments: D, onPendingAttachmentsConsumed: ee }) => {
1815
- let O = z(null), [k, A] = B([]);
1987
+ }, Rt = ({ message: e, initialAttachments: t = [], onCancel: n, onSave: i, onUploadAttachment: a, cancelLabel: s = "Cancel", saveLabel: l = "Save & Submit", ariaLabel: u, removeLabel: d, retryLabel: f, addMenuTitle: p = "Add", attachLabel: m = "Attach file", menuTitle: h = "Menu", menuCloseLabel: g = "Close", className: _, pendingDropFiles: v, onDropFilesConsumed: y, validateAttachment: b, isAttachmentsEnabled: x, hideAttachFile: S = !1, fileAccept: C, maximumAttachmentsAmount: w, onAttachmentsLimitExceeded: T, onDialFileSystemClick: E, dialFileSystemLabel: O, pendingAttachments: A, onPendingAttachmentsConsumed: ee, onAttachmentClick: te, pasteTextThreshold: ne, onMessageTooLong: re }) => {
1988
+ let ie = z(null), [j, M] = B([]);
1816
1989
  L(() => {
1817
- v?.length && (A(v), y?.());
1990
+ v?.length && (M(v), y?.());
1818
1991
  }, [v, y]);
1819
- let [te, ne] = B(e ?? ""), [j, M] = B([]), [N, re] = B(t), ae = j.some((e) => e.status === i.Loading || e.status === i.Error), oe = (te.trim().length > 0 || j.length > 0 || N.length > 0) && !ae, se = (e) => {
1820
- re((t) => t.filter((t) => t.id !== e));
1992
+ let [oe, se] = B(e ?? ""), [ce, le] = B([]), [N, ue] = B(t), de = ce.some((e) => e.status === r.Loading || e.status === r.Error), fe = (oe.trim().length > 0 || ce.length > 0 || N.length > 0) && !de, pe = (e) => {
1993
+ ue((t) => t.filter((t) => t.id !== e));
1821
1994
  }, P = I((e, t) => {
1822
- r(e, N, t);
1823
- }, [N, r]), ce = () => {
1824
- oe && P(te, j);
1825
- }, le = I(() => A([]), []), ue = I((e) => {
1995
+ i(e, N, t);
1996
+ }, [N, i]), F = () => {
1997
+ if (fe) {
1998
+ if (!x && oe.length >= (ne ?? 4e3)) {
1999
+ re?.(oe.length, ne ?? 4e3);
2000
+ return;
2001
+ }
2002
+ P(oe, ce);
2003
+ }
2004
+ }, me = I(() => M([]), []), he = I((e) => {
1826
2005
  let t = Array.from(e.target.files ?? []);
1827
- t.length !== 0 && (e.target.value = "", A(t));
1828
- }, []), F = R(() => T ? [{
2006
+ t.length !== 0 && (e.target.value = "", M(t));
2007
+ }, []), ge = R(() => E ? [{
1829
2008
  key: "dial-fs",
1830
- label: E ?? "DIAL file system",
1831
- icon: /* @__PURE__ */ H(ie, {
1832
- size: l,
2009
+ label: O ?? "DIAL file system",
2010
+ icon: /* @__PURE__ */ H(ae, {
2011
+ size: c,
1833
2012
  "aria-hidden": !0
1834
2013
  }),
1835
- onClick: T
1836
- }] : [], [T, E]);
2014
+ onClick: E
2015
+ }] : [], [E, O]);
1837
2016
  return /* @__PURE__ */ U("div", {
1838
- className: s("flex w-full flex-col gap-2", _),
1839
- children: [/* @__PURE__ */ H(kt, {
2017
+ className: o("flex w-full flex-col gap-2", _),
2018
+ children: [/* @__PURE__ */ H(Ft, {
1840
2019
  message: e,
1841
2020
  ariaLabel: u,
1842
2021
  isStacked: !0,
1843
2022
  hideActionBar: !0,
1844
- pendingDropFiles: k,
1845
- onDropFilesConsumed: le,
2023
+ pendingDropFiles: j,
2024
+ onDropFilesConsumed: me,
1846
2025
  onSend: P,
1847
2026
  onUploadAttachment: a,
1848
- onChange: ne,
1849
- onAttachmentsChange: M,
2027
+ onChange: se,
2028
+ onAttachmentsChange: le,
1850
2029
  removeLabel: d,
1851
2030
  retryLabel: f,
1852
2031
  className: "max-w-full",
1853
2032
  prefixAttachments: N,
1854
- onRemovePrefixAttachment: se,
2033
+ onRemovePrefixAttachment: pe,
1855
2034
  validateAttachment: b,
1856
- maximumAttachmentsAmount: C,
1857
- onAttachmentsLimitExceeded: w,
1858
- pendingAttachments: D,
1859
- onPendingAttachmentsConsumed: ee
2035
+ isAttachmentsEnabled: x,
2036
+ maximumAttachmentsAmount: w,
2037
+ onAttachmentsLimitExceeded: T,
2038
+ pendingAttachments: A,
2039
+ onPendingAttachmentsConsumed: ee,
2040
+ onAttachmentClick: te,
2041
+ pasteTextThreshold: ne,
2042
+ onMessageTooLong: re
1860
2043
  }), /* @__PURE__ */ U("div", {
1861
2044
  className: "flex items-center justify-between",
1862
2045
  children: [/* @__PURE__ */ H("div", {
1863
2046
  className: "flex",
1864
- children: !x && /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("input", {
1865
- ref: O,
2047
+ children: !S && /* @__PURE__ */ U(V, { children: [/* @__PURE__ */ H("input", {
2048
+ ref: ie,
1866
2049
  type: "file",
1867
2050
  multiple: !0,
1868
- accept: S,
2051
+ accept: C,
1869
2052
  className: "sr-only",
1870
2053
  "aria-hidden": !0,
1871
2054
  tabIndex: -1,
1872
- onChange: ue
1873
- }), /* @__PURE__ */ H(Ge, {
1874
- onAttachClick: () => O.current?.click(),
2055
+ onChange: he
2056
+ }), /* @__PURE__ */ H(qe, {
2057
+ onAttachClick: () => ie.current?.click(),
1875
2058
  attachLabel: m,
1876
2059
  addMenuTitle: p,
1877
2060
  menuTitle: h,
1878
2061
  menuCloseLabel: g,
1879
- extraMenuItems: F
2062
+ extraMenuItems: ge
1880
2063
  })] })
1881
2064
  }), /* @__PURE__ */ U("div", {
1882
2065
  className: "flex gap-2",
1883
- children: [/* @__PURE__ */ H(Be, {
1884
- label: o,
2066
+ children: [/* @__PURE__ */ H(D, {
2067
+ label: s,
1885
2068
  onClick: n
1886
- }), /* @__PURE__ */ H(K, {
1887
- label: c,
1888
- onClick: ce,
1889
- disabled: !oe
2069
+ }), /* @__PURE__ */ H(k, {
2070
+ label: l,
2071
+ onClick: F,
2072
+ disabled: !fe
1890
2073
  })]
1891
2074
  })]
1892
2075
  })]
1893
2076
  });
1894
2077
  };
1895
2078
  //#endregion
1896
- export { me as AttachmentCard, he as AttachmentGroup, ge as AttachmentTray, W as BottomSheetShell, We as ChatSettingsModal, jt as ConversationInput, Mt as EditMessageInput, ve as FileDndOverlay, kt as Input, Ie as SendOnEnter, xe as getAttachmentIcon };
2079
+ export { ge as AttachmentCard, _e as AttachmentGroup, ve as AttachmentTray, W as BottomSheetShell, Ge as ChatSettingsModal, Lt as ConversationInput, Rt as EditMessageInput, be as FileDndOverlay, Ft as Input, Re as SendOnEnter, Ce as getAttachmentIcon };