@copilotz/chat-ui 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -30,15 +30,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ AgentBadge: () => AgentBadge,
33
34
  ChatHeader: () => ChatHeader,
34
35
  ChatInput: () => ChatInput,
35
36
  ChatUI: () => ChatUI,
36
37
  ChatUserContextProvider: () => ChatUserContextProvider,
37
38
  Message: () => Message,
39
+ ParticipantsSelector: () => ParticipantsSelector,
38
40
  Sidebar: () => Sidebar2,
41
+ TargetAgentSelector: () => TargetAgentSelector,
39
42
  ThreadManager: () => ThreadManager,
40
43
  UserMenu: () => UserMenu,
41
44
  UserProfile: () => UserProfile,
45
+ assignAgentColors: () => assignAgentColors,
42
46
  chatConfigPresets: () => chatConfigPresets,
43
47
  chatUtils: () => chatUtils,
44
48
  cn: () => cn,
@@ -47,6 +51,8 @@ __export(index_exports, {
47
51
  defaultChatConfig: () => defaultChatConfig,
48
52
  featureFlags: () => featureFlags,
49
53
  formatDate: () => formatDate,
54
+ getAgentColor: () => getAgentColor,
55
+ getAgentInitials: () => getAgentInitials,
50
56
  mergeConfig: () => mergeConfig,
51
57
  themeUtils: () => themeUtils,
52
58
  useChatUserContext: () => useChatUserContext,
@@ -55,7 +61,7 @@ __export(index_exports, {
55
61
  module.exports = __toCommonJS(index_exports);
56
62
 
57
63
  // src/components/chat/ChatUI.tsx
58
- var import_react7 = require("react");
64
+ var import_react8 = require("react");
59
65
  var import_react_virtual = require("@tanstack/react-virtual");
60
66
 
61
67
  // src/config/chatConfig.ts
@@ -352,6 +358,75 @@ var import_react_markdown = __toESM(require("react-markdown"), 1);
352
358
  var import_remark_gfm = __toESM(require("remark-gfm"), 1);
353
359
  var import_rehype_highlight = __toESM(require("rehype-highlight"), 1);
354
360
 
361
+ // src/lib/chatUtils.ts
362
+ var chatUtils = {
363
+ generateId: () => globalThis.crypto?.randomUUID?.() ?? `id-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`,
364
+ generateMessageId: () => chatUtils.generateId(),
365
+ generateThreadId: () => chatUtils.generateId(),
366
+ createMessage: (role, content, attachments) => ({
367
+ id: chatUtils.generateMessageId(),
368
+ role,
369
+ content,
370
+ timestamp: Date.now(),
371
+ attachments,
372
+ isComplete: true
373
+ }),
374
+ createThread: (title) => ({
375
+ id: chatUtils.generateThreadId(),
376
+ title,
377
+ createdAt: Date.now(),
378
+ updatedAt: Date.now(),
379
+ messageCount: 0
380
+ }),
381
+ generateThreadTitle: (firstMessage) => {
382
+ const cleaned = firstMessage.replace(/[^\w\s]/g, "").trim();
383
+ const words = cleaned.split(/\s+/).slice(0, 6);
384
+ return words.join(" ") || "Nova Conversa";
385
+ }
386
+ };
387
+ var AGENT_COLORS = [
388
+ "#6366f1",
389
+ // indigo
390
+ "#8b5cf6",
391
+ // violet
392
+ "#ec4899",
393
+ // pink
394
+ "#f59e0b",
395
+ // amber
396
+ "#10b981",
397
+ // emerald
398
+ "#3b82f6",
399
+ // blue
400
+ "#ef4444",
401
+ // red
402
+ "#14b8a6",
403
+ // teal
404
+ "#f97316",
405
+ // orange
406
+ "#84cc16"
407
+ // lime
408
+ ];
409
+ function getAgentColor(agentId) {
410
+ let hash = 0;
411
+ for (let i = 0; i < agentId.length; i++) {
412
+ hash = (hash << 5) - hash + agentId.charCodeAt(i) | 0;
413
+ }
414
+ return AGENT_COLORS[Math.abs(hash) % AGENT_COLORS.length];
415
+ }
416
+ function getAgentInitials(name) {
417
+ const parts = name.trim().split(/\s+/);
418
+ if (parts.length >= 2) {
419
+ return (parts[0][0] + parts[1][0]).toUpperCase();
420
+ }
421
+ return name.slice(0, 2).toUpperCase();
422
+ }
423
+ function assignAgentColors(agents) {
424
+ return agents.map((agent) => ({
425
+ ...agent,
426
+ color: agent.color || getAgentColor(agent.id)
427
+ }));
428
+ }
429
+
355
430
  // src/components/ui/button.tsx
356
431
  var import_react_slot = require("@radix-ui/react-slot");
357
432
  var import_class_variance_authority = require("class-variance-authority");
@@ -1020,13 +1095,20 @@ var Message = (0, import_react.memo)(({
1020
1095
  markdown,
1021
1096
  isExpanded = false,
1022
1097
  onToggleExpanded,
1023
- isGrouped = false
1098
+ isGrouped = false,
1099
+ agentOptions = []
1024
1100
  }) => {
1025
1101
  const [isEditing, setIsEditing] = (0, import_react.useState)(false);
1026
1102
  const [editContent, setEditContent] = (0, import_react.useState)(message.content);
1027
1103
  const [showActions, setShowActions] = (0, import_react.useState)(false);
1028
1104
  const [copied, setCopied] = (0, import_react.useState)(false);
1029
1105
  const messageIsUser = isUser ?? message.role === "user";
1106
+ const agentSender = !messageIsUser && message.senderAgentId ? agentOptions.find(
1107
+ (a) => a.id === message.senderAgentId || a.name.toLowerCase() === (message.senderAgentId ?? "").toLowerCase() || a.name.toLowerCase() === (message.senderName ?? "").toLowerCase()
1108
+ ) : void 0;
1109
+ const isMultiAgent = agentOptions.length > 1;
1110
+ const resolvedAssistantName = isMultiAgent && (agentSender?.name || message.senderName) || assistantName;
1111
+ const agentColor = agentSender ? agentSender.color || getAgentColor(agentSender.id) : void 0;
1030
1112
  const canEdit = enableEdit && messageIsUser;
1031
1113
  const canRegenerate = enableRegenerate && !messageIsUser;
1032
1114
  const normalizedPreviewChars = Math.max(longMessagePreviewChars, 1);
@@ -1090,9 +1172,26 @@ var Message = (0, import_react.memo)(({
1090
1172
  showAvatar && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: `flex-shrink-0 ${compactMode ? "mt-1" : "mt-0"}`, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Avatar, { className: compactMode ? "h-6 w-6" : "h-8 w-8", children: messageIsUser ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1091
1173
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AvatarImage, { src: userAvatar, alt: userName }),
1092
1174
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AvatarFallback, { className: "bg-primary text-primary-foreground", children: userName.charAt(0).toUpperCase() })
1175
+ ] }) : agentSender ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
1176
+ agentSender.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AvatarImage, { src: agentSender.avatarUrl, alt: agentSender.name }) : null,
1177
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1178
+ AvatarFallback,
1179
+ {
1180
+ style: agentColor ? { backgroundColor: agentColor, color: "white" } : void 0,
1181
+ className: agentColor ? "text-[10px]" : "bg-secondary text-secondary-foreground",
1182
+ children: getAgentInitials(agentSender.name)
1183
+ }
1184
+ )
1093
1185
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: assistantAvatar || /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AvatarFallback, { className: "bg-secondary text-secondary-foreground", children: "AI" }) }) }) }),
1094
1186
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `flex items-center gap-2 mb-1 ${messageIsUser ? "flex-row-reverse" : "flex-row"}`, children: [
1095
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: `font-medium ${compactMode ? "text-sm" : "text-base"}`, children: messageIsUser ? userName : assistantName }),
1187
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1188
+ "span",
1189
+ {
1190
+ className: `font-medium ${compactMode ? "text-sm" : "text-base"}`,
1191
+ style: !messageIsUser && agentColor ? { color: agentColor } : void 0,
1192
+ children: messageIsUser ? userName : resolvedAssistantName
1193
+ }
1194
+ ),
1096
1195
  showTimestamp && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-xs text-muted-foreground", children: formatTime(message.timestamp) }),
1097
1196
  message.isEdited && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { variant: "outline", className: "text-xs", children: "editado" })
1098
1197
  ] })
@@ -2652,9 +2751,238 @@ var Sidebar2 = ({
2652
2751
  };
2653
2752
 
2654
2753
  // src/components/chat/ChatHeader.tsx
2655
- var import_react3 = __toESM(require("react"), 1);
2754
+ var import_react4 = __toESM(require("react"), 1);
2755
+ var import_lucide_react9 = require("lucide-react");
2756
+
2757
+ // src/components/chat/AgentSelectors.tsx
2758
+ var import_react3 = require("react");
2656
2759
  var import_lucide_react8 = require("lucide-react");
2657
2760
  var import_jsx_runtime18 = require("react/jsx-runtime");
2761
+ var ParticipantsSelector = (0, import_react3.memo)(({
2762
+ agents,
2763
+ participantIds,
2764
+ onParticipantsChange,
2765
+ label = "Team",
2766
+ maxVisible = 3,
2767
+ disabled = false
2768
+ }) => {
2769
+ const agentsWithColors = (0, import_react3.useMemo)(() => assignAgentColors(agents), [agents]);
2770
+ const selectedAgents = (0, import_react3.useMemo)(
2771
+ () => agentsWithColors.filter((a) => participantIds.includes(a.id)),
2772
+ [agentsWithColors, participantIds]
2773
+ );
2774
+ const toggleParticipant = (agentId) => {
2775
+ if (participantIds.includes(agentId)) {
2776
+ if (participantIds.length > 1) {
2777
+ onParticipantsChange(participantIds.filter((id) => id !== agentId));
2778
+ }
2779
+ } else {
2780
+ onParticipantsChange([...participantIds, agentId]);
2781
+ }
2782
+ };
2783
+ const selectAll = () => {
2784
+ onParticipantsChange(agentsWithColors.map((a) => a.id));
2785
+ };
2786
+ const visibleAgents = selectedAgents.slice(0, maxVisible);
2787
+ const hiddenCount = selectedAgents.length - maxVisible;
2788
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenu, { children: [
2789
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2790
+ Button,
2791
+ {
2792
+ variant: "ghost",
2793
+ className: "h-9 px-2 gap-1.5 text-sm hover:bg-accent/50",
2794
+ disabled,
2795
+ children: [
2796
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Users, { className: "h-4 w-4 text-muted-foreground" }),
2797
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex items-center gap-1", children: visibleAgents.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
2798
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex -space-x-1.5", children: visibleAgents.map((agent) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Avatar, { className: "h-5 w-5 border-2 border-background", children: [
2799
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
2800
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2801
+ AvatarFallback,
2802
+ {
2803
+ style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
2804
+ className: "text-[8px]",
2805
+ children: getAgentInitials(agent.name)
2806
+ }
2807
+ )
2808
+ ] }, agent.id)) }),
2809
+ hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
2810
+ "+",
2811
+ hiddenCount
2812
+ ] })
2813
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-muted-foreground", children: label }) }),
2814
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.ChevronDown, { className: "h-3 w-3 opacity-50" })
2815
+ ]
2816
+ }
2817
+ ) }),
2818
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenuContent, { align: "start", className: "w-[260px]", children: [
2819
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenuLabel, { className: "flex items-center justify-between", children: [
2820
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Participants" }),
2821
+ selectedAgents.length < agentsWithColors.length && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "ghost", size: "sm", className: "h-6 text-xs", onClick: selectAll, children: "Select All" })
2822
+ ] }),
2823
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuSeparator, {}),
2824
+ agentsWithColors.map((agent) => {
2825
+ const isSelected = participantIds.includes(agent.id);
2826
+ const isLastSelected = isSelected && participantIds.length === 1;
2827
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2828
+ DropdownMenuItem,
2829
+ {
2830
+ onClick: () => toggleParticipant(agent.id),
2831
+ className: "flex items-center gap-3 p-2 cursor-pointer",
2832
+ disabled: isLastSelected,
2833
+ children: [
2834
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Avatar, { className: "h-6 w-6", children: [
2835
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
2836
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2837
+ AvatarFallback,
2838
+ {
2839
+ style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
2840
+ className: "text-[10px]",
2841
+ children: getAgentInitials(agent.name)
2842
+ }
2843
+ )
2844
+ ] }),
2845
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex-1 min-w-0", children: [
2846
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "font-medium text-sm truncate", children: agent.name }),
2847
+ agent.description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "text-xs text-muted-foreground truncate", children: agent.description })
2848
+ ] }),
2849
+ isSelected && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Check, { className: "h-4 w-4 text-primary shrink-0" })
2850
+ ]
2851
+ },
2852
+ agent.id
2853
+ );
2854
+ })
2855
+ ] })
2856
+ ] });
2857
+ });
2858
+ ParticipantsSelector.displayName = "ParticipantsSelector";
2859
+ var TargetAgentSelector = (0, import_react3.memo)(({
2860
+ agents,
2861
+ targetAgentId,
2862
+ onTargetChange,
2863
+ label = "Target",
2864
+ placeholder = "Select agent",
2865
+ disabled = false
2866
+ }) => {
2867
+ const agentsWithColors = (0, import_react3.useMemo)(() => assignAgentColors(agents), [agents]);
2868
+ const selectedAgent = (0, import_react3.useMemo)(
2869
+ () => agentsWithColors.find((a) => a.id === targetAgentId),
2870
+ [agentsWithColors, targetAgentId]
2871
+ );
2872
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenu, { children: [
2873
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2874
+ Button,
2875
+ {
2876
+ variant: "ghost",
2877
+ className: "h-9 px-3 gap-1.5 font-medium text-base hover:bg-accent/50",
2878
+ disabled,
2879
+ children: [
2880
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.AtSign, { className: "h-4 w-4 text-muted-foreground" }),
2881
+ selectedAgent ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
2882
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Avatar, { className: "h-5 w-5", children: [
2883
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
2884
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2885
+ AvatarFallback,
2886
+ {
2887
+ style: { backgroundColor: selectedAgent.color || getAgentColor(selectedAgent.id), color: "white" },
2888
+ className: "text-[10px]",
2889
+ children: getAgentInitials(selectedAgent.name)
2890
+ }
2891
+ )
2892
+ ] }),
2893
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "max-w-[150px] truncate", children: selectedAgent.name })
2894
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-muted-foreground", children: placeholder }),
2895
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.ChevronDown, { className: "h-4 w-4 opacity-50" })
2896
+ ]
2897
+ }
2898
+ ) }),
2899
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenuContent, { align: "start", className: "w-[280px]", children: [
2900
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuLabel, { children: label }),
2901
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuSeparator, {}),
2902
+ agentsWithColors.map((agent) => {
2903
+ const isSelected = agent.id === targetAgentId;
2904
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2905
+ DropdownMenuItem,
2906
+ {
2907
+ onClick: () => onTargetChange(agent.id),
2908
+ className: "flex items-start gap-3 p-3 cursor-pointer",
2909
+ children: [
2910
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
2911
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
2912
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2913
+ AvatarFallback,
2914
+ {
2915
+ style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
2916
+ className: "text-[10px]",
2917
+ children: getAgentInitials(agent.name)
2918
+ }
2919
+ )
2920
+ ] }),
2921
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex-1 min-w-0", children: [
2922
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
2923
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-medium text-sm", children: agent.name }),
2924
+ isSelected && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Check, { className: "h-4 w-4 text-primary shrink-0" })
2925
+ ] }),
2926
+ agent.description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
2927
+ ] })
2928
+ ]
2929
+ },
2930
+ agent.id
2931
+ );
2932
+ })
2933
+ ] })
2934
+ ] });
2935
+ });
2936
+ TargetAgentSelector.displayName = "TargetAgentSelector";
2937
+ var AgentBadge = (0, import_react3.memo)(({
2938
+ agent,
2939
+ onRemove,
2940
+ showRemove = false,
2941
+ size = "md"
2942
+ }) => {
2943
+ const color = agent.color || getAgentColor(agent.id);
2944
+ const avatarSize = size === "sm" ? "h-4 w-4" : "h-5 w-5";
2945
+ const textSize = size === "sm" ? "text-xs" : "text-sm";
2946
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2947
+ Badge,
2948
+ {
2949
+ variant: "secondary",
2950
+ className: "flex items-center gap-1.5 pr-1",
2951
+ style: { borderColor: color, borderWidth: 1 },
2952
+ children: [
2953
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Avatar, { className: avatarSize, children: [
2954
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
2955
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2956
+ AvatarFallback,
2957
+ {
2958
+ style: { backgroundColor: color, color: "white" },
2959
+ className: "text-[8px]",
2960
+ children: getAgentInitials(agent.name)
2961
+ }
2962
+ )
2963
+ ] }),
2964
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: textSize, children: agent.name }),
2965
+ showRemove && onRemove && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2966
+ Button,
2967
+ {
2968
+ variant: "ghost",
2969
+ size: "icon",
2970
+ className: "h-4 w-4 ml-0.5 hover:bg-destructive/20",
2971
+ onClick: (e) => {
2972
+ e.stopPropagation();
2973
+ onRemove();
2974
+ },
2975
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.X, { className: "h-3 w-3" })
2976
+ }
2977
+ )
2978
+ ]
2979
+ }
2980
+ );
2981
+ });
2982
+ AgentBadge.displayName = "AgentBadge";
2983
+
2984
+ // src/components/chat/ChatHeader.tsx
2985
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2658
2986
  var ChatHeader = ({
2659
2987
  config,
2660
2988
  currentThreadTitle,
@@ -2667,16 +2995,19 @@ var ChatHeader = ({
2667
2995
  showCustomComponentButton,
2668
2996
  isMobile,
2669
2997
  showAgentSelector = false,
2998
+ isMultiAgentMode = false,
2670
2999
  agentOptions = [],
2671
3000
  selectedAgentId = null,
2672
3001
  onSelectAgent,
3002
+ participantIds,
3003
+ onParticipantsChange,
2673
3004
  className = ""
2674
3005
  }) => {
2675
- const [isDarkMode, setIsDarkMode] = import_react3.default.useState(() => {
3006
+ const [isDarkMode, setIsDarkMode] = import_react4.default.useState(() => {
2676
3007
  if (typeof window === "undefined") return false;
2677
3008
  return document.documentElement.classList.contains("dark");
2678
3009
  });
2679
- import_react3.default.useEffect(() => {
3010
+ import_react4.default.useEffect(() => {
2680
3011
  const observer = new MutationObserver(() => {
2681
3012
  setIsDarkMode(document.documentElement.classList.contains("dark"));
2682
3013
  });
@@ -2722,52 +3053,60 @@ var ChatHeader = ({
2722
3053
  };
2723
3054
  const selectedAgent = agentOptions.find((agent) => agent.id === selectedAgentId) || null;
2724
3055
  const agentPlaceholder = config.agentSelector?.label || "Select agent";
2725
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3056
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2726
3057
  Card,
2727
3058
  {
2728
3059
  "data-chat-header": true,
2729
3060
  className: `py-0 border-b rounded-none relative z-10 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80 ${className}`,
2730
3061
  style: isMobile ? { paddingTop: "env(safe-area-inset-top)" } : void 0,
2731
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CardHeader, { className: "p-2", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
2732
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
2733
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Tooltip, { children: [
2734
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SidebarTrigger, { className: "-ml-1" }) }),
2735
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipContent, { children: config.labels?.sidebarToggle || "Toggle Sidebar" })
3062
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CardHeader, { className: "p-2", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
3063
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
3064
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Tooltip, { children: [
3065
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(SidebarTrigger, { className: "-ml-1" }) }),
3066
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TooltipContent, { children: config.labels?.sidebarToggle || "Toggle Sidebar" })
2736
3067
  ] }),
2737
- showAgentSelector && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenu, { children: [
2738
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3068
+ showAgentSelector && isMultiAgentMode && onParticipantsChange && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3069
+ ParticipantsSelector,
3070
+ {
3071
+ agents: agentOptions,
3072
+ participantIds: participantIds ?? agentOptions.map((a) => a.id),
3073
+ onParticipantsChange
3074
+ }
3075
+ ),
3076
+ showAgentSelector && !isMultiAgentMode && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DropdownMenu, { children: [
3077
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2739
3078
  Button,
2740
3079
  {
2741
3080
  variant: "ghost",
2742
3081
  className: "h-9 px-3 gap-1.5 font-medium text-base hover:bg-accent/50",
2743
3082
  children: [
2744
- selectedAgent?.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Avatar, { className: "h-5 w-5", children: [
2745
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
2746
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AvatarFallback, { className: "text-[10px]", children: selectedAgent.name.charAt(0).toUpperCase() })
3083
+ selectedAgent?.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Avatar, { className: "h-5 w-5", children: [
3084
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
3085
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AvatarFallback, { className: "text-[10px]", children: selectedAgent.name.charAt(0).toUpperCase() })
2747
3086
  ] }) : null,
2748
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "max-w-[200px] truncate", children: selectedAgent?.name || agentPlaceholder }),
2749
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.ChevronDown, { className: "h-4 w-4 opacity-50" })
3087
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "max-w-[200px] truncate", children: selectedAgent?.name || agentPlaceholder }),
3088
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.ChevronDown, { className: "h-4 w-4 opacity-50" })
2750
3089
  ]
2751
3090
  }
2752
3091
  ) }),
2753
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuContent, { align: "start", className: "w-[280px]", children: agentOptions.map((agent) => {
3092
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DropdownMenuContent, { align: "start", className: "w-[280px]", children: agentOptions.map((agent) => {
2754
3093
  const isSelected = agent.id === selectedAgentId;
2755
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3094
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2756
3095
  DropdownMenuItem,
2757
3096
  {
2758
3097
  onClick: () => onSelectAgent?.(agent.id),
2759
3098
  className: "flex items-start gap-3 p-3 cursor-pointer",
2760
3099
  children: [
2761
- agent.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
2762
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
2763
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AvatarFallback, { className: "text-[10px]", children: agent.name.charAt(0).toUpperCase() })
2764
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "h-6 w-6 mt-0.5 shrink-0 flex items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Bot, { className: "h-3.5 w-3.5 text-primary" }) }),
2765
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex-1 min-w-0", children: [
2766
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-2", children: [
2767
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "font-medium text-sm", children: agent.name }),
2768
- isSelected && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Check, { className: "h-4 w-4 text-primary shrink-0" })
3100
+ agent.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
3101
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
3102
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AvatarFallback, { className: "text-[10px]", children: agent.name.charAt(0).toUpperCase() })
3103
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "h-6 w-6 mt-0.5 shrink-0 flex items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.Bot, { className: "h-3.5 w-3.5 text-primary" }) }),
3104
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex-1 min-w-0", children: [
3105
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
3106
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-medium text-sm", children: agent.name }),
3107
+ isSelected && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.Check, { className: "h-4 w-4 text-primary shrink-0" })
2769
3108
  ] }),
2770
- agent.description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
3109
+ agent.description && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
2771
3110
  ] })
2772
3111
  ]
2773
3112
  },
@@ -2775,59 +3114,59 @@ var ChatHeader = ({
2775
3114
  );
2776
3115
  }) })
2777
3116
  ] }),
2778
- !showAgentSelector && isMobile && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-sm font-medium truncate max-w-[150px] ml-2", children: currentThreadTitle || config.branding?.title || "Chat" })
3117
+ !showAgentSelector && isMobile && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-sm font-medium truncate max-w-[150px] ml-2", children: currentThreadTitle || config.branding?.title || "Chat" })
2779
3118
  ] }),
2780
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-1" }),
2781
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
2782
- showCustomComponentButton && config.customComponent && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Tooltip, { children: [
2783
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3119
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex-1" }),
3120
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-1", children: [
3121
+ showCustomComponentButton && config.customComponent && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Tooltip, { children: [
3122
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2784
3123
  Button,
2785
3124
  {
2786
3125
  variant: "ghost",
2787
3126
  size: "icon",
2788
3127
  className: "h-8 w-8",
2789
3128
  onClick: onCustomComponentToggle,
2790
- children: config.customComponent.icon || /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Menu, { className: "h-4 w-4" })
3129
+ children: config.customComponent.icon || /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.Menu, { className: "h-4 w-4" })
2791
3130
  }
2792
3131
  ) }),
2793
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TooltipContent, { children: config.customComponent.label || config.labels?.customComponentToggle || "Toggle" })
3132
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TooltipContent, { children: config.customComponent.label || config.labels?.customComponentToggle || "Toggle" })
2794
3133
  ] }),
2795
3134
  config.headerActions,
2796
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenu, { children: [
2797
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.MoreVertical, { className: "h-4 w-4" }) }) }),
2798
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenuContent, { align: "end", children: [
2799
- onNewThread && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
2800
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenuItem, { onClick: () => onNewThread?.(), className: "font-medium text-primary", children: [
2801
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Plus, { className: "h-4 w-4 mr-2" }),
3135
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DropdownMenu, { children: [
3136
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.MoreVertical, { className: "h-4 w-4" }) }) }),
3137
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DropdownMenuContent, { align: "end", children: [
3138
+ onNewThread && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
3139
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DropdownMenuItem, { onClick: () => onNewThread?.(), className: "font-medium text-primary", children: [
3140
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.Plus, { className: "h-4 w-4 mr-2" }),
2802
3141
  config.labels?.newThread || "New Thread"
2803
3142
  ] }),
2804
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuSeparator, {})
3143
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DropdownMenuSeparator, {})
2805
3144
  ] }),
2806
- onExportData && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenuItem, { onClick: onExportData, children: [
2807
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Download, { className: "h-4 w-4 mr-2" }),
3145
+ onExportData && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DropdownMenuItem, { onClick: onExportData, children: [
3146
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.Download, { className: "h-4 w-4 mr-2" }),
2808
3147
  config.labels?.exportData || "Export Data"
2809
3148
  ] }),
2810
- onImportData && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenuItem, { onClick: handleImportClick, children: [
2811
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Upload, { className: "h-4 w-4 mr-2" }),
3149
+ onImportData && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DropdownMenuItem, { onClick: handleImportClick, children: [
3150
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.Upload, { className: "h-4 w-4 mr-2" }),
2812
3151
  config.labels?.importData || "Import Data"
2813
3152
  ] }),
2814
- (onExportData || onImportData) && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuSeparator, {}),
2815
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuItem, { onClick: toggleDarkMode, children: isDarkMode ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
2816
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Sun, { className: "h-4 w-4 mr-2" }),
3153
+ (onExportData || onImportData) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DropdownMenuSeparator, {}),
3154
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DropdownMenuItem, { onClick: toggleDarkMode, children: isDarkMode ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
3155
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.Sun, { className: "h-4 w-4 mr-2" }),
2817
3156
  config.labels?.lightMode || "Light Mode"
2818
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
2819
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Moon, { className: "h-4 w-4 mr-2" }),
3157
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
3158
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.Moon, { className: "h-4 w-4 mr-2" }),
2820
3159
  config.labels?.darkMode || "Dark Mode"
2821
3160
  ] }) }),
2822
- onClearAll && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
2823
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuSeparator, {}),
2824
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3161
+ onClearAll && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
3162
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DropdownMenuSeparator, {}),
3163
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2825
3164
  DropdownMenuItem,
2826
3165
  {
2827
3166
  onClick: onClearAll,
2828
3167
  className: "text-destructive",
2829
3168
  children: [
2830
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Trash2, { className: "h-4 w-4 mr-2" }),
3169
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.Trash2, { className: "h-4 w-4 mr-2" }),
2831
3170
  config.labels?.clearAll || "Clear All"
2832
3171
  ]
2833
3172
  }
@@ -2842,18 +3181,18 @@ var ChatHeader = ({
2842
3181
  };
2843
3182
 
2844
3183
  // src/components/chat/ChatInput.tsx
2845
- var import_react5 = require("react");
3184
+ var import_react6 = require("react");
2846
3185
 
2847
3186
  // src/components/chat/UserContext.tsx
2848
- var import_react4 = require("react");
2849
- var import_jsx_runtime19 = require("react/jsx-runtime");
2850
- var Ctx = (0, import_react4.createContext)(void 0);
3187
+ var import_react5 = require("react");
3188
+ var import_jsx_runtime20 = require("react/jsx-runtime");
3189
+ var Ctx = (0, import_react5.createContext)(void 0);
2851
3190
  var ChatUserContextProvider = ({ children, initial }) => {
2852
- const [ctx, setCtx] = (0, import_react4.useState)(() => ({
3191
+ const [ctx, setCtx] = (0, import_react5.useState)(() => ({
2853
3192
  updatedAt: Date.now(),
2854
3193
  ...initial ?? {}
2855
3194
  }));
2856
- (0, import_react4.useEffect)(() => {
3195
+ (0, import_react5.useEffect)(() => {
2857
3196
  if (!initial) return;
2858
3197
  setCtx((prev) => {
2859
3198
  const keys = Object.keys(initial);
@@ -2862,21 +3201,21 @@ var ChatUserContextProvider = ({ children, initial }) => {
2862
3201
  return { ...prev, ...initial, updatedAt: Date.now() };
2863
3202
  });
2864
3203
  }, [initial]);
2865
- const setPartial = (0, import_react4.useCallback)((next) => {
3204
+ const setPartial = (0, import_react5.useCallback)((next) => {
2866
3205
  setCtx((prev) => {
2867
3206
  const partial = typeof next === "function" ? next(prev) : next;
2868
3207
  return { ...prev, ...partial, updatedAt: Date.now() };
2869
3208
  });
2870
3209
  }, []);
2871
- const value = (0, import_react4.useMemo)(() => ({
3210
+ const value = (0, import_react5.useMemo)(() => ({
2872
3211
  context: ctx,
2873
3212
  setContext: setPartial,
2874
3213
  resetContext: () => setCtx({ updatedAt: Date.now() })
2875
3214
  }), [ctx, setPartial]);
2876
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Ctx.Provider, { value, children });
3215
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Ctx.Provider, { value, children });
2877
3216
  };
2878
3217
  function useChatUserContext() {
2879
- const v = (0, import_react4.useContext)(Ctx);
3218
+ const v = (0, import_react5.useContext)(Ctx);
2880
3219
  if (!v) throw new Error("useChatUserContext must be used within ChatUserContextProvider");
2881
3220
  return v;
2882
3221
  }
@@ -3207,13 +3546,13 @@ var resolveVoiceProviderFactory = (createProvider) => createProvider ?? createMa
3207
3546
 
3208
3547
  // src/components/ui/progress.tsx
3209
3548
  var ProgressPrimitive = __toESM(require("@radix-ui/react-progress"), 1);
3210
- var import_jsx_runtime20 = require("react/jsx-runtime");
3549
+ var import_jsx_runtime21 = require("react/jsx-runtime");
3211
3550
  function Progress({
3212
3551
  className,
3213
3552
  value,
3214
3553
  ...props
3215
3554
  }) {
3216
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3555
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3217
3556
  ProgressPrimitive.Root,
3218
3557
  {
3219
3558
  "data-slot": "progress",
@@ -3222,7 +3561,7 @@ function Progress({
3222
3561
  className
3223
3562
  ),
3224
3563
  ...props,
3225
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3564
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3226
3565
  ProgressPrimitive.Indicator,
3227
3566
  {
3228
3567
  "data-slot": "progress-indicator",
@@ -3235,8 +3574,8 @@ function Progress({
3235
3574
  }
3236
3575
 
3237
3576
  // src/components/chat/VoiceComposer.tsx
3238
- var import_lucide_react9 = require("lucide-react");
3239
- var import_jsx_runtime21 = require("react/jsx-runtime");
3577
+ var import_lucide_react10 = require("lucide-react");
3578
+ var import_jsx_runtime22 = require("react/jsx-runtime");
3240
3579
  var formatDuration = (durationMs) => {
3241
3580
  const totalSeconds = Math.max(0, Math.floor(durationMs / 1e3));
3242
3581
  const minutes = Math.floor(totalSeconds / 60);
@@ -3331,13 +3670,13 @@ var VoiceComposer = ({
3331
3670
  }
3332
3671
  onRecordAgain();
3333
3672
  };
3334
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "w-full max-w-3xl rounded-2xl border bg-background p-3 shadow-sm sm:p-4 md:min-w-3xl", children: [
3335
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between gap-2 sm:gap-3", children: [
3336
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
3337
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Badge, { variant: "outline", children: labels?.voiceTitle || "Voice" }),
3338
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "truncate rounded-full bg-muted px-2.5 py-1 text-[11px] sm:text-xs text-muted-foreground", children: headerLabel })
3673
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "w-full max-w-3xl rounded-2xl border bg-background p-3 shadow-sm sm:p-4 md:min-w-3xl", children: [
3674
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between gap-2 sm:gap-3", children: [
3675
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
3676
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Badge, { variant: "outline", children: labels?.voiceTitle || "Voice" }),
3677
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "truncate rounded-full bg-muted px-2.5 py-1 text-[11px] sm:text-xs text-muted-foreground", children: headerLabel })
3339
3678
  ] }),
3340
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3679
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3341
3680
  Button,
3342
3681
  {
3343
3682
  type: "button",
@@ -3347,14 +3686,14 @@ var VoiceComposer = ({
3347
3686
  onClick: onExit,
3348
3687
  disabled: disabled || isBusy,
3349
3688
  children: [
3350
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Keyboard, { className: "h-4 w-4" }),
3351
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "hidden sm:inline", children: labels?.voiceExit || "Use keyboard" })
3689
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Keyboard, { className: "h-4 w-4" }),
3690
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "hidden sm:inline", children: labels?.voiceExit || "Use keyboard" })
3352
3691
  ]
3353
3692
  }
3354
3693
  )
3355
3694
  ] }),
3356
- !isDraftLayout ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "mt-3 rounded-xl border border-dashed border-primary/30 bg-primary/5 px-3 py-3 text-center sm:px-4 sm:py-4", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "mx-auto flex w-full max-w-sm flex-col items-center gap-3", children: [
3357
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3695
+ !isDraftLayout ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mt-3 rounded-xl border border-dashed border-primary/30 bg-primary/5 px-3 py-3 text-center sm:px-4 sm:py-4", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "mx-auto flex w-full max-w-sm flex-col items-center gap-3", children: [
3696
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3358
3697
  Button,
3359
3698
  {
3360
3699
  type: "button",
@@ -3363,21 +3702,21 @@ var VoiceComposer = ({
3363
3702
  className: `h-16 w-16 rounded-full sm:h-20 sm:w-20 ${isCapturing ? "bg-red-500 hover:bg-red-600 text-white border-red-500" : "border-red-200 bg-red-50 text-red-600 hover:bg-red-100 hover:text-red-700"}`,
3364
3703
  onClick: isCapturing ? onStop : onStart,
3365
3704
  disabled: disabled || isBusy,
3366
- children: isBusy ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Loader2, { className: "h-7 w-7 animate-spin" }) : isCapturing ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Square, { className: "h-7 w-7" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Mic, { className: "h-7 w-7" })
3705
+ children: isBusy ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Loader2, { className: "h-7 w-7 animate-spin" }) : isCapturing ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Square, { className: "h-7 w-7" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Mic, { className: "h-7 w-7" })
3367
3706
  }
3368
3707
  ),
3369
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "w-full space-y-2", children: [
3370
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Progress, { value: levelValue, className: "h-2" }),
3371
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
3372
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: formatDuration(durationMs) }),
3373
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: isCapturing ? labels?.voiceStop || "Stop recording" : labels?.voiceStart || "Start recording" })
3708
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "w-full space-y-2", children: [
3709
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Progress, { value: levelValue, className: "h-2" }),
3710
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
3711
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: formatDuration(durationMs) }),
3712
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: isCapturing ? labels?.voiceStop || "Stop recording" : labels?.voiceStart || "Start recording" })
3374
3713
  ] })
3375
3714
  ] }),
3376
- showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "w-full rounded-lg border bg-background px-3 py-2 text-left text-sm", children: transcriptText })
3377
- ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "mt-3 rounded-xl border bg-muted/20 p-3 sm:p-4", children: [
3378
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center justify-between gap-2 text-xs text-muted-foreground", children: [
3379
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: formatDuration(durationMs) }),
3380
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3715
+ showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "w-full rounded-lg border bg-background px-3 py-2 text-left text-sm", children: transcriptText })
3716
+ ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "mt-3 rounded-xl border bg-muted/20 p-3 sm:p-4", children: [
3717
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center justify-between gap-2 text-xs text-muted-foreground", children: [
3718
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { children: formatDuration(durationMs) }),
3719
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3381
3720
  Button,
3382
3721
  {
3383
3722
  type: "button",
@@ -3388,12 +3727,12 @@ var VoiceComposer = ({
3388
3727
  disabled,
3389
3728
  "aria-label": labels?.voiceDiscard || "Delete recording",
3390
3729
  title: labels?.voiceDiscard || "Delete recording",
3391
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Trash2, { className: "h-4 w-4" })
3730
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Trash2, { className: "h-4 w-4" })
3392
3731
  }
3393
3732
  )
3394
3733
  ] }),
3395
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "mt-4 flex flex-col items-center gap-4 text-center", children: [
3396
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3734
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "mt-4 flex flex-col items-center gap-4 text-center", children: [
3735
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3397
3736
  Button,
3398
3737
  {
3399
3738
  type: "button",
@@ -3402,12 +3741,12 @@ var VoiceComposer = ({
3402
3741
  className: `h-20 w-20 rounded-full sm:h-24 sm:w-24 ${orbIsListening ? "border-red-500 bg-red-500 text-white hover:bg-red-600" : isArmedDraft ? "border-red-200 bg-red-50 text-red-600 shadow-[0_0_0_10px_rgba(239,68,68,0.08)] hover:bg-red-100 hover:text-red-700" : "border-red-200 bg-red-50 text-red-600 hover:bg-red-100 hover:text-red-700"}`,
3403
3742
  onClick: handleReviewOrbClick,
3404
3743
  disabled: disabled || orbIsReviewBusy,
3405
- children: orbIsReviewBusy ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Loader2, { className: "h-7 w-7 animate-spin" }) : orbIsListening ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Square, { className: "h-7 w-7" }) : isArmedDraft ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Mic, { className: "h-7 w-7 animate-pulse" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Mic, { className: "h-7 w-7" })
3744
+ children: orbIsReviewBusy ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Loader2, { className: "h-7 w-7 animate-spin" }) : orbIsListening ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Square, { className: "h-7 w-7" }) : isArmedDraft ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Mic, { className: "h-7 w-7 animate-pulse" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Mic, { className: "h-7 w-7" })
3406
3745
  }
3407
3746
  ),
3408
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "max-w-sm space-y-1 px-2", children: [
3409
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "text-sm text-foreground", children: reviewHelperText }),
3410
- isCapturing && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "mx-auto h-1.5 w-32 overflow-hidden rounded-full bg-red-100", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3747
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "max-w-sm space-y-1 px-2", children: [
3748
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-sm text-foreground", children: reviewHelperText }),
3749
+ isCapturing && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mx-auto h-1.5 w-32 overflow-hidden rounded-full bg-red-100", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3411
3750
  "div",
3412
3751
  {
3413
3752
  className: "h-full rounded-full bg-red-500 transition-[width] duration-150",
@@ -3416,28 +3755,28 @@ var VoiceComposer = ({
3416
3755
  ) })
3417
3756
  ] })
3418
3757
  ] }),
3419
- attachment && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "mt-4 rounded-lg border bg-background/90 p-2 shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("audio", { controls: true, preload: "metadata", className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("source", { src: attachment.dataUrl, type: attachment.mimeType }) }) }),
3420
- showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "mt-3 rounded-lg border bg-background px-3 py-2 text-left text-sm", children: transcriptText }),
3421
- isAutoSendActive && autoSendDelayMs > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "mt-3 flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "inline-flex items-center rounded-full border bg-background px-3 py-1 text-xs text-muted-foreground", children: interpolateSeconds(labels?.voiceAutoSendIn, countdownSeconds) }) }),
3422
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "mt-4 grid grid-cols-1 gap-2 sm:flex sm:items-center sm:justify-end", children: [
3423
- isAutoSendActive && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Button, { type: "button", variant: "ghost", size: "sm", onClick: onCancelAutoSend, disabled, className: "w-full sm:w-auto", children: [
3424
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.X, { className: "h-4 w-4" }),
3758
+ attachment && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mt-4 rounded-lg border bg-background/90 p-2 shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("audio", { controls: true, preload: "metadata", className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("source", { src: attachment.dataUrl, type: attachment.mimeType }) }) }),
3759
+ showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mt-3 rounded-lg border bg-background px-3 py-2 text-left text-sm", children: transcriptText }),
3760
+ isAutoSendActive && autoSendDelayMs > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mt-3 flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "inline-flex items-center rounded-full border bg-background px-3 py-1 text-xs text-muted-foreground", children: interpolateSeconds(labels?.voiceAutoSendIn, countdownSeconds) }) }),
3761
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "mt-4 grid grid-cols-1 gap-2 sm:flex sm:items-center sm:justify-end", children: [
3762
+ isAutoSendActive && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Button, { type: "button", variant: "ghost", size: "sm", onClick: onCancelAutoSend, disabled, className: "w-full sm:w-auto", children: [
3763
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.X, { className: "h-4 w-4" }),
3425
3764
  labels?.voiceCancel || "Cancel"
3426
3765
  ] }),
3427
- /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Button, { type: "button", size: "sm", onClick: onSendNow, disabled, className: "w-full sm:w-auto", children: [
3428
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react9.Send, { className: "h-4 w-4" }),
3766
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Button, { type: "button", size: "sm", onClick: onSendNow, disabled, className: "w-full sm:w-auto", children: [
3767
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Send, { className: "h-4 w-4" }),
3429
3768
  labels?.voiceSendNow || "Send now"
3430
3769
  ] })
3431
3770
  ] })
3432
3771
  ] }),
3433
- errorMessage && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "mt-3 rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive", children: errorMessage })
3772
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mt-3 rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive", children: errorMessage })
3434
3773
  ] });
3435
3774
  };
3436
3775
 
3437
3776
  // src/components/chat/ChatInput.tsx
3438
- var import_lucide_react10 = require("lucide-react");
3439
- var import_jsx_runtime22 = require("react/jsx-runtime");
3440
- var FileUploadItem = (0, import_react5.memo)(function FileUploadItem2({ file, progress, onCancel }) {
3777
+ var import_lucide_react11 = require("lucide-react");
3778
+ var import_jsx_runtime23 = require("react/jsx-runtime");
3779
+ var FileUploadItem = (0, import_react6.memo)(function FileUploadItem2({ file, progress, onCancel }) {
3441
3780
  const guessTypeFromName = (name) => {
3442
3781
  const ext = (name || "").split(".").pop()?.toLowerCase();
3443
3782
  switch (ext) {
@@ -3465,10 +3804,10 @@ var FileUploadItem = (0, import_react5.memo)(function FileUploadItem2({ file, pr
3465
3804
  };
3466
3805
  const getFileIcon = (type, name) => {
3467
3806
  const t = typeof type === "string" && type.length > 0 ? type : guessTypeFromName(name);
3468
- if (t.startsWith("image/")) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Image, { className: "h-4 w-4" });
3469
- if (t.startsWith("video/")) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Video, { className: "h-4 w-4" });
3470
- if (t.startsWith("audio/")) return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Mic, { className: "h-4 w-4" });
3471
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.FileText, { className: "h-4 w-4" });
3807
+ if (t.startsWith("image/")) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Image, { className: "h-4 w-4" });
3808
+ if (t.startsWith("video/")) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Video, { className: "h-4 w-4" });
3809
+ if (t.startsWith("audio/")) return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Mic, { className: "h-4 w-4" });
3810
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.FileText, { className: "h-4 w-4" });
3472
3811
  };
3473
3812
  const formatFileSize = (bytes) => {
3474
3813
  if (bytes === 0) return "0 Bytes";
@@ -3477,30 +3816,30 @@ var FileUploadItem = (0, import_react5.memo)(function FileUploadItem2({ file, pr
3477
3816
  const i = Math.floor(Math.log(bytes) / Math.log(k));
3478
3817
  return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
3479
3818
  };
3480
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Card, { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardContent, { className: "p-3", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-3", children: [
3819
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Card, { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CardContent, { className: "p-3", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-3", children: [
3481
3820
  getFileIcon(file.type, file.name),
3482
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex-1 min-w-0", children: [
3483
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-sm font-medium truncate", children: file.name }),
3484
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-xs text-muted-foreground", children: formatFileSize(file.size ?? 0) }),
3485
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Progress, { value: progress, className: "h-1 mt-1" })
3821
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex-1 min-w-0", children: [
3822
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm font-medium truncate", children: file.name }),
3823
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-xs text-muted-foreground", children: formatFileSize(file.size ?? 0) }),
3824
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Progress, { value: progress, className: "h-1 mt-1" })
3486
3825
  ] }),
3487
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3826
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3488
3827
  Button,
3489
3828
  {
3490
3829
  variant: "ghost",
3491
3830
  size: "icon",
3492
3831
  className: "h-6 w-6",
3493
3832
  onClick: onCancel,
3494
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.X, { className: "h-3 w-3" })
3833
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.X, { className: "h-3 w-3" })
3495
3834
  }
3496
3835
  )
3497
3836
  ] }) }) });
3498
3837
  });
3499
- var AttachmentPreview = (0, import_react5.memo)(function AttachmentPreview2({ attachment, onRemove }) {
3500
- const [isPlaying, setIsPlaying] = (0, import_react5.useState)(false);
3501
- const [audioPlaybackSrc, setAudioPlaybackSrc] = (0, import_react5.useState)(attachment.dataUrl);
3502
- const audioRef = (0, import_react5.useRef)(null);
3503
- (0, import_react5.useEffect)(() => {
3838
+ var AttachmentPreview = (0, import_react6.memo)(function AttachmentPreview2({ attachment, onRemove }) {
3839
+ const [isPlaying, setIsPlaying] = (0, import_react6.useState)(false);
3840
+ const [audioPlaybackSrc, setAudioPlaybackSrc] = (0, import_react6.useState)(attachment.dataUrl);
3841
+ const audioRef = (0, import_react6.useRef)(null);
3842
+ (0, import_react6.useEffect)(() => {
3504
3843
  if (attachment.kind !== "audio" || !attachment.dataUrl.startsWith("data:")) {
3505
3844
  setAudioPlaybackSrc(attachment.dataUrl);
3506
3845
  return;
@@ -3531,9 +3870,9 @@ var AttachmentPreview = (0, import_react5.memo)(function AttachmentPreview2({ at
3531
3870
  const minutes = Math.floor(seconds / 60);
3532
3871
  return `${minutes}:${(seconds % 60).toString().padStart(2, "0")}`;
3533
3872
  };
3534
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Card, { className: "relative group", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(CardContent, { className: "p-2", children: [
3535
- attachment.kind === "image" && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "relative", children: [
3536
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3873
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Card, { className: "relative group", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(CardContent, { className: "p-2", children: [
3874
+ attachment.kind === "image" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "relative", children: [
3875
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3537
3876
  "img",
3538
3877
  {
3539
3878
  src: attachment.dataUrl,
@@ -3541,19 +3880,19 @@ var AttachmentPreview = (0, import_react5.memo)(function AttachmentPreview2({ at
3541
3880
  className: "w-full h-20 object-cover rounded"
3542
3881
  }
3543
3882
  ),
3544
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3883
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3545
3884
  Button,
3546
3885
  {
3547
3886
  variant: "destructive",
3548
3887
  size: "icon",
3549
3888
  className: "h-6 w-6",
3550
3889
  onClick: onRemove,
3551
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.X, { className: "h-3 w-3" })
3890
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.X, { className: "h-3 w-3" })
3552
3891
  }
3553
3892
  ) })
3554
3893
  ] }),
3555
- attachment.kind === "video" && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "relative", children: [
3556
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3894
+ attachment.kind === "video" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "relative", children: [
3895
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3557
3896
  "video",
3558
3897
  {
3559
3898
  src: attachment.dataUrl,
@@ -3562,34 +3901,34 @@ var AttachmentPreview = (0, import_react5.memo)(function AttachmentPreview2({ at
3562
3901
  muted: true
3563
3902
  }
3564
3903
  ),
3565
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3904
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3566
3905
  Button,
3567
3906
  {
3568
3907
  variant: "destructive",
3569
3908
  size: "icon",
3570
3909
  className: "h-6 w-6",
3571
3910
  onClick: onRemove,
3572
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.X, { className: "h-3 w-3" })
3911
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.X, { className: "h-3 w-3" })
3573
3912
  }
3574
3913
  ) }),
3575
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Badge, { className: "absolute bottom-1 right-1 text-xs", children: formatDuration2(attachment.durationMs) })
3914
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Badge, { className: "absolute bottom-1 right-1 text-xs", children: formatDuration2(attachment.durationMs) })
3576
3915
  ] }),
3577
- attachment.kind === "audio" && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2 p-2", children: [
3578
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3916
+ attachment.kind === "audio" && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2 p-2", children: [
3917
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3579
3918
  Button,
3580
3919
  {
3581
3920
  variant: "outline",
3582
3921
  size: "icon",
3583
3922
  className: "h-8 w-8",
3584
3923
  onClick: handlePlayPause,
3585
- children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Pause, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Play, { className: "h-3 w-3" })
3924
+ children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Pause, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Play, { className: "h-3 w-3" })
3586
3925
  }
3587
3926
  ),
3588
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex-1", children: [
3589
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-xs font-medium", children: attachment.fileName || "Audio" }),
3590
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-xs text-muted-foreground", children: formatDuration2(attachment.durationMs) })
3927
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex-1", children: [
3928
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-xs font-medium", children: attachment.fileName || "Audio" }),
3929
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-xs text-muted-foreground", children: formatDuration2(attachment.durationMs) })
3591
3930
  ] }),
3592
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3931
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3593
3932
  "audio",
3594
3933
  {
3595
3934
  ref: audioRef,
@@ -3597,71 +3936,71 @@ var AttachmentPreview = (0, import_react5.memo)(function AttachmentPreview2({ at
3597
3936
  onPause: () => setIsPlaying(false),
3598
3937
  onEnded: () => setIsPlaying(false),
3599
3938
  preload: "metadata",
3600
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("source", { src: audioPlaybackSrc, type: attachment.mimeType })
3939
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("source", { src: audioPlaybackSrc, type: attachment.mimeType })
3601
3940
  }
3602
3941
  ),
3603
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3942
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3604
3943
  Button,
3605
3944
  {
3606
3945
  variant: "ghost",
3607
3946
  size: "icon",
3608
3947
  className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
3609
3948
  onClick: onRemove,
3610
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.X, { className: "h-3 w-3" })
3949
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.X, { className: "h-3 w-3" })
3611
3950
  }
3612
3951
  )
3613
3952
  ] }),
3614
- attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "absolute bottom-0 left-0 right-0 bg-black/70 text-white text-xs p-1 rounded-b", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "truncate", children: attachment.fileName }) })
3953
+ attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "absolute bottom-0 left-0 right-0 bg-black/70 text-white text-xs p-1 rounded-b", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "truncate", children: attachment.fileName }) })
3615
3954
  ] }) });
3616
3955
  });
3617
- var AudioRecorder = (0, import_react5.memo)(function AudioRecorder2({ isRecording, onStartRecording, onStopRecording, onCancel, recordingDuration, config }) {
3956
+ var AudioRecorder = (0, import_react6.memo)(function AudioRecorder2({ isRecording, onStartRecording, onStopRecording, onCancel, recordingDuration, config }) {
3618
3957
  const formatTime = (seconds) => {
3619
3958
  const mins = Math.floor(seconds / 60);
3620
3959
  const secs = seconds % 60;
3621
3960
  return `${mins}:${secs.toString().padStart(2, "0")}`;
3622
3961
  };
3623
3962
  if (!isRecording) {
3624
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
3625
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3963
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Tooltip, { children: [
3964
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3626
3965
  Button,
3627
3966
  {
3628
3967
  variant: "outline",
3629
3968
  size: "icon",
3630
3969
  onClick: onStartRecording,
3631
3970
  className: "h-10 w-10",
3632
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Mic, { className: "h-4 w-4" })
3971
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Mic, { className: "h-4 w-4" })
3633
3972
  }
3634
3973
  ) }),
3635
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { children: config?.labels?.recordAudioTooltip })
3974
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipContent, { children: config?.labels?.recordAudioTooltip })
3636
3975
  ] });
3637
3976
  }
3638
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Card, { className: "border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-950", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CardContent, { className: "p-3", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-3", children: [
3639
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex items-center gap-2", children: [
3640
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "h-3 w-3 bg-red-500 rounded-full animate-pulse" }),
3641
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-sm font-medium text-red-700 dark:text-red-300", children: config?.labels?.voiceListening || "Recording" })
3977
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Card, { className: "border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-950", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(CardContent, { className: "p-3", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-3", children: [
3978
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center gap-2", children: [
3979
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "h-3 w-3 bg-red-500 rounded-full animate-pulse" }),
3980
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-sm font-medium text-red-700 dark:text-red-300", children: config?.labels?.voiceListening || "Recording" })
3642
3981
  ] }),
3643
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Badge, { variant: "outline", className: "text-xs", children: formatTime(recordingDuration) }),
3644
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex gap-1 ml-auto", children: [
3645
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3982
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Badge, { variant: "outline", className: "text-xs", children: formatTime(recordingDuration) }),
3983
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex gap-1 ml-auto", children: [
3984
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
3646
3985
  Button,
3647
3986
  {
3648
3987
  variant: "outline",
3649
3988
  size: "sm",
3650
3989
  onClick: onCancel,
3651
3990
  children: [
3652
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.X, { className: "h-3 w-3 mr-1" }),
3991
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.X, { className: "h-3 w-3 mr-1" }),
3653
3992
  config?.labels?.cancel || "Cancel"
3654
3993
  ]
3655
3994
  }
3656
3995
  ),
3657
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3996
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
3658
3997
  Button,
3659
3998
  {
3660
3999
  variant: "default",
3661
4000
  size: "sm",
3662
4001
  onClick: onStopRecording,
3663
4002
  children: [
3664
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Square, { className: "h-3 w-3 mr-1" }),
4003
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Square, { className: "h-3 w-3 mr-1" }),
3665
4004
  config?.labels?.voiceStop || "Stop"
3666
4005
  ]
3667
4006
  }
@@ -3680,7 +4019,7 @@ var resolveVoiceErrorMessage = (error, config) => {
3680
4019
  };
3681
4020
  var clearVoiceTranscript = () => ({});
3682
4021
  var resolveVoiceSegmentDuration = (segment) => segment.attachment.durationMs ?? 0;
3683
- var ChatInput = (0, import_react5.memo)(function ChatInput2({
4022
+ var ChatInput = (0, import_react6.memo)(function ChatInput2({
3684
4023
  value,
3685
4024
  onChange,
3686
4025
  onSubmit,
@@ -3707,32 +4046,32 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
3707
4046
  const voiceShowTranscriptPreview = config?.voiceCompose?.showTranscriptPreview ?? true;
3708
4047
  const voiceTranscriptMode = config?.voiceCompose?.transcriptMode ?? "final-only";
3709
4048
  const voiceMaxRecordingMs = config?.voiceCompose?.maxRecordingMs;
3710
- const [isRecording, setIsRecording] = (0, import_react5.useState)(false);
4049
+ const [isRecording, setIsRecording] = (0, import_react6.useState)(false);
3711
4050
  const { setContext } = useChatUserContext();
3712
- const [recordingDuration, setRecordingDuration] = (0, import_react5.useState)(0);
3713
- const [uploadProgress, setUploadProgress] = (0, import_react5.useState)(/* @__PURE__ */ new Map());
3714
- const [isVoiceComposerOpen, setIsVoiceComposerOpen] = (0, import_react5.useState)(
4051
+ const [recordingDuration, setRecordingDuration] = (0, import_react6.useState)(0);
4052
+ const [uploadProgress, setUploadProgress] = (0, import_react6.useState)(/* @__PURE__ */ new Map());
4053
+ const [isVoiceComposerOpen, setIsVoiceComposerOpen] = (0, import_react6.useState)(
3715
4054
  () => voiceComposeEnabled && voiceDefaultMode === "voice"
3716
4055
  );
3717
- const [voiceState, setVoiceState] = (0, import_react5.useState)("idle");
3718
- const [voiceDraft, setVoiceDraft] = (0, import_react5.useState)(null);
3719
- const [voiceTranscript, setVoiceTranscript] = (0, import_react5.useState)(clearVoiceTranscript);
3720
- const [voiceDurationMs, setVoiceDurationMs] = (0, import_react5.useState)(0);
3721
- const [voiceAudioLevel, setVoiceAudioLevel] = (0, import_react5.useState)(0);
3722
- const [voiceCountdownMs, setVoiceCountdownMs] = (0, import_react5.useState)(0);
3723
- const [isVoiceAutoSendActive, setIsVoiceAutoSendActive] = (0, import_react5.useState)(false);
3724
- const [voiceError, setVoiceError] = (0, import_react5.useState)(null);
3725
- const textareaRef = (0, import_react5.useRef)(null);
3726
- const fileInputRef = (0, import_react5.useRef)(null);
3727
- const mediaRecorderRef = (0, import_react5.useRef)(null);
3728
- const recordingStartTime = (0, import_react5.useRef)(0);
3729
- const recordingInterval = (0, import_react5.useRef)(null);
3730
- const mediaStreamRef = (0, import_react5.useRef)(null);
3731
- const voiceProviderRef = (0, import_react5.useRef)(null);
3732
- const voiceDraftRef = (0, import_react5.useRef)(null);
3733
- const voiceAppendBaseRef = (0, import_react5.useRef)(null);
3734
- const voiceAppendBaseDurationRef = (0, import_react5.useRef)(0);
3735
- (0, import_react5.useEffect)(() => {
4056
+ const [voiceState, setVoiceState] = (0, import_react6.useState)("idle");
4057
+ const [voiceDraft, setVoiceDraft] = (0, import_react6.useState)(null);
4058
+ const [voiceTranscript, setVoiceTranscript] = (0, import_react6.useState)(clearVoiceTranscript);
4059
+ const [voiceDurationMs, setVoiceDurationMs] = (0, import_react6.useState)(0);
4060
+ const [voiceAudioLevel, setVoiceAudioLevel] = (0, import_react6.useState)(0);
4061
+ const [voiceCountdownMs, setVoiceCountdownMs] = (0, import_react6.useState)(0);
4062
+ const [isVoiceAutoSendActive, setIsVoiceAutoSendActive] = (0, import_react6.useState)(false);
4063
+ const [voiceError, setVoiceError] = (0, import_react6.useState)(null);
4064
+ const textareaRef = (0, import_react6.useRef)(null);
4065
+ const fileInputRef = (0, import_react6.useRef)(null);
4066
+ const mediaRecorderRef = (0, import_react6.useRef)(null);
4067
+ const recordingStartTime = (0, import_react6.useRef)(0);
4068
+ const recordingInterval = (0, import_react6.useRef)(null);
4069
+ const mediaStreamRef = (0, import_react6.useRef)(null);
4070
+ const voiceProviderRef = (0, import_react6.useRef)(null);
4071
+ const voiceDraftRef = (0, import_react6.useRef)(null);
4072
+ const voiceAppendBaseRef = (0, import_react6.useRef)(null);
4073
+ const voiceAppendBaseDurationRef = (0, import_react6.useRef)(0);
4074
+ (0, import_react6.useEffect)(() => {
3736
4075
  return () => {
3737
4076
  if (mediaStreamRef.current) {
3738
4077
  mediaStreamRef.current.getTracks().forEach((track) => track.stop());
@@ -3746,7 +4085,7 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
3746
4085
  }
3747
4086
  };
3748
4087
  }, []);
3749
- (0, import_react5.useEffect)(() => {
4088
+ (0, import_react6.useEffect)(() => {
3750
4089
  voiceDraftRef.current = voiceDraft;
3751
4090
  }, [voiceDraft]);
3752
4091
  const handleSubmit = (e) => {
@@ -3840,7 +4179,7 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
3840
4179
  }
3841
4180
  e.target.value = "";
3842
4181
  };
3843
- const handleDrop = (0, import_react5.useCallback)(async (e) => {
4182
+ const handleDrop = (0, import_react6.useCallback)(async (e) => {
3844
4183
  e.preventDefault();
3845
4184
  if (!enableFileUpload) return;
3846
4185
  const files = Array.from(e.dataTransfer.files);
@@ -3853,7 +4192,7 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
3853
4192
  }
3854
4193
  }
3855
4194
  }, [attachments, enableFileUpload, maxAttachments, onAttachmentsChange]);
3856
- const handleDragOver = (0, import_react5.useCallback)((e) => {
4195
+ const handleDragOver = (0, import_react6.useCallback)((e) => {
3857
4196
  e.preventDefault();
3858
4197
  }, []);
3859
4198
  const startRecording = async () => {
@@ -3923,7 +4262,7 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
3923
4262
  }
3924
4263
  }
3925
4264
  };
3926
- const resetVoiceComposerState = (0, import_react5.useCallback)((nextState = "idle") => {
4265
+ const resetVoiceComposerState = (0, import_react6.useCallback)((nextState = "idle") => {
3927
4266
  setVoiceState(nextState);
3928
4267
  setVoiceDraft(null);
3929
4268
  voiceDraftRef.current = null;
@@ -3936,11 +4275,11 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
3936
4275
  setIsVoiceAutoSendActive(false);
3937
4276
  setVoiceError(null);
3938
4277
  }, []);
3939
- const armVoiceDraftForAppend = (0, import_react5.useCallback)((segment) => {
4278
+ const armVoiceDraftForAppend = (0, import_react6.useCallback)((segment) => {
3940
4279
  voiceAppendBaseRef.current = segment;
3941
4280
  voiceAppendBaseDurationRef.current = segment ? resolveVoiceSegmentDuration(segment) : 0;
3942
4281
  }, []);
3943
- const handleVoiceProviderStateChange = (0, import_react5.useCallback)((nextState) => {
4282
+ const handleVoiceProviderStateChange = (0, import_react6.useCallback)((nextState) => {
3944
4283
  if (voiceReviewMode === "armed" && (nextState === "waiting_for_speech" || nextState === "listening")) {
3945
4284
  const currentDraft = voiceDraftRef.current;
3946
4285
  if (currentDraft) {
@@ -3953,7 +4292,7 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
3953
4292
  }
3954
4293
  setVoiceState(nextState);
3955
4294
  }, [armVoiceDraftForAppend, voiceAutoSendDelayMs, voiceReviewMode]);
3956
- const ensureVoiceProvider = (0, import_react5.useCallback)(async () => {
4295
+ const ensureVoiceProvider = (0, import_react6.useCallback)(async () => {
3957
4296
  if (voiceProviderRef.current) {
3958
4297
  return voiceProviderRef.current;
3959
4298
  }
@@ -4040,7 +4379,7 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4040
4379
  voiceProviderRef.current = provider;
4041
4380
  return provider;
4042
4381
  }, [armVoiceDraftForAppend, config, handleVoiceProviderStateChange, voiceAutoSendDelayMs, voiceMaxRecordingMs, voiceReviewMode]);
4043
- const closeVoiceComposer = (0, import_react5.useCallback)(async () => {
4382
+ const closeVoiceComposer = (0, import_react6.useCallback)(async () => {
4044
4383
  voiceAppendBaseRef.current = null;
4045
4384
  voiceAppendBaseDurationRef.current = 0;
4046
4385
  setIsVoiceComposerOpen(false);
@@ -4056,7 +4395,7 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4056
4395
  await voiceProviderRef.current.cancel();
4057
4396
  }
4058
4397
  }, []);
4059
- const startVoiceCapture = (0, import_react5.useCallback)(async (appendToDraft = false) => {
4398
+ const startVoiceCapture = (0, import_react6.useCallback)(async (appendToDraft = false) => {
4060
4399
  if (disabled || isGenerating) {
4061
4400
  return;
4062
4401
  }
@@ -4105,7 +4444,7 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4105
4444
  setVoiceState("error");
4106
4445
  }
4107
4446
  }, [disabled, isGenerating, ensureVoiceProvider, config]);
4108
- const stopVoiceCapture = (0, import_react5.useCallback)(async () => {
4447
+ const stopVoiceCapture = (0, import_react6.useCallback)(async () => {
4109
4448
  if (!voiceProviderRef.current) return;
4110
4449
  try {
4111
4450
  await voiceProviderRef.current.stop();
@@ -4114,7 +4453,7 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4114
4453
  setVoiceState("error");
4115
4454
  }
4116
4455
  }, [config]);
4117
- const cancelVoiceCapture = (0, import_react5.useCallback)(async () => {
4456
+ const cancelVoiceCapture = (0, import_react6.useCallback)(async () => {
4118
4457
  voiceAppendBaseRef.current = null;
4119
4458
  voiceAppendBaseDurationRef.current = 0;
4120
4459
  if (voiceProviderRef.current) {
@@ -4122,7 +4461,7 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4122
4461
  }
4123
4462
  resetVoiceComposerState("idle");
4124
4463
  }, [resetVoiceComposerState]);
4125
- const finalizeVoiceComposerAfterSend = (0, import_react5.useCallback)(() => {
4464
+ const finalizeVoiceComposerAfterSend = (0, import_react6.useCallback)(() => {
4126
4465
  if (voicePersistComposer) {
4127
4466
  resetVoiceComposerState("idle");
4128
4467
  setIsVoiceComposerOpen(true);
@@ -4130,7 +4469,7 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4130
4469
  }
4131
4470
  void closeVoiceComposer();
4132
4471
  }, [voicePersistComposer, resetVoiceComposerState, closeVoiceComposer]);
4133
- const sendVoiceDraft = (0, import_react5.useCallback)(() => {
4472
+ const sendVoiceDraft = (0, import_react6.useCallback)(() => {
4134
4473
  void (async () => {
4135
4474
  if (!voiceDraft || disabled || isGenerating) {
4136
4475
  return;
@@ -4156,7 +4495,7 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4156
4495
  onAttachmentsChange,
4157
4496
  finalizeVoiceComposerAfterSend
4158
4497
  ]);
4159
- const cancelVoiceAutoSend = (0, import_react5.useCallback)(() => {
4498
+ const cancelVoiceAutoSend = (0, import_react6.useCallback)(() => {
4160
4499
  void (async () => {
4161
4500
  if (voiceReviewMode === "armed" && voiceProviderRef.current) {
4162
4501
  await voiceProviderRef.current.cancel();
@@ -4168,7 +4507,7 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4168
4507
  setVoiceCountdownMs(0);
4169
4508
  setIsVoiceAutoSendActive(false);
4170
4509
  }, [armVoiceDraftForAppend, voiceReviewMode]);
4171
- const pauseVoiceReview = (0, import_react5.useCallback)(async () => {
4510
+ const pauseVoiceReview = (0, import_react6.useCallback)(async () => {
4172
4511
  if (voiceState === "listening") {
4173
4512
  await stopVoiceCapture();
4174
4513
  return;
@@ -4180,7 +4519,7 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4180
4519
  setVoiceAudioLevel(0);
4181
4520
  setVoiceState("review");
4182
4521
  }, [armVoiceDraftForAppend, stopVoiceCapture, voiceReviewMode, voiceState]);
4183
- (0, import_react5.useEffect)(() => {
4522
+ (0, import_react6.useEffect)(() => {
4184
4523
  if (!voiceDraft || voiceAutoSendDelayMs <= 0 || !isVoiceAutoSendActive) {
4185
4524
  return;
4186
4525
  }
@@ -4208,8 +4547,8 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4208
4547
  };
4209
4548
  const canAddMoreAttachments = attachments.length < maxAttachments;
4210
4549
  const showVoiceComposer = voiceComposeEnabled && isVoiceComposerOpen;
4211
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: `border-t py-0 bg-transparent ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "px-0 md:p-2 pb-1 space-y-4 bg-transparent", children: [
4212
- uploadProgress.size > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "space-y-2", children: Array.from(uploadProgress.entries()).map(([id, progress]) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4550
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: `border-t py-0 bg-transparent ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "px-0 md:p-2 pb-1 space-y-4 bg-transparent", children: [
4551
+ uploadProgress.size > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "space-y-2", children: Array.from(uploadProgress.entries()).map(([id, progress]) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4213
4552
  FileUploadItem,
4214
4553
  {
4215
4554
  file: { name: progress.fileName },
@@ -4224,7 +4563,7 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4224
4563
  },
4225
4564
  id
4226
4565
  )) }),
4227
- isRecording && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4566
+ isRecording && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4228
4567
  AudioRecorder,
4229
4568
  {
4230
4569
  isRecording,
@@ -4235,7 +4574,7 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4235
4574
  config
4236
4575
  }
4237
4576
  ),
4238
- attachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "grid grid-cols-4 gap-2", children: attachments.map((attachment, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4577
+ attachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "grid grid-cols-4 gap-2", children: attachments.map((attachment, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4239
4578
  AttachmentPreview,
4240
4579
  {
4241
4580
  attachment,
@@ -4243,7 +4582,7 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4243
4582
  },
4244
4583
  index
4245
4584
  )) }),
4246
- showVoiceComposer ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mb-1 flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4585
+ showVoiceComposer ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mb-1 flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4247
4586
  VoiceComposer,
4248
4587
  {
4249
4588
  state: voiceState,
@@ -4283,15 +4622,15 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4283
4622
  void closeVoiceComposer();
4284
4623
  }
4285
4624
  }
4286
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("form", { onSubmit: handleSubmit, className: "mb-1 flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
4625
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("form", { onSubmit: handleSubmit, className: "mb-1 flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
4287
4626
  "div",
4288
4627
  {
4289
4628
  className: "flex items-end gap-2 p-3 border rounded-lg bg-background w-full md:min-w-3xl max-w-3xl",
4290
4629
  onDrop: handleDrop,
4291
4630
  onDragOver: handleDragOver,
4292
4631
  children: [
4293
- enableFileUpload && canAddMoreAttachments && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
4294
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4632
+ enableFileUpload && canAddMoreAttachments && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
4633
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4295
4634
  "input",
4296
4635
  {
4297
4636
  ref: fileInputRef,
@@ -4302,8 +4641,8 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4302
4641
  className: "hidden"
4303
4642
  }
4304
4643
  ),
4305
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
4306
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4644
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Tooltip, { children: [
4645
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4307
4646
  Button,
4308
4647
  {
4309
4648
  type: "button",
@@ -4316,13 +4655,13 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4316
4655
  fileInputRef.current?.click();
4317
4656
  },
4318
4657
  disabled,
4319
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Paperclip, { className: "h-4 w-4" })
4658
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Paperclip, { className: "h-4 w-4" })
4320
4659
  }
4321
4660
  ) }),
4322
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { children: config?.labels?.attachFileTooltip })
4661
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipContent, { children: config?.labels?.attachFileTooltip })
4323
4662
  ] })
4324
4663
  ] }),
4325
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4664
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4326
4665
  Textarea,
4327
4666
  {
4328
4667
  ref: textareaRef,
@@ -4335,8 +4674,8 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4335
4674
  rows: 1
4336
4675
  }
4337
4676
  ) }),
4338
- enableAudioRecording && !isRecording && canAddMoreAttachments && !value.trim() && (voiceComposeEnabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
4339
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4677
+ enableAudioRecording && !isRecording && canAddMoreAttachments && !value.trim() && (voiceComposeEnabled ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Tooltip, { children: [
4678
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4340
4679
  Button,
4341
4680
  {
4342
4681
  type: "button",
@@ -4347,11 +4686,11 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4347
4686
  void startVoiceCapture();
4348
4687
  },
4349
4688
  disabled: disabled || isGenerating,
4350
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Mic, { className: "h-4 w-4" })
4689
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Mic, { className: "h-4 w-4" })
4351
4690
  }
4352
4691
  ) }),
4353
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { children: config?.labels?.voiceEnter || config?.labels?.recordAudioTooltip })
4354
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4692
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipContent, { children: config?.labels?.voiceEnter || config?.labels?.recordAudioTooltip })
4693
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4355
4694
  AudioRecorder,
4356
4695
  {
4357
4696
  isRecording,
@@ -4362,8 +4701,8 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4362
4701
  config
4363
4702
  }
4364
4703
  )),
4365
- isGenerating ? /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
4366
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4704
+ isGenerating ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Tooltip, { children: [
4705
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4367
4706
  Button,
4368
4707
  {
4369
4708
  type: "button",
@@ -4371,36 +4710,36 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4371
4710
  size: "icon",
4372
4711
  className: "h-10 w-10",
4373
4712
  onClick: onStopGeneration,
4374
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Square, { className: "h-4 w-4" })
4713
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Square, { className: "h-4 w-4" })
4375
4714
  }
4376
4715
  ) }),
4377
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { children: config?.labels?.stopGenerationTooltip })
4378
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(Tooltip, { children: [
4379
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4716
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipContent, { children: config?.labels?.stopGenerationTooltip })
4717
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Tooltip, { children: [
4718
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4380
4719
  Button,
4381
4720
  {
4382
4721
  type: "submit",
4383
4722
  size: "icon",
4384
4723
  className: "h-10 w-10",
4385
4724
  disabled: disabled || !value.trim() && attachments.length === 0,
4386
- children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react10.Send, { className: "h-4 w-4" })
4725
+ children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Send, { className: "h-4 w-4" })
4387
4726
  }
4388
4727
  ) }),
4389
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipContent, { children: config?.labels?.sendMessageTooltip })
4728
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(TooltipContent, { children: config?.labels?.sendMessageTooltip })
4390
4729
  ] })
4391
4730
  ]
4392
4731
  }
4393
4732
  ) }),
4394
- /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "text-[10px] text-muted-foreground text-center", children: [
4733
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "text-[10px] text-muted-foreground text-center", children: [
4395
4734
  window.innerWidth > 768 ? config?.labels?.inputHelpText : "",
4396
- attachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
4735
+ attachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
4397
4736
  " \u2022 ",
4398
4737
  attachments.length,
4399
4738
  "/",
4400
4739
  maxAttachments,
4401
4740
  " anexos"
4402
4741
  ] }),
4403
- config?.labels?.footerLabel && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
4742
+ config?.labels?.footerLabel && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
4404
4743
  " \u2022 ",
4405
4744
  config.labels.footerLabel
4406
4745
  ] })
@@ -4409,21 +4748,21 @@ var ChatInput = (0, import_react5.memo)(function ChatInput2({
4409
4748
  });
4410
4749
 
4411
4750
  // src/components/chat/UserProfile.tsx
4412
- var import_react6 = require("react");
4751
+ var import_react7 = require("react");
4413
4752
 
4414
4753
  // src/components/ui/scroll-area.tsx
4415
- var React11 = __toESM(require("react"), 1);
4754
+ var React12 = __toESM(require("react"), 1);
4416
4755
  var ScrollAreaPrimitive = __toESM(require("@radix-ui/react-scroll-area"), 1);
4417
- var import_jsx_runtime23 = require("react/jsx-runtime");
4418
- var ScrollArea = React11.forwardRef(({ className, children, viewportClassName, onScroll, onScrollCapture, ...props }, ref) => {
4419
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
4756
+ var import_jsx_runtime24 = require("react/jsx-runtime");
4757
+ var ScrollArea = React12.forwardRef(({ className, children, viewportClassName, onScroll, onScrollCapture, ...props }, ref) => {
4758
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
4420
4759
  ScrollAreaPrimitive.Root,
4421
4760
  {
4422
4761
  "data-slot": "scroll-area",
4423
4762
  className: cn("relative", className),
4424
4763
  ...props,
4425
4764
  children: [
4426
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4765
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4427
4766
  ScrollAreaPrimitive.Viewport,
4428
4767
  {
4429
4768
  ref,
@@ -4437,8 +4776,8 @@ var ScrollArea = React11.forwardRef(({ className, children, viewportClassName, o
4437
4776
  children
4438
4777
  }
4439
4778
  ),
4440
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ScrollBar, {}),
4441
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ScrollAreaPrimitive.Corner, {})
4779
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ScrollBar, {}),
4780
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ScrollAreaPrimitive.Corner, {})
4442
4781
  ]
4443
4782
  }
4444
4783
  );
@@ -4449,7 +4788,7 @@ function ScrollBar({
4449
4788
  orientation = "vertical",
4450
4789
  ...props
4451
4790
  }) {
4452
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4791
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4453
4792
  ScrollAreaPrimitive.ScrollAreaScrollbar,
4454
4793
  {
4455
4794
  "data-slot": "scroll-area-scrollbar",
@@ -4461,7 +4800,7 @@ function ScrollBar({
4461
4800
  className
4462
4801
  ),
4463
4802
  ...props,
4464
- children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4803
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4465
4804
  ScrollAreaPrimitive.ScrollAreaThumb,
4466
4805
  {
4467
4806
  "data-slot": "scroll-area-thumb",
@@ -4473,8 +4812,8 @@ function ScrollBar({
4473
4812
  }
4474
4813
 
4475
4814
  // src/components/chat/UserProfile.tsx
4476
- var import_lucide_react11 = require("lucide-react");
4477
- var import_jsx_runtime24 = require("react/jsx-runtime");
4815
+ var import_lucide_react12 = require("lucide-react");
4816
+ var import_jsx_runtime25 = require("react/jsx-runtime");
4478
4817
  var getInitials2 = (name, email) => {
4479
4818
  if (name) {
4480
4819
  return name.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase();
@@ -4488,29 +4827,29 @@ var getFieldIcon = (type, key) => {
4488
4827
  const iconClass = "h-4 w-4 text-muted-foreground";
4489
4828
  switch (type) {
4490
4829
  case "email":
4491
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Mail, { className: iconClass });
4830
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Mail, { className: iconClass });
4492
4831
  case "phone":
4493
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Phone, { className: iconClass });
4832
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Phone, { className: iconClass });
4494
4833
  case "url":
4495
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Globe, { className: iconClass });
4834
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Globe, { className: iconClass });
4496
4835
  case "date":
4497
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Calendar, { className: iconClass });
4836
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Calendar, { className: iconClass });
4498
4837
  }
4499
4838
  const lowerKey = key?.toLowerCase() || "";
4500
- if (lowerKey.includes("follower")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Users, { className: iconClass });
4501
- if (lowerKey.includes("following")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.UserPlus, { className: iconClass });
4502
- if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Image, { className: iconClass });
4503
- if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.BadgeCheck, { className: iconClass });
4504
- if (lowerKey.includes("bio")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.FileText, { className: iconClass });
4505
- if (lowerKey.includes("email")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Mail, { className: iconClass });
4506
- if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Phone, { className: iconClass });
4507
- if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.MapPin, { className: iconClass });
4508
- if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Building, { className: iconClass });
4509
- if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Briefcase, { className: iconClass });
4510
- if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Globe, { className: iconClass });
4511
- if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.AtSign, { className: iconClass });
4512
- if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Calendar, { className: iconClass });
4513
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.User, { className: iconClass });
4839
+ if (lowerKey.includes("follower")) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Users, { className: iconClass });
4840
+ if (lowerKey.includes("following")) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.UserPlus, { className: iconClass });
4841
+ if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Image, { className: iconClass });
4842
+ if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.BadgeCheck, { className: iconClass });
4843
+ if (lowerKey.includes("bio")) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.FileText, { className: iconClass });
4844
+ if (lowerKey.includes("email")) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Mail, { className: iconClass });
4845
+ if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Phone, { className: iconClass });
4846
+ if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.MapPin, { className: iconClass });
4847
+ if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Building, { className: iconClass });
4848
+ if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Briefcase, { className: iconClass });
4849
+ if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Globe, { className: iconClass });
4850
+ if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.AtSign, { className: iconClass });
4851
+ if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Calendar, { className: iconClass });
4852
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.User, { className: iconClass });
4514
4853
  };
4515
4854
  var formatValue = (value, type, key) => {
4516
4855
  if (value === null || value === void 0) return "-";
@@ -4544,15 +4883,15 @@ var getMemoryCategoryIcon = (category) => {
4544
4883
  const iconClass = "h-4 w-4 text-muted-foreground";
4545
4884
  switch (category) {
4546
4885
  case "preference":
4547
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Heart, { className: iconClass });
4886
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Heart, { className: iconClass });
4548
4887
  case "fact":
4549
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Info, { className: iconClass });
4888
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Info, { className: iconClass });
4550
4889
  case "goal":
4551
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Target, { className: iconClass });
4890
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Target, { className: iconClass });
4552
4891
  case "context":
4553
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Lightbulb, { className: iconClass });
4892
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Lightbulb, { className: iconClass });
4554
4893
  default:
4555
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Brain, { className: iconClass });
4894
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Brain, { className: iconClass });
4556
4895
  }
4557
4896
  };
4558
4897
  var getMemoryCategoryLabel = (category) => {
@@ -4583,10 +4922,10 @@ var UserProfile = ({
4583
4922
  onDeleteMemory,
4584
4923
  className
4585
4924
  }) => {
4586
- const [newMemoryContent, setNewMemoryContent] = (0, import_react6.useState)("");
4587
- const [isAddingMemory, setIsAddingMemory] = (0, import_react6.useState)(false);
4588
- const [editingMemoryId, setEditingMemoryId] = (0, import_react6.useState)(null);
4589
- const [editingMemoryContent, setEditingMemoryContent] = (0, import_react6.useState)("");
4925
+ const [newMemoryContent, setNewMemoryContent] = (0, import_react7.useState)("");
4926
+ const [isAddingMemory, setIsAddingMemory] = (0, import_react7.useState)(false);
4927
+ const [editingMemoryId, setEditingMemoryId] = (0, import_react7.useState)(null);
4928
+ const [editingMemoryContent, setEditingMemoryContent] = (0, import_react7.useState)("");
4590
4929
  const handleAddMemory = () => {
4591
4930
  if (newMemoryContent.trim() && onAddMemory) {
4592
4931
  onAddMemory(newMemoryContent.trim(), "other");
@@ -4622,66 +4961,66 @@ var UserProfile = ({
4622
4961
  const displayName = user?.name || user?.email?.split("@")[0] || "User";
4623
4962
  const initials = getInitials2(user?.name, user?.email);
4624
4963
  const normalizedFields = normalizeCustomFields(customFields);
4625
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Sheet, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
4964
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Sheet, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4626
4965
  SheetContent,
4627
4966
  {
4628
4967
  side: "right",
4629
4968
  className: cn("w-full sm:max-w-md p-0 flex flex-col h-full overflow-hidden", className),
4630
4969
  children: [
4631
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SheetHeader, { className: "px-6 py-4 border-b shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(SheetTitle, { children: labels.title }) }) }),
4632
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ScrollArea, { className: "flex-1 min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "p-6 space-y-6", children: [
4633
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col items-center text-center space-y-4", children: [
4634
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Avatar, { className: "h-24 w-24 shrink-0", children: [
4635
- user?.avatar && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AvatarImage, { src: user.avatar, alt: displayName }),
4636
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AvatarFallback, { className: "text-2xl bg-primary/10 text-primary", children: initials })
4970
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SheetHeader, { className: "px-6 py-4 border-b shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SheetTitle, { children: labels.title }) }) }),
4971
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ScrollArea, { className: "flex-1 min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "p-6 space-y-6", children: [
4972
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col items-center text-center space-y-4", children: [
4973
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Avatar, { className: "h-24 w-24 shrink-0", children: [
4974
+ user?.avatar && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AvatarImage, { src: user.avatar, alt: displayName }),
4975
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AvatarFallback, { className: "text-2xl bg-primary/10 text-primary", children: initials })
4637
4976
  ] }),
4638
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "w-full px-2", children: [
4639
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h2", { className: "text-xl font-semibold break-words", children: displayName }),
4640
- user?.email && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-sm text-muted-foreground break-words", children: user.email })
4977
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "w-full px-2", children: [
4978
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h2", { className: "text-xl font-semibold break-words", children: displayName }),
4979
+ user?.email && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm text-muted-foreground break-words", children: user.email })
4641
4980
  ] })
4642
4981
  ] }),
4643
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Separator, {}),
4644
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "space-y-3", children: [
4645
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.basicInfo }),
4646
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "space-y-2", children: [
4647
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
4648
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.User, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
4649
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex-1 min-w-0", children: [
4650
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-xs text-muted-foreground", children: "Name" }),
4651
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-sm font-medium break-words", children: displayName })
4982
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Separator, {}),
4983
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "space-y-3", children: [
4984
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.basicInfo }),
4985
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "space-y-2", children: [
4986
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
4987
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.User, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
4988
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex-1 min-w-0", children: [
4989
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-xs text-muted-foreground", children: "Name" }),
4990
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm font-medium break-words", children: displayName })
4652
4991
  ] })
4653
4992
  ] }),
4654
- user?.email && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
4655
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.AtSign, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
4656
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex-1 min-w-0", children: [
4657
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-xs text-muted-foreground", children: "Handle" }),
4658
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-sm font-medium break-words", children: user.email })
4993
+ user?.email && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
4994
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.AtSign, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
4995
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex-1 min-w-0", children: [
4996
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-xs text-muted-foreground", children: "Handle" }),
4997
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm font-medium break-words", children: user.email })
4659
4998
  ] })
4660
4999
  ] }),
4661
- user?.id && user.id !== user?.name && user.id !== user?.email && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
4662
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.User, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
4663
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex-1 min-w-0", children: [
4664
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-xs text-muted-foreground", children: "ID" }),
4665
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-sm font-medium break-words", children: user.id })
5000
+ user?.id && user.id !== user?.name && user.id !== user?.email && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
5001
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.User, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
5002
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex-1 min-w-0", children: [
5003
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-xs text-muted-foreground", children: "ID" }),
5004
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm font-medium break-words", children: user.id })
4666
5005
  ] })
4667
5006
  ] })
4668
5007
  ] })
4669
5008
  ] }),
4670
- normalizedFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
4671
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Separator, {}),
4672
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "space-y-3", children: [
4673
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.customFields }),
4674
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "space-y-2", children: normalizedFields.map((field) => {
5009
+ normalizedFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
5010
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Separator, {}),
5011
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "space-y-3", children: [
5012
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.customFields }),
5013
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "space-y-2", children: normalizedFields.map((field) => {
4675
5014
  const isBioField = field.key.toLowerCase().includes("bio");
4676
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
5015
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4677
5016
  "div",
4678
5017
  {
4679
5018
  className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50",
4680
5019
  children: [
4681
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "mt-0.5 shrink-0", children: field.icon || getFieldIcon(field.type, field.key) }),
4682
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex-1 min-w-0", children: [
4683
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-xs text-muted-foreground", children: field.label }),
4684
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: cn(
5020
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "mt-0.5 shrink-0", children: field.icon || getFieldIcon(field.type, field.key) }),
5021
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex-1 min-w-0", children: [
5022
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-xs text-muted-foreground", children: field.label }),
5023
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: cn(
4685
5024
  "text-sm font-medium",
4686
5025
  isBioField ? "whitespace-pre-wrap break-words" : "break-words"
4687
5026
  ), children: formatValue(field.value, field.type, field.key) })
@@ -4693,26 +5032,26 @@ var UserProfile = ({
4693
5032
  }) })
4694
5033
  ] })
4695
5034
  ] }),
4696
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Separator, {}),
4697
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "space-y-3", children: [
4698
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center justify-between", children: [
4699
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider flex items-center gap-2", children: [
4700
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Brain, { className: "h-4 w-4" }),
5035
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Separator, {}),
5036
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "space-y-3", children: [
5037
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center justify-between", children: [
5038
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider flex items-center gap-2", children: [
5039
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Brain, { className: "h-4 w-4" }),
4701
5040
  labels.memories
4702
5041
  ] }),
4703
- onAddMemory && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5042
+ onAddMemory && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4704
5043
  Button,
4705
5044
  {
4706
5045
  variant: "ghost",
4707
5046
  size: "sm",
4708
5047
  className: "h-7 px-2",
4709
5048
  onClick: () => setIsAddingMemory(true),
4710
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Plus, { className: "h-4 w-4" })
5049
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Plus, { className: "h-4 w-4" })
4711
5050
  }
4712
5051
  )
4713
5052
  ] }),
4714
- isAddingMemory && onAddMemory && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex gap-2", children: [
4715
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5053
+ isAddingMemory && onAddMemory && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex gap-2", children: [
5054
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4716
5055
  Input,
4717
5056
  {
4718
5057
  value: newMemoryContent,
@@ -4729,24 +5068,24 @@ var UserProfile = ({
4729
5068
  autoFocus: true
4730
5069
  }
4731
5070
  ),
4732
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { size: "sm", onClick: handleAddMemory, disabled: !newMemoryContent.trim(), children: "Salvar" })
5071
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { size: "sm", onClick: handleAddMemory, disabled: !newMemoryContent.trim(), children: "Salvar" })
4733
5072
  ] }),
4734
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "space-y-2", children: memories.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-sm text-muted-foreground text-center py-4", children: labels.noMemories }) : memories.map((memory) => {
5073
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "space-y-2", children: memories.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm text-muted-foreground text-center py-4", children: labels.noMemories }) : memories.map((memory) => {
4735
5074
  const isEditing = editingMemoryId === memory.id;
4736
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
5075
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4737
5076
  "div",
4738
5077
  {
4739
5078
  className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50 group",
4740
5079
  children: [
4741
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "mt-0.5 shrink-0", children: memory.source === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Bot, { className: "h-4 w-4 text-primary" }) : getMemoryCategoryIcon(memory.category) }),
4742
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex-1 min-w-0", children: [
4743
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2 mb-0.5", children: [
4744
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-xs text-muted-foreground", children: getMemoryCategoryLabel(memory.category) }),
4745
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-xs text-muted-foreground", children: "\u2022" }),
4746
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-xs text-muted-foreground", children: memory.source === "agent" ? "IA" : "Voc\xEA" })
5080
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "mt-0.5 shrink-0", children: memory.source === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Bot, { className: "h-4 w-4 text-primary" }) : getMemoryCategoryIcon(memory.category) }),
5081
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex-1 min-w-0", children: [
5082
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex items-center gap-2 mb-0.5", children: [
5083
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-xs text-muted-foreground", children: getMemoryCategoryLabel(memory.category) }),
5084
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-xs text-muted-foreground", children: "\u2022" }),
5085
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-xs text-muted-foreground", children: memory.source === "agent" ? "IA" : "Voc\xEA" })
4747
5086
  ] }),
4748
- isEditing ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "space-y-2", children: [
4749
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5087
+ isEditing ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "space-y-2", children: [
5088
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4750
5089
  Textarea,
4751
5090
  {
4752
5091
  value: editingMemoryContent,
@@ -4763,8 +5102,8 @@ var UserProfile = ({
4763
5102
  }
4764
5103
  }
4765
5104
  ),
4766
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex gap-1 justify-end", children: [
4767
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
5105
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex gap-1 justify-end", children: [
5106
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4768
5107
  Button,
4769
5108
  {
4770
5109
  variant: "ghost",
@@ -4772,12 +5111,12 @@ var UserProfile = ({
4772
5111
  className: "h-7 px-2",
4773
5112
  onClick: handleCancelEdit,
4774
5113
  children: [
4775
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.X, { className: "h-3.5 w-3.5 mr-1" }),
5114
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.X, { className: "h-3.5 w-3.5 mr-1" }),
4776
5115
  "Cancelar"
4777
5116
  ]
4778
5117
  }
4779
5118
  ),
4780
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
5119
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4781
5120
  Button,
4782
5121
  {
4783
5122
  size: "sm",
@@ -4785,33 +5124,33 @@ var UserProfile = ({
4785
5124
  onClick: handleSaveEdit,
4786
5125
  disabled: !editingMemoryContent.trim(),
4787
5126
  children: [
4788
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Check, { className: "h-3.5 w-3.5 mr-1" }),
5127
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Check, { className: "h-3.5 w-3.5 mr-1" }),
4789
5128
  "Salvar"
4790
5129
  ]
4791
5130
  }
4792
5131
  )
4793
5132
  ] })
4794
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-sm break-words", children: memory.content })
5133
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm break-words", children: memory.content })
4795
5134
  ] }),
4796
- !isEditing && (onUpdateMemory || onDeleteMemory) && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0", children: [
4797
- onUpdateMemory && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5135
+ !isEditing && (onUpdateMemory || onDeleteMemory) && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0", children: [
5136
+ onUpdateMemory && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4798
5137
  Button,
4799
5138
  {
4800
5139
  variant: "ghost",
4801
5140
  size: "icon",
4802
5141
  className: "h-7 w-7",
4803
5142
  onClick: () => handleStartEdit(memory),
4804
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Pencil, { className: "h-3.5 w-3.5 text-muted-foreground" })
5143
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Pencil, { className: "h-3.5 w-3.5 text-muted-foreground" })
4805
5144
  }
4806
5145
  ),
4807
- onDeleteMemory && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5146
+ onDeleteMemory && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4808
5147
  Button,
4809
5148
  {
4810
5149
  variant: "ghost",
4811
5150
  size: "icon",
4812
5151
  className: "h-7 w-7",
4813
5152
  onClick: () => onDeleteMemory(memory.id),
4814
- children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react11.Trash2, { className: "h-3.5 w-3.5 text-destructive" })
5153
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Trash2, { className: "h-3.5 w-3.5 text-destructive" })
4815
5154
  }
4816
5155
  )
4817
5156
  ] })
@@ -4822,8 +5161,8 @@ var UserProfile = ({
4822
5161
  }) })
4823
5162
  ] })
4824
5163
  ] }) }),
4825
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "p-4 border-t space-y-2 shrink-0", children: [
4826
- onEditProfile && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5164
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "p-4 border-t space-y-2 shrink-0", children: [
5165
+ onEditProfile && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4827
5166
  Button,
4828
5167
  {
4829
5168
  variant: "outline",
@@ -4832,7 +5171,7 @@ var UserProfile = ({
4832
5171
  children: "Edit Profile"
4833
5172
  }
4834
5173
  ),
4835
- onLogout && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
5174
+ onLogout && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4836
5175
  Button,
4837
5176
  {
4838
5177
  variant: "destructive",
@@ -4848,8 +5187,8 @@ var UserProfile = ({
4848
5187
  };
4849
5188
 
4850
5189
  // src/components/chat/ChatUI.tsx
4851
- var import_lucide_react12 = require("lucide-react");
4852
- var import_jsx_runtime25 = require("react/jsx-runtime");
5190
+ var import_lucide_react13 = require("lucide-react");
5191
+ var import_jsx_runtime26 = require("react/jsx-runtime");
4853
5192
  var ChatUI = ({
4854
5193
  messages = [],
4855
5194
  threads = [],
@@ -4866,6 +5205,10 @@ var ChatUI = ({
4866
5205
  agentOptions = [],
4867
5206
  selectedAgentId = null,
4868
5207
  onSelectAgent,
5208
+ participantIds,
5209
+ onParticipantsChange,
5210
+ targetAgentId = null,
5211
+ onTargetAgentChange,
4869
5212
  className = "",
4870
5213
  onAddMemory,
4871
5214
  onUpdateMemory,
@@ -4873,12 +5216,12 @@ var ChatUI = ({
4873
5216
  initialInput,
4874
5217
  onInitialInputConsumed
4875
5218
  }) => {
4876
- const config = (0, import_react7.useMemo)(
5219
+ const config = (0, import_react8.useMemo)(
4877
5220
  () => mergeConfig(defaultChatConfig, userConfig),
4878
5221
  [userConfig]
4879
5222
  );
4880
- const [isMobile, setIsMobile] = (0, import_react7.useState)(false);
4881
- const [isUserProfileOpen, setIsUserProfileOpen] = (0, import_react7.useState)(false);
5223
+ const [isMobile, setIsMobile] = (0, import_react8.useState)(false);
5224
+ const [isUserProfileOpen, setIsUserProfileOpen] = (0, import_react8.useState)(false);
4882
5225
  let userContext;
4883
5226
  try {
4884
5227
  const contextValue = useChatUserContext();
@@ -4892,10 +5235,10 @@ var ChatUI = ({
4892
5235
  }
4893
5236
  return false;
4894
5237
  };
4895
- const [inputValue, setInputValue] = (0, import_react7.useState)("");
4896
- const [attachments, setAttachments] = (0, import_react7.useState)([]);
4897
- const [expandedMessageIds, setExpandedMessageIds] = (0, import_react7.useState)({});
4898
- const [state, setState] = (0, import_react7.useState)({
5238
+ const [inputValue, setInputValue] = (0, import_react8.useState)("");
5239
+ const [attachments, setAttachments] = (0, import_react8.useState)([]);
5240
+ const [expandedMessageIds, setExpandedMessageIds] = (0, import_react8.useState)({});
5241
+ const [state, setState] = (0, import_react8.useState)({
4899
5242
  isRecording: false,
4900
5243
  selectedThreadId: currentThreadId,
4901
5244
  isAtBottom: true,
@@ -4907,41 +5250,41 @@ var ChatUI = ({
4907
5250
  isSidebarCollapsed: false
4908
5251
  // No longer used for main sidebar
4909
5252
  });
4910
- (0, import_react7.useEffect)(() => {
5253
+ (0, import_react8.useEffect)(() => {
4911
5254
  if (currentThreadId !== state.selectedThreadId) {
4912
5255
  setState((prev) => ({ ...prev, selectedThreadId: currentThreadId }));
4913
5256
  }
4914
5257
  }, [currentThreadId]);
4915
- const initialInputApplied = (0, import_react7.useRef)(false);
4916
- const initialInputConsumedRef = (0, import_react7.useRef)(false);
4917
- (0, import_react7.useEffect)(() => {
5258
+ const initialInputApplied = (0, import_react8.useRef)(false);
5259
+ const initialInputConsumedRef = (0, import_react8.useRef)(false);
5260
+ (0, import_react8.useEffect)(() => {
4918
5261
  if (initialInput && !initialInputApplied.current) {
4919
5262
  setInputValue(initialInput);
4920
5263
  initialInputApplied.current = true;
4921
5264
  }
4922
5265
  }, [initialInput]);
4923
- const scrollAreaRef = (0, import_react7.useRef)(null);
4924
- const stateRef = (0, import_react7.useRef)(state);
4925
- const inputValueRef = (0, import_react7.useRef)(inputValue);
4926
- const attachmentsRef = (0, import_react7.useRef)(attachments);
4927
- (0, import_react7.useEffect)(() => {
5266
+ const scrollAreaRef = (0, import_react8.useRef)(null);
5267
+ const stateRef = (0, import_react8.useRef)(state);
5268
+ const inputValueRef = (0, import_react8.useRef)(inputValue);
5269
+ const attachmentsRef = (0, import_react8.useRef)(attachments);
5270
+ (0, import_react8.useEffect)(() => {
4928
5271
  stateRef.current = state;
4929
5272
  }, [state]);
4930
- (0, import_react7.useEffect)(() => {
5273
+ (0, import_react8.useEffect)(() => {
4931
5274
  inputValueRef.current = inputValue;
4932
5275
  }, [inputValue]);
4933
- (0, import_react7.useEffect)(() => {
5276
+ (0, import_react8.useEffect)(() => {
4934
5277
  attachmentsRef.current = attachments;
4935
5278
  }, [attachments]);
4936
- const [isCustomMounted, setIsCustomMounted] = (0, import_react7.useState)(false);
4937
- const [isCustomVisible, setIsCustomVisible] = (0, import_react7.useState)(false);
5279
+ const [isCustomMounted, setIsCustomMounted] = (0, import_react8.useState)(false);
5280
+ const [isCustomVisible, setIsCustomVisible] = (0, import_react8.useState)(false);
4938
5281
  const virtualizer = (0, import_react_virtual.useVirtualizer)({
4939
5282
  count: messages.length,
4940
5283
  getScrollElement: () => scrollAreaRef.current,
4941
5284
  estimateSize: () => 100,
4942
5285
  overscan: 5
4943
5286
  });
4944
- const createStateCallback = (0, import_react7.useCallback)(
5287
+ const createStateCallback = (0, import_react8.useCallback)(
4945
5288
  (setter) => ({
4946
5289
  setState: (newState) => setter?.(newState),
4947
5290
  getState: () => ({
@@ -4953,7 +5296,7 @@ var ChatUI = ({
4953
5296
  []
4954
5297
  // No dependencies - uses refs for latest state
4955
5298
  );
4956
- (0, import_react7.useEffect)(() => {
5299
+ (0, import_react8.useEffect)(() => {
4957
5300
  const checkMobile = () => {
4958
5301
  setIsMobile(globalThis.innerWidth < 1024);
4959
5302
  };
@@ -4961,7 +5304,7 @@ var ChatUI = ({
4961
5304
  globalThis.addEventListener("resize", checkMobile);
4962
5305
  return () => globalThis.removeEventListener("resize", checkMobile);
4963
5306
  }, []);
4964
- (0, import_react7.useEffect)(() => {
5307
+ (0, import_react8.useEffect)(() => {
4965
5308
  if (!isMobile || !config.customComponent?.component) return;
4966
5309
  if (state.showSidebar) {
4967
5310
  setIsCustomMounted(true);
@@ -4972,8 +5315,8 @@ var ChatUI = ({
4972
5315
  return () => clearTimeout(t);
4973
5316
  }
4974
5317
  }, [state.showSidebar, isMobile, config.customComponent]);
4975
- const prevMessageCountRef = (0, import_react7.useRef)(0);
4976
- (0, import_react7.useEffect)(() => {
5318
+ const prevMessageCountRef = (0, import_react8.useRef)(0);
5319
+ (0, import_react8.useEffect)(() => {
4977
5320
  if (messages.length === 0) {
4978
5321
  prevMessageCountRef.current = 0;
4979
5322
  return;
@@ -4999,10 +5342,10 @@ var ChatUI = ({
4999
5342
  }
5000
5343
  });
5001
5344
  }, [messages, state.isAtBottom, virtualizer]);
5002
- (0, import_react7.useEffect)(() => {
5345
+ (0, import_react8.useEffect)(() => {
5003
5346
  virtualizer.measure();
5004
5347
  }, [expandedMessageIds, virtualizer]);
5005
- (0, import_react7.useEffect)(() => {
5348
+ (0, import_react8.useEffect)(() => {
5006
5349
  const validMessageIds = new Set(messages.map((message) => message.id));
5007
5350
  setExpandedMessageIds((prev) => {
5008
5351
  const activeIds = Object.keys(prev);
@@ -5017,7 +5360,7 @@ var ChatUI = ({
5017
5360
  return next;
5018
5361
  });
5019
5362
  }, [messages]);
5020
- const handleScroll = (0, import_react7.useCallback)((e) => {
5363
+ const handleScroll = (0, import_react8.useCallback)((e) => {
5021
5364
  const { scrollTop, scrollHeight, clientHeight } = e.currentTarget;
5022
5365
  const isAtBottom = scrollHeight - scrollTop - clientHeight < 50;
5023
5366
  setState((prev) => {
@@ -5025,7 +5368,7 @@ var ChatUI = ({
5025
5368
  return { ...prev, isAtBottom };
5026
5369
  });
5027
5370
  }, []);
5028
- const handleSendMessage = (0, import_react7.useCallback)((content, messageAttachments = []) => {
5371
+ const handleSendMessage = (0, import_react8.useCallback)((content, messageAttachments = []) => {
5029
5372
  if (!content.trim() && messageAttachments.length === 0) return;
5030
5373
  callbacks.onSendMessage?.(content, messageAttachments, createStateCallback());
5031
5374
  if (initialInputApplied.current && !initialInputConsumedRef.current) {
@@ -5035,7 +5378,7 @@ var ChatUI = ({
5035
5378
  setInputValue("");
5036
5379
  setAttachments([]);
5037
5380
  }, [callbacks, createStateCallback, onInitialInputConsumed]);
5038
- const handleMessageAction = (0, import_react7.useCallback)((event) => {
5381
+ const handleMessageAction = (0, import_react8.useCallback)((event) => {
5039
5382
  const { action, messageId, content } = event;
5040
5383
  switch (action) {
5041
5384
  case "copy":
@@ -5054,7 +5397,7 @@ var ChatUI = ({
5054
5397
  break;
5055
5398
  }
5056
5399
  }, [callbacks, createStateCallback]);
5057
- const handleToggleMessageExpansion = (0, import_react7.useCallback)((messageId) => {
5400
+ const handleToggleMessageExpansion = (0, import_react8.useCallback)((messageId) => {
5058
5401
  setExpandedMessageIds((prev) => {
5059
5402
  if (prev[messageId]) {
5060
5403
  const next = { ...prev };
@@ -5067,44 +5410,44 @@ var ChatUI = ({
5067
5410
  };
5068
5411
  });
5069
5412
  }, []);
5070
- const handleCreateThread = (0, import_react7.useCallback)((title) => {
5413
+ const handleCreateThread = (0, import_react8.useCallback)((title) => {
5071
5414
  callbacks.onCreateThread?.(title, createStateCallback());
5072
5415
  }, [callbacks, createStateCallback]);
5073
- const handleSelectThread = (0, import_react7.useCallback)((threadId) => {
5416
+ const handleSelectThread = (0, import_react8.useCallback)((threadId) => {
5074
5417
  callbacks.onSelectThread?.(threadId, createStateCallback());
5075
5418
  }, [callbacks, createStateCallback]);
5076
- const handleRenameThread = (0, import_react7.useCallback)((threadId, newTitle) => {
5419
+ const handleRenameThread = (0, import_react8.useCallback)((threadId, newTitle) => {
5077
5420
  callbacks.onRenameThread?.(threadId, newTitle, createStateCallback());
5078
5421
  }, [callbacks, createStateCallback]);
5079
- const handleDeleteThread = (0, import_react7.useCallback)((threadId) => {
5422
+ const handleDeleteThread = (0, import_react8.useCallback)((threadId) => {
5080
5423
  callbacks.onDeleteThread?.(threadId, createStateCallback());
5081
5424
  }, [callbacks, createStateCallback]);
5082
- const handleArchiveThread = (0, import_react7.useCallback)((threadId) => {
5425
+ const handleArchiveThread = (0, import_react8.useCallback)((threadId) => {
5083
5426
  callbacks.onArchiveThread?.(threadId, createStateCallback());
5084
5427
  }, [callbacks, createStateCallback]);
5085
- const closeSidebar = (0, import_react7.useCallback)(() => {
5428
+ const closeSidebar = (0, import_react8.useCallback)(() => {
5086
5429
  setState((prev) => ({ ...prev, showSidebar: false }));
5087
5430
  }, []);
5088
- const handleCustomComponentToggle = (0, import_react7.useCallback)(() => {
5431
+ const handleCustomComponentToggle = (0, import_react8.useCallback)(() => {
5089
5432
  setState((prev) => ({ ...prev, showSidebar: !prev.showSidebar }));
5090
5433
  }, []);
5091
- const sidebarUser = (0, import_react7.useMemo)(() => user ? {
5434
+ const sidebarUser = (0, import_react8.useMemo)(() => user ? {
5092
5435
  id: user.id,
5093
5436
  name: user.name,
5094
5437
  email: user.email,
5095
5438
  avatar: user.avatar
5096
5439
  } : null, [user?.id, user?.name, user?.email, user?.avatar]);
5097
- const handleViewProfile = (0, import_react7.useCallback)(() => {
5440
+ const handleViewProfile = (0, import_react8.useCallback)(() => {
5098
5441
  setIsUserProfileOpen(true);
5099
5442
  callbacks.onViewProfile?.();
5100
5443
  }, [callbacks.onViewProfile]);
5101
- const sidebarUserMenuCallbacks = (0, import_react7.useMemo)(() => ({
5444
+ const sidebarUserMenuCallbacks = (0, import_react8.useMemo)(() => ({
5102
5445
  onViewProfile: handleViewProfile,
5103
5446
  onOpenSettings: callbacks.onOpenSettings,
5104
5447
  onThemeChange: callbacks.onThemeChange,
5105
5448
  onLogout: callbacks.onLogout
5106
5449
  }), [handleViewProfile, callbacks.onOpenSettings, callbacks.onThemeChange, callbacks.onLogout]);
5107
- const renderCustomComponent = (0, import_react7.useCallback)(() => {
5450
+ const renderCustomComponent = (0, import_react8.useCallback)(() => {
5108
5451
  const component = config?.customComponent?.component;
5109
5452
  if (!component) return null;
5110
5453
  if (typeof component === "function") {
@@ -5112,16 +5455,16 @@ var ChatUI = ({
5112
5455
  }
5113
5456
  return component;
5114
5457
  }, [config?.customComponent?.component, closeSidebar, isMobile]);
5115
- const SuggestionIconComponents = [import_lucide_react12.MessageSquare, import_lucide_react12.Lightbulb, import_lucide_react12.Zap, import_lucide_react12.HelpCircle];
5458
+ const SuggestionIconComponents = [import_lucide_react13.MessageSquare, import_lucide_react13.Lightbulb, import_lucide_react13.Zap, import_lucide_react13.HelpCircle];
5116
5459
  const renderSuggestions = () => {
5117
5460
  if (messages.length > 0 || !suggestions.length) return null;
5118
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col items-center justify-center min-h-[60vh] py-8 px-4", children: [
5119
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "text-center mb-8", children: [
5120
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "inline-flex items-center justify-center w-14 h-14 rounded-2xl bg-gradient-to-br from-primary/20 to-primary/5 mb-4 shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Sparkles, { className: "w-7 h-7 text-primary" }) }),
5121
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h2", { className: "text-xl font-semibold mb-2", children: config.branding.title }),
5122
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-muted-foreground text-sm max-w-md", children: config.branding.subtitle })
5461
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col items-center justify-center min-h-[60vh] py-8 px-4", children: [
5462
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "text-center mb-8", children: [
5463
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "inline-flex items-center justify-center w-14 h-14 rounded-2xl bg-gradient-to-br from-primary/20 to-primary/5 mb-4 shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Sparkles, { className: "w-7 h-7 text-primary" }) }),
5464
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h2", { className: "text-xl font-semibold mb-2", children: config.branding.title }),
5465
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-muted-foreground text-sm max-w-md", children: config.branding.subtitle })
5123
5466
  ] }),
5124
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 w-full max-w-2xl", children: suggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
5467
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 w-full max-w-2xl", children: suggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
5125
5468
  "button",
5126
5469
  {
5127
5470
  type: "button",
@@ -5130,10 +5473,10 @@ var ChatUI = ({
5130
5473
  children: [
5131
5474
  (() => {
5132
5475
  const IconComponent = SuggestionIconComponents[index % SuggestionIconComponents.length];
5133
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex items-center justify-center w-8 h-8 rounded-lg bg-primary/10 text-primary shrink-0 group-hover:bg-primary/15 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(IconComponent, { className: "h-4 w-4" }) });
5476
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex items-center justify-center w-8 h-8 rounded-lg bg-primary/10 text-primary shrink-0 group-hover:bg-primary/15 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(IconComponent, { className: "h-4 w-4" }) });
5134
5477
  })(),
5135
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "flex-1 min-w-0 pr-6", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("p", { className: "text-sm font-medium leading-snug line-clamp-2", children: suggestion }) }),
5136
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.ArrowRight, { className: "absolute right-4 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity" })
5478
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex-1 min-w-0 pr-6", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-sm font-medium leading-snug line-clamp-2", children: suggestion }) }),
5479
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.ArrowRight, { className: "absolute right-4 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity" })
5137
5480
  ]
5138
5481
  },
5139
5482
  index
@@ -5144,40 +5487,41 @@ var ChatUI = ({
5144
5487
  const items = messageSuggestions?.[messageId];
5145
5488
  if (!items || items.length === 0) return null;
5146
5489
  const inlineSuggestionOffsetClass = config.ui.showAvatars ? config.ui.compactMode ? "ml-9" : "ml-11" : "";
5147
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: `flex flex-wrap gap-2 mt-2 ${inlineSuggestionOffsetClass}`, children: items.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
5490
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: `flex flex-wrap gap-2 mt-2 ${inlineSuggestionOffsetClass}`, children: items.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
5148
5491
  "button",
5149
5492
  {
5150
5493
  type: "button",
5151
5494
  onClick: () => handleSendMessage(suggestion),
5152
5495
  className: "group inline-flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-full border border-border bg-background hover:bg-accent hover:border-accent-foreground/20 transition-all duration-150 text-foreground/80 hover:text-foreground",
5153
5496
  children: [
5154
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_lucide_react12.Sparkles, { className: "h-3 w-3 text-primary opacity-70 group-hover:opacity-100" }),
5155
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "max-w-[200px] truncate", children: suggestion })
5497
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Sparkles, { className: "h-3 w-3 text-primary opacity-70 group-hover:opacity-100" }),
5498
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "max-w-[200px] truncate", children: suggestion })
5156
5499
  ]
5157
5500
  },
5158
5501
  `${messageId}-suggestion-${index}`
5159
5502
  )) });
5160
5503
  };
5161
- const renderMessageLoadingSkeleton = () => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "space-y-6 py-2", children: [0, 1, 2, 3].map((index) => {
5504
+ const renderMessageLoadingSkeleton = () => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "space-y-6 py-2", children: [0, 1, 2, 3].map((index) => {
5162
5505
  const isUserRow = index % 2 === 1;
5163
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
5506
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
5164
5507
  "div",
5165
5508
  {
5166
5509
  className: `flex gap-3 ${isUserRow ? "justify-end" : "justify-start"}`,
5167
5510
  children: [
5168
- !isUserRow && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" }),
5169
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `space-y-2 ${isUserRow ? "w-[70%]" : "w-[75%]"}`, children: [
5170
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Skeleton, { className: "h-4 w-24" }),
5171
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Skeleton, { className: "h-4 w-full" }),
5172
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Skeleton, { className: "h-4 w-[85%]" })
5511
+ !isUserRow && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" }),
5512
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `space-y-2 ${isUserRow ? "w-[70%]" : "w-[75%]"}`, children: [
5513
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Skeleton, { className: "h-4 w-24" }),
5514
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Skeleton, { className: "h-4 w-full" }),
5515
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Skeleton, { className: "h-4 w-[85%]" })
5173
5516
  ] }),
5174
- isUserRow && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" })
5517
+ isUserRow && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" })
5175
5518
  ]
5176
5519
  },
5177
5520
  `message-skeleton-${index}`
5178
5521
  );
5179
5522
  }) });
5180
- const messageProps = (0, import_react7.useMemo)(() => ({
5523
+ const isMultiAgentMode = config.agentSelector?.mode === "multi";
5524
+ const messageProps = (0, import_react8.useMemo)(() => ({
5181
5525
  userAvatar: user?.avatar,
5182
5526
  userName: user?.name,
5183
5527
  assistantAvatar: assistant?.avatar,
@@ -5200,12 +5544,15 @@ var ChatUI = ({
5200
5544
  longMessageChunkChars: config.ui.longMessageChunkChars,
5201
5545
  renderUserMarkdown: config.ui.renderUserMarkdown,
5202
5546
  markdown: config.markdown,
5203
- onToggleExpanded: handleToggleMessageExpansion
5547
+ onToggleExpanded: handleToggleMessageExpansion,
5548
+ agentOptions: isMultiAgentMode ? agentOptions : void 0
5204
5549
  }), [
5205
5550
  user?.avatar,
5206
5551
  user?.name,
5207
5552
  assistant?.avatar,
5208
5553
  assistant?.name,
5554
+ isMultiAgentMode,
5555
+ agentOptions,
5209
5556
  config.ui.showTimestamps,
5210
5557
  config.ui.showAvatars,
5211
5558
  config.ui.compactMode,
@@ -5227,10 +5574,10 @@ var ChatUI = ({
5227
5574
  handleToggleMessageExpansion
5228
5575
  ]);
5229
5576
  const shouldShowAgentSelector = Boolean(
5230
- config.agentSelector?.enabled && onSelectAgent && agentOptions.length > 0 && (!config.agentSelector?.hideIfSingle || agentOptions.length > 1)
5577
+ config.agentSelector?.enabled && agentOptions.length > 0 && (!config.agentSelector?.hideIfSingle || agentOptions.length > 1) && (isMultiAgentMode ? onParticipantsChange : onSelectAgent)
5231
5578
  );
5232
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SidebarProvider, { defaultOpen: true, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: `flex h-[100svh] md:h-screen bg-background w-full overflow-hidden ${className}`, children: [
5233
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5579
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SidebarProvider, { defaultOpen: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `flex h-[100svh] md:h-screen bg-background w-full overflow-hidden ${className}`, children: [
5580
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5234
5581
  Sidebar2,
5235
5582
  {
5236
5583
  threads,
@@ -5247,8 +5594,8 @@ var ChatUI = ({
5247
5594
  showThemeOptions: !!callbacks.onThemeChange
5248
5595
  }
5249
5596
  ),
5250
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(SidebarInset, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-col h-full min-h-0", children: [
5251
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5597
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SidebarInset, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col h-full min-h-0", children: [
5598
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5252
5599
  ChatHeader,
5253
5600
  {
5254
5601
  config,
@@ -5258,14 +5605,17 @@ var ChatUI = ({
5258
5605
  onNewThread: handleCreateThread,
5259
5606
  showCustomComponentButton: !!config?.customComponent?.component,
5260
5607
  showAgentSelector: shouldShowAgentSelector,
5608
+ isMultiAgentMode,
5261
5609
  agentOptions,
5262
5610
  selectedAgentId,
5263
- onSelectAgent
5611
+ onSelectAgent,
5612
+ participantIds,
5613
+ onParticipantsChange
5264
5614
  }
5265
5615
  ),
5266
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex flex-1 flex-row min-h-0 overflow-hidden", children: [
5267
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "flex-1 flex flex-col min-h-0", children: [
5268
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5616
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-1 flex-row min-h-0 overflow-hidden", children: [
5617
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex-1 flex flex-col min-h-0", children: [
5618
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5269
5619
  ScrollArea,
5270
5620
  {
5271
5621
  ref: scrollAreaRef,
@@ -5273,7 +5623,7 @@ var ChatUI = ({
5273
5623
  viewportClassName: "p-4 overscroll-contain",
5274
5624
  onScrollCapture: handleScroll,
5275
5625
  style: { contain: "strict" },
5276
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "max-w-4xl mx-auto pb-4", children: isMessagesLoading ? renderMessageLoadingSkeleton() : messages.length === 0 ? renderSuggestions() : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5626
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "max-w-4xl mx-auto pb-4", children: isMessagesLoading ? renderMessageLoadingSkeleton() : messages.length === 0 ? renderSuggestions() : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5277
5627
  "div",
5278
5628
  {
5279
5629
  style: {
@@ -5285,7 +5635,7 @@ var ChatUI = ({
5285
5635
  const message = messages[virtualRow.index];
5286
5636
  const prevMessage = virtualRow.index > 0 ? messages[virtualRow.index - 1] : null;
5287
5637
  const isGrouped = prevMessage !== null && prevMessage.role === message.role;
5288
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5638
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5289
5639
  "div",
5290
5640
  {
5291
5641
  "data-index": virtualRow.index,
@@ -5297,8 +5647,8 @@ var ChatUI = ({
5297
5647
  width: "100%",
5298
5648
  transform: `translateY(${virtualRow.start}px)`
5299
5649
  },
5300
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: virtualRow.index === 0 ? "" : isGrouped ? "pt-2" : "pt-4", children: [
5301
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5650
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: virtualRow.index === 0 ? "" : isGrouped ? "pt-2" : "pt-4", children: [
5651
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5302
5652
  Message,
5303
5653
  {
5304
5654
  message,
@@ -5317,38 +5667,50 @@ var ChatUI = ({
5317
5667
  ) })
5318
5668
  }
5319
5669
  ),
5320
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "bg-background pb-[env(safe-area-inset-bottom)]", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5321
- ChatInput,
5322
- {
5323
- value: inputValue,
5324
- onChange: (value) => {
5325
- setInputValue(value);
5326
- if (initialInputApplied.current && !initialInputConsumedRef.current) {
5327
- initialInputConsumedRef.current = true;
5328
- onInitialInputConsumed?.();
5329
- }
5330
- },
5331
- onSubmit: handleSendMessage,
5332
- attachments,
5333
- onAttachmentsChange: setAttachments,
5334
- placeholder: config.labels.inputPlaceholder,
5335
- disabled: false,
5336
- isGenerating,
5337
- onStopGeneration: callbacks.onStopGeneration,
5338
- enableFileUpload: config.features.enableFileUpload,
5339
- enableAudioRecording: config.features.enableAudioRecording,
5340
- maxAttachments: config.features.maxAttachments,
5341
- maxFileSize: config.features.maxFileSize,
5342
- config
5343
- }
5344
- ) })
5670
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "bg-background pb-[env(safe-area-inset-bottom)]", children: [
5671
+ isMultiAgentMode && shouldShowAgentSelector && onTargetAgentChange && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "px-4 pt-1", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5672
+ TargetAgentSelector,
5673
+ {
5674
+ agents: participantIds && participantIds.length > 0 ? agentOptions.filter((a) => participantIds.includes(a.id)) : agentOptions,
5675
+ targetAgentId,
5676
+ onTargetChange: onTargetAgentChange,
5677
+ placeholder: config.agentSelector?.label || "Select agent",
5678
+ disabled: isGenerating
5679
+ }
5680
+ ) }),
5681
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5682
+ ChatInput,
5683
+ {
5684
+ value: inputValue,
5685
+ onChange: (value) => {
5686
+ setInputValue(value);
5687
+ if (initialInputApplied.current && !initialInputConsumedRef.current) {
5688
+ initialInputConsumedRef.current = true;
5689
+ onInitialInputConsumed?.();
5690
+ }
5691
+ },
5692
+ onSubmit: handleSendMessage,
5693
+ attachments,
5694
+ onAttachmentsChange: setAttachments,
5695
+ placeholder: config.labels.inputPlaceholder,
5696
+ disabled: false,
5697
+ isGenerating,
5698
+ onStopGeneration: callbacks.onStopGeneration,
5699
+ enableFileUpload: config.features.enableFileUpload,
5700
+ enableAudioRecording: config.features.enableAudioRecording,
5701
+ maxAttachments: config.features.maxAttachments,
5702
+ maxFileSize: config.features.maxFileSize,
5703
+ config
5704
+ }
5705
+ )
5706
+ ] })
5345
5707
  ] }),
5346
- config?.customComponent?.component && !isMobile && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5708
+ config?.customComponent?.component && !isMobile && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5347
5709
  "div",
5348
5710
  {
5349
5711
  className: "h-full transition-all duration-300 ease-in-out overflow-hidden",
5350
5712
  style: { width: state.showSidebar ? config.customComponent.panelWidth ?? 320 : 0 },
5351
- children: state.showSidebar && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5713
+ children: state.showSidebar && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5352
5714
  "div",
5353
5715
  {
5354
5716
  className: "h-full overflow-hidden border-l bg-background animate-in slide-in-from-right-4 duration-300",
@@ -5360,8 +5722,8 @@ var ChatUI = ({
5360
5722
  )
5361
5723
  ] })
5362
5724
  ] }) }),
5363
- isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "fixed inset-0 z-50", children: [
5364
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5725
+ isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "fixed inset-0 z-50", children: [
5726
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5365
5727
  "div",
5366
5728
  {
5367
5729
  className: `absolute inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-200 ease-out ${isCustomVisible ? "opacity-100" : "opacity-0"}`,
@@ -5369,16 +5731,16 @@ var ChatUI = ({
5369
5731
  onClick: closeSidebar
5370
5732
  }
5371
5733
  ),
5372
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5734
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5373
5735
  "div",
5374
5736
  {
5375
5737
  className: `absolute top-0 right-0 h-full w-full bg-background transform-gpu transition-transform duration-200 ease-out ${isCustomVisible ? "translate-x-0" : "translate-x-full"}`,
5376
5738
  style: { willChange: "transform" },
5377
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "h-full overflow-hidden", children: renderCustomComponent() })
5739
+ children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "h-full overflow-hidden", children: renderCustomComponent() })
5378
5740
  }
5379
5741
  )
5380
5742
  ] }),
5381
- isUserProfileOpen && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
5743
+ isUserProfileOpen && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5382
5744
  UserProfile,
5383
5745
  {
5384
5746
  isOpen: isUserProfileOpen,
@@ -5401,14 +5763,14 @@ var ChatUI = ({
5401
5763
  };
5402
5764
 
5403
5765
  // src/components/chat/ThreadManager.tsx
5404
- var import_react8 = require("react");
5405
- var import_lucide_react13 = require("lucide-react");
5406
- var import_jsx_runtime26 = require("react/jsx-runtime");
5766
+ var import_react9 = require("react");
5767
+ var import_lucide_react14 = require("lucide-react");
5768
+ var import_jsx_runtime27 = require("react/jsx-runtime");
5407
5769
  var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onArchive }) => {
5408
- const [isEditing, setIsEditing] = (0, import_react8.useState)(false);
5409
- const [editTitle, setEditTitle] = (0, import_react8.useState)(thread.title);
5410
- const inputRef = (0, import_react8.useRef)(null);
5411
- (0, import_react8.useEffect)(() => {
5770
+ const [isEditing, setIsEditing] = (0, import_react9.useState)(false);
5771
+ const [editTitle, setEditTitle] = (0, import_react9.useState)(thread.title);
5772
+ const inputRef = (0, import_react9.useRef)(null);
5773
+ (0, import_react9.useEffect)(() => {
5412
5774
  if (isEditing && inputRef.current) {
5413
5775
  inputRef.current.focus();
5414
5776
  inputRef.current.select();
@@ -5432,9 +5794,9 @@ var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onAr
5432
5794
  handleCancelEdit();
5433
5795
  }
5434
5796
  };
5435
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Card, { className: `cursor-pointer transition-all duration-200 hover:shadow-md py-0 ${isActive ? "ring-2 ring-primary bg-primary/5" : "hover:bg-muted/50"}`, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CardContent, { className: "p-3 max-w-sm", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-start justify-between gap-2", children: [
5436
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex-1 min-w-0", onClick: onSelect, children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-2", children: [
5437
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5797
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Card, { className: `cursor-pointer transition-all duration-200 hover:shadow-md py-0 ${isActive ? "ring-2 ring-primary bg-primary/5" : "hover:bg-muted/50"}`, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CardContent, { className: "p-3 max-w-sm", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-start justify-between gap-2", children: [
5798
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex-1 min-w-0", onClick: onSelect, children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2", children: [
5799
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5438
5800
  Input,
5439
5801
  {
5440
5802
  ref: inputRef,
@@ -5446,44 +5808,44 @@ var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onAr
5446
5808
  placeholder: config?.labels?.threadNamePlaceholder || "Conversation name"
5447
5809
  }
5448
5810
  ),
5449
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button, { size: "sm", variant: "ghost", onClick: handleSaveEdit, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Check, { className: "h-3 w-3" }) }),
5450
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button, { size: "sm", variant: "ghost", onClick: handleCancelEdit, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.X, { className: "h-3 w-3" }) })
5451
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
5452
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h4", { className: "font-medium text-sm truncate mb-1", children: thread.title }),
5453
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
5454
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1", children: [
5455
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Hash, { className: "h-3 w-3" }),
5811
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { size: "sm", variant: "ghost", onClick: handleSaveEdit, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Check, { className: "h-3 w-3" }) }),
5812
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { size: "sm", variant: "ghost", onClick: handleCancelEdit, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.X, { className: "h-3 w-3" }) })
5813
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
5814
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h4", { className: "font-medium text-sm truncate mb-1", children: thread.title }),
5815
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
5816
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-1", children: [
5817
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Hash, { className: "h-3 w-3" }),
5456
5818
  thread.messageCount,
5457
5819
  " msgs"
5458
5820
  ] }),
5459
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Separator, { orientation: "vertical", className: "h-3" }),
5460
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-1", children: [
5461
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Calendar, { className: "h-3 w-3" }),
5821
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Separator, { orientation: "vertical", className: "h-3" }),
5822
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-1", children: [
5823
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Calendar, { className: "h-3 w-3" }),
5462
5824
  formatDate(thread.updatedAt, config?.labels)
5463
5825
  ] }),
5464
- thread.isArchived && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
5465
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Separator, { orientation: "vertical", className: "h-3" }),
5466
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Badge, { variant: "secondary", className: "text-xs", children: [
5467
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Archive, { className: "h-2 w-2 mr-1" }),
5826
+ thread.isArchived && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
5827
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Separator, { orientation: "vertical", className: "h-3" }),
5828
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Badge, { variant: "secondary", className: "text-xs", children: [
5829
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Archive, { className: "h-2 w-2 mr-1" }),
5468
5830
  config?.labels?.archiveThread || "Archived"
5469
5831
  ] })
5470
5832
  ] })
5471
5833
  ] })
5472
5834
  ] }) }),
5473
- !isEditing && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DropdownMenu, { children: [
5474
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button, { variant: "ghost", size: "icon", className: "h-6 w-6 m-auto", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.MoreVertical, { className: "h-3 w-3" }) }) }),
5475
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DropdownMenuContent, { align: "end", children: [
5476
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DropdownMenuItem, { onClick: () => setIsEditing(true), children: [
5477
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Edit2, { className: "h-4 w-4 mr-2" }),
5835
+ !isEditing && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DropdownMenu, { children: [
5836
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { variant: "ghost", size: "icon", className: "h-6 w-6 m-auto", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.MoreVertical, { className: "h-3 w-3" }) }) }),
5837
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DropdownMenuContent, { align: "end", children: [
5838
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DropdownMenuItem, { onClick: () => setIsEditing(true), children: [
5839
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Edit2, { className: "h-4 w-4 mr-2" }),
5478
5840
  config?.labels?.renameThread || "Rename"
5479
5841
  ] }),
5480
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DropdownMenuItem, { onClick: onArchive, children: [
5481
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Archive, { className: "h-4 w-4 mr-2" }),
5842
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DropdownMenuItem, { onClick: onArchive, children: [
5843
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Archive, { className: "h-4 w-4 mr-2" }),
5482
5844
  thread.isArchived ? config?.labels?.unarchiveThread || "Unarchive" : config?.labels?.archiveThread || "Archive"
5483
5845
  ] }),
5484
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DropdownMenuSeparator, {}),
5485
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DropdownMenuItem, { onClick: onDelete, className: "text-destructive", children: [
5486
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Trash2, { className: "h-4 w-4 mr-2" }),
5846
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropdownMenuSeparator, {}),
5847
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DropdownMenuItem, { onClick: onDelete, className: "text-destructive", children: [
5848
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Trash2, { className: "h-4 w-4 mr-2" }),
5487
5849
  config?.labels?.deleteThread || "Delete"
5488
5850
  ] })
5489
5851
  ] })
@@ -5491,24 +5853,24 @@ var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onAr
5491
5853
  ] }) }) });
5492
5854
  };
5493
5855
  var CreateThreadDialog2 = ({ onCreateThread, config }) => {
5494
- const [title, setTitle] = (0, import_react8.useState)("");
5495
- const [isOpen, setIsOpen] = (0, import_react8.useState)(false);
5856
+ const [title, setTitle] = (0, import_react9.useState)("");
5857
+ const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
5496
5858
  const handleCreate = () => {
5497
5859
  onCreateThread(title.trim() || void 0);
5498
5860
  setTitle("");
5499
5861
  setIsOpen(false);
5500
5862
  };
5501
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
5502
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Button, { variant: "outline", className: "w-full", children: [
5503
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Plus, { className: "h-4 w-4 mr-2" }),
5863
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
5864
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Button, { variant: "outline", className: "w-full", children: [
5865
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Plus, { className: "h-4 w-4 mr-2" }),
5504
5866
  config?.labels?.createNewThread || "New Conversation"
5505
5867
  ] }) }),
5506
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogContent, { children: [
5507
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogHeader, { children: [
5508
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogTitle, { children: config?.labels?.createNewThread || "Create New Conversation" }),
5509
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
5868
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogContent, { children: [
5869
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogHeader, { children: [
5870
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogTitle, { children: config?.labels?.createNewThread || "Create New Conversation" }),
5871
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
5510
5872
  ] }),
5511
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5873
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5512
5874
  Input,
5513
5875
  {
5514
5876
  value: title,
@@ -5518,9 +5880,9 @@ var CreateThreadDialog2 = ({ onCreateThread, config }) => {
5518
5880
  autoFocus: true
5519
5881
  }
5520
5882
  ),
5521
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(DialogFooter, { children: [
5522
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config?.labels?.cancel || "Cancel" }),
5523
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button, { onClick: handleCreate, children: config?.labels?.create || "Create" })
5883
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogFooter, { children: [
5884
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config?.labels?.cancel || "Cancel" }),
5885
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { onClick: handleCreate, children: config?.labels?.create || "Create" })
5524
5886
  ] })
5525
5887
  ] })
5526
5888
  ] });
@@ -5538,9 +5900,9 @@ var ThreadManager = ({
5538
5900
  onClose,
5539
5901
  className = ""
5540
5902
  }) => {
5541
- const [searchQuery, setSearchQuery] = (0, import_react8.useState)("");
5542
- const [showArchived, setShowArchived] = (0, import_react8.useState)(false);
5543
- const [deleteThreadId, setDeleteThreadId] = (0, import_react8.useState)(null);
5903
+ const [searchQuery, setSearchQuery] = (0, import_react9.useState)("");
5904
+ const [showArchived, setShowArchived] = (0, import_react9.useState)(false);
5905
+ const [deleteThreadId, setDeleteThreadId] = (0, import_react9.useState)(null);
5544
5906
  const filteredThreads = threads.filter((thread) => {
5545
5907
  const title = (thread.title ?? "").toString();
5546
5908
  const matchesSearch = title.toLowerCase().includes(searchQuery.toLowerCase());
@@ -5574,20 +5936,20 @@ var ThreadManager = ({
5574
5936
  setDeleteThreadId(null);
5575
5937
  };
5576
5938
  if (!isOpen) return null;
5577
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `fixed inset-0 z-50 bg-background/80 backdrop-blur-sm ${className}`, children: [
5578
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "fixed left-0 top-0 h-full w-full max-w-md border-r bg-background shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Card, { className: "h-full border-0 rounded-none", children: [
5579
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(CardHeader, { className: "border-b", children: [
5580
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center justify-between", children: [
5581
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(CardTitle, { className: "flex items-center gap-2", children: [
5582
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.MessageSquare, { className: "h-5 w-5" }),
5939
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `fixed inset-0 z-50 bg-background/80 backdrop-blur-sm ${className}`, children: [
5940
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "fixed left-0 top-0 h-full w-full max-w-md border-r bg-background shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Card, { className: "h-full border-0 rounded-none", children: [
5941
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(CardHeader, { className: "border-b", children: [
5942
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
5943
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(CardTitle, { className: "flex items-center gap-2", children: [
5944
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.MessageSquare, { className: "h-5 w-5" }),
5583
5945
  config?.labels?.newChat || "Conversations"
5584
5946
  ] }),
5585
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.X, { className: "h-4 w-4" }) })
5947
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.X, { className: "h-4 w-4" }) })
5586
5948
  ] }),
5587
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "space-y-3", children: [
5588
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "relative", children: [
5589
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Search, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
5590
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5949
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "space-y-3", children: [
5950
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "relative", children: [
5951
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Search, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
5952
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5591
5953
  Input,
5592
5954
  {
5593
5955
  placeholder: config?.labels?.search || "Search conversations...",
@@ -5597,8 +5959,8 @@ var ThreadManager = ({
5597
5959
  }
5598
5960
  )
5599
5961
  ] }),
5600
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center justify-between", children: [
5601
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
5962
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
5963
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5602
5964
  Button,
5603
5965
  {
5604
5966
  variant: "outline",
@@ -5606,12 +5968,12 @@ var ThreadManager = ({
5606
5968
  onClick: () => setShowArchived(!showArchived),
5607
5969
  className: "text-xs",
5608
5970
  children: [
5609
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Filter, { className: "h-3 w-3 mr-1" }),
5971
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Filter, { className: "h-3 w-3 mr-1" }),
5610
5972
  showArchived ? config?.labels?.hideArchived || "Hide Archived" : config?.labels?.showArchived || "Show Archived"
5611
5973
  ]
5612
5974
  }
5613
5975
  ),
5614
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Badge, { variant: "secondary", className: "text-xs", children: [
5976
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Badge, { variant: "secondary", className: "text-xs", children: [
5615
5977
  filteredThreads.length,
5616
5978
  " / ",
5617
5979
  threads.length
@@ -5619,14 +5981,14 @@ var ThreadManager = ({
5619
5981
  ] })
5620
5982
  ] })
5621
5983
  ] }),
5622
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(CardContent, { className: "p-0 flex-1", children: [
5623
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "p-4", children: onCreateThread && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CreateThreadDialog2, { onCreateThread, config }) }),
5624
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ScrollArea, { className: "h-[calc(100vh-280px)]", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "px-4 pb-4 space-y-4", children: Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "text-center py-8 text-muted-foreground", children: [
5625
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.MessageSquare, { className: "h-12 w-12 mx-auto mb-3 opacity-50" }),
5626
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-sm", children: searchQuery ? config?.labels?.noThreadsFound || "No conversations found" : config?.labels?.noThreadsYet || "No conversations yet" })
5627
- ] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { children: [
5628
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h3", { className: "text-sm font-medium text-muted-foreground mb-2 px-2", children: group }),
5629
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "space-y-2", children: groupThreads.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
5984
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(CardContent, { className: "p-0 flex-1", children: [
5985
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "p-4", children: onCreateThread && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CreateThreadDialog2, { onCreateThread, config }) }),
5986
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ScrollArea, { className: "h-[calc(100vh-280px)]", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "px-4 pb-4 space-y-4", children: Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "text-center py-8 text-muted-foreground", children: [
5987
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.MessageSquare, { className: "h-12 w-12 mx-auto mb-3 opacity-50" }),
5988
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-sm", children: searchQuery ? config?.labels?.noThreadsFound || "No conversations found" : config?.labels?.noThreadsYet || "No conversations yet" })
5989
+ ] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
5990
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h3", { className: "text-sm font-medium text-muted-foreground mb-2 px-2", children: group }),
5991
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "space-y-2", children: groupThreads.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5630
5992
  ThreadItem,
5631
5993
  {
5632
5994
  thread,
@@ -5642,14 +6004,14 @@ var ThreadManager = ({
5642
6004
  ] }, group)) }) })
5643
6005
  ] })
5644
6006
  ] }) }),
5645
- deleteThreadId && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AlertDialog, { open: !!deleteThreadId, onOpenChange: () => setDeleteThreadId(null), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(AlertDialogContent, { children: [
5646
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(AlertDialogHeader, { children: [
5647
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AlertDialogTitle, { children: config?.labels?.deleteConfirmTitle || "Delete Conversation" }),
5648
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AlertDialogDescription, { children: config?.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
6007
+ deleteThreadId && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AlertDialog, { open: !!deleteThreadId, onOpenChange: () => setDeleteThreadId(null), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(AlertDialogContent, { children: [
6008
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(AlertDialogHeader, { children: [
6009
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AlertDialogTitle, { children: config?.labels?.deleteConfirmTitle || "Delete Conversation" }),
6010
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AlertDialogDescription, { children: config?.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
5649
6011
  ] }),
5650
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(AlertDialogFooter, { children: [
5651
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AlertDialogCancel, { children: config?.labels?.cancel || "Cancel" }),
5652
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
6012
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(AlertDialogFooter, { children: [
6013
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AlertDialogCancel, { children: config?.labels?.cancel || "Cancel" }),
6014
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5653
6015
  AlertDialogAction,
5654
6016
  {
5655
6017
  onClick: () => deleteThreadId && handleDeleteThread(deleteThreadId),
@@ -5661,44 +6023,21 @@ var ThreadManager = ({
5661
6023
  ] }) })
5662
6024
  ] }) });
5663
6025
  };
5664
-
5665
- // src/lib/chatUtils.ts
5666
- var chatUtils = {
5667
- generateId: () => globalThis.crypto?.randomUUID?.() ?? `id-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`,
5668
- generateMessageId: () => chatUtils.generateId(),
5669
- generateThreadId: () => chatUtils.generateId(),
5670
- createMessage: (role, content, attachments) => ({
5671
- id: chatUtils.generateMessageId(),
5672
- role,
5673
- content,
5674
- timestamp: Date.now(),
5675
- attachments,
5676
- isComplete: true
5677
- }),
5678
- createThread: (title) => ({
5679
- id: chatUtils.generateThreadId(),
5680
- title,
5681
- createdAt: Date.now(),
5682
- updatedAt: Date.now(),
5683
- messageCount: 0
5684
- }),
5685
- generateThreadTitle: (firstMessage) => {
5686
- const cleaned = firstMessage.replace(/[^\w\s]/g, "").trim();
5687
- const words = cleaned.split(/\s+/).slice(0, 6);
5688
- return words.join(" ") || "Nova Conversa";
5689
- }
5690
- };
5691
6026
  // Annotate the CommonJS export names for ESM import in node:
5692
6027
  0 && (module.exports = {
6028
+ AgentBadge,
5693
6029
  ChatHeader,
5694
6030
  ChatInput,
5695
6031
  ChatUI,
5696
6032
  ChatUserContextProvider,
5697
6033
  Message,
6034
+ ParticipantsSelector,
5698
6035
  Sidebar,
6036
+ TargetAgentSelector,
5699
6037
  ThreadManager,
5700
6038
  UserMenu,
5701
6039
  UserProfile,
6040
+ assignAgentColors,
5702
6041
  chatConfigPresets,
5703
6042
  chatUtils,
5704
6043
  cn,
@@ -5707,6 +6046,8 @@ var chatUtils = {
5707
6046
  defaultChatConfig,
5708
6047
  featureFlags,
5709
6048
  formatDate,
6049
+ getAgentColor,
6050
+ getAgentInitials,
5710
6051
  mergeConfig,
5711
6052
  themeUtils,
5712
6053
  useChatUserContext,