import { TRANSITION_STYLE } from "../constants";
import type { OrganSvgProps } from "../types";

export function Heart({ style, colorScale, isActive = false, className }: OrganSvgProps) {
  const defaultColor = colorScale[200];
  const activeColor = colorScale[300];
  const fill = style?.fill ?? (isActive ? activeColor : defaultColor);

  return (
    <g className={className} data-organ="heart">
      <path
        d={HEART_PATH}
        fill={fill}
        stroke={style?.stroke}
        strokeWidth={style?.strokeWidth}
        style={{ transition: TRANSITION_STYLE }}
      />
    </g>
  );
}

const HEART_PATH =
  "M21.2501 15.6307C21.0524 15.1071 21.283 11.5402 18.7791 10.9185C18.7791 9.90077 18.174 9.20674 17.6484 8.75865C17.9884 8.75865 17.3295 7.77724 17.1648 7.48273C17 7.18822 16.1764 6.3374 16.2093 6.14106C16.2423 5.94472 16.3411 5.71565 16.6706 5.84655C17 5.97744 17.1318 5.94472 17.2307 5.81382C17.281 5.74723 17.3312 5.66369 17.3425 5.58476C17.6919 5.74838 17.7578 5.6502 17.8896 5.58476C18.0214 5.51931 18.1202 5.15935 18.0214 4.99573C17.9507 4.87874 17.5769 4.7283 17.1648 4.62812C17.7907 4.30853 17.7249 4.24309 17.7578 4.14492C17.7907 4.04674 17.3624 3.52317 17.1977 3.42499C17.0659 3.34646 16.6319 3.6103 16.4232 3.75203C16.5372 3.44999 16.5904 3.21866 16.5717 3.1632C16.5388 3.06503 16.1435 2.93414 16.0117 2.99959C15.9062 3.05194 15.8032 3.52303 15.7649 3.75203C15.7635 3.42446 15.4649 3.07029 15.3198 2.86849C15.1551 2.63943 15.188 2.21402 14.9574 2.11585C14.7268 2.01768 14.4303 2.37764 14.1338 2.76305C14.2254 2.47629 14.3569 1.94473 14.3314 1.91943C14.1667 1.78853 13.8373 1.82126 13.8043 1.91943C13.7055 2.23576 13.5012 2.93386 13.4749 3.19565C12.8748 3.73205 12.5176 4.13578 12.2559 4.51667C11.2675 4.10305 10.0485 3.88313 8.65228 4.5376C7.94795 3.8504 8.3353 2.57418 8.50003 2.21422C8.66476 1.85426 9.22484 1.55974 9.42251 1.4943C9.62019 1.42885 9.88376 1.69064 9.94965 1.69064C10.0155 1.69064 10.1473 1.62519 10.1144 1.4943C10.088 1.38958 9.88376 1.27614 9.78492 1.23251C9.83983 1.24341 10.0155 1.25869 10.2791 1.23251C10.4109 1.13434 10.3121 0.381691 10.1473 0.316244C9.98259 0.250796 9.29073 0.348967 8.65228 0.643481C8.67258 0.45237 8.45579 0.108613 8.36825 0.021657C8.26941 -0.0765141 7.90701 0.185275 7.90701 0.283447C7.90701 0.31617 7.94654 0.427431 8.10468 0.610683C8.30236 0.839749 7.90701 1.16699 7.90701 1.10154C7.90701 1.03609 7.77522 0.806901 7.70933 0.741454C7.64344 0.676006 7.31398 0.905072 7.37987 0.970519C7.70933 1.46137 7.41282 1.88678 7.14925 2.99939C6.88569 4.11199 7.41282 5.02826 7.57755 5.42094C7.41282 5.38822 6.81979 4.17744 6.19382 2.67215C5.93026 2.54126 5.04072 3.13028 5.10661 3.32662C5.66669 4.83191 6.68801 6.30448 6.81979 6.53355C6.83776 6.56478 6.84409 6.60939 6.84102 6.66464C5.00777 5.29024 3.65699 4.73394 3.36048 4.50488C3.06397 4.27581 2.60273 3.78495 2.33916 3.78495C2.0756 3.78495 1.54846 4.37398 1.54846 4.50488C1.54846 4.60959 2.51487 5.2248 2.99808 5.51931C2.64666 5.46477 1.79885 5.45386 1.219 5.84655C0.988383 5.6502 0.889546 5.61748 0.724817 5.81382C0.625979 5.91199 0.8566 6.14106 0.757763 6.20651C0.658925 6.27196 0.560079 5.97744 0.428296 5.91199C0.296512 5.84655 0.0658916 6.01017 0.0658916 6.14106C0.0658916 6.27196 0.263567 6.30468 0.164729 6.56647C0.0658916 6.82826 0 6.86098 0 6.99188C0 7.12277 0.560079 7.7118 0.922483 7.5809C1.02132 7.54818 0.889537 7.25367 1.35078 6.92643C1.81202 6.59919 3.03965 6.3374 4.41976 6.99188C4.04707 7.76537 3.75583 8.80285 3.75583 9.44595C3.75583 10.4605 4.05234 10.7876 4.44322 11.9657C4.27008 12.4064 4.09434 12.9259 4.05235 13.4055C3.98646 14.1581 4.25003 14.5508 4.84305 15.9252C5.43608 17.2996 6.32561 17.7577 6.52329 17.9541C6.72096 18.1504 6.95158 18.5104 7.08337 18.6413C7.18879 18.746 7.47872 18.8376 7.6105 18.8703C7.75327 19.1539 8.19694 19.8062 8.8295 20.1465C9.6202 20.5719 10.8721 20.8665 12.157 21.4228C13.4419 21.9791 14.9904 22.1754 15.4846 22.3063C15.9787 22.4372 17.4942 22.9608 17.8237 22.9935C18.1532 23.0262 18.6144 22.9281 19.2074 22.8626C19.8005 22.7972 20.657 22.3717 21.2501 21.9463C21.8431 21.5209 21.8101 20.9319 21.9749 19.7211C22.1396 18.5104 21.4477 16.1542 21.2501 15.6307Z";
