{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "shop-cart-summary",
  "type": "registry:component",
  "title": "Shop Cart Summary",
  "description": "A cart panel with line items, quantity steppers and remove, a free shipping progress bar, a promo code field with valid and invalid states and totals that count to their new value.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "ecommerce",
    "ecommerce",
    "cart",
    "checkout",
    "promo code",
    "totals",
    "shop"
  ],
  "docs": "https://hyperblur.dev/effects/shop-cart-summary",
  "files": [
    {
      "path": "registry/hyperblur/shop-cart-summary.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/shop-cart-summary.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport interface CartItem {\n  id: string;\n  name: string;\n  variant?: string;\n  price: number;\n  quantity: number;\n  tone?: string;\n  glyph?: \"shoe\" | \"sock\" | \"bag\" | \"bottle\" | \"cap\";\n}\n\nexport interface CartTotals {\n  items: CartItem[];\n  subtotal: number;\n  discount: number;\n  shipping: number;\n  tax: number;\n  total: number;\n  promoCode: string | null;\n}\n\nexport interface ShopCartSummaryProps extends Omit<React.HTMLAttributes<HTMLElement>, \"title\"> {\n  title?: string;\n  defaultItems?: CartItem[];\n  currency?: string;\n  freeShippingThreshold?: number;\n  shippingCost?: number;\n  taxRate?: number;\n  promoCodes?: Record<string, number>;\n  checkoutLabel?: string;\n  continueHref?: string;\n  onItemsChange?: (items: CartItem[]) => void;\n  onCheckout?: (totals: CartTotals) => void;\n  accent?: string;\n}\n\nconst defaultItems: CartItem[] = [\n  { id: \"trail-runner\", name: \"Trail Runner 3\", variant: \"Basalt / US 10\", price: 138, quantity: 1, tone: \"#3b4a5a\", glyph: \"shoe\" },\n  { id: \"merino-crew\", name: \"Merino Crew Socks\", variant: \"Fog, 3-pack\", price: 24, quantity: 2, tone: \"#7a6f62\", glyph: \"sock\" },\n  { id: \"daypack\", name: \"Ridge Daypack 18L\", variant: \"Moss\", price: 92, quantity: 1, tone: \"#4f5d3f\", glyph: \"bag\" },\n];\n\nconst glyphs: Record<NonNullable<CartItem[\"glyph\"]>, string> = {\n  shoe: \"M6 30c0-4 2-7 5-8l6-1 4-6c1-1 2-1 3 0l3 3c2 2 5 3 8 3l6 1c3 1 5 3 5 6v2H6Z M6 31.5h40v3H6Z\",\n  sock: \"M20 6h12v18c0 3 1 5 3 7l2 2c2 2 2 6-1 8s-6 2-8 0l-7-7c-1-1-1-3-1-4V6Z\",\n  bag: \"M14 16c0-6 4-10 12-10s12 4 12 10v22c0 2-2 4-4 4H18c-2 0-4-2-4-4V16Z M20 24h12v8H20z\",\n  bottle: \"M22 6h8v6l3 4v24c0 2-1 3-3 3h-8c-2 0-3-1-3-3V16l3-4V6Z\",\n  cap: \"M8 30c0-10 8-18 18-18s18 8 18 18H8Z M8 31.5h40c0 2-2 3-4 3H8v-3Z\",\n};\n\nfunction money(value: number, currency: string) {\n  const negative = value < 0;\n  const [whole, cents] = Math.abs(value).toFixed(2).split(\".\");\n  const grouped = whole.replace(/\\B(?=(\\d{3})+$)/g, \",\");\n  return `${negative ? \"−\" : \"\"}${currency}${grouped}.${cents}`;\n}\n\nfunction useTween(target: number) {\n  const [value, setValue] = React.useState(target);\n  const fromRef = React.useRef(target);\n  React.useEffect(() => {\n    const from = fromRef.current;\n    if (from === target) return;\n    const reduce = typeof window !== \"undefined\" && window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n    let frame = 0;\n    const start = performance.now();\n    const duration = reduce ? 0 : 520;\n    const tick = (now: number) => {\n      const t = duration === 0 ? 1 : Math.min(1, (now - start) / duration);\n      const eased = 1 - Math.pow(1 - t, 3);\n      const next = from + (target - from) * eased;\n      fromRef.current = next;\n      setValue(next);\n      if (t < 1) frame = requestAnimationFrame(tick);\n    };\n    frame = requestAnimationFrame(tick);\n    return () => cancelAnimationFrame(frame);\n  }, [target]);\n  return value;\n}\n\nfunction Num({ value, currency }: { value: number; currency: string }) {\n  const shown = useTween(value);\n  return <>{money(Math.round(shown * 100) / 100, currency)}</>;\n}\n\nconst css = `\n.hb-ki6 {\n  --hb-ki6-accent: #10b981;\n  box-sizing: border-box;\n  width: 100%;\n  container-type: inline-size;\n  background:\n    radial-gradient(60% 40% at 100% 0%, color-mix(in srgb, var(--hb-ki6-accent) 8%, transparent), transparent 70%),\n    #0a0a0a;\n  color: #ededed;\n  font-family: inherit;\n  -webkit-font-smoothing: antialiased;\n}\n.hb-ki6 *, .hb-ki6 *::before, .hb-ki6 *::after { box-sizing: border-box; }\n.hb-ki6-inner {\n  display: grid;\n  gap: 20px;\n  max-width: 1120px;\n  margin: 0 auto;\n  padding: clamp(40px, 6.5cqi, 96px) clamp(16px, 4cqi, 40px);\n}\n.hb-ki6-panel {\n  min-width: 0;\n  border: 1px solid rgba(255,255,255,.08);\n  border-radius: 22px;\n  background: linear-gradient(180deg, #121212, #0e0e0e);\n  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);\n}\n.hb-ki6-main { padding: clamp(18px, 2.6cqi, 28px); }\n.hb-ki6-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }\n.hb-ki6-title { margin: 0; font-size: clamp(24px, 3cqi, 30px); font-weight: 650; letter-spacing: -.03em; }\n.hb-ki6-title span { color: #6b6b6b; font-weight: 500; }\n.hb-ki6-link { color: #8f8f8f; font-size: 13.5px; text-decoration: none; border-radius: 4px; }\n.hb-ki6-link:hover { color: #ededed; }\n.hb-ki6-link:focus-visible { outline: 2px solid var(--hb-ki6-accent); outline-offset: 2px; }\n.hb-ki6-ship {\n  margin-top: 18px;\n  padding: 14px 16px;\n  border: 1px solid rgba(255,255,255,.07);\n  border-radius: 14px;\n  background: #0b0b0b;\n}\n.hb-ki6-ship p { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: #c9c9c9; font-size: 13.5px; }\n.hb-ki6-ship p b { color: #ededed; font-weight: 600; }\n.hb-ki6-ship svg { width: 16px; height: 16px; flex: none; color: var(--hb-ki6-accent); }\n.hb-ki6-bar { position: relative; height: 6px; border-radius: 6px; background: rgba(255,255,255,.07); overflow: hidden; }\n.hb-ki6-bar span {\n  position: absolute;\n  inset: 0;\n  border-radius: inherit;\n  background: linear-gradient(90deg, color-mix(in srgb, var(--hb-ki6-accent) 50%, #0a0a0a), var(--hb-ki6-accent));\n  transform-origin: left;\n  transform: scaleX(var(--hb-ki6-p, 0));\n  transition: transform .6s cubic-bezier(.2,.7,.2,1);\n  animation: hb-ki6-grow 1.2s cubic-bezier(.2,.7,.2,1) both;\n}\n.hb-ki6-bar span::after {\n  content: \"\";\n  position: absolute;\n  inset: 0;\n  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);\n  transform: translateX(-100%);\n  animation: hb-ki6-sheen 2.6s 1.2s ease-in-out infinite;\n}\n.hb-ki6-list { margin: 8px 0 0; padding: 0; list-style: none; }\n.hb-ki6-item {\n  display: grid;\n  grid-template-rows: 1fr;\n  transition: grid-template-rows .3s ease, opacity .25s ease;\n}\n.hb-ki6-item[data-leaving=\"true\"] { grid-template-rows: 0fr; opacity: 0; }\n.hb-ki6-row {\n  display: grid;\n  grid-template-columns: 64px 1fr auto;\n  gap: 4px 14px;\n  align-items: center;\n  min-height: 0;\n  overflow: hidden;\n  padding: 16px 0;\n  border-bottom: 1px solid rgba(255,255,255,.06);\n}\n.hb-ki6-item:last-child .hb-ki6-row { border-bottom: 0; }\n.hb-ki6-thumb {\n  grid-row: span 2;\n  display: grid;\n  place-items: center;\n  width: 64px;\n  height: 64px;\n  border-radius: 14px;\n  box-shadow: inset 0 0 0 1px rgba(255,255,255,.1), inset 0 1px 0 rgba(255,255,255,.15);\n}\n.hb-ki6-thumb svg { width: 36px; height: 36px; }\n.hb-ki6-name { min-width: 0; }\n.hb-ki6-name b { display: block; font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }\n.hb-ki6-name span { display: block; margin-top: 3px; color: #8f8f8f; font-size: 12.5px; }\n.hb-ki6-line { font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }\n.hb-ki6-ctrls { grid-column: 2 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; }\n.hb-ki6-step {\n  display: inline-flex;\n  align-items: center;\n  height: 32px;\n  border: 1px solid rgba(255,255,255,.1);\n  border-radius: 10px;\n  background: #0b0b0b;\n}\n.hb-ki6-step button {\n  display: grid;\n  place-items: center;\n  width: 30px;\n  height: 100%;\n  margin: 0;\n  padding: 0;\n  border: 0;\n  border-radius: 10px;\n  background: transparent;\n  color: #ededed;\n  cursor: pointer;\n}\n.hb-ki6-step button:disabled { color: #404040; cursor: default; }\n.hb-ki6-step button:focus-visible { outline: 2px solid var(--hb-ki6-accent); outline-offset: -3px; }\n.hb-ki6-step svg { width: 12px; height: 12px; }\n.hb-ki6-step output { min-width: 20px; font-size: 13.5px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }\n.hb-ki6-unit { color: #6b6b6b; font-size: 12px; margin-left: 10px; }\n.hb-ki6-remove {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  height: 30px;\n  margin: 0;\n  padding: 0 10px;\n  border: 0;\n  border-radius: 8px;\n  background: transparent;\n  color: #8f8f8f;\n  font: inherit;\n  font-size: 12.5px;\n  cursor: pointer;\n  transition: color .2s ease, background-color .2s ease;\n}\n.hb-ki6-remove svg { width: 14px; height: 14px; }\n.hb-ki6-remove:hover { color: #f87171; background: rgba(248,113,113,.08); }\n.hb-ki6-remove:focus-visible { outline: 2px solid var(--hb-ki6-accent); outline-offset: 1px; }\n.hb-ki6-empty { padding: 40px 0 20px; color: #8f8f8f; font-size: 14.5px; text-align: center; }\n.hb-ki6-empty a { color: var(--hb-ki6-accent); }\n.hb-ki6-side { padding: clamp(18px, 2.6cqi, 26px); align-self: start; }\n.hb-ki6-stitle { margin: 0 0 16px; font-size: 16px; font-weight: 600; }\n.hb-ki6-promo { display: flex; gap: 8px; }\n.hb-ki6-input {\n  flex: 1;\n  min-width: 0;\n  height: 42px;\n  padding: 0 14px;\n  border: 1px solid rgba(255,255,255,.1);\n  border-radius: 12px;\n  background: #0a0a0a;\n  color: #ededed;\n  font: inherit;\n  font-size: 14px;\n  letter-spacing: .04em;\n  text-transform: uppercase;\n  outline: none;\n  transition: border-color .2s ease, box-shadow .2s ease;\n}\n.hb-ki6-input::placeholder { color: #5a5a5a; letter-spacing: 0; text-transform: none; }\n.hb-ki6-input:focus { border-color: color-mix(in srgb, var(--hb-ki6-accent) 60%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hb-ki6-accent) 18%, transparent); }\n.hb-ki6-input[aria-invalid=\"true\"] { border-color: rgba(248,113,113,.6); box-shadow: 0 0 0 3px rgba(248,113,113,.14); animation: hb-ki6-shake .35s ease; }\n.hb-ki6-apply {\n  height: 42px;\n  margin: 0;\n  padding: 0 16px;\n  border: 1px solid rgba(255,255,255,.12);\n  border-radius: 12px;\n  background: #171717;\n  color: #ededed;\n  font: inherit;\n  font-size: 13.5px;\n  font-weight: 600;\n  cursor: pointer;\n  transition: background-color .2s ease, border-color .2s ease;\n}\n.hb-ki6-apply:hover:not(:disabled) { background: #1f1f1f; border-color: rgba(255,255,255,.2); }\n.hb-ki6-apply:disabled { color: #5a5a5a; cursor: default; }\n.hb-ki6-apply:focus-visible { outline: 2px solid var(--hb-ki6-accent); outline-offset: 2px; }\n.hb-ki6-msg { min-height: 20px; margin: 8px 0 0; font-size: 12.5px; }\n.hb-ki6-msg[data-kind=\"error\"] { color: #f87171; }\n.hb-ki6-chip {\n  display: inline-flex;\n  align-items: center;\n  gap: 8px;\n  height: 30px;\n  margin-top: 10px;\n  padding: 0 6px 0 10px;\n  border: 1px solid color-mix(in srgb, var(--hb-ki6-accent) 40%, transparent);\n  border-radius: 999px;\n  background: color-mix(in srgb, var(--hb-ki6-accent) 12%, transparent);\n  color: color-mix(in srgb, var(--hb-ki6-accent) 70%, #fff);\n  font-size: 12.5px;\n  font-weight: 600;\n  animation: hb-ki6-pop .35s cubic-bezier(.2,.9,.3,1.3) both;\n}\n.hb-ki6-chip svg { width: 14px; height: 14px; }\n.hb-ki6-chip button {\n  display: grid;\n  place-items: center;\n  width: 20px;\n  height: 20px;\n  margin: 0;\n  padding: 0;\n  border: 0;\n  border-radius: 50%;\n  background: rgba(255,255,255,.08);\n  color: inherit;\n  cursor: pointer;\n}\n.hb-ki6-chip button:focus-visible { outline: 2px solid var(--hb-ki6-accent); outline-offset: 1px; }\n.hb-ki6-rows { display: grid; gap: 10px; margin: 18px 0 0; padding: 18px 0 0; border-top: 1px solid rgba(255,255,255,.07); }\n.hb-ki6-rows div { display: flex; justify-content: space-between; gap: 12px; color: #a1a1a1; font-size: 14px; }\n.hb-ki6-rows dd { margin: 0; color: #ededed; font-variant-numeric: tabular-nums; }\n.hb-ki6-rows dt { margin: 0; }\n.hb-ki6-rows .hb-ki6-good dd { color: color-mix(in srgb, var(--hb-ki6-accent) 75%, #fff); }\n.hb-ki6-total {\n  display: flex;\n  align-items: baseline;\n  justify-content: space-between;\n  margin: 18px 0;\n  padding-top: 18px;\n  border-top: 1px solid rgba(255,255,255,.07);\n}\n.hb-ki6-total span { color: #a1a1a1; font-size: 14px; }\n.hb-ki6-total b { font-size: 28px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }\n.hb-ki6-total small { color: #6b6b6b; font-size: 12px; font-weight: 500; margin-right: 6px; }\n.hb-ki6-checkout {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  gap: 10px;\n  width: 100%;\n  height: 50px;\n  margin: 0;\n  border: 0;\n  border-radius: 14px;\n  background: var(--hb-ki6-accent);\n  box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 12px 30px -14px var(--hb-ki6-accent);\n  color: #04130d;\n  font: inherit;\n  font-size: 15px;\n  font-weight: 650;\n  cursor: pointer;\n  transition: filter .2s ease, transform .15s ease;\n}\n.hb-ki6-checkout svg { width: 16px; height: 16px; }\n.hb-ki6-checkout:hover:not(:disabled) { filter: brightness(1.08); }\n.hb-ki6-checkout:active:not(:disabled) { transform: scale(.985); }\n.hb-ki6-checkout:disabled { opacity: .4; cursor: default; }\n.hb-ki6-checkout:focus-visible { outline: 2px solid #ededed; outline-offset: 3px; }\n.hb-ki6-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 12px 0 0; color: #6b6b6b; font-size: 12px; }\n.hb-ki6-note svg { width: 13px; height: 13px; }\n@container (min-width: 820px) {\n  .hb-ki6-inner { grid-template-columns: 1.55fr 1fr; gap: 20px; align-items: start; }\n  .hb-ki6-row { grid-template-columns: 72px 1fr auto; gap: 6px 18px; }\n  .hb-ki6-thumb { width: 72px; height: 72px; }\n}\n@container (max-width: 520px) {\n  .hb-ki6-unit, .hb-ki6-rmt { display: none; }\n  .hb-ki6-remove { padding: 0 8px; }\n  .hb-ki6-head { flex-direction: column; gap: 6px; }\n}\n@keyframes hb-ki6-grow { from { transform: scaleX(0); } }\n@keyframes hb-ki6-sheen { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }\n@keyframes hb-ki6-shake {\n  0%, 100% { transform: none; }\n  30% { transform: translateX(-5px); }\n  60% { transform: translateX(4px); }\n}\n@keyframes hb-ki6-pop { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-ki6-bar span, .hb-ki6-bar span::after, .hb-ki6-input[aria-invalid=\"true\"], .hb-ki6-chip { animation: none; }\n  .hb-ki6-bar span, .hb-ki6-item, .hb-ki6-input, .hb-ki6-remove, .hb-ki6-checkout { transition: none; }\n}\n`;\n\nconst minus = <svg viewBox=\"0 0 12 12\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" aria-hidden=\"true\"><path d=\"M2.5 6h7\" /></svg>;\nconst plus = <svg viewBox=\"0 0 12 12\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" aria-hidden=\"true\"><path d=\"M2.5 6h7M6 2.5v7\" /></svg>;\n\nexport function ShopCartSummary({\n  title = \"Your bag\",\n  defaultItems: initialItems = defaultItems,\n  currency = \"$\",\n  freeShippingThreshold = 300,\n  shippingCost = 9,\n  taxRate = 0.0825,\n  promoCodes = { NORTHWIND10: 0.1, TRAIL15: 0.15 },\n  checkoutLabel = \"Checkout securely\",\n  continueHref = \"#\",\n  onItemsChange,\n  onCheckout,\n  accent = \"#10b981\",\n  className,\n  style,\n  ...rest\n}: ShopCartSummaryProps) {\n  const [items, setItems] = React.useState(initialItems);\n  const [leaving, setLeaving] = React.useState<string[]>([]);\n  const [code, setCode] = React.useState(\"\");\n  const [applied, setApplied] = React.useState<string | null>(null);\n  const [invalid, setInvalid] = React.useState(0);\n  const timers = React.useRef<ReturnType<typeof setTimeout>[]>([]);\n  const uid = React.useId();\n\n  React.useEffect(() => {\n    const list = timers.current;\n    return () => list.forEach(clearTimeout);\n  }, []);\n\n  const update = (next: CartItem[]) => {\n    setItems(next);\n    onItemsChange?.(next);\n  };\n\n  const setQty = (id: string, delta: number) => {\n    update(items.map((item) => (item.id === id ? { ...item, quantity: Math.max(1, Math.min(20, item.quantity + delta)) } : item)));\n  };\n\n  const remove = (id: string) => {\n    const next = items.filter((item) => item.id !== id);\n    setLeaving((list) => [...list, id]);\n    timers.current.push(\n      setTimeout(() => {\n        setLeaving((list) => list.filter((x) => x !== id));\n        update(next);\n      }, 300),\n    );\n  };\n\n  const apply = (event: React.FormEvent<HTMLFormElement>) => {\n    event.preventDefault();\n    const key = code.trim().toUpperCase();\n    if (!key) return;\n    if (promoCodes[key] !== undefined) {\n      setApplied(key);\n      setInvalid(0);\n      setCode(\"\");\n    } else {\n      setInvalid((n) => n + 1);\n    }\n  };\n\n  const count = items.reduce((sum, item) => sum + item.quantity, 0);\n  const subtotal = items.reduce((sum, item) => sum + item.price * item.quantity, 0);\n  const rate = applied ? promoCodes[applied] ?? 0 : 0;\n  const discount = Math.round(subtotal * rate * 100) / 100;\n  const afterDiscount = subtotal - discount;\n  const free = afterDiscount >= freeShippingThreshold;\n  const shipping = items.length === 0 || free ? 0 : shippingCost;\n  const tax = Math.round(afterDiscount * taxRate * 100) / 100;\n  const total = afterDiscount + shipping + tax;\n  const progress = freeShippingThreshold > 0 ? Math.min(1, afterDiscount / freeShippingThreshold) : 1;\n\n  return (\n    <section\n      className={className ? `hb-ki6 ${className}` : \"hb-ki6\"}\n      style={{ \"--hb-ki6-accent\": accent, ...style } as React.CSSProperties}\n      {...rest}\n    >\n      <style href=\"hb-shop-cart-summary\" precedence=\"default\">{css}</style>\n      <div className=\"hb-ki6-inner\">\n        <div className=\"hb-ki6-panel hb-ki6-main\">\n          <div className=\"hb-ki6-head\">\n            <h2 className=\"hb-ki6-title\">\n              {title} <span>· {count} {count === 1 ? \"item\" : \"items\"}</span>\n            </h2>\n            <a className=\"hb-ki6-link\" href={continueHref}>Continue shopping</a>\n          </div>\n          {items.length > 0 && (\n            <div className=\"hb-ki6-ship\">\n              <p aria-live=\"polite\">\n                <svg viewBox=\"0 0 20 20\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                  {free ? <path d=\"M4.5 10.5l3.5 3.5 7.5-8\" /> : <path d=\"M1.5 5h10v8h-10zM11.5 8h3.5l3 3v2h-6.5M5 16a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zM15 16a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z\" />}\n                </svg>\n                {free ? (\n                  <span>You unlocked <b>free shipping</b>.</span>\n                ) : (\n                  <span>\n                    Add <b>{money(freeShippingThreshold - afterDiscount, currency)}</b> more for free shipping.\n                  </span>\n                )}\n              </p>\n              <div\n                className=\"hb-ki6-bar\"\n                role=\"progressbar\"\n                aria-label=\"Progress to free shipping\"\n                aria-valuemin={0}\n                aria-valuemax={100}\n                aria-valuenow={Math.round(progress * 100)}\n              >\n                <span style={{ \"--hb-ki6-p\": progress.toFixed(4) } as React.CSSProperties} />\n              </div>\n            </div>\n          )}\n          {items.length === 0 ? (\n            <p className=\"hb-ki6-empty\">\n              Your bag is empty. <a href={continueHref}>Find something you love</a>\n            </p>\n          ) : (\n            <ul className=\"hb-ki6-list\">\n              {items.map((item) => {\n                const tone = item.tone ?? \"#3a3a3a\";\n                return (\n                  <li key={item.id} className=\"hb-ki6-item\" data-leaving={leaving.includes(item.id)}>\n                    <div className=\"hb-ki6-row\">\n                      <span\n                        className=\"hb-ki6-thumb\"\n                        style={{ background: `radial-gradient(circle at 30% 20%, color-mix(in srgb, ${tone} 60%, #fff) 0%, transparent 55%), linear-gradient(145deg, ${tone}, color-mix(in srgb, ${tone} 45%, #000))` }}\n                        aria-hidden=\"true\"\n                      >\n                        <svg viewBox=\"0 0 52 48\" fill=\"rgba(255,255,255,.88)\" fillRule=\"evenodd\">\n                          <path d={glyphs[item.glyph ?? \"bag\"]} />\n                        </svg>\n                      </span>\n                      <div className=\"hb-ki6-name\">\n                        <b>{item.name}</b>\n                        {item.variant && <span>{item.variant}</span>}\n                      </div>\n                      <div className=\"hb-ki6-ctrls\">\n                        <div style={{ display: \"flex\", alignItems: \"center\" }}>\n                          <div className=\"hb-ki6-step\" role=\"group\" aria-label={`Quantity of ${item.name}`}>\n                            <button type=\"button\" aria-label=\"Decrease\" disabled={item.quantity <= 1} onClick={() => setQty(item.id, -1)}>{minus}</button>\n                            <output aria-live=\"polite\">{item.quantity}</output>\n                            <button type=\"button\" aria-label=\"Increase\" disabled={item.quantity >= 20} onClick={() => setQty(item.id, 1)}>{plus}</button>\n                          </div>\n                          {item.quantity > 1 && <span className=\"hb-ki6-unit\">{money(item.price, currency)} each</span>}\n                        </div>\n                        <button type=\"button\" className=\"hb-ki6-remove\" onClick={() => remove(item.id)} aria-label={`Remove ${item.name}`}>\n                          <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.4\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                            <path d=\"M2.5 4.5h11M6 4.5V3h4v1.5M4 4.5l.7 9h6.6l.7-9\" />\n                          </svg>\n                          <span className=\"hb-ki6-rmt\">Remove</span>\n                        </button>\n                      </div>\n                      <span className=\"hb-ki6-line\">\n                        <Num value={item.price * item.quantity} currency={currency} />\n                      </span>\n                    </div>\n                  </li>\n                );\n              })}\n            </ul>\n          )}\n        </div>\n        <aside className=\"hb-ki6-panel hb-ki6-side\" aria-label=\"Order summary\">\n          <h3 className=\"hb-ki6-stitle\">Order summary</h3>\n          <form className=\"hb-ki6-promo\" onSubmit={apply} noValidate>\n            <label htmlFor={`${uid}-promo`} style={{ position: \"absolute\", width: 1, height: 1, overflow: \"hidden\", clip: \"rect(0 0 0 0)\" }}>\n              Promo code\n            </label>\n            <input\n              id={`${uid}-promo`}\n              key={invalid}\n              className=\"hb-ki6-input\"\n              placeholder=\"Promo code\"\n              value={code}\n              autoComplete=\"off\"\n              aria-invalid={invalid > 0}\n              aria-describedby={`${uid}-msg`}\n              onChange={(event) => {\n                setCode(event.target.value);\n                if (invalid) setInvalid(0);\n              }}\n            />\n            <button type=\"submit\" className=\"hb-ki6-apply\" disabled={!code.trim()}>Apply</button>\n          </form>\n          <p className=\"hb-ki6-msg\" id={`${uid}-msg`} data-kind={invalid ? \"error\" : undefined} aria-live=\"polite\">\n            {invalid ? \"That code isn't valid. Check the spelling and try again.\" : applied ? \"\" : `Try ${Object.keys(promoCodes)[0] ?? \"\"}`}\n          </p>\n          {applied && (\n            <span className=\"hb-ki6-chip\">\n              <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.5\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                <path d=\"M8.5 2h5v5l-6.5 6.5-5-5L8.5 2zM11 5h.01\" />\n              </svg>\n              {applied} · {Math.round(rate * 100)}% off\n              <button type=\"button\" aria-label={`Remove code ${applied}`} onClick={() => setApplied(null)}>\n                <svg viewBox=\"0 0 12 12\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" aria-hidden=\"true\"><path d=\"M3 3l6 6M9 3l-6 6\" /></svg>\n              </button>\n            </span>\n          )}\n          <dl className=\"hb-ki6-rows\">\n            <div>\n              <dt>Subtotal</dt>\n              <dd><Num value={subtotal} currency={currency} /></dd>\n            </div>\n            {discount > 0 && (\n              <div className=\"hb-ki6-good\">\n                <dt>Discount</dt>\n                <dd><Num value={-discount} currency={currency} /></dd>\n              </div>\n            )}\n            <div className={shipping === 0 && items.length > 0 ? \"hb-ki6-good\" : undefined}>\n              <dt>Shipping</dt>\n              <dd>{shipping === 0 && items.length > 0 ? \"Free\" : money(shipping, currency)}</dd>\n            </div>\n            <div>\n              <dt>Estimated tax</dt>\n              <dd><Num value={tax} currency={currency} /></dd>\n            </div>\n          </dl>\n          <div className=\"hb-ki6-total\">\n            <span>Total</span>\n            <b>\n              <small>USD</small>\n              <Num value={total} currency={currency} />\n            </b>\n          </div>\n          <button\n            type=\"button\"\n            className=\"hb-ki6-checkout\"\n            disabled={items.length === 0}\n            onClick={() => onCheckout?.({ items, subtotal, discount, shipping, tax, total, promoCode: applied })}\n          >\n            <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n              <rect x=\"3\" y=\"7\" width=\"10\" height=\"7\" rx=\"1.5\" />\n              <path d=\"M5.5 7V5a2.5 2.5 0 0 1 5 0v2\" />\n            </svg>\n            {checkoutLabel}\n          </button>\n          <p className=\"hb-ki6-note\">\n            <svg viewBox=\"0 0 16 16\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.4\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n              <path d=\"M8 1.5l5 2v4c0 3.2-2.2 5.8-5 7-2.8-1.2-5-3.8-5-7v-4l5-2z\" />\n            </svg>\n            Free returns within 30 days\n          </p>\n        </aside>\n      </div>\n    </section>\n  );\n}\n"
    }
  ]
}