import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
import { pick } from '../characterTypes.js';

function pal(c) {
    return {
        sclera: pick(c, 0, "var(--white, #FFFFFF)"),
        iris: pick(c, 1, "var(--anim-eye-iris, #2563EB)"),
        pupil: pick(c, 2, "var(--anim-stroke, #111)"),
        highlight: pick(c, 3, "var(--white, #FFF)"),
    };
}
function RoundEye({ x, y, rS, rI, rP, c }) {
    return (jsxs("g", { transform: `translate(${x} ${y})`, children: [jsx("circle", { r: rS, fill: c.sclera }), jsx("circle", { r: rI, fill: c.iris }), jsx("circle", { r: rP, fill: c.pupil }), jsx("circle", { cx: -rI * 0.3, cy: -rI * 0.3, r: rI * 0.25, fill: c.highlight, opacity: 0.9 })] }));
}
const EyesClassic = ({ colors, spread = 16, y = -6, scale = 1, transform, eyebrows = true }) => {
    const c = pal(colors);
    return (jsxs("g", { transform: `${transform !== null && transform !== void 0 ? transform : ""} scale(${scale})`, stroke: c.pupil, strokeWidth: 1.2, strokeLinecap: "round", children: [jsx(RoundEye, { x: -spread, y: y, rS: 7, rI: 4.5, rP: 2.2, c: c }), jsx(RoundEye, { x: spread, y: y, rS: 7, rI: 4.5, rP: 2.2, c: c }), eyebrows && (jsxs(Fragment, { children: [jsx("path", { d: `M${-spread - 8} ${y - 8} q8 -6 16 0`, fill: "none" }), jsx("path", { d: `M${spread - 8} ${y - 8} q8 -6 16 0`, fill: "none" })] }))] }));
};
const EyesAnime = ({ colors, spread = 18, y = -6, scale = 1, transform, eyebrows = true }) => {
    const c = pal(colors);
    return (jsxs("g", { transform: `${transform !== null && transform !== void 0 ? transform : ""} scale(${scale})`, stroke: c.pupil, strokeWidth: 1.2, children: [jsx(RoundEye, { x: -spread, y: y, rS: 10, rI: 7, rP: 3.5, c: c }), jsx(RoundEye, { x: spread, y: y, rS: 10, rI: 7, rP: 3.5, c: c }), eyebrows && (jsxs(Fragment, { children: [jsx("path", { d: `M${-spread - 10} ${y - 12} q10 -5 20 0`, fill: "none" }), jsx("path", { d: `M${spread - 10} ${y - 12} q10 -5 20 0`, fill: "none" })] }))] }));
};
const EyesSleepy = ({ colors, spread = 16, y = -6, scale = 1, transform }) => {
    const c = pal(colors);
    return (jsxs("g", { transform: `${transform !== null && transform !== void 0 ? transform : ""} scale(${scale})`, stroke: c.pupil, strokeWidth: 1.6, strokeLinecap: "round", children: [jsx("line", { x1: -spread - 6, y1: y, x2: -spread + 6, y2: y }), jsx("line", { x1: spread - 6, y1: y, x2: spread + 6, y2: y })] }));
};
const EyesSmile = ({ colors, spread = 16, y = -6, scale = 1, transform }) => {
    const c = pal(colors);
    return (jsxs("g", { transform: `${transform !== null && transform !== void 0 ? transform : ""} scale(${scale})`, stroke: c.pupil, strokeWidth: 1.6, strokeLinecap: "round", children: [jsx("path", { d: `M${-spread - 6} ${y + 2} q6 -8 12 0`, fill: "none" }), jsx("path", { d: `M${spread - 6} ${y + 2} q6 -8 12 0`, fill: "none" })] }));
};
const EYES_RENDERERS = {
    classic: EyesClassic, big: EyesAnime, anime: EyesAnime, sleepy: EyesSleepy,
    angry: EyesSleepy, surprised: EyesAnime, winkLeft: EyesSleepy, winkRight: EyesSleepy,
    smile: EyesSmile, oval: EyesClassic, upturned: EyesClassic,
    downturned: EyesSleepy, lashes: EyesClassic, sparkle: EyesAnime,
    heart: EyesAnime, star: EyesAnime, sad: EyesSleepy, focused: EyesClassic,
};
const Eyes = ({ variant, ...rest }) => {
    var _a;
    const Comp = (_a = EYES_RENDERERS[variant]) !== null && _a !== void 0 ? _a : EyesClassic;
    return jsx(Comp, { ...rest });
};

export { EYES_RENDERERS, Eyes, EyesAnime, EyesClassic, EyesSleepy, EyesSmile };
//# sourceMappingURL=eyes.js.map
