{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "email-campaign-composer",
  "title": "Email Campaign Composer",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-react/blocks/email-campaign-composer/EmailCampaignComposer.tsx",
      "content": "'use client'\n\nimport * as React from 'react'\nimport {\n  ArrowRight,\n  Calendar,\n  Check,\n  CheckCircle2,\n  Eye,\n  Flame,\n  Inbox,\n  Lock,\n  Mail,\n  Monitor,\n  Send,\n  ShieldCheck,\n  Smartphone,\n  Sparkles,\n  Split,\n  Terminal,\n  UserCheck,\n  Users,\n  Zap,\n} from 'lucide-react'\nimport { Badge } from '@/components/ui/badge'\nimport { Button } from '@/components/ui/button'\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'\nimport {\n  Dialog,\n  DialogContent,\n  DialogDescription,\n  DialogFooter,\n  DialogHeader,\n  DialogTitle,\n  DialogTrigger,\n} from '@/components/ui/dialog'\nimport { Input } from '@/components/ui/input'\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'\nimport { Separator } from '@/components/ui/separator'\nimport { Switch } from '@/components/ui/switch'\nimport { cn } from '@/lib/utils'\n\nexport interface EmailCampaignComposerProps {\n  className?: string\n}\n\ntype ViewportMode = 'desktop' | 'mobile'\ntype ClientOption = 'all' | 'gmail' | 'apple' | 'outlook'\ntype ScheduleTiming = 'optimal' | 'immediate' | 'custom'\n\ninterface AudienceSegment {\n  id: string\n  label: string\n  count: number\n  formattedCount: string\n  openRate: string\n  clickRate: string\n  deliverability: string\n}\n\nconst audienceOptions: AudienceSegment[] = [\n  {\n    id: 'active-devs',\n    label: 'All Active Developers (42,500 subscribers)',\n    count: 42500,\n    formattedCount: '42.5k',\n    openRate: '38.4%',\n    clickRate: '12.2%',\n    deliverability: '99.9%',\n  },\n  {\n    id: 'tech-leads',\n    label: 'Enterprise Tech Leads (8,200 subscribers)',\n    count: 8200,\n    formattedCount: '8.2k',\n    openRate: '46.1%',\n    clickRate: '18.5%',\n    deliverability: '99.8%',\n  },\n  {\n    id: 'free-users',\n    label: 'Free Plan Users (28,000 subscribers)',\n    count: 28000,\n    formattedCount: '28.0k',\n    openRate: '31.2%',\n    clickRate: '8.9%',\n    deliverability: '99.7%',\n  },\n]\n\nconst aiSuggestions = [\n  {\n    text: '🚀 Introducing UIPKGE 2.0: The unbundled UI registry',\n    score: 94,\n    tag: 'High Open Rate Impact',\n  },\n  {\n    text: 'Ship polished UIs 10x faster with UIPKGE 2.0 ⚡',\n    score: 92,\n    tag: 'Strong Action Verb',\n  },\n  {\n    text: 'Zero npm dependencies: How UIPKGE 2.0 changes frontend dev',\n    score: 89,\n    tag: 'Curiosity Spike',\n  },\n]\n\nexport function EmailCampaignComposer({ className }: EmailCampaignComposerProps) {\n  // Campaign state\n  const [campaignName] = React.useState('Product Launch: UIPKGE 2.0 Global Release')\n  const [selectedAudience, setSelectedAudience] = React.useState('active-devs')\n\n  // Subject line & Preheader state\n  const [subjectA, setSubjectA] = React.useState('🚀 Introducing UIPKGE 2.0: The unbundled UI registry')\n  const [subjectB, setSubjectB] = React.useState('Ship polished UIs 10x faster with UIPKGE 2.0 ⚡')\n  const [previewText, setPreviewText] = React.useState(\n    '370+ production components with zero npm dependencies. Native Vue 3 & React code.',\n  )\n  const senderName = 'UIPKGE Team'\n  const senderEmail = 'updates@uipkge.dev'\n\n  // A/B testing state\n  const [isAbTestEnabled, setIsAbTestEnabled] = React.useState(false)\n  const [activePreviewVariant, setActivePreviewVariant] = React.useState<'A' | 'B'>('A')\n\n  // Viewport state\n  const [viewport, setViewport] = React.useState<ViewportMode>('desktop')\n\n  // Test Proof Dialog state\n  const [isTestModalOpen, setIsTestModalOpen] = React.useState(false)\n  const [testTargetEmail, setTestTargetEmail] = React.useState('alex.developer@company.com')\n  const [selectedClient, setSelectedClient] = React.useState<ClientOption>('all')\n  const [isSendingTest, setIsSendingTest] = React.useState(false)\n  const [testSentSuccess, setTestSentSuccess] = React.useState(false)\n\n  // Schedule Broadcast Dialog state\n  const [isScheduleModalOpen, setIsScheduleModalOpen] = React.useState(false)\n  const [scheduleTiming, setScheduleTiming] = React.useState<ScheduleTiming>('optimal')\n  const [isScheduling, setIsScheduling] = React.useState(false)\n  const [scheduleSuccess, setScheduleSuccess] = React.useState(false)\n\n  const currentAudience = React.useMemo(() => {\n    return audienceOptions.find((item) => item.id === selectedAudience) ?? audienceOptions[0]\n  }, [selectedAudience])\n\n  const currentActiveSubject = React.useMemo(() => {\n    if (isAbTestEnabled && activePreviewVariant === 'B') {\n      return subjectB\n    }\n    return subjectA\n  }, [isAbTestEnabled, activePreviewVariant, subjectA, subjectB])\n\n  const emojiCount = React.useMemo(() => {\n    const matches = currentActiveSubject.match(/\\p{Extended_Pictographic}/gu)\n    return matches ? matches.length : 0\n  }, [currentActiveSubject])\n\n  const applyAiSubject = (text: string) => {\n    if (isAbTestEnabled && activePreviewVariant === 'B') {\n      setSubjectB(text)\n    } else {\n      setSubjectA(text)\n    }\n  }\n\n  const handleSendTest = () => {\n    if (!testTargetEmail) return\n    setIsSendingTest(true)\n    setTestSentSuccess(false)\n\n    setTimeout(() => {\n      setIsSendingTest(false)\n      setTestSentSuccess(true)\n      setTimeout(() => {\n        setTestSentSuccess(false)\n        setIsTestModalOpen(false)\n      }, 1800)\n    }, 800)\n  }\n\n  const handleScheduleBroadcast = () => {\n    setIsScheduling(true)\n    setScheduleSuccess(false)\n\n    setTimeout(() => {\n      setIsScheduling(false)\n      setScheduleSuccess(true)\n      setTimeout(() => {\n        setScheduleSuccess(false)\n        setIsScheduleModalOpen(false)\n      }, 1800)\n    }, 900)\n  }\n\n  return (\n    <div data-slot=\"email-campaign-composer\" className={cn('w-full space-y-6', className)}>\n      {/* Top Header Bar */}\n      <Card className=\"border-border bg-card shadow-xs\">\n        <CardHeader className=\"pb-4\">\n          <div className=\"flex flex-col gap-4 lg:flex-row lg:items-center lg:justify-between\">\n            {/* Campaign Title & Status Badge */}\n            <div className=\"space-y-1.5\">\n              <div className=\"flex flex-wrap items-center gap-2.5\">\n                <div className=\"bg-primary/10 text-primary flex size-8 items-center justify-center rounded-lg shadow-xs\">\n                  <Mail className=\"size-4\" />\n                </div>\n                <h2 className=\"text-foreground text-lg font-semibold tracking-tight sm:text-xl\">{campaignName}</h2>\n                {/* Status Badge: Blue info styled */}\n                <Badge\n                  variant=\"outline\"\n                  className=\"border-info/30 bg-info/10 text-info gap-1.5 px-2.5 py-0.5 text-xs font-medium\"\n                >\n                  <span className=\"bg-info size-1.5 rounded-full\" />\n                  <span>Draft Saved · {currentAudience.formattedCount} Recipients</span>\n                </Badge>\n              </div>\n              <p className=\"text-muted-foreground text-xs\">\n                Configure campaign targeting, optimize open rates with AI scoring, and preview live multi-device inbox\n                rendering.\n              </p>\n            </div>\n\n            {/* Top Actions: Send Test Proof & Schedule Broadcast */}\n            <div className=\"flex flex-wrap items-center gap-2.5\">\n              {/* Send Test Proof Dialog */}\n              <Dialog open={isTestModalOpen} onOpenChange={setIsTestModalOpen}>\n                <DialogTrigger asChild>\n                  <Button variant=\"outline\" size=\"sm\" className=\"gap-1.5 text-xs font-medium\">\n                    <Mail className=\"text-muted-foreground size-3.5\" />\n                    <span>Send Test Proof</span>\n                  </Button>\n                </DialogTrigger>\n                <DialogContent className=\"sm:max-w-md\">\n                  <DialogHeader>\n                    <DialogTitle className=\"flex items-center gap-2 text-base\">\n                      <Mail className=\"text-primary size-4\" />\n                      Dispatch Test Proof\n                    </DialogTitle>\n                    <DialogDescription className=\"text-xs\">\n                      Send a full fidelity rendering test to inspect subject line, preheader, and layout across email\n                      clients.\n                    </DialogDescription>\n                  </DialogHeader>\n\n                  <div className=\"space-y-4 py-2\">\n                    <div className=\"space-y-1.5\">\n                      <label className=\"text-muted-foreground text-xs font-medium\">Proof Recipient Address</label>\n                      <Input\n                        value={testTargetEmail}\n                        onChange={(e) => setTestTargetEmail(e.target.value)}\n                        type=\"email\"\n                        placeholder=\"alex.developer@company.com\"\n                        className=\"text-xs\"\n                        disabled={isSendingTest}\n                      />\n                    </div>\n\n                    <div className=\"space-y-1.5\">\n                      <label className=\"text-muted-foreground text-xs font-medium\">\n                        Email Client Engine Simulation\n                      </label>\n                      <div className=\"grid grid-cols-2 gap-2\">\n                        <Button\n                          type=\"button\"\n                          size=\"xs\"\n                          variant={selectedClient === 'all' ? 'default' : 'outline'}\n                          className=\"justify-start text-xs font-medium\"\n                          onClick={() => setSelectedClient('all')}\n                        >\n                          🌐 All Clients (Auto)\n                        </Button>\n                        <Button\n                          type=\"button\"\n                          size=\"xs\"\n                          variant={selectedClient === 'gmail' ? 'default' : 'outline'}\n                          className=\"justify-start text-xs font-medium\"\n                          onClick={() => setSelectedClient('gmail')}\n                        >\n                          ✉️ Gmail (Web/App)\n                        </Button>\n                        <Button\n                          type=\"button\"\n                          size=\"xs\"\n                          variant={selectedClient === 'apple' ? 'default' : 'outline'}\n                          className=\"justify-start text-xs font-medium\"\n                          onClick={() => setSelectedClient('apple')}\n                        >\n                          🍏 Apple Mail (iOS)\n                        </Button>\n                        <Button\n                          type=\"button\"\n                          size=\"xs\"\n                          variant={selectedClient === 'outlook' ? 'default' : 'outline'}\n                          className=\"justify-start text-xs font-medium\"\n                          onClick={() => setSelectedClient('outlook')}\n                        >\n                          💼 Outlook 365\n                        </Button>\n                      </div>\n                    </div>\n\n                    {testSentSuccess && (\n                      <div className=\"border-success/30 bg-success/10 text-success flex items-center gap-2 rounded-md border p-2.5 text-xs font-medium\">\n                        <CheckCircle2 className=\"size-4 shrink-0\" />\n                        <span>Test proof dispatched to {testTargetEmail}!</span>\n                      </div>\n                    )}\n                  </div>\n\n                  <DialogFooter className=\"gap-2 sm:gap-0\">\n                    <Button\n                      variant=\"outline\"\n                      size=\"sm\"\n                      disabled={isSendingTest}\n                      onClick={() => setIsTestModalOpen(false)}\n                    >\n                      Cancel\n                    </Button>\n                    <Button size=\"sm\" className=\"gap-1.5\" disabled={isSendingTest} onClick={handleSendTest}>\n                      <Send className=\"size-3.5\" />\n                      <span>{isSendingTest ? 'Dispatching...' : 'Send Test Proof'}</span>\n                    </Button>\n                  </DialogFooter>\n                </DialogContent>\n              </Dialog>\n\n              {/* Schedule Broadcast Dialog */}\n              <Dialog open={isScheduleModalOpen} onOpenChange={setIsScheduleModalOpen}>\n                <DialogTrigger asChild>\n                  <Button size=\"sm\" className=\"gap-1.5 text-xs font-medium shadow-xs\">\n                    <Send className=\"size-3.5 fill-current\" />\n                    <span>Schedule Broadcast</span>\n                  </Button>\n                </DialogTrigger>\n                <DialogContent className=\"sm:max-w-md\">\n                  <DialogHeader>\n                    <DialogTitle className=\"flex items-center gap-2 text-base\">\n                      <Calendar className=\"text-primary size-4\" />\n                      Schedule Email Broadcast\n                    </DialogTitle>\n                    <DialogDescription className=\"text-xs\">\n                      Queue this broadcast for {currentAudience.count.toLocaleString()} verified subscribers with\n                      deliverability rate limit guardrails.\n                    </DialogDescription>\n                  </DialogHeader>\n\n                  <div className=\"space-y-4 py-2\">\n                    <div className=\"border-border bg-muted/40 space-y-2 rounded-lg border p-3 text-xs\">\n                      <div className=\"flex flex-wrap items-center justify-between\">\n                        <span className=\"text-muted-foreground\">Audience Target</span>\n                        <span className=\"text-foreground font-medium\">{currentAudience.label}</span>\n                      </div>\n                      <div className=\"flex flex-wrap items-center justify-between\">\n                        <span className=\"text-muted-foreground\">Estimated Reach</span>\n                        <span className=\"text-foreground font-semibold\">\n                          {currentAudience.count.toLocaleString()} recipients\n                        </span>\n                      </div>\n                      <div className=\"flex flex-wrap items-center justify-between\">\n                        <span className=\"text-muted-foreground\">Spam Safety Score</span>\n                        <Badge variant=\"success\" className=\"h-4.5 px-1.5 text-xs font-normal\">\n                          0.2 / 10.0 (Safe)\n                        </Badge>\n                      </div>\n                    </div>\n\n                    <div className=\"space-y-2\">\n                      <label className=\"text-muted-foreground text-xs font-medium\">Broadcast Timing</label>\n                      <div className=\"grid grid-cols-1 gap-2\">\n                        <button\n                          type=\"button\"\n                          className={cn(\n                            'border-border hover:border-primary/50 flex flex-wrap items-center justify-between rounded-lg border p-3 text-left text-xs transition-colors',\n                            scheduleTiming === 'optimal' ? 'border-primary bg-primary/5' : 'bg-card',\n                          )}\n                          onClick={() => setScheduleTiming('optimal')}\n                        >\n                          <div className=\"space-y-0.5\">\n                            <div className=\"text-foreground font-medium\">✨ AI Optimal Send Time (Recommended)</div>\n                            <div className=\"text-muted-foreground text-xs\">\n                              Tuesday, Aug 25 @ 9:00 AM EDT (+18% projected opens)\n                            </div>\n                          </div>\n                          <div\n                            className={cn(\n                              'flex size-4 items-center justify-center rounded-full border',\n                              scheduleTiming === 'optimal'\n                                ? 'border-primary bg-primary text-primary-foreground'\n                                : 'border-border',\n                            )}\n                          >\n                            {scheduleTiming === 'optimal' && <div className=\"size-1.5 rounded-full bg-white\" />}\n                          </div>\n                        </button>\n\n                        <button\n                          type=\"button\"\n                          className={cn(\n                            'border-border hover:border-primary/50 flex flex-wrap items-center justify-between rounded-lg border p-3 text-left text-xs transition-colors',\n                            scheduleTiming === 'immediate' ? 'border-primary bg-primary/5' : 'bg-card',\n                          )}\n                          onClick={() => setScheduleTiming('immediate')}\n                        >\n                          <div className=\"space-y-0.5\">\n                            <div className=\"text-foreground font-medium\">⚡ Send Immediately</div>\n                            <div className=\"text-muted-foreground text-xs\">\n                              Dispatch immediately with warm-up concurrency pacing\n                            </div>\n                          </div>\n                          <div\n                            className={cn(\n                              'flex size-4 items-center justify-center rounded-full border',\n                              scheduleTiming === 'immediate'\n                                ? 'border-primary bg-primary text-primary-foreground'\n                                : 'border-border',\n                            )}\n                          >\n                            {scheduleTiming === 'immediate' && <div className=\"size-1.5 rounded-full bg-white\" />}\n                          </div>\n                        </button>\n                      </div>\n                    </div>\n\n                    {scheduleSuccess && (\n                      <div className=\"border-success/30 bg-success/10 text-success flex items-center gap-2 rounded-md border p-2.5 text-xs font-medium\">\n                        <CheckCircle2 className=\"size-4 shrink-0\" />\n                        <span>Broadcast successfully queued for dispatch!</span>\n                      </div>\n                    )}\n                  </div>\n\n                  <DialogFooter className=\"gap-2 sm:gap-0\">\n                    <Button\n                      variant=\"outline\"\n                      size=\"sm\"\n                      disabled={isScheduling}\n                      onClick={() => setIsScheduleModalOpen(false)}\n                    >\n                      Cancel\n                    </Button>\n                    <Button size=\"sm\" className=\"gap-1.5\" disabled={isScheduling} onClick={handleScheduleBroadcast}>\n                      <Send className=\"size-3.5\" />\n                      <span>{isScheduling ? 'Scheduling...' : 'Confirm & Schedule'}</span>\n                    </Button>\n                  </DialogFooter>\n                </DialogContent>\n              </Dialog>\n            </div>\n          </div>\n        </CardHeader>\n      </Card>\n\n      {/* 2-Column Campaign Studio Grid */}\n      <div className=\"grid grid-cols-1 items-start gap-6 lg:grid-cols-12\">\n        {/* LEFT PANEL: Campaign Setup & Audience (45% -> lg:col-span-5) */}\n        <div className=\"space-y-5 lg:col-span-5\">\n          {/* 1. Audience Segment Selector Card */}\n          <Card className=\"border-border bg-card shadow-xs\">\n            <CardHeader className=\"pb-3\">\n              <div className=\"flex flex-wrap items-center justify-between\">\n                <div className=\"flex items-center gap-2\">\n                  <div className=\"bg-primary/10 text-primary flex size-7 items-center justify-center rounded-md\">\n                    <Users className=\"size-3.5\" />\n                  </div>\n                  <CardTitle className=\"text-sm font-semibold tracking-tight\">Audience Segment</CardTitle>\n                </div>\n                <Badge variant=\"secondary\" className=\"h-5 gap-1 px-2 text-xs font-normal\">\n                  <UserCheck className=\"text-success size-3\" />\n                  Verified List\n                </Badge>\n              </div>\n              <CardDescription className=\"text-xs\">\n                Select subscriber segment to calculate deliverability pacing and personalization tags.\n              </CardDescription>\n            </CardHeader>\n            <CardContent className=\"space-y-3.5 pt-0\">\n              <div className=\"space-y-1.5\">\n                <label className=\"text-foreground text-xs font-medium\">Target Segment</label>\n                <Select value={selectedAudience} onValueChange={setSelectedAudience}>\n                  <SelectTrigger\n                    className=\"h-9 w-full text-xs font-medium [&>span]:truncate [&>svg]:shrink-0\"\n                    aria-label=\"Select Audience Segment\"\n                  >\n                    <SelectValue placeholder=\"Select audience segment\" />\n                  </SelectTrigger>\n                  <SelectContent>\n                    {audienceOptions.map((aud) => (\n                      <SelectItem key={aud.id} value={aud.id}>\n                        <span>{aud.label}</span>\n                      </SelectItem>\n                    ))}\n                  </SelectContent>\n                </Select>\n              </div>\n\n              {/* Audience Telemetry Badges Grid */}\n              <div className=\"grid grid-cols-3 gap-2 pt-1\">\n                <div className=\"border-border bg-muted/40 rounded-lg border p-2.5 text-center\">\n                  <div className=\"text-muted-foreground text-xs font-medium\">Recipients</div>\n                  <div className=\"text-foreground mt-0.5 text-sm font-bold tracking-tight\">\n                    {currentAudience.formattedCount}\n                  </div>\n                </div>\n                <div className=\"border-border bg-muted/40 rounded-lg border p-2.5 text-center\">\n                  <div className=\"text-muted-foreground text-xs font-medium\">Avg Open Rate</div>\n                  <div className=\"text-foreground text-success mt-0.5 text-sm font-bold tracking-tight\">\n                    {currentAudience.openRate}\n                  </div>\n                </div>\n                <div className=\"border-border bg-muted/40 rounded-lg border p-2.5 text-center\">\n                  <div className=\"text-muted-foreground text-xs font-medium\">Avg CTR</div>\n                  <div className=\"text-foreground text-info mt-0.5 text-sm font-bold tracking-tight\">\n                    {currentAudience.clickRate}\n                  </div>\n                </div>\n              </div>\n            </CardContent>\n          </Card>\n\n          {/* 2. Subject Line & AI Optimizer Card */}\n          <Card className=\"border-border bg-card shadow-xs\">\n            <CardHeader className=\"pb-3\">\n              <div className=\"flex flex-wrap items-center justify-between\">\n                <div className=\"flex items-center gap-2\">\n                  <div className=\"bg-primary/10 text-primary flex size-7 items-center justify-center rounded-md\">\n                    <Sparkles className=\"size-3.5\" />\n                  </div>\n                  <CardTitle className=\"text-sm font-semibold tracking-tight\">Subject Line & AI Scorer</CardTitle>\n                </div>\n                {/* AI Subject Scorer Green Badge */}\n                <Badge\n                  variant=\"outline\"\n                  className=\"border-success/30 bg-success/10 text-success gap-1 px-2 text-xs font-medium\"\n                >\n                  <Sparkles className=\"text-success size-3\" />\n                  <span>94 / 100 · High Open Rate Impact</span>\n                </Badge>\n              </div>\n              <CardDescription className=\"text-xs\">\n                AI predictive heuristic analyzing urgency, sentiment, character count, and spam filter risk.\n              </CardDescription>\n            </CardHeader>\n\n            <CardContent className=\"space-y-4 pt-0\">\n              {/* A/B Subject Variant Switcher */}\n              <div className=\"border-border bg-muted/30 flex flex-wrap items-center justify-between rounded-lg border p-3\">\n                <div className=\"space-y-0.5\">\n                  <div className=\"text-foreground flex items-center gap-1.5 text-xs font-medium\">\n                    <Split className=\"text-primary size-3.5\" />\n                    <span>A/B Subject Variant Testing</span>\n                  </div>\n                  <p className=\"text-muted-foreground text-xs\">Test 2 subject lines with 50/50 subscriber split</p>\n                </div>\n                <Switch\n                  id=\"react-ab-toggle\"\n                  checked={isAbTestEnabled}\n                  onCheckedChange={(val) => setIsAbTestEnabled(val)}\n                />\n              </div>\n\n              {/* Subject Input Variant A */}\n              <div className=\"space-y-1.5\">\n                <div className=\"flex flex-wrap items-center justify-between text-xs\">\n                  <label className=\"text-foreground font-medium\">\n                    Subject Line {isAbTestEnabled ? '(Variant A · 50%)' : ''}\n                  </label>\n                  <div className=\"flex items-center gap-1.5\">\n                    <span className=\"text-muted-foreground font-mono text-xs\">{subjectA.length}/60 chars</span>\n                    <Badge variant=\"outline\" className=\"text-muted-foreground h-4.5 gap-1 px-1.5 text-xs font-normal\">\n                      <Flame className=\"text-warning size-2.5\" />\n                      <span>{emojiCount} emoji</span>\n                    </Badge>\n                  </div>\n                </div>\n                <Input\n                  value={subjectA}\n                  onChange={(e) => setSubjectA(e.target.value)}\n                  className=\"text-xs\"\n                  placeholder=\"Enter campaign subject line...\"\n                />\n              </div>\n\n              {/* Subject Input Variant B (Visible if A/B Enabled) */}\n              {isAbTestEnabled && (\n                <div className=\"space-y-1.5\">\n                  <div className=\"flex flex-wrap items-center justify-between text-xs\">\n                    <label className=\"text-foreground font-medium\">Subject Line (Variant B · 50%)</label>\n                    <span className=\"text-muted-foreground font-mono text-xs\">{subjectB.length}/60 chars</span>\n                  </div>\n                  <Input\n                    value={subjectB}\n                    onChange={(e) => setSubjectB(e.target.value)}\n                    className=\"text-xs\"\n                    placeholder=\"Enter alternate subject line B...\"\n                  />\n                  <div className=\"flex items-center gap-1 pt-1\">\n                    <Button\n                      type=\"button\"\n                      size=\"xs\"\n                      variant={activePreviewVariant === 'A' ? 'default' : 'outline'}\n                      className=\"text-xs font-medium\"\n                      onClick={() => setActivePreviewVariant('A')}\n                    >\n                      Preview Variant A\n                    </Button>\n                    <Button\n                      type=\"button\"\n                      size=\"xs\"\n                      variant={activePreviewVariant === 'B' ? 'default' : 'outline'}\n                      className=\"text-xs font-medium\"\n                      onClick={() => setActivePreviewVariant('B')}\n                    >\n                      Preview Variant B\n                    </Button>\n                  </div>\n                </div>\n              )}\n\n              {/* AI Subject Score Breakdown Metrics */}\n              <div className=\"border-border bg-muted/20 space-y-2 rounded-lg border p-3 text-xs\">\n                <div className=\"flex flex-wrap items-center justify-between\">\n                  <span className=\"text-muted-foreground flex items-center gap-1.5\">\n                    <Check className=\"text-success size-3\" />\n                    Sentiment Tone\n                  </span>\n                  <span className=\"text-foreground font-medium\">Positive (98%)</span>\n                </div>\n                <div className=\"flex flex-wrap items-center justify-between\">\n                  <span className=\"text-muted-foreground flex items-center gap-1.5\">\n                    <Check className=\"text-success size-3\" />\n                    Urgency & Relevance\n                  </span>\n                  <span className=\"text-foreground font-medium\">High (91%)</span>\n                </div>\n                <div className=\"flex flex-wrap items-center justify-between\">\n                  <span className=\"text-muted-foreground flex items-center gap-1.5\">\n                    <Check className=\"text-success size-3\" />\n                    Spam Keyword Risk\n                  </span>\n                  <span className=\"text-foreground text-success font-medium\">Very Low (0.1%)</span>\n                </div>\n              </div>\n\n              {/* 1-Click AI Subject Line Suggestions */}\n              <div className=\"space-y-2\">\n                <span className=\"text-muted-foreground flex items-center gap-1 text-xs font-medium\">\n                  <Sparkles className=\"text-primary size-3\" />\n                  AI Optimization Suggestions (Click to apply):\n                </span>\n                <div className=\"space-y-1.5\">\n                  {aiSuggestions.map((suggestion, idx) => (\n                    <button\n                      key={idx}\n                      type=\"button\"\n                      className=\"border-border hover:border-primary/40 hover:bg-muted/50 flex w-full items-center justify-between rounded-md border p-2 text-left text-xs transition-colors\"\n                      onClick={() => applyAiSubject(suggestion.text)}\n                    >\n                      <span className=\"text-foreground truncate font-medium\">{suggestion.text}</span>\n                      <Badge variant=\"secondary\" className=\"text-success ml-2 shrink-0 font-mono text-xs\">\n                        {suggestion.score}/100\n                      </Badge>\n                    </button>\n                  ))}\n                </div>\n              </div>\n\n              <Separator />\n\n              {/* 3. Preview Text / Preheader */}\n              <div className=\"space-y-1.5\">\n                <div className=\"flex flex-wrap items-center justify-between text-xs\">\n                  <label className=\"text-foreground font-medium\">Preview Text / Preheader</label>\n                  <span className=\"text-muted-foreground font-mono text-xs\">{previewText.length}/90 chars</span>\n                </div>\n                <Input\n                  value={previewText}\n                  onChange={(e) => setPreviewText(e.target.value)}\n                  className=\"text-xs\"\n                  placeholder=\"Secondary snippet displayed in subscriber inbox lists...\"\n                />\n              </div>\n\n              <Separator />\n\n              {/* 4. Sender Identity */}\n              <div className=\"space-y-3\">\n                <label className=\"text-foreground text-xs font-medium\">Sender Identity</label>\n                <div className=\"grid grid-cols-1 gap-2.5 sm:grid-cols-2\">\n                  <div className=\"space-y-1\">\n                    <span className=\"text-muted-foreground text-xs\">Sender Display Name</span>\n                    <Input defaultValue={senderName} className=\"text-xs\" placeholder=\"UIPKGE Team\" />\n                  </div>\n                  <div className=\"space-y-1\">\n                    <span className=\"text-muted-foreground text-xs\">From Address</span>\n                    <Input defaultValue={senderEmail} className=\"text-xs\" placeholder=\"updates@uipkge.dev\" />\n                  </div>\n                </div>\n                <div className=\"border-success/20 bg-success/5 text-success flex flex-wrap items-center justify-between rounded-md border px-2.5 py-1.5 text-xs\">\n                  <div className=\"flex items-center gap-1.5\">\n                    <ShieldCheck className=\"size-3.5 shrink-0\" />\n                    <span>\n                      Domain verified: <strong>mail.uipkge.dev</strong> (SPF & DKIM valid)\n                    </span>\n                  </div>\n                  <Badge variant=\"outline\" className=\"border-success/30 text-success h-4.5 px-1.5 text-xs\">\n                    TLS 1.3\n                  </Badge>\n                </div>\n              </div>\n            </CardContent>\n          </Card>\n        </div>\n\n        {/* RIGHT PANEL: Live Multi-Device Email Preview (55% -> lg:col-span-7) */}\n        <div className=\"space-y-5 lg:col-span-7\">\n          {/* Live Email Canvas Container Card */}\n          <Card className=\"border-border bg-card overflow-hidden shadow-xs\">\n            <CardHeader className=\"border-border bg-muted/20 border-b pb-3\">\n              <div className=\"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between\">\n                <div className=\"flex items-center gap-2\">\n                  <Eye className=\"text-primary size-4\" />\n                  <CardTitle className=\"text-sm font-semibold tracking-tight\">Live Newsletter Preview</CardTitle>\n                  {isAbTestEnabled && (\n                    <Badge variant=\"secondary\" className=\"text-xs font-normal\">\n                      Showing Variant {activePreviewVariant}\n                    </Badge>\n                  )}\n                </div>\n\n                {/* Device Viewport Toggle (Desktop 600px vs Mobile 375px) */}\n                <div className=\"bg-muted border-border inline-flex items-center rounded-lg border p-1 shadow-xs\">\n                  <Button\n                    type=\"button\"\n                    size=\"xs\"\n                    variant={viewport === 'desktop' ? 'default' : 'ghost'}\n                    className=\"gap-1.5 text-xs font-medium\"\n                    onClick={() => setViewport('desktop')}\n                  >\n                    <Monitor className=\"size-3.5\" />\n                    <span>Desktop 600px</span>\n                  </Button>\n                  <Button\n                    type=\"button\"\n                    size=\"xs\"\n                    variant={viewport === 'mobile' ? 'default' : 'ghost'}\n                    className=\"gap-1.5 text-xs font-medium\"\n                    onClick={() => setViewport('mobile')}\n                  >\n                    <Smartphone className=\"size-3.5\" />\n                    <span>Mobile 375px</span>\n                  </Button>\n                </div>\n              </div>\n            </CardHeader>\n\n            {/* Rendered Newsletter Preview Canvas */}\n            <CardContent className=\"bg-muted/30 flex min-h-[580px] flex-col items-center justify-start p-4 sm:p-6\">\n              <div\n                className={cn(\n                  'w-full transition-[max-width] duration-300 ease-in-out',\n                  viewport === 'desktop' ? 'max-w-[580px]' : 'max-w-[360px]',\n                )}\n              >\n                {/* Window Chrome Bar Frame */}\n                <div className=\"border-border bg-card overflow-hidden rounded-xl border shadow-sm\">\n                  {/* Top Chrome Bar */}\n                  <div className=\"border-border bg-muted/60 flex flex-wrap items-center justify-between border-b px-4 py-2.5\">\n                    <div className=\"flex items-center gap-1.5\">\n                      <div className=\"bg-destructive/80 size-2.5 rounded-full\" />\n                      <div className=\"bg-warning/80 size-2.5 rounded-full\" />\n                      <div className=\"bg-success/80 size-2.5 rounded-full\" />\n                    </div>\n                    <div className=\"text-muted-foreground flex items-center gap-1.5 font-mono text-xs\">\n                      <Inbox className=\"size-3\" />\n                      <span>UIPKGE Preview · {viewport === 'desktop' ? '600px' : '375px'}</span>\n                    </div>\n                    <Badge\n                      variant=\"outline\"\n                      className=\"border-border text-muted-foreground h-4.5 gap-1 px-1.5 text-xs font-normal\"\n                    >\n                      <Lock className=\"text-success size-2.5\" />\n                      TLS 1.3\n                    </Badge>\n                  </div>\n\n                  {/* Envelope Metadata Readout */}\n                  <div className=\"border-border bg-card/70 space-y-2 border-b p-4 text-xs\">\n                    <div className=\"flex flex-wrap items-center justify-between\">\n                      <div className=\"flex items-center gap-2\">\n                        <div className=\"bg-primary text-primary-foreground flex size-7 items-center justify-center rounded-full font-bold\">\n                          U\n                        </div>\n                        <div>\n                          <div className=\"flex items-center gap-1.5\">\n                            <span className=\"text-foreground font-semibold\">{senderName}</span>\n                            <span className=\"text-muted-foreground\">&lt;{senderEmail}&gt;</span>\n                          </div>\n                          <div className=\"text-muted-foreground text-xs\">To: alex.developer@enterprise.com</div>\n                        </div>\n                      </div>\n                      <span className=\"text-muted-foreground text-xs\">Aug 21, 2026</span>\n                    </div>\n\n                    <div className=\"space-y-0.5 pt-1\">\n                      <div className=\"text-foreground text-sm font-semibold tracking-tight\">{currentActiveSubject}</div>\n                      <div className=\"text-muted-foreground line-clamp-1 text-xs\">{previewText}</div>\n                    </div>\n                  </div>\n\n                  {/* High-Fidelity Rendered Email Newsletter Body */}\n                  <div className=\"bg-card space-y-5 p-5 sm:p-7\">\n                    {/* Logo Banner */}\n                    <div className=\"border-border flex flex-wrap items-center justify-between border-b pb-3.5\">\n                      <div className=\"flex items-center gap-2\">\n                        <div className=\"bg-primary text-primary-foreground flex size-6 items-center justify-center rounded-md\">\n                          <Zap className=\"size-3.5 fill-current\" />\n                        </div>\n                        <span className=\"text-foreground text-sm font-bold tracking-tight\">UIPKGE</span>\n                      </div>\n                      <Badge variant=\"secondary\" className=\"text-xs font-medium\">\n                        Changelog #24 · Release 2.0\n                      </Badge>\n                    </div>\n\n                    {/* Hero Headline & Description */}\n                    <div className=\"space-y-2.5\">\n                      <Badge\n                        variant=\"outline\"\n                        className=\"text-primary border-primary/30 text-xs font-semibold tracking-wider uppercase\"\n                      >\n                        Major Product Release\n                      </Badge>\n                      <h3 className=\"text-foreground text-xl leading-tight font-bold tracking-tight sm:text-2xl\">\n                        Ship polished UIs in minutes\n                      </h3>\n                      <p className=\"text-muted-foreground text-xs leading-relaxed sm:text-sm\">\n                        We completely rebuilt the registry engine. 370+ production components with zero npm\n                        dependencies, 100% code ownership, and full native support for Vue 3 and React with modern OKLCH\n                        tokens.\n                      </p>\n                    </div>\n\n                    {/* Product Visual with Code Snippet & Callout Pills */}\n                    <div className=\"border-border bg-muted/40 overflow-hidden rounded-lg border\">\n                      <div className=\"border-border bg-muted/60 flex flex-wrap items-center justify-between border-b px-3.5 py-2\">\n                        <div className=\"text-muted-foreground flex items-center gap-1.5 font-mono text-xs\">\n                          <Terminal className=\"text-primary size-3\" />\n                          <span>components/ui/button.tsx</span>\n                        </div>\n                        <span className=\"text-success font-mono text-xs font-medium\">TypeScript</span>\n                      </div>\n                      <div className=\"space-y-3 p-3.5\">\n                        <div className=\"border-border bg-background text-muted-foreground rounded-md border p-2.5 font-mono text-xs\">\n                          <span className=\"text-primary font-semibold\">$</span> npx shadcn add @uipkge/button\n                        </div>\n\n                        {/* Mini Interactive UI Demo inside Email */}\n                        <div className=\"bg-card border-border flex flex-wrap items-center justify-center gap-2 rounded-md border p-3\">\n                          <Button size=\"xs\" variant=\"default\">\n                            Primary\n                          </Button>\n                          <Button size=\"xs\" variant=\"secondary\">\n                            Secondary\n                          </Button>\n                          <Button size=\"xs\" variant=\"outline\">\n                            Outline\n                          </Button>\n                          <Button size=\"xs\" variant=\"destructive\">\n                            Destructive\n                          </Button>\n                        </div>\n\n                        {/* 3 Callout Pills */}\n                        <div className=\"flex flex-wrap items-center justify-center gap-1.5 pt-1\">\n                          <Badge variant=\"secondary\" className=\"text-xs font-normal\">\n                            ⚡ Zero npm dependencies\n                          </Badge>\n                          <Badge variant=\"secondary\" className=\"text-xs font-normal\">\n                            🎨 OKLCH Dark Mode\n                          </Badge>\n                          <Badge variant=\"secondary\" className=\"text-xs font-normal\">\n                            🧩 Vue 3 + React Parity\n                          </Badge>\n                        </div>\n                      </div>\n                    </div>\n\n                    {/* Primary CTA Button */}\n                    <div className=\"flex flex-col items-center justify-center space-y-2 pt-1 text-center\">\n                      <Button size=\"lg\" className=\"w-full px-8 font-semibold shadow-xs sm:w-auto\">\n                        <span>Explore Components</span>\n                        <ArrowRight className=\"ml-1 size-4\" />\n                      </Button>\n                      <p className=\"text-muted-foreground text-xs\">\n                        Free & Open Source · MIT License · 370+ Primitives & Blocks\n                      </p>\n                    </div>\n\n                    <Separator />\n\n                    {/* Unsubscribe & Footer Details */}\n                    <div className=\"text-muted-foreground space-y-2.5 pt-1 text-center text-xs\">\n                      <div className=\"flex flex-wrap items-center justify-center gap-3 font-medium\">\n                        <span className=\"hover:text-foreground cursor-pointer transition-colors\">Documentation</span>\n                        <span>·</span>\n                        <span className=\"hover:text-foreground cursor-pointer transition-colors\">GitHub</span>\n                        <span>·</span>\n                        <span className=\"hover:text-foreground cursor-pointer transition-colors\">Discord</span>\n                        <span>·</span>\n                        <span className=\"hover:text-foreground cursor-pointer transition-colors\">Preferences</span>\n                      </div>\n                      <p className=\"text-xs\">UIPKGE Inc. · 548 Market St, Suite 29314, San Francisco, CA 94104</p>\n                      <p className=\"text-xs\">\n                        You received this email because you subscribed to UIPKGE updates.\n                        <span className=\"hover:text-foreground cursor-pointer underline\">\n                          {' '}\n                          Unsubscribe anytime (RFC 8058)\n                        </span>\n                        .\n                      </p>\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </CardContent>\n          </Card>\n\n          {/* Deliverability & Inbox Placement Card */}\n          <Card className=\"border-border bg-card shadow-xs\">\n            <CardHeader className=\"pb-3\">\n              <div className=\"flex flex-wrap items-center justify-between\">\n                <div className=\"flex items-center gap-2\">\n                  <div className=\"bg-success/10 text-success flex size-7 items-center justify-center rounded-md\">\n                    <ShieldCheck className=\"size-4\" />\n                  </div>\n                  <CardTitle className=\"text-sm font-semibold tracking-tight\">\n                    Deliverability & Inbox Placement Scorecard\n                  </CardTitle>\n                </div>\n                <Badge variant=\"outline\" className=\"border-success/30 text-success h-5 px-2 text-xs\">\n                  99.8% Inbox Probability\n                </Badge>\n              </div>\n              <CardDescription className=\"text-xs\">\n                Heuristic spam risk evaluation, DNS authentication compliance, and subscriber engagement telemetry.\n              </CardDescription>\n            </CardHeader>\n\n            <CardContent className=\"space-y-4 pt-0\">\n              {/* 3 Core Scorecard Metrics */}\n              <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-3\">\n                {/* Metric 1: Spam Score */}\n                <div className=\"border-border bg-muted/30 rounded-lg border p-3\">\n                  <div className=\"flex flex-wrap items-center justify-between text-xs\">\n                    <span className=\"text-muted-foreground\">Spam Score</span>\n                    <Badge variant=\"success\" className=\"h-4.5 px-1 text-xs\">\n                      Optimal\n                    </Badge>\n                  </div>\n                  <div className=\"mt-1 flex items-baseline gap-1\">\n                    <span className=\"text-success text-xl font-bold tracking-tight\">0.2</span>\n                    <span className=\"text-muted-foreground text-xs\">/ 10.0</span>\n                  </div>\n                  <div className=\"bg-muted mt-2 h-1.5 w-full overflow-hidden rounded-full\">\n                    <div className=\"bg-success h-full w-[98%] rounded-full\" />\n                  </div>\n                </div>\n\n                {/* Metric 2: Domain Auth */}\n                <div className=\"border-border bg-muted/30 rounded-lg border p-3\">\n                  <div className=\"flex flex-wrap items-center justify-between text-xs\">\n                    <span className=\"text-muted-foreground\">Auth Headers</span>\n                    <Badge variant=\"success\" className=\"h-4.5 px-1 text-xs\">\n                      100% Pass\n                    </Badge>\n                  </div>\n                  <div className=\"mt-1 space-y-0.5 text-xs\">\n                    <div className=\"flex justify-between\">\n                      <span className=\"text-muted-foreground\">SPF / DKIM</span>\n                      <span className=\"text-foreground font-medium\">Valid (2048-bit)</span>\n                    </div>\n                    <div className=\"flex justify-between\">\n                      <span className=\"text-muted-foreground\">DMARC</span>\n                      <span className=\"text-foreground font-medium\">p=reject</span>\n                    </div>\n                  </div>\n                </div>\n\n                {/* Metric 3: Reading Time */}\n                <div className=\"border-border bg-muted/30 rounded-lg border p-3\">\n                  <div className=\"flex flex-wrap items-center justify-between text-xs\">\n                    <span className=\"text-muted-foreground\">Reading Time</span>\n                    <span className=\"text-foreground font-mono font-medium\">185 words</span>\n                  </div>\n                  <div className=\"mt-1 flex items-baseline gap-1\">\n                    <span className=\"text-foreground text-xl font-bold tracking-tight\">45</span>\n                    <span className=\"text-muted-foreground text-xs\">seconds</span>\n                  </div>\n                  <div className=\"text-muted-foreground mt-1 text-xs\">Payload size: 14.2 KB (Safe)</div>\n                </div>\n              </div>\n\n              {/* Detailed Checklist Row */}\n              <div className=\"grid grid-cols-1 gap-2 text-xs sm:grid-cols-2\">\n                <div className=\"border-border/80 bg-muted/20 flex flex-wrap items-center justify-between rounded-md border px-3 py-2\">\n                  <span className=\"text-muted-foreground flex items-center gap-1.5\">\n                    <Check className=\"text-success size-3.5\" />\n                    Primary Tab Placement\n                  </span>\n                  <span className=\"text-foreground font-medium\">99.8% (Gmail / Apple)</span>\n                </div>\n                <div className=\"border-border/80 bg-muted/20 flex flex-wrap items-center justify-between rounded-md border px-3 py-2\">\n                  <span className=\"text-muted-foreground flex items-center gap-1.5\">\n                    <Check className=\"text-success size-3.5\" />\n                    RFC 8058 One-Click\n                  </span>\n                  <span className=\"text-foreground font-medium\">Compliant</span>\n                </div>\n                <div className=\"border-border/80 bg-muted/20 flex flex-wrap items-center justify-between rounded-md border px-3 py-2\">\n                  <span className=\"text-muted-foreground flex items-center gap-1.5\">\n                    <Check className=\"text-success size-3.5\" />\n                    Dark Mode Contrast\n                  </span>\n                  <span className=\"text-foreground font-medium\">100% WCAG AAA</span>\n                </div>\n                <div className=\"border-border/80 bg-muted/20 flex flex-wrap items-center justify-between rounded-md border px-3 py-2\">\n                  <span className=\"text-muted-foreground flex items-center gap-1.5\">\n                    <Check className=\"text-success size-3.5\" />\n                    HTTPS Asset Links\n                  </span>\n                  <span className=\"text-foreground font-medium\">6 Valid Links</span>\n                </div>\n              </div>\n            </CardContent>\n          </Card>\n        </div>\n      </div>\n    </div>\n  )\n}\n\nexport default EmailCampaignComposer\n",
      "type": "registry:block",
      "target": "~/components/blocks/EmailCampaignComposer.tsx"
    }
  ],
  "dependencies": [
    "lucide-react"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "https://uipkge.dev/r/react/badge.json",
    "https://uipkge.dev/r/react/button.json",
    "https://uipkge.dev/r/react/card.json",
    "https://uipkge.dev/r/react/dialog.json",
    "https://uipkge.dev/r/react/input.json",
    "https://uipkge.dev/r/react/select.json",
    "https://uipkge.dev/r/react/separator.json",
    "https://uipkge.dev/r/react/switch.json"
  ],
  "description": "High-craft marketing email broadcast designer, audience segment selector, AI subject line optimizer, A/B testing split, live multi-device newsletter preview, and deliverability scorecard.",
  "categories": [
    "marketing",
    "app",
    "dashboard"
  ]
}