@agentiffai/design 0.1.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 (82) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/LICENSE +21 -0
  3. package/README.md +187 -0
  4. package/assets/layout/main-pane-section.png +0 -0
  5. package/assets/layout/nav-complete.png +0 -0
  6. package/assets/layout/nav-horizontal-section.png +0 -0
  7. package/assets/layout/nav-vertical-section.png +0 -0
  8. package/assets/layout/pane-section-dropdowns.png +0 -0
  9. package/assets/layout/pane-section-header.png +0 -0
  10. package/dist/Window-B6e_UfLV.d.ts +429 -0
  11. package/dist/Window-CgGFIYHS.d.cts +429 -0
  12. package/dist/chunk-CNVJ5UF2.js +2069 -0
  13. package/dist/chunk-CNVJ5UF2.js.map +1 -0
  14. package/dist/chunk-CVHHTWDQ.cjs +72 -0
  15. package/dist/chunk-CVHHTWDQ.cjs.map +1 -0
  16. package/dist/chunk-H4VHCHCP.cjs +1268 -0
  17. package/dist/chunk-H4VHCHCP.cjs.map +1 -0
  18. package/dist/chunk-JQ6Q7MDQ.js +67 -0
  19. package/dist/chunk-JQ6Q7MDQ.js.map +1 -0
  20. package/dist/chunk-KNSPBTTJ.cjs +2158 -0
  21. package/dist/chunk-KNSPBTTJ.cjs.map +1 -0
  22. package/dist/chunk-MNXQDDWP.js +2143 -0
  23. package/dist/chunk-MNXQDDWP.js.map +1 -0
  24. package/dist/chunk-P4Q3MHIY.cjs +2093 -0
  25. package/dist/chunk-P4Q3MHIY.cjs.map +1 -0
  26. package/dist/chunk-PAOXD7DF.js +1253 -0
  27. package/dist/chunk-PAOXD7DF.js.map +1 -0
  28. package/dist/copilotkit/index.cjs +611 -0
  29. package/dist/copilotkit/index.cjs.map +1 -0
  30. package/dist/copilotkit/index.d.cts +162 -0
  31. package/dist/copilotkit/index.d.ts +162 -0
  32. package/dist/copilotkit/index.js +538 -0
  33. package/dist/copilotkit/index.js.map +1 -0
  34. package/dist/icons/index.cjs +48 -0
  35. package/dist/icons/index.cjs.map +1 -0
  36. package/dist/icons/index.d.cts +375 -0
  37. package/dist/icons/index.d.ts +375 -0
  38. package/dist/icons/index.js +3 -0
  39. package/dist/icons/index.js.map +1 -0
  40. package/dist/index.cjs +536 -0
  41. package/dist/index.cjs.map +1 -0
  42. package/dist/index.d-DYU1eVeb.d.cts +252 -0
  43. package/dist/index.d-DYU1eVeb.d.ts +252 -0
  44. package/dist/index.d.cts +185 -0
  45. package/dist/index.d.ts +185 -0
  46. package/dist/index.js +358 -0
  47. package/dist/index.js.map +1 -0
  48. package/dist/layout/index.cjs +48 -0
  49. package/dist/layout/index.cjs.map +1 -0
  50. package/dist/layout/index.d.cts +206 -0
  51. package/dist/layout/index.d.ts +206 -0
  52. package/dist/layout/index.js +3 -0
  53. package/dist/layout/index.js.map +1 -0
  54. package/dist/theme/index.cjs +24 -0
  55. package/dist/theme/index.cjs.map +1 -0
  56. package/dist/theme/index.d.cts +95 -0
  57. package/dist/theme/index.d.ts +95 -0
  58. package/dist/theme/index.js +3 -0
  59. package/dist/theme/index.js.map +1 -0
  60. package/package.json +148 -0
  61. package/public/assets/bg-set/brand-logos/Google.svg +1 -0
  62. package/public/assets/bg-set/brand-logos/Google2.svg +1 -0
  63. package/public/assets/bg-set/brand-logos/Microsoft.svg +1 -0
  64. package/public/assets/bg-set/brand-logos/Microsoft2.svg +1 -0
  65. package/public/assets/bg-set/brand-logos/Slack.svg +1 -0
  66. package/public/assets/bg-set/brand-logos/Slack2.svg +1 -0
  67. package/public/assets/bg-set/brand-logos/YouTube.svg +1 -0
  68. package/public/assets/bg-set/brand-logos/YouTube2.svg +1 -0
  69. package/public/assets/bg-set/pattern/Size=lg, Type=Waves Rays2.svg +1 -0
  70. package/public/assets/bg-set/pattern/Size=md, Type=Waves Rays2.svg +1 -0
  71. package/public/assets/bg-set/pattern/Size=sm, Type=Waves Rays2.svg +1 -0
  72. package/public/assets/bg-set/pattern/Size=xl, Type=Waves Rays2.svg +1 -0
  73. package/public/assets/bg-set/pattern/Size=xs, Type=Waves Rays2.svg +1 -0
  74. package/public/assets/icon-set/Icon-add-circle-fill.svg +1 -0
  75. package/public/assets/icon-set/Icon-calendar-fill.svg +1 -0
  76. package/public/assets/icon-set/Icon-chat-1-fill.svg +1 -0
  77. package/public/assets/icon-set/Icon-download-2-fill.svg +1 -0
  78. package/public/assets/icon-set/Icon-home-fill.svg +1 -0
  79. package/public/assets/icon-set/Icon-mic-fill.svg +1 -0
  80. package/public/assets/icon-set/Icon-settings-3-fill.svg +1 -0
  81. package/public/assets/icon-set/Icon-settings-fill.svg +1 -0
  82. package/public/assets/icon-set/Icon-settings-line.svg +1 -0
@@ -0,0 +1,2069 @@
1
+ import { useRef, useState, useEffect } from 'react';
2
+ import styled7, { keyframes, css } from 'styled-components';
3
+ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
+ import { useButton } from '@react-aria/button';
5
+ import { useTextField } from '@react-aria/textfield';
6
+
7
+ // src/components/AssistantThinking/AssistantThinking.tsx
8
+ var dotPulse = keyframes`
9
+ 0%, 100% {
10
+ opacity: 0.3;
11
+ transform: scale(0.8);
12
+ }
13
+ 50% {
14
+ opacity: 1;
15
+ transform: scale(1);
16
+ }
17
+ `;
18
+ var Container = styled7.div`
19
+ display: inline-flex;
20
+ align-items: center;
21
+ gap: 12px;
22
+ padding: 12px 16px;
23
+ background-color: #2c2c2e;
24
+ border-radius: 16px;
25
+ box-shadow: none;
26
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
27
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
28
+ max-width: fit-content;
29
+ margin: 0 auto;
30
+ `;
31
+ var Avatar = styled7.div`
32
+ width: 40px;
33
+ height: 40px;
34
+ border-radius: 50%;
35
+ background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
36
+ display: flex;
37
+ align-items: center;
38
+ justify-content: center;
39
+ flex-shrink: 0;
40
+ box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
41
+ `;
42
+ var HeadphonesIcon = styled7.svg`
43
+ width: 20px;
44
+ height: 20px;
45
+ color: #FFFFFF;
46
+ `;
47
+ var Content = styled7.div`
48
+ display: flex;
49
+ align-items: center;
50
+ gap: 8px;
51
+ `;
52
+ var LoadingDots = styled7.div`
53
+ display: flex;
54
+ align-items: center;
55
+ gap: 4px;
56
+ padding: 0 4px;
57
+ `;
58
+ var Dot = styled7.span`
59
+ width: 6px;
60
+ height: 6px;
61
+ border-radius: 50%;
62
+ background-color: #8e8e93;
63
+ animation: ${dotPulse} 1.4s ease-in-out infinite;
64
+ `;
65
+ var Message = styled7.span`
66
+ font-size: 14px;
67
+ color: #e5e5e7;
68
+ font-weight: 400;
69
+ line-height: 1.5;
70
+ white-space: nowrap;
71
+ `;
72
+ function AssistantThinking({
73
+ message = "Analyzing data, please wait...",
74
+ className,
75
+ ariaLabel = "Assistant is thinking"
76
+ }) {
77
+ const containerRef = useRef(null);
78
+ return /* @__PURE__ */ jsxs(
79
+ Container,
80
+ {
81
+ ref: containerRef,
82
+ className,
83
+ role: "status",
84
+ "aria-live": "polite",
85
+ "aria-label": ariaLabel,
86
+ children: [
87
+ /* @__PURE__ */ jsx(Avatar, { "aria-hidden": "true", children: /* @__PURE__ */ jsx(HeadphonesIcon, { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx("path", { d: "M17 13a4 4 0 0 1 0 8c-2.142 0-4-1.79-4-4h-2a4 4 0 1 1-.535-2h3.07A4 4 0 0 1 17 13M2 12v-2h2V7a4 4 0 0 1 4-4h8a4 4 0 0 1 4 4v3h2v2z" }) }) }),
88
+ /* @__PURE__ */ jsxs(Content, { children: [
89
+ /* @__PURE__ */ jsxs(LoadingDots, { "aria-hidden": "true", children: [
90
+ /* @__PURE__ */ jsx(Dot, { style: { animationDelay: "0ms" } }),
91
+ /* @__PURE__ */ jsx(Dot, { style: { animationDelay: "150ms" } }),
92
+ /* @__PURE__ */ jsx(Dot, { style: { animationDelay: "300ms" } })
93
+ ] }),
94
+ /* @__PURE__ */ jsx(Message, { children: message })
95
+ ] })
96
+ ]
97
+ }
98
+ );
99
+ }
100
+ AssistantThinking.displayName = "AssistantThinking";
101
+ var ChatInputContainer = styled7.div`
102
+ display: flex;
103
+ flex-direction: column;
104
+ width: 100%;
105
+ padding: 8px;
106
+ background: transparent;
107
+ border-radius: 0;
108
+ box-shadow: none;
109
+ box-sizing: border-box;
110
+
111
+ @media (min-width: 640px) {
112
+ padding: 12px;
113
+ }
114
+ `;
115
+ var SuggestionsWrapper = styled7.div`
116
+ display: flex;
117
+ flex-direction: row;
118
+ flex-wrap: wrap;
119
+ gap: 8px;
120
+ margin-bottom: 12px;
121
+ width: 100%;
122
+ box-sizing: border-box;
123
+ `;
124
+ var SuggestionButton = styled7.button`
125
+ padding: 8px 16px;
126
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
127
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
128
+ font-size: 13px;
129
+ font-weight: 400;
130
+ text-align: center;
131
+ border: 1px solid #3a3a3c;
132
+ border-radius: 20px;
133
+ cursor: pointer;
134
+ transition: all 0.15s ease;
135
+ white-space: nowrap;
136
+
137
+ /* Dark theme colors */
138
+ background-color: #2c2c2e;
139
+ color: #e5e5e7;
140
+
141
+ /* Hover state */
142
+ &:hover:not(:disabled) {
143
+ background-color: #3a3a3c;
144
+ border-color: #48484a;
145
+ }
146
+
147
+ /* Active state */
148
+ &:active:not(:disabled) {
149
+ background-color: #48484a;
150
+ }
151
+
152
+ /* Focus state */
153
+ &:focus-visible {
154
+ outline: 2px solid #5B9FFF;
155
+ outline-offset: 2px;
156
+ }
157
+
158
+ /* Disabled state */
159
+ &:disabled {
160
+ cursor: not-allowed;
161
+ opacity: 0.4;
162
+ }
163
+ `;
164
+ var InputWrapper = styled7.div`
165
+ display: flex;
166
+ align-items: center;
167
+ gap: 10px;
168
+ padding: 10px 14px;
169
+ background-color: #2c2c2e;
170
+ border: 1px solid #3a3a3c;
171
+ border-radius: 12px;
172
+ transition: all 0.2s ease;
173
+ width: 100%;
174
+ box-sizing: border-box;
175
+
176
+ &:focus-within {
177
+ border-color: #5B9FFF;
178
+ background-color: #323234;
179
+ }
180
+ `;
181
+ var InputField = styled7.input`
182
+ flex: 1;
183
+ border: none;
184
+ outline: none;
185
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
186
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
187
+ font-size: 14px;
188
+ color: #e5e5e7;
189
+ background: transparent;
190
+
191
+ &::placeholder {
192
+ color: #6e6e73;
193
+ }
194
+
195
+ &:disabled {
196
+ color: #6e6e73;
197
+ cursor: not-allowed;
198
+ }
199
+ `;
200
+ var SubmitButton = styled7.button`
201
+ display: flex;
202
+ align-items: center;
203
+ justify-content: center;
204
+ width: 32px;
205
+ height: 32px;
206
+ padding: 0;
207
+ border: none;
208
+ border-radius: 50%;
209
+ background-color: ${(props) => props.disabled ? "#3a3a3c" : "#5B9FFF"};
210
+ color: ${(props) => props.disabled ? "#6e6e73" : "#ffffff"};
211
+ cursor: ${(props) => props.disabled ? "not-allowed" : "pointer"};
212
+ transition: all 0.2s ease;
213
+ flex-shrink: 0;
214
+
215
+ &:hover:not(:disabled) {
216
+ background-color: #4A8FEF;
217
+ transform: scale(1.05);
218
+ }
219
+
220
+ &:active:not(:disabled) {
221
+ transform: scale(0.98);
222
+ }
223
+
224
+ &:focus-visible {
225
+ outline: 2px solid #5B9FFF;
226
+ outline-offset: 2px;
227
+ }
228
+
229
+ svg {
230
+ width: 18px;
231
+ height: 18px;
232
+ }
233
+ `;
234
+ var ChatInput = ({
235
+ suggestions = [],
236
+ onSuggestionSelect,
237
+ value = "",
238
+ onChange,
239
+ onSubmit,
240
+ placeholder = "Ask, write or search for anything...",
241
+ isDisabled = false,
242
+ isReadOnly = false,
243
+ autoFocus = false,
244
+ className,
245
+ "aria-label": ariaLabel = "Chat message input",
246
+ ...ariaProps
247
+ }) => {
248
+ const [internalValue, setInternalValue] = useState(value);
249
+ const inputRef = useRef(null);
250
+ const currentValue = value !== void 0 ? value : internalValue;
251
+ const setValue = onChange || setInternalValue;
252
+ const { inputProps } = useTextField(
253
+ {
254
+ ...ariaProps,
255
+ "aria-label": ariaLabel,
256
+ value: currentValue,
257
+ onChange: (newValue) => {
258
+ setValue(newValue);
259
+ },
260
+ isDisabled,
261
+ isReadOnly
262
+ },
263
+ inputRef
264
+ );
265
+ const handleKeyDown = (e) => {
266
+ if (e.key === "Enter") {
267
+ e.preventDefault();
268
+ handleSubmit();
269
+ }
270
+ };
271
+ const handleSubmit = () => {
272
+ if (currentValue.trim() && onSubmit && !isDisabled && !isReadOnly) {
273
+ onSubmit(currentValue.trim());
274
+ setValue("");
275
+ inputRef.current?.focus();
276
+ }
277
+ };
278
+ const handleSuggestionClick = (suggestionText) => {
279
+ if (onSuggestionSelect && !isDisabled && !isReadOnly) {
280
+ onSuggestionSelect(suggestionText);
281
+ setValue(suggestionText);
282
+ inputRef.current?.focus();
283
+ }
284
+ };
285
+ const canSubmit = currentValue.trim().length > 0 && !isDisabled && !isReadOnly;
286
+ return /* @__PURE__ */ jsxs(ChatInputContainer, { className, children: [
287
+ suggestions.length > 0 && /* @__PURE__ */ jsx(SuggestionsWrapper, { role: "list", "aria-label": "Suggested prompts", children: suggestions.map((suggestion, index) => /* @__PURE__ */ jsx(
288
+ SuggestionButtonComponent,
289
+ {
290
+ suggestion,
291
+ onSelect: handleSuggestionClick,
292
+ isDisabled: isDisabled || isReadOnly
293
+ },
294
+ `${suggestion.text}-${index}`
295
+ )) }),
296
+ /* @__PURE__ */ jsxs(InputWrapper, { children: [
297
+ /* @__PURE__ */ jsx(
298
+ InputField,
299
+ {
300
+ ...inputProps,
301
+ ref: inputRef,
302
+ type: "text",
303
+ placeholder,
304
+ onKeyDown: handleKeyDown,
305
+ autoFocus,
306
+ disabled: isDisabled,
307
+ readOnly: isReadOnly
308
+ }
309
+ ),
310
+ /* @__PURE__ */ jsx(
311
+ SubmitButtonComponent,
312
+ {
313
+ onPress: handleSubmit,
314
+ isDisabled: !canSubmit,
315
+ ariaLabel: "Send message"
316
+ }
317
+ )
318
+ ] })
319
+ ] });
320
+ };
321
+ var SuggestionButtonComponent = ({
322
+ suggestion,
323
+ onSelect,
324
+ isDisabled = false
325
+ }) => {
326
+ const ref = useRef(null);
327
+ const { buttonProps } = useButton(
328
+ {
329
+ onPress: () => onSelect(suggestion.text),
330
+ isDisabled,
331
+ "aria-label": `Select suggestion: ${suggestion.text}`
332
+ },
333
+ ref
334
+ );
335
+ return /* @__PURE__ */ jsx(SuggestionButton, { ...buttonProps, ref, role: "listitem", children: suggestion.text });
336
+ };
337
+ var SubmitButtonComponent = ({
338
+ onPress,
339
+ isDisabled = false,
340
+ ariaLabel = "Send message"
341
+ }) => {
342
+ const ref = useRef(null);
343
+ const { buttonProps } = useButton(
344
+ {
345
+ onPress,
346
+ isDisabled,
347
+ "aria-label": ariaLabel
348
+ },
349
+ ref
350
+ );
351
+ return /* @__PURE__ */ jsx(SubmitButton, { ...buttonProps, ref, disabled: isDisabled, title: ariaLabel, children: /* @__PURE__ */ jsxs(
352
+ "svg",
353
+ {
354
+ width: "20",
355
+ height: "20",
356
+ viewBox: "0 0 20 20",
357
+ fill: "none",
358
+ xmlns: "http://www.w3.org/2000/svg",
359
+ role: "img",
360
+ "aria-hidden": "true",
361
+ children: [
362
+ /* @__PURE__ */ jsx("title", { children: "Arrow Right Icon" }),
363
+ /* @__PURE__ */ jsx(
364
+ "path",
365
+ {
366
+ d: "M4 10H16M16 10L10 4M16 10L10 16",
367
+ stroke: "currentColor",
368
+ strokeWidth: "2",
369
+ strokeLinecap: "round",
370
+ strokeLinejoin: "round"
371
+ }
372
+ )
373
+ ]
374
+ }
375
+ ) });
376
+ };
377
+ ChatInput.displayName = "ChatInput";
378
+ var StyledUserMessage = styled7.button`
379
+ /* Base styles */
380
+ display: inline-flex;
381
+ align-items: center;
382
+ justify-content: center;
383
+ padding: 12px 20px;
384
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
385
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
386
+ font-size: 14px;
387
+ font-weight: 400;
388
+ line-height: 1.4;
389
+ color: #ffffff;
390
+ border: none;
391
+ cursor: default;
392
+ user-select: none;
393
+ white-space: pre-wrap;
394
+ word-wrap: break-word;
395
+ position: relative;
396
+ text-align: left;
397
+
398
+ /* Pill shape - fully rounded ends */
399
+ border-radius: 999px;
400
+
401
+ /* Purple to blue gradient (left to right) */
402
+ background: linear-gradient(90deg, #8B5CF6 0%, #5B8DEF 100%);
403
+
404
+ /* Subtle shadow and glow effect */
405
+ box-shadow:
406
+ 0 2px 8px rgba(91, 141, 239, 0.25),
407
+ 0 1px 3px rgba(139, 92, 246, 0.15);
408
+
409
+ /* Smooth transitions */
410
+ transition: all 0.2s ease-in-out;
411
+
412
+ /* Speech bubble tail */
413
+ &::after {
414
+ content: '';
415
+ position: absolute;
416
+ bottom: -4px;
417
+ right: -6px;
418
+ width: 18px;
419
+ height: 18px;
420
+ background: #5B8DEF;
421
+ transform: rotate(45deg);
422
+ border-radius: 0 0 16px 0;
423
+ box-shadow:
424
+ 2px 2px 4px rgba(91, 141, 239, 0.15);
425
+ transition: all 0.2s ease-in-out;
426
+ }
427
+
428
+ /* Hover state - only for button elements */
429
+ &[role="button"]:hover:not(:disabled) {
430
+ transform: translateY(-1px);
431
+ cursor: pointer;
432
+ box-shadow:
433
+ 0 4px 12px rgba(91, 141, 239, 0.35),
434
+ 0 2px 6px rgba(139, 92, 246, 0.25);
435
+
436
+ &::after {
437
+ box-shadow:
438
+ 3px 3px 6px rgba(91, 141, 239, 0.2);
439
+ }
440
+ }
441
+
442
+ /* Active/Pressed state - only for button elements */
443
+ &[role="button"]:active:not(:disabled) {
444
+ transform: translateY(0);
445
+ box-shadow:
446
+ 0 1px 4px rgba(91, 141, 239, 0.2),
447
+ 0 1px 2px rgba(139, 92, 246, 0.1);
448
+
449
+ &::after {
450
+ box-shadow:
451
+ 1px 1px 2px rgba(91, 141, 239, 0.1);
452
+ }
453
+ }
454
+
455
+ ${({ $isPressed }) => $isPressed && css`
456
+ transform: translateY(0) scale(0.98);
457
+ box-shadow:
458
+ 0 1px 4px rgba(91, 141, 239, 0.2),
459
+ 0 1px 2px rgba(139, 92, 246, 0.1);
460
+
461
+ &::after {
462
+ box-shadow:
463
+ 1px 1px 2px rgba(91, 141, 239, 0.1);
464
+ }
465
+ `}
466
+
467
+ /* Focus state for accessibility */
468
+ &:focus {
469
+ outline: none;
470
+ }
471
+
472
+ &:focus-visible {
473
+ outline: 2px solid #5B8DEF;
474
+ outline-offset: 3px;
475
+ box-shadow:
476
+ 0 4px 12px rgba(91, 141, 239, 0.35),
477
+ 0 2px 6px rgba(139, 92, 246, 0.25),
478
+ 0 0 0 3px rgba(91, 141, 239, 0.1);
479
+ }
480
+
481
+ /* Disabled state */
482
+ &:disabled {
483
+ cursor: not-allowed;
484
+ opacity: 0.5;
485
+ transform: none;
486
+ box-shadow: none;
487
+
488
+ &::after {
489
+ opacity: 0.5;
490
+ box-shadow: none;
491
+ }
492
+ }
493
+ `;
494
+ function UserMessage({
495
+ children,
496
+ className,
497
+ isPressed = false,
498
+ onPress,
499
+ ...ariaProps
500
+ }) {
501
+ const ref = useRef(null);
502
+ if (!onPress) {
503
+ return /* @__PURE__ */ jsx(StyledUserMessage, { as: "div", className, $isPressed: isPressed, role: "presentation", children });
504
+ }
505
+ const { buttonProps, isPressed: ariaPressedState } = useButton(
506
+ {
507
+ ...ariaProps,
508
+ onPress
509
+ },
510
+ ref
511
+ );
512
+ return /* @__PURE__ */ jsx(
513
+ StyledUserMessage,
514
+ {
515
+ ...buttonProps,
516
+ ref,
517
+ className,
518
+ $isPressed: isPressed || ariaPressedState,
519
+ role: "button",
520
+ tabIndex: 0,
521
+ children
522
+ }
523
+ );
524
+ }
525
+ UserMessage.displayName = "UserMessage";
526
+ var variantStyles = {
527
+ primary: css`
528
+ background-color: ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
529
+ color: white;
530
+ border: none;
531
+
532
+ &:hover:not(:disabled) {
533
+ opacity: 0.9;
534
+ transform: translateY(-1px);
535
+ }
536
+
537
+ &:active:not(:disabled) {
538
+ opacity: 0.8;
539
+ transform: translateY(0);
540
+ }
541
+
542
+ &:focus-visible {
543
+ outline: 2px solid ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
544
+ outline-offset: 2px;
545
+ }
546
+ `,
547
+ secondary: css`
548
+ background-color: transparent;
549
+ color: ${({ theme }) => theme?.colors?.text ?? "#000000"};
550
+ border: 1px solid ${({ theme }) => theme?.colors?.border ?? "#E0E0E0"};
551
+
552
+ &:hover:not(:disabled) {
553
+ background-color: ${({ theme }) => theme?.colors?.surface ?? "#ffffff"};
554
+ border-color: ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
555
+ }
556
+
557
+ &:active:not(:disabled) {
558
+ background-color: ${({ theme }) => theme?.colors?.border ?? "#E0E0E0"};
559
+ }
560
+
561
+ &:focus-visible {
562
+ outline: 2px solid ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
563
+ outline-offset: 2px;
564
+ }
565
+ `,
566
+ icon: css`
567
+ background-color: transparent;
568
+ color: ${({ theme }) => theme?.colors?.text ?? "#000000"};
569
+ border: none;
570
+ padding: ${({ theme }) => theme?.spacing?.sm ?? "8px"};
571
+ min-width: auto;
572
+
573
+ &:hover:not(:disabled) {
574
+ background-color: ${({ theme }) => theme?.colors?.border ?? "#E0E0E0"};
575
+ opacity: 0.8;
576
+ }
577
+
578
+ &:active:not(:disabled) {
579
+ opacity: 0.6;
580
+ }
581
+
582
+ &:focus-visible {
583
+ outline: 2px solid ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
584
+ outline-offset: 2px;
585
+ }
586
+ `
587
+ };
588
+ var sizeStyles = {
589
+ small: css`
590
+ padding: ${({ theme }) => theme?.spacing?.xs ?? "4px"} ${({ theme }) => theme?.spacing?.sm ?? "8px"};
591
+ font-size: 0.875rem;
592
+ min-width: 60px;
593
+ height: 28px;
594
+ `,
595
+ medium: css`
596
+ padding: ${({ theme }) => theme?.spacing?.sm ?? "8px"} ${({ theme }) => theme?.spacing?.md ?? "16px"};
597
+ font-size: 1rem;
598
+ min-width: 80px;
599
+ height: 36px;
600
+ `,
601
+ large: css`
602
+ padding: ${({ theme }) => theme?.spacing?.md ?? "16px"} ${({ theme }) => theme?.spacing?.lg ?? "24px"};
603
+ font-size: 1.125rem;
604
+ min-width: 100px;
605
+ height: 44px;
606
+ `
607
+ };
608
+ var StyledButton = styled7.button`
609
+ /* Base styles */
610
+ display: inline-flex;
611
+ align-items: center;
612
+ justify-content: center;
613
+ gap: ${({ theme }) => theme?.spacing?.xs ?? "4px"};
614
+ font-family: ${({ theme }) => theme?.fonts?.body ?? "system-ui, sans-serif"};
615
+ font-weight: 500;
616
+ border-radius: ${({ theme }) => theme?.radii?.md ?? "8px"};
617
+ cursor: pointer;
618
+ transition: all 0.2s ease-in-out;
619
+ white-space: nowrap;
620
+ user-select: none;
621
+
622
+ /* Variant styles */
623
+ ${({ $variant }) => variantStyles[$variant]}
624
+
625
+ /* Size styles */
626
+ ${({ $size, $variant }) => $variant !== "icon" && sizeStyles[$size]}
627
+
628
+ /* Icon variant size overrides */
629
+ ${({ $variant, $size }) => $variant === "icon" && css`
630
+ width: ${$size === "small" ? "28px" : $size === "large" ? "44px" : "36px"};
631
+ height: ${$size === "small" ? "28px" : $size === "large" ? "44px" : "36px"};
632
+ border-radius: ${({ theme }) => theme?.radii?.sm ?? "4px"};
633
+ `}
634
+
635
+ /* Pressed state */
636
+ ${({ $isPressed }) => $isPressed && css`
637
+ transform: scale(0.98);
638
+ `}
639
+
640
+ /* Loading state */
641
+ ${({ $isLoading }) => $isLoading && css`
642
+ cursor: wait;
643
+ opacity: 0.7;
644
+ `}
645
+
646
+ /* Disabled state */
647
+ &:disabled {
648
+ cursor: not-allowed;
649
+ opacity: 0.5;
650
+ transform: none;
651
+ }
652
+
653
+ /* Remove default focus outline, using focus-visible instead */
654
+ &:focus {
655
+ outline: none;
656
+ }
657
+ `;
658
+ function Button({
659
+ variant = "primary",
660
+ size = "medium",
661
+ children,
662
+ className,
663
+ disabled = false,
664
+ isLoading = false,
665
+ ...ariaProps
666
+ }) {
667
+ const ref = useRef(null);
668
+ const { buttonProps, isPressed } = useButton(
669
+ {
670
+ ...ariaProps,
671
+ isDisabled: disabled || isLoading
672
+ },
673
+ ref
674
+ );
675
+ return /* @__PURE__ */ jsx(
676
+ StyledButton,
677
+ {
678
+ ...buttonProps,
679
+ ref,
680
+ className,
681
+ $variant: variant,
682
+ $size: size,
683
+ $isPressed: isPressed,
684
+ $isLoading: isLoading,
685
+ disabled: disabled || isLoading,
686
+ children: isLoading ? /* @__PURE__ */ jsx("span", { "aria-live": "polite", "aria-busy": "true", children: "Loading..." }) : children
687
+ }
688
+ );
689
+ }
690
+ Button.displayName = "Button";
691
+ var ActionsContainer = styled7.div`
692
+ display: flex;
693
+ gap: ${({ theme }) => theme?.spacing?.sm ?? "8px"};
694
+ align-items: center;
695
+
696
+ ${({ $layout }) => $layout === "horizontal" ? css`
697
+ flex-direction: row;
698
+ flex-wrap: wrap;
699
+ ` : css`
700
+ flex-direction: column;
701
+ align-items: stretch;
702
+
703
+ button {
704
+ width: 100%;
705
+ }
706
+ `}
707
+ `;
708
+ function Actions({ actions, layout = "horizontal", className }) {
709
+ return /* @__PURE__ */ jsx(ActionsContainer, { $layout: layout, className, children: actions.map((action) => /* @__PURE__ */ jsxs(
710
+ Button,
711
+ {
712
+ variant: action.variant || "secondary",
713
+ onPress: action.onClick,
714
+ isDisabled: action.disabled,
715
+ "aria-label": action.label,
716
+ children: [
717
+ action.icon && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: action.icon }),
718
+ action.variant !== "icon" && action.label
719
+ ]
720
+ },
721
+ action.id
722
+ )) });
723
+ }
724
+ Actions.displayName = "Actions";
725
+ var dotPulse2 = keyframes`
726
+ 0%, 100% {
727
+ opacity: 0.3;
728
+ transform: scale(0.8);
729
+ }
730
+ 50% {
731
+ opacity: 1;
732
+ transform: scale(1);
733
+ }
734
+ `;
735
+ var fadeIn = keyframes`
736
+ from {
737
+ opacity: 0;
738
+ }
739
+ to {
740
+ opacity: 1;
741
+ }
742
+ `;
743
+ var blink = keyframes`
744
+ 0%, 49% {
745
+ opacity: 1;
746
+ }
747
+ 50%, 100% {
748
+ opacity: 0;
749
+ }
750
+ `;
751
+ var ResponseContainer = styled7.div`
752
+ display: inline-flex;
753
+ align-items: center;
754
+ gap: 12px;
755
+ padding: 12px 16px;
756
+ background-color: #2c2c2e;
757
+ border-radius: 16px;
758
+ box-shadow: none;
759
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
760
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
761
+ max-width: fit-content;
762
+ margin: 0 auto;
763
+ `;
764
+ var LoadingDots2 = styled7.div`
765
+ display: flex;
766
+ align-items: center;
767
+ gap: 4px;
768
+ padding: 0 4px;
769
+ `;
770
+ var Dot2 = styled7.span`
771
+ width: 6px;
772
+ height: 6px;
773
+ border-radius: 50%;
774
+ background-color: #8e8e93;
775
+ animation: ${dotPulse2} 1.4s ease-in-out infinite;
776
+ animation-delay: ${(props) => props.delay}s;
777
+ `;
778
+ var TypingIndicator = styled7.div`
779
+ display: flex;
780
+ align-items: center;
781
+ gap: 4px;
782
+ padding: 0 4px;
783
+
784
+ ${Dot2} {
785
+ width: 6px;
786
+ height: 6px;
787
+ background-color: #8e8e93;
788
+ animation: ${dotPulse2} 1.4s ease-in-out infinite;
789
+ }
790
+ `;
791
+ var Message2 = styled7.span`
792
+ font-size: 14px;
793
+ color: #e5e5e7;
794
+ font-weight: 400;
795
+ line-height: 1.5;
796
+ white-space: nowrap;
797
+ `;
798
+ var StreamingText = styled7.div`
799
+ font-size: 14px;
800
+ line-height: 1.5;
801
+ color: #e5e5e7;
802
+ animation: ${fadeIn} 0.3s ease-in;
803
+ position: relative;
804
+ font-weight: 400;
805
+ white-space: nowrap;
806
+
807
+ /* Blinking cursor effect */
808
+ &::after {
809
+ content: '|';
810
+ margin-left: 0.125rem;
811
+ animation: ${blink} 1s infinite;
812
+ color: #8e8e93;
813
+ font-weight: 400;
814
+ }
815
+ `;
816
+ var Response = ({
817
+ isLoading = false,
818
+ isTyping = false,
819
+ isStreaming = false,
820
+ streamingContent = "",
821
+ message = "Thinking...",
822
+ className
823
+ }) => {
824
+ if (isLoading) {
825
+ return /* @__PURE__ */ jsxs(ResponseContainer, { className, "data-testid": "response-loading", children: [
826
+ /* @__PURE__ */ jsxs(LoadingDots2, { "aria-hidden": "true", children: [
827
+ /* @__PURE__ */ jsx(Dot2, { delay: 0 }),
828
+ /* @__PURE__ */ jsx(Dot2, { delay: 0.15 }),
829
+ /* @__PURE__ */ jsx(Dot2, { delay: 0.3 })
830
+ ] }),
831
+ /* @__PURE__ */ jsx(Message2, { children: message })
832
+ ] });
833
+ }
834
+ if (isTyping) {
835
+ return /* @__PURE__ */ jsxs(ResponseContainer, { className, "data-testid": "response-typing", children: [
836
+ /* @__PURE__ */ jsxs(TypingIndicator, { "aria-hidden": "true", children: [
837
+ /* @__PURE__ */ jsx(Dot2, { delay: 0 }),
838
+ /* @__PURE__ */ jsx(Dot2, { delay: 0.15 }),
839
+ /* @__PURE__ */ jsx(Dot2, { delay: 0.3 })
840
+ ] }),
841
+ /* @__PURE__ */ jsx(Message2, { children: message })
842
+ ] });
843
+ }
844
+ if (isStreaming && streamingContent) {
845
+ return /* @__PURE__ */ jsx(ResponseContainer, { className, "data-testid": "response-streaming", children: /* @__PURE__ */ jsx(StreamingText, { children: streamingContent }) });
846
+ }
847
+ return null;
848
+ };
849
+ var dotPulse3 = keyframes`
850
+ 0%, 100% {
851
+ opacity: 0.3;
852
+ transform: scale(0.8);
853
+ }
854
+ 50% {
855
+ opacity: 1;
856
+ transform: scale(1);
857
+ }
858
+ `;
859
+ var shake = keyframes`
860
+ 0%, 100% {
861
+ transform: translateX(0);
862
+ }
863
+ 25% {
864
+ transform: translateX(-5px);
865
+ }
866
+ 75% {
867
+ transform: translateX(5px);
868
+ }
869
+ `;
870
+ var AgentStateContainer = styled7.div`
871
+ display: inline-flex;
872
+ flex-direction: column;
873
+ align-items: center;
874
+ gap: 12px;
875
+ padding: 12px 16px;
876
+ background-color: ${(props) => props.isError ? "#3a1f1f" : "#2c2c2e"};
877
+ border-radius: 16px;
878
+ border: ${(props) => props.isError ? "1px solid #7f1d1d" : "none"};
879
+ box-shadow: none;
880
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
881
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
882
+ max-width: fit-content;
883
+ margin: 0 auto;
884
+ `;
885
+ var StateContent = styled7.div`
886
+ display: flex;
887
+ flex-direction: column;
888
+ gap: 8px;
889
+ align-items: center;
890
+ width: 100%;
891
+ `;
892
+ var IdleIndicator = styled7.div`
893
+ width: 6px;
894
+ height: 6px;
895
+ background-color: #8e8e93;
896
+ border-radius: 50%;
897
+ animation: ${dotPulse3} 2s infinite ease-in-out;
898
+ `;
899
+ var ErrorIndicator = styled7.div`
900
+ width: 6px;
901
+ height: 6px;
902
+ background-color: #ff6b6b;
903
+ border-radius: 50%;
904
+ animation: ${shake} 0.5s ease-in-out;
905
+ `;
906
+ var StateLabel = styled7.span`
907
+ font-size: 14px;
908
+ font-weight: 400;
909
+ color: #e5e5e7;
910
+ line-height: 1.5;
911
+ white-space: nowrap;
912
+ `;
913
+ styled7.p`
914
+ font-size: 14px;
915
+ color: #8e8e93;
916
+ line-height: 1.5;
917
+ margin: 0;
918
+ text-align: center;
919
+ white-space: nowrap;
920
+ `;
921
+ var ProgressBar = styled7.div`
922
+ width: 100%;
923
+ height: 4px;
924
+ background-color: #3a3a3c;
925
+ border-radius: 2px;
926
+ overflow: hidden;
927
+ margin-top: 4px;
928
+ `;
929
+ var ProgressBarFill = styled7.div`
930
+ height: 100%;
931
+ width: ${(props) => Math.min(Math.max(props.progress, 0), 100)}%;
932
+ background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
933
+ border-radius: 2px;
934
+ transition: width 0.3s ease-in-out;
935
+ `;
936
+ var AgentState = ({ state, message, progress, className }) => {
937
+ if (state === "idle") {
938
+ return /* @__PURE__ */ jsx(AgentStateContainer, { className, "data-testid": "agent-state-idle", children: /* @__PURE__ */ jsxs(StateContent, { children: [
939
+ /* @__PURE__ */ jsx(IdleIndicator, {}),
940
+ /* @__PURE__ */ jsx(StateLabel, { children: message || "Agent is idle" }),
941
+ progress !== void 0 && /* @__PURE__ */ jsx(ProgressBar, { children: /* @__PURE__ */ jsx(ProgressBarFill, { progress }) })
942
+ ] }) });
943
+ }
944
+ if (state === "error") {
945
+ return /* @__PURE__ */ jsx(AgentStateContainer, { className, "data-testid": "agent-state-error", isError: true, children: /* @__PURE__ */ jsxs(StateContent, { children: [
946
+ /* @__PURE__ */ jsx(ErrorIndicator, {}),
947
+ /* @__PURE__ */ jsx(StateLabel, { children: message || "Error occurred" })
948
+ ] }) });
949
+ }
950
+ if (state === "thinking") {
951
+ return /* @__PURE__ */ jsx(Response, { isLoading: true, message: message || "Agent is thinking...", className });
952
+ }
953
+ if (state === "responding") {
954
+ return /* @__PURE__ */ jsx(Response, { isTyping: true, message: message || "Agent is responding...", className });
955
+ }
956
+ return null;
957
+ };
958
+ var FooterContainer = styled7.footer`
959
+ display: flex;
960
+ align-items: center;
961
+ justify-content: center;
962
+ padding: ${({ theme }) => theme?.spacing?.sm ?? "8px"} ${({ theme }) => theme?.spacing?.md ?? "16px"};
963
+ background-color: ${({ theme }) => theme?.colors?.surface ?? "#ffffff"};
964
+ border-top: 1px solid ${({ theme }) => theme?.colors?.border ?? "#E0E0E0"};
965
+ min-height: 44px;
966
+ `;
967
+ var FooterContent = styled7.div`
968
+ display: flex;
969
+ align-items: center;
970
+ justify-content: space-between;
971
+ gap: ${({ theme }) => theme?.spacing?.md ?? "16px"};
972
+ width: 100%;
973
+ max-width: 100%;
974
+ font-size: 0.75rem;
975
+ color: ${({ theme }) => theme?.colors?.text ?? "#000000"};
976
+ opacity: 0.6;
977
+ font-family: ${({ theme }) => theme?.fonts?.body ?? "system-ui, sans-serif"};
978
+ line-height: 1.4;
979
+ `;
980
+ var FooterBranding = styled7.div`
981
+ display: flex;
982
+ align-items: center;
983
+ gap: ${({ theme }) => theme?.spacing?.xs ?? "4px"};
984
+ flex-shrink: 0;
985
+ `;
986
+ var FooterStatus = styled7.div`
987
+ display: flex;
988
+ align-items: center;
989
+ gap: ${({ theme }) => theme?.spacing?.xs ?? "4px"};
990
+ overflow: hidden;
991
+ text-overflow: ellipsis;
992
+ white-space: nowrap;
993
+ font-size: 0.75rem;
994
+ opacity: 0.8;
995
+ `;
996
+ var FooterLink = styled7.a`
997
+ color: ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
998
+ text-decoration: none;
999
+ transition: opacity 150ms ease;
1000
+ cursor: pointer;
1001
+
1002
+ &:hover {
1003
+ opacity: 0.8;
1004
+ text-decoration: underline;
1005
+ }
1006
+
1007
+ &:focus-visible {
1008
+ outline: 2px solid ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
1009
+ outline-offset: 2px;
1010
+ border-radius: ${({ theme }) => theme?.radii?.sm ?? "4px"};
1011
+ }
1012
+ `;
1013
+ var Footer = ({
1014
+ branding,
1015
+ status,
1016
+ brandingUrl,
1017
+ onBrandingClick,
1018
+ className
1019
+ }) => {
1020
+ if (!branding && !status) {
1021
+ return null;
1022
+ }
1023
+ const handleBrandingClick = (e) => {
1024
+ if (onBrandingClick) {
1025
+ e.preventDefault();
1026
+ onBrandingClick();
1027
+ }
1028
+ };
1029
+ return /* @__PURE__ */ jsx(FooterContainer, { className, children: /* @__PURE__ */ jsxs(FooterContent, { children: [
1030
+ branding && /* @__PURE__ */ jsx(FooterBranding, { children: brandingUrl ? /* @__PURE__ */ jsx(
1031
+ FooterLink,
1032
+ {
1033
+ href: brandingUrl,
1034
+ onClick: handleBrandingClick,
1035
+ target: "_blank",
1036
+ rel: "noopener noreferrer",
1037
+ children: branding
1038
+ }
1039
+ ) : branding }),
1040
+ status && /* @__PURE__ */ jsx(FooterStatus, { children: status })
1041
+ ] }) });
1042
+ };
1043
+ Footer.displayName = "Footer";
1044
+ var HeaderContainer = styled7.header`
1045
+ display: flex;
1046
+ align-items: center;
1047
+ justify-content: space-between;
1048
+ padding: 8px;
1049
+ background-color: #2c2c2e;
1050
+ border-bottom: 1px solid #3a3a3c;
1051
+ min-height: 60px;
1052
+ box-sizing: border-box;
1053
+
1054
+ @media (min-width: 640px) {
1055
+ padding: 12px;
1056
+ }
1057
+ `;
1058
+ var HeaderContent = styled7.div`
1059
+ display: flex;
1060
+ flex-direction: column;
1061
+ gap: ${({ theme }) => theme?.spacing?.xs ?? "4px"};
1062
+ flex: 1;
1063
+ min-width: 0;
1064
+ `;
1065
+ var HeaderTitle = styled7.h1`
1066
+ margin: 0;
1067
+ font-size: 1rem;
1068
+ font-weight: 600;
1069
+ color: #e5e5e7;
1070
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
1071
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
1072
+ line-height: 1.5;
1073
+ overflow: hidden;
1074
+ text-overflow: ellipsis;
1075
+ white-space: nowrap;
1076
+ `;
1077
+ var HeaderSubtitle = styled7.p`
1078
+ margin: 0;
1079
+ font-size: 0.875rem;
1080
+ color: #8e8e93;
1081
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
1082
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
1083
+ line-height: 1.4;
1084
+ overflow: hidden;
1085
+ text-overflow: ellipsis;
1086
+ white-space: nowrap;
1087
+ `;
1088
+ var HeaderActions = styled7.div`
1089
+ display: flex;
1090
+ align-items: center;
1091
+ gap: ${({ theme }) => theme?.spacing?.xs ?? "4px"};
1092
+ margin-left: ${({ theme }) => theme?.spacing?.md ?? "16px"};
1093
+ `;
1094
+ var ActionButton = styled7.button`
1095
+ display: inline-flex;
1096
+ align-items: center;
1097
+ justify-content: center;
1098
+ width: 32px;
1099
+ height: 32px;
1100
+ padding: 0;
1101
+ background-color: transparent;
1102
+ border: none;
1103
+ border-radius: 6px;
1104
+ color: #e5e5e7;
1105
+ cursor: pointer;
1106
+ transition: all 150ms ease;
1107
+
1108
+ &:hover:not(:disabled) {
1109
+ background-color: #3a3a3c;
1110
+ }
1111
+
1112
+ &:active:not(:disabled) {
1113
+ transform: scale(0.95);
1114
+ background-color: #48484a;
1115
+ }
1116
+
1117
+ &:focus-visible {
1118
+ outline: 2px solid #5B9FFF;
1119
+ outline-offset: 2px;
1120
+ }
1121
+
1122
+ &:disabled {
1123
+ cursor: not-allowed;
1124
+ opacity: 0.3;
1125
+ }
1126
+
1127
+ svg {
1128
+ width: 16px;
1129
+ height: 16px;
1130
+ display: block;
1131
+ }
1132
+ `;
1133
+ var Header = ({
1134
+ title,
1135
+ subtitle,
1136
+ onClose,
1137
+ onMinimize,
1138
+ className
1139
+ }) => {
1140
+ const minimizeRef = useRef(null);
1141
+ const closeRef = useRef(null);
1142
+ const { buttonProps: minimizeProps } = useButton(
1143
+ {
1144
+ onPress: onMinimize,
1145
+ "aria-label": "Minimize",
1146
+ isDisabled: !onMinimize
1147
+ },
1148
+ minimizeRef
1149
+ );
1150
+ const { buttonProps: closeProps } = useButton(
1151
+ {
1152
+ onPress: onClose,
1153
+ "aria-label": "Close",
1154
+ isDisabled: !onClose
1155
+ },
1156
+ closeRef
1157
+ );
1158
+ return /* @__PURE__ */ jsxs(HeaderContainer, { className, children: [
1159
+ /* @__PURE__ */ jsxs(HeaderContent, { children: [
1160
+ /* @__PURE__ */ jsx(HeaderTitle, { children: title }),
1161
+ subtitle && /* @__PURE__ */ jsx(HeaderSubtitle, { children: subtitle })
1162
+ ] }),
1163
+ /* @__PURE__ */ jsxs(HeaderActions, { children: [
1164
+ onMinimize && /* @__PURE__ */ jsx(ActionButton, { ref: minimizeRef, ...minimizeProps, "data-action": "minimize", children: /* @__PURE__ */ jsxs(
1165
+ "svg",
1166
+ {
1167
+ width: "16",
1168
+ height: "16",
1169
+ viewBox: "0 0 16 16",
1170
+ fill: "none",
1171
+ xmlns: "http://www.w3.org/2000/svg",
1172
+ "aria-hidden": "true",
1173
+ children: [
1174
+ /* @__PURE__ */ jsx("title", { children: "Minimize" }),
1175
+ /* @__PURE__ */ jsx("line", { x1: "3", y1: "8", x2: "13", y2: "8", stroke: "currentColor", strokeWidth: "2" })
1176
+ ]
1177
+ }
1178
+ ) }),
1179
+ onClose && /* @__PURE__ */ jsx(ActionButton, { ref: closeRef, ...closeProps, "data-action": "close", children: /* @__PURE__ */ jsxs(
1180
+ "svg",
1181
+ {
1182
+ width: "16",
1183
+ height: "16",
1184
+ viewBox: "0 0 16 16",
1185
+ fill: "none",
1186
+ xmlns: "http://www.w3.org/2000/svg",
1187
+ "aria-hidden": "true",
1188
+ children: [
1189
+ /* @__PURE__ */ jsx("title", { children: "Close" }),
1190
+ /* @__PURE__ */ jsx("line", { x1: "4", y1: "4", x2: "12", y2: "12", stroke: "currentColor", strokeWidth: "2" }),
1191
+ /* @__PURE__ */ jsx("line", { x1: "12", y1: "4", x2: "4", y2: "12", stroke: "currentColor", strokeWidth: "2" })
1192
+ ]
1193
+ }
1194
+ ) })
1195
+ ] })
1196
+ ] });
1197
+ };
1198
+ Header.displayName = "Header";
1199
+ var InputContainer = styled7.div`
1200
+ display: flex;
1201
+ flex-direction: column;
1202
+ width: 100%;
1203
+ position: relative;
1204
+ `;
1205
+ var InputWrapper2 = styled7.div`
1206
+ display: flex;
1207
+ align-items: flex-end;
1208
+ gap: 8px;
1209
+ padding: 12px;
1210
+ background-color: #ffffff;
1211
+ border: 1px solid #e5e7eb;
1212
+ border-radius: 12px;
1213
+ transition: all 0.2s ease;
1214
+
1215
+ &:focus-within {
1216
+ border-color: #3b82f6;
1217
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
1218
+ }
1219
+
1220
+ &:hover:not(:focus-within) {
1221
+ border-color: #d1d5db;
1222
+ }
1223
+ `;
1224
+ var TextArea = styled7.textarea`
1225
+ flex: 1;
1226
+ min-height: 24px;
1227
+ max-height: ${(props) => `${(props.$maxRows || 5) * 24}px`};
1228
+ padding: 0;
1229
+ border: none;
1230
+ outline: none;
1231
+ resize: none;
1232
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
1233
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
1234
+ font-size: 14px;
1235
+ line-height: 24px;
1236
+ color: #111827;
1237
+ background: transparent;
1238
+ overflow-y: auto;
1239
+
1240
+ &::placeholder {
1241
+ color: #9ca3af;
1242
+ }
1243
+
1244
+ &:disabled {
1245
+ color: #9ca3af;
1246
+ cursor: not-allowed;
1247
+ }
1248
+
1249
+ &:read-only {
1250
+ cursor: default;
1251
+ }
1252
+
1253
+ /* Custom scrollbar */
1254
+ &::-webkit-scrollbar {
1255
+ width: 6px;
1256
+ }
1257
+
1258
+ &::-webkit-scrollbar-track {
1259
+ background: transparent;
1260
+ }
1261
+
1262
+ &::-webkit-scrollbar-thumb {
1263
+ background: #d1d5db;
1264
+ border-radius: 3px;
1265
+ }
1266
+
1267
+ &::-webkit-scrollbar-thumb:hover {
1268
+ background: #9ca3af;
1269
+ }
1270
+ `;
1271
+ var SendButton = styled7.button`
1272
+ display: flex;
1273
+ align-items: center;
1274
+ justify-content: center;
1275
+ width: 36px;
1276
+ height: 36px;
1277
+ padding: 0;
1278
+ border: none;
1279
+ border-radius: 8px;
1280
+ background-color: ${(props) => props.disabled ? "#e5e7eb" : "#3b82f6"};
1281
+ color: ${(props) => props.disabled ? "#9ca3af" : "#ffffff"};
1282
+ cursor: ${(props) => props.disabled ? "not-allowed" : "pointer"};
1283
+ transition: all 0.2s ease;
1284
+ flex-shrink: 0;
1285
+
1286
+ &:hover:not(:disabled) {
1287
+ background-color: #2563eb;
1288
+ transform: translateY(-1px);
1289
+ }
1290
+
1291
+ &:active:not(:disabled) {
1292
+ transform: translateY(0);
1293
+ }
1294
+
1295
+ &:focus-visible {
1296
+ outline: 2px solid #3b82f6;
1297
+ outline-offset: 2px;
1298
+ }
1299
+
1300
+ svg {
1301
+ width: 20px;
1302
+ height: 20px;
1303
+ }
1304
+ `;
1305
+ var Input = ({
1306
+ value = "",
1307
+ onChange,
1308
+ onSubmit,
1309
+ placeholder = "Type a message...",
1310
+ isDisabled = false,
1311
+ isReadOnly = false,
1312
+ maxRows = 5,
1313
+ autoFocus = false,
1314
+ className,
1315
+ "aria-label": ariaLabel = "Message input",
1316
+ ...ariaProps
1317
+ }) => {
1318
+ const textareaRef = useRef(null);
1319
+ const { inputProps } = useTextField(
1320
+ {
1321
+ ...ariaProps,
1322
+ "aria-label": ariaLabel,
1323
+ value,
1324
+ onChange: (newValue) => {
1325
+ onChange?.(newValue);
1326
+ },
1327
+ isDisabled,
1328
+ isReadOnly,
1329
+ inputElementType: "textarea"
1330
+ },
1331
+ textareaRef
1332
+ );
1333
+ const handleKeyDown = (e) => {
1334
+ if (e.key === "Enter" && !e.shiftKey) {
1335
+ e.preventDefault();
1336
+ if (value.trim() && onSubmit && !isDisabled && !isReadOnly) {
1337
+ onSubmit(value.trim());
1338
+ onChange?.("");
1339
+ }
1340
+ }
1341
+ };
1342
+ const handleSend = () => {
1343
+ if (value.trim() && onSubmit && !isDisabled && !isReadOnly) {
1344
+ onSubmit(value.trim());
1345
+ onChange?.("");
1346
+ textareaRef.current?.focus();
1347
+ }
1348
+ };
1349
+ const canSend = value.trim().length > 0 && !isDisabled && !isReadOnly;
1350
+ return /* @__PURE__ */ jsx(InputContainer, { className, children: /* @__PURE__ */ jsxs(InputWrapper2, { children: [
1351
+ /* @__PURE__ */ jsx(
1352
+ TextArea,
1353
+ {
1354
+ ...inputProps,
1355
+ ref: textareaRef,
1356
+ placeholder,
1357
+ onKeyDown: handleKeyDown,
1358
+ $maxRows: maxRows,
1359
+ autoFocus,
1360
+ disabled: isDisabled,
1361
+ readOnly: isReadOnly
1362
+ }
1363
+ ),
1364
+ /* @__PURE__ */ jsx(
1365
+ SendButton,
1366
+ {
1367
+ type: "button",
1368
+ onClick: handleSend,
1369
+ disabled: !canSend,
1370
+ "aria-label": "Send message",
1371
+ title: "Send message (Enter)",
1372
+ children: /* @__PURE__ */ jsxs(
1373
+ "svg",
1374
+ {
1375
+ width: "20",
1376
+ height: "20",
1377
+ viewBox: "0 0 20 20",
1378
+ fill: "none",
1379
+ xmlns: "http://www.w3.org/2000/svg",
1380
+ role: "img",
1381
+ "aria-hidden": "true",
1382
+ children: [
1383
+ /* @__PURE__ */ jsx("title", { children: "Send Icon" }),
1384
+ /* @__PURE__ */ jsx(
1385
+ "path",
1386
+ {
1387
+ d: "M2.5 10L17.5 3.75L11.25 18.75L10 12.5L2.5 10Z",
1388
+ stroke: "currentColor",
1389
+ strokeWidth: "2",
1390
+ strokeLinecap: "round",
1391
+ strokeLinejoin: "round"
1392
+ }
1393
+ )
1394
+ ]
1395
+ }
1396
+ )
1397
+ }
1398
+ )
1399
+ ] }) });
1400
+ };
1401
+ var FileAttachmentContainer = styled7.div`
1402
+ display: flex;
1403
+ align-items: center;
1404
+ gap: 8px;
1405
+ padding: 12px;
1406
+ background-color: #3a3a3c;
1407
+ border: 1px solid #48484a;
1408
+ border-radius: 8px;
1409
+ max-width: 320px;
1410
+ cursor: ${(props) => props.$isInteractive ? "pointer" : "default"};
1411
+ transition: border-color 0.15s ease;
1412
+
1413
+ /* Remove default button styles when used as button */
1414
+ ${(props) => props.$isInteractive && `
1415
+ font: inherit;
1416
+ color: inherit;
1417
+ text-align: left;
1418
+ appearance: none;
1419
+ -webkit-appearance: none;
1420
+
1421
+ &:hover {
1422
+ border-color: #5a5a5c;
1423
+ background-color: #48484a;
1424
+ }
1425
+
1426
+ &:focus-visible {
1427
+ outline: 2px solid #5B9FFF;
1428
+ outline-offset: 2px;
1429
+ border-color: #5B9FFF;
1430
+ }
1431
+
1432
+ &:active {
1433
+ border-color: #6a6a6c;
1434
+ }
1435
+ `}
1436
+ `;
1437
+ var FileIconContainer = styled7.div`
1438
+ flex-shrink: 0;
1439
+ width: 32px;
1440
+ height: 32px;
1441
+ display: flex;
1442
+ align-items: center;
1443
+ justify-content: center;
1444
+ font-size: 24px;
1445
+ line-height: 1;
1446
+ `;
1447
+ var FileInfo = styled7.div`
1448
+ flex: 1;
1449
+ min-width: 0;
1450
+ display: flex;
1451
+ flex-direction: column;
1452
+ gap: 2px;
1453
+ `;
1454
+ var FileTitle = styled7.div`
1455
+ font-size: 14px;
1456
+ font-weight: 500;
1457
+ color: #e5e5e7;
1458
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
1459
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
1460
+ line-height: 1.4;
1461
+ overflow: hidden;
1462
+ text-overflow: ellipsis;
1463
+ white-space: nowrap;
1464
+ `;
1465
+ var FileMetadata = styled7.div`
1466
+ display: flex;
1467
+ align-items: center;
1468
+ gap: 4px;
1469
+ font-size: 12px;
1470
+ color: #8e8e93;
1471
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
1472
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
1473
+ line-height: 1.4;
1474
+ overflow: hidden;
1475
+ `;
1476
+ var FileSubtitle = styled7.span`
1477
+ color: #8e8e93;
1478
+ white-space: nowrap;
1479
+ overflow: hidden;
1480
+ text-overflow: ellipsis;
1481
+
1482
+ &:last-child {
1483
+ flex-shrink: 0;
1484
+ }
1485
+ `;
1486
+ var FileAttachment = ({
1487
+ title,
1488
+ subtitle,
1489
+ size,
1490
+ icon = "\u{1F4C4}",
1491
+ onClick,
1492
+ onPress,
1493
+ className,
1494
+ ...ariaProps
1495
+ }) => {
1496
+ const ref = useRef(null);
1497
+ const isInteractive = !!(onClick || onPress);
1498
+ const handlePress = (e) => {
1499
+ if (onClick) onClick();
1500
+ if (onPress) onPress(e);
1501
+ };
1502
+ const { buttonProps } = useButton(
1503
+ {
1504
+ ...ariaProps,
1505
+ onPress: isInteractive ? handlePress : void 0,
1506
+ isDisabled: !isInteractive
1507
+ },
1508
+ ref
1509
+ );
1510
+ return /* @__PURE__ */ jsxs(
1511
+ FileAttachmentContainer,
1512
+ {
1513
+ ...isInteractive ? buttonProps : {},
1514
+ ref: isInteractive ? ref : void 0,
1515
+ className,
1516
+ $isInteractive: isInteractive,
1517
+ as: isInteractive ? "button" : "div",
1518
+ children: [
1519
+ /* @__PURE__ */ jsx(FileIconContainer, { children: icon }),
1520
+ /* @__PURE__ */ jsxs(FileInfo, { children: [
1521
+ /* @__PURE__ */ jsx(FileTitle, { children: title }),
1522
+ /* @__PURE__ */ jsxs(FileMetadata, { children: [
1523
+ subtitle && /* @__PURE__ */ jsx(FileSubtitle, { children: subtitle }),
1524
+ size && subtitle && /* @__PURE__ */ jsx(FileSubtitle, { "aria-hidden": "true", children: " \u2022 " }),
1525
+ size && /* @__PURE__ */ jsx(FileSubtitle, { children: size })
1526
+ ] })
1527
+ ] })
1528
+ ]
1529
+ }
1530
+ );
1531
+ };
1532
+ var MessageContainer = styled7.div`
1533
+ display: flex;
1534
+ gap: 12px;
1535
+ align-items: flex-start;
1536
+ padding: 8px 0;
1537
+ max-width: 100%;
1538
+ `;
1539
+ var AvatarContainer = styled7.div`
1540
+ flex-shrink: 0;
1541
+ `;
1542
+ var Avatar2 = styled7.img`
1543
+ width: 32px;
1544
+ height: 32px;
1545
+ border-radius: 50%;
1546
+ object-fit: cover;
1547
+ background-color: #e5e7eb;
1548
+ `;
1549
+ var AvatarInitials = styled7.div`
1550
+ width: 32px;
1551
+ height: 32px;
1552
+ border-radius: 50%;
1553
+ background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
1554
+ color: white;
1555
+ display: flex;
1556
+ align-items: center;
1557
+ justify-content: center;
1558
+ font-size: 12px;
1559
+ font-weight: 600;
1560
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
1561
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
1562
+
1563
+ svg {
1564
+ width: 18px;
1565
+ height: 18px;
1566
+ }
1567
+ `;
1568
+ var ContentContainer = styled7.div`
1569
+ flex: 1;
1570
+ min-width: 0;
1571
+ `;
1572
+ var MessageContent = styled7.div`
1573
+ background-color: #2c2c2e;
1574
+ padding: 12px 16px;
1575
+ border-radius: 16px;
1576
+ border-top-left-radius: 4px;
1577
+ color: #e5e5e7;
1578
+ font-size: 14px;
1579
+ line-height: 1.5;
1580
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
1581
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
1582
+ word-wrap: break-word;
1583
+ white-space: pre-wrap;
1584
+ `;
1585
+ var LoadingDots3 = styled7.div`
1586
+ display: flex;
1587
+ gap: 6px;
1588
+ padding: 12px 16px;
1589
+ background-color: #2c2c2e;
1590
+ border-radius: 16px;
1591
+ border-top-left-radius: 4px;
1592
+ width: fit-content;
1593
+ `;
1594
+ var bounce = keyframes`
1595
+ 0%, 60%, 100% {
1596
+ transform: translateY(0);
1597
+ }
1598
+ 30% {
1599
+ transform: translateY(-8px);
1600
+ }
1601
+ `;
1602
+ var LoadingDot = styled7.div`
1603
+ width: 8px;
1604
+ height: 8px;
1605
+ border-radius: 50%;
1606
+ background-color: #8e8e93;
1607
+ animation: ${bounce} 1.4s ease-in-out infinite;
1608
+ animation-delay: ${(props) => props.delay}s;
1609
+ `;
1610
+ var AttachmentsContainer = styled7.div`
1611
+ display: flex;
1612
+ flex-direction: column;
1613
+ gap: 8px;
1614
+ margin-top: 12px;
1615
+ `;
1616
+ var AssistantMessage = ({
1617
+ content = "",
1618
+ avatarUrl,
1619
+ avatarInitials: _avatarInitials = "AI",
1620
+ isLoading = false,
1621
+ className,
1622
+ attachments = [],
1623
+ enableMarkdown: _enableMarkdown = false
1624
+ }) => {
1625
+ const renderContent = () => {
1626
+ if (isLoading) {
1627
+ return /* @__PURE__ */ jsxs(LoadingDots3, { children: [
1628
+ /* @__PURE__ */ jsx(LoadingDot, { delay: 0 }),
1629
+ /* @__PURE__ */ jsx(LoadingDot, { delay: 0.2 }),
1630
+ /* @__PURE__ */ jsx(LoadingDot, { delay: 0.4 })
1631
+ ] });
1632
+ }
1633
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1634
+ content && /* @__PURE__ */ jsx(MessageContent, { children: content }),
1635
+ attachments.length > 0 && /* @__PURE__ */ jsx(AttachmentsContainer, { children: attachments.map((attachment, index) => /* @__PURE__ */ jsx(FileAttachment, { ...attachment }, `${attachment.title}-${index}`)) })
1636
+ ] });
1637
+ };
1638
+ return /* @__PURE__ */ jsxs(MessageContainer, { className, children: [
1639
+ /* @__PURE__ */ jsx(AvatarContainer, { children: avatarUrl ? /* @__PURE__ */ jsx(Avatar2, { src: avatarUrl, alt: "Assistant avatar" }) : /* @__PURE__ */ jsx(AvatarInitials, { children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M17 13a4 4 0 0 1 0 8c-2.142 0-4-1.79-4-4h-2a4 4 0 1 1-.535-2h3.07A4 4 0 0 1 17 13M2 12v-2h2V7a4 4 0 0 1 4-4h8a4 4 0 0 1 4 4v3h2v2z" }) }) }) }),
1640
+ /* @__PURE__ */ jsx(ContentContainer, { children: renderContent() })
1641
+ ] });
1642
+ };
1643
+ var MessagesContainer = styled7.div`
1644
+ display: flex;
1645
+ flex-direction: column;
1646
+ flex: 1;
1647
+ overflow: hidden;
1648
+ background-color: #1c1c1e;
1649
+ padding: 8px;
1650
+ gap: 12px;
1651
+ box-sizing: border-box;
1652
+
1653
+ /* Ensure proper scrolling behavior for child components */
1654
+ position: relative;
1655
+ min-height: 0;
1656
+
1657
+ /* Desktop padding */
1658
+ @media (min-width: 640px) {
1659
+ padding: 12px;
1660
+ }
1661
+ `;
1662
+ var Messages = ({
1663
+ children,
1664
+ className,
1665
+ ariaLabel = "Messages"
1666
+ }) => {
1667
+ return /* @__PURE__ */ jsx(MessagesContainer, { className, role: "region", "aria-label": ariaLabel, children });
1668
+ };
1669
+ Messages.displayName = "Messages";
1670
+ var MessagesListContainer = styled7.div`
1671
+ display: flex;
1672
+ flex-direction: column;
1673
+ width: 100%;
1674
+ max-height: ${(props) => props.$maxHeight};
1675
+ overflow-y: auto;
1676
+ overflow-x: hidden;
1677
+ position: relative;
1678
+ background: #ffffff;
1679
+ border: 1px solid #e5e7eb;
1680
+ border-radius: 8px;
1681
+ scroll-behavior: smooth;
1682
+
1683
+ /* Custom scrollbar styling */
1684
+ &::-webkit-scrollbar {
1685
+ width: 8px;
1686
+ }
1687
+
1688
+ &::-webkit-scrollbar-track {
1689
+ background: #f1f5f9;
1690
+ border-radius: 4px;
1691
+ }
1692
+
1693
+ &::-webkit-scrollbar-thumb {
1694
+ background: #cbd5e1;
1695
+ border-radius: 4px;
1696
+ transition: background 0.2s ease;
1697
+ }
1698
+
1699
+ &::-webkit-scrollbar-thumb:hover {
1700
+ background: #94a3b8;
1701
+ }
1702
+
1703
+ /* Firefox scrollbar styling */
1704
+ scrollbar-width: thin;
1705
+ scrollbar-color: #cbd5e1 #f1f5f9;
1706
+
1707
+ /* Ensure proper rendering on mobile */
1708
+ -webkit-overflow-scrolling: touch;
1709
+ `;
1710
+ var MessagesListContent = styled7.div`
1711
+ display: flex;
1712
+ flex-direction: column;
1713
+ gap: 12px;
1714
+ padding: 16px;
1715
+ min-height: min-content;
1716
+
1717
+ /* Message styling */
1718
+ .message {
1719
+ display: flex;
1720
+ flex-direction: column;
1721
+ gap: 4px;
1722
+ padding: 12px 16px;
1723
+ border-radius: 8px;
1724
+ max-width: 85%;
1725
+ word-wrap: break-word;
1726
+ animation: messageSlideIn 0.2s ease-out;
1727
+ }
1728
+
1729
+ @keyframes messageSlideIn {
1730
+ from {
1731
+ opacity: 0;
1732
+ transform: translateY(8px);
1733
+ }
1734
+ to {
1735
+ opacity: 1;
1736
+ transform: translateY(0);
1737
+ }
1738
+ }
1739
+
1740
+ /* Role-specific message styling */
1741
+ .message--user {
1742
+ align-self: flex-end;
1743
+ background: #3b82f6;
1744
+ color: #ffffff;
1745
+ border-bottom-right-radius: 4px;
1746
+ }
1747
+
1748
+ .message--assistant {
1749
+ align-self: flex-start;
1750
+ background: #f1f5f9;
1751
+ color: #1e293b;
1752
+ border-bottom-left-radius: 4px;
1753
+ }
1754
+
1755
+ .message--system {
1756
+ align-self: center;
1757
+ background: #fef3c7;
1758
+ color: #92400e;
1759
+ font-size: 0.875rem;
1760
+ font-style: italic;
1761
+ max-width: 100%;
1762
+ text-align: center;
1763
+ }
1764
+ `;
1765
+ var MessagesList = ({
1766
+ messages,
1767
+ autoScroll = true,
1768
+ className,
1769
+ renderMessage,
1770
+ onScrollTop,
1771
+ maxHeight = "600px"
1772
+ }) => {
1773
+ const containerRef = useRef(null);
1774
+ const contentRef = useRef(null);
1775
+ const isUserScrollingRef = useRef(false);
1776
+ const scrollTimeoutRef = useRef(null);
1777
+ useEffect(() => {
1778
+ if (autoScroll && !isUserScrollingRef.current && containerRef.current) {
1779
+ const container = containerRef.current;
1780
+ container.scrollTop = container.scrollHeight;
1781
+ }
1782
+ }, [messages.length, autoScroll]);
1783
+ const handleScroll = () => {
1784
+ if (!containerRef.current) return;
1785
+ const container = containerRef.current;
1786
+ const isAtBottom = container.scrollHeight - container.scrollTop - container.clientHeight < 10;
1787
+ isUserScrollingRef.current = !isAtBottom;
1788
+ if (scrollTimeoutRef.current) {
1789
+ clearTimeout(scrollTimeoutRef.current);
1790
+ }
1791
+ scrollTimeoutRef.current = setTimeout(() => {
1792
+ isUserScrollingRef.current = false;
1793
+ }, 1e3);
1794
+ if (container.scrollTop === 0 && onScrollTop) {
1795
+ onScrollTop();
1796
+ }
1797
+ };
1798
+ useEffect(() => {
1799
+ return () => {
1800
+ if (scrollTimeoutRef.current) {
1801
+ clearTimeout(scrollTimeoutRef.current);
1802
+ }
1803
+ };
1804
+ }, []);
1805
+ const defaultRenderMessage = (message) => /* @__PURE__ */ jsx(
1806
+ "div",
1807
+ {
1808
+ className: `message message--${message.role}`,
1809
+ "data-message-id": message.id,
1810
+ "data-role": message.role,
1811
+ children: message.content
1812
+ },
1813
+ message.id
1814
+ );
1815
+ return /* @__PURE__ */ jsx(
1816
+ MessagesListContainer,
1817
+ {
1818
+ ref: containerRef,
1819
+ onScroll: handleScroll,
1820
+ className,
1821
+ $maxHeight: maxHeight,
1822
+ children: /* @__PURE__ */ jsx(MessagesListContent, { ref: contentRef, children: messages.map(renderMessage || defaultRenderMessage) })
1823
+ }
1824
+ );
1825
+ };
1826
+ var StyledUserMessage2 = styled7.div`
1827
+ display: flex;
1828
+ justify-content: flex-end;
1829
+ align-items: flex-start;
1830
+ margin: 8px 0;
1831
+ padding: 0 16px;
1832
+ width: 100%;
1833
+ `;
1834
+ var MessageBubble = styled7.div`
1835
+ display: flex;
1836
+ flex-direction: column;
1837
+ max-width: 70%;
1838
+ padding: 12px 16px;
1839
+ border-radius: 18px 18px 4px 18px;
1840
+
1841
+ /* User message colors - distinct from assistant messages */
1842
+ background-color: #007AFF;
1843
+ color: #FFFFFF;
1844
+
1845
+ /* Box shadow for depth */
1846
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
1847
+
1848
+ /* Smooth transitions */
1849
+ transition: all 0.2s ease-in-out;
1850
+
1851
+ &:hover {
1852
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
1853
+ }
1854
+
1855
+ /* Username styling */
1856
+ strong {
1857
+ font-size: 12px;
1858
+ font-weight: 600;
1859
+ margin-bottom: 4px;
1860
+ opacity: 0.9;
1861
+ }
1862
+ `;
1863
+ var MessageContent2 = styled7.p`
1864
+ margin: 0;
1865
+ font-size: 14px;
1866
+ line-height: 1.5;
1867
+ word-wrap: break-word;
1868
+ white-space: pre-wrap;
1869
+ `;
1870
+ var MessageTime = styled7.time`
1871
+ font-size: 11px;
1872
+ opacity: 0.7;
1873
+ margin-top: 4px;
1874
+ text-align: right;
1875
+ `;
1876
+ var UserMessage2 = ({
1877
+ content,
1878
+ timestamp,
1879
+ className,
1880
+ avatarUrl,
1881
+ username
1882
+ }) => {
1883
+ return /* @__PURE__ */ jsxs(StyledUserMessage2, { className, children: [
1884
+ /* @__PURE__ */ jsxs(MessageBubble, { children: [
1885
+ username && /* @__PURE__ */ jsx("strong", { children: username }),
1886
+ /* @__PURE__ */ jsx(MessageContent2, { children: content }),
1887
+ timestamp && /* @__PURE__ */ jsx(MessageTime, { children: timestamp })
1888
+ ] }),
1889
+ avatarUrl && /* @__PURE__ */ jsx(
1890
+ "img",
1891
+ {
1892
+ src: avatarUrl,
1893
+ alt: username || "User",
1894
+ style: { width: "32px", height: "32px", borderRadius: "50%", marginLeft: "8px" }
1895
+ }
1896
+ )
1897
+ ] });
1898
+ };
1899
+ var SuggestionsContainer = styled7.div`
1900
+ display: flex;
1901
+ flex-wrap: wrap;
1902
+ gap: ${({ theme }) => theme?.spacing?.sm ?? "8px"};
1903
+ padding: ${({ theme }) => theme?.spacing?.md ?? "16px"} 0;
1904
+ `;
1905
+ var StyledSuggestion = styled7.button`
1906
+ /* Base styles */
1907
+ display: inline-flex;
1908
+ align-items: center;
1909
+ justify-content: center;
1910
+ padding: ${({ theme }) => theme?.spacing?.sm ?? "8px"} ${({ theme }) => theme?.spacing?.md ?? "16px"};
1911
+ font-family: ${({ theme }) => theme?.fonts?.body ?? "system-ui, sans-serif"};
1912
+ font-size: 0.875rem;
1913
+ font-weight: 500;
1914
+ color: ${({ theme }) => theme?.colors?.text ?? "#000000"};
1915
+ background-color: ${({ theme }) => theme?.colors?.surface ?? "#ffffff"};
1916
+ border: 1px solid ${({ theme }) => theme?.colors?.border ?? "#E0E0E0"};
1917
+ border-radius: ${({ theme }) => theme?.radii?.lg ?? "12px"};
1918
+ cursor: pointer;
1919
+ transition: all 0.2s ease-in-out;
1920
+ white-space: nowrap;
1921
+ user-select: none;
1922
+
1923
+ /* Hover state */
1924
+ &:hover:not(:disabled) {
1925
+ background-color: ${({ theme }) => theme?.colors?.border ?? "#E0E0E0"};
1926
+ border-color: ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
1927
+ transform: translateY(-1px);
1928
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
1929
+ }
1930
+
1931
+ /* Active/Pressed state */
1932
+ &:active:not(:disabled) {
1933
+ transform: translateY(0);
1934
+ box-shadow: none;
1935
+ }
1936
+
1937
+ ${({ $isPressed }) => $isPressed && css`
1938
+ transform: scale(0.98);
1939
+ `}
1940
+
1941
+ /* Focus state */
1942
+ &:focus-visible {
1943
+ outline: 2px solid ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
1944
+ outline-offset: 2px;
1945
+ }
1946
+
1947
+ /* Remove default focus outline */
1948
+ &:focus {
1949
+ outline: none;
1950
+ }
1951
+
1952
+ /* Disabled state */
1953
+ &:disabled {
1954
+ cursor: not-allowed;
1955
+ opacity: 0.5;
1956
+ transform: none;
1957
+ }
1958
+ `;
1959
+ function Suggestions({ suggestions, onSelect, className }) {
1960
+ if (suggestions.length === 0) {
1961
+ return null;
1962
+ }
1963
+ return /* @__PURE__ */ jsx(SuggestionsContainer, { className, role: "list", "aria-label": "Suggested prompts", children: suggestions.map((suggestion) => /* @__PURE__ */ jsx(SuggestionChip, { suggestion, onSelect }, suggestion)) });
1964
+ }
1965
+ function SuggestionChip({ suggestion, onSelect }) {
1966
+ const ref = useRef(null);
1967
+ const { buttonProps, isPressed } = useButton(
1968
+ {
1969
+ onPress: () => onSelect(suggestion),
1970
+ "aria-label": `Select suggestion: ${suggestion}`
1971
+ },
1972
+ ref
1973
+ );
1974
+ return /* @__PURE__ */ jsx(StyledSuggestion, { ...buttonProps, ref, $isPressed: isPressed, role: "listitem", children: suggestion });
1975
+ }
1976
+ Suggestions.displayName = "Suggestions";
1977
+ var WindowContainer = styled7.div`
1978
+ display: flex;
1979
+ flex-direction: column;
1980
+ background-color: #1c1c1e;
1981
+ border-radius: 0;
1982
+ box-shadow: none;
1983
+ overflow: hidden;
1984
+ transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
1985
+ position: relative;
1986
+
1987
+ /* Default dimensions */
1988
+ width: ${({ $width }) => $width};
1989
+ height: ${({ $height }) => $height};
1990
+
1991
+ /* Fullscreen state */
1992
+ ${({ $isFullscreen }) => $isFullscreen && css`
1993
+ width: 100vw;
1994
+ height: 100vh;
1995
+ border-radius: 0;
1996
+ box-shadow: none;
1997
+ position: fixed;
1998
+ top: 0;
1999
+ left: 0;
2000
+ z-index: 1000;
2001
+ `}
2002
+
2003
+ /* Minimized state */
2004
+ ${({ $isMinimized }) => $isMinimized && css`
2005
+ height: 60px;
2006
+ width: 300px;
2007
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
2008
+ cursor: pointer;
2009
+
2010
+ /* Hide all content except header when minimized */
2011
+ > *:not(:first-child) {
2012
+ display: none;
2013
+ }
2014
+
2015
+ /* Keep header visible but adjust styling */
2016
+ > *:first-child {
2017
+ border-bottom: none;
2018
+ }
2019
+ `}
2020
+
2021
+ /* Responsive behavior for smaller screens */
2022
+ @media (max-width: 768px) {
2023
+ ${({ $isFullscreen, $isMinimized }) => !$isFullscreen && !$isMinimized && css`
2024
+ width: 100vw;
2025
+ height: 100vh;
2026
+ border-radius: 0;
2027
+ max-width: 100%;
2028
+ max-height: 100%;
2029
+ `}
2030
+ }
2031
+
2032
+ /* Focus states for accessibility */
2033
+ &:focus-visible {
2034
+ outline: 2px solid ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
2035
+ outline-offset: 2px;
2036
+ }
2037
+
2038
+ /* Ensure proper stacking context */
2039
+ z-index: ${({ $isFullscreen }) => $isFullscreen ? 1e3 : 100};
2040
+ `;
2041
+ var Window = ({
2042
+ isMinimized = false,
2043
+ isFullscreen = false,
2044
+ width = "400px",
2045
+ height = "600px",
2046
+ children,
2047
+ className,
2048
+ ariaLabel = "Chat window"
2049
+ }) => {
2050
+ return /* @__PURE__ */ jsx(
2051
+ WindowContainer,
2052
+ {
2053
+ className,
2054
+ $isMinimized: isMinimized,
2055
+ $isFullscreen: isFullscreen,
2056
+ $width: width,
2057
+ $height: height,
2058
+ role: "dialog",
2059
+ "aria-label": ariaLabel,
2060
+ "aria-modal": "false",
2061
+ children
2062
+ }
2063
+ );
2064
+ };
2065
+ Window.displayName = "Window";
2066
+
2067
+ export { Actions, AgentState, AssistantMessage, AssistantThinking, Button, ChatInput, FileAttachment, Footer, Header, Input, Messages, MessagesList, MessagesListContainer, MessagesListContent, Response, Suggestions, UserMessage, UserMessage2, Window };
2068
+ //# sourceMappingURL=chunk-CNVJ5UF2.js.map
2069
+ //# sourceMappingURL=chunk-CNVJ5UF2.js.map