{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"marketing-feature-sections-feature-chat","type":"registry:block","title":"Feature Chat","files":[{"path":"components/blocks/marketing/feature-sections/feature-chat.tsx","content":"import { useState, useRef } from 'react';\nimport { Button } from '@/components/ui/button';\nimport { Input } from '@/components/ui/input';\nimport { Badge } from '@/components/ui/badge';\nimport { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';\nimport { ArrowRight, Code2, Command, MessageSquare, Paperclip, Search, Send, Shield, Sparkles, ThumbsUp, Zap } from 'lucide-react';\n\nimport { cn } from '@/lib/utils';\n\nimport type { ComponentType, SVGProps } from 'react';\n\ntype LucideIcon = ComponentType<SVGProps<SVGSVGElement> & { size?: number | string }>;\ninterface Message {\n  id: string;\n  content: string;\n  sender: 'user' | 'assistant';\n  feature?: string;\n  timestamp: Date;\n  isTyping?: boolean;\n}\n\ninterface Feature {\n  id: string;\n  name: string;\n  description: string;\n  icon: LucideIcon;\n  color: string;\n  triggerWords: string[];\n}\n\nconst features: Feature[] = [\n  {\n    id: 'performance',\n    name: 'Lightning Performance',\n    description:\n      'Our platform delivers exceptional performance with optimized algorithms and efficient resource management.',\n    icon: Zap,\n    color: 'text-amber-500',\n    triggerWords: ['fast', 'performance', 'speed', 'quick', 'efficient'],\n  },\n  {\n    id: 'ai',\n    name: 'AI-Powered Tools',\n    description:\n      'Leverage artificial intelligence to automate tasks, gain insights, and enhance productivity.',\n    icon: Sparkles,\n    color: 'text-purple-500',\n    triggerWords: ['ai', 'intelligence', 'smart', 'automation', 'learn'],\n  },\n  {\n    id: 'security',\n    name: 'Enterprise Security',\n    description:\n      'End-to-end encryption and advanced security protocols keep your data safe.',\n    icon: Shield,\n    color: 'text-blue-500',\n    triggerWords: ['secure', 'security', 'protection', 'safe', 'encrypt'],\n  },\n  {\n    id: 'api',\n    name: 'Developer API',\n    description:\n      'Integrate with your existing tools and workflows using our comprehensive API.',\n    icon: Code2,\n    color: 'text-emerald-500',\n    triggerWords: ['api', 'integration', 'code', 'developer', 'connect'],\n  },\n  {\n    id: 'cli',\n    name: 'Command Line Interface',\n    description:\n      'Powerful CLI tools for developers who prefer terminal-based workflows.',\n    icon: Command,\n    color: 'text-gray-500',\n    triggerWords: ['cli', 'command', 'terminal', 'console', 'shell'],\n  },\n];\n\nconst initialMessages: Message[] = [\n  {\n    id: '1',\n    content:\n      \"Hello! I'm your product assistant. I can help you discover our key features. What would you like to know about?\",\n    sender: 'assistant',\n    timestamp: new Date(),\n  },\n];\n\nconst suggestedQuestions = [\n  'How fast is your platform?',\n  'Tell me about your security features',\n  'Do you have AI capabilities?',\n  'Is there an API for developers?',\n  'Can I use the CLI to manage tasks?',\n];\n\nexport default function FeatureChat() {\n  const [messages, setMessages] = useState<Message[]>(initialMessages);\n  const [inputValue, setInputValue] = useState('');\n  const [isAssistantTyping, setIsAssistantTyping] = useState(false);\n  const messagesEndRef = useRef<HTMLDivElement>(null);\n\n  const findRelevantFeature = (text: string): Feature | undefined => {\n    const lowerText = text.toLowerCase();\n    return features.find((feature) =>\n      feature.triggerWords.some((word) => lowerText.includes(word))\n    );\n  };\n\n  const handleSendMessage = () => {\n    if (!inputValue.trim()) return;\n\n    // Add user message\n    const userMessage: Message = {\n      id: `user-${Date.now()}`,\n      content: inputValue,\n      sender: 'user',\n      timestamp: new Date(),\n    };\n\n    setMessages((prev) => [...prev, userMessage]);\n    setInputValue('');\n    setIsAssistantTyping(true);\n\n    // Determine which feature the user is asking about\n    const relevantFeature = findRelevantFeature(inputValue);\n\n    // Simulate assistant typing delay\n    setTimeout(() => {\n      let assistantResponse: Message;\n\n      if (relevantFeature) {\n        assistantResponse = {\n          id: `assistant-${Date.now()}`,\n          content: `${relevantFeature.description} Would you like to learn more about ${relevantFeature.name}?`,\n          sender: 'assistant',\n          feature: relevantFeature.id,\n          timestamp: new Date(),\n        };\n      } else {\n        assistantResponse = {\n          id: `assistant-${Date.now()}`,\n          content:\n            \"I'm not sure I understand. Could you tell me which specific feature you're interested in? We have performance optimizations, AI capabilities, security features, developer APIs, and CLI tools.\",\n          sender: 'assistant',\n          timestamp: new Date(),\n        };\n      }\n\n      setMessages((prev) => [...prev, assistantResponse]);\n      setIsAssistantTyping(false);\n    }, 1500);\n  };\n\n  const handleSuggestedQuestion = (question: string) => {\n    setInputValue(question);\n    // Optional: Automatically send the message\n    // setTimeout(handleSendMessage, 100);\n  };\n\n  return (\n    <section className=\"container mx-auto space-y-12 px-4 py-24 md:px-6 2xl:max-w-[1400px]\">\n      <div className=\"space-y-4 text-center\">\n        <h2 className=\"text-3xl font-bold tracking-tighter sm:text-4xl md:text-5xl\">\n          Chat with our product assistant\n        </h2>\n        <p className=\"text-muted-foreground mx-auto max-w-[700px] md:text-xl/relaxed lg:text-base/relaxed xl:text-xl/relaxed\">\n          Discover our powerful features through an interactive conversation\n        </p>\n      </div>\n\n      <div className=\"grid grid-cols-1 gap-8 lg:grid-cols-3 lg:gap-12\">\n        <div className=\"space-y-6 lg:col-span-1\">\n          <div className=\"space-y-4\">\n            <h3 className=\"text-lg font-medium\">Key features</h3>\n\n            <div className=\"space-y-3\">\n              {features.map((feature) => (\n                <div\n                  key={feature.id}\n                  className=\"hover:border-primary hover:bg-primary/5 flex cursor-pointer items-start gap-3 rounded-lg border p-3 transition-all\"\n                  onClick={() =>\n                    handleSuggestedQuestion(\n                      `Tell me about your ${feature.name.toLowerCase()}`\n                    )\n                  }\n                >\n                  <div className={cn('bg-muted rounded-md p-2', feature.color)}>\n                    <feature.icon className=\"h-5 w-5\" />\n                  </div>\n                  <div>\n                    <h4 className=\"font-medium\">{feature.name}</h4>\n                    <p className=\"text-muted-foreground line-clamp-2 text-sm\">\n                      {feature.description}\n                    </p>\n                  </div>\n                </div>\n              ))}\n            </div>\n          </div>\n\n          <div className=\"space-y-4\">\n            <h3 className=\"text-lg font-medium\">Suggested questions</h3>\n            <div className=\"flex flex-wrap gap-2\">\n              {suggestedQuestions.map((question, index) => (\n                <Badge\n                  key={index}\n                  variant=\"outline\"\n                  className=\"hover:bg-primary/10 cursor-pointer py-1.5\"\n                  onClick={() => handleSuggestedQuestion(question)}\n                >\n                  <MessageSquare className=\"mr-1 h-3.5 w-3.5\" />\n                  {question}\n                </Badge>\n              ))}\n            </div>\n          </div>\n\n          <div className=\"hidden lg:block\">\n            <a\n              href=\"#\"\n              className=\"text-muted-foreground hover:text-primary flex items-center gap-1 text-sm\"\n            >\n              <Search className=\"h-4 w-4\" />\n              Browse feature documentation\n            </a>\n          </div>\n        </div>\n\n        <div className=\"flex h-[600px] flex-col rounded-xl border shadow-sm lg:col-span-2\">\n          {/* Chat header */}\n          <div className=\"flex items-center gap-3 border-b p-4\">\n            <Avatar className=\"h-10 w-10\">\n              <AvatarImage\n                src=\"/images/bot-avatar.png\"\n                alt=\"Product Assistant\"\n              />\n              <AvatarFallback className=\"bg-primary/10 text-primary\">\n                PA\n              </AvatarFallback>\n            </Avatar>\n            <div>\n              <h3 className=\"font-semibold\">Product Assistant</h3>\n              <p className=\"text-muted-foreground text-xs\">\n                Ask me about our features\n              </p>\n            </div>\n            <Badge variant=\"outline\" className=\"ml-auto\">\n              <span className=\"mr-1 h-2 w-2 rounded-full bg-green-500\"></span>\n              Online\n            </Badge>\n          </div>\n\n          {/* Chat messages */}\n          <div className=\"flex-grow space-y-4 overflow-y-auto p-4\">\n            {messages.map((message) => (\n              <div\n                key={message.id}\n                className={cn(\n                  'flex',\n                  message.sender === 'user' ? 'justify-end' : 'justify-start'\n                )}\n              >\n                <div\n                  className={cn(\n                    'max-w-[80%] rounded-lg p-3',\n                    message.sender === 'user'\n                      ? 'bg-primary text-primary-foreground rounded-br-none'\n                      : 'bg-muted rounded-bl-none'\n                  )}\n                >\n                  {message.feature ? (\n                    <div className=\"space-y-2\">\n                      <p>{message.content}</p>\n                      <div className=\"flex items-center gap-2 text-sm\">\n                        {(() => {\n                          const feature = features.find(\n                            (f) => f.id === message.feature\n                          );\n                          if (!feature) return null;\n                          return (\n                            <>\n                              <feature.icon\n                                className={cn('h-4 w-4', feature.color)}\n                              />\n                              <span className=\"font-medium\">\n                                {feature.name}\n                              </span>\n                            </>\n                          );\n                        })()}\n                      </div>\n                    </div>\n                  ) : (\n                    <p>{message.content}</p>\n                  )}\n                  <div\n                    className={cn(\n                      'mt-1 flex items-center gap-2 text-xs',\n                      message.sender === 'user'\n                        ? 'text-primary-foreground/80'\n                        : 'text-muted-foreground'\n                    )}\n                  >\n                    {message.timestamp.toLocaleTimeString([], {\n                      hour: '2-digit',\n                      minute: '2-digit',\n                    })}\n                    {message.sender === 'user' && (\n                      <ThumbsUp className=\"h-3 w-3\" />\n                    )}\n                  </div>\n                </div>\n              </div>\n            ))}\n\n            {isAssistantTyping && (\n              <div className=\"flex justify-start\">\n                <div className=\"bg-muted rounded-lg rounded-bl-none p-3\">\n                  <div className=\"flex space-x-2\">\n                    <div className=\"bg-muted-foreground/50 h-2 w-2 animate-bounce rounded-full\"></div>\n                    <div className=\"bg-muted-foreground/50 h-2 w-2 animate-bounce rounded-full delay-75\"></div>\n                    <div className=\"bg-muted-foreground/50 h-2 w-2 animate-bounce rounded-full delay-150\"></div>\n                  </div>\n                </div>\n              </div>\n            )}\n\n            <div ref={messagesEndRef} />\n          </div>\n\n          {/* Chat input */}\n          <div className=\"border-t p-4\">\n            <form\n              onSubmit={(e) => {\n                e.preventDefault();\n                handleSendMessage();\n              }}\n              className=\"flex items-center gap-2\"\n            >\n              <Button\n                type=\"button\"\n                size=\"icon\"\n                variant=\"ghost\"\n                className=\"rounded-full\"\n              >\n                <Paperclip className=\"text-muted-foreground h-5 w-5\" />\n              </Button>\n              <Input\n                value={inputValue}\n                onChange={(e) => setInputValue(e.target.value)}\n                placeholder=\"Ask about our features...\"\n                className=\"flex-grow\"\n              />\n              <Button\n                type=\"submit\"\n                size=\"icon\"\n                disabled={!inputValue.trim()}\n                className=\"rounded-full\"\n              >\n                <Send className=\"h-5 w-5\" />\n              </Button>\n            </form>\n          </div>\n        </div>\n      </div>\n\n      <div className=\"space-y-4 rounded-xl border p-8 text-center\">\n        <h3 className=\"text-xl font-bold\">\n          Ready to explore all our features?\n        </h3>\n        <p className=\"text-muted-foreground mx-auto max-w-[600px]\">\n          Get a personalized demo from our product experts and see how our\n          platform can help your business.\n        </p>\n        <Button asChild size=\"lg\" className=\"mt-2\">\n          <a href=\"#\">\n            Schedule a demo <ArrowRight className=\"ml-2 h-4 w-4\" />\n          </a>\n        </Button>\n      </div>\n    </section>\n  );\n}\n","type":"registry:component","target":"components/blocks/marketing/feature-sections/feature-chat.tsx"},{"path":"components/ui/button.tsx","content":"import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Slot } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst buttonVariants = cva(\n  \"group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\n  {\n    variants: {\n      variant: {\n        default: \"bg-primary text-primary-foreground hover:bg-primary/80\",\n        outline:\n          \"border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50\",\n        secondary:\n          \"bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground\",\n        ghost:\n          \"hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50\",\n        destructive:\n          \"bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40\",\n        link: \"text-primary underline-offset-4 hover:underline\",\n      },\n      size: {\n        default:\n          \"h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n        xs: \"h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3\",\n        sm: \"h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5\",\n        lg: \"h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2\",\n        icon: \"size-9\",\n        \"icon-xs\":\n          \"size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3\",\n        \"icon-sm\":\n          \"size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md\",\n        \"icon-lg\": \"size-10\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n      size: \"default\",\n    },\n  }\n)\n\nfunction Button({\n  className,\n  variant = \"default\",\n  size = \"default\",\n  asChild = false,\n  ...props\n}: React.ComponentProps<\"button\"> &\n  VariantProps<typeof buttonVariants> & {\n    asChild?: boolean\n  }) {\n  const Comp = asChild ? Slot.Root : \"button\"\n\n  return (\n    <Comp\n      data-slot=\"button\"\n      data-variant={variant}\n      data-size={size}\n      className={cn(buttonVariants({ variant, size, className }))}\n      {...props}\n    />\n  )\n}\n\nexport { Button, buttonVariants }\n","type":"registry:ui","target":"components/ui/button.tsx"},{"path":"components/ui/input.tsx","content":"import * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Input({ className, type, ...props }: React.ComponentProps<\"input\">) {\n  return (\n    <input\n      type={type}\n      data-slot=\"input\"\n      className={cn(\n        \"h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nexport { Input }\n","type":"registry:ui","target":"components/ui/input.tsx"},{"path":"components/ui/badge.tsx","content":"import * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\nimport { Slot } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst badgeVariants = cva(\n  \"group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!\",\n  {\n    variants: {\n      variant: {\n        default: \"bg-primary text-primary-foreground [a]:hover:bg-primary/80\",\n        secondary:\n          \"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80\",\n        destructive:\n          \"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20\",\n        outline:\n          \"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground\",\n        ghost:\n          \"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50\",\n        link: \"text-primary underline-offset-4 hover:underline\",\n      },\n    },\n    defaultVariants: {\n      variant: \"default\",\n    },\n  }\n)\n\nfunction Badge({\n  className,\n  variant = \"default\",\n  asChild = false,\n  ...props\n}: React.ComponentProps<\"span\"> &\n  VariantProps<typeof badgeVariants> & { asChild?: boolean }) {\n  const Comp = asChild ? Slot.Root : \"span\"\n\n  return (\n    <Comp\n      data-slot=\"badge\"\n      data-variant={variant}\n      className={cn(badgeVariants({ variant }), className)}\n      {...props}\n    />\n  )\n}\n\nexport { Badge, badgeVariants }\n","type":"registry:ui","target":"components/ui/badge.tsx"},{"path":"components/ui/avatar.tsx","content":"\"use client\"\n\nimport * as React from \"react\"\nimport { Avatar as AvatarPrimitive } from \"radix-ui\"\n\nimport { cn } from \"@/lib/utils\"\n\nfunction Avatar({\n  className,\n  size = \"default\",\n  ...props\n}: React.ComponentProps<typeof AvatarPrimitive.Root> & {\n  size?: \"default\" | \"sm\" | \"lg\"\n}) {\n  return (\n    <AvatarPrimitive.Root\n      data-slot=\"avatar\"\n      data-size={size}\n      className={cn(\n        \"group/avatar relative flex size-8 shrink-0 rounded-full select-none after:absolute after:inset-0 after:rounded-full after:border after:border-border after:mix-blend-darken data-[size=lg]:size-10 data-[size=sm]:size-6 dark:after:mix-blend-lighten\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction AvatarImage({\n  className,\n  ...props\n}: React.ComponentProps<typeof AvatarPrimitive.Image>) {\n  return (\n    <AvatarPrimitive.Image\n      data-slot=\"avatar-image\"\n      className={cn(\n        \"aspect-square size-full rounded-full object-cover\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction AvatarFallback({\n  className,\n  ...props\n}: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {\n  return (\n    <AvatarPrimitive.Fallback\n      data-slot=\"avatar-fallback\"\n      className={cn(\n        \"flex size-full items-center justify-center rounded-full bg-muted text-sm text-muted-foreground group-data-[size=sm]/avatar:text-xs\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction AvatarBadge({ className, ...props }: React.ComponentProps<\"span\">) {\n  return (\n    <span\n      data-slot=\"avatar-badge\"\n      className={cn(\n        \"absolute right-0 bottom-0 z-10 inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground bg-blend-color ring-2 ring-background select-none\",\n        \"group-data-[size=sm]/avatar:size-2 group-data-[size=sm]/avatar:[&>svg]:hidden\",\n        \"group-data-[size=default]/avatar:size-2.5 group-data-[size=default]/avatar:[&>svg]:size-2\",\n        \"group-data-[size=lg]/avatar:size-3 group-data-[size=lg]/avatar:[&>svg]:size-2\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction AvatarGroup({ className, ...props }: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"avatar-group\"\n      className={cn(\n        \"group/avatar-group flex -space-x-2 *:data-[slot=avatar]:ring-2 *:data-[slot=avatar]:ring-background\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nfunction AvatarGroupCount({\n  className,\n  ...props\n}: React.ComponentProps<\"div\">) {\n  return (\n    <div\n      data-slot=\"avatar-group-count\"\n      className={cn(\n        \"relative flex size-8 shrink-0 items-center justify-center rounded-full bg-muted text-sm text-muted-foreground ring-2 ring-background group-has-data-[size=lg]/avatar-group:size-10 group-has-data-[size=sm]/avatar-group:size-6 [&>svg]:size-4 group-has-data-[size=lg]/avatar-group:[&>svg]:size-5 group-has-data-[size=sm]/avatar-group:[&>svg]:size-3\",\n        className\n      )}\n      {...props}\n    />\n  )\n}\n\nexport {\n  Avatar,\n  AvatarImage,\n  AvatarFallback,\n  AvatarGroup,\n  AvatarGroupCount,\n  AvatarBadge,\n}\n","type":"registry:ui","target":"components/ui/avatar.tsx"}],"description":"A feature section styled as a chat thread, pairing message bubbles with copy. Built to show a messaging or support product talking in real conversation.","dependencies":["class-variance-authority","lucide-react","radix-ui"]}