{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "micro-code-slots",
  "type": "registry:component",
  "title": "Code Slots",
  "description": "A code or PIN display where every character is a vertical reel that spins and settles on its value, with a short glow when each reel locks. Changing the value replays it.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "micro",
    "pin",
    "code",
    "otp",
    "slot",
    "reel",
    "counter"
  ],
  "docs": "https://hyperblur.dev/effects/micro-code-slots",
  "files": [
    {
      "path": "registry/hyperblur/micro-code-slots.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/micro-code-slots.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface CodeSlotsProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"children\"> {\n  value?: string;\n  charset?: string;\n  duration?: number;\n  stagger?: number;\n  size?: number;\n  accent?: string;\n}\n\nconst css = `\n.hb-qs2 {\n  --hb-qs2-c: #2f7bff;\n  box-sizing: border-box;\n  display: inline-flex;\n  align-items: center;\n  gap: 0.3em;\n  font-family: ui-monospace, \"Geist Mono\", SFMono-Regular, Menlo, Consolas, monospace;\n  font-weight: 600;\n  line-height: 1;\n  color: #ededed;\n  font-variant-numeric: tabular-nums;\n  user-select: none;\n  -webkit-user-select: none;\n}\n.hb-qs2 *, .hb-qs2 *::before, .hb-qs2 *::after { box-sizing: border-box; }\n.hb-qs2-w {\n  position: relative;\n  width: 0.82em;\n  height: 1.3em;\n  overflow: hidden;\n  background: linear-gradient(180deg, #0c0c0c 0%, #171717 50%, #0c0c0c 100%);\n  border: 1px solid #262626;\n  border-radius: 0.2em;\n  animation: hb-qs2-lock 0.7s ease both;\n  animation-delay: calc(var(--hb-qs2-d) + var(--hb-qs2-t) * 0.88);\n}\n.hb-qs2-w::after {\n  content: \"\";\n  position: absolute;\n  inset: 0;\n  pointer-events: none;\n  background: linear-gradient(180deg, rgba(10, 10, 10, 0.85) 0%, transparent 28%, transparent 72%, rgba(10, 10, 10, 0.85) 100%);\n}\n.hb-qs2-s {\n  display: block;\n  transform: translateY(calc(var(--hb-qs2-n) * -1.3em));\n  animation: hb-qs2-spin var(--hb-qs2-t) cubic-bezier(0.16, 0.86, 0.3, 1.04) backwards;\n  animation-delay: var(--hb-qs2-d);\n  will-change: transform;\n}\n.hb-qs2-g {\n  display: grid;\n  place-items: center;\n  height: 1.3em;\n}\n.hb-qs2-x {\n  display: grid;\n  place-items: center;\n  width: 0.5em;\n  height: 1.3em;\n  color: #6b6b6b;\n}\n@keyframes hb-qs2-spin {\n  from { transform: translateY(0); }\n  to { transform: translateY(calc(var(--hb-qs2-n) * -1.3em)); }\n}\n@keyframes hb-qs2-lock {\n  0% { border-color: #262626; box-shadow: none; }\n  30% { border-color: var(--hb-qs2-c); box-shadow: 0 0 0.7em color-mix(in srgb, var(--hb-qs2-c) 55%, transparent); }\n  100% { border-color: #262626; box-shadow: none; }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-qs2-w, .hb-qs2-s { animation: none; }\n}\n`;\n\nexport function CodeSlots({\n  value = \"482916\",\n  charset = \"0123456789\",\n  duration = 1500,\n  stagger = 140,\n  size = 44,\n  accent = \"#2f7bff\",\n  className = \"\",\n  style,\n  ...rest\n}: CodeSlotsProps) {\n  const chars = Array.from(charset);\n  const len = Math.max(1, chars.length);\n  const vars = {\n    \"--hb-qs2-c\": accent,\n    fontSize: `${size}px`,\n    ...style,\n  } as React.CSSProperties;\n\n  let reel = 0;\n  const cells = Array.from(value).map((ch, i) => {\n    const target = chars.indexOf(ch);\n    if (target < 0) {\n      return (\n        <span key={`${i}-x`} className=\"hb-qs2-x\" aria-hidden=\"true\">\n          {ch === \" \" ? \" \" : ch}\n        </span>\n      );\n    }\n    const k = reel++;\n    const spins = 1 + (k % 3);\n    const extra = (k * 3 + 2) % len;\n    const count = spins * len + extra + 1;\n    const start = (((target - (count - 1)) % len) + len) % len;\n    const glyphs: string[] = [];\n    for (let j = 0; j < count; j++) glyphs.push(chars[(start + j) % len]);\n    const cellStyle = {\n      \"--hb-qs2-n\": count - 1,\n      \"--hb-qs2-t\": `${Math.max(1, duration)}ms`,\n      \"--hb-qs2-d\": `${(k * stagger).toFixed(0)}ms`,\n    } as React.CSSProperties;\n    return (\n      <span key={`${i}-${ch}-${value}`} className=\"hb-qs2-w\" style={cellStyle} aria-hidden=\"true\">\n        <span className=\"hb-qs2-s\">\n          {glyphs.map((g, j) => (\n            <span key={j} className=\"hb-qs2-g\">\n              {g}\n            </span>\n          ))}\n        </span>\n      </span>\n    );\n  });\n\n  return (\n    <>\n      <style href=\"hb-micro-code-slots\" precedence=\"default\">{css}</style>\n      <div\n        role=\"img\"\n        aria-label={value}\n        className={`hb-qs2 ${className}`}\n        style={vars}\n        {...rest}\n      >\n        {cells}\n      </div>\n    </>\n  );\n}\n"
    }
  ]
}