{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "auth-flow-new-device",
  "type": "registry:component",
  "title": "Auth Flow New Device",
  "description": "A new sign-in review with a dotted map that traces an arc from the usual location to the new one, device facts and a number-matching challenge: tap the number shown on the other device to approve it. Blocking the attempt plays a checklist of the lockdown steps taken.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "auth",
    "auth",
    "new device",
    "number matching",
    "security alert",
    "map",
    "approval"
  ],
  "docs": "https://hyperblur.dev/effects/auth-flow-new-device",
  "files": [
    {
      "path": "registry/hyperblur/auth-flow-new-device.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/auth-flow-new-device.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface AuthFlowDevicePlace {\n  label: string;\n  x: number;\n  y: number;\n}\n\nexport interface AuthFlowNewDeviceProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  device?: string;\n  browser?: string;\n  ip?: string;\n  when?: string;\n  attempt?: AuthFlowDevicePlace;\n  usual?: AuthFlowDevicePlace;\n  distance?: string;\n  numbers?: number[];\n  correct?: number;\n  onApprove?: (remember: boolean) => void;\n  onDeny?: () => void;\n  headingAs?: \"h1\" | \"h2\" | \"h3\";\n  accent?: string;\n}\n\nconst css = `\n@keyframes hb-vg4-pulse {\n  0% { transform: scale(1); opacity: .9; }\n  100% { transform: scale(5.5); opacity: 0; }\n}\n@keyframes hb-vg4-flow { to { stroke-dashoffset: -24; } }\n@keyframes hb-vg4-in {\n  from { opacity: 0; transform: translate3d(0, 10px, 0); }\n  to { opacity: 1; transform: translate3d(0, 0, 0); }\n}\n@keyframes hb-vg4-shake {\n  0%, 100% { transform: translateX(0); }\n  20% { transform: translateX(-8px); }\n  40% { transform: translateX(7px); }\n  60% { transform: translateX(-4px); }\n  80% { transform: translateX(2px); }\n}\n@keyframes hb-vg4-draw { to { stroke-dashoffset: 0; } }\n@keyframes hb-vg4-row {\n  from { opacity: 0; transform: translate3d(-8px, 0, 0); }\n  to { opacity: 1; transform: translate3d(0, 0, 0); }\n}\n.hb-vg4 {\n  --hb-vg4-accent: #fbbf24;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  padding: 72px 20px;\n  overflow: hidden;\n  isolation: isolate;\n  container-type: inline-size;\n  background: #0a0a0a;\n  color: #ededed;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-vg4 *, .hb-vg4 *::before, .hb-vg4 *::after { box-sizing: border-box; }\n.hb-vg4::before { content: \"\"; position: absolute; inset: 0; z-index: -1; background: radial-gradient(ellipse 45% 50% at 20% 30%, color-mix(in srgb, var(--hb-vg4-accent) 9%, transparent), transparent 70%); }\n.hb-vg4-wrap { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); max-width: 900px; margin: 0 auto; border: 1px solid #222; border-radius: 24px; background: #0e0e0e; box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 50px 100px -50px #000; overflow: hidden; }\n.hb-vg4-left { padding: 28px; border-right: 1px solid #1d1d1d; background: linear-gradient(180deg, #121212, #0d0d0d); }\n.hb-vg4-tag { display: inline-flex; align-items: center; gap: 8px; color: var(--hb-vg4-accent); font: 600 11.5px/1 var(--font-mono), ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; }\n.hb-vg4-tag i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, var(--hb-vg4-accent) 20%, transparent); font-style: normal; }\n.hb-vg4-title { margin: 14px 0 0; font-size: 28px; font-weight: 650; letter-spacing: -.03em; line-height: 1.12; }\n.hb-vg4-map { position: relative; margin-top: 20px; border: 1px solid #1f1f1f; border-radius: 16px; background: radial-gradient(ellipse at 50% 120%, #161616, #0b0b0b 70%); overflow: hidden; }\n.hb-vg4-map svg { display: block; width: 100%; height: auto; }\n.hb-vg4-dots circle { fill: #2a2a2a; }\n.hb-vg4-arc { stroke: var(--hb-vg4-accent); stroke-dasharray: 3 5; animation: hb-vg4-flow 1.2s linear infinite; }\n.hb-vg4-ping { fill: none; stroke: var(--hb-vg4-accent); stroke-width: .4; transform-box: fill-box; transform-origin: center; animation: hb-vg4-pulse 2s cubic-bezier(.2, .6, .3, 1) infinite; }\n.hb-vg4-ping:nth-of-type(2) { animation-delay: 1s; }\n.hb-vg4-pin { position: absolute; transform: translate(-50%, calc(-100% - 12px)); padding: 4px 8px; border: 1px solid #2a2a2a; border-radius: 7px; background: rgba(17,17,17,.92); color: #cfcfcf; font-size: 11px; font-weight: 550; white-space: nowrap; backdrop-filter: blur(6px); }\n.hb-vg4-pin[data-new=\"true\"] { border-color: color-mix(in srgb, var(--hb-vg4-accent) 50%, #2a2a2a); color: #ededed; }\n.hb-vg4-dist { position: absolute; right: 10px; bottom: 10px; padding: 3px 7px; border-radius: 6px; background: #151515; color: #8f8f8f; font: 500 10.5px/1.3 var(--font-mono), ui-monospace, monospace; }\n.hb-vg4-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 16px 0 0; border: 1px solid #1f1f1f; border-radius: 14px; background: #1f1f1f; overflow: hidden; }\n.hb-vg4-facts div { padding: 11px 14px; background: #0f0f0f; }\n.hb-vg4-facts dt { color: #6f6f6f; font-size: 11px; font-weight: 550; letter-spacing: .04em; text-transform: uppercase; }\n.hb-vg4-facts dd { margin: 4px 0 0; color: #ededed; font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.hb-vg4-facts dd code { font: 500 12.5px/1 var(--font-mono), ui-monospace, monospace; }\n.hb-vg4-right { display: flex; flex-direction: column; padding: 28px; }\n.hb-vg4-h { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.015em; }\n.hb-vg4-p { margin: 8px 0 0; color: #a1a1a1; font-size: 14px; line-height: 1.6; }\n.hb-vg4-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 20px; }\n.hb-vg4-nums[data-bad=\"true\"] { animation: hb-vg4-shake .42s ease; }\n.hb-vg4-num {\n  position: relative;\n  height: 78px;\n  border: 1px solid #262626;\n  border-radius: 16px;\n  background: linear-gradient(180deg, #171717, #111);\n  color: #ededed;\n  font: 600 32px/1 var(--font-grotesk), var(--font-sans), sans-serif;\n  font-variant-numeric: tabular-nums;\n  letter-spacing: -.02em;\n  cursor: pointer;\n  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 6px 14px -8px #000;\n  transition: transform .18s cubic-bezier(.3, 1.4, .5, 1), border-color .2s ease, background .2s ease, color .2s ease;\n}\n.hb-vg4-num:hover:not(:disabled) { transform: translateY(-2px); border-color: #3a3a3a; }\n.hb-vg4-num:active:not(:disabled) { transform: translateY(0) scale(.97); }\n.hb-vg4-num:focus-visible { outline: 2px solid var(--hb-vg4-accent); outline-offset: 2px; }\n.hb-vg4-num[data-state=\"wrong\"] { border-color: #7f1d1d; color: #fca5a5; background: #160b0b; }\n.hb-vg4-num[data-state=\"right\"] { border-color: color-mix(in srgb, var(--hb-vg4-accent) 60%, transparent); color: var(--hb-vg4-accent); background: color-mix(in srgb, var(--hb-vg4-accent) 8%, #111); }\n.hb-vg4-num:disabled { cursor: default; }\n.hb-vg4-msg { min-height: 20px; margin-top: 10px; color: #8f8f8f; font-size: 12.5px; }\n.hb-vg4-msg[data-bad=\"true\"] { color: #fca5a5; }\n.hb-vg4-remember { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 12px 14px; border: 1px solid #1f1f1f; border-radius: 12px; background: #0b0b0b; color: #cfcfcf; font-size: 13px; cursor: pointer; }\n.hb-vg4-sw { position: relative; flex: 0 0 auto; width: 36px; height: 20px; border-radius: 99px; background: #2a2a2a; transition: background .25s ease; }\n.hb-vg4-sw::after { content: \"\"; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #ededed; box-shadow: 0 1px 3px rgba(0,0,0,.5); transition: transform .3s cubic-bezier(.3, 1.4, .5, 1); }\n.hb-vg4-remember input { position: absolute; opacity: 0; width: 1px; height: 1px; }\n.hb-vg4-remember input:checked + .hb-vg4-sw { background: var(--hb-vg4-accent); }\n.hb-vg4-remember input:checked + .hb-vg4-sw::after { transform: translateX(16px); }\n.hb-vg4-remember input:focus-visible + .hb-vg4-sw { outline: 2px solid var(--hb-vg4-accent); outline-offset: 2px; }\n.hb-vg4-deny { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; margin-top: auto; padding: 0 16px; border: 1px solid #3b1414; border-radius: 12px; background: #140a0a; color: #fca5a5; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; transition: background .2s ease, border-color .2s ease, transform .12s ease; }\n.hb-vg4-deny:hover { background: #1c0d0d; border-color: #5b1d1d; }\n.hb-vg4-deny:active { transform: scale(.98); }\n.hb-vg4-deny:focus-visible { outline: 2px solid #f87171; outline-offset: 2px; }\n.hb-vg4-spacer { flex: 1 1 auto; min-height: 18px; }\n.hb-vg4-result { animation: hb-vg4-in .45s cubic-bezier(.2, .8, .2, 1) both; }\n.hb-vg4-badge { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; }\n.hb-vg4-badge[data-tone=\"ok\"] { background: color-mix(in srgb, var(--hb-vg4-accent) 14%, #111); color: var(--hb-vg4-accent); }\n.hb-vg4-badge[data-tone=\"bad\"] { background: #1a0c0c; color: #f87171; }\n.hb-vg4-badge path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: hb-vg4-draw .55s .1s cubic-bezier(.65, 0, .35, 1) forwards; }\n.hb-vg4-result .hb-vg4-h { margin-top: 16px; }\n.hb-vg4-list { display: grid; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }\n.hb-vg4-list li { display: flex; align-items: center; gap: 10px; color: #cfcfcf; font-size: 13.5px; animation: hb-vg4-row .4s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--d) * 220ms + 200ms); }\n.hb-vg4-list li span { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #1a1a1a; color: #86efac; }\n.hb-vg4-undo { align-self: flex-start; margin-top: 18px; padding: 0; border: 0; border-radius: 4px; background: none; color: #8f8f8f; font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }\n.hb-vg4-undo:hover { color: #ededed; }\n.hb-vg4-undo:focus-visible { outline: 2px solid var(--hb-vg4-accent); outline-offset: 2px; }\n@container (max-width: 700px) {\n  .hb-vg4-wrap { grid-template-columns: minmax(0, 1fr); }\n  .hb-vg4-left { border-right: 0; border-bottom: 1px solid #1d1d1d; padding: 22px; }\n  .hb-vg4-right { padding: 22px; }\n  .hb-vg4-title { font-size: 23px; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-vg4 *, .hb-vg4 *::before, .hb-vg4 *::after { animation: none !important; transition: none !important; }\n  .hb-vg4-badge path { stroke-dashoffset: 0; }\n  .hb-vg4-ping { display: none; }\n}\n`;\n\nfunction hash(n: number) {\n  let x = Math.imul(n ^ 0x27d4eb2d, 0x165667b1) >>> 0;\n  x = Math.imul(x ^ (x >>> 15), 0x85ebca77) >>> 0;\n  return (x ^ (x >>> 13)) >>> 0;\n}\n\nconst W = 360;\nconst H = 170;\n\nexport function AuthFlowNewDevice({\n  device = \"MacBook Air\",\n  browser = \"Chrome 131 on macOS\",\n  ip = \"84.17.46.203\",\n  when = \"Today, 9:41 AM\",\n  attempt = { label: \"Berlin, DE\", x: 0.66, y: 0.42 },\n  usual = { label: \"Lisbon, PT\", x: 0.22, y: 0.7 },\n  distance = \"2,312 km from your usual sign-in\",\n  numbers = [38, 72, 15],\n  correct = 72,\n  onApprove,\n  onDeny,\n  headingAs = \"h2\",\n  accent = \"#fbbf24\",\n  className = \"\",\n  style,\n  ...rest\n}: AuthFlowNewDeviceProps) {\n  const Heading = headingAs;\n  const uid = React.useId();\n  const [picked, setPicked] = React.useState<number | null>(null);\n  const [tries, setTries] = React.useState(0);\n  const [remember, setRemember] = React.useState(true);\n  const [result, setResult] = React.useState<\"pending\" | \"approved\" | \"denied\">(\"pending\");\n\n  const dots = React.useMemo(() => {\n    const out: { x: number; y: number; r: number }[] = [];\n    for (let y = 8; y < H; y += 10) {\n      for (let x = 8; x < W; x += 10) {\n        const h = hash(x * 131 + y * 7);\n        const nx = x / W;\n        const ny = y / H;\n        const land = Math.sin(nx * 7.1 + 0.6) * Math.cos(ny * 5.3 - 0.4) + Math.sin(nx * 13 + ny * 4) * 0.35;\n        if (land > -0.15 && h % 7 !== 0) out.push({ x, y, r: land > 0.45 ? 1.5 : 1.1 });\n      }\n    }\n    return out;\n  }, []);\n\n  const ax = attempt.x * W;\n  const ay = attempt.y * H;\n  const ux = usual.x * W;\n  const uy = usual.y * H;\n  const cx = (ax + ux) / 2;\n  const cy = Math.min(ay, uy) - 46;\n\n  const pick = (n: number) => {\n    if (picked === correct) return;\n    setPicked(n);\n    if (n === correct) {\n      window.setTimeout(() => {\n        setResult(\"approved\");\n        onApprove?.(remember);\n      }, 650);\n    } else setTries((t) => t + 1);\n  };\n\n  const deny = () => {\n    setResult(\"denied\");\n    onDeny?.();\n  };\n\n  const reset = () => {\n    setResult(\"pending\");\n    setPicked(null);\n    setTries(0);\n  };\n\n  const wrong = picked !== null && picked !== correct;\n  const vars = { \"--hb-vg4-accent\": accent, ...style } as React.CSSProperties;\n  const tick = (\n    <svg width=\"11\" height=\"11\" viewBox=\"0 0 12 12\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n      <path d=\"M2.5 6.5l2.2 2.2L9.5 3.8\" />\n    </svg>\n  );\n\n  return (\n    <section className={`hb-vg4 ${className}`} style={vars} aria-labelledby={`${uid}-t`} {...rest}>\n      <style href=\"hb-auth-flow-new-device\" precedence=\"default\">{css}</style>\n      <div className=\"hb-vg4-wrap\">\n        <div className=\"hb-vg4-left\">\n          <span className=\"hb-vg4-tag\">\n            <i aria-hidden=\"true\" />\n            New sign-in attempt\n          </span>\n          <Heading id={`${uid}-t`} className=\"hb-vg4-title\">Is this you signing in from {attempt.label.split(\",\")[0]}?</Heading>\n          <div className=\"hb-vg4-map\">\n            <svg viewBox={`0 0 ${W} ${H}`} role=\"img\" aria-label={`Map from ${usual.label} to ${attempt.label}`}>\n              <g className=\"hb-vg4-dots\">\n                {dots.map((d, i) => (\n                  <circle key={i} cx={d.x} cy={d.y} r={d.r} />\n                ))}\n              </g>\n              <path className=\"hb-vg4-arc\" d={`M${ux.toFixed(1)} ${uy.toFixed(1)}Q${cx.toFixed(1)} ${cy.toFixed(1)} ${ax.toFixed(1)} ${ay.toFixed(1)}`} fill=\"none\" strokeWidth=\"1.5\" strokeLinecap=\"round\" />\n              <circle cx={ux} cy={uy} r=\"4\" fill=\"#8f8f8f\" stroke=\"#0b0b0b\" strokeWidth=\"2\" />\n              <circle className=\"hb-vg4-ping\" cx={ax} cy={ay} r=\"4\" />\n              <circle className=\"hb-vg4-ping\" cx={ax} cy={ay} r=\"4\" />\n              <circle cx={ax} cy={ay} r=\"5\" fill={accent} stroke=\"#0b0b0b\" strokeWidth=\"2\" />\n            </svg>\n            <span className=\"hb-vg4-pin\" style={{ left: `${(usual.x * 100).toFixed(1)}%`, top: `${(usual.y * 100).toFixed(1)}%` }}>Usual · {usual.label}</span>\n            <span className=\"hb-vg4-pin\" data-new=\"true\" style={{ left: `${(attempt.x * 100).toFixed(1)}%`, top: `${(attempt.y * 100).toFixed(1)}%` }}>{attempt.label}</span>\n            <span className=\"hb-vg4-dist\">{distance}</span>\n          </div>\n          <dl className=\"hb-vg4-facts\">\n            <div>\n              <dt>Device</dt>\n              <dd>{device}</dd>\n            </div>\n            <div>\n              <dt>Browser</dt>\n              <dd>{browser}</dd>\n            </div>\n            <div>\n              <dt>IP address</dt>\n              <dd><code>{ip}</code></dd>\n            </div>\n            <div>\n              <dt>Time</dt>\n              <dd>{when}</dd>\n            </div>\n          </dl>\n        </div>\n        <div className=\"hb-vg4-right\">\n          {result === \"pending\" ? (\n            <>\n              <h3 className=\"hb-vg4-h\">Match the number</h3>\n              <p className=\"hb-vg4-p\">Your {device} is showing a two-digit number. Tap the same one here to let it in.</p>\n              <div className=\"hb-vg4-nums\" role=\"group\" aria-label=\"Numbers\" data-bad={wrong} key={tries}>\n                {numbers.map((n) => (\n                  <button\n                    key={n}\n                    type=\"button\"\n                    className=\"hb-vg4-num\"\n                    data-state={picked === n ? (n === correct ? \"right\" : \"wrong\") : \"idle\"}\n                    onClick={() => pick(n)}\n                    disabled={picked === correct}\n                    aria-describedby={`${uid}-m`}\n                  >\n                    {n}\n                  </button>\n                ))}\n              </div>\n              <div id={`${uid}-m`} className=\"hb-vg4-msg\" data-bad={wrong} aria-live=\"polite\">\n                {picked === correct ? \"Number matched. Approving\" : wrong ? (tries >= 2 ? \"Still no match. If you didn't start this, block it.\" : \"That's not the number on your device.\") : \"Not sure? Don't guess. Block it instead.\"}\n              </div>\n              <label className=\"hb-vg4-remember\">\n                Trust this device for 30 days\n                <input type=\"checkbox\" checked={remember} onChange={(e) => setRemember(e.target.checked)} />\n                <span className=\"hb-vg4-sw\" aria-hidden=\"true\" />\n              </label>\n              <div className=\"hb-vg4-spacer\" />\n              <button type=\"button\" className=\"hb-vg4-deny\" onClick={deny}>\n                <svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                  <circle cx=\"12\" cy=\"12\" r=\"9\" />\n                  <path d=\"M5.6 5.6l12.8 12.8\" />\n                </svg>\n                No, it wasn&apos;t me\n              </button>\n            </>\n          ) : result === \"approved\" ? (\n            <div className=\"hb-vg4-result\" role=\"status\">\n              <span className=\"hb-vg4-badge\" data-tone=\"ok\" aria-hidden=\"true\">\n                <svg width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.4\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n                  <path d=\"M5 12.5l4.5 4.5L19 7.5\" />\n                </svg>\n              </span>\n              <h3 className=\"hb-vg4-h\">{device} is signed in</h3>\n              <p className=\"hb-vg4-p\">{remember ? \"We'll skip this check on it for the next 30 days.\" : \"We'll ask again the next time it signs in.\"} You can remove it any time from Devices.</p>\n              <button type=\"button\" className=\"hb-vg4-undo\" onClick={reset}>Review again</button>\n            </div>\n          ) : (\n            <div className=\"hb-vg4-result\" role=\"status\">\n              <span className=\"hb-vg4-badge\" data-tone=\"bad\" aria-hidden=\"true\">\n                <svg width=\"22\" height=\"22\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n                  <path d=\"M12 3l7 3v5c0 4.5-3 8.3-7 10-4-1.7-7-5.5-7-10V6l7-3z\" />\n                </svg>\n              </span>\n              <h3 className=\"hb-vg4-h\">Attempt blocked</h3>\n              <p className=\"hb-vg4-p\">Good call. Here is what we did to lock things down.</p>\n              <ul className=\"hb-vg4-list\">\n                {[`Blocked ${device} in ${attempt.label}`, \"Signed out every other session\", \"Sent a password reset link\", \"Flagged IP for review\"].map((t, i) => (\n                  <li key={t} style={{ \"--d\": i } as React.CSSProperties}>\n                    <span>{tick}</span>\n                    {t}\n                  </li>\n                ))}\n              </ul>\n              <button type=\"button\" className=\"hb-vg4-undo\" onClick={reset}>It was me after all</button>\n            </div>\n          )}\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}