@agentiffai/design 0.1.2 → 0.1.3

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.
@@ -1,15 +1,798 @@
1
1
  'use strict';
2
2
 
3
- var chunkOPWUJP7J_cjs = require('../chunk-OPWUJP7J.cjs');
4
- var reactUi = require('@copilotkit/react-ui');
5
- var styled = require('styled-components');
6
- var jsxRuntime = require('react/jsx-runtime');
3
+ var button = require('@react-aria/button');
7
4
  var react = require('react');
5
+ var styled4 = require('styled-components');
6
+ var jsxRuntime = require('react/jsx-runtime');
7
+ var reactUi = require('@copilotkit/react-ui');
8
+ var textfield = require('@react-aria/textfield');
8
9
 
9
10
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
11
 
11
- var styled__default = /*#__PURE__*/_interopDefault(styled);
12
+ var styled4__default = /*#__PURE__*/_interopDefault(styled4);
13
+
14
+ // src/components/copilotkit/Button/Button.tsx
15
+ var variantStyles = {
16
+ primary: styled4.css`
17
+ background-color: ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
18
+ color: white;
19
+ border: none;
20
+
21
+ &:hover:not(:disabled) {
22
+ opacity: 0.9;
23
+ transform: translateY(-1px);
24
+ }
25
+
26
+ &:active:not(:disabled) {
27
+ opacity: 0.8;
28
+ transform: translateY(0);
29
+ }
30
+
31
+ &:focus-visible {
32
+ outline: 2px solid ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
33
+ outline-offset: 2px;
34
+ }
35
+ `,
36
+ secondary: styled4.css`
37
+ background-color: transparent;
38
+ color: ${({ theme }) => theme?.colors?.text ?? "#000000"};
39
+ border: 1px solid ${({ theme }) => theme?.colors?.border ?? "#E0E0E0"};
40
+
41
+ &:hover:not(:disabled) {
42
+ background-color: ${({ theme }) => theme?.colors?.surface ?? "#ffffff"};
43
+ border-color: ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
44
+ }
45
+
46
+ &:active:not(:disabled) {
47
+ background-color: ${({ theme }) => theme?.colors?.border ?? "#E0E0E0"};
48
+ }
49
+
50
+ &:focus-visible {
51
+ outline: 2px solid ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
52
+ outline-offset: 2px;
53
+ }
54
+ `,
55
+ icon: styled4.css`
56
+ background-color: transparent;
57
+ color: ${({ theme }) => theme?.colors?.text ?? "#000000"};
58
+ border: none;
59
+ padding: ${({ theme }) => theme?.spacing?.sm ?? "8px"};
60
+ min-width: auto;
61
+
62
+ &:hover:not(:disabled) {
63
+ background-color: ${({ theme }) => theme?.colors?.border ?? "#E0E0E0"};
64
+ opacity: 0.8;
65
+ }
66
+
67
+ &:active:not(:disabled) {
68
+ opacity: 0.6;
69
+ }
70
+
71
+ &:focus-visible {
72
+ outline: 2px solid ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
73
+ outline-offset: 2px;
74
+ }
75
+ `
76
+ };
77
+ var sizeStyles = {
78
+ small: styled4.css`
79
+ padding: ${({ theme }) => theme?.spacing?.xs ?? "4px"} ${({ theme }) => theme?.spacing?.sm ?? "8px"};
80
+ font-size: 0.875rem;
81
+ min-width: 60px;
82
+ height: 28px;
83
+ `,
84
+ medium: styled4.css`
85
+ padding: ${({ theme }) => theme?.spacing?.sm ?? "8px"} ${({ theme }) => theme?.spacing?.md ?? "16px"};
86
+ font-size: 1rem;
87
+ min-width: 80px;
88
+ height: 36px;
89
+ `,
90
+ large: styled4.css`
91
+ padding: ${({ theme }) => theme?.spacing?.md ?? "16px"} ${({ theme }) => theme?.spacing?.lg ?? "24px"};
92
+ font-size: 1.125rem;
93
+ min-width: 100px;
94
+ height: 44px;
95
+ `
96
+ };
97
+ var StyledButton = styled4__default.default.button`
98
+ /* Base styles */
99
+ display: inline-flex;
100
+ align-items: center;
101
+ justify-content: center;
102
+ gap: ${({ theme }) => theme?.spacing?.xs ?? "4px"};
103
+ font-family: ${({ theme }) => theme?.fonts?.body ?? "system-ui, sans-serif"};
104
+ font-weight: 500;
105
+ border-radius: ${({ theme }) => theme?.radii?.md ?? "8px"};
106
+ cursor: pointer;
107
+ transition: all 0.2s ease-in-out;
108
+ white-space: nowrap;
109
+ user-select: none;
110
+
111
+ /* Variant styles */
112
+ ${({ $variant }) => variantStyles[$variant]}
113
+
114
+ /* Size styles */
115
+ ${({ $size, $variant }) => $variant !== "icon" && sizeStyles[$size]}
116
+
117
+ /* Icon variant size overrides */
118
+ ${({ $variant, $size }) => $variant === "icon" && styled4.css`
119
+ width: ${$size === "small" ? "28px" : $size === "large" ? "44px" : "36px"};
120
+ height: ${$size === "small" ? "28px" : $size === "large" ? "44px" : "36px"};
121
+ border-radius: ${({ theme }) => theme?.radii?.sm ?? "4px"};
122
+ `}
123
+
124
+ /* Pressed state */
125
+ ${({ $isPressed }) => $isPressed && styled4.css`
126
+ transform: scale(0.98);
127
+ `}
128
+
129
+ /* Loading state */
130
+ ${({ $isLoading }) => $isLoading && styled4.css`
131
+ cursor: wait;
132
+ opacity: 0.7;
133
+ `}
134
+
135
+ /* Disabled state */
136
+ &:disabled {
137
+ cursor: not-allowed;
138
+ opacity: 0.5;
139
+ transform: none;
140
+ }
141
+
142
+ /* Remove default focus outline, using focus-visible instead */
143
+ &:focus {
144
+ outline: none;
145
+ }
146
+ `;
147
+ function Button({
148
+ variant = "primary",
149
+ size = "medium",
150
+ children,
151
+ className,
152
+ disabled = false,
153
+ isLoading = false,
154
+ ...ariaProps
155
+ }) {
156
+ const ref = react.useRef(null);
157
+ const { buttonProps, isPressed } = button.useButton(
158
+ {
159
+ ...ariaProps,
160
+ isDisabled: disabled || isLoading
161
+ },
162
+ ref
163
+ );
164
+ return /* @__PURE__ */ jsxRuntime.jsx(
165
+ StyledButton,
166
+ {
167
+ ...buttonProps,
168
+ ref,
169
+ className,
170
+ $variant: variant,
171
+ $size: size,
172
+ $isPressed: isPressed,
173
+ $isLoading: isLoading,
174
+ disabled: disabled || isLoading,
175
+ children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-live": "polite", "aria-busy": "true", children: "Loading..." }) : children
176
+ }
177
+ );
178
+ }
179
+ Button.displayName = "Button";
180
+ var ActionsContainer = styled4__default.default.div`
181
+ display: flex;
182
+ gap: ${({ theme }) => theme?.spacing?.sm ?? "8px"};
183
+ align-items: center;
184
+
185
+ ${({ $layout }) => $layout === "horizontal" ? styled4.css`
186
+ flex-direction: row;
187
+ flex-wrap: wrap;
188
+ ` : styled4.css`
189
+ flex-direction: column;
190
+ align-items: stretch;
191
+
192
+ button {
193
+ width: 100%;
194
+ }
195
+ `}
196
+ `;
197
+ function Actions({ actions, layout = "horizontal", className }) {
198
+ return /* @__PURE__ */ jsxRuntime.jsx(ActionsContainer, { $layout: layout, className, children: actions.map((action) => /* @__PURE__ */ jsxRuntime.jsxs(
199
+ Button,
200
+ {
201
+ variant: action.variant || "secondary",
202
+ onPress: action.onClick,
203
+ isDisabled: action.disabled,
204
+ "aria-label": action.label,
205
+ children: [
206
+ action.icon && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", children: action.icon }),
207
+ action.variant !== "icon" && action.label
208
+ ]
209
+ },
210
+ action.id
211
+ )) });
212
+ }
213
+ Actions.displayName = "Actions";
214
+ var dotPulse = styled4.keyframes`
215
+ 0%, 100% {
216
+ opacity: 0.3;
217
+ transform: scale(0.8);
218
+ }
219
+ 50% {
220
+ opacity: 1;
221
+ transform: scale(1);
222
+ }
223
+ `;
224
+ var fadeIn = styled4.keyframes`
225
+ from {
226
+ opacity: 0;
227
+ }
228
+ to {
229
+ opacity: 1;
230
+ }
231
+ `;
232
+ var blink = styled4.keyframes`
233
+ 0%, 49% {
234
+ opacity: 1;
235
+ }
236
+ 50%, 100% {
237
+ opacity: 0;
238
+ }
239
+ `;
240
+ var ResponseContainer = styled4__default.default.div`
241
+ display: inline-flex;
242
+ align-items: center;
243
+ gap: 12px;
244
+ padding: 12px 16px;
245
+ background-color: #2c2c2e;
246
+ border-radius: 16px;
247
+ box-shadow: none;
248
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
249
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
250
+ max-width: fit-content;
251
+ margin: 0 auto;
252
+ `;
253
+ var LoadingDots = styled4__default.default.div`
254
+ display: flex;
255
+ align-items: center;
256
+ gap: 4px;
257
+ padding: 0 4px;
258
+ `;
259
+ var Dot = styled4__default.default.span`
260
+ width: 6px;
261
+ height: 6px;
262
+ border-radius: 50%;
263
+ background-color: #8e8e93;
264
+ animation: ${dotPulse} 1.4s ease-in-out infinite;
265
+ animation-delay: ${(props) => props.delay}s;
266
+ `;
267
+ var TypingIndicator = styled4__default.default.div`
268
+ display: flex;
269
+ align-items: center;
270
+ gap: 4px;
271
+ padding: 0 4px;
272
+
273
+ ${Dot} {
274
+ width: 6px;
275
+ height: 6px;
276
+ background-color: #8e8e93;
277
+ animation: ${dotPulse} 1.4s ease-in-out infinite;
278
+ }
279
+ `;
280
+ var Message = styled4__default.default.span`
281
+ font-size: 14px;
282
+ color: #e5e5e7;
283
+ font-weight: 400;
284
+ line-height: 1.5;
285
+ white-space: nowrap;
286
+ `;
287
+ var StreamingText = styled4__default.default.div`
288
+ font-size: 14px;
289
+ line-height: 1.5;
290
+ color: #e5e5e7;
291
+ animation: ${fadeIn} 0.3s ease-in;
292
+ position: relative;
293
+ font-weight: 400;
294
+ white-space: nowrap;
12
295
 
296
+ /* Blinking cursor effect */
297
+ &::after {
298
+ content: '|';
299
+ margin-left: 0.125rem;
300
+ animation: ${blink} 1s infinite;
301
+ color: #8e8e93;
302
+ font-weight: 400;
303
+ }
304
+ `;
305
+ var Response = ({
306
+ isLoading = false,
307
+ isTyping = false,
308
+ isStreaming = false,
309
+ streamingContent = "",
310
+ message = "Thinking...",
311
+ className
312
+ }) => {
313
+ if (isLoading) {
314
+ return /* @__PURE__ */ jsxRuntime.jsxs(ResponseContainer, { className, "data-testid": "response-loading", children: [
315
+ /* @__PURE__ */ jsxRuntime.jsxs(LoadingDots, { "aria-hidden": "true", children: [
316
+ /* @__PURE__ */ jsxRuntime.jsx(Dot, { delay: 0 }),
317
+ /* @__PURE__ */ jsxRuntime.jsx(Dot, { delay: 0.15 }),
318
+ /* @__PURE__ */ jsxRuntime.jsx(Dot, { delay: 0.3 })
319
+ ] }),
320
+ /* @__PURE__ */ jsxRuntime.jsx(Message, { children: message })
321
+ ] });
322
+ }
323
+ if (isTyping) {
324
+ return /* @__PURE__ */ jsxRuntime.jsxs(ResponseContainer, { className, "data-testid": "response-typing", children: [
325
+ /* @__PURE__ */ jsxRuntime.jsxs(TypingIndicator, { "aria-hidden": "true", children: [
326
+ /* @__PURE__ */ jsxRuntime.jsx(Dot, { delay: 0 }),
327
+ /* @__PURE__ */ jsxRuntime.jsx(Dot, { delay: 0.15 }),
328
+ /* @__PURE__ */ jsxRuntime.jsx(Dot, { delay: 0.3 })
329
+ ] }),
330
+ /* @__PURE__ */ jsxRuntime.jsx(Message, { children: message })
331
+ ] });
332
+ }
333
+ if (isStreaming && streamingContent) {
334
+ return /* @__PURE__ */ jsxRuntime.jsx(ResponseContainer, { className, "data-testid": "response-streaming", children: /* @__PURE__ */ jsxRuntime.jsx(StreamingText, { children: streamingContent }) });
335
+ }
336
+ return null;
337
+ };
338
+ var dotPulse2 = styled4.keyframes`
339
+ 0%, 100% {
340
+ opacity: 0.3;
341
+ transform: scale(0.8);
342
+ }
343
+ 50% {
344
+ opacity: 1;
345
+ transform: scale(1);
346
+ }
347
+ `;
348
+ var shake = styled4.keyframes`
349
+ 0%, 100% {
350
+ transform: translateX(0);
351
+ }
352
+ 25% {
353
+ transform: translateX(-5px);
354
+ }
355
+ 75% {
356
+ transform: translateX(5px);
357
+ }
358
+ `;
359
+ var AgentStateContainer = styled4__default.default.div`
360
+ display: inline-flex;
361
+ flex-direction: column;
362
+ align-items: center;
363
+ gap: 12px;
364
+ padding: 12px 16px;
365
+ background-color: ${(props) => props.isError ? "#3a1f1f" : "#2c2c2e"};
366
+ border-radius: 16px;
367
+ border: ${(props) => props.isError ? "1px solid #7f1d1d" : "none"};
368
+ box-shadow: none;
369
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
370
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
371
+ max-width: fit-content;
372
+ margin: 0 auto;
373
+ `;
374
+ var StateContent = styled4__default.default.div`
375
+ display: flex;
376
+ flex-direction: column;
377
+ gap: 8px;
378
+ align-items: center;
379
+ width: 100%;
380
+ `;
381
+ var IdleIndicator = styled4__default.default.div`
382
+ width: 6px;
383
+ height: 6px;
384
+ background-color: #8e8e93;
385
+ border-radius: 50%;
386
+ animation: ${dotPulse2} 2s infinite ease-in-out;
387
+ `;
388
+ var ErrorIndicator = styled4__default.default.div`
389
+ width: 6px;
390
+ height: 6px;
391
+ background-color: #ff6b6b;
392
+ border-radius: 50%;
393
+ animation: ${shake} 0.5s ease-in-out;
394
+ `;
395
+ var StateLabel = styled4__default.default.span`
396
+ font-size: 14px;
397
+ font-weight: 400;
398
+ color: #e5e5e7;
399
+ line-height: 1.5;
400
+ white-space: nowrap;
401
+ `;
402
+ styled4__default.default.p`
403
+ font-size: 14px;
404
+ color: #8e8e93;
405
+ line-height: 1.5;
406
+ margin: 0;
407
+ text-align: center;
408
+ white-space: nowrap;
409
+ `;
410
+ var ProgressBar = styled4__default.default.div`
411
+ width: 100%;
412
+ height: 4px;
413
+ background-color: #3a3a3c;
414
+ border-radius: 2px;
415
+ overflow: hidden;
416
+ margin-top: 4px;
417
+ `;
418
+ var ProgressBarFill = styled4__default.default.div`
419
+ height: 100%;
420
+ width: ${(props) => Math.min(Math.max(props.progress, 0), 100)}%;
421
+ background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
422
+ border-radius: 2px;
423
+ transition: width 0.3s ease-in-out;
424
+ `;
425
+ var AgentState = ({ state, message, progress, className }) => {
426
+ if (state === "idle") {
427
+ return /* @__PURE__ */ jsxRuntime.jsx(AgentStateContainer, { className, "data-testid": "agent-state-idle", children: /* @__PURE__ */ jsxRuntime.jsxs(StateContent, { children: [
428
+ /* @__PURE__ */ jsxRuntime.jsx(IdleIndicator, {}),
429
+ /* @__PURE__ */ jsxRuntime.jsx(StateLabel, { children: message || "Agent is idle" }),
430
+ progress !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(ProgressBar, { children: /* @__PURE__ */ jsxRuntime.jsx(ProgressBarFill, { progress }) })
431
+ ] }) });
432
+ }
433
+ if (state === "error") {
434
+ return /* @__PURE__ */ jsxRuntime.jsx(AgentStateContainer, { className, "data-testid": "agent-state-error", isError: true, children: /* @__PURE__ */ jsxRuntime.jsxs(StateContent, { children: [
435
+ /* @__PURE__ */ jsxRuntime.jsx(ErrorIndicator, {}),
436
+ /* @__PURE__ */ jsxRuntime.jsx(StateLabel, { children: message || "Error occurred" })
437
+ ] }) });
438
+ }
439
+ if (state === "thinking") {
440
+ return /* @__PURE__ */ jsxRuntime.jsx(
441
+ Response,
442
+ {
443
+ isLoading: true,
444
+ message: message || "Agent is thinking...",
445
+ className
446
+ }
447
+ );
448
+ }
449
+ if (state === "responding") {
450
+ return /* @__PURE__ */ jsxRuntime.jsx(
451
+ Response,
452
+ {
453
+ isTyping: true,
454
+ message: message || "Agent is responding...",
455
+ className
456
+ }
457
+ );
458
+ }
459
+ return null;
460
+ };
461
+ var MessageContainer = styled4__default.default.div`
462
+ display: flex;
463
+ gap: 12px;
464
+ align-items: flex-start;
465
+ padding: 8px 0;
466
+ max-width: 100%;
467
+ `;
468
+ var AvatarContainer = styled4__default.default.div`
469
+ flex-shrink: 0;
470
+ `;
471
+ var Avatar = styled4__default.default.img`
472
+ width: 32px;
473
+ height: 32px;
474
+ border-radius: 50%;
475
+ object-fit: cover;
476
+ background-color: #e5e7eb;
477
+ `;
478
+ var AvatarInitials = styled4__default.default.div`
479
+ width: 32px;
480
+ height: 32px;
481
+ border-radius: 50%;
482
+ background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
483
+ color: white;
484
+ display: flex;
485
+ align-items: center;
486
+ justify-content: center;
487
+ font-size: 12px;
488
+ font-weight: 600;
489
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
490
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
491
+
492
+ svg {
493
+ width: 18px;
494
+ height: 18px;
495
+ }
496
+ `;
497
+ var ContentContainer = styled4__default.default.div`
498
+ flex: 1;
499
+ min-width: 0;
500
+ `;
501
+ var MessageContent = styled4__default.default.div`
502
+ background-color: #2c2c2e;
503
+ padding: 12px 16px;
504
+ border-radius: 16px;
505
+ border-top-left-radius: 4px;
506
+ color: #e5e5e7;
507
+ font-size: 14px;
508
+ line-height: 1.5;
509
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
510
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
511
+ word-wrap: break-word;
512
+ white-space: pre-wrap;
513
+ `;
514
+ var LoadingDots2 = styled4__default.default.div`
515
+ display: flex;
516
+ gap: 6px;
517
+ padding: 12px 16px;
518
+ background-color: #2c2c2e;
519
+ border-radius: 16px;
520
+ border-top-left-radius: 4px;
521
+ width: fit-content;
522
+ `;
523
+ var bounce = styled4.keyframes`
524
+ 0%, 60%, 100% {
525
+ transform: translateY(0);
526
+ }
527
+ 30% {
528
+ transform: translateY(-8px);
529
+ }
530
+ `;
531
+ var LoadingDot = styled4__default.default.div`
532
+ width: 8px;
533
+ height: 8px;
534
+ border-radius: 50%;
535
+ background-color: #8e8e93;
536
+ animation: ${bounce} 1.4s ease-in-out infinite;
537
+ animation-delay: ${(props) => props.delay}s;
538
+ `;
539
+ var FileAttachmentContainer = styled4__default.default.div`
540
+ display: flex;
541
+ align-items: center;
542
+ gap: 8px;
543
+ padding: 12px;
544
+ background-color: #3a3a3c;
545
+ border: 1px solid #48484a;
546
+ border-radius: 8px;
547
+ max-width: 320px;
548
+ cursor: ${(props) => props.$isInteractive ? "pointer" : "default"};
549
+ transition: border-color 0.15s ease;
550
+
551
+ /* Remove default button styles when used as button */
552
+ ${(props) => props.$isInteractive && `
553
+ font: inherit;
554
+ color: inherit;
555
+ text-align: left;
556
+ appearance: none;
557
+ -webkit-appearance: none;
558
+
559
+ &:hover {
560
+ border-color: #5a5a5c;
561
+ background-color: #48484a;
562
+ }
563
+
564
+ &:focus-visible {
565
+ outline: 2px solid #5B9FFF;
566
+ outline-offset: 2px;
567
+ border-color: #5B9FFF;
568
+ }
569
+
570
+ &:active {
571
+ border-color: #6a6a6c;
572
+ }
573
+ `}
574
+ `;
575
+ var FileIconContainer = styled4__default.default.div`
576
+ flex-shrink: 0;
577
+ width: 32px;
578
+ height: 32px;
579
+ display: flex;
580
+ align-items: center;
581
+ justify-content: center;
582
+ font-size: 24px;
583
+ line-height: 1;
584
+ `;
585
+ var FileInfo = styled4__default.default.div`
586
+ flex: 1;
587
+ min-width: 0;
588
+ display: flex;
589
+ flex-direction: column;
590
+ gap: 2px;
591
+ `;
592
+ var FileTitle = styled4__default.default.div`
593
+ font-size: 14px;
594
+ font-weight: 500;
595
+ color: #e5e5e7;
596
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
597
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
598
+ line-height: 1.4;
599
+ overflow: hidden;
600
+ text-overflow: ellipsis;
601
+ white-space: nowrap;
602
+ `;
603
+ var FileMetadata = styled4__default.default.div`
604
+ display: flex;
605
+ align-items: center;
606
+ gap: 4px;
607
+ font-size: 12px;
608
+ color: #8e8e93;
609
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
610
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
611
+ line-height: 1.4;
612
+ overflow: hidden;
613
+ `;
614
+ var FileSubtitle = styled4__default.default.span`
615
+ color: #8e8e93;
616
+ white-space: nowrap;
617
+ overflow: hidden;
618
+ text-overflow: ellipsis;
619
+
620
+ &:last-child {
621
+ flex-shrink: 0;
622
+ }
623
+ `;
624
+ var FileAttachment = ({
625
+ title,
626
+ subtitle,
627
+ size,
628
+ icon = "\u{1F4C4}",
629
+ onClick,
630
+ onPress,
631
+ className,
632
+ ...ariaProps
633
+ }) => {
634
+ const ref = react.useRef(null);
635
+ const isInteractive = !!(onClick || onPress);
636
+ const handlePress = (e) => {
637
+ if (onClick) onClick();
638
+ if (onPress) onPress(e);
639
+ };
640
+ const { buttonProps } = button.useButton(
641
+ {
642
+ ...ariaProps,
643
+ onPress: isInteractive ? handlePress : void 0,
644
+ isDisabled: !isInteractive
645
+ },
646
+ ref
647
+ );
648
+ return /* @__PURE__ */ jsxRuntime.jsxs(
649
+ FileAttachmentContainer,
650
+ {
651
+ ...isInteractive ? buttonProps : {},
652
+ ref: isInteractive ? ref : void 0,
653
+ className,
654
+ $isInteractive: isInteractive,
655
+ as: isInteractive ? "button" : "div",
656
+ children: [
657
+ /* @__PURE__ */ jsxRuntime.jsx(FileIconContainer, { children: icon }),
658
+ /* @__PURE__ */ jsxRuntime.jsxs(FileInfo, { children: [
659
+ /* @__PURE__ */ jsxRuntime.jsx(FileTitle, { children: title }),
660
+ /* @__PURE__ */ jsxRuntime.jsxs(FileMetadata, { children: [
661
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx(FileSubtitle, { children: subtitle }),
662
+ size && subtitle && /* @__PURE__ */ jsxRuntime.jsx(FileSubtitle, { "aria-hidden": "true", children: " \u2022 " }),
663
+ size && /* @__PURE__ */ jsxRuntime.jsx(FileSubtitle, { children: size })
664
+ ] })
665
+ ] })
666
+ ]
667
+ }
668
+ );
669
+ };
670
+ var AttachmentsContainer = styled4__default.default.div`
671
+ display: flex;
672
+ flex-direction: column;
673
+ gap: 8px;
674
+ margin-top: 12px;
675
+ `;
676
+ var AssistantMessage = ({
677
+ content = "",
678
+ avatarUrl,
679
+ avatarInitials: _avatarInitials = "AI",
680
+ isLoading = false,
681
+ className,
682
+ attachments = [],
683
+ enableMarkdown: _enableMarkdown = false
684
+ }) => {
685
+ const renderContent = () => {
686
+ if (isLoading) {
687
+ return /* @__PURE__ */ jsxRuntime.jsxs(LoadingDots2, { children: [
688
+ /* @__PURE__ */ jsxRuntime.jsx(LoadingDot, { delay: 0 }),
689
+ /* @__PURE__ */ jsxRuntime.jsx(LoadingDot, { delay: 0.2 }),
690
+ /* @__PURE__ */ jsxRuntime.jsx(LoadingDot, { delay: 0.4 })
691
+ ] });
692
+ }
693
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
694
+ content && /* @__PURE__ */ jsxRuntime.jsx(MessageContent, { children: content }),
695
+ attachments.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(AttachmentsContainer, { children: attachments.map((attachment, index) => /* @__PURE__ */ jsxRuntime.jsx(FileAttachment, { ...attachment }, `${attachment.title}-${index}`)) })
696
+ ] });
697
+ };
698
+ return /* @__PURE__ */ jsxRuntime.jsxs(MessageContainer, { className, children: [
699
+ /* @__PURE__ */ jsxRuntime.jsx(AvatarContainer, { children: avatarUrl ? /* @__PURE__ */ jsxRuntime.jsx(Avatar, { src: avatarUrl, alt: "Assistant avatar" }) : /* @__PURE__ */ jsxRuntime.jsx(AvatarInitials, { children: /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsxRuntime.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" }) }) }) }),
700
+ /* @__PURE__ */ jsxRuntime.jsx(ContentContainer, { children: renderContent() })
701
+ ] });
702
+ };
703
+ var dotPulse3 = styled4.keyframes`
704
+ 0%, 100% {
705
+ opacity: 0.3;
706
+ transform: scale(0.8);
707
+ }
708
+ 50% {
709
+ opacity: 1;
710
+ transform: scale(1);
711
+ }
712
+ `;
713
+ var Container = styled4__default.default.div`
714
+ display: inline-flex;
715
+ align-items: center;
716
+ gap: 12px;
717
+ padding: 12px 16px;
718
+ background-color: #2c2c2e;
719
+ border-radius: 16px;
720
+ box-shadow: none;
721
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
722
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
723
+ max-width: fit-content;
724
+ margin: 0 auto;
725
+ `;
726
+ var Avatar2 = styled4__default.default.div`
727
+ width: 40px;
728
+ height: 40px;
729
+ border-radius: 50%;
730
+ background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
731
+ display: flex;
732
+ align-items: center;
733
+ justify-content: center;
734
+ flex-shrink: 0;
735
+ box-shadow: 0 2px 8px rgba(139, 92, 246, 0.3);
736
+ `;
737
+ var HeadphonesIcon = styled4__default.default.svg`
738
+ width: 20px;
739
+ height: 20px;
740
+ color: #FFFFFF;
741
+ `;
742
+ var Content = styled4__default.default.div`
743
+ display: flex;
744
+ align-items: center;
745
+ gap: 8px;
746
+ `;
747
+ var LoadingDots3 = styled4__default.default.div`
748
+ display: flex;
749
+ align-items: center;
750
+ gap: 4px;
751
+ padding: 0 4px;
752
+ `;
753
+ var Dot2 = styled4__default.default.span`
754
+ width: 6px;
755
+ height: 6px;
756
+ border-radius: 50%;
757
+ background-color: #8e8e93;
758
+ animation: ${dotPulse3} 1.4s ease-in-out infinite;
759
+ `;
760
+ var Message2 = styled4__default.default.span`
761
+ font-size: 14px;
762
+ color: #e5e5e7;
763
+ font-weight: 400;
764
+ line-height: 1.5;
765
+ white-space: nowrap;
766
+ `;
767
+ function AssistantThinking({
768
+ message = "Analyzing data, please wait...",
769
+ className,
770
+ ariaLabel = "Assistant is thinking"
771
+ }) {
772
+ const containerRef = react.useRef(null);
773
+ return /* @__PURE__ */ jsxRuntime.jsxs(
774
+ Container,
775
+ {
776
+ ref: containerRef,
777
+ className,
778
+ role: "status",
779
+ "aria-live": "polite",
780
+ "aria-label": ariaLabel,
781
+ children: [
782
+ /* @__PURE__ */ jsxRuntime.jsx(Avatar2, { "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(HeadphonesIcon, { viewBox: "0 0 24 24", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntime.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" }) }) }),
783
+ /* @__PURE__ */ jsxRuntime.jsxs(Content, { children: [
784
+ /* @__PURE__ */ jsxRuntime.jsxs(LoadingDots3, { "aria-hidden": "true", children: [
785
+ /* @__PURE__ */ jsxRuntime.jsx(Dot2, { style: { animationDelay: "0ms" } }),
786
+ /* @__PURE__ */ jsxRuntime.jsx(Dot2, { style: { animationDelay: "150ms" } }),
787
+ /* @__PURE__ */ jsxRuntime.jsx(Dot2, { style: { animationDelay: "300ms" } })
788
+ ] }),
789
+ /* @__PURE__ */ jsxRuntime.jsx(Message2, { children: message })
790
+ ] })
791
+ ]
792
+ }
793
+ );
794
+ }
795
+ AssistantThinking.displayName = "AssistantThinking";
13
796
  var AssistantMessageAdapter = ({
14
797
  message,
15
798
  isLoading,
@@ -24,15 +807,15 @@ var AssistantMessageAdapter = ({
24
807
  // ImageRenderer,
25
808
  }) => {
26
809
  if (isLoading) {
27
- return /* @__PURE__ */ jsxRuntime.jsx(chunkOPWUJP7J_cjs.AssistantThinking, { message: "Thinking..." });
810
+ return /* @__PURE__ */ jsxRuntime.jsx(AssistantThinking, { message: "Thinking..." });
28
811
  }
29
812
  if (isGenerating && !message?.content) {
30
- return /* @__PURE__ */ jsxRuntime.jsx(chunkOPWUJP7J_cjs.AssistantThinking, { message: "Generating response..." });
813
+ return /* @__PURE__ */ jsxRuntime.jsx(AssistantThinking, { message: "Generating response..." });
31
814
  }
32
815
  const content = message?.content || "";
33
816
  const attachments = [];
34
817
  return /* @__PURE__ */ jsxRuntime.jsx(
35
- chunkOPWUJP7J_cjs.AssistantMessage,
818
+ AssistantMessage,
36
819
  {
37
820
  content,
38
821
  avatarInitials: "AI",
@@ -42,30 +825,464 @@ var AssistantMessageAdapter = ({
42
825
  }
43
826
  );
44
827
  };
45
- AssistantMessageAdapter.displayName = "AssistantMessageAdapter";
46
- var UserMessageWrapper = styled__default.default.div`
47
- display: flex;
48
- justify-content: flex-end;
49
- width: 100%;
50
- padding: 8px 0;
51
- `;
52
- var UserMessageAdapter = ({
53
- message,
54
- ImageRenderer
828
+ AssistantMessageAdapter.displayName = "AssistantMessageAdapter";
829
+ var StyledUserMessage = styled4__default.default.button`
830
+ /* Base styles */
831
+ display: inline-flex;
832
+ align-items: center;
833
+ justify-content: center;
834
+ padding: 12px 20px;
835
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
836
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
837
+ font-size: 14px;
838
+ font-weight: 400;
839
+ line-height: 1.4;
840
+ color: #ffffff;
841
+ border: none;
842
+ cursor: default;
843
+ user-select: none;
844
+ white-space: pre-wrap;
845
+ word-wrap: break-word;
846
+ position: relative;
847
+ text-align: left;
848
+
849
+ /* Pill shape - fully rounded ends */
850
+ border-radius: 999px;
851
+
852
+ /* Purple to blue gradient (left to right) */
853
+ background: linear-gradient(90deg, #8B5CF6 0%, #5B8DEF 100%);
854
+
855
+ /* Subtle shadow and glow effect */
856
+ box-shadow:
857
+ 0 2px 8px rgba(91, 141, 239, 0.25),
858
+ 0 1px 3px rgba(139, 92, 246, 0.15);
859
+
860
+ /* Smooth transitions */
861
+ transition: all 0.2s ease-in-out;
862
+
863
+ /* Speech bubble tail */
864
+ &::after {
865
+ content: '';
866
+ position: absolute;
867
+ bottom: -4px;
868
+ right: -6px;
869
+ width: 18px;
870
+ height: 18px;
871
+ background: #5B8DEF;
872
+ transform: rotate(45deg);
873
+ border-radius: 0 0 16px 0;
874
+ box-shadow:
875
+ 2px 2px 4px rgba(91, 141, 239, 0.15);
876
+ transition: all 0.2s ease-in-out;
877
+ }
878
+
879
+ /* Hover state - only for button elements */
880
+ &[role="button"]:hover:not(:disabled) {
881
+ transform: translateY(-1px);
882
+ cursor: pointer;
883
+ box-shadow:
884
+ 0 4px 12px rgba(91, 141, 239, 0.35),
885
+ 0 2px 6px rgba(139, 92, 246, 0.25);
886
+
887
+ &::after {
888
+ box-shadow:
889
+ 3px 3px 6px rgba(91, 141, 239, 0.2);
890
+ }
891
+ }
892
+
893
+ /* Active/Pressed state - only for button elements */
894
+ &[role="button"]:active:not(:disabled) {
895
+ transform: translateY(0);
896
+ box-shadow:
897
+ 0 1px 4px rgba(91, 141, 239, 0.2),
898
+ 0 1px 2px rgba(139, 92, 246, 0.1);
899
+
900
+ &::after {
901
+ box-shadow:
902
+ 1px 1px 2px rgba(91, 141, 239, 0.1);
903
+ }
904
+ }
905
+
906
+ ${({ $isPressed }) => $isPressed && styled4.css`
907
+ transform: translateY(0) scale(0.98);
908
+ box-shadow:
909
+ 0 1px 4px rgba(91, 141, 239, 0.2),
910
+ 0 1px 2px rgba(139, 92, 246, 0.1);
911
+
912
+ &::after {
913
+ box-shadow:
914
+ 1px 1px 2px rgba(91, 141, 239, 0.1);
915
+ }
916
+ `}
917
+
918
+ /* Focus state for accessibility */
919
+ &:focus {
920
+ outline: none;
921
+ }
922
+
923
+ &:focus-visible {
924
+ outline: 2px solid #5B8DEF;
925
+ outline-offset: 3px;
926
+ box-shadow:
927
+ 0 4px 12px rgba(91, 141, 239, 0.35),
928
+ 0 2px 6px rgba(139, 92, 246, 0.25),
929
+ 0 0 0 3px rgba(91, 141, 239, 0.1);
930
+ }
931
+
932
+ /* Disabled state */
933
+ &:disabled {
934
+ cursor: not-allowed;
935
+ opacity: 0.5;
936
+ transform: none;
937
+ box-shadow: none;
938
+
939
+ &::after {
940
+ opacity: 0.5;
941
+ box-shadow: none;
942
+ }
943
+ }
944
+ `;
945
+ function UserMessage({
946
+ children,
947
+ className,
948
+ isPressed = false,
949
+ onPress,
950
+ ...ariaProps
951
+ }) {
952
+ const ref = react.useRef(null);
953
+ if (!onPress) {
954
+ return /* @__PURE__ */ jsxRuntime.jsx(
955
+ StyledUserMessage,
956
+ {
957
+ as: "div",
958
+ className,
959
+ $isPressed: isPressed,
960
+ role: "presentation",
961
+ children
962
+ }
963
+ );
964
+ }
965
+ const { buttonProps, isPressed: ariaPressedState } = button.useButton(
966
+ {
967
+ ...ariaProps,
968
+ onPress
969
+ },
970
+ ref
971
+ );
972
+ return /* @__PURE__ */ jsxRuntime.jsx(
973
+ StyledUserMessage,
974
+ {
975
+ ...buttonProps,
976
+ ref,
977
+ className,
978
+ $isPressed: isPressed || ariaPressedState,
979
+ role: "button",
980
+ tabIndex: 0,
981
+ children
982
+ }
983
+ );
984
+ }
985
+ UserMessage.displayName = "UserMessage";
986
+ var UserMessageWrapper = styled4__default.default.div`
987
+ display: flex;
988
+ justify-content: flex-end;
989
+ width: 100%;
990
+ padding: 8px 0;
991
+ `;
992
+ var UserMessageAdapter = ({
993
+ message,
994
+ ImageRenderer
995
+ }) => {
996
+ if (message?.image) {
997
+ return /* @__PURE__ */ jsxRuntime.jsx(
998
+ ImageRenderer,
999
+ {
1000
+ image: message.image,
1001
+ content: message.content
1002
+ }
1003
+ );
1004
+ }
1005
+ const content = message?.content || "";
1006
+ return /* @__PURE__ */ jsxRuntime.jsx(UserMessageWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(UserMessage, { children: content }) });
1007
+ };
1008
+ UserMessageAdapter.displayName = "UserMessageAdapter";
1009
+ var ChatInputContainer = styled4__default.default.div`
1010
+ display: flex;
1011
+ flex-direction: column;
1012
+ width: 100%;
1013
+ padding: 8px;
1014
+ background: transparent;
1015
+ border-radius: 0;
1016
+ box-shadow: none;
1017
+ box-sizing: border-box;
1018
+
1019
+ @media (min-width: 640px) {
1020
+ padding: 12px;
1021
+ }
1022
+ `;
1023
+ var SuggestionsWrapper = styled4__default.default.div`
1024
+ display: flex;
1025
+ flex-direction: row;
1026
+ flex-wrap: wrap;
1027
+ gap: 8px;
1028
+ margin-bottom: 12px;
1029
+ width: 100%;
1030
+ box-sizing: border-box;
1031
+ `;
1032
+ var SuggestionButton = styled4__default.default.button`
1033
+ padding: 8px 16px;
1034
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
1035
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
1036
+ font-size: 13px;
1037
+ font-weight: 400;
1038
+ text-align: center;
1039
+ border: 1px solid #3a3a3c;
1040
+ border-radius: 20px;
1041
+ cursor: pointer;
1042
+ transition: all 0.15s ease;
1043
+ white-space: nowrap;
1044
+
1045
+ /* Dark theme colors */
1046
+ background-color: #2c2c2e;
1047
+ color: #e5e5e7;
1048
+
1049
+ /* Hover state */
1050
+ &:hover:not(:disabled) {
1051
+ background-color: #3a3a3c;
1052
+ border-color: #48484a;
1053
+ }
1054
+
1055
+ /* Active state */
1056
+ &:active:not(:disabled) {
1057
+ background-color: #48484a;
1058
+ }
1059
+
1060
+ /* Focus state */
1061
+ &:focus-visible {
1062
+ outline: 2px solid #5B9FFF;
1063
+ outline-offset: 2px;
1064
+ }
1065
+
1066
+ /* Disabled state */
1067
+ &:disabled {
1068
+ cursor: not-allowed;
1069
+ opacity: 0.4;
1070
+ }
1071
+ `;
1072
+ var InputWrapper = styled4__default.default.div`
1073
+ display: flex;
1074
+ align-items: center;
1075
+ gap: 10px;
1076
+ padding: 10px 14px;
1077
+ background-color: #2c2c2e;
1078
+ border: 1px solid #3a3a3c;
1079
+ border-radius: 12px;
1080
+ transition: all 0.2s ease;
1081
+ width: 100%;
1082
+ box-sizing: border-box;
1083
+
1084
+ &:focus-within {
1085
+ border-color: #5B9FFF;
1086
+ background-color: #323234;
1087
+ }
1088
+ `;
1089
+ var InputField = styled4__default.default.input`
1090
+ flex: 1;
1091
+ border: none;
1092
+ outline: none;
1093
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
1094
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
1095
+ font-size: 14px;
1096
+ color: #e5e5e7;
1097
+ background: transparent;
1098
+
1099
+ &::placeholder {
1100
+ color: #6e6e73;
1101
+ }
1102
+
1103
+ &:disabled {
1104
+ color: #6e6e73;
1105
+ cursor: not-allowed;
1106
+ }
1107
+ `;
1108
+ var SubmitButton = styled4__default.default.button`
1109
+ display: flex;
1110
+ align-items: center;
1111
+ justify-content: center;
1112
+ width: 32px;
1113
+ height: 32px;
1114
+ padding: 0;
1115
+ border: none;
1116
+ border-radius: 50%;
1117
+ background-color: ${(props) => props.disabled ? "#3a3a3c" : "#5B9FFF"};
1118
+ color: ${(props) => props.disabled ? "#6e6e73" : "#ffffff"};
1119
+ cursor: ${(props) => props.disabled ? "not-allowed" : "pointer"};
1120
+ transition: all 0.2s ease;
1121
+ flex-shrink: 0;
1122
+
1123
+ &:hover:not(:disabled) {
1124
+ background-color: #4A8FEF;
1125
+ transform: scale(1.05);
1126
+ }
1127
+
1128
+ &:active:not(:disabled) {
1129
+ transform: scale(0.98);
1130
+ }
1131
+
1132
+ &:focus-visible {
1133
+ outline: 2px solid #5B9FFF;
1134
+ outline-offset: 2px;
1135
+ }
1136
+
1137
+ svg {
1138
+ width: 18px;
1139
+ height: 18px;
1140
+ }
1141
+ `;
1142
+ var ChatInput = ({
1143
+ suggestions = [],
1144
+ onSuggestionSelect,
1145
+ value = "",
1146
+ onChange,
1147
+ onSubmit,
1148
+ placeholder = "Ask, write or search for anything...",
1149
+ isDisabled = false,
1150
+ isReadOnly = false,
1151
+ autoFocus = false,
1152
+ className,
1153
+ "aria-label": ariaLabel = "Chat message input",
1154
+ ...ariaProps
1155
+ }) => {
1156
+ const [internalValue, setInternalValue] = react.useState(value);
1157
+ const inputRef = react.useRef(null);
1158
+ const currentValue = value !== void 0 ? value : internalValue;
1159
+ const setValue = onChange || setInternalValue;
1160
+ const { inputProps } = textfield.useTextField(
1161
+ {
1162
+ ...ariaProps,
1163
+ "aria-label": ariaLabel,
1164
+ value: currentValue,
1165
+ onChange: (newValue) => {
1166
+ setValue(newValue);
1167
+ },
1168
+ isDisabled,
1169
+ isReadOnly
1170
+ },
1171
+ inputRef
1172
+ );
1173
+ const handleKeyDown = (e) => {
1174
+ if (e.key === "Enter") {
1175
+ e.preventDefault();
1176
+ handleSubmit();
1177
+ }
1178
+ };
1179
+ const handleSubmit = () => {
1180
+ if (currentValue.trim() && onSubmit && !isDisabled && !isReadOnly) {
1181
+ onSubmit(currentValue.trim());
1182
+ setValue("");
1183
+ inputRef.current?.focus();
1184
+ }
1185
+ };
1186
+ const handleSuggestionClick = (suggestionText) => {
1187
+ if (onSuggestionSelect && !isDisabled && !isReadOnly) {
1188
+ onSuggestionSelect(suggestionText);
1189
+ setValue(suggestionText);
1190
+ inputRef.current?.focus();
1191
+ }
1192
+ };
1193
+ const canSubmit = currentValue.trim().length > 0 && !isDisabled && !isReadOnly;
1194
+ return /* @__PURE__ */ jsxRuntime.jsxs(ChatInputContainer, { className, children: [
1195
+ suggestions.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(SuggestionsWrapper, { role: "list", "aria-label": "Suggested prompts", children: suggestions.map((suggestion, index) => /* @__PURE__ */ jsxRuntime.jsx(
1196
+ SuggestionButtonComponent,
1197
+ {
1198
+ suggestion,
1199
+ onSelect: handleSuggestionClick,
1200
+ isDisabled: isDisabled || isReadOnly
1201
+ },
1202
+ `${suggestion.text}-${index}`
1203
+ )) }),
1204
+ /* @__PURE__ */ jsxRuntime.jsxs(InputWrapper, { children: [
1205
+ /* @__PURE__ */ jsxRuntime.jsx(
1206
+ InputField,
1207
+ {
1208
+ ...inputProps,
1209
+ ref: inputRef,
1210
+ type: "text",
1211
+ placeholder,
1212
+ onKeyDown: handleKeyDown,
1213
+ autoFocus,
1214
+ disabled: isDisabled,
1215
+ readOnly: isReadOnly
1216
+ }
1217
+ ),
1218
+ /* @__PURE__ */ jsxRuntime.jsx(
1219
+ SubmitButtonComponent,
1220
+ {
1221
+ onPress: handleSubmit,
1222
+ isDisabled: !canSubmit,
1223
+ ariaLabel: "Send message"
1224
+ }
1225
+ )
1226
+ ] })
1227
+ ] });
1228
+ };
1229
+ var SuggestionButtonComponent = ({
1230
+ suggestion,
1231
+ onSelect,
1232
+ isDisabled = false
1233
+ }) => {
1234
+ const ref = react.useRef(null);
1235
+ const { buttonProps } = button.useButton(
1236
+ {
1237
+ onPress: () => onSelect(suggestion.text),
1238
+ isDisabled,
1239
+ "aria-label": `Select suggestion: ${suggestion.text}`
1240
+ },
1241
+ ref
1242
+ );
1243
+ return /* @__PURE__ */ jsxRuntime.jsx(SuggestionButton, { ...buttonProps, ref, role: "listitem", children: suggestion.text });
1244
+ };
1245
+ var SubmitButtonComponent = ({
1246
+ onPress,
1247
+ isDisabled = false,
1248
+ ariaLabel = "Send message"
55
1249
  }) => {
56
- if (message?.image) {
57
- return /* @__PURE__ */ jsxRuntime.jsx(
58
- ImageRenderer,
59
- {
60
- image: message.image,
61
- content: message.content
62
- }
63
- );
64
- }
65
- const content = message?.content || "";
66
- return /* @__PURE__ */ jsxRuntime.jsx(UserMessageWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(chunkOPWUJP7J_cjs.UserMessage, { children: content }) });
1250
+ const ref = react.useRef(null);
1251
+ const { buttonProps } = button.useButton(
1252
+ {
1253
+ onPress,
1254
+ isDisabled,
1255
+ "aria-label": ariaLabel
1256
+ },
1257
+ ref
1258
+ );
1259
+ return /* @__PURE__ */ jsxRuntime.jsx(SubmitButton, { ...buttonProps, ref, disabled: isDisabled, title: ariaLabel, children: /* @__PURE__ */ jsxRuntime.jsxs(
1260
+ "svg",
1261
+ {
1262
+ width: "20",
1263
+ height: "20",
1264
+ viewBox: "0 0 20 20",
1265
+ fill: "none",
1266
+ xmlns: "http://www.w3.org/2000/svg",
1267
+ role: "img",
1268
+ "aria-hidden": "true",
1269
+ children: [
1270
+ /* @__PURE__ */ jsxRuntime.jsx("title", { children: "Arrow Right Icon" }),
1271
+ /* @__PURE__ */ jsxRuntime.jsx(
1272
+ "path",
1273
+ {
1274
+ d: "M4 10H16M16 10L10 4M16 10L10 16",
1275
+ stroke: "currentColor",
1276
+ strokeWidth: "2",
1277
+ strokeLinecap: "round",
1278
+ strokeLinejoin: "round"
1279
+ }
1280
+ )
1281
+ ]
1282
+ }
1283
+ ) });
67
1284
  };
68
- UserMessageAdapter.displayName = "UserMessageAdapter";
1285
+ ChatInput.displayName = "ChatInput";
69
1286
  var InputAdapter = ({
70
1287
  inProgress,
71
1288
  onSend,
@@ -78,7 +1295,7 @@ var InputAdapter = ({
78
1295
  setValue("");
79
1296
  };
80
1297
  return /* @__PURE__ */ jsxRuntime.jsx(
81
- chunkOPWUJP7J_cjs.ChatInput,
1298
+ ChatInput,
82
1299
  {
83
1300
  value,
84
1301
  onChange: setValue,
@@ -100,7 +1317,278 @@ var InputAdapter = ({
100
1317
  );
101
1318
  };
102
1319
  InputAdapter.displayName = "InputAdapter";
103
- var GlobalSidebarStyles = styled.createGlobalStyle`
1320
+ var HeaderContainer = styled4__default.default.header`
1321
+ display: flex;
1322
+ align-items: center;
1323
+ justify-content: space-between;
1324
+ padding: 8px;
1325
+ background-color: #2c2c2e;
1326
+ border-bottom: 1px solid #3a3a3c;
1327
+ min-height: 60px;
1328
+ box-sizing: border-box;
1329
+
1330
+ @media (min-width: 640px) {
1331
+ padding: 12px;
1332
+ }
1333
+ `;
1334
+ var HeaderContent = styled4__default.default.div`
1335
+ display: flex;
1336
+ flex-direction: column;
1337
+ gap: ${({ theme }) => theme?.spacing?.xs ?? "4px"};
1338
+ flex: 1;
1339
+ min-width: 0;
1340
+ `;
1341
+ var HeaderTitle = styled4__default.default.h1`
1342
+ margin: 0;
1343
+ font-size: 1rem;
1344
+ font-weight: 600;
1345
+ color: #e5e5e7;
1346
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
1347
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
1348
+ line-height: 1.5;
1349
+ overflow: hidden;
1350
+ text-overflow: ellipsis;
1351
+ white-space: nowrap;
1352
+ `;
1353
+ var HeaderSubtitle = styled4__default.default.p`
1354
+ margin: 0;
1355
+ font-size: 0.875rem;
1356
+ color: #8e8e93;
1357
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
1358
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
1359
+ line-height: 1.4;
1360
+ overflow: hidden;
1361
+ text-overflow: ellipsis;
1362
+ white-space: nowrap;
1363
+ `;
1364
+ var HeaderActions = styled4__default.default.div`
1365
+ display: flex;
1366
+ align-items: center;
1367
+ gap: ${({ theme }) => theme?.spacing?.xs ?? "4px"};
1368
+ margin-left: ${({ theme }) => theme?.spacing?.md ?? "16px"};
1369
+ `;
1370
+ var ActionButton = styled4__default.default.button`
1371
+ display: inline-flex;
1372
+ align-items: center;
1373
+ justify-content: center;
1374
+ width: 32px;
1375
+ height: 32px;
1376
+ padding: 0;
1377
+ background-color: transparent;
1378
+ border: none;
1379
+ border-radius: 6px;
1380
+ color: #e5e5e7;
1381
+ cursor: pointer;
1382
+ transition: all 150ms ease;
1383
+
1384
+ &:hover:not(:disabled) {
1385
+ background-color: #3a3a3c;
1386
+ }
1387
+
1388
+ &:active:not(:disabled) {
1389
+ transform: scale(0.95);
1390
+ background-color: #48484a;
1391
+ }
1392
+
1393
+ &:focus-visible {
1394
+ outline: 2px solid #5B9FFF;
1395
+ outline-offset: 2px;
1396
+ }
1397
+
1398
+ &:disabled {
1399
+ cursor: not-allowed;
1400
+ opacity: 0.3;
1401
+ }
1402
+
1403
+ svg {
1404
+ width: 16px;
1405
+ height: 16px;
1406
+ display: block;
1407
+ }
1408
+ `;
1409
+ var Header = ({
1410
+ title,
1411
+ subtitle,
1412
+ onClose,
1413
+ onMinimize,
1414
+ className
1415
+ }) => {
1416
+ const minimizeRef = react.useRef(null);
1417
+ const closeRef = react.useRef(null);
1418
+ const { buttonProps: minimizeProps } = button.useButton(
1419
+ {
1420
+ onPress: onMinimize,
1421
+ "aria-label": "Minimize",
1422
+ isDisabled: !onMinimize
1423
+ },
1424
+ minimizeRef
1425
+ );
1426
+ const { buttonProps: closeProps } = button.useButton(
1427
+ {
1428
+ onPress: onClose,
1429
+ "aria-label": "Close",
1430
+ isDisabled: !onClose
1431
+ },
1432
+ closeRef
1433
+ );
1434
+ return /* @__PURE__ */ jsxRuntime.jsxs(HeaderContainer, { className, children: [
1435
+ /* @__PURE__ */ jsxRuntime.jsxs(HeaderContent, { children: [
1436
+ /* @__PURE__ */ jsxRuntime.jsx(HeaderTitle, { children: title }),
1437
+ subtitle && /* @__PURE__ */ jsxRuntime.jsx(HeaderSubtitle, { children: subtitle })
1438
+ ] }),
1439
+ /* @__PURE__ */ jsxRuntime.jsxs(HeaderActions, { children: [
1440
+ onMinimize && /* @__PURE__ */ jsxRuntime.jsx(ActionButton, { ref: minimizeRef, ...minimizeProps, "data-action": "minimize", children: /* @__PURE__ */ jsxRuntime.jsxs(
1441
+ "svg",
1442
+ {
1443
+ width: "16",
1444
+ height: "16",
1445
+ viewBox: "0 0 16 16",
1446
+ fill: "none",
1447
+ xmlns: "http://www.w3.org/2000/svg",
1448
+ "aria-hidden": "true",
1449
+ children: [
1450
+ /* @__PURE__ */ jsxRuntime.jsx("title", { children: "Minimize" }),
1451
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "3", y1: "8", x2: "13", y2: "8", stroke: "currentColor", strokeWidth: "2" })
1452
+ ]
1453
+ }
1454
+ ) }),
1455
+ onClose && /* @__PURE__ */ jsxRuntime.jsx(ActionButton, { ref: closeRef, ...closeProps, "data-action": "close", children: /* @__PURE__ */ jsxRuntime.jsxs(
1456
+ "svg",
1457
+ {
1458
+ width: "16",
1459
+ height: "16",
1460
+ viewBox: "0 0 16 16",
1461
+ fill: "none",
1462
+ xmlns: "http://www.w3.org/2000/svg",
1463
+ "aria-hidden": "true",
1464
+ children: [
1465
+ /* @__PURE__ */ jsxRuntime.jsx("title", { children: "Close" }),
1466
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "4", y1: "4", x2: "12", y2: "12", stroke: "currentColor", strokeWidth: "2" }),
1467
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "12", y1: "4", x2: "4", y2: "12", stroke: "currentColor", strokeWidth: "2" })
1468
+ ]
1469
+ }
1470
+ ) })
1471
+ ] })
1472
+ ] });
1473
+ };
1474
+ Header.displayName = "Header";
1475
+ var MessagesContainer = styled4__default.default.div`
1476
+ display: flex;
1477
+ flex-direction: column;
1478
+ flex: 1;
1479
+ overflow: hidden;
1480
+ background-color: #1c1c1e;
1481
+ padding: 8px;
1482
+ gap: 12px;
1483
+ box-sizing: border-box;
1484
+
1485
+ /* Ensure proper scrolling behavior for child components */
1486
+ position: relative;
1487
+ min-height: 0;
1488
+
1489
+ /* Desktop padding */
1490
+ @media (min-width: 640px) {
1491
+ padding: 12px;
1492
+ }
1493
+ `;
1494
+ var Messages = ({
1495
+ children,
1496
+ className,
1497
+ ariaLabel = "Messages"
1498
+ }) => {
1499
+ return /* @__PURE__ */ jsxRuntime.jsx(MessagesContainer, { className, role: "region", "aria-label": ariaLabel, children });
1500
+ };
1501
+ Messages.displayName = "Messages";
1502
+ var WindowContainer = styled4__default.default.div`
1503
+ display: flex;
1504
+ flex-direction: column;
1505
+ background-color: #1c1c1e;
1506
+ border-radius: 0;
1507
+ box-shadow: none;
1508
+ overflow: hidden;
1509
+ transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
1510
+ position: relative;
1511
+
1512
+ /* Default dimensions */
1513
+ width: ${({ $width }) => $width};
1514
+ height: ${({ $height }) => $height};
1515
+
1516
+ /* Fullscreen state */
1517
+ ${({ $isFullscreen }) => $isFullscreen && styled4.css`
1518
+ width: 100vw;
1519
+ height: 100vh;
1520
+ border-radius: 0;
1521
+ box-shadow: none;
1522
+ position: fixed;
1523
+ top: 0;
1524
+ left: 0;
1525
+ z-index: 1000;
1526
+ `}
1527
+
1528
+ /* Minimized state */
1529
+ ${({ $isMinimized }) => $isMinimized && styled4.css`
1530
+ height: 60px;
1531
+ width: 300px;
1532
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
1533
+ cursor: pointer;
1534
+
1535
+ /* Hide all content except header when minimized */
1536
+ > *:not(:first-child) {
1537
+ display: none;
1538
+ }
1539
+
1540
+ /* Keep header visible but adjust styling */
1541
+ > *:first-child {
1542
+ border-bottom: none;
1543
+ }
1544
+ `}
1545
+
1546
+ /* Responsive behavior for smaller screens */
1547
+ @media (max-width: 768px) {
1548
+ ${({ $isFullscreen, $isMinimized }) => !$isFullscreen && !$isMinimized && styled4.css`
1549
+ width: 100vw;
1550
+ height: 100vh;
1551
+ border-radius: 0;
1552
+ max-width: 100%;
1553
+ max-height: 100%;
1554
+ `}
1555
+ }
1556
+
1557
+ /* Focus states for accessibility */
1558
+ &:focus-visible {
1559
+ outline: 2px solid ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
1560
+ outline-offset: 2px;
1561
+ }
1562
+
1563
+ /* Ensure proper stacking context */
1564
+ z-index: ${({ $isFullscreen }) => $isFullscreen ? 1e3 : 100};
1565
+ `;
1566
+ var Window = ({
1567
+ isMinimized = false,
1568
+ isFullscreen = false,
1569
+ width = "400px",
1570
+ height = "600px",
1571
+ children,
1572
+ className,
1573
+ ariaLabel = "Chat window"
1574
+ }) => {
1575
+ return /* @__PURE__ */ jsxRuntime.jsx(
1576
+ WindowContainer,
1577
+ {
1578
+ className,
1579
+ $isMinimized: isMinimized,
1580
+ $isFullscreen: isFullscreen,
1581
+ $width: width,
1582
+ $height: height,
1583
+ role: "dialog",
1584
+ "aria-label": ariaLabel,
1585
+ "aria-modal": "false",
1586
+ children
1587
+ }
1588
+ );
1589
+ };
1590
+ Window.displayName = "Window";
1591
+ var GlobalSidebarStyles = styled4.createGlobalStyle`
104
1592
  /* Override CopilotKit's default positioning - start off-screen */
105
1593
  .copilotKitSidebar {
106
1594
  position: fixed !important;
@@ -181,7 +1669,7 @@ var GlobalSidebarStyles = styled.createGlobalStyle`
181
1669
  }
182
1670
  }
183
1671
  `;
184
- var StyledChatButton = styled__default.default.button`
1672
+ var StyledChatButton = styled4__default.default.button`
185
1673
  position: fixed;
186
1674
  bottom: 8px;
187
1675
  right: 8px;
@@ -226,13 +1714,13 @@ function CustomCopilotSidebar({
226
1714
  setOpen(false);
227
1715
  onSetOpen?.(false);
228
1716
  };
229
- return /* @__PURE__ */ jsxRuntime.jsx(chunkOPWUJP7J_cjs.Header, { title: "AI Assistant", subtitle: "How can I help you today?", onClose: handleClose });
1717
+ return /* @__PURE__ */ jsxRuntime.jsx(Header, { title: "AI Assistant", subtitle: "How can I help you today?", onClose: handleClose });
230
1718
  };
231
1719
  const WindowAdapterLocal = (props) => {
232
- return /* @__PURE__ */ jsxRuntime.jsx(chunkOPWUJP7J_cjs.Window, { children: props.children });
1720
+ return /* @__PURE__ */ jsxRuntime.jsx(Window, { children: props.children });
233
1721
  };
234
1722
  const MessagesAdapter = (props) => {
235
- return /* @__PURE__ */ jsxRuntime.jsx(chunkOPWUJP7J_cjs.Messages, { children: props.messages.map((message, index) => /* @__PURE__ */ jsxRuntime.jsx(
1723
+ return /* @__PURE__ */ jsxRuntime.jsx(Messages, { children: props.messages.map((message, index) => /* @__PURE__ */ jsxRuntime.jsx(
236
1724
  props.RenderMessage,
237
1725
  {
238
1726
  message,
@@ -303,7 +1791,602 @@ function CustomCopilotSidebar({
303
1791
  ] });
304
1792
  }
305
1793
  CustomCopilotSidebar.displayName = "CustomCopilotSidebar";
306
- var GlobalSidebarStyles2 = styled.createGlobalStyle`
1794
+ var FooterContainer = styled4__default.default.footer`
1795
+ display: flex;
1796
+ align-items: center;
1797
+ justify-content: center;
1798
+ padding: ${({ theme }) => theme?.spacing?.sm ?? "8px"} ${({ theme }) => theme?.spacing?.md ?? "16px"};
1799
+ background-color: ${({ theme }) => theme?.colors?.surface ?? "#ffffff"};
1800
+ border-top: 1px solid ${({ theme }) => theme?.colors?.border ?? "#E0E0E0"};
1801
+ min-height: 44px;
1802
+ `;
1803
+ var FooterContent = styled4__default.default.div`
1804
+ display: flex;
1805
+ align-items: center;
1806
+ justify-content: space-between;
1807
+ gap: ${({ theme }) => theme?.spacing?.md ?? "16px"};
1808
+ width: 100%;
1809
+ max-width: 100%;
1810
+ font-size: 0.75rem;
1811
+ color: ${({ theme }) => theme?.colors?.text ?? "#000000"};
1812
+ opacity: 0.6;
1813
+ font-family: ${({ theme }) => theme?.fonts?.body ?? "system-ui, sans-serif"};
1814
+ line-height: 1.4;
1815
+ `;
1816
+ var FooterBranding = styled4__default.default.div`
1817
+ display: flex;
1818
+ align-items: center;
1819
+ gap: ${({ theme }) => theme?.spacing?.xs ?? "4px"};
1820
+ flex-shrink: 0;
1821
+ `;
1822
+ var FooterStatus = styled4__default.default.div`
1823
+ display: flex;
1824
+ align-items: center;
1825
+ gap: ${({ theme }) => theme?.spacing?.xs ?? "4px"};
1826
+ overflow: hidden;
1827
+ text-overflow: ellipsis;
1828
+ white-space: nowrap;
1829
+ font-size: 0.75rem;
1830
+ opacity: 0.8;
1831
+ `;
1832
+ var FooterLink = styled4__default.default.a`
1833
+ color: ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
1834
+ text-decoration: none;
1835
+ transition: opacity 150ms ease;
1836
+ cursor: pointer;
1837
+
1838
+ &:hover {
1839
+ opacity: 0.8;
1840
+ text-decoration: underline;
1841
+ }
1842
+
1843
+ &:focus-visible {
1844
+ outline: 2px solid ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
1845
+ outline-offset: 2px;
1846
+ border-radius: ${({ theme }) => theme?.radii?.sm ?? "4px"};
1847
+ }
1848
+ `;
1849
+ var Footer = ({
1850
+ branding,
1851
+ status,
1852
+ brandingUrl,
1853
+ onBrandingClick,
1854
+ className
1855
+ }) => {
1856
+ if (!branding && !status) {
1857
+ return null;
1858
+ }
1859
+ const handleBrandingClick = (e) => {
1860
+ if (onBrandingClick) {
1861
+ e.preventDefault();
1862
+ onBrandingClick();
1863
+ }
1864
+ };
1865
+ return /* @__PURE__ */ jsxRuntime.jsx(FooterContainer, { className, children: /* @__PURE__ */ jsxRuntime.jsxs(FooterContent, { children: [
1866
+ branding && /* @__PURE__ */ jsxRuntime.jsx(FooterBranding, { children: brandingUrl ? /* @__PURE__ */ jsxRuntime.jsx(
1867
+ FooterLink,
1868
+ {
1869
+ href: brandingUrl,
1870
+ onClick: handleBrandingClick,
1871
+ target: "_blank",
1872
+ rel: "noopener noreferrer",
1873
+ children: branding
1874
+ }
1875
+ ) : branding }),
1876
+ status && /* @__PURE__ */ jsxRuntime.jsx(FooterStatus, { children: status })
1877
+ ] }) });
1878
+ };
1879
+ Footer.displayName = "Footer";
1880
+ var InputContainer = styled4__default.default.div`
1881
+ display: flex;
1882
+ flex-direction: column;
1883
+ width: 100%;
1884
+ position: relative;
1885
+ `;
1886
+ var InputWrapper2 = styled4__default.default.div`
1887
+ display: flex;
1888
+ align-items: flex-end;
1889
+ gap: 8px;
1890
+ padding: 12px;
1891
+ background-color: #ffffff;
1892
+ border: 1px solid #e5e7eb;
1893
+ border-radius: 12px;
1894
+ transition: all 0.2s ease;
1895
+
1896
+ &:focus-within {
1897
+ border-color: #3b82f6;
1898
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
1899
+ }
1900
+
1901
+ &:hover:not(:focus-within) {
1902
+ border-color: #d1d5db;
1903
+ }
1904
+ `;
1905
+ var TextArea = styled4__default.default.textarea`
1906
+ flex: 1;
1907
+ min-height: 24px;
1908
+ max-height: ${(props) => `${(props.$maxRows || 5) * 24}px`};
1909
+ padding: 0;
1910
+ border: none;
1911
+ outline: none;
1912
+ resize: none;
1913
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu',
1914
+ 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
1915
+ font-size: 14px;
1916
+ line-height: 24px;
1917
+ color: #111827;
1918
+ background: transparent;
1919
+ overflow-y: auto;
1920
+
1921
+ &::placeholder {
1922
+ color: #9ca3af;
1923
+ }
1924
+
1925
+ &:disabled {
1926
+ color: #9ca3af;
1927
+ cursor: not-allowed;
1928
+ }
1929
+
1930
+ &:read-only {
1931
+ cursor: default;
1932
+ }
1933
+
1934
+ /* Custom scrollbar */
1935
+ &::-webkit-scrollbar {
1936
+ width: 6px;
1937
+ }
1938
+
1939
+ &::-webkit-scrollbar-track {
1940
+ background: transparent;
1941
+ }
1942
+
1943
+ &::-webkit-scrollbar-thumb {
1944
+ background: #d1d5db;
1945
+ border-radius: 3px;
1946
+ }
1947
+
1948
+ &::-webkit-scrollbar-thumb:hover {
1949
+ background: #9ca3af;
1950
+ }
1951
+ `;
1952
+ var SendButton = styled4__default.default.button`
1953
+ display: flex;
1954
+ align-items: center;
1955
+ justify-content: center;
1956
+ width: 36px;
1957
+ height: 36px;
1958
+ padding: 0;
1959
+ border: none;
1960
+ border-radius: 8px;
1961
+ background-color: ${(props) => props.disabled ? "#e5e7eb" : "#3b82f6"};
1962
+ color: ${(props) => props.disabled ? "#9ca3af" : "#ffffff"};
1963
+ cursor: ${(props) => props.disabled ? "not-allowed" : "pointer"};
1964
+ transition: all 0.2s ease;
1965
+ flex-shrink: 0;
1966
+
1967
+ &:hover:not(:disabled) {
1968
+ background-color: #2563eb;
1969
+ transform: translateY(-1px);
1970
+ }
1971
+
1972
+ &:active:not(:disabled) {
1973
+ transform: translateY(0);
1974
+ }
1975
+
1976
+ &:focus-visible {
1977
+ outline: 2px solid #3b82f6;
1978
+ outline-offset: 2px;
1979
+ }
1980
+
1981
+ svg {
1982
+ width: 20px;
1983
+ height: 20px;
1984
+ }
1985
+ `;
1986
+ var Input = ({
1987
+ value = "",
1988
+ onChange,
1989
+ onSubmit,
1990
+ placeholder = "Type a message...",
1991
+ isDisabled = false,
1992
+ isReadOnly = false,
1993
+ maxRows = 5,
1994
+ autoFocus = false,
1995
+ className,
1996
+ "aria-label": ariaLabel = "Message input",
1997
+ ...ariaProps
1998
+ }) => {
1999
+ const textareaRef = react.useRef(null);
2000
+ const { inputProps } = textfield.useTextField(
2001
+ {
2002
+ ...ariaProps,
2003
+ "aria-label": ariaLabel,
2004
+ value,
2005
+ onChange: (newValue) => {
2006
+ onChange?.(newValue);
2007
+ },
2008
+ isDisabled,
2009
+ isReadOnly,
2010
+ inputElementType: "textarea"
2011
+ },
2012
+ textareaRef
2013
+ );
2014
+ const handleKeyDown = (e) => {
2015
+ if (e.key === "Enter" && !e.shiftKey) {
2016
+ e.preventDefault();
2017
+ if (value.trim() && onSubmit && !isDisabled && !isReadOnly) {
2018
+ onSubmit(value.trim());
2019
+ onChange?.("");
2020
+ }
2021
+ }
2022
+ };
2023
+ const handleSend = () => {
2024
+ if (value.trim() && onSubmit && !isDisabled && !isReadOnly) {
2025
+ onSubmit(value.trim());
2026
+ onChange?.("");
2027
+ textareaRef.current?.focus();
2028
+ }
2029
+ };
2030
+ const canSend = value.trim().length > 0 && !isDisabled && !isReadOnly;
2031
+ return /* @__PURE__ */ jsxRuntime.jsx(InputContainer, { className, children: /* @__PURE__ */ jsxRuntime.jsxs(InputWrapper2, { children: [
2032
+ /* @__PURE__ */ jsxRuntime.jsx(
2033
+ TextArea,
2034
+ {
2035
+ ...inputProps,
2036
+ ref: textareaRef,
2037
+ placeholder,
2038
+ onKeyDown: handleKeyDown,
2039
+ $maxRows: maxRows,
2040
+ autoFocus,
2041
+ disabled: isDisabled,
2042
+ readOnly: isReadOnly
2043
+ }
2044
+ ),
2045
+ /* @__PURE__ */ jsxRuntime.jsx(
2046
+ SendButton,
2047
+ {
2048
+ type: "button",
2049
+ onClick: handleSend,
2050
+ disabled: !canSend,
2051
+ "aria-label": "Send message",
2052
+ title: "Send message (Enter)",
2053
+ children: /* @__PURE__ */ jsxRuntime.jsxs(
2054
+ "svg",
2055
+ {
2056
+ width: "20",
2057
+ height: "20",
2058
+ viewBox: "0 0 20 20",
2059
+ fill: "none",
2060
+ xmlns: "http://www.w3.org/2000/svg",
2061
+ role: "img",
2062
+ "aria-hidden": "true",
2063
+ children: [
2064
+ /* @__PURE__ */ jsxRuntime.jsx("title", { children: "Send Icon" }),
2065
+ /* @__PURE__ */ jsxRuntime.jsx(
2066
+ "path",
2067
+ {
2068
+ d: "M2.5 10L17.5 3.75L11.25 18.75L10 12.5L2.5 10Z",
2069
+ stroke: "currentColor",
2070
+ strokeWidth: "2",
2071
+ strokeLinecap: "round",
2072
+ strokeLinejoin: "round"
2073
+ }
2074
+ )
2075
+ ]
2076
+ }
2077
+ )
2078
+ }
2079
+ )
2080
+ ] }) });
2081
+ };
2082
+ var MessagesListContainer = styled4__default.default.div`
2083
+ display: flex;
2084
+ flex-direction: column;
2085
+ width: 100%;
2086
+ max-height: ${(props) => props.$maxHeight};
2087
+ overflow-y: auto;
2088
+ overflow-x: hidden;
2089
+ position: relative;
2090
+ background: #ffffff;
2091
+ border: 1px solid #e5e7eb;
2092
+ border-radius: 8px;
2093
+ scroll-behavior: smooth;
2094
+
2095
+ /* Custom scrollbar styling */
2096
+ &::-webkit-scrollbar {
2097
+ width: 8px;
2098
+ }
2099
+
2100
+ &::-webkit-scrollbar-track {
2101
+ background: #f1f5f9;
2102
+ border-radius: 4px;
2103
+ }
2104
+
2105
+ &::-webkit-scrollbar-thumb {
2106
+ background: #cbd5e1;
2107
+ border-radius: 4px;
2108
+ transition: background 0.2s ease;
2109
+ }
2110
+
2111
+ &::-webkit-scrollbar-thumb:hover {
2112
+ background: #94a3b8;
2113
+ }
2114
+
2115
+ /* Firefox scrollbar styling */
2116
+ scrollbar-width: thin;
2117
+ scrollbar-color: #cbd5e1 #f1f5f9;
2118
+
2119
+ /* Ensure proper rendering on mobile */
2120
+ -webkit-overflow-scrolling: touch;
2121
+ `;
2122
+ var MessagesListContent = styled4__default.default.div`
2123
+ display: flex;
2124
+ flex-direction: column;
2125
+ gap: 12px;
2126
+ padding: 16px;
2127
+ min-height: min-content;
2128
+
2129
+ /* Message styling */
2130
+ .message {
2131
+ display: flex;
2132
+ flex-direction: column;
2133
+ gap: 4px;
2134
+ padding: 12px 16px;
2135
+ border-radius: 8px;
2136
+ max-width: 85%;
2137
+ word-wrap: break-word;
2138
+ animation: messageSlideIn 0.2s ease-out;
2139
+ }
2140
+
2141
+ @keyframes messageSlideIn {
2142
+ from {
2143
+ opacity: 0;
2144
+ transform: translateY(8px);
2145
+ }
2146
+ to {
2147
+ opacity: 1;
2148
+ transform: translateY(0);
2149
+ }
2150
+ }
2151
+
2152
+ /* Role-specific message styling */
2153
+ .message--user {
2154
+ align-self: flex-end;
2155
+ background: #3b82f6;
2156
+ color: #ffffff;
2157
+ border-bottom-right-radius: 4px;
2158
+ }
2159
+
2160
+ .message--assistant {
2161
+ align-self: flex-start;
2162
+ background: #f1f5f9;
2163
+ color: #1e293b;
2164
+ border-bottom-left-radius: 4px;
2165
+ }
2166
+
2167
+ .message--system {
2168
+ align-self: center;
2169
+ background: #fef3c7;
2170
+ color: #92400e;
2171
+ font-size: 0.875rem;
2172
+ font-style: italic;
2173
+ max-width: 100%;
2174
+ text-align: center;
2175
+ }
2176
+ `;
2177
+ var MessagesList = ({
2178
+ messages,
2179
+ autoScroll = true,
2180
+ className,
2181
+ renderMessage,
2182
+ onScrollTop,
2183
+ maxHeight = "600px"
2184
+ }) => {
2185
+ const containerRef = react.useRef(null);
2186
+ const contentRef = react.useRef(null);
2187
+ const isUserScrollingRef = react.useRef(false);
2188
+ const scrollTimeoutRef = react.useRef(null);
2189
+ react.useEffect(() => {
2190
+ if (autoScroll && !isUserScrollingRef.current && containerRef.current) {
2191
+ const container = containerRef.current;
2192
+ container.scrollTop = container.scrollHeight;
2193
+ }
2194
+ }, [messages.length, autoScroll]);
2195
+ const handleScroll = () => {
2196
+ if (!containerRef.current) return;
2197
+ const container = containerRef.current;
2198
+ const isAtBottom = container.scrollHeight - container.scrollTop - container.clientHeight < 10;
2199
+ isUserScrollingRef.current = !isAtBottom;
2200
+ if (scrollTimeoutRef.current) {
2201
+ clearTimeout(scrollTimeoutRef.current);
2202
+ }
2203
+ scrollTimeoutRef.current = setTimeout(() => {
2204
+ isUserScrollingRef.current = false;
2205
+ }, 1e3);
2206
+ if (container.scrollTop === 0 && onScrollTop) {
2207
+ onScrollTop();
2208
+ }
2209
+ };
2210
+ react.useEffect(() => {
2211
+ return () => {
2212
+ if (scrollTimeoutRef.current) {
2213
+ clearTimeout(scrollTimeoutRef.current);
2214
+ }
2215
+ };
2216
+ }, []);
2217
+ const defaultRenderMessage = (message) => /* @__PURE__ */ jsxRuntime.jsx(
2218
+ "div",
2219
+ {
2220
+ className: `message message--${message.role}`,
2221
+ "data-message-id": message.id,
2222
+ "data-role": message.role,
2223
+ children: message.content
2224
+ },
2225
+ message.id
2226
+ );
2227
+ return /* @__PURE__ */ jsxRuntime.jsx(
2228
+ MessagesListContainer,
2229
+ {
2230
+ ref: containerRef,
2231
+ onScroll: handleScroll,
2232
+ className,
2233
+ $maxHeight: maxHeight,
2234
+ children: /* @__PURE__ */ jsxRuntime.jsx(MessagesListContent, { ref: contentRef, children: messages.map(renderMessage || defaultRenderMessage) })
2235
+ }
2236
+ );
2237
+ };
2238
+ var StyledUserMessage2 = styled4__default.default.div`
2239
+ display: flex;
2240
+ justify-content: flex-end;
2241
+ align-items: flex-start;
2242
+ margin: 8px 0;
2243
+ padding: 0 16px;
2244
+ width: 100%;
2245
+ `;
2246
+ var MessageBubble = styled4__default.default.div`
2247
+ display: flex;
2248
+ flex-direction: column;
2249
+ max-width: 70%;
2250
+ padding: 12px 16px;
2251
+ border-radius: 18px 18px 4px 18px;
2252
+
2253
+ /* User message colors - distinct from assistant messages */
2254
+ background-color: #007AFF;
2255
+ color: #FFFFFF;
2256
+
2257
+ /* Box shadow for depth */
2258
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
2259
+
2260
+ /* Smooth transitions */
2261
+ transition: all 0.2s ease-in-out;
2262
+
2263
+ &:hover {
2264
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
2265
+ }
2266
+
2267
+ /* Username styling */
2268
+ strong {
2269
+ font-size: 12px;
2270
+ font-weight: 600;
2271
+ margin-bottom: 4px;
2272
+ opacity: 0.9;
2273
+ }
2274
+ `;
2275
+ var MessageContent2 = styled4__default.default.p`
2276
+ margin: 0;
2277
+ font-size: 14px;
2278
+ line-height: 1.5;
2279
+ word-wrap: break-word;
2280
+ white-space: pre-wrap;
2281
+ `;
2282
+ var MessageTime = styled4__default.default.time`
2283
+ font-size: 11px;
2284
+ opacity: 0.7;
2285
+ margin-top: 4px;
2286
+ text-align: right;
2287
+ `;
2288
+ var UserMessage2 = ({
2289
+ content,
2290
+ timestamp,
2291
+ className,
2292
+ avatarUrl,
2293
+ username
2294
+ }) => {
2295
+ return /* @__PURE__ */ jsxRuntime.jsxs(StyledUserMessage2, { className, children: [
2296
+ /* @__PURE__ */ jsxRuntime.jsxs(MessageBubble, { children: [
2297
+ username && /* @__PURE__ */ jsxRuntime.jsx("strong", { children: username }),
2298
+ /* @__PURE__ */ jsxRuntime.jsx(MessageContent2, { children: content }),
2299
+ timestamp && /* @__PURE__ */ jsxRuntime.jsx(MessageTime, { children: timestamp })
2300
+ ] }),
2301
+ avatarUrl && /* @__PURE__ */ jsxRuntime.jsx(
2302
+ "img",
2303
+ {
2304
+ src: avatarUrl,
2305
+ alt: username || "User",
2306
+ style: { width: "32px", height: "32px", borderRadius: "50%", marginLeft: "8px" }
2307
+ }
2308
+ )
2309
+ ] });
2310
+ };
2311
+ var SuggestionsContainer = styled4__default.default.div`
2312
+ display: flex;
2313
+ flex-wrap: wrap;
2314
+ gap: ${({ theme }) => theme?.spacing?.sm ?? "8px"};
2315
+ padding: ${({ theme }) => theme?.spacing?.md ?? "16px"} 0;
2316
+ `;
2317
+ var StyledSuggestion = styled4__default.default.button`
2318
+ /* Base styles */
2319
+ display: inline-flex;
2320
+ align-items: center;
2321
+ justify-content: center;
2322
+ padding: ${({ theme }) => theme?.spacing?.sm ?? "8px"} ${({ theme }) => theme?.spacing?.md ?? "16px"};
2323
+ font-family: ${({ theme }) => theme?.fonts?.body ?? "system-ui, sans-serif"};
2324
+ font-size: 0.875rem;
2325
+ font-weight: 500;
2326
+ color: ${({ theme }) => theme?.colors?.text ?? "#000000"};
2327
+ background-color: ${({ theme }) => theme?.colors?.surface ?? "#ffffff"};
2328
+ border: 1px solid ${({ theme }) => theme?.colors?.border ?? "#E0E0E0"};
2329
+ border-radius: ${({ theme }) => theme?.radii?.lg ?? "12px"};
2330
+ cursor: pointer;
2331
+ transition: all 0.2s ease-in-out;
2332
+ white-space: nowrap;
2333
+ user-select: none;
2334
+
2335
+ /* Hover state */
2336
+ &:hover:not(:disabled) {
2337
+ background-color: ${({ theme }) => theme?.colors?.border ?? "#E0E0E0"};
2338
+ border-color: ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
2339
+ transform: translateY(-1px);
2340
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
2341
+ }
2342
+
2343
+ /* Active/Pressed state */
2344
+ &:active:not(:disabled) {
2345
+ transform: translateY(0);
2346
+ box-shadow: none;
2347
+ }
2348
+
2349
+ ${({ $isPressed }) => $isPressed && styled4.css`
2350
+ transform: scale(0.98);
2351
+ `}
2352
+
2353
+ /* Focus state */
2354
+ &:focus-visible {
2355
+ outline: 2px solid ${({ theme }) => theme?.colors?.primary ?? "#0066FF"};
2356
+ outline-offset: 2px;
2357
+ }
2358
+
2359
+ /* Remove default focus outline */
2360
+ &:focus {
2361
+ outline: none;
2362
+ }
2363
+
2364
+ /* Disabled state */
2365
+ &:disabled {
2366
+ cursor: not-allowed;
2367
+ opacity: 0.5;
2368
+ transform: none;
2369
+ }
2370
+ `;
2371
+ function Suggestions({ suggestions, onSelect, className }) {
2372
+ if (suggestions.length === 0) {
2373
+ return null;
2374
+ }
2375
+ return /* @__PURE__ */ jsxRuntime.jsx(SuggestionsContainer, { className, role: "list", "aria-label": "Suggested prompts", children: suggestions.map((suggestion) => /* @__PURE__ */ jsxRuntime.jsx(SuggestionChip, { suggestion, onSelect }, suggestion)) });
2376
+ }
2377
+ function SuggestionChip({ suggestion, onSelect }) {
2378
+ const ref = react.useRef(null);
2379
+ const { buttonProps, isPressed } = button.useButton(
2380
+ {
2381
+ onPress: () => onSelect(suggestion),
2382
+ "aria-label": `Select suggestion: ${suggestion}`
2383
+ },
2384
+ ref
2385
+ );
2386
+ return /* @__PURE__ */ jsxRuntime.jsx(StyledSuggestion, { ...buttonProps, ref, $isPressed: isPressed, role: "listitem", children: suggestion });
2387
+ }
2388
+ Suggestions.displayName = "Suggestions";
2389
+ var GlobalSidebarStyles2 = styled4.createGlobalStyle`
307
2390
  /* Override CopilotKit's default positioning - start off-screen */
308
2391
  .copilotKitSidebar {
309
2392
  position: fixed !important;
@@ -411,7 +2494,7 @@ var GlobalSidebarStyles2 = styled.createGlobalStyle`
411
2494
  }
412
2495
  }
413
2496
  `;
414
- var StyledChatButton2 = styled__default.default.button`
2497
+ var StyledChatButton2 = styled4__default.default.button`
415
2498
  position: fixed;
416
2499
  bottom: 8px;
417
2500
  right: 8px;
@@ -461,13 +2544,13 @@ var CustomCopilotSidebar2 = ({
461
2544
  setOpen(false);
462
2545
  onSetOpen?.(false);
463
2546
  };
464
- return /* @__PURE__ */ jsxRuntime.jsx(chunkOPWUJP7J_cjs.Header, { title: "AI Assistant", subtitle: "How can I help you today?", onClose: handleClose });
2547
+ return /* @__PURE__ */ jsxRuntime.jsx(Header, { title: "AI Assistant", subtitle: "How can I help you today?", onClose: handleClose });
465
2548
  };
466
2549
  const WindowAdapter = (props) => {
467
- return /* @__PURE__ */ jsxRuntime.jsx(chunkOPWUJP7J_cjs.Window, { children: props.children });
2550
+ return /* @__PURE__ */ jsxRuntime.jsx(Window, { children: props.children });
468
2551
  };
469
2552
  const MessagesAdapter = (props) => {
470
- return /* @__PURE__ */ jsxRuntime.jsx(chunkOPWUJP7J_cjs.Messages, { children: props.messages.map((message, index) => /* @__PURE__ */ jsxRuntime.jsx(
2553
+ return /* @__PURE__ */ jsxRuntime.jsx(Messages, { children: props.messages.map((message, index) => /* @__PURE__ */ jsxRuntime.jsx(
471
2554
  props.RenderMessage,
472
2555
  {
473
2556
  message,
@@ -542,74 +2625,26 @@ var CustomCopilotSidebar2 = ({
542
2625
  };
543
2626
  CustomCopilotSidebar2.displayName = "CustomCopilotSidebar";
544
2627
 
545
- Object.defineProperty(exports, "Actions", {
546
- enumerable: true,
547
- get: function () { return chunkOPWUJP7J_cjs.Actions; }
548
- });
549
- Object.defineProperty(exports, "AgentState", {
550
- enumerable: true,
551
- get: function () { return chunkOPWUJP7J_cjs.AgentState; }
552
- });
553
- Object.defineProperty(exports, "AssistantMessage", {
554
- enumerable: true,
555
- get: function () { return chunkOPWUJP7J_cjs.AssistantMessage; }
556
- });
557
- Object.defineProperty(exports, "Button", {
558
- enumerable: true,
559
- get: function () { return chunkOPWUJP7J_cjs.Button; }
560
- });
561
- Object.defineProperty(exports, "FileAttachment", {
562
- enumerable: true,
563
- get: function () { return chunkOPWUJP7J_cjs.FileAttachment; }
564
- });
565
- Object.defineProperty(exports, "Footer", {
566
- enumerable: true,
567
- get: function () { return chunkOPWUJP7J_cjs.Footer; }
568
- });
569
- Object.defineProperty(exports, "Header", {
570
- enumerable: true,
571
- get: function () { return chunkOPWUJP7J_cjs.Header; }
572
- });
573
- Object.defineProperty(exports, "Input", {
574
- enumerable: true,
575
- get: function () { return chunkOPWUJP7J_cjs.Input; }
576
- });
577
- Object.defineProperty(exports, "Messages", {
578
- enumerable: true,
579
- get: function () { return chunkOPWUJP7J_cjs.Messages; }
580
- });
581
- Object.defineProperty(exports, "MessagesList", {
582
- enumerable: true,
583
- get: function () { return chunkOPWUJP7J_cjs.MessagesList; }
584
- });
585
- Object.defineProperty(exports, "MessagesListContainer", {
586
- enumerable: true,
587
- get: function () { return chunkOPWUJP7J_cjs.MessagesListContainer; }
588
- });
589
- Object.defineProperty(exports, "MessagesListContent", {
590
- enumerable: true,
591
- get: function () { return chunkOPWUJP7J_cjs.MessagesListContent; }
592
- });
593
- Object.defineProperty(exports, "Response", {
594
- enumerable: true,
595
- get: function () { return chunkOPWUJP7J_cjs.Response; }
596
- });
597
- Object.defineProperty(exports, "Suggestions", {
598
- enumerable: true,
599
- get: function () { return chunkOPWUJP7J_cjs.Suggestions; }
600
- });
601
- Object.defineProperty(exports, "UserMessage", {
602
- enumerable: true,
603
- get: function () { return chunkOPWUJP7J_cjs.UserMessage2; }
604
- });
605
- Object.defineProperty(exports, "Window", {
606
- enumerable: true,
607
- get: function () { return chunkOPWUJP7J_cjs.Window; }
608
- });
2628
+ exports.Actions = Actions;
2629
+ exports.AgentState = AgentState;
2630
+ exports.AssistantMessage = AssistantMessage;
609
2631
  exports.AssistantMessageAdapter = AssistantMessageAdapter;
2632
+ exports.Button = Button;
610
2633
  exports.CustomCopilotSidebar = CustomCopilotSidebar;
2634
+ exports.FileAttachment = FileAttachment;
2635
+ exports.Footer = Footer;
2636
+ exports.Header = Header;
2637
+ exports.Input = Input;
611
2638
  exports.InputAdapter = InputAdapter;
612
2639
  exports.IntegratedSidebar = CustomCopilotSidebar2;
2640
+ exports.Messages = Messages;
2641
+ exports.MessagesList = MessagesList;
2642
+ exports.MessagesListContainer = MessagesListContainer;
2643
+ exports.MessagesListContent = MessagesListContent;
2644
+ exports.Response = Response;
2645
+ exports.Suggestions = Suggestions;
2646
+ exports.UserMessage = UserMessage2;
613
2647
  exports.UserMessageAdapter = UserMessageAdapter;
2648
+ exports.Window = Window;
614
2649
  //# sourceMappingURL=index.cjs.map
615
2650
  //# sourceMappingURL=index.cjs.map