@carto/ps-react-ui 4.3.10 → 4.4.0-chat-ui.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/chat.js +798 -0
  2. package/dist/chat.js.map +1 -0
  3. package/dist/components.js +260 -240
  4. package/dist/components.js.map +1 -1
  5. package/dist/types/chat/bubbles/chat-error-message.d.ts +2 -0
  6. package/dist/types/chat/bubbles/chat-suggestion-button.d.ts +2 -0
  7. package/dist/types/chat/bubbles/chat-user-message.d.ts +2 -0
  8. package/dist/types/chat/bubbles/index.d.ts +4 -0
  9. package/dist/types/chat/const.d.ts +3 -0
  10. package/dist/types/chat/containers/chat-content.d.ts +2 -0
  11. package/dist/types/chat/containers/chat-footer.d.ts +2 -0
  12. package/dist/types/chat/containers/chat-header.d.ts +2 -0
  13. package/dist/types/chat/containers/chat-starter.d.ts +2 -0
  14. package/dist/types/chat/containers/index.d.ts +4 -0
  15. package/dist/types/chat/containers/styles.d.ts +101 -0
  16. package/dist/types/chat/feedback/chat-loader.d.ts +2 -0
  17. package/dist/types/chat/feedback/chat-rating-action.d.ts +2 -0
  18. package/dist/types/chat/feedback/chat-thinking.d.ts +2 -0
  19. package/dist/types/chat/feedback/chat-tools.d.ts +2 -0
  20. package/dist/types/chat/feedback/index.d.ts +5 -0
  21. package/dist/types/chat/feedback/styles.d.ts +65 -0
  22. package/dist/types/chat/index.d.ts +16 -0
  23. package/dist/types/chat/types.d.ts +99 -0
  24. package/dist/types/components/copy-button/copy-button.d.ts +2 -0
  25. package/dist/types/components/copy-button/types.d.ts +6 -0
  26. package/dist/types/components/index.d.ts +2 -0
  27. package/dist/widgets/actions.js +22 -21
  28. package/dist/widgets/actions.js.map +1 -1
  29. package/dist/widgets/bar.js +7 -6
  30. package/dist/widgets/bar.js.map +1 -1
  31. package/dist/widgets/category.js +9 -8
  32. package/dist/widgets/category.js.map +1 -1
  33. package/dist/widgets/formula.js +11 -10
  34. package/dist/widgets/formula.js.map +1 -1
  35. package/dist/widgets/histogram.js +7 -6
  36. package/dist/widgets/histogram.js.map +1 -1
  37. package/dist/widgets/markdown.js +9 -8
  38. package/dist/widgets/markdown.js.map +1 -1
  39. package/dist/widgets/pie.js +7 -6
  40. package/dist/widgets/pie.js.map +1 -1
  41. package/dist/widgets/scatterplot.js +7 -6
  42. package/dist/widgets/scatterplot.js.map +1 -1
  43. package/dist/widgets/spread.js +57 -56
  44. package/dist/widgets/spread.js.map +1 -1
  45. package/dist/widgets/table.js +67 -66
  46. package/dist/widgets/table.js.map +1 -1
  47. package/dist/widgets/timeseries.js +23 -22
  48. package/dist/widgets/timeseries.js.map +1 -1
  49. package/dist/widgets/wrapper.js +21 -20
  50. package/dist/widgets/wrapper.js.map +1 -1
  51. package/package.json +7 -3
  52. package/src/chat/bubbles/chat-agent-message.test.tsx +30 -0
  53. package/src/chat/bubbles/chat-agent-message.tsx +11 -0
  54. package/src/chat/bubbles/chat-error-message.test.tsx +40 -0
  55. package/src/chat/bubbles/chat-error-message.tsx +47 -0
  56. package/src/chat/bubbles/chat-suggestion-button.test.tsx +24 -0
  57. package/src/chat/bubbles/chat-suggestion-button.tsx +27 -0
  58. package/src/chat/bubbles/chat-user-message.test.tsx +27 -0
  59. package/src/chat/bubbles/chat-user-message.tsx +27 -0
  60. package/src/chat/bubbles/index.ts +4 -0
  61. package/src/chat/bubbles/styles.ts +106 -0
  62. package/src/chat/const.ts +3 -0
  63. package/src/chat/containers/chat-content.test.tsx +15 -0
  64. package/src/chat/containers/chat-content.tsx +32 -0
  65. package/src/chat/containers/chat-footer.test.tsx +34 -0
  66. package/src/chat/containers/chat-footer.tsx +78 -0
  67. package/src/chat/containers/chat-header.test.tsx +28 -0
  68. package/src/chat/containers/chat-header.tsx +29 -0
  69. package/src/chat/containers/chat-starter.test.tsx +32 -0
  70. package/src/chat/containers/chat-starter.tsx +75 -0
  71. package/src/chat/containers/index.ts +4 -0
  72. package/src/chat/containers/styles.ts +107 -0
  73. package/src/chat/feedback/chat-actions-container.test.tsx +64 -0
  74. package/src/chat/feedback/chat-actions-container.tsx +7 -0
  75. package/src/chat/feedback/chat-loader.test.tsx +10 -0
  76. package/src/chat/feedback/chat-loader.tsx +31 -0
  77. package/src/chat/feedback/chat-rating-action.tsx +43 -0
  78. package/src/chat/feedback/chat-thinking.test.tsx +15 -0
  79. package/src/chat/feedback/chat-thinking.tsx +23 -0
  80. package/src/chat/feedback/chat-tools.test.tsx +23 -0
  81. package/src/chat/feedback/chat-tools.tsx +54 -0
  82. package/src/chat/feedback/index.ts +5 -0
  83. package/src/chat/feedback/styles.ts +80 -0
  84. package/src/chat/index.ts +45 -0
  85. package/src/chat/types.ts +124 -0
  86. package/src/components/copy-button/copy-button.test.tsx +41 -0
  87. package/src/components/copy-button/copy-button.tsx +31 -0
  88. package/src/components/copy-button/types.ts +10 -0
  89. package/src/components/index.ts +3 -0
package/dist/chat.js ADDED
@@ -0,0 +1,798 @@
1
+ import { jsx as d, jsxs as y, Fragment as K } from "react/jsx-runtime";
2
+ import { c as T } from "react/compiler-runtime";
3
+ import { styled as H, Typography as $, Box as x, Link as Y, ButtonBase as X, Fab as J, IconButton as O, FilledInput as V, FormHelperText as q, FormControl as Q, Accordion as Z, AccordionSummary as ee, AccordionDetails as te, CircularProgress as oe } from "@mui/material";
4
+ import { ErrorOutline as N, ArrowUpward as ne, KeyboardArrowDown as re, Close as le, StopCircleOutlined as se, ArrowUpwardOutlined as ie, ThumbUp as ae, ThumbUpOutlined as ce, ThumbDown as de, ThumbDownOutlined as me, ExpandMore as pe, CheckCircleOutline as fe } from "@mui/icons-material";
5
+ import { keyframes as P } from "@mui/material/styles";
6
+ import { useRef as ue } from "react";
7
+ const j = 768, Ee = 300, Fe = 100, G = H($)(() => ({
8
+ whiteSpace: "pre-wrap",
9
+ overflowX: "clip",
10
+ overflowWrap: "break-word",
11
+ maxWidth: "100%"
12
+ }));
13
+ G.displayName = "ChatMessageOverflow";
14
+ const A = {
15
+ agentMessageContainer: (t) => ({
16
+ width: "100%",
17
+ display: "flex",
18
+ flexDirection: "column",
19
+ alignItems: "flex-start",
20
+ paddingRight: t.spacing(4),
21
+ "& + .PsChat--agent-message": {
22
+ marginTop: t.spacing(1)
23
+ },
24
+ "& + .PsChat--user-message": {
25
+ marginTop: t.spacing(3)
26
+ }
27
+ }),
28
+ userMessageContainer: {
29
+ width: "100%",
30
+ display: "flex",
31
+ flexDirection: "column",
32
+ alignItems: "flex-end",
33
+ paddingLeft: ({
34
+ spacing: t
35
+ }) => t(4),
36
+ "&:has(+ .PsChat--user-message) > .PsChat--user-message-inner": {
37
+ borderRadius: ({
38
+ spacing: t
39
+ }) => t(2)
40
+ },
41
+ "& + .PsChat--user-message": {
42
+ marginTop: ({
43
+ spacing: t
44
+ }) => t(0.5)
45
+ },
46
+ "& + .PsChat--agent-message": {
47
+ marginTop: ({
48
+ spacing: t
49
+ }) => t(3)
50
+ }
51
+ },
52
+ userMessage: {
53
+ padding: ({
54
+ spacing: t
55
+ }) => t(0.75, 1.5),
56
+ borderRadius: ({
57
+ spacing: t
58
+ }) => t(2, 2, 0.25, 2),
59
+ border: ({
60
+ palette: t
61
+ }) => `1px solid ${t.divider}`,
62
+ backgroundColor: ({
63
+ palette: t
64
+ }) => t.background.default,
65
+ color: ({
66
+ palette: t
67
+ }) => t.text.primary,
68
+ width: "fit-content"
69
+ },
70
+ muted: {
71
+ color: ({
72
+ palette: t
73
+ }) => t.text.disabled
74
+ },
75
+ userMessageTop: {
76
+ textAlign: "right",
77
+ marginBottom: ({
78
+ spacing: t
79
+ }) => t(0.5)
80
+ },
81
+ errorMessage: {
82
+ display: "flex",
83
+ alignItems: "center",
84
+ flexWrap: "wrap",
85
+ gap: ({
86
+ spacing: t
87
+ }) => t(1)
88
+ },
89
+ errorActions: {
90
+ display: "flex",
91
+ alignItems: "center",
92
+ gap: ({
93
+ spacing: t
94
+ }) => t(0.5)
95
+ },
96
+ errorAction: {
97
+ color: ({
98
+ palette: t
99
+ }) => t.text.primary
100
+ },
101
+ errorActionSeparator: {
102
+ mr: 0.5,
103
+ color: ({
104
+ palette: t
105
+ }) => t.black[25],
106
+ fontWeight: 600
107
+ },
108
+ suggestionButton: {
109
+ transition: "border-color 0.2s",
110
+ width: "100%",
111
+ alignItems: "flex-start",
112
+ justifyContent: "space-between",
113
+ textAlign: "left",
114
+ gap: ({
115
+ spacing: t
116
+ }) => t(1),
117
+ padding: ({
118
+ spacing: t
119
+ }) => t(0.75, 1.5),
120
+ borderRadius: ({
121
+ spacing: t
122
+ }) => t(2),
123
+ border: ({
124
+ palette: t
125
+ }) => `1px solid ${t.divider}`,
126
+ "& .MuiSvgIcon-root": {
127
+ transition: "color 0.2s",
128
+ color: "inherit",
129
+ fontSize: ({
130
+ spacing: t
131
+ }) => t(1.5),
132
+ width: ({
133
+ spacing: t
134
+ }) => t(1.5),
135
+ minWidth: ({
136
+ spacing: t
137
+ }) => t(1.5),
138
+ height: ({
139
+ spacing: t
140
+ }) => t(2.5)
141
+ },
142
+ "&:not(.Mui-disabled) .MuiSvgIcon-root": {
143
+ color: ({
144
+ palette: t
145
+ }) => t.text.secondary
146
+ },
147
+ "&:hover": {
148
+ borderColor: ({
149
+ palette: t
150
+ }) => t.text.hint,
151
+ "& .MuiSvgIcon-root": {
152
+ color: ({
153
+ palette: t
154
+ }) => t.text.primary
155
+ }
156
+ },
157
+ "&.Mui-disabled": {
158
+ color: ({
159
+ palette: t
160
+ }) => t.text.disabled
161
+ }
162
+ }
163
+ };
164
+ function Oe(t) {
165
+ const e = T(11), {
166
+ children: n,
167
+ muted: o,
168
+ topContext: i,
169
+ sx: l
170
+ } = t, m = o === void 0 ? !1 : o;
171
+ let a;
172
+ e[0] !== i ? (a = i && /* @__PURE__ */ d(x, { sx: A.userMessageTop, children: i }), e[0] = i, e[1] = a) : a = e[1];
173
+ const s = m ? A.muted : void 0;
174
+ let r;
175
+ e[2] !== l || e[3] !== s ? (r = {
176
+ ...A.userMessage,
177
+ ...s,
178
+ ...l
179
+ }, e[2] = l, e[3] = s, e[4] = r) : r = e[4];
180
+ let c;
181
+ e[5] !== n || e[6] !== r ? (c = /* @__PURE__ */ d(G, { className: "PsChat--user-message-inner", variant: "body2", sx: r, children: n }), e[5] = n, e[6] = r, e[7] = c) : c = e[7];
182
+ let p;
183
+ return e[8] !== a || e[9] !== c ? (p = /* @__PURE__ */ y(x, { className: "PsChat--user-message", sx: A.userMessageContainer, children: [
184
+ a,
185
+ c
186
+ ] }), e[8] = a, e[9] = c, e[10] = p) : p = e[10], p;
187
+ }
188
+ const he = (t) => {
189
+ const e = T(6);
190
+ let n, o;
191
+ e[0] !== t ? ({
192
+ className: n,
193
+ ...o
194
+ } = t, e[0] = t, e[1] = n, e[2] = o) : (n = e[1], o = e[2]);
195
+ const i = `PsChat--agent-message ${n ?? ""}`;
196
+ let l;
197
+ return e[3] !== o || e[4] !== i ? (l = /* @__PURE__ */ d(x, { className: i, ...o }), e[3] = o, e[4] = i, e[5] = l) : l = e[5], l;
198
+ }, ge = H(he)(({
199
+ theme: t
200
+ }) => A.agentMessageContainer(t));
201
+ ge.displayName = "ChatAgentMessage";
202
+ function Pe(t) {
203
+ const e = T(13), {
204
+ errors: n,
205
+ icon: o,
206
+ actions: i,
207
+ sx: l
208
+ } = t;
209
+ let m;
210
+ e[0] !== l ? (m = {
211
+ ...A.errorMessage,
212
+ ...l
213
+ }, e[0] = l, e[1] = m) : m = e[1];
214
+ let a;
215
+ e[2] !== o ? (a = o ?? /* @__PURE__ */ d(N, { fontSize: "medium", color: "error" }), e[2] = o, e[3] = a) : a = e[3];
216
+ let s;
217
+ e[4] !== n ? (s = n.map(xe), e[4] = n, e[5] = s) : s = e[5];
218
+ let r;
219
+ e[6] !== i ? (r = i?.length ? /* @__PURE__ */ d(x, { sx: A.errorActions, children: (i ?? []).map(be) }) : null, e[6] = i, e[7] = r) : r = e[7];
220
+ let c;
221
+ return e[8] !== m || e[9] !== a || e[10] !== s || e[11] !== r ? (c = /* @__PURE__ */ y(x, { sx: m, children: [
222
+ a,
223
+ s,
224
+ r
225
+ ] }), e[8] = m, e[9] = a, e[10] = s, e[11] = r, e[12] = c) : c = e[12], c;
226
+ }
227
+ function be(t, e) {
228
+ return /* @__PURE__ */ y("span", { children: [
229
+ e > 0 && /* @__PURE__ */ d($, { component: "span", variant: "body2", sx: A.errorActionSeparator, children: "·" }),
230
+ /* @__PURE__ */ d(Y, { component: "button", variant: "body2", onClick: t.onClick, sx: A.errorAction, children: t.label })
231
+ ] }, e);
232
+ }
233
+ function xe(t, e) {
234
+ return /* @__PURE__ */ d($, { variant: "subtitle2", color: "error.relatedDark", children: t }, e);
235
+ }
236
+ function Ce(t) {
237
+ const e = T(17);
238
+ let n, o, i, l;
239
+ e[0] !== t ? ({
240
+ label: o,
241
+ color: n,
242
+ sx: l,
243
+ ...i
244
+ } = t, e[0] = t, e[1] = n, e[2] = o, e[3] = i, e[4] = l) : (n = e[1], o = e[2], i = e[3], l = e[4]);
245
+ let m;
246
+ e[5] !== n ? (m = n ? {
247
+ backgroundColor: n
248
+ } : void 0, e[5] = n, e[6] = m) : m = e[6];
249
+ let a;
250
+ e[7] !== l || e[8] !== m ? (a = {
251
+ ...A.suggestionButton,
252
+ ...m,
253
+ ...l
254
+ }, e[7] = l, e[8] = m, e[9] = a) : a = e[9];
255
+ let s;
256
+ e[10] !== o ? (s = /* @__PURE__ */ d($, { color: "inherit", variant: "body2", children: o }), e[10] = o, e[11] = s) : s = e[11];
257
+ let r;
258
+ e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ d(ne, {}), e[12] = r) : r = e[12];
259
+ let c;
260
+ return e[13] !== i || e[14] !== a || e[15] !== s ? (c = /* @__PURE__ */ y(X, { sx: a, ...i, children: [
261
+ s,
262
+ r
263
+ ] }), e[13] = i, e[14] = a, e[15] = s, e[16] = c) : c = e[16], c;
264
+ }
265
+ const ye = P`
266
+ 0% {
267
+ background-position: 150% 0;
268
+ }
269
+ 100% {
270
+ background-position: -50% 0;
271
+ }
272
+ `, ve = P`
273
+ 0% { transform: scale(0.68); opacity: 0.7; }
274
+ 40% { transform: scale(1); opacity: 1; }
275
+ 80% { transform: scale(0.6); opacity: 0.65; }
276
+ 100% { transform: scale(0.68); opacity: 0.7; }
277
+ `, Te = P`
278
+ 0% { transform: scale(1); }
279
+ 40% { transform: scale(0.75); }
280
+ 80% { transform: scale(1.125); }
281
+ 100% { transform: scale(1); }
282
+ `, z = {
283
+ thinking: {
284
+ display: "flex",
285
+ alignItems: "center",
286
+ minHeight: ({
287
+ spacing: t
288
+ }) => t(3),
289
+ background: ({
290
+ palette: t
291
+ }) => `linear-gradient(
292
+ 90deg,
293
+ ${t.text.disabled} 25%,
294
+ ${t.text.secondary} 50%,
295
+ ${t.text.disabled} 75%
296
+ )`,
297
+ backgroundSize: "200% 100%",
298
+ backgroundClip: "text",
299
+ WebkitBackgroundClip: "text",
300
+ WebkitTextFillColor: "transparent",
301
+ animation: `${ye} 2s ease-in-out infinite`,
302
+ animationDuration: "2s"
303
+ },
304
+ loader: {
305
+ display: "flex",
306
+ alignItems: "center",
307
+ justifyContent: "center",
308
+ position: "relative",
309
+ p: 1
310
+ },
311
+ loaderOuterCircle: {
312
+ position: "absolute",
313
+ inset: 0,
314
+ margin: "auto",
315
+ borderRadius: "50%",
316
+ backgroundColor: ({
317
+ palette: t
318
+ }) => t.action.disabled,
319
+ animation: `${ve} 1s ease-in-out infinite`
320
+ },
321
+ loaderInnerCircle: {
322
+ position: "absolute",
323
+ inset: 0,
324
+ margin: "auto",
325
+ borderRadius: "50%",
326
+ backgroundColor: ({
327
+ palette: t
328
+ }) => t.text.primary,
329
+ animation: `${Te} 1s ease-in-out infinite`
330
+ },
331
+ tools: {
332
+ width: "100%"
333
+ },
334
+ toolHeader: {
335
+ display: "flex",
336
+ alignItems: "center",
337
+ gap: ({
338
+ spacing: t
339
+ }) => t(1)
340
+ },
341
+ toolStatusIcon: {
342
+ display: "flex",
343
+ alignItems: "center"
344
+ }
345
+ };
346
+ function we(t) {
347
+ const e = T(6), {
348
+ children: n,
349
+ duration: o,
350
+ sx: i
351
+ } = t, l = n === void 0 ? "Thinking..." : n, a = `${(o === void 0 ? 2e3 : o) / 1e3}s`;
352
+ let s;
353
+ e[0] !== a || e[1] !== i ? (s = {
354
+ ...z.thinking,
355
+ animationDuration: a,
356
+ ...i
357
+ }, e[0] = a, e[1] = i, e[2] = s) : s = e[2];
358
+ let r;
359
+ return e[3] !== l || e[4] !== s ? (r = /* @__PURE__ */ d($, { variant: "body2", sx: s, children: l }), e[3] = l, e[4] = s, e[5] = r) : r = e[5], r;
360
+ }
361
+ function Re(t) {
362
+ const e = T(16), {
363
+ size: n,
364
+ labels: o,
365
+ sx: i
366
+ } = t, l = n === void 0 ? 24 : n;
367
+ let m;
368
+ e[0] !== o ? (m = o === void 0 ? {} : o, e[0] = o, e[1] = m) : m = e[1];
369
+ const s = m.loading ?? "Loading";
370
+ let r;
371
+ e[2] !== l || e[3] !== i ? (r = {
372
+ ...z.loader,
373
+ width: l,
374
+ height: l,
375
+ ...i
376
+ }, e[2] = l, e[3] = i, e[4] = r) : r = e[4];
377
+ const c = l * 0.75, p = l * 0.75;
378
+ let f;
379
+ e[5] !== c || e[6] !== p ? (f = /* @__PURE__ */ d(x, { component: "span", sx: {
380
+ ...z.loaderOuterCircle,
381
+ width: c,
382
+ height: p
383
+ } }), e[5] = c, e[6] = p, e[7] = f) : f = e[7];
384
+ const u = l * 0.32, g = l * 0.32;
385
+ let b;
386
+ e[8] !== g || e[9] !== u ? (b = /* @__PURE__ */ d(x, { component: "span", sx: {
387
+ ...z.loaderInnerCircle,
388
+ width: u,
389
+ height: g
390
+ } }), e[8] = g, e[9] = u, e[10] = b) : b = e[10];
391
+ let h;
392
+ return e[11] !== b || e[12] !== s || e[13] !== r || e[14] !== f ? (h = /* @__PURE__ */ y(x, { role: "status", "aria-busy": !0, "aria-label": s, sx: r, children: [
393
+ f,
394
+ b
395
+ ] }), e[11] = b, e[12] = s, e[13] = r, e[14] = f, e[15] = h) : h = e[15], h;
396
+ }
397
+ const Se = P`
398
+ 0% { border-top-color: transparent; border-bottom-color: var(--chat-border-color) }
399
+ 0.1% { border-top-color: var(--chat-border-color); border-bottom-color: var(--chat-border-color) }
400
+ 99.9% { border-top-color: var(--chat-border-color); border-bottom-color: var(--chat-border-color) }
401
+ 100% { border-top-color: var(--chat-border-color); border-bottom-color: transparent }
402
+ `, Ie = P`
403
+ 0% { opacity: 1; pointer-events: auto }
404
+ 95% { opacity: 1; pointer-events: auto }
405
+ 100% { opacity: 0; pointer-events: none }
406
+ `, v = {
407
+ header: {
408
+ display: "flex",
409
+ alignItems: "center",
410
+ justifyContent: "space-between",
411
+ padding: ({
412
+ spacing: t
413
+ }) => t(1)
414
+ },
415
+ headerTitle: {
416
+ flexGrow: 1,
417
+ px: ({
418
+ spacing: t
419
+ }) => t(0.5)
420
+ },
421
+ headerActions: {
422
+ display: "flex",
423
+ alignItems: "center",
424
+ marginLeft: ({
425
+ spacing: t
426
+ }) => t(2),
427
+ gap: ({
428
+ spacing: t
429
+ }) => t(0.5)
430
+ },
431
+ footerWrapper: {
432
+ padding: ({
433
+ spacing: t
434
+ }) => t(1),
435
+ position: "relative"
436
+ },
437
+ footerCorner: {
438
+ position: "absolute",
439
+ bottom: "38px",
440
+ right: `max(16px, calc(50% - ${j / 2}px + 6px))`,
441
+ margin: "0 auto"
442
+ },
443
+ footer: {
444
+ maxWidth: j,
445
+ margin: "0 auto"
446
+ },
447
+ footerCaption: {
448
+ textAlign: "center"
449
+ },
450
+ content: {
451
+ overflowY: "auto",
452
+ flex: 1,
453
+ position: "relative",
454
+ mx: "auto",
455
+ maxWidth: j,
456
+ width: "100%",
457
+ maxHeight: "100%",
458
+ pt: 1,
459
+ pb: 2,
460
+ px: 2,
461
+ display: "flex",
462
+ flexDirection: "column",
463
+ "--chat-border-color": ({
464
+ palette: t
465
+ }) => t.divider,
466
+ borderTop: "1px solid transparent",
467
+ borderBottom: "1px solid transparent",
468
+ "@supports (animation-timeline: scroll())": {
469
+ animation: `${Se} linear both`,
470
+ animationTimeline: "scroll(self)"
471
+ }
472
+ },
473
+ jumpToLatestWrapper: {
474
+ position: "sticky",
475
+ bottom: ({
476
+ spacing: t
477
+ }) => t(3),
478
+ height: 0,
479
+ display: "flex",
480
+ justifyContent: "center",
481
+ zIndex: 1
482
+ },
483
+ jumpToLatest: {
484
+ opacity: 0,
485
+ pointerEvents: "none",
486
+ "@supports (animation-timeline: scroll())": {
487
+ animation: `${Ie} linear both`,
488
+ animationTimeline: "scroll(nearest)"
489
+ }
490
+ },
491
+ starter: {
492
+ display: "flex",
493
+ flexDirection: "column",
494
+ alignItems: "center",
495
+ justifyContent: "center",
496
+ padding: ({
497
+ spacing: t
498
+ }) => t(3),
499
+ textAlign: "center",
500
+ maxWidth: j,
501
+ margin: "0 auto"
502
+ },
503
+ starterItems: {
504
+ display: "grid",
505
+ width: "100%",
506
+ marginTop: ({
507
+ spacing: t
508
+ }) => t(2)
509
+ },
510
+ starterItemsTwoCol: {
511
+ gridTemplateColumns: "repeat(2, 1fr)"
512
+ }
513
+ };
514
+ function je(t) {
515
+ const e = T(12), {
516
+ children: n,
517
+ labels: o,
518
+ sx: i
519
+ } = t;
520
+ let l;
521
+ e[0] !== o ? (l = o === void 0 ? {} : o, e[0] = o, e[1] = l) : l = e[1];
522
+ const m = l, a = ue(null);
523
+ let s;
524
+ e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = () => {
525
+ a.current?.scrollTo({
526
+ top: a.current.scrollHeight,
527
+ behavior: "smooth"
528
+ });
529
+ }, e[2] = s) : s = e[2];
530
+ const r = s;
531
+ let c;
532
+ e[3] !== i ? (c = {
533
+ ...v.content,
534
+ ...i
535
+ }, e[3] = i, e[4] = c) : c = e[4];
536
+ const p = m.jumpToLatest ?? "Jump to latest";
537
+ let f;
538
+ e[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ d(re, {}), e[5] = f) : f = e[5];
539
+ let u;
540
+ e[6] !== p ? (u = /* @__PURE__ */ d(x, { sx: v.jumpToLatestWrapper, children: /* @__PURE__ */ d(J, { size: "small", onClick: r, "aria-label": p, sx: v.jumpToLatest, children: f }) }), e[6] = p, e[7] = u) : u = e[7];
541
+ let g;
542
+ return e[8] !== n || e[9] !== c || e[10] !== u ? (g = /* @__PURE__ */ y(x, { ref: a, sx: c, children: [
543
+ n,
544
+ u
545
+ ] }), e[8] = n, e[9] = c, e[10] = u, e[11] = g) : g = e[11], g;
546
+ }
547
+ function He(t) {
548
+ const e = T(14), {
549
+ leftSlot: n,
550
+ title: o,
551
+ rightSlot: i,
552
+ onClose: l,
553
+ sx: m
554
+ } = t;
555
+ let a;
556
+ e[0] !== m ? (a = {
557
+ ...v.header,
558
+ ...m
559
+ }, e[0] = m, e[1] = a) : a = e[1];
560
+ let s;
561
+ e[2] !== o ? (s = /* @__PURE__ */ d($, { variant: "subtitle2", sx: v.headerTitle, children: o }), e[2] = o, e[3] = s) : s = e[3];
562
+ let r;
563
+ e[4] !== l ? (r = l && /* @__PURE__ */ d(O, { size: "medium", onClick: l, "aria-label": "Close", children: /* @__PURE__ */ d(le, {}) }), e[4] = l, e[5] = r) : r = e[5];
564
+ let c;
565
+ e[6] !== i || e[7] !== r ? (c = /* @__PURE__ */ y(x, { sx: v.headerActions, children: [
566
+ i,
567
+ r
568
+ ] }), e[6] = i, e[7] = r, e[8] = c) : c = e[8];
569
+ let p;
570
+ return e[9] !== n || e[10] !== a || e[11] !== s || e[12] !== c ? (p = /* @__PURE__ */ y(x, { sx: a, children: [
571
+ n,
572
+ s,
573
+ c
574
+ ] }), e[9] = n, e[10] = a, e[11] = s, e[12] = c, e[13] = p) : p = e[13], p;
575
+ }
576
+ const ke = "Responses are AI generated. Please verify key information.";
577
+ function Ue(t) {
578
+ const e = T(35), {
579
+ value: n,
580
+ onChange: o,
581
+ onSend: i,
582
+ onStop: l,
583
+ isGenerating: m,
584
+ disabled: a,
585
+ placeholder: s,
586
+ labels: r,
587
+ caption: c,
588
+ sx: p
589
+ } = t, f = m === void 0 ? !1 : m, u = a === void 0 ? !1 : a, g = s === void 0 ? "Type a message..." : s;
590
+ let b;
591
+ e[0] !== r ? (b = r === void 0 ? {} : r, e[0] = r, e[1] = b) : b = e[1];
592
+ const h = b, C = c === void 0 ? ke : c;
593
+ let w;
594
+ e[2] !== u || e[3] !== f || e[4] !== n ? (w = n.trim() && !u && !f, e[2] = u, e[3] = f, e[4] = n, e[5] = w) : w = e[5];
595
+ const S = w;
596
+ let L;
597
+ e[6] !== S || e[7] !== i ? (L = (F) => {
598
+ F.key === "Enter" && !F.shiftKey && (F.preventDefault(), S && i());
599
+ }, e[6] = S, e[7] = i, e[8] = L) : L = e[8];
600
+ const M = L;
601
+ let I;
602
+ e[9] !== p ? (I = {
603
+ ...v.footerWrapper,
604
+ ...p
605
+ }, e[9] = p, e[10] = I) : I = e[10];
606
+ let k;
607
+ e[11] !== o ? (k = (F) => o(F.target.value), e[11] = o, e[12] = k) : k = e[12];
608
+ const D = u || f;
609
+ let _;
610
+ e[13] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = {
611
+ minHeight: 0
612
+ }, e[13] = _) : _ = e[13];
613
+ let W;
614
+ e[14] !== M || e[15] !== g || e[16] !== k || e[17] !== D || e[18] !== n ? (W = /* @__PURE__ */ d(V, { multiline: !0, value: n, onChange: k, onKeyDown: M, placeholder: g, disabled: D, sx: v.footer, style: _, fullWidth: !0, size: "small" }), e[14] = M, e[15] = g, e[16] = k, e[17] = D, e[18] = n, e[19] = W) : W = e[19];
615
+ let B;
616
+ e[20] !== S || e[21] !== u || e[22] !== f || e[23] !== h.send || e[24] !== h.stop || e[25] !== i || e[26] !== l ? (B = /* @__PURE__ */ d(x, { sx: v.footerCorner, children: f && l ? /* @__PURE__ */ d(O, { size: "small", onClick: l, disabled: u, "aria-label": h.stop ?? "Stop", children: /* @__PURE__ */ d(se, {}) }) : /* @__PURE__ */ d(O, { size: "small", variant: "contained", onClick: i, disabled: !S, "aria-label": h.send ?? "Send", children: /* @__PURE__ */ d(ie, {}) }) }), e[20] = S, e[21] = u, e[22] = f, e[23] = h.send, e[24] = h.stop, e[25] = i, e[26] = l, e[27] = B) : B = e[27];
617
+ let E;
618
+ e[28] !== C ? (E = C ? /* @__PURE__ */ d(q, { sx: v.footerCaption, children: C }) : null, e[28] = C, e[29] = E) : E = e[29];
619
+ let R;
620
+ return e[30] !== W || e[31] !== B || e[32] !== E || e[33] !== I ? (R = /* @__PURE__ */ y(Q, { fullWidth: !0, sx: I, children: [
621
+ W,
622
+ B,
623
+ E
624
+ ] }), e[30] = W, e[31] = B, e[32] = E, e[33] = I, e[34] = R) : R = e[34], R;
625
+ }
626
+ const U = [
627
+ "#C9DB7440",
628
+ // pastel green
629
+ "#FE88B140",
630
+ // pastel red
631
+ "#9EB9F340",
632
+ // pastel blue
633
+ "#F6CF7140"
634
+ // pastel yellow
635
+ ];
636
+ function Ne(t) {
637
+ const e = T(40), {
638
+ icon: n,
639
+ title: o,
640
+ description: i,
641
+ items: l,
642
+ size: m,
643
+ onSelect: a,
644
+ sx: s
645
+ } = t, r = m === void 0 ? "small" : m;
646
+ let c, p, f, u, g, b, h, C;
647
+ if (e[0] !== i || e[1] !== n || e[2] !== l || e[3] !== a || e[4] !== r || e[5] !== s || e[6] !== o) {
648
+ const L = l.map(Ae);
649
+ p = x;
650
+ const M = r === "small" ? 1 : 2;
651
+ e[15] !== s || e[16] !== M ? (g = {
652
+ ...v.starter,
653
+ gap: M,
654
+ ...s
655
+ }, e[15] = s, e[16] = M, e[17] = g) : g = e[17], b = n, e[18] !== r || e[19] !== o ? (h = o && /* @__PURE__ */ d($, { variant: r === "small" ? "h6" : "h5", children: o }), e[18] = r, e[19] = o, e[20] = h) : h = e[20], e[21] !== i || e[22] !== r ? (C = i && /* @__PURE__ */ d($, { variant: r === "small" ? "body2" : "body1", color: "text.secondary", children: i }), e[21] = i, e[22] = r, e[23] = C) : C = e[23], c = x;
656
+ const I = r === "small" ? 1 : 2, k = l.length > 2 ? v.starterItemsTwoCol : void 0;
657
+ e[24] !== k || e[25] !== I ? (f = {
658
+ ...v.starterItems,
659
+ gap: I,
660
+ ...k
661
+ }, e[24] = k, e[25] = I, e[26] = f) : f = e[26];
662
+ let D;
663
+ e[27] !== a ? (D = (_) => /* @__PURE__ */ d(Ce, { label: _.label, onClick: () => a?.(_.label), color: _.color }, _.label), e[27] = a, e[28] = D) : D = e[28], u = L.map(D), e[0] = i, e[1] = n, e[2] = l, e[3] = a, e[4] = r, e[5] = s, e[6] = o, e[7] = c, e[8] = p, e[9] = f, e[10] = u, e[11] = g, e[12] = b, e[13] = h, e[14] = C;
664
+ } else
665
+ c = e[7], p = e[8], f = e[9], u = e[10], g = e[11], b = e[12], h = e[13], C = e[14];
666
+ let w;
667
+ e[29] !== c || e[30] !== f || e[31] !== u ? (w = /* @__PURE__ */ d(c, { sx: f, children: u }), e[29] = c, e[30] = f, e[31] = u, e[32] = w) : w = e[32];
668
+ let S;
669
+ return e[33] !== p || e[34] !== g || e[35] !== b || e[36] !== h || e[37] !== C || e[38] !== w ? (S = /* @__PURE__ */ y(p, { sx: g, children: [
670
+ b,
671
+ h,
672
+ C,
673
+ w
674
+ ] }), e[33] = p, e[34] = g, e[35] = b, e[36] = h, e[37] = C, e[38] = w, e[39] = S) : S = e[39], S;
675
+ }
676
+ function Ae(t, e) {
677
+ return typeof t == "string" ? {
678
+ label: t,
679
+ color: U[e]
680
+ } : {
681
+ label: t.label,
682
+ color: t.color ?? U[e]
683
+ };
684
+ }
685
+ const Ge = H(x)(({
686
+ theme: t
687
+ }) => ({
688
+ display: "flex",
689
+ alignItems: "center",
690
+ gap: t.spacing(0.5)
691
+ }));
692
+ function Ke(t) {
693
+ const e = T(25), {
694
+ rating: n,
695
+ onRatingChange: o,
696
+ labels: i
697
+ } = t;
698
+ let l;
699
+ e[0] !== i ? (l = i === void 0 ? {} : i, e[0] = i, e[1] = l) : l = e[1];
700
+ const m = l;
701
+ let a;
702
+ e[2] !== o || e[3] !== n ? (a = () => o?.(n === "up" ? null : "up"), e[2] = o, e[3] = n, e[4] = a) : a = e[4];
703
+ const s = m.thumbUp ?? "Thumbs up", r = n === "up" ? "primary" : void 0;
704
+ let c;
705
+ e[5] !== n ? (c = n === "up" ? /* @__PURE__ */ d(ae, { fontSize: "small" }) : /* @__PURE__ */ d(ce, { fontSize: "small" }), e[5] = n, e[6] = c) : c = e[6];
706
+ let p;
707
+ e[7] !== a || e[8] !== s || e[9] !== r || e[10] !== c ? (p = /* @__PURE__ */ d(O, { size: "small", onClick: a, "aria-label": s, color: r, children: c }), e[7] = a, e[8] = s, e[9] = r, e[10] = c, e[11] = p) : p = e[11];
708
+ let f;
709
+ e[12] !== o || e[13] !== n ? (f = () => o?.(n === "down" ? null : "down"), e[12] = o, e[13] = n, e[14] = f) : f = e[14];
710
+ const u = m.thumbDown ?? "Thumbs down", g = n === "down" ? "primary" : void 0;
711
+ let b;
712
+ e[15] !== n ? (b = n === "down" ? /* @__PURE__ */ d(de, { fontSize: "small" }) : /* @__PURE__ */ d(me, { fontSize: "small" }), e[15] = n, e[16] = b) : b = e[16];
713
+ let h;
714
+ e[17] !== g || e[18] !== b || e[19] !== f || e[20] !== u ? (h = /* @__PURE__ */ d(O, { size: "small", onClick: f, "aria-label": u, color: g, children: b }), e[17] = g, e[18] = b, e[19] = f, e[20] = u, e[21] = h) : h = e[21];
715
+ let C;
716
+ return e[22] !== h || e[23] !== p ? (C = /* @__PURE__ */ y(K, { children: [
717
+ p,
718
+ h
719
+ ] }), e[22] = h, e[23] = p, e[24] = C) : C = e[24], C;
720
+ }
721
+ function $e(t) {
722
+ const e = T(4), {
723
+ status: n
724
+ } = t;
725
+ switch (n) {
726
+ case "loading": {
727
+ let o;
728
+ return e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ d(oe, { size: 16 }), e[0] = o) : o = e[0], o;
729
+ }
730
+ case "thinking": {
731
+ let o;
732
+ return e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ d(we, { children: "..." }), e[1] = o) : o = e[1], o;
733
+ }
734
+ case "complete": {
735
+ let o;
736
+ return e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ d(fe, { fontSize: "small", color: "success" }), e[2] = o) : o = e[2], o;
737
+ }
738
+ case "error": {
739
+ let o;
740
+ return e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ d(N, { fontSize: "small", color: "error" }), e[3] = o) : o = e[3], o;
741
+ }
742
+ }
743
+ }
744
+ function Ye(t) {
745
+ const e = T(12), {
746
+ tools: n,
747
+ labels: o,
748
+ sx: i
749
+ } = t;
750
+ let l;
751
+ e[0] !== o ? (l = o === void 0 ? {} : o, e[0] = o, e[1] = l) : l = e[1];
752
+ const m = l;
753
+ let a;
754
+ e[2] !== i ? (a = {
755
+ ...z.tools,
756
+ ...i
757
+ }, e[2] = i, e[3] = a) : a = e[3];
758
+ let s;
759
+ e[4] !== m.title ? (s = m.title && /* @__PURE__ */ d($, { variant: "caption", color: "text.secondary", sx: {
760
+ mb: 1
761
+ }, children: m.title }), e[4] = m.title, e[5] = s) : s = e[5];
762
+ let r;
763
+ e[6] !== n ? (r = n.map(_e), e[6] = n, e[7] = r) : r = e[7];
764
+ let c;
765
+ return e[8] !== a || e[9] !== s || e[10] !== r ? (c = /* @__PURE__ */ y(x, { sx: a, children: [
766
+ s,
767
+ r
768
+ ] }), e[8] = a, e[9] = s, e[10] = r, e[11] = c) : c = e[11], c;
769
+ }
770
+ function _e(t) {
771
+ return /* @__PURE__ */ y(Z, { disableGutters: !0, elevation: 0, children: [
772
+ /* @__PURE__ */ d(ee, { expandIcon: /* @__PURE__ */ d(pe, {}), children: /* @__PURE__ */ y(x, { sx: z.toolHeader, children: [
773
+ /* @__PURE__ */ d(x, { sx: z.toolStatusIcon, children: /* @__PURE__ */ d($e, { status: t.status }) }),
774
+ /* @__PURE__ */ d($, { variant: "body2", children: t.name })
775
+ ] }) }),
776
+ t.content && /* @__PURE__ */ d(te, { children: t.content })
777
+ ] }, t.id);
778
+ }
779
+ export {
780
+ Fe as CHAT_DIVIDER_DELAY,
781
+ j as CHAT_MAX_WIDTH,
782
+ Ee as CHAT_SCROLL_DELAY,
783
+ Ge as ChatActionsContainer,
784
+ ge as ChatAgentMessage,
785
+ je as ChatContent,
786
+ Pe as ChatErrorMessage,
787
+ Ue as ChatFooter,
788
+ He as ChatHeader,
789
+ Re as ChatLoader,
790
+ G as ChatMessageOverflow,
791
+ Ke as ChatRatingAction,
792
+ Ne as ChatStarter,
793
+ Ce as ChatSuggestionButton,
794
+ we as ChatThinking,
795
+ Ye as ChatTools,
796
+ Oe as ChatUserMessage
797
+ };
798
+ //# sourceMappingURL=chat.js.map