@epam/ai-dial-conversation-input 1.1.0-dev.17 → 1.1.0-dev.170

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