@copilotz/chat-ui 0.2.1 → 0.3.1

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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/components/chat/ChatUI.tsx
2
- import { useState as useState8, useEffect as useEffect10, useRef as useRef6, useCallback as useCallback4, useMemo as useMemo4 } from "react";
2
+ import { useState as useState8, useEffect as useEffect10, useRef as useRef6, useCallback as useCallback4, useMemo as useMemo5 } from "react";
3
3
  import { useVirtualizer } from "@tanstack/react-virtual";
4
4
 
5
5
  // src/config/chatConfig.ts
@@ -168,127 +168,6 @@ function mergeConfig(_baseConfig, userConfig) {
168
168
  headerActions: userConfig.headerActions || defaultChatConfig.headerActions
169
169
  };
170
170
  }
171
- var chatConfigPresets = {
172
- minimal: {
173
- features: {
174
- enableThreads: false,
175
- enableFileUpload: false,
176
- enableAudioRecording: false,
177
- enableMessageEditing: false,
178
- enableMessageCopy: true,
179
- enableRegeneration: true,
180
- enableToolCallsDisplay: false
181
- },
182
- ui: {
183
- compactMode: true,
184
- showTimestamps: false,
185
- showAvatars: false
186
- }
187
- },
188
- full: {
189
- features: {
190
- enableThreads: true,
191
- enableFileUpload: true,
192
- enableAudioRecording: true,
193
- enableMessageEditing: true,
194
- enableMessageCopy: true,
195
- enableRegeneration: true,
196
- enableToolCallsDisplay: true
197
- },
198
- ui: {
199
- showTimestamps: true,
200
- showAvatars: true,
201
- compactMode: false,
202
- showWordCount: true
203
- }
204
- },
205
- developer: {
206
- features: {
207
- enableThreads: true,
208
- enableFileUpload: true,
209
- enableAudioRecording: false,
210
- enableMessageEditing: true,
211
- enableMessageCopy: true,
212
- enableRegeneration: true,
213
- enableToolCallsDisplay: true
214
- },
215
- ui: {
216
- showTimestamps: true,
217
- showAvatars: true,
218
- compactMode: false,
219
- showWordCount: true
220
- }
221
- },
222
- customer_support: {
223
- branding: {
224
- title: "Customer Support",
225
- subtitle: "How can I help you today?"
226
- },
227
- features: {
228
- enableThreads: true,
229
- enableFileUpload: true,
230
- enableAudioRecording: false,
231
- enableMessageEditing: false,
232
- enableMessageCopy: true,
233
- enableRegeneration: false,
234
- enableToolCallsDisplay: false
235
- },
236
- ui: {
237
- showTimestamps: true,
238
- showAvatars: true,
239
- compactMode: false
240
- }
241
- }
242
- };
243
- function validateConfig(config) {
244
- const errors = [];
245
- if (config.features?.maxAttachments && config.features.maxAttachments < 1) {
246
- errors.push("maxAttachments must be at least 1");
247
- }
248
- if (config.features?.maxFileSize && config.features.maxFileSize < 1024) {
249
- errors.push("maxFileSize must be at least 1024 bytes (1KB)");
250
- }
251
- if (config.branding?.title && typeof config.branding.title !== "string") {
252
- errors.push("branding.title must be a string");
253
- }
254
- return errors;
255
- }
256
- var themeUtils = {
257
- getSystemTheme: () => {
258
- if (typeof globalThis.matchMedia === "undefined") return "light";
259
- return globalThis.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
260
- },
261
- resolveTheme: (theme) => {
262
- return theme === "auto" ? themeUtils.getSystemTheme() : theme;
263
- },
264
- applyTheme: (theme) => {
265
- if (typeof document === "undefined") return;
266
- const resolvedTheme = themeUtils.resolveTheme(theme);
267
- document.documentElement.classList.toggle("dark", resolvedTheme === "dark");
268
- }
269
- };
270
- var featureFlags = {
271
- isEnabled: (config, feature) => {
272
- return config.features[feature] === true;
273
- },
274
- getEnabledFeatures: (config) => {
275
- return Object.entries(config.features).filter(([_, enabled]) => enabled === true).map(([feature]) => feature);
276
- },
277
- hasAnyFeature: (config, features) => {
278
- return features.some((feature) => featureFlags.isEnabled(config, feature));
279
- }
280
- };
281
- var configUtils = {
282
- createConfigHook: (config) => {
283
- return {
284
- config,
285
- isFeatureEnabled: (feature) => featureFlags.isEnabled(config, feature),
286
- getLabel: (key) => config.labels[key],
287
- getBranding: () => config.branding,
288
- getUI: () => config.ui
289
- };
290
- }
291
- };
292
171
 
293
172
  // src/components/chat/Message.tsx
294
173
  import React, { useState, useMemo, useEffect, memo } from "react";
@@ -296,6 +175,75 @@ import ReactMarkdown from "react-markdown";
296
175
  import remarkGfm from "remark-gfm";
297
176
  import rehypeHighlight from "rehype-highlight";
298
177
 
178
+ // src/lib/chatUtils.ts
179
+ var chatUtils = {
180
+ generateId: () => globalThis.crypto?.randomUUID?.() ?? `id-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`,
181
+ generateMessageId: () => chatUtils.generateId(),
182
+ generateThreadId: () => chatUtils.generateId(),
183
+ createMessage: (role, content, attachments) => ({
184
+ id: chatUtils.generateMessageId(),
185
+ role,
186
+ content,
187
+ timestamp: Date.now(),
188
+ attachments,
189
+ isComplete: true
190
+ }),
191
+ createThread: (title) => ({
192
+ id: chatUtils.generateThreadId(),
193
+ title,
194
+ createdAt: Date.now(),
195
+ updatedAt: Date.now(),
196
+ messageCount: 0
197
+ }),
198
+ generateThreadTitle: (firstMessage) => {
199
+ const cleaned = firstMessage.replace(/[^\w\s]/g, "").trim();
200
+ const words = cleaned.split(/\s+/).slice(0, 6);
201
+ return words.join(" ") || "Nova Conversa";
202
+ }
203
+ };
204
+ var AGENT_COLORS = [
205
+ "#6366f1",
206
+ // indigo
207
+ "#8b5cf6",
208
+ // violet
209
+ "#ec4899",
210
+ // pink
211
+ "#f59e0b",
212
+ // amber
213
+ "#10b981",
214
+ // emerald
215
+ "#3b82f6",
216
+ // blue
217
+ "#ef4444",
218
+ // red
219
+ "#14b8a6",
220
+ // teal
221
+ "#f97316",
222
+ // orange
223
+ "#84cc16"
224
+ // lime
225
+ ];
226
+ function getAgentColor(agentId) {
227
+ let hash = 0;
228
+ for (let i = 0; i < agentId.length; i++) {
229
+ hash = (hash << 5) - hash + agentId.charCodeAt(i) | 0;
230
+ }
231
+ return AGENT_COLORS[Math.abs(hash) % AGENT_COLORS.length];
232
+ }
233
+ function getAgentInitials(name) {
234
+ const parts = name.trim().split(/\s+/);
235
+ if (parts.length >= 2) {
236
+ return (parts[0][0] + parts[1][0]).toUpperCase();
237
+ }
238
+ return name.slice(0, 2).toUpperCase();
239
+ }
240
+ function assignAgentColors(agents) {
241
+ return agents.map((agent) => ({
242
+ ...agent,
243
+ color: agent.color || getAgentColor(agent.id)
244
+ }));
245
+ }
246
+
299
247
  // src/components/ui/button.tsx
300
248
  import { Slot } from "@radix-ui/react-slot";
301
249
  import { cva } from "class-variance-authority";
@@ -975,13 +923,20 @@ var Message = memo(({
975
923
  markdown,
976
924
  isExpanded = false,
977
925
  onToggleExpanded,
978
- isGrouped = false
926
+ isGrouped = false,
927
+ agentOptions = []
979
928
  }) => {
980
929
  const [isEditing, setIsEditing] = useState(false);
981
930
  const [editContent, setEditContent] = useState(message.content);
982
931
  const [showActions, setShowActions] = useState(false);
983
932
  const [copied, setCopied] = useState(false);
984
933
  const messageIsUser = isUser ?? message.role === "user";
934
+ const agentSender = !messageIsUser && message.senderAgentId ? agentOptions.find(
935
+ (a) => a.id === message.senderAgentId || a.name.toLowerCase() === (message.senderAgentId ?? "").toLowerCase() || a.name.toLowerCase() === (message.senderName ?? "").toLowerCase()
936
+ ) : void 0;
937
+ const isMultiAgent = agentOptions.length > 1;
938
+ const resolvedAssistantName = isMultiAgent && (agentSender?.name || message.senderName) || assistantName;
939
+ const agentColor = agentSender ? agentSender.color || getAgentColor(agentSender.id) : void 0;
985
940
  const canEdit = enableEdit && messageIsUser;
986
941
  const canRegenerate = enableRegenerate && !messageIsUser;
987
942
  const normalizedPreviewChars = Math.max(longMessagePreviewChars, 1);
@@ -1045,9 +1000,26 @@ var Message = memo(({
1045
1000
  showAvatar && /* @__PURE__ */ jsx7("div", { className: `flex-shrink-0 ${compactMode ? "mt-1" : "mt-0"}`, children: /* @__PURE__ */ jsx7(Avatar, { className: compactMode ? "h-6 w-6" : "h-8 w-8", children: messageIsUser ? /* @__PURE__ */ jsxs2(Fragment, { children: [
1046
1001
  /* @__PURE__ */ jsx7(AvatarImage, { src: userAvatar, alt: userName }),
1047
1002
  /* @__PURE__ */ jsx7(AvatarFallback, { className: "bg-primary text-primary-foreground", children: userName.charAt(0).toUpperCase() })
1003
+ ] }) : agentSender ? /* @__PURE__ */ jsxs2(Fragment, { children: [
1004
+ agentSender.avatarUrl ? /* @__PURE__ */ jsx7(AvatarImage, { src: agentSender.avatarUrl, alt: agentSender.name }) : null,
1005
+ /* @__PURE__ */ jsx7(
1006
+ AvatarFallback,
1007
+ {
1008
+ style: agentColor ? { backgroundColor: agentColor, color: "white" } : void 0,
1009
+ className: agentColor ? "text-[10px]" : "bg-secondary text-secondary-foreground",
1010
+ children: getAgentInitials(agentSender.name)
1011
+ }
1012
+ )
1048
1013
  ] }) : /* @__PURE__ */ jsx7(Fragment, { children: assistantAvatar || /* @__PURE__ */ jsx7(AvatarFallback, { className: "bg-secondary text-secondary-foreground", children: "AI" }) }) }) }),
1049
1014
  /* @__PURE__ */ jsxs2("div", { className: `flex items-center gap-2 mb-1 ${messageIsUser ? "flex-row-reverse" : "flex-row"}`, children: [
1050
- /* @__PURE__ */ jsx7("span", { className: `font-medium ${compactMode ? "text-sm" : "text-base"}`, children: messageIsUser ? userName : assistantName }),
1015
+ /* @__PURE__ */ jsx7(
1016
+ "span",
1017
+ {
1018
+ className: `font-medium ${compactMode ? "text-sm" : "text-base"}`,
1019
+ style: !messageIsUser && agentColor ? { color: agentColor } : void 0,
1020
+ children: messageIsUser ? userName : resolvedAssistantName
1021
+ }
1022
+ ),
1051
1023
  showTimestamp && /* @__PURE__ */ jsx7("span", { className: "text-xs text-muted-foreground", children: formatTime(message.timestamp) }),
1052
1024
  message.isEdited && /* @__PURE__ */ jsx7(Badge, { variant: "outline", className: "text-xs", children: "editado" })
1053
1025
  ] })
@@ -2624,7 +2596,7 @@ var Sidebar2 = ({
2624
2596
  };
2625
2597
 
2626
2598
  // src/components/chat/ChatHeader.tsx
2627
- import React8 from "react";
2599
+ import React9 from "react";
2628
2600
  import {
2629
2601
  Bot as Bot2,
2630
2602
  MoreVertical,
@@ -2635,10 +2607,239 @@ import {
2635
2607
  Menu,
2636
2608
  Moon as Moon2,
2637
2609
  Sun as Sun2,
2638
- ChevronDown as ChevronDown2,
2639
- Check as Check2
2610
+ ChevronDown as ChevronDown3,
2611
+ Check as Check3
2640
2612
  } from "lucide-react";
2613
+
2614
+ // src/components/chat/AgentSelectors.tsx
2615
+ import { memo as memo2, useMemo as useMemo3 } from "react";
2616
+ import { Check as Check2, ChevronDown as ChevronDown2, Users, AtSign, X as X2 } from "lucide-react";
2641
2617
  import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
2618
+ var ParticipantsSelector = memo2(({
2619
+ agents,
2620
+ participantIds,
2621
+ onParticipantsChange,
2622
+ label = "Team",
2623
+ maxVisible = 3,
2624
+ disabled = false
2625
+ }) => {
2626
+ const agentsWithColors = useMemo3(() => assignAgentColors(agents), [agents]);
2627
+ const selectedAgents = useMemo3(
2628
+ () => agentsWithColors.filter((a) => participantIds.includes(a.id)),
2629
+ [agentsWithColors, participantIds]
2630
+ );
2631
+ const toggleParticipant = (agentId) => {
2632
+ if (participantIds.includes(agentId)) {
2633
+ if (participantIds.length > 1) {
2634
+ onParticipantsChange(participantIds.filter((id) => id !== agentId));
2635
+ }
2636
+ } else {
2637
+ onParticipantsChange([...participantIds, agentId]);
2638
+ }
2639
+ };
2640
+ const selectAll = () => {
2641
+ onParticipantsChange(agentsWithColors.map((a) => a.id));
2642
+ };
2643
+ const visibleAgents = selectedAgents.slice(0, maxVisible);
2644
+ const hiddenCount = selectedAgents.length - maxVisible;
2645
+ return /* @__PURE__ */ jsxs10(DropdownMenu, { children: [
2646
+ /* @__PURE__ */ jsx18(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs10(
2647
+ Button,
2648
+ {
2649
+ variant: "ghost",
2650
+ className: "h-9 px-2 gap-1.5 text-sm hover:bg-accent/50",
2651
+ disabled,
2652
+ children: [
2653
+ /* @__PURE__ */ jsx18(Users, { className: "h-4 w-4 text-muted-foreground" }),
2654
+ /* @__PURE__ */ jsx18("div", { className: "flex items-center gap-1", children: visibleAgents.length > 0 ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
2655
+ /* @__PURE__ */ jsx18("div", { className: "flex -space-x-1.5", children: visibleAgents.map((agent) => /* @__PURE__ */ jsxs10(Avatar, { className: "h-5 w-5 border-2 border-background", children: [
2656
+ /* @__PURE__ */ jsx18(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
2657
+ /* @__PURE__ */ jsx18(
2658
+ AvatarFallback,
2659
+ {
2660
+ style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
2661
+ className: "text-[8px]",
2662
+ children: getAgentInitials(agent.name)
2663
+ }
2664
+ )
2665
+ ] }, agent.id)) }),
2666
+ hiddenCount > 0 && /* @__PURE__ */ jsxs10("span", { className: "text-xs text-muted-foreground", children: [
2667
+ "+",
2668
+ hiddenCount
2669
+ ] })
2670
+ ] }) : /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: label }) }),
2671
+ /* @__PURE__ */ jsx18(ChevronDown2, { className: "h-3 w-3 opacity-50" })
2672
+ ]
2673
+ }
2674
+ ) }),
2675
+ /* @__PURE__ */ jsxs10(DropdownMenuContent, { align: "start", className: "w-[260px]", children: [
2676
+ /* @__PURE__ */ jsxs10(DropdownMenuLabel, { className: "flex items-center justify-between", children: [
2677
+ /* @__PURE__ */ jsx18("span", { children: "Participants" }),
2678
+ selectedAgents.length < agentsWithColors.length && /* @__PURE__ */ jsx18(Button, { variant: "ghost", size: "sm", className: "h-6 text-xs", onClick: selectAll, children: "Select All" })
2679
+ ] }),
2680
+ /* @__PURE__ */ jsx18(DropdownMenuSeparator, {}),
2681
+ agentsWithColors.map((agent) => {
2682
+ const isSelected = participantIds.includes(agent.id);
2683
+ const isLastSelected = isSelected && participantIds.length === 1;
2684
+ return /* @__PURE__ */ jsxs10(
2685
+ DropdownMenuItem,
2686
+ {
2687
+ onClick: () => toggleParticipant(agent.id),
2688
+ className: "flex items-center gap-3 p-2 cursor-pointer",
2689
+ disabled: isLastSelected,
2690
+ children: [
2691
+ /* @__PURE__ */ jsxs10(Avatar, { className: "h-6 w-6", children: [
2692
+ /* @__PURE__ */ jsx18(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
2693
+ /* @__PURE__ */ jsx18(
2694
+ AvatarFallback,
2695
+ {
2696
+ style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
2697
+ className: "text-[10px]",
2698
+ children: getAgentInitials(agent.name)
2699
+ }
2700
+ )
2701
+ ] }),
2702
+ /* @__PURE__ */ jsxs10("div", { className: "flex-1 min-w-0", children: [
2703
+ /* @__PURE__ */ jsx18("div", { className: "font-medium text-sm truncate", children: agent.name }),
2704
+ agent.description && /* @__PURE__ */ jsx18("div", { className: "text-xs text-muted-foreground truncate", children: agent.description })
2705
+ ] }),
2706
+ isSelected && /* @__PURE__ */ jsx18(Check2, { className: "h-4 w-4 text-primary shrink-0" })
2707
+ ]
2708
+ },
2709
+ agent.id
2710
+ );
2711
+ })
2712
+ ] })
2713
+ ] });
2714
+ });
2715
+ ParticipantsSelector.displayName = "ParticipantsSelector";
2716
+ var TargetAgentSelector = memo2(({
2717
+ agents,
2718
+ targetAgentId,
2719
+ onTargetChange,
2720
+ label = "Target",
2721
+ placeholder = "Select agent",
2722
+ disabled = false
2723
+ }) => {
2724
+ const agentsWithColors = useMemo3(() => assignAgentColors(agents), [agents]);
2725
+ const selectedAgent = useMemo3(
2726
+ () => agentsWithColors.find((a) => a.id === targetAgentId),
2727
+ [agentsWithColors, targetAgentId]
2728
+ );
2729
+ return /* @__PURE__ */ jsxs10(DropdownMenu, { children: [
2730
+ /* @__PURE__ */ jsx18(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs10(
2731
+ Button,
2732
+ {
2733
+ variant: "ghost",
2734
+ className: "h-9 px-3 gap-1.5 font-medium text-base hover:bg-accent/50",
2735
+ disabled,
2736
+ children: [
2737
+ /* @__PURE__ */ jsx18(AtSign, { className: "h-4 w-4 text-muted-foreground" }),
2738
+ selectedAgent ? /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
2739
+ /* @__PURE__ */ jsxs10(Avatar, { className: "h-5 w-5", children: [
2740
+ /* @__PURE__ */ jsx18(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
2741
+ /* @__PURE__ */ jsx18(
2742
+ AvatarFallback,
2743
+ {
2744
+ style: { backgroundColor: selectedAgent.color || getAgentColor(selectedAgent.id), color: "white" },
2745
+ className: "text-[10px]",
2746
+ children: getAgentInitials(selectedAgent.name)
2747
+ }
2748
+ )
2749
+ ] }),
2750
+ /* @__PURE__ */ jsx18("span", { className: "max-w-[150px] truncate", children: selectedAgent.name })
2751
+ ] }) : /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: placeholder }),
2752
+ /* @__PURE__ */ jsx18(ChevronDown2, { className: "h-4 w-4 opacity-50" })
2753
+ ]
2754
+ }
2755
+ ) }),
2756
+ /* @__PURE__ */ jsxs10(DropdownMenuContent, { align: "start", className: "w-[280px]", children: [
2757
+ /* @__PURE__ */ jsx18(DropdownMenuLabel, { children: label }),
2758
+ /* @__PURE__ */ jsx18(DropdownMenuSeparator, {}),
2759
+ agentsWithColors.map((agent) => {
2760
+ const isSelected = agent.id === targetAgentId;
2761
+ return /* @__PURE__ */ jsxs10(
2762
+ DropdownMenuItem,
2763
+ {
2764
+ onClick: () => onTargetChange(agent.id),
2765
+ className: "flex items-start gap-3 p-3 cursor-pointer",
2766
+ children: [
2767
+ /* @__PURE__ */ jsxs10(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
2768
+ /* @__PURE__ */ jsx18(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
2769
+ /* @__PURE__ */ jsx18(
2770
+ AvatarFallback,
2771
+ {
2772
+ style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
2773
+ className: "text-[10px]",
2774
+ children: getAgentInitials(agent.name)
2775
+ }
2776
+ )
2777
+ ] }),
2778
+ /* @__PURE__ */ jsxs10("div", { className: "flex-1 min-w-0", children: [
2779
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
2780
+ /* @__PURE__ */ jsx18("span", { className: "font-medium text-sm", children: agent.name }),
2781
+ isSelected && /* @__PURE__ */ jsx18(Check2, { className: "h-4 w-4 text-primary shrink-0" })
2782
+ ] }),
2783
+ agent.description && /* @__PURE__ */ jsx18("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
2784
+ ] })
2785
+ ]
2786
+ },
2787
+ agent.id
2788
+ );
2789
+ })
2790
+ ] })
2791
+ ] });
2792
+ });
2793
+ TargetAgentSelector.displayName = "TargetAgentSelector";
2794
+ var AgentBadge = memo2(({
2795
+ agent,
2796
+ onRemove,
2797
+ showRemove = false,
2798
+ size = "md"
2799
+ }) => {
2800
+ const color = agent.color || getAgentColor(agent.id);
2801
+ const avatarSize = size === "sm" ? "h-4 w-4" : "h-5 w-5";
2802
+ const textSize = size === "sm" ? "text-xs" : "text-sm";
2803
+ return /* @__PURE__ */ jsxs10(
2804
+ Badge,
2805
+ {
2806
+ variant: "secondary",
2807
+ className: "flex items-center gap-1.5 pr-1",
2808
+ style: { borderColor: color, borderWidth: 1 },
2809
+ children: [
2810
+ /* @__PURE__ */ jsxs10(Avatar, { className: avatarSize, children: [
2811
+ /* @__PURE__ */ jsx18(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
2812
+ /* @__PURE__ */ jsx18(
2813
+ AvatarFallback,
2814
+ {
2815
+ style: { backgroundColor: color, color: "white" },
2816
+ className: "text-[8px]",
2817
+ children: getAgentInitials(agent.name)
2818
+ }
2819
+ )
2820
+ ] }),
2821
+ /* @__PURE__ */ jsx18("span", { className: textSize, children: agent.name }),
2822
+ showRemove && onRemove && /* @__PURE__ */ jsx18(
2823
+ Button,
2824
+ {
2825
+ variant: "ghost",
2826
+ size: "icon",
2827
+ className: "h-4 w-4 ml-0.5 hover:bg-destructive/20",
2828
+ onClick: (e) => {
2829
+ e.stopPropagation();
2830
+ onRemove();
2831
+ },
2832
+ children: /* @__PURE__ */ jsx18(X2, { className: "h-3 w-3" })
2833
+ }
2834
+ )
2835
+ ]
2836
+ }
2837
+ );
2838
+ });
2839
+ AgentBadge.displayName = "AgentBadge";
2840
+
2841
+ // src/components/chat/ChatHeader.tsx
2842
+ import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
2642
2843
  var ChatHeader = ({
2643
2844
  config,
2644
2845
  currentThreadTitle,
@@ -2651,16 +2852,19 @@ var ChatHeader = ({
2651
2852
  showCustomComponentButton,
2652
2853
  isMobile,
2653
2854
  showAgentSelector = false,
2855
+ isMultiAgentMode = false,
2654
2856
  agentOptions = [],
2655
2857
  selectedAgentId = null,
2656
2858
  onSelectAgent,
2859
+ participantIds,
2860
+ onParticipantsChange,
2657
2861
  className = ""
2658
2862
  }) => {
2659
- const [isDarkMode, setIsDarkMode] = React8.useState(() => {
2863
+ const [isDarkMode, setIsDarkMode] = React9.useState(() => {
2660
2864
  if (typeof window === "undefined") return false;
2661
2865
  return document.documentElement.classList.contains("dark");
2662
2866
  });
2663
- React8.useEffect(() => {
2867
+ React9.useEffect(() => {
2664
2868
  const observer = new MutationObserver(() => {
2665
2869
  setIsDarkMode(document.documentElement.classList.contains("dark"));
2666
2870
  });
@@ -2706,52 +2910,60 @@ var ChatHeader = ({
2706
2910
  };
2707
2911
  const selectedAgent = agentOptions.find((agent) => agent.id === selectedAgentId) || null;
2708
2912
  const agentPlaceholder = config.agentSelector?.label || "Select agent";
2709
- return /* @__PURE__ */ jsx18(
2913
+ return /* @__PURE__ */ jsx19(
2710
2914
  Card,
2711
2915
  {
2712
2916
  "data-chat-header": true,
2713
2917
  className: `py-0 border-b rounded-none relative z-10 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80 ${className}`,
2714
2918
  style: isMobile ? { paddingTop: "env(safe-area-inset-top)" } : void 0,
2715
- children: /* @__PURE__ */ jsx18(CardHeader, { className: "p-2", children: /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between gap-2", children: [
2716
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
2717
- /* @__PURE__ */ jsxs10(Tooltip, { children: [
2718
- /* @__PURE__ */ jsx18(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx18(SidebarTrigger, { className: "-ml-1" }) }),
2719
- /* @__PURE__ */ jsx18(TooltipContent, { children: config.labels?.sidebarToggle || "Toggle Sidebar" })
2919
+ children: /* @__PURE__ */ jsx19(CardHeader, { className: "p-2", children: /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-2", children: [
2920
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
2921
+ /* @__PURE__ */ jsxs11(Tooltip, { children: [
2922
+ /* @__PURE__ */ jsx19(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx19(SidebarTrigger, { className: "-ml-1" }) }),
2923
+ /* @__PURE__ */ jsx19(TooltipContent, { children: config.labels?.sidebarToggle || "Toggle Sidebar" })
2720
2924
  ] }),
2721
- showAgentSelector && /* @__PURE__ */ jsxs10(DropdownMenu, { children: [
2722
- /* @__PURE__ */ jsx18(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs10(
2925
+ showAgentSelector && isMultiAgentMode && onParticipantsChange && /* @__PURE__ */ jsx19(
2926
+ ParticipantsSelector,
2927
+ {
2928
+ agents: agentOptions,
2929
+ participantIds: participantIds ?? agentOptions.map((a) => a.id),
2930
+ onParticipantsChange
2931
+ }
2932
+ ),
2933
+ showAgentSelector && !isMultiAgentMode && /* @__PURE__ */ jsxs11(DropdownMenu, { children: [
2934
+ /* @__PURE__ */ jsx19(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(
2723
2935
  Button,
2724
2936
  {
2725
2937
  variant: "ghost",
2726
2938
  className: "h-9 px-3 gap-1.5 font-medium text-base hover:bg-accent/50",
2727
2939
  children: [
2728
- selectedAgent?.avatarUrl ? /* @__PURE__ */ jsxs10(Avatar, { className: "h-5 w-5", children: [
2729
- /* @__PURE__ */ jsx18(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
2730
- /* @__PURE__ */ jsx18(AvatarFallback, { className: "text-[10px]", children: selectedAgent.name.charAt(0).toUpperCase() })
2940
+ selectedAgent?.avatarUrl ? /* @__PURE__ */ jsxs11(Avatar, { className: "h-5 w-5", children: [
2941
+ /* @__PURE__ */ jsx19(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
2942
+ /* @__PURE__ */ jsx19(AvatarFallback, { className: "text-[10px]", children: selectedAgent.name.charAt(0).toUpperCase() })
2731
2943
  ] }) : null,
2732
- /* @__PURE__ */ jsx18("span", { className: "max-w-[200px] truncate", children: selectedAgent?.name || agentPlaceholder }),
2733
- /* @__PURE__ */ jsx18(ChevronDown2, { className: "h-4 w-4 opacity-50" })
2944
+ /* @__PURE__ */ jsx19("span", { className: "max-w-[200px] truncate", children: selectedAgent?.name || agentPlaceholder }),
2945
+ /* @__PURE__ */ jsx19(ChevronDown3, { className: "h-4 w-4 opacity-50" })
2734
2946
  ]
2735
2947
  }
2736
2948
  ) }),
2737
- /* @__PURE__ */ jsx18(DropdownMenuContent, { align: "start", className: "w-[280px]", children: agentOptions.map((agent) => {
2949
+ /* @__PURE__ */ jsx19(DropdownMenuContent, { align: "start", className: "w-[280px]", children: agentOptions.map((agent) => {
2738
2950
  const isSelected = agent.id === selectedAgentId;
2739
- return /* @__PURE__ */ jsxs10(
2951
+ return /* @__PURE__ */ jsxs11(
2740
2952
  DropdownMenuItem,
2741
2953
  {
2742
2954
  onClick: () => onSelectAgent?.(agent.id),
2743
2955
  className: "flex items-start gap-3 p-3 cursor-pointer",
2744
2956
  children: [
2745
- agent.avatarUrl ? /* @__PURE__ */ jsxs10(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
2746
- /* @__PURE__ */ jsx18(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
2747
- /* @__PURE__ */ jsx18(AvatarFallback, { className: "text-[10px]", children: agent.name.charAt(0).toUpperCase() })
2748
- ] }) : /* @__PURE__ */ jsx18("div", { className: "h-6 w-6 mt-0.5 shrink-0 flex items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsx18(Bot2, { className: "h-3.5 w-3.5 text-primary" }) }),
2749
- /* @__PURE__ */ jsxs10("div", { className: "flex-1 min-w-0", children: [
2750
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
2751
- /* @__PURE__ */ jsx18("span", { className: "font-medium text-sm", children: agent.name }),
2752
- isSelected && /* @__PURE__ */ jsx18(Check2, { className: "h-4 w-4 text-primary shrink-0" })
2957
+ agent.avatarUrl ? /* @__PURE__ */ jsxs11(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
2958
+ /* @__PURE__ */ jsx19(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
2959
+ /* @__PURE__ */ jsx19(AvatarFallback, { className: "text-[10px]", children: agent.name.charAt(0).toUpperCase() })
2960
+ ] }) : /* @__PURE__ */ jsx19("div", { className: "h-6 w-6 mt-0.5 shrink-0 flex items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsx19(Bot2, { className: "h-3.5 w-3.5 text-primary" }) }),
2961
+ /* @__PURE__ */ jsxs11("div", { className: "flex-1 min-w-0", children: [
2962
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
2963
+ /* @__PURE__ */ jsx19("span", { className: "font-medium text-sm", children: agent.name }),
2964
+ isSelected && /* @__PURE__ */ jsx19(Check3, { className: "h-4 w-4 text-primary shrink-0" })
2753
2965
  ] }),
2754
- agent.description && /* @__PURE__ */ jsx18("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
2966
+ agent.description && /* @__PURE__ */ jsx19("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
2755
2967
  ] })
2756
2968
  ]
2757
2969
  },
@@ -2759,59 +2971,59 @@ var ChatHeader = ({
2759
2971
  );
2760
2972
  }) })
2761
2973
  ] }),
2762
- !showAgentSelector && isMobile && /* @__PURE__ */ jsx18("span", { className: "text-sm font-medium truncate max-w-[150px] ml-2", children: currentThreadTitle || config.branding?.title || "Chat" })
2974
+ !showAgentSelector && isMobile && /* @__PURE__ */ jsx19("span", { className: "text-sm font-medium truncate max-w-[150px] ml-2", children: currentThreadTitle || config.branding?.title || "Chat" })
2763
2975
  ] }),
2764
- /* @__PURE__ */ jsx18("div", { className: "flex-1" }),
2765
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
2766
- showCustomComponentButton && config.customComponent && /* @__PURE__ */ jsxs10(Tooltip, { children: [
2767
- /* @__PURE__ */ jsx18(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx18(
2976
+ /* @__PURE__ */ jsx19("div", { className: "flex-1" }),
2977
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
2978
+ showCustomComponentButton && config.customComponent && /* @__PURE__ */ jsxs11(Tooltip, { children: [
2979
+ /* @__PURE__ */ jsx19(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx19(
2768
2980
  Button,
2769
2981
  {
2770
2982
  variant: "ghost",
2771
2983
  size: "icon",
2772
2984
  className: "h-8 w-8",
2773
2985
  onClick: onCustomComponentToggle,
2774
- children: config.customComponent.icon || /* @__PURE__ */ jsx18(Menu, { className: "h-4 w-4" })
2986
+ children: config.customComponent.icon || /* @__PURE__ */ jsx19(Menu, { className: "h-4 w-4" })
2775
2987
  }
2776
2988
  ) }),
2777
- /* @__PURE__ */ jsx18(TooltipContent, { children: config.customComponent.label || config.labels?.customComponentToggle || "Toggle" })
2989
+ /* @__PURE__ */ jsx19(TooltipContent, { children: config.customComponent.label || config.labels?.customComponentToggle || "Toggle" })
2778
2990
  ] }),
2779
2991
  config.headerActions,
2780
- /* @__PURE__ */ jsxs10(DropdownMenu, { children: [
2781
- /* @__PURE__ */ jsx18(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx18(Button, { variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ jsx18(MoreVertical, { className: "h-4 w-4" }) }) }),
2782
- /* @__PURE__ */ jsxs10(DropdownMenuContent, { align: "end", children: [
2783
- onNewThread && /* @__PURE__ */ jsxs10(Fragment3, { children: [
2784
- /* @__PURE__ */ jsxs10(DropdownMenuItem, { onClick: () => onNewThread?.(), className: "font-medium text-primary", children: [
2785
- /* @__PURE__ */ jsx18(Plus2, { className: "h-4 w-4 mr-2" }),
2992
+ /* @__PURE__ */ jsxs11(DropdownMenu, { children: [
2993
+ /* @__PURE__ */ jsx19(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx19(Button, { variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ jsx19(MoreVertical, { className: "h-4 w-4" }) }) }),
2994
+ /* @__PURE__ */ jsxs11(DropdownMenuContent, { align: "end", children: [
2995
+ onNewThread && /* @__PURE__ */ jsxs11(Fragment4, { children: [
2996
+ /* @__PURE__ */ jsxs11(DropdownMenuItem, { onClick: () => onNewThread?.(), className: "font-medium text-primary", children: [
2997
+ /* @__PURE__ */ jsx19(Plus2, { className: "h-4 w-4 mr-2" }),
2786
2998
  config.labels?.newThread || "New Thread"
2787
2999
  ] }),
2788
- /* @__PURE__ */ jsx18(DropdownMenuSeparator, {})
3000
+ /* @__PURE__ */ jsx19(DropdownMenuSeparator, {})
2789
3001
  ] }),
2790
- onExportData && /* @__PURE__ */ jsxs10(DropdownMenuItem, { onClick: onExportData, children: [
2791
- /* @__PURE__ */ jsx18(Download, { className: "h-4 w-4 mr-2" }),
3002
+ onExportData && /* @__PURE__ */ jsxs11(DropdownMenuItem, { onClick: onExportData, children: [
3003
+ /* @__PURE__ */ jsx19(Download, { className: "h-4 w-4 mr-2" }),
2792
3004
  config.labels?.exportData || "Export Data"
2793
3005
  ] }),
2794
- onImportData && /* @__PURE__ */ jsxs10(DropdownMenuItem, { onClick: handleImportClick, children: [
2795
- /* @__PURE__ */ jsx18(Upload, { className: "h-4 w-4 mr-2" }),
3006
+ onImportData && /* @__PURE__ */ jsxs11(DropdownMenuItem, { onClick: handleImportClick, children: [
3007
+ /* @__PURE__ */ jsx19(Upload, { className: "h-4 w-4 mr-2" }),
2796
3008
  config.labels?.importData || "Import Data"
2797
3009
  ] }),
2798
- (onExportData || onImportData) && /* @__PURE__ */ jsx18(DropdownMenuSeparator, {}),
2799
- /* @__PURE__ */ jsx18(DropdownMenuItem, { onClick: toggleDarkMode, children: isDarkMode ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
2800
- /* @__PURE__ */ jsx18(Sun2, { className: "h-4 w-4 mr-2" }),
3010
+ (onExportData || onImportData) && /* @__PURE__ */ jsx19(DropdownMenuSeparator, {}),
3011
+ /* @__PURE__ */ jsx19(DropdownMenuItem, { onClick: toggleDarkMode, children: isDarkMode ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
3012
+ /* @__PURE__ */ jsx19(Sun2, { className: "h-4 w-4 mr-2" }),
2801
3013
  config.labels?.lightMode || "Light Mode"
2802
- ] }) : /* @__PURE__ */ jsxs10(Fragment3, { children: [
2803
- /* @__PURE__ */ jsx18(Moon2, { className: "h-4 w-4 mr-2" }),
3014
+ ] }) : /* @__PURE__ */ jsxs11(Fragment4, { children: [
3015
+ /* @__PURE__ */ jsx19(Moon2, { className: "h-4 w-4 mr-2" }),
2804
3016
  config.labels?.darkMode || "Dark Mode"
2805
3017
  ] }) }),
2806
- onClearAll && /* @__PURE__ */ jsxs10(Fragment3, { children: [
2807
- /* @__PURE__ */ jsx18(DropdownMenuSeparator, {}),
2808
- /* @__PURE__ */ jsxs10(
3018
+ onClearAll && /* @__PURE__ */ jsxs11(Fragment4, { children: [
3019
+ /* @__PURE__ */ jsx19(DropdownMenuSeparator, {}),
3020
+ /* @__PURE__ */ jsxs11(
2809
3021
  DropdownMenuItem,
2810
3022
  {
2811
3023
  onClick: onClearAll,
2812
3024
  className: "text-destructive",
2813
3025
  children: [
2814
- /* @__PURE__ */ jsx18(Trash22, { className: "h-4 w-4 mr-2" }),
3026
+ /* @__PURE__ */ jsx19(Trash22, { className: "h-4 w-4 mr-2" }),
2815
3027
  config.labels?.clearAll || "Clear All"
2816
3028
  ]
2817
3029
  }
@@ -2826,11 +3038,11 @@ var ChatHeader = ({
2826
3038
  };
2827
3039
 
2828
3040
  // src/components/chat/ChatInput.tsx
2829
- import { useState as useState6, useRef as useRef5, useCallback as useCallback3, useEffect as useEffect9, memo as memo2 } from "react";
3041
+ import React11, { useState as useState6, useRef as useRef5, useCallback as useCallback3, useEffect as useEffect9, memo as memo3 } from "react";
2830
3042
 
2831
3043
  // src/components/chat/UserContext.tsx
2832
- import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as useEffect8, useMemo as useMemo3, useState as useState5 } from "react";
2833
- import { jsx as jsx19 } from "react/jsx-runtime";
3044
+ import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as useEffect8, useMemo as useMemo4, useState as useState5 } from "react";
3045
+ import { jsx as jsx20 } from "react/jsx-runtime";
2834
3046
  var Ctx = createContext2(void 0);
2835
3047
  var ChatUserContextProvider = ({ children, initial }) => {
2836
3048
  const [ctx, setCtx] = useState5(() => ({
@@ -2852,12 +3064,12 @@ var ChatUserContextProvider = ({ children, initial }) => {
2852
3064
  return { ...prev, ...partial, updatedAt: Date.now() };
2853
3065
  });
2854
3066
  }, []);
2855
- const value = useMemo3(() => ({
3067
+ const value = useMemo4(() => ({
2856
3068
  context: ctx,
2857
3069
  setContext: setPartial,
2858
3070
  resetContext: () => setCtx({ updatedAt: Date.now() })
2859
3071
  }), [ctx, setPartial]);
2860
- return /* @__PURE__ */ jsx19(Ctx.Provider, { value, children });
3072
+ return /* @__PURE__ */ jsx20(Ctx.Provider, { value, children });
2861
3073
  };
2862
3074
  function useChatUserContext() {
2863
3075
  const v = useContext2(Ctx);
@@ -3191,13 +3403,13 @@ var resolveVoiceProviderFactory = (createProvider) => createProvider ?? createMa
3191
3403
 
3192
3404
  // src/components/ui/progress.tsx
3193
3405
  import * as ProgressPrimitive from "@radix-ui/react-progress";
3194
- import { jsx as jsx20 } from "react/jsx-runtime";
3406
+ import { jsx as jsx21 } from "react/jsx-runtime";
3195
3407
  function Progress({
3196
3408
  className,
3197
3409
  value,
3198
3410
  ...props
3199
3411
  }) {
3200
- return /* @__PURE__ */ jsx20(
3412
+ return /* @__PURE__ */ jsx21(
3201
3413
  ProgressPrimitive.Root,
3202
3414
  {
3203
3415
  "data-slot": "progress",
@@ -3206,7 +3418,7 @@ function Progress({
3206
3418
  className
3207
3419
  ),
3208
3420
  ...props,
3209
- children: /* @__PURE__ */ jsx20(
3421
+ children: /* @__PURE__ */ jsx21(
3210
3422
  ProgressPrimitive.Indicator,
3211
3423
  {
3212
3424
  "data-slot": "progress-indicator",
@@ -3219,8 +3431,8 @@ function Progress({
3219
3431
  }
3220
3432
 
3221
3433
  // src/components/chat/VoiceComposer.tsx
3222
- import { Keyboard, Loader2, Mic, Send, Square, Trash2 as Trash23, X as X2 } from "lucide-react";
3223
- import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
3434
+ import { Keyboard, Loader2, Mic, Send, Square, Trash2 as Trash23, X as X3 } from "lucide-react";
3435
+ import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
3224
3436
  var formatDuration = (durationMs) => {
3225
3437
  const totalSeconds = Math.max(0, Math.floor(durationMs / 1e3));
3226
3438
  const minutes = Math.floor(totalSeconds / 60);
@@ -3315,13 +3527,13 @@ var VoiceComposer = ({
3315
3527
  }
3316
3528
  onRecordAgain();
3317
3529
  };
3318
- return /* @__PURE__ */ jsxs11("div", { className: "w-full max-w-3xl rounded-2xl border bg-background p-3 shadow-sm sm:p-4 md:min-w-3xl", children: [
3319
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-2 sm:gap-3", children: [
3320
- /* @__PURE__ */ jsxs11("div", { className: "flex min-w-0 items-center gap-2", children: [
3321
- /* @__PURE__ */ jsx21(Badge, { variant: "outline", children: labels?.voiceTitle || "Voice" }),
3322
- /* @__PURE__ */ jsx21("span", { className: "truncate rounded-full bg-muted px-2.5 py-1 text-[11px] sm:text-xs text-muted-foreground", children: headerLabel })
3530
+ return /* @__PURE__ */ jsxs12("div", { className: "w-full max-w-3xl rounded-2xl border bg-background p-3 shadow-sm sm:p-4 md:min-w-3xl", children: [
3531
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between gap-2 sm:gap-3", children: [
3532
+ /* @__PURE__ */ jsxs12("div", { className: "flex min-w-0 items-center gap-2", children: [
3533
+ /* @__PURE__ */ jsx22(Badge, { variant: "outline", children: labels?.voiceTitle || "Voice" }),
3534
+ /* @__PURE__ */ jsx22("span", { className: "truncate rounded-full bg-muted px-2.5 py-1 text-[11px] sm:text-xs text-muted-foreground", children: headerLabel })
3323
3535
  ] }),
3324
- /* @__PURE__ */ jsxs11(
3536
+ /* @__PURE__ */ jsxs12(
3325
3537
  Button,
3326
3538
  {
3327
3539
  type: "button",
@@ -3331,14 +3543,14 @@ var VoiceComposer = ({
3331
3543
  onClick: onExit,
3332
3544
  disabled: disabled || isBusy,
3333
3545
  children: [
3334
- /* @__PURE__ */ jsx21(Keyboard, { className: "h-4 w-4" }),
3335
- /* @__PURE__ */ jsx21("span", { className: "hidden sm:inline", children: labels?.voiceExit || "Use keyboard" })
3546
+ /* @__PURE__ */ jsx22(Keyboard, { className: "h-4 w-4" }),
3547
+ /* @__PURE__ */ jsx22("span", { className: "hidden sm:inline", children: labels?.voiceExit || "Use keyboard" })
3336
3548
  ]
3337
3549
  }
3338
3550
  )
3339
3551
  ] }),
3340
- !isDraftLayout ? /* @__PURE__ */ jsx21("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__ */ jsxs11("div", { className: "mx-auto flex w-full max-w-sm flex-col items-center gap-3", children: [
3341
- /* @__PURE__ */ jsx21(
3552
+ !isDraftLayout ? /* @__PURE__ */ jsx22("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__ */ jsxs12("div", { className: "mx-auto flex w-full max-w-sm flex-col items-center gap-3", children: [
3553
+ /* @__PURE__ */ jsx22(
3342
3554
  Button,
3343
3555
  {
3344
3556
  type: "button",
@@ -3347,21 +3559,21 @@ var VoiceComposer = ({
3347
3559
  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"}`,
3348
3560
  onClick: isCapturing ? onStop : onStart,
3349
3561
  disabled: disabled || isBusy,
3350
- children: isBusy ? /* @__PURE__ */ jsx21(Loader2, { className: "h-7 w-7 animate-spin" }) : isCapturing ? /* @__PURE__ */ jsx21(Square, { className: "h-7 w-7" }) : /* @__PURE__ */ jsx21(Mic, { className: "h-7 w-7" })
3562
+ children: isBusy ? /* @__PURE__ */ jsx22(Loader2, { className: "h-7 w-7 animate-spin" }) : isCapturing ? /* @__PURE__ */ jsx22(Square, { className: "h-7 w-7" }) : /* @__PURE__ */ jsx22(Mic, { className: "h-7 w-7" })
3351
3563
  }
3352
3564
  ),
3353
- /* @__PURE__ */ jsxs11("div", { className: "w-full space-y-2", children: [
3354
- /* @__PURE__ */ jsx21(Progress, { value: levelValue, className: "h-2" }),
3355
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
3356
- /* @__PURE__ */ jsx21("span", { children: formatDuration(durationMs) }),
3357
- /* @__PURE__ */ jsx21("span", { children: isCapturing ? labels?.voiceStop || "Stop recording" : labels?.voiceStart || "Start recording" })
3565
+ /* @__PURE__ */ jsxs12("div", { className: "w-full space-y-2", children: [
3566
+ /* @__PURE__ */ jsx22(Progress, { value: levelValue, className: "h-2" }),
3567
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
3568
+ /* @__PURE__ */ jsx22("span", { children: formatDuration(durationMs) }),
3569
+ /* @__PURE__ */ jsx22("span", { children: isCapturing ? labels?.voiceStop || "Stop recording" : labels?.voiceStart || "Start recording" })
3358
3570
  ] })
3359
3571
  ] }),
3360
- showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ jsx21("div", { className: "w-full rounded-lg border bg-background px-3 py-2 text-left text-sm", children: transcriptText })
3361
- ] }) }) : /* @__PURE__ */ jsxs11("div", { className: "mt-3 rounded-xl border bg-muted/20 p-3 sm:p-4", children: [
3362
- /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-2 text-xs text-muted-foreground", children: [
3363
- /* @__PURE__ */ jsx21("span", { children: formatDuration(durationMs) }),
3364
- /* @__PURE__ */ jsx21(
3572
+ showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ jsx22("div", { className: "w-full rounded-lg border bg-background px-3 py-2 text-left text-sm", children: transcriptText })
3573
+ ] }) }) : /* @__PURE__ */ jsxs12("div", { className: "mt-3 rounded-xl border bg-muted/20 p-3 sm:p-4", children: [
3574
+ /* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between gap-2 text-xs text-muted-foreground", children: [
3575
+ /* @__PURE__ */ jsx22("span", { children: formatDuration(durationMs) }),
3576
+ /* @__PURE__ */ jsx22(
3365
3577
  Button,
3366
3578
  {
3367
3579
  type: "button",
@@ -3372,12 +3584,12 @@ var VoiceComposer = ({
3372
3584
  disabled,
3373
3585
  "aria-label": labels?.voiceDiscard || "Delete recording",
3374
3586
  title: labels?.voiceDiscard || "Delete recording",
3375
- children: /* @__PURE__ */ jsx21(Trash23, { className: "h-4 w-4" })
3587
+ children: /* @__PURE__ */ jsx22(Trash23, { className: "h-4 w-4" })
3376
3588
  }
3377
3589
  )
3378
3590
  ] }),
3379
- /* @__PURE__ */ jsxs11("div", { className: "mt-4 flex flex-col items-center gap-4 text-center", children: [
3380
- /* @__PURE__ */ jsx21(
3591
+ /* @__PURE__ */ jsxs12("div", { className: "mt-4 flex flex-col items-center gap-4 text-center", children: [
3592
+ /* @__PURE__ */ jsx22(
3381
3593
  Button,
3382
3594
  {
3383
3595
  type: "button",
@@ -3386,12 +3598,12 @@ var VoiceComposer = ({
3386
3598
  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"}`,
3387
3599
  onClick: handleReviewOrbClick,
3388
3600
  disabled: disabled || orbIsReviewBusy,
3389
- children: orbIsReviewBusy ? /* @__PURE__ */ jsx21(Loader2, { className: "h-7 w-7 animate-spin" }) : orbIsListening ? /* @__PURE__ */ jsx21(Square, { className: "h-7 w-7" }) : isArmedDraft ? /* @__PURE__ */ jsx21(Mic, { className: "h-7 w-7 animate-pulse" }) : /* @__PURE__ */ jsx21(Mic, { className: "h-7 w-7" })
3601
+ children: orbIsReviewBusy ? /* @__PURE__ */ jsx22(Loader2, { className: "h-7 w-7 animate-spin" }) : orbIsListening ? /* @__PURE__ */ jsx22(Square, { className: "h-7 w-7" }) : isArmedDraft ? /* @__PURE__ */ jsx22(Mic, { className: "h-7 w-7 animate-pulse" }) : /* @__PURE__ */ jsx22(Mic, { className: "h-7 w-7" })
3390
3602
  }
3391
3603
  ),
3392
- /* @__PURE__ */ jsxs11("div", { className: "max-w-sm space-y-1 px-2", children: [
3393
- /* @__PURE__ */ jsx21("p", { className: "text-sm text-foreground", children: reviewHelperText }),
3394
- isCapturing && /* @__PURE__ */ jsx21("div", { className: "mx-auto h-1.5 w-32 overflow-hidden rounded-full bg-red-100", children: /* @__PURE__ */ jsx21(
3604
+ /* @__PURE__ */ jsxs12("div", { className: "max-w-sm space-y-1 px-2", children: [
3605
+ /* @__PURE__ */ jsx22("p", { className: "text-sm text-foreground", children: reviewHelperText }),
3606
+ isCapturing && /* @__PURE__ */ jsx22("div", { className: "mx-auto h-1.5 w-32 overflow-hidden rounded-full bg-red-100", children: /* @__PURE__ */ jsx22(
3395
3607
  "div",
3396
3608
  {
3397
3609
  className: "h-full rounded-full bg-red-500 transition-[width] duration-150",
@@ -3400,21 +3612,21 @@ var VoiceComposer = ({
3400
3612
  ) })
3401
3613
  ] })
3402
3614
  ] }),
3403
- attachment && /* @__PURE__ */ jsx21("div", { className: "mt-4 rounded-lg border bg-background/90 p-2 shadow-sm", children: /* @__PURE__ */ jsx21("audio", { controls: true, preload: "metadata", className: "w-full", children: /* @__PURE__ */ jsx21("source", { src: attachment.dataUrl, type: attachment.mimeType }) }) }),
3404
- showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ jsx21("div", { className: "mt-3 rounded-lg border bg-background px-3 py-2 text-left text-sm", children: transcriptText }),
3405
- isAutoSendActive && autoSendDelayMs > 0 && /* @__PURE__ */ jsx21("div", { className: "mt-3 flex justify-center", children: /* @__PURE__ */ jsx21("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) }) }),
3406
- /* @__PURE__ */ jsxs11("div", { className: "mt-4 grid grid-cols-1 gap-2 sm:flex sm:items-center sm:justify-end", children: [
3407
- isAutoSendActive && /* @__PURE__ */ jsxs11(Button, { type: "button", variant: "ghost", size: "sm", onClick: onCancelAutoSend, disabled, className: "w-full sm:w-auto", children: [
3408
- /* @__PURE__ */ jsx21(X2, { className: "h-4 w-4" }),
3615
+ attachment && /* @__PURE__ */ jsx22("div", { className: "mt-4 rounded-lg border bg-background/90 p-2 shadow-sm", children: /* @__PURE__ */ jsx22("audio", { controls: true, preload: "metadata", className: "w-full", children: /* @__PURE__ */ jsx22("source", { src: attachment.dataUrl, type: attachment.mimeType }) }) }),
3616
+ showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ jsx22("div", { className: "mt-3 rounded-lg border bg-background px-3 py-2 text-left text-sm", children: transcriptText }),
3617
+ isAutoSendActive && autoSendDelayMs > 0 && /* @__PURE__ */ jsx22("div", { className: "mt-3 flex justify-center", children: /* @__PURE__ */ jsx22("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) }) }),
3618
+ /* @__PURE__ */ jsxs12("div", { className: "mt-4 grid grid-cols-1 gap-2 sm:flex sm:items-center sm:justify-end", children: [
3619
+ isAutoSendActive && /* @__PURE__ */ jsxs12(Button, { type: "button", variant: "ghost", size: "sm", onClick: onCancelAutoSend, disabled, className: "w-full sm:w-auto", children: [
3620
+ /* @__PURE__ */ jsx22(X3, { className: "h-4 w-4" }),
3409
3621
  labels?.voiceCancel || "Cancel"
3410
3622
  ] }),
3411
- /* @__PURE__ */ jsxs11(Button, { type: "button", size: "sm", onClick: onSendNow, disabled, className: "w-full sm:w-auto", children: [
3412
- /* @__PURE__ */ jsx21(Send, { className: "h-4 w-4" }),
3623
+ /* @__PURE__ */ jsxs12(Button, { type: "button", size: "sm", onClick: onSendNow, disabled, className: "w-full sm:w-auto", children: [
3624
+ /* @__PURE__ */ jsx22(Send, { className: "h-4 w-4" }),
3413
3625
  labels?.voiceSendNow || "Send now"
3414
3626
  ] })
3415
3627
  ] })
3416
3628
  ] }),
3417
- errorMessage && /* @__PURE__ */ jsx21("div", { className: "mt-3 rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive", children: errorMessage })
3629
+ errorMessage && /* @__PURE__ */ jsx22("div", { className: "mt-3 rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive", children: errorMessage })
3418
3630
  ] });
3419
3631
  };
3420
3632
 
@@ -3426,14 +3638,37 @@ import {
3426
3638
  Image as Image2,
3427
3639
  Video,
3428
3640
  FileText,
3429
- X as X3,
3641
+ X as X4,
3430
3642
  Square as Square2,
3431
3643
  Play,
3432
3644
  Pause,
3433
3645
  Loader2 as Loader22
3434
3646
  } from "lucide-react";
3435
- import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
3436
- var FileUploadItem = memo2(function FileUploadItem2({ file, progress, onCancel }) {
3647
+ import { Fragment as Fragment5, jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
3648
+ function getActiveMentionMatch(value, caret) {
3649
+ const prefix = value.slice(0, caret);
3650
+ const match = /(^|\s)@([\w.-]*)$/.exec(prefix);
3651
+ if (!match) return null;
3652
+ const query = match[2] ?? "";
3653
+ return {
3654
+ start: prefix.length - query.length - 1,
3655
+ end: caret,
3656
+ query
3657
+ };
3658
+ }
3659
+ function resolveTargetFromMentions(value, agents) {
3660
+ const matches = value.matchAll(/(^|\s)@([\w.-]+)/g);
3661
+ for (const match of matches) {
3662
+ const mention = match[2]?.toLowerCase();
3663
+ if (!mention) continue;
3664
+ const agent = agents.find(
3665
+ (candidate) => candidate.id.toLowerCase() === mention || candidate.name.toLowerCase() === mention
3666
+ );
3667
+ if (agent) return agent;
3668
+ }
3669
+ return null;
3670
+ }
3671
+ var FileUploadItem = memo3(function FileUploadItem2({ file, progress, onCancel }) {
3437
3672
  const guessTypeFromName = (name) => {
3438
3673
  const ext = (name || "").split(".").pop()?.toLowerCase();
3439
3674
  switch (ext) {
@@ -3461,10 +3696,10 @@ var FileUploadItem = memo2(function FileUploadItem2({ file, progress, onCancel }
3461
3696
  };
3462
3697
  const getFileIcon = (type, name) => {
3463
3698
  const t = typeof type === "string" && type.length > 0 ? type : guessTypeFromName(name);
3464
- if (t.startsWith("image/")) return /* @__PURE__ */ jsx22(Image2, { className: "h-4 w-4" });
3465
- if (t.startsWith("video/")) return /* @__PURE__ */ jsx22(Video, { className: "h-4 w-4" });
3466
- if (t.startsWith("audio/")) return /* @__PURE__ */ jsx22(Mic2, { className: "h-4 w-4" });
3467
- return /* @__PURE__ */ jsx22(FileText, { className: "h-4 w-4" });
3699
+ if (t.startsWith("image/")) return /* @__PURE__ */ jsx23(Image2, { className: "h-4 w-4" });
3700
+ if (t.startsWith("video/")) return /* @__PURE__ */ jsx23(Video, { className: "h-4 w-4" });
3701
+ if (t.startsWith("audio/")) return /* @__PURE__ */ jsx23(Mic2, { className: "h-4 w-4" });
3702
+ return /* @__PURE__ */ jsx23(FileText, { className: "h-4 w-4" });
3468
3703
  };
3469
3704
  const formatFileSize = (bytes) => {
3470
3705
  if (bytes === 0) return "0 Bytes";
@@ -3473,26 +3708,26 @@ var FileUploadItem = memo2(function FileUploadItem2({ file, progress, onCancel }
3473
3708
  const i = Math.floor(Math.log(bytes) / Math.log(k));
3474
3709
  return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
3475
3710
  };
3476
- return /* @__PURE__ */ jsx22(Card, { className: "relative", children: /* @__PURE__ */ jsx22(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-3", children: [
3711
+ return /* @__PURE__ */ jsx23(Card, { className: "relative", children: /* @__PURE__ */ jsx23(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-3", children: [
3477
3712
  getFileIcon(file.type, file.name),
3478
- /* @__PURE__ */ jsxs12("div", { className: "flex-1 min-w-0", children: [
3479
- /* @__PURE__ */ jsx22("p", { className: "text-sm font-medium truncate", children: file.name }),
3480
- /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: formatFileSize(file.size ?? 0) }),
3481
- /* @__PURE__ */ jsx22(Progress, { value: progress, className: "h-1 mt-1" })
3713
+ /* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
3714
+ /* @__PURE__ */ jsx23("p", { className: "text-sm font-medium truncate", children: file.name }),
3715
+ /* @__PURE__ */ jsx23("p", { className: "text-xs text-muted-foreground", children: formatFileSize(file.size ?? 0) }),
3716
+ /* @__PURE__ */ jsx23(Progress, { value: progress, className: "h-1 mt-1" })
3482
3717
  ] }),
3483
- /* @__PURE__ */ jsx22(
3718
+ /* @__PURE__ */ jsx23(
3484
3719
  Button,
3485
3720
  {
3486
3721
  variant: "ghost",
3487
3722
  size: "icon",
3488
3723
  className: "h-6 w-6",
3489
3724
  onClick: onCancel,
3490
- children: /* @__PURE__ */ jsx22(X3, { className: "h-3 w-3" })
3725
+ children: /* @__PURE__ */ jsx23(X4, { className: "h-3 w-3" })
3491
3726
  }
3492
3727
  )
3493
3728
  ] }) }) });
3494
3729
  });
3495
- var AttachmentPreview = memo2(function AttachmentPreview2({ attachment, onRemove }) {
3730
+ var AttachmentPreview = memo3(function AttachmentPreview2({ attachment, onRemove }) {
3496
3731
  const [isPlaying, setIsPlaying] = useState6(false);
3497
3732
  const [audioPlaybackSrc, setAudioPlaybackSrc] = useState6(attachment.dataUrl);
3498
3733
  const audioRef = useRef5(null);
@@ -3527,9 +3762,9 @@ var AttachmentPreview = memo2(function AttachmentPreview2({ attachment, onRemove
3527
3762
  const minutes = Math.floor(seconds / 60);
3528
3763
  return `${minutes}:${(seconds % 60).toString().padStart(2, "0")}`;
3529
3764
  };
3530
- return /* @__PURE__ */ jsx22(Card, { className: "relative group", children: /* @__PURE__ */ jsxs12(CardContent, { className: "p-2", children: [
3531
- attachment.kind === "image" && /* @__PURE__ */ jsxs12("div", { className: "relative", children: [
3532
- /* @__PURE__ */ jsx22(
3765
+ return /* @__PURE__ */ jsx23(Card, { className: "relative group", children: /* @__PURE__ */ jsxs13(CardContent, { className: "p-2", children: [
3766
+ attachment.kind === "image" && /* @__PURE__ */ jsxs13("div", { className: "relative", children: [
3767
+ /* @__PURE__ */ jsx23(
3533
3768
  "img",
3534
3769
  {
3535
3770
  src: attachment.dataUrl,
@@ -3537,19 +3772,19 @@ var AttachmentPreview = memo2(function AttachmentPreview2({ attachment, onRemove
3537
3772
  className: "w-full h-20 object-cover rounded"
3538
3773
  }
3539
3774
  ),
3540
- /* @__PURE__ */ jsx22("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ jsx22(
3775
+ /* @__PURE__ */ jsx23("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ jsx23(
3541
3776
  Button,
3542
3777
  {
3543
3778
  variant: "destructive",
3544
3779
  size: "icon",
3545
3780
  className: "h-6 w-6",
3546
3781
  onClick: onRemove,
3547
- children: /* @__PURE__ */ jsx22(X3, { className: "h-3 w-3" })
3782
+ children: /* @__PURE__ */ jsx23(X4, { className: "h-3 w-3" })
3548
3783
  }
3549
3784
  ) })
3550
3785
  ] }),
3551
- attachment.kind === "video" && /* @__PURE__ */ jsxs12("div", { className: "relative", children: [
3552
- /* @__PURE__ */ jsx22(
3786
+ attachment.kind === "video" && /* @__PURE__ */ jsxs13("div", { className: "relative", children: [
3787
+ /* @__PURE__ */ jsx23(
3553
3788
  "video",
3554
3789
  {
3555
3790
  src: attachment.dataUrl,
@@ -3558,34 +3793,34 @@ var AttachmentPreview = memo2(function AttachmentPreview2({ attachment, onRemove
3558
3793
  muted: true
3559
3794
  }
3560
3795
  ),
3561
- /* @__PURE__ */ jsx22("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ jsx22(
3796
+ /* @__PURE__ */ jsx23("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ jsx23(
3562
3797
  Button,
3563
3798
  {
3564
3799
  variant: "destructive",
3565
3800
  size: "icon",
3566
3801
  className: "h-6 w-6",
3567
3802
  onClick: onRemove,
3568
- children: /* @__PURE__ */ jsx22(X3, { className: "h-3 w-3" })
3803
+ children: /* @__PURE__ */ jsx23(X4, { className: "h-3 w-3" })
3569
3804
  }
3570
3805
  ) }),
3571
- /* @__PURE__ */ jsx22(Badge, { className: "absolute bottom-1 right-1 text-xs", children: formatDuration2(attachment.durationMs) })
3806
+ /* @__PURE__ */ jsx23(Badge, { className: "absolute bottom-1 right-1 text-xs", children: formatDuration2(attachment.durationMs) })
3572
3807
  ] }),
3573
- attachment.kind === "audio" && /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2 p-2", children: [
3574
- /* @__PURE__ */ jsx22(
3808
+ attachment.kind === "audio" && /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 p-2", children: [
3809
+ /* @__PURE__ */ jsx23(
3575
3810
  Button,
3576
3811
  {
3577
3812
  variant: "outline",
3578
3813
  size: "icon",
3579
3814
  className: "h-8 w-8",
3580
3815
  onClick: handlePlayPause,
3581
- children: isPlaying ? /* @__PURE__ */ jsx22(Pause, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx22(Play, { className: "h-3 w-3" })
3816
+ children: isPlaying ? /* @__PURE__ */ jsx23(Pause, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx23(Play, { className: "h-3 w-3" })
3582
3817
  }
3583
3818
  ),
3584
- /* @__PURE__ */ jsxs12("div", { className: "flex-1", children: [
3585
- /* @__PURE__ */ jsx22("p", { className: "text-xs font-medium", children: attachment.fileName || "Audio" }),
3586
- /* @__PURE__ */ jsx22("p", { className: "text-xs text-muted-foreground", children: formatDuration2(attachment.durationMs) })
3819
+ /* @__PURE__ */ jsxs13("div", { className: "flex-1", children: [
3820
+ /* @__PURE__ */ jsx23("p", { className: "text-xs font-medium", children: attachment.fileName || "Audio" }),
3821
+ /* @__PURE__ */ jsx23("p", { className: "text-xs text-muted-foreground", children: formatDuration2(attachment.durationMs) })
3587
3822
  ] }),
3588
- /* @__PURE__ */ jsx22(
3823
+ /* @__PURE__ */ jsx23(
3589
3824
  "audio",
3590
3825
  {
3591
3826
  ref: audioRef,
@@ -3593,71 +3828,71 @@ var AttachmentPreview = memo2(function AttachmentPreview2({ attachment, onRemove
3593
3828
  onPause: () => setIsPlaying(false),
3594
3829
  onEnded: () => setIsPlaying(false),
3595
3830
  preload: "metadata",
3596
- children: /* @__PURE__ */ jsx22("source", { src: audioPlaybackSrc, type: attachment.mimeType })
3831
+ children: /* @__PURE__ */ jsx23("source", { src: audioPlaybackSrc, type: attachment.mimeType })
3597
3832
  }
3598
3833
  ),
3599
- /* @__PURE__ */ jsx22(
3834
+ /* @__PURE__ */ jsx23(
3600
3835
  Button,
3601
3836
  {
3602
3837
  variant: "ghost",
3603
3838
  size: "icon",
3604
3839
  className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
3605
3840
  onClick: onRemove,
3606
- children: /* @__PURE__ */ jsx22(X3, { className: "h-3 w-3" })
3841
+ children: /* @__PURE__ */ jsx23(X4, { className: "h-3 w-3" })
3607
3842
  }
3608
3843
  )
3609
3844
  ] }),
3610
- attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */ jsx22("div", { className: "absolute bottom-0 left-0 right-0 bg-black/70 text-white text-xs p-1 rounded-b", children: /* @__PURE__ */ jsx22("p", { className: "truncate", children: attachment.fileName }) })
3845
+ attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */ jsx23("div", { className: "absolute bottom-0 left-0 right-0 bg-black/70 text-white text-xs p-1 rounded-b", children: /* @__PURE__ */ jsx23("p", { className: "truncate", children: attachment.fileName }) })
3611
3846
  ] }) });
3612
3847
  });
3613
- var AudioRecorder = memo2(function AudioRecorder2({ isRecording, onStartRecording, onStopRecording, onCancel, recordingDuration, config }) {
3848
+ var AudioRecorder = memo3(function AudioRecorder2({ isRecording, onStartRecording, onStopRecording, onCancel, recordingDuration, config }) {
3614
3849
  const formatTime = (seconds) => {
3615
3850
  const mins = Math.floor(seconds / 60);
3616
3851
  const secs = seconds % 60;
3617
3852
  return `${mins}:${secs.toString().padStart(2, "0")}`;
3618
3853
  };
3619
3854
  if (!isRecording) {
3620
- return /* @__PURE__ */ jsxs12(Tooltip, { children: [
3621
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
3855
+ return /* @__PURE__ */ jsxs13(Tooltip, { children: [
3856
+ /* @__PURE__ */ jsx23(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx23(
3622
3857
  Button,
3623
3858
  {
3624
3859
  variant: "outline",
3625
3860
  size: "icon",
3626
3861
  onClick: onStartRecording,
3627
3862
  className: "h-10 w-10",
3628
- children: /* @__PURE__ */ jsx22(Mic2, { className: "h-4 w-4" })
3863
+ children: /* @__PURE__ */ jsx23(Mic2, { className: "h-4 w-4" })
3629
3864
  }
3630
3865
  ) }),
3631
- /* @__PURE__ */ jsx22(TooltipContent, { children: config?.labels?.recordAudioTooltip })
3866
+ /* @__PURE__ */ jsx23(TooltipContent, { children: config?.labels?.recordAudioTooltip })
3632
3867
  ] });
3633
3868
  }
3634
- return /* @__PURE__ */ jsx22(Card, { className: "border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-950", children: /* @__PURE__ */ jsx22(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-3", children: [
3635
- /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
3636
- /* @__PURE__ */ jsx22("div", { className: "h-3 w-3 bg-red-500 rounded-full animate-pulse" }),
3637
- /* @__PURE__ */ jsx22("span", { className: "text-sm font-medium text-red-700 dark:text-red-300", children: config?.labels?.voiceListening || "Recording" })
3869
+ return /* @__PURE__ */ jsx23(Card, { className: "border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-950", children: /* @__PURE__ */ jsx23(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-3", children: [
3870
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
3871
+ /* @__PURE__ */ jsx23("div", { className: "h-3 w-3 bg-red-500 rounded-full animate-pulse" }),
3872
+ /* @__PURE__ */ jsx23("span", { className: "text-sm font-medium text-red-700 dark:text-red-300", children: config?.labels?.voiceListening || "Recording" })
3638
3873
  ] }),
3639
- /* @__PURE__ */ jsx22(Badge, { variant: "outline", className: "text-xs", children: formatTime(recordingDuration) }),
3640
- /* @__PURE__ */ jsxs12("div", { className: "flex gap-1 ml-auto", children: [
3641
- /* @__PURE__ */ jsxs12(
3874
+ /* @__PURE__ */ jsx23(Badge, { variant: "outline", className: "text-xs", children: formatTime(recordingDuration) }),
3875
+ /* @__PURE__ */ jsxs13("div", { className: "flex gap-1 ml-auto", children: [
3876
+ /* @__PURE__ */ jsxs13(
3642
3877
  Button,
3643
3878
  {
3644
3879
  variant: "outline",
3645
3880
  size: "sm",
3646
3881
  onClick: onCancel,
3647
3882
  children: [
3648
- /* @__PURE__ */ jsx22(X3, { className: "h-3 w-3 mr-1" }),
3883
+ /* @__PURE__ */ jsx23(X4, { className: "h-3 w-3 mr-1" }),
3649
3884
  config?.labels?.cancel || "Cancel"
3650
3885
  ]
3651
3886
  }
3652
3887
  ),
3653
- /* @__PURE__ */ jsxs12(
3888
+ /* @__PURE__ */ jsxs13(
3654
3889
  Button,
3655
3890
  {
3656
3891
  variant: "default",
3657
3892
  size: "sm",
3658
3893
  onClick: onStopRecording,
3659
3894
  children: [
3660
- /* @__PURE__ */ jsx22(Square2, { className: "h-3 w-3 mr-1" }),
3895
+ /* @__PURE__ */ jsx23(Square2, { className: "h-3 w-3 mr-1" }),
3661
3896
  config?.labels?.voiceStop || "Stop"
3662
3897
  ]
3663
3898
  }
@@ -3676,7 +3911,7 @@ var resolveVoiceErrorMessage = (error, config) => {
3676
3911
  };
3677
3912
  var clearVoiceTranscript = () => ({});
3678
3913
  var resolveVoiceSegmentDuration = (segment) => segment.attachment.durationMs ?? 0;
3679
- var ChatInput = memo2(function ChatInput2({
3914
+ var ChatInput = memo3(function ChatInput2({
3680
3915
  value,
3681
3916
  onChange,
3682
3917
  onSubmit,
@@ -3693,7 +3928,9 @@ var ChatInput = memo2(function ChatInput2({
3693
3928
  // 10MB
3694
3929
  acceptedFileTypes = ["image/*", "video/*", "audio/*"],
3695
3930
  className = "",
3696
- config
3931
+ config,
3932
+ mentionAgents = [],
3933
+ onTargetAgentChange
3697
3934
  }) {
3698
3935
  const voiceComposeEnabled = config?.voiceCompose?.enabled === true;
3699
3936
  const voiceDefaultMode = config?.voiceCompose?.defaultMode ?? "text";
@@ -3718,6 +3955,8 @@ var ChatInput = memo2(function ChatInput2({
3718
3955
  const [voiceCountdownMs, setVoiceCountdownMs] = useState6(0);
3719
3956
  const [isVoiceAutoSendActive, setIsVoiceAutoSendActive] = useState6(false);
3720
3957
  const [voiceError, setVoiceError] = useState6(null);
3958
+ const [activeMention, setActiveMention] = useState6(null);
3959
+ const [activeMentionIndex, setActiveMentionIndex] = useState6(0);
3721
3960
  const textareaRef = useRef5(null);
3722
3961
  const fileInputRef = useRef5(null);
3723
3962
  const mediaRecorderRef = useRef5(null);
@@ -3728,6 +3967,35 @@ var ChatInput = memo2(function ChatInput2({
3728
3967
  const voiceDraftRef = useRef5(null);
3729
3968
  const voiceAppendBaseRef = useRef5(null);
3730
3969
  const voiceAppendBaseDurationRef = useRef5(0);
3970
+ const filteredMentionAgents = React11.useMemo(() => {
3971
+ if (!activeMention || mentionAgents.length === 0) return [];
3972
+ const query = activeMention.query.trim().toLowerCase();
3973
+ const rank = (agent) => {
3974
+ const id = agent.id.toLowerCase();
3975
+ const name = agent.name.toLowerCase();
3976
+ if (!query) return 0;
3977
+ if (name.startsWith(query) || id.startsWith(query)) return 0;
3978
+ if (name.includes(query) || id.includes(query)) return 1;
3979
+ return 2;
3980
+ };
3981
+ return mentionAgents.filter((agent) => rank(agent) < 2).sort((left, right) => {
3982
+ const rankDiff = rank(left) - rank(right);
3983
+ if (rankDiff !== 0) return rankDiff;
3984
+ return left.name.localeCompare(right.name);
3985
+ }).slice(0, 6);
3986
+ }, [activeMention, mentionAgents]);
3987
+ const isMentionMenuOpen = filteredMentionAgents.length > 0;
3988
+ const syncMentionState = useCallback3((nextValue, nextCaret) => {
3989
+ const caret = typeof nextCaret === "number" ? nextCaret : textareaRef.current?.selectionStart ?? nextValue.length;
3990
+ const nextMatch = getActiveMentionMatch(nextValue, caret);
3991
+ setActiveMention((prev) => {
3992
+ if (prev?.start === nextMatch?.start && prev?.end === nextMatch?.end && prev?.query === nextMatch?.query) {
3993
+ return prev;
3994
+ }
3995
+ return nextMatch;
3996
+ });
3997
+ setActiveMentionIndex(0);
3998
+ }, []);
3731
3999
  useEffect9(() => {
3732
4000
  return () => {
3733
4001
  if (mediaStreamRef.current) {
@@ -3745,14 +4013,70 @@ var ChatInput = memo2(function ChatInput2({
3745
4013
  useEffect9(() => {
3746
4014
  voiceDraftRef.current = voiceDraft;
3747
4015
  }, [voiceDraft]);
4016
+ useEffect9(() => {
4017
+ if (!isMentionMenuOpen) {
4018
+ setActiveMentionIndex(0);
4019
+ return;
4020
+ }
4021
+ setActiveMentionIndex(
4022
+ (prev) => prev >= filteredMentionAgents.length ? 0 : prev
4023
+ );
4024
+ }, [filteredMentionAgents.length, isMentionMenuOpen]);
4025
+ const selectMentionAgent = useCallback3((agent) => {
4026
+ if (!activeMention) return;
4027
+ const replacement = `@${agent.name} `;
4028
+ const nextValue = value.slice(0, activeMention.start) + replacement + value.slice(activeMention.end);
4029
+ const nextCaret = activeMention.start + replacement.length;
4030
+ onChange(nextValue);
4031
+ onTargetAgentChange?.(agent.id);
4032
+ setActiveMention(null);
4033
+ setActiveMentionIndex(0);
4034
+ requestAnimationFrame(() => {
4035
+ textareaRef.current?.focus();
4036
+ textareaRef.current?.setSelectionRange(nextCaret, nextCaret);
4037
+ });
4038
+ }, [activeMention, onChange, onTargetAgentChange, value]);
3748
4039
  const handleSubmit = (e) => {
3749
4040
  e.preventDefault();
3750
4041
  if (!value.trim() && attachments.length === 0 || disabled || isGenerating) return;
4042
+ const mentionedAgent = resolveTargetFromMentions(value, mentionAgents);
4043
+ if (mentionedAgent) {
4044
+ onTargetAgentChange?.(mentionedAgent.id);
4045
+ }
3751
4046
  onSubmit(value.trim(), attachments);
3752
4047
  onChange("");
3753
4048
  onAttachmentsChange([]);
4049
+ setActiveMention(null);
4050
+ setActiveMentionIndex(0);
3754
4051
  };
3755
4052
  const handleKeyDown = (e) => {
4053
+ if (isMentionMenuOpen) {
4054
+ if (e.key === "ArrowDown") {
4055
+ e.preventDefault();
4056
+ setActiveMentionIndex(
4057
+ (prev) => prev >= filteredMentionAgents.length - 1 ? 0 : prev + 1
4058
+ );
4059
+ return;
4060
+ }
4061
+ if (e.key === "ArrowUp") {
4062
+ e.preventDefault();
4063
+ setActiveMentionIndex(
4064
+ (prev) => prev <= 0 ? filteredMentionAgents.length - 1 : prev - 1
4065
+ );
4066
+ return;
4067
+ }
4068
+ if ((e.key === "Enter" || e.key === "Tab") && filteredMentionAgents[activeMentionIndex]) {
4069
+ e.preventDefault();
4070
+ selectMentionAgent(filteredMentionAgents[activeMentionIndex]);
4071
+ return;
4072
+ }
4073
+ if (e.key === "Escape") {
4074
+ e.preventDefault();
4075
+ setActiveMention(null);
4076
+ setActiveMentionIndex(0);
4077
+ return;
4078
+ }
4079
+ }
3756
4080
  if (e.key === "Enter" && !e.shiftKey && !e.ctrlKey && window.innerWidth > 768) {
3757
4081
  e.preventDefault();
3758
4082
  handleSubmit(e);
@@ -4204,8 +4528,8 @@ var ChatInput = memo2(function ChatInput2({
4204
4528
  };
4205
4529
  const canAddMoreAttachments = attachments.length < maxAttachments;
4206
4530
  const showVoiceComposer = voiceComposeEnabled && isVoiceComposerOpen;
4207
- return /* @__PURE__ */ jsx22(TooltipProvider, { children: /* @__PURE__ */ jsx22("div", { className: `border-t py-0 bg-transparent ${className}`, children: /* @__PURE__ */ jsxs12("div", { className: "px-0 md:p-2 pb-1 space-y-4 bg-transparent", children: [
4208
- uploadProgress.size > 0 && /* @__PURE__ */ jsx22("div", { className: "space-y-2", children: Array.from(uploadProgress.entries()).map(([id, progress]) => /* @__PURE__ */ jsx22(
4531
+ return /* @__PURE__ */ jsx23(TooltipProvider, { children: /* @__PURE__ */ jsx23("div", { className: `border-t py-0 bg-transparent ${className}`, children: /* @__PURE__ */ jsxs13("div", { className: "px-0 md:p-2 pb-1 space-y-4 bg-transparent", children: [
4532
+ uploadProgress.size > 0 && /* @__PURE__ */ jsx23("div", { className: "space-y-2", children: Array.from(uploadProgress.entries()).map(([id, progress]) => /* @__PURE__ */ jsx23(
4209
4533
  FileUploadItem,
4210
4534
  {
4211
4535
  file: { name: progress.fileName },
@@ -4220,7 +4544,7 @@ var ChatInput = memo2(function ChatInput2({
4220
4544
  },
4221
4545
  id
4222
4546
  )) }),
4223
- isRecording && /* @__PURE__ */ jsx22(
4547
+ isRecording && /* @__PURE__ */ jsx23(
4224
4548
  AudioRecorder,
4225
4549
  {
4226
4550
  isRecording,
@@ -4231,7 +4555,7 @@ var ChatInput = memo2(function ChatInput2({
4231
4555
  config
4232
4556
  }
4233
4557
  ),
4234
- attachments.length > 0 && /* @__PURE__ */ jsx22("div", { className: "grid grid-cols-4 gap-2", children: attachments.map((attachment, index) => /* @__PURE__ */ jsx22(
4558
+ attachments.length > 0 && /* @__PURE__ */ jsx23("div", { className: "grid grid-cols-4 gap-2", children: attachments.map((attachment, index) => /* @__PURE__ */ jsx23(
4235
4559
  AttachmentPreview,
4236
4560
  {
4237
4561
  attachment,
@@ -4239,7 +4563,7 @@ var ChatInput = memo2(function ChatInput2({
4239
4563
  },
4240
4564
  index
4241
4565
  )) }),
4242
- showVoiceComposer ? /* @__PURE__ */ jsx22("div", { className: "mb-1 flex justify-center", children: /* @__PURE__ */ jsx22(
4566
+ showVoiceComposer ? /* @__PURE__ */ jsx23("div", { className: "mb-1 flex justify-center", children: /* @__PURE__ */ jsx23(
4243
4567
  VoiceComposer,
4244
4568
  {
4245
4569
  state: voiceState,
@@ -4279,15 +4603,15 @@ var ChatInput = memo2(function ChatInput2({
4279
4603
  void closeVoiceComposer();
4280
4604
  }
4281
4605
  }
4282
- ) }) : /* @__PURE__ */ jsx22("form", { onSubmit: handleSubmit, className: "mb-1 flex justify-center", children: /* @__PURE__ */ jsxs12(
4606
+ ) }) : /* @__PURE__ */ jsx23("form", { onSubmit: handleSubmit, className: "mb-1 flex justify-center", children: /* @__PURE__ */ jsxs13(
4283
4607
  "div",
4284
4608
  {
4285
4609
  className: "flex items-end gap-2 p-3 border rounded-lg bg-background w-full md:min-w-3xl max-w-3xl",
4286
4610
  onDrop: handleDrop,
4287
4611
  onDragOver: handleDragOver,
4288
4612
  children: [
4289
- enableFileUpload && canAddMoreAttachments && /* @__PURE__ */ jsxs12(Fragment4, { children: [
4290
- /* @__PURE__ */ jsx22(
4613
+ enableFileUpload && canAddMoreAttachments && /* @__PURE__ */ jsxs13(Fragment5, { children: [
4614
+ /* @__PURE__ */ jsx23(
4291
4615
  "input",
4292
4616
  {
4293
4617
  ref: fileInputRef,
@@ -4298,8 +4622,8 @@ var ChatInput = memo2(function ChatInput2({
4298
4622
  className: "hidden"
4299
4623
  }
4300
4624
  ),
4301
- /* @__PURE__ */ jsxs12(Tooltip, { children: [
4302
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
4625
+ /* @__PURE__ */ jsxs13(Tooltip, { children: [
4626
+ /* @__PURE__ */ jsx23(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx23(
4303
4627
  Button,
4304
4628
  {
4305
4629
  type: "button",
@@ -4312,27 +4636,56 @@ var ChatInput = memo2(function ChatInput2({
4312
4636
  fileInputRef.current?.click();
4313
4637
  },
4314
4638
  disabled,
4315
- children: /* @__PURE__ */ jsx22(Paperclip, { className: "h-4 w-4" })
4639
+ children: /* @__PURE__ */ jsx23(Paperclip, { className: "h-4 w-4" })
4316
4640
  }
4317
4641
  ) }),
4318
- /* @__PURE__ */ jsx22(TooltipContent, { children: config?.labels?.attachFileTooltip })
4642
+ /* @__PURE__ */ jsx23(TooltipContent, { children: config?.labels?.attachFileTooltip })
4319
4643
  ] })
4320
4644
  ] }),
4321
- /* @__PURE__ */ jsx22("div", { className: "flex-1", children: /* @__PURE__ */ jsx22(
4322
- Textarea,
4323
- {
4324
- ref: textareaRef,
4325
- value,
4326
- onChange: (e) => onChange(e.target.value),
4327
- onKeyDown: handleKeyDown,
4328
- placeholder,
4329
- disabled,
4330
- className: "max-h-[120px] resize-none border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0",
4331
- rows: 1
4332
- }
4333
- ) }),
4334
- enableAudioRecording && !isRecording && canAddMoreAttachments && !value.trim() && (voiceComposeEnabled ? /* @__PURE__ */ jsxs12(Tooltip, { children: [
4335
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
4645
+ /* @__PURE__ */ jsxs13("div", { className: "relative flex-1", children: [
4646
+ /* @__PURE__ */ jsx23(
4647
+ Textarea,
4648
+ {
4649
+ ref: textareaRef,
4650
+ value,
4651
+ onChange: (e) => {
4652
+ onChange(e.target.value);
4653
+ syncMentionState(e.target.value, e.target.selectionStart ?? e.target.value.length);
4654
+ },
4655
+ onSelect: (e) => {
4656
+ const target = e.target;
4657
+ syncMentionState(target.value, target.selectionStart ?? target.value.length);
4658
+ },
4659
+ onClick: (e) => {
4660
+ const target = e.target;
4661
+ syncMentionState(target.value, target.selectionStart ?? target.value.length);
4662
+ },
4663
+ onKeyDown: handleKeyDown,
4664
+ placeholder,
4665
+ disabled,
4666
+ className: "max-h-[120px] resize-none border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0",
4667
+ rows: 1
4668
+ }
4669
+ ),
4670
+ isMentionMenuOpen && /* @__PURE__ */ jsx23("div", { className: "absolute bottom-full left-0 right-0 mb-2 overflow-hidden rounded-md border bg-popover shadow-md", children: /* @__PURE__ */ jsx23("div", { className: "p-1", children: filteredMentionAgents.map((agent, index) => /* @__PURE__ */ jsxs13(
4671
+ "button",
4672
+ {
4673
+ type: "button",
4674
+ className: `flex w-full items-center gap-2 rounded-sm px-3 py-2 text-left text-sm ${index === activeMentionIndex ? "bg-accent text-accent-foreground" : "hover:bg-accent/60"}`,
4675
+ onMouseDown: (mouseEvent) => {
4676
+ mouseEvent.preventDefault();
4677
+ selectMentionAgent(agent);
4678
+ },
4679
+ children: [
4680
+ /* @__PURE__ */ jsx23("span", { className: "font-medium", children: agent.name }),
4681
+ agent.description && /* @__PURE__ */ jsx23("span", { className: "truncate text-xs text-muted-foreground", children: agent.description })
4682
+ ]
4683
+ },
4684
+ agent.id
4685
+ )) }) })
4686
+ ] }),
4687
+ enableAudioRecording && !isRecording && canAddMoreAttachments && !value.trim() && (voiceComposeEnabled ? /* @__PURE__ */ jsxs13(Tooltip, { children: [
4688
+ /* @__PURE__ */ jsx23(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx23(
4336
4689
  Button,
4337
4690
  {
4338
4691
  type: "button",
@@ -4343,11 +4696,11 @@ var ChatInput = memo2(function ChatInput2({
4343
4696
  void startVoiceCapture();
4344
4697
  },
4345
4698
  disabled: disabled || isGenerating,
4346
- children: /* @__PURE__ */ jsx22(Mic2, { className: "h-4 w-4" })
4699
+ children: /* @__PURE__ */ jsx23(Mic2, { className: "h-4 w-4" })
4347
4700
  }
4348
4701
  ) }),
4349
- /* @__PURE__ */ jsx22(TooltipContent, { children: config?.labels?.voiceEnter || config?.labels?.recordAudioTooltip })
4350
- ] }) : /* @__PURE__ */ jsx22(
4702
+ /* @__PURE__ */ jsx23(TooltipContent, { children: config?.labels?.voiceEnter || config?.labels?.recordAudioTooltip })
4703
+ ] }) : /* @__PURE__ */ jsx23(
4351
4704
  AudioRecorder,
4352
4705
  {
4353
4706
  isRecording,
@@ -4358,8 +4711,8 @@ var ChatInput = memo2(function ChatInput2({
4358
4711
  config
4359
4712
  }
4360
4713
  )),
4361
- isGenerating ? /* @__PURE__ */ jsxs12(Tooltip, { children: [
4362
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
4714
+ isGenerating ? /* @__PURE__ */ jsxs13(Tooltip, { children: [
4715
+ /* @__PURE__ */ jsx23(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx23(
4363
4716
  Button,
4364
4717
  {
4365
4718
  type: "button",
@@ -4367,36 +4720,36 @@ var ChatInput = memo2(function ChatInput2({
4367
4720
  size: "icon",
4368
4721
  className: "h-10 w-10",
4369
4722
  onClick: onStopGeneration,
4370
- children: /* @__PURE__ */ jsx22(Square2, { className: "h-4 w-4" })
4723
+ children: /* @__PURE__ */ jsx23(Square2, { className: "h-4 w-4" })
4371
4724
  }
4372
4725
  ) }),
4373
- /* @__PURE__ */ jsx22(TooltipContent, { children: config?.labels?.stopGenerationTooltip })
4374
- ] }) : /* @__PURE__ */ jsxs12(Tooltip, { children: [
4375
- /* @__PURE__ */ jsx22(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx22(
4726
+ /* @__PURE__ */ jsx23(TooltipContent, { children: config?.labels?.stopGenerationTooltip })
4727
+ ] }) : /* @__PURE__ */ jsxs13(Tooltip, { children: [
4728
+ /* @__PURE__ */ jsx23(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx23(
4376
4729
  Button,
4377
4730
  {
4378
4731
  type: "submit",
4379
4732
  size: "icon",
4380
4733
  className: "h-10 w-10",
4381
4734
  disabled: disabled || !value.trim() && attachments.length === 0,
4382
- children: disabled ? /* @__PURE__ */ jsx22(Loader22, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx22(Send2, { className: "h-4 w-4" })
4735
+ children: disabled ? /* @__PURE__ */ jsx23(Loader22, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx23(Send2, { className: "h-4 w-4" })
4383
4736
  }
4384
4737
  ) }),
4385
- /* @__PURE__ */ jsx22(TooltipContent, { children: config?.labels?.sendMessageTooltip })
4738
+ /* @__PURE__ */ jsx23(TooltipContent, { children: config?.labels?.sendMessageTooltip })
4386
4739
  ] })
4387
4740
  ]
4388
4741
  }
4389
4742
  ) }),
4390
- /* @__PURE__ */ jsxs12("div", { className: "text-[10px] text-muted-foreground text-center", children: [
4743
+ /* @__PURE__ */ jsxs13("div", { className: "text-[10px] text-muted-foreground text-center", children: [
4391
4744
  window.innerWidth > 768 ? config?.labels?.inputHelpText : "",
4392
- attachments.length > 0 && /* @__PURE__ */ jsxs12(Fragment4, { children: [
4745
+ attachments.length > 0 && /* @__PURE__ */ jsxs13(Fragment5, { children: [
4393
4746
  " \u2022 ",
4394
4747
  attachments.length,
4395
4748
  "/",
4396
4749
  maxAttachments,
4397
4750
  " anexos"
4398
4751
  ] }),
4399
- config?.labels?.footerLabel && /* @__PURE__ */ jsxs12(Fragment4, { children: [
4752
+ config?.labels?.footerLabel && /* @__PURE__ */ jsxs13(Fragment5, { children: [
4400
4753
  " \u2022 ",
4401
4754
  config.labels.footerLabel
4402
4755
  ] })
@@ -4408,18 +4761,18 @@ var ChatInput = memo2(function ChatInput2({
4408
4761
  import { useState as useState7 } from "react";
4409
4762
 
4410
4763
  // src/components/ui/scroll-area.tsx
4411
- import * as React11 from "react";
4764
+ import * as React12 from "react";
4412
4765
  import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
4413
- import { jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
4414
- var ScrollArea = React11.forwardRef(({ className, children, viewportClassName, onScroll, onScrollCapture, ...props }, ref) => {
4415
- return /* @__PURE__ */ jsxs13(
4766
+ import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
4767
+ var ScrollArea = React12.forwardRef(({ className, children, viewportClassName, onScroll, onScrollCapture, ...props }, ref) => {
4768
+ return /* @__PURE__ */ jsxs14(
4416
4769
  ScrollAreaPrimitive.Root,
4417
4770
  {
4418
4771
  "data-slot": "scroll-area",
4419
4772
  className: cn("relative", className),
4420
4773
  ...props,
4421
4774
  children: [
4422
- /* @__PURE__ */ jsx23(
4775
+ /* @__PURE__ */ jsx24(
4423
4776
  ScrollAreaPrimitive.Viewport,
4424
4777
  {
4425
4778
  ref,
@@ -4433,8 +4786,8 @@ var ScrollArea = React11.forwardRef(({ className, children, viewportClassName, o
4433
4786
  children
4434
4787
  }
4435
4788
  ),
4436
- /* @__PURE__ */ jsx23(ScrollBar, {}),
4437
- /* @__PURE__ */ jsx23(ScrollAreaPrimitive.Corner, {})
4789
+ /* @__PURE__ */ jsx24(ScrollBar, {}),
4790
+ /* @__PURE__ */ jsx24(ScrollAreaPrimitive.Corner, {})
4438
4791
  ]
4439
4792
  }
4440
4793
  );
@@ -4445,7 +4798,7 @@ function ScrollBar({
4445
4798
  orientation = "vertical",
4446
4799
  ...props
4447
4800
  }) {
4448
- return /* @__PURE__ */ jsx23(
4801
+ return /* @__PURE__ */ jsx24(
4449
4802
  ScrollAreaPrimitive.ScrollAreaScrollbar,
4450
4803
  {
4451
4804
  "data-slot": "scroll-area-scrollbar",
@@ -4457,7 +4810,7 @@ function ScrollBar({
4457
4810
  className
4458
4811
  ),
4459
4812
  ...props,
4460
- children: /* @__PURE__ */ jsx23(
4813
+ children: /* @__PURE__ */ jsx24(
4461
4814
  ScrollAreaPrimitive.ScrollAreaThumb,
4462
4815
  {
4463
4816
  "data-slot": "scroll-area-thumb",
@@ -4472,14 +4825,14 @@ function ScrollBar({
4472
4825
  import {
4473
4826
  User as User2,
4474
4827
  Mail,
4475
- AtSign,
4828
+ AtSign as AtSign2,
4476
4829
  Calendar,
4477
4830
  MapPin,
4478
4831
  Phone,
4479
4832
  Globe,
4480
4833
  Building,
4481
4834
  Briefcase,
4482
- Users,
4835
+ Users as Users2,
4483
4836
  UserPlus,
4484
4837
  Image as Image3,
4485
4838
  BadgeCheck,
@@ -4493,10 +4846,10 @@ import {
4493
4846
  Heart,
4494
4847
  Bot as Bot3,
4495
4848
  Pencil,
4496
- Check as Check3,
4497
- X as X4
4849
+ Check as Check4,
4850
+ X as X5
4498
4851
  } from "lucide-react";
4499
- import { Fragment as Fragment5, jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
4852
+ import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
4500
4853
  var getInitials2 = (name, email) => {
4501
4854
  if (name) {
4502
4855
  return name.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase();
@@ -4510,29 +4863,29 @@ var getFieldIcon = (type, key) => {
4510
4863
  const iconClass = "h-4 w-4 text-muted-foreground";
4511
4864
  switch (type) {
4512
4865
  case "email":
4513
- return /* @__PURE__ */ jsx24(Mail, { className: iconClass });
4866
+ return /* @__PURE__ */ jsx25(Mail, { className: iconClass });
4514
4867
  case "phone":
4515
- return /* @__PURE__ */ jsx24(Phone, { className: iconClass });
4868
+ return /* @__PURE__ */ jsx25(Phone, { className: iconClass });
4516
4869
  case "url":
4517
- return /* @__PURE__ */ jsx24(Globe, { className: iconClass });
4870
+ return /* @__PURE__ */ jsx25(Globe, { className: iconClass });
4518
4871
  case "date":
4519
- return /* @__PURE__ */ jsx24(Calendar, { className: iconClass });
4872
+ return /* @__PURE__ */ jsx25(Calendar, { className: iconClass });
4520
4873
  }
4521
4874
  const lowerKey = key?.toLowerCase() || "";
4522
- if (lowerKey.includes("follower")) return /* @__PURE__ */ jsx24(Users, { className: iconClass });
4523
- if (lowerKey.includes("following")) return /* @__PURE__ */ jsx24(UserPlus, { className: iconClass });
4524
- if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */ jsx24(Image3, { className: iconClass });
4525
- if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */ jsx24(BadgeCheck, { className: iconClass });
4526
- if (lowerKey.includes("bio")) return /* @__PURE__ */ jsx24(FileText2, { className: iconClass });
4527
- if (lowerKey.includes("email")) return /* @__PURE__ */ jsx24(Mail, { className: iconClass });
4528
- if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */ jsx24(Phone, { className: iconClass });
4529
- if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */ jsx24(MapPin, { className: iconClass });
4530
- if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */ jsx24(Building, { className: iconClass });
4531
- if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */ jsx24(Briefcase, { className: iconClass });
4532
- if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */ jsx24(Globe, { className: iconClass });
4533
- if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */ jsx24(AtSign, { className: iconClass });
4534
- if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */ jsx24(Calendar, { className: iconClass });
4535
- return /* @__PURE__ */ jsx24(User2, { className: iconClass });
4875
+ if (lowerKey.includes("follower")) return /* @__PURE__ */ jsx25(Users2, { className: iconClass });
4876
+ if (lowerKey.includes("following")) return /* @__PURE__ */ jsx25(UserPlus, { className: iconClass });
4877
+ if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */ jsx25(Image3, { className: iconClass });
4878
+ if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */ jsx25(BadgeCheck, { className: iconClass });
4879
+ if (lowerKey.includes("bio")) return /* @__PURE__ */ jsx25(FileText2, { className: iconClass });
4880
+ if (lowerKey.includes("email")) return /* @__PURE__ */ jsx25(Mail, { className: iconClass });
4881
+ if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */ jsx25(Phone, { className: iconClass });
4882
+ if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */ jsx25(MapPin, { className: iconClass });
4883
+ if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */ jsx25(Building, { className: iconClass });
4884
+ if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */ jsx25(Briefcase, { className: iconClass });
4885
+ if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */ jsx25(Globe, { className: iconClass });
4886
+ if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */ jsx25(AtSign2, { className: iconClass });
4887
+ if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */ jsx25(Calendar, { className: iconClass });
4888
+ return /* @__PURE__ */ jsx25(User2, { className: iconClass });
4536
4889
  };
4537
4890
  var formatValue = (value, type, key) => {
4538
4891
  if (value === null || value === void 0) return "-";
@@ -4566,15 +4919,15 @@ var getMemoryCategoryIcon = (category) => {
4566
4919
  const iconClass = "h-4 w-4 text-muted-foreground";
4567
4920
  switch (category) {
4568
4921
  case "preference":
4569
- return /* @__PURE__ */ jsx24(Heart, { className: iconClass });
4922
+ return /* @__PURE__ */ jsx25(Heart, { className: iconClass });
4570
4923
  case "fact":
4571
- return /* @__PURE__ */ jsx24(Info, { className: iconClass });
4924
+ return /* @__PURE__ */ jsx25(Info, { className: iconClass });
4572
4925
  case "goal":
4573
- return /* @__PURE__ */ jsx24(Target, { className: iconClass });
4926
+ return /* @__PURE__ */ jsx25(Target, { className: iconClass });
4574
4927
  case "context":
4575
- return /* @__PURE__ */ jsx24(Lightbulb, { className: iconClass });
4928
+ return /* @__PURE__ */ jsx25(Lightbulb, { className: iconClass });
4576
4929
  default:
4577
- return /* @__PURE__ */ jsx24(Brain2, { className: iconClass });
4930
+ return /* @__PURE__ */ jsx25(Brain2, { className: iconClass });
4578
4931
  }
4579
4932
  };
4580
4933
  var getMemoryCategoryLabel = (category) => {
@@ -4644,66 +4997,66 @@ var UserProfile = ({
4644
4997
  const displayName = user?.name || user?.email?.split("@")[0] || "User";
4645
4998
  const initials = getInitials2(user?.name, user?.email);
4646
4999
  const normalizedFields = normalizeCustomFields(customFields);
4647
- return /* @__PURE__ */ jsx24(Sheet, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs14(
5000
+ return /* @__PURE__ */ jsx25(Sheet, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs15(
4648
5001
  SheetContent,
4649
5002
  {
4650
5003
  side: "right",
4651
5004
  className: cn("w-full sm:max-w-md p-0 flex flex-col h-full overflow-hidden", className),
4652
5005
  children: [
4653
- /* @__PURE__ */ jsx24(SheetHeader, { className: "px-6 py-4 border-b shrink-0", children: /* @__PURE__ */ jsx24("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx24(SheetTitle, { children: labels.title }) }) }),
4654
- /* @__PURE__ */ jsx24(ScrollArea, { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxs14("div", { className: "p-6 space-y-6", children: [
4655
- /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center text-center space-y-4", children: [
4656
- /* @__PURE__ */ jsxs14(Avatar, { className: "h-24 w-24 shrink-0", children: [
4657
- user?.avatar && /* @__PURE__ */ jsx24(AvatarImage, { src: user.avatar, alt: displayName }),
4658
- /* @__PURE__ */ jsx24(AvatarFallback, { className: "text-2xl bg-primary/10 text-primary", children: initials })
5006
+ /* @__PURE__ */ jsx25(SheetHeader, { className: "px-6 py-4 border-b shrink-0", children: /* @__PURE__ */ jsx25("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx25(SheetTitle, { children: labels.title }) }) }),
5007
+ /* @__PURE__ */ jsx25(ScrollArea, { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxs15("div", { className: "p-6 space-y-6", children: [
5008
+ /* @__PURE__ */ jsxs15("div", { className: "flex flex-col items-center text-center space-y-4", children: [
5009
+ /* @__PURE__ */ jsxs15(Avatar, { className: "h-24 w-24 shrink-0", children: [
5010
+ user?.avatar && /* @__PURE__ */ jsx25(AvatarImage, { src: user.avatar, alt: displayName }),
5011
+ /* @__PURE__ */ jsx25(AvatarFallback, { className: "text-2xl bg-primary/10 text-primary", children: initials })
4659
5012
  ] }),
4660
- /* @__PURE__ */ jsxs14("div", { className: "w-full px-2", children: [
4661
- /* @__PURE__ */ jsx24("h2", { className: "text-xl font-semibold break-words", children: displayName }),
4662
- user?.email && /* @__PURE__ */ jsx24("p", { className: "text-sm text-muted-foreground break-words", children: user.email })
5013
+ /* @__PURE__ */ jsxs15("div", { className: "w-full px-2", children: [
5014
+ /* @__PURE__ */ jsx25("h2", { className: "text-xl font-semibold break-words", children: displayName }),
5015
+ user?.email && /* @__PURE__ */ jsx25("p", { className: "text-sm text-muted-foreground break-words", children: user.email })
4663
5016
  ] })
4664
5017
  ] }),
4665
- /* @__PURE__ */ jsx24(Separator, {}),
4666
- /* @__PURE__ */ jsxs14("div", { className: "space-y-3", children: [
4667
- /* @__PURE__ */ jsx24("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.basicInfo }),
4668
- /* @__PURE__ */ jsxs14("div", { className: "space-y-2", children: [
4669
- /* @__PURE__ */ jsxs14("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
4670
- /* @__PURE__ */ jsx24(User2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
4671
- /* @__PURE__ */ jsxs14("div", { className: "flex-1 min-w-0", children: [
4672
- /* @__PURE__ */ jsx24("p", { className: "text-xs text-muted-foreground", children: "Name" }),
4673
- /* @__PURE__ */ jsx24("p", { className: "text-sm font-medium break-words", children: displayName })
5018
+ /* @__PURE__ */ jsx25(Separator, {}),
5019
+ /* @__PURE__ */ jsxs15("div", { className: "space-y-3", children: [
5020
+ /* @__PURE__ */ jsx25("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.basicInfo }),
5021
+ /* @__PURE__ */ jsxs15("div", { className: "space-y-2", children: [
5022
+ /* @__PURE__ */ jsxs15("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
5023
+ /* @__PURE__ */ jsx25(User2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
5024
+ /* @__PURE__ */ jsxs15("div", { className: "flex-1 min-w-0", children: [
5025
+ /* @__PURE__ */ jsx25("p", { className: "text-xs text-muted-foreground", children: "Name" }),
5026
+ /* @__PURE__ */ jsx25("p", { className: "text-sm font-medium break-words", children: displayName })
4674
5027
  ] })
4675
5028
  ] }),
4676
- user?.email && /* @__PURE__ */ jsxs14("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
4677
- /* @__PURE__ */ jsx24(AtSign, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
4678
- /* @__PURE__ */ jsxs14("div", { className: "flex-1 min-w-0", children: [
4679
- /* @__PURE__ */ jsx24("p", { className: "text-xs text-muted-foreground", children: "Handle" }),
4680
- /* @__PURE__ */ jsx24("p", { className: "text-sm font-medium break-words", children: user.email })
5029
+ user?.email && /* @__PURE__ */ jsxs15("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
5030
+ /* @__PURE__ */ jsx25(AtSign2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
5031
+ /* @__PURE__ */ jsxs15("div", { className: "flex-1 min-w-0", children: [
5032
+ /* @__PURE__ */ jsx25("p", { className: "text-xs text-muted-foreground", children: "Handle" }),
5033
+ /* @__PURE__ */ jsx25("p", { className: "text-sm font-medium break-words", children: user.email })
4681
5034
  ] })
4682
5035
  ] }),
4683
- user?.id && user.id !== user?.name && user.id !== user?.email && /* @__PURE__ */ jsxs14("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
4684
- /* @__PURE__ */ jsx24(User2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
4685
- /* @__PURE__ */ jsxs14("div", { className: "flex-1 min-w-0", children: [
4686
- /* @__PURE__ */ jsx24("p", { className: "text-xs text-muted-foreground", children: "ID" }),
4687
- /* @__PURE__ */ jsx24("p", { className: "text-sm font-medium break-words", children: user.id })
5036
+ user?.id && user.id !== user?.name && user.id !== user?.email && /* @__PURE__ */ jsxs15("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
5037
+ /* @__PURE__ */ jsx25(User2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
5038
+ /* @__PURE__ */ jsxs15("div", { className: "flex-1 min-w-0", children: [
5039
+ /* @__PURE__ */ jsx25("p", { className: "text-xs text-muted-foreground", children: "ID" }),
5040
+ /* @__PURE__ */ jsx25("p", { className: "text-sm font-medium break-words", children: user.id })
4688
5041
  ] })
4689
5042
  ] })
4690
5043
  ] })
4691
5044
  ] }),
4692
- normalizedFields.length > 0 && /* @__PURE__ */ jsxs14(Fragment5, { children: [
4693
- /* @__PURE__ */ jsx24(Separator, {}),
4694
- /* @__PURE__ */ jsxs14("div", { className: "space-y-3", children: [
4695
- /* @__PURE__ */ jsx24("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.customFields }),
4696
- /* @__PURE__ */ jsx24("div", { className: "space-y-2", children: normalizedFields.map((field) => {
5045
+ normalizedFields.length > 0 && /* @__PURE__ */ jsxs15(Fragment6, { children: [
5046
+ /* @__PURE__ */ jsx25(Separator, {}),
5047
+ /* @__PURE__ */ jsxs15("div", { className: "space-y-3", children: [
5048
+ /* @__PURE__ */ jsx25("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.customFields }),
5049
+ /* @__PURE__ */ jsx25("div", { className: "space-y-2", children: normalizedFields.map((field) => {
4697
5050
  const isBioField = field.key.toLowerCase().includes("bio");
4698
- return /* @__PURE__ */ jsxs14(
5051
+ return /* @__PURE__ */ jsxs15(
4699
5052
  "div",
4700
5053
  {
4701
5054
  className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50",
4702
5055
  children: [
4703
- /* @__PURE__ */ jsx24("div", { className: "mt-0.5 shrink-0", children: field.icon || getFieldIcon(field.type, field.key) }),
4704
- /* @__PURE__ */ jsxs14("div", { className: "flex-1 min-w-0", children: [
4705
- /* @__PURE__ */ jsx24("p", { className: "text-xs text-muted-foreground", children: field.label }),
4706
- /* @__PURE__ */ jsx24("p", { className: cn(
5056
+ /* @__PURE__ */ jsx25("div", { className: "mt-0.5 shrink-0", children: field.icon || getFieldIcon(field.type, field.key) }),
5057
+ /* @__PURE__ */ jsxs15("div", { className: "flex-1 min-w-0", children: [
5058
+ /* @__PURE__ */ jsx25("p", { className: "text-xs text-muted-foreground", children: field.label }),
5059
+ /* @__PURE__ */ jsx25("p", { className: cn(
4707
5060
  "text-sm font-medium",
4708
5061
  isBioField ? "whitespace-pre-wrap break-words" : "break-words"
4709
5062
  ), children: formatValue(field.value, field.type, field.key) })
@@ -4715,26 +5068,26 @@ var UserProfile = ({
4715
5068
  }) })
4716
5069
  ] })
4717
5070
  ] }),
4718
- /* @__PURE__ */ jsx24(Separator, {}),
4719
- /* @__PURE__ */ jsxs14("div", { className: "space-y-3", children: [
4720
- /* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between", children: [
4721
- /* @__PURE__ */ jsxs14("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider flex items-center gap-2", children: [
4722
- /* @__PURE__ */ jsx24(Brain2, { className: "h-4 w-4" }),
5071
+ /* @__PURE__ */ jsx25(Separator, {}),
5072
+ /* @__PURE__ */ jsxs15("div", { className: "space-y-3", children: [
5073
+ /* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between", children: [
5074
+ /* @__PURE__ */ jsxs15("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider flex items-center gap-2", children: [
5075
+ /* @__PURE__ */ jsx25(Brain2, { className: "h-4 w-4" }),
4723
5076
  labels.memories
4724
5077
  ] }),
4725
- onAddMemory && /* @__PURE__ */ jsx24(
5078
+ onAddMemory && /* @__PURE__ */ jsx25(
4726
5079
  Button,
4727
5080
  {
4728
5081
  variant: "ghost",
4729
5082
  size: "sm",
4730
5083
  className: "h-7 px-2",
4731
5084
  onClick: () => setIsAddingMemory(true),
4732
- children: /* @__PURE__ */ jsx24(Plus3, { className: "h-4 w-4" })
5085
+ children: /* @__PURE__ */ jsx25(Plus3, { className: "h-4 w-4" })
4733
5086
  }
4734
5087
  )
4735
5088
  ] }),
4736
- isAddingMemory && onAddMemory && /* @__PURE__ */ jsxs14("div", { className: "flex gap-2", children: [
4737
- /* @__PURE__ */ jsx24(
5089
+ isAddingMemory && onAddMemory && /* @__PURE__ */ jsxs15("div", { className: "flex gap-2", children: [
5090
+ /* @__PURE__ */ jsx25(
4738
5091
  Input,
4739
5092
  {
4740
5093
  value: newMemoryContent,
@@ -4751,24 +5104,24 @@ var UserProfile = ({
4751
5104
  autoFocus: true
4752
5105
  }
4753
5106
  ),
4754
- /* @__PURE__ */ jsx24(Button, { size: "sm", onClick: handleAddMemory, disabled: !newMemoryContent.trim(), children: "Salvar" })
5107
+ /* @__PURE__ */ jsx25(Button, { size: "sm", onClick: handleAddMemory, disabled: !newMemoryContent.trim(), children: "Salvar" })
4755
5108
  ] }),
4756
- /* @__PURE__ */ jsx24("div", { className: "space-y-2", children: memories.length === 0 ? /* @__PURE__ */ jsx24("p", { className: "text-sm text-muted-foreground text-center py-4", children: labels.noMemories }) : memories.map((memory) => {
5109
+ /* @__PURE__ */ jsx25("div", { className: "space-y-2", children: memories.length === 0 ? /* @__PURE__ */ jsx25("p", { className: "text-sm text-muted-foreground text-center py-4", children: labels.noMemories }) : memories.map((memory) => {
4757
5110
  const isEditing = editingMemoryId === memory.id;
4758
- return /* @__PURE__ */ jsxs14(
5111
+ return /* @__PURE__ */ jsxs15(
4759
5112
  "div",
4760
5113
  {
4761
5114
  className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50 group",
4762
5115
  children: [
4763
- /* @__PURE__ */ jsx24("div", { className: "mt-0.5 shrink-0", children: memory.source === "agent" ? /* @__PURE__ */ jsx24(Bot3, { className: "h-4 w-4 text-primary" }) : getMemoryCategoryIcon(memory.category) }),
4764
- /* @__PURE__ */ jsxs14("div", { className: "flex-1 min-w-0", children: [
4765
- /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 mb-0.5", children: [
4766
- /* @__PURE__ */ jsx24("span", { className: "text-xs text-muted-foreground", children: getMemoryCategoryLabel(memory.category) }),
4767
- /* @__PURE__ */ jsx24("span", { className: "text-xs text-muted-foreground", children: "\u2022" }),
4768
- /* @__PURE__ */ jsx24("span", { className: "text-xs text-muted-foreground", children: memory.source === "agent" ? "IA" : "Voc\xEA" })
5116
+ /* @__PURE__ */ jsx25("div", { className: "mt-0.5 shrink-0", children: memory.source === "agent" ? /* @__PURE__ */ jsx25(Bot3, { className: "h-4 w-4 text-primary" }) : getMemoryCategoryIcon(memory.category) }),
5117
+ /* @__PURE__ */ jsxs15("div", { className: "flex-1 min-w-0", children: [
5118
+ /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2 mb-0.5", children: [
5119
+ /* @__PURE__ */ jsx25("span", { className: "text-xs text-muted-foreground", children: getMemoryCategoryLabel(memory.category) }),
5120
+ /* @__PURE__ */ jsx25("span", { className: "text-xs text-muted-foreground", children: "\u2022" }),
5121
+ /* @__PURE__ */ jsx25("span", { className: "text-xs text-muted-foreground", children: memory.source === "agent" ? "IA" : "Voc\xEA" })
4769
5122
  ] }),
4770
- isEditing ? /* @__PURE__ */ jsxs14("div", { className: "space-y-2", children: [
4771
- /* @__PURE__ */ jsx24(
5123
+ isEditing ? /* @__PURE__ */ jsxs15("div", { className: "space-y-2", children: [
5124
+ /* @__PURE__ */ jsx25(
4772
5125
  Textarea,
4773
5126
  {
4774
5127
  value: editingMemoryContent,
@@ -4785,8 +5138,8 @@ var UserProfile = ({
4785
5138
  }
4786
5139
  }
4787
5140
  ),
4788
- /* @__PURE__ */ jsxs14("div", { className: "flex gap-1 justify-end", children: [
4789
- /* @__PURE__ */ jsxs14(
5141
+ /* @__PURE__ */ jsxs15("div", { className: "flex gap-1 justify-end", children: [
5142
+ /* @__PURE__ */ jsxs15(
4790
5143
  Button,
4791
5144
  {
4792
5145
  variant: "ghost",
@@ -4794,12 +5147,12 @@ var UserProfile = ({
4794
5147
  className: "h-7 px-2",
4795
5148
  onClick: handleCancelEdit,
4796
5149
  children: [
4797
- /* @__PURE__ */ jsx24(X4, { className: "h-3.5 w-3.5 mr-1" }),
5150
+ /* @__PURE__ */ jsx25(X5, { className: "h-3.5 w-3.5 mr-1" }),
4798
5151
  "Cancelar"
4799
5152
  ]
4800
5153
  }
4801
5154
  ),
4802
- /* @__PURE__ */ jsxs14(
5155
+ /* @__PURE__ */ jsxs15(
4803
5156
  Button,
4804
5157
  {
4805
5158
  size: "sm",
@@ -4807,33 +5160,33 @@ var UserProfile = ({
4807
5160
  onClick: handleSaveEdit,
4808
5161
  disabled: !editingMemoryContent.trim(),
4809
5162
  children: [
4810
- /* @__PURE__ */ jsx24(Check3, { className: "h-3.5 w-3.5 mr-1" }),
5163
+ /* @__PURE__ */ jsx25(Check4, { className: "h-3.5 w-3.5 mr-1" }),
4811
5164
  "Salvar"
4812
5165
  ]
4813
5166
  }
4814
5167
  )
4815
5168
  ] })
4816
- ] }) : /* @__PURE__ */ jsx24("p", { className: "text-sm break-words", children: memory.content })
5169
+ ] }) : /* @__PURE__ */ jsx25("p", { className: "text-sm break-words", children: memory.content })
4817
5170
  ] }),
4818
- !isEditing && (onUpdateMemory || onDeleteMemory) && /* @__PURE__ */ jsxs14("div", { className: "flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0", children: [
4819
- onUpdateMemory && /* @__PURE__ */ jsx24(
5171
+ !isEditing && (onUpdateMemory || onDeleteMemory) && /* @__PURE__ */ jsxs15("div", { className: "flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0", children: [
5172
+ onUpdateMemory && /* @__PURE__ */ jsx25(
4820
5173
  Button,
4821
5174
  {
4822
5175
  variant: "ghost",
4823
5176
  size: "icon",
4824
5177
  className: "h-7 w-7",
4825
5178
  onClick: () => handleStartEdit(memory),
4826
- children: /* @__PURE__ */ jsx24(Pencil, { className: "h-3.5 w-3.5 text-muted-foreground" })
5179
+ children: /* @__PURE__ */ jsx25(Pencil, { className: "h-3.5 w-3.5 text-muted-foreground" })
4827
5180
  }
4828
5181
  ),
4829
- onDeleteMemory && /* @__PURE__ */ jsx24(
5182
+ onDeleteMemory && /* @__PURE__ */ jsx25(
4830
5183
  Button,
4831
5184
  {
4832
5185
  variant: "ghost",
4833
5186
  size: "icon",
4834
5187
  className: "h-7 w-7",
4835
5188
  onClick: () => onDeleteMemory(memory.id),
4836
- children: /* @__PURE__ */ jsx24(Trash24, { className: "h-3.5 w-3.5 text-destructive" })
5189
+ children: /* @__PURE__ */ jsx25(Trash24, { className: "h-3.5 w-3.5 text-destructive" })
4837
5190
  }
4838
5191
  )
4839
5192
  ] })
@@ -4844,8 +5197,8 @@ var UserProfile = ({
4844
5197
  }) })
4845
5198
  ] })
4846
5199
  ] }) }),
4847
- /* @__PURE__ */ jsxs14("div", { className: "p-4 border-t space-y-2 shrink-0", children: [
4848
- onEditProfile && /* @__PURE__ */ jsx24(
5200
+ /* @__PURE__ */ jsxs15("div", { className: "p-4 border-t space-y-2 shrink-0", children: [
5201
+ onEditProfile && /* @__PURE__ */ jsx25(
4849
5202
  Button,
4850
5203
  {
4851
5204
  variant: "outline",
@@ -4854,7 +5207,7 @@ var UserProfile = ({
4854
5207
  children: "Edit Profile"
4855
5208
  }
4856
5209
  ),
4857
- onLogout && /* @__PURE__ */ jsx24(
5210
+ onLogout && /* @__PURE__ */ jsx25(
4858
5211
  Button,
4859
5212
  {
4860
5213
  variant: "destructive",
@@ -4871,7 +5224,7 @@ var UserProfile = ({
4871
5224
 
4872
5225
  // src/components/chat/ChatUI.tsx
4873
5226
  import { Sparkles, ArrowRight, MessageSquare, Lightbulb as Lightbulb2, Zap, HelpCircle } from "lucide-react";
4874
- import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
5227
+ import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
4875
5228
  var ChatUI = ({
4876
5229
  messages = [],
4877
5230
  threads = [],
@@ -4888,6 +5241,10 @@ var ChatUI = ({
4888
5241
  agentOptions = [],
4889
5242
  selectedAgentId = null,
4890
5243
  onSelectAgent,
5244
+ participantIds,
5245
+ onParticipantsChange,
5246
+ targetAgentId = null,
5247
+ onTargetAgentChange,
4891
5248
  className = "",
4892
5249
  onAddMemory,
4893
5250
  onUpdateMemory,
@@ -4895,7 +5252,7 @@ var ChatUI = ({
4895
5252
  initialInput,
4896
5253
  onInitialInputConsumed
4897
5254
  }) => {
4898
- const config = useMemo4(
5255
+ const config = useMemo5(
4899
5256
  () => mergeConfig(defaultChatConfig, userConfig),
4900
5257
  [userConfig]
4901
5258
  );
@@ -5110,7 +5467,7 @@ var ChatUI = ({
5110
5467
  const handleCustomComponentToggle = useCallback4(() => {
5111
5468
  setState((prev) => ({ ...prev, showSidebar: !prev.showSidebar }));
5112
5469
  }, []);
5113
- const sidebarUser = useMemo4(() => user ? {
5470
+ const sidebarUser = useMemo5(() => user ? {
5114
5471
  id: user.id,
5115
5472
  name: user.name,
5116
5473
  email: user.email,
@@ -5120,7 +5477,7 @@ var ChatUI = ({
5120
5477
  setIsUserProfileOpen(true);
5121
5478
  callbacks.onViewProfile?.();
5122
5479
  }, [callbacks.onViewProfile]);
5123
- const sidebarUserMenuCallbacks = useMemo4(() => ({
5480
+ const sidebarUserMenuCallbacks = useMemo5(() => ({
5124
5481
  onViewProfile: handleViewProfile,
5125
5482
  onOpenSettings: callbacks.onOpenSettings,
5126
5483
  onThemeChange: callbacks.onThemeChange,
@@ -5137,13 +5494,13 @@ var ChatUI = ({
5137
5494
  const SuggestionIconComponents = [MessageSquare, Lightbulb2, Zap, HelpCircle];
5138
5495
  const renderSuggestions = () => {
5139
5496
  if (messages.length > 0 || !suggestions.length) return null;
5140
- return /* @__PURE__ */ jsxs15("div", { className: "flex flex-col items-center justify-center min-h-[60vh] py-8 px-4", children: [
5141
- /* @__PURE__ */ jsxs15("div", { className: "text-center mb-8", children: [
5142
- /* @__PURE__ */ jsx25("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__ */ jsx25(Sparkles, { className: "w-7 h-7 text-primary" }) }),
5143
- /* @__PURE__ */ jsx25("h2", { className: "text-xl font-semibold mb-2", children: config.branding.title }),
5144
- /* @__PURE__ */ jsx25("p", { className: "text-muted-foreground text-sm max-w-md", children: config.branding.subtitle })
5497
+ return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col items-center justify-center min-h-[60vh] py-8 px-4", children: [
5498
+ /* @__PURE__ */ jsxs16("div", { className: "text-center mb-8", children: [
5499
+ /* @__PURE__ */ jsx26("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__ */ jsx26(Sparkles, { className: "w-7 h-7 text-primary" }) }),
5500
+ /* @__PURE__ */ jsx26("h2", { className: "text-xl font-semibold mb-2", children: config.branding.title }),
5501
+ /* @__PURE__ */ jsx26("p", { className: "text-muted-foreground text-sm max-w-md", children: config.branding.subtitle })
5145
5502
  ] }),
5146
- /* @__PURE__ */ jsx25("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 w-full max-w-2xl", children: suggestions.map((suggestion, index) => /* @__PURE__ */ jsxs15(
5503
+ /* @__PURE__ */ jsx26("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 w-full max-w-2xl", children: suggestions.map((suggestion, index) => /* @__PURE__ */ jsxs16(
5147
5504
  "button",
5148
5505
  {
5149
5506
  type: "button",
@@ -5152,10 +5509,10 @@ var ChatUI = ({
5152
5509
  children: [
5153
5510
  (() => {
5154
5511
  const IconComponent = SuggestionIconComponents[index % SuggestionIconComponents.length];
5155
- return /* @__PURE__ */ jsx25("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__ */ jsx25(IconComponent, { className: "h-4 w-4" }) });
5512
+ return /* @__PURE__ */ jsx26("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__ */ jsx26(IconComponent, { className: "h-4 w-4" }) });
5156
5513
  })(),
5157
- /* @__PURE__ */ jsx25("div", { className: "flex-1 min-w-0 pr-6", children: /* @__PURE__ */ jsx25("p", { className: "text-sm font-medium leading-snug line-clamp-2", children: suggestion }) }),
5158
- /* @__PURE__ */ jsx25(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" })
5514
+ /* @__PURE__ */ jsx26("div", { className: "flex-1 min-w-0 pr-6", children: /* @__PURE__ */ jsx26("p", { className: "text-sm font-medium leading-snug line-clamp-2", children: suggestion }) }),
5515
+ /* @__PURE__ */ jsx26(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" })
5159
5516
  ]
5160
5517
  },
5161
5518
  index
@@ -5166,40 +5523,41 @@ var ChatUI = ({
5166
5523
  const items = messageSuggestions?.[messageId];
5167
5524
  if (!items || items.length === 0) return null;
5168
5525
  const inlineSuggestionOffsetClass = config.ui.showAvatars ? config.ui.compactMode ? "ml-9" : "ml-11" : "";
5169
- return /* @__PURE__ */ jsx25("div", { className: `flex flex-wrap gap-2 mt-2 ${inlineSuggestionOffsetClass}`, children: items.map((suggestion, index) => /* @__PURE__ */ jsxs15(
5526
+ return /* @__PURE__ */ jsx26("div", { className: `flex flex-wrap gap-2 mt-2 ${inlineSuggestionOffsetClass}`, children: items.map((suggestion, index) => /* @__PURE__ */ jsxs16(
5170
5527
  "button",
5171
5528
  {
5172
5529
  type: "button",
5173
5530
  onClick: () => handleSendMessage(suggestion),
5174
5531
  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",
5175
5532
  children: [
5176
- /* @__PURE__ */ jsx25(Sparkles, { className: "h-3 w-3 text-primary opacity-70 group-hover:opacity-100" }),
5177
- /* @__PURE__ */ jsx25("span", { className: "max-w-[200px] truncate", children: suggestion })
5533
+ /* @__PURE__ */ jsx26(Sparkles, { className: "h-3 w-3 text-primary opacity-70 group-hover:opacity-100" }),
5534
+ /* @__PURE__ */ jsx26("span", { className: "max-w-[200px] truncate", children: suggestion })
5178
5535
  ]
5179
5536
  },
5180
5537
  `${messageId}-suggestion-${index}`
5181
5538
  )) });
5182
5539
  };
5183
- const renderMessageLoadingSkeleton = () => /* @__PURE__ */ jsx25("div", { className: "space-y-6 py-2", children: [0, 1, 2, 3].map((index) => {
5540
+ const renderMessageLoadingSkeleton = () => /* @__PURE__ */ jsx26("div", { className: "space-y-6 py-2", children: [0, 1, 2, 3].map((index) => {
5184
5541
  const isUserRow = index % 2 === 1;
5185
- return /* @__PURE__ */ jsxs15(
5542
+ return /* @__PURE__ */ jsxs16(
5186
5543
  "div",
5187
5544
  {
5188
5545
  className: `flex gap-3 ${isUserRow ? "justify-end" : "justify-start"}`,
5189
5546
  children: [
5190
- !isUserRow && /* @__PURE__ */ jsx25(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" }),
5191
- /* @__PURE__ */ jsxs15("div", { className: `space-y-2 ${isUserRow ? "w-[70%]" : "w-[75%]"}`, children: [
5192
- /* @__PURE__ */ jsx25(Skeleton, { className: "h-4 w-24" }),
5193
- /* @__PURE__ */ jsx25(Skeleton, { className: "h-4 w-full" }),
5194
- /* @__PURE__ */ jsx25(Skeleton, { className: "h-4 w-[85%]" })
5547
+ !isUserRow && /* @__PURE__ */ jsx26(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" }),
5548
+ /* @__PURE__ */ jsxs16("div", { className: `space-y-2 ${isUserRow ? "w-[70%]" : "w-[75%]"}`, children: [
5549
+ /* @__PURE__ */ jsx26(Skeleton, { className: "h-4 w-24" }),
5550
+ /* @__PURE__ */ jsx26(Skeleton, { className: "h-4 w-full" }),
5551
+ /* @__PURE__ */ jsx26(Skeleton, { className: "h-4 w-[85%]" })
5195
5552
  ] }),
5196
- isUserRow && /* @__PURE__ */ jsx25(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" })
5553
+ isUserRow && /* @__PURE__ */ jsx26(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" })
5197
5554
  ]
5198
5555
  },
5199
5556
  `message-skeleton-${index}`
5200
5557
  );
5201
5558
  }) });
5202
- const messageProps = useMemo4(() => ({
5559
+ const isMultiAgentMode = config.agentSelector?.mode === "multi";
5560
+ const messageProps = useMemo5(() => ({
5203
5561
  userAvatar: user?.avatar,
5204
5562
  userName: user?.name,
5205
5563
  assistantAvatar: assistant?.avatar,
@@ -5222,12 +5580,15 @@ var ChatUI = ({
5222
5580
  longMessageChunkChars: config.ui.longMessageChunkChars,
5223
5581
  renderUserMarkdown: config.ui.renderUserMarkdown,
5224
5582
  markdown: config.markdown,
5225
- onToggleExpanded: handleToggleMessageExpansion
5583
+ onToggleExpanded: handleToggleMessageExpansion,
5584
+ agentOptions: isMultiAgentMode ? agentOptions : void 0
5226
5585
  }), [
5227
5586
  user?.avatar,
5228
5587
  user?.name,
5229
5588
  assistant?.avatar,
5230
5589
  assistant?.name,
5590
+ isMultiAgentMode,
5591
+ agentOptions,
5231
5592
  config.ui.showTimestamps,
5232
5593
  config.ui.showAvatars,
5233
5594
  config.ui.compactMode,
@@ -5249,10 +5610,10 @@ var ChatUI = ({
5249
5610
  handleToggleMessageExpansion
5250
5611
  ]);
5251
5612
  const shouldShowAgentSelector = Boolean(
5252
- config.agentSelector?.enabled && onSelectAgent && agentOptions.length > 0 && (!config.agentSelector?.hideIfSingle || agentOptions.length > 1)
5613
+ config.agentSelector?.enabled && agentOptions.length > 0 && (!config.agentSelector?.hideIfSingle || agentOptions.length > 1) && (isMultiAgentMode ? onParticipantsChange : onSelectAgent)
5253
5614
  );
5254
- return /* @__PURE__ */ jsx25(TooltipProvider, { children: /* @__PURE__ */ jsx25(SidebarProvider, { defaultOpen: true, children: /* @__PURE__ */ jsxs15("div", { className: `flex h-[100svh] md:h-screen bg-background w-full overflow-hidden ${className}`, children: [
5255
- /* @__PURE__ */ jsx25(
5615
+ return /* @__PURE__ */ jsx26(TooltipProvider, { children: /* @__PURE__ */ jsx26(SidebarProvider, { defaultOpen: true, children: /* @__PURE__ */ jsxs16("div", { className: `flex h-[100svh] md:h-screen bg-background w-full overflow-hidden ${className}`, children: [
5616
+ /* @__PURE__ */ jsx26(
5256
5617
  Sidebar2,
5257
5618
  {
5258
5619
  threads,
@@ -5269,8 +5630,8 @@ var ChatUI = ({
5269
5630
  showThemeOptions: !!callbacks.onThemeChange
5270
5631
  }
5271
5632
  ),
5272
- /* @__PURE__ */ jsx25(SidebarInset, { children: /* @__PURE__ */ jsxs15("div", { className: "flex flex-col h-full min-h-0", children: [
5273
- /* @__PURE__ */ jsx25(
5633
+ /* @__PURE__ */ jsx26(SidebarInset, { children: /* @__PURE__ */ jsxs16("div", { className: "flex flex-col h-full min-h-0", children: [
5634
+ /* @__PURE__ */ jsx26(
5274
5635
  ChatHeader,
5275
5636
  {
5276
5637
  config,
@@ -5280,14 +5641,17 @@ var ChatUI = ({
5280
5641
  onNewThread: handleCreateThread,
5281
5642
  showCustomComponentButton: !!config?.customComponent?.component,
5282
5643
  showAgentSelector: shouldShowAgentSelector,
5644
+ isMultiAgentMode,
5283
5645
  agentOptions,
5284
5646
  selectedAgentId,
5285
- onSelectAgent
5647
+ onSelectAgent,
5648
+ participantIds,
5649
+ onParticipantsChange
5286
5650
  }
5287
5651
  ),
5288
- /* @__PURE__ */ jsxs15("div", { className: "flex flex-1 flex-row min-h-0 overflow-hidden", children: [
5289
- /* @__PURE__ */ jsxs15("div", { className: "flex-1 flex flex-col min-h-0", children: [
5290
- /* @__PURE__ */ jsx25(
5652
+ /* @__PURE__ */ jsxs16("div", { className: "flex flex-1 flex-row min-h-0 overflow-hidden", children: [
5653
+ /* @__PURE__ */ jsxs16("div", { className: "flex-1 flex flex-col min-h-0", children: [
5654
+ /* @__PURE__ */ jsx26(
5291
5655
  ScrollArea,
5292
5656
  {
5293
5657
  ref: scrollAreaRef,
@@ -5295,7 +5659,7 @@ var ChatUI = ({
5295
5659
  viewportClassName: "p-4 overscroll-contain",
5296
5660
  onScrollCapture: handleScroll,
5297
5661
  style: { contain: "strict" },
5298
- children: /* @__PURE__ */ jsx25("div", { className: "max-w-4xl mx-auto pb-4", children: isMessagesLoading ? renderMessageLoadingSkeleton() : messages.length === 0 ? renderSuggestions() : /* @__PURE__ */ jsx25(
5662
+ children: /* @__PURE__ */ jsx26("div", { className: "max-w-4xl mx-auto pb-4", children: isMessagesLoading ? renderMessageLoadingSkeleton() : messages.length === 0 ? renderSuggestions() : /* @__PURE__ */ jsx26(
5299
5663
  "div",
5300
5664
  {
5301
5665
  style: {
@@ -5307,7 +5671,7 @@ var ChatUI = ({
5307
5671
  const message = messages[virtualRow.index];
5308
5672
  const prevMessage = virtualRow.index > 0 ? messages[virtualRow.index - 1] : null;
5309
5673
  const isGrouped = prevMessage !== null && prevMessage.role === message.role;
5310
- return /* @__PURE__ */ jsx25(
5674
+ return /* @__PURE__ */ jsx26(
5311
5675
  "div",
5312
5676
  {
5313
5677
  "data-index": virtualRow.index,
@@ -5319,8 +5683,8 @@ var ChatUI = ({
5319
5683
  width: "100%",
5320
5684
  transform: `translateY(${virtualRow.start}px)`
5321
5685
  },
5322
- children: /* @__PURE__ */ jsxs15("div", { className: virtualRow.index === 0 ? "" : isGrouped ? "pt-2" : "pt-4", children: [
5323
- /* @__PURE__ */ jsx25(
5686
+ children: /* @__PURE__ */ jsxs16("div", { className: virtualRow.index === 0 ? "" : isGrouped ? "pt-2" : "pt-4", children: [
5687
+ /* @__PURE__ */ jsx26(
5324
5688
  Message,
5325
5689
  {
5326
5690
  message,
@@ -5339,38 +5703,52 @@ var ChatUI = ({
5339
5703
  ) })
5340
5704
  }
5341
5705
  ),
5342
- /* @__PURE__ */ jsx25("div", { className: "bg-background pb-[env(safe-area-inset-bottom)]", children: /* @__PURE__ */ jsx25(
5343
- ChatInput,
5344
- {
5345
- value: inputValue,
5346
- onChange: (value) => {
5347
- setInputValue(value);
5348
- if (initialInputApplied.current && !initialInputConsumedRef.current) {
5349
- initialInputConsumedRef.current = true;
5350
- onInitialInputConsumed?.();
5351
- }
5352
- },
5353
- onSubmit: handleSendMessage,
5354
- attachments,
5355
- onAttachmentsChange: setAttachments,
5356
- placeholder: config.labels.inputPlaceholder,
5357
- disabled: false,
5358
- isGenerating,
5359
- onStopGeneration: callbacks.onStopGeneration,
5360
- enableFileUpload: config.features.enableFileUpload,
5361
- enableAudioRecording: config.features.enableAudioRecording,
5362
- maxAttachments: config.features.maxAttachments,
5363
- maxFileSize: config.features.maxFileSize,
5364
- config
5365
- }
5366
- ) })
5706
+ /* @__PURE__ */ jsxs16("div", { className: "bg-background pb-[env(safe-area-inset-bottom)]", children: [
5707
+ isMultiAgentMode && shouldShowAgentSelector && onTargetAgentChange && /* @__PURE__ */ jsx26("div", { className: "px-4 pt-1", children: /* @__PURE__ */ jsx26(
5708
+ TargetAgentSelector,
5709
+ {
5710
+ agents: participantIds && participantIds.length > 0 ? agentOptions.filter((a) => participantIds.includes(a.id)) : agentOptions,
5711
+ targetAgentId,
5712
+ onTargetChange: onTargetAgentChange,
5713
+ placeholder: config.agentSelector?.label || "Select agent",
5714
+ disabled: isGenerating
5715
+ }
5716
+ ) }),
5717
+ /* @__PURE__ */ jsx26(
5718
+ ChatInput,
5719
+ {
5720
+ value: inputValue,
5721
+ onChange: (value) => {
5722
+ setInputValue(value);
5723
+ if (initialInputApplied.current && !initialInputConsumedRef.current) {
5724
+ initialInputConsumedRef.current = true;
5725
+ onInitialInputConsumed?.();
5726
+ }
5727
+ },
5728
+ onSubmit: handleSendMessage,
5729
+ attachments,
5730
+ onAttachmentsChange: setAttachments,
5731
+ placeholder: config.labels.inputPlaceholder,
5732
+ disabled: false,
5733
+ isGenerating,
5734
+ onStopGeneration: callbacks.onStopGeneration,
5735
+ enableFileUpload: config.features.enableFileUpload,
5736
+ enableAudioRecording: config.features.enableAudioRecording,
5737
+ maxAttachments: config.features.maxAttachments,
5738
+ maxFileSize: config.features.maxFileSize,
5739
+ config,
5740
+ mentionAgents: participantIds && participantIds.length > 0 ? agentOptions.filter((a) => participantIds.includes(a.id)) : agentOptions,
5741
+ onTargetAgentChange
5742
+ }
5743
+ )
5744
+ ] })
5367
5745
  ] }),
5368
- config?.customComponent?.component && !isMobile && /* @__PURE__ */ jsx25(
5746
+ config?.customComponent?.component && !isMobile && /* @__PURE__ */ jsx26(
5369
5747
  "div",
5370
5748
  {
5371
5749
  className: "h-full transition-all duration-300 ease-in-out overflow-hidden",
5372
5750
  style: { width: state.showSidebar ? config.customComponent.panelWidth ?? 320 : 0 },
5373
- children: state.showSidebar && /* @__PURE__ */ jsx25(
5751
+ children: state.showSidebar && /* @__PURE__ */ jsx26(
5374
5752
  "div",
5375
5753
  {
5376
5754
  className: "h-full overflow-hidden border-l bg-background animate-in slide-in-from-right-4 duration-300",
@@ -5382,8 +5760,8 @@ var ChatUI = ({
5382
5760
  )
5383
5761
  ] })
5384
5762
  ] }) }),
5385
- isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */ jsxs15("div", { className: "fixed inset-0 z-50", children: [
5386
- /* @__PURE__ */ jsx25(
5763
+ isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */ jsxs16("div", { className: "fixed inset-0 z-50", children: [
5764
+ /* @__PURE__ */ jsx26(
5387
5765
  "div",
5388
5766
  {
5389
5767
  className: `absolute inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-200 ease-out ${isCustomVisible ? "opacity-100" : "opacity-0"}`,
@@ -5391,16 +5769,16 @@ var ChatUI = ({
5391
5769
  onClick: closeSidebar
5392
5770
  }
5393
5771
  ),
5394
- /* @__PURE__ */ jsx25(
5772
+ /* @__PURE__ */ jsx26(
5395
5773
  "div",
5396
5774
  {
5397
5775
  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"}`,
5398
5776
  style: { willChange: "transform" },
5399
- children: /* @__PURE__ */ jsx25("div", { className: "h-full overflow-hidden", children: renderCustomComponent() })
5777
+ children: /* @__PURE__ */ jsx26("div", { className: "h-full overflow-hidden", children: renderCustomComponent() })
5400
5778
  }
5401
5779
  )
5402
5780
  ] }),
5403
- isUserProfileOpen && /* @__PURE__ */ jsx25(
5781
+ isUserProfileOpen && /* @__PURE__ */ jsx26(
5404
5782
  UserProfile,
5405
5783
  {
5406
5784
  isOpen: isUserProfileOpen,
@@ -5435,10 +5813,10 @@ import {
5435
5813
  Filter as Filter2,
5436
5814
  Calendar as Calendar2,
5437
5815
  Hash,
5438
- X as X5,
5439
- Check as Check4
5816
+ X as X6,
5817
+ Check as Check5
5440
5818
  } from "lucide-react";
5441
- import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
5819
+ import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
5442
5820
  var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onArchive }) => {
5443
5821
  const [isEditing, setIsEditing] = useState9(false);
5444
5822
  const [editTitle, setEditTitle] = useState9(thread.title);
@@ -5467,9 +5845,9 @@ var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onAr
5467
5845
  handleCancelEdit();
5468
5846
  }
5469
5847
  };
5470
- return /* @__PURE__ */ jsx26(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__ */ jsx26(CardContent, { className: "p-3 max-w-sm", children: /* @__PURE__ */ jsxs16("div", { className: "flex items-start justify-between gap-2", children: [
5471
- /* @__PURE__ */ jsx26("div", { className: "flex-1 min-w-0", onClick: onSelect, children: isEditing ? /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2", children: [
5472
- /* @__PURE__ */ jsx26(
5848
+ return /* @__PURE__ */ jsx27(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__ */ jsx27(CardContent, { className: "p-3 max-w-sm", children: /* @__PURE__ */ jsxs17("div", { className: "flex items-start justify-between gap-2", children: [
5849
+ /* @__PURE__ */ jsx27("div", { className: "flex-1 min-w-0", onClick: onSelect, children: isEditing ? /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
5850
+ /* @__PURE__ */ jsx27(
5473
5851
  Input,
5474
5852
  {
5475
5853
  ref: inputRef,
@@ -5481,44 +5859,44 @@ var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onAr
5481
5859
  placeholder: config?.labels?.threadNamePlaceholder || "Conversation name"
5482
5860
  }
5483
5861
  ),
5484
- /* @__PURE__ */ jsx26(Button, { size: "sm", variant: "ghost", onClick: handleSaveEdit, children: /* @__PURE__ */ jsx26(Check4, { className: "h-3 w-3" }) }),
5485
- /* @__PURE__ */ jsx26(Button, { size: "sm", variant: "ghost", onClick: handleCancelEdit, children: /* @__PURE__ */ jsx26(X5, { className: "h-3 w-3" }) })
5486
- ] }) : /* @__PURE__ */ jsxs16(Fragment6, { children: [
5487
- /* @__PURE__ */ jsx26("h4", { className: "font-medium text-sm truncate mb-1", children: thread.title }),
5488
- /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
5489
- /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
5490
- /* @__PURE__ */ jsx26(Hash, { className: "h-3 w-3" }),
5862
+ /* @__PURE__ */ jsx27(Button, { size: "sm", variant: "ghost", onClick: handleSaveEdit, children: /* @__PURE__ */ jsx27(Check5, { className: "h-3 w-3" }) }),
5863
+ /* @__PURE__ */ jsx27(Button, { size: "sm", variant: "ghost", onClick: handleCancelEdit, children: /* @__PURE__ */ jsx27(X6, { className: "h-3 w-3" }) })
5864
+ ] }) : /* @__PURE__ */ jsxs17(Fragment7, { children: [
5865
+ /* @__PURE__ */ jsx27("h4", { className: "font-medium text-sm truncate mb-1", children: thread.title }),
5866
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
5867
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1", children: [
5868
+ /* @__PURE__ */ jsx27(Hash, { className: "h-3 w-3" }),
5491
5869
  thread.messageCount,
5492
5870
  " msgs"
5493
5871
  ] }),
5494
- /* @__PURE__ */ jsx26(Separator, { orientation: "vertical", className: "h-3" }),
5495
- /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1", children: [
5496
- /* @__PURE__ */ jsx26(Calendar2, { className: "h-3 w-3" }),
5872
+ /* @__PURE__ */ jsx27(Separator, { orientation: "vertical", className: "h-3" }),
5873
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1", children: [
5874
+ /* @__PURE__ */ jsx27(Calendar2, { className: "h-3 w-3" }),
5497
5875
  formatDate(thread.updatedAt, config?.labels)
5498
5876
  ] }),
5499
- thread.isArchived && /* @__PURE__ */ jsxs16(Fragment6, { children: [
5500
- /* @__PURE__ */ jsx26(Separator, { orientation: "vertical", className: "h-3" }),
5501
- /* @__PURE__ */ jsxs16(Badge, { variant: "secondary", className: "text-xs", children: [
5502
- /* @__PURE__ */ jsx26(Archive2, { className: "h-2 w-2 mr-1" }),
5877
+ thread.isArchived && /* @__PURE__ */ jsxs17(Fragment7, { children: [
5878
+ /* @__PURE__ */ jsx27(Separator, { orientation: "vertical", className: "h-3" }),
5879
+ /* @__PURE__ */ jsxs17(Badge, { variant: "secondary", className: "text-xs", children: [
5880
+ /* @__PURE__ */ jsx27(Archive2, { className: "h-2 w-2 mr-1" }),
5503
5881
  config?.labels?.archiveThread || "Archived"
5504
5882
  ] })
5505
5883
  ] })
5506
5884
  ] })
5507
5885
  ] }) }),
5508
- !isEditing && /* @__PURE__ */ jsxs16(DropdownMenu, { children: [
5509
- /* @__PURE__ */ jsx26(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx26(Button, { variant: "ghost", size: "icon", className: "h-6 w-6 m-auto", children: /* @__PURE__ */ jsx26(MoreVertical2, { className: "h-3 w-3" }) }) }),
5510
- /* @__PURE__ */ jsxs16(DropdownMenuContent, { align: "end", children: [
5511
- /* @__PURE__ */ jsxs16(DropdownMenuItem, { onClick: () => setIsEditing(true), children: [
5512
- /* @__PURE__ */ jsx26(Edit22, { className: "h-4 w-4 mr-2" }),
5886
+ !isEditing && /* @__PURE__ */ jsxs17(DropdownMenu, { children: [
5887
+ /* @__PURE__ */ jsx27(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx27(Button, { variant: "ghost", size: "icon", className: "h-6 w-6 m-auto", children: /* @__PURE__ */ jsx27(MoreVertical2, { className: "h-3 w-3" }) }) }),
5888
+ /* @__PURE__ */ jsxs17(DropdownMenuContent, { align: "end", children: [
5889
+ /* @__PURE__ */ jsxs17(DropdownMenuItem, { onClick: () => setIsEditing(true), children: [
5890
+ /* @__PURE__ */ jsx27(Edit22, { className: "h-4 w-4 mr-2" }),
5513
5891
  config?.labels?.renameThread || "Rename"
5514
5892
  ] }),
5515
- /* @__PURE__ */ jsxs16(DropdownMenuItem, { onClick: onArchive, children: [
5516
- /* @__PURE__ */ jsx26(Archive2, { className: "h-4 w-4 mr-2" }),
5893
+ /* @__PURE__ */ jsxs17(DropdownMenuItem, { onClick: onArchive, children: [
5894
+ /* @__PURE__ */ jsx27(Archive2, { className: "h-4 w-4 mr-2" }),
5517
5895
  thread.isArchived ? config?.labels?.unarchiveThread || "Unarchive" : config?.labels?.archiveThread || "Archive"
5518
5896
  ] }),
5519
- /* @__PURE__ */ jsx26(DropdownMenuSeparator, {}),
5520
- /* @__PURE__ */ jsxs16(DropdownMenuItem, { onClick: onDelete, className: "text-destructive", children: [
5521
- /* @__PURE__ */ jsx26(Trash25, { className: "h-4 w-4 mr-2" }),
5897
+ /* @__PURE__ */ jsx27(DropdownMenuSeparator, {}),
5898
+ /* @__PURE__ */ jsxs17(DropdownMenuItem, { onClick: onDelete, className: "text-destructive", children: [
5899
+ /* @__PURE__ */ jsx27(Trash25, { className: "h-4 w-4 mr-2" }),
5522
5900
  config?.labels?.deleteThread || "Delete"
5523
5901
  ] })
5524
5902
  ] })
@@ -5533,17 +5911,17 @@ var CreateThreadDialog2 = ({ onCreateThread, config }) => {
5533
5911
  setTitle("");
5534
5912
  setIsOpen(false);
5535
5913
  };
5536
- return /* @__PURE__ */ jsxs16(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
5537
- /* @__PURE__ */ jsx26(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs16(Button, { variant: "outline", className: "w-full", children: [
5538
- /* @__PURE__ */ jsx26(Plus4, { className: "h-4 w-4 mr-2" }),
5914
+ return /* @__PURE__ */ jsxs17(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
5915
+ /* @__PURE__ */ jsx27(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs17(Button, { variant: "outline", className: "w-full", children: [
5916
+ /* @__PURE__ */ jsx27(Plus4, { className: "h-4 w-4 mr-2" }),
5539
5917
  config?.labels?.createNewThread || "New Conversation"
5540
5918
  ] }) }),
5541
- /* @__PURE__ */ jsxs16(DialogContent, { children: [
5542
- /* @__PURE__ */ jsxs16(DialogHeader, { children: [
5543
- /* @__PURE__ */ jsx26(DialogTitle, { children: config?.labels?.createNewThread || "Create New Conversation" }),
5544
- /* @__PURE__ */ jsx26(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
5919
+ /* @__PURE__ */ jsxs17(DialogContent, { children: [
5920
+ /* @__PURE__ */ jsxs17(DialogHeader, { children: [
5921
+ /* @__PURE__ */ jsx27(DialogTitle, { children: config?.labels?.createNewThread || "Create New Conversation" }),
5922
+ /* @__PURE__ */ jsx27(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
5545
5923
  ] }),
5546
- /* @__PURE__ */ jsx26(
5924
+ /* @__PURE__ */ jsx27(
5547
5925
  Input,
5548
5926
  {
5549
5927
  value: title,
@@ -5553,9 +5931,9 @@ var CreateThreadDialog2 = ({ onCreateThread, config }) => {
5553
5931
  autoFocus: true
5554
5932
  }
5555
5933
  ),
5556
- /* @__PURE__ */ jsxs16(DialogFooter, { children: [
5557
- /* @__PURE__ */ jsx26(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config?.labels?.cancel || "Cancel" }),
5558
- /* @__PURE__ */ jsx26(Button, { onClick: handleCreate, children: config?.labels?.create || "Create" })
5934
+ /* @__PURE__ */ jsxs17(DialogFooter, { children: [
5935
+ /* @__PURE__ */ jsx27(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config?.labels?.cancel || "Cancel" }),
5936
+ /* @__PURE__ */ jsx27(Button, { onClick: handleCreate, children: config?.labels?.create || "Create" })
5559
5937
  ] })
5560
5938
  ] })
5561
5939
  ] });
@@ -5609,20 +5987,20 @@ var ThreadManager = ({
5609
5987
  setDeleteThreadId(null);
5610
5988
  };
5611
5989
  if (!isOpen) return null;
5612
- return /* @__PURE__ */ jsx26(TooltipProvider, { children: /* @__PURE__ */ jsxs16("div", { className: `fixed inset-0 z-50 bg-background/80 backdrop-blur-sm ${className}`, children: [
5613
- /* @__PURE__ */ jsx26("div", { className: "fixed left-0 top-0 h-full w-full max-w-md border-r bg-background shadow-lg", children: /* @__PURE__ */ jsxs16(Card, { className: "h-full border-0 rounded-none", children: [
5614
- /* @__PURE__ */ jsxs16(CardHeader, { className: "border-b", children: [
5615
- /* @__PURE__ */ jsxs16("div", { className: "flex items-center justify-between", children: [
5616
- /* @__PURE__ */ jsxs16(CardTitle, { className: "flex items-center gap-2", children: [
5617
- /* @__PURE__ */ jsx26(MessageSquare2, { className: "h-5 w-5" }),
5990
+ return /* @__PURE__ */ jsx27(TooltipProvider, { children: /* @__PURE__ */ jsxs17("div", { className: `fixed inset-0 z-50 bg-background/80 backdrop-blur-sm ${className}`, children: [
5991
+ /* @__PURE__ */ jsx27("div", { className: "fixed left-0 top-0 h-full w-full max-w-md border-r bg-background shadow-lg", children: /* @__PURE__ */ jsxs17(Card, { className: "h-full border-0 rounded-none", children: [
5992
+ /* @__PURE__ */ jsxs17(CardHeader, { className: "border-b", children: [
5993
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
5994
+ /* @__PURE__ */ jsxs17(CardTitle, { className: "flex items-center gap-2", children: [
5995
+ /* @__PURE__ */ jsx27(MessageSquare2, { className: "h-5 w-5" }),
5618
5996
  config?.labels?.newChat || "Conversations"
5619
5997
  ] }),
5620
- /* @__PURE__ */ jsx26(Button, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ jsx26(X5, { className: "h-4 w-4" }) })
5998
+ /* @__PURE__ */ jsx27(Button, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ jsx27(X6, { className: "h-4 w-4" }) })
5621
5999
  ] }),
5622
- /* @__PURE__ */ jsxs16("div", { className: "space-y-3", children: [
5623
- /* @__PURE__ */ jsxs16("div", { className: "relative", children: [
5624
- /* @__PURE__ */ jsx26(Search2, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
5625
- /* @__PURE__ */ jsx26(
6000
+ /* @__PURE__ */ jsxs17("div", { className: "space-y-3", children: [
6001
+ /* @__PURE__ */ jsxs17("div", { className: "relative", children: [
6002
+ /* @__PURE__ */ jsx27(Search2, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
6003
+ /* @__PURE__ */ jsx27(
5626
6004
  Input,
5627
6005
  {
5628
6006
  placeholder: config?.labels?.search || "Search conversations...",
@@ -5632,8 +6010,8 @@ var ThreadManager = ({
5632
6010
  }
5633
6011
  )
5634
6012
  ] }),
5635
- /* @__PURE__ */ jsxs16("div", { className: "flex items-center justify-between", children: [
5636
- /* @__PURE__ */ jsxs16(
6013
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
6014
+ /* @__PURE__ */ jsxs17(
5637
6015
  Button,
5638
6016
  {
5639
6017
  variant: "outline",
@@ -5641,12 +6019,12 @@ var ThreadManager = ({
5641
6019
  onClick: () => setShowArchived(!showArchived),
5642
6020
  className: "text-xs",
5643
6021
  children: [
5644
- /* @__PURE__ */ jsx26(Filter2, { className: "h-3 w-3 mr-1" }),
6022
+ /* @__PURE__ */ jsx27(Filter2, { className: "h-3 w-3 mr-1" }),
5645
6023
  showArchived ? config?.labels?.hideArchived || "Hide Archived" : config?.labels?.showArchived || "Show Archived"
5646
6024
  ]
5647
6025
  }
5648
6026
  ),
5649
- /* @__PURE__ */ jsxs16(Badge, { variant: "secondary", className: "text-xs", children: [
6027
+ /* @__PURE__ */ jsxs17(Badge, { variant: "secondary", className: "text-xs", children: [
5650
6028
  filteredThreads.length,
5651
6029
  " / ",
5652
6030
  threads.length
@@ -5654,14 +6032,14 @@ var ThreadManager = ({
5654
6032
  ] })
5655
6033
  ] })
5656
6034
  ] }),
5657
- /* @__PURE__ */ jsxs16(CardContent, { className: "p-0 flex-1", children: [
5658
- /* @__PURE__ */ jsx26("div", { className: "p-4", children: onCreateThread && /* @__PURE__ */ jsx26(CreateThreadDialog2, { onCreateThread, config }) }),
5659
- /* @__PURE__ */ jsx26(ScrollArea, { className: "h-[calc(100vh-280px)]", children: /* @__PURE__ */ jsx26("div", { className: "px-4 pb-4 space-y-4", children: Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ jsxs16("div", { className: "text-center py-8 text-muted-foreground", children: [
5660
- /* @__PURE__ */ jsx26(MessageSquare2, { className: "h-12 w-12 mx-auto mb-3 opacity-50" }),
5661
- /* @__PURE__ */ jsx26("p", { className: "text-sm", children: searchQuery ? config?.labels?.noThreadsFound || "No conversations found" : config?.labels?.noThreadsYet || "No conversations yet" })
5662
- ] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ jsxs16("div", { children: [
5663
- /* @__PURE__ */ jsx26("h3", { className: "text-sm font-medium text-muted-foreground mb-2 px-2", children: group }),
5664
- /* @__PURE__ */ jsx26("div", { className: "space-y-2", children: groupThreads.map((thread) => /* @__PURE__ */ jsx26(
6035
+ /* @__PURE__ */ jsxs17(CardContent, { className: "p-0 flex-1", children: [
6036
+ /* @__PURE__ */ jsx27("div", { className: "p-4", children: onCreateThread && /* @__PURE__ */ jsx27(CreateThreadDialog2, { onCreateThread, config }) }),
6037
+ /* @__PURE__ */ jsx27(ScrollArea, { className: "h-[calc(100vh-280px)]", children: /* @__PURE__ */ jsx27("div", { className: "px-4 pb-4 space-y-4", children: Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ jsxs17("div", { className: "text-center py-8 text-muted-foreground", children: [
6038
+ /* @__PURE__ */ jsx27(MessageSquare2, { className: "h-12 w-12 mx-auto mb-3 opacity-50" }),
6039
+ /* @__PURE__ */ jsx27("p", { className: "text-sm", children: searchQuery ? config?.labels?.noThreadsFound || "No conversations found" : config?.labels?.noThreadsYet || "No conversations yet" })
6040
+ ] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ jsxs17("div", { children: [
6041
+ /* @__PURE__ */ jsx27("h3", { className: "text-sm font-medium text-muted-foreground mb-2 px-2", children: group }),
6042
+ /* @__PURE__ */ jsx27("div", { className: "space-y-2", children: groupThreads.map((thread) => /* @__PURE__ */ jsx27(
5665
6043
  ThreadItem,
5666
6044
  {
5667
6045
  thread,
@@ -5677,14 +6055,14 @@ var ThreadManager = ({
5677
6055
  ] }, group)) }) })
5678
6056
  ] })
5679
6057
  ] }) }),
5680
- deleteThreadId && /* @__PURE__ */ jsx26(AlertDialog, { open: !!deleteThreadId, onOpenChange: () => setDeleteThreadId(null), children: /* @__PURE__ */ jsxs16(AlertDialogContent, { children: [
5681
- /* @__PURE__ */ jsxs16(AlertDialogHeader, { children: [
5682
- /* @__PURE__ */ jsx26(AlertDialogTitle, { children: config?.labels?.deleteConfirmTitle || "Delete Conversation" }),
5683
- /* @__PURE__ */ jsx26(AlertDialogDescription, { children: config?.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
6058
+ deleteThreadId && /* @__PURE__ */ jsx27(AlertDialog, { open: !!deleteThreadId, onOpenChange: () => setDeleteThreadId(null), children: /* @__PURE__ */ jsxs17(AlertDialogContent, { children: [
6059
+ /* @__PURE__ */ jsxs17(AlertDialogHeader, { children: [
6060
+ /* @__PURE__ */ jsx27(AlertDialogTitle, { children: config?.labels?.deleteConfirmTitle || "Delete Conversation" }),
6061
+ /* @__PURE__ */ jsx27(AlertDialogDescription, { children: config?.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
5684
6062
  ] }),
5685
- /* @__PURE__ */ jsxs16(AlertDialogFooter, { children: [
5686
- /* @__PURE__ */ jsx26(AlertDialogCancel, { children: config?.labels?.cancel || "Cancel" }),
5687
- /* @__PURE__ */ jsx26(
6063
+ /* @__PURE__ */ jsxs17(AlertDialogFooter, { children: [
6064
+ /* @__PURE__ */ jsx27(AlertDialogCancel, { children: config?.labels?.cancel || "Cancel" }),
6065
+ /* @__PURE__ */ jsx27(
5688
6066
  AlertDialogAction,
5689
6067
  {
5690
6068
  onClick: () => deleteThreadId && handleDeleteThread(deleteThreadId),
@@ -5696,54 +6074,28 @@ var ThreadManager = ({
5696
6074
  ] }) })
5697
6075
  ] }) });
5698
6076
  };
5699
-
5700
- // src/lib/chatUtils.ts
5701
- var chatUtils = {
5702
- generateId: () => globalThis.crypto?.randomUUID?.() ?? `id-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`,
5703
- generateMessageId: () => chatUtils.generateId(),
5704
- generateThreadId: () => chatUtils.generateId(),
5705
- createMessage: (role, content, attachments) => ({
5706
- id: chatUtils.generateMessageId(),
5707
- role,
5708
- content,
5709
- timestamp: Date.now(),
5710
- attachments,
5711
- isComplete: true
5712
- }),
5713
- createThread: (title) => ({
5714
- id: chatUtils.generateThreadId(),
5715
- title,
5716
- createdAt: Date.now(),
5717
- updatedAt: Date.now(),
5718
- messageCount: 0
5719
- }),
5720
- generateThreadTitle: (firstMessage) => {
5721
- const cleaned = firstMessage.replace(/[^\w\s]/g, "").trim();
5722
- const words = cleaned.split(/\s+/).slice(0, 6);
5723
- return words.join(" ") || "Nova Conversa";
5724
- }
5725
- };
5726
6077
  export {
6078
+ AgentBadge,
5727
6079
  ChatHeader,
5728
6080
  ChatInput,
5729
6081
  ChatUI,
5730
6082
  ChatUserContextProvider,
5731
6083
  Message,
6084
+ ParticipantsSelector,
5732
6085
  Sidebar2 as Sidebar,
6086
+ TargetAgentSelector,
5733
6087
  ThreadManager,
5734
6088
  UserMenu,
5735
6089
  UserProfile,
5736
- chatConfigPresets,
6090
+ assignAgentColors,
5737
6091
  chatUtils,
5738
6092
  cn,
5739
- configUtils,
5740
6093
  createObjectUrlFromDataUrl,
5741
6094
  defaultChatConfig,
5742
- featureFlags,
5743
6095
  formatDate,
6096
+ getAgentColor,
6097
+ getAgentInitials,
5744
6098
  mergeConfig,
5745
- themeUtils,
5746
- useChatUserContext,
5747
- validateConfig
6099
+ useChatUserContext
5748
6100
  };
5749
6101
  //# sourceMappingURL=index.js.map