{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "model-picker",
  "title": "Model Picker Block",
  "description": "A model picker for an AI chat composer: a searchable menu grouped by provider with Auto, favorites, capability filters, New, Beta and locked Pro models, a detail panel with intelligence and speed meters, context and price, and a thinking effort switch that appears for reasoning models.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/model-picker/model-picker.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport type Capability = \"vision\" | \"tools\" | \"reasoning\" | \"web\";\n\nexport interface AIModel {\n  id: string;\n  name: string;\n  provider: string;\n  description: string;\n  /** Context window in tokens. */\n  context: number;\n  /** 1 to 5. */\n  speed: number;\n  /** 1 to 5. */\n  intelligence: number;\n  /** USD per million tokens. */\n  price: { input: number; output: number };\n  caps: Capability[];\n  badge?: \"New\" | \"Beta\";\n  /** Shown but not selectable, with an upgrade note. */\n  locked?: boolean;\n  cutoff?: string;\n}\n\nexport interface ModelPickerProps {\n  models?: AIModel[];\n  /** Selected model id. \"auto\" picks a model per message. */\n  defaultValue?: string;\n  onChange?: (id: string, effort: Effort) => void;\n  /** Open the menu on first render. */\n  defaultOpen?: boolean;\n  /** Show the Auto option. */\n  auto?: boolean;\n  onUpgrade?: () => void;\n  theme?: \"dark\" | \"light\";\n  className?: string;\n}\n\ntype Effort = \"low\" | \"medium\" | \"high\";\n\nconst PALETTES = {\n  dark: { bg: \"#0A0A0A\", text: \"#F5F4F1\", muted: \"rgba(245,244,241,0.62)\", faint: \"rgba(245,244,241,0.38)\", card: \"#141414\", pop: \"#171717\", border: \"rgba(255,255,255,0.09)\", hover: \"rgba(255,255,255,0.06)\", chip: \"rgba(255,255,255,0.06)\", on: \"#F5F4F1\", onText: \"#0A0A0A\", accent: \"#FB923C\", ring: \"rgba(245,244,241,0.6)\", track: \"rgba(255,255,255,0.1)\", shadow: \"0 24px 60px -12px rgba(0,0,0,0.7)\" },\n  light: { bg: \"#FAFAF8\", text: \"#0A0A0A\", muted: \"rgba(10,10,10,0.62)\", faint: \"rgba(10,10,10,0.42)\", card: \"#FFFFFF\", pop: \"#FFFFFF\", border: \"rgba(10,10,10,0.1)\", hover: \"rgba(10,10,10,0.04)\", chip: \"rgba(10,10,10,0.05)\", on: \"#0A0A0A\", onText: \"#FAFAF8\", accent: \"#EA580C\", ring: \"rgba(10,10,10,0.5)\", track: \"rgba(10,10,10,0.08)\", shadow: \"0 24px 60px -16px rgba(0,0,0,0.18)\" },\n};\nconst GRADIENT = \"linear-gradient(135deg,#FB923C,#EC4899,#8B5CF6,#3B82F6)\";\n\n// Made-up models; replace with your own.\nconst DEFAULT_MODELS: AIModel[] = [\n  { id: \"aurora-3-pro\", name: \"Aurora 3 Pro\", provider: \"Aurora\", description: \"Best overall. Strong at writing, analysis and long documents.\", context: 400_000, speed: 3, intelligence: 5, price: { input: 3, output: 15 }, caps: [\"vision\", \"tools\", \"reasoning\", \"web\"], cutoff: \"Mar 2026\" },\n  { id: \"aurora-3-flash\", name: \"Aurora 3 Flash\", provider: \"Aurora\", description: \"Fast and cheap for everyday chat, summaries and extraction.\", context: 200_000, speed: 5, intelligence: 3, price: { input: 0.3, output: 1.2 }, caps: [\"vision\", \"tools\", \"web\"], cutoff: \"Mar 2026\" },\n  { id: \"cobalt-reasoner\", name: \"Cobalt Reasoner\", provider: \"Cobalt\", description: \"Thinks step by step before answering. Great for math, code and planning.\", context: 256_000, speed: 2, intelligence: 5, price: { input: 5, output: 25 }, caps: [\"tools\", \"reasoning\"], badge: \"New\", cutoff: \"Jun 2026\" },\n  { id: \"cobalt-mini\", name: \"Cobalt Mini\", provider: \"Cobalt\", description: \"Small reasoning model with a good balance of speed and depth.\", context: 128_000, speed: 4, intelligence: 4, price: { input: 0.8, output: 3.2 }, caps: [\"tools\", \"reasoning\"], cutoff: \"Jun 2026\" },\n  { id: \"ember-vision\", name: \"Ember 2 Vision\", provider: \"Ember\", description: \"Reads screenshots, charts and handwriting with high accuracy.\", context: 128_000, speed: 4, intelligence: 4, price: { input: 1, output: 4 }, caps: [\"vision\", \"tools\"], badge: \"Beta\", cutoff: \"Jan 2026\" },\n  { id: \"sage-70b\", name: \"Sage 70B\", provider: \"Open models\", description: \"Open-weight model you can also run on your own servers.\", context: 128_000, speed: 3, intelligence: 4, price: { input: 0.6, output: 0.6 }, caps: [\"tools\"], cutoff: \"Dec 2025\" },\n  { id: \"aurora-3-ultra\", name: \"Aurora 3 Ultra\", provider: \"Aurora\", description: \"Largest model for the hardest research and coding tasks.\", context: 1_000_000, speed: 1, intelligence: 5, price: { input: 15, output: 60 }, caps: [\"vision\", \"tools\", \"reasoning\", \"web\"], locked: true, cutoff: \"Mar 2026\" },\n];\nconst AUTO: AIModel = { id: \"auto\", name: \"Auto\", provider: \"\", description: \"Picks the best model for each message, balancing quality and speed.\", context: 0, speed: 4, intelligence: 4, price: { input: 0, output: 0 }, caps: [\"vision\", \"tools\", \"reasoning\", \"web\"] };\n\nconst CAP_LABEL: Record<Capability, string> = { vision: \"Vision\", tools: \"Tools\", reasoning: \"Reasoning\", web: \"Web search\" };\nconst ctx = (n: number) => (n >= 1_000_000 ? `${n / 1_000_000}M` : `${Math.round(n / 1000)}k`);\n\nfunction capIcon(c: Capability, size = 13) {\n  const common = { width: size, height: size, viewBox: \"0 0 24 24\", fill: \"none\", stroke: \"currentColor\", strokeWidth: 1.8, strokeLinecap: \"round\" as const, strokeLinejoin: \"round\" as const, \"aria-hidden\": true };\n  if (c === \"vision\")\n    return (\n      <svg {...common}>\n        <path d=\"M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12Z\" />\n        <circle cx=\"12\" cy=\"12\" r=\"3\" />\n      </svg>\n    );\n  if (c === \"tools\")\n    return (\n      <svg {...common}>\n        <path d=\"M14.7 6.3a4 4 0 0 0-5.4 5.4L3 18l3 3 6.3-6.3a4 4 0 0 0 5.4-5.4l-2.5 2.5-2.5-.6-.6-2.5 2.6-2.4Z\" />\n      </svg>\n    );\n  if (c === \"reasoning\")\n    return (\n      <svg {...common}>\n        <path d=\"M9 18h6M10 21h4M12 3a6 6 0 0 0-4 10.5c.7.7 1 1.5 1 2.5h6c0-1 .3-1.8 1-2.5A6 6 0 0 0 12 3Z\" />\n      </svg>\n    );\n  return (\n    <svg {...common}>\n      <circle cx=\"12\" cy=\"12\" r=\"9\" />\n      <path d=\"M3 12h18M12 3c2.5 2.7 2.5 15.3 0 18M12 3c-2.5 2.7-2.5 15.3 0 18\" />\n    </svg>\n  );\n}\n\nexport function ModelPicker({ models = DEFAULT_MODELS, defaultValue = \"aurora-3-pro\", onChange, defaultOpen = true, auto = true, onUpgrade, theme = \"dark\", className }: ModelPickerProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const uid = React.useId();\n  const all = auto ? [AUTO, ...models] : models;\n  const [value, setValue] = React.useState(defaultValue);\n  const [open, setOpen] = React.useState(defaultOpen);\n  const [q, setQ] = React.useState(\"\");\n  const [caps, setCaps] = React.useState<Capability[]>([]);\n  const [fav, setFav] = React.useState<string[]>([\"cobalt-reasoner\"]);\n  const [active, setActive] = React.useState(defaultValue);\n  const [effort, setEffort] = React.useState<Effort>(\"medium\");\n  const [text, setText] = React.useState(\"\");\n  const [sent, setSent] = React.useState<string | null>(null);\n  const wrap = React.useRef<HTMLDivElement>(null);\n  const trigger = React.useRef<HTMLButtonElement>(null);\n  const listRef = React.useRef<HTMLUListElement>(null);\n  const sentTimer = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n  React.useEffect(() => {\n    if (!open) return;\n    const down = (e: MouseEvent) => {\n      if (wrap.current && !wrap.current.contains(e.target as Node)) setOpen(false);\n    };\n    document.addEventListener(\"mousedown\", down);\n    return () => document.removeEventListener(\"mousedown\", down);\n  }, [open]);\n  React.useEffect(\n    () => () => {\n      if (sentTimer.current) clearTimeout(sentTimer.current);\n    },\n    [],\n  );\n\n  const query = q.trim().toLowerCase();\n  const matches = (m: AIModel) => (!query || `${m.name} ${m.provider} ${m.description}`.toLowerCase().includes(query)) && caps.every((c) => m.caps.includes(c));\n  const groups: { label: string; items: AIModel[] }[] = [];\n  const favs = all.filter((m) => fav.includes(m.id) && matches(m));\n  if (favs.length) groups.push({ label: \"Favorites\", items: favs });\n  if (auto && matches(AUTO) && !fav.includes(\"auto\") && !query && !caps.length) groups.push({ label: \"\", items: [AUTO] });\n  for (const prov of Array.from(new Set(models.map((m) => m.provider)))) {\n    const items = models.filter((m) => m.provider === prov && !fav.includes(m.id) && matches(m));\n    if (items.length) groups.push({ label: prov, items });\n  }\n  const flat = groups.flatMap((g) => g.items);\n  const activeId = flat.some((m) => m.id === active) ? active : flat[0]?.id;\n  const current = all.find((m) => m.id === value) ?? all[0];\n  const shown = flat.find((m) => m.id === activeId) ?? current;\n  const optId = (id: string) => `${uid}-opt-${id}`;\n\n  const scrollTo = (id: string) => {\n    const el = listRef.current?.querySelector<HTMLElement>(`[data-id=\"${id}\"]`);\n    el?.scrollIntoView({ block: \"nearest\" });\n  };\n  const choose = (m: AIModel) => {\n    if (m.locked) return;\n    setValue(m.id);\n    setOpen(false);\n    setQ(\"\");\n    onChange?.(m.id, effort);\n    trigger.current?.focus();\n  };\n  const onKey = (e: React.KeyboardEvent) => {\n    const i = flat.findIndex((m) => m.id === activeId);\n    if (e.key === \"ArrowDown\" || e.key === \"ArrowUp\") {\n      e.preventDefault();\n      const next = flat[(i + (e.key === \"ArrowDown\" ? 1 : -1) + flat.length) % flat.length];\n      if (next) {\n        setActive(next.id);\n        scrollTo(next.id);\n      }\n    } else if (e.key === \"Enter\") {\n      e.preventDefault();\n      if (shown) choose(shown);\n    } else if (e.key === \"Escape\") {\n      e.preventDefault();\n      setOpen(false);\n      trigger.current?.focus();\n    }\n  };\n  // Focus the search box only when the user opened the menu, not when it starts open on page load.\n  const userOpened = React.useRef(false);\n  const openMenu = () => {\n    userOpened.current = true;\n    setActive(value);\n    setOpen(true);\n  };\n  const focusSearch = React.useCallback((el: HTMLInputElement | null) => {\n    if (el && userOpened.current) el.focus({ preventScroll: true });\n  }, []);\n\n  const ring = { [\"--tw-ring-color\" as string]: p.ring, [\"--tw-ring-offset-color\" as string]: p.card } as React.CSSProperties;\n  const focus = \"outline-none focus-visible:ring-2 focus-visible:ring-offset-2\";\n  const reasoning = current.caps.includes(\"reasoning\");\n  const meter = (n: number, label: string) => (\n    <span className=\"flex items-center gap-1\" role=\"img\" aria-label={`${label} ${n} of 5`}>\n      {[1, 2, 3, 4, 5].map((k) => (\n        <span key={k} className=\"h-1.5 w-3.5 rounded-full\" style={{ background: k <= n ? p.text : p.track }} />\n      ))}\n    </span>\n  );\n  const mark = (m: AIModel, size: number) => (\n    <span className=\"flex shrink-0 items-center justify-center rounded-lg text-[11px] font-bold\" style={{ width: size, height: size, background: m.id === \"auto\" ? GRADIENT : p.chip, color: m.id === \"auto\" ? \"#fff\" : p.muted }} aria-hidden=\"true\">\n      {m.id === \"auto\" ? \"✦\" : m.name[0]}\n    </span>\n  );\n\n  return (\n    <section className={cn(\"@container w-full\", className)} style={{ background: p.bg, color: p.text }}>\n      <div className=\"mx-auto flex min-h-[720px] max-w-3xl flex-col justify-end px-4 py-10 @[640px]:px-6 @[640px]:py-14\">\n        {/* Composer */}\n        <div ref={wrap} className=\"relative\">\n          <form\n            onSubmit={(e) => {\n              e.preventDefault();\n              if (!text.trim()) return;\n              setText(\"\");\n              setSent(`Sent to ${current.name}${reasoning ? ` · ${effort} thinking` : \"\"}`);\n              if (sentTimer.current) clearTimeout(sentTimer.current);\n              sentTimer.current = setTimeout(() => setSent(null), 2400);\n            }}\n            className=\"rounded-2xl border p-3\"\n            style={{ background: p.card, borderColor: p.border }}\n          >\n            <label htmlFor={`${uid}-msg`} className=\"sr-only\">\n              Message\n            </label>\n            <textarea id={`${uid}-msg`} value={text} onChange={(e) => setText(e.target.value)} rows={2} placeholder=\"Ask anything…\" className=\"w-full resize-none border-0 bg-transparent px-1.5 py-1 text-[15px] outline-none placeholder:opacity-60\" style={{ color: p.text }} />\n            <div className=\"mt-2 flex items-center justify-between gap-2\">\n              <div className=\"flex min-w-0 items-center gap-1.5\">\n                <button\n                  ref={trigger}\n                  type=\"button\"\n                  aria-haspopup=\"listbox\"\n                  aria-expanded={open}\n                  aria-controls={`${uid}-pop`}\n                  onClick={() => (open ? setOpen(false) : openMenu())}\n                  className={cn(\"flex h-8 min-w-0 cursor-pointer items-center gap-2 rounded-full border px-2 pr-2.5 text-[13px]\", focus)}\n                  style={{ borderColor: p.border, background: open ? p.hover : \"transparent\", color: p.text, ...ring }}\n                >\n                  <AnimatePresence mode=\"popLayout\" initial={false}>\n                    <motion.span key={current.id} className=\"flex min-w-0 items-center gap-2\" initial={reduce ? false : { opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} exit={reduce ? undefined : { opacity: 0, y: -6 }} transition={{ duration: 0.18 }}>\n                      {mark(current, 20)}\n                      <span className=\"truncate font-medium\">{current.name}</span>\n                    </motion.span>\n                  </AnimatePresence>\n                  <motion.svg width=\"12\" height=\"12\" viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" className=\"shrink-0\" style={{ color: p.faint }} animate={{ rotate: open ? 180 : 0 }} aria-hidden=\"true\">\n                    <path d=\"m4 6 4 4 4-4\" />\n                  </motion.svg>\n                </button>\n                <AnimatePresence initial={false}>\n                  {reasoning && (\n                    <motion.div initial={reduce ? false : { opacity: 0, width: 0 }} animate={{ opacity: 1, width: \"auto\" }} exit={reduce ? undefined : { opacity: 0, width: 0 }} className=\"overflow-hidden\">\n                      <div role=\"radiogroup\" aria-label=\"Thinking effort\" className=\"flex h-8 items-center rounded-full border p-0.5\" style={{ borderColor: p.border }}>\n                        {([\"low\", \"medium\", \"high\"] as Effort[]).map((e) => (\n                          <button key={e} type=\"button\" role=\"radio\" aria-checked={effort === e} onClick={() => setEffort(e)} className={cn(\"relative h-6 cursor-pointer rounded-full border-0 bg-transparent px-2 text-[12px] capitalize\", focus)} style={{ color: effort === e ? p.text : p.faint, ...ring }}>\n                            {effort === e && <motion.span layoutId={`${uid}-effort`} className=\"absolute inset-0 rounded-full\" style={{ background: p.chip }} transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 500, damping: 36 }} />}\n                            <span className=\"relative\">{e === \"medium\" ? \"Med\" : e}</span>\n                          </button>\n                        ))}\n                      </div>\n                    </motion.div>\n                  )}\n                </AnimatePresence>\n              </div>\n              <button type=\"submit\" disabled={!text.trim()} aria-label=\"Send\" className={cn(\"flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-full border-0 disabled:cursor-not-allowed disabled:opacity-35\", focus)} style={{ background: p.on, color: p.onText, ...ring }}>\n                <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                  <path d=\"M12 19V5m0 0-6 6m6-6 6 6\" />\n                </svg>\n              </button>\n            </div>\n          </form>\n          <p className=\"m-0 mt-2 h-4 text-center text-[12px]\" style={{ color: p.faint }} role=\"status\">\n            {sent}\n          </p>\n\n          {/* Menu */}\n          <AnimatePresence>\n            {open && (\n              <motion.div\n                id={`${uid}-pop`}\n                initial={reduce ? false : { opacity: 0, y: 8, scale: 0.98 }}\n                animate={{ opacity: 1, y: 0, scale: 1 }}\n                exit={reduce ? undefined : { opacity: 0, y: 6, scale: 0.98 }}\n                transition={{ duration: 0.16 }}\n                className=\"absolute inset-x-0 bottom-[calc(100%+8px)] z-20 flex max-h-[460px] origin-bottom overflow-hidden rounded-2xl border @[640px]:right-auto @[640px]:w-[620px]\"\n                style={{ background: p.pop, borderColor: p.border, boxShadow: p.shadow }}\n              >\n                <div className=\"flex min-w-0 flex-1 flex-col @[640px]:w-[320px] @[640px]:flex-none @[640px]:border-r\" style={{ borderColor: p.border }}>\n                  <div className=\"border-b p-2\" style={{ borderColor: p.border }}>\n                    <div className=\"flex items-center gap-2 rounded-lg px-2\" style={{ background: p.chip }}>\n                      <svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden=\"true\" style={{ color: p.faint }}>\n                        <circle cx=\"11\" cy=\"11\" r=\"7\" />\n                        <path d=\"m20 20-3.5-3.5\" />\n                      </svg>\n                      <input\n                        ref={focusSearch}\n                        role=\"combobox\"\n                        aria-expanded=\"true\"\n                        aria-controls={`${uid}-list`}\n                        aria-activedescendant={activeId ? optId(activeId) : undefined}\n                        aria-autocomplete=\"list\"\n                        aria-label=\"Search models\"\n                        value={q}\n                        onChange={(e) => setQ(e.target.value)}\n                        onKeyDown={onKey}\n                        placeholder=\"Search models\"\n                        className=\"h-8 min-w-0 flex-1 border-0 bg-transparent text-[13px] outline-none\"\n                        style={{ color: p.text }}\n                      />\n                    </div>\n                    <div className=\"mt-2 flex flex-wrap gap-1\" role=\"group\" aria-label=\"Filter by capability\">\n                      {(Object.keys(CAP_LABEL) as Capability[]).map((c) => {\n                        const on = caps.includes(c);\n                        return (\n                          <button key={c} type=\"button\" aria-pressed={on} onClick={() => setCaps((v) => (on ? v.filter((x) => x !== c) : [...v, c]))} className={cn(\"flex h-6 cursor-pointer items-center gap-1 rounded-full border px-2 text-[11.5px]\", focus)} style={{ borderColor: on ? p.text : p.border, background: on ? p.chip : \"transparent\", color: on ? p.text : p.muted, ...ring }}>\n                            {capIcon(c, 11)}\n                            {CAP_LABEL[c]}\n                          </button>\n                        );\n                      })}\n                    </div>\n                  </div>\n                  <ul ref={listRef} id={`${uid}-list`} role=\"listbox\" aria-label=\"Models\" className=\"m-0 min-h-0 flex-1 list-none overflow-y-auto p-1.5\">\n                    {groups.map((g) => (\n                      <li key={g.label || \"auto\"} role=\"presentation\">\n                        {g.label && (\n                          <p className=\"m-0 px-2 pt-2.5 pb-1 text-[11px] font-medium tracking-wide uppercase\" style={{ color: p.faint }} aria-hidden=\"true\">\n                            {g.label}\n                          </p>\n                        )}\n                        <ul role=\"group\" aria-label={g.label || \"Auto\"} className=\"m-0 list-none p-0\">\n                          {g.items.map((m) => {\n                            const isActive = m.id === activeId;\n                            const selected = m.id === value;\n                            return (\n                              <li\n                                key={m.id}\n                                id={optId(m.id)}\n                                data-id={m.id}\n                                role=\"option\"\n                                aria-selected={selected}\n                                aria-disabled={m.locked || undefined}\n                                onMouseEnter={() => setActive(m.id)}\n                                onMouseDown={(e) => e.preventDefault()}\n                                onClick={() => choose(m)}\n                                className={cn(\"group relative flex cursor-pointer items-center gap-2.5 rounded-lg px-2 py-2\", m.locked && \"cursor-not-allowed\")}\n                                style={{ background: isActive ? p.hover : \"transparent\" }}\n                              >\n                                {mark(m, 26)}\n                                <span className=\"min-w-0 flex-1\">\n                                  <span className=\"flex items-center gap-1.5 text-[13.5px] font-medium\" style={{ opacity: m.locked ? 0.55 : 1 }}>\n                                    <span className=\"truncate\">{m.name}</span>\n                                    {m.badge && (\n                                      <span className=\"rounded px-1 text-[10px] font-semibold\" style={{ background: p.chip, color: p.accent }}>\n                                        {m.badge}\n                                      </span>\n                                    )}\n                                    {m.locked && (\n                                      <span className=\"rounded px-1 text-[10px] font-semibold\" style={{ background: p.chip, color: p.muted }}>\n                                        Pro\n                                      </span>\n                                    )}\n                                  </span>\n                                  <span className=\"mt-0.5 flex items-center gap-1.5 text-[11.5px]\" style={{ color: p.faint }}>\n                                    {m.id === \"auto\" ? (\n                                      \"Best model for each message\"\n                                    ) : (\n                                      <>\n                                        {m.caps.map((c) => (\n                                          <span key={c} title={CAP_LABEL[c]}>\n                                            {capIcon(c, 11)}\n                                          </span>\n                                        ))}\n                                        <span>· {ctx(m.context)}</span>\n                                      </>\n                                    )}\n                                  </span>\n                                </span>\n                                {m.id !== \"auto\" && (\n                                  <button\n                                    type=\"button\"\n                                    tabIndex={-1}\n                                    aria-label={fav.includes(m.id) ? `Remove ${m.name} from favorites` : `Add ${m.name} to favorites`}\n                                    onClick={(e) => {\n                                      e.stopPropagation();\n                                      setFav((v) => (v.includes(m.id) ? v.filter((x) => x !== m.id) : [...v, m.id]));\n                                    }}\n                                    className={cn(\"flex h-6 w-6 cursor-pointer items-center justify-center rounded-md border-0 bg-transparent transition-opacity\", fav.includes(m.id) ? \"opacity-100\" : \"opacity-0 group-hover:opacity-100 [@media(hover:none)]:opacity-60\")}\n                                    style={{ color: fav.includes(m.id) ? p.accent : p.faint }}\n                                  >\n                                    <svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill={fav.includes(m.id) ? \"currentColor\" : \"none\"} stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                                      <path d=\"m12 3 2.8 5.7 6.2.9-4.5 4.4 1 6.2L12 17.3 6.5 20.2l1-6.2L3 9.6l6.2-.9L12 3Z\" />\n                                    </svg>\n                                  </button>\n                                )}\n                                {selected && (\n                                  <svg width=\"14\" height=\"14\" viewBox=\"0 0 16 16\" fill=\"none\" stroke={p.text} strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                                    <path d=\"m3 8.5 3 3 7-7\" />\n                                  </svg>\n                                )}\n                              </li>\n                            );\n                          })}\n                        </ul>\n                      </li>\n                    ))}\n                    {flat.length === 0 && (\n                      <li role=\"presentation\" className=\"px-3 py-8 text-center text-[13px]\" style={{ color: p.muted }}>\n                        No models match.\n                      </li>\n                    )}\n                  </ul>\n                  <p className=\"m-0 hidden border-t px-3 py-2 text-[11px] @[640px]:block\" style={{ borderColor: p.border, color: p.faint }} aria-hidden=\"true\">\n                    ↑ ↓ to move · Enter to pick · Esc to close\n                  </p>\n                </div>\n\n                {/* Details */}\n                <div className=\"hidden min-w-0 flex-1 flex-col overflow-y-auto p-4 @[640px]:flex\" aria-live=\"polite\">\n                  {shown && (\n                    <motion.div key={shown.id} initial={reduce ? false : { opacity: 0, x: 6 }} animate={{ opacity: 1, x: 0 }} transition={{ duration: 0.16 }}>\n                      <div className=\"flex items-center gap-2.5\">\n                        {mark(shown, 34)}\n                        <div className=\"min-w-0\">\n                          <p className=\"m-0 text-[15px] font-semibold\">{shown.name}</p>\n                          <p className=\"m-0 text-[12px]\" style={{ color: p.faint }}>\n                            {shown.id === \"auto\" ? \"Router\" : shown.provider}\n                            {shown.cutoff ? ` · Knowledge to ${shown.cutoff}` : \"\"}\n                          </p>\n                        </div>\n                      </div>\n                      <p className=\"m-0 mt-3 text-[13px] leading-[1.55]\" style={{ color: p.muted }}>\n                        {shown.description}\n                      </p>\n                      <dl className=\"m-0 mt-4 grid grid-cols-[84px_1fr] items-center gap-x-3 gap-y-2.5 text-[12.5px]\">\n                        <dt style={{ color: p.faint }}>Intelligence</dt>\n                        <dd className=\"m-0\">{meter(shown.intelligence, \"Intelligence\")}</dd>\n                        <dt style={{ color: p.faint }}>Speed</dt>\n                        <dd className=\"m-0\">{meter(shown.speed, \"Speed\")}</dd>\n                        {shown.id !== \"auto\" && (\n                          <>\n                            <dt style={{ color: p.faint }}>Context</dt>\n                            <dd className=\"m-0 tabular-nums\">{ctx(shown.context)} tokens</dd>\n                            <dt style={{ color: p.faint }}>Price</dt>\n                            <dd className=\"m-0 tabular-nums\">\n                              ${shown.price.input} in · ${shown.price.output} out <span style={{ color: p.faint }}>/ 1M</span>\n                            </dd>\n                          </>\n                        )}\n                      </dl>\n                      <ul className=\"m-0 mt-4 flex list-none flex-wrap gap-1.5 p-0\">\n                        {(Object.keys(CAP_LABEL) as Capability[]).map((c) => {\n                          const has = shown.caps.includes(c);\n                          return (\n                            <li key={c} className=\"flex items-center gap-1 rounded-full border px-2 py-0.5 text-[11.5px]\" style={{ borderColor: p.border, color: has ? p.text : p.faint, textDecoration: has ? undefined : \"line-through\" }}>\n                              {capIcon(c, 11)}\n                              {CAP_LABEL[c]}\n                              <span className=\"sr-only\">{has ? \", supported\" : \", not supported\"}</span>\n                            </li>\n                          );\n                        })}\n                      </ul>\n                      {shown.locked && (\n                        <div className=\"mt-4 rounded-xl p-3 text-[12.5px]\" style={{ background: p.chip }}>\n                          <p className=\"m-0\" style={{ color: p.muted }}>\n                            Available on the Pro plan.\n                          </p>\n                          <button type=\"button\" onClick={onUpgrade} className={cn(\"mt-2 h-7 cursor-pointer rounded-full border-0 px-3 text-[12px] font-medium\", focus)} style={{ background: p.on, color: p.onText, ...ring }}>\n                            Upgrade\n                          </button>\n                        </div>\n                      )}\n                    </motion.div>\n                  )}\n                </div>\n              </motion.div>\n            )}\n          </AnimatePresence>\n        </div>\n      </div>\n    </section>\n  );\n}\n\nexport default ModelPicker;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}