{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "error-state",
  "title": "Error State",
  "description": "A failed-generation state with a preserved prompt and retry.",
  "dependencies": [
    "lucide-react"
  ],
  "files": [
    {
      "path": "components/spectrumui/blocks/ai-assistants/error-state.tsx",
      "content": "'use client';\n\nimport { useState } from 'react';\nimport { AlertTriangle, Loader2, RefreshCw } from 'lucide-react';\nimport { cn } from '@/lib/utils';\n\nexport type ErrorStateVariant = 'Card' | 'Inline';\n\nexport interface ErrorStateProps {\n  title?: string;\n  message?: string;\n  retryLabel?: string;\n  retrying?: boolean;\n  onRetry?: () => void;\n  variant?: ErrorStateVariant;\n  className?: string;\n}\n\nexport function ErrorState({\n  title = 'Generation failed',\n  message = 'The model timed out before finishing. Your prompt is preserved — retrying usually resolves this.',\n  retryLabel = 'Retry',\n  retrying: retryingProp,\n  onRetry,\n  variant = 'Card',\n  className,\n}: ErrorStateProps) {\n  const [retryingState, setRetryingState] = useState(false);\n  const retrying = retryingProp !== undefined ? retryingProp : retryingState;\n\n  function retry() {\n    setRetryingState(true);\n    setTimeout(() => setRetryingState(false), 1600);\n    onRetry?.();\n  }\n\n  if (variant === 'Inline') {\n    return (\n      <div\n        role=\"alert\"\n        className={cn(\n          'flex w-fit items-center gap-2.5 rounded-full border border-red-500/20 bg-red-500/[0.06] py-1.5 pl-3 pr-1.5 text-[12.5px] text-red-700 dark:text-red-400',\n          className,\n        )}\n      >\n        <AlertTriangle className=\"size-3.5 shrink-0\" />\n        <span>{title}</span>\n        <button\n          type=\"button\"\n          onClick={retry}\n          disabled={retrying}\n          className=\"flex items-center gap-1 rounded-full bg-white px-2 py-0.5 text-[11.5px] font-medium text-neutral-800 shadow-xs transition-transform duration-150 active:scale-[0.95] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-red-400 dark:bg-neutral-900 dark:text-neutral-200\"\n        >\n          {retrying ? (\n            <Loader2 className=\"size-3 animate-spin [animation-duration:800ms]\" />\n          ) : (\n            <RefreshCw className=\"size-3\" />\n          )}\n          {retryLabel}\n        </button>\n      </div>\n    );\n  }\n\n  return (\n    <div\n      role=\"alert\"\n      className={cn(\n        'w-full max-w-[420px] rounded-2xl border border-black/[0.08] bg-white p-4 shadow-xs dark:border-white/[0.09] dark:bg-[#0B0B0D]',\n        className,\n      )}\n    >\n      <div className=\"flex items-start gap-3\">\n        <span className=\"grid size-8 shrink-0 place-items-center rounded-full bg-red-500/10 text-red-600 dark:text-red-400\">\n          <AlertTriangle className=\"size-4\" />\n        </span>\n        <div className=\"min-w-0\">\n          <h3 className=\"text-[13.5px] font-semibold tracking-[-0.1px] text-neutral-900 dark:text-neutral-50\">\n            {title}\n          </h3>\n          <p className=\"mt-1 text-[12.5px] leading-[1.6] text-neutral-500 dark:text-neutral-400\">\n            {message}\n          </p>\n        </div>\n      </div>\n\n      <div className=\"mt-3.5 flex justify-end\">\n        <button\n          type=\"button\"\n          onClick={retry}\n          disabled={retrying}\n          className=\"flex items-center gap-1.5 rounded-lg bg-neutral-900 px-3 py-1.5 text-[12.5px] font-medium text-white transition-[transform,opacity] duration-[160ms] ease-[cubic-bezier(0.23,1,0.32,1)] active:scale-[0.97] disabled:opacity-60 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-neutral-400 focus-visible:ring-offset-2 dark:bg-neutral-100 dark:text-neutral-900\"\n        >\n          {retrying ? (\n            <Loader2 className=\"size-3.5 animate-spin [animation-duration:800ms]\" />\n          ) : (\n            <RefreshCw className=\"size-3.5\" />\n          )}\n          {retrying ? 'Retrying…' : retryLabel}\n        </button>\n      </div>\n    </div>\n  );\n}\n\nexport default ErrorState;\n",
      "type": "registry:block",
      "target": "components/spectrumui/blocks/ai-assistants/error-state.tsx"
    }
  ],
  "type": "registry:block"
}
