{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "border-star-orbit",
  "type": "registry:component",
  "title": "Border Star Orbit",
  "description": "A card whose border carries a glowing four-point star that circles the perimeter, dragging a trail of fading color behind it.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "hover",
    "border",
    "star",
    "orbit",
    "glow",
    "card",
    "comet"
  ],
  "docs": "https://hyperblur.dev/effects/border-star-orbit",
  "files": [
    {
      "path": "registry/hyperblur/border-star-orbit.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/border-star-orbit.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface BorderStarOrbitProps extends React.HTMLAttributes<HTMLDivElement> {\n  radius?: number;\n  starSize?: number;\n  duration?: number;\n  color?: string;\n  trailColor?: string;\n  trail?: number;\n  pauseOnHover?: boolean;\n}\n\nconst css = `\n.hb-qr4 {\n  position: relative;\n  box-sizing: border-box;\n  padding: 16px;\n  border: 1px solid rgba(255, 255, 255, 0.1);\n  border-radius: var(--hb-qr4-r);\n  background: #111111;\n  color: #ededed;\n  font-family: inherit;\n}\n.hb-qr4-o {\n  position: absolute;\n  inset: -1px;\n  pointer-events: none;\n  display: none;\n}\n@supports (offset-path: path(\"M0 0\")) {\n  .hb-qr4-o { display: block; }\n}\n.hb-qr4-d,\n.hb-qr4-h {\n  position: absolute;\n  left: 0;\n  top: 0;\n  offset-path: var(--hb-qr4-p);\n  offset-rotate: 0deg;\n  animation: hb-qr4-run var(--hb-qr4-t) linear infinite;\n}\n.hb-qr4-d {\n  border-radius: 50%;\n  background: var(--hb-qr4-b);\n  box-shadow: 0 0 8px 1px color-mix(in srgb, var(--hb-qr4-a) 70%, transparent);\n}\n.hb-qr4-h {\n  display: grid;\n  place-items: center;\n  width: var(--hb-qr4-z);\n  height: var(--hb-qr4-z);\n  filter: drop-shadow(0 0 5px var(--hb-qr4-a)) drop-shadow(0 0 12px var(--hb-qr4-a));\n}\n.hb-qr4-h > span {\n  display: block;\n  width: 100%;\n  height: 100%;\n  background: #ffffff;\n  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);\n  animation: hb-qr4-spin 3s linear infinite;\n}\n.hb-qr4[data-pause=\"true\"]:hover .hb-qr4-d,\n.hb-qr4[data-pause=\"true\"]:hover .hb-qr4-h,\n.hb-qr4[data-pause=\"true\"]:hover .hb-qr4-h > span {\n  animation-play-state: paused;\n}\n@keyframes hb-qr4-run {\n  from { offset-distance: 0%; }\n  to { offset-distance: 100%; }\n}\n@keyframes hb-qr4-spin {\n  to { transform: rotate(360deg); }\n}\n@media (prefers-reduced-motion: reduce) {\n  .hb-qr4-d,\n  .hb-qr4-h,\n  .hb-qr4-h > span { animation: none; }\n}\n`;\n\nfunction roundedRect(w: number, h: number, radius: number) {\n  const i = 0.5;\n  const r = Math.max(0, Math.min(radius - i, (w - 2 * i) / 2, (h - 2 * i) / 2));\n  const x0 = i;\n  const y0 = i;\n  const x1 = w - i;\n  const y1 = h - i;\n  const f = (n: number) => n.toFixed(2);\n  return [\n    `M${f(x0 + r)} ${f(y0)}`,\n    `H${f(x1 - r)}`,\n    `A${f(r)} ${f(r)} 0 0 1 ${f(x1)} ${f(y0 + r)}`,\n    `V${f(y1 - r)}`,\n    `A${f(r)} ${f(r)} 0 0 1 ${f(x1 - r)} ${f(y1)}`,\n    `H${f(x0 + r)}`,\n    `A${f(r)} ${f(r)} 0 0 1 ${f(x0)} ${f(y1 - r)}`,\n    `V${f(y0 + r)}`,\n    `A${f(r)} ${f(r)} 0 0 1 ${f(x0 + r)} ${f(y0)}`,\n    \"Z\",\n  ].join(\" \");\n}\n\nexport function BorderStarOrbit({\n  radius = 16,\n  starSize = 14,\n  duration = 4,\n  color = \"#7fb3ff\",\n  trailColor = \"#2f7bff\",\n  trail = 14,\n  pauseOnHover = false,\n  className = \"\",\n  style,\n  children,\n  ...rest\n}: BorderStarOrbitProps) {\n  const rootRef = React.useRef<HTMLDivElement>(null);\n  const [box, setBox] = React.useState({ w: 0, h: 0 });\n\n  React.useEffect(() => {\n    const el = rootRef.current;\n    if (!el) return;\n    const measure = () => {\n      const w = el.offsetWidth;\n      const h = el.offsetHeight;\n      setBox((prev) => (prev.w === w && prev.h === h ? prev : { w, h }));\n    };\n    measure();\n    const ro = new ResizeObserver(measure);\n    ro.observe(el);\n    return () => ro.disconnect();\n  }, []);\n\n  const count = Math.max(0, Math.min(30, Math.round(trail)));\n  const ready = box.w > 0 && box.h > 0;\n  const path = ready ? `path(\"${roundedRect(box.w, box.h, radius)}\")` : \"none\";\n  const dots = Array.from({ length: count }, (_, k) => {\n    const i = k + 1;\n    const f = i / (count + 1);\n    const size = Math.max(2, starSize * 0.5 * (1 - f * 0.8));\n    return {\n      key: i,\n      style: {\n        width: size,\n        height: size,\n        opacity: Math.pow(1 - f, 1.6) * 0.9,\n        animationDelay: `${(-duration * (1 - i * 0.007)).toFixed(3)}s`,\n        [\"--hb-qr4-b\" as string]: `color-mix(in srgb, ${color} ${Math.round((1 - f) * 100)}%, ${trailColor})`,\n      } as React.CSSProperties,\n    };\n  }).reverse();\n\n  return (\n    <div\n      ref={rootRef}\n      data-pause={pauseOnHover ? \"true\" : \"false\"}\n      className={`hb-qr4 ${className}`.trim()}\n      style={\n        {\n          [\"--hb-qr4-r\" as string]: `${radius}px`,\n          [\"--hb-qr4-z\" as string]: `${starSize}px`,\n          [\"--hb-qr4-t\" as string]: `${duration}s`,\n          [\"--hb-qr4-a\" as string]: color,\n          [\"--hb-qr4-p\" as string]: path,\n          ...style,\n        } as React.CSSProperties\n      }\n      {...rest}\n    >\n      <style href=\"hb-border-star-orbit\" precedence=\"default\">\n        {css}\n      </style>\n      {children}\n      {ready ? (\n        <div className=\"hb-qr4-o\" aria-hidden=\"true\">\n          {dots.map((d) => (\n            <span key={d.key} className=\"hb-qr4-d\" style={d.style} />\n          ))}\n          <span className=\"hb-qr4-h\">\n            <span />\n          </span>\n        </div>\n      ) : null}\n    </div>\n  );\n}\n"
    }
  ]
}