{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "order-cart-drawer",
  "type": "registry:component",
  "title": "Order Cart Drawer",
  "description": "A cart sheet with quantity steppers, line notes, delivery or pickup, area fees from props, payment choice, a coupon field and a Send order button with a confirmation state.",
  "author": "Hyperblur <hello@hyperblur.dev>",
  "dependencies": [],
  "registryDependencies": [],
  "categories": [
    "ordering",
    "cart",
    "drawer",
    "checkout",
    "delivery",
    "pickup",
    "order"
  ],
  "docs": "https://hyperblur.dev/effects/order-cart-drawer",
  "files": [
    {
      "path": "registry/hyperblur/order-cart-drawer.tsx",
      "type": "registry:component",
      "target": "components/hyperblur/order-cart-drawer.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\n\nexport type OrderMode = \"delivery\" | \"pickup\";\n\nexport interface CartLine {\n  id: string;\n  name: string;\n  price: number;\n  quantity: number;\n  options?: string;\n  note?: string;\n  color?: string;\n}\n\nexport interface DeliveryArea {\n  id: string;\n  label: string;\n  fee: number;\n  eta?: string;\n}\n\nexport interface PaymentMethod {\n  id: string;\n  label: string;\n  hint?: string;\n  icon?: \"cash\" | \"card\" | \"instant\" | \"wallet\";\n}\n\nexport interface PickupStore {\n  name: string;\n  address: string;\n  readyTime?: string;\n}\n\nexport interface CouponResult {\n  code: string;\n  discount: number;\n  label?: string;\n}\n\nexport interface CartOrder {\n  items: CartLine[];\n  mode: OrderMode;\n  area: DeliveryArea | null;\n  customer: { name: string; phone: string };\n  address: { street: string; details: string } | null;\n  payment: PaymentMethod | null;\n  coupon: CouponResult | null;\n  subtotal: number;\n  deliveryFee: number;\n  discount: number;\n  total: number;\n}\n\nexport interface OrderCartDrawerLabels {\n  title: string;\n  close: string;\n  empty: string;\n  emptyHint: string;\n  addNote: string;\n  editNote: string;\n  notePlaceholder: string;\n  remove: string;\n  decrease: string;\n  increase: string;\n  delivery: string;\n  pickup: string;\n  area: string;\n  areaPlaceholder: string;\n  details: string;\n  name: string;\n  phone: string;\n  street: string;\n  streetDetails: string;\n  pickupAt: string;\n  readyIn: string;\n  payment: string;\n  coupon: string;\n  couponPlaceholder: string;\n  apply: string;\n  removeCoupon: string;\n  couponInvalid: string;\n  couponApplied: string;\n  subtotal: string;\n  deliveryFee: string;\n  deliveryPending: string;\n  deliveryFree: string;\n  discount: string;\n  total: string;\n  submit: string;\n  sending: string;\n  required: string;\n  sentTitle: string;\n  sentText: string;\n  newOrder: string;\n}\n\nexport interface OrderCartDrawerProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"onSubmit\"> {\n  open?: boolean;\n  defaultOpen?: boolean;\n  onOpenChange?: (open: boolean) => void;\n  inline?: boolean;\n  items?: CartLine[];\n  defaultItems?: CartLine[];\n  onItemsChange?: (items: CartLine[]) => void;\n  mode?: OrderMode;\n  defaultMode?: OrderMode;\n  onModeChange?: (mode: OrderMode) => void;\n  areas?: DeliveryArea[];\n  defaultAreaId?: string;\n  store?: PickupStore;\n  paymentMethods?: PaymentMethod[];\n  defaultPaymentId?: string;\n  onApplyCoupon?: (code: string, subtotal: number) => CouponResult | null | Promise<CouponResult | null>;\n  onSubmit?: (order: CartOrder) => void | Promise<void>;\n  onNewOrder?: () => void;\n  currency?: string;\n  locale?: string;\n  theme?: \"dark\" | \"light\";\n  accent?: string;\n  labels?: Partial<OrderCartDrawerLabels>;\n}\n\nconst defaultLabels: OrderCartDrawerLabels = {\n  title: \"Your order\",\n  close: \"Close\",\n  empty: \"Your order is empty\",\n  emptyHint: \"Add something from the menu to get started.\",\n  addNote: \"Add note\",\n  editNote: \"Edit note\",\n  notePlaceholder: \"Note for the kitchen\",\n  remove: \"Remove\",\n  decrease: \"Decrease quantity\",\n  increase: \"Increase quantity\",\n  delivery: \"Delivery\",\n  pickup: \"Pickup\",\n  area: \"Delivery area\",\n  areaPlaceholder: \"Choose your area\",\n  details: \"Your details\",\n  name: \"Name\",\n  phone: \"Phone\",\n  street: \"Street and number\",\n  streetDetails: \"Apt, floor, landmark (optional)\",\n  pickupAt: \"Pick up at\",\n  readyIn: \"Ready in\",\n  payment: \"Payment\",\n  coupon: \"Coupon\",\n  couponPlaceholder: \"Enter code\",\n  apply: \"Apply\",\n  removeCoupon: \"Remove\",\n  couponInvalid: \"This code is not valid\",\n  couponApplied: \"{code} applied\",\n  subtotal: \"Subtotal\",\n  deliveryFee: \"Delivery\",\n  deliveryPending: \"Choose an area\",\n  deliveryFree: \"Free\",\n  discount: \"Discount\",\n  total: \"Total\",\n  submit: \"Send order\",\n  sending: \"Sending\",\n  required: \"Required\",\n  sentTitle: \"Order sent\",\n  sentText: \"We will confirm your order on chat in a few minutes.\",\n  newOrder: \"Start a new order\",\n};\n\nconst defaultItems: CartLine[] = [\n  { id: \"smash-double\", name: \"Smash Double\", price: 11.5, quantity: 2, options: \"Medium · Extra cheese\", color: \"#e0752d\" },\n  { id: \"truffle-fries\", name: \"Truffle Fries\", price: 6, quantity: 1, options: \"Large\", note: \"Extra crispy, please\", color: \"#d9a632\" },\n  { id: \"vanilla-shake\", name: \"Vanilla Bean Shake\", price: 6.5, quantity: 1, color: \"#c98fb4\" },\n];\n\nconst defaultAreas: DeliveryArea[] = [\n  { id: \"downtown\", label: \"Downtown\", fee: 2.99, eta: \"25-35 min\" },\n  { id: \"riverside\", label: \"Riverside\", fee: 3.99, eta: \"30-40 min\" },\n  { id: \"hillcrest\", label: \"Hillcrest\", fee: 4.99, eta: \"35-45 min\" },\n  { id: \"northgate\", label: \"Northgate\", fee: 5.99, eta: \"40-50 min\" },\n];\n\nconst defaultStore: PickupStore = { name: \"Corner Kitchen\", address: \"214 Grand Street, Brooklyn, NY\", readyTime: \"15-20 min\" };\n\nconst defaultPayments: PaymentMethod[] = [\n  { id: \"cash\", label: \"Pay on delivery\", hint: \"Cash or card at the door\", icon: \"cash\" },\n  { id: \"card\", label: \"Card\", hint: \"We send a secure card link on chat\", icon: \"card\" },\n  { id: \"instant\", label: \"Instant transfer\", hint: \"Transfer key sent on chat\", icon: \"instant\" },\n];\n\nconst css = `\n.hb-ob2 {\n  --hb-ob2-bg: #0f0f0f;\n  --hb-ob2-surface: #171717;\n  --hb-ob2-raised: #1d1d1d;\n  --hb-ob2-line: #262626;\n  --hb-ob2-text: #ededed;\n  --hb-ob2-muted: #a1a1a1;\n  --hb-ob2-faint: #6f6f6f;\n  --hb-ob2-danger: #ff6b6b;\n  --hb-ob2-ok: #4ade80;\n  box-sizing: border-box;\n  display: flex;\n  flex-direction: column;\n  min-height: 0;\n  width: 100%;\n  overflow: hidden;\n  border: 1px solid var(--hb-ob2-line);\n  background: var(--hb-ob2-bg);\n  color: var(--hb-ob2-text);\n  font-family: inherit;\n  font-size: 13px;\n  line-height: 1.4;\n  container-type: inline-size;\n}\n.hb-ob2 *, .hb-ob2 *::before, .hb-ob2 *::after { box-sizing: border-box; }\n.hb-ob2[data-theme=\"light\"] {\n  --hb-ob2-bg: #fbfaf7;\n  --hb-ob2-surface: #ffffff;\n  --hb-ob2-raised: #f3f1ec;\n  --hb-ob2-line: #e6e3dc;\n  --hb-ob2-text: #151515;\n  --hb-ob2-muted: #63605a;\n  --hb-ob2-faint: #9a968e;\n  --hb-ob2-danger: #d63c3c;\n  --hb-ob2-ok: #16a34a;\n}\n.hb-ob2[data-inline=\"true\"] { height: 100%; max-height: inherit; border-radius: 18px; }\n.hb-ob2[data-inline=\"false\"] {\n  position: relative;\n  max-height: 92dvh;\n  border-radius: 22px 22px 0 0;\n  border-bottom: 0;\n  box-shadow: 0 -24px 60px -20px rgba(0, 0, 0, 0.55);\n  animation: hb-ob2-sheet 0.42s cubic-bezier(0.2, 0.9, 0.25, 1) both;\n}\n.hb-ob2:focus { outline: none; }\n.hb-ob2-layer {\n  position: fixed;\n  inset: 0;\n  z-index: 70;\n  display: flex;\n  align-items: flex-end;\n  justify-content: center;\n  height: 100dvh;\n}\n.hb-ob2-scrim {\n  position: absolute;\n  inset: 0;\n  background: rgba(0, 0, 0, 0.56);\n  backdrop-filter: blur(3px);\n  -webkit-backdrop-filter: blur(3px);\n  animation: hb-ob2-fade 0.3s ease both;\n}\n@media (min-width: 640px) {\n  .hb-ob2-layer { justify-content: flex-end; align-items: stretch; }\n  .hb-ob2[data-inline=\"false\"] {\n    width: 420px;\n    max-height: none;\n    height: 100dvh;\n    border-radius: 22px 0 0 22px;\n    border-bottom: 1px solid var(--hb-ob2-line);\n    border-right: 0;\n    animation-name: hb-ob2-side;\n  }\n}\n.hb-ob2-grab { display: flex; justify-content: center; padding-top: 8px; }\n.hb-ob2-grab span { width: 36px; height: 4px; border-radius: 99px; background: var(--hb-ob2-line); }\n@media (min-width: 640px) { .hb-ob2-grab { display: none; } }\n.hb-ob2[data-inline=\"true\"] .hb-ob2-grab { display: none; }\n.hb-ob2-head {\n  display: flex;\n  flex: none;\n  align-items: center;\n  gap: 10px;\n  padding: 12px 12px 10px 16px;\n  border-bottom: 1px solid var(--hb-ob2-line);\n}\n.hb-ob2-title { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }\n.hb-ob2-chip {\n  padding: 2px 8px;\n  border-radius: 999px;\n  background: color-mix(in srgb, var(--hb-ob2-accent) 16%, transparent);\n  color: color-mix(in srgb, var(--hb-ob2-accent) 75%, var(--hb-ob2-text));\n  font-size: 11.5px;\n  font-weight: 600;\n  font-variant-numeric: tabular-nums;\n}\n.hb-ob2-x {\n  display: grid;\n  place-items: center;\n  width: 30px;\n  height: 30px;\n  margin-left: auto;\n  padding: 0;\n  border: 1px solid var(--hb-ob2-line);\n  border-radius: 10px;\n  background: var(--hb-ob2-surface);\n  color: var(--hb-ob2-muted);\n  cursor: pointer;\n  transition: color 0.15s ease, border-color 0.15s ease;\n}\n.hb-ob2-x:hover { color: var(--hb-ob2-text); border-color: var(--hb-ob2-faint); }\n.hb-ob2 svg { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }\n.hb-ob2-x svg { width: 15px; height: 15px; }\n.hb-ob2-body {\n  display: flex;\n  flex: 1 1 auto;\n  min-height: 0;\n  flex-direction: column;\n  gap: 18px;\n  padding: 14px 16px 18px;\n  overflow-y: auto;\n  overscroll-behavior: contain;\n  scrollbar-width: thin;\n  scrollbar-color: var(--hb-ob2-line) transparent;\n}\n.hb-ob2-lines { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }\n.hb-ob2-line {\n  display: grid;\n  grid-template-columns: 40px minmax(0, 1fr) auto;\n  gap: 4px 12px;\n  padding: 10px 0;\n  border-bottom: 1px dashed var(--hb-ob2-line);\n  animation: hb-ob2-in 0.35s ease both;\n}\n.hb-ob2-line:first-child { padding-top: 0; }\n.hb-ob2-art {\n  position: relative;\n  display: grid;\n  place-items: center;\n  width: 40px;\n  height: 40px;\n  overflow: hidden;\n  border-radius: 12px;\n  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--hb-ob2-tone) 70%, #fff) 0%, var(--hb-ob2-tone) 55%, color-mix(in srgb, var(--hb-ob2-tone) 60%, #000) 100%);\n  color: rgba(255, 255, 255, 0.92);\n  font-size: 14px;\n  font-weight: 700;\n  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);\n}\n.hb-ob2-info { min-width: 0; }\n.hb-ob2-name { display: block; overflow: hidden; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }\n.hb-ob2-opt { display: block; overflow: hidden; color: var(--hb-ob2-muted); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }\n.hb-ob2-price { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }\n.hb-ob2-row2 { display: flex; grid-column: 2 / 4; align-items: center; justify-content: space-between; gap: 8px; }\n.hb-ob2-links { display: flex; align-items: center; gap: 10px; min-width: 0; }\n.hb-ob2-link {\n  padding: 0;\n  border: 0;\n  background: none;\n  color: var(--hb-ob2-muted);\n  font: inherit;\n  font-size: 12px;\n  cursor: pointer;\n  text-decoration: underline;\n  text-decoration-color: transparent;\n  text-underline-offset: 3px;\n  transition: color 0.15s ease, text-decoration-color 0.15s ease;\n}\n.hb-ob2-link:hover { color: var(--hb-ob2-text); text-decoration-color: currentColor; }\n.hb-ob2-link[data-danger=\"true\"]:hover { color: var(--hb-ob2-danger); }\n.hb-ob2-notetext { overflow: hidden; color: var(--hb-ob2-faint); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }\n.hb-ob2-step {\n  display: inline-flex;\n  flex: none;\n  align-items: center;\n  height: 28px;\n  border: 1px solid var(--hb-ob2-line);\n  border-radius: 999px;\n  background: var(--hb-ob2-surface);\n}\n.hb-ob2-step button {\n  display: grid;\n  place-items: center;\n  width: 28px;\n  height: 26px;\n  padding: 0;\n  border: 0;\n  border-radius: 999px;\n  background: none;\n  color: var(--hb-ob2-text);\n  cursor: pointer;\n}\n.hb-ob2-step button:hover:not(:disabled) { color: var(--hb-ob2-accent); }\n.hb-ob2-step button:disabled { color: var(--hb-ob2-faint); cursor: default; }\n.hb-ob2-step svg { width: 13px; height: 13px; stroke-width: 2.2; }\n.hb-ob2-qty { min-width: 18px; font-weight: 650; font-variant-numeric: tabular-nums; text-align: center; }\n.hb-ob2-note { grid-column: 2 / 4; }\n.hb-ob2-sec { display: flex; flex-direction: column; gap: 10px; }\n.hb-ob2-label { margin: 0; color: var(--hb-ob2-muted); font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }\n.hb-ob2-seg {\n  position: relative;\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n  padding: 3px;\n  border: 1px solid var(--hb-ob2-line);\n  border-radius: 12px;\n  background: var(--hb-ob2-surface);\n}\n.hb-ob2-seg::before {\n  content: \"\";\n  position: absolute;\n  top: 3px;\n  bottom: 3px;\n  left: 3px;\n  width: calc(50% - 3px);\n  border-radius: 9px;\n  background: var(--hb-ob2-raised);\n  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 0 0 1px var(--hb-ob2-line);\n  transition: transform 0.3s cubic-bezier(0.3, 0.9, 0.3, 1);\n}\n.hb-ob2-seg[data-value=\"pickup\"]::before { transform: translateX(100%); }\n.hb-ob2-seg button {\n  position: relative;\n  display: inline-flex;\n  align-items: center;\n  justify-content: center;\n  gap: 7px;\n  height: 34px;\n  border: 0;\n  border-radius: 9px;\n  background: none;\n  color: var(--hb-ob2-muted);\n  font: inherit;\n  font-weight: 600;\n  cursor: pointer;\n  transition: color 0.2s ease;\n}\n.hb-ob2-seg button[aria-checked=\"true\"] { color: var(--hb-ob2-text); }\n.hb-ob2-seg svg { width: 15px; height: 15px; }\n.hb-ob2-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }\n@container (min-width: 480px) { .hb-ob2-grid { grid-template-columns: 1fr 1fr; } .hb-ob2-wide { grid-column: 1 / -1; } }\n.hb-ob2-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }\n.hb-ob2-field > span { color: var(--hb-ob2-muted); font-size: 12px; font-weight: 500; }\n.hb-ob2-input {\n  width: 100%;\n  height: 38px;\n  padding: 0 12px;\n  border: 1px solid var(--hb-ob2-line);\n  border-radius: 10px;\n  background: var(--hb-ob2-surface);\n  color: var(--hb-ob2-text);\n  font: inherit;\n  font-size: 14px;\n  outline: none;\n  transition: border-color 0.15s ease, box-shadow 0.15s ease;\n  appearance: none;\n  -webkit-appearance: none;\n}\n.hb-ob2-input::placeholder { color: var(--hb-ob2-faint); }\n.hb-ob2-input:focus { border-color: var(--hb-ob2-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hb-ob2-accent) 22%, transparent); }\n.hb-ob2-input[aria-invalid=\"true\"] { border-color: var(--hb-ob2-danger); }\n.hb-ob2-sel {\n  padding-right: 34px;\n  background-image: linear-gradient(45deg, transparent 50%, var(--hb-ob2-muted) 50%), linear-gradient(135deg, var(--hb-ob2-muted) 50%, transparent 50%);\n  background-position: calc(100% - 17px) 16px, calc(100% - 12px) 16px;\n  background-size: 5px 5px, 5px 5px;\n  background-repeat: no-repeat;\n  cursor: pointer;\n}\n.hb-ob2-sel option { background: var(--hb-ob2-surface); color: var(--hb-ob2-text); }\n.hb-ob2-err, .hb-ob2-field > .hb-ob2-err { color: var(--hb-ob2-danger); font-size: 11.5px; }\n.hb-ob2-store {\n  display: grid;\n  grid-template-columns: 34px minmax(0, 1fr);\n  gap: 2px 12px;\n  padding: 12px;\n  border: 1px solid var(--hb-ob2-line);\n  border-radius: 12px;\n  background: var(--hb-ob2-surface);\n  animation: hb-ob2-in 0.3s ease both;\n}\n.hb-ob2-pin {\n  display: grid;\n  grid-row: span 3;\n  place-items: center;\n  width: 34px;\n  height: 34px;\n  border-radius: 10px;\n  background: color-mix(in srgb, var(--hb-ob2-accent) 16%, transparent);\n  color: var(--hb-ob2-accent);\n}\n.hb-ob2-pin svg { width: 17px; height: 17px; }\n.hb-ob2-store b { font-weight: 600; }\n.hb-ob2-store span { color: var(--hb-ob2-muted); font-size: 12px; }\n.hb-ob2-ready { display: inline-flex; align-items: center; gap: 6px; }\n.hb-ob2-ready::before { content: \"\"; width: 6px; height: 6px; border-radius: 50%; background: var(--hb-ob2-ok); }\n.hb-ob2-deliv { display: flex; flex-direction: column; gap: 10px; animation: hb-ob2-in 0.3s ease both; }\n.hb-ob2-pays { display: flex; flex-direction: column; gap: 8px; }\n.hb-ob2-pay {\n  display: grid;\n  grid-template-columns: 32px minmax(0, 1fr) 18px;\n  align-items: center;\n  gap: 12px;\n  width: 100%;\n  padding: 10px 12px;\n  border: 1px solid var(--hb-ob2-line);\n  border-radius: 12px;\n  background: var(--hb-ob2-surface);\n  color: var(--hb-ob2-text);\n  font: inherit;\n  text-align: left;\n  cursor: pointer;\n  transition: border-color 0.15s ease, background-color 0.15s ease;\n}\n.hb-ob2-pay:hover { border-color: var(--hb-ob2-faint); }\n.hb-ob2-pay[aria-checked=\"true\"] {\n  border-color: var(--hb-ob2-accent);\n  background: color-mix(in srgb, var(--hb-ob2-accent) 7%, var(--hb-ob2-surface));\n}\n.hb-ob2-payicon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--hb-ob2-raised); color: var(--hb-ob2-muted); }\n.hb-ob2-pay[aria-checked=\"true\"] .hb-ob2-payicon { color: var(--hb-ob2-accent); }\n.hb-ob2-payicon svg { width: 17px; height: 17px; }\n.hb-ob2-paytext { display: flex; min-width: 0; flex-direction: column; }\n.hb-ob2-paytext b { font-weight: 600; }\n.hb-ob2-paytext span { overflow: hidden; color: var(--hb-ob2-muted); font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }\n.hb-ob2-radio { position: relative; width: 18px; height: 18px; border: 1.5px solid var(--hb-ob2-faint); border-radius: 50%; transition: border-color 0.15s ease; }\n.hb-ob2-radio::after { content: \"\"; position: absolute; inset: 3px; border-radius: 50%; background: var(--hb-ob2-accent); transform: scale(0); transition: transform 0.2s cubic-bezier(0.3, 1.5, 0.5, 1); }\n.hb-ob2-pay[aria-checked=\"true\"] .hb-ob2-radio { border-color: var(--hb-ob2-accent); }\n.hb-ob2-pay[aria-checked=\"true\"] .hb-ob2-radio::after { transform: scale(1); }\n.hb-ob2-coupon { display: flex; gap: 8px; }\n.hb-ob2-coupon .hb-ob2-input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 0.04em; }\n.hb-ob2-coupon .hb-ob2-input::placeholder { text-transform: none; letter-spacing: 0; }\n.hb-ob2-btn2 {\n  flex: none;\n  height: 38px;\n  padding: 0 14px;\n  border: 1px solid var(--hb-ob2-line);\n  border-radius: 10px;\n  background: var(--hb-ob2-raised);\n  color: var(--hb-ob2-text);\n  font: inherit;\n  font-weight: 600;\n  cursor: pointer;\n  transition: border-color 0.15s ease;\n}\n.hb-ob2-btn2:hover:not(:disabled) { border-color: var(--hb-ob2-faint); }\n.hb-ob2-btn2:disabled { opacity: 0.5; cursor: default; }\n.hb-ob2-applied {\n  display: flex;\n  align-items: center;\n  gap: 10px;\n  padding: 9px 10px 9px 12px;\n  border: 1px dashed color-mix(in srgb, var(--hb-ob2-ok) 55%, transparent);\n  border-radius: 10px;\n  background: color-mix(in srgb, var(--hb-ob2-ok) 8%, transparent);\n  animation: hb-ob2-in 0.3s ease both;\n}\n.hb-ob2-applied svg { width: 16px; height: 16px; color: var(--hb-ob2-ok); }\n.hb-ob2-applied b { font-weight: 600; }\n.hb-ob2-applied span { color: var(--hb-ob2-muted); font-size: 12px; }\n.hb-ob2-applied .hb-ob2-link { margin-left: auto; }\n.hb-ob2-sum { display: flex; flex-direction: column; gap: 7px; padding-top: 4px; }\n.hb-ob2-sumrow { display: flex; justify-content: space-between; gap: 12px; color: var(--hb-ob2-muted); font-variant-numeric: tabular-nums; }\n.hb-ob2-sumrow b { color: var(--hb-ob2-text); font-weight: 500; }\n.hb-ob2-sumrow[data-kind=\"discount\"] b { color: var(--hb-ob2-ok); }\n.hb-ob2-sumrow[data-kind=\"pending\"] b { color: var(--hb-ob2-faint); font-weight: 400; }\n.hb-ob2-sumrow[data-kind=\"total\"] { padding-top: 9px; border-top: 1px solid var(--hb-ob2-line); color: var(--hb-ob2-text); font-size: 15px; font-weight: 650; }\n.hb-ob2-sumrow[data-kind=\"total\"] b { font-weight: 700; }\n.hb-ob2-foot {\n  flex: none;\n  padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px));\n  border-top: 1px solid var(--hb-ob2-line);\n  background: var(--hb-ob2-bg);\n}\n.hb-ob2[data-inline=\"true\"] .hb-ob2-foot { padding-bottom: 12px; }\n.hb-ob2-cta {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 10px;\n  width: 100%;\n  height: 46px;\n  padding: 0 16px;\n  border: 0;\n  border-radius: 13px;\n  background: var(--hb-ob2-accent);\n  color: #fff;\n  font: inherit;\n  font-size: 14.5px;\n  font-weight: 650;\n  cursor: pointer;\n  box-shadow: 0 10px 24px -12px var(--hb-ob2-accent);\n  transition: filter 0.15s ease, transform 0.12s ease;\n}\n.hb-ob2-cta:hover:not(:disabled) { filter: brightness(1.08); }\n.hb-ob2-cta:active:not(:disabled) { transform: scale(0.985); }\n.hb-ob2-cta:disabled { cursor: default; opacity: 0.55; }\n.hb-ob2-cta b { font-variant-numeric: tabular-nums; }\n.hb-ob2-cta[data-busy=\"true\"] span::after { content: \"\"; display: inline-block; width: 1.2em; text-align: left; animation: hb-ob2-dots 1.2s steps(4) infinite; }\n.hb-ob2 button:focus-visible, .hb-ob2-link:focus-visible { outline: 2px solid var(--hb-ob2-accent); outline-offset: 2px; }\n.hb-ob2-empty, .hb-ob2-done {\n  display: flex;\n  flex: 1;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  gap: 6px;\n  padding: 20px 8px;\n  text-align: center;\n}\n.hb-ob2-empty b, .hb-ob2-done b { font-size: 15px; font-weight: 650; }\n.hb-ob2-empty span, .hb-ob2-done span { max-width: 280px; color: var(--hb-ob2-muted); }\n.hb-ob2-emptyicon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 6px; border-radius: 16px; background: var(--hb-ob2-surface); color: var(--hb-ob2-faint); box-shadow: inset 0 0 0 1px var(--hb-ob2-line); }\n.hb-ob2-emptyicon svg { width: 24px; height: 24px; }\n.hb-ob2-check { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 8px; border-radius: 50%; background: color-mix(in srgb, var(--hb-ob2-ok) 16%, transparent); color: var(--hb-ob2-ok); animation: hb-ob2-pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) both; }\n.hb-ob2-check svg { width: 26px; height: 26px; stroke-width: 2.4; stroke-dasharray: 30; stroke-dashoffset: 30; animation: hb-ob2-draw 0.5s 0.2s ease forwards; }\n.hb-ob2-receipt { display: flex; gap: 8px; margin-top: 8px; padding: 6px 12px; border: 1px solid var(--hb-ob2-line); border-radius: 999px; background: var(--hb-ob2-surface); font-variant-numeric: tabular-nums; }\n.hb-ob2-done .hb-ob2-btn2 { margin-top: 12px; }\n.hb-ob2-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n@keyframes hb-ob2-sheet { from { transform: translateY(100%); } to { transform: translateY(0); } }\n@keyframes hb-ob2-side { from { transform: translateX(100%); } to { transform: translateX(0); } }\n@keyframes hb-ob2-fade { from { opacity: 0; } to { opacity: 1; } }\n@keyframes hb-ob2-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }\n@keyframes hb-ob2-pop { from { transform: scale(0.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }\n@keyframes hb-ob2-draw { to { stroke-dashoffset: 0; } }\n@keyframes hb-ob2-dots { 0% { content: \"\"; } 25% { content: \".\"; } 50% { content: \"..\"; } 75% { content: \"...\"; } }\n@media (prefers-reduced-motion: reduce) {\n  .hb-ob2, .hb-ob2 *, .hb-ob2-scrim { animation: none !important; transition: none !important; }\n  .hb-ob2-check svg { stroke-dashoffset: 0; }\n}\n`;\n\nfunction useControlled<T>(value: T | undefined, initial: T, onChange?: (next: T) => void) {\n  const [inner, setInner] = React.useState<T>(initial);\n  const controlled = value !== undefined;\n  const current = controlled ? (value as T) : inner;\n  const set = React.useCallback(\n    (next: T) => {\n      if (!controlled) setInner(next);\n      onChange?.(next);\n    },\n    [controlled, onChange],\n  );\n  return [current, set] as const;\n}\n\nfunction fill(template: string, values: Record<string, string>) {\n  return template.replace(/\\{(\\w+)\\}/g, (m, k: string) => (k in values ? values[k] : m));\n}\n\nfunction hashHue(text: string) {\n  let h = 0;\n  for (let i = 0; i < text.length; i++) h = (Math.imul(h, 31) + text.charCodeAt(i)) >>> 0;\n  return h % 360;\n}\n\nconst focusable = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\nfunction PayIcon({ kind }: { kind: PaymentMethod[\"icon\"] }) {\n  if (kind === \"cash\")\n    return (\n      <svg viewBox=\"0 0 24 24\">\n        <rect x=\"3\" y=\"6\" width=\"18\" height=\"12\" rx=\"2.5\" />\n        <circle cx=\"12\" cy=\"12\" r=\"2.6\" />\n        <path d=\"M6.5 9.5v.01M17.5 14.5v.01\" />\n      </svg>\n    );\n  if (kind === \"card\")\n    return (\n      <svg viewBox=\"0 0 24 24\">\n        <rect x=\"3\" y=\"5.5\" width=\"18\" height=\"13\" rx=\"2.5\" />\n        <path d=\"M3 10h18M7 15h3\" />\n      </svg>\n    );\n  if (kind === \"instant\")\n    return (\n      <svg viewBox=\"0 0 24 24\">\n        <path d=\"M13 3 5 13.5h6L10 21l8-10.5h-6L13 3Z\" />\n      </svg>\n    );\n  return (\n    <svg viewBox=\"0 0 24 24\">\n      <path d=\"M4 7.5A2.5 2.5 0 0 1 6.5 5H18v4\" />\n      <rect x=\"4\" y=\"7.5\" width=\"16\" height=\"11.5\" rx=\"2.5\" />\n      <path d=\"M16 13.2h.01\" />\n    </svg>\n  );\n}\n\nexport function OrderCartDrawer({\n  open,\n  defaultOpen = false,\n  onOpenChange,\n  inline = false,\n  items,\n  defaultItems: initialItems = defaultItems,\n  onItemsChange,\n  mode,\n  defaultMode = \"delivery\",\n  onModeChange,\n  areas = defaultAreas,\n  defaultAreaId,\n  store = defaultStore,\n  paymentMethods = defaultPayments,\n  defaultPaymentId,\n  onApplyCoupon,\n  onSubmit,\n  onNewOrder,\n  currency = \"USD\",\n  locale = \"en-US\",\n  theme = \"dark\",\n  accent = \"#2f7bff\",\n  labels,\n  className,\n  style,\n  ...rest\n}: OrderCartDrawerProps) {\n  const l = { ...defaultLabels, ...labels };\n  const uid = React.useId();\n  const money = React.useMemo(() => new Intl.NumberFormat(locale, { style: \"currency\", currency }), [locale, currency]);\n  const [isOpen, setOpen] = useControlled(open, defaultOpen, onOpenChange);\n  const [lines, setLines] = useControlled(items, initialItems, onItemsChange);\n  const [orderMode, setOrderMode] = useControlled(mode, defaultMode, onModeChange);\n  const [areaId, setAreaId] = React.useState(defaultAreaId ?? \"\");\n  const [paymentId, setPaymentId] = React.useState(defaultPaymentId ?? paymentMethods[0]?.id ?? \"\");\n  const [customer, setCustomer] = React.useState({ name: \"\", phone: \"\" });\n  const [address, setAddress] = React.useState({ street: \"\", details: \"\" });\n  const [notesOpen, setNotesOpen] = React.useState<Record<string, boolean>>({});\n  const [couponInput, setCouponInput] = React.useState(\"\");\n  const [coupon, setCoupon] = React.useState<CouponResult | null>(null);\n  const [couponState, setCouponState] = React.useState<\"idle\" | \"checking\" | \"invalid\">(\"idle\");\n  const [status, setStatus] = React.useState<\"idle\" | \"sending\" | \"sent\">(\"idle\");\n  const [showErrors, setShowErrors] = React.useState(false);\n  const [sentTotal, setSentTotal] = React.useState(0);\n  const layerRef = React.useRef<HTMLDivElement>(null);\n  const panelRef = React.useRef<HTMLDivElement>(null);\n  const bodyRef = React.useRef<HTMLDivElement>(null);\n\n  const visible = inline || isOpen;\n  const close = React.useCallback(() => setOpen(false), [setOpen]);\n\n  React.useEffect(() => {\n    if (inline || !isOpen) return;\n    const layer = layerRef.current;\n    const panel = panelRef.current;\n    if (!layer || !panel) return;\n    const opener = document.activeElement as HTMLElement | null;\n    const html = document.documentElement;\n    const body = document.body;\n    const prev = { html: html.style.overflow, body: body.style.overflow };\n    html.style.overflow = \"hidden\";\n    body.style.overflow = \"hidden\";\n    const inerted: HTMLElement[] = [];\n    let node: HTMLElement | null = layer;\n    while (node && node !== body && node.parentElement) {\n      for (const sibling of Array.from(node.parentElement.children)) {\n        if (sibling !== node && sibling instanceof HTMLElement && !sibling.inert && sibling.tagName !== \"STYLE\" && sibling.tagName !== \"SCRIPT\") {\n          sibling.inert = true;\n          inerted.push(sibling);\n        }\n      }\n      node = node.parentElement;\n    }\n    const frame = requestAnimationFrame(() => {\n      const first = panel.querySelector<HTMLElement>(focusable);\n      (first ?? panel).focus({ preventScroll: true });\n    });\n    return () => {\n      cancelAnimationFrame(frame);\n      html.style.overflow = prev.html;\n      body.style.overflow = prev.body;\n      for (const el of inerted) el.inert = false;\n      if (opener && typeof opener.focus === \"function\") opener.focus({ preventScroll: true });\n    };\n  }, [inline, isOpen]);\n\n  const onLayerKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n    if (event.key === \"Escape\") {\n      event.stopPropagation();\n      close();\n      return;\n    }\n    if (event.key !== \"Tab\") return;\n    const panel = panelRef.current;\n    if (!panel) return;\n    const nodes = Array.from(panel.querySelectorAll<HTMLElement>(focusable)).filter((n) => n.offsetParent !== null);\n    if (!nodes.length) {\n      event.preventDefault();\n      return;\n    }\n    const first = nodes[0];\n    const last = nodes[nodes.length - 1];\n    if (event.shiftKey && (document.activeElement === first || document.activeElement === panel)) {\n      event.preventDefault();\n      last.focus();\n    } else if (!event.shiftKey && document.activeElement === last) {\n      event.preventDefault();\n      first.focus();\n    }\n  };\n\n  const count = lines.reduce((s, line) => s + line.quantity, 0);\n  const subtotal = lines.reduce((s, line) => s + line.price * line.quantity, 0);\n  const area = orderMode === \"delivery\" ? areas.find((a) => a.id === areaId) ?? null : null;\n  const deliveryFee = area ? area.fee : 0;\n  const discount = coupon ? Math.min(Math.max(0, coupon.discount), subtotal) : 0;\n  const total = Math.max(0, subtotal + deliveryFee - discount);\n  const payment = paymentMethods.find((p) => p.id === paymentId) ?? null;\n\n  const errors = {\n    name: !customer.name.trim(),\n    phone: customer.phone.replace(/\\D/g, \"\").length < 7,\n    area: orderMode === \"delivery\" && !area,\n    street: orderMode === \"delivery\" && !address.street.trim(),\n    payment: !payment,\n  };\n  const invalid = Object.values(errors).some(Boolean);\n\n  const updateLine = (id: string, patch: Partial<CartLine>) => setLines(lines.map((line) => (line.id === id ? { ...line, ...patch } : line)));\n  const removeLine = (id: string) => setLines(lines.filter((line) => line.id !== id));\n\n  const applyCoupon = async () => {\n    const code = couponInput.trim().toUpperCase();\n    if (!code) return;\n    if (!onApplyCoupon) {\n      setCouponState(\"invalid\");\n      return;\n    }\n    setCouponState(\"checking\");\n    try {\n      const result = await onApplyCoupon(code, subtotal);\n      if (result && result.discount > 0) {\n        setCoupon(result);\n        setCouponInput(\"\");\n        setCouponState(\"idle\");\n      } else setCouponState(\"invalid\");\n    } catch {\n      setCouponState(\"invalid\");\n    }\n  };\n\n  const submit = async () => {\n    if (status !== \"idle\" || !lines.length) return;\n    if (invalid) {\n      setShowErrors(true);\n      const order = [\"name\", \"phone\", \"area\", \"street\", \"payment\"] as const;\n      const key = order.find((k) => errors[k]);\n      if (key) {\n        const el = panelRef.current?.querySelector<HTMLElement>(`[data-field=\"${key}\"]`);\n        el?.scrollIntoView({ block: \"center\", behavior: \"smooth\" });\n        el?.focus({ preventScroll: true });\n      }\n      return;\n    }\n    const order: CartOrder = {\n      items: lines,\n      mode: orderMode,\n      area,\n      customer: { name: customer.name.trim(), phone: customer.phone.trim() },\n      address: orderMode === \"delivery\" ? { street: address.street.trim(), details: address.details.trim() } : null,\n      payment,\n      coupon,\n      subtotal,\n      deliveryFee,\n      discount,\n      total,\n    };\n    setStatus(\"sending\");\n    try {\n      await onSubmit?.(order);\n      setSentTotal(total);\n      setStatus(\"sent\");\n      bodyRef.current?.scrollTo({ top: 0 });\n    } catch {\n      setStatus(\"idle\");\n    }\n  };\n\n  const startNew = () => {\n    setStatus(\"idle\");\n    setShowErrors(false);\n    setCoupon(null);\n    setCouponInput(\"\");\n    setCouponState(\"idle\");\n    if (items === undefined) setLines([]);\n    onNewOrder?.();\n  };\n\n  if (!visible) return null;\n\n  const err = (key: keyof typeof errors) => showErrors && errors[key];\n  const titleId = `${uid}-title`;\n\n  const panel = (\n    <div\n      ref={panelRef}\n      className={[\"hb-ob2\", inline ? className : undefined].filter(Boolean).join(\" \")}\n      data-inline={inline ? \"true\" : \"false\"}\n      data-theme={theme}\n      role={inline ? \"region\" : \"dialog\"}\n      aria-modal={inline ? undefined : true}\n      aria-labelledby={titleId}\n      tabIndex={-1}\n      style={inline ? ({ \"--hb-ob2-accent\": accent, ...style } as React.CSSProperties) : ({ \"--hb-ob2-accent\": accent } as React.CSSProperties)}\n      {...(inline ? rest : {})}\n    >\n      <style href=\"hb-order-cart-drawer\" precedence=\"default\">{css}</style>\n      <div className=\"hb-ob2-grab\" aria-hidden=\"true\">\n        <span />\n      </div>\n      <div className=\"hb-ob2-head\">\n        <h2 id={titleId} className=\"hb-ob2-title\">\n          {l.title}\n        </h2>\n        {count > 0 && status !== \"sent\" ? <span className=\"hb-ob2-chip\">{count}</span> : null}\n        {inline ? null : (\n          <button type=\"button\" className=\"hb-ob2-x\" onClick={close} aria-label={l.close}>\n            <svg viewBox=\"0 0 24 24\">\n              <path d=\"M6 6l12 12M18 6 6 18\" />\n            </svg>\n          </button>\n        )}\n      </div>\n\n      <div ref={bodyRef} className=\"hb-ob2-body\">\n        {status === \"sent\" ? (\n          <div className=\"hb-ob2-done\" role=\"status\">\n            <span className=\"hb-ob2-check\" aria-hidden=\"true\">\n              <svg viewBox=\"0 0 24 24\">\n                <path d=\"M5 12.5 10 17.5 19 7\" />\n              </svg>\n            </span>\n            <b>{l.sentTitle}</b>\n            <span>{l.sentText}</span>\n            <span className=\"hb-ob2-receipt\">\n              {l.total} <b>{money.format(sentTotal)}</b>\n            </span>\n            <button type=\"button\" className=\"hb-ob2-btn2\" onClick={startNew}>\n              {l.newOrder}\n            </button>\n          </div>\n        ) : lines.length === 0 ? (\n          <div className=\"hb-ob2-empty\">\n            <span className=\"hb-ob2-emptyicon\" aria-hidden=\"true\">\n              <svg viewBox=\"0 0 24 24\">\n                <path d=\"M5 8h14l-1.2 11.1a2 2 0 0 1-2 1.9H8.2a2 2 0 0 1-2-1.9L5 8Z\" />\n                <path d=\"M9 10V6.5a3 3 0 0 1 6 0V10\" />\n              </svg>\n            </span>\n            <b>{l.empty}</b>\n            <span>{l.emptyHint}</span>\n          </div>\n        ) : (\n          <>\n            <ul className=\"hb-ob2-lines\">\n              {lines.map((line) => {\n                const tone = line.color ?? `hsl(${hashHue(line.id)} 55% 48%)`;\n                const noteOpen = notesOpen[line.id] ?? false;\n                const noteId = `${uid}-note-${line.id}`;\n                return (\n                  <li key={line.id} className=\"hb-ob2-line\">\n                    <span className=\"hb-ob2-art\" style={{ \"--hb-ob2-tone\": tone } as React.CSSProperties} aria-hidden=\"true\">\n                      {line.name.trim().charAt(0).toUpperCase()}\n                    </span>\n                    <span className=\"hb-ob2-info\">\n                      <span className=\"hb-ob2-name\">{line.name}</span>\n                      {line.options ? <span className=\"hb-ob2-opt\">{line.options}</span> : null}\n                    </span>\n                    <span className=\"hb-ob2-price\">{money.format(line.price * line.quantity)}</span>\n                    <span className=\"hb-ob2-row2\">\n                      <span className=\"hb-ob2-links\">\n                        <button\n                          type=\"button\"\n                          className=\"hb-ob2-link\"\n                          aria-expanded={noteOpen}\n                          aria-controls={noteOpen ? noteId : undefined}\n                          onClick={() => setNotesOpen({ ...notesOpen, [line.id]: !noteOpen })}\n                        >\n                          {line.note ? l.editNote : l.addNote}\n                        </button>\n                        <button type=\"button\" className=\"hb-ob2-link\" data-danger=\"true\" onClick={() => removeLine(line.id)} aria-label={`${l.remove} ${line.name}`}>\n                          {l.remove}\n                        </button>\n                        {line.note && !noteOpen ? <span className=\"hb-ob2-notetext\">{line.note}</span> : null}\n                      </span>\n                      <span className=\"hb-ob2-step\">\n                        <button\n                          type=\"button\"\n                          aria-label={`${l.decrease}, ${line.name}`}\n                          disabled={line.quantity <= 1}\n                          onClick={() => updateLine(line.id, { quantity: Math.max(1, line.quantity - 1) })}\n                        >\n                          <svg viewBox=\"0 0 24 24\">\n                            <path d=\"M6 12h12\" />\n                          </svg>\n                        </button>\n                        <span className=\"hb-ob2-qty\" aria-live=\"polite\">\n                          {line.quantity}\n                        </span>\n                        <button type=\"button\" aria-label={`${l.increase}, ${line.name}`} onClick={() => updateLine(line.id, { quantity: line.quantity + 1 })}>\n                          <svg viewBox=\"0 0 24 24\">\n                            <path d=\"M12 6v12M6 12h12\" />\n                          </svg>\n                        </button>\n                      </span>\n                    </span>\n                    {noteOpen ? (\n                      <span className=\"hb-ob2-note\">\n                        <input\n                          id={noteId}\n                          className=\"hb-ob2-input\"\n                          value={line.note ?? \"\"}\n                          placeholder={l.notePlaceholder}\n                          aria-label={`${l.notePlaceholder}, ${line.name}`}\n                          maxLength={140}\n                          onChange={(e) => updateLine(line.id, { note: e.target.value })}\n                          onKeyDown={(e) => {\n                            if (e.key === \"Enter\") setNotesOpen({ ...notesOpen, [line.id]: false });\n                          }}\n                        />\n                      </span>\n                    ) : null}\n                  </li>\n                );\n              })}\n            </ul>\n\n            <div className=\"hb-ob2-sec\">\n              <div className=\"hb-ob2-seg\" role=\"radiogroup\" aria-label={`${l.delivery} / ${l.pickup}`} data-value={orderMode}>\n                {([\"delivery\", \"pickup\"] as const).map((m) => (\n                  <button\n                    key={m}\n                    type=\"button\"\n                    role=\"radio\"\n                    aria-checked={orderMode === m}\n                    tabIndex={orderMode === m ? 0 : -1}\n                    onClick={() => setOrderMode(m)}\n                    onKeyDown={(e) => {\n                      if ([\"ArrowLeft\", \"ArrowRight\", \"ArrowUp\", \"ArrowDown\"].includes(e.key)) {\n                        e.preventDefault();\n                        const next = orderMode === \"delivery\" ? \"pickup\" : \"delivery\";\n                        setOrderMode(next);\n                        const sib = (e.currentTarget.parentElement?.querySelector(`button:nth-of-type(${next === \"delivery\" ? 1 : 2})`) ?? null) as HTMLElement | null;\n                        sib?.focus();\n                      }\n                    }}\n                  >\n                    {m === \"delivery\" ? (\n                      <svg viewBox=\"0 0 24 24\">\n                        <path d=\"M3 7h11v9H3zM14 10h4l3 3v3h-7\" />\n                        <circle cx=\"7\" cy=\"17.5\" r=\"1.8\" />\n                        <circle cx=\"17\" cy=\"17.5\" r=\"1.8\" />\n                      </svg>\n                    ) : (\n                      <svg viewBox=\"0 0 24 24\">\n                        <path d=\"M4 9.5 5.5 4h13L20 9.5M4 9.5h16M4 9.5v10h16v-10M9.5 19.5v-5h5v5\" />\n                      </svg>\n                    )}\n                    {m === \"delivery\" ? l.delivery : l.pickup}\n                  </button>\n                ))}\n              </div>\n\n              {orderMode === \"delivery\" ? (\n                <div className=\"hb-ob2-deliv\" key=\"delivery\">\n                  <label className=\"hb-ob2-field\">\n                    <span>{l.area}</span>\n                    <select\n                      className=\"hb-ob2-input hb-ob2-sel\"\n                      data-field=\"area\"\n                      value={areaId}\n                      aria-invalid={err(\"area\") || undefined}\n                      onChange={(e) => setAreaId(e.target.value)}\n                    >\n                      <option value=\"\">{l.areaPlaceholder}</option>\n                      {areas.map((a) => (\n                        <option key={a.id} value={a.id}>\n                          {`${a.label} · ${a.fee > 0 ? money.format(a.fee) : l.deliveryFree}${a.eta ? ` · ${a.eta}` : \"\"}`}\n                        </option>\n                      ))}\n                    </select>\n                    {err(\"area\") ? <span className=\"hb-ob2-err\">{l.required}</span> : null}\n                  </label>\n                </div>\n              ) : (\n                <div className=\"hb-ob2-store\" key=\"pickup\">\n                  <span className=\"hb-ob2-pin\" aria-hidden=\"true\">\n                    <svg viewBox=\"0 0 24 24\">\n                      <path d=\"M12 21s-6.5-5.6-6.5-11A6.5 6.5 0 0 1 18.5 10c0 5.4-6.5 11-6.5 11Z\" />\n                      <circle cx=\"12\" cy=\"10\" r=\"2.3\" />\n                    </svg>\n                  </span>\n                  <span>{l.pickupAt}</span>\n                  <b>{store.name}</b>\n                  <span>{store.address}</span>\n                  {store.readyTime ? (\n                    <span className=\"hb-ob2-ready\" style={{ gridColumn: \"2\" }}>\n                      {l.readyIn} {store.readyTime}\n                    </span>\n                  ) : null}\n                </div>\n              )}\n            </div>\n\n            <div className=\"hb-ob2-sec\">\n              <p className=\"hb-ob2-label\">{l.details}</p>\n              <div className=\"hb-ob2-grid\">\n                <label className=\"hb-ob2-field\">\n                  <span>{l.name}</span>\n                  <input\n                    className=\"hb-ob2-input\"\n                    data-field=\"name\"\n                    autoComplete=\"name\"\n                    value={customer.name}\n                    aria-invalid={err(\"name\") || undefined}\n                    onChange={(e) => setCustomer({ ...customer, name: e.target.value })}\n                  />\n                  {err(\"name\") ? <span className=\"hb-ob2-err\">{l.required}</span> : null}\n                </label>\n                <label className=\"hb-ob2-field\">\n                  <span>{l.phone}</span>\n                  <input\n                    className=\"hb-ob2-input\"\n                    data-field=\"phone\"\n                    type=\"tel\"\n                    inputMode=\"tel\"\n                    autoComplete=\"tel\"\n                    value={customer.phone}\n                    aria-invalid={err(\"phone\") || undefined}\n                    onChange={(e) => setCustomer({ ...customer, phone: e.target.value })}\n                  />\n                  {err(\"phone\") ? <span className=\"hb-ob2-err\">{l.required}</span> : null}\n                </label>\n                {orderMode === \"delivery\" ? (\n                  <>\n                    <label className=\"hb-ob2-field hb-ob2-wide\">\n                      <span>{l.street}</span>\n                      <input\n                        className=\"hb-ob2-input\"\n                        data-field=\"street\"\n                        autoComplete=\"street-address\"\n                        value={address.street}\n                        aria-invalid={err(\"street\") || undefined}\n                        onChange={(e) => setAddress({ ...address, street: e.target.value })}\n                      />\n                      {err(\"street\") ? <span className=\"hb-ob2-err\">{l.required}</span> : null}\n                    </label>\n                    <label className=\"hb-ob2-field hb-ob2-wide\">\n                      <span>{l.streetDetails}</span>\n                      <input className=\"hb-ob2-input\" value={address.details} onChange={(e) => setAddress({ ...address, details: e.target.value })} />\n                    </label>\n                  </>\n                ) : null}\n              </div>\n            </div>\n\n            {paymentMethods.length ? (\n              <div className=\"hb-ob2-sec\">\n                <p className=\"hb-ob2-label\" id={`${uid}-pay`}>\n                  {l.payment}\n                </p>\n                <div className=\"hb-ob2-pays\" role=\"radiogroup\" aria-labelledby={`${uid}-pay`}>\n                  {paymentMethods.map((p, i) => {\n                    const checked = p.id === paymentId;\n                    return (\n                      <button\n                        key={p.id}\n                        type=\"button\"\n                        role=\"radio\"\n                        className=\"hb-ob2-pay\"\n                        data-field={i === 0 ? \"payment\" : undefined}\n                        aria-checked={checked}\n                        tabIndex={checked || (!payment && i === 0) ? 0 : -1}\n                        onClick={() => setPaymentId(p.id)}\n                        onKeyDown={(e) => {\n                          const step = e.key === \"ArrowDown\" || e.key === \"ArrowRight\" ? 1 : e.key === \"ArrowUp\" || e.key === \"ArrowLeft\" ? -1 : 0;\n                          if (!step) return;\n                          e.preventDefault();\n                          const next = paymentMethods[(i + step + paymentMethods.length) % paymentMethods.length];\n                          setPaymentId(next.id);\n                          const buttons = e.currentTarget.parentElement?.querySelectorAll<HTMLElement>(\"button\");\n                          buttons?.[(i + step + paymentMethods.length) % paymentMethods.length]?.focus();\n                        }}\n                      >\n                        <span className=\"hb-ob2-payicon\" aria-hidden=\"true\">\n                          <PayIcon kind={p.icon} />\n                        </span>\n                        <span className=\"hb-ob2-paytext\">\n                          <b>{p.label}</b>\n                          {p.hint ? <span>{p.hint}</span> : null}\n                        </span>\n                        <span className=\"hb-ob2-radio\" aria-hidden=\"true\" />\n                      </button>\n                    );\n                  })}\n                </div>\n              </div>\n            ) : null}\n\n            <div className=\"hb-ob2-sec\">\n              <p className=\"hb-ob2-label\">{l.coupon}</p>\n              {coupon ? (\n                <div className=\"hb-ob2-applied\">\n                  <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n                    <path d=\"M3 9V6.5A1.5 1.5 0 0 1 4.5 5h15A1.5 1.5 0 0 1 21 6.5V9a3 3 0 0 0 0 6v2.5a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 17.5V15a3 3 0 0 0 0-6Z\" />\n                    <path d=\"m9 12.5 2 2 4-4.5\" />\n                  </svg>\n                  <span>\n                    <b>{fill(l.couponApplied, { code: coupon.code })}</b>\n                    {coupon.label ? ` · ${coupon.label}` : \"\"}\n                  </span>\n                  <button type=\"button\" className=\"hb-ob2-link\" data-danger=\"true\" onClick={() => setCoupon(null)}>\n                    {l.removeCoupon}\n                  </button>\n                </div>\n              ) : (\n                <>\n                  <form\n                    className=\"hb-ob2-coupon\"\n                    onSubmit={(e) => {\n                      e.preventDefault();\n                      void applyCoupon();\n                    }}\n                  >\n                    <input\n                      className=\"hb-ob2-input\"\n                      value={couponInput}\n                      placeholder={l.couponPlaceholder}\n                      aria-label={l.coupon}\n                      aria-invalid={couponState === \"invalid\" || undefined}\n                      autoCapitalize=\"characters\"\n                      onChange={(e) => {\n                        setCouponInput(e.target.value);\n                        if (couponState === \"invalid\") setCouponState(\"idle\");\n                      }}\n                    />\n                    <button type=\"submit\" className=\"hb-ob2-btn2\" disabled={!couponInput.trim() || couponState === \"checking\"}>\n                      {l.apply}\n                    </button>\n                  </form>\n                  {couponState === \"invalid\" ? (\n                    <span className=\"hb-ob2-err\" role=\"alert\">\n                      {l.couponInvalid}\n                    </span>\n                  ) : null}\n                </>\n              )}\n            </div>\n\n            <div className=\"hb-ob2-sum\">\n              <div className=\"hb-ob2-sumrow\">\n                <span>{l.subtotal}</span>\n                <b>{money.format(subtotal)}</b>\n              </div>\n              {orderMode === \"delivery\" ? (\n                <div className=\"hb-ob2-sumrow\" data-kind={area ? undefined : \"pending\"}>\n                  <span>{l.deliveryFee}</span>\n                  <b>{area ? (area.fee > 0 ? money.format(area.fee) : l.deliveryFree) : l.deliveryPending}</b>\n                </div>\n              ) : null}\n              {discount > 0 ? (\n                <div className=\"hb-ob2-sumrow\" data-kind=\"discount\">\n                  <span>{l.discount}</span>\n                  <b>{`-${money.format(discount)}`}</b>\n                </div>\n              ) : null}\n              <div className=\"hb-ob2-sumrow\" data-kind=\"total\">\n                <span>{l.total}</span>\n                <b>{money.format(total)}</b>\n              </div>\n            </div>\n          </>\n        )}\n      </div>\n\n      {status !== \"sent\" && lines.length > 0 ? (\n        <div className=\"hb-ob2-foot\">\n          <button type=\"button\" className=\"hb-ob2-cta\" data-busy={status === \"sending\" ? \"true\" : \"false\"} disabled={status === \"sending\"} onClick={() => void submit()}>\n            <span>{status === \"sending\" ? l.sending : l.submit}</span>\n            <b>{money.format(total)}</b>\n          </button>\n        </div>\n      ) : null}\n    </div>\n  );\n\n  if (inline) return panel;\n\n  return (\n    <div\n      ref={layerRef}\n      className={[\"hb-ob2-layer\", className].filter(Boolean).join(\" \")}\n      style={style}\n      onKeyDown={onLayerKeyDown}\n      {...rest}\n    >\n      <div className=\"hb-ob2-scrim\" aria-hidden=\"true\" onClick={close} />\n      {panel}\n    </div>\n  );\n}\n"
    }
  ]
}