@agentiffai/design 1.3.5 → 1.3.7

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,6 +1,6 @@
1
1
  import { useButton } from '@react-aria/button';
2
- import { memo, useState, useRef, useEffect, useCallback } from 'react';
3
- import styled4, { css, keyframes, createGlobalStyle } from 'styled-components';
2
+ import { memo, useRef, useEffect, useState, useMemo, useCallback } from 'react';
3
+ import styled8, { css, keyframes, createGlobalStyle } from 'styled-components';
4
4
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
5
  import { CopilotSidebar, useChatContext } from '@copilotkit/react-ui';
6
6
  import { useTextField } from '@react-aria/textfield';
@@ -245,7 +245,7 @@ var sizeStyles = {
245
245
  height: 44px;
246
246
  `
247
247
  };
248
- var StyledButton = styled4.button`
248
+ var StyledButton = styled8.button`
249
249
  /* Base styles */
250
250
  display: inline-flex;
251
251
  align-items: center;
@@ -328,7 +328,7 @@ function Button({
328
328
  );
329
329
  }
330
330
  Button.displayName = "Button";
331
- var ActionsContainer = styled4.div`
331
+ var ActionsContainer = styled8.div`
332
332
  display: flex;
333
333
  gap: ${tokens.spacing.sm};
334
334
  align-items: center;
@@ -388,7 +388,7 @@ var blink = keyframes`
388
388
  opacity: 0;
389
389
  }
390
390
  `;
391
- var ResponseContainer = styled4.div`
391
+ var ResponseContainer = styled8.div`
392
392
  display: inline-flex;
393
393
  align-items: center;
394
394
  gap: ${tokens.spacing.sm};
@@ -400,13 +400,13 @@ var ResponseContainer = styled4.div`
400
400
  max-width: fit-content;
401
401
  margin: 0 auto;
402
402
  `;
403
- var LoadingDots = styled4.div`
403
+ var LoadingDots = styled8.div`
404
404
  display: flex;
405
405
  align-items: center;
406
406
  gap: ${tokens.spacing.xs};
407
407
  padding: 0 ${tokens.spacing.xs};
408
408
  `;
409
- var Dot = styled4.span`
409
+ var Dot = styled8.span`
410
410
  width: ${tokens.spacing.xs};
411
411
  height: ${tokens.spacing.xs};
412
412
  border-radius: ${tokens.borderRadius.full};
@@ -414,7 +414,7 @@ var Dot = styled4.span`
414
414
  animation: ${dotPulse} 1.4s ease-in-out infinite;
415
415
  animation-delay: ${(props) => props.delay}s;
416
416
  `;
417
- var TypingIndicator = styled4.div`
417
+ var TypingIndicator = styled8.div`
418
418
  display: flex;
419
419
  align-items: center;
420
420
  gap: ${tokens.spacing.xs};
@@ -427,14 +427,14 @@ var TypingIndicator = styled4.div`
427
427
  animation: ${dotPulse} 1.4s ease-in-out infinite;
428
428
  }
429
429
  `;
430
- var Message = styled4.span`
430
+ var Message = styled8.span`
431
431
  font-size: ${tokens.typography.fontSize.sm};
432
432
  color: ${tokens.colors.text.primary};
433
433
  font-weight: ${tokens.typography.fontWeight.regular};
434
434
  line-height: ${tokens.typography.lineHeight.normal};
435
435
  white-space: nowrap;
436
436
  `;
437
- var StreamingText = styled4.div`
437
+ var StreamingText = styled8.div`
438
438
  font-size: ${tokens.typography.fontSize.sm};
439
439
  line-height: ${tokens.typography.lineHeight.normal};
440
440
  color: ${tokens.colors.text.primary};
@@ -506,7 +506,7 @@ var shake = keyframes`
506
506
  transform: translateX(5px);
507
507
  }
508
508
  `;
509
- var AgentStateContainer = styled4.div`
509
+ var AgentStateContainer = styled8.div`
510
510
  display: inline-flex;
511
511
  flex-direction: column;
512
512
  align-items: center;
@@ -520,35 +520,35 @@ var AgentStateContainer = styled4.div`
520
520
  max-width: fit-content;
521
521
  margin: 0 auto;
522
522
  `;
523
- var StateContent = styled4.div`
523
+ var StateContent = styled8.div`
524
524
  display: flex;
525
525
  flex-direction: column;
526
526
  gap: ${tokens.spacing.sm};
527
527
  align-items: center;
528
528
  width: 100%;
529
529
  `;
530
- var IdleIndicator = styled4.div`
530
+ var IdleIndicator = styled8.div`
531
531
  width: ${tokens.spacing.xs};
532
532
  height: ${tokens.spacing.xs};
533
533
  background-color: ${tokens.colors.status.idle};
534
534
  border-radius: ${tokens.borderRadius.full};
535
535
  animation: ${dotPulse2} 2s infinite ease-in-out;
536
536
  `;
537
- var ErrorIndicator = styled4.div`
537
+ var ErrorIndicator = styled8.div`
538
538
  width: ${tokens.spacing.xs};
539
539
  height: ${tokens.spacing.xs};
540
540
  background-color: ${tokens.colors.error};
541
541
  border-radius: ${tokens.borderRadius.full};
542
542
  animation: ${shake} 0.5s ease-in-out;
543
543
  `;
544
- var StateLabel = styled4.span`
544
+ var StateLabel = styled8.span`
545
545
  font-size: ${tokens.typography.fontSize.sm};
546
546
  font-weight: ${tokens.typography.fontWeight.regular};
547
547
  color: ${tokens.colors.text.primary};
548
548
  line-height: ${tokens.typography.lineHeight.normal};
549
549
  white-space: nowrap;
550
550
  `;
551
- styled4.p`
551
+ styled8.p`
552
552
  font-size: ${tokens.typography.fontSize.sm};
553
553
  color: ${tokens.colors.text.tertiary};
554
554
  line-height: ${tokens.typography.lineHeight.normal};
@@ -556,7 +556,7 @@ styled4.p`
556
556
  text-align: center;
557
557
  white-space: nowrap;
558
558
  `;
559
- var ProgressBar = styled4.div`
559
+ var ProgressBar = styled8.div`
560
560
  width: 100%;
561
561
  height: ${tokens.spacing.xs};
562
562
  background-color: ${tokens.colors.surface.elevated};
@@ -564,7 +564,7 @@ var ProgressBar = styled4.div`
564
564
  overflow: hidden;
565
565
  margin-top: ${tokens.spacing.xs};
566
566
  `;
567
- var ProgressBarFill = styled4.div`
567
+ var ProgressBarFill = styled8.div`
568
568
  height: 100%;
569
569
  width: ${(props) => Math.min(Math.max(props.progress, 0), 100)}%;
570
570
  background: linear-gradient(135deg, ${tokens.colors.accent} 0%, ${tokens.colors.primary} 100%);
@@ -593,11 +593,11 @@ var AgentState = ({ state, message, progress, className }) => {
593
593
  }
594
594
  return null;
595
595
  };
596
- var Container = styled4.div`
596
+ var Container = styled8.div`
597
597
  margin: ${tokens.spacing.sm} 0;
598
598
  padding: 0 ${tokens.spacing.sm};
599
599
  `;
600
- var ToolName = styled4.div`
600
+ var ToolName = styled8.div`
601
601
  font-size: ${tokens.typography.fontSize.xs};
602
602
  color: ${tokens.colors.text.tertiary};
603
603
  margin-bottom: ${tokens.spacing.xs};
@@ -704,7 +704,7 @@ var getSizeValue = (size = "md") => {
704
704
  };
705
705
  }
706
706
  };
707
- var Container2 = styled4.div`
707
+ var Container2 = styled8.div`
708
708
  display: inline-flex;
709
709
  align-items: center;
710
710
  gap: ${tokens.spacing.md};
@@ -716,7 +716,7 @@ var Container2 = styled4.div`
716
716
  max-width: fit-content;
717
717
  margin: 0 auto;
718
718
  `;
719
- var Avatar = styled4.div`
719
+ var Avatar = styled8.div`
720
720
  width: ${(props) => getSizeValue(props.size).avatar};
721
721
  height: ${(props) => getSizeValue(props.size).avatar};
722
722
  border-radius: ${tokens.borderRadius.full};
@@ -727,23 +727,23 @@ var Avatar = styled4.div`
727
727
  flex-shrink: 0;
728
728
  box-shadow: ${tokens.shadows.glow.primary};
729
729
  `;
730
- var HeadphonesIcon = styled4.svg`
730
+ var HeadphonesIcon = styled8.svg`
731
731
  width: ${(props) => getSizeValue(props.size).icon};
732
732
  height: ${(props) => getSizeValue(props.size).icon};
733
733
  color: ${tokens.colors.text.primary};
734
734
  `;
735
- var Content = styled4.div`
735
+ var Content = styled8.div`
736
736
  display: flex;
737
737
  align-items: center;
738
738
  gap: ${tokens.spacing.sm};
739
739
  `;
740
- var LoadingDots2 = styled4.div`
740
+ var LoadingDots2 = styled8.div`
741
741
  display: flex;
742
742
  align-items: center;
743
743
  gap: ${(props) => props.variant === "wave" ? "2px" : `${tokens.spacing.xs}`};
744
744
  padding: 0 ${tokens.spacing.xs};
745
745
  `;
746
- var Dot2 = styled4.span`
746
+ var Dot2 = styled8.span`
747
747
  width: ${(props) => getSizeValue(props.size).dotSize};
748
748
  height: ${(props) => getSizeValue(props.size).dotSize};
749
749
  border-radius: ${tokens.borderRadius.full};
@@ -761,7 +761,7 @@ var Dot2 = styled4.span`
761
761
  }}
762
762
  1.4s ease-in-out infinite;
763
763
  `;
764
- var Message2 = styled4.span`
764
+ var Message2 = styled8.span`
765
765
  font-size: ${(props) => getSizeValue(props.size).fontSize};
766
766
  color: ${tokens.colors.text.secondary};
767
767
  font-weight: ${tokens.typography.fontWeight.regular};
@@ -821,8 +821,8 @@ function AssistantThinking({
821
821
  );
822
822
  }
823
823
  AssistantThinking.displayName = "AssistantThinking";
824
- var Container3 = styled4.div`
825
- font-family: ${(props) => props.variant === "code" ? tokens.typography.fontFamily.monospace : tokens.typography.fontFamily.primary};
824
+ var Container3 = styled8.div`
825
+ font-family: ${(props) => props.$variant === "code" ? tokens.typography.fontFamily.monospace : tokens.typography.fontFamily.primary};
826
826
  white-space: pre-wrap;
827
827
  word-break: break-word;
828
828
  line-height: ${tokens.typography.lineHeight.normal};
@@ -830,7 +830,7 @@ var Container3 = styled4.div`
830
830
  text-rendering: optimizeSpeed;
831
831
  contain: content;
832
832
  `;
833
- var Cursor = styled4.span`
833
+ var Cursor = styled8.span`
834
834
  display: inline-block;
835
835
  width: 2px;
836
836
  height: 1em;
@@ -854,17 +854,15 @@ var StreamingTextBase = ({
854
854
  content,
855
855
  isStreaming = false,
856
856
  typingSpeed: _typingSpeed = 50,
857
- // Not used - streaming shows chunks as they arrive
857
+ // Reserved for future use
858
858
  cursor = true,
859
859
  variant = "default",
860
860
  onStreamComplete,
861
861
  className
862
862
  }) => {
863
- const [displayedText, setDisplayedText] = useState(content);
864
863
  const wasStreamingRef = useRef(isStreaming);
865
864
  const completionCalledRef = useRef(false);
866
865
  useEffect(() => {
867
- setDisplayedText(content);
868
866
  if (wasStreamingRef.current && !isStreaming && !completionCalledRef.current) {
869
867
  completionCalledRef.current = true;
870
868
  onStreamComplete?.();
@@ -873,45 +871,48 @@ var StreamingTextBase = ({
873
871
  completionCalledRef.current = false;
874
872
  }
875
873
  wasStreamingRef.current = isStreaming;
876
- }, [content, isStreaming, onStreamComplete]);
874
+ }, [isStreaming, onStreamComplete]);
877
875
  const showCursor = isStreaming && cursor;
878
- return /* @__PURE__ */ jsxs(Container3, { variant, className, children: [
879
- displayedText,
876
+ return /* @__PURE__ */ jsxs(Container3, { $variant: variant, className, children: [
877
+ content,
880
878
  showCursor && /* @__PURE__ */ jsx(Cursor, {})
881
879
  ] });
882
880
  };
883
881
  var StreamingText2 = memo(StreamingTextBase);
884
882
  StreamingText2.displayName = "StreamingText";
885
- var MessageContainer = styled4.div`
883
+ var MessageContainer = styled8.div`
886
884
  display: flex;
887
- gap: ${tokens.spacing.sm};
888
- align-items: flex-start;
889
- padding: ${tokens.spacing.sm} 0;
885
+ flex-direction: column;
886
+ gap: ${tokens.spacing.xs};
887
+ padding: ${tokens.spacing.xs} 0;
890
888
  max-width: 100%;
891
889
  /* GPU acceleration hint for smooth rendering during streaming */
892
890
  will-change: contents;
893
891
  contain: content;
894
892
  `;
895
- var AvatarContainer = styled4.div`
893
+ var AvatarContainer = styled8.div`
894
+ display: flex;
895
+ align-items: center;
896
+ gap: ${tokens.spacing.xs};
896
897
  flex-shrink: 0;
897
898
  `;
898
- var Avatar2 = styled4.img`
899
- width: ${tokens.spacing.xl};
900
- height: ${tokens.spacing.xl};
899
+ var Avatar2 = styled8.img`
900
+ width: 20px;
901
+ height: 20px;
901
902
  border-radius: ${tokens.borderRadius.full};
902
903
  object-fit: cover;
903
904
  background-color: transparent;
904
905
  `;
905
- var AvatarInitials = styled4.div`
906
- width: ${tokens.spacing.xl};
907
- height: ${tokens.spacing.xl};
906
+ var AvatarInitials = styled8.div`
907
+ width: 20px;
908
+ height: 20px;
908
909
  border-radius: ${tokens.borderRadius.full};
909
910
  overflow: hidden;
910
911
  display: flex;
911
912
  align-items: center;
912
913
  justify-content: center;
913
914
  background-color: ${tokens.colors.secondary};
914
- padding: ${tokens.spacing.xs};
915
+ padding: 2px;
915
916
  box-sizing: border-box;
916
917
 
917
918
  img {
@@ -920,16 +921,20 @@ var AvatarInitials = styled4.div`
920
921
  object-fit: contain;
921
922
  }
922
923
  `;
923
- var ContentContainer = styled4.div`
924
- flex: 1;
924
+ var AvatarLabel = styled8.span`
925
+ font-size: ${tokens.typography.fontSize.xs};
926
+ font-weight: ${tokens.typography.fontWeight.medium};
927
+ color: ${tokens.colors.text.secondary};
928
+ `;
929
+ var ContentContainer = styled8.div`
930
+ width: 100%;
925
931
  min-width: 0;
926
932
  `;
927
- var MessageContent = styled4.div`
933
+ var MessageContent = styled8.div`
928
934
  /* Use solid color instead of backdrop-filter for performance during streaming */
929
935
  background-color: ${tokens.colors.surface.elevated};
930
- padding: ${tokens.spacing.sm} ${tokens.spacing.md};
936
+ padding: ${tokens.spacing.sm};
931
937
  border-radius: ${tokens.borderRadius.lg};
932
- border-top-left-radius: ${tokens.borderRadius.sm};
933
938
  color: ${tokens.colors.text.primary};
934
939
  font-size: ${tokens.typography.fontSize.sm};
935
940
  line-height: ${tokens.typography.lineHeight.normal};
@@ -939,14 +944,13 @@ var MessageContent = styled4.div`
939
944
  /* Optimize text rendering */
940
945
  text-rendering: optimizeSpeed;
941
946
  `;
942
- var LoadingDots3 = styled4.div`
947
+ var LoadingDots3 = styled8.div`
943
948
  display: flex;
944
949
  gap: ${tokens.spacing.xs};
945
- padding: ${tokens.spacing.sm} ${tokens.spacing.md};
950
+ padding: ${tokens.spacing.sm};
946
951
  /* Use solid color instead of backdrop-filter for performance */
947
952
  background-color: ${tokens.colors.surface.elevated};
948
953
  border-radius: ${tokens.borderRadius.lg};
949
- border-top-left-radius: ${tokens.borderRadius.sm};
950
954
  width: fit-content;
951
955
  `;
952
956
  var pulse2 = keyframes`
@@ -957,7 +961,7 @@ var pulse2 = keyframes`
957
961
  opacity: 1;
958
962
  }
959
963
  `;
960
- var LoadingDot = styled4.div`
964
+ var LoadingDot = styled8.div`
961
965
  width: ${tokens.spacing.sm};
962
966
  height: ${tokens.spacing.sm};
963
967
  border-radius: ${tokens.borderRadius.full};
@@ -966,7 +970,7 @@ var LoadingDot = styled4.div`
966
970
  animation: ${pulse2} 1.4s ease-in-out infinite;
967
971
  animation-delay: ${(props) => props.delay}s;
968
972
  `;
969
- var FileAttachmentContainer = styled4.div`
973
+ var FileAttachmentContainer = styled8.div`
970
974
  display: flex;
971
975
  align-items: center;
972
976
  gap: ${tokens.spacing.sm};
@@ -1002,7 +1006,7 @@ var FileAttachmentContainer = styled4.div`
1002
1006
  }
1003
1007
  `}
1004
1008
  `;
1005
- var FileIconContainer = styled4.div`
1009
+ var FileIconContainer = styled8.div`
1006
1010
  flex-shrink: 0;
1007
1011
  width: ${tokens.spacing.xl};
1008
1012
  height: ${tokens.spacing.xl};
@@ -1012,14 +1016,14 @@ var FileIconContainer = styled4.div`
1012
1016
  font-size: ${tokens.typography.fontSize["2xl"]};
1013
1017
  line-height: 1;
1014
1018
  `;
1015
- var FileInfo = styled4.div`
1019
+ var FileInfo = styled8.div`
1016
1020
  flex: 1;
1017
1021
  min-width: 0;
1018
1022
  display: flex;
1019
1023
  flex-direction: column;
1020
1024
  gap: 2px;
1021
1025
  `;
1022
- var FileTitle = styled4.div`
1026
+ var FileTitle = styled8.div`
1023
1027
  font-size: ${tokens.typography.fontSize.sm};
1024
1028
  font-weight: ${tokens.typography.fontWeight.medium};
1025
1029
  color: ${tokens.colors.text.primary};
@@ -1029,7 +1033,7 @@ var FileTitle = styled4.div`
1029
1033
  text-overflow: ellipsis;
1030
1034
  white-space: nowrap;
1031
1035
  `;
1032
- var FileMetadata = styled4.div`
1036
+ var FileMetadata = styled8.div`
1033
1037
  display: flex;
1034
1038
  align-items: center;
1035
1039
  gap: ${tokens.spacing.xs};
@@ -1039,7 +1043,7 @@ var FileMetadata = styled4.div`
1039
1043
  line-height: ${tokens.typography.lineHeight.tight};
1040
1044
  overflow: hidden;
1041
1045
  `;
1042
- var FileSubtitle = styled4.span`
1046
+ var FileSubtitle = styled8.span`
1043
1047
  color: ${tokens.colors.text.tertiary};
1044
1048
  white-space: nowrap;
1045
1049
  overflow: hidden;
@@ -1095,13 +1099,13 @@ var FileAttachment = ({
1095
1099
  }
1096
1100
  );
1097
1101
  };
1098
- var AttachmentsContainer = styled4.div`
1102
+ var AttachmentsContainer = styled8.div`
1099
1103
  display: flex;
1100
1104
  flex-direction: column;
1101
1105
  gap: ${tokens.spacing.sm};
1102
1106
  margin-top: ${tokens.spacing.sm};
1103
1107
  `;
1104
- var ActionButton = styled4.button`
1108
+ var ActionButton = styled8.button`
1105
1109
  display: inline-flex;
1106
1110
  align-items: center;
1107
1111
  gap: ${tokens.spacing.xs};
@@ -1125,19 +1129,19 @@ var ActionButton = styled4.button`
1125
1129
  transform: scale(0.98);
1126
1130
  }
1127
1131
  `;
1128
- var ActionsContainer2 = styled4.div`
1132
+ var ActionsContainer2 = styled8.div`
1129
1133
  display: flex;
1130
1134
  gap: ${tokens.spacing.xs};
1131
1135
  flex-wrap: wrap;
1132
1136
  margin-top: ${tokens.spacing.sm};
1133
1137
  `;
1134
- var MessageTime = styled4.time`
1138
+ var MessageTime = styled8.time`
1135
1139
  font-size: ${tokens.typography.fontSize.xs};
1136
1140
  color: ${tokens.colors.text.tertiary};
1137
1141
  margin-top: ${tokens.spacing.xs};
1138
1142
  display: block;
1139
1143
  `;
1140
- var StreamingIndicator = styled4.span`
1144
+ var StreamingIndicator = styled8.span`
1141
1145
  display: inline-block;
1142
1146
  width: ${tokens.spacing.xs};
1143
1147
  height: ${tokens.spacing.xs};
@@ -1201,7 +1205,10 @@ var AssistantMessageBase = ({
1201
1205
  ] });
1202
1206
  };
1203
1207
  return /* @__PURE__ */ jsxs(MessageContainer, { className, children: [
1204
- /* @__PURE__ */ jsx(AvatarContainer, { children: avatarUrl ? /* @__PURE__ */ jsx(Avatar2, { src: avatarUrl, alt: "Assistant avatar" }) : /* @__PURE__ */ jsx(AvatarInitials, { children: /* @__PURE__ */ jsx(Avatar2, { src: "/assets/avatar-transparent-bg.png", alt: "AI Assistant" }) }) }),
1208
+ /* @__PURE__ */ jsxs(AvatarContainer, { children: [
1209
+ avatarUrl ? /* @__PURE__ */ jsx(Avatar2, { src: avatarUrl, alt: "Assistant avatar" }) : /* @__PURE__ */ jsx(AvatarInitials, { children: /* @__PURE__ */ jsx(Avatar2, { src: "/assets/avatar-transparent-bg.png", alt: "AI Assistant" }) }),
1210
+ /* @__PURE__ */ jsx(AvatarLabel, { children: "Assistant" })
1211
+ ] }),
1205
1212
  /* @__PURE__ */ jsx(ContentContainer, { children: renderContent() })
1206
1213
  ] });
1207
1214
  };
@@ -1211,7 +1218,7 @@ var TOOL_CALL_MARKER_REGEX = /<!--TOOL_CALL:([^:]+):(.+?)-->/g;
1211
1218
  function stripToolCallMarkers(content) {
1212
1219
  return content.replace(TOOL_CALL_MARKER_REGEX, "").trim();
1213
1220
  }
1214
- var GenerativeUIContainer = styled4.div`
1221
+ var GenerativeUIContainer = styled8.div`
1215
1222
  margin-top: ${tokens.spacing.sm};
1216
1223
  margin-bottom: ${tokens.spacing.sm};
1217
1224
  `;
@@ -1260,7 +1267,53 @@ var AssistantMessageAdapterBase = ({
1260
1267
  };
1261
1268
  var AssistantMessageAdapter = memo(AssistantMessageAdapterBase);
1262
1269
  AssistantMessageAdapter.displayName = "AssistantMessageAdapter";
1263
- var ChatInputContainer = styled4.div`
1270
+ function createAssistantMessageAdapter(ThinkingIndicator, ToolCallsComponent) {
1271
+ const CustomAssistantMessageAdapter = ({
1272
+ message,
1273
+ isLoading,
1274
+ isGenerating,
1275
+ isCurrentMessage
1276
+ }) => {
1277
+ const showThinking = isLoading || isGenerating && !message?.content;
1278
+ const shouldShowToolCalls = isCurrentMessage && ToolCallsComponent;
1279
+ const rawContent = message?.content || "";
1280
+ const content = stripToolCallMarkers(rawContent);
1281
+ let generativeUIOutput = null;
1282
+ const msgWithUI = message;
1283
+ if (msgWithUI && typeof msgWithUI.generativeUI === "function") {
1284
+ try {
1285
+ generativeUIOutput = msgWithUI.generativeUI();
1286
+ } catch (e) {
1287
+ console.warn("[AssistantMessageAdapter] Error rendering generativeUI:", e);
1288
+ }
1289
+ }
1290
+ const attachments = [];
1291
+ if (showThinking) {
1292
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1293
+ ThinkingIndicator ? /* @__PURE__ */ jsx(ThinkingIndicator, { isLoading, isGenerating }) : /* @__PURE__ */ jsx(AssistantThinking, { message: "Thinking..." }),
1294
+ shouldShowToolCalls && /* @__PURE__ */ jsx(ToolCallsComponent, {})
1295
+ ] });
1296
+ }
1297
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
1298
+ shouldShowToolCalls && /* @__PURE__ */ jsx(ToolCallsComponent, {}),
1299
+ generativeUIOutput && /* @__PURE__ */ jsx(GenerativeUIContainer, { children: generativeUIOutput }),
1300
+ content && /* @__PURE__ */ jsx(
1301
+ AssistantMessage,
1302
+ {
1303
+ content,
1304
+ avatarInitials: "AI",
1305
+ isLoading: false,
1306
+ isStreaming: isGenerating,
1307
+ attachments,
1308
+ enableMarkdown: true
1309
+ }
1310
+ )
1311
+ ] });
1312
+ };
1313
+ CustomAssistantMessageAdapter.displayName = "CustomAssistantMessageAdapter";
1314
+ return memo(CustomAssistantMessageAdapter);
1315
+ }
1316
+ var ChatInputContainer = styled8.div`
1264
1317
  display: flex;
1265
1318
  flex-direction: column;
1266
1319
  width: 100%;
@@ -1276,7 +1329,7 @@ var ChatInputContainer = styled4.div`
1276
1329
  padding: ${tokens.spacing.md};
1277
1330
  }
1278
1331
  `;
1279
- var SuggestionsWrapper = styled4.div`
1332
+ var SuggestionsWrapper = styled8.div`
1280
1333
  display: flex;
1281
1334
  flex-direction: row;
1282
1335
  flex-wrap: wrap;
@@ -1285,7 +1338,7 @@ var SuggestionsWrapper = styled4.div`
1285
1338
  width: 100%;
1286
1339
  box-sizing: border-box;
1287
1340
  `;
1288
- var SuggestionButton = styled4.button`
1341
+ var SuggestionButton = styled8.button`
1289
1342
  padding: ${tokens.spacing.sm} ${tokens.spacing.md};
1290
1343
  font-family: ${tokens.typography.fontFamily.primary};
1291
1344
  font-size: 13px;
@@ -1324,7 +1377,7 @@ var SuggestionButton = styled4.button`
1324
1377
  opacity: 0.4;
1325
1378
  }
1326
1379
  `;
1327
- var InputWrapper = styled4.div`
1380
+ var InputWrapper = styled8.div`
1328
1381
  display: flex;
1329
1382
  align-items: flex-end; /* Align button to bottom when textarea expands */
1330
1383
  gap: ${tokens.spacing.sm};
@@ -1342,7 +1395,7 @@ var InputWrapper = styled4.div`
1342
1395
  background-color: rgba(50, 50, 52, 0.6);
1343
1396
  }
1344
1397
  `;
1345
- var InputField = styled4.textarea`
1398
+ var InputField = styled8.textarea`
1346
1399
  flex: 1;
1347
1400
  border: none;
1348
1401
  outline: none;
@@ -1367,7 +1420,7 @@ var InputField = styled4.textarea`
1367
1420
  cursor: not-allowed;
1368
1421
  }
1369
1422
  `;
1370
- var SubmitButton = styled4.button`
1423
+ var SubmitButton = styled8.button`
1371
1424
  display: flex;
1372
1425
  align-items: center;
1373
1426
  justify-content: center;
@@ -1446,7 +1499,6 @@ var ChatInput = ({
1446
1499
  if (inputRef.current) {
1447
1500
  inputRef.current.style.height = "auto";
1448
1501
  }
1449
- inputRef.current?.focus();
1450
1502
  }
1451
1503
  };
1452
1504
  const handleSuggestionClick = (suggestionText) => {
@@ -1552,7 +1604,7 @@ ChatInput.displayName = "ChatInput";
1552
1604
  var InputAdapter = ({
1553
1605
  inProgress,
1554
1606
  onSend,
1555
- isVisible = true
1607
+ isVisible: _isVisible = true
1556
1608
  }) => {
1557
1609
  const [value, setValue] = useState("");
1558
1610
  const [isSubmitting, setIsSubmitting] = useState(false);
@@ -1596,7 +1648,7 @@ var InputAdapter = ({
1596
1648
  onSubmit: handleSubmit,
1597
1649
  placeholder: "Ask, write or search for anything...",
1598
1650
  isDisabled: shouldDisableInput,
1599
- autoFocus: isVisible,
1651
+ autoFocus: false,
1600
1652
  "aria-label": "Chat message input",
1601
1653
  suggestions: [{ text: "Explore workflows" }],
1602
1654
  onSuggestionSelect: handleSuggestionSelect
@@ -1604,7 +1656,7 @@ var InputAdapter = ({
1604
1656
  );
1605
1657
  };
1606
1658
  InputAdapter.displayName = "InputAdapter";
1607
- var StyledUserMessage = styled4.button`
1659
+ var StyledUserMessage = styled8.button`
1608
1660
  /* Base styles */
1609
1661
  display: inline-flex;
1610
1662
  align-items: center;
@@ -1619,6 +1671,7 @@ var StyledUserMessage = styled4.button`
1619
1671
  user-select: none;
1620
1672
  white-space: pre-wrap;
1621
1673
  word-wrap: break-word;
1674
+ word-break: break-word;
1622
1675
  position: relative;
1623
1676
  text-align: left;
1624
1677
 
@@ -1739,7 +1792,7 @@ function UserMessageBase({
1739
1792
  }
1740
1793
  var UserMessage = memo(UserMessageBase);
1741
1794
  UserMessage.displayName = "UserMessage";
1742
- var UserMessageWrapper = styled4.div`
1795
+ var UserMessageWrapper = styled8.div`
1743
1796
  display: flex;
1744
1797
  justify-content: flex-end;
1745
1798
  width: 100%;
@@ -1769,7 +1822,7 @@ var pulse3 = keyframes`
1769
1822
  transform: scale(1.1);
1770
1823
  }
1771
1824
  `;
1772
- var Container4 = styled4.div`
1825
+ var Container4 = styled8.div`
1773
1826
  display: inline-flex;
1774
1827
  align-items: center;
1775
1828
  gap: ${(props) => {
@@ -1785,7 +1838,7 @@ var Container4 = styled4.div`
1785
1838
  }};
1786
1839
  font-family: ${tokens.typography.fontFamily.primary};
1787
1840
  `;
1788
- var StatusDot = styled4.div`
1841
+ var StatusDot = styled8.div`
1789
1842
  width: ${(props) => {
1790
1843
  if (props.variant === "badge") {
1791
1844
  switch (props.size) {
@@ -1846,7 +1899,7 @@ var StatusDot = styled4.div`
1846
1899
  animation: ${(props) => props.status === "streaming" ? pulse3 : "none"} 2s ease-in-out infinite;
1847
1900
  flex-shrink: 0;
1848
1901
  `;
1849
- var Label = styled4.span`
1902
+ var Label = styled8.span`
1850
1903
  font-size: ${(props) => {
1851
1904
  if (props.variant === "badge") {
1852
1905
  switch (props.size) {
@@ -1873,7 +1926,7 @@ var Label = styled4.span`
1873
1926
  color: ${tokens.colors.text.secondary};
1874
1927
  line-height: ${tokens.typography.lineHeight.tight};
1875
1928
  `;
1876
- var BadgeContainer = styled4.div`
1929
+ var BadgeContainer = styled8.div`
1877
1930
  display: inline-flex;
1878
1931
  align-items: center;
1879
1932
  gap: ${(props) => {
@@ -1950,7 +2003,7 @@ var StreamStatusIndicator = ({
1950
2003
  return /* @__PURE__ */ jsx(Container4, { size, className, role: "status", "aria-label": getStatusLabel(status), children: content });
1951
2004
  };
1952
2005
  StreamStatusIndicator.displayName = "StreamStatusIndicator";
1953
- var HeaderContainer = styled4.header`
2006
+ var HeaderContainer = styled8.header`
1954
2007
  display: flex;
1955
2008
  align-items: center;
1956
2009
  justify-content: space-between;
@@ -1966,14 +2019,14 @@ var HeaderContainer = styled4.header`
1966
2019
  padding: ${tokens.spacing.sm} ${tokens.spacing.md};
1967
2020
  }
1968
2021
  `;
1969
- var HeaderContent = styled4.div`
2022
+ var HeaderContent = styled8.div`
1970
2023
  display: flex;
1971
2024
  flex-direction: column;
1972
2025
  gap: ${tokens.spacing.xs};
1973
2026
  flex: 1;
1974
2027
  min-width: 0;
1975
2028
  `;
1976
- var HeaderTitle = styled4.h1`
2029
+ var HeaderTitle = styled8.h1`
1977
2030
  margin: 0;
1978
2031
  font-size: ${tokens.typography.fontSize.base};
1979
2032
  font-weight: ${tokens.typography.fontWeight.semibold};
@@ -1984,7 +2037,7 @@ var HeaderTitle = styled4.h1`
1984
2037
  text-overflow: ellipsis;
1985
2038
  white-space: nowrap;
1986
2039
  `;
1987
- var HeaderSubtitle = styled4.p`
2040
+ var HeaderSubtitle = styled8.p`
1988
2041
  margin: 0;
1989
2042
  font-size: ${tokens.typography.fontSize.sm};
1990
2043
  color: ${tokens.colors.text.secondary};
@@ -1994,13 +2047,13 @@ var HeaderSubtitle = styled4.p`
1994
2047
  text-overflow: ellipsis;
1995
2048
  white-space: nowrap;
1996
2049
  `;
1997
- var HeaderActions = styled4.div`
2050
+ var HeaderActions = styled8.div`
1998
2051
  display: flex;
1999
2052
  align-items: center;
2000
2053
  gap: ${tokens.spacing.xs};
2001
2054
  margin-left: ${tokens.spacing.md};
2002
2055
  `;
2003
- var ActionButton2 = styled4.button`
2056
+ var ActionButton2 = styled8.button`
2004
2057
  display: inline-flex;
2005
2058
  align-items: center;
2006
2059
  justify-content: center;
@@ -2117,7 +2170,7 @@ var Header = ({
2117
2170
  ] });
2118
2171
  };
2119
2172
  Header.displayName = "Header";
2120
- var MessagesContainer = styled4.div`
2173
+ var MessagesContainer = styled8.div`
2121
2174
  display: flex;
2122
2175
  flex-direction: column;
2123
2176
  flex: 1;
@@ -2129,18 +2182,14 @@ var MessagesContainer = styled4.div`
2129
2182
  ${tokens.colors.background.darker},
2130
2183
  ${tokens.colors.background.darkest}
2131
2184
  );
2132
- padding: ${tokens.spacing.sm};
2133
- gap: ${tokens.spacing.md};
2185
+ /* Minimal horizontal padding to maximize message width */
2186
+ padding: ${tokens.spacing.sm} ${tokens.spacing.xs};
2187
+ gap: ${tokens.spacing.sm};
2134
2188
  box-sizing: border-box;
2135
2189
 
2136
2190
  /* Ensure proper scrolling behavior for child components */
2137
2191
  position: relative;
2138
2192
  min-height: 0;
2139
-
2140
- /* Desktop padding */
2141
- @media (min-width: ${tokens.breakpoints.mobile}px) {
2142
- padding: ${tokens.spacing.md};
2143
- }
2144
2193
  `;
2145
2194
  var Messages = ({
2146
2195
  children,
@@ -2150,7 +2199,7 @@ var Messages = ({
2150
2199
  return /* @__PURE__ */ jsx(MessagesContainer, { className, role: "region", "aria-label": ariaLabel, children });
2151
2200
  };
2152
2201
  Messages.displayName = "Messages";
2153
- var WindowContainer = styled4.div`
2202
+ var WindowContainer = styled8.div`
2154
2203
  display: flex;
2155
2204
  flex-direction: column;
2156
2205
  /* Glassmorphism effect */
@@ -2351,7 +2400,7 @@ var GlobalSidebarStyles = createGlobalStyle`
2351
2400
  }
2352
2401
  }
2353
2402
  `;
2354
- var StyledChatButton = styled4.button`
2403
+ var StyledChatButton = styled8.button`
2355
2404
  position: fixed;
2356
2405
  bottom: 8px;
2357
2406
  right: 8px;
@@ -2403,7 +2452,7 @@ var CustomCopilotSidebar = ({
2403
2452
  };
2404
2453
  return /* @__PURE__ */ jsx(Header, { title: "AI Assistant", subtitle: "How can I help you today?", onClose: handleClose });
2405
2454
  };
2406
- const WindowAdapter = (props) => {
2455
+ const WindowAdapter2 = (props) => {
2407
2456
  return /* @__PURE__ */ jsx(Window, { children: props.children });
2408
2457
  };
2409
2458
  const MessagesAdapter = (props) => {
@@ -2459,7 +2508,7 @@ var CustomCopilotSidebar = ({
2459
2508
  UserMessage: UserMessageAdapter,
2460
2509
  Input: InputAdapter,
2461
2510
  Header: HeaderAdapter,
2462
- Window: WindowAdapter,
2511
+ Window: WindowAdapter2,
2463
2512
  Messages: MessagesAdapter,
2464
2513
  Button: CustomButton,
2465
2514
  instructions,
@@ -2485,8 +2534,8 @@ var GlobalSidebarStyles2 = createGlobalStyle`
2485
2534
  /* Override CopilotKit's content wrapper to respect safe areas in landscape */
2486
2535
  @media (orientation: landscape) {
2487
2536
  .copilotKitSidebarContentWrapper {
2488
- right: env(safe-area-inset-right, 0px) !important;
2489
- left: env(safe-area-inset-left, 0px) !important;
2537
+ right: var(--safe-area-right, 0px) !important;
2538
+ left: var(--safe-area-left, 0px) !important;
2490
2539
  }
2491
2540
  }
2492
2541
 
@@ -2515,18 +2564,18 @@ var GlobalSidebarStyles2 = createGlobalStyle`
2515
2564
  /* Override CopilotKit defaults for mobile */
2516
2565
  position: fixed !important;
2517
2566
  /* TOP: Account for status bar safe area (Android notch/status bar) */
2518
- top: calc(${tokens.spacing.sm} + env(safe-area-inset-top, 0px)) !important;
2567
+ top: calc(${tokens.spacing.sm} + var(--safe-area-top, 0px)) !important;
2519
2568
  /* RIGHT: Account for landscape notch on right side */
2520
- right: calc(${tokens.spacing.sm} + env(safe-area-inset-right, 0px)) !important;
2569
+ right: calc(${tokens.spacing.sm} + var(--safe-area-right, 0px)) !important;
2521
2570
  /* BOTTOM: Account for horizontal navbar (52px) + safe area for Android nav buttons */
2522
- bottom: calc(52px + ${tokens.spacing.sm} + env(safe-area-inset-bottom, 0px)) !important;
2571
+ bottom: calc(52px + ${tokens.spacing.sm} + var(--safe-area-bottom, 0px)) !important;
2523
2572
  /* LEFT: Account for landscape notch on left side */
2524
- left: calc(${tokens.spacing.sm} + env(safe-area-inset-left, 0px)) !important;
2525
- width: calc(100vw - ${tokens.spacing.lg} - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)) !important;
2573
+ left: calc(${tokens.spacing.sm} + var(--safe-area-left, 0px)) !important;
2574
+ width: calc(100vw - ${tokens.spacing.lg} - var(--safe-area-left, 0px) - var(--safe-area-right, 0px)) !important;
2526
2575
  /* Adjust height to account for top, bottom safe areas, and navbar */
2527
- height: calc(100vh - ${tokens.spacing.lg} - env(safe-area-inset-top, 0px) - 52px - env(safe-area-inset-bottom, 0px)) !important;
2528
- max-width: calc(100vw - ${tokens.spacing.lg} - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)) !important;
2529
- max-height: calc(100vh - ${tokens.spacing.lg} - env(safe-area-inset-top, 0px) - 52px - env(safe-area-inset-bottom, 0px)) !important;
2576
+ height: calc(100vh - ${tokens.spacing.lg} - var(--safe-area-top, 0px) - 52px - var(--safe-area-bottom, 0px)) !important;
2577
+ max-width: calc(100vw - ${tokens.spacing.lg} - var(--safe-area-left, 0px) - var(--safe-area-right, 0px)) !important;
2578
+ max-height: calc(100vh - ${tokens.spacing.lg} - var(--safe-area-top, 0px) - 52px - var(--safe-area-bottom, 0px)) !important;
2530
2579
  margin: 0 !important;
2531
2580
  border-radius: ${tokens.borderRadius.xl} !important;
2532
2581
 
@@ -2563,17 +2612,115 @@ var GlobalSidebarStyles2 = createGlobalStyle`
2563
2612
  .copilotKitSidebar [role="dialog"] {
2564
2613
  inset: auto !important;
2565
2614
  /* TOP: Account for status bar safe area */
2566
- top: calc(${tokens.spacing.sm} + env(safe-area-inset-top, 0px)) !important;
2615
+ top: calc(${tokens.spacing.sm} + var(--safe-area-top, 0px)) !important;
2567
2616
  /* RIGHT: Account for landscape notch on right side */
2568
- right: calc(${tokens.spacing.sm} + env(safe-area-inset-right, 0px)) !important;
2617
+ right: calc(${tokens.spacing.sm} + var(--safe-area-right, 0px)) !important;
2569
2618
  /* BOTTOM: Account for horizontal navbar (52px) + safe area */
2570
- bottom: calc(52px + ${tokens.spacing.sm} + env(safe-area-inset-bottom, 0px)) !important;
2619
+ bottom: calc(52px + ${tokens.spacing.sm} + var(--safe-area-bottom, 0px)) !important;
2571
2620
  left: auto !important;
2572
2621
  width: 28rem !important;
2573
2622
  /* Adjust height to account for top, bottom safe areas, and navbar */
2574
- height: calc(100vh - ${tokens.spacing.lg} - env(safe-area-inset-top, 0px) - 52px - env(safe-area-inset-bottom, 0px)) !important;
2623
+ height: calc(100vh - ${tokens.spacing.lg} - var(--safe-area-top, 0px) - 52px - var(--safe-area-bottom, 0px)) !important;
2575
2624
  max-width: 28rem !important;
2576
- max-height: calc(100vh - ${tokens.spacing.lg} - env(safe-area-inset-top, 0px) - 52px - env(safe-area-inset-bottom, 0px)) !important;
2625
+ max-height: calc(100vh - ${tokens.spacing.lg} - var(--safe-area-top, 0px) - 52px - var(--safe-area-bottom, 0px)) !important;
2626
+ }
2627
+ }
2628
+
2629
+ /* Mobile landscape: sidebar on right side, allow background interaction */
2630
+ @media (orientation: landscape) and (max-height: 500px) {
2631
+ /* Account for vertical nav (60px) in landscape */
2632
+ .copilotKitSidebarContentWrapper {
2633
+ left: 60px !important;
2634
+ width: calc(100% - 60px) !important;
2635
+ }
2636
+
2637
+ /* Shrink the sidebar container to only cover the right portion where dialog lives */
2638
+ /* Also stretch to full height (remove default 8px padding) */
2639
+ .copilotKitSidebar {
2640
+ top: 0 !important;
2641
+ bottom: 0 !important;
2642
+ left: 58vw !important;
2643
+ width: min(50vw, 22rem) !important;
2644
+ height: 100vh !important;
2645
+ }
2646
+
2647
+ /* Offset the expanded sidebar wrapper to leave space for main content */
2648
+ .copilotKitSidebarContentWrapper.sidebarExpanded {
2649
+ margin-right: 30vw !important;
2650
+ }
2651
+
2652
+ .copilotKitSidebar [role="dialog"] {
2653
+ width: min(50vw, 20rem) !important;
2654
+ max-width: min(50vw, 20rem) !important;
2655
+ left: auto !important;
2656
+ right: 1.5rem !important;
2657
+ /* Use top/bottom ONLY - let browser calculate height (more reliable than explicit height) */
2658
+ top: var(--safe-area-top, 0px) !important;
2659
+ bottom: calc(52px + var(--safe-area-bottom, 0px)) !important;
2660
+ /* Remove explicit height - let top/bottom define it */
2661
+ height: auto !important;
2662
+ max-height: none !important;
2663
+ /* Remove margins */
2664
+ margin: 0 !important;
2665
+ border-radius: 0 !important;
2666
+ border-top-left-radius: ${tokens.borderRadius.xl} !important;
2667
+ border-bottom-left-radius: ${tokens.borderRadius.xl} !important;
2668
+ }
2669
+
2670
+ /* Compact header in landscape - hide title text but keep close button */
2671
+ .copilotKitSidebar [role="dialog"] header,
2672
+ .copilotKitSidebar [role="dialog"] [data-testid="chat-header"],
2673
+ .copilotKitSidebar [role="dialog"] > div:first-child {
2674
+ padding: 0.25rem 0.5rem !important;
2675
+ min-height: auto !important;
2676
+ height: 1.5rem;
2677
+ padding-right: 1.5rem !important;
2678
+ }
2679
+
2680
+ /* Hide the title text but keep close button visible */
2681
+ .copilotKitSidebar [role="dialog"] header h1,
2682
+ .copilotKitSidebar [role="dialog"] header h2,
2683
+ .copilotKitSidebar [role="dialog"] header span:not(:last-child),
2684
+ .copilotKitSidebar [role="dialog"] > div:first-child > span,
2685
+ .copilotKitSidebar [role="dialog"] > div:first-child > h1,
2686
+ .copilotKitSidebar [role="dialog"] > div:first-child > h2 {
2687
+ display: none !important;
2688
+ }
2689
+
2690
+ /* Reduce vertical padding inside chat to preserve space in landscape */
2691
+ .copilotKitMessages {
2692
+ padding: ${tokens.spacing.xs} ${tokens.spacing.sm} !important;
2693
+ }
2694
+
2695
+ .copilotKitMessage {
2696
+ padding: ${tokens.spacing.xs} 0 !important;
2697
+ margin: ${tokens.spacing.xs} 0 !important;
2698
+ }
2699
+
2700
+ /* Compact input area in landscape */
2701
+ .copilotKitInput,
2702
+ .copilotKitSidebar [role="dialog"] > div:last-child {
2703
+ padding: ${tokens.spacing.xs} ${tokens.spacing.sm} !important;
2704
+ }
2705
+
2706
+ /* Reduce gap between messages */
2707
+ .copilotKitMessages > div {
2708
+ gap: 0.25rem !important;
2709
+ padding-bottom: 0;
2710
+ margin-bottom: -3rem;
2711
+ }
2712
+
2713
+ /* Compact suggested prompts in landscape */
2714
+ div[role="list"][aria-label*="Suggested"] {
2715
+ margin: 0 !important;
2716
+ padding: 1px !important;
2717
+ min-height: auto !important;
2718
+ max-height: 32px !important;
2719
+ }
2720
+
2721
+ /* Compact parent of suggestions (input area) */
2722
+ .copilotKitSidebar [role="dialog"] > div:last-child {
2723
+ padding: 1px !important;
2577
2724
  }
2578
2725
  }
2579
2726
 
@@ -2663,10 +2810,10 @@ var GlobalSidebarStyles2 = createGlobalStyle`
2663
2810
  box-shadow: none !important;
2664
2811
  }
2665
2812
  `;
2666
- var StyledChatButton2 = styled4.button`
2813
+ var StyledChatButton2 = styled8.button`
2667
2814
  position: fixed;
2668
- bottom: calc(${tokens.spacing.sm} + env(safe-area-inset-bottom, 0px));
2669
- right: calc(${tokens.spacing.sm} + env(safe-area-inset-right, 0px));
2815
+ bottom: calc(${tokens.spacing.sm} + var(--safe-area-bottom, 0px));
2816
+ right: calc(${tokens.spacing.sm} + var(--safe-area-right, 0px));
2670
2817
  width: 36px;
2671
2818
  height: 36px;
2672
2819
  border-radius: ${tokens.borderRadius.full};
@@ -2697,17 +2844,11 @@ var StyledChatButton2 = styled4.button`
2697
2844
  fill: ${tokens.colors.text.primary};
2698
2845
  }
2699
2846
  `;
2700
- function CustomCopilotSidebar2({
2701
- children,
2702
- defaultOpen = false,
2703
- onSetOpen,
2704
- instructions,
2705
- className,
2706
- disabled = false,
2707
- disabledReason = "Start a free trial to enable AI chat",
2708
- onError,
2709
- renderError
2710
- }) {
2847
+ var WindowAdapter = (props) => {
2848
+ return /* @__PURE__ */ jsx(Window, { children: props.children });
2849
+ };
2850
+ WindowAdapter.displayName = "WindowAdapter";
2851
+ function createHeaderAdapter(onSetOpen) {
2711
2852
  const HeaderAdapterWithClose = (_props) => {
2712
2853
  const { setOpen } = useChatContext();
2713
2854
  const handleClose = () => {
@@ -2716,9 +2857,10 @@ function CustomCopilotSidebar2({
2716
2857
  };
2717
2858
  return /* @__PURE__ */ jsx(Header, { title: "AI Assistant", onClose: handleClose });
2718
2859
  };
2719
- const WindowAdapterLocal = (props) => {
2720
- return /* @__PURE__ */ jsx(Window, { children: props.children });
2721
- };
2860
+ HeaderAdapterWithClose.displayName = "HeaderAdapterWithClose";
2861
+ return HeaderAdapterWithClose;
2862
+ }
2863
+ function createButtonAdapter(disabled, disabledReason, onSetOpen) {
2722
2864
  const CustomButton = (_props) => {
2723
2865
  const { open, setOpen } = useChatContext();
2724
2866
  const handleClick = () => {
@@ -2755,16 +2897,44 @@ function CustomCopilotSidebar2({
2755
2897
  }
2756
2898
  );
2757
2899
  };
2900
+ CustomButton.displayName = "CustomButton";
2901
+ return CustomButton;
2902
+ }
2903
+ function CustomCopilotSidebar2({
2904
+ children,
2905
+ defaultOpen = false,
2906
+ onSetOpen,
2907
+ instructions,
2908
+ className,
2909
+ disabled = false,
2910
+ disabledReason = "Start a free trial to enable AI chat",
2911
+ onError,
2912
+ renderError,
2913
+ ThinkingIndicator,
2914
+ ToolCallsComponent
2915
+ }) {
2916
+ const HeaderAdapterWithClose = useMemo(
2917
+ () => createHeaderAdapter(onSetOpen),
2918
+ [onSetOpen]
2919
+ );
2920
+ const CustomButton = useMemo(
2921
+ () => createButtonAdapter(disabled, disabledReason, onSetOpen),
2922
+ [disabled, disabledReason, onSetOpen]
2923
+ );
2924
+ const AssistantMessageAdapterMemo = useMemo(
2925
+ () => ThinkingIndicator || ToolCallsComponent ? createAssistantMessageAdapter(ThinkingIndicator, ToolCallsComponent) : AssistantMessageAdapter,
2926
+ [ThinkingIndicator, ToolCallsComponent]
2927
+ );
2758
2928
  return /* @__PURE__ */ jsxs(Fragment, { children: [
2759
2929
  /* @__PURE__ */ jsx(GlobalSidebarStyles2, {}),
2760
2930
  /* @__PURE__ */ jsx(
2761
2931
  CopilotSidebar,
2762
2932
  {
2763
- AssistantMessage: AssistantMessageAdapter,
2933
+ AssistantMessage: AssistantMessageAdapterMemo,
2764
2934
  UserMessage: UserMessageAdapter,
2765
2935
  Input: InputAdapter,
2766
2936
  Header: HeaderAdapterWithClose,
2767
- Window: WindowAdapterLocal,
2937
+ Window: WindowAdapter,
2768
2938
  Button: CustomButton,
2769
2939
  RenderActionExecutionMessage: ActionExecutionAdapter,
2770
2940
  instructions,
@@ -2785,7 +2955,7 @@ function CustomCopilotSidebar2({
2785
2955
  ] });
2786
2956
  }
2787
2957
  CustomCopilotSidebar2.displayName = "CustomCopilotSidebar";
2788
- var FooterContainer = styled4.footer`
2958
+ var FooterContainer = styled8.footer`
2789
2959
  display: flex;
2790
2960
  align-items: center;
2791
2961
  justify-content: center;
@@ -2794,7 +2964,7 @@ var FooterContainer = styled4.footer`
2794
2964
  border-top: 1px solid ${tokens.colors.border.default};
2795
2965
  min-height: 44px;
2796
2966
  `;
2797
- var FooterContent = styled4.div`
2967
+ var FooterContent = styled8.div`
2798
2968
  display: flex;
2799
2969
  align-items: center;
2800
2970
  justify-content: space-between;
@@ -2807,13 +2977,13 @@ var FooterContent = styled4.div`
2807
2977
  font-family: ${tokens.typography.fontFamily.primary};
2808
2978
  line-height: ${tokens.typography.lineHeight.tight};
2809
2979
  `;
2810
- var FooterBranding = styled4.div`
2980
+ var FooterBranding = styled8.div`
2811
2981
  display: flex;
2812
2982
  align-items: center;
2813
2983
  gap: ${tokens.spacing.xs};
2814
2984
  flex-shrink: 0;
2815
2985
  `;
2816
- var FooterStatus = styled4.div`
2986
+ var FooterStatus = styled8.div`
2817
2987
  display: flex;
2818
2988
  align-items: center;
2819
2989
  gap: ${tokens.spacing.xs};
@@ -2823,7 +2993,7 @@ var FooterStatus = styled4.div`
2823
2993
  font-size: ${tokens.typography.fontSize.xs};
2824
2994
  opacity: 0.8;
2825
2995
  `;
2826
- var FooterLink = styled4.a`
2996
+ var FooterLink = styled8.a`
2827
2997
  color: ${tokens.colors.primary};
2828
2998
  text-decoration: none;
2829
2999
  transition: opacity ${tokens.transitions.fast};
@@ -2871,13 +3041,13 @@ var Footer = ({
2871
3041
  ] }) });
2872
3042
  };
2873
3043
  Footer.displayName = "Footer";
2874
- var InputContainer = styled4.div`
3044
+ var InputContainer = styled8.div`
2875
3045
  display: flex;
2876
3046
  flex-direction: column;
2877
3047
  width: 100%;
2878
3048
  position: relative;
2879
3049
  `;
2880
- var InputWrapper2 = styled4.div`
3050
+ var InputWrapper2 = styled8.div`
2881
3051
  display: flex;
2882
3052
  align-items: flex-end;
2883
3053
  gap: ${tokens.spacing.sm};
@@ -2897,7 +3067,7 @@ var InputWrapper2 = styled4.div`
2897
3067
  border-color: ${tokens.colors.border.subtle};
2898
3068
  }
2899
3069
  `;
2900
- var TextArea = styled4.textarea`
3070
+ var TextArea = styled8.textarea`
2901
3071
  flex: 1;
2902
3072
  min-height: ${tokens.spacing.lg};
2903
3073
  max-height: ${(props) => `${(props.$maxRows || 5) * 24}px`};
@@ -2943,7 +3113,7 @@ var TextArea = styled4.textarea`
2943
3113
  background: ${tokens.colors.scrollbar.thumbHover};
2944
3114
  }
2945
3115
  `;
2946
- var SendButton = styled4.button`
3116
+ var SendButton = styled8.button`
2947
3117
  display: flex;
2948
3118
  align-items: center;
2949
3119
  justify-content: center;
@@ -3073,7 +3243,7 @@ var Input = ({
3073
3243
  )
3074
3244
  ] }) });
3075
3245
  };
3076
- var MessagesListContainer = styled4.div`
3246
+ var MessagesListContainer = styled8.div`
3077
3247
  display: flex;
3078
3248
  flex-direction: column;
3079
3249
  width: 100%;
@@ -3113,7 +3283,7 @@ var MessagesListContainer = styled4.div`
3113
3283
  /* Ensure proper rendering on mobile */
3114
3284
  -webkit-overflow-scrolling: touch;
3115
3285
  `;
3116
- var MessagesListContent = styled4.div`
3286
+ var MessagesListContent = styled8.div`
3117
3287
  display: flex;
3118
3288
  flex-direction: column;
3119
3289
  gap: ${tokens.spacing.sm};
@@ -3229,19 +3399,19 @@ var MessagesList = ({
3229
3399
  }
3230
3400
  );
3231
3401
  };
3232
- var StyledUserMessage2 = styled4.div`
3402
+ var StyledUserMessage2 = styled8.div`
3233
3403
  display: flex;
3234
3404
  justify-content: flex-end;
3235
3405
  align-items: flex-start;
3236
- margin: ${tokens.spacing.sm} 0;
3237
- padding: 0 ${tokens.spacing.md};
3406
+ margin: ${tokens.spacing.xs} 0;
3407
+ padding: 0;
3238
3408
  width: 100%;
3239
3409
  `;
3240
- var MessageBubble = styled4.div`
3410
+ var MessageBubble = styled8.div`
3241
3411
  display: flex;
3242
3412
  flex-direction: column;
3243
- max-width: 70%;
3244
- padding: ${tokens.spacing.sm} ${tokens.spacing.md};
3413
+ max-width: 85%;
3414
+ padding: ${tokens.spacing.sm};
3245
3415
  border-radius: ${tokens.borderRadius.lg};
3246
3416
 
3247
3417
  /* User message colors - dark blue from brand */
@@ -3264,7 +3434,7 @@ var MessageBubble = styled4.div`
3264
3434
  opacity: 0.9;
3265
3435
  }
3266
3436
  `;
3267
- var MessageContent2 = styled4.p`
3437
+ var MessageContent2 = styled8.p`
3268
3438
  margin: 0;
3269
3439
  font-size: ${tokens.typography.fontSize.sm};
3270
3440
  line-height: ${tokens.typography.lineHeight.normal};
@@ -3273,13 +3443,13 @@ var MessageContent2 = styled4.p`
3273
3443
  word-break: break-word;
3274
3444
  white-space: pre-wrap;
3275
3445
  `;
3276
- var MessageTime2 = styled4.time`
3446
+ var MessageTime2 = styled8.time`
3277
3447
  font-size: ${tokens.typography.fontSize.xs};
3278
3448
  opacity: 0.7;
3279
3449
  margin-top: ${tokens.spacing.xs};
3280
3450
  text-align: right;
3281
3451
  `;
3282
- var ActionButton3 = styled4.button`
3452
+ var ActionButton3 = styled8.button`
3283
3453
  display: inline-flex;
3284
3454
  align-items: center;
3285
3455
  gap: ${tokens.spacing.xs};
@@ -3303,12 +3473,12 @@ var ActionButton3 = styled4.button`
3303
3473
  transform: scale(0.98);
3304
3474
  }
3305
3475
  `;
3306
- var ActionsContainer3 = styled4.div`
3476
+ var ActionsContainer3 = styled8.div`
3307
3477
  display: flex;
3308
3478
  gap: ${tokens.spacing.xs};
3309
3479
  flex-wrap: wrap;
3310
3480
  `;
3311
- var StreamingIndicator2 = styled4.span`
3481
+ var StreamingIndicator2 = styled8.span`
3312
3482
  display: inline-block;
3313
3483
  width: ${tokens.spacing.xs};
3314
3484
  height: ${tokens.spacing.xs};
@@ -3329,7 +3499,7 @@ var StreamingIndicator2 = styled4.span`
3329
3499
  }
3330
3500
  }
3331
3501
  `;
3332
- var Avatar3 = styled4.img`
3502
+ var Avatar3 = styled8.img`
3333
3503
  width: ${tokens.spacing.xl};
3334
3504
  height: ${tokens.spacing.xl};
3335
3505
  border-radius: ${tokens.borderRadius.full};
@@ -3362,7 +3532,7 @@ var UserMessage2 = ({
3362
3532
  avatarUrl && /* @__PURE__ */ jsx(Avatar3, { src: avatarUrl, alt: username || "User" })
3363
3533
  ] });
3364
3534
  };
3365
- var ErrorContainer = styled4.div`
3535
+ var ErrorContainer = styled8.div`
3366
3536
  display: flex;
3367
3537
  align-items: flex-start;
3368
3538
  gap: ${tokens.spacing.sm};
@@ -3376,7 +3546,7 @@ var ErrorContainer = styled4.div`
3376
3546
  width: ${(props) => props.variant === "banner" ? "100%" : "auto"};
3377
3547
  max-width: ${(props) => props.variant === "banner" ? "100%" : "600px"};
3378
3548
  `;
3379
- var IconContainer = styled4.div`
3549
+ var IconContainer = styled8.div`
3380
3550
  flex-shrink: 0;
3381
3551
  width: 20px;
3382
3552
  height: 20px;
@@ -3393,29 +3563,29 @@ var ErrorIcon = () => /* @__PURE__ */ jsx(
3393
3563
  children: /* @__PURE__ */ jsx("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z" })
3394
3564
  }
3395
3565
  );
3396
- var Content2 = styled4.div`
3566
+ var Content2 = styled8.div`
3397
3567
  flex: 1;
3398
3568
  display: flex;
3399
3569
  flex-direction: column;
3400
3570
  gap: ${tokens.spacing.sm};
3401
3571
  `;
3402
- var ErrorMessage = styled4.div`
3572
+ var ErrorMessage = styled8.div`
3403
3573
  font-size: ${tokens.typography.fontSize.sm};
3404
3574
  line-height: ${tokens.typography.lineHeight.normal};
3405
3575
  color: ${tokens.colors.text.primary};
3406
3576
  `;
3407
- var ErrorDetails = styled4.div`
3577
+ var ErrorDetails = styled8.div`
3408
3578
  font-size: ${tokens.typography.fontSize.xs};
3409
3579
  line-height: 1.4;
3410
3580
  color: ${tokens.colors.text.secondary};
3411
3581
  margin-top: ${tokens.spacing.xs};
3412
3582
  `;
3413
- var Actions2 = styled4.div`
3583
+ var Actions2 = styled8.div`
3414
3584
  display: flex;
3415
3585
  gap: ${tokens.spacing.sm};
3416
3586
  margin-top: ${tokens.spacing.sm};
3417
3587
  `;
3418
- var Button2 = styled4.button`
3588
+ var Button2 = styled8.button`
3419
3589
  display: inline-flex;
3420
3590
  align-items: center;
3421
3591
  gap: ${tokens.spacing.xs};
@@ -3444,7 +3614,7 @@ var Button2 = styled4.button`
3444
3614
  cursor: not-allowed;
3445
3615
  }
3446
3616
  `;
3447
- var CloseButton = styled4.button`
3617
+ var CloseButton = styled8.button`
3448
3618
  flex-shrink: 0;
3449
3619
  width: 24px;
3450
3620
  height: 24px;
@@ -3503,7 +3673,7 @@ var StreamErrorMessage = ({
3503
3673
  ] });
3504
3674
  };
3505
3675
  StreamErrorMessage.displayName = "StreamErrorMessage";
3506
- var SuggestionsContainer = styled4.div`
3676
+ var SuggestionsContainer = styled8.div`
3507
3677
  display: flex;
3508
3678
  flex-wrap: nowrap; /* Single row */
3509
3679
  gap: ${tokens.spacing.sm};
@@ -3536,7 +3706,7 @@ var SuggestionsContainer = styled4.div`
3536
3706
  display: none; /* Chrome/Safari/Opera */
3537
3707
  }
3538
3708
  `;
3539
- var StyledSuggestion = styled4.button`
3709
+ var StyledSuggestion = styled8.button`
3540
3710
  /* Base styles */
3541
3711
  display: inline-flex;
3542
3712
  align-items: center;