{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "pay-failed-retry",
  "type": "registry:component",
  "title": "Pay Failed Retry",
  "description": "A payment failure state with a shaking x mark, an error message, reason chips and Retry and Change method buttons.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "payments",
    "failed",
    "error",
    "payment",
    "retry",
    "declined",
    "shake"
  ],
  "docs": "https://hyperblur.dev/effects/pay-failed-retry",
  "files": [
    {
      "path": "registry/hyperblur/pay-failed-retry.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/pay-failed-retry.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface PayFailedRetryProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n  title?: string;\n  message?: string;\n  reasons?: string[];\n  retryLabel?: string;\n  changeLabel?: string;\n  onRetry?: () => void;\n  onChangeMethod?: () => void;\n  busy?: boolean;\n  accent?: string;\n  loop?: boolean;\n  loopDelay?: number;\n}\n\nconst css = `\n.hb-qf5 {\n  box-sizing: border-box;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  width: 100%;\n  color: #ededed;\n  font-family: inherit;\n  text-align: center;\n}\n.hb-qf5 *, .hb-qf5 *::before, .hb-qf5 *::after { box-sizing: border-box; }\n.hb-qf5-in { display: flex; flex-direction: column; align-items: center; width: 100%; }\n.hb-qf5-badge { position: relative; width: 56px; height: 56px; flex: none; }\n.hb-qf5-pulse {\n  position: absolute;\n  inset: 0;\n  border: 2px solid var(--hb-qf5-x);\n  border-radius: 50%;\n  animation: hb-qf5-pulse 1.1s ease-out 0.45s both;\n}\n.hb-qf5-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }\n.hb-qf5-shake { transform-origin: 28px 28px; animation: hb-qf5-shake 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97) 0.55s both; }\n.hb-qf5-disc { fill: color-mix(in srgb, var(--hb-qf5-x) 14%, transparent); stroke: var(--hb-qf5-x); stroke-width: 2.5; }\n.hb-qf5-x {\n  fill: none;\n  stroke: var(--hb-qf5-x);\n  stroke-width: 3.6;\n  stroke-linecap: round;\n  stroke-dasharray: 1 1.2;\n  stroke-dashoffset: 0;\n  animation: hb-qf5-draw 0.3s ease-out 0.25s both;\n}\n.hb-qf5-x + .hb-qf5-x { animation-delay: 0.4s; }\n.hb-qf5-title { margin: 9px 0 0; font-size: 15px; font-weight: 600; letter-spacing: -0.005em; animation: hb-qf5-up 0.5s ease 0.5s both; }\n.hb-qf5-msg { margin: 2px 0 0; color: #8f8f8f; font-size: 12.5px; line-height: 1.4; animation: hb-qf5-up 0.5s ease 0.58s both; }\n.hb-qf5-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 9px 0 0; padding: 0; list-style: none; }\n.hb-qf5-chip {\n  padding: 3px 9px;\n  color: color-mix(in srgb, var(--hb-qf5-x) 55%, #fff);\n  font-size: 11.5px;\n  background: color-mix(in srgb, var(--hb-qf5-x) 12%, transparent);\n  border: 1px solid color-mix(in srgb, var(--hb-qf5-x) 32%, transparent);\n  border-radius: 999px;\n  animation: hb-qf5-up 0.45s ease both;\n  animation-delay: calc(0.66s + var(--i) * 0.07s);\n}\n.hb-qf5-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; animation: hb-qf5-up 0.5s ease 0.8s both; }\n.hb-qf5-btn {\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  gap: 7px;\n  height: 36px;\n  margin: 0;\n  padding: 0 16px;\n  font: inherit;\n  font-size: 13px;\n  font-weight: 600;\n  border-radius: 999px;\n  cursor: pointer;\n  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s ease, border-color 0.2s ease;\n  -webkit-tap-highlight-color: transparent;\n}\n.hb-qf5-btn:hover:not(:disabled) { transform: translateY(-1px); }\n.hb-qf5-btn:active:not(:disabled) { transform: scale(0.97); }\n.hb-qf5-btn:focus-visible { outline: 2px solid var(--hb-qf5-x); outline-offset: 3px; }\n.hb-qf5-btn:disabled { cursor: progress; opacity: 0.75; }\n.hb-qf5-go { color: #0a0a0a; background: #ededed; border: 1px solid #ededed; }\n.hb-qf5-go:hover:not(:disabled) { background: #fff; }\n.hb-qf5-alt { color: #ededed; background: transparent; border: 1px solid #333333; }\n.hb-qf5-alt:hover:not(:disabled) { background: #171717; border-color: #4a4a4a; }\n.hb-qf5-spin { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; animation: hb-qf5-rot 0.8s linear infinite; }\n.hb-qf5-ico { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }\n@keyframes hb-qf5-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }\n@keyframes hb-qf5-shake {\n  0%, 100% { transform: translateX(0) rotate(0); }\n  15% { transform: translateX(-7px) rotate(-6deg); }\n  30% { transform: translateX(6px) rotate(5deg); }\n  45% { transform: translateX(-5px) rotate(-4deg); }\n  60% { transform: translateX(4px) rotate(3deg); }\n  80% { transform: translateX(-2px) rotate(-1deg); }\n}\n@keyframes hb-qf5-pulse { from { opacity: 0.7; transform: scale(1); } to { opacity: 0; transform: scale(1.7); } }\n@keyframes hb-qf5-up { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }\n@keyframes hb-qf5-rot { to { transform: rotate(360deg); } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-qf5-pulse, .hb-qf5-shake, .hb-qf5-x, .hb-qf5-title, .hb-qf5-msg, .hb-qf5-chip, .hb-qf5-acts, .hb-qf5-spin { animation: none; }\n  .hb-qf5-pulse { opacity: 0; }\n  .hb-qf5-btn { transition: none; }\n}\n`;\n\nexport function PayFailedRetry({\n  title = \"Payment declined\",\n  message = \"Your bank did not approve this payment.\",\n  reasons = [\"Insufficient funds\", \"Card expired\"],\n  retryLabel = \"Try again\",\n  changeLabel = \"Change method\",\n  onRetry,\n  onChangeMethod,\n  busy = false,\n  accent = \"#ff5d6c\",\n  loop = false,\n  loopDelay = 5600,\n  className = \"\",\n  style,\n  ...rest\n}: PayFailedRetryProps) {\n  const [run, setRun] = React.useState(0);\n\n  React.useEffect(() => {\n    if (!loop) return;\n    const id = window.setInterval(() => setRun((r) => r + 1), Math.max(2500, loopDelay));\n    return () => window.clearInterval(id);\n  }, [loop, loopDelay]);\n\n  function retry() {\n    setRun((r) => r + 1);\n    onRetry?.();\n  }\n\n  const vars = { \"--hb-qf5-x\": accent, ...style } as React.CSSProperties;\n\n  return (\n    <div className={`hb-qf5 ${className}`} style={vars} role=\"alert\" {...rest}>\n      <style href=\"hb-pay-failed-retry\" precedence=\"default\">{css}</style>\n      <div key={run} className=\"hb-qf5-in\">\n        <div className=\"hb-qf5-badge\" aria-hidden=\"true\">\n          <span className=\"hb-qf5-pulse\" />\n          <svg className=\"hb-qf5-svg\" viewBox=\"0 0 56 56\">\n            <g className=\"hb-qf5-shake\">\n              <circle className=\"hb-qf5-disc\" cx=\"28\" cy=\"28\" r=\"25\" />\n              <path className=\"hb-qf5-x\" d=\"M20 20l16 16\" pathLength=\"1\" />\n              <path className=\"hb-qf5-x\" d=\"M36 20L20 36\" pathLength=\"1\" />\n            </g>\n          </svg>\n        </div>\n        <p className=\"hb-qf5-title\">{title}</p>\n        {message && <p className=\"hb-qf5-msg\">{message}</p>}\n        {reasons.length > 0 && (\n          <ul className=\"hb-qf5-chips\" aria-label=\"Possible reasons\">\n            {reasons.map((reason, i) => (\n              <li key={reason} className=\"hb-qf5-chip\" style={{ \"--i\": i } as React.CSSProperties}>\n                {reason}\n              </li>\n            ))}\n          </ul>\n        )}\n      </div>\n      <div className=\"hb-qf5-acts\">\n          <button type=\"button\" className=\"hb-qf5-btn hb-qf5-go\" onClick={retry} disabled={busy} aria-busy={busy}>\n            {busy ? (\n              <svg className=\"hb-qf5-spin\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n                <circle cx=\"12\" cy=\"12\" r=\"9\" opacity=\"0.25\" />\n                <path d=\"M21 12a9 9 0 0 0-9-9\" />\n              </svg>\n            ) : (\n              <svg className=\"hb-qf5-ico\" viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n                <path d=\"M20 12a8 8 0 1 1-2.6-5.9M20 4v5h-5\" />\n              </svg>\n            )}\n            {retryLabel}\n          </button>\n          <button type=\"button\" className=\"hb-qf5-btn hb-qf5-alt\" onClick={onChangeMethod}>\n            {changeLabel}\n          </button>\n      </div>\n    </div>\n  );\n}\n"
    }
  ]
}