// PrimeHouse — inline SVG icons for the offer print sheet.
// Font icons (Material Symbols) don't survive html-to-image / some PDF
// exports — they fall back to literal ligature text. These inline SVGs
// always render. API mirrors the bundle's <Icon>: <Icon size style>name</Icon>.
const PH_ICON_PATHS = {
  square_foot: (
    <g><path d="M3 7V5a2 2 0 0 1 2-2h2" /><path d="M17 3h2a2 2 0 0 1 2 2v2" /><path d="M21 17v2a2 2 0 0 1-2 2h-2" /><path d="M7 21H5a2 2 0 0 1-2-2v-2" /><rect x="8.5" y="8.5" width="7" height="7" /></g>
  ),
  meeting_room: (
    <g><path d="M18 20V6a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v14" /><path d="M2 20h20" /><path d="M14 12h.01" /></g>
  ),
  bathtub: (
    <g><path d="M9 6 6.5 3.5a1.5 1.5 0 0 0-1-.5C4.7 3 4 3.7 4 4.5V12" /><path d="M2 12h20v3a4 4 0 0 1-4 4H6a4 4 0 0 1-4-4z" /><path d="M6 19v2" /><path d="M18 19v2" /></g>
  ),
  stairs: (
    <polyline points="21 6 17 6 17 10 13 10 13 14 9 14 9 18 3 18" />
  ),
  location_on: (
    <g><path d="M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0Z" /><circle cx="12" cy="10" r="3" /></g>
  ),
  check: (
    <g><path d="M20 6 9 17l-5-5" /></g>
  ),
  add_circle: (
    <g><circle cx="12" cy="12" r="10" /><path d="M8 12h8" /><path d="M12 8v8" /></g>
  ),
  info: (
    <g><circle cx="12" cy="12" r="10" /><path d="M12 16v-4" /><path d="M12 8h.01" /></g>
  ),
  call: (
    <g><path d="M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92Z" /></g>
  ),
  mail: (
    <g><rect x="2" y="4" width="20" height="16" rx="2" /><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7" /></g>
  ),
  language: (
    <g><circle cx="12" cy="12" r="10" /><path d="M2 12h20" /><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20Z" /></g>
  ),
  storefront: (
    <g><path d="m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7" /><path d="M2 7h20" /><path d="M4 7v13a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V7" /><path d="M10 21v-5a2 2 0 0 1 4 0v5" /></g>
  ),
  shopping_cart: (
    <g><circle cx="8" cy="21" r="1" /><circle cx="19" cy="21" r="1" /><path d="M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12" /></g>
  ),
  school: (
    <g><path d="M2 10l10-5 10 5-10 5z" /><path d="M6 12v5c3 2.5 9 2.5 12 0v-5" /><path d="M22 10v6" /></g>
  ),
  directions_bus: (
    <g><path d="M4 17V7a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10" /><path d="M4 11h16" /><path d="M3 17h18a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-1" /><path d="M4 20H3a1 1 0 0 1-1-1v-1a1 1 0 0 1 1-1" /><circle cx="7.5" cy="20" r="1.5" /><circle cx="16.5" cy="20" r="1.5" /></g>
  ),
  child_care: (
    <g><circle cx="12" cy="12" r="9" /><path d="M9 11h.01" /><path d="M15 11h.01" /><path d="M9.5 15a3.5 3 0 0 0 5 0" /></g>
  ),
};

function PhIcon({ children, size = 24, style = {} }) {
  const key = String(children);
  const inner = PH_ICON_PATHS[key];
  return (
    <svg
      width={size}
      height={size}
      viewBox="0 0 24 24"
      fill="none"
      stroke="currentColor"
      strokeWidth="1.9"
      strokeLinecap="round"
      strokeLinejoin="round"
      aria-hidden="true"
      style={{ display: "inline-block", verticalAlign: "middle", width: size + "px", height: size + "px", flex: "0 0 auto", flexShrink: 0, ...style }}
    >
      {inner || null}
    </svg>
  );
}

window.PhIcon = PhIcon;
