{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "waitlist-queue-ticket",
  "type": "registry:component",
  "title": "Waitlist Queue Ticket",
  "description": "A light waitlist with an odometer of people in line and a ticket machine where a queue marches toward the gate. Joining drops you into the line and prints a perforated ticket with your number, wave and opening date.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "waitlist",
    "waitlist",
    "counter",
    "ticket",
    "queue",
    "light",
    "section"
  ],
  "docs": "https://hyperblur.dev/effects/waitlist-queue-ticket",
  "files": [
    {
      "path": "registry/hyperblur/waitlist-queue-ticket.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/waitlist-queue-ticket.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface WaitlistQueueTicketProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  eyebrow?: string;\n  title?: string;\n  subtitle?: string;\n  product?: string;\n  initialCount?: number;\n  live?: boolean;\n  perWave?: number;\n  waves?: string[];\n  ctaLabel?: string;\n  onJoin?: (email: string, position: number) => void | Promise<void>;\n  accent?: string;\n}\n\nfunction hash(n: number) {\n  let x = (n * 2654435761) >>> 0;\n  x ^= x >>> 15;\n  x = Math.imul(x, 2246822519) >>> 0;\n  x ^= x >>> 13;\n  return x >>> 0;\n}\n\nfunction seedOf(s: string) {\n  let h = 7;\n  for (let i = 0; i < s.length; i++) h = (Math.imul(h, 33) + s.charCodeAt(i)) >>> 0;\n  return h;\n}\n\nconst css = `\n@keyframes hb-wd7-march { from { transform: translateX(0); } to { transform: translateX(-28px); } }\n@keyframes hb-wd7-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }\n@keyframes hb-wd7-print { 0% { transform: translateY(-100%); } 100% { transform: translateY(0); } }\n@keyframes hb-wd7-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }\n@keyframes hb-wd7-you { 0% { transform: translateY(-30px) scale(0.6); opacity: 0; } 60% { transform: translateY(2px) scale(1.1); opacity: 1; } 100% { transform: none; } }\n@keyframes hb-wd7-spin { to { transform: rotate(360deg); } }\n.hb-wd7 {\n  --hb-wd7-accent: #4f46e5;\n  position: relative;\n  box-sizing: border-box;\n  width: 100%;\n  container-type: inline-size;\n  background: #f7f5ef;\n  color: #16151a;\n  font-family: inherit;\n  overflow: hidden;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-wd7 *, .hb-wd7 *::before, .hb-wd7 *::after { box-sizing: border-box; }\n.hb-wd7-in { max-width: 1120px; margin: 0 auto; padding: 80px 20px 96px; display: grid; gap: 44px; align-items: center; }\n@container (min-width: 880px) { .hb-wd7-in { grid-template-columns: 1fr 1fr; gap: 56px; } }\n.hb-wd7-eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 11px; border-radius: 999px; background: #fff; border: 1px solid rgba(22,21,26,0.08); font: 500 12px/1 var(--font-mono, monospace); color: #4b4a52; }\n.hb-wd7-eyebrow i { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,0.2); font-style: normal; }\n.hb-wd7-title { margin: 18px 0 14px; font: 600 clamp(34px, 5.4cqw, 58px)/0.98 var(--font-grotesk, inherit); letter-spacing: -0.04em; }\n.hb-wd7-sub { margin: 0 0 26px; font-size: 16px; line-height: 1.6; color: #5d5b62; max-width: 42ch; }\n.hb-wd7-counter { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }\n.hb-wd7-odo { display: inline-flex; padding: 6px 8px; border-radius: 12px; background: #16151a; color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 10px 20px -12px rgba(22,21,26,0.6); }\n.hb-wd7-digit { position: relative; width: 0.62em; height: 1.1em; overflow: hidden; font: 600 26px/1.1 var(--font-mono, monospace); font-variant-numeric: tabular-nums; text-align: center; }\n.hb-wd7-digit > span { position: absolute; left: 0; right: 0; top: 0; display: flex; flex-direction: column; transition: transform 0.7s cubic-bezier(0.34, 1.2, 0.5, 1); }\n.hb-wd7-sep { width: 0.3em; font: 600 26px/1.1 var(--font-mono, monospace); color: #8b8a92; text-align: center; }\n.hb-wd7-counter small { font-size: 13px; color: #5d5b62; line-height: 1.4; }\n.hb-wd7-form { display: flex; gap: 6px; padding: 6px; border-radius: 16px; background: #fff; border: 1px solid rgba(22,21,26,0.1); box-shadow: 0 20px 40px -24px rgba(22,21,26,0.3); max-width: 460px; transition: border-color 0.2s ease, box-shadow 0.2s ease; }\n.hb-wd7-form:focus-within { border-color: var(--hb-wd7-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--hb-wd7-accent) 14%, transparent), 0 20px 40px -24px rgba(22,21,26,0.3); }\n.hb-wd7-form[data-error=\"true\"] { border-color: #dc2626; }\n.hb-wd7-form input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0 12px; font: 400 15px/1 inherit; font-family: inherit; color: #16151a; outline: none; }\n.hb-wd7-form input::placeholder { color: #a3a1a8; }\n.hb-wd7-btn { appearance: none; border: 0; height: 46px; padding: 0 20px; border-radius: 11px; background: var(--hb-wd7-accent); color: #fff; font: 600 14px/1 inherit; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; box-shadow: inset 0 1px 0 rgba(255,255,255,0.25), 0 8px 18px -10px var(--hb-wd7-accent); transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.5, 1), filter 0.2s ease; }\n.hb-wd7-btn:hover { filter: brightness(1.1); }\n.hb-wd7-btn:active { transform: scale(0.97); }\n.hb-wd7-btn:disabled { cursor: progress; }\n.hb-wd7-btn:focus-visible { outline: 2px solid #16151a; outline-offset: 3px; }\n.hb-wd7-spin { width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; animation: hb-wd7-spin 0.7s linear infinite; }\n.hb-wd7-err { margin: 8px 0 0 4px; font-size: 12.5px; color: #dc2626; }\n.hb-wd7-note { margin: 12px 0 0 4px; font-size: 12.5px; color: #8b8a92; }\n.hb-wd7-stage { position: relative; display: grid; gap: 0; justify-items: center; }\n.hb-wd7-machine { position: relative; z-index: 2; width: min(360px, 100%); padding: 16px 18px 20px; border-radius: 22px 22px 14px 14px; background: linear-gradient(180deg, #24232a, #16151a); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 30px 50px -26px rgba(22,21,26,0.7); }\n.hb-wd7-mtop { display: flex; align-items: center; justify-content: space-between; font: 500 11px/1 var(--font-mono, monospace); color: #9d9ca5; letter-spacing: 0.06em; text-transform: uppercase; }\n.hb-wd7-lamp { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 10px #22c55e; }\n.hb-wd7-line { position: relative; height: 44px; margin: 14px 0 12px; border-radius: 10px; background: #0e0d12; overflow: hidden; box-shadow: inset 0 2px 6px rgba(0,0,0,0.6); }\n.hb-wd7-line::after { content: \"\"; position: absolute; inset: 0; background: linear-gradient(90deg, #0e0d12 0%, transparent 14%, transparent 86%, #0e0d12 100%); pointer-events: none; }\n.hb-wd7-people { position: absolute; left: 0; bottom: 8px; display: flex; gap: 10px; padding-left: 12px; animation: hb-wd7-march 1.6s linear infinite; }\n.hb-wd7-person { flex: none; width: 18px; display: grid; justify-items: center; gap: 2px; animation: hb-wd7-bob 0.8s ease-in-out infinite; }\n.hb-wd7-person::before { content: \"\"; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }\n.hb-wd7-person::after { content: \"\"; width: 14px; height: 12px; border-radius: 7px 7px 3px 3px; background: currentColor; }\n.hb-wd7-you { position: absolute; left: 50%; bottom: 8px; color: var(--hb-wd7-accent); filter: drop-shadow(0 0 6px var(--hb-wd7-accent)); animation: hb-wd7-you 0.6s cubic-bezier(0.34, 1.5, 0.5, 1) both; }\n.hb-wd7-gate { position: absolute; left: 10px; top: 6px; bottom: 6px; width: 3px; border-radius: 2px; background: var(--hb-wd7-accent); box-shadow: 0 0 10px var(--hb-wd7-accent); z-index: 2; }\n.hb-wd7-slot { height: 8px; border-radius: 4px; background: #050407; box-shadow: inset 0 2px 3px rgba(0,0,0,0.8), 0 1px 0 rgba(255,255,255,0.08); }\n.hb-wd7-feed { position: relative; z-index: 1; width: min(310px, 88%); margin-top: -6px; overflow: hidden; padding: 0 10px 24px; }\n.hb-wd7-ticket { position: relative; background: #fff; border-radius: 0 0 14px 14px; box-shadow: 0 18px 30px -18px rgba(22,21,26,0.45); animation: hb-wd7-print 1.1s cubic-bezier(0.3, 0.7, 0.2, 1) both; color: #16151a; }\n.hb-wd7-ticket[data-ghost=\"true\"] { background: repeating-linear-gradient(135deg, #fbfaf7 0 8px, #f3f1ea 8px 16px); color: #a3a1a8; box-shadow: none; border: 1px dashed rgba(22,21,26,0.18); border-top: 0; animation: none; }\n.hb-wd7-tmain { padding: 22px 20px 16px; display: grid; gap: 4px; }\n.hb-wd7-tlabel { font: 500 10.5px/1 var(--font-mono, monospace); letter-spacing: 0.14em; text-transform: uppercase; color: #8b8a92; }\n.hb-wd7-tnum { font: 700 44px/1 var(--font-grotesk, inherit); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }\n.hb-wd7-ticket:not([data-ghost=\"true\"]) .hb-wd7-tnum { color: var(--hb-wd7-accent); }\n.hb-wd7-trow { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 12.5px; }\n.hb-wd7-trow span { display: grid; gap: 3px; }\n.hb-wd7-trow b { font-weight: 600; }\n.hb-wd7-perf { position: relative; height: 0; border-top: 2px dashed rgba(22,21,26,0.15); margin: 0 12px; }\n.hb-wd7-perf::before, .hb-wd7-perf::after { content: \"\"; position: absolute; top: -9px; width: 16px; height: 16px; border-radius: 50%; background: #f7f5ef; }\n.hb-wd7-perf::before { left: -21px; }\n.hb-wd7-perf::after { right: -21px; }\n.hb-wd7-stub { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px 16px; }\n.hb-wd7-bars { display: flex; gap: 1.5px; height: 30px; align-items: stretch; }\n.hb-wd7-bars i { display: block; background: currentColor; font-style: normal; }\n.hb-wd7-stub small { font: 500 10.5px/1.3 var(--font-mono, monospace); color: #8b8a92; text-align: right; }\n@media (prefers-reduced-motion: reduce) {\n  .hb-wd7 *, .hb-wd7 *::before, .hb-wd7 *::after { animation: none !important; transition: none !important; }\n}\n`;\n\nfunction Odometer({ value }: { value: number }) {\n  const s = value.toLocaleString(\"en-US\");\n  return (\n    <span className=\"hb-wd7-odo\" aria-hidden=\"true\">\n      {s.split(\"\").map((ch, i) =>\n        ch === \",\" ? (\n          <span key={`s${i}`} className=\"hb-wd7-sep\">,</span>\n        ) : (\n          <span key={`d${s.length - i}`} className=\"hb-wd7-digit\">\n            <span style={{ transform: `translateY(-${Number(ch) * 10}%)` }}>\n              {Array.from({ length: 10 }, (_, n) => (\n                <span key={n} style={{ height: \"1.1em\" }}>{n}</span>\n              ))}\n            </span>\n          </span>\n        ),\n      )}\n    </span>\n  );\n}\n\nexport function WaitlistQueueTicket({\n  eyebrow = \"Queue is moving\",\n  title = \"Take a number. We let people in every Tuesday.\",\n  subtitle = \"Lumen opens to a new wave each week so onboarding stays personal. Grab your spot and we will send your ticket with the exact week you get in.\",\n  product = \"Lumen\",\n  initialCount = 12482,\n  live = true,\n  perWave = 1500,\n  waves = [\"Nov 18\", \"Nov 25\", \"Dec 2\", \"Dec 9\", \"Dec 16\", \"Jan 6\", \"Jan 13\", \"Jan 20\", \"Jan 27\"],\n  ctaLabel = \"Take a number\",\n  onJoin,\n  accent = \"#4f46e5\",\n  className = \"\",\n  style,\n  ...rest\n}: WaitlistQueueTicketProps) {\n  const uid = React.useId().replace(/:/g, \"\");\n  const [count, setCount] = React.useState(initialCount);\n  const [email, setEmail] = React.useState(\"\");\n  const [error, setError] = React.useState<string | null>(null);\n  const [status, setStatus] = React.useState<\"idle\" | \"saving\" | \"joined\">(\"idle\");\n  const [position, setPosition] = React.useState(0);\n\n  React.useEffect(() => {\n    if (!live || window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches) return;\n    let tick = 0;\n    const t = setInterval(() => {\n      tick++;\n      setCount((c) => c + 1 + (hash(tick) % 3));\n    }, 2600);\n    return () => clearInterval(t);\n  }, [live]);\n\n  const submit = async (e: React.FormEvent) => {\n    e.preventDefault();\n    if (!/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(email)) {\n      setError(\"That email looks incomplete.\");\n      return;\n    }\n    setError(null);\n    setStatus(\"saving\");\n    const pos = count + 1;\n    try {\n      if (onJoin) await onJoin(email, pos);\n      else await new Promise((r) => setTimeout(r, 800));\n      setPosition(pos);\n      setCount(pos);\n      setStatus(\"joined\");\n    } catch {\n      setStatus(\"idle\");\n      setError(\"Something went wrong. Try again in a moment.\");\n    }\n  };\n\n  const shownPos = status === \"joined\" ? position : count + 1;\n  const wave = Math.floor((shownPos - 1) / perWave);\n  const waveLabel = waves[Math.min(wave, waves.length - 1)] ?? \"Soon\";\n  const ahead = Math.max(0, shownPos - 1 - Math.min(wave, waves.length - 1) * perWave);\n  const seed = seedOf(status === \"joined\" ? email : \"ghost\");\n  const bars = Array.from({ length: 34 }, (_, i) => 1 + (hash(seed + i) % 3));\n\n  return (\n    <section className={`hb-wd7 ${className}`} style={{ \"--hb-wd7-accent\": accent, ...style } as React.CSSProperties} {...rest}>\n      <style href=\"hb-waitlist-queue-ticket\" precedence=\"default\">{css}</style>\n      <div className=\"hb-wd7-in\">\n        <div>\n          <span className=\"hb-wd7-eyebrow\">\n            <i aria-hidden=\"true\" />\n            {eyebrow}\n          </span>\n          <h2 className=\"hb-wd7-title\">{title}</h2>\n          <p className=\"hb-wd7-sub\">{subtitle}</p>\n          <div className=\"hb-wd7-counter\">\n            <Odometer value={count} />\n            <small aria-live=\"polite\">\n              people in line\n              <br />\n              for {product}\n            </small>\n          </div>\n          {status === \"joined\" ? (\n            <p className=\"hb-wd7-note\" role=\"status\" style={{ fontSize: 14, color: \"#16151a\" }}>\n              You are number {position.toLocaleString(\"en-US\")}. Your ticket is on its way to {email}.\n            </p>\n          ) : (\n            <>\n              <form className=\"hb-wd7-form\" data-error={!!error} onSubmit={submit} noValidate>\n                <input id={`${uid}-e`} type=\"email\" value={email} onChange={(e) => setEmail(e.target.value)} placeholder=\"you@company.com\" aria-label=\"Email address\" aria-invalid={!!error} aria-describedby={error ? `${uid}-err` : `${uid}-note`} autoComplete=\"email\" />\n                <button type=\"submit\" className=\"hb-wd7-btn\" disabled={status === \"saving\"}>\n                  {status === \"saving\" && <span className=\"hb-wd7-spin\" aria-hidden=\"true\" />}\n                  {status === \"saving\" ? \"Printing\" : ctaLabel}\n                </button>\n              </form>\n              {error ? (\n                <p id={`${uid}-err`} className=\"hb-wd7-err\" role=\"alert\">{error}</p>\n              ) : (\n                <p id={`${uid}-note`} className=\"hb-wd7-note\">One email when your wave opens. No newsletter.</p>\n              )}\n            </>\n          )}\n        </div>\n        <div className=\"hb-wd7-stage\">\n          <div className=\"hb-wd7-machine\">\n            <div className=\"hb-wd7-mtop\">\n              <span>{product} queue</span>\n              <span className=\"hb-wd7-lamp\" aria-hidden=\"true\" />\n            </div>\n            <div className=\"hb-wd7-line\" aria-hidden=\"true\">\n              <span className=\"hb-wd7-gate\" />\n              <div className=\"hb-wd7-people\">\n                {Array.from({ length: 22 }, (_, i) => (\n                  <span key={i} className=\"hb-wd7-person\" style={{ color: `hsl(${(hash(i + 3) % 60) + 220} 8% ${42 + (hash(i) % 16)}%)`, animationDelay: `${((hash(i + 9) % 8) / 10).toFixed(1)}s` }} />\n                ))}\n              </div>\n              {status === \"joined\" && <span className=\"hb-wd7-person hb-wd7-you\" />}\n            </div>\n            <div className=\"hb-wd7-slot\" />\n          </div>\n          <div className=\"hb-wd7-feed\">\n            <div className=\"hb-wd7-ticket\" data-ghost={status !== \"joined\"} key={status === \"joined\" ? \"t\" : \"g\"}>\n              <div className=\"hb-wd7-tmain\">\n                <span className=\"hb-wd7-tlabel\">{status === \"joined\" ? \"Your number\" : \"Next number\"}</span>\n                <span className=\"hb-wd7-tnum\">#{shownPos.toLocaleString(\"en-US\")}</span>\n                <div className=\"hb-wd7-trow\">\n                  <span>\n                    <span className=\"hb-wd7-tlabel\">Wave</span>\n                    <b>{String(Math.min(wave, waves.length - 1) + 1).padStart(2, \"0\")}</b>\n                  </span>\n                  <span>\n                    <span className=\"hb-wd7-tlabel\">Doors open</span>\n                    <b>{waveLabel}</b>\n                  </span>\n                  <span>\n                    <span className=\"hb-wd7-tlabel\">Ahead in wave</span>\n                    <b>{ahead.toLocaleString(\"en-US\")}</b>\n                  </span>\n                </div>\n              </div>\n              <div className=\"hb-wd7-perf\" aria-hidden=\"true\" />\n              <div className=\"hb-wd7-stub\">\n                <span className=\"hb-wd7-bars\" aria-hidden=\"true\">\n                  {bars.map((w, i) => (\n                    <i key={i} style={{ width: w, opacity: i % 7 === 3 ? 0 : 1 }} />\n                  ))}\n                </span>\n                <small>\n                  ADMIT ONE\n                  <br />\n                  {product.toUpperCase()} EARLY ACCESS\n                </small>\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}