{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "episode-detail",
  "title": "Episode Detail",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-native/blocks/episode-detail/EpisodeDetail.tsx",
      "content": "import type { ReactNode } from 'react'\nimport { View, type ViewProps } from 'react-native'\nimport { Pause, Play, RotateCcw } from 'lucide-react-native'\nimport { Button } from '@/components/ui/button'\nimport { Icon } from '@/components/ui/icon'\nimport { Progress } from '@/components/ui/progress'\nimport { Text } from '@/components/ui/text'\nimport { cn } from '@/lib/utils'\n\nexport interface EpisodePlayback {\n  status: 'ready' | 'playing' | 'loading' | 'error'\n  /** The caller-owned playback position and duration in seconds. */\n  position?: number\n  duration?: number\n  errorMessage?: string\n}\n\nconst defaultLabels = {\n  about: 'About this episode',\n  play: 'Play episode',\n  playAgain: 'Play again',\n  resume: (time: string) => `Resume at ${time}`,\n  pause: 'Pause episode',\n  loading: 'Loading episode…',\n  error: 'This episode could not be played.',\n  retry: 'Retry playback',\n  progress: 'Playback progress',\n  elapsed: (position: string, duration: string) => `${position} of ${duration}`,\n}\n\nexport interface EpisodeDetailProps extends ViewProps {\n  className?: string\n  title: string\n  show?: string\n  /** A localized date, episode number, or runtime. */\n  metadata?: string\n  summary?: string\n  /** A caller-provided player, cover, or other episode media. */\n  media?: ReactNode\n  playback?: EpisodePlayback\n  /** Starts or resumes from the given time in seconds. */\n  onPlay?: (position: number) => void\n  onPause?: () => void\n  onRetry?: () => void\n  labels?: Partial<typeof defaultLabels>\n}\n\nfunction timestamp(seconds: number) {\n  const minutes = Math.floor(seconds / 60)\n  const tail = String(Math.floor(seconds % 60)).padStart(2, '0')\n  return `${minutes}:${tail}`\n}\n\nexport function EpisodeDetail({\n  title,\n  show,\n  metadata,\n  summary,\n  media,\n  playback,\n  onPlay,\n  onPause,\n  onRetry,\n  labels,\n  children,\n  className,\n  ...props\n}: EpisodeDetailProps) {\n  const copy = { ...defaultLabels, ...labels }\n  const rawDuration = playback?.duration ?? 0\n  const duration = Number.isFinite(rawDuration) && rawDuration > 0 ? rawDuration : undefined\n  const rawPosition = playback?.position ?? 0\n  const position = Number.isFinite(rawPosition) ? Math.max(0, Math.min(rawPosition, duration ?? rawPosition)) : 0\n  const ended = duration !== undefined && position >= duration\n  const loading = playback?.status === 'loading'\n  const failed = playback?.status === 'error'\n\n  let actionLabel = ended ? copy.playAgain : position > 0 ? copy.resume(timestamp(position)) : copy.play\n  let action = onPlay ? () => onPlay(ended ? 0 : position) : undefined\n  let icon = ended ? RotateCcw : Play\n  if (loading) actionLabel = copy.loading\n  if (playback?.status === 'playing') {\n    actionLabel = copy.pause\n    action = onPause\n    icon = Pause\n  }\n  if (failed) {\n    actionLabel = copy.retry\n    action = onRetry\n    icon = RotateCcw\n  }\n\n  return (\n    <View {...props} className={cn('gap-[20px]', className)}>\n      <View className=\"gap-[4px]\">\n        {show ? (\n          <Text size=\"sm\" variant=\"muted\">\n            {show}\n          </Text>\n        ) : null}\n        <Text size=\"title\">{title}</Text>\n        {metadata ? (\n          <Text size=\"sm\" variant=\"muted\">\n            {metadata}\n          </Text>\n        ) : null}\n      </View>\n\n      {media}\n\n      {duration !== undefined || failed || action ? (\n        <View className=\"gap-[8px]\">\n          {duration !== undefined && !failed ? (\n            <>\n              <Progress\n                value={position}\n                max={duration}\n                accessibilityLabel={copy.progress}\n                accessibilityValue={{\n                  min: 0,\n                  max: Math.ceil(duration),\n                  now: Math.floor(position),\n                  text: copy.elapsed(timestamp(position), timestamp(duration)),\n                }}\n              />\n              <View className=\"flex-row flex-wrap justify-between gap-[8px]\" aria-hidden>\n                <Text size=\"xs\" variant=\"muted\" style={{ fontVariant: ['tabular-nums'] }}>\n                  {timestamp(position)}\n                </Text>\n                <Text size=\"xs\" variant=\"muted\" style={{ fontVariant: ['tabular-nums'] }}>\n                  {timestamp(duration)}\n                </Text>\n              </View>\n            </>\n          ) : null}\n          {failed ? (\n            <Text size=\"sm\" className=\"text-destructive\" accessibilityRole=\"alert\">\n              {playback.errorMessage ?? copy.error}\n            </Text>\n          ) : null}\n          {action ? (\n            <Button\n              accessibilityLabel={actionLabel}\n              loading={loading}\n              onPress={() => {\n                if (!loading) action()\n              }}\n            >\n              {loading ? null : <Icon icon={icon} size={18} className=\"text-primary-foreground\" />}\n              {actionLabel}\n            </Button>\n          ) : null}\n        </View>\n      ) : null}\n\n      {summary ? (\n        <View className=\"gap-[4px]\">\n          <Text className=\"font-semibold\">{copy.about}</Text>\n          <Text variant=\"muted\">{summary}</Text>\n        </View>\n      ) : null}\n      {children}\n    </View>\n  )\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/episode-detail/EpisodeDetail.tsx"
    },
    {
      "path": "packages/registry-native/blocks/episode-detail/index.ts",
      "content": "export { EpisodeDetail, type EpisodeDetailProps, type EpisodePlayback } from './EpisodeDetail'\n",
      "type": "registry:block",
      "target": "~/components/blocks/episode-detail/index.ts"
    }
  ],
  "dependencies": [
    "lucide-react-native"
  ],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/button.json",
    "https://native.uipkge.dev/r/native/icon.json",
    "https://native.uipkge.dev/r/native/progress.json",
    "https://native.uipkge.dev/r/native/text.json",
    "https://native.uipkge.dev/r/native/utils.json"
  ],
  "description": "Editorial episode details with caller-owned playback, resume, progress, retry, and notes composition.",
  "categories": [
    "media"
  ]
}