{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "notfound-search",
  "type": "registry:component",
  "title": "404 Search",
  "description": "A light 404 page with a serif headline, a live search that filters popular pages as you type, keyboard navigation and a hand-drawn arrow that draws itself in.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "not-found",
    "404",
    "error page",
    "search",
    "light",
    "serif",
    "filter"
  ],
  "docs": "https://hyperblur.dev/effects/notfound-search",
  "files": [
    {
      "path": "registry/hyperblur/notfound-search.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/notfound-search.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface NotfoundSearchLink {\n  label: string;\n  href: string;\n}\n\nexport interface NotfoundSearchPage {\n  title: string;\n  href: string;\n  description?: string;\n  section?: string;\n}\n\nexport interface NotfoundSearchProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\" | \"onChange\"> {\n  code?: string;\n  title?: string;\n  titleEmphasis?: string;\n  subtitle?: string;\n  pages?: NotfoundSearchPage[];\n  placeholder?: string;\n  note?: string;\n  limit?: number;\n  shortcut?: boolean;\n  primary?: NotfoundSearchLink;\n  secondary?: NotfoundSearchLink;\n  onReport?: () => void;\n  onSearch?: (query: string) => void;\n  accent?: string;\n}\n\nconst defaultPages: NotfoundSearchPage[] = [\n  { title: \"Pricing\", href: \"/pricing\", description: \"Plans for teams of every size\", section: \"Product\" },\n  { title: \"Documentation\", href: \"/docs\", description: \"Guides, API reference and SDKs\", section: \"Developers\" },\n  { title: \"Changelog\", href: \"/changelog\", description: \"Everything we shipped this month\", section: \"Product\" },\n  { title: \"Integrations\", href: \"/integrations\", description: \"Slack, Linear, GitHub and 40 more\", section: \"Product\" },\n  { title: \"Help center\", href: \"/help\", description: \"Billing, accounts and security answers\", section: \"Support\" },\n  { title: \"System status\", href: \"/status\", description: \"Live uptime for every region\", section: \"Support\" },\n  { title: \"Careers\", href: \"/careers\", description: \"12 open roles in Lisbon, Berlin and remote\", section: \"Company\" },\n  { title: \"Blog\", href: \"/blog\", description: \"Notes from the team building Fernway\", section: \"Company\" },\n];\n\nconst css = `\n.hb-kg3 {\n  --hb-kg3-accent: #e8613c;\n  --hb-kg3-ink: #1d1b17;\n  --hb-kg3-muted: #6f6a60;\n  --hb-kg3-line: rgba(29, 27, 23, .1);\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  overflow: hidden;\n  isolation: isolate;\n  container-type: inline-size;\n  background:\n    radial-gradient(rgba(29, 27, 23, .07) 1px, transparent 1px) 0 0 / 22px 22px,\n    #f7f5ef;\n  color: var(--hb-kg3-ink);\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-kg3 *, .hb-kg3 *::before, .hb-kg3 *::after { box-sizing: border-box; }\n.hb-kg3::before {\n  content: \"\";\n  position: absolute;\n  inset: 0;\n  z-index: -1;\n  background:\n    radial-gradient(40% 60% at 85% 20%, color-mix(in srgb, var(--hb-kg3-accent) 14%, transparent), transparent 70%),\n    linear-gradient(90deg, #f7f5ef 0, transparent 30%, transparent 70%, #f7f5ef 100%);\n  pointer-events: none;\n}\n.hb-kg3-inner {\n  display: grid;\n  gap: 40px;\n  max-width: 1120px;\n  margin: 0 auto;\n  padding: 72px 20px;\n  align-items: center;\n}\n.hb-kg3-copy { min-width: 0; }\n.hb-kg3-chip {\n  display: inline-flex;\n  align-items: center;\n  gap: 8px;\n  height: 28px;\n  padding: 0 12px;\n  border: 1px solid var(--hb-kg3-line);\n  border-radius: 999px;\n  background: #fff;\n  color: var(--hb-kg3-muted);\n  font-family: ui-monospace, \"SFMono-Regular\", Menlo, Consolas, monospace;\n  font-size: 11px;\n  letter-spacing: .06em;\n  box-shadow: 0 1px 2px rgba(29, 27, 23, .05);\n}\n.hb-kg3-chip b { color: var(--hb-kg3-accent); font-weight: 600; }\n.hb-kg3-title {\n  margin: 20px 0 0;\n  font-family: var(--font-sans, ui-sans-serif, system-ui, sans-serif);\n  font-size: clamp(50px, 8.2cqi, 92px);\n  font-weight: 400;\n  line-height: .95;\n  letter-spacing: -.025em;\n  text-wrap: balance;\n}\n.hb-kg3-title em { font-style: normal; color: var(--hb-kg3-accent); }\n.hb-kg3-sub {\n  margin: 18px 0 0;\n  max-width: 420px;\n  color: var(--hb-kg3-muted);\n  font-size: 16px;\n  line-height: 1.6;\n  text-wrap: pretty;\n}\n.hb-kg3-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-top: 28px; }\n.hb-kg3-btn {\n  display: inline-flex;\n  align-items: center;\n  gap: 8px;\n  min-height: 44px;\n  padding: 0 22px;\n  border-radius: 999px;\n  background: var(--hb-kg3-ink);\n  color: #f7f5ef;\n  font-size: 14px;\n  font-weight: 600;\n  text-decoration: none;\n  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 8px 20px -10px rgba(29, 27, 23, .6);\n  transition: transform .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s ease;\n}\n.hb-kg3-btn:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 14px 26px -12px rgba(29, 27, 23, .7); }\n.hb-kg3-link {\n  color: var(--hb-kg3-ink);\n  font-size: 14px;\n  font-weight: 500;\n  text-decoration: underline;\n  text-decoration-color: color-mix(in srgb, var(--hb-kg3-accent) 60%, transparent);\n  text-decoration-thickness: 1.5px;\n  text-underline-offset: 4px;\n  transition: text-decoration-color .2s ease;\n}\n.hb-kg3-link:hover { text-decoration-color: var(--hb-kg3-accent); }\n.hb-kg3 a:focus-visible, .hb-kg3 button:focus-visible { outline: 2px solid var(--hb-kg3-accent); outline-offset: 3px; }\n.hb-kg3-side { position: relative; min-width: 0; }\n.hb-kg3-card {\n  position: relative;\n  border: 1px solid var(--hb-kg3-line);\n  border-radius: 20px;\n  background: #fff;\n  box-shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 1px 2px rgba(29, 27, 23, .04), 0 24px 48px -24px rgba(29, 27, 23, .22);\n  overflow: hidden;\n}\n.hb-kg3-field {\n  display: flex;\n  align-items: center;\n  gap: 12px;\n  height: 58px;\n  padding: 0 18px;\n  border-bottom: 1px solid var(--hb-kg3-line);\n}\n.hb-kg3-field:focus-within { background: color-mix(in srgb, var(--hb-kg3-accent) 4%, #fff); }\n.hb-kg3-field svg { width: 18px; height: 18px; flex: none; color: var(--hb-kg3-muted); }\n.hb-kg3-input {\n  flex: 1;\n  min-width: 0;\n  height: 100%;\n  border: 0;\n  background: transparent;\n  color: var(--hb-kg3-ink);\n  font: inherit;\n  font-size: 16px;\n  outline: none;\n}\n.hb-kg3-input::placeholder { color: #a39d92; }\n.hb-kg3-input::-webkit-search-cancel-button { display: none; }\n.hb-kg3-kbd {\n  display: inline-grid;\n  place-items: center;\n  min-width: 24px;\n  height: 24px;\n  padding: 0 6px;\n  border: 1px solid var(--hb-kg3-line);\n  border-bottom-width: 2px;\n  border-radius: 6px;\n  color: var(--hb-kg3-muted);\n  font-family: ui-monospace, \"SFMono-Regular\", Menlo, Consolas, monospace;\n  font-size: 11px;\n}\n.hb-kg3-label {\n  display: flex;\n  justify-content: space-between;\n  padding: 12px 18px 6px;\n  color: #a39d92;\n  font-size: 11px;\n  font-weight: 600;\n  letter-spacing: .08em;\n  text-transform: uppercase;\n}\n.hb-kg3-list { list-style: none; margin: 0; padding: 0 8px 8px; }\n.hb-kg3-item {\n  display: flex;\n  align-items: center;\n  gap: 12px;\n  min-height: 52px;\n  padding: 8px 10px;\n  border-radius: 12px;\n  color: inherit;\n  text-decoration: none;\n  outline: none;\n  animation: hb-kg3-in .32s cubic-bezier(.2, .8, .2, 1) both;\n  animation-delay: var(--hb-kg3-i);\n  transition: background-color .15s ease;\n}\n.hb-kg3-item:hover, .hb-kg3-item:focus-visible { background: #f4f1ea; outline: none; }\n.hb-kg3-item:focus-visible { box-shadow: inset 0 0 0 1.5px var(--hb-kg3-accent); }\n.hb-kg3-icon {\n  display: grid;\n  place-items: center;\n  width: 34px;\n  height: 34px;\n  flex: none;\n  border: 1px solid var(--hb-kg3-line);\n  border-radius: 10px;\n  background: #faf8f3;\n  color: var(--hb-kg3-ink);\n  font-family: var(--font-sans, ui-sans-serif, system-ui, sans-serif);\n  font-size: 18px;\n}\n.hb-kg3-text { display: grid; min-width: 0; flex: 1; }\n.hb-kg3-name { font-size: 14px; font-weight: 600; }\n.hb-kg3-desc { overflow: hidden; color: var(--hb-kg3-muted); font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }\n.hb-kg3 mark { border-radius: 3px; background: color-mix(in srgb, var(--hb-kg3-accent) 22%, transparent); color: inherit; }\n.hb-kg3-tag { display: none; color: #a39d92; font-size: 12px; }\n.hb-kg3-go { width: 16px; height: 16px; flex: none; color: var(--hb-kg3-accent); opacity: 0; transform: translateX(-4px); transition: opacity .15s ease, transform .15s ease; }\n.hb-kg3-item:hover .hb-kg3-go, .hb-kg3-item:focus-visible .hb-kg3-go { opacity: 1; transform: none; }\n.hb-kg3-empty { padding: 22px 18px 26px; color: var(--hb-kg3-muted); font-size: 14px; line-height: 1.5; }\n.hb-kg3-empty button {\n  margin-left: 4px;\n  padding: 0;\n  border: 0;\n  background: none;\n  color: var(--hb-kg3-ink);\n  font: inherit;\n  font-weight: 600;\n  text-decoration: underline;\n  text-underline-offset: 3px;\n  cursor: pointer;\n}\n.hb-kg3-doodle { display: none; position: absolute; left: -150px; top: -54px; width: 160px; height: 100px; pointer-events: none; color: var(--hb-kg3-ink); }\n.hb-kg3-note {\n  position: absolute;\n  left: 0;\n  top: 0;\n  font-family: var(--font-sans, ui-sans-serif, system-ui, sans-serif);\n  font-size: 21px;\n    white-space: nowrap;\n  transform: rotate(-6deg);\n  opacity: 0;\n  animation: hb-kg3-fade .5s ease .3s forwards;\n}\n.hb-kg3-doodle svg { position: absolute; left: 40px; top: 24px; width: 110px; height: 76px; overflow: visible; }\n.hb-kg3-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: hb-kg3-draw 1.2s cubic-bezier(.6, 0, .3, 1) .6s forwards; }\n.hb-kg3-head { opacity: 0; animation: hb-kg3-fade .25s ease 1.7s forwards; }\n@container (min-width: 520px) {\n  .hb-kg3-tag { display: block; }\n}\n@container (min-width: 900px) {\n  .hb-kg3-inner { grid-template-columns: 1fr 1.05fr; gap: 72px; padding: 96px 40px; }\n  .hb-kg3-doodle { display: block; }\n}\n@keyframes hb-kg3-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }\n@keyframes hb-kg3-draw { to { stroke-dashoffset: 0; } }\n@keyframes hb-kg3-fade { to { opacity: 1; } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-kg3-item, .hb-kg3-note, .hb-kg3-head { animation: none; opacity: 1; }\n  .hb-kg3-draw { animation: none; stroke-dashoffset: 0; }\n  .hb-kg3-btn, .hb-kg3-item, .hb-kg3-go { transition: none; }\n  .hb-kg3-btn:hover { transform: none; }\n}\n`;\n\nfunction highlight(text: string, query: string) {\n  if (!query) return text;\n  const at = text.toLowerCase().indexOf(query.toLowerCase());\n  if (at < 0) return text;\n  return (\n    <>\n      {text.slice(0, at)}\n      <mark>{text.slice(at, at + query.length)}</mark>\n      {text.slice(at + query.length)}\n    </>\n  );\n}\n\nexport function NotfoundSearch({\n  code = \"404\",\n  title = \"Page not found\",\n  titleEmphasis = \"not found\",\n  subtitle = \"The page you asked for isn't here anymore. Search for it, or jump to one of the pages people visit most.\",\n  pages = defaultPages,\n  placeholder = \"Search pages, docs and guides\",\n  note = \"start typing\",\n  limit = 5,\n  shortcut = false,\n  primary = { label: \"Back to home\", href: \"/\" },\n  secondary = { label: \"Report a broken link\", href: \"mailto:hello@fernway.co?subject=Broken%20link\" },\n  onReport,\n  onSearch,\n  accent = \"#e8613c\",\n  className = \"\",\n  style,\n  ...rest\n}: NotfoundSearchProps) {\n  const uid = React.useId().replace(/[^a-zA-Z0-9_-]/g, \"\");\n  const [query, setQuery] = React.useState(\"\");\n  const inputRef = React.useRef<HTMLInputElement>(null);\n  const listRef = React.useRef<HTMLUListElement>(null);\n  const vars = { \"--hb-kg3-accent\": accent, ...style } as React.CSSProperties;\n\n  const q = query.trim();\n  const results = React.useMemo(() => {\n    const needle = q.toLowerCase();\n    const found = needle\n      ? pages.filter((p) => `${p.title} ${p.description ?? \"\"} ${p.section ?? \"\"}`.toLowerCase().includes(needle))\n      : pages;\n    return found.slice(0, limit);\n  }, [pages, q, limit]);\n\n  React.useEffect(() => {\n    if (!shortcut) return;\n    const onKey = (e: KeyboardEvent) => {\n      if (e.key !== \"/\" || e.metaKey || e.ctrlKey) return;\n      const t = e.target as HTMLElement | null;\n      if (t && (t.tagName === \"INPUT\" || t.tagName === \"TEXTAREA\" || t.isContentEditable)) return;\n      e.preventDefault();\n      inputRef.current?.focus();\n    };\n    document.addEventListener(\"keydown\", onKey);\n    return () => document.removeEventListener(\"keydown\", onKey);\n  }, [shortcut]);\n\n  const update = (value: string) => {\n    setQuery(value);\n    onSearch?.(value);\n  };\n\n  const links = () => Array.from(listRef.current?.querySelectorAll<HTMLAnchorElement>(\"a\") ?? []);\n\n  const onInputKey = (e: React.KeyboardEvent<HTMLInputElement>) => {\n    if (e.key === \"ArrowDown\") {\n      e.preventDefault();\n      links()[0]?.focus();\n    } else if (e.key === \"Enter\") {\n      const first = links()[0];\n      if (first && q) {\n        e.preventDefault();\n        first.click();\n      }\n    } else if (e.key === \"Escape\" && query) {\n      e.preventDefault();\n      update(\"\");\n    }\n  };\n\n  const onListKey = (e: React.KeyboardEvent<HTMLUListElement>) => {\n    const all = links();\n    const at = all.indexOf(document.activeElement as HTMLAnchorElement);\n    if (at < 0) return;\n    if (e.key === \"ArrowDown\") {\n      e.preventDefault();\n      all[Math.min(at + 1, all.length - 1)]?.focus();\n    } else if (e.key === \"ArrowUp\") {\n      e.preventDefault();\n      if (at === 0) inputRef.current?.focus();\n      else all[at - 1]?.focus();\n    } else if (e.key === \"Escape\") {\n      e.preventDefault();\n      inputRef.current?.focus();\n    }\n  };\n\n  const emIndex = titleEmphasis ? title.indexOf(titleEmphasis) : -1;\n  const heading =\n    emIndex >= 0 ? (\n      <>\n        {title.slice(0, emIndex)}\n        <em>{titleEmphasis}</em>\n        {title.slice(emIndex + titleEmphasis.length)}\n      </>\n    ) : (\n      title\n    );\n\n  return (\n    <section className={`hb-kg3 ${className}`} style={vars} aria-labelledby={`${uid}-title`} {...rest}>\n      <style href=\"hb-notfound-search\" precedence=\"default\">{css}</style>\n      <div className=\"hb-kg3-inner\">\n        <div className=\"hb-kg3-copy\">\n          <span className=\"hb-kg3-chip\"><b>{code}</b> Not found</span>\n          <h1 id={`${uid}-title`} className=\"hb-kg3-title\">{heading}</h1>\n          {subtitle && <p className=\"hb-kg3-sub\">{subtitle}</p>}\n          <div className=\"hb-kg3-actions\">\n            <a className=\"hb-kg3-btn\" href={primary.href}>{primary.label}</a>\n            <a className=\"hb-kg3-link\" href={secondary.href} onClick={onReport}>{secondary.label}</a>\n          </div>\n        </div>\n        <div className=\"hb-kg3-side\">\n          <div className=\"hb-kg3-doodle\" aria-hidden=\"true\">\n            <span className=\"hb-kg3-note\">{note}</span>\n            <svg viewBox=\"0 0 110 76\" fill=\"none\">\n              <defs>\n                <mask id={`${uid}-m`} maskUnits=\"userSpaceOnUse\" x=\"-10\" y=\"-10\" width=\"130\" height=\"96\">\n                  <path className=\"hb-kg3-draw\" d=\"M6 4C8 36 44 60 100 56\" pathLength={1} stroke=\"#fff\" strokeWidth=\"6\" strokeLinecap=\"round\" />\n                </mask>\n              </defs>\n              <path d=\"M6 4C8 36 44 60 100 56\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeDasharray=\"4 5\" mask={`url(#${uid}-m)`} />\n              <path className=\"hb-kg3-head\" d=\"M91 48.5 101 56l-9.5 7.5\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n            </svg>\n          </div>\n          <div className=\"hb-kg3-card\">\n            <label className=\"hb-kg3-field\">\n              <svg viewBox=\"0 0 20 20\" fill=\"none\" aria-hidden=\"true\">\n                <circle cx=\"9\" cy=\"9\" r=\"6\" stroke=\"currentColor\" strokeWidth=\"1.6\" />\n                <path d=\"m13.5 13.5 3.5 3.5\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" />\n              </svg>\n              <input\n                ref={inputRef}\n                className=\"hb-kg3-input\"\n                type=\"search\"\n                value={query}\n                placeholder={placeholder}\n                aria-label=\"Search pages\"\n                aria-controls={`${uid}-list`}\n                autoComplete=\"off\"\n                spellCheck={false}\n                onChange={(e) => update(e.target.value)}\n                onKeyDown={onInputKey}\n              />\n              {(query || shortcut) && <span className=\"hb-kg3-kbd\" aria-hidden=\"true\">{query ? \"esc\" : \"/\"}</span>}\n            </label>\n            <div className=\"hb-kg3-label\">\n              <span>{q ? \"Results\" : \"Popular pages\"}</span>\n              <span aria-live=\"polite\">{q ? `${results.length} ${results.length === 1 ? \"match\" : \"matches\"}` : \"\"}</span>\n            </div>\n            {results.length > 0 ? (\n              <ul id={`${uid}-list`} ref={listRef} className=\"hb-kg3-list\" onKeyDown={onListKey}>\n                {results.map((page, i) => (\n                  <li key={page.href + page.title}>\n                    <a className=\"hb-kg3-item\" href={page.href} style={{ \"--hb-kg3-i\": `${i * 40}ms` } as React.CSSProperties}>\n                      <span className=\"hb-kg3-icon\" aria-hidden=\"true\">{page.title.charAt(0)}</span>\n                      <span className=\"hb-kg3-text\">\n                        <span className=\"hb-kg3-name\">{highlight(page.title, q)}</span>\n                        {page.description && <span className=\"hb-kg3-desc\">{highlight(page.description, q)}</span>}\n                      </span>\n                      {page.section && <span className=\"hb-kg3-tag\">{page.section}</span>}\n                      <svg className=\"hb-kg3-go\" viewBox=\"0 0 16 16\" fill=\"none\" aria-hidden=\"true\">\n                        <path d=\"M3 8h9m-3.5-3.5L12 8l-3.5 3.5\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n                      </svg>\n                    </a>\n                  </li>\n                ))}\n              </ul>\n            ) : (\n              <p className=\"hb-kg3-empty\" id={`${uid}-list`}>\n                No pages match &ldquo;{q}&rdquo;.\n                <button type=\"button\" onClick={() => { update(\"\"); inputRef.current?.focus(); }}>Clear search</button>\n              </p>\n            )}\n          </div>\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}