{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "docs-site",
  "type": "registry:block",
  "title": "Docs Site",
  "description": "A documentation site with a top nav, collapsible sidebar, code samples whose language choice follows you across the page, a table of contents that tracks your scroll, ⌘K search over pages and headings, and prev and next cards.",
  "categories": [
    "screen",
    "Dev"
  ],
  "dependencies": [
    "motion",
    "lucide-react"
  ],
  "registryDependencies": [
    "utils",
    "https://coss.com/ui/r/button.json",
    "https://coss.com/ui/r/kbd.json"
  ],
  "files": [
    {
      "path": "registry/devl/docs-site.tsx",
      "type": "registry:component",
      "content": "\"use client\";\n\nimport { AnimatePresence, LayoutGroup, MotionConfig, motion } from \"motion/react\";\nimport {\n  ArrowLeftIcon,\n  ArrowRightIcon,\n  CheckIcon,\n  ChevronDownIcon,\n  ChevronRightIcon,\n  CopyIcon,\n  CornerDownLeftIcon,\n  FileTextIcon,\n  HashIcon,\n  InfoIcon,\n  MenuIcon,\n  PencilIcon,\n  SearchIcon,\n  ThumbsDownIcon,\n  ThumbsUpIcon,\n  TriangleAlertIcon,\n  XIcon,\n} from \"lucide-react\";\nimport {\n  Fragment,\n  type KeyboardEvent,\n  type ReactNode,\n  useEffect,\n  useLayoutEffect,\n  useMemo,\n  useRef,\n  useState,\n} from \"react\";\nimport { Button } from \"@/components/ui/button\";\nimport { Kbd } from \"@/components/ui/kbd\";\nimport { cn } from \"@/lib/utils\";\n\nexport type DocsLang = \"node\" | \"python\" | \"go\" | \"curl\";\n\nexport type DocsBlock =\n  | { type: \"p\"; text: string }\n  | { type: \"list\"; items: string[] }\n  | { type: \"steps\"; items: string[] }\n  | { type: \"callout\"; tone: \"info\" | \"warning\"; title: string; text: string }\n  | { type: \"code\"; samples: Partial<Record<DocsLang, string>>; title?: string }\n  | { type: \"table\"; head: string[]; rows: string[][] };\n\nexport interface DocsSection {\n  id: string;\n  title: string;\n  blocks: DocsBlock[];\n}\n\nexport interface DocsPage {\n  id: string;\n  title: string;\n  group: string;\n  lead: string;\n  updated: string;\n  minutes: number;\n  sections: DocsSection[];\n}\n\nexport interface DocsSiteProps {\n  product?: string;\n  version?: string;\n  pages?: DocsPage[];\n  initialPage?: string;\n  dashboardHref?: string;\n  editHref?: (pageId: string) => string;\n  className?: string;\n}\n\nconst defaultPages: DocsPage[] = [\n  {\n    id: \"introduction\",\n    title: \"Introduction\",\n    group: \"Getting started\",\n    lead: \"Kestrel delivers events from your product to your customers' endpoints, with retries, signatures and a delivery log they can trust.\",\n    updated: \"Oct 2\",\n    minutes: 2,\n    sections: [\n      {\n        id: \"what-you-can-build\",\n        title: \"What you can build\",\n        blocks: [\n          { type: \"p\", text: \"Anything your customers would otherwise poll for. Teams use Kestrel to send order updates to warehouses, sync CRM records, trigger builds and page on-call when a job fails.\" },\n          { type: \"list\", items: [\"Outgoing webhooks with per-customer endpoints\", \"A hosted portal where customers manage their own endpoints\", \"Delivery logs, replays and alerts without building them yourself\"] },\n        ],\n      },\n      {\n        id: \"how-it-fits\",\n        title: \"How it fits together\",\n        blocks: [\n          { type: \"p\", text: \"Your backend publishes an event once. Kestrel fans it out to every subscribed endpoint, signs each request, retries failures and records every attempt.\" },\n        ],\n      },\n    ],\n  },\n  {\n    id: \"quickstart\",\n    title: \"Quickstart\",\n    group: \"Getting started\",\n    lead: \"Send your first webhook in about five minutes.\",\n    updated: \"Oct 18\",\n    minutes: 5,\n    sections: [\n      {\n        id: \"install\",\n        title: \"Install the SDK\",\n        blocks: [\n          {\n            type: \"code\",\n            samples: { node: \"npm install @kestrel/node\", python: \"pip install kestrel\", go: \"go get kestrel.dev/go/v2\", curl: \"# No install needed. Every SDK call maps to one HTTP request.\" },\n          },\n        ],\n      },\n      {\n        id: \"send-event\",\n        title: \"Send an event\",\n        blocks: [\n          { type: \"p\", text: \"Publish an event with a type and a JSON payload. Every endpoint subscribed to that type receives it.\" },\n          {\n            type: \"code\",\n            samples: {\n              node: `const kestrel = new Kestrel(process.env.KESTREL_KEY);\\n\\nawait kestrel.events.publish({\\n  type: \"order.shipped\",\\n  data: { orderId: \"ord_9QX2\", carrier: \"Parcelwise\" },\\n});`,\n              python: `kestrel = Kestrel(os.environ[\"KESTREL_KEY\"])\\n\\nkestrel.events.publish(\\n    type=\"order.shipped\",\\n    data={\"order_id\": \"ord_9QX2\", \"carrier\": \"Parcelwise\"},\\n)`,\n              go: `client := kestrel.New(os.Getenv(\"KESTREL_KEY\"))\\n\\nclient.Events.Publish(ctx, kestrel.Event{\\n\\tType: \"order.shipped\",\\n\\tData: map[string]any{\"orderId\": \"ord_9QX2\"},\\n})`,\n              curl: `curl https://api.kestrel.dev/v2/events \\\\\\n  -H \"Authorization: Bearer $KESTREL_KEY\" \\\\\\n  -d type=order.shipped \\\\\\n  -d data[orderId]=ord_9QX2`,\n            },\n          },\n          { type: \"callout\", tone: \"info\", title: \"Use a test key first\", text: \"Keys starting with kst_test_ deliver to test endpoints only, so you can try this without touching customer traffic.\" },\n        ],\n      },\n    ],\n  },\n  {\n    id: \"authentication\",\n    title: \"Authentication\",\n    group: \"Getting started\",\n    lead: \"Every API request is authenticated with a secret key from your dashboard.\",\n    updated: \"Sep 12\",\n    minutes: 2,\n    sections: [\n      {\n        id: \"api-keys\",\n        title: \"API keys\",\n        blocks: [\n          {\n            type: \"table\",\n            head: [\"Prefix\", \"Environment\", \"Can deliver to\"],\n            rows: [\n              [\"kst_live_\", \"Production\", \"Live endpoints\"],\n              [\"kst_test_\", \"Test\", \"Test endpoints and the local CLI\"],\n            ],\n          },\n          { type: \"callout\", tone: \"warning\", title: \"Keep secret keys on the server\", text: \"Anyone with a secret key can publish events as you. Never ship one in a browser bundle or a mobile app.\" },\n        ],\n      },\n    ],\n  },\n  {\n    id: \"signatures\",\n    title: \"Verifying signatures\",\n    group: \"Webhooks\",\n    lead: \"Kestrel signs every request so your customers can check it came from you and wasn't changed on the way.\",\n    updated: \"Oct 9\",\n    minutes: 3,\n    sections: [\n      {\n        id: \"how-signing-works\",\n        title: \"How signing works\",\n        blocks: [\n          { type: \"p\", text: \"Each request carries a Kestrel-Signature header: a timestamp and an HMAC-SHA256 of the timestamp and raw body, keyed with the endpoint's signing secret.\" },\n        ],\n      },\n      {\n        id: \"verify\",\n        title: \"Verify in your handler\",\n        blocks: [\n          {\n            type: \"code\",\n            samples: {\n              node: `const event = kestrel.webhooks.verify(\\n  rawBody,\\n  req.headers[\"kestrel-signature\"],\\n  process.env.ENDPOINT_SECRET,\\n);`,\n              python: `event = kestrel.webhooks.verify(\\n    raw_body,\\n    request.headers[\"Kestrel-Signature\"],\\n    os.environ[\"ENDPOINT_SECRET\"],\\n)`,\n              go: `event, err := kestrel.Verify(body, r.Header.Get(\"Kestrel-Signature\"), secret)`,\n            },\n          },\n        ],\n      },\n    ],\n  },\n  {\n    id: \"retries\",\n    title: \"Retries and dead letters\",\n    group: \"Webhooks\",\n    lead: \"When an endpoint fails, Kestrel retries with backoff, then parks the event in a dead-letter queue, so nothing is lost and one bad endpoint never holds up the rest.\",\n    updated: \"Oct 22\",\n    minutes: 4,\n    sections: [\n      {\n        id: \"how-retries-work\",\n        title: \"How retries work\",\n        blocks: [\n          {\n            type: \"callout\",\n            tone: \"info\",\n            title: \"Changed in v2.4\",\n            text: \"Events now move to the dead-letter queue after three failed attempts. Before v2.4 they were retried for up to 24 hours.\",\n          },\n          { type: \"p\", text: \"A delivery fails when the endpoint answers with anything other than a 2xx, takes longer than 15 seconds, or can't be reached. Each retry waits longer than the last, with jitter so a recovering endpoint isn't hit by every event at once.\" },\n          {\n            type: \"table\",\n            head: [\"Attempt\", \"Sent after\", \"If it fails\"],\n            rows: [\n              [\"1\", \"Immediately\", \"Retry in about 1 minute\"],\n              [\"2\", \"~1 minute\", \"Retry in about 10 minutes\"],\n              [\"3\", \"~10 minutes\", \"Move to the dead-letter queue\"],\n            ],\n          },\n          { type: \"p\", text: \"An endpoint that answers 410 Gone is disabled straight away and its pending events are dead-lettered.\" },\n        ],\n      },\n      {\n        id: \"dead-letter-queue\",\n        title: \"The dead-letter queue\",\n        blocks: [\n          { type: \"p\", text: \"Dead-lettered events keep their payload, every attempt and the last error for 7 days. List them per endpoint to see what went wrong.\" },\n          {\n            type: \"code\",\n            title: \"List dead letters for an endpoint\",\n            samples: {\n              node: `const parked = await kestrel.deadLetters.list({\\n  endpointId: \"ep_8fK21\",\\n  limit: 20,\\n});\\n\\nfor (const letter of parked.data) {\\n  console.log(letter.eventId, letter.lastError);\\n}`,\n              python: `parked = kestrel.dead_letters.list(endpoint_id=\"ep_8fK21\", limit=20)\\n\\nfor letter in parked.data:\\n    print(letter.event_id, letter.last_error)`,\n              go: `parked, err := client.DeadLetters.List(ctx, &kestrel.DeadLetterParams{\\n\\tEndpointID: \"ep_8fK21\",\\n\\tLimit:      20,\\n})`,\n              curl: `curl \"https://api.kestrel.dev/v2/dead_letters?endpoint_id=ep_8fK21&limit=20\" \\\\\\n  -H \"Authorization: Bearer $KESTREL_KEY\"`,\n            },\n          },\n        ],\n      },\n      {\n        id: \"replaying\",\n        title: \"Replaying events\",\n        blocks: [\n          {\n            type: \"steps\",\n            items: [\n              \"Fix the endpoint, or wait until your customer confirms it's back.\",\n              \"Open Deliveries, filter by Dead-lettered, and select the events to send again.\",\n              \"Choose Replay. Each event is delivered once more and counted as a new attempt.\",\n            ],\n          },\n          {\n            type: \"code\",\n            title: \"Replay from code\",\n            samples: {\n              node: `await kestrel.deadLetters.replay(\"dl_3Hc9Ve\");`,\n              python: `kestrel.dead_letters.replay(\"dl_3Hc9Ve\")`,\n              go: `err := client.DeadLetters.Replay(ctx, \"dl_3Hc9Ve\")`,\n              curl: `curl -X POST https://api.kestrel.dev/v2/dead_letters/dl_3Hc9Ve/replay \\\\\\n  -H \"Authorization: Bearer $KESTREL_KEY\"`,\n            },\n          },\n          {\n            type: \"callout\",\n            tone: \"warning\",\n            title: \"Replays can arrive out of order\",\n            text: \"A replayed event may land after newer events for the same object. Compare the event's created timestamp before overwriting state.\",\n          },\n        ],\n      },\n      {\n        id: \"limits\",\n        title: \"Limits\",\n        blocks: [\n          {\n            type: \"table\",\n            head: [\"Limit\", \"Value\"],\n            rows: [\n              [\"Attempts per event\", \"3\"],\n              [\"Request timeout\", \"15 seconds\"],\n              [\"Dead-letter retention\", \"7 days\"],\n              [\"Replay rate\", \"50 events/s per endpoint\"],\n            ],\n          },\n        ],\n      },\n    ],\n  },\n  {\n    id: \"replay-guide\",\n    title: \"Bulk replays\",\n    group: \"Webhooks\",\n    lead: \"Send a whole window of events again after an outage, without flooding the endpoint.\",\n    updated: \"Oct 22\",\n    minutes: 3,\n    sections: [\n      {\n        id: \"choose-window\",\n        title: \"Choose a window\",\n        blocks: [\n          { type: \"p\", text: \"Pick a start and end time and an optional event type. Kestrel shows how many events match before anything is sent.\" },\n          {\n            type: \"code\",\n            samples: {\n              node: `await kestrel.replays.create({\\n  endpointId: \"ep_8fK21\",\\n  from: \"2026-10-21T09:00:00Z\",\\n  to: \"2026-10-21T09:40:00Z\",\\n});`,\n              curl: `curl https://api.kestrel.dev/v2/replays \\\\\\n  -H \"Authorization: Bearer $KESTREL_KEY\" \\\\\\n  -d endpoint_id=ep_8fK21 \\\\\\n  -d from=2026-10-21T09:00:00Z \\\\\\n  -d to=2026-10-21T09:40:00Z`,\n            },\n          },\n        ],\n      },\n      {\n        id: \"pacing\",\n        title: \"Pacing\",\n        blocks: [{ type: \"p\", text: \"Bulk replays are paced at the endpoint's replay rate and pause automatically if the endpoint starts failing again.\" }],\n      },\n    ],\n  },\n  {\n    id: \"events-api\",\n    title: \"Events\",\n    group: \"API reference\",\n    lead: \"The Event object, and how to list and retrieve events.\",\n    updated: \"Oct 14\",\n    minutes: 3,\n    sections: [\n      {\n        id: \"event-object\",\n        title: \"The Event object\",\n        blocks: [\n          {\n            type: \"table\",\n            head: [\"Field\", \"Type\", \"Description\"],\n            rows: [\n              [\"id\", \"string\", \"Unique ID, prefixed evt_\"],\n              [\"type\", \"string\", \"Dot-separated name, e.g. order.shipped\"],\n              [\"data\", \"object\", \"Your payload, up to 256 KB\"],\n              [\"created\", \"timestamp\", \"When you published it\"],\n            ],\n          },\n        ],\n      },\n      {\n        id: \"list-events\",\n        title: \"List events\",\n        blocks: [\n          {\n            type: \"code\",\n            samples: {\n              node: `const events = await kestrel.events.list({ type: \"order.shipped\" });`,\n              python: `events = kestrel.events.list(type=\"order.shipped\")`,\n              curl: `curl \"https://api.kestrel.dev/v2/events?type=order.shipped\" \\\\\\n  -H \"Authorization: Bearer $KESTREL_KEY\"`,\n            },\n          },\n        ],\n      },\n    ],\n  },\n  {\n    id: \"deliveries-api\",\n    title: \"Deliveries\",\n    group: \"API reference\",\n    lead: \"Every attempt to send an event to an endpoint, with status, timing and response.\",\n    updated: \"Oct 14\",\n    minutes: 2,\n    sections: [\n      {\n        id: \"delivery-object\",\n        title: \"The Delivery object\",\n        blocks: [\n          {\n            type: \"table\",\n            head: [\"Field\", \"Type\", \"Description\"],\n            rows: [\n              [\"id\", \"string\", \"Unique ID, prefixed dlv_\"],\n              [\"status\", \"enum\", \"succeeded, failed or dead_lettered\"],\n              [\"attempt\", \"integer\", \"1 to 3\"],\n              [\"duration_ms\", \"integer\", \"Time until the endpoint answered\"],\n            ],\n          },\n        ],\n      },\n    ],\n  },\n];\n\nconst LANGS: { id: DocsLang; label: string }[] = [\n  { id: \"node\", label: \"Node.js\" },\n  { id: \"python\", label: \"Python\" },\n  { id: \"go\", label: \"Go\" },\n  { id: \"curl\", label: \"cURL\" },\n];\n\nconst navLinks = [\"Guides\", \"API reference\"] as const;\n\nconst ease = [0.23, 1, 0.32, 1] as const;\nconst spring = { type: \"spring\", stiffness: 520, damping: 42 } as const;\n\nconst KEYWORDS =\n  /^(const|let|var|await|async|for|of|in|new|return|import|from|if|else|func|err|nil|range|def|print|True|False|None|curl)$/;\n\nfunction highlight(code: string): ReactNode[] {\n  const out: ReactNode[] = [];\n  const re = /((?:\\/\\/|#).*$)|(\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'|`(?:[^`\\\\]|\\\\.)*`)|(\\s-[A-Za-z]\\b|\\s--?[a-z-]+)|(\\b\\d[\\d_.]*\\b)|([A-Za-z_$][\\w$]*)/gm;\n  let last = 0;\n  let k = 0;\n  for (let m = re.exec(code); m; m = re.exec(code)) {\n    if (m.index > last) out.push(code.slice(last, m.index));\n    const tok = m[0];\n    if (m[1] && (m[1].startsWith(\"//\") || /(^|\\s)#/.test(code.slice(Math.max(0, m.index - 1), m.index + 1))))\n      out.push(<span className=\"text-muted-foreground italic\" key={k++}>{tok}</span>);\n    else if (m[2]) out.push(<span className=\"text-emerald-700 dark:text-emerald-300\" key={k++}>{tok}</span>);\n    else if (m[3]) out.push(<span className=\"text-sky-700 dark:text-sky-300\" key={k++}>{tok}</span>);\n    else if (m[4]) out.push(<span className=\"text-amber-700 dark:text-amber-300\" key={k++}>{tok}</span>);\n    else if (m[5] && KEYWORDS.test(tok)) out.push(<span className=\"text-violet-700 dark:text-violet-300\" key={k++}>{tok}</span>);\n    else if (m[5] && /^[A-Z]/.test(tok)) out.push(<span className=\"text-sky-700 dark:text-sky-300\" key={k++}>{tok}</span>);\n    else if (m[5] && code[re.lastIndex] === \"(\") out.push(<span className=\"text-blue-700 dark:text-blue-300\" key={k++}>{tok}</span>);\n    else out.push(tok);\n    last = re.lastIndex;\n  }\n  if (last < code.length) out.push(code.slice(last));\n  return out;\n}\n\nfunction CodeTabs({ samples, title, lang, onLang }: { samples: Partial<Record<DocsLang, string>>; title?: string; lang: DocsLang; onLang: (l: DocsLang) => void }) {\n  const available = LANGS.filter((l) => samples[l.id]);\n  const current = samples[lang] ? lang : available[0].id;\n  const [copied, setCopied] = useState(false);\n  useEffect(() => {\n    if (!copied) return;\n    const id = window.setTimeout(() => setCopied(false), 1600);\n    return () => window.clearTimeout(id);\n  }, [copied]);\n  const single = available.length === 1 && !title;\n  return (\n    <div className=\"overflow-hidden rounded-xl border bg-card shadow-xs/5\">\n      <div className=\"flex h-10 items-center gap-1 border-b bg-muted/40 ps-1.5 pe-1.5\">\n        {title && <span className=\"hidden min-w-0 flex-1 truncate ps-1.5 pe-2 font-medium text-muted-foreground text-xs @2xl:block\">{title}</span>}\n        <div className=\"flex min-w-0 gap-0.5 overflow-x-auto [scrollbar-width:none]\" role=\"tablist\">\n          {single ? (\n            <span className=\"px-1.5 font-mono text-muted-foreground text-xs\">terminal</span>\n          ) : (\n            available.map((l) => (\n              <button\n                aria-selected={current === l.id}\n                className={cn(\n                  \"relative h-7 shrink-0 cursor-pointer rounded-md px-2 font-medium text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring\",\n                  current === l.id ? \"text-foreground\" : \"text-muted-foreground hover:text-foreground\",\n                )}\n                key={l.id}\n                onClick={() => onLang(l.id)}\n                role=\"tab\"\n                type=\"button\"\n              >\n                {current === l.id && <span className=\"absolute inset-0 rounded-md bg-background shadow-xs/5 ring-1 ring-border dark:bg-accent dark:ring-0\" />}\n                <span className=\"relative\">{l.label}</span>\n              </button>\n            ))\n          )}\n        </div>\n        <button\n          aria-label={copied ? \"Copied\" : \"Copy code\"}\n          className={cn(\"ms-auto flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md text-muted-foreground outline-none transition-[color,background-color,scale] duration-150 ease-out hover:bg-accent hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring active:scale-90\", title && \"@2xl:ms-1\")}\n          onClick={() => {\n            navigator.clipboard?.writeText(samples[current] ?? \"\").catch(() => {});\n            setCopied(true);\n          }}\n          type=\"button\"\n        >\n          <AnimatePresence initial={false} mode=\"popLayout\">\n            <motion.span animate={{ opacity: 1, scale: 1 }} exit={{ opacity: 0, scale: 0.8 }} initial={{ opacity: 0, scale: 0.8 }} key={copied ? \"y\" : \"n\"} transition={{ duration: 0.12 }}>\n              {copied ? <CheckIcon className=\"size-3.5 text-success\" /> : <CopyIcon className=\"size-3.5\" />}\n            </motion.span>\n          </AnimatePresence>\n        </button>\n      </div>\n      <pre className=\"overflow-x-auto px-4 py-3 font-mono text-[12.5px] leading-6 [scrollbar-width:thin]\">\n        <code>{highlight(samples[current] ?? \"\")}</code>\n      </pre>\n    </div>\n  );\n}\n\nfunction Inline({ text }: { text: string }) {\n  const parts = text.split(/(kst_live_|kst_test_|Kestrel-Signature|evt_|dlv_|order\\.shipped|410 Gone|2xx)/g);\n  return (\n    <>\n      {parts.map((p, i) =>\n        i % 2 === 1 ? (\n          <code className=\"rounded-md border bg-muted px-1 py-px font-mono text-[0.8125rem]\" key={i}>\n            {p}\n          </code>\n        ) : (\n          <Fragment key={i}>{p}</Fragment>\n        ),\n      )}\n    </>\n  );\n}\n\nfunction Block({ block, lang, onLang }: { block: DocsBlock; lang: DocsLang; onLang: (l: DocsLang) => void }) {\n  switch (block.type) {\n    case \"p\":\n      return (\n        <p className=\"text-pretty text-[15px] text-foreground/85 leading-7\">\n          <Inline text={block.text} />\n        </p>\n      );\n    case \"list\":\n      return (\n        <ul className=\"flex flex-col gap-1 ps-1\">\n          {block.items.map((it) => (\n            <li className=\"flex gap-3 text-[15px] leading-7\" key={it}>\n              <span className=\"mt-[13px] size-1 shrink-0 rounded-full bg-muted-foreground/70\" />\n              <span className=\"text-foreground/85\">{it}</span>\n            </li>\n          ))}\n        </ul>\n      );\n    case \"steps\":\n      return (\n        <ol className=\"relative flex flex-col gap-3 before:absolute before:top-3 before:bottom-3 before:left-3 before:w-px before:bg-border\">\n          {block.items.map((it, i) => (\n            <li className=\"relative flex gap-3\" key={it}>\n              <span className=\"z-10 flex size-6 shrink-0 items-center justify-center rounded-full border bg-background font-medium text-xs tabular-nums\">{i + 1}</span>\n              <span className=\"text-pretty text-[15px] text-foreground/85 leading-6\">{it}</span>\n            </li>\n          ))}\n        </ol>\n      );\n    case \"callout\": {\n      const Icon = block.tone === \"info\" ? InfoIcon : TriangleAlertIcon;\n      return (\n        <div\n          className={cn(\n            \"flex gap-3 rounded-xl border px-4 py-3.5\",\n            block.tone === \"info\" ? \"border-info/16 bg-info/4 dark:border-info/14 dark:bg-info/6\" : \"border-warning/20 bg-warning/5 dark:border-warning/14 dark:bg-warning/6\",\n          )}\n          role=\"note\"\n        >\n          <Icon className={cn(\"mt-[3px] size-4 shrink-0\", block.tone === \"info\" ? \"text-info-foreground\" : \"text-warning-foreground\")} />\n          <div className=\"min-w-0\">\n            <div className=\"font-medium\">{block.title}</div>\n            <p className=\"mt-1 text-pretty text-muted-foreground leading-6\">\n              <Inline text={block.text} />\n            </p>\n          </div>\n        </div>\n      );\n    }\n    case \"code\":\n      return <CodeTabs lang={lang} onLang={onLang} samples={block.samples} title={block.title} />;\n    case \"table\":\n      return (\n        <div className=\"overflow-x-auto rounded-xl border [scrollbar-width:thin]\">\n          <table className=\"w-full min-w-[420px] text-left text-sm\">\n            <thead className=\"bg-muted/30\">\n              <tr>\n                {block.head.map((h) => (\n                  <th className=\"border-b px-3.5 py-2 font-medium text-muted-foreground text-xs\" key={h}>\n                    {h}\n                  </th>\n                ))}\n              </tr>\n            </thead>\n            <tbody>\n              {block.rows.map((r) => (\n                <tr className=\"border-b last:border-b-0\" key={r.join()}>\n                  {r.map((c, i) => (\n                    <td className={cn(\"px-3.5 py-2 align-baseline leading-6\", i === 0 ? \"font-mono text-[0.8125rem] text-foreground\" : \"text-foreground/85\")} key={c}>\n                      {c}\n                    </td>\n                  ))}\n                </tr>\n              ))}\n            </tbody>\n          </table>\n        </div>\n      );\n  }\n}\n\ninterface SearchHit {\n  id: string;\n  page: DocsPage;\n  section?: DocsSection;\n}\n\nfunction SearchDialog({ pages, onPick, onClose }: { pages: DocsPage[]; onPick: (page: string, section?: string) => void; onClose: () => void }) {\n  const [query, setQuery] = useState(\"\");\n  const [active, setActive] = useState(0);\n  const inputRef = useRef<HTMLInputElement>(null);\n  useEffect(() => inputRef.current?.focus(), []);\n  const hits = useMemo<SearchHit[]>(() => {\n    const q = query.trim().toLowerCase();\n    const all: SearchHit[] = pages.flatMap((p) => [\n      { id: p.id, page: p },\n      ...p.sections.map((s) => ({ id: `${p.id}#${s.id}`, page: p, section: s })),\n    ]);\n    if (!q) return all.filter((h) => !h.section).slice(0, 8);\n    const score = (h: SearchHit) => {\n      const title = (h.section ? h.section.title : h.page.title).toLowerCase();\n      if (title.startsWith(q)) return 0;\n      if (title.includes(q)) return 1;\n      if (h.page.title.toLowerCase().includes(q)) return 2;\n      const body = h.section ? h.section.blocks.map((b) => (\"text\" in b ? b.text : \"\")).join(\" \") : h.page.lead;\n      return body.toLowerCase().includes(q) ? 3 : 9;\n    };\n    return all\n      .map((h) => ({ h, s: score(h) }))\n      .filter((x) => x.s < 9)\n      .sort((a, b) => a.s - b.s)\n      .slice(0, 10)\n      .map((x) => x.h);\n  }, [pages, query]);\n\n  const mark = (text: string) => {\n    const q = query.trim();\n    if (!q) return text;\n    const i = text.toLowerCase().indexOf(q.toLowerCase());\n    if (i < 0) return text;\n    return (\n      <>\n        {text.slice(0, i)}\n        <mark className=\"rounded-sm bg-warning/24 text-foreground\">{text.slice(i, i + q.length)}</mark>\n        {text.slice(i + q.length)}\n      </>\n    );\n  };\n\n  return (\n    <motion.div\n      animate={{ opacity: 1 }}\n      className=\"absolute inset-0 z-50 flex items-start justify-center bg-black/24 px-3 pt-16\"\n      exit={{ opacity: 0 }}\n      initial={{ opacity: 0 }}\n      onMouseDown={(e) => e.target === e.currentTarget && onClose()}\n      transition={{ duration: 0.12 }}\n    >\n      <motion.div\n        animate={{ opacity: 1, scale: 1 }}\n        aria-label=\"Search documentation\"\n        aria-modal=\"true\"\n        className=\"flex max-h-[440px] w-full max-w-xl origin-top flex-col overflow-hidden rounded-2xl border bg-popover shadow-lg/10\"\n        exit={{ opacity: 0, scale: 0.98 }}\n        initial={{ opacity: 0, scale: 0.98 }}\n        role=\"dialog\"\n        transition={{ duration: 0.14, ease }}\n      >\n        <div className=\"flex items-center gap-2 border-b px-3\">\n          <SearchIcon className=\"size-4 shrink-0 text-muted-foreground\" />\n          <input\n            aria-label=\"Search the docs\"\n            className=\"h-12 min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground\"\n            onChange={(e) => {\n              setQuery(e.target.value);\n              setActive(0);\n            }}\n            onKeyDown={(e) => {\n              if (e.key === \"ArrowDown\") {\n                e.preventDefault();\n                setActive((a) => Math.min(hits.length - 1, a + 1));\n              } else if (e.key === \"ArrowUp\") {\n                e.preventDefault();\n                setActive((a) => Math.max(0, a - 1));\n              } else if (e.key === \"Enter\" && hits[active]) {\n                onPick(hits[active].page.id, hits[active].section?.id);\n              } else if (e.key === \"Escape\") {\n                e.stopPropagation();\n                onClose();\n              }\n            }}\n            placeholder=\"Search guides and API reference…\"\n            ref={inputRef}\n            value={query}\n          />\n          <Kbd>Esc</Kbd>\n        </div>\n        <div className=\"min-h-0 flex-1 overflow-y-auto p-1.5\" role=\"listbox\">\n          {hits.length === 0 ? (\n            <div className=\"px-4 py-10 text-center text-muted-foreground text-sm\">\n              Nothing for “{query}”. Try “retry”, “signature” or “replay”.\n            </div>\n          ) : (\n            <>\n              {!query && <div className=\"px-2.5 pt-1.5 pb-1 font-medium text-muted-foreground text-xs\">Pages</div>}\n              {hits.map((h, i) => (\n                <div\n                  aria-selected={i === active}\n                  className={cn(\"flex cursor-pointer items-center gap-3 rounded-lg px-2.5 py-2\", i === active && \"bg-accent\")}\n                  key={h.id}\n                  onClick={() => onPick(h.page.id, h.section?.id)}\n                  onMouseMove={() => setActive(i)}\n                  role=\"option\"\n                >\n                  <span className=\"flex size-7 shrink-0 items-center justify-center rounded-lg border bg-card text-muted-foreground\">\n                    {h.section ? <HashIcon className=\"size-3.5\" /> : <FileTextIcon className=\"size-3.5\" />}\n                  </span>\n                  <span className=\"min-w-0 flex-1\">\n                    <span className=\"block truncate font-medium\">{mark(h.section ? h.section.title : h.page.title)}</span>\n                    <span className=\"block truncate text-muted-foreground text-xs\">\n                      {h.page.group}\n                      {h.section ? ` › ${h.page.title}` : \"\"}\n                    </span>\n                  </span>\n                  {i === active && <CornerDownLeftIcon className=\"size-3.5 shrink-0 text-muted-foreground\" />}\n                </div>\n              ))}\n            </>\n          )}\n        </div>\n      </motion.div>\n    </motion.div>\n  );\n}\n\nexport function DocsSite({\n  product = \"Kestrel\",\n  version = \"v2.4\",\n  pages = defaultPages,\n  initialPage = \"retries\",\n  dashboardHref,\n  editHref,\n  className,\n}: DocsSiteProps) {\n  const [pageId, setPageId] = useState(initialPage);\n  const [lang, setLang] = useState<DocsLang>(\"node\");\n  const [activeSection, setActiveSection] = useState<string | null>(null);\n  const [search, setSearch] = useState(false);\n  const [drawer, setDrawer] = useState(false);\n  const [tocOpen, setTocOpen] = useState(false);\n  const [feedback, setFeedback] = useState<Record<string, \"yes\" | \"no\">>({});\n  const [closedGroups, setClosedGroups] = useState<Set<string>>(() => new Set());\n  const scrollRef = useRef<HTMLDivElement>(null);\n  const pendingSection = useRef<string | null>(null);\n\n  const page = pages.find((p) => p.id === pageId) ?? pages[0];\n  const index = pages.indexOf(page);\n  const prev = pages[index - 1];\n  const next = pages[index + 1];\n  const groups = Array.from(new Set(pages.map((p) => p.group)));\n\n  const scrollToSection = (id: string, smooth = true) => {\n    const box = scrollRef.current;\n    const el = box?.querySelector<HTMLElement>(`[data-section=\"${id}\"]`);\n    if (box && el) box.scrollTo({ top: el.offsetTop - 16, behavior: smooth ? \"smooth\" : \"auto\" });\n  };\n\n  const go = (id: string, section?: string) => {\n    setSearch(false);\n    setDrawer(false);\n    setTocOpen(false);\n    if (id === pageId) {\n      if (section) scrollToSection(section);\n      else scrollRef.current?.scrollTo({ top: 0, behavior: \"smooth\" });\n      return;\n    }\n    pendingSection.current = section ?? null;\n    setPageId(id);\n  };\n\n  // biome-ignore lint/correctness/useExhaustiveDependencies: runs once per page change\n  useLayoutEffect(() => {\n    const box = scrollRef.current;\n    if (!box) return;\n    if (pendingSection.current) {\n      scrollToSection(pendingSection.current, false);\n      pendingSection.current = null;\n    } else box.scrollTop = 0;\n    setActiveSection(page.sections[0]?.id ?? null);\n  }, [pageId]);\n\n  const onScroll = () => {\n    const box = scrollRef.current;\n    if (!box) return;\n    let current = page.sections[0]?.id ?? null;\n    for (const s of page.sections) {\n      const el = box.querySelector<HTMLElement>(`[data-section=\"${s.id}\"]`);\n      if (el && el.offsetTop - 120 <= box.scrollTop) current = s.id;\n    }\n    if (box.scrollTop + box.clientHeight >= box.scrollHeight - 4) current = page.sections[page.sections.length - 1]?.id ?? current;\n    if (current !== activeSection) setActiveSection(current);\n  };\n\n  const onKeyDown = (e: KeyboardEvent<HTMLDivElement>) => {\n    if (search) return;\n    if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === \"k\") {\n      e.preventDefault();\n      setSearch(true);\n      return;\n    }\n    const t = e.target as HTMLElement;\n    if (t.tagName === \"INPUT\" || t.tagName === \"TEXTAREA\" || e.metaKey || e.ctrlKey || e.altKey) return;\n    if (e.key === \"/\") {\n      e.preventDefault();\n      setSearch(true);\n    } else if (e.key === \"Escape\") {\n      setDrawer(false);\n      setTocOpen(false);\n    } else if (e.key === \"[\" && prev) go(prev.id);\n    else if (e.key === \"]\" && next) go(next.id);\n  };\n\n  const sidebar = (\n    <nav aria-label=\"Documentation\" className=\"flex flex-col gap-6 px-3 py-5\">\n      {groups.map((g) => {\n        const closed = closedGroups.has(g);\n        return (\n          <div key={g}>\n            <button\n              aria-expanded={!closed}\n              className=\"group/g flex h-6 w-full cursor-pointer items-center justify-between rounded-md px-2.5 mb-1 text-left font-medium text-foreground text-xs outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n              onClick={() =>\n                setClosedGroups((c) => {\n                  const n = new Set(c);\n                  if (n.has(g)) n.delete(g);\n                  else n.add(g);\n                  return n;\n                })\n              }\n              type=\"button\"\n            >\n              {g}\n              <ChevronDownIcon className={cn(\"size-3.5 text-muted-foreground/70 transition-[rotate,color] duration-200 group-hover/g:text-foreground\", closed && \"-rotate-90\")} />\n            </button>\n            <AnimatePresence initial={false}>\n              {!closed && (\n                <motion.ul\n                  animate={{ height: \"auto\", opacity: 1 }}\n                  className=\"flex flex-col overflow-hidden\"\n                  exit={{ height: 0, opacity: 0 }}\n                  initial={{ height: 0, opacity: 0 }}\n                  transition={{ duration: 0.2, ease }}\n                >\n                  {pages\n                    .filter((p) => p.group === g)\n                    .map((p) => {\n                      const on = p.id === page.id;\n                      return (\n                        <li key={p.id}>\n                          <button\n                            aria-current={on ? \"page\" : undefined}\n                            className={cn(\n                              \"relative flex h-8 w-full cursor-pointer items-center rounded-lg px-2.5 text-left text-[13px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring\",\n                              on ? \"font-medium text-foreground\" : \"text-muted-foreground hover:bg-accent/60 hover:text-foreground\",\n                            )}\n                            onClick={() => go(p.id)}\n                            type=\"button\"\n                          >\n                            {on && <motion.span className=\"absolute inset-0 rounded-lg bg-accent\" layoutId=\"docs-nav-pill\" transition={spring} />}\n                            <span className=\"relative truncate\">{p.title}</span>\n                            {p.id === \"retries\" && <span className=\"relative ms-auto rounded-full bg-info/12 px-1.5 font-medium text-[10px] text-info-foreground\">New</span>}\n                          </button>\n                        </li>\n                      );\n                    })}\n                </motion.ul>\n              )}\n            </AnimatePresence>\n          </div>\n        );\n      })}\n    </nav>\n  );\n\n  const toc = (\n    <LayoutGroup id=\"docs-toc\">\n      <ul className=\"relative flex flex-col border-s\">\n        {page.sections.map((s) => {\n          const on = s.id === activeSection;\n          return (\n            <li className=\"relative\" key={s.id}>\n              {on && <motion.span className=\"absolute inset-y-1 -left-px w-0.5 rounded-full bg-foreground\" layoutId=\"toc-rail\" transition={spring} />}\n              <button\n                className={cn(\n                  \"w-full cursor-pointer rounded-e-md py-1.5 ps-3.5 pe-2 text-left text-[13px] outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring\",\n                  on ? \"font-medium text-foreground\" : \"text-muted-foreground hover:text-foreground\",\n                )}\n                onClick={() => go(page.id, s.id)}\n                type=\"button\"\n              >\n                {s.title}\n              </button>\n            </li>\n          );\n        })}\n      </ul>\n    </LayoutGroup>\n  );\n\n  return (\n    <MotionConfig reducedMotion=\"user\">\n      <div\n        className={cn(\"@container relative isolate flex h-[760px] w-full flex-col overflow-hidden bg-background text-foreground text-sm outline-none\", className)}\n        onKeyDown={onKeyDown}\n        tabIndex={-1}\n      >\n        <header className=\"flex h-14 shrink-0 items-center gap-3 border-b px-3 @3xl:px-5\">\n          <Button aria-label=\"Open navigation\" className=\"@4xl:hidden\" onClick={() => setDrawer(true)} size=\"icon-sm\" variant=\"ghost\">\n            <MenuIcon />\n          </Button>\n          <a className=\"flex shrink-0 items-center gap-2 rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring\" href=\"#top\" onClick={(e) => { e.preventDefault(); go(\"introduction\"); }}>\n            <svg aria-hidden className=\"size-6\" viewBox=\"0 0 24 24\">\n              <rect className=\"fill-foreground\" height=\"24\" rx=\"7\" width=\"24\" />\n              <path className=\"stroke-background\" d=\"M7 17 12 7l5 10M9.2 13h5.6\" fill=\"none\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"2\" />\n            </svg>\n            <span className=\"font-heading font-semibold tracking-tight\">{product}</span>\n            <span className=\"hidden text-muted-foreground @md:inline\">Docs</span>\n          </a>\n          <span className=\"hidden rounded-md border px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground @xl:inline\">{version}</span>\n          <LayoutGroup id=\"docs-top\">\n            <nav aria-label=\"Sections\" className=\"ms-2 hidden items-center gap-1 @4xl:flex\">\n              {navLinks.map((l) => {\n                const on = (l === \"API reference\" && page.group === \"API reference\") || (l === \"Guides\" && page.group !== \"API reference\");\n                return (\n                  <button\n                    aria-current={on ? \"page\" : undefined}\n                    className={cn(\n                      \"relative flex h-14 cursor-pointer items-center px-2.5 outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset\",\n                      on ? \"font-medium text-foreground\" : \"text-muted-foreground hover:text-foreground\",\n                    )}\n                    key={l}\n                    onClick={() => go(l === \"API reference\" ? (pages.find((p) => p.group === \"API reference\")?.id ?? pages[0].id) : pages[0].id)}\n                    type=\"button\"\n                  >\n                    {l}\n                    {on && <motion.span className=\"absolute inset-x-2.5 -bottom-px h-0.5 rounded-full bg-foreground\" layoutId=\"docs-top-line\" transition={spring} />}\n                  </button>\n                );\n              })}\n            </nav>\n          </LayoutGroup>\n          <div className=\"ms-auto flex items-center gap-2\">\n            <button\n              className=\"flex h-8 cursor-pointer items-center gap-2 rounded-lg border bg-background px-2.5 text-muted-foreground shadow-xs/5 outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring @xl:w-56 dark:bg-input/32\"\n              onClick={() => setSearch(true)}\n              type=\"button\"\n            >\n              <SearchIcon className=\"size-4\" />\n              <span className=\"hidden flex-1 text-left @xl:inline\">Search docs</span>\n              <Kbd className=\"hidden @xl:inline-flex\">⌘K</Kbd>\n            </button>\n            {dashboardHref && (\n              <Button className=\"hidden @2xl:inline-flex\" render={<a href={dashboardHref} rel=\"noreferrer\" target=\"_blank\" />} size=\"sm\" variant=\"outline\">\n                Dashboard\n              </Button>\n            )}\n          </div>\n        </header>\n\n        <div className=\"flex min-h-0 flex-1\">\n          <aside aria-label=\"Pages\" className=\"hidden w-60 shrink-0 overflow-y-auto border-e [scrollbar-width:thin] @4xl:block\">\n            {sidebar}\n          </aside>\n\n          <div className=\"min-w-0 flex-1 overflow-y-auto [scroll-padding-top:16px] [scrollbar-width:thin]\" onScroll={onScroll} ref={scrollRef}>\n            <div className=\"mx-auto flex max-w-[1040px] gap-10 px-4 pt-8 pb-16 @3xl:px-10\">\n              <motion.article\n                animate={{ opacity: 1, y: 0 }}\n                className=\"min-w-0 max-w-[680px] flex-1\"\n                initial={{ opacity: 0, y: 6 }}\n                key={page.id}\n                transition={{ duration: 0.2, ease }}\n              >\n                <div className=\"flex items-center gap-1.5 text-muted-foreground text-xs\">\n                  <span>{page.group}</span>\n                  <ChevronRightIcon className=\"size-3\" />\n                  <span className=\"text-foreground\">{page.title}</span>\n                </div>\n                <h1 className=\"mt-3 text-balance font-heading font-semibold text-3xl tracking-tight\">{page.title}</h1>\n                <p className=\"mt-3 text-pretty text-[17px] text-muted-foreground leading-7\">{page.lead}</p>\n                <div className=\"mt-4 flex items-center gap-3 text-muted-foreground text-xs\">\n                  <span>Updated {page.updated}</span>\n                  <span className=\"size-0.5 rounded-full bg-muted-foreground\" />\n                  <span>{page.minutes} min read</span>\n                </div>\n\n                {page.sections.length > 1 && (\n                  <div className=\"mt-6 rounded-xl border @6xl:hidden\">\n                    <button\n                      aria-expanded={tocOpen}\n                      className=\"flex h-10 w-full cursor-pointer items-center justify-between rounded-xl px-3.5 font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring\"\n                      onClick={() => setTocOpen((o) => !o)}\n                      type=\"button\"\n                    >\n                      On this page\n                      <ChevronDownIcon className={cn(\"size-4 text-muted-foreground transition-transform duration-200\", tocOpen && \"rotate-180\")} />\n                    </button>\n                    <AnimatePresence initial={false}>\n                      {tocOpen && (\n                        <motion.div\n                          animate={{ height: \"auto\", opacity: 1 }}\n                          className=\"overflow-hidden\"\n                          exit={{ height: 0, opacity: 0 }}\n                          initial={{ height: 0, opacity: 0 }}\n                          transition={{ duration: 0.2, ease }}\n                        >\n                          <div className=\"px-3.5 pb-3\">{toc}</div>\n                        </motion.div>\n                      )}\n                    </AnimatePresence>\n                  </div>\n                )}\n\n                {page.sections.map((s) => (\n                  <section className=\"mt-10 flex flex-col gap-4\" data-section={s.id} key={s.id}>\n                    <h2 className=\"group/h flex items-center gap-2 font-heading font-semibold text-xl tracking-tight\">\n                      {s.title}\n                      <button\n                        aria-label={`Link to ${s.title}`}\n                        className=\"cursor-pointer rounded text-muted-foreground opacity-0 outline-none transition-opacity focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring group-hover/h:opacity-100\"\n                        onClick={() => go(page.id, s.id)}\n                        type=\"button\"\n                      >\n                        <HashIcon className=\"size-4\" />\n                      </button>\n                    </h2>\n                    {s.blocks.map((b, i) => (\n                      <Block block={b} key={i} lang={lang} onLang={setLang} />\n                    ))}\n                  </section>\n                ))}\n\n                <div className=\"mt-12 flex flex-wrap items-center gap-3 border-t pt-6\">\n                  <AnimatePresence initial={false} mode=\"wait\">\n                    {feedback[page.id] ? (\n                      <motion.p animate={{ opacity: 1 }} className=\"text-muted-foreground\" exit={{ opacity: 0 }} initial={{ opacity: 0 }} key=\"thanks\" transition={{ duration: 0.15 }}>\n                        {feedback[page.id] === \"yes\" ? \"Thanks! Glad it helped.\" : \"Thanks. We read every one of these and fix the page.\"}\n                      </motion.p>\n                    ) : (\n                      <motion.div animate={{ opacity: 1 }} className=\"flex items-center gap-3\" exit={{ opacity: 0 }} initial={{ opacity: 0 }} key=\"ask\" transition={{ duration: 0.15 }}>\n                        <span className=\"text-muted-foreground\">Was this page helpful?</span>\n                        <Button onClick={() => setFeedback((f) => ({ ...f, [page.id]: \"yes\" }))} size=\"sm\" variant=\"outline\">\n                          <ThumbsUpIcon />\n                          Yes\n                        </Button>\n                        <Button onClick={() => setFeedback((f) => ({ ...f, [page.id]: \"no\" }))} size=\"sm\" variant=\"outline\">\n                          <ThumbsDownIcon />\n                          No\n                        </Button>\n                      </motion.div>\n                    )}\n                  </AnimatePresence>\n                  {editHref && (\n                    <a\n                      className=\"ms-auto flex items-center gap-1.5 rounded text-muted-foreground text-xs outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring @6xl:hidden\"\n                      href={editHref(page.id)}\n                      rel=\"noreferrer\"\n                      target=\"_blank\"\n                    >\n                      <PencilIcon className=\"size-3.5\" />\n                      Edit this page\n                    </a>\n                  )}\n                </div>\n\n                <div className=\"mt-6 grid grid-cols-1 gap-3 @xl:grid-cols-2\">\n                  {prev ? (\n                    <button\n                      className=\"group/pn flex cursor-pointer flex-col items-start gap-1 rounded-xl border p-4 text-left outline-none transition-[border-color,scale] duration-150 ease-out hover:border-foreground/20 focus-visible:ring-2 focus-visible:ring-ring active:scale-[0.98]\"\n                      onClick={() => go(prev.id)}\n                      type=\"button\"\n                    >\n                      <span className=\"flex items-center gap-1.5 text-muted-foreground text-xs\">\n                        <ArrowLeftIcon className=\"size-3.5 transition-transform duration-150 group-hover/pn:-translate-x-0.5\" />\n                        Previous <Kbd className=\"h-4 text-[10px]\">[</Kbd>\n                      </span>\n                      <span className=\"font-medium\">{prev.title}</span>\n                    </button>\n                  ) : (\n                    <span className=\"hidden @xl:block\" />\n                  )}\n                  {next && (\n                    <button\n                      className=\"group/pn flex cursor-pointer flex-col items-end gap-1 rounded-xl border p-4 text-right outline-none transition-[border-color,scale] duration-150 ease-out hover:border-foreground/20 focus-visible:ring-2 focus-visible:ring-ring active:scale-[0.98]\"\n                      onClick={() => go(next.id)}\n                      type=\"button\"\n                    >\n                      <span className=\"flex items-center gap-1.5 text-muted-foreground text-xs\">\n                        <Kbd className=\"h-4 text-[10px]\">]</Kbd> Next\n                        <ArrowRightIcon className=\"size-3.5 transition-transform duration-150 group-hover/pn:translate-x-0.5\" />\n                      </span>\n                      <span className=\"font-medium\">{next.title}</span>\n                    </button>\n                  )}\n                </div>\n              </motion.article>\n\n              <aside aria-label=\"On this page\" className=\"sticky top-8 hidden h-fit w-52 shrink-0 @6xl:block\">\n                <div className=\"mb-2 font-medium text-xs\">On this page</div>\n                {toc}\n                <div className=\"mt-6 flex flex-col gap-2 border-t pt-4 text-muted-foreground text-xs\">\n                  {editHref && (\n                    <a\n                      className=\"flex items-center gap-1.5 rounded outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n                      href={editHref(page.id)}\n                      rel=\"noreferrer\"\n                      target=\"_blank\"\n                    >\n                      <PencilIcon className=\"size-3.5\" />\n                      Edit this page\n                    </a>\n                  )}\n                  <button\n                    className=\"flex cursor-pointer items-center gap-1.5 rounded text-left outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n                    onClick={() => scrollRef.current?.scrollTo({ top: 0, behavior: \"smooth\" })}\n                    type=\"button\"\n                  >\n                    <ArrowLeftIcon className=\"size-3.5 rotate-90\" />\n                    Back to top\n                  </button>\n                </div>\n              </aside>\n            </div>\n          </div>\n        </div>\n\n        <AnimatePresence>\n          {drawer && (\n            <>\n              <motion.div\n                animate={{ opacity: 1 }}\n                aria-hidden\n                className=\"absolute inset-0 z-40 bg-black/32 @4xl:hidden\"\n                exit={{ opacity: 0 }}\n                initial={{ opacity: 0 }}\n                onClick={() => setDrawer(false)}\n              />\n              <motion.div\n                animate={{ x: 0 }}\n                aria-label=\"Documentation\"\n                aria-modal=\"true\"\n                className=\"absolute inset-y-2 left-2 z-50 flex w-[272px] max-w-[calc(100%-3rem)] flex-col overflow-hidden rounded-2xl border bg-background shadow-lg/10 @4xl:hidden\"\n                exit={{ x: \"-110%\" }}\n                initial={{ x: \"-110%\" }}\n                role=\"dialog\"\n                transition={{ type: \"spring\", stiffness: 420, damping: 40 }}\n              >\n                <div className=\"flex h-12 items-center justify-between border-b ps-4 pe-2\">\n                  <span className=\"font-medium\">\n                    {product} Docs <span className=\"font-mono text-muted-foreground text-xs\">{version}</span>\n                  </span>\n                  <Button aria-label=\"Close navigation\" onClick={() => setDrawer(false)} size=\"icon-sm\" variant=\"ghost\">\n                    <XIcon />\n                  </Button>\n                </div>\n                <div className=\"min-h-0 flex-1 overflow-y-auto\">{sidebar}</div>\n              </motion.div>\n            </>\n          )}\n        </AnimatePresence>\n\n        <AnimatePresence>{search && <SearchDialog onClose={() => setSearch(false)} onPick={go} pages={pages} />}</AnimatePresence>\n      </div>\n    </MotionConfig>\n  );\n}\n"
    }
  ]
}