@mcp-b/embedded-agent 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +272 -31
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3012 -54
- package/dist/index.js.map +1 -1
- package/dist/styles/globals.css +1 -1
- package/dist/web-component-standalone.iife.js +4 -4
- package/dist/web-component.d.ts +10 -1
- package/dist/web-component.d.ts.map +1 -1
- package/dist/web-component.js +2826 -52
- package/dist/web-component.js.map +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-component.js","names":["clsx","twMerge","ClassValue","cn","inputs","MCP_MAX_RECONNECT_ATTEMPTS","MCP_BASE_RECONNECT_DELAY_MS","MCP_MAX_RECONNECT_DELAY_MS","MCP_TAB_CONNECT_DELAY_MS","AUDIO_FREQUENCY_BINS","REALTIME_DEFAULT_MODEL","REALTIME_DEFAULT_VOICE","REALTIME_DEFAULT_API_URL","AUDIO_VISUALIZATION_INTERVAL_MS","RESPONSE_REQUEST_DELAY_MS","TOOL_CALL_DISPLAY_DURATION_MS","TOOL_CALL_ERROR_DISPLAY_DURATION_MS","WAVEFORM_HISTORY_SIZE","WAVEFORM_UPDATE_RATE_MS","WEBSOCKET_OPEN","DEBUG_LOGGING_ENABLED","window","__WEBMCP_DEBUG__","debugLog","component","message","data","isDebugEnabled","undefined","console","log","debugLog","AudioAnalyzer","audioContext","AudioContext","analyser","AnalyserNode","source","MediaStreamAudioSourceNode","dataArray","Uint8Array","ArrayBuffer","animationId","initialize","stream","MediaStream","Promise","audioTracks","getAudioTracks","streamId","id","length","trackInfo","map","t","label","enabled","muted","readyState","state","resume","err","console","warn","createAnalyser","fftSize","smoothingTimeConstant","createMediaStreamSource","connect","bufferLength","frequencyBinCount","sampleRate","contextState","getAudioLevel","getByteFrequencyData","sum","i","average","Math","min","getFrequencyData","bins","Array","fill","result","samplesPerBin","floor","j","push","startAnalysis","callback","level","frequencies","analyze","requestAnimationFrame","stopAnalysis","cancelAnimationFrame","destroy","disconnect","close","EventCallback","IEventEmitter","EventEmitter","listeners","Map","Set","on","event","callback","has","set","get","add","off","delete","emit","data","forEach","error","console","removeAllListeners","clear","listenerCount","size","RESPONSE_REQUEST_DELAY_MS","EventEmitter","ToolManager","FunctionCall","RealtimeMessage","ResponseOutputItem","type","status","name","call_id","arguments","isCompletedFunctionCall","item","MessageHandler","isProcessingResponse","pendingFunctionCalls","Set","responseRequestTimer","ReturnType","setTimeout","hasRequestedResponse","constructor","toolManager","eventEmitter","handleMessage","data","dataChannel","RTCDataChannel","Promise","msg","JSON","parse","error","console","handleResponseCreated","handleResponseDone","handleFunctionCallArguments","handleSpeechEvents","handleAudioEvents","handleTranscriptEvents","handleUserTranscript","handleError","handleSessionEvents","_msg","outputItems","extractResponseOutput","response","hasFunctionCalls","some","length","functionCalls","filter","map","functionCall","has","add","executeFunctionCall","warn","size","requestResponseIfNeeded","r","Record","Array","isArray","output","eventType","emit","log","hasAudio","delta","eventMap","text","transcript","clearTimeout","result","executeToolCall","readyState","stringify","success","send","undefined","sendToolError","String","delete","errorResponse","reset","clear","FunctionCall","OpenAITool","ToolExecutionResult","RegisteredTool","name","description","inputSchema","Record","ToolExecutor","args","Promise","ToolManager","tools","executor","lastSentToolSignature","setTools","setExecutor","resetSession","console","log","getToolSignature","map","t","sort","join","hasToolsChanged","currentSignature","markToolsSent","formatToolsForOpenAI","builtInTools","type","parameters","properties","required","registeredTools","tool","const","validateToolSchema","schema","result","Object","entries","filter","prop","p","optional","nullable","key","executeToolCall","functionCall","arguments","argsString","executeListTools","success","error","find","JSON","parse","data","String","toolList","count","length","message","getChangesSummary","added","removed","total","prevTools","split","Boolean","currTools","prevSet","Set","currSet","has","debugLog","REALTIME_DEFAULT_API_URL","REALTIME_DEFAULT_MODEL","REALTIME_DEFAULT_VOICE","RealtimeConfig","RealtimeSession","EphemeralTokenResponse","client_secret","value","hasClientSecret","response","secret","WebRTCManager","tokenEndpoint","constructor","createSession","config","Promise","model","voice","apiUrl","ephemeralKey","getEphemeralToken","pc","RTCPeerConnection","audioElement","createAudioElement","remoteStream","MediaStream","ontrack","e","streams","srcObject","streamId","id","tracks","getTracks","length","localStream","getUserMedia","map","t","kind","enabled","muted","readyState","forEach","track","addTrack","dataChannel","createDataChannel","offer","createOffer","setLocalDescription","sdp","Error","answer","connectToOpenAI","setRemoteDescription","cleanup","stop","remove","close","fetch","method","headers","body","JSON","stringify","ok","errorText","text","console","error","statusText","data","json","HTMLAudioElement","document","createElement","autoplay","style","display","appendChild","navigator","mediaDevices","audio","echoCancellation","noiseSuppression","autoGainControl","baseUrl","RTCSessionDescriptionInit","Authorization","answerSdp","type","const","AUDIO_FREQUENCY_BINS","AUDIO_VISUALIZATION_INTERVAL_MS","debugLog","AudioAnalyzer","EventEmitter","MessageHandler","ToolManager","WebRTCManager","RegisteredTool","ToolExecutor","EventCallback","RealtimeConfig","RealtimeSession","SessionConfig","EMPTY_FREQUENCY_TEMPLATE","Object","freeze","Array","fill","createZeroFrequencyArray","OpenAIRealtimeService","session","webrtcManager","toolManager","messageHandler","eventEmitter","muted","lastState","localAnalyzer","remoteAnalyzer","visualizationInterval","ReturnType","setInterval","sessionStartTime","onToolsChangedCallback","constructor","tokenEndpoint","setTools","tools","isSessionActive","updateSessionTools","setToolExecutor","executor","setExecutor","onToolsChanged","callback","startSession","config","Promise","stopSession","Date","now","emitSessionState","createSession","setupDataChannel","dataChannel","setupPeerConnectionMonitoring","pc","localStream","initializeLocalAnalyzer","remoteStream","initializeRemoteAnalyzer","originalOntrack","ontrack","e","call","streams","console","warn","error","handleSessionError","durationSeconds","Math","floor","clearInterval","destroy","cleanup","reset","resetSession","sendUserMessage","text","Error","message","type","item","role","content","send","JSON","stringify","readyState","getLocalStream","MediaStream","getRemoteStream","toggleMute","audioElement","isMuted","on","event","off","getSessionStatus","state","isActive","RTCDataChannel","addEventListener","configureSession","MessageEvent","handleMessage","data","emit","RTCPeerConnection","connectionState","iceConnectionState","formatToolsForOpenAI","markToolsSent","sessionConfig","modalities","instructions","getSessionInstructions","voice","tool_choice","turn_detection","threshold","prefix_padding_ms","silence_duration_ms","input_audio_transcription","model","sessionUpdate","changesSummary","getChangesSummary","log","total","added","length","slice","join","removed","String","stream","clonedStream","getAudioTracks","map","t","clone","initialize","startAudioVisualization","logCounter","micLevel","getAudioLevel","micFrequency","getFrequencyData","speakerLevel","speakerFrequency","mic","toFixed","speaker","extra","Record","payload","RealtimeConfig","model","voice","apiUrl","tokenEndpoint","RealtimeSession","pc","RTCPeerConnection","dataChannel","RTCDataChannel","audioElement","HTMLAudioElement","localStream","MediaStream","remoteStream","cleanup","OpenAITool","type","name","description","parameters","properties","Record","required","SessionConfig","modalities","instructions","tools","tool_choice","turn_detection","threshold","prefix_padding_ms","silence_duration_ms","input_audio_transcription","FunctionCall","arguments","call_id","status","ConversationItem","role","content","output","RealtimeMessage","key","ToolExecutionResult","success","data","error","EventCallback","IEventEmitter","on","event","callback","off","emit","AudioLevelData","micLevel","micFrequency","speakerLevel","speakerFrequency","TranscriptData","text","isDone","ToolCallData","toolName","VoiceModeState","isActive","isConnecting","isMuted","isError","connectionState","audioLevel","transcript","toolCall","SessionStateEventData","state","durationSeconds","UserTranscriptEventData","AssistantTranscriptEventData","delta","ToolCallStartedEventData","ToolCallCompletedEventData","ErrorEventData","message","isSessionStateEventData","d","includes","isUserTranscriptEventData","isAssistantTranscriptEventData","undefined","isToolCallStartedEventData","isToolCallCompletedEventData","isErrorEventData","isAudioLevelData","Array","isArray","useCallback","useEffect","useMemo","useRef","useState","TOOL_CALL_DISPLAY_DURATION_MS","TOOL_CALL_ERROR_DISPLAY_DURATION_MS","isAssistantTranscriptEventData","isAudioLevelData","isErrorEventData","isSessionStateEventData","isToolCallCompletedEventData","isToolCallStartedEventData","isUserTranscriptEventData","OpenAIRealtimeService","AudioLevelData","RealtimeConfig","RegisteredTool","ToolCallData","ToolExecutor","TranscriptData","VoiceModeState","UseVoiceModeOptions","tokenEndpoint","tools","toolExecutor","onConnect","onDisconnect","durationSeconds","onError","error","onUserTranscript","text","onAssistantTranscript","UseVoiceModeReturn","startSession","config","Promise","stopSession","toggleMute","muted","sendMessage","useVoiceMode","options","$","_c","isActive","setIsActive","isConnecting","setIsConnecting","isMuted","setIsMuted","isError","setIsError","connectionState","setConnectionState","audioLevel","setAudioLevel","transcript","setTranscript","toolCall","setToolCall","setError","serviceRef","onConnectRef","onDisconnectRef","onErrorRef","onUserTranscriptRef","onAssistantTranscriptRef","t0","t1","current","t2","getService","t3","t4","service","setTools","t5","t6","service_0","setToolExecutor","t7","t8","service_1","handleSessionState","data","console","warn","state","handleAudioLevel","data_0","handleUserTranscript","data_1","type","isDone","handleAssistantTranscript","data_2","delta","prev","handleAssistantTranscriptDone","data_3","text_0","handleToolCallStarted","data_4","status","toolName","name","handleToolCallCompleted","data_5","setTimeout","undefined","handleError","data_6","errorMsg","message","on","off","t9","service_2","t10","err","errorMsg_0","Error","service_3","t11","service_4","newMuted","t12","text_1","service_5","isSessionActive","sendUserMessage","t13","createContext","useContext","useMemo","useVoiceMode","ReactNode","UseVoiceModeReturn","RegisteredTool","ToolExecutor","VoiceModeContextValue","isSupported","VoiceModeContext","VoiceModeProviderProps","children","tokenEndpoint","tools","toolExecutor","onConnect","onDisconnect","durationSeconds","onError","error","onUserTranscript","text","onAssistantTranscript","checkVoiceModeSupport","window","RTCPeerConnection","navigator","mediaDevices","getUserMedia","VoiceModeProvider","t0","$","_c","t1","voiceMode","t2","Symbol","for","t3","value","t4","useVoiceModeContext","context","Error","useOptionalVoiceModeContext","c","_c","AvatarPrimitive","React","cn","Avatar","t0","$","className","props","t1","t2","AvatarImage","AvatarFallback","c","_c","DialogPrimitive","XIcon","React","cn","Dialog","t0","$","props","t1","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","className","t2","DialogContent","children","showCloseButton","undefined","Symbol","for","t3","t4","t5","DialogHeader","DialogFooter","DialogTitle","DialogDescription","c","_c","TooltipPrimitive","React","cn","TooltipProvider","t0","$","props","t1","delayDuration","undefined","t2","Tooltip","TooltipTrigger","TooltipContent","children","className","sideOffset","t3","Symbol","for","t4","Slot","cva","React","cn","VariantProps","ButtonProps","ComponentProps","buttonVariants","asChild","variants","variant","default","destructive","outline","secondary","ghost","link","size","sm","lg","icon","defaultVariants","Button","t0","$","_c","className","props","t1","undefined","Comp","t2","t3","c","_c","Slottable","forwardRef","cn","Button","Tooltip","TooltipContent","TooltipTrigger","ComponentPropsWithRef","TooltipIconButtonProps","tooltip","side","TooltipIconButton","HTMLButtonElement","t0","ref","$","children","className","rest","t1","undefined","t2","t3","t4","t5","t6","t7","displayName","c","_c","AttachmentPrimitive","ComposerPrimitive","MessagePrimitive","useAssistantApi","useAssistantState","FileText","PlusIcon","XIcon","useEffect","useState","useShallow","cn","Avatar","AvatarFallback","AvatarImage","Dialog","DialogContent","DialogTitle","DialogTrigger","Tooltip","TooltipContent","TooltipTrigger","TooltipIconButton","FC","PropsWithChildren","useFileSrc","file","$","src","setSrc","undefined","t0","t1","objectUrl","URL","createObjectURL","revokeObjectURL","useAttachmentSrc","src_0","_temp2","AttachmentPreviewProps","AttachmentPreview","AttachmentPreviewDialog","children","t2","Symbol","for","t3","t4","AttachmentThumb","isImage","_temp3","AttachmentUI","api","isComposer","attachment","source","_temp4","typeLabel","_temp5","t5","t6","t7","t8","t9","t10","AttachmentRemove","UserMessageAttachments","Attachment","ComposerAttachments","ComposerAddAttachment","_temp","type","content","filter","image","attachment_0","_exhaustiveCheck","Error","c","_c","MarkdownTextPrimitive","unstable_memoizeMarkdownComponents","memoizeMarkdownComponents","useIsMarkdownCodeBlock","CheckIcon","CopyIcon","memo","useState","remarkGfm","cn","TooltipIconButton","CodeHeaderProps","FC","MarkdownTextImpl","$","t0","Symbol","for","defaultComponents","MarkdownText","CodeHeader","language","code","isCopied","copyToClipboard","useCopyToClipboard","t1","onCopy","t2","t3","t4","t5","t6","undefined","copiedDuration","setIsCopied","value","navigator","clipboard","writeText","then","setTimeout","h1","className","props","h2","h3","h4","h5","h6","p","a","blockquote","ul","ol","hr","table","th","td","tr","sup","pre","Code","isCodeBlock","TabClientTransport","SSEClientTransport","StreamableHTTPClientTransport","MCPSourceConfig","Transport","TransportType","createMCPTransport","config","transportType","type","targetOrigin","window","location","origin","channelId","serverUrl","URL","url","headers","Record","Accept","customHeaders","authToken","Authorization","transportOptions","requestInit","shouldFallbackToSSE","error","Error","message","includes","calculateReconnectDelay","attempt","baseDelay","maxDelay","Math","min","pow","Client","ToolListChangedNotificationSchema","createContext","useCallback","useContext","useEffect","useMemo","useRef","useState","MCP_TAB_CONNECT_DELAY_MS","createMCPTransport","CallToolResult","MCPSource","MCPSourceConfig","Prompt","Resource","ResourceTemplate","ToolWithSource","Transport","ReactNode","SOURCE_LOCAL","SOURCE_REMOTE","SourceState","Omit","client","transport","resources","resourceTemplates","prompts","MCPToolsContextValue","tools","sources","Map","addSource","id","config","Promise","removeSource","getSource","isConnected","callTool","name","args","Record","callToolOnSource","sourceId","MCPToolsContext","MCPToolsProviderProps","children","autoConnectLocal","onToolsChange","MCPToolsProvider","sourcesRef","forceUpdate","toolsList","setToolsList","rebuildTools","allTools","current","forEach","source","tool","push","_sourceId","getPublicSource","state","error","has","sourceState","set","version","connect","listTools","setNotificationHandler","updated","err","console","Error","String","get","close","delete","undefined","arguments","find","t","publicSources","timer","setTimeout","type","clearTimeout","catch","clear","value","useMCPTools","context","useOptionalMCPTools","Loader2","Plug","Plus","X","useCallback","useState","cn","SOURCE_REMOTE","useMCPTools","Button","Dialog","DialogContent","DialogDescription","DialogHeader","DialogTitle","DialogTrigger","TooltipIconButton","FC","RemoteServer","id","url","RemoteMCPSettings","sources","addSource","removeSource","isOpen","setIsOpen","setUrl","isConnecting","setIsConnecting","error","setError","remoteServers","forEach","source","config","type","push","handleConnect","trim","URL","serverId","length","Date","now","err","Error","message","handleDisconnect","handleKeyDown","e","React","KeyboardEvent","key","connectedCount","filter","s","get","state","target","value","map","server","isConnected","isLoading","tools","CheckIcon","ChevronDownIcon","ChevronUpIcon","useState","Button","ToolCallMessagePartComponent","ToolFallback","t0","$","_c","toolName","argsText","result","isCollapsed","setIsCollapsed","t1","Symbol","for","t2","t3","t4","t5","undefined","JSON","stringify","t6","useEffect","useRef","cn","HTMLAttributes","LiveWaveformProps","HTMLDivElement","active","processing","barWidth","barGap","barRadius","barColor","fadeEdges","fadeWidth","height","sensitivity","smoothingTimeConstant","mode","manualAudioLevel","LiveWaveform","t0","$","_c","className","props","t1","t10","t2","t3","t4","t5","t6","t7","t8","t9","undefined","canvasRef","containerRef","t11","Symbol","for","historyRef","lastUpdateRef","processingAnimationRef","t12","lastActiveDataRef","transitionProgressRef","t13","staticBarsRef","needsRedrawRef","gradientCacheRef","lastWidthRef","heightStyle","t14","t15","canvas","current","container","resizeObserver","ResizeObserver","rect","getBoundingClientRect","dpr","window","devicePixelRatio","width","style","ctx","getContext","scale","observe","disconnect","t16","t17","time","animateProcessing","Math","min","processingData","barCount","floor","halfCount","i","normalizedPosition","centerWeight","abs","wave1","sin","wave2","wave3","cos","combinedWave","processingValue","finalValue","length","lastDataIndex","lastValue","push","max","i_0","normalizedPosition_0","centerWeight_0","wave1_0","wave2_0","wave3_0","combinedWave_0","processingValue_0","finalValue_0","lastDataIndex_0","lastValue_0","requestAnimationFrame","cancelAnimationFrame","hasData","fadeProgress","fadeToIdle","map","value","value_0","t18","t19","canvas_0","ctx_0","rafId","animate","currentTime","rect_0","level","barCount_0","halfCount_0","newBars","i_1","distanceFromCenter","value_1","i_2","distanceFromCenter_0","value_2","shift","clearRect","computedBarColor","getComputedStyle","color","step","barCount_1","centerY","dataToRender","i_3","value_3","x","barHeight","y","fillStyle","globalAlpha","beginPath","roundRect","fill","fillRect","i_4","dataIndex","value_4","x_0","barHeight_0","y_0","gradient","createLinearGradient","fadePercent","addColorStop","globalCompositeOperation","t20","t21","t22","t23","t24","t25","Mic","MicOff","Phone","PhoneOff","Volume2","cn","Button","LiveWaveform","AudioLevelData","ToolCallData","VoiceIndicatorProps","isActive","isConnecting","isMuted","audioLevel","toolCall","onStart","onStop","onToggleMute","className","VoiceIndicator","t0","$","_c","micLevel","speakerLevel","toolCallStatus","status","error","t1","getBorderClass","t2","t3","t4","Symbol","for","t5","t6","t7","t8","t9","t10","t11","t12","t13","t14","t15","t16","t17","t18","t19","t20","t21","t22","t23","t24","toolName","t25","t26","ActionBarPrimitive","BranchPickerPrimitive","ComposerPrimitive","ErrorPrimitive","MessagePrimitive","ThreadPrimitive","ArrowDownIcon","ArrowUpIcon","CheckIcon","ChevronLeftIcon","ChevronRightIcon","CopyIcon","PencilIcon","Phone","RefreshCwIcon","Square","AnimatePresence","domAnimation","LazyMotion","MotionConfig","m","cn","useOptionalVoiceModeContext","ComposerAddAttachment","ComposerAttachments","UserMessageAttachments","Button","MarkdownText","RemoteMCPSettings","ToolFallback","TooltipIconButton","VoiceIndicator","FC","ThreadWithVoice","UserMessage","EditComposer","AssistantMessage","ComposerArea","$","_c","voiceMode","t0","Symbol","for","t1","isSupported","isActive","isConnecting","opacity","y","duration","isMuted","audioLevel","toolCall","startSession","stopSession","toggleMute","t2","t3","t4","TextComposer","t5","t6","t7","t8","t9","ThreadScrollToBottom","ThreadWelcome","delay","ThreadSuggestions","title","label","action","map","_temp","MessageError","Text","tools","Fallback","AssistantActionBar","UserActionBar","BranchPicker","Root","Props","className","rest","suggestedAction","index","c","_c","AssistantModalPrimitive","ChevronDownIcon","forwardRef","ThreadWithVoice","TooltipIconButton","FC","AssistantModal","$","t0","Symbol","for","t1","AssistantModalButtonProps","AssistantModalButton","HTMLButtonElement","ref","rest","state","tooltip","t2","t3","t4","displayName","useAssistantTool","useMCPTools","CallToolResult","ToolWithSource","FC","ToolBridge","tool","callTool","name","args","Record","Promise","toolName","description","parameters","inputSchema","execute","result","textContent","content","map","c","text","JSON","stringify","join","error","console","MCPToolRegistry","$","_c","tools","t0","t1","_sourceId","MCPToolsDebug","sources","Symbol","for","t2","Array","from","values","_temp2","t3","length","t4","_temp3","t5","t6","source","id","state","message","WEBMCP_STYLES","injectStyles","document","styleId","getElementById","style","createElement","id","textContent","head","appendChild","AssistantRuntimeProvider","AssistantChatTransport","useChatRuntime","r2wc","lastAssistantMessageIsCompleteWithToolCalls","useMemo","AssistantModal","MCPToolRegistry","injectStyles","MCPToolsProvider","VoiceModeProvider","FC","EmbeddedAgentProps","appId","apiBase","tokenEndpoint","autoConnectLocal","onToolsChange","tools","onVoiceError","error","onVoiceConnect","onVoiceDisconnect","duration","EmbeddedAgent","t0","$","_c","t1","undefined","chatApi","t2","api","transport","t3","sendAutomaticallyWhen","_temp","runtime","resolvedTokenEndpoint","window","console","debug","t4","t5","WebMCPAgentElement","Parameters","props","registerWebMCPAgent","tagName","customElements","get","define","messages"],"sources":["../src/lib/utils.ts","../src/lib/constants.ts","../src/services/realtime/audio-analyzer.ts","../src/services/realtime/event-emitter.ts","../src/services/realtime/message-handler.ts","../src/services/realtime/tool-manager.ts","../src/services/realtime/webrtc-manager.ts","../src/services/realtime/openai-realtime-service.ts","../src/services/realtime/types.ts","../src/hooks/useVoiceMode.ts","../src/providers/VoiceModeProvider.tsx","../src/components/avatar.tsx","../src/components/dialog.tsx","../src/components/tooltip.tsx","../src/components/button.tsx","../src/components/tooltip-icon-button.tsx","../src/components/attachment.tsx","../src/components/markdown-text.tsx","../src/lib/mcp-transport.ts","../src/providers/MCPToolsProvider.tsx","../src/components/RemoteMCPSettings.tsx","../src/components/tool-fallback.tsx","../src/components/live-waveform.tsx","../src/components/voice-indicator.tsx","../src/components/thread-with-voice.tsx","../src/components/assistant-modal.tsx","../src/components/MCPToolRegistry.tsx","../src/generated/inline-styles.ts","../src/web-component.tsx"],"sourcesContent":["import { clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nimport type { ClassValue } from 'clsx'\n\n/**\n * Merges Tailwind CSS classes with proper precedence handling.\n * Combines clsx for conditional classes and tailwind-merge for deduplication.\n */\nexport function cn(...inputs: ClassValue[]): string {\n\treturn twMerge(clsx(inputs))\n}\n","/**\n * Shared Constants\n *\n * Centralized location for all magic numbers, timeouts, and configuration values.\n * Having these in one place makes the codebase more maintainable and easier to tune.\n */\n\n// ============================================================================\n// MCP Connection Constants\n// ============================================================================\n\n/** Maximum number of reconnection attempts before giving up */\nexport const MCP_MAX_RECONNECT_ATTEMPTS = 5\n\n/** Base delay in milliseconds for exponential backoff reconnection */\nexport const MCP_BASE_RECONNECT_DELAY_MS = 1000\n\n/** Maximum reconnect delay in milliseconds (caps exponential backoff) */\nexport const MCP_MAX_RECONNECT_DELAY_MS = 30000\n\n/** Delay before auto-connecting to tab-based MCP sources (allows server initialization) */\nexport const MCP_TAB_CONNECT_DELAY_MS = 100\n\n// ============================================================================\n// Voice Mode / Realtime API Constants\n// ============================================================================\n\n/** Number of frequency bins for audio visualization */\nexport const AUDIO_FREQUENCY_BINS = 32\n\n/** Default OpenAI Realtime model */\nexport const REALTIME_DEFAULT_MODEL = 'gpt-4o-realtime-preview-2024-12-17'\n\n/** Default voice for OpenAI Realtime */\nexport const REALTIME_DEFAULT_VOICE = 'verse'\n\n/** Default OpenAI Realtime API URL */\nexport const REALTIME_DEFAULT_API_URL = 'https://api.openai.com/v1/realtime'\n\n/** Interval in milliseconds for audio visualization updates (~60fps) */\nexport const AUDIO_VISUALIZATION_INTERVAL_MS = 16\n\n/** Delay in milliseconds before requesting response after tool execution */\nexport const RESPONSE_REQUEST_DELAY_MS = 150\n\n/** Duration to show completed tool calls before clearing (success) */\nexport const TOOL_CALL_DISPLAY_DURATION_MS = 1500\n\n/** Duration to show failed tool calls before clearing (error) */\nexport const TOOL_CALL_ERROR_DISPLAY_DURATION_MS = 3000\n\n// ============================================================================\n// Waveform Visualization Constants\n// ============================================================================\n\n/** Default history size for scrolling waveform mode */\nexport const WAVEFORM_HISTORY_SIZE = 60\n\n/** Update rate in milliseconds for waveform visualization */\nexport const WAVEFORM_UPDATE_RATE_MS = 30\n\n// ============================================================================\n// WebSocket States (for type-safe comparisons)\n// ============================================================================\n\n/** WebSocket OPEN state value */\nexport const WEBSOCKET_OPEN = 1\n\n// ============================================================================\n// Logging Configuration\n// ============================================================================\n\n/**\n * Enable debug logging for development.\n * Can be enabled by setting window.__WEBMCP_DEBUG__ = true in the browser console.\n * In production builds, this defaults to false.\n */\nexport const DEBUG_LOGGING_ENABLED =\n\ttypeof window !== 'undefined' &&\n\t(window as { __WEBMCP_DEBUG__?: boolean }).__WEBMCP_DEBUG__ === true\n\n/**\n * Conditional debug logger that only logs when DEBUG_LOGGING_ENABLED is true.\n * Can be enabled at runtime by setting window.__WEBMCP_DEBUG__ = true\n *\n * @param component - The component or service name for the log prefix\n * @param message - The log message\n * @param data - Optional data to include in the log\n */\nexport function debugLog(component: string, message: string, data?: unknown): void {\n\t// Check the flag at runtime to allow enabling after page load\n\tconst isDebugEnabled =\n\t\ttypeof window !== 'undefined' &&\n\t\t(window as { __WEBMCP_DEBUG__?: boolean }).__WEBMCP_DEBUG__ === true\n\n\tif (isDebugEnabled) {\n\t\tif (data !== undefined) {\n\t\t\tconsole.log(`[${component}] ${message}`, data)\n\t\t} else {\n\t\t\tconsole.log(`[${component}] ${message}`)\n\t\t}\n\t}\n}\n","import { debugLog } from '../../lib/constants'\n\n/**\n * Audio analyzer for processing microphone and speaker audio streams.\n * Uses Web Audio API to analyze audio levels and frequency data.\n */\nexport class AudioAnalyzer {\n\tprivate audioContext: AudioContext | null = null\n\tprivate analyser: AnalyserNode | null = null\n\tprivate source: MediaStreamAudioSourceNode | null = null\n\tprivate dataArray: Uint8Array<ArrayBuffer> | null = null\n\tprivate animationId: number | null = null\n\n\t/**\n\t * Initialize the audio analyzer with a media stream\n\t * @param stream - MediaStream to analyze (typically from microphone or speaker)\n\t */\n\tasync initialize(stream: MediaStream): Promise<void> {\n\t\t// Log stream info for debugging\n\t\tconst audioTracks = stream.getAudioTracks()\n\t\tdebugLog('AudioAnalyzer', 'Initializing with stream', {\n\t\t\tstreamId: stream.id,\n\t\t\taudioTracks: audioTracks.length,\n\t\t\ttrackInfo: audioTracks.map((t) => ({\n\t\t\t\tid: t.id,\n\t\t\t\tlabel: t.label,\n\t\t\t\tenabled: t.enabled,\n\t\t\t\tmuted: t.muted,\n\t\t\t\treadyState: t.readyState,\n\t\t\t})),\n\t\t})\n\n\t\tthis.audioContext = new AudioContext()\n\t\tdebugLog('AudioAnalyzer', `AudioContext created, initial state: ${this.audioContext.state}`)\n\n\t\t// Always try to resume - some browsers need this regardless of reported state\n\t\ttry {\n\t\t\tawait this.audioContext.resume()\n\t\t\tdebugLog('AudioAnalyzer', `AudioContext after resume: ${this.audioContext.state}`)\n\t\t} catch (err) {\n\t\t\tconsole.warn('[AudioAnalyzer] Failed to resume AudioContext:', err)\n\t\t}\n\n\t\tthis.analyser = this.audioContext.createAnalyser()\n\t\tthis.analyser.fftSize = 256\n\t\tthis.analyser.smoothingTimeConstant = 0.8\n\n\t\tthis.source = this.audioContext.createMediaStreamSource(stream)\n\t\tthis.source.connect(this.analyser)\n\n\t\tconst bufferLength = this.analyser.frequencyBinCount\n\t\tthis.dataArray = new Uint8Array(new ArrayBuffer(bufferLength))\n\n\t\tdebugLog('AudioAnalyzer', 'Setup complete', {\n\t\t\tsampleRate: this.audioContext.sampleRate,\n\t\t\tfrequencyBinCount: bufferLength,\n\t\t\tcontextState: this.audioContext.state,\n\t\t})\n\t}\n\n\tgetAudioLevel(): number {\n\t\tif (!this.analyser || !this.dataArray) return 0\n\n\t\tthis.analyser.getByteFrequencyData(this.dataArray)\n\n\t\t// Calculate average volume\n\t\tlet sum = 0\n\t\tfor (let i = 0; i < this.dataArray.length; i++) {\n\t\t\tsum += this.dataArray[i]\n\t\t}\n\t\tconst average = sum / this.dataArray.length\n\n\t\t// Normalize to 0-1 range\n\t\treturn Math.min(1, average / 128)\n\t}\n\n\tgetFrequencyData(bins = 16): number[] {\n\t\tif (!this.analyser || !this.dataArray) return new Array(bins).fill(0)\n\n\t\tthis.analyser.getByteFrequencyData(this.dataArray)\n\n\t\tconst result: number[] = []\n\t\tconst samplesPerBin = Math.floor(this.dataArray.length / bins)\n\n\t\tfor (let i = 0; i < bins; i++) {\n\t\t\tlet sum = 0\n\t\t\tfor (let j = 0; j < samplesPerBin; j++) {\n\t\t\t\tsum += this.dataArray[i * samplesPerBin + j]\n\t\t\t}\n\t\t\t// Normalize to 0-1 range\n\t\t\tresult.push(Math.min(1, sum / samplesPerBin / 255))\n\t\t}\n\n\t\treturn result\n\t}\n\n\tstartAnalysis(callback: (level: number, frequencies: number[]) => void): void {\n\t\tconst analyze = () => {\n\t\t\tconst level = this.getAudioLevel()\n\t\t\tconst frequencies = this.getFrequencyData()\n\t\t\tcallback(level, frequencies)\n\t\t\tthis.animationId = requestAnimationFrame(analyze)\n\t\t}\n\t\tanalyze()\n\t}\n\n\tstopAnalysis(): void {\n\t\tif (this.animationId !== null) {\n\t\t\tcancelAnimationFrame(this.animationId)\n\t\t\tthis.animationId = null\n\t\t}\n\t}\n\n\tdestroy(): void {\n\t\tthis.stopAnalysis()\n\n\t\tif (this.source) {\n\t\t\tthis.source.disconnect()\n\t\t\tthis.source = null\n\t\t}\n\n\t\tif (this.analyser) {\n\t\t\tthis.analyser.disconnect()\n\t\t\tthis.analyser = null\n\t\t}\n\n\t\tif (this.audioContext) {\n\t\t\tvoid this.audioContext.close()\n\t\t\tthis.audioContext = null\n\t\t}\n\n\t\tthis.dataArray = null\n\t}\n}\n","import type { EventCallback, IEventEmitter } from './types'\n\nexport class EventEmitter implements IEventEmitter {\n\tprivate listeners = new Map<string, Set<EventCallback>>()\n\n\ton(event: string, callback: EventCallback): void {\n\t\tif (!this.listeners.has(event)) {\n\t\t\tthis.listeners.set(event, new Set())\n\t\t}\n\t\tconst listeners = this.listeners.get(event)\n\t\tif (listeners) {\n\t\t\tlisteners.add(callback)\n\t\t}\n\t}\n\n\toff(event: string, callback: EventCallback): void {\n\t\tthis.listeners.get(event)?.delete(callback)\n\t}\n\n\temit(event: string, data: unknown): void {\n\t\tthis.listeners.get(event)?.forEach((callback) => {\n\t\t\ttry {\n\t\t\t\tcallback(data)\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(`Error in event listener for ${event}:`, error)\n\t\t\t}\n\t\t})\n\t}\n\n\tremoveAllListeners(event?: string): void {\n\t\tif (event) {\n\t\t\tthis.listeners.delete(event)\n\t\t} else {\n\t\t\tthis.listeners.clear()\n\t\t}\n\t}\n\n\tlistenerCount(event: string): number {\n\t\treturn this.listeners.get(event)?.size || 0\n\t}\n}\n","import { RESPONSE_REQUEST_DELAY_MS } from '../../lib/constants'\n\nimport type { EventEmitter } from './event-emitter'\nimport type { ToolManager } from './tool-manager'\nimport type { FunctionCall, RealtimeMessage } from './types'\n\n/**\n * Type for response output items from OpenAI Realtime API\n */\ninterface ResponseOutputItem {\n\ttype: string\n\tstatus?: string\n\tname?: string\n\tcall_id?: string\n\targuments?: string\n}\n\n/**\n * Type guard to check if an output item is a completed function call\n */\nfunction isCompletedFunctionCall(item: ResponseOutputItem): item is ResponseOutputItem & {\n\tname: string\n\tcall_id: string\n\targuments: string\n} {\n\treturn (\n\t\titem.type === 'function_call' &&\n\t\titem.status === 'completed' &&\n\t\ttypeof item.name === 'string' &&\n\t\ttypeof item.call_id === 'string'\n\t)\n}\n\nexport class MessageHandler {\n\tprivate isProcessingResponse = false\n\tprivate pendingFunctionCalls = new Set<string>()\n\tprivate responseRequestTimer: ReturnType<typeof setTimeout> | null = null\n\tprivate hasRequestedResponse = false\n\n\tconstructor(\n\t\tprivate toolManager: ToolManager,\n\t\tprivate eventEmitter: EventEmitter\n\t) {}\n\n\tasync handleMessage(data: string, dataChannel: RTCDataChannel): Promise<void> {\n\t\tlet msg: RealtimeMessage\n\n\t\ttry {\n\t\t\tmsg = JSON.parse(data) as RealtimeMessage\n\t\t} catch (error) {\n\t\t\tconsole.error('Failed to parse realtime message:', error)\n\t\t\treturn\n\t\t}\n\n\t\t// Log all incoming events for debugging\n\t\t// Route message to appropriate handler\n\t\tswitch (msg.type) {\n\t\t\tcase 'response.created':\n\t\t\t\tthis.handleResponseCreated(msg)\n\t\t\t\tbreak\n\n\t\t\tcase 'response.done':\n\t\t\t\tawait this.handleResponseDone(msg, dataChannel)\n\t\t\t\tbreak\n\n\t\t\tcase 'response.function_call_arguments.done':\n\t\t\t\tthis.handleFunctionCallArguments()\n\t\t\t\tbreak\n\n\t\t\tcase 'input_audio_buffer.speech_started':\n\t\t\tcase 'input_audio_buffer.speech_stopped':\n\t\t\t\tthis.handleSpeechEvents(msg)\n\t\t\t\tbreak\n\n\t\t\t// GA API: response.output_audio events\n\t\t\tcase 'response.output_audio.delta':\n\t\t\tcase 'response.output_audio.done':\n\t\t\t\tthis.handleAudioEvents(msg)\n\t\t\t\tbreak\n\n\t\t\t// GA API: response.output_audio_transcript and response.output_text events\n\t\t\tcase 'response.output_audio_transcript.delta':\n\t\t\tcase 'response.output_audio_transcript.done':\n\t\t\tcase 'response.output_text.delta':\n\t\t\tcase 'response.output_text.done':\n\t\t\t\tthis.handleTranscriptEvents(msg)\n\t\t\t\tbreak\n\n\t\t\tcase 'conversation.item.input_audio_transcription.completed':\n\t\t\t\tthis.handleUserTranscript(msg)\n\t\t\t\tbreak\n\n\t\t\tcase 'error':\n\t\t\t\tthis.handleError(msg)\n\t\t\t\tbreak\n\n\t\t\tcase 'session.created':\n\t\t\tcase 'session.updated':\n\t\t\t\tthis.handleSessionEvents(msg)\n\t\t\t\tbreak\n\n\t\t\tcase 'conversation.item.created':\n\t\t\tcase 'input_audio_buffer.committed':\n\t\t\t\t// Log only, no action needed\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tprivate handleResponseCreated(_msg: RealtimeMessage): void {\n\t\tthis.isProcessingResponse = true\n\t\tthis.hasRequestedResponse = false\n\t}\n\n\tprivate async handleResponseDone(\n\t\tmsg: RealtimeMessage,\n\t\tdataChannel: RTCDataChannel\n\t): Promise<void> {\n\t\t// Safely extract response output with proper type checking\n\t\tconst outputItems = this.extractResponseOutput(msg.response)\n\n\t\t// Check if there are function calls to process\n\t\tconst hasFunctionCalls = outputItems.some(isCompletedFunctionCall)\n\n\t\t// Only set isProcessingResponse to false if there are no function calls\n\t\tif (!hasFunctionCalls) {\n\t\t\tthis.isProcessingResponse = false\n\t\t\tthis.hasRequestedResponse = false\n\t\t}\n\n\t\t// Process any function calls in the response\n\t\tif (outputItems.length > 0) {\n\t\t\t// Extract function calls with proper type narrowing\n\t\t\tconst functionCalls: FunctionCall[] = outputItems\n\t\t\t\t.filter(isCompletedFunctionCall)\n\t\t\t\t.map((item) => ({\n\t\t\t\t\tname: item.name,\n\t\t\t\t\tcall_id: item.call_id,\n\t\t\t\t\targuments: item.arguments ?? '',\n\t\t\t\t}))\n\n\t\t\tfor (const functionCall of functionCalls) {\n\t\t\t\tif (!this.pendingFunctionCalls.has(functionCall.call_id)) {\n\t\t\t\t\tthis.pendingFunctionCalls.add(functionCall.call_id)\n\t\t\t\t\tawait this.executeFunctionCall(functionCall, dataChannel)\n\t\t\t\t} else {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`[MessageHandler] Skipping duplicate function call: ${functionCall.name} (${functionCall.call_id})`\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// After all function calls are processed, check if we need to request a response\n\t\t\tif (functionCalls.length > 0 && this.pendingFunctionCalls.size === 0) {\n\t\t\t\tthis.requestResponseIfNeeded(dataChannel)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Safely extract response output array from response object\n\t */\n\tprivate extractResponseOutput(response: unknown): ResponseOutputItem[] {\n\t\tif (!response || typeof response !== 'object') {\n\t\t\treturn []\n\t\t}\n\n\t\tconst r = response as Record<string, unknown>\n\t\tif (!Array.isArray(r.output)) {\n\t\t\treturn []\n\t\t}\n\n\t\t// Filter to only valid output items\n\t\treturn r.output.filter(\n\t\t\t(item): item is ResponseOutputItem =>\n\t\t\t\titem !== null &&\n\t\t\t\ttypeof item === 'object' &&\n\t\t\t\ttypeof (item as ResponseOutputItem).type === 'string'\n\t\t)\n\t}\n\n\tprivate handleFunctionCallArguments(): void {\n\t\t// Function call arguments are being accumulated\n\t\t// Actual execution happens in handleResponseDone\n\t}\n\n\tprivate handleSpeechEvents(msg: RealtimeMessage): void {\n\t\tconst eventType =\n\t\t\tmsg.type === 'input_audio_buffer.speech_started' ? 'speech_started' : 'speech_stopped'\n\t\tthis.eventEmitter.emit(eventType, msg)\n\t}\n\n\tprivate handleAudioEvents(msg: RealtimeMessage): void {\n\t\tconst eventType = msg.type === 'response.output_audio.delta' ? 'audio_started' : 'audio_stopped'\n\t\tconsole.log(`[MessageHandler] Assistant ${eventType}`, {\n\t\t\ttype: msg.type,\n\t\t\thasAudio: !!(msg as { delta?: unknown }).delta,\n\t\t})\n\t\tthis.eventEmitter.emit(eventType, msg)\n\t}\n\n\tprivate handleTranscriptEvents(msg: RealtimeMessage): void {\n\t\t// GA API event name mappings\n\t\tconst eventMap: Record<string, string> = {\n\t\t\t'response.output_audio_transcript.delta': 'assistant_transcript',\n\t\t\t'response.output_audio_transcript.done': 'assistant_transcript_done',\n\t\t\t'response.output_text.delta': 'text',\n\t\t\t'response.output_text.done': 'text_done',\n\t\t}\n\n\t\tconst eventType = eventMap[msg.type]\n\t\tif (eventType) {\n\t\t\tthis.eventEmitter.emit(eventType, msg)\n\t\t}\n\t}\n\n\tprivate handleUserTranscript(msg: RealtimeMessage): void {\n\t\tthis.eventEmitter.emit('user_transcript_done', { text: msg.transcript })\n\t}\n\n\tprivate handleSessionEvents(_msg: RealtimeMessage): void {\n\t\t// Session events are handled but no action is needed at this time\n\t}\n\n\tprivate handleError(msg: RealtimeMessage): void {\n\t\tconsole.error('Realtime API error:', msg)\n\t\tthis.eventEmitter.emit('error', msg)\n\t\tthis.isProcessingResponse = false\n\t\tthis.hasRequestedResponse = false\n\n\t\t// Clear any pending response timer\n\t\tif (this.responseRequestTimer) {\n\t\t\tclearTimeout(this.responseRequestTimer)\n\t\t\tthis.responseRequestTimer = null\n\t\t}\n\t}\n\n\tprivate async executeFunctionCall(\n\t\tfunctionCall: FunctionCall,\n\t\tdataChannel: RTCDataChannel\n\t): Promise<void> {\n\t\tconst { name, call_id } = functionCall\n\n\t\ttry {\n\t\t\t// Emit start event\n\t\t\tthis.eventEmitter.emit('tool_call_started', { name })\n\n\t\t\t// Execute tool\n\t\t\tconst result = await this.toolManager.executeToolCall(functionCall)\n\n\t\t\t// Check if data channel is still open before sending\n\t\t\tif (dataChannel.readyState !== 'open') {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[MessageHandler] Cannot send tool result for ${name}: DataChannel is ${dataChannel.readyState}`\n\t\t\t\t)\n\t\t\t\tthis.eventEmitter.emit('tool_call_completed', {\n\t\t\t\t\tname,\n\t\t\t\t\terror: 'DataChannel closed during tool execution',\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Send result back\n\t\t\tconst response = {\n\t\t\t\ttype: 'conversation.item.create',\n\t\t\t\titem: {\n\t\t\t\t\ttype: 'function_call_output',\n\t\t\t\t\tcall_id: call_id,\n\t\t\t\t\toutput: JSON.stringify(\n\t\t\t\t\t\tresult.success\n\t\t\t\t\t\t\t? result.data\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\terror: result.error,\n\t\t\t\t\t\t\t\t\tsuccess: false,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tdataChannel.send(JSON.stringify(response))\n\n\t\t\t// Emit completion event\n\t\t\tthis.eventEmitter.emit('tool_call_completed', {\n\t\t\t\tname,\n\t\t\t\terror: result.success ? undefined : result.error,\n\t\t\t})\n\t\t} catch (error) {\n\t\t\tconsole.error(`[MessageHandler] Tool execution failed for ${name}:`, error)\n\t\t\tthis.sendToolError(call_id, String(error), dataChannel)\n\t\t} finally {\n\t\t\tthis.pendingFunctionCalls.delete(call_id)\n\n\t\t\t// After removing this function call, check if all are complete\n\t\t\tif (this.pendingFunctionCalls.size === 0) {\n\t\t\t\t// All function calls are done, now we can request a response\n\t\t\t\tthis.isProcessingResponse = false\n\t\t\t\tthis.hasRequestedResponse = false\n\t\t\t\tthis.requestResponseIfNeeded(dataChannel)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate sendToolError(call_id: string, error: string, dataChannel: RTCDataChannel): void {\n\t\t// Check if data channel is still open before sending error\n\t\tif (dataChannel.readyState !== 'open') {\n\t\t\tconsole.error(\n\t\t\t\t`[MessageHandler] Cannot send tool error: DataChannel is ${dataChannel.readyState}`\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\tconst errorResponse = {\n\t\t\ttype: 'conversation.item.create',\n\t\t\titem: {\n\t\t\t\ttype: 'function_call_output',\n\t\t\t\tcall_id: call_id,\n\t\t\t\toutput: JSON.stringify({ error, success: false }),\n\t\t\t},\n\t\t}\n\n\t\tdataChannel.send(JSON.stringify(errorResponse))\n\t}\n\n\tprivate requestResponseIfNeeded(dataChannel: RTCDataChannel): void {\n\t\t// Clear any existing timer\n\t\tif (this.responseRequestTimer) {\n\t\t\tclearTimeout(this.responseRequestTimer)\n\t\t\tthis.responseRequestTimer = null\n\t\t}\n\n\t\t// Set a new timer to request response (delay prevents race conditions)\n\t\tthis.responseRequestTimer = setTimeout(() => {\n\t\t\tif (\n\t\t\t\t!this.isProcessingResponse &&\n\t\t\t\t!this.hasRequestedResponse &&\n\t\t\t\tdataChannel.readyState === 'open' &&\n\t\t\t\tthis.pendingFunctionCalls.size === 0\n\t\t\t) {\n\t\t\t\tthis.hasRequestedResponse = true\n\t\t\t\tthis.isProcessingResponse = true\n\t\t\t\tdataChannel.send(JSON.stringify({ type: 'response.create' }))\n\t\t\t}\n\t\t\tthis.responseRequestTimer = null\n\t\t}, RESPONSE_REQUEST_DELAY_MS)\n\t}\n\n\treset(): void {\n\t\tthis.isProcessingResponse = false\n\t\tthis.hasRequestedResponse = false\n\t\tthis.pendingFunctionCalls.clear()\n\n\t\t// Clear any pending response timer\n\t\tif (this.responseRequestTimer) {\n\t\t\tclearTimeout(this.responseRequestTimer)\n\t\t\tthis.responseRequestTimer = null\n\t\t}\n\t}\n}\n","import type { FunctionCall, OpenAITool, ToolExecutionResult } from './types'\n\nexport interface RegisteredTool {\n\tname: string\n\tdescription: string\n\tinputSchema?: Record<string, unknown>\n}\n\nexport type ToolExecutor = (name: string, args: Record<string, unknown>) => Promise<unknown>\n\nexport class ToolManager {\n\tprivate tools: RegisteredTool[] = []\n\tprivate executor: ToolExecutor | null = null\n\tprivate lastSentToolSignature = ''\n\n\tsetTools(tools: RegisteredTool[]): void {\n\t\tthis.tools = tools\n\t}\n\n\tsetExecutor(executor: ToolExecutor): void {\n\t\tthis.executor = executor\n\t}\n\n\tresetSession(): void {\n\t\tconsole.log('[ToolManager] resetSession called (lastSentToolSignature preserved)')\n\t}\n\n\tprivate getToolSignature(tools: RegisteredTool[]): string {\n\t\treturn tools\n\t\t\t.map((t) => t.name)\n\t\t\t.sort()\n\t\t\t.join('|')\n\t}\n\n\thasToolsChanged(): boolean {\n\t\tconst currentSignature = this.getToolSignature(this.tools)\n\t\treturn currentSignature !== this.lastSentToolSignature\n\t}\n\n\tmarkToolsSent(): void {\n\t\tthis.lastSentToolSignature = this.getToolSignature(this.tools)\n\t}\n\n\tformatToolsForOpenAI(): OpenAITool[] {\n\t\t// Built-in tools\n\t\tconst builtInTools: OpenAITool[] = [\n\t\t\t{\n\t\t\t\ttype: 'function',\n\t\t\t\tname: 'list_available_tools',\n\t\t\t\tdescription:\n\t\t\t\t\t'List all currently available tools that can be called. Use this when you need to know what tools are available or when the user asks about available capabilities.',\n\t\t\t\tparameters: {\n\t\t\t\t\ttype: 'object',\n\t\t\t\t\tproperties: {},\n\t\t\t\t\trequired: [],\n\t\t\t\t},\n\t\t\t},\n\t\t]\n\n\t\t// Registered tools\n\t\tconst registeredTools = this.tools.map((tool) => ({\n\t\t\ttype: 'function' as const,\n\t\t\tname: tool.name,\n\t\t\tdescription: tool.description || `Execute ${tool.name} action`,\n\t\t\tparameters: this.validateToolSchema(tool.inputSchema),\n\t\t}))\n\n\t\treturn [...builtInTools, ...registeredTools]\n\t}\n\n\tprivate validateToolSchema(schema: Record<string, unknown> | undefined): {\n\t\ttype: string\n\t\tproperties?: Record<string, unknown>\n\t\trequired?: string[]\n\t} {\n\t\tif (!schema) {\n\t\t\treturn { type: 'object', properties: {}, required: [] }\n\t\t}\n\n\t\tconst result: {\n\t\t\ttype: string\n\t\t\tproperties?: Record<string, unknown>\n\t\t\trequired?: string[]\n\t\t} = { type: 'object', ...schema }\n\n\t\tif (result.type === 'object') {\n\t\t\tresult.properties = (result.properties as Record<string, unknown>) || {}\n\n\t\t\t// Generate required array if not present\n\t\t\tif (!result.required && result.properties) {\n\t\t\t\tresult.required = Object.entries(result.properties)\n\t\t\t\t\t.filter(([, prop]) => {\n\t\t\t\t\t\tif (prop && typeof prop === 'object') {\n\t\t\t\t\t\t\tconst p = prop as { optional?: boolean; nullable?: boolean; type?: string }\n\t\t\t\t\t\t\treturn !p.optional && !p.nullable && p.type !== 'null'\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn false\n\t\t\t\t\t})\n\t\t\t\t\t.map(([key]) => key)\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n\n\tasync executeToolCall(functionCall: FunctionCall): Promise<ToolExecutionResult> {\n\t\tconst { name, arguments: argsString } = functionCall\n\n\t\t// Handle built-in tools\n\t\tif (name === 'list_available_tools') {\n\t\t\treturn this.executeListTools()\n\t\t}\n\n\t\t// Check if executor is set\n\t\tif (!this.executor) {\n\t\t\treturn { success: false, error: 'Tool executor not configured' }\n\t\t}\n\n\t\t// Find the tool\n\t\tconst tool = this.tools.find((t) => t.name === name)\n\t\tif (!tool) {\n\t\t\tconsole.error(`[ToolManager] Tool not found: ${name}`)\n\t\t\treturn { success: false, error: `Tool not found: ${name}` }\n\t\t}\n\n\t\t// Parse arguments\n\t\tlet args: Record<string, unknown>\n\t\ttry {\n\t\t\targs = argsString ? (JSON.parse(argsString) as Record<string, unknown>) : {}\n\t\t} catch (error) {\n\t\t\tconsole.error('[ToolManager] Failed to parse arguments:', error)\n\t\t\treturn { success: false, error: 'Invalid arguments format' }\n\t\t}\n\n\t\ttry {\n\t\t\tconst result = await this.executor(name, args)\n\t\t\treturn { success: true, data: result }\n\t\t} catch (error) {\n\t\t\tconsole.error(`[ToolManager] Tool execution error for ${name}:`, error)\n\t\t\treturn { success: false, error: String(error) }\n\t\t}\n\t}\n\n\tprivate executeListTools(): ToolExecutionResult {\n\t\tconst toolList = this.tools.map((tool) => ({\n\t\t\tname: tool.name,\n\t\t\tdescription: tool.description || 'No description available',\n\t\t\tparameters: tool.inputSchema || {},\n\t\t}))\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\ttools: toolList,\n\t\t\t\tcount: toolList.length,\n\t\t\t\tmessage:\n\t\t\t\t\ttoolList.length > 0\n\t\t\t\t\t\t? `Found ${toolList.length} available tools`\n\t\t\t\t\t\t: 'No tools currently available',\n\t\t\t},\n\t\t}\n\t}\n\n\tgetChangesSummary(): { added: string[]; removed: string[]; total: number } | null {\n\t\tif (!this.hasToolsChanged()) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst prevTools = this.lastSentToolSignature.split('|').filter(Boolean)\n\t\tconst currTools = this.tools.map((t) => t.name)\n\n\t\tconst prevSet = new Set(prevTools)\n\t\tconst currSet = new Set(currTools)\n\n\t\tconst added = currTools.filter((name) => !prevSet.has(name))\n\t\tconst removed = prevTools.filter((name) => !currSet.has(name))\n\n\t\treturn {\n\t\t\tadded,\n\t\t\tremoved,\n\t\t\ttotal: this.tools.length,\n\t\t}\n\t}\n}\n","import {\n\tdebugLog,\n\tREALTIME_DEFAULT_API_URL,\n\tREALTIME_DEFAULT_MODEL,\n\tREALTIME_DEFAULT_VOICE,\n} from '../../lib/constants'\n\nimport type { RealtimeConfig, RealtimeSession } from './types'\n\ninterface EphemeralTokenResponse {\n\tclient_secret?: {\n\t\tvalue?: string\n\t}\n}\n\nfunction hasClientSecret(response: unknown): response is {\n\tclient_secret: { value: string }\n} {\n\tif (!response || typeof response !== 'object') {\n\t\treturn false\n\t}\n\tconst secret = (response as EphemeralTokenResponse).client_secret\n\treturn typeof secret?.value === 'string'\n}\n\nexport class WebRTCManager {\n\tprivate tokenEndpoint: string\n\n\tconstructor(tokenEndpoint: string) {\n\t\tthis.tokenEndpoint = tokenEndpoint\n\t}\n\n\tasync createSession(config: RealtimeConfig = {}): Promise<RealtimeSession> {\n\t\tconst model = config.model || REALTIME_DEFAULT_MODEL\n\t\tconst voice = config.voice || REALTIME_DEFAULT_VOICE\n\t\tconst apiUrl = config.apiUrl || REALTIME_DEFAULT_API_URL\n\n\t\t// Get ephemeral token from our backend\n\t\tconst ephemeralKey = await this.getEphemeralToken(model, voice)\n\n\t\t// Create peer connection\n\t\tconst pc = new RTCPeerConnection()\n\n\t\t// Set up audio playback\n\t\tconst audioElement = this.createAudioElement()\n\t\t// Track streams\n\t\tlet remoteStream: MediaStream | null = null\n\t\tpc.ontrack = (e) => {\n\t\t\tremoteStream = e.streams[0]\n\t\t\taudioElement.srcObject = remoteStream\n\t\t\tdebugLog('WebRTC', 'Remote audio stream received and connected to audio element', {\n\t\t\t\tstreamId: remoteStream.id,\n\t\t\t\ttracks: remoteStream.getTracks().length,\n\t\t\t})\n\t\t}\n\n\t\t// Add microphone\n\t\tconst localStream = await this.getUserMedia()\n\t\tdebugLog('WebRTC', 'Local microphone stream acquired', {\n\t\t\tstreamId: localStream.id,\n\t\t\ttracks: localStream.getTracks().map((t) => ({\n\t\t\t\tkind: t.kind,\n\t\t\t\tenabled: t.enabled,\n\t\t\t\tmuted: t.muted,\n\t\t\t\treadyState: t.readyState,\n\t\t\t})),\n\t\t})\n\n\t\tlocalStream.getTracks().forEach((track) => {\n\t\t\tpc.addTrack(track, localStream)\n\t\t})\n\n\t\t// Create data channel for events\n\t\tconst dataChannel = pc.createDataChannel('oai-events')\n\n\t\t// Create offer and establish connection\n\t\tconst offer = await pc.createOffer()\n\t\tawait pc.setLocalDescription(offer)\n\n\t\t// Connect to OpenAI\n\t\tif (!offer.sdp) {\n\t\t\tthrow new Error('Failed to create offer SDP')\n\t\t}\n\t\tconst answer = await this.connectToOpenAI(apiUrl, model, offer.sdp, ephemeralKey)\n\t\tawait pc.setRemoteDescription(answer)\n\n\t\t// Create cleanup function\n\t\tconst cleanup = () => {\n\t\t\tlocalStream.getTracks().forEach((track) => {\n\t\t\t\ttrack.stop()\n\t\t\t})\n\t\t\taudioElement.remove()\n\t\t\tdataChannel.close()\n\t\t\tpc.close()\n\t\t}\n\n\t\treturn {\n\t\t\tpc,\n\t\t\tdataChannel,\n\t\t\taudioElement,\n\t\t\tlocalStream,\n\t\t\tremoteStream,\n\t\t\tcleanup,\n\t\t}\n\t}\n\n\tprivate async getEphemeralToken(model: string, voice: string): Promise<string> {\n\t\tconst response = await fetch(this.tokenEndpoint, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t},\n\t\t\tbody: JSON.stringify({ model, voice }),\n\t\t})\n\n\t\tif (!response.ok) {\n\t\t\tconst errorText = await response.text()\n\t\t\tconsole.error('Failed to get ephemeral token:', errorText)\n\t\t\tthrow new Error(`Failed to get ephemeral token: ${response.statusText}`)\n\t\t}\n\n\t\tconst data: unknown = await response.json()\n\n\t\tif (!hasClientSecret(data)) {\n\t\t\tthrow new Error('Invalid token response format')\n\t\t}\n\n\t\treturn data.client_secret.value\n\t}\n\n\tprivate createAudioElement(): HTMLAudioElement {\n\t\tconst audioElement = document.createElement('audio')\n\t\taudioElement.autoplay = true\n\t\taudioElement.style.display = 'none'\n\t\tdocument.body.appendChild(audioElement)\n\t\treturn audioElement\n\t}\n\n\tprivate async getUserMedia(): Promise<MediaStream> {\n\t\ttry {\n\t\t\treturn await navigator.mediaDevices.getUserMedia({\n\t\t\t\taudio: {\n\t\t\t\t\techoCancellation: true,\n\t\t\t\t\tnoiseSuppression: true,\n\t\t\t\t\tautoGainControl: true,\n\t\t\t\t},\n\t\t\t})\n\t\t} catch (error) {\n\t\t\tthrow new Error(`Failed to access microphone: ${error}`)\n\t\t}\n\t}\n\n\tprivate async connectToOpenAI(\n\t\tbaseUrl: string,\n\t\tmodel: string,\n\t\tsdp: string,\n\t\tephemeralKey: string\n\t): Promise<RTCSessionDescriptionInit> {\n\t\tconst response = await fetch(`${baseUrl}?model=${model}`, {\n\t\t\tmethod: 'POST',\n\t\t\tbody: sdp,\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${ephemeralKey}`,\n\t\t\t\t'Content-Type': 'application/sdp',\n\t\t\t},\n\t\t})\n\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(`Failed to establish WebRTC connection: ${response.statusText}`)\n\t\t}\n\n\t\tconst answerSdp = await response.text()\n\t\treturn {\n\t\t\ttype: 'answer' as const,\n\t\t\tsdp: answerSdp,\n\t\t}\n\t}\n}\n","import {\n\tAUDIO_FREQUENCY_BINS,\n\tAUDIO_VISUALIZATION_INTERVAL_MS,\n\tdebugLog,\n} from '../../lib/constants'\nimport { AudioAnalyzer } from './audio-analyzer'\nimport { EventEmitter } from './event-emitter'\nimport { MessageHandler } from './message-handler'\nimport { ToolManager } from './tool-manager'\nimport { WebRTCManager } from './webrtc-manager'\n\nimport type { RegisteredTool, ToolExecutor } from './tool-manager'\nimport type { EventCallback, RealtimeConfig, RealtimeSession, SessionConfig } from './types'\n\n/** Pre-allocated zero frequency array for performance */\nconst EMPTY_FREQUENCY_TEMPLATE = Object.freeze(new Array(AUDIO_FREQUENCY_BINS).fill(0))\nconst createZeroFrequencyArray = (): number[] => [...EMPTY_FREQUENCY_TEMPLATE]\n\n/**\n * OpenAI Realtime API Service\n *\n * Manages voice conversations with OpenAI's Realtime API,\n * including WebRTC connections, tool integration, and message handling.\n */\nexport class OpenAIRealtimeService {\n\tprivate session: RealtimeSession | null = null\n\tprivate webrtcManager: WebRTCManager\n\tprivate toolManager: ToolManager\n\tprivate messageHandler: MessageHandler\n\tprivate eventEmitter: EventEmitter\n\tprivate muted = false\n\tprivate lastState: 'disconnected' | 'connecting' | 'connected' | 'error' = 'disconnected'\n\tprivate localAnalyzer: AudioAnalyzer | null = null\n\tprivate remoteAnalyzer: AudioAnalyzer | null = null\n\tprivate visualizationInterval: ReturnType<typeof setInterval> | null = null\n\tprivate sessionStartTime: number | null = null\n\tprivate onToolsChangedCallback: (() => void) | null = null\n\n\tconstructor(tokenEndpoint: string) {\n\t\tthis.webrtcManager = new WebRTCManager(tokenEndpoint)\n\t\tthis.toolManager = new ToolManager()\n\t\tthis.eventEmitter = new EventEmitter()\n\t\tthis.messageHandler = new MessageHandler(this.toolManager, this.eventEmitter)\n\t}\n\n\t/**\n\t * Set the tools available for the voice session\n\t */\n\tsetTools(tools: RegisteredTool[]): void {\n\t\tthis.toolManager.setTools(tools)\n\t\tif (this.isSessionActive()) {\n\t\t\tthis.updateSessionTools()\n\t\t}\n\t}\n\n\t/**\n\t * Set the tool executor function\n\t */\n\tsetToolExecutor(executor: ToolExecutor): void {\n\t\tthis.toolManager.setExecutor(executor)\n\t}\n\n\t/**\n\t * Register callback for when tools change\n\t */\n\tonToolsChanged(callback: () => void): void {\n\t\tthis.onToolsChangedCallback = callback\n\t}\n\n\t/**\n\t * Start a new realtime session\n\t */\n\tasync startSession(config: RealtimeConfig = {}): Promise<RealtimeSession> {\n\t\ttry {\n\t\t\t// Clean up existing session\n\t\t\tif (this.session) {\n\t\t\t\tthis.stopSession()\n\t\t\t}\n\n\t\t\tthis.muted = false\n\t\t\tthis.sessionStartTime = Date.now()\n\t\t\tthis.emitSessionState('connecting')\n\n\t\t\t// Create new WebRTC session\n\t\t\tthis.session = await this.webrtcManager.createSession(config)\n\n\t\t\t// Setup data channel handlers\n\t\t\tthis.setupDataChannel(this.session.dataChannel)\n\n\t\t\t// Monitor peer connection state\n\t\t\tthis.setupPeerConnectionMonitoring(this.session.pc)\n\n\t\t\tif (this.session.localStream) {\n\t\t\t\tawait this.initializeLocalAnalyzer(this.session.localStream)\n\t\t\t}\n\n\t\t\tif (this.session.remoteStream) {\n\t\t\t\tvoid this.initializeRemoteAnalyzer(this.session.remoteStream)\n\t\t\t}\n\n\t\t\t// Update session reference for remote stream\n\t\t\tconst originalOntrack = this.session.pc.ontrack\n\t\t\tconst session = this.session\n\t\t\tthis.session.pc.ontrack = (e) => {\n\t\t\t\tif (originalOntrack) originalOntrack.call(session.pc, e)\n\t\t\t\tif (this.session) {\n\t\t\t\t\tthis.session.remoteStream = e.streams[0]\n\t\t\t\t}\n\n\t\t\t\tconst remoteStream = e.streams[0]\n\t\t\t\tif (!remoteStream) {\n\t\t\t\t\tconsole.warn('[OpenAIRealtimeService] Received ontrack event without stream')\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tvoid this.initializeRemoteAnalyzer(remoteStream)\n\t\t\t}\n\n\t\t\treturn this.session\n\t\t} catch (error) {\n\t\t\tthis.handleSessionError(error)\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t/**\n\t * Stop the current session\n\t */\n\tstopSession(): void {\n\t\t// Calculate session duration for usage tracking\n\t\tlet durationSeconds = 0\n\t\tif (this.sessionStartTime) {\n\t\t\tdurationSeconds = Math.floor((Date.now() - this.sessionStartTime) / 1000)\n\t\t}\n\n\t\tif (this.visualizationInterval) {\n\t\t\tclearInterval(this.visualizationInterval)\n\t\t\tthis.visualizationInterval = null\n\t\t}\n\n\t\tif (this.localAnalyzer) {\n\t\t\tthis.localAnalyzer.destroy()\n\t\t\tthis.localAnalyzer = null\n\t\t}\n\n\t\tif (this.remoteAnalyzer) {\n\t\t\tthis.remoteAnalyzer.destroy()\n\t\t\tthis.remoteAnalyzer = null\n\t\t}\n\t\tif (this.session) {\n\t\t\tthis.session.cleanup()\n\t\t\tthis.session = null\n\t\t}\n\t\tthis.messageHandler.reset()\n\t\tthis.toolManager.resetSession()\n\n\t\t// Emit disconnected state with session duration\n\t\tthis.muted = false\n\t\tthis.emitSessionState('disconnected', { durationSeconds })\n\n\t\t// Reset session start time\n\t\tthis.sessionStartTime = null\n\t}\n\n\t/**\n\t * Send a text message to the assistant\n\t */\n\tsendUserMessage(text: string): void {\n\t\tif (!this.isSessionActive()) {\n\t\t\tthrow new Error('No active session')\n\t\t}\n\n\t\tconst message = {\n\t\t\ttype: 'conversation.item.create',\n\t\t\titem: {\n\t\t\t\ttype: 'message',\n\t\t\t\trole: 'user',\n\t\t\t\tcontent: [{ type: 'input_text', text }],\n\t\t\t},\n\t\t}\n\n\t\tif (!this.session) {\n\t\t\tthrow new Error('Session is not active')\n\t\t}\n\t\tthis.session.dataChannel.send(JSON.stringify(message))\n\t\tthis.session.dataChannel.send(JSON.stringify({ type: 'response.create' }))\n\t}\n\n\t/**\n\t * Check if session is active\n\t */\n\tisSessionActive(): boolean {\n\t\treturn this.session !== null && this.session.dataChannel.readyState === 'open'\n\t}\n\n\t/**\n\t * Get the local audio stream\n\t */\n\tgetLocalStream(): MediaStream | null {\n\t\treturn this.session?.localStream || null\n\t}\n\n\t/**\n\t * Get the remote audio stream\n\t */\n\tgetRemoteStream(): MediaStream | null {\n\t\treturn this.session?.remoteStream || null\n\t}\n\n\t/**\n\t * Toggle audio mute\n\t */\n\ttoggleMute(muted: boolean): void {\n\t\tif (this.session?.audioElement) {\n\t\t\tthis.session.audioElement.muted = muted\n\t\t}\n\t\tthis.muted = muted\n\t\tthis.emitSessionState(this.lastState, { isMuted: this.muted })\n\t}\n\n\t/**\n\t * Event handling\n\t */\n\ton(event: string, callback: EventCallback): void {\n\t\tthis.eventEmitter.on(event, callback)\n\t}\n\n\toff(event: string, callback: EventCallback): void {\n\t\tthis.eventEmitter.off(event, callback)\n\t}\n\n\tgetSessionStatus(): {\n\t\tstate: 'connecting' | 'connected' | 'disconnected' | 'error'\n\t\tisActive: boolean\n\t\tisMuted: boolean\n\t} {\n\t\treturn {\n\t\t\tstate: this.lastState,\n\t\t\tisActive: this.lastState === 'connected',\n\t\t\tisMuted: this.muted,\n\t\t}\n\t}\n\n\t/**\n\t * Private methods\n\t */\n\tprivate setupDataChannel(dataChannel: RTCDataChannel): void {\n\t\t// Configure session when channel opens\n\t\tdataChannel.addEventListener('open', () => {\n\t\t\tthis.configureSession(dataChannel)\n\t\t\tthis.muted = false\n\t\t\tthis.emitSessionState('connected')\n\t\t})\n\n\t\t// Handle incoming messages\n\t\tdataChannel.addEventListener('message', (event: MessageEvent<string>) => {\n\t\t\tvoid (async () => {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.messageHandler.handleMessage(event.data, dataChannel)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsole.error('Error handling message:', error)\n\t\t\t\t}\n\t\t\t})()\n\t\t})\n\n\t\t// Handle errors\n\t\tdataChannel.addEventListener('error', (error) => {\n\t\t\tconsole.error('DataChannel error:', error)\n\t\t\tthis.eventEmitter.emit('error', { type: 'datachannel_error', error })\n\t\t})\n\n\t\t// Handle close\n\t\tdataChannel.addEventListener('close', () => {\n\t\t\tthis.messageHandler.reset()\n\t\t\tthis.eventEmitter.emit('session_closed', {})\n\t\t})\n\t}\n\n\tprivate setupPeerConnectionMonitoring(pc: RTCPeerConnection): void {\n\t\t// Monitor connection state changes\n\t\tpc.addEventListener('connectionstatechange', () => {\n\t\t\tif (pc.connectionState === 'failed' || pc.connectionState === 'disconnected') {\n\t\t\t\tconsole.error('Peer connection failed or disconnected')\n\t\t\t\tthis.messageHandler.reset()\n\t\t\t\tthis.eventEmitter.emit('error', {\n\t\t\t\t\ttype: 'connection_error',\n\t\t\t\t\tmessage: `Connection ${pc.connectionState}`,\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\n\t\t// Monitor ICE connection state\n\t\tpc.addEventListener('iceconnectionstatechange', () => {\n\t\t\tif (pc.iceConnectionState === 'failed' || pc.iceConnectionState === 'disconnected') {\n\t\t\t\tconsole.error('ICE connection failed or disconnected')\n\t\t\t}\n\t\t})\n\n\t\t// Monitor signaling state\n\t\tpc.addEventListener('signalingstatechange', () => {})\n\t}\n\n\tprivate configureSession(dataChannel: RTCDataChannel): void {\n\t\t// Reset per-session state\n\t\tthis.toolManager.resetSession()\n\n\t\t// Get initial tools\n\t\tconst tools = this.toolManager.formatToolsForOpenAI()\n\t\t// Mark tools as sent\n\t\tthis.toolManager.markToolsSent()\n\n\t\tconst sessionConfig: SessionConfig = {\n\t\t\tmodalities: ['text', 'audio'],\n\t\t\tinstructions: this.getSessionInstructions(),\n\t\t\tvoice: 'verse',\n\t\t\ttools: tools,\n\t\t\ttool_choice: 'auto',\n\t\t\tturn_detection: {\n\t\t\t\ttype: 'server_vad',\n\t\t\t\tthreshold: 0.5,\n\t\t\t\tprefix_padding_ms: 300,\n\t\t\t\tsilence_duration_ms: 500,\n\t\t\t},\n\t\t\tinput_audio_transcription: {\n\t\t\t\tmodel: 'whisper-1',\n\t\t\t},\n\t\t}\n\n\t\tconst sessionUpdate = {\n\t\t\ttype: 'session.update',\n\t\t\tsession: sessionConfig,\n\t\t}\n\n\t\tdataChannel.send(JSON.stringify(sessionUpdate))\n\t}\n\n\tprivate updateSessionTools(): void {\n\t\tif (!this.session) {\n\t\t\tconsole.warn('[OpenAIRealtimeService] Cannot update tools: no active session')\n\t\t\treturn\n\t\t}\n\n\t\tif (this.session.dataChannel.readyState !== 'open') {\n\t\t\tconsole.warn(\n\t\t\t\t`[OpenAIRealtimeService] Cannot update tools: DataChannel is ${this.session.dataChannel.readyState}`\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\t// Check if tools have actually changed\n\t\tconst changesSummary = this.toolManager.getChangesSummary()\n\t\tif (!changesSummary) {\n\t\t\treturn\n\t\t}\n\n\t\t// Get the full tool list\n\t\tconst tools = this.toolManager.formatToolsForOpenAI()\n\n\t\tconsole.log(\n\t\t\t'[OpenAIRealtimeService] Sending tool update to OpenAI:',\n\t\t\t`${changesSummary.total} total tools,`,\n\t\t\tchangesSummary.added.length > 0\n\t\t\t\t? `+${changesSummary.added.length} added (${changesSummary.added.slice(0, 3).join(', ')}${changesSummary.added.length > 3 ? '...' : ''})`\n\t\t\t\t: '',\n\t\t\tchangesSummary.removed.length > 0 ? `-${changesSummary.removed.length} removed` : ''\n\t\t)\n\n\t\t// Mark tools as sent\n\t\tthis.toolManager.markToolsSent()\n\n\t\tconst sessionUpdate = {\n\t\t\ttype: 'session.update',\n\t\t\tsession: {\n\t\t\t\ttools: tools,\n\t\t\t\ttool_choice: 'auto',\n\t\t\t},\n\t\t}\n\n\t\tthis.session.dataChannel.send(JSON.stringify(sessionUpdate))\n\t}\n\n\tprivate getSessionInstructions(): string {\n\t\treturn `You are a helpful assistant with access to tools.\n Use the available tools to help users with their tasks.\n You can use the list_available_tools function to see what tools are currently available.\n Be concise and helpful in your responses.`\n\t}\n\n\tprivate handleSessionError(error: unknown): void {\n\t\tconsole.error('Session error:', error)\n\t\tthis.emitSessionState('error', {\n\t\t\ttype: 'session_error',\n\t\t\terror: String(error),\n\t\t})\n\t\tthis.stopSession()\n\t}\n\n\tprivate async initializeLocalAnalyzer(stream: MediaStream): Promise<void> {\n\t\tif (this.localAnalyzer) {\n\t\t\tthis.localAnalyzer.destroy()\n\t\t}\n\n\t\tthis.localAnalyzer = new AudioAnalyzer()\n\t\ttry {\n\t\t\t// Clone the stream to avoid conflicts with WebRTC which consumes the original\n\t\t\tconst clonedStream = new MediaStream(stream.getAudioTracks().map((t) => t.clone()))\n\t\t\tawait this.localAnalyzer.initialize(clonedStream)\n\t\t\tthis.startAudioVisualization()\n\t\t} catch (error) {\n\t\t\tconsole.error('[OpenAIRealtimeService] Failed to initialize local audio analyzer', error)\n\t\t\tif (this.localAnalyzer) {\n\t\t\t\tthis.localAnalyzer.destroy()\n\t\t\t\tthis.localAnalyzer = null\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async initializeRemoteAnalyzer(stream: MediaStream): Promise<void> {\n\t\tif (this.remoteAnalyzer) {\n\t\t\tthis.remoteAnalyzer.destroy()\n\t\t}\n\n\t\tthis.remoteAnalyzer = new AudioAnalyzer()\n\t\ttry {\n\t\t\t// Clone the stream to avoid conflicts with WebRTC\n\t\t\tconst clonedStream = new MediaStream(stream.getAudioTracks().map((t) => t.clone()))\n\t\t\tawait this.remoteAnalyzer.initialize(clonedStream)\n\t\t\tthis.startAudioVisualization()\n\t\t} catch (error) {\n\t\t\tconsole.error('[OpenAIRealtimeService] Failed to initialize remote audio analyzer', error)\n\t\t\tif (this.remoteAnalyzer) {\n\t\t\t\tthis.remoteAnalyzer.destroy()\n\t\t\t\tthis.remoteAnalyzer = null\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate startAudioVisualization(): void {\n\t\tif (!this.localAnalyzer && !this.remoteAnalyzer) {\n\t\t\tdebugLog('OpenAIRealtimeService', 'Audio visualization not started: no analyzers ready')\n\t\t\treturn\n\t\t}\n\n\t\tif (this.visualizationInterval) {\n\t\t\tclearInterval(this.visualizationInterval)\n\t\t}\n\n\t\tlet logCounter = 0\n\t\tthis.visualizationInterval = setInterval(() => {\n\t\t\tconst micLevel = this.localAnalyzer?.getAudioLevel() ?? 0\n\t\t\tconst micFrequency =\n\t\t\t\tthis.localAnalyzer?.getFrequencyData(AUDIO_FREQUENCY_BINS) ?? createZeroFrequencyArray()\n\t\t\tconst speakerLevel = this.remoteAnalyzer?.getAudioLevel() ?? 0\n\t\t\tconst speakerFrequency =\n\t\t\t\tthis.remoteAnalyzer?.getFrequencyData(AUDIO_FREQUENCY_BINS) ?? createZeroFrequencyArray()\n\n\t\t\t// Log audio levels periodically for debugging (every ~1 second)\n\t\t\tlogCounter++\n\t\t\tif (logCounter % 60 === 0) {\n\t\t\t\tdebugLog('OpenAIRealtimeService', 'Audio levels', {\n\t\t\t\t\tmic: micLevel.toFixed(3),\n\t\t\t\t\tspeaker: speakerLevel.toFixed(3),\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tthis.eventEmitter.emit('audio_level', {\n\t\t\t\tmicLevel,\n\t\t\t\tmicFrequency,\n\t\t\t\tspeakerLevel,\n\t\t\t\tspeakerFrequency,\n\t\t\t})\n\t\t}, AUDIO_VISUALIZATION_INTERVAL_MS)\n\t}\n\n\tprivate emitSessionState(\n\t\tstate: 'connecting' | 'connected' | 'disconnected' | 'error',\n\t\textra: Record<string, unknown> = {}\n\t): void {\n\t\tthis.lastState = state\n\t\tconst payload = {\n\t\t\tstate,\n\t\t\tisActive: state === 'connected',\n\t\t\tisMuted: this.muted,\n\t\t\t...extra,\n\t\t}\n\n\t\tthis.eventEmitter.emit('session_state', payload)\n\n\t\tswitch (state) {\n\t\t\tcase 'connecting':\n\t\t\t\tthis.eventEmitter.emit('session_connecting', payload)\n\t\t\t\tbreak\n\t\t\tcase 'connected':\n\t\t\t\tthis.eventEmitter.emit('session_connected', payload)\n\t\t\t\tbreak\n\t\t\tcase 'disconnected':\n\t\t\t\tthis.eventEmitter.emit('session_closed', payload)\n\t\t\t\tbreak\n\t\t\tcase 'error':\n\t\t\t\tthis.eventEmitter.emit('error', payload)\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tbreak\n\t\t}\n\t}\n}\n\n// Re-export types for convenience\nexport type { RealtimeConfig, RealtimeSession } from './types'\n","/**\n * Types for OpenAI Realtime API integration\n */\n\nexport interface RealtimeConfig {\n\tmodel?: string\n\tvoice?: string\n\tapiUrl?: string\n\ttokenEndpoint?: string\n}\n\nexport interface RealtimeSession {\n\tpc: RTCPeerConnection\n\tdataChannel: RTCDataChannel\n\taudioElement: HTMLAudioElement\n\tlocalStream: MediaStream | null\n\tremoteStream: MediaStream | null\n\tcleanup: () => void\n}\n\nexport interface OpenAITool {\n\ttype: 'function'\n\tname: string\n\tdescription: string\n\tparameters: {\n\t\ttype: string\n\t\tproperties?: Record<string, unknown>\n\t\trequired?: string[]\n\t}\n}\n\nexport interface SessionConfig {\n\tmodalities: string[]\n\tinstructions: string\n\tvoice?: string\n\ttools: OpenAITool[]\n\ttool_choice: string\n\tturn_detection: {\n\t\ttype: string\n\t\tthreshold: number\n\t\tprefix_padding_ms: number\n\t\tsilence_duration_ms: number\n\t}\n\tinput_audio_transcription?: {\n\t\tmodel: string\n\t}\n}\n\nexport interface FunctionCall {\n\tname: string\n\targuments: string\n\tcall_id: string\n\ttype?: string\n\tstatus?: string\n}\n\nexport interface ConversationItem {\n\ttype: string\n\trole?: string\n\tcontent?: unknown[]\n\tcall_id?: string\n\toutput?: string\n}\n\nexport interface RealtimeMessage {\n\ttype: string\n\t[key: string]: unknown\n}\n\nexport interface ToolExecutionResult {\n\tsuccess: boolean\n\tdata?: unknown\n\terror?: string\n}\n\nexport type EventCallback = (data: unknown) => void\n\nexport interface IEventEmitter {\n\ton(event: string, callback: EventCallback): void\n\toff(event: string, callback: EventCallback): void\n\temit(event: string, data: unknown): void\n}\n\nexport interface AudioLevelData {\n\tmicLevel: number\n\tmicFrequency: number[]\n\tspeakerLevel: number\n\tspeakerFrequency: number[]\n}\n\nexport interface TranscriptData {\n\ttype: 'user' | 'assistant'\n\ttext: string\n\tisDone: boolean\n}\n\nexport interface ToolCallData {\n\tstatus: 'started' | 'completed'\n\ttoolName: string\n\terror?: string\n}\n\nexport interface VoiceModeState {\n\tisActive: boolean\n\tisConnecting: boolean\n\tisMuted: boolean\n\tisError: boolean\n\tconnectionState: string\n\taudioLevel?: AudioLevelData\n\ttranscript?: TranscriptData\n\ttoolCall?: ToolCallData\n\terror?: string\n}\n\n// ============================================================================\n// Event Data Types - For type-safe event handling\n// ============================================================================\n\n/**\n * Session state event data from the realtime service\n */\nexport interface SessionStateEventData {\n\tstate: 'connecting' | 'connected' | 'disconnected' | 'error'\n\tisActive: boolean\n\tisMuted: boolean\n\tdurationSeconds?: number\n}\n\n/**\n * User transcript event data\n */\nexport interface UserTranscriptEventData {\n\ttext: string\n}\n\n/**\n * Assistant transcript streaming event data\n */\nexport interface AssistantTranscriptEventData {\n\tdelta?: string\n\ttranscript?: string\n}\n\n/**\n * Tool call started event data\n */\nexport interface ToolCallStartedEventData {\n\tname: string\n}\n\n/**\n * Tool call completed event data\n */\nexport interface ToolCallCompletedEventData {\n\tname: string\n\terror?: string\n}\n\n/**\n * Error event data\n */\nexport interface ErrorEventData {\n\terror?: string\n\tmessage?: string\n\ttype?: string\n}\n\n// ============================================================================\n// Type Guards - Runtime type checking for event data\n// ============================================================================\n\n/**\n * Type guard for SessionStateEventData\n */\nexport function isSessionStateEventData(data: unknown): data is SessionStateEventData {\n\tif (!data || typeof data !== 'object') return false\n\tconst d = data as Record<string, unknown>\n\treturn (\n\t\ttypeof d.state === 'string' &&\n\t\t['connecting', 'connected', 'disconnected', 'error'].includes(d.state) &&\n\t\ttypeof d.isActive === 'boolean' &&\n\t\ttypeof d.isMuted === 'boolean'\n\t)\n}\n\n/**\n * Type guard for UserTranscriptEventData\n */\nexport function isUserTranscriptEventData(data: unknown): data is UserTranscriptEventData {\n\tif (!data || typeof data !== 'object') return false\n\tconst d = data as Record<string, unknown>\n\treturn typeof d.text === 'string'\n}\n\n/**\n * Type guard for AssistantTranscriptEventData\n */\nexport function isAssistantTranscriptEventData(\n\tdata: unknown\n): data is AssistantTranscriptEventData {\n\tif (!data || typeof data !== 'object') return false\n\tconst d = data as Record<string, unknown>\n\treturn d.delta === undefined || typeof d.delta === 'string'\n}\n\n/**\n * Type guard for ToolCallStartedEventData\n */\nexport function isToolCallStartedEventData(data: unknown): data is ToolCallStartedEventData {\n\tif (!data || typeof data !== 'object') return false\n\tconst d = data as Record<string, unknown>\n\treturn typeof d.name === 'string'\n}\n\n/**\n * Type guard for ToolCallCompletedEventData\n */\nexport function isToolCallCompletedEventData(data: unknown): data is ToolCallCompletedEventData {\n\tif (!data || typeof data !== 'object') return false\n\tconst d = data as Record<string, unknown>\n\treturn typeof d.name === 'string'\n}\n\n/**\n * Type guard for ErrorEventData\n */\nexport function isErrorEventData(data: unknown): data is ErrorEventData {\n\tif (!data || typeof data !== 'object') return false\n\t// Error events must have at least one of these fields\n\tconst d = data as Record<string, unknown>\n\treturn typeof d.error === 'string' || typeof d.message === 'string' || typeof d.type === 'string'\n}\n\n/**\n * Type guard for AudioLevelData\n */\nexport function isAudioLevelData(data: unknown): data is AudioLevelData {\n\tif (!data || typeof data !== 'object') return false\n\tconst d = data as Record<string, unknown>\n\treturn (\n\t\ttypeof d.micLevel === 'number' &&\n\t\tArray.isArray(d.micFrequency) &&\n\t\ttypeof d.speakerLevel === 'number' &&\n\t\tArray.isArray(d.speakerFrequency)\n\t)\n}\n","/**\n * Voice Mode Hook\n *\n * Manages OpenAI Realtime API voice sessions with WebRTC.\n * Provides audio level streaming, transcript events, and tool call tracking.\n *\n * @example Basic usage\n * ```tsx\n * const {\n * isActive,\n * startSession,\n * stopSession,\n * toggleMute\n * } = useVoiceMode({\n * tokenEndpoint: '/api/realtime/session'\n * })\n * ```\n */\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\n\nimport {\n\tTOOL_CALL_DISPLAY_DURATION_MS,\n\tTOOL_CALL_ERROR_DISPLAY_DURATION_MS,\n} from '../lib/constants'\nimport {\n\tisAssistantTranscriptEventData,\n\tisAudioLevelData,\n\tisErrorEventData,\n\tisSessionStateEventData,\n\tisToolCallCompletedEventData,\n\tisToolCallStartedEventData,\n\tisUserTranscriptEventData,\n\tOpenAIRealtimeService,\n} from '../services/realtime'\n\nimport type {\n\tAudioLevelData,\n\tRealtimeConfig,\n\tRegisteredTool,\n\tToolCallData,\n\tToolExecutor,\n\tTranscriptData,\n\tVoiceModeState,\n} from '../services/realtime'\n\nexport interface UseVoiceModeOptions {\n\t/** Endpoint to get ephemeral tokens from */\n\ttokenEndpoint: string\n\t/** Tools available for the voice session */\n\ttools?: RegisteredTool[]\n\t/** Tool executor function */\n\ttoolExecutor?: ToolExecutor\n\t/** Callback when session connects */\n\tonConnect?: () => void\n\t/** Callback when session disconnects */\n\tonDisconnect?: (durationSeconds: number) => void\n\t/** Callback when error occurs */\n\tonError?: (error: string) => void\n\t/** Callback when user transcript is complete */\n\tonUserTranscript?: (text: string) => void\n\t/** Callback when assistant transcript is complete */\n\tonAssistantTranscript?: (text: string) => void\n}\n\nexport interface UseVoiceModeReturn extends VoiceModeState {\n\t/** Start voice session */\n\tstartSession: (config?: RealtimeConfig) => Promise<void>\n\t/** Stop voice session */\n\tstopSession: () => void\n\t/** Toggle microphone mute */\n\ttoggleMute: (muted?: boolean) => void\n\t/** Send text message while in voice mode */\n\tsendMessage: (text: string) => void\n}\n\nexport function useVoiceMode(options: UseVoiceModeOptions): UseVoiceModeReturn {\n\tconst {\n\t\ttokenEndpoint,\n\t\ttools,\n\t\ttoolExecutor,\n\t\tonConnect,\n\t\tonDisconnect,\n\t\tonError,\n\t\tonUserTranscript,\n\t\tonAssistantTranscript,\n\t} = options\n\n\t// State\n\tconst [isActive, setIsActive] = useState(false)\n\tconst [isConnecting, setIsConnecting] = useState(false)\n\tconst [isMuted, setIsMuted] = useState(false)\n\tconst [isError, setIsError] = useState(false)\n\tconst [connectionState, setConnectionState] = useState('disconnected')\n\tconst [audioLevel, setAudioLevel] = useState<AudioLevelData | undefined>()\n\tconst [transcript, setTranscript] = useState<TranscriptData | undefined>()\n\tconst [toolCall, setToolCall] = useState<ToolCallData | undefined>()\n\tconst [error, setError] = useState<string | undefined>()\n\n\t// Service ref\n\tconst serviceRef = useRef<OpenAIRealtimeService | null>(null)\n\n\t// Callbacks refs to avoid stale closures\n\tconst onConnectRef = useRef(onConnect)\n\tconst onDisconnectRef = useRef(onDisconnect)\n\tconst onErrorRef = useRef(onError)\n\tconst onUserTranscriptRef = useRef(onUserTranscript)\n\tconst onAssistantTranscriptRef = useRef(onAssistantTranscript)\n\n\tuseEffect(() => {\n\t\tonConnectRef.current = onConnect\n\t\tonDisconnectRef.current = onDisconnect\n\t\tonErrorRef.current = onError\n\t\tonUserTranscriptRef.current = onUserTranscript\n\t\tonAssistantTranscriptRef.current = onAssistantTranscript\n\t}, [onConnect, onDisconnect, onError, onUserTranscript, onAssistantTranscript])\n\n\t// Get or create service instance\n\tconst getService = useCallback(() => {\n\t\tif (!serviceRef.current) {\n\t\t\tserviceRef.current = new OpenAIRealtimeService(tokenEndpoint)\n\t\t}\n\t\treturn serviceRef.current\n\t}, [tokenEndpoint])\n\n\t// Update tools when they change\n\tuseEffect(() => {\n\t\tif (tools) {\n\t\t\tconst service = getService()\n\t\t\tservice.setTools(tools)\n\t\t}\n\t}, [tools, getService])\n\n\t// Update tool executor when it changes\n\tuseEffect(() => {\n\t\tif (toolExecutor) {\n\t\t\tconst service = getService()\n\t\t\tservice.setToolExecutor(toolExecutor)\n\t\t}\n\t}, [toolExecutor, getService])\n\n\t// Set up event listeners\n\tuseEffect(() => {\n\t\tconst service = getService()\n\n\t\t// Session state handler - uses type guard for safe access\n\t\tconst handleSessionState = (data: unknown) => {\n\t\t\tif (!isSessionStateEventData(data)) {\n\t\t\t\tconsole.warn('[useVoiceMode] Invalid session state event data:', data)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tsetConnectionState(data.state)\n\t\t\tsetIsActive(data.isActive)\n\t\t\tsetIsMuted(data.isMuted)\n\t\t\tsetIsConnecting(data.state === 'connecting')\n\t\t\tsetIsError(data.state === 'error')\n\n\t\t\tif (data.state === 'connected') {\n\t\t\t\tonConnectRef.current?.()\n\t\t\t} else if (data.state === 'disconnected') {\n\t\t\t\tonDisconnectRef.current?.(data.durationSeconds ?? 0)\n\t\t\t}\n\t\t}\n\n\t\t// Audio level handler - uses type guard for safe access\n\t\tconst handleAudioLevel = (data: unknown) => {\n\t\t\tif (isAudioLevelData(data)) {\n\t\t\t\tsetAudioLevel(data)\n\t\t\t}\n\t\t}\n\n\t\t// User transcript handler - uses type guard for safe access\n\t\tconst handleUserTranscript = (data: unknown) => {\n\t\t\tif (!isUserTranscriptEventData(data)) {\n\t\t\t\tconsole.warn('[useVoiceMode] Invalid user transcript event data:', data)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetTranscript({ type: 'user', text: data.text, isDone: true })\n\t\t\tonUserTranscriptRef.current?.(data.text)\n\t\t}\n\n\t\t// Assistant transcript handler (streaming) - uses type guard for safe access\n\t\tconst handleAssistantTranscript = (data: unknown) => {\n\t\t\tif (!isAssistantTranscriptEventData(data)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst text = data.delta || data.transcript || ''\n\t\t\tsetTranscript((prev) => ({\n\t\t\t\ttype: 'assistant',\n\t\t\t\ttext: prev?.type === 'assistant' ? prev.text + text : text,\n\t\t\t\tisDone: false,\n\t\t\t}))\n\t\t}\n\n\t\t// Assistant transcript done handler - uses type guard for safe access\n\t\tconst handleAssistantTranscriptDone = (data: unknown) => {\n\t\t\tif (!isAssistantTranscriptEventData(data)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst text = data.transcript || ''\n\t\t\tsetTranscript({ type: 'assistant', text, isDone: true })\n\t\t\tonAssistantTranscriptRef.current?.(text)\n\t\t}\n\n\t\t// Tool call started handler - uses type guard for safe access\n\t\tconst handleToolCallStarted = (data: unknown) => {\n\t\t\tif (!isToolCallStartedEventData(data)) {\n\t\t\t\tconsole.warn('[useVoiceMode] Invalid tool call started event data:', data)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetToolCall({ status: 'started', toolName: data.name })\n\t\t}\n\n\t\t// Tool call completed handler - uses type guard for safe access\n\t\tconst handleToolCallCompleted = (data: unknown) => {\n\t\t\tif (!isToolCallCompletedEventData(data)) {\n\t\t\t\tconsole.warn('[useVoiceMode] Invalid tool call completed event data:', data)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetToolCall({ status: 'completed', toolName: data.name, error: data.error })\n\n\t\t\t// Clear tool call after a delay (longer for errors)\n\t\t\tsetTimeout(\n\t\t\t\t() => {\n\t\t\t\t\tsetToolCall(undefined)\n\t\t\t\t},\n\t\t\t\tdata.error ? TOOL_CALL_ERROR_DISPLAY_DURATION_MS : TOOL_CALL_DISPLAY_DURATION_MS\n\t\t\t)\n\t\t}\n\n\t\t// Error handler - uses type guard for safe access\n\t\tconst handleError = (data: unknown) => {\n\t\t\tif (!isErrorEventData(data)) {\n\t\t\t\tsetError('Unknown error')\n\t\t\t\tsetIsError(true)\n\t\t\t\tonErrorRef.current?.('Unknown error')\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst errorMsg = data.error || data.message || 'Unknown error'\n\t\t\tsetError(errorMsg)\n\t\t\tsetIsError(true)\n\t\t\tonErrorRef.current?.(errorMsg)\n\t\t}\n\n\t\t// Register listeners\n\t\tservice.on('session_state', handleSessionState)\n\t\tservice.on('audio_level', handleAudioLevel)\n\t\tservice.on('user_transcript_done', handleUserTranscript)\n\t\tservice.on('assistant_transcript', handleAssistantTranscript)\n\t\tservice.on('assistant_transcript_done', handleAssistantTranscriptDone)\n\t\tservice.on('tool_call_started', handleToolCallStarted)\n\t\tservice.on('tool_call_completed', handleToolCallCompleted)\n\t\tservice.on('error', handleError)\n\n\t\t// Cleanup\n\t\treturn () => {\n\t\t\tservice.off('session_state', handleSessionState)\n\t\t\tservice.off('audio_level', handleAudioLevel)\n\t\t\tservice.off('user_transcript_done', handleUserTranscript)\n\t\t\tservice.off('assistant_transcript', handleAssistantTranscript)\n\t\t\tservice.off('assistant_transcript_done', handleAssistantTranscriptDone)\n\t\t\tservice.off('tool_call_started', handleToolCallStarted)\n\t\t\tservice.off('tool_call_completed', handleToolCallCompleted)\n\t\t\tservice.off('error', handleError)\n\t\t}\n\t}, [getService])\n\n\t// Start session\n\tconst startSession = useCallback(\n\t\tasync (config?: RealtimeConfig) => {\n\t\t\ttry {\n\t\t\t\tsetIsConnecting(true)\n\t\t\t\tsetIsError(false)\n\t\t\t\tsetError(undefined)\n\n\t\t\t\tconst service = getService()\n\t\t\t\tawait service.startSession(config)\n\t\t\t} catch (err) {\n\t\t\t\tsetIsConnecting(false)\n\t\t\t\tsetIsError(true)\n\t\t\t\tconst errorMsg = err instanceof Error ? err.message : 'Failed to start session'\n\t\t\t\tsetError(errorMsg)\n\t\t\t\tonErrorRef.current?.(errorMsg)\n\t\t\t}\n\t\t},\n\t\t[getService]\n\t)\n\n\t// Stop session\n\tconst stopSession = useCallback(() => {\n\t\tconst service = getService()\n\t\tservice.stopSession()\n\t\tsetAudioLevel(undefined)\n\t\tsetTranscript(undefined)\n\t\tsetToolCall(undefined)\n\t}, [getService])\n\n\t// Toggle mute\n\tconst toggleMute = useCallback(\n\t\t(muted?: boolean) => {\n\t\t\tconst service = getService()\n\t\t\tconst newMuted = muted !== undefined ? muted : !isMuted\n\t\t\tservice.toggleMute(newMuted)\n\t\t\tsetIsMuted(newMuted)\n\t\t},\n\t\t[getService, isMuted]\n\t)\n\n\t// Send message\n\tconst sendMessage = useCallback(\n\t\t(text: string) => {\n\t\t\tconst service = getService()\n\t\t\tif (service.isSessionActive()) {\n\t\t\t\tservice.sendUserMessage(text)\n\t\t\t}\n\t\t},\n\t\t[getService]\n\t)\n\n\t// Memoize return value\n\treturn useMemo(\n\t\t() => ({\n\t\t\tisActive,\n\t\t\tisConnecting,\n\t\t\tisMuted,\n\t\t\tisError,\n\t\t\tconnectionState,\n\t\t\taudioLevel,\n\t\t\ttranscript,\n\t\t\ttoolCall,\n\t\t\terror,\n\t\t\tstartSession,\n\t\t\tstopSession,\n\t\t\ttoggleMute,\n\t\t\tsendMessage,\n\t\t}),\n\t\t[\n\t\t\tisActive,\n\t\t\tisConnecting,\n\t\t\tisMuted,\n\t\t\tisError,\n\t\t\tconnectionState,\n\t\t\taudioLevel,\n\t\t\ttranscript,\n\t\t\ttoolCall,\n\t\t\terror,\n\t\t\tstartSession,\n\t\t\tstopSession,\n\t\t\ttoggleMute,\n\t\t\tsendMessage,\n\t\t]\n\t)\n}\n","import { createContext, useContext, useMemo } from 'react'\n\nimport { useVoiceMode } from '../hooks/useVoiceMode'\n\nimport type { ReactNode } from 'react'\nimport type { UseVoiceModeReturn } from '../hooks/useVoiceMode'\nimport type { RegisteredTool, ToolExecutor } from '../services/realtime'\n\n/**\n * Voice Mode Provider\n *\n * Provides voice mode state and controls to the component tree.\n */\n\ninterface VoiceModeContextValue extends UseVoiceModeReturn {\n\tisSupported: boolean\n}\n\nconst VoiceModeContext = createContext<VoiceModeContextValue | null>(null)\n\nexport interface VoiceModeProviderProps {\n\tchildren: ReactNode\n\t/** Backend endpoint for ephemeral tokens */\n\ttokenEndpoint: string\n\t/** Tools available for voice mode */\n\ttools?: RegisteredTool[]\n\t/** Tool executor function */\n\ttoolExecutor?: ToolExecutor\n\t/** Callback when session connects */\n\tonConnect?: () => void\n\t/** Callback when session disconnects */\n\tonDisconnect?: (durationSeconds: number) => void\n\t/** Callback when error occurs */\n\tonError?: (error: string) => void\n\t/** Callback when user transcript is complete */\n\tonUserTranscript?: (text: string) => void\n\t/** Callback when assistant transcript is complete */\n\tonAssistantTranscript?: (text: string) => void\n}\n\n/**\n * Check if the browser supports WebRTC and getUserMedia\n */\nfunction checkVoiceModeSupport(): boolean {\n\treturn !!(\n\t\ttypeof window !== 'undefined' &&\n\t\twindow.RTCPeerConnection &&\n\t\tnavigator.mediaDevices?.getUserMedia\n\t)\n}\n\nexport function VoiceModeProvider({\n\tchildren,\n\ttokenEndpoint,\n\ttools,\n\ttoolExecutor,\n\tonConnect,\n\tonDisconnect,\n\tonError,\n\tonUserTranscript,\n\tonAssistantTranscript,\n}: VoiceModeProviderProps) {\n\tconst voiceMode = useVoiceMode({\n\t\ttokenEndpoint,\n\t\ttools,\n\t\ttoolExecutor,\n\t\tonConnect,\n\t\tonDisconnect,\n\t\tonError,\n\t\tonUserTranscript,\n\t\tonAssistantTranscript,\n\t})\n\n\tconst isSupported = useMemo(() => checkVoiceModeSupport(), [])\n\n\tconst value = useMemo(\n\t\t() => ({\n\t\t\t...voiceMode,\n\t\t\tisSupported,\n\t\t}),\n\t\t[voiceMode, isSupported]\n\t)\n\n\treturn <VoiceModeContext.Provider value={value}>{children}</VoiceModeContext.Provider>\n}\n\n/**\n * Hook to access voice mode context\n */\nexport function useVoiceModeContext(): VoiceModeContextValue {\n\tconst context = useContext(VoiceModeContext)\n\tif (!context) {\n\t\tthrow new Error('useVoiceModeContext must be used within a VoiceModeProvider')\n\t}\n\treturn context\n}\n\n/**\n * Hook to optionally access voice mode context (returns null if not in provider)\n */\nexport function useOptionalVoiceModeContext(): VoiceModeContextValue | null {\n\treturn useContext(VoiceModeContext)\n}\n","'use client'\n\nimport * as AvatarPrimitive from '@radix-ui/react-avatar'\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils'\n\nfunction Avatar({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Root>) {\n\treturn (\n\t\t<AvatarPrimitive.Root\n\t\t\tdata-slot=\"avatar\"\n\t\t\tclassName={cn('relative flex size-8 shrink-0 overflow-hidden rounded-full', className)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction AvatarImage({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Image>) {\n\treturn (\n\t\t<AvatarPrimitive.Image\n\t\t\tdata-slot=\"avatar-image\"\n\t\t\tclassName={cn('aspect-square size-full', className)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction AvatarFallback({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {\n\treturn (\n\t\t<AvatarPrimitive.Fallback\n\t\t\tdata-slot=\"avatar-fallback\"\n\t\t\tclassName={cn('bg-muted flex size-full items-center justify-center rounded-full', className)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nexport { Avatar, AvatarImage, AvatarFallback }\n","'use client'\n\nimport * as DialogPrimitive from '@radix-ui/react-dialog'\nimport { XIcon } from 'lucide-react'\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils'\n\nfunction Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {\n\treturn <DialogPrimitive.Root data-slot=\"dialog\" {...props} />\n}\n\nfunction DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n\treturn <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n\treturn <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\nfunction DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {\n\treturn <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />\n}\n\nfunction DialogOverlay({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n\treturn (\n\t\t<DialogPrimitive.Overlay\n\t\t\tdata-slot=\"dialog-overlay\"\n\t\t\tclassName={cn(\n\t\t\t\t'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction DialogContent({\n\tclassName,\n\tchildren,\n\tshowCloseButton = true,\n\t...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n\tshowCloseButton?: boolean\n}) {\n\treturn (\n\t\t<DialogPortal data-slot=\"dialog-portal\">\n\t\t\t<DialogOverlay />\n\t\t\t<DialogPrimitive.Content\n\t\t\t\tdata-slot=\"dialog-content\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',\n\t\t\t\t\tclassName\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t{showCloseButton && (\n\t\t\t\t\t<DialogPrimitive.Close\n\t\t\t\t\t\tdata-slot=\"dialog-close\"\n\t\t\t\t\t\tclassName=\"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<XIcon />\n\t\t\t\t\t\t<span className=\"sr-only\">Close</span>\n\t\t\t\t\t</DialogPrimitive.Close>\n\t\t\t\t)}\n\t\t\t</DialogPrimitive.Content>\n\t\t</DialogPortal>\n\t)\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"dialog-header\"\n\t\t\tclassName={cn('flex flex-col gap-2 text-center sm:text-left', className)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"dialog-footer\"\n\t\t\tclassName={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {\n\treturn (\n\t\t<DialogPrimitive.Title\n\t\t\tdata-slot=\"dialog-title\"\n\t\t\tclassName={cn('text-lg leading-none font-semibold', className)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction DialogDescription({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n\treturn (\n\t\t<DialogPrimitive.Description\n\t\t\tdata-slot=\"dialog-description\"\n\t\t\tclassName={cn('text-muted-foreground text-sm', className)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nexport {\n\tDialog,\n\tDialogClose,\n\tDialogContent,\n\tDialogDescription,\n\tDialogFooter,\n\tDialogHeader,\n\tDialogOverlay,\n\tDialogPortal,\n\tDialogTitle,\n\tDialogTrigger,\n}\n","'use client'\n\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip'\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils'\n\nfunction TooltipProvider({\n\tdelayDuration = 0,\n\t...props\n}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {\n\treturn (\n\t\t<TooltipPrimitive.Provider\n\t\t\tdata-slot=\"tooltip-provider\"\n\t\t\tdelayDuration={delayDuration}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>) {\n\treturn (\n\t\t<TooltipProvider>\n\t\t\t<TooltipPrimitive.Root data-slot=\"tooltip\" {...props} />\n\t\t</TooltipProvider>\n\t)\n}\n\nfunction TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {\n\treturn <TooltipPrimitive.Trigger data-slot=\"tooltip-trigger\" {...props} />\n}\n\nfunction TooltipContent({\n\tclassName,\n\tsideOffset = 0,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof TooltipPrimitive.Content>) {\n\treturn (\n\t\t<TooltipPrimitive.Portal>\n\t\t\t<TooltipPrimitive.Content\n\t\t\t\tdata-slot=\"tooltip-content\"\n\t\t\t\tsideOffset={sideOffset}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance',\n\t\t\t\t\tclassName\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t<TooltipPrimitive.Arrow className=\"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]\" />\n\t\t\t</TooltipPrimitive.Content>\n\t\t</TooltipPrimitive.Portal>\n\t)\n}\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }\n","import { Slot } from '@radix-ui/react-slot'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils'\n\nimport type { VariantProps } from 'class-variance-authority'\n\nexport interface ButtonProps\n\textends React.ComponentProps<'button'>,\n\t\tVariantProps<typeof buttonVariants> {\n\tasChild?: boolean\n}\n\nconst buttonVariants = cva(\n\t\"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive\",\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault: 'bg-primary text-primary-foreground hover:bg-primary/90',\n\t\t\t\tdestructive:\n\t\t\t\t\t'bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',\n\t\t\t\toutline:\n\t\t\t\t\t'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',\n\t\t\t\tsecondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',\n\t\t\t\tghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',\n\t\t\t\tlink: 'text-primary underline-offset-4 hover:underline',\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\tdefault: 'h-9 px-4 py-2 has-[>svg]:px-3',\n\t\t\t\tsm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5',\n\t\t\t\tlg: 'h-10 rounded-md px-6 has-[>svg]:px-4',\n\t\t\t\ticon: 'size-9',\n\t\t\t\t'icon-sm': 'size-8',\n\t\t\t\t'icon-lg': 'size-10',\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tvariant: 'default',\n\t\t\tsize: 'default',\n\t\t},\n\t}\n)\n\nfunction Button({\n\tclassName,\n\tvariant,\n\tsize,\n\tasChild = false,\n\t...props\n}: React.ComponentProps<'button'> &\n\tVariantProps<typeof buttonVariants> & {\n\t\tasChild?: boolean\n\t}) {\n\tconst Comp = asChild ? Slot : 'button'\n\n\treturn (\n\t\t<Comp\n\t\t\tdata-slot=\"button\"\n\t\t\tclassName={cn(buttonVariants({ variant, size, className }))}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nexport { Button, buttonVariants }\n","'use client'\n\nimport { Slottable } from '@radix-ui/react-slot'\nimport { forwardRef } from 'react'\n\nimport { cn } from '../lib/utils'\nimport { Button } from './button'\nimport { Tooltip, TooltipContent, TooltipTrigger } from './tooltip'\n\nimport type { ComponentPropsWithRef } from 'react'\n\nexport type TooltipIconButtonProps = ComponentPropsWithRef<typeof Button> & {\n\ttooltip: string\n\tside?: 'top' | 'bottom' | 'left' | 'right'\n}\n\nexport const TooltipIconButton = forwardRef<HTMLButtonElement, TooltipIconButtonProps>(\n\t({ children, tooltip, side = 'bottom', className, ...rest }, ref) => {\n\t\treturn (\n\t\t\t<Tooltip>\n\t\t\t\t<TooltipTrigger asChild>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\t{...rest}\n\t\t\t\t\t\tclassName={cn('aui-button-icon size-6 p-1', className)}\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Slottable>{children}</Slottable>\n\t\t\t\t\t\t<span className=\"aui-sr-only sr-only\">{tooltip}</span>\n\t\t\t\t\t</Button>\n\t\t\t\t</TooltipTrigger>\n\t\t\t\t<TooltipContent side={side}>{tooltip}</TooltipContent>\n\t\t\t</Tooltip>\n\t\t)\n\t}\n)\n\nTooltipIconButton.displayName = 'TooltipIconButton'\n","'use client'\n\nimport {\n\tAttachmentPrimitive,\n\tComposerPrimitive,\n\tMessagePrimitive,\n\tuseAssistantApi,\n\tuseAssistantState,\n} from '@assistant-ui/react'\nimport { FileText, PlusIcon, XIcon } from 'lucide-react'\nimport { useEffect, useState } from 'react'\nimport { useShallow } from 'zustand/shallow'\n\nimport { cn } from '../lib/utils'\nimport { Avatar, AvatarFallback, AvatarImage } from './avatar'\nimport { Dialog, DialogContent, DialogTitle, DialogTrigger } from './dialog'\nimport { Tooltip, TooltipContent, TooltipTrigger } from './tooltip'\nimport { TooltipIconButton } from './tooltip-icon-button'\n\nimport type { FC, PropsWithChildren } from 'react'\n\nconst useFileSrc = (file: File | undefined) => {\n\tconst [src, setSrc] = useState<string | undefined>(undefined)\n\n\tuseEffect(() => {\n\t\tif (!file) {\n\t\t\tsetSrc(undefined)\n\t\t\treturn\n\t\t}\n\n\t\tconst objectUrl = URL.createObjectURL(file)\n\t\tsetSrc(objectUrl)\n\n\t\treturn () => {\n\t\t\tURL.revokeObjectURL(objectUrl)\n\t\t}\n\t}, [file])\n\n\treturn src\n}\n\nconst useAttachmentSrc = () => {\n\tconst { file, src } = useAssistantState(\n\t\tuseShallow(({ attachment }): { file?: File; src?: string } => {\n\t\t\tif (attachment.type !== 'image') return {}\n\t\t\tif (attachment.file) return { file: attachment.file }\n\t\t\tconst src = attachment.content?.filter((c) => c.type === 'image')[0]?.image\n\t\t\tif (!src) return {}\n\t\t\treturn { src }\n\t\t})\n\t)\n\n\treturn useFileSrc(file) ?? src\n}\n\ntype AttachmentPreviewProps = {\n\tsrc: string\n}\n\nconst AttachmentPreview: FC<AttachmentPreviewProps> = ({ src }) => {\n\treturn (\n\t\t<img\n\t\t\tsrc={src}\n\t\t\talt=\"Image Preview\"\n\t\t\twidth={1}\n\t\t\theight={1}\n\t\t\tclassName=\"aui-attachment-preview-image-loaded block h-auto max-h-[80vh] w-auto max-w-full object-contain\"\n\t\t/>\n\t)\n}\n\nconst AttachmentPreviewDialog: FC<PropsWithChildren> = ({ children }) => {\n\tconst src = useAttachmentSrc()\n\n\tif (!src) return children\n\n\treturn (\n\t\t<Dialog>\n\t\t\t<DialogTrigger\n\t\t\t\tclassName=\"aui-attachment-preview-trigger cursor-pointer transition-colors hover:bg-accent/50\"\n\t\t\t\tasChild\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</DialogTrigger>\n\t\t\t<DialogContent className=\"aui-attachment-preview-dialog-content p-2 sm:max-w-3xl [&_svg]:text-background [&>button]:rounded-full [&>button]:bg-foreground/60 [&>button]:p-1 [&>button]:opacity-100 [&>button]:!ring-0 [&>button]:hover:[&_svg]:text-destructive\">\n\t\t\t\t<DialogTitle className=\"aui-sr-only sr-only\">Image Attachment Preview</DialogTitle>\n\t\t\t\t<div className=\"aui-attachment-preview relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden bg-background\">\n\t\t\t\t\t<AttachmentPreview src={src} />\n\t\t\t\t</div>\n\t\t\t</DialogContent>\n\t\t</Dialog>\n\t)\n}\n\nconst AttachmentThumb: FC = () => {\n\tconst isImage = useAssistantState(({ attachment }) => attachment.type === 'image')\n\tconst src = useAttachmentSrc()\n\n\treturn (\n\t\t<Avatar className=\"aui-attachment-tile-avatar h-full w-full rounded-none\">\n\t\t\t<AvatarImage\n\t\t\t\tsrc={src}\n\t\t\t\talt=\"Attachment preview\"\n\t\t\t\tclassName=\"aui-attachment-tile-image object-cover\"\n\t\t\t/>\n\t\t\t<AvatarFallback delayMs={isImage ? 200 : 0}>\n\t\t\t\t<FileText className=\"aui-attachment-tile-fallback-icon size-8 text-muted-foreground\" />\n\t\t\t</AvatarFallback>\n\t\t</Avatar>\n\t)\n}\n\nconst AttachmentUI: FC = () => {\n\tconst api = useAssistantApi()\n\tconst isComposer = api.attachment.source === 'composer'\n\n\tconst isImage = useAssistantState(({ attachment }) => attachment.type === 'image')\n\tconst typeLabel = useAssistantState(({ attachment }) => {\n\t\tconst type = attachment.type\n\t\tswitch (type) {\n\t\t\tcase 'image':\n\t\t\t\treturn 'Image'\n\t\t\tcase 'document':\n\t\t\t\treturn 'Document'\n\t\t\tcase 'file':\n\t\t\t\treturn 'File'\n\t\t\tdefault: {\n\t\t\t\tconst _exhaustiveCheck: never = type\n\t\t\t\tthrow new Error(`Unknown attachment type: ${_exhaustiveCheck}`)\n\t\t\t}\n\t\t}\n\t})\n\n\treturn (\n\t\t<Tooltip>\n\t\t\t<AttachmentPrimitive.Root\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'aui-attachment-root relative',\n\t\t\t\t\tisImage && 'aui-attachment-root-composer only:[&>#attachment-tile]:size-24'\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<AttachmentPreviewDialog>\n\t\t\t\t\t<TooltipTrigger asChild>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t'aui-attachment-tile size-14 cursor-pointer overflow-hidden rounded-[14px] border bg-muted transition-opacity hover:opacity-75',\n\t\t\t\t\t\t\t\tisComposer && 'aui-attachment-tile-composer border-foreground/20'\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\t\tid=\"attachment-tile\"\n\t\t\t\t\t\t\taria-label={`${typeLabel} attachment`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<AttachmentThumb />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</TooltipTrigger>\n\t\t\t\t</AttachmentPreviewDialog>\n\t\t\t\t{isComposer && <AttachmentRemove />}\n\t\t\t</AttachmentPrimitive.Root>\n\t\t\t<TooltipContent side=\"top\">\n\t\t\t\t<AttachmentPrimitive.Name />\n\t\t\t</TooltipContent>\n\t\t</Tooltip>\n\t)\n}\n\nconst AttachmentRemove: FC = () => {\n\treturn (\n\t\t<AttachmentPrimitive.Remove asChild>\n\t\t\t<TooltipIconButton\n\t\t\t\ttooltip=\"Remove file\"\n\t\t\t\tclassName=\"aui-attachment-tile-remove absolute top-1.5 right-1.5 size-3.5 rounded-full bg-white text-muted-foreground opacity-100 shadow-sm hover:!bg-white [&_svg]:text-black hover:[&_svg]:text-destructive\"\n\t\t\t\tside=\"top\"\n\t\t\t>\n\t\t\t\t<XIcon className=\"aui-attachment-remove-icon size-3 dark:stroke-[2.5px]\" />\n\t\t\t</TooltipIconButton>\n\t\t</AttachmentPrimitive.Remove>\n\t)\n}\n\nexport const UserMessageAttachments: FC = () => {\n\treturn (\n\t\t<div className=\"aui-user-message-attachments-end col-span-full col-start-1 row-start-1 flex w-full flex-row justify-end gap-2\">\n\t\t\t<MessagePrimitive.Attachments components={{ Attachment: AttachmentUI }} />\n\t\t</div>\n\t)\n}\n\nexport const ComposerAttachments: FC = () => {\n\treturn (\n\t\t<div className=\"aui-composer-attachments mb-2 flex w-full flex-row items-center gap-2 overflow-x-auto px-1.5 pt-0.5 pb-1 empty:hidden\">\n\t\t\t<ComposerPrimitive.Attachments components={{ Attachment: AttachmentUI }} />\n\t\t</div>\n\t)\n}\n\nexport const ComposerAddAttachment: FC = () => {\n\treturn (\n\t\t<ComposerPrimitive.AddAttachment asChild>\n\t\t\t<TooltipIconButton\n\t\t\t\ttooltip=\"Add Attachment\"\n\t\t\t\tside=\"bottom\"\n\t\t\t\tvariant=\"ghost\"\n\t\t\t\tsize=\"icon\"\n\t\t\t\tclassName=\"aui-composer-add-attachment size-[34px] rounded-full p-1 text-xs font-semibold hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30\"\n\t\t\t\taria-label=\"Add Attachment\"\n\t\t\t>\n\t\t\t\t<PlusIcon className=\"aui-attachment-add-icon size-5 stroke-[1.5px]\" />\n\t\t\t</TooltipIconButton>\n\t\t</ComposerPrimitive.AddAttachment>\n\t)\n}\n","'use client'\n\n// CSS imported via globals.css - see src/styles/globals.css for @assistant-ui/react-markdown styles\nimport {\n\tMarkdownTextPrimitive,\n\tunstable_memoizeMarkdownComponents as memoizeMarkdownComponents,\n\tuseIsMarkdownCodeBlock,\n} from '@assistant-ui/react-markdown'\nimport { CheckIcon, CopyIcon } from 'lucide-react'\nimport { memo, useState } from 'react'\nimport remarkGfm from 'remark-gfm'\n\nimport { cn } from '../lib/utils'\nimport { TooltipIconButton } from './tooltip-icon-button'\n\nimport type { CodeHeaderProps } from '@assistant-ui/react-markdown'\nimport type { FC } from 'react'\n\nconst MarkdownTextImpl = () => {\n\treturn (\n\t\t<MarkdownTextPrimitive\n\t\t\tremarkPlugins={[remarkGfm]}\n\t\t\tclassName=\"aui-md\"\n\t\t\tcomponents={defaultComponents}\n\t\t/>\n\t)\n}\n\nexport const MarkdownText = memo(MarkdownTextImpl)\n\nconst CodeHeader: FC<CodeHeaderProps> = ({ language, code }) => {\n\tconst { isCopied, copyToClipboard } = useCopyToClipboard()\n\tconst onCopy = () => {\n\t\tif (!code || isCopied) return\n\t\tcopyToClipboard(code)\n\t}\n\n\treturn (\n\t\t<div className=\"aui-code-header-root mt-2 flex items-center justify-between gap-2 rounded-t-lg bg-muted-foreground/15 px-2 py-1 text-sm font-semibold text-foreground dark:bg-muted-foreground/20\">\n\t\t\t<span className=\"aui-code-header-language lowercase [&>span]:text-xs\">{language}</span>\n\t\t\t<TooltipIconButton tooltip=\"Copy\" onClick={onCopy}>\n\t\t\t\t{!isCopied && <CopyIcon />}\n\t\t\t\t{isCopied && <CheckIcon />}\n\t\t\t</TooltipIconButton>\n\t\t</div>\n\t)\n}\n\nconst useCopyToClipboard = ({\n\tcopiedDuration = 3000,\n}: {\n\tcopiedDuration?: number\n} = {}) => {\n\tconst [isCopied, setIsCopied] = useState<boolean>(false)\n\n\tconst copyToClipboard = (value: string) => {\n\t\tif (!value) return\n\n\t\tvoid navigator.clipboard.writeText(value).then(() => {\n\t\t\tsetIsCopied(true)\n\t\t\tsetTimeout(() => setIsCopied(false), copiedDuration)\n\t\t})\n\t}\n\n\treturn { isCopied, copyToClipboard }\n}\n\nconst defaultComponents = memoizeMarkdownComponents({\n\th1: ({ className, ...props }) => (\n\t\t<h1\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-h1 mb-4 scroll-m-20 text-[25px] font-extrabold tracking-tight last:mb-0',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\th2: ({ className, ...props }) => (\n\t\t<h2\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-h2 mt-4 mb-2 scroll-m-20 text-[21px] font-semibold tracking-tight first:mt-0 last:mb-0',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\th3: ({ className, ...props }) => (\n\t\t<h3\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-h3 mt-3 mb-2 scroll-m-20 text-[19px] font-semibold tracking-tight first:mt-0 last:mb-0',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\th4: ({ className, ...props }) => (\n\t\t<h4\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-h4 mt-3 mb-2 scroll-m-20 text-[17px] font-semibold tracking-tight first:mt-0 last:mb-0',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\th5: ({ className, ...props }) => (\n\t\t<h5\n\t\t\tclassName={cn('aui-md-h5 my-2 text-[15px] font-semibold first:mt-0 last:mb-0', className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\th6: ({ className, ...props }) => (\n\t\t<h6\n\t\t\tclassName={cn('aui-md-h6 my-2 text-[15px] font-semibold first:mt-0 last:mb-0', className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\tp: ({ className, ...props }) => (\n\t\t<p\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-p mt-2 mb-2 text-[13px] leading-relaxed first:mt-0 last:mb-0',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\ta: ({ className, ...props }) => (\n\t\t<a\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-a text-[13px] font-medium text-primary underline underline-offset-4',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\tblockquote: ({ className, ...props }) => (\n\t\t<blockquote\n\t\t\tclassName={cn('aui-md-blockquote text-[13px] border-l-2 pl-3 italic', className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\tul: ({ className, ...props }) => (\n\t\t<ul\n\t\t\tclassName={cn('aui-md-ul text-[13px] my-2 ml-4 list-disc [&>li]:mt-1', className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\tol: ({ className, ...props }) => (\n\t\t<ol\n\t\t\tclassName={cn('aui-md-ol text-[13px] my-2 ml-4 list-decimal [&>li]:mt-1', className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\thr: ({ className, ...props }) => (\n\t\t<hr className={cn('aui-md-hr my-2 border-b', className)} {...props} />\n\t),\n\ttable: ({ className, ...props }) => (\n\t\t<table\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-table text-[13px] my-2 w-full border-separate border-spacing-0 overflow-y-auto',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\tth: ({ className, ...props }) => (\n\t\t<th\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-th bg-muted px-2 py-1 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [&[align=center]]:text-center [&[align=right]]:text-right',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\ttd: ({ className, ...props }) => (\n\t\t<td\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-td border-b border-l px-2 py-1 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\ttr: ({ className, ...props }) => (\n\t\t<tr\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\tsup: ({ className, ...props }) => (\n\t\t<sup className={cn('aui-md-sup [&>a]:text-xs [&>a]:no-underline', className)} {...props} />\n\t),\n\tpre: ({ className, ...props }) => (\n\t\t<pre\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-pre text-[13px] overflow-x-auto !rounded-t-none rounded-b-lg bg-black p-2 text-white',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\tcode: function Code({ className, ...props }) {\n\t\tconst isCodeBlock = useIsMarkdownCodeBlock()\n\t\treturn (\n\t\t\t<code\n\t\t\t\tclassName={cn(\n\t\t\t\t\t!isCodeBlock && 'aui-md-inline-code text-[13px] rounded border bg-muted font-semibold',\n\t\t\t\t\tclassName\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t)\n\t},\n\tCodeHeader,\n})\n","/**\n * MCP Transport Utilities\n *\n * Shared transport creation logic for MCP sources.\n * This eliminates duplication between MCPToolsProvider and useMCPSource.\n */\nimport { TabClientTransport } from '@mcp-b/transports'\nimport { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js'\nimport { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'\n\nimport type { MCPSourceConfig } from '@mcp-b/cloud-mirror-types'\nimport type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js'\n\n/**\n * Transport type options for HTTP-based connections\n */\nexport type TransportType = 'http' | 'sse'\n\n/**\n * Creates the appropriate MCP transport based on source configuration.\n *\n * @param config - The MCP source configuration\n * @param transportType - For HTTP sources, specifies whether to use HTTP or SSE transport\n * @returns A configured MCP Transport instance\n *\n * @example Tab-based transport (same-tab or iframe)\n * ```ts\n * const transport = createMCPTransport({ type: 'tab' })\n * ```\n *\n * @example HTTP transport with auth\n * ```ts\n * const transport = createMCPTransport({\n * type: 'http',\n * url: 'https://example.com/mcp',\n * authToken: 'secret'\n * }, 'http')\n * ```\n */\nexport function createMCPTransport(\n\tconfig: MCPSourceConfig,\n\ttransportType: TransportType = 'http'\n): Transport {\n\tif (config.type === 'tab') {\n\t\treturn new TabClientTransport({\n\t\t\ttargetOrigin: config.targetOrigin ?? window.location.origin,\n\t\t\tchannelId: config.channelId ?? 'mcp-default',\n\t\t})\n\t}\n\n\t// HTTP/SSE transport configuration\n\tconst serverUrl = new URL(config.url)\n\tconst headers: Record<string, string> = {\n\t\tAccept: 'application/json, text/event-stream',\n\t\t...(config.customHeaders ?? {}),\n\t}\n\n\tif (config.authToken) {\n\t\theaders.Authorization = `Bearer ${config.authToken}`\n\t}\n\n\tconst transportOptions = {\n\t\trequestInit: { headers },\n\t}\n\n\tif (transportType === 'sse') {\n\t\treturn new SSEClientTransport(serverUrl, transportOptions)\n\t}\n\n\treturn new StreamableHTTPClientTransport(serverUrl, transportOptions)\n}\n\n/**\n * Check if an error indicates we should try SSE fallback.\n *\n * This handles cases where HTTP streaming isn't supported (404/405) or\n * when the connection fails due to CORS/network issues.\n *\n * @param error - The error from the failed HTTP connection\n * @returns true if the error suggests trying SSE transport instead\n */\nexport function shouldFallbackToSSE(error: Error): boolean {\n\tconst message = error.message\n\treturn (\n\t\tmessage.includes('404') ||\n\t\tmessage.includes('Not Found') ||\n\t\tmessage.includes('405') ||\n\t\tmessage.includes('Method Not Allowed') ||\n\t\tmessage === 'Failed to fetch' || // Chrome CORS\n\t\tmessage === 'NetworkError when attempting to fetch resource.' || // Firefox\n\t\tmessage === 'Load failed' // Safari\n\t)\n}\n\n/**\n * Calculate exponential backoff delay for reconnection attempts.\n *\n * @param attempt - The current attempt number (0-based)\n * @param baseDelay - Base delay in milliseconds\n * @param maxDelay - Maximum delay cap in milliseconds\n * @returns The calculated delay in milliseconds\n */\nexport function calculateReconnectDelay(\n\tattempt: number,\n\tbaseDelay: number,\n\tmaxDelay: number\n): number {\n\treturn Math.min(baseDelay * Math.pow(2, attempt), maxDelay)\n}\n","/**\n * MCP Tools Provider\n *\n * Simplified provider for managing tools from multiple MCP sources.\n * Sources can be tab-based (same-tab, iframes) or HTTP-based (remote servers).\n *\n * @example Basic usage\n * ```tsx\n * <MCPToolsProvider>\n * <App />\n * </MCPToolsProvider>\n * ```\n *\n * @example Using the hook\n * ```tsx\n * const { tools, addSource, callTool } = useMCPTools()\n * await addSource('remote', { type: 'http', url: 'http://localhost:8888/mcp' })\n * ```\n */\nimport { Client } from '@modelcontextprotocol/sdk/client/index.js'\nimport { ToolListChangedNotificationSchema } from '@modelcontextprotocol/sdk/types.js'\nimport { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react'\n\nimport { MCP_TAB_CONNECT_DELAY_MS } from '../lib/constants'\nimport { createMCPTransport } from '../lib/mcp-transport'\n\nimport type {\n\tCallToolResult,\n\tMCPSource,\n\tMCPSourceConfig,\n\tPrompt,\n\tResource,\n\tResourceTemplate,\n\tToolWithSource,\n} from '@mcp-b/cloud-mirror-types'\nimport type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js'\nimport type { ReactNode } from 'react'\n\n/** Well-known source IDs */\nexport const SOURCE_LOCAL = 'local'\nexport const SOURCE_REMOTE = 'remote'\n\n/** Internal source state with client reference */\ninterface SourceState extends Omit<MCPSource, 'resources' | 'resourceTemplates' | 'prompts'> {\n\tclient: Client | null\n\ttransport: Transport | null\n\tresources: Resource[]\n\tresourceTemplates: ResourceTemplate[]\n\tprompts: Prompt[]\n}\n\n/**\n * MCP Tools Context Value\n */\nexport interface MCPToolsContextValue {\n\t/** All tools from all sources, tagged with _sourceId */\n\ttools: ToolWithSource[]\n\n\t/** All sources and their states */\n\tsources: Map<string, MCPSource>\n\n\t/** Add a new source */\n\taddSource: (id: string, config: MCPSourceConfig) => Promise<void>\n\n\t/** Remove a source */\n\tremoveSource: (id: string) => Promise<void>\n\n\t/** Get a specific source */\n\tgetSource: (id: string) => MCPSource | undefined\n\n\t/** Check if a source is connected */\n\tisConnected: (id: string) => boolean\n\n\t/** Call a tool (auto-routes based on tool name lookup) */\n\tcallTool: (name: string, args: Record<string, unknown>) => Promise<CallToolResult>\n\n\t/** Call a tool on a specific source */\n\tcallToolOnSource: (\n\t\tsourceId: string,\n\t\tname: string,\n\t\targs: Record<string, unknown>\n\t) => Promise<CallToolResult>\n}\n\nconst MCPToolsContext = createContext<MCPToolsContextValue | null>(null)\n\nexport interface MCPToolsProviderProps {\n\tchildren: ReactNode\n\t/** Auto-connect to same-tab source on mount (default: true) */\n\tautoConnectLocal?: boolean\n\t/** Callback when tools change */\n\tonToolsChange?: (tools: ToolWithSource[]) => void\n}\n\nexport function MCPToolsProvider({\n\tchildren,\n\tautoConnectLocal = true,\n\tonToolsChange,\n}: MCPToolsProviderProps) {\n\t// Sources map (internal state with client references)\n\tconst sourcesRef = useRef<Map<string, SourceState>>(new Map())\n\n\t// Trigger re-renders when sources change\n\tconst [, forceUpdate] = useState({})\n\n\t// Derived tools list\n\tconst [toolsList, setToolsList] = useState<ToolWithSource[]>([])\n\n\t/**\n\t * Rebuild tools list from all sources\n\t */\n\tconst rebuildTools = useCallback(() => {\n\t\tconst allTools: ToolWithSource[] = []\n\n\t\tsourcesRef.current.forEach((source) => {\n\t\t\tsource.tools.forEach((tool) => {\n\t\t\t\tallTools.push({\n\t\t\t\t\t...tool,\n\t\t\t\t\t_sourceId: source.id,\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\n\t\tsetToolsList(allTools)\n\t}, [])\n\n\t/**\n\t * Get public source state (without client reference)\n\t */\n\tconst getPublicSource = useCallback((source: SourceState): MCPSource => {\n\t\treturn {\n\t\t\tid: source.id,\n\t\t\tconfig: source.config,\n\t\t\tstate: source.state,\n\t\t\terror: source.error,\n\t\t\ttools: source.tools,\n\t\t\tresources: source.resources,\n\t\t\tresourceTemplates: source.resourceTemplates,\n\t\t\tprompts: source.prompts,\n\t\t}\n\t}, [])\n\n\t/**\n\t * Add a new source\n\t */\n\tconst addSource = useCallback(\n\t\tasync (id: string, config: MCPSourceConfig): Promise<void> => {\n\t\t\t// Remove existing source if any\n\t\t\tif (sourcesRef.current.has(id)) {\n\t\t\t\tawait removeSource(id)\n\t\t\t}\n\n\t\t\t// Create initial state\n\t\t\tconst sourceState: SourceState = {\n\t\t\t\tid,\n\t\t\t\tconfig,\n\t\t\t\tstate: 'connecting',\n\t\t\t\terror: null,\n\t\t\t\ttools: [],\n\t\t\t\tresources: [],\n\t\t\t\tresourceTemplates: [],\n\t\t\t\tprompts: [],\n\t\t\t\tclient: null,\n\t\t\t\ttransport: null,\n\t\t\t}\n\n\t\t\tsourcesRef.current.set(id, sourceState)\n\t\t\tforceUpdate({})\n\n\t\t\ttry {\n\t\t\t\t// Create client and transport\n\t\t\t\tconst client = new Client({\n\t\t\t\t\tname: `MCP-Source-${id}`,\n\t\t\t\t\tversion: '1.0.0',\n\t\t\t\t})\n\n\t\t\t\tconst transport = createMCPTransport(config)\n\n\t\t\t\t// Connect\n\t\t\t\tawait client.connect(transport)\n\n\t\t\t\t// Update state with client\n\t\t\t\tsourceState.client = client\n\t\t\t\tsourceState.transport = transport\n\n\t\t\t\t// Get initial tools\n\t\t\t\tconst { tools } = await client.listTools()\n\t\t\t\tsourceState.tools = tools\n\t\t\t\tsourceState.state = 'connected'\n\n\t\t\t\t// Listen for tool updates\n\t\t\t\tclient.setNotificationHandler(ToolListChangedNotificationSchema, async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst updated = await client.listTools()\n\t\t\t\t\t\tsourceState.tools = updated.tools\n\t\t\t\t\t\trebuildTools()\n\t\t\t\t\t\tforceUpdate({})\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tconsole.error(`[MCPToolsProvider:${id}] Failed to update tools:`, err)\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\trebuildTools()\n\t\t\t\tforceUpdate({})\n\t\t\t} catch (err) {\n\t\t\t\tconst error = err instanceof Error ? err : new Error(String(err))\n\t\t\t\tconsole.error(`[MCPToolsProvider:${id}] Connection failed:`, error)\n\n\t\t\t\tsourceState.state = 'error'\n\t\t\t\tsourceState.error = error\n\t\t\t\tforceUpdate({})\n\t\t\t}\n\t\t},\n\t\t[rebuildTools]\n\t)\n\n\t/**\n\t * Remove a source\n\t */\n\tconst removeSource = useCallback(\n\t\tasync (id: string): Promise<void> => {\n\t\t\tconst source = sourcesRef.current.get(id)\n\t\t\tif (!source) return\n\n\t\t\t// Close client and transport\n\t\t\tif (source.client) {\n\t\t\t\ttry {\n\t\t\t\t\tawait source.client.close()\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconsole.error(`[MCPToolsProvider:${id}] Error closing client:`, err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (source.transport) {\n\t\t\t\ttry {\n\t\t\t\t\tawait source.transport.close()\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconsole.error(`[MCPToolsProvider:${id}] Error closing transport:`, err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsourcesRef.current.delete(id)\n\t\t\trebuildTools()\n\t\t\tforceUpdate({})\n\t\t},\n\t\t[rebuildTools]\n\t)\n\n\t/**\n\t * Get a source by ID\n\t */\n\tconst getSource = useCallback(\n\t\t(id: string): MCPSource | undefined => {\n\t\t\tconst source = sourcesRef.current.get(id)\n\t\t\treturn source ? getPublicSource(source) : undefined\n\t\t},\n\t\t[getPublicSource]\n\t)\n\n\t/**\n\t * Check if a source is connected\n\t */\n\tconst isConnected = useCallback((id: string): boolean => {\n\t\tconst source = sourcesRef.current.get(id)\n\t\treturn source?.state === 'connected'\n\t}, [])\n\n\t/**\n\t * Call a tool on a specific source\n\t */\n\tconst callToolOnSource = useCallback(\n\t\tasync (\n\t\t\tsourceId: string,\n\t\t\tname: string,\n\t\t\targs: Record<string, unknown>\n\t\t): Promise<CallToolResult> => {\n\t\t\tconst source = sourcesRef.current.get(sourceId)\n\t\t\tif (!source?.client) {\n\t\t\t\tthrow new Error(`Source '${sourceId}' not connected`)\n\t\t\t}\n\n\t\t\treturn (await source.client.callTool({ name, arguments: args })) as CallToolResult\n\t\t},\n\t\t[]\n\t)\n\n\t/**\n\t * Call a tool (auto-routes based on tool name)\n\t */\n\tconst callTool = useCallback(\n\t\tasync (name: string, args: Record<string, unknown>): Promise<CallToolResult> => {\n\t\t\t// Find which source has this tool\n\t\t\tconst tool = toolsList.find((t) => t.name === name)\n\t\t\tif (!tool) {\n\t\t\t\tthrow new Error(`Tool '${name}' not found`)\n\t\t\t}\n\n\t\t\treturn callToolOnSource(tool._sourceId, name, args)\n\t\t},\n\t\t[toolsList, callToolOnSource]\n\t)\n\n\t/**\n\t * Get sources map for context (public view)\n\t */\n\tconst sources = useMemo(() => {\n\t\tconst publicSources = new Map<string, MCPSource>()\n\t\tsourcesRef.current.forEach((source) => {\n\t\t\tpublicSources.set(source.id, getPublicSource(source))\n\t\t})\n\t\treturn publicSources\n\t}, [toolsList, getPublicSource]) // Rebuild when tools change (which triggers on source changes)\n\n\t// Auto-connect to local source on mount\n\tuseEffect(() => {\n\t\tif (autoConnectLocal) {\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tvoid addSource(SOURCE_LOCAL, { type: 'tab' })\n\t\t\t}, MCP_TAB_CONNECT_DELAY_MS)\n\t\t\treturn () => clearTimeout(timer)\n\t\t}\n\t}, [autoConnectLocal, addSource])\n\n\t// Notify on tools change\n\tuseEffect(() => {\n\t\tonToolsChange?.(toolsList)\n\t}, [toolsList, onToolsChange])\n\n\t// Cleanup on unmount\n\tuseEffect(() => {\n\t\tconst sources = sourcesRef\n\t\treturn () => {\n\t\t\tsources.current.forEach((source) => {\n\t\t\t\tif (source.client) {\n\t\t\t\t\tvoid source.client.close().catch(console.error)\n\t\t\t\t}\n\t\t\t\tif (source.transport) {\n\t\t\t\t\tvoid source.transport.close().catch(console.error)\n\t\t\t\t}\n\t\t\t})\n\t\t\tsources.current.clear()\n\t\t}\n\t}, [])\n\n\tconst value = useMemo<MCPToolsContextValue>(\n\t\t() => ({\n\t\t\ttools: toolsList,\n\t\t\tsources,\n\t\t\taddSource,\n\t\t\tremoveSource,\n\t\t\tgetSource,\n\t\t\tisConnected,\n\t\t\tcallTool,\n\t\t\tcallToolOnSource,\n\t\t}),\n\t\t[\n\t\t\ttoolsList,\n\t\t\tsources,\n\t\t\taddSource,\n\t\t\tremoveSource,\n\t\t\tgetSource,\n\t\t\tisConnected,\n\t\t\tcallTool,\n\t\t\tcallToolOnSource,\n\t\t]\n\t)\n\n\treturn <MCPToolsContext.Provider value={value}>{children}</MCPToolsContext.Provider>\n}\n\n/**\n * Hook to access MCP Tools context\n */\nexport function useMCPTools(): MCPToolsContextValue {\n\tconst context = useContext(MCPToolsContext)\n\tif (!context) {\n\t\tthrow new Error('useMCPTools must be used within an MCPToolsProvider')\n\t}\n\treturn context\n}\n\n/**\n * Hook to optionally access MCP Tools context\n */\nexport function useOptionalMCPTools(): MCPToolsContextValue | null {\n\treturn useContext(MCPToolsContext)\n}\n","/**\n * Remote MCP Settings\n *\n * A dialog component for managing remote MCP server connections.\n * Allows users to add, connect, and disconnect from remote MCP servers.\n */\n\nimport { Loader2, Plug, Plus, X } from 'lucide-react'\nimport { useCallback, useState } from 'react'\n\nimport { cn } from '../lib/utils'\nimport { SOURCE_REMOTE, useMCPTools } from '../providers/MCPToolsProvider'\nimport { Button } from './button'\nimport {\n\tDialog,\n\tDialogContent,\n\tDialogDescription,\n\tDialogHeader,\n\tDialogTitle,\n\tDialogTrigger,\n} from './dialog'\nimport { TooltipIconButton } from './tooltip-icon-button'\n\nimport type { FC } from 'react'\n\ninterface RemoteServer {\n\tid: string\n\turl: string\n}\n\nexport const RemoteMCPSettings: FC = () => {\n\tconst { sources, addSource, removeSource } = useMCPTools()\n\tconst [isOpen, setIsOpen] = useState(false)\n\tconst [url, setUrl] = useState('')\n\tconst [isConnecting, setIsConnecting] = useState(false)\n\tconst [error, setError] = useState<string | null>(null)\n\n\t// Get connected remote servers\n\tconst remoteServers: RemoteServer[] = []\n\tsources.forEach((source, id) => {\n\t\tif (source.config.type === 'http' && id !== 'local') {\n\t\t\tremoteServers.push({ id, url: source.config.url })\n\t\t}\n\t})\n\n\tconst handleConnect = useCallback(async () => {\n\t\tif (!url.trim()) {\n\t\t\tsetError('Please enter a URL')\n\t\t\treturn\n\t\t}\n\n\t\t// Validate URL\n\t\ttry {\n\t\t\tnew URL(url)\n\t\t} catch {\n\t\t\tsetError('Please enter a valid URL')\n\t\t\treturn\n\t\t}\n\n\t\tsetIsConnecting(true)\n\t\tsetError(null)\n\n\t\ttry {\n\t\t\t// Generate a unique ID for this server\n\t\t\tconst serverId = remoteServers.length === 0 ? SOURCE_REMOTE : `remote-${Date.now()}`\n\t\t\tawait addSource(serverId, { type: 'http', url })\n\t\t\tsetUrl('')\n\t\t} catch (err) {\n\t\t\tsetError(err instanceof Error ? err.message : 'Failed to connect')\n\t\t} finally {\n\t\t\tsetIsConnecting(false)\n\t\t}\n\t}, [url, addSource, remoteServers.length])\n\n\tconst handleDisconnect = useCallback(\n\t\tasync (serverId: string) => {\n\t\t\tawait removeSource(serverId)\n\t\t},\n\t\t[removeSource]\n\t)\n\n\tconst handleKeyDown = useCallback(\n\t\t(e: React.KeyboardEvent) => {\n\t\t\tif (e.key === 'Enter' && !isConnecting) {\n\t\t\t\tvoid handleConnect()\n\t\t\t}\n\t\t},\n\t\t[handleConnect, isConnecting]\n\t)\n\n\t// Count connected servers\n\tconst connectedCount = remoteServers.filter((s) => {\n\t\tconst source = sources.get(s.id)\n\t\treturn source?.state === 'connected'\n\t}).length\n\n\treturn (\n\t\t<Dialog open={isOpen} onOpenChange={setIsOpen}>\n\t\t\t<DialogTrigger asChild>\n\t\t\t\t<TooltipIconButton\n\t\t\t\t\ttooltip=\"Connect MCP Server\"\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'gap-2 rounded-full text-muted-foreground hover:text-foreground',\n\t\t\t\t\t\tconnectedCount > 0 && 'text-green-600 dark:text-green-400'\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t<Plug className=\"h-4 w-4\" />\n\t\t\t\t\t{connectedCount > 0 && <span className=\"text-xs\">{connectedCount}</span>}\n\t\t\t\t</TooltipIconButton>\n\t\t\t</DialogTrigger>\n\t\t\t<DialogContent className=\"sm:max-w-md\">\n\t\t\t\t<DialogHeader>\n\t\t\t\t\t<DialogTitle>Remote MCP Servers</DialogTitle>\n\t\t\t\t\t<DialogDescription>\n\t\t\t\t\t\tConnect to remote MCP servers to access their tools, resources, and prompts.\n\t\t\t\t\t</DialogDescription>\n\t\t\t\t</DialogHeader>\n\n\t\t\t\t<div className=\"space-y-4\">\n\t\t\t\t\t{/* URL Input */}\n\t\t\t\t\t<div className=\"space-y-2\">\n\t\t\t\t\t\t<label htmlFor=\"mcp-url\" className=\"text-sm font-medium\">\n\t\t\t\t\t\t\tServer URL\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<div className=\"flex gap-2\">\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tid=\"mcp-url\"\n\t\t\t\t\t\t\t\ttype=\"url\"\n\t\t\t\t\t\t\t\tvalue={url}\n\t\t\t\t\t\t\t\tonChange={(e) => setUrl(e.target.value)}\n\t\t\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t\t\t\tplaceholder=\"https://mcp.example.com/sse\"\n\t\t\t\t\t\t\t\tdisabled={isConnecting}\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t'flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors',\n\t\t\t\t\t\t\t\t\t'placeholder:text-muted-foreground',\n\t\t\t\t\t\t\t\t\t'focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring',\n\t\t\t\t\t\t\t\t\t'disabled:cursor-not-allowed disabled:opacity-50'\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tonClick={() => void handleConnect()}\n\t\t\t\t\t\t\t\tdisabled={isConnecting || !url.trim()}\n\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\tclassName=\"shrink-0\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{isConnecting ? (\n\t\t\t\t\t\t\t\t\t<Loader2 className=\"h-4 w-4 animate-spin\" />\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<Plus className=\"h-4 w-4\" />\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{error && <p className=\"text-xs text-destructive\">{error}</p>}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{/* Connected Servers List */}\n\t\t\t\t\t{remoteServers.length > 0 && (\n\t\t\t\t\t\t<div className=\"space-y-2\">\n\t\t\t\t\t\t\t<label className=\"text-sm font-medium\">Connected Servers</label>\n\t\t\t\t\t\t\t<div className=\"space-y-2\">\n\t\t\t\t\t\t\t\t{remoteServers.map((server) => {\n\t\t\t\t\t\t\t\t\tconst source = sources.get(server.id)\n\t\t\t\t\t\t\t\t\tconst isConnected = source?.state === 'connected'\n\t\t\t\t\t\t\t\t\tconst isLoading = source?.state === 'connecting'\n\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tkey={server.id}\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"flex items-center gap-2 rounded-md border border-border bg-muted/50 px-3 py-2\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{/* Status indicator */}\n\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'h-2 w-2 shrink-0 rounded-full',\n\t\t\t\t\t\t\t\t\t\t\t\t\tisConnected && 'bg-green-500',\n\t\t\t\t\t\t\t\t\t\t\t\t\tisLoading && 'bg-yellow-500 animate-pulse',\n\t\t\t\t\t\t\t\t\t\t\t\t\tsource?.state === 'error' && 'bg-red-500'\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t\t\t\t{/* URL */}\n\t\t\t\t\t\t\t\t\t\t\t<span className=\"flex-1 truncate text-xs text-muted-foreground\">\n\t\t\t\t\t\t\t\t\t\t\t\t{server.url}\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\n\t\t\t\t\t\t\t\t\t\t\t{/* Tools count */}\n\t\t\t\t\t\t\t\t\t\t\t{isConnected && source && (\n\t\t\t\t\t\t\t\t\t\t\t\t<span className=\"text-xs text-muted-foreground\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t{source.tools.length} tools\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t\t\t\t\t{/* Disconnect button */}\n\t\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={() => void handleDisconnect(server.id)}\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"shrink-0 rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive\"\n\t\t\t\t\t\t\t\t\t\t\t\taria-label=\"Disconnect server\"\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{isLoading ? (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Loader2 className=\"h-3 w-3 animate-spin\" />\n\t\t\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<X className=\"h-3 w-3\" />\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{/* Help text */}\n\t\t\t\t\t<p className=\"text-xs text-muted-foreground\">\n\t\t\t\t\t\tEnter the URL of an MCP server that supports the Streamable HTTP transport (SSE).\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t</DialogContent>\n\t\t</Dialog>\n\t)\n}\n","import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react'\nimport { useState } from 'react'\n\nimport { Button } from './button'\n\nimport type { ToolCallMessagePartComponent } from '@assistant-ui/react'\n\nexport const ToolFallback: ToolCallMessagePartComponent = ({ toolName, argsText, result }) => {\n\tconst [isCollapsed, setIsCollapsed] = useState(true)\n\treturn (\n\t\t<div className=\"aui-tool-fallback-root mb-3 flex w-full flex-col gap-2 rounded-xl border border-border/20 bg-muted/5 py-2\">\n\t\t\t<div className=\"aui-tool-fallback-header flex items-center gap-2 px-3\">\n\t\t\t\t<CheckIcon className=\"aui-tool-fallback-icon size-3.5 text-emerald-500\" />\n\t\t\t\t<p className=\"aui-tool-fallback-title flex-grow text-sm font-medium\">{toolName}</p>\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\tclassName=\"h-6 w-6 p-0\"\n\t\t\t\t\tonClick={() => setIsCollapsed(!isCollapsed)}\n\t\t\t\t>\n\t\t\t\t\t{isCollapsed ? (\n\t\t\t\t\t\t<ChevronUpIcon className=\"size-3.5\" />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<ChevronDownIcon className=\"size-3.5\" />\n\t\t\t\t\t)}\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t\t{!isCollapsed && (\n\t\t\t\t<div className=\"aui-tool-fallback-content flex flex-col gap-2 border-t border-border/20 pt-2\">\n\t\t\t\t\t<div className=\"aui-tool-fallback-args-root px-3\">\n\t\t\t\t\t\t<span className=\"text-[10px] font-medium uppercase tracking-wide text-muted-foreground/70\">\n\t\t\t\t\t\t\tInput\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<pre className=\"aui-tool-fallback-args-value mt-1 max-h-40 overflow-auto rounded-lg bg-muted/30 px-2 py-1.5 font-mono text-[11px] leading-relaxed text-foreground/80 whitespace-pre-wrap\">\n\t\t\t\t\t\t\t{argsText}\n\t\t\t\t\t\t</pre>\n\t\t\t\t\t</div>\n\t\t\t\t\t{result !== undefined && (\n\t\t\t\t\t\t<div className=\"aui-tool-fallback-result-root border-t border-dashed border-border/20 px-3 pt-2\">\n\t\t\t\t\t\t\t<span className=\"text-[10px] font-medium uppercase tracking-wide text-muted-foreground/70\">\n\t\t\t\t\t\t\t\tOutput\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<pre className=\"aui-tool-fallback-result-content mt-1 max-h-60 overflow-auto rounded-lg bg-muted/30 px-2 py-1.5 font-mono text-[11px] leading-relaxed text-foreground/80 whitespace-pre-wrap\">\n\t\t\t\t\t\t\t\t{typeof result === 'string' ? result : JSON.stringify(result, null, 2)}\n\t\t\t\t\t\t\t</pre>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n","import { useEffect, useRef } from 'react'\n\nimport { cn } from '../lib/utils'\n\nimport type { HTMLAttributes } from 'react'\n\nexport type LiveWaveformProps = HTMLAttributes<HTMLDivElement> & {\n\tactive?: boolean\n\tprocessing?: boolean\n\tbarWidth?: number\n\tbarGap?: number\n\tbarRadius?: number\n\tbarColor?: string\n\tfadeEdges?: boolean\n\tfadeWidth?: number\n\theight?: string | number\n\tsensitivity?: number\n\tsmoothingTimeConstant?: number\n\tmode?: 'scrolling' | 'static'\n\t/** Manual audio level (0-1) instead of using microphone */\n\tmanualAudioLevel?: number\n}\n\nexport const LiveWaveform = ({\n\tactive = false,\n\tprocessing = false,\n\tbarWidth = 3,\n\tbarGap = 1,\n\tbarRadius = 1.5,\n\tbarColor,\n\tfadeEdges = true,\n\tfadeWidth = 24,\n\theight = 64,\n\tsensitivity = 1,\n\tmode = 'static',\n\tmanualAudioLevel,\n\tclassName,\n\t...props\n}: LiveWaveformProps) => {\n\tconst canvasRef = useRef<HTMLCanvasElement>(null)\n\tconst containerRef = useRef<HTMLDivElement>(null)\n\tconst historyRef = useRef<number[]>([])\n\tconst _animationRef = useRef<number>(0)\n\tconst lastUpdateRef = useRef<number>(0)\n\tconst processingAnimationRef = useRef<number | null>(null)\n\tconst lastActiveDataRef = useRef<number[]>([])\n\tconst transitionProgressRef = useRef(0)\n\tconst staticBarsRef = useRef<number[]>([])\n\tconst needsRedrawRef = useRef(true)\n\tconst gradientCacheRef = useRef<CanvasGradient | null>(null)\n\tconst lastWidthRef = useRef(0)\n\n\tconst heightStyle = typeof height === 'number' ? `${height}px` : height\n\tconst historySize = 60\n\tconst updateRate = 30\n\n\t// Handle canvas resizing\n\tuseEffect(() => {\n\t\tconst canvas = canvasRef.current\n\t\tconst container = containerRef.current\n\t\tif (!canvas || !container) return\n\n\t\tconst resizeObserver = new ResizeObserver(() => {\n\t\t\tconst rect = container.getBoundingClientRect()\n\t\t\tconst dpr = window.devicePixelRatio || 1\n\n\t\t\tcanvas.width = rect.width * dpr\n\t\t\tcanvas.height = rect.height * dpr\n\t\t\tcanvas.style.width = `${rect.width}px`\n\t\t\tcanvas.style.height = `${rect.height}px`\n\n\t\t\tconst ctx = canvas.getContext('2d')\n\t\t\tif (ctx) {\n\t\t\t\tctx.scale(dpr, dpr)\n\t\t\t}\n\n\t\t\tgradientCacheRef.current = null\n\t\t\tlastWidthRef.current = rect.width\n\t\t\tneedsRedrawRef.current = true\n\t\t})\n\n\t\tresizeObserver.observe(container)\n\t\treturn () => resizeObserver.disconnect()\n\t}, [])\n\n\t// Processing animation effect\n\tuseEffect(() => {\n\t\tif (processing && !active) {\n\t\t\tlet time = 0\n\t\t\ttransitionProgressRef.current = 0\n\n\t\t\tconst animateProcessing = () => {\n\t\t\t\ttime += 0.03\n\t\t\t\ttransitionProgressRef.current = Math.min(1, transitionProgressRef.current + 0.02)\n\n\t\t\t\tconst processingData: number[] = []\n\t\t\t\tconst barCount = Math.floor(\n\t\t\t\t\t(containerRef.current?.getBoundingClientRect().width || 200) / (barWidth + barGap)\n\t\t\t\t)\n\n\t\t\t\tif (mode === 'static') {\n\t\t\t\t\tconst halfCount = Math.floor(barCount / 2)\n\n\t\t\t\t\tfor (let i = 0; i < barCount; i++) {\n\t\t\t\t\t\tconst normalizedPosition = (i - halfCount) / halfCount\n\t\t\t\t\t\tconst centerWeight = 1 - Math.abs(normalizedPosition) * 0.4\n\n\t\t\t\t\t\tconst wave1 = Math.sin(time * 1.5 + normalizedPosition * 3) * 0.25\n\t\t\t\t\t\tconst wave2 = Math.sin(time * 0.8 - normalizedPosition * 2) * 0.2\n\t\t\t\t\t\tconst wave3 = Math.cos(time * 2 + normalizedPosition) * 0.15\n\t\t\t\t\t\tconst combinedWave = wave1 + wave2 + wave3\n\t\t\t\t\t\tconst processingValue = (0.2 + combinedWave) * centerWeight\n\n\t\t\t\t\t\tlet finalValue = processingValue\n\t\t\t\t\t\tif (lastActiveDataRef.current.length > 0 && transitionProgressRef.current < 1) {\n\t\t\t\t\t\t\tconst lastDataIndex = Math.min(i, lastActiveDataRef.current.length - 1)\n\t\t\t\t\t\t\tconst lastValue = lastActiveDataRef.current[lastDataIndex] || 0\n\t\t\t\t\t\t\tfinalValue =\n\t\t\t\t\t\t\t\tlastValue * (1 - transitionProgressRef.current) +\n\t\t\t\t\t\t\t\tprocessingValue * transitionProgressRef.current\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tprocessingData.push(Math.max(0.05, Math.min(1, finalValue)))\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfor (let i = 0; i < barCount; i++) {\n\t\t\t\t\t\tconst normalizedPosition = (i - barCount / 2) / (barCount / 2)\n\t\t\t\t\t\tconst centerWeight = 1 - Math.abs(normalizedPosition) * 0.4\n\n\t\t\t\t\t\tconst wave1 = Math.sin(time * 1.5 + i * 0.15) * 0.25\n\t\t\t\t\t\tconst wave2 = Math.sin(time * 0.8 - i * 0.1) * 0.2\n\t\t\t\t\t\tconst wave3 = Math.cos(time * 2 + i * 0.05) * 0.15\n\t\t\t\t\t\tconst combinedWave = wave1 + wave2 + wave3\n\t\t\t\t\t\tconst processingValue = (0.2 + combinedWave) * centerWeight\n\n\t\t\t\t\t\tlet finalValue = processingValue\n\t\t\t\t\t\tif (lastActiveDataRef.current.length > 0 && transitionProgressRef.current < 1) {\n\t\t\t\t\t\t\tconst lastDataIndex = Math.floor((i / barCount) * lastActiveDataRef.current.length)\n\t\t\t\t\t\t\tconst lastValue = lastActiveDataRef.current[lastDataIndex] || 0\n\t\t\t\t\t\t\tfinalValue =\n\t\t\t\t\t\t\t\tlastValue * (1 - transitionProgressRef.current) +\n\t\t\t\t\t\t\t\tprocessingValue * transitionProgressRef.current\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tprocessingData.push(Math.max(0.05, Math.min(1, finalValue)))\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (mode === 'static') {\n\t\t\t\t\tstaticBarsRef.current = processingData\n\t\t\t\t} else {\n\t\t\t\t\thistoryRef.current = processingData\n\t\t\t\t}\n\n\t\t\t\tneedsRedrawRef.current = true\n\t\t\t\tprocessingAnimationRef.current = requestAnimationFrame(animateProcessing)\n\t\t\t}\n\n\t\t\tanimateProcessing()\n\n\t\t\treturn () => {\n\t\t\t\tif (processingAnimationRef.current) {\n\t\t\t\t\tcancelAnimationFrame(processingAnimationRef.current)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (!active && !processing) {\n\t\t\tconst hasData =\n\t\t\t\tmode === 'static' ? staticBarsRef.current.length > 0 : historyRef.current.length > 0\n\n\t\t\tif (hasData) {\n\t\t\t\tlet fadeProgress = 0\n\t\t\t\tconst fadeToIdle = () => {\n\t\t\t\t\tfadeProgress += 0.03\n\t\t\t\t\tif (fadeProgress < 1) {\n\t\t\t\t\t\tif (mode === 'static') {\n\t\t\t\t\t\t\tstaticBarsRef.current = staticBarsRef.current.map(\n\t\t\t\t\t\t\t\t(value) => value * (1 - fadeProgress)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\thistoryRef.current = historyRef.current.map((value) => value * (1 - fadeProgress))\n\t\t\t\t\t\t}\n\t\t\t\t\t\tneedsRedrawRef.current = true\n\t\t\t\t\t\trequestAnimationFrame(fadeToIdle)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (mode === 'static') {\n\t\t\t\t\t\t\tstaticBarsRef.current = []\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\thistoryRef.current = []\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfadeToIdle()\n\t\t\t}\n\t\t}\n\t}, [processing, active, barWidth, barGap, mode])\n\n\t// Animation loop\n\tuseEffect(() => {\n\t\tconst canvas = canvasRef.current\n\t\tif (!canvas) return\n\n\t\tconst ctx = canvas.getContext('2d')\n\t\tif (!ctx) return\n\n\t\tlet rafId: number\n\n\t\tconst animate = (currentTime: number) => {\n\t\t\tconst rect = canvas.getBoundingClientRect()\n\n\t\t\t// Update audio data if active\n\t\t\tif (active && currentTime - lastUpdateRef.current > updateRate) {\n\t\t\t\tlastUpdateRef.current = currentTime\n\n\t\t\t\t// Use manual audio level if provided\n\t\t\t\tif (manualAudioLevel !== undefined) {\n\t\t\t\t\tconst level = Math.max(0.05, Math.min(1, manualAudioLevel * sensitivity))\n\n\t\t\t\t\tif (mode === 'static') {\n\t\t\t\t\t\tconst barCount = Math.floor(rect.width / (barWidth + barGap))\n\t\t\t\t\t\tconst halfCount = Math.floor(barCount / 2)\n\t\t\t\t\t\tconst newBars: number[] = []\n\n\t\t\t\t\t\t// Create symmetric bars based on manual level\n\t\t\t\t\t\tfor (let i = halfCount - 1; i >= 0; i--) {\n\t\t\t\t\t\t\tconst distanceFromCenter = Math.abs(i - halfCount / 2) / (halfCount / 2)\n\t\t\t\t\t\t\tconst value = level * (1 - distanceFromCenter * 0.3)\n\t\t\t\t\t\t\tnewBars.push(Math.max(0.05, value))\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor (let i = 0; i < halfCount; i++) {\n\t\t\t\t\t\t\tconst distanceFromCenter = Math.abs(i - halfCount / 2) / (halfCount / 2)\n\t\t\t\t\t\t\tconst value = level * (1 - distanceFromCenter * 0.3)\n\t\t\t\t\t\t\tnewBars.push(Math.max(0.05, value))\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstaticBarsRef.current = newBars\n\t\t\t\t\t\tlastActiveDataRef.current = newBars\n\t\t\t\t\t} else {\n\t\t\t\t\t\thistoryRef.current.push(level)\n\t\t\t\t\t\tlastActiveDataRef.current = [...historyRef.current]\n\n\t\t\t\t\t\tif (historyRef.current.length > historySize) {\n\t\t\t\t\t\t\thistoryRef.current.shift()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tneedsRedrawRef.current = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Only redraw if needed\n\t\t\tif (!needsRedrawRef.current && !active) {\n\t\t\t\trafId = requestAnimationFrame(animate)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tneedsRedrawRef.current = active\n\t\t\tctx.clearRect(0, 0, rect.width, rect.height)\n\n\t\t\tconst computedBarColor =\n\t\t\t\tbarColor ||\n\t\t\t\t(() => {\n\t\t\t\t\tconst style = getComputedStyle(canvas)\n\t\t\t\t\tconst color = style.color\n\t\t\t\t\treturn color || '#000'\n\t\t\t\t})()\n\n\t\t\tconst step = barWidth + barGap\n\t\t\tconst barCount = Math.floor(rect.width / step)\n\t\t\tconst centerY = rect.height / 2\n\n\t\t\t// Draw bars based on mode\n\t\t\tif (mode === 'static') {\n\t\t\t\tconst dataToRender = processing\n\t\t\t\t\t? staticBarsRef.current\n\t\t\t\t\t: active\n\t\t\t\t\t\t? staticBarsRef.current\n\t\t\t\t\t\t: staticBarsRef.current.length > 0\n\t\t\t\t\t\t\t? staticBarsRef.current\n\t\t\t\t\t\t\t: []\n\n\t\t\t\tfor (let i = 0; i < barCount && i < dataToRender.length; i++) {\n\t\t\t\t\tconst value = dataToRender[i] || 0.1\n\t\t\t\t\tconst x = i * step\n\t\t\t\t\tconst barHeight = Math.max(4, value * rect.height * 0.8)\n\t\t\t\t\tconst y = centerY - barHeight / 2\n\n\t\t\t\t\tctx.fillStyle = computedBarColor\n\t\t\t\t\tctx.globalAlpha = 0.4 + value * 0.6\n\n\t\t\t\t\tif (barRadius > 0) {\n\t\t\t\t\t\tctx.beginPath()\n\t\t\t\t\t\tctx.roundRect(x, y, barWidth, barHeight, barRadius)\n\t\t\t\t\t\tctx.fill()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tctx.fillRect(x, y, barWidth, barHeight)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Scrolling mode\n\t\t\t\tfor (let i = 0; i < barCount && i < historyRef.current.length; i++) {\n\t\t\t\t\tconst dataIndex = historyRef.current.length - 1 - i\n\t\t\t\t\tconst value = historyRef.current[dataIndex] || 0.1\n\t\t\t\t\tconst x = rect.width - (i + 1) * step\n\t\t\t\t\tconst barHeight = Math.max(4, value * rect.height * 0.8)\n\t\t\t\t\tconst y = centerY - barHeight / 2\n\n\t\t\t\t\tctx.fillStyle = computedBarColor\n\t\t\t\t\tctx.globalAlpha = 0.4 + value * 0.6\n\n\t\t\t\t\tif (barRadius > 0) {\n\t\t\t\t\t\tctx.beginPath()\n\t\t\t\t\t\tctx.roundRect(x, y, barWidth, barHeight, barRadius)\n\t\t\t\t\t\tctx.fill()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tctx.fillRect(x, y, barWidth, barHeight)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Apply edge fading\n\t\t\tif (fadeEdges && fadeWidth > 0 && rect.width > 0) {\n\t\t\t\tif (!gradientCacheRef.current || lastWidthRef.current !== rect.width) {\n\t\t\t\t\tconst gradient = ctx.createLinearGradient(0, 0, rect.width, 0)\n\t\t\t\t\tconst fadePercent = Math.min(0.3, fadeWidth / rect.width)\n\n\t\t\t\t\tgradient.addColorStop(0, 'rgba(255,255,255,1)')\n\t\t\t\t\tgradient.addColorStop(fadePercent, 'rgba(255,255,255,0)')\n\t\t\t\t\tgradient.addColorStop(1 - fadePercent, 'rgba(255,255,255,0)')\n\t\t\t\t\tgradient.addColorStop(1, 'rgba(255,255,255,1)')\n\n\t\t\t\t\tgradientCacheRef.current = gradient\n\t\t\t\t\tlastWidthRef.current = rect.width\n\t\t\t\t}\n\n\t\t\t\tctx.globalCompositeOperation = 'destination-out'\n\t\t\t\tctx.fillStyle = gradientCacheRef.current\n\t\t\t\tctx.fillRect(0, 0, rect.width, rect.height)\n\t\t\t\tctx.globalCompositeOperation = 'source-over'\n\t\t\t}\n\n\t\t\tctx.globalAlpha = 1\n\n\t\t\trafId = requestAnimationFrame(animate)\n\t\t}\n\n\t\trafId = requestAnimationFrame(animate)\n\n\t\treturn () => {\n\t\t\tif (rafId) {\n\t\t\t\tcancelAnimationFrame(rafId)\n\t\t\t}\n\t\t}\n\t}, [\n\t\tactive,\n\t\tprocessing,\n\t\tsensitivity,\n\t\tbarWidth,\n\t\tbarGap,\n\t\tbarRadius,\n\t\tbarColor,\n\t\tfadeEdges,\n\t\tfadeWidth,\n\t\tmode,\n\t\tmanualAudioLevel,\n\t\thistorySize,\n\t\tupdateRate,\n\t])\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cn('relative h-full w-full', className)}\n\t\t\tref={containerRef}\n\t\t\tstyle={{ height: heightStyle }}\n\t\t\taria-label={\n\t\t\t\tactive ? 'Live audio waveform' : processing ? 'Processing audio' : 'Audio waveform idle'\n\t\t\t}\n\t\t\trole=\"img\"\n\t\t\t{...props}\n\t\t>\n\t\t\t{!active && !processing && (\n\t\t\t\t<div className=\"border-muted-foreground/20 absolute top-1/2 right-0 left-0 -translate-y-1/2 border-t-2 border-dotted\" />\n\t\t\t)}\n\t\t\t<canvas className=\"block h-full w-full\" ref={canvasRef} />\n\t\t</div>\n\t)\n}\n","import { Mic, MicOff, Phone, PhoneOff, Volume2 } from 'lucide-react'\n\nimport { cn } from '../lib/utils'\nimport { Button } from './button'\nimport { LiveWaveform } from './live-waveform'\n\nimport type { AudioLevelData, ToolCallData } from '../services/realtime'\n\nexport interface VoiceIndicatorProps {\n\tisActive: boolean\n\tisConnecting: boolean\n\tisMuted: boolean\n\taudioLevel?: AudioLevelData\n\ttoolCall?: ToolCallData\n\tonStart: () => void\n\tonStop: () => void\n\tonToggleMute: () => void\n\tclassName?: string\n}\n\nexport function VoiceIndicator({\n\tisActive,\n\tisConnecting,\n\tisMuted,\n\taudioLevel,\n\ttoolCall,\n\tonStart,\n\tonStop,\n\tonToggleMute,\n\tclassName,\n}: VoiceIndicatorProps) {\n\tconst micLevel = audioLevel?.micLevel ?? 0\n\tconst speakerLevel = audioLevel?.speakerLevel ?? 0\n\n\t// Determine tool call status for border styling\n\tconst toolCallStatus =\n\t\ttoolCall?.status === 'started'\n\t\t\t? 'calling'\n\t\t\t: toolCall?.status === 'completed'\n\t\t\t\t? toolCall.error\n\t\t\t\t\t? 'error'\n\t\t\t\t\t: 'success'\n\t\t\t\t: 'idle'\n\n\t// Get border style based on tool call status\n\tconst getBorderClass = () => {\n\t\tswitch (toolCallStatus) {\n\t\t\tcase 'calling':\n\t\t\t\treturn 'border-blue-500/60 shadow-[0_0_12px_rgba(59,130,246,0.3)]'\n\t\t\tcase 'success':\n\t\t\t\treturn 'border-green-500/60 shadow-[0_0_12px_rgba(34,197,94,0.3)]'\n\t\t\tcase 'error':\n\t\t\t\treturn 'border-red-500/60 shadow-[0_0_12px_rgba(239,68,68,0.3)]'\n\t\t\tdefault:\n\t\t\t\treturn 'border-border'\n\t\t}\n\t}\n\n\tif (!isActive && !isConnecting) {\n\t\t// Collapsed state - just show start button\n\t\treturn (\n\t\t\t<div className={cn('flex items-center', className)}>\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\tonClick={onStart}\n\t\t\t\t\tclassName=\"gap-2 rounded-full\"\n\t\t\t\t\taria-label=\"Start voice session\"\n\t\t\t\t>\n\t\t\t\t\t<Phone className=\"h-4 w-4\" />\n\t\t\t\t\t<span className=\"text-xs\">Voice</span>\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t)\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cn(\n\t\t\t\t'flex items-center gap-3 rounded-full border bg-background/95 px-3 py-2 backdrop-blur-sm transition-all duration-300',\n\t\t\t\tgetBorderClass(),\n\t\t\t\tclassName\n\t\t\t)}\n\t\t>\n\t\t\t{/* User microphone indicator */}\n\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t<div\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'flex h-8 w-8 items-center justify-center rounded-full transition-colors',\n\t\t\t\t\t\tisMuted ? 'bg-muted text-muted-foreground' : 'bg-primary/10 text-primary'\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{isMuted ? <MicOff className=\"h-4 w-4\" /> : <Mic className=\"h-4 w-4\" />}\n\t\t\t\t</div>\n\t\t\t\t<div className=\"h-6 w-16\">\n\t\t\t\t\t<LiveWaveform\n\t\t\t\t\t\tactive={isActive && !isMuted}\n\t\t\t\t\t\tprocessing={isConnecting}\n\t\t\t\t\t\tmanualAudioLevel={micLevel}\n\t\t\t\t\t\tbarWidth={2}\n\t\t\t\t\t\tbarGap={1}\n\t\t\t\t\t\tbarRadius={2}\n\t\t\t\t\t\tbarColor=\"hsl(var(--primary))\"\n\t\t\t\t\t\theight={24}\n\t\t\t\t\t\tmode=\"static\"\n\t\t\t\t\t\tsensitivity={2.0}\n\t\t\t\t\t\tfadeEdges={false}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t{/* Separator */}\n\t\t\t<div className=\"h-6 w-px bg-border\" />\n\n\t\t\t{/* Agent speaker indicator */}\n\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t<div className=\"h-6 w-16\">\n\t\t\t\t\t<LiveWaveform\n\t\t\t\t\t\tactive={isActive}\n\t\t\t\t\t\tprocessing={isConnecting}\n\t\t\t\t\t\tmanualAudioLevel={speakerLevel}\n\t\t\t\t\t\tbarWidth={2}\n\t\t\t\t\t\tbarGap={1}\n\t\t\t\t\t\tbarRadius={2}\n\t\t\t\t\t\tbarColor=\"hsl(var(--muted-foreground))\"\n\t\t\t\t\t\theight={24}\n\t\t\t\t\t\tmode=\"static\"\n\t\t\t\t\t\tsensitivity={2.0}\n\t\t\t\t\t\tfadeEdges={false}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<div\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'flex h-8 w-8 items-center justify-center rounded-full bg-muted text-muted-foreground'\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t<Volume2 className=\"h-4 w-4\" />\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t{/* Separator */}\n\t\t\t<div className=\"h-6 w-px bg-border\" />\n\n\t\t\t{/* Controls */}\n\t\t\t<div className=\"flex items-center gap-1\">\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\tonClick={onToggleMute}\n\t\t\t\t\tdisabled={!isActive}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'h-8 w-8 rounded-full',\n\t\t\t\t\t\tisMuted && 'text-destructive hover:text-destructive'\n\t\t\t\t\t)}\n\t\t\t\t\taria-label={isMuted ? 'Unmute microphone' : 'Mute microphone'}\n\t\t\t\t>\n\t\t\t\t\t{isMuted ? <MicOff className=\"h-4 w-4\" /> : <Mic className=\"h-4 w-4\" />}\n\t\t\t\t</Button>\n\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\tonClick={onStop}\n\t\t\t\t\tclassName=\"h-8 w-8 rounded-full text-destructive hover:bg-destructive/10 hover:text-destructive\"\n\t\t\t\t\taria-label=\"End voice session\"\n\t\t\t\t>\n\t\t\t\t\t<PhoneOff className=\"h-4 w-4\" />\n\t\t\t\t</Button>\n\t\t\t</div>\n\n\t\t\t{/* Tool call indicator */}\n\t\t\t{toolCall && toolCallStatus !== 'idle' && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'ml-1 flex items-center gap-1 rounded-full px-2 py-0.5 text-xs',\n\t\t\t\t\t\ttoolCallStatus === 'calling' && 'bg-blue-500/10 text-blue-600',\n\t\t\t\t\t\ttoolCallStatus === 'success' && 'bg-green-500/10 text-green-600',\n\t\t\t\t\t\ttoolCallStatus === 'error' && 'bg-red-500/10 text-red-600'\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'h-1.5 w-1.5 rounded-full',\n\t\t\t\t\t\t\ttoolCallStatus === 'calling' && 'animate-pulse bg-blue-500',\n\t\t\t\t\t\t\ttoolCallStatus === 'success' && 'bg-green-500',\n\t\t\t\t\t\t\ttoolCallStatus === 'error' && 'bg-red-500'\n\t\t\t\t\t\t)}\n\t\t\t\t\t/>\n\t\t\t\t\t<span className=\"max-w-[80px] truncate\">{toolCall.toolName}</span>\n\t\t\t\t</div>\n\t\t\t)}\n\n\t\t\t{/* Connecting indicator */}\n\t\t\t{isConnecting && (\n\t\t\t\t<div className=\"ml-1 flex items-center gap-1 text-xs text-muted-foreground\">\n\t\t\t\t\t<span className=\"h-1.5 w-1.5 animate-pulse rounded-full bg-amber-500\" />\n\t\t\t\t\t<span>Connecting...</span>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n","/**\n * Thread with Voice Mode\n *\n * Enhanced thread component that includes voice mode.\n * Replaces the composer with a voice panel when voice is active.\n */\n\nimport {\n\tActionBarPrimitive,\n\tBranchPickerPrimitive,\n\tComposerPrimitive,\n\tErrorPrimitive,\n\tMessagePrimitive,\n\tThreadPrimitive,\n} from '@assistant-ui/react'\nimport {\n\tArrowDownIcon,\n\tArrowUpIcon,\n\tCheckIcon,\n\tChevronLeftIcon,\n\tChevronRightIcon,\n\tCopyIcon,\n\tPencilIcon,\n\tPhone,\n\tRefreshCwIcon,\n\tSquare,\n} from 'lucide-react'\nimport { AnimatePresence, domAnimation, LazyMotion, MotionConfig } from 'motion/react'\nimport * as m from 'motion/react-m'\n\nimport { cn } from '../lib/utils'\nimport { useOptionalVoiceModeContext } from '../providers/VoiceModeProvider'\nimport { ComposerAddAttachment, ComposerAttachments, UserMessageAttachments } from './attachment'\nimport { Button } from './button'\nimport { MarkdownText } from './markdown-text'\nimport { RemoteMCPSettings } from './RemoteMCPSettings'\nimport { ToolFallback } from './tool-fallback'\nimport { TooltipIconButton } from './tooltip-icon-button'\nimport { VoiceIndicator } from './voice-indicator'\n\nimport type { FC } from 'react'\n\nexport const ThreadWithVoice: FC = () => {\n\treturn (\n\t\t<LazyMotion features={domAnimation}>\n\t\t\t<MotionConfig reducedMotion=\"user\">\n\t\t\t\t<ThreadPrimitive.Root\n\t\t\t\t\tclassName=\"aui-root aui-thread-root app-shell @container relative flex h-full flex-col bg-background/50\"\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\t['--thread-max-width' as string]: '100%',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<ThreadPrimitive.Viewport className=\"aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll px-4\">\n\t\t\t\t\t\t<ThreadPrimitive.If empty>\n\t\t\t\t\t\t\t<ThreadWelcome />\n\t\t\t\t\t\t</ThreadPrimitive.If>\n\n\t\t\t\t\t\t<ThreadPrimitive.Messages\n\t\t\t\t\t\t\tcomponents={{\n\t\t\t\t\t\t\t\tUserMessage,\n\t\t\t\t\t\t\t\tEditComposer,\n\t\t\t\t\t\t\t\tAssistantMessage,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<ThreadPrimitive.If empty={false}>\n\t\t\t\t\t\t\t<div className=\"aui-thread-viewport-spacer min-h-8 grow\" />\n\t\t\t\t\t\t</ThreadPrimitive.If>\n\n\t\t\t\t\t\t<ComposerArea />\n\t\t\t\t\t</ThreadPrimitive.Viewport>\n\t\t\t\t</ThreadPrimitive.Root>\n\t\t\t</MotionConfig>\n\t\t</LazyMotion>\n\t)\n}\n\n/**\n * Composer area with voice indicator\n */\nconst ComposerArea: FC = () => {\n\tconst voiceMode = useOptionalVoiceModeContext()\n\n\treturn (\n\t\t<div className=\"aui-composer-wrapper sticky bottom-0 mx-auto flex w-full max-w-[var(--thread-max-width)] flex-col gap-4 overflow-visible rounded-t-3xl pb-4 md:pb-6\">\n\t\t\t<ThreadScrollToBottom />\n\n\t\t\t{/* Voice indicator - shown above composer when voice mode is active */}\n\t\t\t<AnimatePresence>\n\t\t\t\t{voiceMode?.isSupported && (voiceMode.isActive || voiceMode.isConnecting) && (\n\t\t\t\t\t<m.div\n\t\t\t\t\t\tinitial={{ opacity: 0, y: 20 }}\n\t\t\t\t\t\tanimate={{ opacity: 1, y: 0 }}\n\t\t\t\t\t\texit={{ opacity: 0, y: -10 }}\n\t\t\t\t\t\ttransition={{ duration: 0.2 }}\n\t\t\t\t\t\tclassName=\"flex justify-center\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<VoiceIndicator\n\t\t\t\t\t\t\tisActive={voiceMode.isActive}\n\t\t\t\t\t\t\tisConnecting={voiceMode.isConnecting}\n\t\t\t\t\t\t\tisMuted={voiceMode.isMuted}\n\t\t\t\t\t\t\taudioLevel={voiceMode.audioLevel}\n\t\t\t\t\t\t\ttoolCall={voiceMode.toolCall}\n\t\t\t\t\t\t\tonStart={voiceMode.startSession}\n\t\t\t\t\t\t\tonStop={voiceMode.stopSession}\n\t\t\t\t\t\t\tonToggleMute={() => voiceMode.toggleMute()}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</m.div>\n\t\t\t\t)}\n\t\t\t</AnimatePresence>\n\n\t\t\t<TextComposer />\n\t\t</div>\n\t)\n}\n\nconst TextComposer: FC = () => {\n\tconst voiceMode = useOptionalVoiceModeContext()\n\n\treturn (\n\t\t<ComposerPrimitive.Root\n\t\t\tclassName={cn(\n\t\t\t\t'aui-composer-root group/composer flex w-full flex-col overflow-hidden rounded-2xl px-3 py-2',\n\t\t\t\t'border border-border/40 shadow-sm backdrop-blur-md',\n\t\t\t\t'bg-background/80',\n\t\t\t\t'transition-all duration-200',\n\t\t\t\t'focus-within:border-ring/50 focus-within:shadow-md',\n\t\t\t\t'hover:border-border/60'\n\t\t\t)}\n\t\t>\n\t\t\t<ComposerAttachments />\n\t\t\t<ComposerPrimitive.Input\n\t\t\t\tplaceholder=\"Send a message...\"\n\t\t\t\tclassName=\"aui-composer-input mt-2 max-h-24 w-full resize-none bg-transparent px-0 py-2 text-sm leading-relaxed text-foreground placeholder:text-muted-foreground/70 focus-visible:outline-none focus-visible:ring-0\"\n\t\t\t\trows={1}\n\t\t\t\tautoFocus\n\t\t\t\taria-label=\"Message input\"\n\t\t\t/>\n\t\t\t<div className=\"aui-composer-action-wrapper mt-2 flex items-center justify-between text-muted-foreground\">\n\t\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t\t<ComposerAddAttachment />\n\n\t\t\t\t\t{/* Remote MCP settings */}\n\t\t\t\t\t<RemoteMCPSettings />\n\n\t\t\t\t\t{/* Voice mode button */}\n\t\t\t\t\t{voiceMode?.isSupported && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\tonClick={() => voiceMode.startSession()}\n\t\t\t\t\t\t\tclassName=\"gap-2 rounded-full text-muted-foreground hover:text-foreground\"\n\t\t\t\t\t\t\taria-label=\"Start voice session\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Phone className=\"h-4 w-4\" />\n\t\t\t\t\t\t\t<span className=\"text-xs\">Voice</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"flex items-center gap-1.5\">\n\t\t\t\t\t<ThreadPrimitive.If running={false}>\n\t\t\t\t\t\t<ComposerPrimitive.Send asChild>\n\t\t\t\t\t\t\t<TooltipIconButton\n\t\t\t\t\t\t\t\ttooltip=\"Send message\"\n\t\t\t\t\t\t\t\tside=\"top\"\n\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\t\t\tclassName=\"aui-composer-send size-8 shrink-0 rounded-full border border-primary/60 bg-primary px-0 text-primary-foreground shadow-[0_12px_24px_-16px_rgba(37,99,235,0.55)] transition-shadow hover:shadow-[0_14px_24px_-14px_rgba(37,99,235,0.6)] focus-visible:ring-2 focus-visible:ring-primary/40\"\n\t\t\t\t\t\t\t\taria-label=\"Send message\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ArrowUpIcon className=\"aui-composer-send-icon size-4\" />\n\t\t\t\t\t\t\t</TooltipIconButton>\n\t\t\t\t\t\t</ComposerPrimitive.Send>\n\t\t\t\t\t</ThreadPrimitive.If>\n\n\t\t\t\t\t<ThreadPrimitive.If running>\n\t\t\t\t\t\t<ComposerPrimitive.Cancel asChild>\n\t\t\t\t\t\t\t<TooltipIconButton\n\t\t\t\t\t\t\t\ttooltip=\"Stop generating\"\n\t\t\t\t\t\t\t\tside=\"top\"\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\t\t\tclassName=\"aui-composer-cancel size-8 shrink-0 rounded-full border border-destructive/60 bg-destructive px-0 text-destructive-foreground shadow-[0_12px_24px_-18px_rgba(220,38,38,0.55)] transition-shadow hover:shadow-[0_14px_24px_-16px_rgba(220,38,38,0.6)] focus-visible:ring-2 focus-visible:ring-destructive/40\"\n\t\t\t\t\t\t\t\taria-label=\"Stop generating\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Square className=\"aui-composer-cancel-icon size-3.5\" />\n\t\t\t\t\t\t\t</TooltipIconButton>\n\t\t\t\t\t\t</ComposerPrimitive.Cancel>\n\t\t\t\t\t</ThreadPrimitive.If>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</ComposerPrimitive.Root>\n\t)\n}\n\nconst ThreadScrollToBottom: FC = () => {\n\treturn (\n\t\t<ThreadPrimitive.ScrollToBottom asChild>\n\t\t\t<TooltipIconButton\n\t\t\t\ttooltip=\"Scroll to bottom\"\n\t\t\t\tvariant=\"outline\"\n\t\t\t\tclassName=\"aui-thread-scroll-to-bottom absolute -top-12 z-10 self-center rounded-full p-4 disabled:invisible dark:bg-background dark:hover:bg-accent\"\n\t\t\t>\n\t\t\t\t<ArrowDownIcon />\n\t\t\t</TooltipIconButton>\n\t\t</ThreadPrimitive.ScrollToBottom>\n\t)\n}\n\nconst ThreadWelcome: FC = () => {\n\treturn (\n\t\t<div className=\"aui-thread-welcome-root mx-auto my-auto flex w-full max-w-[var(--thread-max-width)] flex-grow flex-col\">\n\t\t\t<div className=\"aui-thread-welcome-center flex w-full flex-grow flex-col items-center justify-center\">\n\t\t\t\t<div className=\"aui-thread-welcome-message flex size-full flex-col justify-center px-8\">\n\t\t\t\t\t<m.div\n\t\t\t\t\t\tinitial={{ opacity: 0, y: 10 }}\n\t\t\t\t\t\tanimate={{ opacity: 1, y: 0 }}\n\t\t\t\t\t\texit={{ opacity: 0, y: 10 }}\n\t\t\t\t\t\tclassName=\"aui-thread-welcome-message-motion-1 text-3xl font-bold tracking-tight\"\n\t\t\t\t\t>\n\t\t\t\t\t\tHello there!\n\t\t\t\t\t</m.div>\n\t\t\t\t\t<m.div\n\t\t\t\t\t\tinitial={{ opacity: 0, y: 10 }}\n\t\t\t\t\t\tanimate={{ opacity: 1, y: 0 }}\n\t\t\t\t\t\texit={{ opacity: 0, y: 10 }}\n\t\t\t\t\t\ttransition={{ delay: 0.1 }}\n\t\t\t\t\t\tclassName=\"aui-thread-welcome-message-motion-2 mt-2 text-lg text-muted-foreground\"\n\t\t\t\t\t>\n\t\t\t\t\t\tHow can I help you today?\n\t\t\t\t\t</m.div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<ThreadSuggestions />\n\t\t</div>\n\t)\n}\n\nconst ThreadSuggestions: FC = () => {\n\treturn (\n\t\t<div className=\"aui-thread-welcome-suggestions grid w-full gap-2 pb-4 @md:grid-cols-2\">\n\t\t\t{[\n\t\t\t\t{\n\t\t\t\t\ttitle: \"What's the weather\",\n\t\t\t\t\tlabel: 'in San Francisco?',\n\t\t\t\t\taction: \"What's the weather in San Francisco?\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttitle: 'Explain React hooks',\n\t\t\t\t\tlabel: 'like useState and useEffect',\n\t\t\t\t\taction: 'Explain React hooks like useState and useEffect',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttitle: 'Write a SQL query',\n\t\t\t\t\tlabel: 'to find top customers',\n\t\t\t\t\taction: 'Write a SQL query to find top customers',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttitle: 'Create a meal plan',\n\t\t\t\t\tlabel: 'for healthy weight loss',\n\t\t\t\t\taction: 'Create a meal plan for healthy weight loss',\n\t\t\t\t},\n\t\t\t].map((suggestedAction, index) => (\n\t\t\t\t<m.div\n\t\t\t\t\tinitial={{ opacity: 0, y: 20 }}\n\t\t\t\t\tanimate={{ opacity: 1, y: 0 }}\n\t\t\t\t\texit={{ opacity: 0, y: 20 }}\n\t\t\t\t\ttransition={{ delay: 0.05 * index }}\n\t\t\t\t\tkey={`suggested-action-${suggestedAction.title}-${index}`}\n\t\t\t\t\tclassName=\"aui-thread-welcome-suggestion-display [&:nth-child(n+3)]:hidden @md:[&:nth-child(n+3)]:block\"\n\t\t\t\t>\n\t\t\t\t\t<ThreadPrimitive.Suggestion prompt={suggestedAction.action} send asChild>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\tclassName=\"aui-thread-welcome-suggestion h-auto w-full flex-1 flex-wrap items-start justify-start gap-1 rounded-xl border-border/50 bg-background/50 px-4 py-3 text-left text-sm transition-colors hover:bg-accent/50 hover:border-accent @md:flex-col\"\n\t\t\t\t\t\t\taria-label={suggestedAction.action}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span className=\"aui-thread-welcome-suggestion-text-1 font-medium text-foreground\">\n\t\t\t\t\t\t\t\t{suggestedAction.title}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"aui-thread-welcome-suggestion-text-2 text-muted-foreground text-xs\">\n\t\t\t\t\t\t\t\t{suggestedAction.label}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</ThreadPrimitive.Suggestion>\n\t\t\t\t</m.div>\n\t\t\t))}\n\t\t</div>\n\t)\n}\n\nconst MessageError: FC = () => {\n\treturn (\n\t\t<MessagePrimitive.Error>\n\t\t\t<ErrorPrimitive.Root className=\"aui-message-error-root mt-2 rounded-md border border-destructive bg-destructive/10 p-3 text-sm text-destructive dark:bg-destructive/5 dark:text-red-200\">\n\t\t\t\t<ErrorPrimitive.Message className=\"aui-message-error-message line-clamp-2\" />\n\t\t\t</ErrorPrimitive.Root>\n\t\t</MessagePrimitive.Error>\n\t)\n}\n\nconst AssistantMessage: FC = () => {\n\treturn (\n\t\t<MessagePrimitive.Root asChild>\n\t\t\t<div\n\t\t\t\tclassName=\"aui-assistant-message-root relative mx-auto w-full max-w-[var(--thread-max-width)] animate-in py-4 duration-200 fade-in slide-in-from-bottom-1 last:mb-24\"\n\t\t\t\tdata-role=\"assistant\"\n\t\t\t>\n\t\t\t\t<div className=\"aui-assistant-message-content mx-2 leading-7 break-words text-foreground\">\n\t\t\t\t\t<MessagePrimitive.Parts\n\t\t\t\t\t\tcomponents={{\n\t\t\t\t\t\t\tText: MarkdownText,\n\t\t\t\t\t\t\ttools: { Fallback: ToolFallback },\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t<MessageError />\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"aui-assistant-message-footer mt-2 ml-2 flex\">\n\t\t\t\t\t<BranchPicker />\n\t\t\t\t\t<AssistantActionBar />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</MessagePrimitive.Root>\n\t)\n}\n\nconst AssistantActionBar: FC = () => {\n\treturn (\n\t\t<ActionBarPrimitive.Root\n\t\t\thideWhenRunning\n\t\t\tautohide=\"not-last\"\n\t\t\tautohideFloat=\"single-branch\"\n\t\t\tclassName=\"aui-assistant-action-bar-root col-start-3 row-start-2 -ml-1 flex gap-1 text-muted-foreground data-floating:absolute data-floating:rounded-md data-floating:border data-floating:bg-background data-floating:p-1 data-floating:shadow-sm\"\n\t\t>\n\t\t\t<ActionBarPrimitive.Copy asChild>\n\t\t\t\t<TooltipIconButton tooltip=\"Copy\">\n\t\t\t\t\t<MessagePrimitive.If copied>\n\t\t\t\t\t\t<CheckIcon />\n\t\t\t\t\t</MessagePrimitive.If>\n\t\t\t\t\t<MessagePrimitive.If copied={false}>\n\t\t\t\t\t\t<CopyIcon />\n\t\t\t\t\t</MessagePrimitive.If>\n\t\t\t\t</TooltipIconButton>\n\t\t\t</ActionBarPrimitive.Copy>\n\t\t\t<ActionBarPrimitive.Reload asChild>\n\t\t\t\t<TooltipIconButton tooltip=\"Refresh\">\n\t\t\t\t\t<RefreshCwIcon />\n\t\t\t\t</TooltipIconButton>\n\t\t\t</ActionBarPrimitive.Reload>\n\t\t</ActionBarPrimitive.Root>\n\t)\n}\n\nconst UserMessage: FC = () => {\n\treturn (\n\t\t<MessagePrimitive.Root asChild>\n\t\t\t<div\n\t\t\t\tclassName=\"aui-user-message-root mx-auto grid w-full max-w-[var(--thread-max-width)] animate-in auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] gap-y-2 px-2 py-4 duration-200 fade-in slide-in-from-bottom-1 first:mt-3 last:mb-5 [&:where(>*)]:col-start-2\"\n\t\t\t\tdata-role=\"user\"\n\t\t\t>\n\t\t\t\t<UserMessageAttachments />\n\n\t\t\t\t<div className=\"aui-user-message-content-wrapper relative col-start-2 min-w-0 max-w-[85%]\">\n\t\t\t\t\t<div className=\"aui-user-message-content rounded-2xl rounded-tr-sm bg-primary text-primary-foreground px-4 py-3 text-sm leading-relaxed shadow-sm\">\n\t\t\t\t\t\t<MessagePrimitive.Parts />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"aui-user-action-bar-wrapper absolute top-1/2 left-0 -translate-x-full -translate-y-1/2 pr-2\">\n\t\t\t\t\t\t<UserActionBar />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\n\t\t\t\t<BranchPicker className=\"aui-user-branch-picker col-span-full col-start-1 row-start-3 -mr-1 justify-end\" />\n\t\t\t</div>\n\t\t</MessagePrimitive.Root>\n\t)\n}\n\nconst UserActionBar: FC = () => {\n\treturn (\n\t\t<ActionBarPrimitive.Root\n\t\t\thideWhenRunning\n\t\t\tautohide=\"not-last\"\n\t\t\tclassName=\"aui-user-action-bar-root flex flex-col items-end\"\n\t\t>\n\t\t\t<ActionBarPrimitive.Edit asChild>\n\t\t\t\t<TooltipIconButton tooltip=\"Edit\" className=\"aui-user-action-edit p-4\">\n\t\t\t\t\t<PencilIcon />\n\t\t\t\t</TooltipIconButton>\n\t\t\t</ActionBarPrimitive.Edit>\n\t\t</ActionBarPrimitive.Root>\n\t)\n}\n\nconst EditComposer: FC = () => {\n\treturn (\n\t\t<div className=\"aui-edit-composer-wrapper mx-auto flex w-full max-w-[var(--thread-max-width)] flex-col gap-4 px-2 first:mt-4\">\n\t\t\t<ComposerPrimitive.Root className=\"aui-edit-composer-root ml-auto flex w-full max-w-7/8 flex-col rounded-xl bg-muted\">\n\t\t\t\t<ComposerPrimitive.Input\n\t\t\t\t\tclassName=\"aui-edit-composer-input flex min-h-[60px] w-full resize-none bg-transparent p-4 text-foreground outline-none\"\n\t\t\t\t\tautoFocus\n\t\t\t\t/>\n\n\t\t\t\t<div className=\"aui-edit-composer-footer mx-3 mb-3 flex items-center justify-center gap-2 self-end\">\n\t\t\t\t\t<ComposerPrimitive.Cancel asChild>\n\t\t\t\t\t\t<Button variant=\"ghost\" size=\"sm\" aria-label=\"Cancel edit\">\n\t\t\t\t\t\t\tCancel\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</ComposerPrimitive.Cancel>\n\t\t\t\t\t<ComposerPrimitive.Send asChild>\n\t\t\t\t\t\t<Button size=\"sm\" aria-label=\"Update message\">\n\t\t\t\t\t\t\tUpdate\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</ComposerPrimitive.Send>\n\t\t\t\t</div>\n\t\t\t</ComposerPrimitive.Root>\n\t\t</div>\n\t)\n}\n\nconst BranchPicker: FC<BranchPickerPrimitive.Root.Props> = ({ className, ...rest }) => {\n\treturn (\n\t\t<BranchPickerPrimitive.Root\n\t\t\thideWhenSingleBranch\n\t\t\tclassName={cn(\n\t\t\t\t'aui-branch-picker-root mr-2 -ml-2 inline-flex items-center text-xs text-muted-foreground',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...rest}\n\t\t>\n\t\t\t<BranchPickerPrimitive.Previous asChild>\n\t\t\t\t<TooltipIconButton tooltip=\"Previous\">\n\t\t\t\t\t<ChevronLeftIcon />\n\t\t\t\t</TooltipIconButton>\n\t\t\t</BranchPickerPrimitive.Previous>\n\t\t\t<span className=\"aui-branch-picker-state font-medium\">\n\t\t\t\t<BranchPickerPrimitive.Number /> / <BranchPickerPrimitive.Count />\n\t\t\t</span>\n\t\t\t<BranchPickerPrimitive.Next asChild>\n\t\t\t\t<TooltipIconButton tooltip=\"Next\">\n\t\t\t\t\t<ChevronRightIcon />\n\t\t\t\t</TooltipIconButton>\n\t\t\t</BranchPickerPrimitive.Next>\n\t\t</BranchPickerPrimitive.Root>\n\t)\n}\n","'use client'\n\nimport { AssistantModalPrimitive } from '@assistant-ui/react'\nimport { ChevronDownIcon } from 'lucide-react'\nimport { forwardRef } from 'react'\n\nimport { ThreadWithVoice } from './thread-with-voice'\nimport { TooltipIconButton } from './tooltip-icon-button'\n\nimport type { FC } from 'react'\n\nexport const AssistantModal: FC = () => {\n\treturn (\n\t\t<AssistantModalPrimitive.Root>\n\t\t\t<AssistantModalPrimitive.Anchor className=\"aui-root aui-modal-anchor fixed right-6 bottom-6 size-14\">\n\t\t\t\t<AssistantModalPrimitive.Trigger asChild>\n\t\t\t\t\t<AssistantModalButton />\n\t\t\t\t</AssistantModalPrimitive.Trigger>\n\t\t\t</AssistantModalPrimitive.Anchor>\n\t\t\t<AssistantModalPrimitive.Content\n\t\t\t\tsideOffset={16}\n\t\t\t\tclassName=\"aui-root aui-modal-content z-50 h-[600px] w-[500px] overflow-clip overscroll-contain rounded-2xl border border-border/50 bg-popover/95 backdrop-blur-xl p-0 text-popover-foreground shadow-2xl outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-bottom-1/2 data-[state=closed]:slide-out-to-right-1/2 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:slide-in-from-bottom-1/2 data-[state=open]:slide-in-from-right-1/2 data-[state=open]:zoom-in-95 [&>.aui-thread-root]:bg-inherit\"\n\t\t\t>\n\t\t\t\t<ThreadWithVoice />\n\t\t\t</AssistantModalPrimitive.Content>\n\t\t</AssistantModalPrimitive.Root>\n\t)\n}\n\ntype AssistantModalButtonProps = { 'data-state'?: 'open' | 'closed' }\n\nconst AssistantModalButton = forwardRef<HTMLButtonElement, AssistantModalButtonProps>(\n\t({ 'data-state': state, ...rest }, ref) => {\n\t\tconst tooltip = state === 'open' ? 'Close Assistant' : 'Open Assistant'\n\n\t\treturn (\n\t\t\t<TooltipIconButton\n\t\t\t\tvariant=\"ghost\"\n\t\t\t\ttooltip={tooltip}\n\t\t\t\tside=\"left\"\n\t\t\t\t{...rest}\n\t\t\t\tclassName=\"aui-modal-button size-full rounded-full transition-all hover:scale-105 hover:bg-transparent active:scale-95\"\n\t\t\t\tref={ref}\n\t\t\t>\n\t\t\t\t<img\n\t\t\t\t\tsrc=\"/logo.png\"\n\t\t\t\t\talt=\"Assistant\"\n\t\t\t\t\tdata-state={state}\n\t\t\t\t\tclassName=\"aui-modal-button-closed-icon absolute size-full object-contain drop-shadow-xl transition-all duration-300 ease-in-out hover:drop-shadow-2xl data-[state=closed]:scale-100 data-[state=closed]:rotate-0 data-[state=open]:scale-0 data-[state=open]:rotate-90\"\n\t\t\t\t/>\n\n\t\t\t\t<ChevronDownIcon\n\t\t\t\t\tdata-state={state}\n\t\t\t\t\tclassName=\"aui-modal-button-open-icon absolute size-full rounded-full bg-primary p-3 text-primary-foreground shadow-xl transition-all duration-300 ease-in-out hover:shadow-2xl data-[state=closed]:scale-0 data-[state=closed]:-rotate-90 data-[state=open]:scale-100 data-[state=open]:rotate-0\"\n\t\t\t\t/>\n\t\t\t\t<span className=\"aui-sr-only sr-only\">{tooltip}</span>\n\t\t\t</TooltipIconButton>\n\t\t)\n\t}\n)\n\nAssistantModalButton.displayName = 'AssistantModalButton'\n","/**\n * MCP Tool Registry Component\n *\n * Registers all MCP tools with the assistant-ui runtime.\n * Uses the unified callTool function which auto-routes based on tool source.\n *\n * Usage:\n * <MCPToolRegistry />\n *\n * This component should be placed inside both MCPToolsProvider and AssistantRuntimeProvider.\n */\nimport { useAssistantTool } from '@assistant-ui/react'\n\nimport { useMCPTools } from '../providers/MCPToolsProvider'\n\nimport type { CallToolResult, ToolWithSource } from '@mcp-b/cloud-mirror-types'\nimport type { FC } from 'react'\n\n/**\n * Bridge component that registers a single tool with assistant-ui\n */\nconst ToolBridge: FC<{\n\ttool: ToolWithSource\n\tcallTool: (name: string, args: Record<string, unknown>) => Promise<CallToolResult>\n}> = ({ tool, callTool }) => {\n\tuseAssistantTool({\n\t\ttoolName: tool.name,\n\t\tdescription: tool.description ?? '',\n\t\tparameters: (tool.inputSchema ?? {}) as Record<string, unknown>,\n\t\texecute: async (args) => {\n\t\t\ttry {\n\t\t\t\tconst result = await callTool(tool.name, args)\n\n\t\t\t\t// Return a formatted response for the assistant\n\t\t\t\tconst textContent = result.content\n\t\t\t\t\t.map((c) => {\n\t\t\t\t\t\tif ('text' in c && typeof c.text === 'string') {\n\t\t\t\t\t\t\treturn c.text\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn JSON.stringify(c)\n\t\t\t\t\t})\n\t\t\t\t\t.join('\\n')\n\n\t\t\t\treturn textContent || 'Tool executed successfully'\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(`[ToolBridge] Tool '${tool.name}' execution failed:`, error)\n\t\t\t\tthrow error\n\t\t\t}\n\t\t},\n\t})\n\n\treturn null\n}\n\n/**\n * Tool registry that registers all MCP tools with assistant-ui.\n * Routes tool calls automatically based on _sourceId.\n */\nexport const MCPToolRegistry: FC = () => {\n\tconst { tools, callTool } = useMCPTools()\n\n\treturn (\n\t\t<>\n\t\t\t{tools.map((tool) => (\n\t\t\t\t<ToolBridge key={`${tool._sourceId}-${tool.name}`} tool={tool} callTool={callTool} />\n\t\t\t))}\n\t\t</>\n\t)\n}\n\n/**\n * Debug component to display registered tools and sources\n */\nexport const MCPToolsDebug: FC = () => {\n\tconst { tools, sources } = useMCPTools()\n\n\treturn (\n\t\t<div className=\"rounded border border-border bg-muted p-3 text-xs\">\n\t\t\t<div className=\"mb-2 font-medium\">MCP Tools Debug</div>\n\t\t\t<div className=\"mb-2\">\n\t\t\t\t<div className=\"font-medium\">Sources:</div>\n\t\t\t\t{Array.from(sources.values()).map((source) => (\n\t\t\t\t\t<div key={source.id} className=\"ml-2\">\n\t\t\t\t\t\t{source.id}: {source.state}\n\t\t\t\t\t\t{source.error && <span className=\"text-destructive\"> ({source.error.message})</span>}\n\t\t\t\t\t</div>\n\t\t\t\t))}\n\t\t\t</div>\n\t\t\t<div className=\"mb-1\">Total tools: {tools.length}</div>\n\t\t\t<ul className=\"list-disc space-y-1 pl-4\">\n\t\t\t\t{tools.map((tool) => (\n\t\t\t\t\t<li key={`${tool._sourceId}-${tool.name}`}>\n\t\t\t\t\t\t<span className=\"font-mono\">{tool.name}</span>\n\t\t\t\t\t\t<span className=\"ml-1 text-muted-foreground\">({tool._sourceId})</span>\n\t\t\t\t\t</li>\n\t\t\t\t))}\n\t\t\t</ul>\n\t\t</div>\n\t)\n}\n","/**\n * Auto-generated file - DO NOT EDIT\n * Generated by scripts/generate-inline-styles.js\n *\n * Contains the compiled CSS for the web component standalone build.\n */\n\nexport const WEBMCP_STYLES = \"/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */\\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\",\\\"Segoe UI Symbol\\\",\\\"Noto Color Emoji\\\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\\\"Liberation Mono\\\",\\\"Courier New\\\",monospace;--color-red-200:oklch(88.5% .062 18.334);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-amber-500:oklch(76.9% .188 70.08);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-emerald-500:oklch(69.6% .17 162.48);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25/1.875);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--tracking-tight:-.025em;--tracking-wide:.025em;--leading-relaxed:1.625;--radius-xs:.125rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--drop-shadow-xl:0 9px 7px #0000001a;--drop-shadow-2xl:0 25px 25px #00000026;--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-sm:8px;--blur-md:12px;--blur-xl:24px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\",\\\"Segoe UI Symbol\\\",\\\"Noto Color Emoji\\\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\\\"Liberation Mono\\\",\\\"Courier New\\\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}:root{--radius:.75rem;--background:oklch(100% 0 0);--foreground:oklch(14.1% .005 285.823);--card:oklch(100% 0 0);--card-foreground:oklch(14.1% .005 285.823);--popover:oklch(100% 0 0);--popover-foreground:oklch(14.1% .005 285.823);--primary:oklch(21% .006 285.885);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(96.7% .001 286.375);--secondary-foreground:oklch(21% .006 285.885);--muted:oklch(96.7% .001 286.375);--muted-foreground:oklch(55.2% .016 285.938);--accent:oklch(96.7% .001 286.375);--accent-foreground:oklch(21% .006 285.885);--destructive:oklch(57.7% .245 27.325);--destructive-foreground:oklch(98.5% 0 0);--border:oklch(92% .004 286.32);--input:oklch(92% .004 286.32);--ring:oklch(70.5% .015 286.067)}.dark{--background:oklch(14.1% .005 285.823);--foreground:oklch(98.5% 0 0);--card:oklch(21% .006 285.885);--card-foreground:oklch(98.5% 0 0);--popover:oklch(21% .006 285.885);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(92% .004 286.32);--primary-foreground:oklch(21% .006 285.885);--secondary:oklch(27.4% .006 286.033);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(27.4% .006 286.033);--muted-foreground:oklch(70.5% .015 286.067);--accent:oklch(27.4% .006 286.033);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(70.4% .191 22.216);--destructive-foreground:oklch(98.5% 0 0);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.2% .016 285.938)}*{border-color:var(--border);outline-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){*{outline-color:color-mix(in oklch,var(--ring),transparent 50%)}}body{background-color:var(--background);color:var(--foreground)}}@layer components{.app-shell{z-index:0;background-color:var(--background);background-image:radial-gradient(80% 60% at -10% -10%,oklch(82% .15 270/.15),#0000),radial-gradient(60% 50% at 110% 10%,oklch(85% .1 220/.12),#0000),radial-gradient(50% 45% at 50% 120%,oklch(95% .02 250/.08),#0000);position:relative}.dark .app-shell{background-image:radial-gradient(80% 60% at -10% -10%,oklch(55% .14 270/.25),#0000),radial-gradient(60% 50% at 110% 15%,oklch(60% .12 220/.22),#0000),radial-gradient(50% 45% at 50% 120%,oklch(35% .04 250/.16),#0000)}.app-shell:before,.app-shell:after{content:\\\"\\\";pointer-events:none;filter:blur(32px);opacity:.6;z-index:-1;border-radius:9999px;position:absolute;inset:auto}.app-shell:before{background:radial-gradient(60% 60% at 40% 40%,oklch(80% .12 270/.3),#0000);width:260px;height:260px;top:-60px;left:-80px}.app-shell:after{background:radial-gradient(60% 60% at 60% 60%,oklch(84% .1 220/.25),#0000);width:300px;height:300px;bottom:-80px;right:-60px}.toolbar-surface{border-top:1px solid var(--border);background:linear-gradient(to right,var(--background),var(--background),var(--background))}@supports (color:color-mix(in lab, red, red)){.toolbar-surface{background:linear-gradient(to right,var(--background),color-mix(in oklch,var(--background),transparent 5%),var(--background))}}.toolbar-surface{-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}@supports ((-webkit-backdrop-filter:blur(12px)) or (backdrop-filter:blur(12px))){.toolbar-surface{background:var(--background)}@supports (color:color-mix(in lab, red, red)){.toolbar-surface{background:color-mix(in oklch,var(--background),transparent 20%)}}}.toolbar-surface-top{border-bottom:1px solid var(--border);background:linear-gradient(to right,var(--background),var(--background),var(--background))}@supports (color:color-mix(in lab, red, red)){.toolbar-surface-top{background:linear-gradient(to right,var(--background),color-mix(in oklch,var(--background),transparent 5%),var(--background))}}.toolbar-surface-top{-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}@supports ((-webkit-backdrop-filter:blur(12px)) or (backdrop-filter:blur(12px))){.toolbar-surface-top{background:var(--background)}@supports (color:color-mix(in lab, red, red)){.toolbar-surface-top{background:color-mix(in oklch,var(--background),transparent 20%)}}}.toolbar-inner{justify-content:space-between;align-items:center;padding:.5rem .75rem;display:flex}.toolbar-card{background:var(--card);justify-content:space-between;align-items:center;gap:.5rem;display:flex}@supports (color:color-mix(in lab, red, red)){.toolbar-card{background:color-mix(in oklch,var(--card),transparent 60%)}}.toolbar-card{border:1px solid var(--border);border-radius:.75rem;padding:.5rem .75rem}.toolbar-group{align-items:center;gap:.25rem;display:flex}.btn-toolbar-primary{background:linear-gradient(to right,var(--primary),var(--primary));border-radius:.75rem;align-items:center;gap:.5rem;height:2.25rem;padding:0 .75rem;display:flex}@supports (color:color-mix(in lab, red, red)){.btn-toolbar-primary{background:linear-gradient(to right,color-mix(in oklch,var(--primary),transparent 95%),color-mix(in oklch,var(--primary),transparent 90%))}}.btn-toolbar-primary{border:1px solid var(--primary)}@supports (color:color-mix(in lab, red, red)){.btn-toolbar-primary{border:1px solid color-mix(in oklch,var(--primary),transparent 80%)}}.btn-toolbar-primary{transition:all .2s}.btn-toolbar-primary:hover{background:linear-gradient(to right,var(--primary),var(--primary))}@supports (color:color-mix(in lab, red, red)){.btn-toolbar-primary:hover{background:linear-gradient(to right,color-mix(in oklch,var(--primary),transparent 90%),color-mix(in oklch,var(--primary),transparent 80%))}}.btn-toolbar-icon-primary{background:linear-gradient(to bottom right,var(--primary),var(--primary));border-radius:9999px;width:2rem;height:2rem;padding:0}@supports (color:color-mix(in lab, red, red)){.btn-toolbar-icon-primary{background:linear-gradient(to bottom right,color-mix(in oklch,var(--primary),transparent 90%),color-mix(in oklch,var(--primary),transparent 80%))}}.btn-toolbar-icon-primary{border:1px solid var(--primary)}@supports (color:color-mix(in lab, red, red)){.btn-toolbar-icon-primary{border:1px solid color-mix(in oklch,var(--primary),transparent 70%)}}.btn-toolbar-icon-primary{transition:all .2s;box-shadow:0 1px 2px #0000000d}.btn-toolbar-icon-primary:hover{background:linear-gradient(to bottom right,var(--primary),var(--primary))}@supports (color:color-mix(in lab, red, red)){.btn-toolbar-icon-primary:hover{background:linear-gradient(to bottom right,color-mix(in oklch,var(--primary),transparent 80%),color-mix(in oklch,var(--primary),transparent 70%))}}.btn-toolbar-icon-secondary{background:linear-gradient(to bottom right,var(--secondary),var(--secondary));border-radius:9999px;width:2rem;height:2rem;padding:0}@supports (color:color-mix(in lab, red, red)){.btn-toolbar-icon-secondary{background:linear-gradient(to bottom right,color-mix(in oklch,var(--secondary),transparent 90%),color-mix(in oklch,var(--secondary),transparent 80%))}}.btn-toolbar-icon-secondary{border:1px solid var(--secondary)}@supports (color:color-mix(in lab, red, red)){.btn-toolbar-icon-secondary{border:1px solid color-mix(in oklch,var(--secondary),transparent 70%)}}.btn-toolbar-icon-secondary{transition:all .2s;box-shadow:0 1px 2px #0000000d}.btn-toolbar-icon-secondary:hover{background:linear-gradient(to bottom right,var(--secondary),var(--secondary))}@supports (color:color-mix(in lab, red, red)){.btn-toolbar-icon-secondary:hover{background:linear-gradient(to bottom right,color-mix(in oklch,var(--secondary),transparent 80%),color-mix(in oklch,var(--secondary),transparent 70%))}}.badge-compact{height:1.25rem;padding:0 .5rem;font-size:10px}.badge-mini{height:1rem;padding:0 .375rem;font-size:10px}@keyframes shimmer-bg{0%{background-position:-1000px 0}to{background-position:1000px 0}}.shimmer{background:linear-gradient(90deg,#0000,#ffffff1a,#0000) 0 0/1000px 100%;animation:3s linear infinite shimmer-bg}.animate-shimmer{animation:2s linear infinite shimmer}@keyframes pulse-glow{0%,to{box-shadow:0 0 20px rgba(var(--primary),.1)}50%{box-shadow:0 0 30px rgba(var(--primary),.2)}}.pulse-glow{animation:2s ease-in-out infinite pulse-glow}@keyframes gradient-x{0%,to{background-position:0%}50%{background-position:100%}}.animate-gradient-x{animation:8s ease-in-out infinite gradient-x}.gradient-text{background:linear-gradient(to right,var(--foreground),var(--foreground))}@supports (color:color-mix(in lab, red, red)){.gradient-text{background:linear-gradient(to right,var(--foreground),color-mix(in oklch,var(--foreground),transparent 30%))}}.gradient-text{-webkit-text-fill-color:transparent;-webkit-background-clip:text;background-clip:text}.glass{background:var(--background)}@supports (color:color-mix(in lab, red, red)){.glass{background:color-mix(in oklch,var(--background),transparent 50%)}}.glass{-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border:1px solid var(--border)}@supports (color:color-mix(in lab, red, red)){.glass{border:1px solid color-mix(in oklch,var(--border),transparent 50%)}}.tool-card{transition:all .3s ease-out}.tool-card:hover{transform:scale(1.02);box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -2px #0000000d}.scrollbar-thin{scrollbar-width:thin}.scrollbar-thin::-webkit-scrollbar{width:6px;height:6px}.scrollbar-thin::-webkit-scrollbar-track{background:0 0}.scrollbar-thin::-webkit-scrollbar-thumb{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.scrollbar-thin::-webkit-scrollbar-thumb{background-color:color-mix(in oklch,var(--primary),transparent 80%)}}.scrollbar-thin::-webkit-scrollbar-thumb{border-radius:3px}.scrollbar-thin::-webkit-scrollbar-thumb:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.scrollbar-thin::-webkit-scrollbar-thumb:hover{background-color:color-mix(in oklch,var(--primary),transparent 70%)}}}@layer utilities{.\\\\@container{container-type:inline-size}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{inset:calc(var(--spacing)*0)}.-top-12{top:calc(var(--spacing)*-12)}.top-1\\\\.5{top:calc(var(--spacing)*1.5)}.top-1\\\\/2{top:50%}.top-4{top:calc(var(--spacing)*4)}.top-\\\\[50\\\\%\\\\]{top:50%}.right-0{right:calc(var(--spacing)*0)}.right-1\\\\.5{right:calc(var(--spacing)*1.5)}.right-4{right:calc(var(--spacing)*4)}.right-6{right:calc(var(--spacing)*6)}.bottom-0{bottom:calc(var(--spacing)*0)}.bottom-6{bottom:calc(var(--spacing)*6)}.left-0{left:calc(var(--spacing)*0)}.left-\\\\[50\\\\%\\\\]{left:50%}.z-10{z-index:10}.z-50{z-index:50}.col-span-full{grid-column:1/-1}.col-start-1{grid-column-start:1}.col-start-2{grid-column-start:2}.col-start-3{grid-column-start:3}.row-start-1{grid-row-start:1}.row-start-2{grid-row-start:2}.row-start-3{grid-row-start:3}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.m-0{margin:calc(var(--spacing)*0)}.mx-2{margin-inline:calc(var(--spacing)*2)}.mx-3{margin-inline:calc(var(--spacing)*3)}.mx-auto{margin-inline:auto}.my-2{margin-block:calc(var(--spacing)*2)}.my-auto{margin-block:auto}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.-mr-1{margin-right:calc(var(--spacing)*-1)}.mr-2{margin-right:calc(var(--spacing)*2)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.-ml-1{margin-left:calc(var(--spacing)*-1)}.-ml-2{margin-left:calc(var(--spacing)*-2)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.inline{display:inline}.inline-flex{display:inline-flex}.table{display:table}.aspect-square{aspect-ratio:1}.size-2\\\\.5{width:calc(var(--spacing)*2.5);height:calc(var(--spacing)*2.5)}.size-3{width:calc(var(--spacing)*3);height:calc(var(--spacing)*3)}.size-3\\\\.5{width:calc(var(--spacing)*3.5);height:calc(var(--spacing)*3.5)}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-5{width:calc(var(--spacing)*5);height:calc(var(--spacing)*5)}.size-6{width:calc(var(--spacing)*6);height:calc(var(--spacing)*6)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.size-14{width:calc(var(--spacing)*14);height:calc(var(--spacing)*14)}.size-\\\\[34px\\\\]{width:34px;height:34px}.size-full{width:100%;height:100%}.h-1\\\\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-2\\\\.5{height:calc(var(--spacing)*2.5)}.h-3{height:calc(var(--spacing)*3)}.h-3\\\\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-6{height:calc(var(--spacing)*6)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-\\\\[600px\\\\]{height:600px}.h-auto{height:auto}.h-full{height:100%}.max-h-24{max-height:calc(var(--spacing)*24)}.max-h-40{max-height:calc(var(--spacing)*40)}.max-h-60{max-height:calc(var(--spacing)*60)}.max-h-\\\\[80dvh\\\\]{max-height:80dvh}.max-h-\\\\[80vh\\\\]{max-height:80vh}.min-h-8{min-height:calc(var(--spacing)*8)}.min-h-\\\\[60px\\\\]{min-height:60px}.w-1\\\\.5{width:calc(var(--spacing)*1.5)}.w-2{width:calc(var(--spacing)*2)}.w-2\\\\.5{width:calc(var(--spacing)*2.5)}.w-3{width:calc(var(--spacing)*3)}.w-3\\\\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-6{width:calc(var(--spacing)*6)}.w-8{width:calc(var(--spacing)*8)}.w-16{width:calc(var(--spacing)*16)}.w-\\\\[500px\\\\]{width:500px}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-2xl{max-width:var(--container-2xl)}.max-w-7\\\\/8{max-width:87.5%}.max-w-\\\\[80\\\\%\\\\]{max-width:80%}.max-w-\\\\[80px\\\\]{max-width:80px}.max-w-\\\\[85\\\\%\\\\]{max-width:85%}.max-w-\\\\[calc\\\\(100\\\\%-2rem\\\\)\\\\]{max-width:calc(100% - 2rem)}.max-w-\\\\[var\\\\(--thread-max-width\\\\)\\\\]{max-width:var(--thread-max-width)}.max-w-full{max-width:100%}.min-w-0{min-width:calc(var(--spacing)*0)}.flex-1{flex:1}.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.border-separate{border-collapse:separate}.border-spacing-0{--tw-border-spacing-x:calc(var(--spacing)*0);--tw-border-spacing-y:calc(var(--spacing)*0);border-spacing:var(--tw-border-spacing-x)var(--tw-border-spacing-y)}.origin-\\\\(--radix-tooltip-content-transform-origin\\\\){transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-full{--tw-translate-x:-100%;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-\\\\[-50\\\\%\\\\]{--tw-translate-x:-50%;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\\\\/2{--tw-translate-y:calc(calc(1/2*100%)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-\\\\[-50\\\\%\\\\]{--tw-translate-y:-50%;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-\\\\[calc\\\\(-50\\\\%_-_2px\\\\)\\\\]{--tw-translate-y:calc(-50% - 2px);translate:var(--tw-translate-x)var(--tw-translate-y)}.rotate-45{rotate:45deg}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize-none{resize:none}.scroll-m-20{scroll-margin:calc(var(--spacing)*20)}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.auto-rows-auto{grid-auto-rows:auto}.grid-cols-\\\\[minmax\\\\(72px\\\\,1fr\\\\)_auto\\\\]{grid-template-columns:minmax(72px,1fr) auto}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0\\\\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\\\\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}.gap-y-2{row-gap:calc(var(--spacing)*2)}.self-center{align-self:center}.self-end{align-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-clip{overflow:clip}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-y-scroll{overflow-y:scroll}.overscroll-contain{overscroll-behavior:contain}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-\\\\[2px\\\\]{border-radius:2px}.rounded-\\\\[14px\\\\]{border-radius:14px}.rounded-\\\\[inherit\\\\]{border-radius:inherit}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.rounded-xs{border-radius:var(--radius-xs)}.\\\\!rounded-t-none{border-top-left-radius:0!important;border-top-right-radius:0!important}.rounded-t-3xl{border-top-left-radius:var(--radius-3xl);border-top-right-radius:var(--radius-3xl)}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.rounded-tr-sm{border-top-right-radius:calc(var(--radius) - 4px)}.rounded-b-lg{border-bottom-right-radius:var(--radius);border-bottom-left-radius:var(--radius)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-dotted{--tw-border-style:dotted;border-style:dotted}.border-blue-500\\\\/40{border-color:#3080ff66}@supports (color:color-mix(in lab, red, red)){.border-blue-500\\\\/40{border-color:color-mix(in oklab,var(--color-blue-500)40%,transparent)}}.border-blue-500\\\\/60{border-color:#3080ff99}@supports (color:color-mix(in lab, red, red)){.border-blue-500\\\\/60{border-color:color-mix(in oklab,var(--color-blue-500)60%,transparent)}}.border-border,.border-border\\\\/20{border-color:var(--border)}@supports (color:color-mix(in lab, red, red)){.border-border\\\\/20{border-color:color-mix(in oklab,var(--border)20%,transparent)}}.border-border\\\\/40{border-color:var(--border)}@supports (color:color-mix(in lab, red, red)){.border-border\\\\/40{border-color:color-mix(in oklab,var(--border)40%,transparent)}}.border-border\\\\/50{border-color:var(--border)}@supports (color:color-mix(in lab, red, red)){.border-border\\\\/50{border-color:color-mix(in oklab,var(--border)50%,transparent)}}.border-destructive,.border-destructive\\\\/60{border-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.border-destructive\\\\/60{border-color:color-mix(in oklab,var(--destructive)60%,transparent)}}.border-foreground\\\\/20{border-color:var(--foreground)}@supports (color:color-mix(in lab, red, red)){.border-foreground\\\\/20{border-color:color-mix(in oklab,var(--foreground)20%,transparent)}}.border-green-500\\\\/40{border-color:#00c75866}@supports (color:color-mix(in lab, red, red)){.border-green-500\\\\/40{border-color:color-mix(in oklab,var(--color-green-500)40%,transparent)}}.border-green-500\\\\/60{border-color:#00c75899}@supports (color:color-mix(in lab, red, red)){.border-green-500\\\\/60{border-color:color-mix(in oklab,var(--color-green-500)60%,transparent)}}.border-input{border-color:var(--input)}.border-muted-foreground\\\\/20{border-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.border-muted-foreground\\\\/20{border-color:color-mix(in oklab,var(--muted-foreground)20%,transparent)}}.border-primary\\\\/60{border-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.border-primary\\\\/60{border-color:color-mix(in oklab,var(--primary)60%,transparent)}}.border-red-500\\\\/40{border-color:#fb2c3666}@supports (color:color-mix(in lab, red, red)){.border-red-500\\\\/40{border-color:color-mix(in oklab,var(--color-red-500)40%,transparent)}}.border-red-500\\\\/60{border-color:#fb2c3699}@supports (color:color-mix(in lab, red, red)){.border-red-500\\\\/60{border-color:color-mix(in oklab,var(--color-red-500)60%,transparent)}}.border-transparent{border-color:#0000}.border-white\\\\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.border-white\\\\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-t-transparent{border-top-color:#0000}.border-l-transparent{border-left-color:#0000}.bg-\\\\[color-mix\\\\(in_oklab\\\\,rgb\\\\(var\\\\(--background\\\\)\\\\)_20\\\\%\\\\,transparent\\\\)\\\\]{background-color:rgb(var(--background))}@supports (color:color-mix(in lab, red, red)){.bg-\\\\[color-mix\\\\(in_oklab\\\\,rgb\\\\(var\\\\(--background\\\\)\\\\)_20\\\\%\\\\,transparent\\\\)\\\\]{background-color:color-mix(in oklab,rgb(var(--background))20%,transparent)}}.bg-amber-500{background-color:var(--color-amber-500)}.bg-background,.bg-background\\\\/50{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.bg-background\\\\/50{background-color:color-mix(in oklab,var(--background)50%,transparent)}}.bg-background\\\\/80{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.bg-background\\\\/80{background-color:color-mix(in oklab,var(--background)80%,transparent)}}.bg-background\\\\/95{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.bg-background\\\\/95{background-color:color-mix(in oklab,var(--background)95%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\\\\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\\\\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-500\\\\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\\\\/5{background-color:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.bg-blue-500\\\\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\\\\/10{background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.bg-border{background-color:var(--border)}.bg-destructive,.bg-destructive\\\\/10{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.bg-destructive\\\\/10{background-color:color-mix(in oklab,var(--destructive)10%,transparent)}}.bg-foreground{background-color:var(--foreground)}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\\\\/5{background-color:#00c7580d}@supports (color:color-mix(in lab, red, red)){.bg-green-500\\\\/5{background-color:color-mix(in oklab,var(--color-green-500)5%,transparent)}}.bg-green-500\\\\/10{background-color:#00c7581a}@supports (color:color-mix(in lab, red, red)){.bg-green-500\\\\/10{background-color:color-mix(in oklab,var(--color-green-500)10%,transparent)}}.bg-muted{background-color:var(--muted)}.bg-muted-foreground\\\\/15{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.bg-muted-foreground\\\\/15{background-color:color-mix(in oklab,var(--muted-foreground)15%,transparent)}}.bg-muted\\\\/5{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\\\\/5{background-color:color-mix(in oklab,var(--muted)5%,transparent)}}.bg-muted\\\\/30{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\\\\/30{background-color:color-mix(in oklab,var(--muted)30%,transparent)}}.bg-muted\\\\/50{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\\\\/50{background-color:color-mix(in oklab,var(--muted)50%,transparent)}}.bg-popover\\\\/95{background-color:var(--popover)}@supports (color:color-mix(in lab, red, red)){.bg-popover\\\\/95{background-color:color-mix(in oklab,var(--popover)95%,transparent)}}.bg-primary,.bg-primary\\\\/10{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.bg-primary\\\\/10{background-color:color-mix(in oklab,var(--primary)10%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\\\\/5{background-color:#fb2c360d}@supports (color:color-mix(in lab, red, red)){.bg-red-500\\\\/5{background-color:color-mix(in oklab,var(--color-red-500)5%,transparent)}}.bg-red-500\\\\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.bg-red-500\\\\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-secondary{background-color:var(--secondary)}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-yellow-500{background-color:var(--color-yellow-500)}.fill-foreground{fill:var(--foreground)}.stroke-\\\\[1\\\\.5px\\\\]{stroke-width:1.5px}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.p-px{padding:1px}.px-0{padding-inline:calc(var(--spacing)*0)}.px-1\\\\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\\\\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.px-8{padding-inline:calc(var(--spacing)*8)}.py-0\\\\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\\\\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\\\\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.pt-0\\\\.5{padding-top:calc(var(--spacing)*.5)}.pt-2{padding-top:calc(var(--spacing)*2)}.pr-2{padding-right:calc(var(--spacing)*2)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-3{padding-left:calc(var(--spacing)*3)}.pl-4{padding-left:calc(var(--spacing)*4)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\\\[10px\\\\]{font-size:10px}.text-\\\\[11px\\\\]{font-size:11px}.text-\\\\[13px\\\\]{font-size:13px}.text-\\\\[15px\\\\]{font-size:15px}.text-\\\\[17px\\\\]{font-size:17px}.text-\\\\[19px\\\\]{font-size:19px}.text-\\\\[21px\\\\]{font-size:21px}.text-\\\\[25px\\\\]{font-size:25px}.leading-7{--tw-leading:calc(var(--spacing)*7);line-height:calc(var(--spacing)*7)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.text-balance{text-wrap:balance}.break-words{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-background{color:var(--background)}.text-blue-600{color:var(--color-blue-600)}.text-destructive{color:var(--destructive)}.text-destructive-foreground{color:var(--destructive-foreground)}.text-emerald-500{color:var(--color-emerald-500)}.text-foreground,.text-foreground\\\\/80{color:var(--foreground)}@supports (color:color-mix(in lab, red, red)){.text-foreground\\\\/80{color:color-mix(in oklab,var(--foreground)80%,transparent)}}.text-green-600{color:var(--color-green-600)}.text-muted-foreground,.text-muted-foreground\\\\/65{color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.text-muted-foreground\\\\/65{color:color-mix(in oklab,var(--muted-foreground)65%,transparent)}}.text-muted-foreground\\\\/70{color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.text-muted-foreground\\\\/70{color:color-mix(in oklab,var(--muted-foreground)70%,transparent)}}.text-popover-foreground{color:var(--popover-foreground)}.text-primary{color:var(--primary)}.text-primary-foreground{color:var(--primary-foreground)}.text-red-600{color:var(--color-red-600)}.text-secondary-foreground{color:var(--secondary-foreground)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.italic{font-style:italic}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-70{opacity:.7}.opacity-100{opacity:1}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\\\[0_0_12px_rgba\\\\(34\\\\,197\\\\,94\\\\,0\\\\.3\\\\)\\\\]{--tw-shadow:0 0 12px var(--tw-shadow-color,#22c55e4d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\\\[0_0_12px_rgba\\\\(59\\\\,130\\\\,246\\\\,0\\\\.3\\\\)\\\\]{--tw-shadow:0 0 12px var(--tw-shadow-color,#3b82f64d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\\\[0_0_12px_rgba\\\\(239\\\\,68\\\\,68\\\\,0\\\\.3\\\\)\\\\]{--tw-shadow:0 0 12px var(--tw-shadow-color,#ef44444d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\\\[0_12px_24px_-16px_rgba\\\\(37\\\\,99\\\\,235\\\\,0\\\\.55\\\\)\\\\]{--tw-shadow:0 12px 24px -16px var(--tw-shadow-color,#2563eb8c);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\\\[0_12px_24px_-18px_rgba\\\\(220\\\\,38\\\\,38\\\\,0\\\\.55\\\\)\\\\]{--tw-shadow:0 12px 24px -18px var(--tw-shadow-color,#dc26268c);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.\\\\[box-shadow\\\\:inset_0_1px_2px_0_rgba\\\\(255\\\\,255\\\\,255\\\\,0\\\\.15\\\\)\\\\]{box-shadow:inset 0 1px 2px #ffffff26}.shadow-black\\\\/20{--tw-shadow-color:#0003}@supports (color:color-mix(in lab, red, red)){.shadow-black\\\\/20{--tw-shadow-color:color-mix(in oklab,color-mix(in oklab,var(--color-black)20%,transparent)var(--tw-shadow-alpha),transparent)}}.ring-offset-background{--tw-ring-offset-color:var(--background)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.drop-shadow-xl{--tw-drop-shadow-size:drop-shadow(0 9px 7px var(--tw-drop-shadow-color,#0000001a));--tw-drop-shadow:drop-shadow(var(--drop-shadow-xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\\\[color\\\\,box-shadow\\\\]{transition-property:color,box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.placeholder\\\\:text-muted-foreground::placeholder,.placeholder\\\\:text-muted-foreground\\\\/70::placeholder{color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.placeholder\\\\:text-muted-foreground\\\\/70::placeholder{color:color-mix(in oklab,var(--muted-foreground)70%,transparent)}}.first\\\\:mt-0:first-child{margin-top:calc(var(--spacing)*0)}.first\\\\:mt-3:first-child{margin-top:calc(var(--spacing)*3)}.first\\\\:mt-4:first-child{margin-top:calc(var(--spacing)*4)}.first\\\\:rounded-tl-lg:first-child{border-top-left-radius:var(--radius)}.first\\\\:border-t:first-child{border-top-style:var(--tw-border-style);border-top-width:1px}.last\\\\:mb-0:last-child{margin-bottom:calc(var(--spacing)*0)}.last\\\\:mb-5:last-child{margin-bottom:calc(var(--spacing)*5)}.last\\\\:mb-24:last-child{margin-bottom:calc(var(--spacing)*24)}.last\\\\:rounded-tr-lg:last-child{border-top-right-radius:var(--radius)}.last\\\\:border-r:last-child{border-right-style:var(--tw-border-style);border-right-width:1px}.empty\\\\:hidden:empty{display:none}.focus-within\\\\:border-ring\\\\/50:focus-within{border-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){.focus-within\\\\:border-ring\\\\/50:focus-within{border-color:color-mix(in oklab,var(--ring)50%,transparent)}}.focus-within\\\\:border-white\\\\/20:focus-within{border-color:#fff3}@supports (color:color-mix(in lab, red, red)){.focus-within\\\\:border-white\\\\/20:focus-within{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.focus-within\\\\:shadow-2xl:focus-within{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-within\\\\:shadow-md:focus-within{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-within\\\\:ring-2:focus-within{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-within\\\\:shadow-black\\\\/30:focus-within{--tw-shadow-color:#0000004d}@supports (color:color-mix(in lab, red, red)){.focus-within\\\\:shadow-black\\\\/30:focus-within{--tw-shadow-color:color-mix(in oklab,color-mix(in oklab,var(--color-black)30%,transparent)var(--tw-shadow-alpha),transparent)}}.focus-within\\\\:ring-ring:focus-within{--tw-ring-color:var(--ring)}.focus-within\\\\:ring-offset-2:focus-within{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}@media (hover:hover){.hover\\\\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x)var(--tw-scale-y)}.hover\\\\:border-accent:hover{border-color:var(--accent)}.hover\\\\:border-border\\\\/60:hover{border-color:var(--border)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:border-border\\\\/60:hover{border-color:color-mix(in oklab,var(--border)60%,transparent)}}.hover\\\\:border-white\\\\/15:hover{border-color:#ffffff26}@supports (color:color-mix(in lab, red, red)){.hover\\\\:border-white\\\\/15:hover{border-color:color-mix(in oklab,var(--color-white)15%,transparent)}}.hover\\\\:\\\\!bg-white:hover{background-color:var(--color-white)!important}.hover\\\\:bg-accent:hover,.hover\\\\:bg-accent\\\\/50:hover{background-color:var(--accent)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-accent\\\\/50:hover{background-color:color-mix(in oklab,var(--accent)50%,transparent)}}.hover\\\\:bg-destructive\\\\/10:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-destructive\\\\/10:hover{background-color:color-mix(in oklab,var(--destructive)10%,transparent)}}.hover\\\\:bg-destructive\\\\/80:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-destructive\\\\/80:hover{background-color:color-mix(in oklab,var(--destructive)80%,transparent)}}.hover\\\\:bg-destructive\\\\/90:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-destructive\\\\/90:hover{background-color:color-mix(in oklab,var(--destructive)90%,transparent)}}.hover\\\\:bg-muted-foreground\\\\/15:hover{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-muted-foreground\\\\/15:hover{background-color:color-mix(in oklab,var(--muted-foreground)15%,transparent)}}.hover\\\\:bg-primary\\\\/80:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-primary\\\\/80:hover{background-color:color-mix(in oklab,var(--primary)80%,transparent)}}.hover\\\\:bg-primary\\\\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-primary\\\\/90:hover{background-color:color-mix(in oklab,var(--primary)90%,transparent)}}.hover\\\\:bg-secondary\\\\/80:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-secondary\\\\/80:hover{background-color:color-mix(in oklab,var(--secondary)80%,transparent)}}.hover\\\\:bg-transparent:hover{background-color:#0000}.hover\\\\:text-accent-foreground:hover{color:var(--accent-foreground)}.hover\\\\:text-destructive:hover{color:var(--destructive)}.hover\\\\:text-foreground:hover{color:var(--foreground)}.hover\\\\:underline:hover{text-decoration-line:underline}.hover\\\\:opacity-75:hover{opacity:.75}.hover\\\\:opacity-100:hover{opacity:1}.hover\\\\:shadow-2xl:hover{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\\\\:shadow-\\\\[0_14px_24px_-14px_rgba\\\\(37\\\\,99\\\\,235\\\\,0\\\\.6\\\\)\\\\]:hover{--tw-shadow:0 14px 24px -14px var(--tw-shadow-color,#2563eb99);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\\\\:shadow-\\\\[0_14px_24px_-16px_rgba\\\\(220\\\\,38\\\\,38\\\\,0\\\\.6\\\\)\\\\]:hover{--tw-shadow:0 14px 24px -16px var(--tw-shadow-color,#dc262699);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\\\\:drop-shadow-2xl:hover{--tw-drop-shadow-size:drop-shadow(0 25px 25px var(--tw-drop-shadow-color,#00000026));--tw-drop-shadow:drop-shadow(var(--drop-shadow-2xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}}.focus\\\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\\\\:ring-ring:focus{--tw-ring-color:var(--ring)}.focus\\\\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\\\\:outline-hidden:focus{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.focus\\\\:outline-hidden:focus{outline-offset:2px;outline:2px solid #0000}}.focus\\\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\\\\:border-ring:focus-visible{border-color:var(--ring)}.focus-visible\\\\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\\\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\\\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\\\:ring-\\\\[3px\\\\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\\\:ring-destructive\\\\/20:focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.focus-visible\\\\:ring-destructive\\\\/20:focus-visible{--tw-ring-color:color-mix(in oklab,var(--destructive)20%,transparent)}}.focus-visible\\\\:ring-destructive\\\\/40:focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.focus-visible\\\\:ring-destructive\\\\/40:focus-visible{--tw-ring-color:color-mix(in oklab,var(--destructive)40%,transparent)}}.focus-visible\\\\:ring-primary\\\\/40:focus-visible{--tw-ring-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.focus-visible\\\\:ring-primary\\\\/40:focus-visible{--tw-ring-color:color-mix(in oklab,var(--primary)40%,transparent)}}.focus-visible\\\\:ring-ring:focus-visible,.focus-visible\\\\:ring-ring\\\\/50:focus-visible{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){.focus-visible\\\\:ring-ring\\\\/50:focus-visible{--tw-ring-color:color-mix(in oklab,var(--ring)50%,transparent)}}.focus-visible\\\\:outline-1:focus-visible{outline-style:var(--tw-outline-style);outline-width:1px}.focus-visible\\\\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\\\\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x)var(--tw-scale-y)}.disabled\\\\:pointer-events-none:disabled{pointer-events:none}.disabled\\\\:invisible:disabled{visibility:hidden}.disabled\\\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\\\:opacity-50:disabled{opacity:.5}.has-\\\\[\\\\>svg\\\\]\\\\:px-2\\\\.5:has(>svg){padding-inline:calc(var(--spacing)*2.5)}.has-\\\\[\\\\>svg\\\\]\\\\:px-3:has(>svg){padding-inline:calc(var(--spacing)*3)}.has-\\\\[\\\\>svg\\\\]\\\\:px-4:has(>svg){padding-inline:calc(var(--spacing)*4)}.aria-invalid\\\\:border-destructive[aria-invalid=true]{border-color:var(--destructive)}.aria-invalid\\\\:ring-destructive\\\\/20[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.aria-invalid\\\\:ring-destructive\\\\/20[aria-invalid=true]{--tw-ring-color:color-mix(in oklab,var(--destructive)20%,transparent)}}.data-floating\\\\:absolute[data-floating]{position:absolute}.data-floating\\\\:rounded-md[data-floating]{border-radius:calc(var(--radius) - 2px)}.data-floating\\\\:border[data-floating]{border-style:var(--tw-border-style);border-width:1px}.data-floating\\\\:bg-background[data-floating]{background-color:var(--background)}.data-floating\\\\:p-1[data-floating]{padding:calc(var(--spacing)*1)}.data-floating\\\\:shadow-sm[data-floating]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\\\\[orientation\\\\=horizontal\\\\]\\\\:h-px[data-orientation=horizontal]{height:1px}.data-\\\\[orientation\\\\=horizontal\\\\]\\\\:w-full[data-orientation=horizontal]{width:100%}.data-\\\\[orientation\\\\=vertical\\\\]\\\\:h-full[data-orientation=vertical]{height:100%}.data-\\\\[orientation\\\\=vertical\\\\]\\\\:w-px[data-orientation=vertical]{width:1px}.data-\\\\[state\\\\=closed\\\\]\\\\:scale-0[data-state=closed]{--tw-scale-x:0%;--tw-scale-y:0%;--tw-scale-z:0%;scale:var(--tw-scale-x)var(--tw-scale-y)}.data-\\\\[state\\\\=closed\\\\]\\\\:scale-100[data-state=closed]{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x)var(--tw-scale-y)}.data-\\\\[state\\\\=closed\\\\]\\\\:-rotate-90[data-state=closed]{rotate:-90deg}.data-\\\\[state\\\\=closed\\\\]\\\\:rotate-0[data-state=closed]{rotate:none}.data-\\\\[state\\\\=open\\\\]\\\\:scale-0[data-state=open]{--tw-scale-x:0%;--tw-scale-y:0%;--tw-scale-z:0%;scale:var(--tw-scale-x)var(--tw-scale-y)}.data-\\\\[state\\\\=open\\\\]\\\\:scale-100[data-state=open]{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x)var(--tw-scale-y)}.data-\\\\[state\\\\=open\\\\]\\\\:rotate-0[data-state=open]{rotate:none}.data-\\\\[state\\\\=open\\\\]\\\\:rotate-90[data-state=open]{rotate:90deg}.data-\\\\[state\\\\=open\\\\]\\\\:bg-accent[data-state=open]{background-color:var(--accent)}.data-\\\\[state\\\\=open\\\\]\\\\:text-muted-foreground[data-state=open]{color:var(--muted-foreground)}@media (min-width:40rem){.sm\\\\:max-w-3xl{max-width:var(--container-3xl)}.sm\\\\:max-w-lg{max-width:var(--container-lg)}.sm\\\\:max-w-md{max-width:var(--container-md)}.sm\\\\:flex-row{flex-direction:row}.sm\\\\:justify-end{justify-content:flex-end}.sm\\\\:text-left{text-align:left}}@media (min-width:48rem){.md\\\\:pb-6{padding-bottom:calc(var(--spacing)*6)}}@container (min-width:28rem){.\\\\@md\\\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.\\\\@md\\\\:flex-col{flex-direction:column}}.dark\\\\:border-input:is(.dark *){border-color:var(--input)}.dark\\\\:border-muted-foreground\\\\/15:is(.dark *){border-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:border-muted-foreground\\\\/15:is(.dark *){border-color:color-mix(in oklab,var(--muted-foreground)15%,transparent)}}.dark\\\\:bg-background:is(.dark *){background-color:var(--background)}.dark\\\\:bg-destructive\\\\/5:is(.dark *){background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:bg-destructive\\\\/5:is(.dark *){background-color:color-mix(in oklab,var(--destructive)5%,transparent)}}.dark\\\\:bg-destructive\\\\/60:is(.dark *){background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:bg-destructive\\\\/60:is(.dark *){background-color:color-mix(in oklab,var(--destructive)60%,transparent)}}.dark\\\\:bg-input\\\\/30:is(.dark *){background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:bg-input\\\\/30:is(.dark *){background-color:color-mix(in oklab,var(--input)30%,transparent)}}.dark\\\\:bg-muted-foreground\\\\/20:is(.dark *){background-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:bg-muted-foreground\\\\/20:is(.dark *){background-color:color-mix(in oklab,var(--muted-foreground)20%,transparent)}}.dark\\\\:stroke-\\\\[2\\\\.5px\\\\]:is(.dark *){stroke-width:2.5px}.dark\\\\:text-green-400:is(.dark *){color:var(--color-green-400)}.dark\\\\:text-red-200:is(.dark *){color:var(--color-red-200)}@media (hover:hover){.dark\\\\:hover\\\\:bg-accent:is(.dark *):hover,.dark\\\\:hover\\\\:bg-accent\\\\/50:is(.dark *):hover{background-color:var(--accent)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:hover\\\\:bg-accent\\\\/50:is(.dark *):hover{background-color:color-mix(in oklab,var(--accent)50%,transparent)}}.dark\\\\:hover\\\\:bg-accent\\\\/60:is(.dark *):hover{background-color:var(--accent)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:hover\\\\:bg-accent\\\\/60:is(.dark *):hover{background-color:color-mix(in oklab,var(--accent)60%,transparent)}}.dark\\\\:hover\\\\:bg-input\\\\/50:is(.dark *):hover{background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:hover\\\\:bg-input\\\\/50:is(.dark *):hover{background-color:color-mix(in oklab,var(--input)50%,transparent)}}.dark\\\\:hover\\\\:bg-muted-foreground\\\\/30:is(.dark *):hover{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:hover\\\\:bg-muted-foreground\\\\/30:is(.dark *):hover{background-color:color-mix(in oklab,var(--muted-foreground)30%,transparent)}}}.dark\\\\:focus-visible\\\\:ring-destructive\\\\/40:is(.dark *):focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:focus-visible\\\\:ring-destructive\\\\/40:is(.dark *):focus-visible{--tw-ring-color:color-mix(in oklab,var(--destructive)40%,transparent)}}.dark\\\\:aria-invalid\\\\:ring-destructive\\\\/40:is(.dark *)[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:aria-invalid\\\\:ring-destructive\\\\/40:is(.dark *)[aria-invalid=true]{--tw-ring-color:color-mix(in oklab,var(--destructive)40%,transparent)}}.\\\\[\\\\&_svg\\\\]\\\\:pointer-events-none svg{pointer-events:none}.\\\\[\\\\&_svg\\\\]\\\\:shrink-0 svg{flex-shrink:0}.\\\\[\\\\&_svg\\\\]\\\\:text-background svg{color:var(--background)}.\\\\[\\\\&_svg\\\\]\\\\:text-black svg{color:var(--color-black)}@media (hover:hover){.hover\\\\:\\\\[\\\\&_svg\\\\]\\\\:text-destructive:hover svg{color:var(--destructive)}}.\\\\[\\\\&_svg\\\\:not\\\\(\\\\[class\\\\*\\\\=\\\\'size-\\\\'\\\\]\\\\)\\\\]\\\\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.\\\\[\\\\&\\\\:last-child\\\\>td\\\\:first-child\\\\]\\\\:rounded-bl-lg:last-child>td:first-child{border-bottom-left-radius:var(--radius)}.\\\\[\\\\&\\\\:last-child\\\\>td\\\\:last-child\\\\]\\\\:rounded-br-lg:last-child>td:last-child{border-bottom-right-radius:var(--radius)}.\\\\[\\\\&\\\\:nth-child\\\\(n\\\\+3\\\\)\\\\]\\\\:hidden:nth-child(n+3){display:none}@container (min-width:28rem){.\\\\@md\\\\:\\\\[\\\\&\\\\:nth-child\\\\(n\\\\+3\\\\)\\\\]\\\\:block:nth-child(n+3){display:block}}.\\\\[\\\\&\\\\:where\\\\(\\\\>\\\\*\\\\)\\\\]\\\\:col-start-2:where(){grid-column-start:2}.only\\\\:\\\\[\\\\&\\\\>\\\\#attachment-tile\\\\]\\\\:size-24:only-child>#attachment-tile{width:calc(var(--spacing)*24);height:calc(var(--spacing)*24)}.\\\\[\\\\&\\\\>\\\\.aui-thread-root\\\\]\\\\:bg-inherit>.aui-thread-root{background-color:inherit}.\\\\[\\\\&\\\\>a\\\\]\\\\:text-xs>a{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.\\\\[\\\\&\\\\>a\\\\]\\\\:no-underline>a{text-decoration-line:none}.\\\\[\\\\&\\\\>button\\\\]\\\\:rounded-full>button{border-radius:3.40282e38px}.\\\\[\\\\&\\\\>button\\\\]\\\\:bg-foreground\\\\/60>button{background-color:var(--foreground)}@supports (color:color-mix(in lab, red, red)){.\\\\[\\\\&\\\\>button\\\\]\\\\:bg-foreground\\\\/60>button{background-color:color-mix(in oklab,var(--foreground)60%,transparent)}}.\\\\[\\\\&\\\\>button\\\\]\\\\:p-1>button{padding:calc(var(--spacing)*1)}.\\\\[\\\\&\\\\>button\\\\]\\\\:opacity-100>button{opacity:1}.\\\\[\\\\&\\\\>button\\\\]\\\\:\\\\!ring-0>button{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}@media (hover:hover){.\\\\[\\\\&\\\\>button\\\\]\\\\:hover\\\\:\\\\[\\\\&_svg\\\\]\\\\:text-destructive>button:hover svg{color:var(--destructive)}}.\\\\[\\\\&\\\\>li\\\\]\\\\:mt-1>li{margin-top:calc(var(--spacing)*1)}.\\\\[\\\\&\\\\>span\\\\]\\\\:text-xs>span{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.\\\\[\\\\&\\\\[align\\\\=center\\\\]\\\\]\\\\:text-center[align=center]{text-align:center}.\\\\[\\\\&\\\\[align\\\\=right\\\\]\\\\]\\\\:text-right[align=right]{text-align:right}}@keyframes shimmer{0%{transform:translate(-100%)}to{transform:translate(200%)}}@keyframes subtle-pulse{0%,to{opacity:1}50%{opacity:.85}}@keyframes smooth-slide-down{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}@keyframes fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes gradient-shift{0%,to{transform:translate(0%)translateY(0%)}25%{transform:translate(100%)translateY(100%)}50%{transform:translate(100%)translateY(0%)}75%{transform:translate(0%)translateY(100%)}}@keyframes float{0%,to{transform:translateY(0)translate(0)}33%{transform:translateY(-30px)translate(20px)}66%{transform:translateY(20px)translate(-20px)}}@keyframes float-delayed{0%,to{transform:translateY(0)translate(0)}33%{transform:translateY(30px)translate(-30px)}66%{transform:translateY(-20px)translate(20px)}}.tool-card-transition{transition:all .4s cubic-bezier(.34,1.56,.64,1)}.tool-card-smooth{transition:all .35s cubic-bezier(.4,0,.2,1)}.animate-fadeInUp{opacity:0;animation:.5s ease-out forwards fadeInUp}.animate-gradient-shift{background-size:200% 200%;animation:20s ease-in-out infinite gradient-shift}.animate-float-slow{animation:20s ease-in-out infinite float}.animate-float-delayed{animation:25s ease-in-out 5s infinite float-delayed}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}@keyframes aui-pulse{50%{opacity:.5}}:where(.aui-md[data-status=running]):empty:after,:where(.aui-md[data-status=running])>:where(:not(ol):not(ul):not(pre)):last-child:after,:where(.aui-md[data-status=running])>pre:last-child code:after,:where(.aui-md[data-status=running])>:where(:is(ol,ul):last-child)>:where(li:last-child:not(:has(*>li))):after,:where(.aui-md[data-status=running])>:where(:is(ol,ul):last-child)>:where(li:last-child)>:where(:is(ol,ul):last-child)>:where(li:last-child:not(:has(*>li))):after,:where(.aui-md[data-status=running])>:where(:is(ol,ul):last-child)>:where(li:last-child)>:where(:is(ol,ul):last-child)>:where(li:last-child)>:where(:is(ol,ul):last-child)>:where(li:last-child):after{--aui-content:\\\"●\\\";content:var(--aui-content);margin-left:.25rem;margin-right:.25rem;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;animation:2s cubic-bezier(.4,0,.6,1) infinite aui-pulse}@property --tw-border-spacing-x{syntax:\\\"<length>\\\";inherits:false;initial-value:0}@property --tw-border-spacing-y{syntax:\\\"<length>\\\";inherits:false;initial-value:0}@property --tw-translate-x{syntax:\\\"*\\\";inherits:false;initial-value:0}@property --tw-translate-y{syntax:\\\"*\\\";inherits:false;initial-value:0}@property --tw-translate-z{syntax:\\\"*\\\";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:\\\"*\\\";inherits:false;initial-value:0}@property --tw-border-style{syntax:\\\"*\\\";inherits:false;initial-value:solid}@property --tw-leading{syntax:\\\"*\\\";inherits:false}@property --tw-font-weight{syntax:\\\"*\\\";inherits:false}@property --tw-tracking{syntax:\\\"*\\\";inherits:false}@property --tw-shadow{syntax:\\\"*\\\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\\\"*\\\";inherits:false}@property --tw-shadow-alpha{syntax:\\\"<percentage>\\\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\\\"*\\\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\\\"*\\\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\\\"<percentage>\\\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\\\"*\\\";inherits:false}@property --tw-ring-shadow{syntax:\\\"*\\\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\\\"*\\\";inherits:false}@property --tw-inset-ring-shadow{syntax:\\\"*\\\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\\\"*\\\";inherits:false}@property --tw-ring-offset-width{syntax:\\\"<length>\\\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\\\"*\\\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\\\"*\\\";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:\\\"*\\\";inherits:false;initial-value:solid}@property --tw-blur{syntax:\\\"*\\\";inherits:false}@property --tw-brightness{syntax:\\\"*\\\";inherits:false}@property --tw-contrast{syntax:\\\"*\\\";inherits:false}@property --tw-grayscale{syntax:\\\"*\\\";inherits:false}@property --tw-hue-rotate{syntax:\\\"*\\\";inherits:false}@property --tw-invert{syntax:\\\"*\\\";inherits:false}@property --tw-opacity{syntax:\\\"*\\\";inherits:false}@property --tw-saturate{syntax:\\\"*\\\";inherits:false}@property --tw-sepia{syntax:\\\"*\\\";inherits:false}@property --tw-drop-shadow{syntax:\\\"*\\\";inherits:false}@property --tw-drop-shadow-color{syntax:\\\"*\\\";inherits:false}@property --tw-drop-shadow-alpha{syntax:\\\"<percentage>\\\";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:\\\"*\\\";inherits:false}@property --tw-backdrop-blur{syntax:\\\"*\\\";inherits:false}@property --tw-backdrop-brightness{syntax:\\\"*\\\";inherits:false}@property --tw-backdrop-contrast{syntax:\\\"*\\\";inherits:false}@property --tw-backdrop-grayscale{syntax:\\\"*\\\";inherits:false}@property --tw-backdrop-hue-rotate{syntax:\\\"*\\\";inherits:false}@property --tw-backdrop-invert{syntax:\\\"*\\\";inherits:false}@property --tw-backdrop-opacity{syntax:\\\"*\\\";inherits:false}@property --tw-backdrop-saturate{syntax:\\\"*\\\";inherits:false}@property --tw-backdrop-sepia{syntax:\\\"*\\\";inherits:false}@property --tw-duration{syntax:\\\"*\\\";inherits:false}@property --tw-ease{syntax:\\\"*\\\";inherits:false}@property --tw-scale-x{syntax:\\\"*\\\";inherits:false;initial-value:1}@property --tw-scale-y{syntax:\\\"*\\\";inherits:false;initial-value:1}@property --tw-scale-z{syntax:\\\"*\\\";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}\";\n\n/**\n * Inject the WebMCP styles into the document head.\n * This is called automatically when registering the web component.\n */\nexport function injectStyles(): void {\n\tif (typeof document === 'undefined') return\n\n\tconst styleId = 'webmcp-agent-styles'\n\tif (document.getElementById(styleId)) return\n\n\tconst style = document.createElement('style')\n\tstyle.id = styleId\n\tstyle.textContent = WEBMCP_STYLES\n\tdocument.head.appendChild(style)\n}\n","/**\n * WebMCP Agent Web Component\n *\n * A custom element wrapper for the EmbeddedAgent React component.\n * Uses @r2wc/react-to-web-component to convert React to a native web component.\n *\n * @example Usage as a custom element (standalone - styles auto-injected)\n * ```html\n * <script src=\"@mcp-b/embedded-agent/web-component/standalone\"></script>\n * <webmcp-agent\n * app-id=\"your-app-id\"\n * api-base=\"https://your-worker.workers.dev\"\n * ></webmcp-agent>\n * ```\n *\n * @example React usage (import the component directly)\n * ```tsx\n * import { EmbeddedAgent } from '@mcp-b/embedded-agent'\n * import '@mcp-b/embedded-agent/styles'\n *\n * function App() {\n * return (\n * <EmbeddedAgent\n * appId=\"your-app-id\"\n * apiBase=\"https://your-worker.workers.dev\"\n * />\n * )\n * }\n * ```\n */\n\nimport { AssistantRuntimeProvider } from '@assistant-ui/react'\nimport { AssistantChatTransport, useChatRuntime } from '@assistant-ui/react-ai-sdk'\nimport r2wc from '@r2wc/react-to-web-component'\nimport { lastAssistantMessageIsCompleteWithToolCalls } from 'ai'\nimport { useMemo } from 'react'\n\nimport { AssistantModal } from './components/assistant-modal'\nimport { MCPToolRegistry } from './components/MCPToolRegistry'\nimport { injectStyles } from './generated/inline-styles'\nimport { MCPToolsProvider } from './providers/MCPToolsProvider'\nimport { VoiceModeProvider } from './providers/VoiceModeProvider'\n\nimport type { FC } from 'react'\n\n/**\n * Props for the EmbeddedAgent React component\n *\n * These props map to HTML attributes in kebab-case when used as a web component:\n * - appId -> app-id\n * - apiBase -> api-base\n * - tokenEndpoint -> token-endpoint\n * - autoConnectLocal -> auto-connect-local\n */\nexport interface EmbeddedAgentProps {\n\t/** Your app/workspace ID */\n\tappId: string\n\t/** API base URL for your WebMCP worker */\n\tapiBase?: string\n\t/** Voice mode token endpoint (defaults to {apiBase}/api/realtime/session) */\n\ttokenEndpoint?: string\n\t/** Auto-connect to local MCP source (default: true) */\n\tautoConnectLocal?: boolean\n\t/** Callback when tools are updated */\n\tonToolsChange?: (tools: unknown[]) => void\n\t/** Callback when voice mode errors */\n\tonVoiceError?: (error: string) => void\n\t/** Callback when voice mode connects */\n\tonVoiceConnect?: () => void\n\t/** Callback when voice mode disconnects */\n\tonVoiceDisconnect?: (duration: number) => void\n}\n\n/**\n * EmbeddedAgent React Component\n *\n * A fully self-contained chat widget with MCP tool support and optional voice mode.\n * Can be used as a React component or converted to a web component.\n */\nexport const EmbeddedAgent: FC<EmbeddedAgentProps> = ({\n\tappId,\n\tapiBase,\n\ttokenEndpoint,\n\tautoConnectLocal = true,\n\tonToolsChange,\n\tonVoiceError,\n\tonVoiceConnect,\n\tonVoiceDisconnect,\n}) => {\n\t// Create transport with custom API endpoint\n\tconst transport = useMemo(() => {\n\t\tconst chatApi = apiBase ? `${apiBase}/api/chat` : '/api/chat'\n\t\treturn new AssistantChatTransport({ api: chatApi })\n\t}, [apiBase])\n\n\tconst runtime = useChatRuntime({\n\t\ttransport,\n\t\tsendAutomaticallyWhen: (messages) => {\n\t\t\treturn lastAssistantMessageIsCompleteWithToolCalls(messages)\n\t\t},\n\t})\n\n\t// Compute token endpoint from apiBase if not explicitly provided\n\tconst resolvedTokenEndpoint =\n\t\ttokenEndpoint || (apiBase ? `${apiBase}/api/realtime/session` : undefined)\n\n\t// Log appId for debugging (to be used for API calls in future)\n\tif (appId && typeof window !== 'undefined') {\n\t\tconsole.debug('[WebMCP] Initialized with app_id:', appId)\n\t}\n\n\treturn (\n\t\t<MCPToolsProvider autoConnectLocal={autoConnectLocal} onToolsChange={onToolsChange}>\n\t\t\t{resolvedTokenEndpoint ? (\n\t\t\t\t<VoiceModeProvider\n\t\t\t\t\ttokenEndpoint={resolvedTokenEndpoint}\n\t\t\t\t\tonError={onVoiceError}\n\t\t\t\t\tonConnect={onVoiceConnect}\n\t\t\t\t\tonDisconnect={onVoiceDisconnect}\n\t\t\t\t>\n\t\t\t\t\t<AssistantRuntimeProvider runtime={runtime}>\n\t\t\t\t\t\t<MCPToolRegistry />\n\t\t\t\t\t\t<AssistantModal />\n\t\t\t\t\t</AssistantRuntimeProvider>\n\t\t\t\t</VoiceModeProvider>\n\t\t\t) : (\n\t\t\t\t<AssistantRuntimeProvider runtime={runtime}>\n\t\t\t\t\t<MCPToolRegistry />\n\t\t\t\t\t<AssistantModal />\n\t\t\t\t</AssistantRuntimeProvider>\n\t\t\t)}\n\t\t</MCPToolsProvider>\n\t)\n}\n\n/**\n * Web Component Definition\n *\n * Converts EmbeddedAgent to a custom element that can be used in any HTML page.\n * Attributes are automatically converted from kebab-case to camelCase props.\n */\n// Cast needed for React 19 compatibility - FC return type changed to ReactNode | Promise<ReactNode>\n// but @r2wc expects the older ComponentType signature. Using double assertion to bridge\n// the incompatible React type definitions between our project and @r2wc's dependencies.\nexport const WebMCPAgentElement = r2wc(EmbeddedAgent as unknown as Parameters<typeof r2wc>[0], {\n\tprops: {\n\t\tappId: 'string',\n\t\tapiBase: 'string',\n\t\ttokenEndpoint: 'string',\n\t\tautoConnectLocal: 'boolean',\n\t},\n})\n\n/**\n * Register the custom element\n *\n * Call this function to register the <webmcp-agent> custom element.\n * This is automatically called when importing the web-component entry point.\n * Styles are automatically injected into the document head.\n */\nexport function registerWebMCPAgent(tagName = 'webmcp-agent'): void {\n\tif (typeof window === 'undefined') return\n\n\t// Inject styles into the document head\n\tinjectStyles()\n\n\t// Register the custom element if not already registered\n\tif (!customElements.get(tagName)) {\n\t\tcustomElements.define(tagName, WebMCPAgentElement)\n\t}\n}\n\n// Auto-register when this module is imported\nregisterWebMCPAgent()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,SAAgBG,GAAG,GAAGC,QAA8B;AACnD,QAAOH,QAAQD,KAAKI,OAAO,CAAC;;;;;;ACW7B,MAAaI,2BAA2B;;AAOxC,MAAaC,uBAAuB;;AAGpC,MAAaC,yBAAyB;;AAGtC,MAAaC,yBAAyB;;AAGtC,MAAaC,2BAA2B;;AAGxC,MAAaC,kCAAkC;;AAG/C,MAAaC,4BAA4B;;AAGzC,MAAaC,gCAAgC;;AAG7C,MAAaC,sCAAsC;;;;;;AA4BnD,MAAaI,wBACZ,OAAOC,WAAW,eACjBA,OAA0CC,qBAAqB;;;;;;;;;AAUjE,SAAgBC,SAASC,WAAmBC,SAAiBC,MAAsB;AAMlF,KAHC,OAAOL,WAAW,eACjBA,OAA0CC,qBAAqB,KAGhE,KAAII,SAASE,OACZC,SAAQC,IAAI,IAAIN,UAAS,IAAKC,WAAWC,KAAK;KAE9CG,SAAQC,IAAI,IAAIN,UAAS,IAAKC,UAAU;;;;;;;;;AC7F3C,IAAaO,gBAAb,MAA2B;CAC1B,AAAQC,eAAoC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jB,EAAA;AAAA,QAnBnBiB;;;;;;;;AAgCF,MAAaC,qBAAqBzC,KAAKqB,eAAwD,EAC9FsB,OAAO;CACNjC,OAAO;CACPC,SAAS;CACTC,eAAe;CACfC,kBAAkB;CACnB,EACA,CAAC;;;;;;;;AASF,SAAgB+B,oBAAoBC,UAAU,gBAAsB;AACnE,KAAI,OAAOT,WAAW,YAAa;AAGnC/B,eAAc;AAGd,KAAI,CAACyC,eAAeC,IAAIF,QAAQ,CAC/BC,gBAAeE,OAAOH,SAASJ,mBAAmB;;AAKpDG,qBAAqB;AA9FgC,SAAAX,MAAAgB,UAAA;AAAA,QAmB3ChD,4CAA4CgD,SAAS"}
|
|
1
|
+
{"version":3,"file":"web-component.js","names":["clsx","twMerge","ClassValue","cn","inputs","MCP_MAX_RECONNECT_ATTEMPTS","MCP_BASE_RECONNECT_DELAY_MS","MCP_MAX_RECONNECT_DELAY_MS","MCP_TAB_CONNECT_DELAY_MS","AUDIO_FREQUENCY_BINS","REALTIME_DEFAULT_MODEL","REALTIME_DEFAULT_VOICE","REALTIME_DEFAULT_API_URL","AUDIO_VISUALIZATION_INTERVAL_MS","RESPONSE_REQUEST_DELAY_MS","TOOL_CALL_DISPLAY_DURATION_MS","TOOL_CALL_ERROR_DISPLAY_DURATION_MS","WAVEFORM_HISTORY_SIZE","WAVEFORM_UPDATE_RATE_MS","WEBSOCKET_OPEN","DEBUG_LOGGING_ENABLED","window","__WEBMCP_DEBUG__","debugLog","component","message","data","isDebugEnabled","undefined","console","log","debugLog","AudioAnalyzer","audioContext","AudioContext","analyser","AnalyserNode","source","MediaStreamAudioSourceNode","dataArray","Uint8Array","ArrayBuffer","animationId","initialize","stream","MediaStream","Promise","audioTracks","getAudioTracks","streamId","id","length","trackInfo","map","t","label","enabled","muted","readyState","state","resume","err","console","warn","createAnalyser","fftSize","smoothingTimeConstant","createMediaStreamSource","connect","bufferLength","frequencyBinCount","sampleRate","contextState","getAudioLevel","getByteFrequencyData","sum","i","average","Math","min","getFrequencyData","bins","Array","fill","result","samplesPerBin","floor","j","push","startAnalysis","callback","level","frequencies","analyze","requestAnimationFrame","stopAnalysis","cancelAnimationFrame","destroy","disconnect","close","EventCallback","IEventEmitter","EventEmitter","listeners","Map","Set","on","event","callback","has","set","get","add","off","delete","emit","data","forEach","error","console","removeAllListeners","clear","listenerCount","size","RESPONSE_REQUEST_DELAY_MS","EventEmitter","ToolManager","FunctionCall","RealtimeMessage","ResponseOutputItem","type","status","name","call_id","arguments","isCompletedFunctionCall","item","MessageHandler","isProcessingResponse","pendingFunctionCalls","Set","responseRequestTimer","ReturnType","setTimeout","hasRequestedResponse","constructor","toolManager","eventEmitter","handleMessage","data","dataChannel","RTCDataChannel","Promise","msg","JSON","parse","error","console","handleResponseCreated","handleResponseDone","handleFunctionCallArguments","handleSpeechEvents","handleAudioEvents","handleTranscriptEvents","handleUserTranscript","handleError","handleSessionEvents","_msg","outputItems","extractResponseOutput","response","hasFunctionCalls","some","length","functionCalls","filter","map","functionCall","has","add","executeFunctionCall","warn","size","requestResponseIfNeeded","r","Record","Array","isArray","output","eventType","emit","log","hasAudio","delta","eventMap","text","transcript","clearTimeout","result","executeToolCall","readyState","stringify","success","send","undefined","sendToolError","String","delete","errorResponse","reset","clear","FunctionCall","OpenAITool","ToolExecutionResult","RegisteredTool","name","description","inputSchema","Record","ToolExecutor","args","Promise","ToolManager","tools","executor","lastSentToolSignature","setTools","setExecutor","resetSession","console","log","getToolSignature","map","t","sort","join","hasToolsChanged","currentSignature","markToolsSent","formatToolsForOpenAI","builtInTools","type","parameters","properties","required","registeredTools","tool","const","validateToolSchema","schema","result","Object","entries","filter","prop","p","optional","nullable","key","executeToolCall","functionCall","arguments","argsString","executeListTools","success","error","find","JSON","parse","data","String","toolList","count","length","message","getChangesSummary","added","removed","total","prevTools","split","Boolean","currTools","prevSet","Set","currSet","has","debugLog","REALTIME_DEFAULT_API_URL","REALTIME_DEFAULT_MODEL","REALTIME_DEFAULT_VOICE","RealtimeConfig","RealtimeSession","EphemeralTokenResponse","client_secret","value","hasClientSecret","response","secret","WebRTCManager","tokenEndpoint","constructor","createSession","config","Promise","model","voice","apiUrl","ephemeralKey","getEphemeralToken","pc","RTCPeerConnection","audioElement","createAudioElement","remoteStream","MediaStream","ontrack","e","streams","srcObject","streamId","id","tracks","getTracks","length","localStream","getUserMedia","map","t","kind","enabled","muted","readyState","forEach","track","addTrack","dataChannel","createDataChannel","offer","createOffer","setLocalDescription","sdp","Error","answer","connectToOpenAI","setRemoteDescription","cleanup","stop","remove","close","fetch","method","headers","body","JSON","stringify","ok","errorText","text","console","error","statusText","data","json","HTMLAudioElement","document","createElement","autoplay","style","display","appendChild","navigator","mediaDevices","audio","echoCancellation","noiseSuppression","autoGainControl","baseUrl","RTCSessionDescriptionInit","Authorization","answerSdp","type","const","AUDIO_FREQUENCY_BINS","AUDIO_VISUALIZATION_INTERVAL_MS","debugLog","AudioAnalyzer","EventEmitter","MessageHandler","ToolManager","WebRTCManager","RegisteredTool","ToolExecutor","EventCallback","RealtimeConfig","RealtimeSession","SessionConfig","EMPTY_FREQUENCY_TEMPLATE","Object","freeze","Array","fill","createZeroFrequencyArray","OpenAIRealtimeService","session","webrtcManager","toolManager","messageHandler","eventEmitter","muted","lastState","localAnalyzer","remoteAnalyzer","visualizationInterval","ReturnType","setInterval","sessionStartTime","onToolsChangedCallback","constructor","tokenEndpoint","setTools","tools","isSessionActive","updateSessionTools","setToolExecutor","executor","setExecutor","onToolsChanged","callback","startSession","config","Promise","stopSession","Date","now","emitSessionState","createSession","setupDataChannel","dataChannel","setupPeerConnectionMonitoring","pc","localStream","initializeLocalAnalyzer","remoteStream","initializeRemoteAnalyzer","originalOntrack","ontrack","e","call","streams","console","warn","error","handleSessionError","durationSeconds","Math","floor","clearInterval","destroy","cleanup","reset","resetSession","sendUserMessage","text","Error","message","type","item","role","content","send","JSON","stringify","readyState","getLocalStream","MediaStream","getRemoteStream","toggleMute","audioElement","isMuted","on","event","off","getSessionStatus","state","isActive","RTCDataChannel","addEventListener","configureSession","MessageEvent","handleMessage","data","emit","RTCPeerConnection","connectionState","iceConnectionState","formatToolsForOpenAI","markToolsSent","sessionConfig","modalities","instructions","getSessionInstructions","voice","tool_choice","turn_detection","threshold","prefix_padding_ms","silence_duration_ms","input_audio_transcription","model","sessionUpdate","changesSummary","getChangesSummary","log","total","added","length","slice","join","removed","String","stream","clonedStream","getAudioTracks","map","t","clone","initialize","startAudioVisualization","logCounter","micLevel","getAudioLevel","micFrequency","getFrequencyData","speakerLevel","speakerFrequency","mic","toFixed","speaker","extra","Record","payload","RealtimeConfig","model","voice","apiUrl","tokenEndpoint","RealtimeSession","pc","RTCPeerConnection","dataChannel","RTCDataChannel","audioElement","HTMLAudioElement","localStream","MediaStream","remoteStream","cleanup","OpenAITool","type","name","description","parameters","properties","Record","required","SessionConfig","modalities","instructions","tools","tool_choice","turn_detection","threshold","prefix_padding_ms","silence_duration_ms","input_audio_transcription","FunctionCall","arguments","call_id","status","ConversationItem","role","content","output","RealtimeMessage","key","ToolExecutionResult","success","data","error","EventCallback","IEventEmitter","on","event","callback","off","emit","AudioLevelData","micLevel","micFrequency","speakerLevel","speakerFrequency","TranscriptData","text","isDone","ToolCallData","toolName","VoiceModeState","isActive","isConnecting","isMuted","isError","connectionState","audioLevel","transcript","toolCall","SessionStateEventData","state","durationSeconds","UserTranscriptEventData","AssistantTranscriptEventData","delta","ToolCallStartedEventData","ToolCallCompletedEventData","ErrorEventData","message","isSessionStateEventData","d","includes","isUserTranscriptEventData","isAssistantTranscriptEventData","undefined","isToolCallStartedEventData","isToolCallCompletedEventData","isErrorEventData","isAudioLevelData","Array","isArray","useCallback","useEffect","useMemo","useRef","useState","TOOL_CALL_DISPLAY_DURATION_MS","TOOL_CALL_ERROR_DISPLAY_DURATION_MS","isAssistantTranscriptEventData","isAudioLevelData","isErrorEventData","isSessionStateEventData","isToolCallCompletedEventData","isToolCallStartedEventData","isUserTranscriptEventData","OpenAIRealtimeService","AudioLevelData","RealtimeConfig","RegisteredTool","ToolCallData","ToolExecutor","TranscriptData","VoiceModeState","UseVoiceModeOptions","tokenEndpoint","tools","toolExecutor","onConnect","onDisconnect","durationSeconds","onError","error","onUserTranscript","text","onAssistantTranscript","UseVoiceModeReturn","startSession","config","Promise","stopSession","toggleMute","muted","sendMessage","useVoiceMode","options","$","_c","isActive","setIsActive","isConnecting","setIsConnecting","isMuted","setIsMuted","isError","setIsError","connectionState","setConnectionState","audioLevel","setAudioLevel","transcript","setTranscript","toolCall","setToolCall","setError","serviceRef","onConnectRef","onDisconnectRef","onErrorRef","onUserTranscriptRef","onAssistantTranscriptRef","t0","t1","current","t2","getService","t3","t4","service","setTools","t5","t6","service_0","setToolExecutor","t7","t8","service_1","handleSessionState","data","console","warn","state","handleAudioLevel","data_0","handleUserTranscript","data_1","type","isDone","handleAssistantTranscript","data_2","delta","prev","handleAssistantTranscriptDone","data_3","text_0","handleToolCallStarted","data_4","status","toolName","name","handleToolCallCompleted","data_5","setTimeout","undefined","handleError","data_6","errorMsg","message","on","off","t9","service_2","t10","err","errorMsg_0","Error","service_3","t11","service_4","newMuted","t12","text_1","service_5","isSessionActive","sendUserMessage","t13","createContext","useContext","useMemo","useVoiceMode","ReactNode","UseVoiceModeReturn","RegisteredTool","ToolExecutor","VoiceModeContextValue","isSupported","VoiceModeContext","VoiceModeProviderProps","children","tokenEndpoint","tools","toolExecutor","onConnect","onDisconnect","durationSeconds","onError","error","onUserTranscript","text","onAssistantTranscript","checkVoiceModeSupport","window","RTCPeerConnection","navigator","mediaDevices","getUserMedia","VoiceModeProvider","t0","$","_c","t1","voiceMode","t2","Symbol","for","t3","value","t4","useVoiceModeContext","context","Error","useOptionalVoiceModeContext","c","_c","AvatarPrimitive","React","cn","Avatar","t0","$","className","props","t1","t2","AvatarImage","AvatarFallback","c","_c","DialogPrimitive","XIcon","React","cn","Dialog","t0","$","props","t1","DialogTrigger","DialogPortal","DialogClose","DialogOverlay","className","t2","DialogContent","children","showCloseButton","undefined","Symbol","for","t3","t4","t5","DialogHeader","DialogFooter","DialogTitle","DialogDescription","c","_c","TooltipPrimitive","React","cn","TooltipProvider","t0","$","props","t1","delayDuration","undefined","t2","Tooltip","TooltipTrigger","TooltipContent","children","className","sideOffset","t3","Symbol","for","t4","Slot","cva","React","cn","VariantProps","ButtonProps","ComponentProps","buttonVariants","asChild","variants","variant","default","destructive","outline","secondary","ghost","link","size","sm","lg","icon","defaultVariants","Button","t0","$","_c","className","props","t1","undefined","Comp","t2","t3","c","_c","Slottable","forwardRef","cn","Button","Tooltip","TooltipContent","TooltipTrigger","ComponentPropsWithRef","TooltipIconButtonProps","tooltip","side","TooltipIconButton","HTMLButtonElement","t0","ref","$","children","className","rest","t1","undefined","t2","t3","t4","t5","t6","t7","displayName","c","_c","AttachmentPrimitive","ComposerPrimitive","MessagePrimitive","useAssistantApi","useAssistantState","FileText","PlusIcon","XIcon","useEffect","useState","useShallow","cn","Avatar","AvatarFallback","AvatarImage","Dialog","DialogContent","DialogTitle","DialogTrigger","Tooltip","TooltipContent","TooltipTrigger","TooltipIconButton","FC","PropsWithChildren","useFileSrc","file","$","src","setSrc","undefined","t0","t1","objectUrl","URL","createObjectURL","revokeObjectURL","useAttachmentSrc","src_0","_temp2","AttachmentPreviewProps","AttachmentPreview","AttachmentPreviewDialog","children","t2","Symbol","for","t3","t4","AttachmentThumb","isImage","_temp3","AttachmentUI","api","isComposer","attachment","source","_temp4","typeLabel","_temp5","t5","t6","t7","t8","t9","t10","AttachmentRemove","UserMessageAttachments","Attachment","ComposerAttachments","ComposerAddAttachment","_temp","type","content","filter","image","attachment_0","_exhaustiveCheck","Error","c","_c","MarkdownTextPrimitive","unstable_memoizeMarkdownComponents","memoizeMarkdownComponents","useIsMarkdownCodeBlock","CheckIcon","CopyIcon","memo","useState","remarkGfm","cn","TooltipIconButton","CodeHeaderProps","FC","MarkdownTextImpl","$","t0","Symbol","for","defaultComponents","MarkdownText","CodeHeader","language","code","isCopied","copyToClipboard","useCopyToClipboard","t1","onCopy","t2","t3","t4","t5","t6","undefined","copiedDuration","setIsCopied","value","navigator","clipboard","writeText","then","setTimeout","h1","className","props","h2","h3","h4","h5","h6","p","a","blockquote","ul","ol","hr","table","th","td","tr","sup","pre","Code","isCodeBlock","TabClientTransport","SSEClientTransport","StreamableHTTPClientTransport","MCPSourceConfig","Transport","TransportType","createMCPTransport","config","transportType","type","targetOrigin","window","location","origin","channelId","serverUrl","URL","url","headers","Record","Accept","customHeaders","authToken","Authorization","transportOptions","requestInit","shouldFallbackToSSE","error","Error","message","includes","calculateReconnectDelay","attempt","baseDelay","maxDelay","Math","min","pow","Client","ToolListChangedNotificationSchema","createContext","useCallback","useContext","useEffect","useMemo","useRef","useState","MCP_TAB_CONNECT_DELAY_MS","createMCPTransport","CallToolResult","MCPSource","MCPSourceConfig","Prompt","Resource","ResourceTemplate","ToolWithSource","Transport","ReactNode","SOURCE_LOCAL","SOURCE_REMOTE","SourceState","Omit","client","transport","resources","resourceTemplates","prompts","MCPToolsContextValue","tools","sources","Map","addSource","id","config","Promise","removeSource","getSource","isConnected","callTool","name","args","Record","callToolOnSource","sourceId","MCPToolsContext","MCPToolsProviderProps","children","autoConnectLocal","onToolsChange","MCPToolsProvider","sourcesRef","forceUpdate","toolsList","setToolsList","rebuildTools","allTools","current","forEach","source","tool","push","_sourceId","getPublicSource","state","error","has","sourceState","set","version","connect","listTools","setNotificationHandler","updated","err","console","Error","String","get","close","delete","undefined","arguments","find","t","publicSources","timer","setTimeout","type","clearTimeout","catch","clear","value","useMCPTools","context","useOptionalMCPTools","Loader2","Plug","Plus","X","useCallback","useState","cn","SOURCE_REMOTE","useMCPTools","Button","Dialog","DialogContent","DialogDescription","DialogHeader","DialogTitle","DialogTrigger","TooltipIconButton","FC","RemoteServer","id","url","RemoteMCPSettings","sources","addSource","removeSource","isOpen","setIsOpen","setUrl","isConnecting","setIsConnecting","error","setError","remoteServers","forEach","source","config","type","push","handleConnect","trim","URL","serverId","length","Date","now","err","Error","message","handleDisconnect","handleKeyDown","e","React","KeyboardEvent","key","connectedCount","filter","s","get","state","target","value","map","server","isConnected","isLoading","tools","CheckIcon","ChevronDownIcon","ChevronUpIcon","useState","Button","ToolCallMessagePartComponent","ToolFallback","t0","$","_c","toolName","argsText","result","isCollapsed","setIsCollapsed","t1","Symbol","for","t2","t3","t4","t5","undefined","JSON","stringify","t6","useEffect","useRef","cn","HTMLAttributes","LiveWaveformProps","HTMLDivElement","active","processing","barWidth","barGap","barRadius","barColor","fadeEdges","fadeWidth","height","sensitivity","smoothingTimeConstant","mode","manualAudioLevel","LiveWaveform","t0","$","_c","className","props","t1","t10","t2","t3","t4","t5","t6","t7","t8","t9","undefined","canvasRef","containerRef","t11","Symbol","for","historyRef","lastUpdateRef","processingAnimationRef","t12","lastActiveDataRef","transitionProgressRef","t13","staticBarsRef","needsRedrawRef","gradientCacheRef","lastWidthRef","heightStyle","t14","t15","canvas","current","container","resizeObserver","ResizeObserver","rect","getBoundingClientRect","dpr","window","devicePixelRatio","width","style","ctx","getContext","scale","observe","disconnect","t16","t17","time","animateProcessing","Math","min","processingData","barCount","floor","halfCount","i","normalizedPosition","centerWeight","abs","wave1","sin","wave2","wave3","cos","combinedWave","processingValue","finalValue","length","lastDataIndex","lastValue","push","max","i_0","normalizedPosition_0","centerWeight_0","wave1_0","wave2_0","wave3_0","combinedWave_0","processingValue_0","finalValue_0","lastDataIndex_0","lastValue_0","requestAnimationFrame","cancelAnimationFrame","hasData","fadeProgress","fadeToIdle","map","value","value_0","t18","t19","canvas_0","ctx_0","rafId","animate","currentTime","rect_0","level","barCount_0","halfCount_0","newBars","i_1","distanceFromCenter","value_1","i_2","distanceFromCenter_0","value_2","shift","clearRect","computedBarColor","getComputedStyle","color","step","barCount_1","centerY","dataToRender","i_3","value_3","x","barHeight","y","fillStyle","globalAlpha","beginPath","roundRect","fill","fillRect","i_4","dataIndex","value_4","x_0","barHeight_0","y_0","gradient","createLinearGradient","fadePercent","addColorStop","globalCompositeOperation","t20","t21","t22","t23","t24","t25","Mic","MicOff","Phone","PhoneOff","Volume2","cn","Button","LiveWaveform","AudioLevelData","ToolCallData","VoiceIndicatorProps","isActive","isConnecting","isMuted","audioLevel","toolCall","onStart","onStop","onToggleMute","className","VoiceIndicator","t0","$","_c","micLevel","speakerLevel","toolCallStatus","status","error","t1","getBorderClass","t2","t3","t4","Symbol","for","t5","t6","t7","t8","t9","t10","t11","t12","t13","t14","t15","t16","t17","t18","t19","t20","t21","t22","t23","t24","toolName","t25","t26","ActionBarPrimitive","BranchPickerPrimitive","ComposerPrimitive","ErrorPrimitive","MessagePrimitive","ThreadPrimitive","ArrowDownIcon","ArrowUpIcon","CheckIcon","ChevronLeftIcon","ChevronRightIcon","CopyIcon","PencilIcon","Phone","RefreshCwIcon","Square","AnimatePresence","domAnimation","LazyMotion","MotionConfig","m","cn","useOptionalVoiceModeContext","ComposerAddAttachment","ComposerAttachments","UserMessageAttachments","Button","MarkdownText","RemoteMCPSettings","ToolFallback","TooltipIconButton","VoiceIndicator","FC","ThreadWithVoice","UserMessage","EditComposer","AssistantMessage","ComposerArea","$","_c","voiceMode","t0","Symbol","for","t1","isSupported","isActive","isConnecting","opacity","y","duration","isMuted","audioLevel","toolCall","startSession","stopSession","toggleMute","t2","t3","t4","TextComposer","t5","t6","t7","t8","t9","ThreadScrollToBottom","ThreadWelcome","delay","ThreadSuggestions","title","label","action","map","_temp","MessageError","Text","tools","Fallback","AssistantActionBar","UserActionBar","BranchPicker","Root","Props","className","rest","suggestedAction","index","c","_c","AssistantModalPrimitive","ChevronDownIcon","forwardRef","ThreadWithVoice","TooltipIconButton","FC","AssistantModal","$","t0","Symbol","for","t1","AssistantModalButtonProps","AssistantModalButton","HTMLButtonElement","ref","rest","state","tooltip","t2","t3","t4","displayName","useAssistantTool","useMCPTools","CallToolResult","ToolWithSource","FC","ToolBridge","tool","callTool","name","args","Record","Promise","toolName","description","parameters","inputSchema","execute","result","textContent","content","map","c","text","JSON","stringify","join","error","console","MCPToolRegistry","$","_c","tools","t0","t1","_sourceId","MCPToolsDebug","sources","Symbol","for","t2","Array","from","values","_temp2","t3","length","t4","_temp3","t5","t6","source","id","state","message","useThread","useMemo","Action","id","label","toolName","status","args","result","error","startedAt","duration","humanizeToolName","isRunning","words","replace","toLowerCase","split","length","verb","progressive","endsWith","slice","charAt","toUpperCase","join","ToolCallPart","type","toolCallId","useActions","$","_c","messages","_temp","t0","bb0","t1","Symbol","for","actions","message","role","part","content","toolPart","isComplete","undefined","hasError","Record","push","String","thread","useCurrentAction","find","_temp2","a","useRecentActions","limit","filter","_temp3","useActionStats","_temp4","t2","t3","_temp5","t4","t5","_temp6","t6","total","completed","running","failed","a_1","a_0","c","_c","AlertCircle","CheckCircle2","Circle","Loader2","cn","FC","Action","CurrentActivityProps","currentAction","recentActions","showRecent","className","CurrentActivity","t0","$","t1","t2","t3","undefined","length","t4","t5","status","label","t6","map","_temp","t7","ActionStatus","ActionStatusIconProps","size","ActionStatusIcon","sizeClass","IdleIndicator","Symbol","for","action","id","c","_c","ChevronDown","useState","cn","ActionStatusIcon","FC","Action","ActionListProps","actions","defaultCollapsed","className","ActionList","t0","$","t1","undefined","isCollapsed","setIsCollapsed","length","t2","filter","_temp","completedCount","totalCount","t3","t4","t5","Symbol","for","t6","t7","t8","t9","t10","t11","t12","t13","t14","t15","map","_temp2","t16","t17","t18","ActionItemProps","action","ActionItem","status","label","duration","formatDuration","error","ms","seconds","toFixed","minutes","Math","floor","remainingSeconds","ActionSummary","_temp3","completed","_temp4","running","_temp5","failed","a","id","a_0","a_1","c","_c","ComposerPrimitive","ThreadPrimitive","Mic","Send","Square","cn","FC","PillComposerProps","placeholder","showVoiceButton","isVoiceActive","onVoiceToggle","className","PillComposer","t0","$","t1","t2","t3","undefined","t4","t5","Symbol","for","t6","t7","t8","t9","t10","t11","t12","MinimalComposer","onClick","c","_c","AnimatePresence","motion","useCallback","useEffect","useRef","useState","cn","Variants","FC","ReactNode","PillMode","PillContainerProps","mode","children","onModeChange","className","sizeSpring","type","const","stiffness","damping","mass","containerVariants","Record","width","height","padding","borderRadius","collapsed","hovered","composing","active","expanded","contentVariants","hidden","opacity","y","scale","visible","transition","staggerChildren","exit","duration","ease","hintVariants","delay","barVariants","idle","scaleX","hover","PillContainer","t0","$","isHovered","setIsHovered","hoverTimeoutRef","t1","current","clearTimeout","setTimeout","handleMouseEnter","t2","handleMouseLeave","t3","handleClick","t4","t5","handleKeyDown","e","isShortcut","ctrlKey","metaKey","shiftKey","key","toLowerCase","preventDefault","window","addEventListener","removeEventListener","t6","t7","Symbol","for","showContent","currentVariant","t8","t9","t10","t11","t12","glassClassName","t13","t14","undefined","t15","t16","t17","t18","minHeight","t19","background","backgroundSize","t20","t21","t22","t23","t24","t25","usePillMode","isRunning","hasPendingInput","hasMessages","userMode","setUserMode","derivedMode","setMode","c","_c","Mic","MicOff","PhoneOff","AnimatePresence","motion","useCallback","cn","useOptionalVoiceModeContext","LiveWaveform","FC","ToolBorderStatus","PillVoiceProps","onEnd","compact","className","voiceVariants","hidden","opacity","scale","y","visible","transition","type","const","stiffness","damping","exit","duration","buttonVariants","idle","hover","tap","transcriptVariants","height","voiceToolCallToBorderStatus","toolCall","status","error","PillVoice","t0","$","t1","undefined","voiceMode","t2","stopSession","handleEnd","t3","toggleMute","handleToggleMute","isActive","isConnecting","isError","isMuted","audioLevel","transcript","micLevel","speakerLevel","t4","t5","t6","t7","t8","t9","t10","t11","t12","t13","t14","t15","t16","t17","Symbol","for","t18","t19","t20","t21","t22","t23","t24","t25","t26","t27","t28","t29","t30","t31","t32","t33","t34","t35","t36","t37","t38","t39","t40","repeat","Infinity","toolName","t41","t42","text","isDone","t43","t44","t45","t46","t47","t48","useVoiceBorderStatus","c","_c","memo","ReactMarkdown","remarkGfm","cn","FC","HTMLAttributes","Components","PillMarkdownProps","content","className","compact","ElementProps","HTMLElement","PillMarkdown","t0","$","t1","t2","t3","t4","t5","t6","t7","t8","cn_","props","t9","cn__0","props_0","t10","cn__1","props_1","t11","cn__2","props_2","t12","cn__3","props_3","t13","cn__4","props_4","t14","cn__5","props_5","cn__7","props_7","cn__8","props_8","isInline","includes","cn__9","props_9","h1","h2","h3","p","a","ul","ol","li","_temp","blockquote","code","pre","hr","_temp2","strong","_temp3","em","_temp4","components","Symbol","for","t15","t16","displayName","cn__6","props_6","cn__10","props_10","cn__11","props_11","cn__12","props_12","c","_c","useThread","AlertCircle","CheckCircle2","useMemo","cn","PillMarkdown","FC","ReactNode","SummaryBlockProps","summary","isSuccess","isError","actions","QuickAction","className","label","onClick","variant","SummaryBlock","t0","$","t1","t2","t3","t4","t5","t6","t7","length","map","_temp","t8","TextPart","type","text","useLatestSummary","messages","_temp2","bb0","lastAssistantMessage","reverse","find","_temp3","textParts","content","filter","_temp4","lastText","at","m","role","thread","WelcomeMessage","Symbol","for","ThreadContent","empty","running","complete","_temp5","lastMessage","isRunning","status","action","i","c","_c","AnimatePresence","motion","useEffect","useRef","useState","cn","FC","ReactNode","ToolBorderStatus","ToolStatusBorderProps","status","children","className","borderRadius","borderVariants","idle","opacity","scale","calling","transition","duration","error","shakeAnimation","x","ease","const","ToolStatusBorder","t0","$","t1","undefined","effectiveStatus","t2","t3","t4","t5","t6","t7","t8","useToolBorderStatus","hasRunningAction","lastActionStatus","setStatus","timeoutRef","current","clearTimeout","setTimeout","c","_c","ThreadPrimitive","useThread","History","AnimatePresence","useCallback","useMemo","useState","useActions","useCurrentAction","useRecentActions","cn","useOptionalVoiceModeContext","ActionList","CurrentActivity","IdleIndicator","PillComposer","PillContainer","PillVoice","useVoiceBorderStatus","SummaryBlock","useLatestSummary","WelcomeMessage","ToolStatusBorder","useToolBorderStatus","FC","PillMode","AgentPillProps","position","onOpenHistory","showVoiceButton","isVoiceActive","onVoiceToggle","className","AgentPill","t0","$","t1","t2","t3","undefined","userMode","setUserMode","messages","_temp","voiceMode","voiceBorderStatus","isVoiceModeActive","isActive","isConnecting","isError","actions","currentAction","recentActions","summary","hasMessages","length","t4","bb0","t5","at","lastMessage","role","status","type","isRunning","completed","filter","_temp2","lastCompletedAction","textBorderStatus","borderStatus","t6","bb1","mode","t7","Symbol","for","newMode","handleModeChange","t8","stopSession","startSession","handleVoiceToggle","borderRadius","t9","t10","t11","t12","t13","t14","t15","t16","t17","error","t18","t19","t20","isSupported","t21","t22","t23","thread","a","c","_c","MessagePrimitive","ThreadPrimitive","MessageSquare","X","useState","cn","MarkdownText","ToolFallback","FC","Conversation","id","title","preview","timestamp","Date","messageCount","HistorySidebarProps","isOpen","onClose","conversations","selectedId","onSelectConversation","className","HistorySidebar","t0","$","t1","t2","undefined","showFullThread","setShowFullThread","t3","t4","t5","t6","Symbol","for","t7","t8","t9","t10","t11","t12","t13","length","t14","t15","EmptyHistory","ConversationListProps","onSelect","ConversationList","grouped","groupByDate","date","convos","map","convo","formatRelativeTime","FullThreadView","UserMessage","HistoryUserMessage","AssistantMessage","HistoryAssistantMessage","Text","tools","Fallback","Array","groups","Map","today","setHours","yesterday","setDate","getDate","convoDate","dateKey","getTime","toLocaleDateString","month","year","has","set","get","push","from","entries","now","diffMs","diffMins","Math","floor","diffHours","diffDays","day","WEBMCP_STYLES","injectStyles","document","styleId","getElementById","style","createElement","id","textContent","head","appendChild","AssistantRuntimeProvider","AssistantChatTransport","useChatRuntime","r2wc","lastAssistantMessageIsCompleteWithToolCalls","useCallback","useMemo","useState","AssistantModal","MCPToolRegistry","AgentPill","HistorySidebar","injectStyles","MCPToolsProvider","VoiceModeProvider","FC","Conversation","AgentViewMode","EmbeddedAgentProps","appId","apiBase","tokenEndpoint","autoConnectLocal","viewMode","onToolsChange","tools","onVoiceError","error","onVoiceConnect","onVoiceDisconnect","duration","EmbeddedAgent","t0","$","_c","t1","t2","undefined","chatApi","t3","api","transport","t4","sendAutomaticallyWhen","_temp","runtime","isHistoryOpen","setIsHistoryOpen","t5","Symbol","for","conversations","t6","handleOpenHistory","t7","handleCloseHistory","resolvedTokenEndpoint","window","console","debug","t8","renderUI","t9","t10","WebMCPAgentElement","Parameters","props","registerWebMCPAgent","tagName","customElements","get","define","messages"],"sources":["../src/lib/utils.ts","../src/lib/constants.ts","../src/services/realtime/audio-analyzer.ts","../src/services/realtime/event-emitter.ts","../src/services/realtime/message-handler.ts","../src/services/realtime/tool-manager.ts","../src/services/realtime/webrtc-manager.ts","../src/services/realtime/openai-realtime-service.ts","../src/services/realtime/types.ts","../src/hooks/useVoiceMode.ts","../src/providers/VoiceModeProvider.tsx","../src/components/avatar.tsx","../src/components/dialog.tsx","../src/components/tooltip.tsx","../src/components/button.tsx","../src/components/tooltip-icon-button.tsx","../src/components/attachment.tsx","../src/components/markdown-text.tsx","../src/lib/mcp-transport.ts","../src/providers/MCPToolsProvider.tsx","../src/components/RemoteMCPSettings.tsx","../src/components/tool-fallback.tsx","../src/components/live-waveform.tsx","../src/components/voice-indicator.tsx","../src/components/thread-with-voice.tsx","../src/components/assistant-modal.tsx","../src/components/MCPToolRegistry.tsx","../src/hooks/useActions.ts","../src/components/pill/CurrentActivity.tsx","../src/components/pill/ActionList.tsx","../src/components/pill/PillComposer.tsx","../src/components/pill/PillContainer.tsx","../src/components/pill/PillVoice.tsx","../src/components/pill/PillMarkdown.tsx","../src/components/pill/SummaryBlock.tsx","../src/components/pill/ToolStatusBorder.tsx","../src/components/pill/AgentPill.tsx","../src/components/pill/HistorySidebar.tsx","../src/generated/inline-styles.ts","../src/web-component.tsx"],"sourcesContent":["import { clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\nimport type { ClassValue } from 'clsx'\n\n/**\n * Merges Tailwind CSS classes with proper precedence handling.\n * Combines clsx for conditional classes and tailwind-merge for deduplication.\n */\nexport function cn(...inputs: ClassValue[]): string {\n\treturn twMerge(clsx(inputs))\n}\n","/**\n * Shared Constants\n *\n * Centralized location for all magic numbers, timeouts, and configuration values.\n * Having these in one place makes the codebase more maintainable and easier to tune.\n */\n\n// ============================================================================\n// MCP Connection Constants\n// ============================================================================\n\n/** Maximum number of reconnection attempts before giving up */\nexport const MCP_MAX_RECONNECT_ATTEMPTS = 5\n\n/** Base delay in milliseconds for exponential backoff reconnection */\nexport const MCP_BASE_RECONNECT_DELAY_MS = 1000\n\n/** Maximum reconnect delay in milliseconds (caps exponential backoff) */\nexport const MCP_MAX_RECONNECT_DELAY_MS = 30000\n\n/** Delay before auto-connecting to tab-based MCP sources (allows server initialization) */\nexport const MCP_TAB_CONNECT_DELAY_MS = 100\n\n// ============================================================================\n// Voice Mode / Realtime API Constants\n// ============================================================================\n\n/** Number of frequency bins for audio visualization */\nexport const AUDIO_FREQUENCY_BINS = 32\n\n/** Default OpenAI Realtime model */\nexport const REALTIME_DEFAULT_MODEL = 'gpt-4o-realtime-preview-2024-12-17'\n\n/** Default voice for OpenAI Realtime */\nexport const REALTIME_DEFAULT_VOICE = 'verse'\n\n/** Default OpenAI Realtime API URL */\nexport const REALTIME_DEFAULT_API_URL = 'https://api.openai.com/v1/realtime'\n\n/** Interval in milliseconds for audio visualization updates (~60fps) */\nexport const AUDIO_VISUALIZATION_INTERVAL_MS = 16\n\n/** Delay in milliseconds before requesting response after tool execution */\nexport const RESPONSE_REQUEST_DELAY_MS = 150\n\n/** Duration to show completed tool calls before clearing (success) */\nexport const TOOL_CALL_DISPLAY_DURATION_MS = 1500\n\n/** Duration to show failed tool calls before clearing (error) */\nexport const TOOL_CALL_ERROR_DISPLAY_DURATION_MS = 3000\n\n// ============================================================================\n// Waveform Visualization Constants\n// ============================================================================\n\n/** Default history size for scrolling waveform mode */\nexport const WAVEFORM_HISTORY_SIZE = 60\n\n/** Update rate in milliseconds for waveform visualization */\nexport const WAVEFORM_UPDATE_RATE_MS = 30\n\n// ============================================================================\n// WebSocket States (for type-safe comparisons)\n// ============================================================================\n\n/** WebSocket OPEN state value */\nexport const WEBSOCKET_OPEN = 1\n\n// ============================================================================\n// Logging Configuration\n// ============================================================================\n\n/**\n * Enable debug logging for development.\n * Can be enabled by setting window.__WEBMCP_DEBUG__ = true in the browser console.\n * In production builds, this defaults to false.\n */\nexport const DEBUG_LOGGING_ENABLED =\n\ttypeof window !== 'undefined' &&\n\t(window as { __WEBMCP_DEBUG__?: boolean }).__WEBMCP_DEBUG__ === true\n\n/**\n * Conditional debug logger that only logs when DEBUG_LOGGING_ENABLED is true.\n * Can be enabled at runtime by setting window.__WEBMCP_DEBUG__ = true\n *\n * @param component - The component or service name for the log prefix\n * @param message - The log message\n * @param data - Optional data to include in the log\n */\nexport function debugLog(component: string, message: string, data?: unknown): void {\n\t// Check the flag at runtime to allow enabling after page load\n\tconst isDebugEnabled =\n\t\ttypeof window !== 'undefined' &&\n\t\t(window as { __WEBMCP_DEBUG__?: boolean }).__WEBMCP_DEBUG__ === true\n\n\tif (isDebugEnabled) {\n\t\tif (data !== undefined) {\n\t\t\tconsole.log(`[${component}] ${message}`, data)\n\t\t} else {\n\t\t\tconsole.log(`[${component}] ${message}`)\n\t\t}\n\t}\n}\n","import { debugLog } from '../../lib/constants'\n\n/**\n * Audio analyzer for processing microphone and speaker audio streams.\n * Uses Web Audio API to analyze audio levels and frequency data.\n */\nexport class AudioAnalyzer {\n\tprivate audioContext: AudioContext | null = null\n\tprivate analyser: AnalyserNode | null = null\n\tprivate source: MediaStreamAudioSourceNode | null = null\n\tprivate dataArray: Uint8Array<ArrayBuffer> | null = null\n\tprivate animationId: number | null = null\n\n\t/**\n\t * Initialize the audio analyzer with a media stream\n\t * @param stream - MediaStream to analyze (typically from microphone or speaker)\n\t */\n\tasync initialize(stream: MediaStream): Promise<void> {\n\t\t// Log stream info for debugging\n\t\tconst audioTracks = stream.getAudioTracks()\n\t\tdebugLog('AudioAnalyzer', 'Initializing with stream', {\n\t\t\tstreamId: stream.id,\n\t\t\taudioTracks: audioTracks.length,\n\t\t\ttrackInfo: audioTracks.map((t) => ({\n\t\t\t\tid: t.id,\n\t\t\t\tlabel: t.label,\n\t\t\t\tenabled: t.enabled,\n\t\t\t\tmuted: t.muted,\n\t\t\t\treadyState: t.readyState,\n\t\t\t})),\n\t\t})\n\n\t\tthis.audioContext = new AudioContext()\n\t\tdebugLog('AudioAnalyzer', `AudioContext created, initial state: ${this.audioContext.state}`)\n\n\t\t// Always try to resume - some browsers need this regardless of reported state\n\t\ttry {\n\t\t\tawait this.audioContext.resume()\n\t\t\tdebugLog('AudioAnalyzer', `AudioContext after resume: ${this.audioContext.state}`)\n\t\t} catch (err) {\n\t\t\tconsole.warn('[AudioAnalyzer] Failed to resume AudioContext:', err)\n\t\t}\n\n\t\tthis.analyser = this.audioContext.createAnalyser()\n\t\tthis.analyser.fftSize = 256\n\t\tthis.analyser.smoothingTimeConstant = 0.8\n\n\t\tthis.source = this.audioContext.createMediaStreamSource(stream)\n\t\tthis.source.connect(this.analyser)\n\n\t\tconst bufferLength = this.analyser.frequencyBinCount\n\t\tthis.dataArray = new Uint8Array(new ArrayBuffer(bufferLength))\n\n\t\tdebugLog('AudioAnalyzer', 'Setup complete', {\n\t\t\tsampleRate: this.audioContext.sampleRate,\n\t\t\tfrequencyBinCount: bufferLength,\n\t\t\tcontextState: this.audioContext.state,\n\t\t})\n\t}\n\n\tgetAudioLevel(): number {\n\t\tif (!this.analyser || !this.dataArray) return 0\n\n\t\tthis.analyser.getByteFrequencyData(this.dataArray)\n\n\t\t// Calculate average volume\n\t\tlet sum = 0\n\t\tfor (let i = 0; i < this.dataArray.length; i++) {\n\t\t\tsum += this.dataArray[i]\n\t\t}\n\t\tconst average = sum / this.dataArray.length\n\n\t\t// Normalize to 0-1 range\n\t\treturn Math.min(1, average / 128)\n\t}\n\n\tgetFrequencyData(bins = 16): number[] {\n\t\tif (!this.analyser || !this.dataArray) return new Array(bins).fill(0)\n\n\t\tthis.analyser.getByteFrequencyData(this.dataArray)\n\n\t\tconst result: number[] = []\n\t\tconst samplesPerBin = Math.floor(this.dataArray.length / bins)\n\n\t\tfor (let i = 0; i < bins; i++) {\n\t\t\tlet sum = 0\n\t\t\tfor (let j = 0; j < samplesPerBin; j++) {\n\t\t\t\tsum += this.dataArray[i * samplesPerBin + j]\n\t\t\t}\n\t\t\t// Normalize to 0-1 range\n\t\t\tresult.push(Math.min(1, sum / samplesPerBin / 255))\n\t\t}\n\n\t\treturn result\n\t}\n\n\tstartAnalysis(callback: (level: number, frequencies: number[]) => void): void {\n\t\tconst analyze = () => {\n\t\t\tconst level = this.getAudioLevel()\n\t\t\tconst frequencies = this.getFrequencyData()\n\t\t\tcallback(level, frequencies)\n\t\t\tthis.animationId = requestAnimationFrame(analyze)\n\t\t}\n\t\tanalyze()\n\t}\n\n\tstopAnalysis(): void {\n\t\tif (this.animationId !== null) {\n\t\t\tcancelAnimationFrame(this.animationId)\n\t\t\tthis.animationId = null\n\t\t}\n\t}\n\n\tdestroy(): void {\n\t\tthis.stopAnalysis()\n\n\t\tif (this.source) {\n\t\t\tthis.source.disconnect()\n\t\t\tthis.source = null\n\t\t}\n\n\t\tif (this.analyser) {\n\t\t\tthis.analyser.disconnect()\n\t\t\tthis.analyser = null\n\t\t}\n\n\t\tif (this.audioContext) {\n\t\t\tvoid this.audioContext.close()\n\t\t\tthis.audioContext = null\n\t\t}\n\n\t\tthis.dataArray = null\n\t}\n}\n","import type { EventCallback, IEventEmitter } from './types'\n\nexport class EventEmitter implements IEventEmitter {\n\tprivate listeners = new Map<string, Set<EventCallback>>()\n\n\ton(event: string, callback: EventCallback): void {\n\t\tif (!this.listeners.has(event)) {\n\t\t\tthis.listeners.set(event, new Set())\n\t\t}\n\t\tconst listeners = this.listeners.get(event)\n\t\tif (listeners) {\n\t\t\tlisteners.add(callback)\n\t\t}\n\t}\n\n\toff(event: string, callback: EventCallback): void {\n\t\tthis.listeners.get(event)?.delete(callback)\n\t}\n\n\temit(event: string, data: unknown): void {\n\t\tthis.listeners.get(event)?.forEach((callback) => {\n\t\t\ttry {\n\t\t\t\tcallback(data)\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(`Error in event listener for ${event}:`, error)\n\t\t\t}\n\t\t})\n\t}\n\n\tremoveAllListeners(event?: string): void {\n\t\tif (event) {\n\t\t\tthis.listeners.delete(event)\n\t\t} else {\n\t\t\tthis.listeners.clear()\n\t\t}\n\t}\n\n\tlistenerCount(event: string): number {\n\t\treturn this.listeners.get(event)?.size || 0\n\t}\n}\n","import { RESPONSE_REQUEST_DELAY_MS } from '../../lib/constants'\n\nimport type { EventEmitter } from './event-emitter'\nimport type { ToolManager } from './tool-manager'\nimport type { FunctionCall, RealtimeMessage } from './types'\n\n/**\n * Type for response output items from OpenAI Realtime API\n */\ninterface ResponseOutputItem {\n\ttype: string\n\tstatus?: string\n\tname?: string\n\tcall_id?: string\n\targuments?: string\n}\n\n/**\n * Type guard to check if an output item is a completed function call\n */\nfunction isCompletedFunctionCall(item: ResponseOutputItem): item is ResponseOutputItem & {\n\tname: string\n\tcall_id: string\n\targuments: string\n} {\n\treturn (\n\t\titem.type === 'function_call' &&\n\t\titem.status === 'completed' &&\n\t\ttypeof item.name === 'string' &&\n\t\ttypeof item.call_id === 'string'\n\t)\n}\n\nexport class MessageHandler {\n\tprivate isProcessingResponse = false\n\tprivate pendingFunctionCalls = new Set<string>()\n\tprivate responseRequestTimer: ReturnType<typeof setTimeout> | null = null\n\tprivate hasRequestedResponse = false\n\n\tconstructor(\n\t\tprivate toolManager: ToolManager,\n\t\tprivate eventEmitter: EventEmitter\n\t) {}\n\n\tasync handleMessage(data: string, dataChannel: RTCDataChannel): Promise<void> {\n\t\tlet msg: RealtimeMessage\n\n\t\ttry {\n\t\t\tmsg = JSON.parse(data) as RealtimeMessage\n\t\t} catch (error) {\n\t\t\tconsole.error('Failed to parse realtime message:', error)\n\t\t\treturn\n\t\t}\n\n\t\t// Log all incoming events for debugging\n\t\t// Route message to appropriate handler\n\t\tswitch (msg.type) {\n\t\t\tcase 'response.created':\n\t\t\t\tthis.handleResponseCreated(msg)\n\t\t\t\tbreak\n\n\t\t\tcase 'response.done':\n\t\t\t\tawait this.handleResponseDone(msg, dataChannel)\n\t\t\t\tbreak\n\n\t\t\tcase 'response.function_call_arguments.done':\n\t\t\t\tthis.handleFunctionCallArguments()\n\t\t\t\tbreak\n\n\t\t\tcase 'input_audio_buffer.speech_started':\n\t\t\tcase 'input_audio_buffer.speech_stopped':\n\t\t\t\tthis.handleSpeechEvents(msg)\n\t\t\t\tbreak\n\n\t\t\t// GA API: response.output_audio events\n\t\t\tcase 'response.output_audio.delta':\n\t\t\tcase 'response.output_audio.done':\n\t\t\t\tthis.handleAudioEvents(msg)\n\t\t\t\tbreak\n\n\t\t\t// GA API: response.output_audio_transcript and response.output_text events\n\t\t\tcase 'response.output_audio_transcript.delta':\n\t\t\tcase 'response.output_audio_transcript.done':\n\t\t\tcase 'response.output_text.delta':\n\t\t\tcase 'response.output_text.done':\n\t\t\t\tthis.handleTranscriptEvents(msg)\n\t\t\t\tbreak\n\n\t\t\tcase 'conversation.item.input_audio_transcription.completed':\n\t\t\t\tthis.handleUserTranscript(msg)\n\t\t\t\tbreak\n\n\t\t\tcase 'error':\n\t\t\t\tthis.handleError(msg)\n\t\t\t\tbreak\n\n\t\t\tcase 'session.created':\n\t\t\tcase 'session.updated':\n\t\t\t\tthis.handleSessionEvents(msg)\n\t\t\t\tbreak\n\n\t\t\tcase 'conversation.item.created':\n\t\t\tcase 'input_audio_buffer.committed':\n\t\t\t\t// Log only, no action needed\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tprivate handleResponseCreated(_msg: RealtimeMessage): void {\n\t\tthis.isProcessingResponse = true\n\t\tthis.hasRequestedResponse = false\n\t}\n\n\tprivate async handleResponseDone(\n\t\tmsg: RealtimeMessage,\n\t\tdataChannel: RTCDataChannel\n\t): Promise<void> {\n\t\t// Safely extract response output with proper type checking\n\t\tconst outputItems = this.extractResponseOutput(msg.response)\n\n\t\t// Check if there are function calls to process\n\t\tconst hasFunctionCalls = outputItems.some(isCompletedFunctionCall)\n\n\t\t// Only set isProcessingResponse to false if there are no function calls\n\t\tif (!hasFunctionCalls) {\n\t\t\tthis.isProcessingResponse = false\n\t\t\tthis.hasRequestedResponse = false\n\t\t}\n\n\t\t// Process any function calls in the response\n\t\tif (outputItems.length > 0) {\n\t\t\t// Extract function calls with proper type narrowing\n\t\t\tconst functionCalls: FunctionCall[] = outputItems\n\t\t\t\t.filter(isCompletedFunctionCall)\n\t\t\t\t.map((item) => ({\n\t\t\t\t\tname: item.name,\n\t\t\t\t\tcall_id: item.call_id,\n\t\t\t\t\targuments: item.arguments ?? '',\n\t\t\t\t}))\n\n\t\t\tfor (const functionCall of functionCalls) {\n\t\t\t\tif (!this.pendingFunctionCalls.has(functionCall.call_id)) {\n\t\t\t\t\tthis.pendingFunctionCalls.add(functionCall.call_id)\n\t\t\t\t\tawait this.executeFunctionCall(functionCall, dataChannel)\n\t\t\t\t} else {\n\t\t\t\t\tconsole.warn(\n\t\t\t\t\t\t`[MessageHandler] Skipping duplicate function call: ${functionCall.name} (${functionCall.call_id})`\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// After all function calls are processed, check if we need to request a response\n\t\t\tif (functionCalls.length > 0 && this.pendingFunctionCalls.size === 0) {\n\t\t\t\tthis.requestResponseIfNeeded(dataChannel)\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Safely extract response output array from response object\n\t */\n\tprivate extractResponseOutput(response: unknown): ResponseOutputItem[] {\n\t\tif (!response || typeof response !== 'object') {\n\t\t\treturn []\n\t\t}\n\n\t\tconst r = response as Record<string, unknown>\n\t\tif (!Array.isArray(r.output)) {\n\t\t\treturn []\n\t\t}\n\n\t\t// Filter to only valid output items\n\t\treturn r.output.filter(\n\t\t\t(item): item is ResponseOutputItem =>\n\t\t\t\titem !== null &&\n\t\t\t\ttypeof item === 'object' &&\n\t\t\t\ttypeof (item as ResponseOutputItem).type === 'string'\n\t\t)\n\t}\n\n\tprivate handleFunctionCallArguments(): void {\n\t\t// Function call arguments are being accumulated\n\t\t// Actual execution happens in handleResponseDone\n\t}\n\n\tprivate handleSpeechEvents(msg: RealtimeMessage): void {\n\t\tconst eventType =\n\t\t\tmsg.type === 'input_audio_buffer.speech_started' ? 'speech_started' : 'speech_stopped'\n\t\tthis.eventEmitter.emit(eventType, msg)\n\t}\n\n\tprivate handleAudioEvents(msg: RealtimeMessage): void {\n\t\tconst eventType = msg.type === 'response.output_audio.delta' ? 'audio_started' : 'audio_stopped'\n\t\tconsole.log(`[MessageHandler] Assistant ${eventType}`, {\n\t\t\ttype: msg.type,\n\t\t\thasAudio: !!(msg as { delta?: unknown }).delta,\n\t\t})\n\t\tthis.eventEmitter.emit(eventType, msg)\n\t}\n\n\tprivate handleTranscriptEvents(msg: RealtimeMessage): void {\n\t\t// GA API event name mappings\n\t\tconst eventMap: Record<string, string> = {\n\t\t\t'response.output_audio_transcript.delta': 'assistant_transcript',\n\t\t\t'response.output_audio_transcript.done': 'assistant_transcript_done',\n\t\t\t'response.output_text.delta': 'text',\n\t\t\t'response.output_text.done': 'text_done',\n\t\t}\n\n\t\tconst eventType = eventMap[msg.type]\n\t\tif (eventType) {\n\t\t\tthis.eventEmitter.emit(eventType, msg)\n\t\t}\n\t}\n\n\tprivate handleUserTranscript(msg: RealtimeMessage): void {\n\t\tthis.eventEmitter.emit('user_transcript_done', { text: msg.transcript })\n\t}\n\n\tprivate handleSessionEvents(_msg: RealtimeMessage): void {\n\t\t// Session events are handled but no action is needed at this time\n\t}\n\n\tprivate handleError(msg: RealtimeMessage): void {\n\t\tconsole.error('Realtime API error:', msg)\n\t\tthis.eventEmitter.emit('error', msg)\n\t\tthis.isProcessingResponse = false\n\t\tthis.hasRequestedResponse = false\n\n\t\t// Clear any pending response timer\n\t\tif (this.responseRequestTimer) {\n\t\t\tclearTimeout(this.responseRequestTimer)\n\t\t\tthis.responseRequestTimer = null\n\t\t}\n\t}\n\n\tprivate async executeFunctionCall(\n\t\tfunctionCall: FunctionCall,\n\t\tdataChannel: RTCDataChannel\n\t): Promise<void> {\n\t\tconst { name, call_id } = functionCall\n\n\t\ttry {\n\t\t\t// Emit start event\n\t\t\tthis.eventEmitter.emit('tool_call_started', { name })\n\n\t\t\t// Execute tool\n\t\t\tconst result = await this.toolManager.executeToolCall(functionCall)\n\n\t\t\t// Check if data channel is still open before sending\n\t\t\tif (dataChannel.readyState !== 'open') {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`[MessageHandler] Cannot send tool result for ${name}: DataChannel is ${dataChannel.readyState}`\n\t\t\t\t)\n\t\t\t\tthis.eventEmitter.emit('tool_call_completed', {\n\t\t\t\t\tname,\n\t\t\t\t\terror: 'DataChannel closed during tool execution',\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Send result back\n\t\t\tconst response = {\n\t\t\t\ttype: 'conversation.item.create',\n\t\t\t\titem: {\n\t\t\t\t\ttype: 'function_call_output',\n\t\t\t\t\tcall_id: call_id,\n\t\t\t\t\toutput: JSON.stringify(\n\t\t\t\t\t\tresult.success\n\t\t\t\t\t\t\t? result.data\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\terror: result.error,\n\t\t\t\t\t\t\t\t\tsuccess: false,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tdataChannel.send(JSON.stringify(response))\n\n\t\t\t// Emit completion event\n\t\t\tthis.eventEmitter.emit('tool_call_completed', {\n\t\t\t\tname,\n\t\t\t\terror: result.success ? undefined : result.error,\n\t\t\t})\n\t\t} catch (error) {\n\t\t\tconsole.error(`[MessageHandler] Tool execution failed for ${name}:`, error)\n\t\t\tthis.sendToolError(call_id, String(error), dataChannel)\n\t\t} finally {\n\t\t\tthis.pendingFunctionCalls.delete(call_id)\n\n\t\t\t// After removing this function call, check if all are complete\n\t\t\tif (this.pendingFunctionCalls.size === 0) {\n\t\t\t\t// All function calls are done, now we can request a response\n\t\t\t\tthis.isProcessingResponse = false\n\t\t\t\tthis.hasRequestedResponse = false\n\t\t\t\tthis.requestResponseIfNeeded(dataChannel)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate sendToolError(call_id: string, error: string, dataChannel: RTCDataChannel): void {\n\t\t// Check if data channel is still open before sending error\n\t\tif (dataChannel.readyState !== 'open') {\n\t\t\tconsole.error(\n\t\t\t\t`[MessageHandler] Cannot send tool error: DataChannel is ${dataChannel.readyState}`\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\tconst errorResponse = {\n\t\t\ttype: 'conversation.item.create',\n\t\t\titem: {\n\t\t\t\ttype: 'function_call_output',\n\t\t\t\tcall_id: call_id,\n\t\t\t\toutput: JSON.stringify({ error, success: false }),\n\t\t\t},\n\t\t}\n\n\t\tdataChannel.send(JSON.stringify(errorResponse))\n\t}\n\n\tprivate requestResponseIfNeeded(dataChannel: RTCDataChannel): void {\n\t\t// Clear any existing timer\n\t\tif (this.responseRequestTimer) {\n\t\t\tclearTimeout(this.responseRequestTimer)\n\t\t\tthis.responseRequestTimer = null\n\t\t}\n\n\t\t// Set a new timer to request response (delay prevents race conditions)\n\t\tthis.responseRequestTimer = setTimeout(() => {\n\t\t\tif (\n\t\t\t\t!this.isProcessingResponse &&\n\t\t\t\t!this.hasRequestedResponse &&\n\t\t\t\tdataChannel.readyState === 'open' &&\n\t\t\t\tthis.pendingFunctionCalls.size === 0\n\t\t\t) {\n\t\t\t\tthis.hasRequestedResponse = true\n\t\t\t\tthis.isProcessingResponse = true\n\t\t\t\tdataChannel.send(JSON.stringify({ type: 'response.create' }))\n\t\t\t}\n\t\t\tthis.responseRequestTimer = null\n\t\t}, RESPONSE_REQUEST_DELAY_MS)\n\t}\n\n\treset(): void {\n\t\tthis.isProcessingResponse = false\n\t\tthis.hasRequestedResponse = false\n\t\tthis.pendingFunctionCalls.clear()\n\n\t\t// Clear any pending response timer\n\t\tif (this.responseRequestTimer) {\n\t\t\tclearTimeout(this.responseRequestTimer)\n\t\t\tthis.responseRequestTimer = null\n\t\t}\n\t}\n}\n","import type { FunctionCall, OpenAITool, ToolExecutionResult } from './types'\n\nexport interface RegisteredTool {\n\tname: string\n\tdescription: string\n\tinputSchema?: Record<string, unknown>\n}\n\nexport type ToolExecutor = (name: string, args: Record<string, unknown>) => Promise<unknown>\n\nexport class ToolManager {\n\tprivate tools: RegisteredTool[] = []\n\tprivate executor: ToolExecutor | null = null\n\tprivate lastSentToolSignature = ''\n\n\tsetTools(tools: RegisteredTool[]): void {\n\t\tthis.tools = tools\n\t}\n\n\tsetExecutor(executor: ToolExecutor): void {\n\t\tthis.executor = executor\n\t}\n\n\tresetSession(): void {\n\t\tconsole.log('[ToolManager] resetSession called (lastSentToolSignature preserved)')\n\t}\n\n\tprivate getToolSignature(tools: RegisteredTool[]): string {\n\t\treturn tools\n\t\t\t.map((t) => t.name)\n\t\t\t.sort()\n\t\t\t.join('|')\n\t}\n\n\thasToolsChanged(): boolean {\n\t\tconst currentSignature = this.getToolSignature(this.tools)\n\t\treturn currentSignature !== this.lastSentToolSignature\n\t}\n\n\tmarkToolsSent(): void {\n\t\tthis.lastSentToolSignature = this.getToolSignature(this.tools)\n\t}\n\n\tformatToolsForOpenAI(): OpenAITool[] {\n\t\t// Built-in tools\n\t\tconst builtInTools: OpenAITool[] = [\n\t\t\t{\n\t\t\t\ttype: 'function',\n\t\t\t\tname: 'list_available_tools',\n\t\t\t\tdescription:\n\t\t\t\t\t'List all currently available tools that can be called. Use this when you need to know what tools are available or when the user asks about available capabilities.',\n\t\t\t\tparameters: {\n\t\t\t\t\ttype: 'object',\n\t\t\t\t\tproperties: {},\n\t\t\t\t\trequired: [],\n\t\t\t\t},\n\t\t\t},\n\t\t]\n\n\t\t// Registered tools\n\t\tconst registeredTools = this.tools.map((tool) => ({\n\t\t\ttype: 'function' as const,\n\t\t\tname: tool.name,\n\t\t\tdescription: tool.description || `Execute ${tool.name} action`,\n\t\t\tparameters: this.validateToolSchema(tool.inputSchema),\n\t\t}))\n\n\t\treturn [...builtInTools, ...registeredTools]\n\t}\n\n\tprivate validateToolSchema(schema: Record<string, unknown> | undefined): {\n\t\ttype: string\n\t\tproperties?: Record<string, unknown>\n\t\trequired?: string[]\n\t} {\n\t\tif (!schema) {\n\t\t\treturn { type: 'object', properties: {}, required: [] }\n\t\t}\n\n\t\tconst result: {\n\t\t\ttype: string\n\t\t\tproperties?: Record<string, unknown>\n\t\t\trequired?: string[]\n\t\t} = { type: 'object', ...schema }\n\n\t\tif (result.type === 'object') {\n\t\t\tresult.properties = (result.properties as Record<string, unknown>) || {}\n\n\t\t\t// Generate required array if not present\n\t\t\tif (!result.required && result.properties) {\n\t\t\t\tresult.required = Object.entries(result.properties)\n\t\t\t\t\t.filter(([, prop]) => {\n\t\t\t\t\t\tif (prop && typeof prop === 'object') {\n\t\t\t\t\t\t\tconst p = prop as { optional?: boolean; nullable?: boolean; type?: string }\n\t\t\t\t\t\t\treturn !p.optional && !p.nullable && p.type !== 'null'\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn false\n\t\t\t\t\t})\n\t\t\t\t\t.map(([key]) => key)\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n\n\tasync executeToolCall(functionCall: FunctionCall): Promise<ToolExecutionResult> {\n\t\tconst { name, arguments: argsString } = functionCall\n\n\t\t// Handle built-in tools\n\t\tif (name === 'list_available_tools') {\n\t\t\treturn this.executeListTools()\n\t\t}\n\n\t\t// Check if executor is set\n\t\tif (!this.executor) {\n\t\t\treturn { success: false, error: 'Tool executor not configured' }\n\t\t}\n\n\t\t// Find the tool\n\t\tconst tool = this.tools.find((t) => t.name === name)\n\t\tif (!tool) {\n\t\t\tconsole.error(`[ToolManager] Tool not found: ${name}`)\n\t\t\treturn { success: false, error: `Tool not found: ${name}` }\n\t\t}\n\n\t\t// Parse arguments\n\t\tlet args: Record<string, unknown>\n\t\ttry {\n\t\t\targs = argsString ? (JSON.parse(argsString) as Record<string, unknown>) : {}\n\t\t} catch (error) {\n\t\t\tconsole.error('[ToolManager] Failed to parse arguments:', error)\n\t\t\treturn { success: false, error: 'Invalid arguments format' }\n\t\t}\n\n\t\ttry {\n\t\t\tconst result = await this.executor(name, args)\n\t\t\treturn { success: true, data: result }\n\t\t} catch (error) {\n\t\t\tconsole.error(`[ToolManager] Tool execution error for ${name}:`, error)\n\t\t\treturn { success: false, error: String(error) }\n\t\t}\n\t}\n\n\tprivate executeListTools(): ToolExecutionResult {\n\t\tconst toolList = this.tools.map((tool) => ({\n\t\t\tname: tool.name,\n\t\t\tdescription: tool.description || 'No description available',\n\t\t\tparameters: tool.inputSchema || {},\n\t\t}))\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\ttools: toolList,\n\t\t\t\tcount: toolList.length,\n\t\t\t\tmessage:\n\t\t\t\t\ttoolList.length > 0\n\t\t\t\t\t\t? `Found ${toolList.length} available tools`\n\t\t\t\t\t\t: 'No tools currently available',\n\t\t\t},\n\t\t}\n\t}\n\n\tgetChangesSummary(): { added: string[]; removed: string[]; total: number } | null {\n\t\tif (!this.hasToolsChanged()) {\n\t\t\treturn null\n\t\t}\n\n\t\tconst prevTools = this.lastSentToolSignature.split('|').filter(Boolean)\n\t\tconst currTools = this.tools.map((t) => t.name)\n\n\t\tconst prevSet = new Set(prevTools)\n\t\tconst currSet = new Set(currTools)\n\n\t\tconst added = currTools.filter((name) => !prevSet.has(name))\n\t\tconst removed = prevTools.filter((name) => !currSet.has(name))\n\n\t\treturn {\n\t\t\tadded,\n\t\t\tremoved,\n\t\t\ttotal: this.tools.length,\n\t\t}\n\t}\n}\n","import {\n\tdebugLog,\n\tREALTIME_DEFAULT_API_URL,\n\tREALTIME_DEFAULT_MODEL,\n\tREALTIME_DEFAULT_VOICE,\n} from '../../lib/constants'\n\nimport type { RealtimeConfig, RealtimeSession } from './types'\n\ninterface EphemeralTokenResponse {\n\tclient_secret?: {\n\t\tvalue?: string\n\t}\n}\n\nfunction hasClientSecret(response: unknown): response is {\n\tclient_secret: { value: string }\n} {\n\tif (!response || typeof response !== 'object') {\n\t\treturn false\n\t}\n\tconst secret = (response as EphemeralTokenResponse).client_secret\n\treturn typeof secret?.value === 'string'\n}\n\nexport class WebRTCManager {\n\tprivate tokenEndpoint: string\n\n\tconstructor(tokenEndpoint: string) {\n\t\tthis.tokenEndpoint = tokenEndpoint\n\t}\n\n\tasync createSession(config: RealtimeConfig = {}): Promise<RealtimeSession> {\n\t\tconst model = config.model || REALTIME_DEFAULT_MODEL\n\t\tconst voice = config.voice || REALTIME_DEFAULT_VOICE\n\t\tconst apiUrl = config.apiUrl || REALTIME_DEFAULT_API_URL\n\n\t\t// Get ephemeral token from our backend\n\t\tconst ephemeralKey = await this.getEphemeralToken(model, voice)\n\n\t\t// Create peer connection\n\t\tconst pc = new RTCPeerConnection()\n\n\t\t// Set up audio playback\n\t\tconst audioElement = this.createAudioElement()\n\t\t// Track streams\n\t\tlet remoteStream: MediaStream | null = null\n\t\tpc.ontrack = (e) => {\n\t\t\tremoteStream = e.streams[0]\n\t\t\taudioElement.srcObject = remoteStream\n\t\t\tdebugLog('WebRTC', 'Remote audio stream received and connected to audio element', {\n\t\t\t\tstreamId: remoteStream.id,\n\t\t\t\ttracks: remoteStream.getTracks().length,\n\t\t\t})\n\t\t}\n\n\t\t// Add microphone\n\t\tconst localStream = await this.getUserMedia()\n\t\tdebugLog('WebRTC', 'Local microphone stream acquired', {\n\t\t\tstreamId: localStream.id,\n\t\t\ttracks: localStream.getTracks().map((t) => ({\n\t\t\t\tkind: t.kind,\n\t\t\t\tenabled: t.enabled,\n\t\t\t\tmuted: t.muted,\n\t\t\t\treadyState: t.readyState,\n\t\t\t})),\n\t\t})\n\n\t\tlocalStream.getTracks().forEach((track) => {\n\t\t\tpc.addTrack(track, localStream)\n\t\t})\n\n\t\t// Create data channel for events\n\t\tconst dataChannel = pc.createDataChannel('oai-events')\n\n\t\t// Create offer and establish connection\n\t\tconst offer = await pc.createOffer()\n\t\tawait pc.setLocalDescription(offer)\n\n\t\t// Connect to OpenAI\n\t\tif (!offer.sdp) {\n\t\t\tthrow new Error('Failed to create offer SDP')\n\t\t}\n\t\tconst answer = await this.connectToOpenAI(apiUrl, model, offer.sdp, ephemeralKey)\n\t\tawait pc.setRemoteDescription(answer)\n\n\t\t// Create cleanup function\n\t\tconst cleanup = () => {\n\t\t\tlocalStream.getTracks().forEach((track) => {\n\t\t\t\ttrack.stop()\n\t\t\t})\n\t\t\taudioElement.remove()\n\t\t\tdataChannel.close()\n\t\t\tpc.close()\n\t\t}\n\n\t\treturn {\n\t\t\tpc,\n\t\t\tdataChannel,\n\t\t\taudioElement,\n\t\t\tlocalStream,\n\t\t\tremoteStream,\n\t\t\tcleanup,\n\t\t}\n\t}\n\n\tprivate async getEphemeralToken(model: string, voice: string): Promise<string> {\n\t\tconst response = await fetch(this.tokenEndpoint, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: {\n\t\t\t\t'Content-Type': 'application/json',\n\t\t\t},\n\t\t\tbody: JSON.stringify({ model, voice }),\n\t\t})\n\n\t\tif (!response.ok) {\n\t\t\tconst errorText = await response.text()\n\t\t\tconsole.error('Failed to get ephemeral token:', errorText)\n\t\t\tthrow new Error(`Failed to get ephemeral token: ${response.statusText}`)\n\t\t}\n\n\t\tconst data: unknown = await response.json()\n\n\t\tif (!hasClientSecret(data)) {\n\t\t\tthrow new Error('Invalid token response format')\n\t\t}\n\n\t\treturn data.client_secret.value\n\t}\n\n\tprivate createAudioElement(): HTMLAudioElement {\n\t\tconst audioElement = document.createElement('audio')\n\t\taudioElement.autoplay = true\n\t\taudioElement.style.display = 'none'\n\t\tdocument.body.appendChild(audioElement)\n\t\treturn audioElement\n\t}\n\n\tprivate async getUserMedia(): Promise<MediaStream> {\n\t\ttry {\n\t\t\treturn await navigator.mediaDevices.getUserMedia({\n\t\t\t\taudio: {\n\t\t\t\t\techoCancellation: true,\n\t\t\t\t\tnoiseSuppression: true,\n\t\t\t\t\tautoGainControl: true,\n\t\t\t\t},\n\t\t\t})\n\t\t} catch (error) {\n\t\t\tthrow new Error(`Failed to access microphone: ${error}`)\n\t\t}\n\t}\n\n\tprivate async connectToOpenAI(\n\t\tbaseUrl: string,\n\t\tmodel: string,\n\t\tsdp: string,\n\t\tephemeralKey: string\n\t): Promise<RTCSessionDescriptionInit> {\n\t\tconst response = await fetch(`${baseUrl}?model=${model}`, {\n\t\t\tmethod: 'POST',\n\t\t\tbody: sdp,\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${ephemeralKey}`,\n\t\t\t\t'Content-Type': 'application/sdp',\n\t\t\t},\n\t\t})\n\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(`Failed to establish WebRTC connection: ${response.statusText}`)\n\t\t}\n\n\t\tconst answerSdp = await response.text()\n\t\treturn {\n\t\t\ttype: 'answer' as const,\n\t\t\tsdp: answerSdp,\n\t\t}\n\t}\n}\n","import {\n\tAUDIO_FREQUENCY_BINS,\n\tAUDIO_VISUALIZATION_INTERVAL_MS,\n\tdebugLog,\n} from '../../lib/constants'\nimport { AudioAnalyzer } from './audio-analyzer'\nimport { EventEmitter } from './event-emitter'\nimport { MessageHandler } from './message-handler'\nimport { ToolManager } from './tool-manager'\nimport { WebRTCManager } from './webrtc-manager'\n\nimport type { RegisteredTool, ToolExecutor } from './tool-manager'\nimport type { EventCallback, RealtimeConfig, RealtimeSession, SessionConfig } from './types'\n\n/** Pre-allocated zero frequency array for performance */\nconst EMPTY_FREQUENCY_TEMPLATE = Object.freeze(new Array(AUDIO_FREQUENCY_BINS).fill(0))\nconst createZeroFrequencyArray = (): number[] => [...EMPTY_FREQUENCY_TEMPLATE]\n\n/**\n * OpenAI Realtime API Service\n *\n * Manages voice conversations with OpenAI's Realtime API,\n * including WebRTC connections, tool integration, and message handling.\n */\nexport class OpenAIRealtimeService {\n\tprivate session: RealtimeSession | null = null\n\tprivate webrtcManager: WebRTCManager\n\tprivate toolManager: ToolManager\n\tprivate messageHandler: MessageHandler\n\tprivate eventEmitter: EventEmitter\n\tprivate muted = false\n\tprivate lastState: 'disconnected' | 'connecting' | 'connected' | 'error' = 'disconnected'\n\tprivate localAnalyzer: AudioAnalyzer | null = null\n\tprivate remoteAnalyzer: AudioAnalyzer | null = null\n\tprivate visualizationInterval: ReturnType<typeof setInterval> | null = null\n\tprivate sessionStartTime: number | null = null\n\tprivate onToolsChangedCallback: (() => void) | null = null\n\n\tconstructor(tokenEndpoint: string) {\n\t\tthis.webrtcManager = new WebRTCManager(tokenEndpoint)\n\t\tthis.toolManager = new ToolManager()\n\t\tthis.eventEmitter = new EventEmitter()\n\t\tthis.messageHandler = new MessageHandler(this.toolManager, this.eventEmitter)\n\t}\n\n\t/**\n\t * Set the tools available for the voice session\n\t */\n\tsetTools(tools: RegisteredTool[]): void {\n\t\tthis.toolManager.setTools(tools)\n\t\tif (this.isSessionActive()) {\n\t\t\tthis.updateSessionTools()\n\t\t}\n\t}\n\n\t/**\n\t * Set the tool executor function\n\t */\n\tsetToolExecutor(executor: ToolExecutor): void {\n\t\tthis.toolManager.setExecutor(executor)\n\t}\n\n\t/**\n\t * Register callback for when tools change\n\t */\n\tonToolsChanged(callback: () => void): void {\n\t\tthis.onToolsChangedCallback = callback\n\t}\n\n\t/**\n\t * Start a new realtime session\n\t */\n\tasync startSession(config: RealtimeConfig = {}): Promise<RealtimeSession> {\n\t\ttry {\n\t\t\t// Clean up existing session\n\t\t\tif (this.session) {\n\t\t\t\tthis.stopSession()\n\t\t\t}\n\n\t\t\tthis.muted = false\n\t\t\tthis.sessionStartTime = Date.now()\n\t\t\tthis.emitSessionState('connecting')\n\n\t\t\t// Create new WebRTC session\n\t\t\tthis.session = await this.webrtcManager.createSession(config)\n\n\t\t\t// Setup data channel handlers\n\t\t\tthis.setupDataChannel(this.session.dataChannel)\n\n\t\t\t// Monitor peer connection state\n\t\t\tthis.setupPeerConnectionMonitoring(this.session.pc)\n\n\t\t\tif (this.session.localStream) {\n\t\t\t\tawait this.initializeLocalAnalyzer(this.session.localStream)\n\t\t\t}\n\n\t\t\tif (this.session.remoteStream) {\n\t\t\t\tvoid this.initializeRemoteAnalyzer(this.session.remoteStream)\n\t\t\t}\n\n\t\t\t// Update session reference for remote stream\n\t\t\tconst originalOntrack = this.session.pc.ontrack\n\t\t\tconst session = this.session\n\t\t\tthis.session.pc.ontrack = (e) => {\n\t\t\t\tif (originalOntrack) originalOntrack.call(session.pc, e)\n\t\t\t\tif (this.session) {\n\t\t\t\t\tthis.session.remoteStream = e.streams[0]\n\t\t\t\t}\n\n\t\t\t\tconst remoteStream = e.streams[0]\n\t\t\t\tif (!remoteStream) {\n\t\t\t\t\tconsole.warn('[OpenAIRealtimeService] Received ontrack event without stream')\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tvoid this.initializeRemoteAnalyzer(remoteStream)\n\t\t\t}\n\n\t\t\treturn this.session\n\t\t} catch (error) {\n\t\t\tthis.handleSessionError(error)\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t/**\n\t * Stop the current session\n\t */\n\tstopSession(): void {\n\t\t// Calculate session duration for usage tracking\n\t\tlet durationSeconds = 0\n\t\tif (this.sessionStartTime) {\n\t\t\tdurationSeconds = Math.floor((Date.now() - this.sessionStartTime) / 1000)\n\t\t}\n\n\t\tif (this.visualizationInterval) {\n\t\t\tclearInterval(this.visualizationInterval)\n\t\t\tthis.visualizationInterval = null\n\t\t}\n\n\t\tif (this.localAnalyzer) {\n\t\t\tthis.localAnalyzer.destroy()\n\t\t\tthis.localAnalyzer = null\n\t\t}\n\n\t\tif (this.remoteAnalyzer) {\n\t\t\tthis.remoteAnalyzer.destroy()\n\t\t\tthis.remoteAnalyzer = null\n\t\t}\n\t\tif (this.session) {\n\t\t\tthis.session.cleanup()\n\t\t\tthis.session = null\n\t\t}\n\t\tthis.messageHandler.reset()\n\t\tthis.toolManager.resetSession()\n\n\t\t// Emit disconnected state with session duration\n\t\tthis.muted = false\n\t\tthis.emitSessionState('disconnected', { durationSeconds })\n\n\t\t// Reset session start time\n\t\tthis.sessionStartTime = null\n\t}\n\n\t/**\n\t * Send a text message to the assistant\n\t */\n\tsendUserMessage(text: string): void {\n\t\tif (!this.isSessionActive()) {\n\t\t\tthrow new Error('No active session')\n\t\t}\n\n\t\tconst message = {\n\t\t\ttype: 'conversation.item.create',\n\t\t\titem: {\n\t\t\t\ttype: 'message',\n\t\t\t\trole: 'user',\n\t\t\t\tcontent: [{ type: 'input_text', text }],\n\t\t\t},\n\t\t}\n\n\t\tif (!this.session) {\n\t\t\tthrow new Error('Session is not active')\n\t\t}\n\t\tthis.session.dataChannel.send(JSON.stringify(message))\n\t\tthis.session.dataChannel.send(JSON.stringify({ type: 'response.create' }))\n\t}\n\n\t/**\n\t * Check if session is active\n\t */\n\tisSessionActive(): boolean {\n\t\treturn this.session !== null && this.session.dataChannel.readyState === 'open'\n\t}\n\n\t/**\n\t * Get the local audio stream\n\t */\n\tgetLocalStream(): MediaStream | null {\n\t\treturn this.session?.localStream || null\n\t}\n\n\t/**\n\t * Get the remote audio stream\n\t */\n\tgetRemoteStream(): MediaStream | null {\n\t\treturn this.session?.remoteStream || null\n\t}\n\n\t/**\n\t * Toggle audio mute\n\t */\n\ttoggleMute(muted: boolean): void {\n\t\tif (this.session?.audioElement) {\n\t\t\tthis.session.audioElement.muted = muted\n\t\t}\n\t\tthis.muted = muted\n\t\tthis.emitSessionState(this.lastState, { isMuted: this.muted })\n\t}\n\n\t/**\n\t * Event handling\n\t */\n\ton(event: string, callback: EventCallback): void {\n\t\tthis.eventEmitter.on(event, callback)\n\t}\n\n\toff(event: string, callback: EventCallback): void {\n\t\tthis.eventEmitter.off(event, callback)\n\t}\n\n\tgetSessionStatus(): {\n\t\tstate: 'connecting' | 'connected' | 'disconnected' | 'error'\n\t\tisActive: boolean\n\t\tisMuted: boolean\n\t} {\n\t\treturn {\n\t\t\tstate: this.lastState,\n\t\t\tisActive: this.lastState === 'connected',\n\t\t\tisMuted: this.muted,\n\t\t}\n\t}\n\n\t/**\n\t * Private methods\n\t */\n\tprivate setupDataChannel(dataChannel: RTCDataChannel): void {\n\t\t// Configure session when channel opens\n\t\tdataChannel.addEventListener('open', () => {\n\t\t\tthis.configureSession(dataChannel)\n\t\t\tthis.muted = false\n\t\t\tthis.emitSessionState('connected')\n\t\t})\n\n\t\t// Handle incoming messages\n\t\tdataChannel.addEventListener('message', (event: MessageEvent<string>) => {\n\t\t\tvoid (async () => {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.messageHandler.handleMessage(event.data, dataChannel)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconsole.error('Error handling message:', error)\n\t\t\t\t}\n\t\t\t})()\n\t\t})\n\n\t\t// Handle errors\n\t\tdataChannel.addEventListener('error', (error) => {\n\t\t\tconsole.error('DataChannel error:', error)\n\t\t\tthis.eventEmitter.emit('error', { type: 'datachannel_error', error })\n\t\t})\n\n\t\t// Handle close\n\t\tdataChannel.addEventListener('close', () => {\n\t\t\tthis.messageHandler.reset()\n\t\t\tthis.eventEmitter.emit('session_closed', {})\n\t\t})\n\t}\n\n\tprivate setupPeerConnectionMonitoring(pc: RTCPeerConnection): void {\n\t\t// Monitor connection state changes\n\t\tpc.addEventListener('connectionstatechange', () => {\n\t\t\tif (pc.connectionState === 'failed' || pc.connectionState === 'disconnected') {\n\t\t\t\tconsole.error('Peer connection failed or disconnected')\n\t\t\t\tthis.messageHandler.reset()\n\t\t\t\tthis.eventEmitter.emit('error', {\n\t\t\t\t\ttype: 'connection_error',\n\t\t\t\t\tmessage: `Connection ${pc.connectionState}`,\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\n\t\t// Monitor ICE connection state\n\t\tpc.addEventListener('iceconnectionstatechange', () => {\n\t\t\tif (pc.iceConnectionState === 'failed' || pc.iceConnectionState === 'disconnected') {\n\t\t\t\tconsole.error('ICE connection failed or disconnected')\n\t\t\t}\n\t\t})\n\n\t\t// Monitor signaling state\n\t\tpc.addEventListener('signalingstatechange', () => {})\n\t}\n\n\tprivate configureSession(dataChannel: RTCDataChannel): void {\n\t\t// Reset per-session state\n\t\tthis.toolManager.resetSession()\n\n\t\t// Get initial tools\n\t\tconst tools = this.toolManager.formatToolsForOpenAI()\n\t\t// Mark tools as sent\n\t\tthis.toolManager.markToolsSent()\n\n\t\tconst sessionConfig: SessionConfig = {\n\t\t\tmodalities: ['text', 'audio'],\n\t\t\tinstructions: this.getSessionInstructions(),\n\t\t\tvoice: 'verse',\n\t\t\ttools: tools,\n\t\t\ttool_choice: 'auto',\n\t\t\tturn_detection: {\n\t\t\t\ttype: 'server_vad',\n\t\t\t\tthreshold: 0.5,\n\t\t\t\tprefix_padding_ms: 300,\n\t\t\t\tsilence_duration_ms: 500,\n\t\t\t},\n\t\t\tinput_audio_transcription: {\n\t\t\t\tmodel: 'whisper-1',\n\t\t\t},\n\t\t}\n\n\t\tconst sessionUpdate = {\n\t\t\ttype: 'session.update',\n\t\t\tsession: sessionConfig,\n\t\t}\n\n\t\tdataChannel.send(JSON.stringify(sessionUpdate))\n\t}\n\n\tprivate updateSessionTools(): void {\n\t\tif (!this.session) {\n\t\t\tconsole.warn('[OpenAIRealtimeService] Cannot update tools: no active session')\n\t\t\treturn\n\t\t}\n\n\t\tif (this.session.dataChannel.readyState !== 'open') {\n\t\t\tconsole.warn(\n\t\t\t\t`[OpenAIRealtimeService] Cannot update tools: DataChannel is ${this.session.dataChannel.readyState}`\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\t// Check if tools have actually changed\n\t\tconst changesSummary = this.toolManager.getChangesSummary()\n\t\tif (!changesSummary) {\n\t\t\treturn\n\t\t}\n\n\t\t// Get the full tool list\n\t\tconst tools = this.toolManager.formatToolsForOpenAI()\n\n\t\tconsole.log(\n\t\t\t'[OpenAIRealtimeService] Sending tool update to OpenAI:',\n\t\t\t`${changesSummary.total} total tools,`,\n\t\t\tchangesSummary.added.length > 0\n\t\t\t\t? `+${changesSummary.added.length} added (${changesSummary.added.slice(0, 3).join(', ')}${changesSummary.added.length > 3 ? '...' : ''})`\n\t\t\t\t: '',\n\t\t\tchangesSummary.removed.length > 0 ? `-${changesSummary.removed.length} removed` : ''\n\t\t)\n\n\t\t// Mark tools as sent\n\t\tthis.toolManager.markToolsSent()\n\n\t\tconst sessionUpdate = {\n\t\t\ttype: 'session.update',\n\t\t\tsession: {\n\t\t\t\ttools: tools,\n\t\t\t\ttool_choice: 'auto',\n\t\t\t},\n\t\t}\n\n\t\tthis.session.dataChannel.send(JSON.stringify(sessionUpdate))\n\t}\n\n\tprivate getSessionInstructions(): string {\n\t\treturn `You are a helpful assistant with access to tools.\n Use the available tools to help users with their tasks.\n You can use the list_available_tools function to see what tools are currently available.\n Be concise and helpful in your responses.`\n\t}\n\n\tprivate handleSessionError(error: unknown): void {\n\t\tconsole.error('Session error:', error)\n\t\tthis.emitSessionState('error', {\n\t\t\ttype: 'session_error',\n\t\t\terror: String(error),\n\t\t})\n\t\tthis.stopSession()\n\t}\n\n\tprivate async initializeLocalAnalyzer(stream: MediaStream): Promise<void> {\n\t\tif (this.localAnalyzer) {\n\t\t\tthis.localAnalyzer.destroy()\n\t\t}\n\n\t\tthis.localAnalyzer = new AudioAnalyzer()\n\t\ttry {\n\t\t\t// Clone the stream to avoid conflicts with WebRTC which consumes the original\n\t\t\tconst clonedStream = new MediaStream(stream.getAudioTracks().map((t) => t.clone()))\n\t\t\tawait this.localAnalyzer.initialize(clonedStream)\n\t\t\tthis.startAudioVisualization()\n\t\t} catch (error) {\n\t\t\tconsole.error('[OpenAIRealtimeService] Failed to initialize local audio analyzer', error)\n\t\t\tif (this.localAnalyzer) {\n\t\t\t\tthis.localAnalyzer.destroy()\n\t\t\t\tthis.localAnalyzer = null\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate async initializeRemoteAnalyzer(stream: MediaStream): Promise<void> {\n\t\tif (this.remoteAnalyzer) {\n\t\t\tthis.remoteAnalyzer.destroy()\n\t\t}\n\n\t\tthis.remoteAnalyzer = new AudioAnalyzer()\n\t\ttry {\n\t\t\t// Clone the stream to avoid conflicts with WebRTC\n\t\t\tconst clonedStream = new MediaStream(stream.getAudioTracks().map((t) => t.clone()))\n\t\t\tawait this.remoteAnalyzer.initialize(clonedStream)\n\t\t\tthis.startAudioVisualization()\n\t\t} catch (error) {\n\t\t\tconsole.error('[OpenAIRealtimeService] Failed to initialize remote audio analyzer', error)\n\t\t\tif (this.remoteAnalyzer) {\n\t\t\t\tthis.remoteAnalyzer.destroy()\n\t\t\t\tthis.remoteAnalyzer = null\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate startAudioVisualization(): void {\n\t\tif (!this.localAnalyzer && !this.remoteAnalyzer) {\n\t\t\tdebugLog('OpenAIRealtimeService', 'Audio visualization not started: no analyzers ready')\n\t\t\treturn\n\t\t}\n\n\t\tif (this.visualizationInterval) {\n\t\t\tclearInterval(this.visualizationInterval)\n\t\t}\n\n\t\tlet logCounter = 0\n\t\tthis.visualizationInterval = setInterval(() => {\n\t\t\tconst micLevel = this.localAnalyzer?.getAudioLevel() ?? 0\n\t\t\tconst micFrequency =\n\t\t\t\tthis.localAnalyzer?.getFrequencyData(AUDIO_FREQUENCY_BINS) ?? createZeroFrequencyArray()\n\t\t\tconst speakerLevel = this.remoteAnalyzer?.getAudioLevel() ?? 0\n\t\t\tconst speakerFrequency =\n\t\t\t\tthis.remoteAnalyzer?.getFrequencyData(AUDIO_FREQUENCY_BINS) ?? createZeroFrequencyArray()\n\n\t\t\t// Log audio levels periodically for debugging (every ~1 second)\n\t\t\tlogCounter++\n\t\t\tif (logCounter % 60 === 0) {\n\t\t\t\tdebugLog('OpenAIRealtimeService', 'Audio levels', {\n\t\t\t\t\tmic: micLevel.toFixed(3),\n\t\t\t\t\tspeaker: speakerLevel.toFixed(3),\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tthis.eventEmitter.emit('audio_level', {\n\t\t\t\tmicLevel,\n\t\t\t\tmicFrequency,\n\t\t\t\tspeakerLevel,\n\t\t\t\tspeakerFrequency,\n\t\t\t})\n\t\t}, AUDIO_VISUALIZATION_INTERVAL_MS)\n\t}\n\n\tprivate emitSessionState(\n\t\tstate: 'connecting' | 'connected' | 'disconnected' | 'error',\n\t\textra: Record<string, unknown> = {}\n\t): void {\n\t\tthis.lastState = state\n\t\tconst payload = {\n\t\t\tstate,\n\t\t\tisActive: state === 'connected',\n\t\t\tisMuted: this.muted,\n\t\t\t...extra,\n\t\t}\n\n\t\tthis.eventEmitter.emit('session_state', payload)\n\n\t\tswitch (state) {\n\t\t\tcase 'connecting':\n\t\t\t\tthis.eventEmitter.emit('session_connecting', payload)\n\t\t\t\tbreak\n\t\t\tcase 'connected':\n\t\t\t\tthis.eventEmitter.emit('session_connected', payload)\n\t\t\t\tbreak\n\t\t\tcase 'disconnected':\n\t\t\t\tthis.eventEmitter.emit('session_closed', payload)\n\t\t\t\tbreak\n\t\t\tcase 'error':\n\t\t\t\tthis.eventEmitter.emit('error', payload)\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tbreak\n\t\t}\n\t}\n}\n\n// Re-export types for convenience\nexport type { RealtimeConfig, RealtimeSession } from './types'\n","/**\n * Types for OpenAI Realtime API integration\n */\n\nexport interface RealtimeConfig {\n\tmodel?: string\n\tvoice?: string\n\tapiUrl?: string\n\ttokenEndpoint?: string\n}\n\nexport interface RealtimeSession {\n\tpc: RTCPeerConnection\n\tdataChannel: RTCDataChannel\n\taudioElement: HTMLAudioElement\n\tlocalStream: MediaStream | null\n\tremoteStream: MediaStream | null\n\tcleanup: () => void\n}\n\nexport interface OpenAITool {\n\ttype: 'function'\n\tname: string\n\tdescription: string\n\tparameters: {\n\t\ttype: string\n\t\tproperties?: Record<string, unknown>\n\t\trequired?: string[]\n\t}\n}\n\nexport interface SessionConfig {\n\tmodalities: string[]\n\tinstructions: string\n\tvoice?: string\n\ttools: OpenAITool[]\n\ttool_choice: string\n\tturn_detection: {\n\t\ttype: string\n\t\tthreshold: number\n\t\tprefix_padding_ms: number\n\t\tsilence_duration_ms: number\n\t}\n\tinput_audio_transcription?: {\n\t\tmodel: string\n\t}\n}\n\nexport interface FunctionCall {\n\tname: string\n\targuments: string\n\tcall_id: string\n\ttype?: string\n\tstatus?: string\n}\n\nexport interface ConversationItem {\n\ttype: string\n\trole?: string\n\tcontent?: unknown[]\n\tcall_id?: string\n\toutput?: string\n}\n\nexport interface RealtimeMessage {\n\ttype: string\n\t[key: string]: unknown\n}\n\nexport interface ToolExecutionResult {\n\tsuccess: boolean\n\tdata?: unknown\n\terror?: string\n}\n\nexport type EventCallback = (data: unknown) => void\n\nexport interface IEventEmitter {\n\ton(event: string, callback: EventCallback): void\n\toff(event: string, callback: EventCallback): void\n\temit(event: string, data: unknown): void\n}\n\nexport interface AudioLevelData {\n\tmicLevel: number\n\tmicFrequency: number[]\n\tspeakerLevel: number\n\tspeakerFrequency: number[]\n}\n\nexport interface TranscriptData {\n\ttype: 'user' | 'assistant'\n\ttext: string\n\tisDone: boolean\n}\n\nexport interface ToolCallData {\n\tstatus: 'started' | 'completed'\n\ttoolName: string\n\terror?: string\n}\n\nexport interface VoiceModeState {\n\tisActive: boolean\n\tisConnecting: boolean\n\tisMuted: boolean\n\tisError: boolean\n\tconnectionState: string\n\taudioLevel?: AudioLevelData\n\ttranscript?: TranscriptData\n\ttoolCall?: ToolCallData\n\terror?: string\n}\n\n// ============================================================================\n// Event Data Types - For type-safe event handling\n// ============================================================================\n\n/**\n * Session state event data from the realtime service\n */\nexport interface SessionStateEventData {\n\tstate: 'connecting' | 'connected' | 'disconnected' | 'error'\n\tisActive: boolean\n\tisMuted: boolean\n\tdurationSeconds?: number\n}\n\n/**\n * User transcript event data\n */\nexport interface UserTranscriptEventData {\n\ttext: string\n}\n\n/**\n * Assistant transcript streaming event data\n */\nexport interface AssistantTranscriptEventData {\n\tdelta?: string\n\ttranscript?: string\n}\n\n/**\n * Tool call started event data\n */\nexport interface ToolCallStartedEventData {\n\tname: string\n}\n\n/**\n * Tool call completed event data\n */\nexport interface ToolCallCompletedEventData {\n\tname: string\n\terror?: string\n}\n\n/**\n * Error event data\n */\nexport interface ErrorEventData {\n\terror?: string\n\tmessage?: string\n\ttype?: string\n}\n\n// ============================================================================\n// Type Guards - Runtime type checking for event data\n// ============================================================================\n\n/**\n * Type guard for SessionStateEventData\n */\nexport function isSessionStateEventData(data: unknown): data is SessionStateEventData {\n\tif (!data || typeof data !== 'object') return false\n\tconst d = data as Record<string, unknown>\n\treturn (\n\t\ttypeof d.state === 'string' &&\n\t\t['connecting', 'connected', 'disconnected', 'error'].includes(d.state) &&\n\t\ttypeof d.isActive === 'boolean' &&\n\t\ttypeof d.isMuted === 'boolean'\n\t)\n}\n\n/**\n * Type guard for UserTranscriptEventData\n */\nexport function isUserTranscriptEventData(data: unknown): data is UserTranscriptEventData {\n\tif (!data || typeof data !== 'object') return false\n\tconst d = data as Record<string, unknown>\n\treturn typeof d.text === 'string'\n}\n\n/**\n * Type guard for AssistantTranscriptEventData\n */\nexport function isAssistantTranscriptEventData(\n\tdata: unknown\n): data is AssistantTranscriptEventData {\n\tif (!data || typeof data !== 'object') return false\n\tconst d = data as Record<string, unknown>\n\treturn d.delta === undefined || typeof d.delta === 'string'\n}\n\n/**\n * Type guard for ToolCallStartedEventData\n */\nexport function isToolCallStartedEventData(data: unknown): data is ToolCallStartedEventData {\n\tif (!data || typeof data !== 'object') return false\n\tconst d = data as Record<string, unknown>\n\treturn typeof d.name === 'string'\n}\n\n/**\n * Type guard for ToolCallCompletedEventData\n */\nexport function isToolCallCompletedEventData(data: unknown): data is ToolCallCompletedEventData {\n\tif (!data || typeof data !== 'object') return false\n\tconst d = data as Record<string, unknown>\n\treturn typeof d.name === 'string'\n}\n\n/**\n * Type guard for ErrorEventData\n */\nexport function isErrorEventData(data: unknown): data is ErrorEventData {\n\tif (!data || typeof data !== 'object') return false\n\t// Error events must have at least one of these fields\n\tconst d = data as Record<string, unknown>\n\treturn typeof d.error === 'string' || typeof d.message === 'string' || typeof d.type === 'string'\n}\n\n/**\n * Type guard for AudioLevelData\n */\nexport function isAudioLevelData(data: unknown): data is AudioLevelData {\n\tif (!data || typeof data !== 'object') return false\n\tconst d = data as Record<string, unknown>\n\treturn (\n\t\ttypeof d.micLevel === 'number' &&\n\t\tArray.isArray(d.micFrequency) &&\n\t\ttypeof d.speakerLevel === 'number' &&\n\t\tArray.isArray(d.speakerFrequency)\n\t)\n}\n","/**\n * Voice Mode Hook\n *\n * Manages OpenAI Realtime API voice sessions with WebRTC.\n * Provides audio level streaming, transcript events, and tool call tracking.\n *\n * @example Basic usage\n * ```tsx\n * const {\n * isActive,\n * startSession,\n * stopSession,\n * toggleMute\n * } = useVoiceMode({\n * tokenEndpoint: '/api/realtime/session'\n * })\n * ```\n */\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\n\nimport {\n\tTOOL_CALL_DISPLAY_DURATION_MS,\n\tTOOL_CALL_ERROR_DISPLAY_DURATION_MS,\n} from '../lib/constants'\nimport {\n\tisAssistantTranscriptEventData,\n\tisAudioLevelData,\n\tisErrorEventData,\n\tisSessionStateEventData,\n\tisToolCallCompletedEventData,\n\tisToolCallStartedEventData,\n\tisUserTranscriptEventData,\n\tOpenAIRealtimeService,\n} from '../services/realtime'\n\nimport type {\n\tAudioLevelData,\n\tRealtimeConfig,\n\tRegisteredTool,\n\tToolCallData,\n\tToolExecutor,\n\tTranscriptData,\n\tVoiceModeState,\n} from '../services/realtime'\n\nexport interface UseVoiceModeOptions {\n\t/** Endpoint to get ephemeral tokens from */\n\ttokenEndpoint: string\n\t/** Tools available for the voice session */\n\ttools?: RegisteredTool[]\n\t/** Tool executor function */\n\ttoolExecutor?: ToolExecutor\n\t/** Callback when session connects */\n\tonConnect?: () => void\n\t/** Callback when session disconnects */\n\tonDisconnect?: (durationSeconds: number) => void\n\t/** Callback when error occurs */\n\tonError?: (error: string) => void\n\t/** Callback when user transcript is complete */\n\tonUserTranscript?: (text: string) => void\n\t/** Callback when assistant transcript is complete */\n\tonAssistantTranscript?: (text: string) => void\n}\n\nexport interface UseVoiceModeReturn extends VoiceModeState {\n\t/** Start voice session */\n\tstartSession: (config?: RealtimeConfig) => Promise<void>\n\t/** Stop voice session */\n\tstopSession: () => void\n\t/** Toggle microphone mute */\n\ttoggleMute: (muted?: boolean) => void\n\t/** Send text message while in voice mode */\n\tsendMessage: (text: string) => void\n}\n\nexport function useVoiceMode(options: UseVoiceModeOptions): UseVoiceModeReturn {\n\tconst {\n\t\ttokenEndpoint,\n\t\ttools,\n\t\ttoolExecutor,\n\t\tonConnect,\n\t\tonDisconnect,\n\t\tonError,\n\t\tonUserTranscript,\n\t\tonAssistantTranscript,\n\t} = options\n\n\t// State\n\tconst [isActive, setIsActive] = useState(false)\n\tconst [isConnecting, setIsConnecting] = useState(false)\n\tconst [isMuted, setIsMuted] = useState(false)\n\tconst [isError, setIsError] = useState(false)\n\tconst [connectionState, setConnectionState] = useState('disconnected')\n\tconst [audioLevel, setAudioLevel] = useState<AudioLevelData | undefined>()\n\tconst [transcript, setTranscript] = useState<TranscriptData | undefined>()\n\tconst [toolCall, setToolCall] = useState<ToolCallData | undefined>()\n\tconst [error, setError] = useState<string | undefined>()\n\n\t// Service ref\n\tconst serviceRef = useRef<OpenAIRealtimeService | null>(null)\n\n\t// Callbacks refs to avoid stale closures\n\tconst onConnectRef = useRef(onConnect)\n\tconst onDisconnectRef = useRef(onDisconnect)\n\tconst onErrorRef = useRef(onError)\n\tconst onUserTranscriptRef = useRef(onUserTranscript)\n\tconst onAssistantTranscriptRef = useRef(onAssistantTranscript)\n\n\tuseEffect(() => {\n\t\tonConnectRef.current = onConnect\n\t\tonDisconnectRef.current = onDisconnect\n\t\tonErrorRef.current = onError\n\t\tonUserTranscriptRef.current = onUserTranscript\n\t\tonAssistantTranscriptRef.current = onAssistantTranscript\n\t}, [onConnect, onDisconnect, onError, onUserTranscript, onAssistantTranscript])\n\n\t// Get or create service instance\n\tconst getService = useCallback(() => {\n\t\tif (!serviceRef.current) {\n\t\t\tserviceRef.current = new OpenAIRealtimeService(tokenEndpoint)\n\t\t}\n\t\treturn serviceRef.current\n\t}, [tokenEndpoint])\n\n\t// Update tools when they change\n\tuseEffect(() => {\n\t\tif (tools) {\n\t\t\tconst service = getService()\n\t\t\tservice.setTools(tools)\n\t\t}\n\t}, [tools, getService])\n\n\t// Update tool executor when it changes\n\tuseEffect(() => {\n\t\tif (toolExecutor) {\n\t\t\tconst service = getService()\n\t\t\tservice.setToolExecutor(toolExecutor)\n\t\t}\n\t}, [toolExecutor, getService])\n\n\t// Set up event listeners\n\tuseEffect(() => {\n\t\tconst service = getService()\n\n\t\t// Session state handler - uses type guard for safe access\n\t\tconst handleSessionState = (data: unknown) => {\n\t\t\tif (!isSessionStateEventData(data)) {\n\t\t\t\tconsole.warn('[useVoiceMode] Invalid session state event data:', data)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tsetConnectionState(data.state)\n\t\t\tsetIsActive(data.isActive)\n\t\t\tsetIsMuted(data.isMuted)\n\t\t\tsetIsConnecting(data.state === 'connecting')\n\t\t\tsetIsError(data.state === 'error')\n\n\t\t\tif (data.state === 'connected') {\n\t\t\t\tonConnectRef.current?.()\n\t\t\t} else if (data.state === 'disconnected') {\n\t\t\t\tonDisconnectRef.current?.(data.durationSeconds ?? 0)\n\t\t\t}\n\t\t}\n\n\t\t// Audio level handler - uses type guard for safe access\n\t\tconst handleAudioLevel = (data: unknown) => {\n\t\t\tif (isAudioLevelData(data)) {\n\t\t\t\tsetAudioLevel(data)\n\t\t\t}\n\t\t}\n\n\t\t// User transcript handler - uses type guard for safe access\n\t\tconst handleUserTranscript = (data: unknown) => {\n\t\t\tif (!isUserTranscriptEventData(data)) {\n\t\t\t\tconsole.warn('[useVoiceMode] Invalid user transcript event data:', data)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetTranscript({ type: 'user', text: data.text, isDone: true })\n\t\t\tonUserTranscriptRef.current?.(data.text)\n\t\t}\n\n\t\t// Assistant transcript handler (streaming) - uses type guard for safe access\n\t\tconst handleAssistantTranscript = (data: unknown) => {\n\t\t\tif (!isAssistantTranscriptEventData(data)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst text = data.delta || data.transcript || ''\n\t\t\tsetTranscript((prev) => ({\n\t\t\t\ttype: 'assistant',\n\t\t\t\ttext: prev?.type === 'assistant' ? prev.text + text : text,\n\t\t\t\tisDone: false,\n\t\t\t}))\n\t\t}\n\n\t\t// Assistant transcript done handler - uses type guard for safe access\n\t\tconst handleAssistantTranscriptDone = (data: unknown) => {\n\t\t\tif (!isAssistantTranscriptEventData(data)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst text = data.transcript || ''\n\t\t\tsetTranscript({ type: 'assistant', text, isDone: true })\n\t\t\tonAssistantTranscriptRef.current?.(text)\n\t\t}\n\n\t\t// Tool call started handler - uses type guard for safe access\n\t\tconst handleToolCallStarted = (data: unknown) => {\n\t\t\tif (!isToolCallStartedEventData(data)) {\n\t\t\t\tconsole.warn('[useVoiceMode] Invalid tool call started event data:', data)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetToolCall({ status: 'started', toolName: data.name })\n\t\t}\n\n\t\t// Tool call completed handler - uses type guard for safe access\n\t\tconst handleToolCallCompleted = (data: unknown) => {\n\t\t\tif (!isToolCallCompletedEventData(data)) {\n\t\t\t\tconsole.warn('[useVoiceMode] Invalid tool call completed event data:', data)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsetToolCall({ status: 'completed', toolName: data.name, error: data.error })\n\n\t\t\t// Clear tool call after a delay (longer for errors)\n\t\t\tsetTimeout(\n\t\t\t\t() => {\n\t\t\t\t\tsetToolCall(undefined)\n\t\t\t\t},\n\t\t\t\tdata.error ? TOOL_CALL_ERROR_DISPLAY_DURATION_MS : TOOL_CALL_DISPLAY_DURATION_MS\n\t\t\t)\n\t\t}\n\n\t\t// Error handler - uses type guard for safe access\n\t\tconst handleError = (data: unknown) => {\n\t\t\tif (!isErrorEventData(data)) {\n\t\t\t\tsetError('Unknown error')\n\t\t\t\tsetIsError(true)\n\t\t\t\tonErrorRef.current?.('Unknown error')\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst errorMsg = data.error || data.message || 'Unknown error'\n\t\t\tsetError(errorMsg)\n\t\t\tsetIsError(true)\n\t\t\tonErrorRef.current?.(errorMsg)\n\t\t}\n\n\t\t// Register listeners\n\t\tservice.on('session_state', handleSessionState)\n\t\tservice.on('audio_level', handleAudioLevel)\n\t\tservice.on('user_transcript_done', handleUserTranscript)\n\t\tservice.on('assistant_transcript', handleAssistantTranscript)\n\t\tservice.on('assistant_transcript_done', handleAssistantTranscriptDone)\n\t\tservice.on('tool_call_started', handleToolCallStarted)\n\t\tservice.on('tool_call_completed', handleToolCallCompleted)\n\t\tservice.on('error', handleError)\n\n\t\t// Cleanup\n\t\treturn () => {\n\t\t\tservice.off('session_state', handleSessionState)\n\t\t\tservice.off('audio_level', handleAudioLevel)\n\t\t\tservice.off('user_transcript_done', handleUserTranscript)\n\t\t\tservice.off('assistant_transcript', handleAssistantTranscript)\n\t\t\tservice.off('assistant_transcript_done', handleAssistantTranscriptDone)\n\t\t\tservice.off('tool_call_started', handleToolCallStarted)\n\t\t\tservice.off('tool_call_completed', handleToolCallCompleted)\n\t\t\tservice.off('error', handleError)\n\t\t}\n\t}, [getService])\n\n\t// Start session\n\tconst startSession = useCallback(\n\t\tasync (config?: RealtimeConfig) => {\n\t\t\ttry {\n\t\t\t\tsetIsConnecting(true)\n\t\t\t\tsetIsError(false)\n\t\t\t\tsetError(undefined)\n\n\t\t\t\tconst service = getService()\n\t\t\t\tawait service.startSession(config)\n\t\t\t} catch (err) {\n\t\t\t\tsetIsConnecting(false)\n\t\t\t\tsetIsError(true)\n\t\t\t\tconst errorMsg = err instanceof Error ? err.message : 'Failed to start session'\n\t\t\t\tsetError(errorMsg)\n\t\t\t\tonErrorRef.current?.(errorMsg)\n\t\t\t}\n\t\t},\n\t\t[getService]\n\t)\n\n\t// Stop session\n\tconst stopSession = useCallback(() => {\n\t\tconst service = getService()\n\t\tservice.stopSession()\n\t\tsetAudioLevel(undefined)\n\t\tsetTranscript(undefined)\n\t\tsetToolCall(undefined)\n\t}, [getService])\n\n\t// Toggle mute\n\tconst toggleMute = useCallback(\n\t\t(muted?: boolean) => {\n\t\t\tconst service = getService()\n\t\t\tconst newMuted = muted !== undefined ? muted : !isMuted\n\t\t\tservice.toggleMute(newMuted)\n\t\t\tsetIsMuted(newMuted)\n\t\t},\n\t\t[getService, isMuted]\n\t)\n\n\t// Send message\n\tconst sendMessage = useCallback(\n\t\t(text: string) => {\n\t\t\tconst service = getService()\n\t\t\tif (service.isSessionActive()) {\n\t\t\t\tservice.sendUserMessage(text)\n\t\t\t}\n\t\t},\n\t\t[getService]\n\t)\n\n\t// Memoize return value\n\treturn useMemo(\n\t\t() => ({\n\t\t\tisActive,\n\t\t\tisConnecting,\n\t\t\tisMuted,\n\t\t\tisError,\n\t\t\tconnectionState,\n\t\t\taudioLevel,\n\t\t\ttranscript,\n\t\t\ttoolCall,\n\t\t\terror,\n\t\t\tstartSession,\n\t\t\tstopSession,\n\t\t\ttoggleMute,\n\t\t\tsendMessage,\n\t\t}),\n\t\t[\n\t\t\tisActive,\n\t\t\tisConnecting,\n\t\t\tisMuted,\n\t\t\tisError,\n\t\t\tconnectionState,\n\t\t\taudioLevel,\n\t\t\ttranscript,\n\t\t\ttoolCall,\n\t\t\terror,\n\t\t\tstartSession,\n\t\t\tstopSession,\n\t\t\ttoggleMute,\n\t\t\tsendMessage,\n\t\t]\n\t)\n}\n","import { createContext, useContext, useMemo } from 'react'\n\nimport { useVoiceMode } from '../hooks/useVoiceMode'\n\nimport type { ReactNode } from 'react'\nimport type { UseVoiceModeReturn } from '../hooks/useVoiceMode'\nimport type { RegisteredTool, ToolExecutor } from '../services/realtime'\n\n/**\n * Voice Mode Provider\n *\n * Provides voice mode state and controls to the component tree.\n */\n\ninterface VoiceModeContextValue extends UseVoiceModeReturn {\n\tisSupported: boolean\n}\n\nconst VoiceModeContext = createContext<VoiceModeContextValue | null>(null)\n\nexport interface VoiceModeProviderProps {\n\tchildren: ReactNode\n\t/** Backend endpoint for ephemeral tokens */\n\ttokenEndpoint: string\n\t/** Tools available for voice mode */\n\ttools?: RegisteredTool[]\n\t/** Tool executor function */\n\ttoolExecutor?: ToolExecutor\n\t/** Callback when session connects */\n\tonConnect?: () => void\n\t/** Callback when session disconnects */\n\tonDisconnect?: (durationSeconds: number) => void\n\t/** Callback when error occurs */\n\tonError?: (error: string) => void\n\t/** Callback when user transcript is complete */\n\tonUserTranscript?: (text: string) => void\n\t/** Callback when assistant transcript is complete */\n\tonAssistantTranscript?: (text: string) => void\n}\n\n/**\n * Check if the browser supports WebRTC and getUserMedia\n */\nfunction checkVoiceModeSupport(): boolean {\n\treturn !!(\n\t\ttypeof window !== 'undefined' &&\n\t\twindow.RTCPeerConnection &&\n\t\tnavigator.mediaDevices?.getUserMedia\n\t)\n}\n\nexport function VoiceModeProvider({\n\tchildren,\n\ttokenEndpoint,\n\ttools,\n\ttoolExecutor,\n\tonConnect,\n\tonDisconnect,\n\tonError,\n\tonUserTranscript,\n\tonAssistantTranscript,\n}: VoiceModeProviderProps) {\n\tconst voiceMode = useVoiceMode({\n\t\ttokenEndpoint,\n\t\ttools,\n\t\ttoolExecutor,\n\t\tonConnect,\n\t\tonDisconnect,\n\t\tonError,\n\t\tonUserTranscript,\n\t\tonAssistantTranscript,\n\t})\n\n\tconst isSupported = useMemo(() => checkVoiceModeSupport(), [])\n\n\tconst value = useMemo(\n\t\t() => ({\n\t\t\t...voiceMode,\n\t\t\tisSupported,\n\t\t}),\n\t\t[voiceMode, isSupported]\n\t)\n\n\treturn <VoiceModeContext.Provider value={value}>{children}</VoiceModeContext.Provider>\n}\n\n/**\n * Hook to access voice mode context\n */\nexport function useVoiceModeContext(): VoiceModeContextValue {\n\tconst context = useContext(VoiceModeContext)\n\tif (!context) {\n\t\tthrow new Error('useVoiceModeContext must be used within a VoiceModeProvider')\n\t}\n\treturn context\n}\n\n/**\n * Hook to optionally access voice mode context (returns null if not in provider)\n */\nexport function useOptionalVoiceModeContext(): VoiceModeContextValue | null {\n\treturn useContext(VoiceModeContext)\n}\n","'use client'\n\nimport * as AvatarPrimitive from '@radix-ui/react-avatar'\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils'\n\nfunction Avatar({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Root>) {\n\treturn (\n\t\t<AvatarPrimitive.Root\n\t\t\tdata-slot=\"avatar\"\n\t\t\tclassName={cn('relative flex size-8 shrink-0 overflow-hidden rounded-full', className)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction AvatarImage({ className, ...props }: React.ComponentProps<typeof AvatarPrimitive.Image>) {\n\treturn (\n\t\t<AvatarPrimitive.Image\n\t\t\tdata-slot=\"avatar-image\"\n\t\t\tclassName={cn('aspect-square size-full', className)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction AvatarFallback({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {\n\treturn (\n\t\t<AvatarPrimitive.Fallback\n\t\t\tdata-slot=\"avatar-fallback\"\n\t\t\tclassName={cn('bg-muted flex size-full items-center justify-center rounded-full', className)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nexport { Avatar, AvatarImage, AvatarFallback }\n","'use client'\n\nimport * as DialogPrimitive from '@radix-ui/react-dialog'\nimport { XIcon } from 'lucide-react'\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils'\n\nfunction Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>) {\n\treturn <DialogPrimitive.Root data-slot=\"dialog\" {...props} />\n}\n\nfunction DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n\treturn <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />\n}\n\nfunction DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n\treturn <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />\n}\n\nfunction DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>) {\n\treturn <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />\n}\n\nfunction DialogOverlay({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n\treturn (\n\t\t<DialogPrimitive.Overlay\n\t\t\tdata-slot=\"dialog-overlay\"\n\t\t\tclassName={cn(\n\t\t\t\t'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction DialogContent({\n\tclassName,\n\tchildren,\n\tshowCloseButton = true,\n\t...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n\tshowCloseButton?: boolean\n}) {\n\treturn (\n\t\t<DialogPortal data-slot=\"dialog-portal\">\n\t\t\t<DialogOverlay />\n\t\t\t<DialogPrimitive.Content\n\t\t\t\tdata-slot=\"dialog-content\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg',\n\t\t\t\t\tclassName\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t{showCloseButton && (\n\t\t\t\t\t<DialogPrimitive.Close\n\t\t\t\t\t\tdata-slot=\"dialog-close\"\n\t\t\t\t\t\tclassName=\"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<XIcon />\n\t\t\t\t\t\t<span className=\"sr-only\">Close</span>\n\t\t\t\t\t</DialogPrimitive.Close>\n\t\t\t\t)}\n\t\t\t</DialogPrimitive.Content>\n\t\t</DialogPortal>\n\t)\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<'div'>) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"dialog-header\"\n\t\t\tclassName={cn('flex flex-col gap-2 text-center sm:text-left', className)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction DialogFooter({ className, ...props }: React.ComponentProps<'div'>) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"dialog-footer\"\n\t\t\tclassName={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) {\n\treturn (\n\t\t<DialogPrimitive.Title\n\t\t\tdata-slot=\"dialog-title\"\n\t\t\tclassName={cn('text-lg leading-none font-semibold', className)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction DialogDescription({\n\tclassName,\n\t...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n\treturn (\n\t\t<DialogPrimitive.Description\n\t\t\tdata-slot=\"dialog-description\"\n\t\t\tclassName={cn('text-muted-foreground text-sm', className)}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nexport {\n\tDialog,\n\tDialogClose,\n\tDialogContent,\n\tDialogDescription,\n\tDialogFooter,\n\tDialogHeader,\n\tDialogOverlay,\n\tDialogPortal,\n\tDialogTitle,\n\tDialogTrigger,\n}\n","'use client'\n\nimport * as TooltipPrimitive from '@radix-ui/react-tooltip'\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils'\n\nfunction TooltipProvider({\n\tdelayDuration = 0,\n\t...props\n}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {\n\treturn (\n\t\t<TooltipPrimitive.Provider\n\t\t\tdata-slot=\"tooltip-provider\"\n\t\t\tdelayDuration={delayDuration}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nfunction Tooltip({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Root>) {\n\treturn (\n\t\t<TooltipProvider>\n\t\t\t<TooltipPrimitive.Root data-slot=\"tooltip\" {...props} />\n\t\t</TooltipProvider>\n\t)\n}\n\nfunction TooltipTrigger({ ...props }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {\n\treturn <TooltipPrimitive.Trigger data-slot=\"tooltip-trigger\" {...props} />\n}\n\nfunction TooltipContent({\n\tclassName,\n\tsideOffset = 0,\n\tchildren,\n\t...props\n}: React.ComponentProps<typeof TooltipPrimitive.Content>) {\n\treturn (\n\t\t<TooltipPrimitive.Portal>\n\t\t\t<TooltipPrimitive.Content\n\t\t\t\tdata-slot=\"tooltip-content\"\n\t\t\t\tsideOffset={sideOffset}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance',\n\t\t\t\t\tclassName\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t\t<TooltipPrimitive.Arrow className=\"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]\" />\n\t\t\t</TooltipPrimitive.Content>\n\t\t</TooltipPrimitive.Portal>\n\t)\n}\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }\n","import { Slot } from '@radix-ui/react-slot'\nimport { cva } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { cn } from '../lib/utils'\n\nimport type { VariantProps } from 'class-variance-authority'\n\nexport interface ButtonProps\n\textends React.ComponentProps<'button'>,\n\t\tVariantProps<typeof buttonVariants> {\n\tasChild?: boolean\n}\n\nconst buttonVariants = cva(\n\t\"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive\",\n\t{\n\t\tvariants: {\n\t\t\tvariant: {\n\t\t\t\tdefault: 'bg-primary text-primary-foreground hover:bg-primary/90',\n\t\t\t\tdestructive:\n\t\t\t\t\t'bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',\n\t\t\t\toutline:\n\t\t\t\t\t'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50',\n\t\t\t\tsecondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',\n\t\t\t\tghost: 'hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50',\n\t\t\t\tlink: 'text-primary underline-offset-4 hover:underline',\n\t\t\t},\n\t\t\tsize: {\n\t\t\t\tdefault: 'h-9 px-4 py-2 has-[>svg]:px-3',\n\t\t\t\tsm: 'h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5',\n\t\t\t\tlg: 'h-10 rounded-md px-6 has-[>svg]:px-4',\n\t\t\t\ticon: 'size-9',\n\t\t\t\t'icon-sm': 'size-8',\n\t\t\t\t'icon-lg': 'size-10',\n\t\t\t},\n\t\t},\n\t\tdefaultVariants: {\n\t\t\tvariant: 'default',\n\t\t\tsize: 'default',\n\t\t},\n\t}\n)\n\nfunction Button({\n\tclassName,\n\tvariant,\n\tsize,\n\tasChild = false,\n\t...props\n}: React.ComponentProps<'button'> &\n\tVariantProps<typeof buttonVariants> & {\n\t\tasChild?: boolean\n\t}) {\n\tconst Comp = asChild ? Slot : 'button'\n\n\treturn (\n\t\t<Comp\n\t\t\tdata-slot=\"button\"\n\t\t\tclassName={cn(buttonVariants({ variant, size, className }))}\n\t\t\t{...props}\n\t\t/>\n\t)\n}\n\nexport { Button, buttonVariants }\n","'use client'\n\nimport { Slottable } from '@radix-ui/react-slot'\nimport { forwardRef } from 'react'\n\nimport { cn } from '../lib/utils'\nimport { Button } from './button'\nimport { Tooltip, TooltipContent, TooltipTrigger } from './tooltip'\n\nimport type { ComponentPropsWithRef } from 'react'\n\nexport type TooltipIconButtonProps = ComponentPropsWithRef<typeof Button> & {\n\ttooltip: string\n\tside?: 'top' | 'bottom' | 'left' | 'right'\n}\n\nexport const TooltipIconButton = forwardRef<HTMLButtonElement, TooltipIconButtonProps>(\n\t({ children, tooltip, side = 'bottom', className, ...rest }, ref) => {\n\t\treturn (\n\t\t\t<Tooltip>\n\t\t\t\t<TooltipTrigger asChild>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\t{...rest}\n\t\t\t\t\t\tclassName={cn('aui-button-icon size-6 p-1', className)}\n\t\t\t\t\t\tref={ref}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Slottable>{children}</Slottable>\n\t\t\t\t\t\t<span className=\"aui-sr-only sr-only\">{tooltip}</span>\n\t\t\t\t\t</Button>\n\t\t\t\t</TooltipTrigger>\n\t\t\t\t<TooltipContent side={side}>{tooltip}</TooltipContent>\n\t\t\t</Tooltip>\n\t\t)\n\t}\n)\n\nTooltipIconButton.displayName = 'TooltipIconButton'\n","'use client'\n\nimport {\n\tAttachmentPrimitive,\n\tComposerPrimitive,\n\tMessagePrimitive,\n\tuseAssistantApi,\n\tuseAssistantState,\n} from '@assistant-ui/react'\nimport { FileText, PlusIcon, XIcon } from 'lucide-react'\nimport { useEffect, useState } from 'react'\nimport { useShallow } from 'zustand/shallow'\n\nimport { cn } from '../lib/utils'\nimport { Avatar, AvatarFallback, AvatarImage } from './avatar'\nimport { Dialog, DialogContent, DialogTitle, DialogTrigger } from './dialog'\nimport { Tooltip, TooltipContent, TooltipTrigger } from './tooltip'\nimport { TooltipIconButton } from './tooltip-icon-button'\n\nimport type { FC, PropsWithChildren } from 'react'\n\nconst useFileSrc = (file: File | undefined) => {\n\tconst [src, setSrc] = useState<string | undefined>(undefined)\n\n\tuseEffect(() => {\n\t\tif (!file) {\n\t\t\tsetSrc(undefined)\n\t\t\treturn\n\t\t}\n\n\t\tconst objectUrl = URL.createObjectURL(file)\n\t\tsetSrc(objectUrl)\n\n\t\treturn () => {\n\t\t\tURL.revokeObjectURL(objectUrl)\n\t\t}\n\t}, [file])\n\n\treturn src\n}\n\nconst useAttachmentSrc = () => {\n\tconst { file, src } = useAssistantState(\n\t\tuseShallow(({ attachment }): { file?: File; src?: string } => {\n\t\t\tif (attachment.type !== 'image') return {}\n\t\t\tif (attachment.file) return { file: attachment.file }\n\t\t\tconst src = attachment.content?.filter((c) => c.type === 'image')[0]?.image\n\t\t\tif (!src) return {}\n\t\t\treturn { src }\n\t\t})\n\t)\n\n\treturn useFileSrc(file) ?? src\n}\n\ntype AttachmentPreviewProps = {\n\tsrc: string\n}\n\nconst AttachmentPreview: FC<AttachmentPreviewProps> = ({ src }) => {\n\treturn (\n\t\t<img\n\t\t\tsrc={src}\n\t\t\talt=\"Image Preview\"\n\t\t\twidth={1}\n\t\t\theight={1}\n\t\t\tclassName=\"aui-attachment-preview-image-loaded block h-auto max-h-[80vh] w-auto max-w-full object-contain\"\n\t\t/>\n\t)\n}\n\nconst AttachmentPreviewDialog: FC<PropsWithChildren> = ({ children }) => {\n\tconst src = useAttachmentSrc()\n\n\tif (!src) return children\n\n\treturn (\n\t\t<Dialog>\n\t\t\t<DialogTrigger\n\t\t\t\tclassName=\"aui-attachment-preview-trigger cursor-pointer transition-colors hover:bg-accent/50\"\n\t\t\t\tasChild\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</DialogTrigger>\n\t\t\t<DialogContent className=\"aui-attachment-preview-dialog-content p-2 sm:max-w-3xl [&_svg]:text-background [&>button]:rounded-full [&>button]:bg-foreground/60 [&>button]:p-1 [&>button]:opacity-100 [&>button]:!ring-0 [&>button]:hover:[&_svg]:text-destructive\">\n\t\t\t\t<DialogTitle className=\"aui-sr-only sr-only\">Image Attachment Preview</DialogTitle>\n\t\t\t\t<div className=\"aui-attachment-preview relative mx-auto flex max-h-[80dvh] w-full items-center justify-center overflow-hidden bg-background\">\n\t\t\t\t\t<AttachmentPreview src={src} />\n\t\t\t\t</div>\n\t\t\t</DialogContent>\n\t\t</Dialog>\n\t)\n}\n\nconst AttachmentThumb: FC = () => {\n\tconst isImage = useAssistantState(({ attachment }) => attachment.type === 'image')\n\tconst src = useAttachmentSrc()\n\n\treturn (\n\t\t<Avatar className=\"aui-attachment-tile-avatar h-full w-full rounded-none\">\n\t\t\t<AvatarImage\n\t\t\t\tsrc={src}\n\t\t\t\talt=\"Attachment preview\"\n\t\t\t\tclassName=\"aui-attachment-tile-image object-cover\"\n\t\t\t/>\n\t\t\t<AvatarFallback delayMs={isImage ? 200 : 0}>\n\t\t\t\t<FileText className=\"aui-attachment-tile-fallback-icon size-8 text-muted-foreground\" />\n\t\t\t</AvatarFallback>\n\t\t</Avatar>\n\t)\n}\n\nconst AttachmentUI: FC = () => {\n\tconst api = useAssistantApi()\n\tconst isComposer = api.attachment.source === 'composer'\n\n\tconst isImage = useAssistantState(({ attachment }) => attachment.type === 'image')\n\tconst typeLabel = useAssistantState(({ attachment }) => {\n\t\tconst type = attachment.type\n\t\tswitch (type) {\n\t\t\tcase 'image':\n\t\t\t\treturn 'Image'\n\t\t\tcase 'document':\n\t\t\t\treturn 'Document'\n\t\t\tcase 'file':\n\t\t\t\treturn 'File'\n\t\t\tdefault: {\n\t\t\t\tconst _exhaustiveCheck: never = type\n\t\t\t\tthrow new Error(`Unknown attachment type: ${_exhaustiveCheck}`)\n\t\t\t}\n\t\t}\n\t})\n\n\treturn (\n\t\t<Tooltip>\n\t\t\t<AttachmentPrimitive.Root\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'aui-attachment-root relative',\n\t\t\t\t\tisImage && 'aui-attachment-root-composer only:[&>#attachment-tile]:size-24'\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t<AttachmentPreviewDialog>\n\t\t\t\t\t<TooltipTrigger asChild>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t'aui-attachment-tile size-14 cursor-pointer overflow-hidden rounded-[14px] border bg-muted transition-opacity hover:opacity-75',\n\t\t\t\t\t\t\t\tisComposer && 'aui-attachment-tile-composer border-foreground/20'\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\t\tid=\"attachment-tile\"\n\t\t\t\t\t\t\taria-label={`${typeLabel} attachment`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<AttachmentThumb />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</TooltipTrigger>\n\t\t\t\t</AttachmentPreviewDialog>\n\t\t\t\t{isComposer && <AttachmentRemove />}\n\t\t\t</AttachmentPrimitive.Root>\n\t\t\t<TooltipContent side=\"top\">\n\t\t\t\t<AttachmentPrimitive.Name />\n\t\t\t</TooltipContent>\n\t\t</Tooltip>\n\t)\n}\n\nconst AttachmentRemove: FC = () => {\n\treturn (\n\t\t<AttachmentPrimitive.Remove asChild>\n\t\t\t<TooltipIconButton\n\t\t\t\ttooltip=\"Remove file\"\n\t\t\t\tclassName=\"aui-attachment-tile-remove absolute top-1.5 right-1.5 size-3.5 rounded-full bg-white text-muted-foreground opacity-100 shadow-sm hover:!bg-white [&_svg]:text-black hover:[&_svg]:text-destructive\"\n\t\t\t\tside=\"top\"\n\t\t\t>\n\t\t\t\t<XIcon className=\"aui-attachment-remove-icon size-3 dark:stroke-[2.5px]\" />\n\t\t\t</TooltipIconButton>\n\t\t</AttachmentPrimitive.Remove>\n\t)\n}\n\nexport const UserMessageAttachments: FC = () => {\n\treturn (\n\t\t<div className=\"aui-user-message-attachments-end col-span-full col-start-1 row-start-1 flex w-full flex-row justify-end gap-2\">\n\t\t\t<MessagePrimitive.Attachments components={{ Attachment: AttachmentUI }} />\n\t\t</div>\n\t)\n}\n\nexport const ComposerAttachments: FC = () => {\n\treturn (\n\t\t<div className=\"aui-composer-attachments mb-2 flex w-full flex-row items-center gap-2 overflow-x-auto px-1.5 pt-0.5 pb-1 empty:hidden\">\n\t\t\t<ComposerPrimitive.Attachments components={{ Attachment: AttachmentUI }} />\n\t\t</div>\n\t)\n}\n\nexport const ComposerAddAttachment: FC = () => {\n\treturn (\n\t\t<ComposerPrimitive.AddAttachment asChild>\n\t\t\t<TooltipIconButton\n\t\t\t\ttooltip=\"Add Attachment\"\n\t\t\t\tside=\"bottom\"\n\t\t\t\tvariant=\"ghost\"\n\t\t\t\tsize=\"icon\"\n\t\t\t\tclassName=\"aui-composer-add-attachment size-[34px] rounded-full p-1 text-xs font-semibold hover:bg-muted-foreground/15 dark:border-muted-foreground/15 dark:hover:bg-muted-foreground/30\"\n\t\t\t\taria-label=\"Add Attachment\"\n\t\t\t>\n\t\t\t\t<PlusIcon className=\"aui-attachment-add-icon size-5 stroke-[1.5px]\" />\n\t\t\t</TooltipIconButton>\n\t\t</ComposerPrimitive.AddAttachment>\n\t)\n}\n","'use client'\n\n// CSS imported via globals.css - see src/styles/globals.css for @assistant-ui/react-markdown styles\nimport {\n\tMarkdownTextPrimitive,\n\tunstable_memoizeMarkdownComponents as memoizeMarkdownComponents,\n\tuseIsMarkdownCodeBlock,\n} from '@assistant-ui/react-markdown'\nimport { CheckIcon, CopyIcon } from 'lucide-react'\nimport { memo, useState } from 'react'\nimport remarkGfm from 'remark-gfm'\n\nimport { cn } from '../lib/utils'\nimport { TooltipIconButton } from './tooltip-icon-button'\n\nimport type { CodeHeaderProps } from '@assistant-ui/react-markdown'\nimport type { FC } from 'react'\n\nconst MarkdownTextImpl = () => {\n\treturn (\n\t\t<MarkdownTextPrimitive\n\t\t\tremarkPlugins={[remarkGfm]}\n\t\t\tclassName=\"aui-md\"\n\t\t\tcomponents={defaultComponents}\n\t\t/>\n\t)\n}\n\nexport const MarkdownText = memo(MarkdownTextImpl)\n\nconst CodeHeader: FC<CodeHeaderProps> = ({ language, code }) => {\n\tconst { isCopied, copyToClipboard } = useCopyToClipboard()\n\tconst onCopy = () => {\n\t\tif (!code || isCopied) return\n\t\tcopyToClipboard(code)\n\t}\n\n\treturn (\n\t\t<div className=\"aui-code-header-root mt-2 flex items-center justify-between gap-2 rounded-t-lg bg-muted-foreground/15 px-2 py-1 text-sm font-semibold text-foreground dark:bg-muted-foreground/20\">\n\t\t\t<span className=\"aui-code-header-language lowercase [&>span]:text-xs\">{language}</span>\n\t\t\t<TooltipIconButton tooltip=\"Copy\" onClick={onCopy}>\n\t\t\t\t{!isCopied && <CopyIcon />}\n\t\t\t\t{isCopied && <CheckIcon />}\n\t\t\t</TooltipIconButton>\n\t\t</div>\n\t)\n}\n\nconst useCopyToClipboard = ({\n\tcopiedDuration = 3000,\n}: {\n\tcopiedDuration?: number\n} = {}) => {\n\tconst [isCopied, setIsCopied] = useState<boolean>(false)\n\n\tconst copyToClipboard = (value: string) => {\n\t\tif (!value) return\n\n\t\tvoid navigator.clipboard.writeText(value).then(() => {\n\t\t\tsetIsCopied(true)\n\t\t\tsetTimeout(() => setIsCopied(false), copiedDuration)\n\t\t})\n\t}\n\n\treturn { isCopied, copyToClipboard }\n}\n\nconst defaultComponents = memoizeMarkdownComponents({\n\th1: ({ className, ...props }) => (\n\t\t<h1\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-h1 mb-4 scroll-m-20 text-[25px] font-extrabold tracking-tight last:mb-0',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\th2: ({ className, ...props }) => (\n\t\t<h2\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-h2 mt-4 mb-2 scroll-m-20 text-[21px] font-semibold tracking-tight first:mt-0 last:mb-0',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\th3: ({ className, ...props }) => (\n\t\t<h3\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-h3 mt-3 mb-2 scroll-m-20 text-[19px] font-semibold tracking-tight first:mt-0 last:mb-0',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\th4: ({ className, ...props }) => (\n\t\t<h4\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-h4 mt-3 mb-2 scroll-m-20 text-[17px] font-semibold tracking-tight first:mt-0 last:mb-0',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\th5: ({ className, ...props }) => (\n\t\t<h5\n\t\t\tclassName={cn('aui-md-h5 my-2 text-[15px] font-semibold first:mt-0 last:mb-0', className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\th6: ({ className, ...props }) => (\n\t\t<h6\n\t\t\tclassName={cn('aui-md-h6 my-2 text-[15px] font-semibold first:mt-0 last:mb-0', className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\tp: ({ className, ...props }) => (\n\t\t<p\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-p mt-2 mb-2 text-[13px] leading-relaxed first:mt-0 last:mb-0',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\ta: ({ className, ...props }) => (\n\t\t<a\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-a text-[13px] font-medium text-primary underline underline-offset-4',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\tblockquote: ({ className, ...props }) => (\n\t\t<blockquote\n\t\t\tclassName={cn('aui-md-blockquote text-[13px] border-l-2 pl-3 italic', className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\tul: ({ className, ...props }) => (\n\t\t<ul\n\t\t\tclassName={cn('aui-md-ul text-[13px] my-2 ml-4 list-disc [&>li]:mt-1', className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\tol: ({ className, ...props }) => (\n\t\t<ol\n\t\t\tclassName={cn('aui-md-ol text-[13px] my-2 ml-4 list-decimal [&>li]:mt-1', className)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\thr: ({ className, ...props }) => (\n\t\t<hr className={cn('aui-md-hr my-2 border-b', className)} {...props} />\n\t),\n\ttable: ({ className, ...props }) => (\n\t\t<table\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-table text-[13px] my-2 w-full border-separate border-spacing-0 overflow-y-auto',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\tth: ({ className, ...props }) => (\n\t\t<th\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-th bg-muted px-2 py-1 text-left font-bold first:rounded-tl-lg last:rounded-tr-lg [&[align=center]]:text-center [&[align=right]]:text-right',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\ttd: ({ className, ...props }) => (\n\t\t<td\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-td border-b border-l px-2 py-1 text-left last:border-r [&[align=center]]:text-center [&[align=right]]:text-right',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\ttr: ({ className, ...props }) => (\n\t\t<tr\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-tr m-0 border-b p-0 first:border-t [&:last-child>td:first-child]:rounded-bl-lg [&:last-child>td:last-child]:rounded-br-lg',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\tsup: ({ className, ...props }) => (\n\t\t<sup className={cn('aui-md-sup [&>a]:text-xs [&>a]:no-underline', className)} {...props} />\n\t),\n\tpre: ({ className, ...props }) => (\n\t\t<pre\n\t\t\tclassName={cn(\n\t\t\t\t'aui-md-pre text-[13px] overflow-x-auto !rounded-t-none rounded-b-lg bg-black p-2 text-white',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t),\n\tcode: function Code({ className, ...props }) {\n\t\tconst isCodeBlock = useIsMarkdownCodeBlock()\n\t\treturn (\n\t\t\t<code\n\t\t\t\tclassName={cn(\n\t\t\t\t\t!isCodeBlock && 'aui-md-inline-code text-[13px] rounded border bg-muted font-semibold',\n\t\t\t\t\tclassName\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t)\n\t},\n\tCodeHeader,\n})\n","/**\n * MCP Transport Utilities\n *\n * Shared transport creation logic for MCP sources.\n * This eliminates duplication between MCPToolsProvider and useMCPSource.\n */\nimport { TabClientTransport } from '@mcp-b/transports'\nimport { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js'\nimport { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'\n\nimport type { MCPSourceConfig } from '@mcp-b/cloud-mirror-types'\nimport type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js'\n\n/**\n * Transport type options for HTTP-based connections\n */\nexport type TransportType = 'http' | 'sse'\n\n/**\n * Creates the appropriate MCP transport based on source configuration.\n *\n * @param config - The MCP source configuration\n * @param transportType - For HTTP sources, specifies whether to use HTTP or SSE transport\n * @returns A configured MCP Transport instance\n *\n * @example Tab-based transport (same-tab or iframe)\n * ```ts\n * const transport = createMCPTransport({ type: 'tab' })\n * ```\n *\n * @example HTTP transport with auth\n * ```ts\n * const transport = createMCPTransport({\n * type: 'http',\n * url: 'https://example.com/mcp',\n * authToken: 'secret'\n * }, 'http')\n * ```\n */\nexport function createMCPTransport(\n\tconfig: MCPSourceConfig,\n\ttransportType: TransportType = 'http'\n): Transport {\n\tif (config.type === 'tab') {\n\t\treturn new TabClientTransport({\n\t\t\ttargetOrigin: config.targetOrigin ?? window.location.origin,\n\t\t\tchannelId: config.channelId ?? 'mcp-default',\n\t\t})\n\t}\n\n\t// HTTP/SSE transport configuration\n\tconst serverUrl = new URL(config.url)\n\tconst headers: Record<string, string> = {\n\t\tAccept: 'application/json, text/event-stream',\n\t\t...(config.customHeaders ?? {}),\n\t}\n\n\tif (config.authToken) {\n\t\theaders.Authorization = `Bearer ${config.authToken}`\n\t}\n\n\tconst transportOptions = {\n\t\trequestInit: { headers },\n\t}\n\n\tif (transportType === 'sse') {\n\t\treturn new SSEClientTransport(serverUrl, transportOptions)\n\t}\n\n\treturn new StreamableHTTPClientTransport(serverUrl, transportOptions)\n}\n\n/**\n * Check if an error indicates we should try SSE fallback.\n *\n * This handles cases where HTTP streaming isn't supported (404/405) or\n * when the connection fails due to CORS/network issues.\n *\n * @param error - The error from the failed HTTP connection\n * @returns true if the error suggests trying SSE transport instead\n */\nexport function shouldFallbackToSSE(error: Error): boolean {\n\tconst message = error.message\n\treturn (\n\t\tmessage.includes('404') ||\n\t\tmessage.includes('Not Found') ||\n\t\tmessage.includes('405') ||\n\t\tmessage.includes('Method Not Allowed') ||\n\t\tmessage === 'Failed to fetch' || // Chrome CORS\n\t\tmessage === 'NetworkError when attempting to fetch resource.' || // Firefox\n\t\tmessage === 'Load failed' // Safari\n\t)\n}\n\n/**\n * Calculate exponential backoff delay for reconnection attempts.\n *\n * @param attempt - The current attempt number (0-based)\n * @param baseDelay - Base delay in milliseconds\n * @param maxDelay - Maximum delay cap in milliseconds\n * @returns The calculated delay in milliseconds\n */\nexport function calculateReconnectDelay(\n\tattempt: number,\n\tbaseDelay: number,\n\tmaxDelay: number\n): number {\n\treturn Math.min(baseDelay * Math.pow(2, attempt), maxDelay)\n}\n","/**\n * MCP Tools Provider\n *\n * Simplified provider for managing tools from multiple MCP sources.\n * Sources can be tab-based (same-tab, iframes) or HTTP-based (remote servers).\n *\n * @example Basic usage\n * ```tsx\n * <MCPToolsProvider>\n * <App />\n * </MCPToolsProvider>\n * ```\n *\n * @example Using the hook\n * ```tsx\n * const { tools, addSource, callTool } = useMCPTools()\n * await addSource('remote', { type: 'http', url: 'http://localhost:8888/mcp' })\n * ```\n */\nimport { Client } from '@modelcontextprotocol/sdk/client/index.js'\nimport { ToolListChangedNotificationSchema } from '@modelcontextprotocol/sdk/types.js'\nimport { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react'\n\nimport { MCP_TAB_CONNECT_DELAY_MS } from '../lib/constants'\nimport { createMCPTransport } from '../lib/mcp-transport'\n\nimport type {\n\tCallToolResult,\n\tMCPSource,\n\tMCPSourceConfig,\n\tPrompt,\n\tResource,\n\tResourceTemplate,\n\tToolWithSource,\n} from '@mcp-b/cloud-mirror-types'\nimport type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js'\nimport type { ReactNode } from 'react'\n\n/** Well-known source IDs */\nexport const SOURCE_LOCAL = 'local'\nexport const SOURCE_REMOTE = 'remote'\n\n/** Internal source state with client reference */\ninterface SourceState extends Omit<MCPSource, 'resources' | 'resourceTemplates' | 'prompts'> {\n\tclient: Client | null\n\ttransport: Transport | null\n\tresources: Resource[]\n\tresourceTemplates: ResourceTemplate[]\n\tprompts: Prompt[]\n}\n\n/**\n * MCP Tools Context Value\n */\nexport interface MCPToolsContextValue {\n\t/** All tools from all sources, tagged with _sourceId */\n\ttools: ToolWithSource[]\n\n\t/** All sources and their states */\n\tsources: Map<string, MCPSource>\n\n\t/** Add a new source */\n\taddSource: (id: string, config: MCPSourceConfig) => Promise<void>\n\n\t/** Remove a source */\n\tremoveSource: (id: string) => Promise<void>\n\n\t/** Get a specific source */\n\tgetSource: (id: string) => MCPSource | undefined\n\n\t/** Check if a source is connected */\n\tisConnected: (id: string) => boolean\n\n\t/** Call a tool (auto-routes based on tool name lookup) */\n\tcallTool: (name: string, args: Record<string, unknown>) => Promise<CallToolResult>\n\n\t/** Call a tool on a specific source */\n\tcallToolOnSource: (\n\t\tsourceId: string,\n\t\tname: string,\n\t\targs: Record<string, unknown>\n\t) => Promise<CallToolResult>\n}\n\nconst MCPToolsContext = createContext<MCPToolsContextValue | null>(null)\n\nexport interface MCPToolsProviderProps {\n\tchildren: ReactNode\n\t/** Auto-connect to same-tab source on mount (default: true) */\n\tautoConnectLocal?: boolean\n\t/** Callback when tools change */\n\tonToolsChange?: (tools: ToolWithSource[]) => void\n}\n\nexport function MCPToolsProvider({\n\tchildren,\n\tautoConnectLocal = true,\n\tonToolsChange,\n}: MCPToolsProviderProps) {\n\t// Sources map (internal state with client references)\n\tconst sourcesRef = useRef<Map<string, SourceState>>(new Map())\n\n\t// Trigger re-renders when sources change\n\tconst [, forceUpdate] = useState({})\n\n\t// Derived tools list\n\tconst [toolsList, setToolsList] = useState<ToolWithSource[]>([])\n\n\t/**\n\t * Rebuild tools list from all sources\n\t */\n\tconst rebuildTools = useCallback(() => {\n\t\tconst allTools: ToolWithSource[] = []\n\n\t\tsourcesRef.current.forEach((source) => {\n\t\t\tsource.tools.forEach((tool) => {\n\t\t\t\tallTools.push({\n\t\t\t\t\t...tool,\n\t\t\t\t\t_sourceId: source.id,\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\n\t\tsetToolsList(allTools)\n\t}, [])\n\n\t/**\n\t * Get public source state (without client reference)\n\t */\n\tconst getPublicSource = useCallback((source: SourceState): MCPSource => {\n\t\treturn {\n\t\t\tid: source.id,\n\t\t\tconfig: source.config,\n\t\t\tstate: source.state,\n\t\t\terror: source.error,\n\t\t\ttools: source.tools,\n\t\t\tresources: source.resources,\n\t\t\tresourceTemplates: source.resourceTemplates,\n\t\t\tprompts: source.prompts,\n\t\t}\n\t}, [])\n\n\t/**\n\t * Add a new source\n\t */\n\tconst addSource = useCallback(\n\t\tasync (id: string, config: MCPSourceConfig): Promise<void> => {\n\t\t\t// Remove existing source if any\n\t\t\tif (sourcesRef.current.has(id)) {\n\t\t\t\tawait removeSource(id)\n\t\t\t}\n\n\t\t\t// Create initial state\n\t\t\tconst sourceState: SourceState = {\n\t\t\t\tid,\n\t\t\t\tconfig,\n\t\t\t\tstate: 'connecting',\n\t\t\t\terror: null,\n\t\t\t\ttools: [],\n\t\t\t\tresources: [],\n\t\t\t\tresourceTemplates: [],\n\t\t\t\tprompts: [],\n\t\t\t\tclient: null,\n\t\t\t\ttransport: null,\n\t\t\t}\n\n\t\t\tsourcesRef.current.set(id, sourceState)\n\t\t\tforceUpdate({})\n\n\t\t\ttry {\n\t\t\t\t// Create client and transport\n\t\t\t\tconst client = new Client({\n\t\t\t\t\tname: `MCP-Source-${id}`,\n\t\t\t\t\tversion: '1.0.0',\n\t\t\t\t})\n\n\t\t\t\tconst transport = createMCPTransport(config)\n\n\t\t\t\t// Connect\n\t\t\t\tawait client.connect(transport)\n\n\t\t\t\t// Update state with client\n\t\t\t\tsourceState.client = client\n\t\t\t\tsourceState.transport = transport\n\n\t\t\t\t// Get initial tools\n\t\t\t\tconst { tools } = await client.listTools()\n\t\t\t\tsourceState.tools = tools\n\t\t\t\tsourceState.state = 'connected'\n\n\t\t\t\t// Listen for tool updates\n\t\t\t\tclient.setNotificationHandler(ToolListChangedNotificationSchema, async () => {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst updated = await client.listTools()\n\t\t\t\t\t\tsourceState.tools = updated.tools\n\t\t\t\t\t\trebuildTools()\n\t\t\t\t\t\tforceUpdate({})\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tconsole.error(`[MCPToolsProvider:${id}] Failed to update tools:`, err)\n\t\t\t\t\t}\n\t\t\t\t})\n\n\t\t\t\trebuildTools()\n\t\t\t\tforceUpdate({})\n\t\t\t} catch (err) {\n\t\t\t\tconst error = err instanceof Error ? err : new Error(String(err))\n\t\t\t\tconsole.error(`[MCPToolsProvider:${id}] Connection failed:`, error)\n\n\t\t\t\tsourceState.state = 'error'\n\t\t\t\tsourceState.error = error\n\t\t\t\tforceUpdate({})\n\t\t\t}\n\t\t},\n\t\t[rebuildTools]\n\t)\n\n\t/**\n\t * Remove a source\n\t */\n\tconst removeSource = useCallback(\n\t\tasync (id: string): Promise<void> => {\n\t\t\tconst source = sourcesRef.current.get(id)\n\t\t\tif (!source) return\n\n\t\t\t// Close client and transport\n\t\t\tif (source.client) {\n\t\t\t\ttry {\n\t\t\t\t\tawait source.client.close()\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconsole.error(`[MCPToolsProvider:${id}] Error closing client:`, err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (source.transport) {\n\t\t\t\ttry {\n\t\t\t\t\tawait source.transport.close()\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconsole.error(`[MCPToolsProvider:${id}] Error closing transport:`, err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tsourcesRef.current.delete(id)\n\t\t\trebuildTools()\n\t\t\tforceUpdate({})\n\t\t},\n\t\t[rebuildTools]\n\t)\n\n\t/**\n\t * Get a source by ID\n\t */\n\tconst getSource = useCallback(\n\t\t(id: string): MCPSource | undefined => {\n\t\t\tconst source = sourcesRef.current.get(id)\n\t\t\treturn source ? getPublicSource(source) : undefined\n\t\t},\n\t\t[getPublicSource]\n\t)\n\n\t/**\n\t * Check if a source is connected\n\t */\n\tconst isConnected = useCallback((id: string): boolean => {\n\t\tconst source = sourcesRef.current.get(id)\n\t\treturn source?.state === 'connected'\n\t}, [])\n\n\t/**\n\t * Call a tool on a specific source\n\t */\n\tconst callToolOnSource = useCallback(\n\t\tasync (\n\t\t\tsourceId: string,\n\t\t\tname: string,\n\t\t\targs: Record<string, unknown>\n\t\t): Promise<CallToolResult> => {\n\t\t\tconst source = sourcesRef.current.get(sourceId)\n\t\t\tif (!source?.client) {\n\t\t\t\tthrow new Error(`Source '${sourceId}' not connected`)\n\t\t\t}\n\n\t\t\treturn (await source.client.callTool({ name, arguments: args })) as CallToolResult\n\t\t},\n\t\t[]\n\t)\n\n\t/**\n\t * Call a tool (auto-routes based on tool name)\n\t */\n\tconst callTool = useCallback(\n\t\tasync (name: string, args: Record<string, unknown>): Promise<CallToolResult> => {\n\t\t\t// Find which source has this tool\n\t\t\tconst tool = toolsList.find((t) => t.name === name)\n\t\t\tif (!tool) {\n\t\t\t\tthrow new Error(`Tool '${name}' not found`)\n\t\t\t}\n\n\t\t\treturn callToolOnSource(tool._sourceId, name, args)\n\t\t},\n\t\t[toolsList, callToolOnSource]\n\t)\n\n\t/**\n\t * Get sources map for context (public view)\n\t */\n\tconst sources = useMemo(() => {\n\t\tconst publicSources = new Map<string, MCPSource>()\n\t\tsourcesRef.current.forEach((source) => {\n\t\t\tpublicSources.set(source.id, getPublicSource(source))\n\t\t})\n\t\treturn publicSources\n\t}, [toolsList, getPublicSource]) // Rebuild when tools change (which triggers on source changes)\n\n\t// Auto-connect to local source on mount\n\tuseEffect(() => {\n\t\tif (autoConnectLocal) {\n\t\t\tconst timer = setTimeout(() => {\n\t\t\t\tvoid addSource(SOURCE_LOCAL, { type: 'tab' })\n\t\t\t}, MCP_TAB_CONNECT_DELAY_MS)\n\t\t\treturn () => clearTimeout(timer)\n\t\t}\n\t}, [autoConnectLocal, addSource])\n\n\t// Notify on tools change\n\tuseEffect(() => {\n\t\tonToolsChange?.(toolsList)\n\t}, [toolsList, onToolsChange])\n\n\t// Cleanup on unmount\n\tuseEffect(() => {\n\t\tconst sources = sourcesRef\n\t\treturn () => {\n\t\t\tsources.current.forEach((source) => {\n\t\t\t\tif (source.client) {\n\t\t\t\t\tvoid source.client.close().catch(console.error)\n\t\t\t\t}\n\t\t\t\tif (source.transport) {\n\t\t\t\t\tvoid source.transport.close().catch(console.error)\n\t\t\t\t}\n\t\t\t})\n\t\t\tsources.current.clear()\n\t\t}\n\t}, [])\n\n\tconst value = useMemo<MCPToolsContextValue>(\n\t\t() => ({\n\t\t\ttools: toolsList,\n\t\t\tsources,\n\t\t\taddSource,\n\t\t\tremoveSource,\n\t\t\tgetSource,\n\t\t\tisConnected,\n\t\t\tcallTool,\n\t\t\tcallToolOnSource,\n\t\t}),\n\t\t[\n\t\t\ttoolsList,\n\t\t\tsources,\n\t\t\taddSource,\n\t\t\tremoveSource,\n\t\t\tgetSource,\n\t\t\tisConnected,\n\t\t\tcallTool,\n\t\t\tcallToolOnSource,\n\t\t]\n\t)\n\n\treturn <MCPToolsContext.Provider value={value}>{children}</MCPToolsContext.Provider>\n}\n\n/**\n * Hook to access MCP Tools context\n */\nexport function useMCPTools(): MCPToolsContextValue {\n\tconst context = useContext(MCPToolsContext)\n\tif (!context) {\n\t\tthrow new Error('useMCPTools must be used within an MCPToolsProvider')\n\t}\n\treturn context\n}\n\n/**\n * Hook to optionally access MCP Tools context\n */\nexport function useOptionalMCPTools(): MCPToolsContextValue | null {\n\treturn useContext(MCPToolsContext)\n}\n","/**\n * Remote MCP Settings\n *\n * A dialog component for managing remote MCP server connections.\n * Allows users to add, connect, and disconnect from remote MCP servers.\n */\n\nimport { Loader2, Plug, Plus, X } from 'lucide-react'\nimport { useCallback, useState } from 'react'\n\nimport { cn } from '../lib/utils'\nimport { SOURCE_REMOTE, useMCPTools } from '../providers/MCPToolsProvider'\nimport { Button } from './button'\nimport {\n\tDialog,\n\tDialogContent,\n\tDialogDescription,\n\tDialogHeader,\n\tDialogTitle,\n\tDialogTrigger,\n} from './dialog'\nimport { TooltipIconButton } from './tooltip-icon-button'\n\nimport type { FC } from 'react'\n\ninterface RemoteServer {\n\tid: string\n\turl: string\n}\n\nexport const RemoteMCPSettings: FC = () => {\n\tconst { sources, addSource, removeSource } = useMCPTools()\n\tconst [isOpen, setIsOpen] = useState(false)\n\tconst [url, setUrl] = useState('')\n\tconst [isConnecting, setIsConnecting] = useState(false)\n\tconst [error, setError] = useState<string | null>(null)\n\n\t// Get connected remote servers\n\tconst remoteServers: RemoteServer[] = []\n\tsources.forEach((source, id) => {\n\t\tif (source.config.type === 'http' && id !== 'local') {\n\t\t\tremoteServers.push({ id, url: source.config.url })\n\t\t}\n\t})\n\n\tconst handleConnect = useCallback(async () => {\n\t\tif (!url.trim()) {\n\t\t\tsetError('Please enter a URL')\n\t\t\treturn\n\t\t}\n\n\t\t// Validate URL\n\t\ttry {\n\t\t\tnew URL(url)\n\t\t} catch {\n\t\t\tsetError('Please enter a valid URL')\n\t\t\treturn\n\t\t}\n\n\t\tsetIsConnecting(true)\n\t\tsetError(null)\n\n\t\ttry {\n\t\t\t// Generate a unique ID for this server\n\t\t\tconst serverId = remoteServers.length === 0 ? SOURCE_REMOTE : `remote-${Date.now()}`\n\t\t\tawait addSource(serverId, { type: 'http', url })\n\t\t\tsetUrl('')\n\t\t} catch (err) {\n\t\t\tsetError(err instanceof Error ? err.message : 'Failed to connect')\n\t\t} finally {\n\t\t\tsetIsConnecting(false)\n\t\t}\n\t}, [url, addSource, remoteServers.length])\n\n\tconst handleDisconnect = useCallback(\n\t\tasync (serverId: string) => {\n\t\t\tawait removeSource(serverId)\n\t\t},\n\t\t[removeSource]\n\t)\n\n\tconst handleKeyDown = useCallback(\n\t\t(e: React.KeyboardEvent) => {\n\t\t\tif (e.key === 'Enter' && !isConnecting) {\n\t\t\t\tvoid handleConnect()\n\t\t\t}\n\t\t},\n\t\t[handleConnect, isConnecting]\n\t)\n\n\t// Count connected servers\n\tconst connectedCount = remoteServers.filter((s) => {\n\t\tconst source = sources.get(s.id)\n\t\treturn source?.state === 'connected'\n\t}).length\n\n\treturn (\n\t\t<Dialog open={isOpen} onOpenChange={setIsOpen}>\n\t\t\t<DialogTrigger asChild>\n\t\t\t\t<TooltipIconButton\n\t\t\t\t\ttooltip=\"Connect MCP Server\"\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'gap-2 rounded-full text-muted-foreground hover:text-foreground',\n\t\t\t\t\t\tconnectedCount > 0 && 'text-green-600 dark:text-green-400'\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t<Plug className=\"h-4 w-4\" />\n\t\t\t\t\t{connectedCount > 0 && <span className=\"text-xs\">{connectedCount}</span>}\n\t\t\t\t</TooltipIconButton>\n\t\t\t</DialogTrigger>\n\t\t\t<DialogContent className=\"sm:max-w-md\">\n\t\t\t\t<DialogHeader>\n\t\t\t\t\t<DialogTitle>Remote MCP Servers</DialogTitle>\n\t\t\t\t\t<DialogDescription>\n\t\t\t\t\t\tConnect to remote MCP servers to access their tools, resources, and prompts.\n\t\t\t\t\t</DialogDescription>\n\t\t\t\t</DialogHeader>\n\n\t\t\t\t<div className=\"space-y-4\">\n\t\t\t\t\t{/* URL Input */}\n\t\t\t\t\t<div className=\"space-y-2\">\n\t\t\t\t\t\t<label htmlFor=\"mcp-url\" className=\"text-sm font-medium\">\n\t\t\t\t\t\t\tServer URL\n\t\t\t\t\t\t</label>\n\t\t\t\t\t\t<div className=\"flex gap-2\">\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tid=\"mcp-url\"\n\t\t\t\t\t\t\t\ttype=\"url\"\n\t\t\t\t\t\t\t\tvalue={url}\n\t\t\t\t\t\t\t\tonChange={(e) => setUrl(e.target.value)}\n\t\t\t\t\t\t\t\tonKeyDown={handleKeyDown}\n\t\t\t\t\t\t\t\tplaceholder=\"https://mcp.example.com/sse\"\n\t\t\t\t\t\t\t\tdisabled={isConnecting}\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t'flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm transition-colors',\n\t\t\t\t\t\t\t\t\t'placeholder:text-muted-foreground',\n\t\t\t\t\t\t\t\t\t'focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring',\n\t\t\t\t\t\t\t\t\t'disabled:cursor-not-allowed disabled:opacity-50'\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tonClick={() => void handleConnect()}\n\t\t\t\t\t\t\t\tdisabled={isConnecting || !url.trim()}\n\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\tclassName=\"shrink-0\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{isConnecting ? (\n\t\t\t\t\t\t\t\t\t<Loader2 className=\"h-4 w-4 animate-spin\" />\n\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t<Plus className=\"h-4 w-4\" />\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{error && <p className=\"text-xs text-destructive\">{error}</p>}\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{/* Connected Servers List */}\n\t\t\t\t\t{remoteServers.length > 0 && (\n\t\t\t\t\t\t<div className=\"space-y-2\">\n\t\t\t\t\t\t\t<label className=\"text-sm font-medium\">Connected Servers</label>\n\t\t\t\t\t\t\t<div className=\"space-y-2\">\n\t\t\t\t\t\t\t\t{remoteServers.map((server) => {\n\t\t\t\t\t\t\t\t\tconst source = sources.get(server.id)\n\t\t\t\t\t\t\t\t\tconst isConnected = source?.state === 'connected'\n\t\t\t\t\t\t\t\t\tconst isLoading = source?.state === 'connecting'\n\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tkey={server.id}\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"flex items-center gap-2 rounded-md border border-border bg-muted/50 px-3 py-2\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{/* Status indicator */}\n\t\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t\t\t\t\t'h-2 w-2 shrink-0 rounded-full',\n\t\t\t\t\t\t\t\t\t\t\t\t\tisConnected && 'bg-green-500',\n\t\t\t\t\t\t\t\t\t\t\t\t\tisLoading && 'bg-yellow-500 animate-pulse',\n\t\t\t\t\t\t\t\t\t\t\t\t\tsource?.state === 'error' && 'bg-red-500'\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t\t\t\t{/* URL */}\n\t\t\t\t\t\t\t\t\t\t\t<span className=\"flex-1 truncate text-xs text-muted-foreground\">\n\t\t\t\t\t\t\t\t\t\t\t\t{server.url}\n\t\t\t\t\t\t\t\t\t\t\t</span>\n\n\t\t\t\t\t\t\t\t\t\t\t{/* Tools count */}\n\t\t\t\t\t\t\t\t\t\t\t{isConnected && source && (\n\t\t\t\t\t\t\t\t\t\t\t\t<span className=\"text-xs text-muted-foreground\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t{source.tools.length} tools\n\t\t\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t\t\t\t\t\t{/* Disconnect button */}\n\t\t\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={() => void handleDisconnect(server.id)}\n\t\t\t\t\t\t\t\t\t\t\t\tclassName=\"shrink-0 rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive\"\n\t\t\t\t\t\t\t\t\t\t\t\taria-label=\"Disconnect server\"\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{isLoading ? (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<Loader2 className=\"h-3 w-3 animate-spin\" />\n\t\t\t\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t\t\t\t<X className=\"h-3 w-3\" />\n\t\t\t\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{/* Help text */}\n\t\t\t\t\t<p className=\"text-xs text-muted-foreground\">\n\t\t\t\t\t\tEnter the URL of an MCP server that supports the Streamable HTTP transport (SSE).\n\t\t\t\t\t</p>\n\t\t\t\t</div>\n\t\t\t</DialogContent>\n\t\t</Dialog>\n\t)\n}\n","import { CheckIcon, ChevronDownIcon, ChevronUpIcon } from 'lucide-react'\nimport { useState } from 'react'\n\nimport { Button } from './button'\n\nimport type { ToolCallMessagePartComponent } from '@assistant-ui/react'\n\nexport const ToolFallback: ToolCallMessagePartComponent = ({ toolName, argsText, result }) => {\n\tconst [isCollapsed, setIsCollapsed] = useState(true)\n\treturn (\n\t\t<div className=\"aui-tool-fallback-root mb-3 flex w-full flex-col gap-2 rounded-xl border border-border/20 bg-muted/5 py-2\">\n\t\t\t<div className=\"aui-tool-fallback-header flex items-center gap-2 px-3\">\n\t\t\t\t<CheckIcon className=\"aui-tool-fallback-icon size-3.5 text-emerald-500\" />\n\t\t\t\t<p className=\"aui-tool-fallback-title flex-grow text-sm font-medium\">{toolName}</p>\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\tclassName=\"h-6 w-6 p-0\"\n\t\t\t\t\tonClick={() => setIsCollapsed(!isCollapsed)}\n\t\t\t\t>\n\t\t\t\t\t{isCollapsed ? (\n\t\t\t\t\t\t<ChevronUpIcon className=\"size-3.5\" />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<ChevronDownIcon className=\"size-3.5\" />\n\t\t\t\t\t)}\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t\t{!isCollapsed && (\n\t\t\t\t<div className=\"aui-tool-fallback-content flex flex-col gap-2 border-t border-border/20 pt-2\">\n\t\t\t\t\t<div className=\"aui-tool-fallback-args-root px-3\">\n\t\t\t\t\t\t<span className=\"text-[10px] font-medium uppercase tracking-wide text-muted-foreground/70\">\n\t\t\t\t\t\t\tInput\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<pre className=\"aui-tool-fallback-args-value mt-1 max-h-40 overflow-auto rounded-lg bg-muted/30 px-2 py-1.5 font-mono text-[11px] leading-relaxed text-foreground/80 whitespace-pre-wrap\">\n\t\t\t\t\t\t\t{argsText}\n\t\t\t\t\t\t</pre>\n\t\t\t\t\t</div>\n\t\t\t\t\t{result !== undefined && (\n\t\t\t\t\t\t<div className=\"aui-tool-fallback-result-root border-t border-dashed border-border/20 px-3 pt-2\">\n\t\t\t\t\t\t\t<span className=\"text-[10px] font-medium uppercase tracking-wide text-muted-foreground/70\">\n\t\t\t\t\t\t\t\tOutput\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<pre className=\"aui-tool-fallback-result-content mt-1 max-h-60 overflow-auto rounded-lg bg-muted/30 px-2 py-1.5 font-mono text-[11px] leading-relaxed text-foreground/80 whitespace-pre-wrap\">\n\t\t\t\t\t\t\t\t{typeof result === 'string' ? result : JSON.stringify(result, null, 2)}\n\t\t\t\t\t\t\t</pre>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n","import { useEffect, useRef } from 'react'\n\nimport { cn } from '../lib/utils'\n\nimport type { HTMLAttributes } from 'react'\n\nexport type LiveWaveformProps = HTMLAttributes<HTMLDivElement> & {\n\tactive?: boolean\n\tprocessing?: boolean\n\tbarWidth?: number\n\tbarGap?: number\n\tbarRadius?: number\n\tbarColor?: string\n\tfadeEdges?: boolean\n\tfadeWidth?: number\n\theight?: string | number\n\tsensitivity?: number\n\tsmoothingTimeConstant?: number\n\tmode?: 'scrolling' | 'static'\n\t/** Manual audio level (0-1) instead of using microphone */\n\tmanualAudioLevel?: number\n}\n\nexport const LiveWaveform = ({\n\tactive = false,\n\tprocessing = false,\n\tbarWidth = 3,\n\tbarGap = 1,\n\tbarRadius = 1.5,\n\tbarColor,\n\tfadeEdges = true,\n\tfadeWidth = 24,\n\theight = 64,\n\tsensitivity = 1,\n\tmode = 'static',\n\tmanualAudioLevel,\n\tclassName,\n\t...props\n}: LiveWaveformProps) => {\n\tconst canvasRef = useRef<HTMLCanvasElement>(null)\n\tconst containerRef = useRef<HTMLDivElement>(null)\n\tconst historyRef = useRef<number[]>([])\n\tconst _animationRef = useRef<number>(0)\n\tconst lastUpdateRef = useRef<number>(0)\n\tconst processingAnimationRef = useRef<number | null>(null)\n\tconst lastActiveDataRef = useRef<number[]>([])\n\tconst transitionProgressRef = useRef(0)\n\tconst staticBarsRef = useRef<number[]>([])\n\tconst needsRedrawRef = useRef(true)\n\tconst gradientCacheRef = useRef<CanvasGradient | null>(null)\n\tconst lastWidthRef = useRef(0)\n\n\tconst heightStyle = typeof height === 'number' ? `${height}px` : height\n\tconst historySize = 60\n\tconst updateRate = 30\n\n\t// Handle canvas resizing\n\tuseEffect(() => {\n\t\tconst canvas = canvasRef.current\n\t\tconst container = containerRef.current\n\t\tif (!canvas || !container) return\n\n\t\tconst resizeObserver = new ResizeObserver(() => {\n\t\t\tconst rect = container.getBoundingClientRect()\n\t\t\tconst dpr = window.devicePixelRatio || 1\n\n\t\t\tcanvas.width = rect.width * dpr\n\t\t\tcanvas.height = rect.height * dpr\n\t\t\tcanvas.style.width = `${rect.width}px`\n\t\t\tcanvas.style.height = `${rect.height}px`\n\n\t\t\tconst ctx = canvas.getContext('2d')\n\t\t\tif (ctx) {\n\t\t\t\tctx.scale(dpr, dpr)\n\t\t\t}\n\n\t\t\tgradientCacheRef.current = null\n\t\t\tlastWidthRef.current = rect.width\n\t\t\tneedsRedrawRef.current = true\n\t\t})\n\n\t\tresizeObserver.observe(container)\n\t\treturn () => resizeObserver.disconnect()\n\t}, [])\n\n\t// Processing animation effect\n\tuseEffect(() => {\n\t\tif (processing && !active) {\n\t\t\tlet time = 0\n\t\t\ttransitionProgressRef.current = 0\n\n\t\t\tconst animateProcessing = () => {\n\t\t\t\ttime += 0.03\n\t\t\t\ttransitionProgressRef.current = Math.min(1, transitionProgressRef.current + 0.02)\n\n\t\t\t\tconst processingData: number[] = []\n\t\t\t\tconst barCount = Math.floor(\n\t\t\t\t\t(containerRef.current?.getBoundingClientRect().width || 200) / (barWidth + barGap)\n\t\t\t\t)\n\n\t\t\t\tif (mode === 'static') {\n\t\t\t\t\tconst halfCount = Math.floor(barCount / 2)\n\n\t\t\t\t\tfor (let i = 0; i < barCount; i++) {\n\t\t\t\t\t\tconst normalizedPosition = (i - halfCount) / halfCount\n\t\t\t\t\t\tconst centerWeight = 1 - Math.abs(normalizedPosition) * 0.4\n\n\t\t\t\t\t\tconst wave1 = Math.sin(time * 1.5 + normalizedPosition * 3) * 0.25\n\t\t\t\t\t\tconst wave2 = Math.sin(time * 0.8 - normalizedPosition * 2) * 0.2\n\t\t\t\t\t\tconst wave3 = Math.cos(time * 2 + normalizedPosition) * 0.15\n\t\t\t\t\t\tconst combinedWave = wave1 + wave2 + wave3\n\t\t\t\t\t\tconst processingValue = (0.2 + combinedWave) * centerWeight\n\n\t\t\t\t\t\tlet finalValue = processingValue\n\t\t\t\t\t\tif (lastActiveDataRef.current.length > 0 && transitionProgressRef.current < 1) {\n\t\t\t\t\t\t\tconst lastDataIndex = Math.min(i, lastActiveDataRef.current.length - 1)\n\t\t\t\t\t\t\tconst lastValue = lastActiveDataRef.current[lastDataIndex] || 0\n\t\t\t\t\t\t\tfinalValue =\n\t\t\t\t\t\t\t\tlastValue * (1 - transitionProgressRef.current) +\n\t\t\t\t\t\t\t\tprocessingValue * transitionProgressRef.current\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tprocessingData.push(Math.max(0.05, Math.min(1, finalValue)))\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfor (let i = 0; i < barCount; i++) {\n\t\t\t\t\t\tconst normalizedPosition = (i - barCount / 2) / (barCount / 2)\n\t\t\t\t\t\tconst centerWeight = 1 - Math.abs(normalizedPosition) * 0.4\n\n\t\t\t\t\t\tconst wave1 = Math.sin(time * 1.5 + i * 0.15) * 0.25\n\t\t\t\t\t\tconst wave2 = Math.sin(time * 0.8 - i * 0.1) * 0.2\n\t\t\t\t\t\tconst wave3 = Math.cos(time * 2 + i * 0.05) * 0.15\n\t\t\t\t\t\tconst combinedWave = wave1 + wave2 + wave3\n\t\t\t\t\t\tconst processingValue = (0.2 + combinedWave) * centerWeight\n\n\t\t\t\t\t\tlet finalValue = processingValue\n\t\t\t\t\t\tif (lastActiveDataRef.current.length > 0 && transitionProgressRef.current < 1) {\n\t\t\t\t\t\t\tconst lastDataIndex = Math.floor((i / barCount) * lastActiveDataRef.current.length)\n\t\t\t\t\t\t\tconst lastValue = lastActiveDataRef.current[lastDataIndex] || 0\n\t\t\t\t\t\t\tfinalValue =\n\t\t\t\t\t\t\t\tlastValue * (1 - transitionProgressRef.current) +\n\t\t\t\t\t\t\t\tprocessingValue * transitionProgressRef.current\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tprocessingData.push(Math.max(0.05, Math.min(1, finalValue)))\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (mode === 'static') {\n\t\t\t\t\tstaticBarsRef.current = processingData\n\t\t\t\t} else {\n\t\t\t\t\thistoryRef.current = processingData\n\t\t\t\t}\n\n\t\t\t\tneedsRedrawRef.current = true\n\t\t\t\tprocessingAnimationRef.current = requestAnimationFrame(animateProcessing)\n\t\t\t}\n\n\t\t\tanimateProcessing()\n\n\t\t\treturn () => {\n\t\t\t\tif (processingAnimationRef.current) {\n\t\t\t\t\tcancelAnimationFrame(processingAnimationRef.current)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (!active && !processing) {\n\t\t\tconst hasData =\n\t\t\t\tmode === 'static' ? staticBarsRef.current.length > 0 : historyRef.current.length > 0\n\n\t\t\tif (hasData) {\n\t\t\t\tlet fadeProgress = 0\n\t\t\t\tconst fadeToIdle = () => {\n\t\t\t\t\tfadeProgress += 0.03\n\t\t\t\t\tif (fadeProgress < 1) {\n\t\t\t\t\t\tif (mode === 'static') {\n\t\t\t\t\t\t\tstaticBarsRef.current = staticBarsRef.current.map(\n\t\t\t\t\t\t\t\t(value) => value * (1 - fadeProgress)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\thistoryRef.current = historyRef.current.map((value) => value * (1 - fadeProgress))\n\t\t\t\t\t\t}\n\t\t\t\t\t\tneedsRedrawRef.current = true\n\t\t\t\t\t\trequestAnimationFrame(fadeToIdle)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (mode === 'static') {\n\t\t\t\t\t\t\tstaticBarsRef.current = []\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\thistoryRef.current = []\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfadeToIdle()\n\t\t\t}\n\t\t}\n\t}, [processing, active, barWidth, barGap, mode])\n\n\t// Animation loop\n\tuseEffect(() => {\n\t\tconst canvas = canvasRef.current\n\t\tif (!canvas) return\n\n\t\tconst ctx = canvas.getContext('2d')\n\t\tif (!ctx) return\n\n\t\tlet rafId: number\n\n\t\tconst animate = (currentTime: number) => {\n\t\t\tconst rect = canvas.getBoundingClientRect()\n\n\t\t\t// Update audio data if active\n\t\t\tif (active && currentTime - lastUpdateRef.current > updateRate) {\n\t\t\t\tlastUpdateRef.current = currentTime\n\n\t\t\t\t// Use manual audio level if provided\n\t\t\t\tif (manualAudioLevel !== undefined) {\n\t\t\t\t\tconst level = Math.max(0.05, Math.min(1, manualAudioLevel * sensitivity))\n\n\t\t\t\t\tif (mode === 'static') {\n\t\t\t\t\t\tconst barCount = Math.floor(rect.width / (barWidth + barGap))\n\t\t\t\t\t\tconst halfCount = Math.floor(barCount / 2)\n\t\t\t\t\t\tconst newBars: number[] = []\n\n\t\t\t\t\t\t// Create symmetric bars based on manual level\n\t\t\t\t\t\tfor (let i = halfCount - 1; i >= 0; i--) {\n\t\t\t\t\t\t\tconst distanceFromCenter = Math.abs(i - halfCount / 2) / (halfCount / 2)\n\t\t\t\t\t\t\tconst value = level * (1 - distanceFromCenter * 0.3)\n\t\t\t\t\t\t\tnewBars.push(Math.max(0.05, value))\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor (let i = 0; i < halfCount; i++) {\n\t\t\t\t\t\t\tconst distanceFromCenter = Math.abs(i - halfCount / 2) / (halfCount / 2)\n\t\t\t\t\t\t\tconst value = level * (1 - distanceFromCenter * 0.3)\n\t\t\t\t\t\t\tnewBars.push(Math.max(0.05, value))\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tstaticBarsRef.current = newBars\n\t\t\t\t\t\tlastActiveDataRef.current = newBars\n\t\t\t\t\t} else {\n\t\t\t\t\t\thistoryRef.current.push(level)\n\t\t\t\t\t\tlastActiveDataRef.current = [...historyRef.current]\n\n\t\t\t\t\t\tif (historyRef.current.length > historySize) {\n\t\t\t\t\t\t\thistoryRef.current.shift()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tneedsRedrawRef.current = true\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Only redraw if needed\n\t\t\tif (!needsRedrawRef.current && !active) {\n\t\t\t\trafId = requestAnimationFrame(animate)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tneedsRedrawRef.current = active\n\t\t\tctx.clearRect(0, 0, rect.width, rect.height)\n\n\t\t\tconst computedBarColor =\n\t\t\t\tbarColor ||\n\t\t\t\t(() => {\n\t\t\t\t\tconst style = getComputedStyle(canvas)\n\t\t\t\t\tconst color = style.color\n\t\t\t\t\treturn color || '#000'\n\t\t\t\t})()\n\n\t\t\tconst step = barWidth + barGap\n\t\t\tconst barCount = Math.floor(rect.width / step)\n\t\t\tconst centerY = rect.height / 2\n\n\t\t\t// Draw bars based on mode\n\t\t\tif (mode === 'static') {\n\t\t\t\tconst dataToRender = processing\n\t\t\t\t\t? staticBarsRef.current\n\t\t\t\t\t: active\n\t\t\t\t\t\t? staticBarsRef.current\n\t\t\t\t\t\t: staticBarsRef.current.length > 0\n\t\t\t\t\t\t\t? staticBarsRef.current\n\t\t\t\t\t\t\t: []\n\n\t\t\t\tfor (let i = 0; i < barCount && i < dataToRender.length; i++) {\n\t\t\t\t\tconst value = dataToRender[i] || 0.1\n\t\t\t\t\tconst x = i * step\n\t\t\t\t\tconst barHeight = Math.max(4, value * rect.height * 0.8)\n\t\t\t\t\tconst y = centerY - barHeight / 2\n\n\t\t\t\t\tctx.fillStyle = computedBarColor\n\t\t\t\t\tctx.globalAlpha = 0.4 + value * 0.6\n\n\t\t\t\t\tif (barRadius > 0) {\n\t\t\t\t\t\tctx.beginPath()\n\t\t\t\t\t\tctx.roundRect(x, y, barWidth, barHeight, barRadius)\n\t\t\t\t\t\tctx.fill()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tctx.fillRect(x, y, barWidth, barHeight)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Scrolling mode\n\t\t\t\tfor (let i = 0; i < barCount && i < historyRef.current.length; i++) {\n\t\t\t\t\tconst dataIndex = historyRef.current.length - 1 - i\n\t\t\t\t\tconst value = historyRef.current[dataIndex] || 0.1\n\t\t\t\t\tconst x = rect.width - (i + 1) * step\n\t\t\t\t\tconst barHeight = Math.max(4, value * rect.height * 0.8)\n\t\t\t\t\tconst y = centerY - barHeight / 2\n\n\t\t\t\t\tctx.fillStyle = computedBarColor\n\t\t\t\t\tctx.globalAlpha = 0.4 + value * 0.6\n\n\t\t\t\t\tif (barRadius > 0) {\n\t\t\t\t\t\tctx.beginPath()\n\t\t\t\t\t\tctx.roundRect(x, y, barWidth, barHeight, barRadius)\n\t\t\t\t\t\tctx.fill()\n\t\t\t\t\t} else {\n\t\t\t\t\t\tctx.fillRect(x, y, barWidth, barHeight)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Apply edge fading\n\t\t\tif (fadeEdges && fadeWidth > 0 && rect.width > 0) {\n\t\t\t\tif (!gradientCacheRef.current || lastWidthRef.current !== rect.width) {\n\t\t\t\t\tconst gradient = ctx.createLinearGradient(0, 0, rect.width, 0)\n\t\t\t\t\tconst fadePercent = Math.min(0.3, fadeWidth / rect.width)\n\n\t\t\t\t\tgradient.addColorStop(0, 'rgba(255,255,255,1)')\n\t\t\t\t\tgradient.addColorStop(fadePercent, 'rgba(255,255,255,0)')\n\t\t\t\t\tgradient.addColorStop(1 - fadePercent, 'rgba(255,255,255,0)')\n\t\t\t\t\tgradient.addColorStop(1, 'rgba(255,255,255,1)')\n\n\t\t\t\t\tgradientCacheRef.current = gradient\n\t\t\t\t\tlastWidthRef.current = rect.width\n\t\t\t\t}\n\n\t\t\t\tctx.globalCompositeOperation = 'destination-out'\n\t\t\t\tctx.fillStyle = gradientCacheRef.current\n\t\t\t\tctx.fillRect(0, 0, rect.width, rect.height)\n\t\t\t\tctx.globalCompositeOperation = 'source-over'\n\t\t\t}\n\n\t\t\tctx.globalAlpha = 1\n\n\t\t\trafId = requestAnimationFrame(animate)\n\t\t}\n\n\t\trafId = requestAnimationFrame(animate)\n\n\t\treturn () => {\n\t\t\tif (rafId) {\n\t\t\t\tcancelAnimationFrame(rafId)\n\t\t\t}\n\t\t}\n\t}, [\n\t\tactive,\n\t\tprocessing,\n\t\tsensitivity,\n\t\tbarWidth,\n\t\tbarGap,\n\t\tbarRadius,\n\t\tbarColor,\n\t\tfadeEdges,\n\t\tfadeWidth,\n\t\tmode,\n\t\tmanualAudioLevel,\n\t\thistorySize,\n\t\tupdateRate,\n\t])\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cn('relative h-full w-full', className)}\n\t\t\tref={containerRef}\n\t\t\tstyle={{ height: heightStyle }}\n\t\t\taria-label={\n\t\t\t\tactive ? 'Live audio waveform' : processing ? 'Processing audio' : 'Audio waveform idle'\n\t\t\t}\n\t\t\trole=\"img\"\n\t\t\t{...props}\n\t\t>\n\t\t\t{!active && !processing && (\n\t\t\t\t<div className=\"border-muted-foreground/20 absolute top-1/2 right-0 left-0 -translate-y-1/2 border-t-2 border-dotted\" />\n\t\t\t)}\n\t\t\t<canvas className=\"block h-full w-full\" ref={canvasRef} />\n\t\t</div>\n\t)\n}\n","import { Mic, MicOff, Phone, PhoneOff, Volume2 } from 'lucide-react'\n\nimport { cn } from '../lib/utils'\nimport { Button } from './button'\nimport { LiveWaveform } from './live-waveform'\n\nimport type { AudioLevelData, ToolCallData } from '../services/realtime'\n\nexport interface VoiceIndicatorProps {\n\tisActive: boolean\n\tisConnecting: boolean\n\tisMuted: boolean\n\taudioLevel?: AudioLevelData\n\ttoolCall?: ToolCallData\n\tonStart: () => void\n\tonStop: () => void\n\tonToggleMute: () => void\n\tclassName?: string\n}\n\nexport function VoiceIndicator({\n\tisActive,\n\tisConnecting,\n\tisMuted,\n\taudioLevel,\n\ttoolCall,\n\tonStart,\n\tonStop,\n\tonToggleMute,\n\tclassName,\n}: VoiceIndicatorProps) {\n\tconst micLevel = audioLevel?.micLevel ?? 0\n\tconst speakerLevel = audioLevel?.speakerLevel ?? 0\n\n\t// Determine tool call status for border styling\n\tconst toolCallStatus =\n\t\ttoolCall?.status === 'started'\n\t\t\t? 'calling'\n\t\t\t: toolCall?.status === 'completed'\n\t\t\t\t? toolCall.error\n\t\t\t\t\t? 'error'\n\t\t\t\t\t: 'success'\n\t\t\t\t: 'idle'\n\n\t// Get border style based on tool call status\n\tconst getBorderClass = () => {\n\t\tswitch (toolCallStatus) {\n\t\t\tcase 'calling':\n\t\t\t\treturn 'border-blue-500/60 shadow-[0_0_12px_rgba(59,130,246,0.3)]'\n\t\t\tcase 'success':\n\t\t\t\treturn 'border-green-500/60 shadow-[0_0_12px_rgba(34,197,94,0.3)]'\n\t\t\tcase 'error':\n\t\t\t\treturn 'border-red-500/60 shadow-[0_0_12px_rgba(239,68,68,0.3)]'\n\t\t\tdefault:\n\t\t\t\treturn 'border-border'\n\t\t}\n\t}\n\n\tif (!isActive && !isConnecting) {\n\t\t// Collapsed state - just show start button\n\t\treturn (\n\t\t\t<div className={cn('flex items-center', className)}>\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\tonClick={onStart}\n\t\t\t\t\tclassName=\"gap-2 rounded-full\"\n\t\t\t\t\taria-label=\"Start voice session\"\n\t\t\t\t>\n\t\t\t\t\t<Phone className=\"h-4 w-4\" />\n\t\t\t\t\t<span className=\"text-xs\">Voice</span>\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t)\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclassName={cn(\n\t\t\t\t'flex items-center gap-3 rounded-full border bg-background/95 px-3 py-2 backdrop-blur-sm transition-all duration-300',\n\t\t\t\tgetBorderClass(),\n\t\t\t\tclassName\n\t\t\t)}\n\t\t>\n\t\t\t{/* User microphone indicator */}\n\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t<div\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'flex h-8 w-8 items-center justify-center rounded-full transition-colors',\n\t\t\t\t\t\tisMuted ? 'bg-muted text-muted-foreground' : 'bg-primary/10 text-primary'\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{isMuted ? <MicOff className=\"h-4 w-4\" /> : <Mic className=\"h-4 w-4\" />}\n\t\t\t\t</div>\n\t\t\t\t<div className=\"h-6 w-16\">\n\t\t\t\t\t<LiveWaveform\n\t\t\t\t\t\tactive={isActive && !isMuted}\n\t\t\t\t\t\tprocessing={isConnecting}\n\t\t\t\t\t\tmanualAudioLevel={micLevel}\n\t\t\t\t\t\tbarWidth={2}\n\t\t\t\t\t\tbarGap={1}\n\t\t\t\t\t\tbarRadius={2}\n\t\t\t\t\t\tbarColor=\"hsl(var(--primary))\"\n\t\t\t\t\t\theight={24}\n\t\t\t\t\t\tmode=\"static\"\n\t\t\t\t\t\tsensitivity={2.0}\n\t\t\t\t\t\tfadeEdges={false}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t{/* Separator */}\n\t\t\t<div className=\"h-6 w-px bg-border\" />\n\n\t\t\t{/* Agent speaker indicator */}\n\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t<div className=\"h-6 w-16\">\n\t\t\t\t\t<LiveWaveform\n\t\t\t\t\t\tactive={isActive}\n\t\t\t\t\t\tprocessing={isConnecting}\n\t\t\t\t\t\tmanualAudioLevel={speakerLevel}\n\t\t\t\t\t\tbarWidth={2}\n\t\t\t\t\t\tbarGap={1}\n\t\t\t\t\t\tbarRadius={2}\n\t\t\t\t\t\tbarColor=\"hsl(var(--muted-foreground))\"\n\t\t\t\t\t\theight={24}\n\t\t\t\t\t\tmode=\"static\"\n\t\t\t\t\t\tsensitivity={2.0}\n\t\t\t\t\t\tfadeEdges={false}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t\t<div\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'flex h-8 w-8 items-center justify-center rounded-full bg-muted text-muted-foreground'\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t<Volume2 className=\"h-4 w-4\" />\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t{/* Separator */}\n\t\t\t<div className=\"h-6 w-px bg-border\" />\n\n\t\t\t{/* Controls */}\n\t\t\t<div className=\"flex items-center gap-1\">\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\tonClick={onToggleMute}\n\t\t\t\t\tdisabled={!isActive}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'h-8 w-8 rounded-full',\n\t\t\t\t\t\tisMuted && 'text-destructive hover:text-destructive'\n\t\t\t\t\t)}\n\t\t\t\t\taria-label={isMuted ? 'Unmute microphone' : 'Mute microphone'}\n\t\t\t\t>\n\t\t\t\t\t{isMuted ? <MicOff className=\"h-4 w-4\" /> : <Mic className=\"h-4 w-4\" />}\n\t\t\t\t</Button>\n\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\tonClick={onStop}\n\t\t\t\t\tclassName=\"h-8 w-8 rounded-full text-destructive hover:bg-destructive/10 hover:text-destructive\"\n\t\t\t\t\taria-label=\"End voice session\"\n\t\t\t\t>\n\t\t\t\t\t<PhoneOff className=\"h-4 w-4\" />\n\t\t\t\t</Button>\n\t\t\t</div>\n\n\t\t\t{/* Tool call indicator */}\n\t\t\t{toolCall && toolCallStatus !== 'idle' && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'ml-1 flex items-center gap-1 rounded-full px-2 py-0.5 text-xs',\n\t\t\t\t\t\ttoolCallStatus === 'calling' && 'bg-blue-500/10 text-blue-600',\n\t\t\t\t\t\ttoolCallStatus === 'success' && 'bg-green-500/10 text-green-600',\n\t\t\t\t\t\ttoolCallStatus === 'error' && 'bg-red-500/10 text-red-600'\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'h-1.5 w-1.5 rounded-full',\n\t\t\t\t\t\t\ttoolCallStatus === 'calling' && 'animate-pulse bg-blue-500',\n\t\t\t\t\t\t\ttoolCallStatus === 'success' && 'bg-green-500',\n\t\t\t\t\t\t\ttoolCallStatus === 'error' && 'bg-red-500'\n\t\t\t\t\t\t)}\n\t\t\t\t\t/>\n\t\t\t\t\t<span className=\"max-w-[80px] truncate\">{toolCall.toolName}</span>\n\t\t\t\t</div>\n\t\t\t)}\n\n\t\t\t{/* Connecting indicator */}\n\t\t\t{isConnecting && (\n\t\t\t\t<div className=\"ml-1 flex items-center gap-1 text-xs text-muted-foreground\">\n\t\t\t\t\t<span className=\"h-1.5 w-1.5 animate-pulse rounded-full bg-amber-500\" />\n\t\t\t\t\t<span>Connecting...</span>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n","/**\n * Thread with Voice Mode\n *\n * Enhanced thread component that includes voice mode.\n * Replaces the composer with a voice panel when voice is active.\n */\n\nimport {\n\tActionBarPrimitive,\n\tBranchPickerPrimitive,\n\tComposerPrimitive,\n\tErrorPrimitive,\n\tMessagePrimitive,\n\tThreadPrimitive,\n} from '@assistant-ui/react'\nimport {\n\tArrowDownIcon,\n\tArrowUpIcon,\n\tCheckIcon,\n\tChevronLeftIcon,\n\tChevronRightIcon,\n\tCopyIcon,\n\tPencilIcon,\n\tPhone,\n\tRefreshCwIcon,\n\tSquare,\n} from 'lucide-react'\nimport { AnimatePresence, domAnimation, LazyMotion, MotionConfig } from 'motion/react'\nimport * as m from 'motion/react-m'\n\nimport { cn } from '../lib/utils'\nimport { useOptionalVoiceModeContext } from '../providers/VoiceModeProvider'\nimport { ComposerAddAttachment, ComposerAttachments, UserMessageAttachments } from './attachment'\nimport { Button } from './button'\nimport { MarkdownText } from './markdown-text'\nimport { RemoteMCPSettings } from './RemoteMCPSettings'\nimport { ToolFallback } from './tool-fallback'\nimport { TooltipIconButton } from './tooltip-icon-button'\nimport { VoiceIndicator } from './voice-indicator'\n\nimport type { FC } from 'react'\n\nexport const ThreadWithVoice: FC = () => {\n\treturn (\n\t\t<LazyMotion features={domAnimation}>\n\t\t\t<MotionConfig reducedMotion=\"user\">\n\t\t\t\t<ThreadPrimitive.Root\n\t\t\t\t\tclassName=\"aui-root aui-thread-root app-shell @container relative flex h-full flex-col bg-background/50\"\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\t['--thread-max-width' as string]: '100%',\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<ThreadPrimitive.Viewport className=\"aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll px-4\">\n\t\t\t\t\t\t<ThreadPrimitive.If empty>\n\t\t\t\t\t\t\t<ThreadWelcome />\n\t\t\t\t\t\t</ThreadPrimitive.If>\n\n\t\t\t\t\t\t<ThreadPrimitive.Messages\n\t\t\t\t\t\t\tcomponents={{\n\t\t\t\t\t\t\t\tUserMessage,\n\t\t\t\t\t\t\t\tEditComposer,\n\t\t\t\t\t\t\t\tAssistantMessage,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t<ThreadPrimitive.If empty={false}>\n\t\t\t\t\t\t\t<div className=\"aui-thread-viewport-spacer min-h-8 grow\" />\n\t\t\t\t\t\t</ThreadPrimitive.If>\n\n\t\t\t\t\t\t<ComposerArea />\n\t\t\t\t\t</ThreadPrimitive.Viewport>\n\t\t\t\t</ThreadPrimitive.Root>\n\t\t\t</MotionConfig>\n\t\t</LazyMotion>\n\t)\n}\n\n/**\n * Composer area with voice indicator\n */\nconst ComposerArea: FC = () => {\n\tconst voiceMode = useOptionalVoiceModeContext()\n\n\treturn (\n\t\t<div className=\"aui-composer-wrapper sticky bottom-0 mx-auto flex w-full max-w-[var(--thread-max-width)] flex-col gap-4 overflow-visible rounded-t-3xl pb-4 md:pb-6\">\n\t\t\t<ThreadScrollToBottom />\n\n\t\t\t{/* Voice indicator - shown above composer when voice mode is active */}\n\t\t\t<AnimatePresence>\n\t\t\t\t{voiceMode?.isSupported && (voiceMode.isActive || voiceMode.isConnecting) && (\n\t\t\t\t\t<m.div\n\t\t\t\t\t\tinitial={{ opacity: 0, y: 20 }}\n\t\t\t\t\t\tanimate={{ opacity: 1, y: 0 }}\n\t\t\t\t\t\texit={{ opacity: 0, y: -10 }}\n\t\t\t\t\t\ttransition={{ duration: 0.2 }}\n\t\t\t\t\t\tclassName=\"flex justify-center\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<VoiceIndicator\n\t\t\t\t\t\t\tisActive={voiceMode.isActive}\n\t\t\t\t\t\t\tisConnecting={voiceMode.isConnecting}\n\t\t\t\t\t\t\tisMuted={voiceMode.isMuted}\n\t\t\t\t\t\t\taudioLevel={voiceMode.audioLevel}\n\t\t\t\t\t\t\ttoolCall={voiceMode.toolCall}\n\t\t\t\t\t\t\tonStart={voiceMode.startSession}\n\t\t\t\t\t\t\tonStop={voiceMode.stopSession}\n\t\t\t\t\t\t\tonToggleMute={() => voiceMode.toggleMute()}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</m.div>\n\t\t\t\t)}\n\t\t\t</AnimatePresence>\n\n\t\t\t<TextComposer />\n\t\t</div>\n\t)\n}\n\nconst TextComposer: FC = () => {\n\tconst voiceMode = useOptionalVoiceModeContext()\n\n\treturn (\n\t\t<ComposerPrimitive.Root\n\t\t\tclassName={cn(\n\t\t\t\t'aui-composer-root group/composer flex w-full flex-col overflow-hidden rounded-2xl px-3 py-2',\n\t\t\t\t'border border-border/40 shadow-sm backdrop-blur-md',\n\t\t\t\t'bg-background/80',\n\t\t\t\t'transition-all duration-200',\n\t\t\t\t'focus-within:border-ring/50 focus-within:shadow-md',\n\t\t\t\t'hover:border-border/60'\n\t\t\t)}\n\t\t>\n\t\t\t<ComposerAttachments />\n\t\t\t<ComposerPrimitive.Input\n\t\t\t\tplaceholder=\"Send a message...\"\n\t\t\t\tclassName=\"aui-composer-input mt-2 max-h-24 w-full resize-none bg-transparent px-0 py-2 text-sm leading-relaxed text-foreground placeholder:text-muted-foreground/70 focus-visible:outline-none focus-visible:ring-0\"\n\t\t\t\trows={1}\n\t\t\t\tautoFocus\n\t\t\t\taria-label=\"Message input\"\n\t\t\t/>\n\t\t\t<div className=\"aui-composer-action-wrapper mt-2 flex items-center justify-between text-muted-foreground\">\n\t\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t\t<ComposerAddAttachment />\n\n\t\t\t\t\t{/* Remote MCP settings */}\n\t\t\t\t\t<RemoteMCPSettings />\n\n\t\t\t\t\t{/* Voice mode button */}\n\t\t\t\t\t{voiceMode?.isSupported && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\tonClick={() => voiceMode.startSession()}\n\t\t\t\t\t\t\tclassName=\"gap-2 rounded-full text-muted-foreground hover:text-foreground\"\n\t\t\t\t\t\t\taria-label=\"Start voice session\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Phone className=\"h-4 w-4\" />\n\t\t\t\t\t\t\t<span className=\"text-xs\">Voice</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"flex items-center gap-1.5\">\n\t\t\t\t\t<ThreadPrimitive.If running={false}>\n\t\t\t\t\t\t<ComposerPrimitive.Send asChild>\n\t\t\t\t\t\t\t<TooltipIconButton\n\t\t\t\t\t\t\t\ttooltip=\"Send message\"\n\t\t\t\t\t\t\t\tside=\"top\"\n\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\t\t\tclassName=\"aui-composer-send size-8 shrink-0 rounded-full border border-primary/60 bg-primary px-0 text-primary-foreground shadow-[0_12px_24px_-16px_rgba(37,99,235,0.55)] transition-shadow hover:shadow-[0_14px_24px_-14px_rgba(37,99,235,0.6)] focus-visible:ring-2 focus-visible:ring-primary/40\"\n\t\t\t\t\t\t\t\taria-label=\"Send message\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ArrowUpIcon className=\"aui-composer-send-icon size-4\" />\n\t\t\t\t\t\t\t</TooltipIconButton>\n\t\t\t\t\t\t</ComposerPrimitive.Send>\n\t\t\t\t\t</ThreadPrimitive.If>\n\n\t\t\t\t\t<ThreadPrimitive.If running>\n\t\t\t\t\t\t<ComposerPrimitive.Cancel asChild>\n\t\t\t\t\t\t\t<TooltipIconButton\n\t\t\t\t\t\t\t\ttooltip=\"Stop generating\"\n\t\t\t\t\t\t\t\tside=\"top\"\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tvariant=\"ghost\"\n\t\t\t\t\t\t\t\tsize=\"icon\"\n\t\t\t\t\t\t\t\tclassName=\"aui-composer-cancel size-8 shrink-0 rounded-full border border-destructive/60 bg-destructive px-0 text-destructive-foreground shadow-[0_12px_24px_-18px_rgba(220,38,38,0.55)] transition-shadow hover:shadow-[0_14px_24px_-16px_rgba(220,38,38,0.6)] focus-visible:ring-2 focus-visible:ring-destructive/40\"\n\t\t\t\t\t\t\t\taria-label=\"Stop generating\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Square className=\"aui-composer-cancel-icon size-3.5\" />\n\t\t\t\t\t\t\t</TooltipIconButton>\n\t\t\t\t\t\t</ComposerPrimitive.Cancel>\n\t\t\t\t\t</ThreadPrimitive.If>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</ComposerPrimitive.Root>\n\t)\n}\n\nconst ThreadScrollToBottom: FC = () => {\n\treturn (\n\t\t<ThreadPrimitive.ScrollToBottom asChild>\n\t\t\t<TooltipIconButton\n\t\t\t\ttooltip=\"Scroll to bottom\"\n\t\t\t\tvariant=\"outline\"\n\t\t\t\tclassName=\"aui-thread-scroll-to-bottom absolute -top-12 z-10 self-center rounded-full p-4 disabled:invisible dark:bg-background dark:hover:bg-accent\"\n\t\t\t>\n\t\t\t\t<ArrowDownIcon />\n\t\t\t</TooltipIconButton>\n\t\t</ThreadPrimitive.ScrollToBottom>\n\t)\n}\n\nconst ThreadWelcome: FC = () => {\n\treturn (\n\t\t<div className=\"aui-thread-welcome-root mx-auto my-auto flex w-full max-w-[var(--thread-max-width)] flex-grow flex-col\">\n\t\t\t<div className=\"aui-thread-welcome-center flex w-full flex-grow flex-col items-center justify-center\">\n\t\t\t\t<div className=\"aui-thread-welcome-message flex size-full flex-col justify-center px-8\">\n\t\t\t\t\t<m.div\n\t\t\t\t\t\tinitial={{ opacity: 0, y: 10 }}\n\t\t\t\t\t\tanimate={{ opacity: 1, y: 0 }}\n\t\t\t\t\t\texit={{ opacity: 0, y: 10 }}\n\t\t\t\t\t\tclassName=\"aui-thread-welcome-message-motion-1 text-3xl font-bold tracking-tight\"\n\t\t\t\t\t>\n\t\t\t\t\t\tHello there!\n\t\t\t\t\t</m.div>\n\t\t\t\t\t<m.div\n\t\t\t\t\t\tinitial={{ opacity: 0, y: 10 }}\n\t\t\t\t\t\tanimate={{ opacity: 1, y: 0 }}\n\t\t\t\t\t\texit={{ opacity: 0, y: 10 }}\n\t\t\t\t\t\ttransition={{ delay: 0.1 }}\n\t\t\t\t\t\tclassName=\"aui-thread-welcome-message-motion-2 mt-2 text-lg text-muted-foreground\"\n\t\t\t\t\t>\n\t\t\t\t\t\tHow can I help you today?\n\t\t\t\t\t</m.div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<ThreadSuggestions />\n\t\t</div>\n\t)\n}\n\nconst ThreadSuggestions: FC = () => {\n\treturn (\n\t\t<div className=\"aui-thread-welcome-suggestions grid w-full gap-2 pb-4 @md:grid-cols-2\">\n\t\t\t{[\n\t\t\t\t{\n\t\t\t\t\ttitle: \"What's the weather\",\n\t\t\t\t\tlabel: 'in San Francisco?',\n\t\t\t\t\taction: \"What's the weather in San Francisco?\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttitle: 'Explain React hooks',\n\t\t\t\t\tlabel: 'like useState and useEffect',\n\t\t\t\t\taction: 'Explain React hooks like useState and useEffect',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttitle: 'Write a SQL query',\n\t\t\t\t\tlabel: 'to find top customers',\n\t\t\t\t\taction: 'Write a SQL query to find top customers',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttitle: 'Create a meal plan',\n\t\t\t\t\tlabel: 'for healthy weight loss',\n\t\t\t\t\taction: 'Create a meal plan for healthy weight loss',\n\t\t\t\t},\n\t\t\t].map((suggestedAction, index) => (\n\t\t\t\t<m.div\n\t\t\t\t\tinitial={{ opacity: 0, y: 20 }}\n\t\t\t\t\tanimate={{ opacity: 1, y: 0 }}\n\t\t\t\t\texit={{ opacity: 0, y: 20 }}\n\t\t\t\t\ttransition={{ delay: 0.05 * index }}\n\t\t\t\t\tkey={`suggested-action-${suggestedAction.title}-${index}`}\n\t\t\t\t\tclassName=\"aui-thread-welcome-suggestion-display [&:nth-child(n+3)]:hidden @md:[&:nth-child(n+3)]:block\"\n\t\t\t\t>\n\t\t\t\t\t<ThreadPrimitive.Suggestion prompt={suggestedAction.action} send asChild>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\tclassName=\"aui-thread-welcome-suggestion h-auto w-full flex-1 flex-wrap items-start justify-start gap-1 rounded-xl border-border/50 bg-background/50 px-4 py-3 text-left text-sm transition-colors hover:bg-accent/50 hover:border-accent @md:flex-col\"\n\t\t\t\t\t\t\taria-label={suggestedAction.action}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span className=\"aui-thread-welcome-suggestion-text-1 font-medium text-foreground\">\n\t\t\t\t\t\t\t\t{suggestedAction.title}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"aui-thread-welcome-suggestion-text-2 text-muted-foreground text-xs\">\n\t\t\t\t\t\t\t\t{suggestedAction.label}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</ThreadPrimitive.Suggestion>\n\t\t\t\t</m.div>\n\t\t\t))}\n\t\t</div>\n\t)\n}\n\nconst MessageError: FC = () => {\n\treturn (\n\t\t<MessagePrimitive.Error>\n\t\t\t<ErrorPrimitive.Root className=\"aui-message-error-root mt-2 rounded-md border border-destructive bg-destructive/10 p-3 text-sm text-destructive dark:bg-destructive/5 dark:text-red-200\">\n\t\t\t\t<ErrorPrimitive.Message className=\"aui-message-error-message line-clamp-2\" />\n\t\t\t</ErrorPrimitive.Root>\n\t\t</MessagePrimitive.Error>\n\t)\n}\n\nconst AssistantMessage: FC = () => {\n\treturn (\n\t\t<MessagePrimitive.Root asChild>\n\t\t\t<div\n\t\t\t\tclassName=\"aui-assistant-message-root relative mx-auto w-full max-w-[var(--thread-max-width)] animate-in py-4 duration-200 fade-in slide-in-from-bottom-1 last:mb-24\"\n\t\t\t\tdata-role=\"assistant\"\n\t\t\t>\n\t\t\t\t<div className=\"aui-assistant-message-content mx-2 leading-7 break-words text-foreground\">\n\t\t\t\t\t<MessagePrimitive.Parts\n\t\t\t\t\t\tcomponents={{\n\t\t\t\t\t\t\tText: MarkdownText,\n\t\t\t\t\t\t\ttools: { Fallback: ToolFallback },\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t\t<MessageError />\n\t\t\t\t</div>\n\n\t\t\t\t<div className=\"aui-assistant-message-footer mt-2 ml-2 flex\">\n\t\t\t\t\t<BranchPicker />\n\t\t\t\t\t<AssistantActionBar />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</MessagePrimitive.Root>\n\t)\n}\n\nconst AssistantActionBar: FC = () => {\n\treturn (\n\t\t<ActionBarPrimitive.Root\n\t\t\thideWhenRunning\n\t\t\tautohide=\"not-last\"\n\t\t\tautohideFloat=\"single-branch\"\n\t\t\tclassName=\"aui-assistant-action-bar-root col-start-3 row-start-2 -ml-1 flex gap-1 text-muted-foreground data-floating:absolute data-floating:rounded-md data-floating:border data-floating:bg-background data-floating:p-1 data-floating:shadow-sm\"\n\t\t>\n\t\t\t<ActionBarPrimitive.Copy asChild>\n\t\t\t\t<TooltipIconButton tooltip=\"Copy\">\n\t\t\t\t\t<MessagePrimitive.If copied>\n\t\t\t\t\t\t<CheckIcon />\n\t\t\t\t\t</MessagePrimitive.If>\n\t\t\t\t\t<MessagePrimitive.If copied={false}>\n\t\t\t\t\t\t<CopyIcon />\n\t\t\t\t\t</MessagePrimitive.If>\n\t\t\t\t</TooltipIconButton>\n\t\t\t</ActionBarPrimitive.Copy>\n\t\t\t<ActionBarPrimitive.Reload asChild>\n\t\t\t\t<TooltipIconButton tooltip=\"Refresh\">\n\t\t\t\t\t<RefreshCwIcon />\n\t\t\t\t</TooltipIconButton>\n\t\t\t</ActionBarPrimitive.Reload>\n\t\t</ActionBarPrimitive.Root>\n\t)\n}\n\nconst UserMessage: FC = () => {\n\treturn (\n\t\t<MessagePrimitive.Root asChild>\n\t\t\t<div\n\t\t\t\tclassName=\"aui-user-message-root mx-auto grid w-full max-w-[var(--thread-max-width)] animate-in auto-rows-auto grid-cols-[minmax(72px,1fr)_auto] gap-y-2 px-2 py-4 duration-200 fade-in slide-in-from-bottom-1 first:mt-3 last:mb-5 [&:where(>*)]:col-start-2\"\n\t\t\t\tdata-role=\"user\"\n\t\t\t>\n\t\t\t\t<UserMessageAttachments />\n\n\t\t\t\t<div className=\"aui-user-message-content-wrapper relative col-start-2 min-w-0 max-w-[85%]\">\n\t\t\t\t\t<div className=\"aui-user-message-content rounded-2xl rounded-tr-sm bg-primary text-primary-foreground px-4 py-3 text-sm leading-relaxed shadow-sm\">\n\t\t\t\t\t\t<MessagePrimitive.Parts />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div className=\"aui-user-action-bar-wrapper absolute top-1/2 left-0 -translate-x-full -translate-y-1/2 pr-2\">\n\t\t\t\t\t\t<UserActionBar />\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\n\t\t\t\t<BranchPicker className=\"aui-user-branch-picker col-span-full col-start-1 row-start-3 -mr-1 justify-end\" />\n\t\t\t</div>\n\t\t</MessagePrimitive.Root>\n\t)\n}\n\nconst UserActionBar: FC = () => {\n\treturn (\n\t\t<ActionBarPrimitive.Root\n\t\t\thideWhenRunning\n\t\t\tautohide=\"not-last\"\n\t\t\tclassName=\"aui-user-action-bar-root flex flex-col items-end\"\n\t\t>\n\t\t\t<ActionBarPrimitive.Edit asChild>\n\t\t\t\t<TooltipIconButton tooltip=\"Edit\" className=\"aui-user-action-edit p-4\">\n\t\t\t\t\t<PencilIcon />\n\t\t\t\t</TooltipIconButton>\n\t\t\t</ActionBarPrimitive.Edit>\n\t\t</ActionBarPrimitive.Root>\n\t)\n}\n\nconst EditComposer: FC = () => {\n\treturn (\n\t\t<div className=\"aui-edit-composer-wrapper mx-auto flex w-full max-w-[var(--thread-max-width)] flex-col gap-4 px-2 first:mt-4\">\n\t\t\t<ComposerPrimitive.Root className=\"aui-edit-composer-root ml-auto flex w-full max-w-7/8 flex-col rounded-xl bg-muted\">\n\t\t\t\t<ComposerPrimitive.Input\n\t\t\t\t\tclassName=\"aui-edit-composer-input flex min-h-[60px] w-full resize-none bg-transparent p-4 text-foreground outline-none\"\n\t\t\t\t\tautoFocus\n\t\t\t\t/>\n\n\t\t\t\t<div className=\"aui-edit-composer-footer mx-3 mb-3 flex items-center justify-center gap-2 self-end\">\n\t\t\t\t\t<ComposerPrimitive.Cancel asChild>\n\t\t\t\t\t\t<Button variant=\"ghost\" size=\"sm\" aria-label=\"Cancel edit\">\n\t\t\t\t\t\t\tCancel\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</ComposerPrimitive.Cancel>\n\t\t\t\t\t<ComposerPrimitive.Send asChild>\n\t\t\t\t\t\t<Button size=\"sm\" aria-label=\"Update message\">\n\t\t\t\t\t\t\tUpdate\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</ComposerPrimitive.Send>\n\t\t\t\t</div>\n\t\t\t</ComposerPrimitive.Root>\n\t\t</div>\n\t)\n}\n\nconst BranchPicker: FC<BranchPickerPrimitive.Root.Props> = ({ className, ...rest }) => {\n\treturn (\n\t\t<BranchPickerPrimitive.Root\n\t\t\thideWhenSingleBranch\n\t\t\tclassName={cn(\n\t\t\t\t'aui-branch-picker-root mr-2 -ml-2 inline-flex items-center text-xs text-muted-foreground',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t\t{...rest}\n\t\t>\n\t\t\t<BranchPickerPrimitive.Previous asChild>\n\t\t\t\t<TooltipIconButton tooltip=\"Previous\">\n\t\t\t\t\t<ChevronLeftIcon />\n\t\t\t\t</TooltipIconButton>\n\t\t\t</BranchPickerPrimitive.Previous>\n\t\t\t<span className=\"aui-branch-picker-state font-medium\">\n\t\t\t\t<BranchPickerPrimitive.Number /> / <BranchPickerPrimitive.Count />\n\t\t\t</span>\n\t\t\t<BranchPickerPrimitive.Next asChild>\n\t\t\t\t<TooltipIconButton tooltip=\"Next\">\n\t\t\t\t\t<ChevronRightIcon />\n\t\t\t\t</TooltipIconButton>\n\t\t\t</BranchPickerPrimitive.Next>\n\t\t</BranchPickerPrimitive.Root>\n\t)\n}\n","'use client'\n\nimport { AssistantModalPrimitive } from '@assistant-ui/react'\nimport { ChevronDownIcon } from 'lucide-react'\nimport { forwardRef } from 'react'\n\nimport { ThreadWithVoice } from './thread-with-voice'\nimport { TooltipIconButton } from './tooltip-icon-button'\n\nimport type { FC } from 'react'\n\nexport const AssistantModal: FC = () => {\n\treturn (\n\t\t<AssistantModalPrimitive.Root>\n\t\t\t<AssistantModalPrimitive.Anchor className=\"aui-root aui-modal-anchor fixed right-6 bottom-6 size-14\">\n\t\t\t\t<AssistantModalPrimitive.Trigger asChild>\n\t\t\t\t\t<AssistantModalButton />\n\t\t\t\t</AssistantModalPrimitive.Trigger>\n\t\t\t</AssistantModalPrimitive.Anchor>\n\t\t\t<AssistantModalPrimitive.Content\n\t\t\t\tsideOffset={16}\n\t\t\t\tclassName=\"aui-root aui-modal-content z-50 h-[600px] w-[500px] overflow-clip overscroll-contain rounded-2xl border border-border/50 bg-popover/95 backdrop-blur-xl p-0 text-popover-foreground shadow-2xl outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-bottom-1/2 data-[state=closed]:slide-out-to-right-1/2 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:slide-in-from-bottom-1/2 data-[state=open]:slide-in-from-right-1/2 data-[state=open]:zoom-in-95 [&>.aui-thread-root]:bg-inherit\"\n\t\t\t>\n\t\t\t\t<ThreadWithVoice />\n\t\t\t</AssistantModalPrimitive.Content>\n\t\t</AssistantModalPrimitive.Root>\n\t)\n}\n\ntype AssistantModalButtonProps = { 'data-state'?: 'open' | 'closed' }\n\nconst AssistantModalButton = forwardRef<HTMLButtonElement, AssistantModalButtonProps>(\n\t({ 'data-state': state, ...rest }, ref) => {\n\t\tconst tooltip = state === 'open' ? 'Close Assistant' : 'Open Assistant'\n\n\t\treturn (\n\t\t\t<TooltipIconButton\n\t\t\t\tvariant=\"ghost\"\n\t\t\t\ttooltip={tooltip}\n\t\t\t\tside=\"left\"\n\t\t\t\t{...rest}\n\t\t\t\tclassName=\"aui-modal-button size-full rounded-full transition-all hover:scale-105 hover:bg-transparent active:scale-95\"\n\t\t\t\tref={ref}\n\t\t\t>\n\t\t\t\t<img\n\t\t\t\t\tsrc=\"/logo.png\"\n\t\t\t\t\talt=\"Assistant\"\n\t\t\t\t\tdata-state={state}\n\t\t\t\t\tclassName=\"aui-modal-button-closed-icon absolute size-full object-contain drop-shadow-xl transition-all duration-300 ease-in-out hover:drop-shadow-2xl data-[state=closed]:scale-100 data-[state=closed]:rotate-0 data-[state=open]:scale-0 data-[state=open]:rotate-90\"\n\t\t\t\t/>\n\n\t\t\t\t<ChevronDownIcon\n\t\t\t\t\tdata-state={state}\n\t\t\t\t\tclassName=\"aui-modal-button-open-icon absolute size-full rounded-full bg-primary p-3 text-primary-foreground shadow-xl transition-all duration-300 ease-in-out hover:shadow-2xl data-[state=closed]:scale-0 data-[state=closed]:-rotate-90 data-[state=open]:scale-100 data-[state=open]:rotate-0\"\n\t\t\t\t/>\n\t\t\t\t<span className=\"aui-sr-only sr-only\">{tooltip}</span>\n\t\t\t</TooltipIconButton>\n\t\t)\n\t}\n)\n\nAssistantModalButton.displayName = 'AssistantModalButton'\n","/**\n * MCP Tool Registry Component\n *\n * Registers all MCP tools with the assistant-ui runtime.\n * Uses the unified callTool function which auto-routes based on tool source.\n *\n * Usage:\n * <MCPToolRegistry />\n *\n * This component should be placed inside both MCPToolsProvider and AssistantRuntimeProvider.\n */\nimport { useAssistantTool } from '@assistant-ui/react'\n\nimport { useMCPTools } from '../providers/MCPToolsProvider'\n\nimport type { CallToolResult, ToolWithSource } from '@mcp-b/cloud-mirror-types'\nimport type { FC } from 'react'\n\n/**\n * Bridge component that registers a single tool with assistant-ui\n */\nconst ToolBridge: FC<{\n\ttool: ToolWithSource\n\tcallTool: (name: string, args: Record<string, unknown>) => Promise<CallToolResult>\n}> = ({ tool, callTool }) => {\n\tuseAssistantTool({\n\t\ttoolName: tool.name,\n\t\tdescription: tool.description ?? '',\n\t\tparameters: (tool.inputSchema ?? {}) as Record<string, unknown>,\n\t\texecute: async (args) => {\n\t\t\ttry {\n\t\t\t\tconst result = await callTool(tool.name, args)\n\n\t\t\t\t// Return a formatted response for the assistant\n\t\t\t\tconst textContent = result.content\n\t\t\t\t\t.map((c) => {\n\t\t\t\t\t\tif ('text' in c && typeof c.text === 'string') {\n\t\t\t\t\t\t\treturn c.text\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn JSON.stringify(c)\n\t\t\t\t\t})\n\t\t\t\t\t.join('\\n')\n\n\t\t\t\treturn textContent || 'Tool executed successfully'\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error(`[ToolBridge] Tool '${tool.name}' execution failed:`, error)\n\t\t\t\tthrow error\n\t\t\t}\n\t\t},\n\t})\n\n\treturn null\n}\n\n/**\n * Tool registry that registers all MCP tools with assistant-ui.\n * Routes tool calls automatically based on _sourceId.\n */\nexport const MCPToolRegistry: FC = () => {\n\tconst { tools, callTool } = useMCPTools()\n\n\treturn (\n\t\t<>\n\t\t\t{tools.map((tool) => (\n\t\t\t\t<ToolBridge key={`${tool._sourceId}-${tool.name}`} tool={tool} callTool={callTool} />\n\t\t\t))}\n\t\t</>\n\t)\n}\n\n/**\n * Debug component to display registered tools and sources\n */\nexport const MCPToolsDebug: FC = () => {\n\tconst { tools, sources } = useMCPTools()\n\n\treturn (\n\t\t<div className=\"rounded border border-border bg-muted p-3 text-xs\">\n\t\t\t<div className=\"mb-2 font-medium\">MCP Tools Debug</div>\n\t\t\t<div className=\"mb-2\">\n\t\t\t\t<div className=\"font-medium\">Sources:</div>\n\t\t\t\t{Array.from(sources.values()).map((source) => (\n\t\t\t\t\t<div key={source.id} className=\"ml-2\">\n\t\t\t\t\t\t{source.id}: {source.state}\n\t\t\t\t\t\t{source.error && <span className=\"text-destructive\"> ({source.error.message})</span>}\n\t\t\t\t\t</div>\n\t\t\t\t))}\n\t\t\t</div>\n\t\t\t<div className=\"mb-1\">Total tools: {tools.length}</div>\n\t\t\t<ul className=\"list-disc space-y-1 pl-4\">\n\t\t\t\t{tools.map((tool) => (\n\t\t\t\t\t<li key={`${tool._sourceId}-${tool.name}`}>\n\t\t\t\t\t\t<span className=\"font-mono\">{tool.name}</span>\n\t\t\t\t\t\t<span className=\"ml-1 text-muted-foreground\">({tool._sourceId})</span>\n\t\t\t\t\t</li>\n\t\t\t\t))}\n\t\t\t</ul>\n\t\t</div>\n\t)\n}\n","import { useThread } from '@assistant-ui/react'\nimport { useMemo } from 'react'\n\n/**\n * Represents a single action derived from a tool call\n */\nexport interface Action {\n\tid: string\n\tlabel: string\n\ttoolName: string\n\tstatus: 'queued' | 'running' | 'success' | 'error'\n\targs?: unknown\n\tresult?: unknown\n\terror?: string\n\tstartedAt?: number\n\tduration?: number\n}\n\n/**\n * Humanize a tool name for display\n * e.g., \"search_files\" -> \"Searching files\"\n * e.g., \"readFile\" -> \"Reading file\"\n */\nfunction humanizeToolName(toolName: string, isRunning = false): string {\n\t// Convert camelCase or snake_case to words\n\tconst words = toolName\n\t\t.replace(/([a-z])([A-Z])/g, '$1 $2')\n\t\t.replace(/_/g, ' ')\n\t\t.toLowerCase()\n\t\t.split(' ')\n\n\tif (words.length === 0) return toolName\n\n\t// If running, make it present progressive (e.g., \"searching\")\n\tif (isRunning) {\n\t\tconst verb = words[0]\n\t\t// Simple -ing conversion\n\t\tconst progressive = verb.endsWith('e') ? verb.slice(0, -1) + 'ing' : verb + 'ing'\n\t\twords[0] = progressive.charAt(0).toUpperCase() + progressive.slice(1)\n\t} else {\n\t\t// Capitalize first word\n\t\twords[0] = words[0].charAt(0).toUpperCase() + words[0].slice(1)\n\t}\n\n\treturn words.join(' ')\n}\n\ninterface ToolCallPart {\n\ttype: 'tool-call'\n\ttoolCallId: string\n\ttoolName: string\n\targs: unknown\n\tresult?: unknown\n}\n\n/**\n * Hook to derive actions from the current thread's tool calls\n *\n * Actions are a view of tool calls - not separate state.\n * This maintains compatibility with assistant-ui's data model.\n */\nexport function useActions(): Action[] {\n\t// Use selector pattern to get messages reactively\n\tconst messages = useThread((thread) => thread.messages)\n\n\treturn useMemo(() => {\n\t\tif (!messages || messages.length === 0) {\n\t\t\treturn []\n\t\t}\n\n\t\tconst actions: Action[] = []\n\n\t\tfor (const message of messages) {\n\t\t\tif (message.role !== 'assistant') continue\n\n\t\t\tfor (const part of message.content) {\n\t\t\t\tif (part.type !== 'tool-call') continue\n\n\t\t\t\tconst toolPart = part as ToolCallPart\n\t\t\t\tconst isComplete = toolPart.result !== undefined\n\t\t\t\tconst hasError =\n\t\t\t\t\ttoolPart.result &&\n\t\t\t\t\ttypeof toolPart.result === 'object' &&\n\t\t\t\t\t'error' in (toolPart.result as Record<string, unknown>)\n\n\t\t\t\tlet status: Action['status']\n\t\t\t\tif (hasError) {\n\t\t\t\t\tstatus = 'error'\n\t\t\t\t} else if (isComplete) {\n\t\t\t\t\tstatus = 'success'\n\t\t\t\t} else {\n\t\t\t\t\tstatus = 'running'\n\t\t\t\t}\n\n\t\t\t\tactions.push({\n\t\t\t\t\tid: toolPart.toolCallId,\n\t\t\t\t\ttoolName: toolPart.toolName,\n\t\t\t\t\tlabel: humanizeToolName(toolPart.toolName, status === 'running'),\n\t\t\t\t\tstatus,\n\t\t\t\t\targs: toolPart.args,\n\t\t\t\t\tresult: toolPart.result,\n\t\t\t\t\terror: hasError ? String((toolPart.result as Record<string, unknown>).error) : undefined,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\treturn actions\n\t}, [messages])\n}\n\n/**\n * Hook to get the current running action (if any)\n */\nexport function useCurrentAction(): Action | null {\n\tconst actions = useActions()\n\treturn actions.find((a) => a.status === 'running') ?? null\n}\n\n/**\n * Hook to get recently completed actions\n */\nexport function useRecentActions(limit = 3): Action[] {\n\tconst actions = useActions()\n\treturn actions.filter((a) => a.status === 'success' || a.status === 'error').slice(-limit)\n}\n\n/**\n * Hook to get action summary stats\n */\nexport function useActionStats(): {\n\ttotal: number\n\tcompleted: number\n\trunning: number\n\tfailed: number\n} {\n\tconst actions = useActions()\n\n\treturn useMemo(\n\t\t() => ({\n\t\t\ttotal: actions.length,\n\t\t\tcompleted: actions.filter((a) => a.status === 'success').length,\n\t\t\trunning: actions.filter((a) => a.status === 'running').length,\n\t\t\tfailed: actions.filter((a) => a.status === 'error').length,\n\t\t}),\n\t\t[actions]\n\t)\n}\n\nexport { humanizeToolName }\n","'use client'\n\nimport { AlertCircle, CheckCircle2, Circle, Loader2 } from 'lucide-react'\n\nimport { cn } from '../../lib/utils'\n\nimport type { FC } from 'react'\nimport type { Action } from '../../hooks/useActions'\n\ninterface CurrentActivityProps {\n\tcurrentAction: Action | null\n\trecentActions?: Action[]\n\tshowRecent?: boolean\n\tclassName?: string\n}\n\n/**\n * Displays the current action the agent is performing,\n * with optional recent completed steps shown below.\n */\nexport const CurrentActivity: FC<CurrentActivityProps> = ({\n\tcurrentAction,\n\trecentActions = [],\n\tshowRecent = true,\n\tclassName,\n}) => {\n\tif (!currentAction && recentActions.length === 0) {\n\t\treturn null\n\t}\n\n\treturn (\n\t\t<div className={cn('space-y-2', className)}>\n\t\t\t{/* Current action - prominent display */}\n\t\t\t{currentAction && (\n\t\t\t\t<div className=\"flex items-center gap-2.5\">\n\t\t\t\t\t<ActionStatusIcon status={currentAction.status} />\n\t\t\t\t\t<span className=\"text-sm font-medium text-white\">{currentAction.label}...</span>\n\t\t\t\t</div>\n\t\t\t)}\n\n\t\t\t{/* Recent completed actions - muted, smaller */}\n\t\t\t{showRecent && recentActions.length > 0 && (\n\t\t\t\t<div className=\"ml-1 border-l border-white/20 pl-3 space-y-1\">\n\t\t\t\t\t{recentActions.map((action) => (\n\t\t\t\t\t\t<div key={action.id} className=\"flex items-center gap-2 text-xs text-white/60\">\n\t\t\t\t\t\t\t<ActionStatusIcon status={action.status} size=\"sm\" />\n\t\t\t\t\t\t\t<span className={cn(action.status === 'error' && 'text-red-400')}>\n\t\t\t\t\t\t\t\t{action.label}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\ntype ActionStatus = 'queued' | 'running' | 'success' | 'error'\n\ninterface ActionStatusIconProps {\n\tstatus: ActionStatus\n\tsize?: 'sm' | 'md'\n\tclassName?: string\n}\n\n/**\n * Icon component for action status\n */\nexport const ActionStatusIcon: FC<ActionStatusIconProps> = ({ status, size = 'md', className }) => {\n\tconst sizeClass = size === 'sm' ? 'h-3 w-3' : 'h-4 w-4'\n\n\tswitch (status) {\n\t\tcase 'queued':\n\t\t\treturn <Circle className={cn(sizeClass, 'text-white/40', className)} />\n\t\tcase 'running':\n\t\t\treturn <Loader2 className={cn(sizeClass, 'text-blue-400 animate-spin', className)} />\n\t\tcase 'success':\n\t\t\treturn <CheckCircle2 className={cn(sizeClass, 'text-green-400', className)} />\n\t\tcase 'error':\n\t\t\treturn <AlertCircle className={cn(sizeClass, 'text-red-400', className)} />\n\t\tdefault:\n\t\t\treturn <Circle className={cn(sizeClass, 'text-white/40', className)} />\n\t}\n}\n\n/**\n * Idle state indicator when no actions are running\n */\nexport const IdleIndicator: FC<{ className?: string }> = ({ className }) => {\n\treturn (\n\t\t<div className={cn('flex items-center gap-2 text-white/50', className)}>\n\t\t\t<div className=\"h-2 w-2 rounded-full bg-green-400/60\" />\n\t\t\t<span className=\"text-xs\">Ready</span>\n\t\t</div>\n\t)\n}\n","'use client'\n\nimport { ChevronDown } from 'lucide-react'\nimport { useState } from 'react'\n\nimport { cn } from '../../lib/utils'\nimport { ActionStatusIcon } from './CurrentActivity'\n\nimport type { FC } from 'react'\nimport type { Action } from '../../hooks/useActions'\n\ninterface ActionListProps {\n\tactions: Action[]\n\tdefaultCollapsed?: boolean\n\tclassName?: string\n}\n\n/**\n * Collapsible list of all actions (tool calls) in the current conversation.\n * Shows count in header, expands to show full list with status icons.\n */\nexport const ActionList: FC<ActionListProps> = ({\n\tactions,\n\tdefaultCollapsed = true,\n\tclassName,\n}) => {\n\tconst [isCollapsed, setIsCollapsed] = useState(defaultCollapsed)\n\n\tif (actions.length === 0) {\n\t\treturn null\n\t}\n\n\tconst completedCount = actions.filter((a) => a.status === 'success').length\n\tconst totalCount = actions.length\n\n\treturn (\n\t\t<div className={cn('', className)}>\n\t\t\t{/* Header - always visible */}\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={() => setIsCollapsed(!isCollapsed)}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'flex w-full items-center justify-between',\n\t\t\t\t\t'rounded-lg px-3 py-2',\n\t\t\t\t\t'bg-white/5 hover:bg-white/10',\n\t\t\t\t\t'transition-colors duration-200'\n\t\t\t\t)}\n\t\t\t\taria-expanded={!isCollapsed}\n\t\t\t>\n\t\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t\t<span className=\"text-xs font-medium text-white/80\">Actions</span>\n\t\t\t\t\t<span className=\"text-xs text-white/50\">\n\t\t\t\t\t\t({completedCount}/{totalCount})\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t\t<ChevronDown\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'h-4 w-4 text-white/50 transition-transform duration-200',\n\t\t\t\t\t\t!isCollapsed && 'rotate-180'\n\t\t\t\t\t)}\n\t\t\t\t/>\n\t\t\t</button>\n\n\t\t\t{/* Expandable content */}\n\t\t\t<div\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'grid transition-[grid-template-rows] duration-300 ease-out',\n\t\t\t\t\tisCollapsed ? 'grid-rows-[0fr]' : 'grid-rows-[1fr]'\n\t\t\t\t)}\n\t\t\t\taria-hidden={isCollapsed}\n\t\t\t>\n\t\t\t\t<div className=\"overflow-hidden\">\n\t\t\t\t\t<div className=\"mt-2 max-h-48 space-y-1 overflow-y-auto px-1\">\n\t\t\t\t\t\t{actions.map((action) => (\n\t\t\t\t\t\t\t<ActionItem key={action.id} action={action} />\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n\ninterface ActionItemProps {\n\taction: Action\n\tclassName?: string\n}\n\n/**\n * Single action item in the list\n */\nconst ActionItem: FC<ActionItemProps> = ({ action, className }) => {\n\treturn (\n\t\t<div\n\t\t\tclassName={cn(\n\t\t\t\t'flex items-center justify-between',\n\t\t\t\t'rounded-md px-3 py-1.5',\n\t\t\t\t'hover:bg-white/5',\n\t\t\t\t'transition-colors duration-150',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t>\n\t\t\t<div className=\"flex items-center gap-2.5 min-w-0\">\n\t\t\t\t<ActionStatusIcon status={action.status} size=\"sm\" />\n\t\t\t\t<span\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'text-sm truncate',\n\t\t\t\t\t\taction.status === 'success' && 'text-white/60',\n\t\t\t\t\t\taction.status === 'running' && 'text-white',\n\t\t\t\t\t\taction.status === 'error' && 'text-red-400',\n\t\t\t\t\t\taction.status === 'queued' && 'text-white/40'\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{action.label}\n\t\t\t\t</span>\n\t\t\t</div>\n\n\t\t\t{/* Duration badge */}\n\t\t\t{action.duration && (\n\t\t\t\t<span className=\"text-[10px] text-white/40 tabular-nums\">\n\t\t\t\t\t{formatDuration(action.duration)}\n\t\t\t\t</span>\n\t\t\t)}\n\n\t\t\t{/* Error indicator */}\n\t\t\t{action.status === 'error' && action.error && (\n\t\t\t\t<span className=\"text-[10px] text-red-400 truncate max-w-[100px]\" title={action.error}>\n\t\t\t\t\t{action.error}\n\t\t\t\t</span>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\n/**\n * Format duration in ms to human readable string\n */\nfunction formatDuration(ms: number): string {\n\tif (ms < 1000) {\n\t\treturn `${ms}ms`\n\t}\n\tconst seconds = ms / 1000\n\tif (seconds < 60) {\n\t\treturn `${seconds.toFixed(1)}s`\n\t}\n\tconst minutes = Math.floor(seconds / 60)\n\tconst remainingSeconds = Math.floor(seconds % 60)\n\treturn `${minutes}m ${remainingSeconds}s`\n}\n\n/**\n * Compact inline action summary (for collapsed pill states)\n */\nexport const ActionSummary: FC<{ actions: Action[]; className?: string }> = ({\n\tactions,\n\tclassName,\n}) => {\n\tconst completed = actions.filter((a) => a.status === 'success').length\n\tconst running = actions.filter((a) => a.status === 'running').length\n\tconst failed = actions.filter((a) => a.status === 'error').length\n\n\tif (actions.length === 0) return null\n\n\treturn (\n\t\t<div className={cn('flex items-center gap-3 text-xs', className)}>\n\t\t\t{running > 0 && (\n\t\t\t\t<span className=\"flex items-center gap-1 text-blue-400\">\n\t\t\t\t\t<span className=\"h-1.5 w-1.5 rounded-full bg-blue-400 animate-pulse\" />\n\t\t\t\t\t{running} running\n\t\t\t\t</span>\n\t\t\t)}\n\t\t\t{completed > 0 && <span className=\"text-white/50\">{completed} completed</span>}\n\t\t\t{failed > 0 && <span className=\"text-red-400\">{failed} failed</span>}\n\t\t</div>\n\t)\n}\n","'use client'\n\nimport { ComposerPrimitive, ThreadPrimitive } from '@assistant-ui/react'\nimport { Mic, Send, Square } from 'lucide-react'\n\nimport { cn } from '../../lib/utils'\n\nimport type { FC } from 'react'\n\ninterface PillComposerProps {\n\tplaceholder?: string\n\tshowVoiceButton?: boolean\n\tisVoiceActive?: boolean\n\tonVoiceToggle?: () => void\n\tclassName?: string\n}\n\n/**\n * Compact composer for the pill UI.\n * Uses assistant-ui primitives for data binding.\n */\nexport const PillComposer: FC<PillComposerProps> = ({\n\tplaceholder = 'Ask something...',\n\tshowVoiceButton = false,\n\tisVoiceActive = false,\n\tonVoiceToggle,\n\tclassName,\n}) => {\n\treturn (\n\t\t<ComposerPrimitive.Root\n\t\t\tclassName={cn(\n\t\t\t\t'flex items-center gap-2',\n\t\t\t\t'rounded-full',\n\t\t\t\t'bg-white/10 border border-white/10',\n\t\t\t\t'px-3 py-2',\n\t\t\t\t'focus-within:border-white/20 focus-within:bg-white/15',\n\t\t\t\t'transition-colors duration-200',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t>\n\t\t\t{/* Text input */}\n\t\t\t<ComposerPrimitive.Input\n\t\t\t\tplaceholder={placeholder}\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'flex-1 min-w-0',\n\t\t\t\t\t'bg-transparent',\n\t\t\t\t\t'text-sm text-white placeholder:text-white/40',\n\t\t\t\t\t'outline-none',\n\t\t\t\t\t'resize-none'\n\t\t\t\t)}\n\t\t\t\tautoFocus\n\t\t\t/>\n\n\t\t\t{/* Voice button (optional) */}\n\t\t\t{showVoiceButton && onVoiceToggle && (\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonClick={onVoiceToggle}\n\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t'flex-shrink-0',\n\t\t\t\t\t\t'p-1.5 rounded-full',\n\t\t\t\t\t\t'transition-colors duration-200',\n\t\t\t\t\t\tisVoiceActive\n\t\t\t\t\t\t\t? 'bg-red-500 text-white'\n\t\t\t\t\t\t\t: 'hover:bg-white/10 text-white/60 hover:text-white'\n\t\t\t\t\t)}\n\t\t\t\t\taria-label={isVoiceActive ? 'Stop voice input' : 'Start voice input'}\n\t\t\t\t>\n\t\t\t\t\t<Mic className=\"h-4 w-4\" />\n\t\t\t\t</button>\n\t\t\t)}\n\n\t\t\t{/* Send button - shown when not running */}\n\t\t\t<ThreadPrimitive.If running={false}>\n\t\t\t\t<ComposerPrimitive.Send asChild>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'flex-shrink-0',\n\t\t\t\t\t\t\t'p-1.5 rounded-full',\n\t\t\t\t\t\t\t'bg-primary text-primary-foreground',\n\t\t\t\t\t\t\t'hover:bg-primary/90',\n\t\t\t\t\t\t\t'disabled:opacity-50 disabled:cursor-not-allowed',\n\t\t\t\t\t\t\t'transition-colors duration-200'\n\t\t\t\t\t\t)}\n\t\t\t\t\t\taria-label=\"Send message\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Send className=\"h-4 w-4\" />\n\t\t\t\t\t</button>\n\t\t\t\t</ComposerPrimitive.Send>\n\t\t\t</ThreadPrimitive.If>\n\n\t\t\t{/* Cancel button - shown when running */}\n\t\t\t<ThreadPrimitive.If running>\n\t\t\t\t<ComposerPrimitive.Cancel asChild>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'flex-shrink-0',\n\t\t\t\t\t\t\t'p-1.5 rounded-full',\n\t\t\t\t\t\t\t'bg-red-500 text-white',\n\t\t\t\t\t\t\t'hover:bg-red-600',\n\t\t\t\t\t\t\t'transition-colors duration-200'\n\t\t\t\t\t\t)}\n\t\t\t\t\t\taria-label=\"Stop generating\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Square className=\"h-3.5 w-3.5\" />\n\t\t\t\t\t</button>\n\t\t\t\t</ComposerPrimitive.Cancel>\n\t\t\t</ThreadPrimitive.If>\n\t\t</ComposerPrimitive.Root>\n\t)\n}\n\n/**\n * Minimal composer for collapsed/hovered states\n * Just shows a clickable prompt\n */\nexport const MinimalComposer: FC<{\n\tonClick: () => void\n\tclassName?: string\n}> = ({ onClick, className }) => {\n\treturn (\n\t\t<button\n\t\t\ttype=\"button\"\n\t\t\tonClick={onClick}\n\t\t\tclassName={cn(\n\t\t\t\t'flex items-center gap-2',\n\t\t\t\t'w-full px-4 py-2',\n\t\t\t\t'rounded-full',\n\t\t\t\t'bg-white/5 hover:bg-white/10',\n\t\t\t\t'text-sm text-white/50 hover:text-white/70',\n\t\t\t\t'transition-colors duration-200',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t>\n\t\t\t<span>Ask something...</span>\n\t\t\t<span className=\"ml-auto text-xs text-white/30\">\n\t\t\t\t<kbd className=\"rounded bg-white/10 px-1 py-0.5 font-mono text-[10px]\">⌘⇧K</kbd>\n\t\t\t</span>\n\t\t</button>\n\t)\n}\n","'use client'\n\nimport { AnimatePresence, motion } from 'motion/react'\nimport { useCallback, useEffect, useRef, useState } from 'react'\n\nimport { cn } from '../../lib/utils'\n\nimport type { Variants } from 'motion/react'\nimport type { FC, ReactNode } from 'react'\n\nexport type PillMode = 'collapsed' | 'hovered' | 'composing' | 'active' | 'expanded'\n\ninterface PillContainerProps {\n\tmode: PillMode\n\tchildren: ReactNode\n\tonModeChange?: (mode: PillMode) => void\n\tclassName?: string\n}\n\n// Spring configuration for size changes\nconst sizeSpring = {\n\ttype: 'spring' as const,\n\tstiffness: 300,\n\tdamping: 28,\n\tmass: 0.8,\n}\n\n// Container size variants - minimalist, compact spacing\nconst containerVariants: Record<\n\tPillMode,\n\t{ width: string; height: string; padding: string; borderRadius: string }\n> = {\n\tcollapsed: {\n\t\twidth: '40px',\n\t\theight: '3px',\n\t\tpadding: '0px',\n\t\tborderRadius: '9999px',\n\t},\n\thovered: {\n\t\twidth: '180px',\n\t\theight: '32px',\n\t\tpadding: '0px 12px',\n\t\tborderRadius: '9999px',\n\t},\n\tcomposing: {\n\t\twidth: 'min(360px, calc(100vw - 2rem))',\n\t\theight: 'auto',\n\t\tpadding: '10px 14px',\n\t\tborderRadius: '20px',\n\t},\n\tactive: {\n\t\twidth: 'min(360px, calc(100vw - 2rem))',\n\t\theight: 'auto',\n\t\tpadding: '10px 14px',\n\t\tborderRadius: '20px',\n\t},\n\texpanded: {\n\t\twidth: 'min(400px, calc(100vw - 2rem))',\n\t\theight: 'auto',\n\t\tpadding: '12px 16px',\n\t\tborderRadius: '20px',\n\t},\n}\n\n// Content animation variants\nconst contentVariants: Variants = {\n\thidden: {\n\t\topacity: 0,\n\t\ty: 8,\n\t\tscale: 0.95,\n\t},\n\tvisible: {\n\t\topacity: 1,\n\t\ty: 0,\n\t\tscale: 1,\n\t\ttransition: {\n\t\t\ttype: 'spring',\n\t\t\tstiffness: 500,\n\t\t\tdamping: 30,\n\t\t\tstaggerChildren: 0.05,\n\t\t},\n\t},\n\texit: {\n\t\topacity: 0,\n\t\ty: -4,\n\t\tscale: 0.98,\n\t\ttransition: {\n\t\t\tduration: 0.15,\n\t\t\tease: 'easeOut',\n\t\t},\n\t},\n}\n\n// Hint text animation\nconst hintVariants: Variants = {\n\thidden: { opacity: 0, scale: 0.9 },\n\tvisible: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\ttransition: { delay: 0.1, duration: 0.2 },\n\t},\n\texit: {\n\t\topacity: 0,\n\t\tscale: 0.9,\n\t\ttransition: { duration: 0.1 },\n\t},\n}\n\n// Collapsed bar animation\nconst barVariants: Variants = {\n\tidle: {\n\t\topacity: 0.6,\n\t\tscaleX: 1,\n\t},\n\thover: {\n\t\topacity: 1,\n\t\tscaleX: 1.1,\n\t\ttransition: { duration: 0.2 },\n\t},\n}\n\n/**\n * Morphing container that changes size and shape based on state.\n * Uses spring animations for smooth, natural transitions.\n *\n * States:\n * - collapsed: Tiny 4px tall bar (ambient)\n * - hovered: Medium pill with prompt\n * - composing: User is typing\n * - active: Agent is working\n * - expanded: Full panel with summary/forms\n */\nexport const PillContainer: FC<PillContainerProps> = ({\n\tmode,\n\tchildren,\n\tonModeChange,\n\tclassName,\n}) => {\n\tconst [isHovered, setIsHovered] = useState(false)\n\tconst hoverTimeoutRef = useRef<NodeJS.Timeout | null>(null)\n\n\t// Handle hover with debounce\n\tconst handleMouseEnter = useCallback(() => {\n\t\tif (hoverTimeoutRef.current) {\n\t\t\tclearTimeout(hoverTimeoutRef.current)\n\t\t}\n\t\thoverTimeoutRef.current = setTimeout(() => {\n\t\t\tsetIsHovered(true)\n\t\t\tif (mode === 'collapsed') {\n\t\t\t\tonModeChange?.('hovered')\n\t\t\t}\n\t\t}, 100) // Reduced from 150ms for snappier feel\n\t}, [mode, onModeChange])\n\n\tconst handleMouseLeave = useCallback(() => {\n\t\tif (hoverTimeoutRef.current) {\n\t\t\tclearTimeout(hoverTimeoutRef.current)\n\t\t}\n\t\tsetIsHovered(false)\n\t\tif (mode === 'hovered') {\n\t\t\t// Small delay before collapsing to prevent flicker\n\t\t\thoverTimeoutRef.current = setTimeout(() => {\n\t\t\t\tonModeChange?.('collapsed')\n\t\t\t}, 50)\n\t\t}\n\t}, [mode, onModeChange])\n\n\t// Handle click to expand\n\tconst handleClick = useCallback(() => {\n\t\tif (mode === 'collapsed' || mode === 'hovered') {\n\t\t\tonModeChange?.('composing')\n\t\t}\n\t}, [mode, onModeChange])\n\n\t// Handle keyboard shortcut (Cmd+Shift+K or Ctrl+Shift+K)\n\tuseEffect(() => {\n\t\tconst handleKeyDown = (e: KeyboardEvent) => {\n\t\t\tconst isShortcut = (e.ctrlKey || e.metaKey) && e.shiftKey && e.key.toLowerCase() === 'k'\n\n\t\t\tif (isShortcut) {\n\t\t\t\te.preventDefault()\n\t\t\t\tif (mode === 'collapsed') {\n\t\t\t\t\tonModeChange?.('composing')\n\t\t\t\t} else if (mode === 'composing' || mode === 'hovered') {\n\t\t\t\t\tonModeChange?.('collapsed')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\twindow.addEventListener('keydown', handleKeyDown)\n\t\treturn () => window.removeEventListener('keydown', handleKeyDown)\n\t}, [mode, onModeChange])\n\n\t// Clean up timeout on unmount\n\tuseEffect(() => {\n\t\treturn () => {\n\t\t\tif (hoverTimeoutRef.current) {\n\t\t\t\tclearTimeout(hoverTimeoutRef.current)\n\t\t\t}\n\t\t}\n\t}, [])\n\n\tconst showContent = mode !== 'collapsed' && mode !== 'hovered'\n\tconst currentVariant = containerVariants[mode]\n\n\t// Determine glass styling class based on mode\n\tconst glassClassName = cn(\n\t\t'relative overflow-hidden',\n\t\t// GPU acceleration hint\n\t\t'will-change-transform',\n\t\t// Base glass styling (overridden by mode-specific classes)\n\t\tmode === 'collapsed' && 'glass-pill-collapsed glass-shimmer',\n\t\tmode === 'hovered' && 'glass-pill-hovered',\n\t\t(mode === 'composing' || mode === 'expanded') && 'glass-pill',\n\t\tmode === 'active' && 'glass-pill glass-active',\n\t\tclassName\n\t)\n\n\treturn (\n\t\t<motion.div\n\t\t\tlayout\n\t\t\tclassName={glassClassName}\n\t\t\tinitial={false}\n\t\t\tanimate={{\n\t\t\t\twidth: currentVariant.width,\n\t\t\t\theight: currentVariant.height,\n\t\t\t\tpadding: currentVariant.padding,\n\t\t\t\tborderRadius: currentVariant.borderRadius,\n\t\t\t}}\n\t\t\ttransition={sizeSpring}\n\t\t\tonMouseEnter={handleMouseEnter}\n\t\t\tonMouseLeave={handleMouseLeave}\n\t\t\tonClick={handleClick}\n\t\t\trole={mode === 'collapsed' || mode === 'hovered' ? 'button' : undefined}\n\t\t\ttabIndex={mode === 'collapsed' || mode === 'hovered' ? 0 : undefined}\n\t\t\taria-label={mode === 'collapsed' ? 'Open assistant' : undefined}\n\t\t\tstyle={{\n\t\t\t\tminHeight: showContent ? '60px' : undefined,\n\t\t\t}}\n\t\t>\n\t\t\t{/* Collapsed state - glass shimmer highlight */}\n\t\t\t<AnimatePresence mode=\"wait\">\n\t\t\t\t{mode === 'collapsed' && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tkey=\"collapsed-bar\"\n\t\t\t\t\t\tclassName=\"absolute inset-0\"\n\t\t\t\t\t\tvariants={barVariants}\n\t\t\t\t\t\tinitial=\"idle\"\n\t\t\t\t\t\tanimate={isHovered ? 'hover' : 'idle'}\n\t\t\t\t\t\texit={{ opacity: 0, transition: { duration: 0.1 } }}\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tbackground: 'linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent)',\n\t\t\t\t\t\t\tbackgroundSize: '200% 100%',\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</AnimatePresence>\n\n\t\t\t{/* Hovered state - hint text */}\n\t\t\t<AnimatePresence mode=\"wait\">\n\t\t\t\t{mode === 'hovered' && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tkey=\"hover-hint\"\n\t\t\t\t\t\tclassName=\"relative z-10 flex h-full w-full items-center justify-center\"\n\t\t\t\t\t\tvariants={hintVariants}\n\t\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\t\tanimate=\"visible\"\n\t\t\t\t\t\texit=\"exit\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"text-xs text-white/70\">\n\t\t\t\t\t\t\tClick or{' '}\n\t\t\t\t\t\t\t<kbd className=\"rounded bg-white/10 px-1.5 py-0.5 font-mono text-[10px]\">⌘⇧K</kbd>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</motion.div>\n\t\t\t\t)}\n\t\t\t</AnimatePresence>\n\n\t\t\t{/* Expanded content - z-10 ensures content sits above glass highlight overlays */}\n\t\t\t<AnimatePresence mode=\"wait\">\n\t\t\t\t{showContent && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tkey=\"content\"\n\t\t\t\t\t\tclassName=\"relative z-10 flex flex-col gap-2\"\n\t\t\t\t\t\tvariants={contentVariants}\n\t\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\t\tanimate=\"visible\"\n\t\t\t\t\t\texit=\"exit\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</motion.div>\n\t\t\t\t)}\n\t\t\t</AnimatePresence>\n\t\t</motion.div>\n\t)\n}\n\n/**\n * Hook to manage pill mode based on thread state\n */\nexport function usePillMode(\n\tisRunning: boolean,\n\thasPendingInput: boolean,\n\thasMessages: boolean\n): { mode: PillMode; setMode: (mode: PillMode) => void } {\n\tconst [userMode, setUserMode] = useState<PillMode>('collapsed')\n\n\t// Derive mode from state\n\tlet derivedMode: PillMode = userMode\n\n\tif (hasPendingInput) {\n\t\tderivedMode = 'expanded'\n\t} else if (isRunning) {\n\t\tderivedMode = 'active'\n\t} else if (hasMessages && userMode === 'collapsed') {\n\t\t// After agent completes, stay expanded to show summary\n\t\tderivedMode = 'expanded'\n\t}\n\n\treturn { mode: derivedMode, setMode: setUserMode }\n}\n","'use client'\n\nimport { Mic, MicOff, PhoneOff } from 'lucide-react'\nimport { AnimatePresence, motion } from 'motion/react'\nimport { useCallback } from 'react'\n\nimport { cn } from '../../lib/utils'\nimport { useOptionalVoiceModeContext } from '../../providers/VoiceModeProvider'\nimport { LiveWaveform } from '../live-waveform'\n\nimport type { FC } from 'react'\nimport type { ToolBorderStatus } from './ToolStatusBorder'\n\ninterface PillVoiceProps {\n\t/** Callback when voice mode ends */\n\tonEnd?: () => void\n\t/** Whether to show a compact version */\n\tcompact?: boolean\n\t/** Additional class name */\n\tclassName?: string\n}\n\n// Animation variants for the voice UI\nconst voiceVariants = {\n\thidden: {\n\t\topacity: 0,\n\t\tscale: 0.95,\n\t\ty: 4,\n\t},\n\tvisible: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\ty: 0,\n\t\ttransition: {\n\t\t\ttype: 'spring' as const,\n\t\t\tstiffness: 400,\n\t\t\tdamping: 30,\n\t\t},\n\t},\n\texit: {\n\t\topacity: 0,\n\t\tscale: 0.95,\n\t\ty: -4,\n\t\ttransition: {\n\t\t\tduration: 0.15,\n\t\t},\n\t},\n}\n\n// Button animation\nconst buttonVariants = {\n\tidle: { scale: 1 },\n\thover: { scale: 1.05 },\n\ttap: { scale: 0.95 },\n}\n\n// Transcript animation\nconst transcriptVariants = {\n\thidden: { opacity: 0, height: 0 },\n\tvisible: {\n\t\topacity: 1,\n\t\theight: 'auto',\n\t\ttransition: {\n\t\t\ttype: 'spring' as const,\n\t\t\tstiffness: 300,\n\t\t\tdamping: 25,\n\t\t},\n\t},\n\texit: {\n\t\topacity: 0,\n\t\theight: 0,\n\t\ttransition: {\n\t\t\tduration: 0.1,\n\t\t},\n\t},\n}\n\n/**\n * Convert voice mode tool call status to border status\n */\nexport function voiceToolCallToBorderStatus(toolCall?: {\n\tstatus: 'started' | 'completed'\n\terror?: string\n}): ToolBorderStatus {\n\tif (!toolCall) return 'idle'\n\tif (toolCall.status === 'started') return 'calling'\n\tif (toolCall.status === 'completed') {\n\t\treturn toolCall.error ? 'error' : 'success'\n\t}\n\treturn 'idle'\n}\n\n/**\n * Compact voice mode UI for the pill.\n * Shows waveforms, controls, and transcript preview.\n * Uses motion animations for smooth transitions.\n */\nexport const PillVoice: FC<PillVoiceProps> = ({ onEnd, compact = false, className }) => {\n\tconst voiceMode = useOptionalVoiceModeContext()\n\n\tconst handleEnd = useCallback(() => {\n\t\tvoiceMode?.stopSession()\n\t\tonEnd?.()\n\t}, [voiceMode, onEnd])\n\n\tconst handleToggleMute = useCallback(() => {\n\t\tvoiceMode?.toggleMute()\n\t}, [voiceMode])\n\n\t// Don't render if no voice context or not active/connecting/error\n\tif (!voiceMode || (!voiceMode.isActive && !voiceMode.isConnecting && !voiceMode.isError)) {\n\t\treturn null\n\t}\n\n\tconst { isActive, isConnecting, isMuted, isError, error, audioLevel, transcript, toolCall } =\n\t\tvoiceMode\n\tconst micLevel = audioLevel?.micLevel ?? 0\n\tconst speakerLevel = audioLevel?.speakerLevel ?? 0\n\n\treturn (\n\t\t<motion.div\n\t\t\tclassName={cn('flex flex-col gap-3', className)}\n\t\t\tvariants={voiceVariants}\n\t\t\tinitial=\"hidden\"\n\t\t\tanimate=\"visible\"\n\t\t\texit=\"exit\"\n\t\t>\n\t\t\t{/* Waveforms row */}\n\t\t\t<div className=\"flex items-center gap-3\">\n\t\t\t\t{/* User mic indicator */}\n\t\t\t\t<div className=\"flex flex-1 items-center gap-2\">\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'flex h-7 w-7 shrink-0 items-center justify-center rounded-full',\n\t\t\t\t\t\t\tisMuted ? 'bg-red-500/20 text-red-400' : 'bg-white/10 text-white/80'\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tanimate={{ opacity: isMuted ? 0.6 : 1 }}\n\t\t\t\t\t>\n\t\t\t\t\t\t{isMuted ? <MicOff className=\"h-3.5 w-3.5\" /> : <Mic className=\"h-3.5 w-3.5\" />}\n\t\t\t\t\t</motion.div>\n\n\t\t\t\t\t<div className={cn('h-5 flex-1', compact ? 'max-w-16' : 'max-w-24')}>\n\t\t\t\t\t\t<LiveWaveform\n\t\t\t\t\t\t\tactive={isActive && !isMuted}\n\t\t\t\t\t\t\tprocessing={isConnecting}\n\t\t\t\t\t\t\tmanualAudioLevel={micLevel}\n\t\t\t\t\t\t\tbarWidth={2}\n\t\t\t\t\t\t\tbarGap={1}\n\t\t\t\t\t\t\tbarRadius={1}\n\t\t\t\t\t\t\tbarColor=\"rgba(255, 255, 255, 0.7)\"\n\t\t\t\t\t\t\theight={20}\n\t\t\t\t\t\t\tmode=\"static\"\n\t\t\t\t\t\t\tsensitivity={2.0}\n\t\t\t\t\t\t\tfadeEdges={false}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\n\t\t\t\t{/* Separator */}\n\t\t\t\t<div className=\"h-5 w-px bg-white/10\" />\n\n\t\t\t\t{/* Agent speaker indicator */}\n\t\t\t\t<div className=\"flex flex-1 items-center gap-2\">\n\t\t\t\t\t<div className={cn('h-5 flex-1', compact ? 'max-w-16' : 'max-w-24')}>\n\t\t\t\t\t\t<LiveWaveform\n\t\t\t\t\t\t\tactive={isActive}\n\t\t\t\t\t\t\tprocessing={isConnecting}\n\t\t\t\t\t\t\tmanualAudioLevel={speakerLevel}\n\t\t\t\t\t\t\tbarWidth={2}\n\t\t\t\t\t\t\tbarGap={1}\n\t\t\t\t\t\t\tbarRadius={1}\n\t\t\t\t\t\t\tbarColor=\"rgba(255, 255, 255, 0.4)\"\n\t\t\t\t\t\t\theight={20}\n\t\t\t\t\t\t\tmode=\"static\"\n\t\t\t\t\t\t\tsensitivity={2.0}\n\t\t\t\t\t\t\tfadeEdges={false}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t{/* Agent avatar */}\n\t\t\t\t\t<div className=\"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-white/10\">\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tclassName=\"h-2.5 w-2.5 rounded-full bg-green-400\"\n\t\t\t\t\t\t\tanimate={{\n\t\t\t\t\t\t\t\tscale: speakerLevel > 0.1 ? [1, 1.2, 1] : 1,\n\t\t\t\t\t\t\t\topacity: speakerLevel > 0.1 ? 1 : 0.5,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\ttransition={{ duration: 0.2 }}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\n\t\t\t\t{/* Separator */}\n\t\t\t\t<div className=\"h-5 w-px bg-white/10\" />\n\n\t\t\t\t{/* Controls */}\n\t\t\t\t<div className=\"flex shrink-0 items-center gap-1.5\">\n\t\t\t\t\t{/* Mute button */}\n\t\t\t\t\t<motion.button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={handleToggleMute}\n\t\t\t\t\t\tdisabled={!isActive}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'flex h-7 w-7 items-center justify-center rounded-full',\n\t\t\t\t\t\t\t'transition-colors duration-150',\n\t\t\t\t\t\t\tisMuted\n\t\t\t\t\t\t\t\t? 'bg-red-500/20 text-red-400 hover:bg-red-500/30'\n\t\t\t\t\t\t\t\t: 'bg-white/10 text-white/70 hover:bg-white/20 hover:text-white'\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tvariants={buttonVariants}\n\t\t\t\t\t\tinitial=\"idle\"\n\t\t\t\t\t\twhileHover=\"hover\"\n\t\t\t\t\t\twhileTap=\"tap\"\n\t\t\t\t\t\taria-label={isMuted ? 'Unmute microphone' : 'Mute microphone'}\n\t\t\t\t\t>\n\t\t\t\t\t\t{isMuted ? <MicOff className=\"h-3.5 w-3.5\" /> : <Mic className=\"h-3.5 w-3.5\" />}\n\t\t\t\t\t</motion.button>\n\n\t\t\t\t\t{/* End button */}\n\t\t\t\t\t<motion.button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={handleEnd}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'flex h-7 w-7 items-center justify-center rounded-full',\n\t\t\t\t\t\t\t'bg-red-500/20 text-red-400',\n\t\t\t\t\t\t\t'hover:bg-red-500/30 hover:text-red-300',\n\t\t\t\t\t\t\t'transition-colors duration-150'\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tvariants={buttonVariants}\n\t\t\t\t\t\tinitial=\"idle\"\n\t\t\t\t\t\twhileHover=\"hover\"\n\t\t\t\t\t\twhileTap=\"tap\"\n\t\t\t\t\t\taria-label=\"End voice session\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<PhoneOff className=\"h-3.5 w-3.5\" />\n\t\t\t\t\t</motion.button>\n\t\t\t\t</div>\n\t\t\t</div>\n\n\t\t\t{/* Tool call indicator */}\n\t\t\t<AnimatePresence>\n\t\t\t\t{toolCall && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'flex max-w-full items-center gap-2 rounded-full px-3 py-1.5',\n\t\t\t\t\t\t\t'text-xs',\n\t\t\t\t\t\t\ttoolCall.status === 'started' && 'bg-blue-500/10 text-blue-400',\n\t\t\t\t\t\t\ttoolCall.status === 'completed' &&\n\t\t\t\t\t\t\t\t!toolCall.error &&\n\t\t\t\t\t\t\t\t'bg-green-500/10 text-green-400',\n\t\t\t\t\t\t\ttoolCall.status === 'completed' && toolCall.error && 'bg-red-500/10 text-red-400'\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tinitial={{ opacity: 0, y: -4 }}\n\t\t\t\t\t\tanimate={{ opacity: 1, y: 0 }}\n\t\t\t\t\t\texit={{ opacity: 0, y: -4 }}\n\t\t\t\t\t\ttransition={{ type: 'spring', stiffness: 400, damping: 30 }}\n\t\t\t\t\t>\n\t\t\t\t\t\t<motion.span\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t'h-1.5 w-1.5 shrink-0 rounded-full',\n\t\t\t\t\t\t\t\ttoolCall.status === 'started' && 'bg-blue-500',\n\t\t\t\t\t\t\t\ttoolCall.status === 'completed' && !toolCall.error && 'bg-green-500',\n\t\t\t\t\t\t\t\ttoolCall.status === 'completed' && toolCall.error && 'bg-red-500'\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tanimate={toolCall.status === 'started' ? { opacity: [1, 0.5, 1] } : {}}\n\t\t\t\t\t\t\ttransition={{ duration: 0.8, repeat: Infinity }}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<span className=\"min-w-0 truncate\">{toolCall.toolName}</span>\n\t\t\t\t\t</motion.div>\n\t\t\t\t)}\n\t\t\t</AnimatePresence>\n\n\t\t\t{/* Transcript preview */}\n\t\t\t<AnimatePresence>\n\t\t\t\t{transcript && transcript.text && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"overflow-hidden\"\n\t\t\t\t\t\tvariants={transcriptVariants}\n\t\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\t\tanimate=\"visible\"\n\t\t\t\t\t\texit=\"exit\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t'rounded-lg px-3 py-2 text-xs',\n\t\t\t\t\t\t\t\ttranscript.type === 'user'\n\t\t\t\t\t\t\t\t\t? 'bg-white/10 text-white/80'\n\t\t\t\t\t\t\t\t\t: 'bg-white/5 text-white/60'\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span className=\"mr-1.5 shrink-0 text-white/40\">\n\t\t\t\t\t\t\t\t{transcript.type === 'user' ? 'You:' : 'Agent:'}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className={cn('line-clamp-3', !transcript.isDone && 'animate-pulse')}>\n\t\t\t\t\t\t\t\t{transcript.text}\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</motion.div>\n\t\t\t\t)}\n\t\t\t</AnimatePresence>\n\n\t\t\t{/* Connecting state */}\n\t\t\t<AnimatePresence>\n\t\t\t\t{isConnecting && !isActive && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"flex items-center justify-center gap-2 py-2 text-xs text-white/50\"\n\t\t\t\t\t\tinitial={{ opacity: 0 }}\n\t\t\t\t\t\tanimate={{ opacity: 1 }}\n\t\t\t\t\t\texit={{ opacity: 0 }}\n\t\t\t\t\t>\n\t\t\t\t\t\t<motion.span\n\t\t\t\t\t\t\tclassName=\"h-1.5 w-1.5 rounded-full bg-amber-500\"\n\t\t\t\t\t\t\tanimate={{ opacity: [1, 0.5, 1] }}\n\t\t\t\t\t\t\ttransition={{ duration: 0.8, repeat: Infinity }}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<span>Connecting...</span>\n\t\t\t\t\t</motion.div>\n\t\t\t\t)}\n\t\t\t</AnimatePresence>\n\n\t\t\t{/* Error state */}\n\t\t\t<AnimatePresence>\n\t\t\t\t{isError && error && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName=\"flex items-center gap-2 rounded-lg bg-red-500/10 px-3 py-2 text-xs text-red-400\"\n\t\t\t\t\t\tinitial={{ opacity: 0, y: -4 }}\n\t\t\t\t\t\tanimate={{ opacity: 1, y: 0 }}\n\t\t\t\t\t\texit={{ opacity: 0, y: -4 }}\n\t\t\t\t\t>\n\t\t\t\t\t\t<span className=\"h-1.5 w-1.5 shrink-0 rounded-full bg-red-500\" />\n\t\t\t\t\t\t<span className=\"line-clamp-2\">{error}</span>\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tonClick={handleEnd}\n\t\t\t\t\t\t\tclassName=\"ml-auto shrink-0 text-red-300 hover:text-red-200\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tDismiss\n\t\t\t\t\t\t</button>\n\t\t\t\t\t</motion.div>\n\t\t\t\t)}\n\t\t\t</AnimatePresence>\n\t\t</motion.div>\n\t)\n}\n\n/**\n * Hook to get voice border status for the pill container\n */\nexport function useVoiceBorderStatus(): ToolBorderStatus {\n\tconst voiceMode = useOptionalVoiceModeContext()\n\n\tif (!voiceMode) return 'idle'\n\n\treturn voiceToolCallToBorderStatus(voiceMode.toolCall)\n}\n\nexport default PillVoice\n","'use client'\n\n/**\n * Markdown renderer for pill components.\n * Uses the same styling as the main MarkdownText but accepts content as a prop.\n */\nimport { memo } from 'react'\nimport ReactMarkdown from 'react-markdown'\nimport remarkGfm from 'remark-gfm'\n\nimport { cn } from '../../lib/utils'\n\nimport type { FC, HTMLAttributes } from 'react'\nimport type { Components } from 'react-markdown'\n\ninterface PillMarkdownProps {\n\tcontent: string\n\tclassName?: string\n\t/** Compact mode uses smaller text and tighter spacing */\n\tcompact?: boolean\n}\n\ntype ElementProps = HTMLAttributes<HTMLElement>\n\n/**\n * Markdown component for rendering content within pill UI.\n * Supports GitHub-flavored markdown with compact styling option.\n */\nexport const PillMarkdown: FC<PillMarkdownProps> = memo(({ content, className, compact }) => {\n\tconst components: Components = {\n\t\th1: ({ className: cn_, ...props }: ElementProps) => (\n\t\t\t<h1\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'aui-md-h1 mb-3 scroll-m-20 font-extrabold tracking-tight last:mb-0',\n\t\t\t\t\tcompact ? 'text-base' : 'text-lg',\n\t\t\t\t\tcn_\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t),\n\t\th2: ({ className: cn_, ...props }: ElementProps) => (\n\t\t\t<h2\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'aui-md-h2 mt-3 mb-2 scroll-m-20 font-semibold tracking-tight first:mt-0 last:mb-0',\n\t\t\t\t\tcompact ? 'text-sm' : 'text-base',\n\t\t\t\t\tcn_\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t),\n\t\th3: ({ className: cn_, ...props }: ElementProps) => (\n\t\t\t<h3\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'aui-md-h3 mt-2 mb-1 scroll-m-20 font-semibold tracking-tight first:mt-0 last:mb-0',\n\t\t\t\t\tcompact ? 'text-sm' : 'text-[15px]',\n\t\t\t\t\tcn_\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t),\n\t\tp: ({ className: cn_, ...props }: ElementProps) => (\n\t\t\t<p\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'aui-md-p leading-relaxed first:mt-0 last:mb-0',\n\t\t\t\t\tcompact ? 'text-xs my-1' : 'text-sm my-2',\n\t\t\t\t\tcn_\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t),\n\t\ta: ({ className: cn_, ...props }: HTMLAttributes<HTMLAnchorElement>) => (\n\t\t\t<a\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'aui-md-a font-medium text-primary underline underline-offset-4 hover:text-primary/80',\n\t\t\t\t\tcompact ? 'text-xs' : 'text-sm',\n\t\t\t\t\tcn_\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t),\n\t\tul: ({ className: cn_, ...props }: ElementProps) => (\n\t\t\t<ul\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'aui-md-ul ml-4 list-disc [&>li]:mt-0.5',\n\t\t\t\t\tcompact ? 'text-xs my-1' : 'text-sm my-2',\n\t\t\t\t\tcn_\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t),\n\t\tol: ({ className: cn_, ...props }: ElementProps) => (\n\t\t\t<ol\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'aui-md-ol ml-4 list-decimal [&>li]:mt-0.5',\n\t\t\t\t\tcompact ? 'text-xs my-1' : 'text-sm my-2',\n\t\t\t\t\tcn_\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t),\n\t\tli: ({ className: cn_, ...props }: ElementProps) => (\n\t\t\t<li className={cn('aui-md-li', cn_)} {...props} />\n\t\t),\n\t\tblockquote: ({ className: cn_, ...props }: ElementProps) => (\n\t\t\t<blockquote\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'aui-md-blockquote border-l-2 border-white/20 pl-3 italic text-white/70',\n\t\t\t\t\tcompact ? 'text-xs' : 'text-sm',\n\t\t\t\t\tcn_\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t),\n\t\tcode: ({ className: cn_, ...props }: ElementProps) => {\n\t\t\t// Check if this is inline code (no language class)\n\t\t\tconst isInline = !cn_?.includes('language-')\n\t\t\tif (isInline) {\n\t\t\t\treturn (\n\t\t\t\t\t<code\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'aui-md-inline-code rounded bg-white/10 px-1 py-0.5 font-mono',\n\t\t\t\t\t\t\tcompact ? 'text-[10px]' : 'text-xs',\n\t\t\t\t\t\t\tcn_\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...props}\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn (\n\t\t\t\t<code\n\t\t\t\t\tclassName={cn('aui-md-code block font-mono', compact ? 'text-[10px]' : 'text-xs', cn_)}\n\t\t\t\t\t{...props}\n\t\t\t\t/>\n\t\t\t)\n\t\t},\n\t\tpre: ({ className: cn_, ...props }: ElementProps) => (\n\t\t\t<pre\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'aui-md-pre overflow-x-auto rounded-lg bg-black/30 p-2 my-2',\n\t\t\t\t\tcompact ? 'text-[10px]' : 'text-xs',\n\t\t\t\t\tcn_\n\t\t\t\t)}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t),\n\t\thr: ({ className: cn_, ...props }: ElementProps) => (\n\t\t\t<hr className={cn('aui-md-hr my-2 border-white/10', cn_)} {...props} />\n\t\t),\n\t\tstrong: ({ className: cn_, ...props }: ElementProps) => (\n\t\t\t<strong className={cn('aui-md-strong font-semibold', cn_)} {...props} />\n\t\t),\n\t\tem: ({ className: cn_, ...props }: ElementProps) => (\n\t\t\t<em className={cn('aui-md-em italic', cn_)} {...props} />\n\t\t),\n\t}\n\n\treturn (\n\t\t<div className={cn('aui-md pill-markdown', compact && 'pill-markdown-compact', className)}>\n\t\t\t<ReactMarkdown remarkPlugins={[remarkGfm]} components={components}>\n\t\t\t\t{content}\n\t\t\t</ReactMarkdown>\n\t\t</div>\n\t)\n})\n\nPillMarkdown.displayName = 'PillMarkdown'\n","'use client'\n\nimport { useThread } from '@assistant-ui/react'\nimport { AlertCircle, CheckCircle2 } from 'lucide-react'\nimport { useMemo } from 'react'\n\nimport { cn } from '../../lib/utils'\nimport { PillMarkdown } from './PillMarkdown'\n\nimport type { FC, ReactNode } from 'react'\n\ninterface SummaryBlockProps {\n\tsummary: string\n\tisSuccess?: boolean\n\tisError?: boolean\n\tactions?: QuickAction[]\n\tclassName?: string\n}\n\ninterface QuickAction {\n\tlabel: string\n\tonClick: () => void\n\tvariant?: 'primary' | 'secondary'\n}\n\n/**\n * Summary block showing the agent's synthesized output.\n * Displayed after task completion instead of token streaming.\n */\nexport const SummaryBlock: FC<SummaryBlockProps> = ({\n\tsummary,\n\tisSuccess,\n\tisError,\n\tactions,\n\tclassName,\n}) => {\n\treturn (\n\t\t<div\n\t\t\tclassName={cn(\n\t\t\t\t'rounded-xl p-4',\n\t\t\t\tisSuccess && 'bg-green-500/10 border border-green-500/20',\n\t\t\t\tisError && 'bg-red-500/10 border border-red-500/20',\n\t\t\t\t!isSuccess && !isError && 'bg-white/5 border border-white/10',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t>\n\t\t\t{/* Status header */}\n\t\t\t{(isSuccess || isError) && (\n\t\t\t\t<div className=\"flex items-center gap-2 mb-3\">\n\t\t\t\t\t{isSuccess && <CheckCircle2 className=\"h-4 w-4 text-green-400\" />}\n\t\t\t\t\t{isError && <AlertCircle className=\"h-4 w-4 text-red-400\" />}\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'text-sm font-medium',\n\t\t\t\t\t\t\tisSuccess && 'text-green-400',\n\t\t\t\t\t\t\tisError && 'text-red-400'\n\t\t\t\t\t\t)}\n\t\t\t\t\t>\n\t\t\t\t\t\t{isSuccess ? 'Task Complete' : 'Error'}\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t)}\n\n\t\t\t{/* Summary content - markdown rendering */}\n\t\t\t<PillMarkdown content={summary} className=\"text-white/90\" />\n\n\t\t\t{/* Quick actions */}\n\t\t\t{actions && actions.length > 0 && (\n\t\t\t\t<div className=\"flex flex-wrap gap-2 mt-4 pt-3 border-t border-white/10\">\n\t\t\t\t\t{actions.map((action, i) => (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\tkey={i}\n\t\t\t\t\t\t\tonClick={action.onClick}\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t'px-3 py-1.5 rounded-lg text-sm font-medium',\n\t\t\t\t\t\t\t\t'transition-colors duration-200',\n\t\t\t\t\t\t\t\taction.variant === 'primary'\n\t\t\t\t\t\t\t\t\t? 'bg-primary text-primary-foreground hover:bg-primary/90'\n\t\t\t\t\t\t\t\t\t: 'bg-white/10 text-white/80 hover:bg-white/20'\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{action.label}\n\t\t\t\t\t\t</button>\n\t\t\t\t\t))}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</div>\n\t)\n}\n\ninterface TextPart {\n\ttype: 'text'\n\ttext: string\n}\n\n/**\n * Hook to get the latest summary from the thread\n * Returns the last text content from the last assistant message\n */\nexport function useLatestSummary(): string | null {\n\t// Use selector pattern to get messages reactively\n\tconst messages = useThread((thread) => thread.messages)\n\n\treturn useMemo(() => {\n\t\tif (!messages || messages.length === 0) return null\n\n\t\tconst lastAssistantMessage = [...messages].reverse().find((m) => m.role === 'assistant')\n\n\t\tif (!lastAssistantMessage) return null\n\n\t\t// Get the last text content\n\t\tconst textParts = lastAssistantMessage.content.filter((c): c is TextPart => c.type === 'text')\n\t\tconst lastText = textParts.at(-1)\n\n\t\tif (!lastText) return null\n\n\t\treturn lastText.text\n\t}, [messages])\n}\n\n/**\n * Welcome message for empty state\n */\nexport const WelcomeMessage: FC<{ className?: string }> = ({ className }) => {\n\treturn (\n\t\t<div className={cn('text-center py-4', className)}>\n\t\t\t<h3 className=\"text-lg font-semibold text-white mb-1\">Hello!</h3>\n\t\t\t<p className=\"text-sm text-white/60\">How can I help you today?</p>\n\t\t</div>\n\t)\n}\n\n/**\n * Wrapper for conditional content based on thread state\n */\nexport const ThreadContent: FC<{\n\tempty: ReactNode\n\trunning: ReactNode\n\tcomplete: ReactNode\n}> = ({ empty, running, complete }) => {\n\t// Use selector pattern to get messages reactively\n\tconst messages = useThread((thread) => thread.messages)\n\n\tif (!messages || messages.length === 0) {\n\t\treturn <>{empty}</>\n\t}\n\n\t// Check if currently running (last message is assistant and incomplete)\n\tconst lastMessage = messages.at(-1)\n\t// Status is an object with a type property, not a string\n\tconst isRunning = lastMessage?.role === 'assistant' && lastMessage.status?.type !== 'complete'\n\n\tif (isRunning) {\n\t\treturn <>{running}</>\n\t}\n\n\treturn <>{complete}</>\n}\n","'use client'\n\nimport { AnimatePresence, motion } from 'motion/react'\nimport { useEffect, useRef, useState } from 'react'\n\nimport { cn } from '../../lib/utils'\n\nimport type { FC, ReactNode } from 'react'\n\n// Minimalist: only idle, calling, and error states\n// Success is the default - no special treatment needed\nexport type ToolBorderStatus = 'idle' | 'calling' | 'success' | 'error'\n\ninterface ToolStatusBorderProps {\n\tstatus: ToolBorderStatus\n\tchildren: ReactNode\n\tclassName?: string\n\tborderRadius?: string\n}\n\n// Animation variants for the border glow\nconst borderVariants = {\n\tidle: {\n\t\topacity: 0,\n\t\tscale: 1,\n\t},\n\tcalling: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\ttransition: {\n\t\t\topacity: { duration: 0.15 },\n\t\t},\n\t},\n\terror: {\n\t\topacity: 1,\n\t\tscale: 1,\n\t\ttransition: {\n\t\t\topacity: { duration: 0.1 },\n\t\t},\n\t},\n}\n\n// Subtle shake animation for errors only\nconst shakeAnimation = {\n\tx: [0, -2, 2, -2, 2, 0],\n\ttransition: {\n\t\tduration: 0.3,\n\t\tease: [0.25, 0.1, 0.25, 1] as const,\n\t},\n}\n\n/**\n * Minimal animated border for tool execution status.\n *\n * - idle/success: clean, no border (success is the default state)\n * - calling: subtle animated gradient\n * - error: brief red flash with shake\n */\nexport const ToolStatusBorder: FC<ToolStatusBorderProps> = ({\n\tstatus,\n\tchildren,\n\tclassName,\n\tborderRadius = '20px',\n}) => {\n\t// Treat success as idle - no special visual treatment\n\tconst effectiveStatus = status === 'success' ? 'idle' : status\n\n\treturn (\n\t\t<motion.div\n\t\t\tclassName={cn('relative', className)}\n\t\t\tanimate={effectiveStatus === 'error' ? shakeAnimation : undefined}\n\t\t>\n\t\t\t{/* Animated border layer - only for calling and error */}\n\t\t\t<AnimatePresence>\n\t\t\t\t{effectiveStatus !== 'idle' && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'absolute -inset-[1px] pointer-events-none',\n\t\t\t\t\t\t\teffectiveStatus === 'calling' && 'tool-border-calling',\n\t\t\t\t\t\t\teffectiveStatus === 'error' && 'tool-border-error'\n\t\t\t\t\t\t)}\n\t\t\t\t\t\tstyle={{ borderRadius }}\n\t\t\t\t\t\tvariants={borderVariants}\n\t\t\t\t\t\tinitial=\"idle\"\n\t\t\t\t\t\tanimate={effectiveStatus}\n\t\t\t\t\t\texit={{ opacity: 0, transition: { duration: 0.15 } }}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t\t</AnimatePresence>\n\n\t\t\t{/* Inner content container - no ring for cleaner look */}\n\t\t\t<div className=\"relative\" style={{ borderRadius }}>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</motion.div>\n\t)\n}\n\n/**\n * Hook to manage tool border status based on actions.\n * Minimalist approach: success returns to idle immediately.\n */\nexport function useToolBorderStatus(\n\thasRunningAction: boolean,\n\tlastActionStatus?: 'success' | 'error' | null\n): ToolBorderStatus {\n\tconst [status, setStatus] = useState<ToolBorderStatus>('idle')\n\tconst timeoutRef = useRef<NodeJS.Timeout | null>(null)\n\n\tuseEffect(() => {\n\t\tif (timeoutRef.current) {\n\t\t\tclearTimeout(timeoutRef.current)\n\t\t\ttimeoutRef.current = null\n\t\t}\n\n\t\tif (hasRunningAction) {\n\t\t\tsetStatus('calling')\n\t\t} else if (lastActionStatus === 'error') {\n\t\t\tsetStatus('error')\n\t\t\t// Brief error flash, then back to idle\n\t\t\ttimeoutRef.current = setTimeout(() => {\n\t\t\t\tsetStatus('idle')\n\t\t\t}, 400)\n\t\t} else {\n\t\t\t// Success or no action = idle (clean state)\n\t\t\tsetStatus('idle')\n\t\t}\n\n\t\treturn () => {\n\t\t\tif (timeoutRef.current) {\n\t\t\t\tclearTimeout(timeoutRef.current)\n\t\t\t}\n\t\t}\n\t}, [hasRunningAction, lastActionStatus])\n\n\treturn status\n}\n","'use client'\n\nimport { ThreadPrimitive, useThread } from '@assistant-ui/react'\nimport { History } from 'lucide-react'\nimport { AnimatePresence } from 'motion/react'\nimport { useCallback, useMemo, useState } from 'react'\n\nimport { useActions, useCurrentAction, useRecentActions } from '../../hooks/useActions'\nimport { cn } from '../../lib/utils'\nimport { useOptionalVoiceModeContext } from '../../providers/VoiceModeProvider'\nimport { ActionList } from './ActionList'\nimport { CurrentActivity, IdleIndicator } from './CurrentActivity'\nimport { PillComposer } from './PillComposer'\nimport { PillContainer } from './PillContainer'\nimport { PillVoice, useVoiceBorderStatus } from './PillVoice'\nimport { SummaryBlock, useLatestSummary, WelcomeMessage } from './SummaryBlock'\nimport { ToolStatusBorder, useToolBorderStatus } from './ToolStatusBorder'\n\nimport type { FC } from 'react'\nimport type { PillMode } from './PillContainer'\n\ninterface AgentPillProps {\n\t/** Position of the pill on screen */\n\tposition?: 'bottom-center' | 'bottom-right'\n\t/** Callback when history button is clicked */\n\tonOpenHistory?: () => void\n\t/** Show voice button in composer */\n\tshowVoiceButton?: boolean\n\t/** Voice mode active state */\n\tisVoiceActive?: boolean\n\t/** Voice toggle callback */\n\tonVoiceToggle?: () => void\n\t/** Additional class name */\n\tclassName?: string\n}\n\n/**\n * Action-first agent pill UI.\n *\n * A compact, morphing interface that shows:\n * - Current activity when agent is working\n * - Action list (collapsible)\n * - Summary when complete\n * - Input composer\n *\n * Uses assistant-ui primitives for data binding.\n */\nexport const AgentPill: FC<AgentPillProps> = ({\n\tposition = 'bottom-center',\n\tonOpenHistory,\n\tshowVoiceButton = false,\n\tisVoiceActive = false,\n\tonVoiceToggle,\n\tclassName,\n}) => {\n\tconst [userMode, setUserMode] = useState<PillMode>('collapsed')\n\n\t// Get thread messages using selector pattern\n\tconst messages = useThread((thread) => thread.messages)\n\n\t// Voice mode state\n\tconst voiceMode = useOptionalVoiceModeContext()\n\tconst voiceBorderStatus = useVoiceBorderStatus()\n\t// Voice mode is active when connected, connecting, or showing an error\n\tconst isVoiceModeActive =\n\t\tvoiceMode?.isActive || voiceMode?.isConnecting || voiceMode?.isError || isVoiceActive\n\n\tconst actions = useActions()\n\tconst currentAction = useCurrentAction()\n\tconst recentActions = useRecentActions(3)\n\tconst summary = useLatestSummary()\n\n\t// Determine if thread has messages\n\tconst hasMessages = (messages?.length ?? 0) > 0\n\n\t// Determine if agent is running\n\tconst isRunning = useMemo(() => {\n\t\tif (!messages || messages.length === 0) return false\n\t\tconst lastMessage = messages.at(-1)\n\t\t// Status is an object with a type property, not a string\n\t\treturn lastMessage?.role === 'assistant' && lastMessage.status?.type !== 'complete'\n\t}, [messages])\n\n\t// Determine last action status for border animation\n\tconst lastCompletedAction = useMemo(() => {\n\t\tconst completed = actions.filter((a) => a.status === 'success' || a.status === 'error')\n\t\treturn completed.at(-1)\n\t}, [actions])\n\n\t// Get border status - use voice status when in voice mode\n\tconst textBorderStatus = useToolBorderStatus(\n\t\t!!currentAction,\n\t\tlastCompletedAction?.status === 'success'\n\t\t\t? 'success'\n\t\t\t: lastCompletedAction?.status === 'error'\n\t\t\t\t? 'error'\n\t\t\t\t: null\n\t)\n\tconst borderStatus = isVoiceModeActive ? voiceBorderStatus : textBorderStatus\n\n\t// Determine actual mode based on state\n\tconst mode = useMemo((): PillMode => {\n\t\t// Voice mode is active - always show as active\n\t\tif (isVoiceModeActive) return 'active'\n\n\t\t// User explicitly collapsed\n\t\tif (userMode === 'collapsed') return 'collapsed'\n\t\tif (userMode === 'hovered') return 'hovered'\n\n\t\t// Agent is running\n\t\tif (isRunning) return 'active'\n\n\t\t// Has messages (completed)\n\t\tif (hasMessages) return 'expanded'\n\n\t\t// User is composing\n\t\tif (userMode === 'composing') return 'composing'\n\n\t\treturn 'collapsed'\n\t}, [userMode, isRunning, hasMessages, isVoiceModeActive])\n\n\t// Handle mode changes\n\tconst handleModeChange = useCallback((newMode: PillMode) => {\n\t\tsetUserMode(newMode)\n\t}, [])\n\n\t// Handle voice toggle\n\tconst handleVoiceToggle = useCallback(() => {\n\t\tif (voiceMode) {\n\t\t\tif (voiceMode.isActive || voiceMode.isConnecting) {\n\t\t\t\tvoiceMode.stopSession()\n\t\t\t} else {\n\t\t\t\tvoid voiceMode.startSession()\n\t\t\t}\n\t\t}\n\t\tonVoiceToggle?.()\n\t}, [voiceMode, onVoiceToggle])\n\n\t// Get border radius for current mode\n\tconst borderRadius = mode === 'collapsed' || mode === 'hovered' ? '9999px' : '24px'\n\n\treturn (\n\t\t<ThreadPrimitive.Root\n\t\t\tclassName={cn(\n\t\t\t\t'fixed z-50',\n\t\t\t\tposition === 'bottom-center' && 'bottom-4 left-1/2 -translate-x-1/2',\n\t\t\t\tposition === 'bottom-right' && 'bottom-4 right-4',\n\t\t\t\tclassName\n\t\t\t)}\n\t\t>\n\t\t\t<ToolStatusBorder status={borderStatus} borderRadius={borderRadius}>\n\t\t\t\t<PillContainer mode={mode} onModeChange={handleModeChange}>\n\t\t\t\t\t{/* History button - shown when expanded (hidden in voice mode) */}\n\t\t\t\t\t{!isVoiceModeActive && mode !== 'collapsed' && mode !== 'hovered' && onOpenHistory && (\n\t\t\t\t\t\t<button\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tonClick={onOpenHistory}\n\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t'absolute top-3 right-3',\n\t\t\t\t\t\t\t\t'p-1.5 rounded-full',\n\t\t\t\t\t\t\t\t'hover:bg-white/10',\n\t\t\t\t\t\t\t\t'text-white/50 hover:text-white/80',\n\t\t\t\t\t\t\t\t'transition-colors duration-200'\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\taria-label=\"View conversation history\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<History className=\"h-4 w-4\" />\n\t\t\t\t\t\t</button>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{/* Voice mode UI - when voice is active */}\n\t\t\t\t\t<AnimatePresence mode=\"wait\">\n\t\t\t\t\t\t{isVoiceModeActive && <PillVoice key=\"voice-mode\" onEnd={handleVoiceToggle} />}\n\t\t\t\t\t</AnimatePresence>\n\n\t\t\t\t\t{/* Content based on mode - hidden when voice is active */}\n\t\t\t\t\t{!isVoiceModeActive && mode === 'composing' && !hasMessages && <WelcomeMessage />}\n\n\t\t\t\t\t{/* Current activity - when running (non-voice) */}\n\t\t\t\t\t{!isVoiceModeActive && mode === 'active' && (\n\t\t\t\t\t\t<CurrentActivity\n\t\t\t\t\t\t\tcurrentAction={currentAction}\n\t\t\t\t\t\t\trecentActions={recentActions}\n\t\t\t\t\t\t\tshowRecent={true}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\n\t\t\t\t\t{/* Summary - when completed */}\n\t\t\t\t\t{!isVoiceModeActive && mode === 'expanded' && !isRunning && summary && (\n\t\t\t\t\t\t<SummaryBlock summary={summary} isSuccess={!lastCompletedAction?.error} />\n\t\t\t\t\t)}\n\n\t\t\t\t\t{/* Idle indicator - when expanded but no activity */}\n\t\t\t\t\t{!isVoiceModeActive && mode === 'expanded' && !isRunning && !summary && <IdleIndicator />}\n\n\t\t\t\t\t{/* Action list - when we have actions */}\n\t\t\t\t\t{!isVoiceModeActive &&\n\t\t\t\t\t\t(mode === 'active' || mode === 'expanded') &&\n\t\t\t\t\t\tactions.length > 0 && (\n\t\t\t\t\t\t\t<ActionList actions={actions} defaultCollapsed={mode === 'active'} />\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t{/* Composer - always visible when expanded (hidden in voice mode) */}\n\t\t\t\t\t{!isVoiceModeActive &&\n\t\t\t\t\t\t(mode === 'composing' || mode === 'active' || mode === 'expanded') && (\n\t\t\t\t\t\t\t<PillComposer\n\t\t\t\t\t\t\t\tshowVoiceButton={showVoiceButton || !!voiceMode?.isSupported}\n\t\t\t\t\t\t\t\tisVoiceActive={isVoiceActive}\n\t\t\t\t\t\t\t\tonVoiceToggle={handleVoiceToggle}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t</PillContainer>\n\t\t\t</ToolStatusBorder>\n\t\t</ThreadPrimitive.Root>\n\t)\n}\n\nexport default AgentPill\n","'use client'\n\nimport { MessagePrimitive, ThreadPrimitive } from '@assistant-ui/react'\nimport { MessageSquare, X } from 'lucide-react'\nimport { useState } from 'react'\n\nimport { cn } from '../../lib/utils'\nimport { MarkdownText } from '../markdown-text'\nimport { ToolFallback } from '../tool-fallback'\n\nimport type { FC } from 'react'\n\n/**\n * Represents a conversation in history\n */\nexport interface Conversation {\n\tid: string\n\ttitle: string\n\tpreview: string\n\ttimestamp: Date\n\tmessageCount: number\n}\n\ninterface HistorySidebarProps {\n\tisOpen: boolean\n\tonClose: () => void\n\tconversations?: Conversation[]\n\tselectedId?: string | null\n\tonSelectConversation?: (id: string) => void\n\tclassName?: string\n}\n\n/**\n * Sidebar panel showing conversation history and full thread view.\n * Opens from the right side of the screen.\n */\nexport const HistorySidebar: FC<HistorySidebarProps> = ({\n\tisOpen,\n\tonClose,\n\tconversations = [],\n\tselectedId,\n\tonSelectConversation,\n\tclassName,\n}) => {\n\tconst [showFullThread, setShowFullThread] = useState(false)\n\n\treturn (\n\t\t<>\n\t\t\t{/* Backdrop */}\n\t\t\t{isOpen && (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"fixed inset-0 z-40 bg-black/50 backdrop-blur-sm\"\n\t\t\t\t\tonClick={onClose}\n\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{/* Sidebar panel */}\n\t\t\t<div\n\t\t\t\tclassName={cn(\n\t\t\t\t\t'fixed top-0 right-0 z-50',\n\t\t\t\t\t'h-full w-full max-w-md',\n\t\t\t\t\t'bg-slate-900/95 backdrop-blur-xl',\n\t\t\t\t\t'border-l border-white/10',\n\t\t\t\t\t'shadow-2xl',\n\t\t\t\t\t'transform transition-transform duration-300 ease-out',\n\t\t\t\t\tisOpen ? 'translate-x-0' : 'translate-x-full',\n\t\t\t\t\tclassName\n\t\t\t\t)}\n\t\t\t\trole=\"dialog\"\n\t\t\t\taria-modal=\"true\"\n\t\t\t\taria-label=\"Conversation history\"\n\t\t\t>\n\t\t\t\t{/* Header */}\n\t\t\t\t<div className=\"flex items-center justify-between px-4 py-3 border-b border-white/10\">\n\t\t\t\t\t<div className=\"flex items-center gap-2\">\n\t\t\t\t\t\t<MessageSquare className=\"h-5 w-5 text-white/70\" />\n\t\t\t\t\t\t<h2 className=\"text-lg font-semibold text-white\">\n\t\t\t\t\t\t\t{showFullThread ? 'Conversation' : 'History'}\n\t\t\t\t\t\t</h2>\n\t\t\t\t\t</div>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tonClick={onClose}\n\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t'p-1.5 rounded-lg',\n\t\t\t\t\t\t\t'hover:bg-white/10',\n\t\t\t\t\t\t\t'text-white/60 hover:text-white',\n\t\t\t\t\t\t\t'transition-colors duration-200'\n\t\t\t\t\t\t)}\n\t\t\t\t\t\taria-label=\"Close sidebar\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<X className=\"h-5 w-5\" />\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\n\t\t\t\t{/* Content */}\n\t\t\t\t<div className=\"flex flex-col h-[calc(100%-60px)] overflow-hidden\">\n\t\t\t\t\t{showFullThread && selectedId ? (\n\t\t\t\t\t\t/* Full thread view */\n\t\t\t\t\t\t<div className=\"flex-1 overflow-y-auto\">\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tonClick={() => setShowFullThread(false)}\n\t\t\t\t\t\t\t\tclassName=\"px-4 py-2 text-sm text-primary hover:underline\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t← Back to history\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t<FullThreadView />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t/* Conversation list */\n\t\t\t\t\t\t<div className=\"flex-1 overflow-y-auto p-4\">\n\t\t\t\t\t\t\t{conversations.length === 0 ? (\n\t\t\t\t\t\t\t\t<EmptyHistory />\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<ConversationList\n\t\t\t\t\t\t\t\t\tconversations={conversations}\n\t\t\t\t\t\t\t\t\tselectedId={selectedId}\n\t\t\t\t\t\t\t\t\tonSelect={(id) => {\n\t\t\t\t\t\t\t\t\t\tonSelectConversation?.(id)\n\t\t\t\t\t\t\t\t\t\tsetShowFullThread(true)\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</>\n\t)\n}\n\n/**\n * Empty state when no conversations exist\n */\nconst EmptyHistory: FC = () => {\n\treturn (\n\t\t<div className=\"flex flex-col items-center justify-center h-full text-center px-8\">\n\t\t\t<MessageSquare className=\"h-12 w-12 text-white/20 mb-4\" />\n\t\t\t<h3 className=\"text-lg font-medium text-white/80 mb-2\">No conversations yet</h3>\n\t\t\t<p className=\"text-sm text-white/50\">Your conversation history will appear here.</p>\n\t\t</div>\n\t)\n}\n\ninterface ConversationListProps {\n\tconversations: Conversation[]\n\tselectedId?: string | null\n\tonSelect: (id: string) => void\n}\n\n/**\n * List of conversations grouped by date\n */\nconst ConversationList: FC<ConversationListProps> = ({ conversations, selectedId, onSelect }) => {\n\t// Group conversations by date\n\tconst grouped = groupByDate(conversations)\n\n\treturn (\n\t\t<div className=\"space-y-6\">\n\t\t\t{grouped.map(([date, convos]) => (\n\t\t\t\t<div key={date}>\n\t\t\t\t\t<h3 className=\"text-xs font-medium text-white/50 uppercase tracking-wide mb-2\">{date}</h3>\n\t\t\t\t\t<div className=\"space-y-1\">\n\t\t\t\t\t\t{convos.map((convo) => (\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\tkey={convo.id}\n\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\tonClick={() => onSelect(convo.id)}\n\t\t\t\t\t\t\t\tclassName={cn(\n\t\t\t\t\t\t\t\t\t'w-full text-left p-3 rounded-lg',\n\t\t\t\t\t\t\t\t\t'hover:bg-white/10',\n\t\t\t\t\t\t\t\t\t'transition-colors duration-200',\n\t\t\t\t\t\t\t\t\tselectedId === convo.id && 'bg-white/10'\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<div className=\"font-medium text-white truncate\">{convo.title}</div>\n\t\t\t\t\t\t\t\t<div className=\"text-xs text-white/50 truncate mt-0.5\">{convo.preview}</div>\n\t\t\t\t\t\t\t\t<div className=\"text-[10px] text-white/30 mt-1\">\n\t\t\t\t\t\t\t\t\t{convo.messageCount} messages • {formatRelativeTime(convo.timestamp)}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t))}\n\t\t</div>\n\t)\n}\n\n/**\n * Full thread view using assistant-ui primitives\n */\nconst FullThreadView: FC = () => {\n\treturn (\n\t\t<ThreadPrimitive.Root className=\"flex flex-col h-full\">\n\t\t\t<ThreadPrimitive.Viewport className=\"flex-1 overflow-y-auto px-4 py-4\">\n\t\t\t\t<ThreadPrimitive.Messages\n\t\t\t\t\tcomponents={{\n\t\t\t\t\t\tUserMessage: HistoryUserMessage,\n\t\t\t\t\t\tAssistantMessage: HistoryAssistantMessage,\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</ThreadPrimitive.Viewport>\n\t\t</ThreadPrimitive.Root>\n\t)\n}\n\n/**\n * User message component for history view\n */\nconst HistoryUserMessage: FC = () => {\n\treturn (\n\t\t<MessagePrimitive.Root asChild>\n\t\t\t<div className=\"flex justify-end mb-4\">\n\t\t\t\t<div className=\"max-w-[80%] rounded-2xl bg-primary px-4 py-2 text-sm text-primary-foreground\">\n\t\t\t\t\t<MessagePrimitive.Parts />\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</MessagePrimitive.Root>\n\t)\n}\n\n/**\n * Assistant message component for history view\n */\nconst HistoryAssistantMessage: FC = () => {\n\treturn (\n\t\t<MessagePrimitive.Root asChild>\n\t\t\t<div className=\"mb-4\">\n\t\t\t\t<div className=\"text-sm text-white/90\">\n\t\t\t\t\t<MessagePrimitive.Parts\n\t\t\t\t\t\tcomponents={{\n\t\t\t\t\t\t\tText: MarkdownText,\n\t\t\t\t\t\t\ttools: { Fallback: ToolFallback },\n\t\t\t\t\t\t}}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</MessagePrimitive.Root>\n\t)\n}\n\n/**\n * Group conversations by date\n */\nfunction groupByDate(conversations: Conversation[]): Array<[string, Conversation[]]> {\n\tconst groups = new Map<string, Conversation[]>()\n\n\tconst today = new Date()\n\ttoday.setHours(0, 0, 0, 0)\n\n\tconst yesterday = new Date(today)\n\tyesterday.setDate(yesterday.getDate() - 1)\n\n\tfor (const convo of conversations) {\n\t\tconst convoDate = new Date(convo.timestamp)\n\t\tconvoDate.setHours(0, 0, 0, 0)\n\n\t\tlet dateKey: string\n\t\tif (convoDate.getTime() === today.getTime()) {\n\t\t\tdateKey = 'Today'\n\t\t} else if (convoDate.getTime() === yesterday.getTime()) {\n\t\t\tdateKey = 'Yesterday'\n\t\t} else if (convoDate.getTime() > today.getTime() - 7 * 24 * 60 * 60 * 1000) {\n\t\t\tdateKey = 'This Week'\n\t\t} else {\n\t\t\tdateKey = convoDate.toLocaleDateString('en-US', { month: 'long', year: 'numeric' })\n\t\t}\n\n\t\tif (!groups.has(dateKey)) {\n\t\t\tgroups.set(dateKey, [])\n\t\t}\n\t\tgroups.get(dateKey)!.push(convo)\n\t}\n\n\treturn Array.from(groups.entries())\n}\n\n/**\n * Format relative time\n */\nfunction formatRelativeTime(date: Date): string {\n\tconst now = new Date()\n\tconst diffMs = now.getTime() - date.getTime()\n\tconst diffMins = Math.floor(diffMs / 60000)\n\tconst diffHours = Math.floor(diffMs / 3600000)\n\tconst diffDays = Math.floor(diffMs / 86400000)\n\n\tif (diffMins < 1) return 'just now'\n\tif (diffMins < 60) return `${diffMins} min ago`\n\tif (diffHours < 24) return `${diffHours} hr ago`\n\tif (diffDays < 7) return `${diffDays} days ago`\n\n\treturn date.toLocaleDateString('en-US', { month: 'short', day: 'numeric' })\n}\n\nexport default HistorySidebar\n","/**\n * Auto-generated file - DO NOT EDIT\n * Generated by scripts/generate-inline-styles.js\n *\n * Contains the compiled CSS for the web component standalone build.\n */\n\nexport const WEBMCP_STYLES = \"/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */\\n@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tool-border-angle:0deg}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\",\\\"Segoe UI Symbol\\\",\\\"Noto Color Emoji\\\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\\\"Liberation Mono\\\",\\\"Courier New\\\",monospace;--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-amber-500:oklch(76.9% .188 70.08);--color-yellow-500:oklch(79.5% .184 86.047);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-emerald-500:oklch(69.6% .17 162.48);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-slate-900:oklch(20.8% .042 265.755);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--container-3xl:48rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-base:1rem;--text-base--line-height:calc(1.5/1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--text-2xl:1.5rem;--text-2xl--line-height:calc(2/1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25/1.875);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--tracking-tight:-.025em;--tracking-wide:.025em;--leading-relaxed:1.625;--radius-xs:.125rem;--radius-2xl:1rem;--radius-3xl:1.5rem;--drop-shadow-xl:0 9px 7px #0000001a;--drop-shadow-2xl:0 25px 25px #00000026;--ease-out:cubic-bezier(0,0,.2,1);--ease-in-out:cubic-bezier(.4,0,.2,1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4,0,.6,1)infinite;--blur-sm:8px;--blur-md:12px;--blur-xl:24px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\",\\\"Segoe UI Symbol\\\",\\\"Noto Color Emoji\\\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\\\"Liberation Mono\\\",\\\"Courier New\\\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}:root{--radius:.75rem;--background:oklch(100% 0 0);--foreground:oklch(14.1% .005 285.823);--card:oklch(100% 0 0);--card-foreground:oklch(14.1% .005 285.823);--popover:oklch(100% 0 0);--popover-foreground:oklch(14.1% .005 285.823);--primary:oklch(21% .006 285.885);--primary-foreground:oklch(98.5% 0 0);--secondary:oklch(96.7% .001 286.375);--secondary-foreground:oklch(21% .006 285.885);--muted:oklch(96.7% .001 286.375);--muted-foreground:oklch(55.2% .016 285.938);--accent:oklch(96.7% .001 286.375);--accent-foreground:oklch(21% .006 285.885);--destructive:oklch(57.7% .245 27.325);--destructive-foreground:oklch(98.5% 0 0);--border:oklch(92% .004 286.32);--input:oklch(92% .004 286.32);--ring:oklch(70.5% .015 286.067)}.dark{--background:oklch(14.1% .005 285.823);--foreground:oklch(98.5% 0 0);--card:oklch(21% .006 285.885);--card-foreground:oklch(98.5% 0 0);--popover:oklch(21% .006 285.885);--popover-foreground:oklch(98.5% 0 0);--primary:oklch(92% .004 286.32);--primary-foreground:oklch(21% .006 285.885);--secondary:oklch(27.4% .006 286.033);--secondary-foreground:oklch(98.5% 0 0);--muted:oklch(27.4% .006 286.033);--muted-foreground:oklch(70.5% .015 286.067);--accent:oklch(27.4% .006 286.033);--accent-foreground:oklch(98.5% 0 0);--destructive:oklch(70.4% .191 22.216);--destructive-foreground:oklch(98.5% 0 0);--border:oklch(100% 0 0/.1);--input:oklch(100% 0 0/.15);--ring:oklch(55.2% .016 285.938)}*{border-color:var(--border);outline-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){*{outline-color:color-mix(in oklch,var(--ring),transparent 50%)}}body{background-color:var(--background);color:var(--foreground)}}@layer components{.app-shell{z-index:0;background-color:var(--background);background-image:radial-gradient(80% 60% at -10% -10%,oklch(82% .15 270/.15),#0000),radial-gradient(60% 50% at 110% 10%,oklch(85% .1 220/.12),#0000),radial-gradient(50% 45% at 50% 120%,oklch(95% .02 250/.08),#0000);position:relative}.dark .app-shell{background-image:radial-gradient(80% 60% at -10% -10%,oklch(55% .14 270/.25),#0000),radial-gradient(60% 50% at 110% 15%,oklch(60% .12 220/.22),#0000),radial-gradient(50% 45% at 50% 120%,oklch(35% .04 250/.16),#0000)}.app-shell:before,.app-shell:after{content:\\\"\\\";pointer-events:none;filter:blur(32px);opacity:.6;z-index:-1;border-radius:9999px;position:absolute;inset:auto}.app-shell:before{background:radial-gradient(60% 60% at 40% 40%,oklch(80% .12 270/.3),#0000);width:260px;height:260px;top:-60px;left:-80px}.app-shell:after{background:radial-gradient(60% 60% at 60% 60%,oklch(84% .1 220/.25),#0000);width:300px;height:300px;bottom:-80px;right:-60px}.toolbar-surface{border-top:1px solid var(--border);background:linear-gradient(to right,var(--background),var(--background),var(--background))}@supports (color:color-mix(in lab, red, red)){.toolbar-surface{background:linear-gradient(to right,var(--background),color-mix(in oklch,var(--background),transparent 5%),var(--background))}}.toolbar-surface{-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}@supports ((-webkit-backdrop-filter:blur(12px)) or (backdrop-filter:blur(12px))){.toolbar-surface{background:var(--background)}@supports (color:color-mix(in lab, red, red)){.toolbar-surface{background:color-mix(in oklch,var(--background),transparent 20%)}}}.toolbar-surface-top{border-bottom:1px solid var(--border);background:linear-gradient(to right,var(--background),var(--background),var(--background))}@supports (color:color-mix(in lab, red, red)){.toolbar-surface-top{background:linear-gradient(to right,var(--background),color-mix(in oklch,var(--background),transparent 5%),var(--background))}}.toolbar-surface-top{-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}@supports ((-webkit-backdrop-filter:blur(12px)) or (backdrop-filter:blur(12px))){.toolbar-surface-top{background:var(--background)}@supports (color:color-mix(in lab, red, red)){.toolbar-surface-top{background:color-mix(in oklch,var(--background),transparent 20%)}}}.toolbar-inner{justify-content:space-between;align-items:center;padding:.5rem .75rem;display:flex}.toolbar-card{background:var(--card);justify-content:space-between;align-items:center;gap:.5rem;display:flex}@supports (color:color-mix(in lab, red, red)){.toolbar-card{background:color-mix(in oklch,var(--card),transparent 60%)}}.toolbar-card{border:1px solid var(--border);border-radius:.75rem;padding:.5rem .75rem}.toolbar-group{align-items:center;gap:.25rem;display:flex}.btn-toolbar-primary{background:linear-gradient(to right,var(--primary),var(--primary));border-radius:.75rem;align-items:center;gap:.5rem;height:2.25rem;padding:0 .75rem;display:flex}@supports (color:color-mix(in lab, red, red)){.btn-toolbar-primary{background:linear-gradient(to right,color-mix(in oklch,var(--primary),transparent 95%),color-mix(in oklch,var(--primary),transparent 90%))}}.btn-toolbar-primary{border:1px solid var(--primary)}@supports (color:color-mix(in lab, red, red)){.btn-toolbar-primary{border:1px solid color-mix(in oklch,var(--primary),transparent 80%)}}.btn-toolbar-primary{transition:all .2s}.btn-toolbar-primary:hover{background:linear-gradient(to right,var(--primary),var(--primary))}@supports (color:color-mix(in lab, red, red)){.btn-toolbar-primary:hover{background:linear-gradient(to right,color-mix(in oklch,var(--primary),transparent 90%),color-mix(in oklch,var(--primary),transparent 80%))}}.btn-toolbar-icon-primary{background:linear-gradient(to bottom right,var(--primary),var(--primary));border-radius:9999px;width:2rem;height:2rem;padding:0}@supports (color:color-mix(in lab, red, red)){.btn-toolbar-icon-primary{background:linear-gradient(to bottom right,color-mix(in oklch,var(--primary),transparent 90%),color-mix(in oklch,var(--primary),transparent 80%))}}.btn-toolbar-icon-primary{border:1px solid var(--primary)}@supports (color:color-mix(in lab, red, red)){.btn-toolbar-icon-primary{border:1px solid color-mix(in oklch,var(--primary),transparent 70%)}}.btn-toolbar-icon-primary{transition:all .2s;box-shadow:0 1px 2px #0000000d}.btn-toolbar-icon-primary:hover{background:linear-gradient(to bottom right,var(--primary),var(--primary))}@supports (color:color-mix(in lab, red, red)){.btn-toolbar-icon-primary:hover{background:linear-gradient(to bottom right,color-mix(in oklch,var(--primary),transparent 80%),color-mix(in oklch,var(--primary),transparent 70%))}}.btn-toolbar-icon-secondary{background:linear-gradient(to bottom right,var(--secondary),var(--secondary));border-radius:9999px;width:2rem;height:2rem;padding:0}@supports (color:color-mix(in lab, red, red)){.btn-toolbar-icon-secondary{background:linear-gradient(to bottom right,color-mix(in oklch,var(--secondary),transparent 90%),color-mix(in oklch,var(--secondary),transparent 80%))}}.btn-toolbar-icon-secondary{border:1px solid var(--secondary)}@supports (color:color-mix(in lab, red, red)){.btn-toolbar-icon-secondary{border:1px solid color-mix(in oklch,var(--secondary),transparent 70%)}}.btn-toolbar-icon-secondary{transition:all .2s;box-shadow:0 1px 2px #0000000d}.btn-toolbar-icon-secondary:hover{background:linear-gradient(to bottom right,var(--secondary),var(--secondary))}@supports (color:color-mix(in lab, red, red)){.btn-toolbar-icon-secondary:hover{background:linear-gradient(to bottom right,color-mix(in oklch,var(--secondary),transparent 80%),color-mix(in oklch,var(--secondary),transparent 70%))}}.badge-compact{height:1.25rem;padding:0 .5rem;font-size:10px}.badge-mini{height:1rem;padding:0 .375rem;font-size:10px}@keyframes shimmer-bg{0%{background-position:-1000px 0}to{background-position:1000px 0}}.shimmer{background:linear-gradient(90deg,#0000,#ffffff1a,#0000) 0 0/1000px 100%;animation:3s linear infinite shimmer-bg}.animate-shimmer{animation:2s linear infinite shimmer}@keyframes pulse-glow{0%,to{box-shadow:0 0 20px rgba(var(--primary),.1)}50%{box-shadow:0 0 30px rgba(var(--primary),.2)}}.pulse-glow{animation:2s ease-in-out infinite pulse-glow}@keyframes gradient-x{0%,to{background-position:0%}50%{background-position:100%}}.animate-gradient-x{animation:8s ease-in-out infinite gradient-x}.gradient-text{background:linear-gradient(to right,var(--foreground),var(--foreground))}@supports (color:color-mix(in lab, red, red)){.gradient-text{background:linear-gradient(to right,var(--foreground),color-mix(in oklch,var(--foreground),transparent 30%))}}.gradient-text{-webkit-text-fill-color:transparent;-webkit-background-clip:text;background-clip:text}.glass{background:var(--background)}@supports (color:color-mix(in lab, red, red)){.glass{background:color-mix(in oklch,var(--background),transparent 50%)}}.glass{-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border:1px solid var(--border)}@supports (color:color-mix(in lab, red, red)){.glass{border:1px solid color-mix(in oklch,var(--border),transparent 50%)}}.tool-card{transition:all .3s ease-out}.tool-card:hover{transform:scale(1.02);box-shadow:0 10px 15px -3px #0000001a,0 4px 6px -2px #0000000d}.scrollbar-thin{scrollbar-width:thin}.scrollbar-thin::-webkit-scrollbar{width:6px;height:6px}.scrollbar-thin::-webkit-scrollbar-track{background:0 0}.scrollbar-thin::-webkit-scrollbar-thumb{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.scrollbar-thin::-webkit-scrollbar-thumb{background-color:color-mix(in oklch,var(--primary),transparent 80%)}}.scrollbar-thin::-webkit-scrollbar-thumb{border-radius:3px}.scrollbar-thin::-webkit-scrollbar-thumb:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.scrollbar-thin::-webkit-scrollbar-thumb:hover{background-color:color-mix(in oklch,var(--primary),transparent 70%)}}}@layer utilities{.\\\\@container{container-type:inline-size}.pointer-events-none{pointer-events:none}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.-inset-\\\\[1px\\\\]{inset:-1px}.inset-0{inset:calc(var(--spacing)*0)}.-top-12{top:calc(var(--spacing)*-12)}.top-0{top:calc(var(--spacing)*0)}.top-1\\\\.5{top:calc(var(--spacing)*1.5)}.top-1\\\\/2{top:50%}.top-3{top:calc(var(--spacing)*3)}.top-4{top:calc(var(--spacing)*4)}.top-\\\\[50\\\\%\\\\]{top:50%}.right-0{right:calc(var(--spacing)*0)}.right-1\\\\.5{right:calc(var(--spacing)*1.5)}.right-3{right:calc(var(--spacing)*3)}.right-4{right:calc(var(--spacing)*4)}.right-6{right:calc(var(--spacing)*6)}.bottom-0{bottom:calc(var(--spacing)*0)}.bottom-4{bottom:calc(var(--spacing)*4)}.bottom-6{bottom:calc(var(--spacing)*6)}.left-0{left:calc(var(--spacing)*0)}.left-1\\\\/2,.left-\\\\[50\\\\%\\\\]{left:50%}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.col-span-full{grid-column:1/-1}.col-start-1{grid-column-start:1}.col-start-2{grid-column-start:2}.col-start-3{grid-column-start:3}.row-start-1{grid-row-start:1}.row-start-2{grid-row-start:2}.row-start-3{grid-row-start:3}.container{width:100%}@media (min-width:40rem){.container{max-width:40rem}}@media (min-width:48rem){.container{max-width:48rem}}@media (min-width:64rem){.container{max-width:64rem}}@media (min-width:80rem){.container{max-width:80rem}}@media (min-width:96rem){.container{max-width:96rem}}.m-0{margin:calc(var(--spacing)*0)}.mx-2{margin-inline:calc(var(--spacing)*2)}.mx-3{margin-inline:calc(var(--spacing)*3)}.mx-auto{margin-inline:auto}.my-1{margin-block:calc(var(--spacing)*1)}.my-2{margin-block:calc(var(--spacing)*2)}.my-auto{margin-block:auto}.mt-0\\\\.5{margin-top:calc(var(--spacing)*.5)}.mt-1{margin-top:calc(var(--spacing)*1)}.mt-2{margin-top:calc(var(--spacing)*2)}.mt-3{margin-top:calc(var(--spacing)*3)}.mt-4{margin-top:calc(var(--spacing)*4)}.-mr-1{margin-right:calc(var(--spacing)*-1)}.mr-1\\\\.5{margin-right:calc(var(--spacing)*1.5)}.mr-2{margin-right:calc(var(--spacing)*2)}.mb-1{margin-bottom:calc(var(--spacing)*1)}.mb-2{margin-bottom:calc(var(--spacing)*2)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-4{margin-bottom:calc(var(--spacing)*4)}.-ml-1{margin-left:calc(var(--spacing)*-1)}.-ml-2{margin-left:calc(var(--spacing)*-2)}.ml-1{margin-left:calc(var(--spacing)*1)}.ml-2{margin-left:calc(var(--spacing)*2)}.ml-4{margin-left:calc(var(--spacing)*4)}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.line-clamp-3{-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-flex{display:inline-flex}.table{display:table}.aspect-square{aspect-ratio:1}.size-2\\\\.5{width:calc(var(--spacing)*2.5);height:calc(var(--spacing)*2.5)}.size-3{width:calc(var(--spacing)*3);height:calc(var(--spacing)*3)}.size-3\\\\.5{width:calc(var(--spacing)*3.5);height:calc(var(--spacing)*3.5)}.size-4{width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.size-5{width:calc(var(--spacing)*5);height:calc(var(--spacing)*5)}.size-6{width:calc(var(--spacing)*6);height:calc(var(--spacing)*6)}.size-8{width:calc(var(--spacing)*8);height:calc(var(--spacing)*8)}.size-9{width:calc(var(--spacing)*9);height:calc(var(--spacing)*9)}.size-10{width:calc(var(--spacing)*10);height:calc(var(--spacing)*10)}.size-14{width:calc(var(--spacing)*14);height:calc(var(--spacing)*14)}.size-\\\\[34px\\\\]{width:34px;height:34px}.size-full{width:100%;height:100%}.h-1\\\\.5{height:calc(var(--spacing)*1.5)}.h-2{height:calc(var(--spacing)*2)}.h-2\\\\.5{height:calc(var(--spacing)*2.5)}.h-3{height:calc(var(--spacing)*3)}.h-3\\\\.5{height:calc(var(--spacing)*3.5)}.h-4{height:calc(var(--spacing)*4)}.h-5{height:calc(var(--spacing)*5)}.h-6{height:calc(var(--spacing)*6)}.h-7{height:calc(var(--spacing)*7)}.h-8{height:calc(var(--spacing)*8)}.h-9{height:calc(var(--spacing)*9)}.h-10{height:calc(var(--spacing)*10)}.h-12{height:calc(var(--spacing)*12)}.h-\\\\[600px\\\\]{height:600px}.h-\\\\[calc\\\\(100\\\\%-60px\\\\)\\\\]{height:calc(100% - 60px)}.h-auto{height:auto}.h-full{height:100%}.max-h-24{max-height:calc(var(--spacing)*24)}.max-h-40{max-height:calc(var(--spacing)*40)}.max-h-48{max-height:calc(var(--spacing)*48)}.max-h-60{max-height:calc(var(--spacing)*60)}.max-h-\\\\[80dvh\\\\]{max-height:80dvh}.max-h-\\\\[80vh\\\\]{max-height:80vh}.min-h-8{min-height:calc(var(--spacing)*8)}.min-h-\\\\[60px\\\\]{min-height:60px}.w-1\\\\.5{width:calc(var(--spacing)*1.5)}.w-2{width:calc(var(--spacing)*2)}.w-2\\\\.5{width:calc(var(--spacing)*2.5)}.w-3{width:calc(var(--spacing)*3)}.w-3\\\\.5{width:calc(var(--spacing)*3.5)}.w-4{width:calc(var(--spacing)*4)}.w-5{width:calc(var(--spacing)*5)}.w-6{width:calc(var(--spacing)*6)}.w-7{width:calc(var(--spacing)*7)}.w-8{width:calc(var(--spacing)*8)}.w-12{width:calc(var(--spacing)*12)}.w-16{width:calc(var(--spacing)*16)}.w-\\\\[500px\\\\]{width:500px}.w-auto{width:auto}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-2xl{max-width:var(--container-2xl)}.max-w-7\\\\/8{max-width:87.5%}.max-w-16{max-width:calc(var(--spacing)*16)}.max-w-24{max-width:calc(var(--spacing)*24)}.max-w-\\\\[80\\\\%\\\\]{max-width:80%}.max-w-\\\\[80px\\\\]{max-width:80px}.max-w-\\\\[85\\\\%\\\\]{max-width:85%}.max-w-\\\\[100px\\\\]{max-width:100px}.max-w-\\\\[calc\\\\(100\\\\%-2rem\\\\)\\\\]{max-width:calc(100% - 2rem)}.max-w-\\\\[var\\\\(--thread-max-width\\\\)\\\\]{max-width:var(--thread-max-width)}.max-w-full{max-width:100%}.max-w-md{max-width:var(--container-md)}.min-w-0{min-width:calc(var(--spacing)*0)}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.border-separate{border-collapse:separate}.border-spacing-0{--tw-border-spacing-x:calc(var(--spacing)*0);--tw-border-spacing-y:calc(var(--spacing)*0);border-spacing:var(--tw-border-spacing-x)var(--tw-border-spacing-y)}.origin-\\\\(--radix-tooltip-content-transform-origin\\\\){transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-1\\\\/2{--tw-translate-x:calc(calc(1/2*100%)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-x-full{--tw-translate-x:-100%;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-0{--tw-translate-x:calc(var(--spacing)*0);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-\\\\[-50\\\\%\\\\]{--tw-translate-x:-50%;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-x-full{--tw-translate-x:100%;translate:var(--tw-translate-x)var(--tw-translate-y)}.-translate-y-1\\\\/2{--tw-translate-y:calc(calc(1/2*100%)*-1);translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-\\\\[-50\\\\%\\\\]{--tw-translate-y:-50%;translate:var(--tw-translate-x)var(--tw-translate-y)}.translate-y-\\\\[calc\\\\(-50\\\\%_-_2px\\\\)\\\\]{--tw-translate-y:calc(-50% - 2px);translate:var(--tw-translate-x)var(--tw-translate-y)}.rotate-45{rotate:45deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,)var(--tw-rotate-y,)var(--tw-rotate-z,)var(--tw-skew-x,)var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize-none{resize:none}.scroll-m-20{scroll-margin:calc(var(--spacing)*20)}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.auto-rows-auto{grid-auto-rows:auto}.grid-cols-\\\\[minmax\\\\(72px\\\\,1fr\\\\)_auto\\\\]{grid-template-columns:minmax(72px,1fr) auto}.grid-rows-\\\\[0fr\\\\]{grid-template-rows:0fr}.grid-rows-\\\\[1fr\\\\]{grid-template-rows:1fr}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.gap-0\\\\.5{gap:calc(var(--spacing)*.5)}.gap-1{gap:calc(var(--spacing)*1)}.gap-1\\\\.5{gap:calc(var(--spacing)*1.5)}.gap-2{gap:calc(var(--spacing)*2)}.gap-2\\\\.5{gap:calc(var(--spacing)*2.5)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*4)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*4)*calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*6)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*6)*calc(1 - var(--tw-space-y-reverse)))}.gap-y-2{row-gap:calc(var(--spacing)*2)}.self-center{align-self:center}.self-end{align-self:flex-end}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-clip{overflow:clip}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-y-scroll{overflow-y:scroll}.overscroll-contain{overscroll-behavior:contain}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-3xl{border-radius:var(--radius-3xl)}.rounded-\\\\[2px\\\\]{border-radius:2px}.rounded-\\\\[14px\\\\]{border-radius:14px}.rounded-\\\\[inherit\\\\]{border-radius:inherit}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-xl{border-radius:calc(var(--radius) + 4px)}.rounded-xs{border-radius:var(--radius-xs)}.\\\\!rounded-t-none{border-top-left-radius:0!important;border-top-right-radius:0!important}.rounded-t-3xl{border-top-left-radius:var(--radius-3xl);border-top-right-radius:var(--radius-3xl)}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.rounded-tr-sm{border-top-right-radius:calc(var(--radius) - 4px)}.rounded-b-lg{border-bottom-right-radius:var(--radius);border-bottom-left-radius:var(--radius)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-dotted{--tw-border-style:dotted;border-style:dotted}.border-blue-500\\\\/40{border-color:#3080ff66}@supports (color:color-mix(in lab, red, red)){.border-blue-500\\\\/40{border-color:color-mix(in oklab,var(--color-blue-500)40%,transparent)}}.border-blue-500\\\\/60{border-color:#3080ff99}@supports (color:color-mix(in lab, red, red)){.border-blue-500\\\\/60{border-color:color-mix(in oklab,var(--color-blue-500)60%,transparent)}}.border-border,.border-border\\\\/20{border-color:var(--border)}@supports (color:color-mix(in lab, red, red)){.border-border\\\\/20{border-color:color-mix(in oklab,var(--border)20%,transparent)}}.border-border\\\\/40{border-color:var(--border)}@supports (color:color-mix(in lab, red, red)){.border-border\\\\/40{border-color:color-mix(in oklab,var(--border)40%,transparent)}}.border-border\\\\/50{border-color:var(--border)}@supports (color:color-mix(in lab, red, red)){.border-border\\\\/50{border-color:color-mix(in oklab,var(--border)50%,transparent)}}.border-destructive,.border-destructive\\\\/60{border-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.border-destructive\\\\/60{border-color:color-mix(in oklab,var(--destructive)60%,transparent)}}.border-foreground\\\\/20{border-color:var(--foreground)}@supports (color:color-mix(in lab, red, red)){.border-foreground\\\\/20{border-color:color-mix(in oklab,var(--foreground)20%,transparent)}}.border-green-500\\\\/20{border-color:#00c75833}@supports (color:color-mix(in lab, red, red)){.border-green-500\\\\/20{border-color:color-mix(in oklab,var(--color-green-500)20%,transparent)}}.border-green-500\\\\/40{border-color:#00c75866}@supports (color:color-mix(in lab, red, red)){.border-green-500\\\\/40{border-color:color-mix(in oklab,var(--color-green-500)40%,transparent)}}.border-green-500\\\\/60{border-color:#00c75899}@supports (color:color-mix(in lab, red, red)){.border-green-500\\\\/60{border-color:color-mix(in oklab,var(--color-green-500)60%,transparent)}}.border-input{border-color:var(--input)}.border-muted-foreground\\\\/20{border-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.border-muted-foreground\\\\/20{border-color:color-mix(in oklab,var(--muted-foreground)20%,transparent)}}.border-primary\\\\/60{border-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.border-primary\\\\/60{border-color:color-mix(in oklab,var(--primary)60%,transparent)}}.border-red-500\\\\/20{border-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.border-red-500\\\\/20{border-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.border-red-500\\\\/40{border-color:#fb2c3666}@supports (color:color-mix(in lab, red, red)){.border-red-500\\\\/40{border-color:color-mix(in oklab,var(--color-red-500)40%,transparent)}}.border-red-500\\\\/60{border-color:#fb2c3699}@supports (color:color-mix(in lab, red, red)){.border-red-500\\\\/60{border-color:color-mix(in oklab,var(--color-red-500)60%,transparent)}}.border-transparent{border-color:#0000}.border-white\\\\/10{border-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.border-white\\\\/10{border-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.border-white\\\\/20{border-color:#fff3}@supports (color:color-mix(in lab, red, red)){.border-white\\\\/20{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.border-t-transparent{border-top-color:#0000}.border-l-transparent{border-left-color:#0000}.bg-\\\\[color-mix\\\\(in_oklab\\\\,rgb\\\\(var\\\\(--background\\\\)\\\\)_20\\\\%\\\\,transparent\\\\)\\\\]{background-color:rgb(var(--background))}@supports (color:color-mix(in lab, red, red)){.bg-\\\\[color-mix\\\\(in_oklab\\\\,rgb\\\\(var\\\\(--background\\\\)\\\\)_20\\\\%\\\\,transparent\\\\)\\\\]{background-color:color-mix(in oklab,rgb(var(--background))20%,transparent)}}.bg-amber-500{background-color:var(--color-amber-500)}.bg-background,.bg-background\\\\/50{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.bg-background\\\\/50{background-color:color-mix(in oklab,var(--background)50%,transparent)}}.bg-background\\\\/80{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.bg-background\\\\/80{background-color:color-mix(in oklab,var(--background)80%,transparent)}}.bg-background\\\\/95{background-color:var(--background)}@supports (color:color-mix(in lab, red, red)){.bg-background\\\\/95{background-color:color-mix(in oklab,var(--background)95%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\\\\/30{background-color:#0000004d}@supports (color:color-mix(in lab, red, red)){.bg-black\\\\/30{background-color:color-mix(in oklab,var(--color-black)30%,transparent)}}.bg-black\\\\/50{background-color:#00000080}@supports (color:color-mix(in lab, red, red)){.bg-black\\\\/50{background-color:color-mix(in oklab,var(--color-black)50%,transparent)}}.bg-blue-400{background-color:var(--color-blue-400)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-500\\\\/5{background-color:#3080ff0d}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\\\\/5{background-color:color-mix(in oklab,var(--color-blue-500)5%,transparent)}}.bg-blue-500\\\\/10{background-color:#3080ff1a}@supports (color:color-mix(in lab, red, red)){.bg-blue-500\\\\/10{background-color:color-mix(in oklab,var(--color-blue-500)10%,transparent)}}.bg-border{background-color:var(--border)}.bg-destructive,.bg-destructive\\\\/10{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.bg-destructive\\\\/10{background-color:color-mix(in oklab,var(--destructive)10%,transparent)}}.bg-foreground{background-color:var(--foreground)}.bg-green-400{background-color:var(--color-green-400)}.bg-green-400\\\\/60{background-color:#05df7299}@supports (color:color-mix(in lab, red, red)){.bg-green-400\\\\/60{background-color:color-mix(in oklab,var(--color-green-400)60%,transparent)}}.bg-green-500{background-color:var(--color-green-500)}.bg-green-500\\\\/5{background-color:#00c7580d}@supports (color:color-mix(in lab, red, red)){.bg-green-500\\\\/5{background-color:color-mix(in oklab,var(--color-green-500)5%,transparent)}}.bg-green-500\\\\/10{background-color:#00c7581a}@supports (color:color-mix(in lab, red, red)){.bg-green-500\\\\/10{background-color:color-mix(in oklab,var(--color-green-500)10%,transparent)}}.bg-muted{background-color:var(--muted)}.bg-muted-foreground\\\\/15{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.bg-muted-foreground\\\\/15{background-color:color-mix(in oklab,var(--muted-foreground)15%,transparent)}}.bg-muted\\\\/5{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\\\\/5{background-color:color-mix(in oklab,var(--muted)5%,transparent)}}.bg-muted\\\\/30{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\\\\/30{background-color:color-mix(in oklab,var(--muted)30%,transparent)}}.bg-muted\\\\/50{background-color:var(--muted)}@supports (color:color-mix(in lab, red, red)){.bg-muted\\\\/50{background-color:color-mix(in oklab,var(--muted)50%,transparent)}}.bg-popover\\\\/95{background-color:var(--popover)}@supports (color:color-mix(in lab, red, red)){.bg-popover\\\\/95{background-color:color-mix(in oklab,var(--popover)95%,transparent)}}.bg-primary,.bg-primary\\\\/10{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.bg-primary\\\\/10{background-color:color-mix(in oklab,var(--primary)10%,transparent)}}.bg-red-500{background-color:var(--color-red-500)}.bg-red-500\\\\/5{background-color:#fb2c360d}@supports (color:color-mix(in lab, red, red)){.bg-red-500\\\\/5{background-color:color-mix(in oklab,var(--color-red-500)5%,transparent)}}.bg-red-500\\\\/10{background-color:#fb2c361a}@supports (color:color-mix(in lab, red, red)){.bg-red-500\\\\/10{background-color:color-mix(in oklab,var(--color-red-500)10%,transparent)}}.bg-red-500\\\\/20{background-color:#fb2c3633}@supports (color:color-mix(in lab, red, red)){.bg-red-500\\\\/20{background-color:color-mix(in oklab,var(--color-red-500)20%,transparent)}}.bg-secondary{background-color:var(--secondary)}.bg-slate-900\\\\/95{background-color:#0f172bf2}@supports (color:color-mix(in lab, red, red)){.bg-slate-900\\\\/95{background-color:color-mix(in oklab,var(--color-slate-900)95%,transparent)}}.bg-transparent{background-color:#0000}.bg-white{background-color:var(--color-white)}.bg-white\\\\/5{background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.bg-white\\\\/5{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.bg-white\\\\/10{background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.bg-white\\\\/10{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.bg-yellow-500{background-color:var(--color-yellow-500)}.fill-foreground{fill:var(--foreground)}.stroke-\\\\[1\\\\.5px\\\\]{stroke-width:1.5px}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0{padding:calc(var(--spacing)*0)}.p-1{padding:calc(var(--spacing)*1)}.p-1\\\\.5{padding:calc(var(--spacing)*1.5)}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.p-px{padding:1px}.px-0{padding-inline:calc(var(--spacing)*0)}.px-1{padding-inline:calc(var(--spacing)*1)}.px-1\\\\.5{padding-inline:calc(var(--spacing)*1.5)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-2\\\\.5{padding-inline:calc(var(--spacing)*2.5)}.px-3{padding-inline:calc(var(--spacing)*3)}.px-4{padding-inline:calc(var(--spacing)*4)}.px-5{padding-inline:calc(var(--spacing)*5)}.px-6{padding-inline:calc(var(--spacing)*6)}.px-8{padding-inline:calc(var(--spacing)*8)}.py-0\\\\.5{padding-block:calc(var(--spacing)*.5)}.py-1{padding-block:calc(var(--spacing)*1)}.py-1\\\\.5{padding-block:calc(var(--spacing)*1.5)}.py-2{padding-block:calc(var(--spacing)*2)}.py-2\\\\.5{padding-block:calc(var(--spacing)*2.5)}.py-3{padding-block:calc(var(--spacing)*3)}.py-4{padding-block:calc(var(--spacing)*4)}.pt-0\\\\.5{padding-top:calc(var(--spacing)*.5)}.pt-2{padding-top:calc(var(--spacing)*2)}.pt-3{padding-top:calc(var(--spacing)*3)}.pr-2{padding-right:calc(var(--spacing)*2)}.pb-1{padding-bottom:calc(var(--spacing)*1)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.pl-3{padding-left:calc(var(--spacing)*3)}.pl-4{padding-left:calc(var(--spacing)*4)}.text-center{text-align:center}.text-left{text-align:left}.font-mono{font-family:var(--font-mono)}.text-2xl{font-size:var(--text-2xl);line-height:var(--tw-leading,var(--text-2xl--line-height))}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\\\\[10px\\\\]{font-size:10px}.text-\\\\[11px\\\\]{font-size:11px}.text-\\\\[13px\\\\]{font-size:13px}.text-\\\\[15px\\\\]{font-size:15px}.text-\\\\[17px\\\\]{font-size:17px}.text-\\\\[19px\\\\]{font-size:19px}.text-\\\\[21px\\\\]{font-size:21px}.text-\\\\[25px\\\\]{font-size:25px}.leading-7{--tw-leading:calc(var(--spacing)*7);line-height:calc(var(--spacing)*7)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold{--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.text-balance{text-wrap:balance}.break-words{overflow-wrap:break-word}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-background{color:var(--background)}.text-blue-400{color:var(--color-blue-400)}.text-blue-600{color:var(--color-blue-600)}.text-destructive{color:var(--destructive)}.text-destructive-foreground{color:var(--destructive-foreground)}.text-emerald-500{color:var(--color-emerald-500)}.text-foreground,.text-foreground\\\\/80{color:var(--foreground)}@supports (color:color-mix(in lab, red, red)){.text-foreground\\\\/80{color:color-mix(in oklab,var(--foreground)80%,transparent)}}.text-green-400{color:var(--color-green-400)}.text-green-600{color:var(--color-green-600)}.text-muted-foreground,.text-muted-foreground\\\\/65{color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.text-muted-foreground\\\\/65{color:color-mix(in oklab,var(--muted-foreground)65%,transparent)}}.text-muted-foreground\\\\/70{color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.text-muted-foreground\\\\/70{color:color-mix(in oklab,var(--muted-foreground)70%,transparent)}}.text-popover-foreground{color:var(--popover-foreground)}.text-primary{color:var(--primary)}.text-primary-foreground{color:var(--primary-foreground)}.text-red-300{color:var(--color-red-300)}.text-red-400{color:var(--color-red-400)}.text-red-600{color:var(--color-red-600)}.text-secondary-foreground{color:var(--secondary-foreground)}.text-white{color:var(--color-white)}.text-white\\\\/20{color:#fff3}@supports (color:color-mix(in lab, red, red)){.text-white\\\\/20{color:color-mix(in oklab,var(--color-white)20%,transparent)}}.text-white\\\\/30{color:#ffffff4d}@supports (color:color-mix(in lab, red, red)){.text-white\\\\/30{color:color-mix(in oklab,var(--color-white)30%,transparent)}}.text-white\\\\/40{color:#fff6}@supports (color:color-mix(in lab, red, red)){.text-white\\\\/40{color:color-mix(in oklab,var(--color-white)40%,transparent)}}.text-white\\\\/50{color:#ffffff80}@supports (color:color-mix(in lab, red, red)){.text-white\\\\/50{color:color-mix(in oklab,var(--color-white)50%,transparent)}}.text-white\\\\/60{color:#fff9}@supports (color:color-mix(in lab, red, red)){.text-white\\\\/60{color:color-mix(in oklab,var(--color-white)60%,transparent)}}.text-white\\\\/70{color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.text-white\\\\/70{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.text-white\\\\/80{color:#fffc}@supports (color:color-mix(in lab, red, red)){.text-white\\\\/80{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.text-white\\\\/90{color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){.text-white\\\\/90{color:color-mix(in oklab,var(--color-white)90%,transparent)}}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,)var(--tw-slashed-zero,)var(--tw-numeric-figure,)var(--tw-numeric-spacing,)var(--tw-numeric-fraction,)}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-70{opacity:.7}.opacity-100{opacity:1}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\\\[0_0_12px_rgba\\\\(34\\\\,197\\\\,94\\\\,0\\\\.3\\\\)\\\\]{--tw-shadow:0 0 12px var(--tw-shadow-color,#22c55e4d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\\\[0_0_12px_rgba\\\\(59\\\\,130\\\\,246\\\\,0\\\\.3\\\\)\\\\]{--tw-shadow:0 0 12px var(--tw-shadow-color,#3b82f64d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\\\[0_0_12px_rgba\\\\(239\\\\,68\\\\,68\\\\,0\\\\.3\\\\)\\\\]{--tw-shadow:0 0 12px var(--tw-shadow-color,#ef44444d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\\\[0_12px_24px_-16px_rgba\\\\(37\\\\,99\\\\,235\\\\,0\\\\.55\\\\)\\\\]{--tw-shadow:0 12px 24px -16px var(--tw-shadow-color,#2563eb8c);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\\\\[0_12px_24px_-18px_rgba\\\\(220\\\\,38\\\\,38\\\\,0\\\\.55\\\\)\\\\]{--tw-shadow:0 12px 24px -18px var(--tw-shadow-color,#dc26268c);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a),0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a),0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.\\\\[box-shadow\\\\:inset_0_1px_2px_0_rgba\\\\(255\\\\,255\\\\,255\\\\,0\\\\.15\\\\)\\\\]{box-shadow:inset 0 1px 2px #ffffff26}.shadow-black\\\\/20{--tw-shadow-color:#0003}@supports (color:color-mix(in lab, red, red)){.shadow-black\\\\/20{--tw-shadow-color:color-mix(in oklab,color-mix(in oklab,var(--color-black)20%,transparent)var(--tw-shadow-alpha),transparent)}}.ring-offset-background{--tw-ring-offset-color:var(--background)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.drop-shadow-xl{--tw-drop-shadow-size:drop-shadow(0 9px 7px var(--tw-drop-shadow-color,#0000001a));--tw-drop-shadow:drop-shadow(var(--drop-shadow-xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\\\[color\\\\,box-shadow\\\\]{transition-property:color,box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\\\\[grid-template-rows\\\\]{transition-property:grid-template-rows;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-shadow{transition-property:box-shadow;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.duration-300{--tw-duration:.3s;transition-duration:.3s}.ease-in-out{--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.will-change-transform{will-change:transform}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}.placeholder\\\\:text-muted-foreground::placeholder,.placeholder\\\\:text-muted-foreground\\\\/70::placeholder{color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.placeholder\\\\:text-muted-foreground\\\\/70::placeholder{color:color-mix(in oklab,var(--muted-foreground)70%,transparent)}}.placeholder\\\\:text-white\\\\/40::placeholder{color:#fff6}@supports (color:color-mix(in lab, red, red)){.placeholder\\\\:text-white\\\\/40::placeholder{color:color-mix(in oklab,var(--color-white)40%,transparent)}}.first\\\\:mt-0:first-child{margin-top:calc(var(--spacing)*0)}.first\\\\:mt-3:first-child{margin-top:calc(var(--spacing)*3)}.first\\\\:mt-4:first-child{margin-top:calc(var(--spacing)*4)}.first\\\\:rounded-tl-lg:first-child{border-top-left-radius:var(--radius)}.first\\\\:border-t:first-child{border-top-style:var(--tw-border-style);border-top-width:1px}.last\\\\:mb-0:last-child{margin-bottom:calc(var(--spacing)*0)}.last\\\\:mb-5:last-child{margin-bottom:calc(var(--spacing)*5)}.last\\\\:mb-24:last-child{margin-bottom:calc(var(--spacing)*24)}.last\\\\:rounded-tr-lg:last-child{border-top-right-radius:var(--radius)}.last\\\\:border-r:last-child{border-right-style:var(--tw-border-style);border-right-width:1px}.empty\\\\:hidden:empty{display:none}.focus-within\\\\:border-ring\\\\/50:focus-within{border-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){.focus-within\\\\:border-ring\\\\/50:focus-within{border-color:color-mix(in oklab,var(--ring)50%,transparent)}}.focus-within\\\\:border-white\\\\/20:focus-within{border-color:#fff3}@supports (color:color-mix(in lab, red, red)){.focus-within\\\\:border-white\\\\/20:focus-within{border-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.focus-within\\\\:bg-white\\\\/15:focus-within{background-color:#ffffff26}@supports (color:color-mix(in lab, red, red)){.focus-within\\\\:bg-white\\\\/15:focus-within{background-color:color-mix(in oklab,var(--color-white)15%,transparent)}}.focus-within\\\\:shadow-2xl:focus-within{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-within\\\\:shadow-md:focus-within{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a),0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-within\\\\:ring-2:focus-within{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-within\\\\:shadow-black\\\\/30:focus-within{--tw-shadow-color:#0000004d}@supports (color:color-mix(in lab, red, red)){.focus-within\\\\:shadow-black\\\\/30:focus-within{--tw-shadow-color:color-mix(in oklab,color-mix(in oklab,var(--color-black)30%,transparent)var(--tw-shadow-alpha),transparent)}}.focus-within\\\\:ring-ring:focus-within{--tw-ring-color:var(--ring)}.focus-within\\\\:ring-offset-2:focus-within{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}@media (hover:hover){.hover\\\\:scale-105:hover{--tw-scale-x:105%;--tw-scale-y:105%;--tw-scale-z:105%;scale:var(--tw-scale-x)var(--tw-scale-y)}.hover\\\\:border-accent:hover{border-color:var(--accent)}.hover\\\\:border-border\\\\/60:hover{border-color:var(--border)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:border-border\\\\/60:hover{border-color:color-mix(in oklab,var(--border)60%,transparent)}}.hover\\\\:border-white\\\\/15:hover{border-color:#ffffff26}@supports (color:color-mix(in lab, red, red)){.hover\\\\:border-white\\\\/15:hover{border-color:color-mix(in oklab,var(--color-white)15%,transparent)}}.hover\\\\:\\\\!bg-white:hover{background-color:var(--color-white)!important}.hover\\\\:bg-accent:hover,.hover\\\\:bg-accent\\\\/50:hover{background-color:var(--accent)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-accent\\\\/50:hover{background-color:color-mix(in oklab,var(--accent)50%,transparent)}}.hover\\\\:bg-destructive\\\\/10:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-destructive\\\\/10:hover{background-color:color-mix(in oklab,var(--destructive)10%,transparent)}}.hover\\\\:bg-destructive\\\\/80:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-destructive\\\\/80:hover{background-color:color-mix(in oklab,var(--destructive)80%,transparent)}}.hover\\\\:bg-destructive\\\\/90:hover{background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-destructive\\\\/90:hover{background-color:color-mix(in oklab,var(--destructive)90%,transparent)}}.hover\\\\:bg-muted-foreground\\\\/15:hover{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-muted-foreground\\\\/15:hover{background-color:color-mix(in oklab,var(--muted-foreground)15%,transparent)}}.hover\\\\:bg-primary\\\\/80:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-primary\\\\/80:hover{background-color:color-mix(in oklab,var(--primary)80%,transparent)}}.hover\\\\:bg-primary\\\\/90:hover{background-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-primary\\\\/90:hover{background-color:color-mix(in oklab,var(--primary)90%,transparent)}}.hover\\\\:bg-red-500\\\\/30:hover{background-color:#fb2c364d}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-red-500\\\\/30:hover{background-color:color-mix(in oklab,var(--color-red-500)30%,transparent)}}.hover\\\\:bg-red-600:hover{background-color:var(--color-red-600)}.hover\\\\:bg-secondary\\\\/80:hover{background-color:var(--secondary)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-secondary\\\\/80:hover{background-color:color-mix(in oklab,var(--secondary)80%,transparent)}}.hover\\\\:bg-transparent:hover{background-color:#0000}.hover\\\\:bg-white\\\\/5:hover{background-color:#ffffff0d}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-white\\\\/5:hover{background-color:color-mix(in oklab,var(--color-white)5%,transparent)}}.hover\\\\:bg-white\\\\/10:hover{background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-white\\\\/10:hover{background-color:color-mix(in oklab,var(--color-white)10%,transparent)}}.hover\\\\:bg-white\\\\/20:hover{background-color:#fff3}@supports (color:color-mix(in lab, red, red)){.hover\\\\:bg-white\\\\/20:hover{background-color:color-mix(in oklab,var(--color-white)20%,transparent)}}.hover\\\\:text-accent-foreground:hover{color:var(--accent-foreground)}.hover\\\\:text-destructive:hover{color:var(--destructive)}.hover\\\\:text-foreground:hover{color:var(--foreground)}.hover\\\\:text-primary\\\\/80:hover{color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.hover\\\\:text-primary\\\\/80:hover{color:color-mix(in oklab,var(--primary)80%,transparent)}}.hover\\\\:text-red-200:hover{color:var(--color-red-200)}.hover\\\\:text-red-300:hover{color:var(--color-red-300)}.hover\\\\:text-white:hover{color:var(--color-white)}.hover\\\\:text-white\\\\/70:hover{color:#ffffffb3}@supports (color:color-mix(in lab, red, red)){.hover\\\\:text-white\\\\/70:hover{color:color-mix(in oklab,var(--color-white)70%,transparent)}}.hover\\\\:text-white\\\\/80:hover{color:#fffc}@supports (color:color-mix(in lab, red, red)){.hover\\\\:text-white\\\\/80:hover{color:color-mix(in oklab,var(--color-white)80%,transparent)}}.hover\\\\:underline:hover{text-decoration-line:underline}.hover\\\\:opacity-75:hover{opacity:.75}.hover\\\\:opacity-100:hover{opacity:1}.hover\\\\:shadow-2xl:hover{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\\\\:shadow-\\\\[0_14px_24px_-14px_rgba\\\\(37\\\\,99\\\\,235\\\\,0\\\\.6\\\\)\\\\]:hover{--tw-shadow:0 14px 24px -14px var(--tw-shadow-color,#2563eb99);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\\\\:shadow-\\\\[0_14px_24px_-16px_rgba\\\\(220\\\\,38\\\\,38\\\\,0\\\\.6\\\\)\\\\]:hover{--tw-shadow:0 14px 24px -16px var(--tw-shadow-color,#dc262699);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\\\\:drop-shadow-2xl:hover{--tw-drop-shadow-size:drop-shadow(0 25px 25px var(--tw-drop-shadow-color,#00000026));--tw-drop-shadow:drop-shadow(var(--drop-shadow-2xl));filter:var(--tw-blur,)var(--tw-brightness,)var(--tw-contrast,)var(--tw-grayscale,)var(--tw-hue-rotate,)var(--tw-invert,)var(--tw-saturate,)var(--tw-sepia,)var(--tw-drop-shadow,)}}.focus\\\\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\\\\:ring-ring:focus{--tw-ring-color:var(--ring)}.focus\\\\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,)0 0 0 var(--tw-ring-offset-width)var(--tw-ring-offset-color)}.focus\\\\:outline-hidden:focus{--tw-outline-style:none;outline-style:none}@media (forced-colors:active){.focus\\\\:outline-hidden:focus{outline-offset:2px;outline:2px solid #0000}}.focus\\\\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\\\\:border-ring:focus-visible{border-color:var(--ring)}.focus-visible\\\\:ring-0:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\\\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(1px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\\\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(2px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\\\:ring-\\\\[3px\\\\]:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(3px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\\\\:ring-destructive\\\\/20:focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.focus-visible\\\\:ring-destructive\\\\/20:focus-visible{--tw-ring-color:color-mix(in oklab,var(--destructive)20%,transparent)}}.focus-visible\\\\:ring-destructive\\\\/40:focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.focus-visible\\\\:ring-destructive\\\\/40:focus-visible{--tw-ring-color:color-mix(in oklab,var(--destructive)40%,transparent)}}.focus-visible\\\\:ring-primary\\\\/40:focus-visible{--tw-ring-color:var(--primary)}@supports (color:color-mix(in lab, red, red)){.focus-visible\\\\:ring-primary\\\\/40:focus-visible{--tw-ring-color:color-mix(in oklab,var(--primary)40%,transparent)}}.focus-visible\\\\:ring-ring:focus-visible,.focus-visible\\\\:ring-ring\\\\/50:focus-visible{--tw-ring-color:var(--ring)}@supports (color:color-mix(in lab, red, red)){.focus-visible\\\\:ring-ring\\\\/50:focus-visible{--tw-ring-color:color-mix(in oklab,var(--ring)50%,transparent)}}.focus-visible\\\\:outline-1:focus-visible{outline-style:var(--tw-outline-style);outline-width:1px}.focus-visible\\\\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\\\\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x)var(--tw-scale-y)}.disabled\\\\:pointer-events-none:disabled{pointer-events:none}.disabled\\\\:invisible:disabled{visibility:hidden}.disabled\\\\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\\\:opacity-50:disabled{opacity:.5}.has-\\\\[\\\\>svg\\\\]\\\\:px-2\\\\.5:has(>svg){padding-inline:calc(var(--spacing)*2.5)}.has-\\\\[\\\\>svg\\\\]\\\\:px-3:has(>svg){padding-inline:calc(var(--spacing)*3)}.has-\\\\[\\\\>svg\\\\]\\\\:px-4:has(>svg){padding-inline:calc(var(--spacing)*4)}.aria-invalid\\\\:border-destructive[aria-invalid=true]{border-color:var(--destructive)}.aria-invalid\\\\:ring-destructive\\\\/20[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.aria-invalid\\\\:ring-destructive\\\\/20[aria-invalid=true]{--tw-ring-color:color-mix(in oklab,var(--destructive)20%,transparent)}}.data-floating\\\\:absolute[data-floating]{position:absolute}.data-floating\\\\:rounded-md[data-floating]{border-radius:calc(var(--radius) - 2px)}.data-floating\\\\:border[data-floating]{border-style:var(--tw-border-style);border-width:1px}.data-floating\\\\:bg-background[data-floating]{background-color:var(--background)}.data-floating\\\\:p-1[data-floating]{padding:calc(var(--spacing)*1)}.data-floating\\\\:shadow-sm[data-floating]{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.data-\\\\[orientation\\\\=horizontal\\\\]\\\\:h-px[data-orientation=horizontal]{height:1px}.data-\\\\[orientation\\\\=horizontal\\\\]\\\\:w-full[data-orientation=horizontal]{width:100%}.data-\\\\[orientation\\\\=vertical\\\\]\\\\:h-full[data-orientation=vertical]{height:100%}.data-\\\\[orientation\\\\=vertical\\\\]\\\\:w-px[data-orientation=vertical]{width:1px}.data-\\\\[state\\\\=closed\\\\]\\\\:scale-0[data-state=closed]{--tw-scale-x:0%;--tw-scale-y:0%;--tw-scale-z:0%;scale:var(--tw-scale-x)var(--tw-scale-y)}.data-\\\\[state\\\\=closed\\\\]\\\\:scale-100[data-state=closed]{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x)var(--tw-scale-y)}.data-\\\\[state\\\\=closed\\\\]\\\\:-rotate-90[data-state=closed]{rotate:-90deg}.data-\\\\[state\\\\=closed\\\\]\\\\:rotate-0[data-state=closed]{rotate:none}.data-\\\\[state\\\\=open\\\\]\\\\:scale-0[data-state=open]{--tw-scale-x:0%;--tw-scale-y:0%;--tw-scale-z:0%;scale:var(--tw-scale-x)var(--tw-scale-y)}.data-\\\\[state\\\\=open\\\\]\\\\:scale-100[data-state=open]{--tw-scale-x:100%;--tw-scale-y:100%;--tw-scale-z:100%;scale:var(--tw-scale-x)var(--tw-scale-y)}.data-\\\\[state\\\\=open\\\\]\\\\:rotate-0[data-state=open]{rotate:none}.data-\\\\[state\\\\=open\\\\]\\\\:rotate-90[data-state=open]{rotate:90deg}.data-\\\\[state\\\\=open\\\\]\\\\:bg-accent[data-state=open]{background-color:var(--accent)}.data-\\\\[state\\\\=open\\\\]\\\\:text-muted-foreground[data-state=open]{color:var(--muted-foreground)}@media (min-width:40rem){.sm\\\\:max-w-3xl{max-width:var(--container-3xl)}.sm\\\\:max-w-lg{max-width:var(--container-lg)}.sm\\\\:max-w-md{max-width:var(--container-md)}.sm\\\\:flex-row{flex-direction:row}.sm\\\\:justify-end{justify-content:flex-end}.sm\\\\:text-left{text-align:left}}@media (min-width:48rem){.md\\\\:pb-6{padding-bottom:calc(var(--spacing)*6)}}@container (min-width:28rem){.\\\\@md\\\\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.\\\\@md\\\\:flex-col{flex-direction:column}}.dark\\\\:border-input:is(.dark *){border-color:var(--input)}.dark\\\\:border-muted-foreground\\\\/15:is(.dark *){border-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:border-muted-foreground\\\\/15:is(.dark *){border-color:color-mix(in oklab,var(--muted-foreground)15%,transparent)}}.dark\\\\:bg-background:is(.dark *){background-color:var(--background)}.dark\\\\:bg-destructive\\\\/5:is(.dark *){background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:bg-destructive\\\\/5:is(.dark *){background-color:color-mix(in oklab,var(--destructive)5%,transparent)}}.dark\\\\:bg-destructive\\\\/60:is(.dark *){background-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:bg-destructive\\\\/60:is(.dark *){background-color:color-mix(in oklab,var(--destructive)60%,transparent)}}.dark\\\\:bg-input\\\\/30:is(.dark *){background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:bg-input\\\\/30:is(.dark *){background-color:color-mix(in oklab,var(--input)30%,transparent)}}.dark\\\\:bg-muted-foreground\\\\/20:is(.dark *){background-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:bg-muted-foreground\\\\/20:is(.dark *){background-color:color-mix(in oklab,var(--muted-foreground)20%,transparent)}}.dark\\\\:stroke-\\\\[2\\\\.5px\\\\]:is(.dark *){stroke-width:2.5px}.dark\\\\:text-green-400:is(.dark *){color:var(--color-green-400)}.dark\\\\:text-red-200:is(.dark *){color:var(--color-red-200)}@media (hover:hover){.dark\\\\:hover\\\\:bg-accent:is(.dark *):hover,.dark\\\\:hover\\\\:bg-accent\\\\/50:is(.dark *):hover{background-color:var(--accent)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:hover\\\\:bg-accent\\\\/50:is(.dark *):hover{background-color:color-mix(in oklab,var(--accent)50%,transparent)}}.dark\\\\:hover\\\\:bg-accent\\\\/60:is(.dark *):hover{background-color:var(--accent)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:hover\\\\:bg-accent\\\\/60:is(.dark *):hover{background-color:color-mix(in oklab,var(--accent)60%,transparent)}}.dark\\\\:hover\\\\:bg-input\\\\/50:is(.dark *):hover{background-color:var(--input)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:hover\\\\:bg-input\\\\/50:is(.dark *):hover{background-color:color-mix(in oklab,var(--input)50%,transparent)}}.dark\\\\:hover\\\\:bg-muted-foreground\\\\/30:is(.dark *):hover{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:hover\\\\:bg-muted-foreground\\\\/30:is(.dark *):hover{background-color:color-mix(in oklab,var(--muted-foreground)30%,transparent)}}}.dark\\\\:focus-visible\\\\:ring-destructive\\\\/40:is(.dark *):focus-visible{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:focus-visible\\\\:ring-destructive\\\\/40:is(.dark *):focus-visible{--tw-ring-color:color-mix(in oklab,var(--destructive)40%,transparent)}}.dark\\\\:aria-invalid\\\\:ring-destructive\\\\/40:is(.dark *)[aria-invalid=true]{--tw-ring-color:var(--destructive)}@supports (color:color-mix(in lab, red, red)){.dark\\\\:aria-invalid\\\\:ring-destructive\\\\/40:is(.dark *)[aria-invalid=true]{--tw-ring-color:color-mix(in oklab,var(--destructive)40%,transparent)}}.\\\\[\\\\&_svg\\\\]\\\\:pointer-events-none svg{pointer-events:none}.\\\\[\\\\&_svg\\\\]\\\\:shrink-0 svg{flex-shrink:0}.\\\\[\\\\&_svg\\\\]\\\\:text-background svg{color:var(--background)}.\\\\[\\\\&_svg\\\\]\\\\:text-black svg{color:var(--color-black)}@media (hover:hover){.hover\\\\:\\\\[\\\\&_svg\\\\]\\\\:text-destructive:hover svg{color:var(--destructive)}}.\\\\[\\\\&_svg\\\\:not\\\\(\\\\[class\\\\*\\\\=\\\\'size-\\\\'\\\\]\\\\)\\\\]\\\\:size-4 svg:not([class*=size-]){width:calc(var(--spacing)*4);height:calc(var(--spacing)*4)}.\\\\[\\\\&\\\\:last-child\\\\>td\\\\:first-child\\\\]\\\\:rounded-bl-lg:last-child>td:first-child{border-bottom-left-radius:var(--radius)}.\\\\[\\\\&\\\\:last-child\\\\>td\\\\:last-child\\\\]\\\\:rounded-br-lg:last-child>td:last-child{border-bottom-right-radius:var(--radius)}.\\\\[\\\\&\\\\:nth-child\\\\(n\\\\+3\\\\)\\\\]\\\\:hidden:nth-child(n+3){display:none}@container (min-width:28rem){.\\\\@md\\\\:\\\\[\\\\&\\\\:nth-child\\\\(n\\\\+3\\\\)\\\\]\\\\:block:nth-child(n+3){display:block}}.\\\\[\\\\&\\\\:where\\\\(\\\\>\\\\*\\\\)\\\\]\\\\:col-start-2:where(){grid-column-start:2}.only\\\\:\\\\[\\\\&\\\\>\\\\#attachment-tile\\\\]\\\\:size-24:only-child>#attachment-tile{width:calc(var(--spacing)*24);height:calc(var(--spacing)*24)}.\\\\[\\\\&\\\\>\\\\.aui-thread-root\\\\]\\\\:bg-inherit>.aui-thread-root{background-color:inherit}.\\\\[\\\\&\\\\>a\\\\]\\\\:text-xs>a{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.\\\\[\\\\&\\\\>a\\\\]\\\\:no-underline>a{text-decoration-line:none}.\\\\[\\\\&\\\\>button\\\\]\\\\:rounded-full>button{border-radius:3.40282e38px}.\\\\[\\\\&\\\\>button\\\\]\\\\:bg-foreground\\\\/60>button{background-color:var(--foreground)}@supports (color:color-mix(in lab, red, red)){.\\\\[\\\\&\\\\>button\\\\]\\\\:bg-foreground\\\\/60>button{background-color:color-mix(in oklab,var(--foreground)60%,transparent)}}.\\\\[\\\\&\\\\>button\\\\]\\\\:p-1>button{padding:calc(var(--spacing)*1)}.\\\\[\\\\&\\\\>button\\\\]\\\\:opacity-100>button{opacity:1}.\\\\[\\\\&\\\\>button\\\\]\\\\:\\\\!ring-0>button{--tw-ring-shadow:var(--tw-ring-inset,)0 0 0 calc(0px + var(--tw-ring-offset-width))var(--tw-ring-color,currentcolor)!important;box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)!important}@media (hover:hover){.\\\\[\\\\&\\\\>button\\\\]\\\\:hover\\\\:\\\\[\\\\&_svg\\\\]\\\\:text-destructive>button:hover svg{color:var(--destructive)}}.\\\\[\\\\&\\\\>li\\\\]\\\\:mt-0\\\\.5>li{margin-top:calc(var(--spacing)*.5)}.\\\\[\\\\&\\\\>li\\\\]\\\\:mt-1>li{margin-top:calc(var(--spacing)*1)}.\\\\[\\\\&\\\\>span\\\\]\\\\:text-xs>span{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.\\\\[\\\\&\\\\[align\\\\=center\\\\]\\\\]\\\\:text-center[align=center]{text-align:center}.\\\\[\\\\&\\\\[align\\\\=right\\\\]\\\\]\\\\:text-right[align=right]{text-align:right}}@keyframes shimmer{0%{transform:translate(-100%)}to{transform:translate(200%)}}@keyframes subtle-pulse{0%,to{opacity:1}50%{opacity:.85}}@keyframes smooth-slide-down{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}@keyframes fadeInUp{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes gradient-shift{0%,to{transform:translate(0%)translateY(0%)}25%{transform:translate(100%)translateY(100%)}50%{transform:translate(100%)translateY(0%)}75%{transform:translate(0%)translateY(100%)}}@keyframes float{0%,to{transform:translateY(0)translate(0)}33%{transform:translateY(-30px)translate(20px)}66%{transform:translateY(20px)translate(-20px)}}@keyframes float-delayed{0%,to{transform:translateY(0)translate(0)}33%{transform:translateY(30px)translate(-30px)}66%{transform:translateY(-20px)translate(20px)}}.tool-card-transition{transition:all .4s cubic-bezier(.34,1.56,.64,1)}.tool-card-smooth{transition:all .35s cubic-bezier(.4,0,.2,1)}.animate-fadeInUp{opacity:0;animation:.5s ease-out forwards fadeInUp}.animate-gradient-shift{background-size:200% 200%;animation:20s ease-in-out infinite gradient-shift}.animate-float-slow{animation:20s ease-in-out infinite float}.animate-float-delayed{animation:25s ease-in-out 5s infinite float-delayed}.no-scrollbar::-webkit-scrollbar{display:none}.no-scrollbar{-ms-overflow-style:none;scrollbar-width:none}@keyframes tool-border-rotate{0%{--tool-border-angle:0deg}to{--tool-border-angle:360deg}}@property --tool-border-angle{syntax:\\\"<angle>\\\";inherits:false;initial-value:0deg}.tool-border-calling{background:conic-gradient(from var(--tool-border-angle),transparent 0deg,transparent 60deg,#3b82f680 90deg,#60a5fab3 120deg,#93c5fd80 150deg,transparent 180deg,transparent 360deg);animation:1.5s linear infinite tool-border-rotate}.tool-border-success{background:#22c55e66;box-shadow:0 0 12px #22c55e4d,inset 0 0 8px #22c55e1a}.tool-border-error{background:#ef444466;box-shadow:0 0 12px #ef44444d,inset 0 0 8px #ef44441a}@keyframes pulse-success{0%,to{box-shadow:0 0 #22c55e66}50%{box-shadow:0 0 0 8px #22c55e00}}@keyframes shake{0%,to{transform:translate(0)}10%,30%,50%,70%,90%{transform:translate(-2px)}20%,40%,60%,80%{transform:translate(2px)}}.animate-pulse-success{animation:.6s ease-out pulse-success}.animate-shake{animation:.3s ease-out shake}@keyframes aui-pulse{50%{opacity:.5}}:where(.aui-md[data-status=running]):empty:after,:where(.aui-md[data-status=running])>:where(:not(ol):not(ul):not(pre)):last-child:after,:where(.aui-md[data-status=running])>pre:last-child code:after,:where(.aui-md[data-status=running])>:where(:is(ol,ul):last-child)>:where(li:last-child:not(:has(*>li))):after,:where(.aui-md[data-status=running])>:where(:is(ol,ul):last-child)>:where(li:last-child)>:where(:is(ol,ul):last-child)>:where(li:last-child:not(:has(*>li))):after,:where(.aui-md[data-status=running])>:where(:is(ol,ul):last-child)>:where(li:last-child)>:where(:is(ol,ul):last-child)>:where(li:last-child)>:where(:is(ol,ul):last-child)>:where(li:last-child):after{--aui-content:\\\"●\\\";content:var(--aui-content);margin-left:.25rem;margin-right:.25rem;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;animation:2s cubic-bezier(.4,0,.6,1) infinite aui-pulse}.glass-pill{-webkit-backdrop-filter:blur(20px)saturate(150%);background:#0f172ad9;border:1px solid #ffffff0f;box-shadow:0 4px 16px #0003,inset 0 .5px #ffffff14}.glass-pill:before{content:\\\"\\\";border-radius:inherit;pointer-events:none;z-index:1;background:linear-gradient(#ffffff0a 0%,#0000 40%);position:absolute;inset:0}.glass-pill:after{display:none}.glass-pill-collapsed{-webkit-backdrop-filter:blur(12px);background:#ffffff1f;border:none;box-shadow:0 1px 4px #00000026}.glass-pill-collapsed:before,.glass-pill-collapsed:after{display:none}.glass-pill-hovered{-webkit-backdrop-filter:blur(16px)saturate(140%);background:#0f172acc;border:1px solid #ffffff0f;box-shadow:0 2px 12px #0000002e}.glass-pill-hovered:before,.glass-pill-hovered:after{display:none}@keyframes glass-shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}.glass-shimmer{background:linear-gradient(90deg,#ffffff14 0%,#ffffff26 50%,#ffffff14 100%) 0 0/200% 100%;animation:4s ease-in-out infinite glass-shimmer}@property --tw-border-spacing-x{syntax:\\\"<length>\\\";inherits:false;initial-value:0}@property --tw-border-spacing-y{syntax:\\\"<length>\\\";inherits:false;initial-value:0}@property --tw-translate-x{syntax:\\\"*\\\";inherits:false;initial-value:0}@property --tw-translate-y{syntax:\\\"*\\\";inherits:false;initial-value:0}@property --tw-translate-z{syntax:\\\"*\\\";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:\\\"*\\\";inherits:false}@property --tw-rotate-y{syntax:\\\"*\\\";inherits:false}@property --tw-rotate-z{syntax:\\\"*\\\";inherits:false}@property --tw-skew-x{syntax:\\\"*\\\";inherits:false}@property --tw-skew-y{syntax:\\\"*\\\";inherits:false}@property --tw-space-y-reverse{syntax:\\\"*\\\";inherits:false;initial-value:0}@property --tw-border-style{syntax:\\\"*\\\";inherits:false;initial-value:solid}@property --tw-leading{syntax:\\\"*\\\";inherits:false}@property --tw-font-weight{syntax:\\\"*\\\";inherits:false}@property --tw-tracking{syntax:\\\"*\\\";inherits:false}@property --tw-ordinal{syntax:\\\"*\\\";inherits:false}@property --tw-slashed-zero{syntax:\\\"*\\\";inherits:false}@property --tw-numeric-figure{syntax:\\\"*\\\";inherits:false}@property --tw-numeric-spacing{syntax:\\\"*\\\";inherits:false}@property --tw-numeric-fraction{syntax:\\\"*\\\";inherits:false}@property --tw-shadow{syntax:\\\"*\\\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\\\"*\\\";inherits:false}@property --tw-shadow-alpha{syntax:\\\"<percentage>\\\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\\\"*\\\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\\\"*\\\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\\\"<percentage>\\\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\\\"*\\\";inherits:false}@property --tw-ring-shadow{syntax:\\\"*\\\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\\\"*\\\";inherits:false}@property --tw-inset-ring-shadow{syntax:\\\"*\\\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\\\"*\\\";inherits:false}@property --tw-ring-offset-width{syntax:\\\"<length>\\\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\\\"*\\\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\\\"*\\\";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:\\\"*\\\";inherits:false;initial-value:solid}@property --tw-blur{syntax:\\\"*\\\";inherits:false}@property --tw-brightness{syntax:\\\"*\\\";inherits:false}@property --tw-contrast{syntax:\\\"*\\\";inherits:false}@property --tw-grayscale{syntax:\\\"*\\\";inherits:false}@property --tw-hue-rotate{syntax:\\\"*\\\";inherits:false}@property --tw-invert{syntax:\\\"*\\\";inherits:false}@property --tw-opacity{syntax:\\\"*\\\";inherits:false}@property --tw-saturate{syntax:\\\"*\\\";inherits:false}@property --tw-sepia{syntax:\\\"*\\\";inherits:false}@property --tw-drop-shadow{syntax:\\\"*\\\";inherits:false}@property --tw-drop-shadow-color{syntax:\\\"*\\\";inherits:false}@property --tw-drop-shadow-alpha{syntax:\\\"<percentage>\\\";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:\\\"*\\\";inherits:false}@property --tw-backdrop-blur{syntax:\\\"*\\\";inherits:false}@property --tw-backdrop-brightness{syntax:\\\"*\\\";inherits:false}@property --tw-backdrop-contrast{syntax:\\\"*\\\";inherits:false}@property --tw-backdrop-grayscale{syntax:\\\"*\\\";inherits:false}@property --tw-backdrop-hue-rotate{syntax:\\\"*\\\";inherits:false}@property --tw-backdrop-invert{syntax:\\\"*\\\";inherits:false}@property --tw-backdrop-opacity{syntax:\\\"*\\\";inherits:false}@property --tw-backdrop-saturate{syntax:\\\"*\\\";inherits:false}@property --tw-backdrop-sepia{syntax:\\\"*\\\";inherits:false}@property --tw-duration{syntax:\\\"*\\\";inherits:false}@property --tw-ease{syntax:\\\"*\\\";inherits:false}@property --tw-scale-x{syntax:\\\"*\\\";inherits:false;initial-value:1}@property --tw-scale-y{syntax:\\\"*\\\";inherits:false;initial-value:1}@property --tw-scale-z{syntax:\\\"*\\\";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}}\";\n\n/**\n * Inject the WebMCP styles into the document head.\n * This is called automatically when registering the web component.\n */\nexport function injectStyles(): void {\n\tif (typeof document === 'undefined') return\n\n\tconst styleId = 'webmcp-agent-styles'\n\tif (document.getElementById(styleId)) return\n\n\tconst style = document.createElement('style')\n\tstyle.id = styleId\n\tstyle.textContent = WEBMCP_STYLES\n\tdocument.head.appendChild(style)\n}\n","/**\n * WebMCP Agent Web Component\n *\n * A custom element wrapper for the EmbeddedAgent React component.\n * Uses @r2wc/react-to-web-component to convert React to a native web component.\n *\n * @example Usage as a custom element (standalone - styles auto-injected)\n * ```html\n * <script src=\"@mcp-b/embedded-agent/web-component/standalone\"></script>\n * <webmcp-agent\n * app-id=\"your-app-id\"\n * api-base=\"https://your-worker.workers.dev\"\n * ></webmcp-agent>\n * ```\n *\n * @example React usage (import the component directly)\n * ```tsx\n * import { EmbeddedAgent } from '@mcp-b/embedded-agent'\n * import '@mcp-b/embedded-agent/styles'\n *\n * function App() {\n * return (\n * <EmbeddedAgent\n * appId=\"your-app-id\"\n * apiBase=\"https://your-worker.workers.dev\"\n * />\n * )\n * }\n * ```\n */\n\nimport { AssistantRuntimeProvider } from '@assistant-ui/react'\nimport { AssistantChatTransport, useChatRuntime } from '@assistant-ui/react-ai-sdk'\nimport r2wc from '@r2wc/react-to-web-component'\nimport { lastAssistantMessageIsCompleteWithToolCalls } from 'ai'\nimport { useCallback, useMemo, useState } from 'react'\n\nimport { AssistantModal } from './components/assistant-modal'\nimport { MCPToolRegistry } from './components/MCPToolRegistry'\nimport { AgentPill, HistorySidebar } from './components/pill'\nimport { injectStyles } from './generated/inline-styles'\nimport { MCPToolsProvider } from './providers/MCPToolsProvider'\nimport { VoiceModeProvider } from './providers/VoiceModeProvider'\n\nimport type { FC } from 'react'\nimport type { Conversation } from './components/pill'\n\n/** View mode for the agent UI */\nexport type AgentViewMode = 'pill' | 'modal'\n\n/**\n * Props for the EmbeddedAgent React component\n *\n * These props map to HTML attributes in kebab-case when used as a web component:\n * - appId -> app-id\n * - apiBase -> api-base\n * - tokenEndpoint -> token-endpoint\n * - autoConnectLocal -> auto-connect-local\n * - viewMode -> view-mode\n */\nexport interface EmbeddedAgentProps {\n\t/** Your app/workspace ID */\n\tappId: string\n\t/** API base URL for your WebMCP worker */\n\tapiBase?: string\n\t/** Voice mode token endpoint (defaults to {apiBase}/api/realtime/session) */\n\ttokenEndpoint?: string\n\t/** Auto-connect to local MCP source (default: true) */\n\tautoConnectLocal?: boolean\n\t/** UI view mode: 'pill' (action-first) or 'modal' (traditional chat) */\n\tviewMode?: AgentViewMode\n\t/** Callback when tools are updated */\n\tonToolsChange?: (tools: unknown[]) => void\n\t/** Callback when voice mode errors */\n\tonVoiceError?: (error: string) => void\n\t/** Callback when voice mode connects */\n\tonVoiceConnect?: () => void\n\t/** Callback when voice mode disconnects */\n\tonVoiceDisconnect?: (duration: number) => void\n}\n\n/**\n * EmbeddedAgent React Component\n *\n * A fully self-contained chat widget with MCP tool support and optional voice mode.\n * Supports two view modes:\n * - 'pill': Action-first compact UI (default)\n * - 'modal': Traditional chat modal\n *\n * Can be used as a React component or converted to a web component.\n */\nexport const EmbeddedAgent: FC<EmbeddedAgentProps> = ({\n\tappId,\n\tapiBase,\n\ttokenEndpoint,\n\tautoConnectLocal = true,\n\tviewMode = 'pill',\n\tonToolsChange,\n\tonVoiceError,\n\tonVoiceConnect,\n\tonVoiceDisconnect,\n}) => {\n\t// Create transport with custom API endpoint\n\tconst transport = useMemo(() => {\n\t\tconst chatApi = apiBase ? `${apiBase}/api/chat` : '/api/chat'\n\t\treturn new AssistantChatTransport({ api: chatApi })\n\t}, [apiBase])\n\n\tconst runtime = useChatRuntime({\n\t\ttransport,\n\t\tsendAutomaticallyWhen: (messages) => {\n\t\t\treturn lastAssistantMessageIsCompleteWithToolCalls(messages)\n\t\t},\n\t})\n\n\t// State for history sidebar\n\tconst [isHistoryOpen, setIsHistoryOpen] = useState(false)\n\tconst [conversations] = useState<Conversation[]>([]) // TODO: Load from API\n\n\t// Callbacks\n\tconst handleOpenHistory = useCallback(() => {\n\t\tsetIsHistoryOpen(true)\n\t}, [])\n\n\tconst handleCloseHistory = useCallback(() => {\n\t\tsetIsHistoryOpen(false)\n\t}, [])\n\n\t// Compute token endpoint from apiBase if not explicitly provided\n\tconst resolvedTokenEndpoint =\n\t\ttokenEndpoint || (apiBase ? `${apiBase}/api/realtime/session` : undefined)\n\n\t// Log appId for debugging (to be used for API calls in future)\n\tif (appId && typeof window !== 'undefined') {\n\t\tconsole.debug('[WebMCP] Initialized with app_id:', appId, 'viewMode:', viewMode)\n\t}\n\n\t// Render the appropriate UI based on view mode\n\tconst renderUI = () => {\n\t\tif (viewMode === 'pill') {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t<AgentPill\n\t\t\t\t\t\tposition=\"bottom-center\"\n\t\t\t\t\t\tonOpenHistory={handleOpenHistory}\n\t\t\t\t\t\tshowVoiceButton={!!resolvedTokenEndpoint}\n\t\t\t\t\t/>\n\t\t\t\t\t<HistorySidebar\n\t\t\t\t\t\tisOpen={isHistoryOpen}\n\t\t\t\t\t\tonClose={handleCloseHistory}\n\t\t\t\t\t\tconversations={conversations}\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t)\n\t\t}\n\n\t\t// Default to modal view\n\t\treturn <AssistantModal />\n\t}\n\n\treturn (\n\t\t<MCPToolsProvider autoConnectLocal={autoConnectLocal} onToolsChange={onToolsChange}>\n\t\t\t{resolvedTokenEndpoint ? (\n\t\t\t\t<VoiceModeProvider\n\t\t\t\t\ttokenEndpoint={resolvedTokenEndpoint}\n\t\t\t\t\tonError={onVoiceError}\n\t\t\t\t\tonConnect={onVoiceConnect}\n\t\t\t\t\tonDisconnect={onVoiceDisconnect}\n\t\t\t\t>\n\t\t\t\t\t<AssistantRuntimeProvider runtime={runtime}>\n\t\t\t\t\t\t<MCPToolRegistry />\n\t\t\t\t\t\t{renderUI()}\n\t\t\t\t\t</AssistantRuntimeProvider>\n\t\t\t\t</VoiceModeProvider>\n\t\t\t) : (\n\t\t\t\t<AssistantRuntimeProvider runtime={runtime}>\n\t\t\t\t\t<MCPToolRegistry />\n\t\t\t\t\t{renderUI()}\n\t\t\t\t</AssistantRuntimeProvider>\n\t\t\t)}\n\t\t</MCPToolsProvider>\n\t)\n}\n\n/**\n * Web Component Definition\n *\n * Converts EmbeddedAgent to a custom element that can be used in any HTML page.\n * Attributes are automatically converted from kebab-case to camelCase props.\n */\n// Cast needed for React 19 compatibility - FC return type changed to ReactNode | Promise<ReactNode>\n// but @r2wc expects the older ComponentType signature. Using double assertion to bridge\n// the incompatible React type definitions between our project and @r2wc's dependencies.\nexport const WebMCPAgentElement = r2wc(EmbeddedAgent as unknown as Parameters<typeof r2wc>[0], {\n\tprops: {\n\t\tappId: 'string',\n\t\tapiBase: 'string',\n\t\ttokenEndpoint: 'string',\n\t\tautoConnectLocal: 'boolean',\n\t\tviewMode: 'string',\n\t},\n})\n\n/**\n * Register the custom element\n *\n * Call this function to register the <webmcp-agent> custom element.\n * This is automatically called when importing the web-component entry point.\n * Styles are automatically injected into the document head.\n */\nexport function registerWebMCPAgent(tagName = 'webmcp-agent'): void {\n\tif (typeof window === 'undefined') return\n\n\t// Inject styles into the document head\n\tinjectStyles()\n\n\t// Register the custom element if not already registered\n\tif (!customElements.get(tagName)) {\n\t\tcustomElements.define(tagName, WebMCPAgentElement)\n\t}\n}\n\n// Auto-register when this module is imported\nregisterWebMCPAgent()\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,SAAgBG,GAAG,GAAGC,QAA8B;AACnD,QAAOH,QAAQD,KAAKI,OAAO,CAAC;;;;;;ACW7B,MAAaI,2BAA2B;;AAOxC,MAAaC,uBAAuB;;AAGpC,MAAaC,yBAAyB;;AAGtC,MAAaC,yBAAyB;;AAGtC,MAAaC,2BAA2B;;AAGxC,MAAaC,kCAAkC;;AAG/C,MAAaC,4BAA4B;;AAGzC,MAAaC,gCAAgC;;AAG7C,MAAaC,sCAAsC;;;;;;AA4BnD,MAAaI,wBACZ,OAAOC,WAAW,eACjBA,OAA0CC,qBAAqB;;;;;;;;;AAUjE,SAAgBC,SAASC,WAAmBC,SAAiBC,MAAsB;AAMlF,KAHC,OAAOL,WAAW,eACjBA,OAA0CC,qBAAqB,KAGhE,KAAII,SAASE,OACZC,SAAQC,IAAI,IAAIN,UAAS,IAAKC,WAAWC,KAAK;KAE9CG,SAAQC,IAAI,IAAIN,UAAS,IAAKC,UAAU;;;;;;;;;AC7F3C,IAAaO,gBAAb,MAA2B;CAC1B,AAAQC,eAAoC;CAC5C,AAAQE,WAAgC;CACxC,AAAQE,SAA4C;CACpD,AAAQE,YAA4C;CACpD,A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