import { jsx as r, jsxs as h } from "react/jsx-runtime";
import { classNames as a } from "./index-classNames.js";
import { parseCssVariable as x } from "./index-css-variables-parser.js";
import { ComponentContainer as y } from "./index-ComponentContainer.js";
import { StarRating as b } from "./index-StarRating.js";
import { Text as S, TextTypes as v, FontWeights as z } from "./index-Text.js";
import "react";
import s from "./index-Rating.module.scss.js";
const R = (t) => {
  const {
    type: C = "stars",
    size: f = "20",
    color: g = "--p800",
    valueAlign: l = "left",
    valueColor: m = "--fn-bg",
    valueSize: c = null,
    className: u,
    bgColor: p,
    isBlurred: o
  } = t;
  let {
    value: i = 0
  } = t;
  parseFloat(String(i)) > 5 && (i = 5);
  const n = i.toFixed(1);
  ({
    ...t
  });
  const d = () => {
    const e = {};
    return o && (e.filter = "blur(12px)", e.userSelect = "none"), m && (e.color = x(m)), f && (e.fontSize = `${parseInt(String(f)) * 0.9}px`), c && (e.fontSize = `${c}px`), e.fontWeight = "bold", e.padding = "0 5px", e;
  };
  return r(y, {
    className: a(u),
    children: h("div", {
      className: a(s.container, l == "top" ? s.ratingAlignTop : ""),
      children: [l && l == "left" ? r("span", {
        className: a(),
        style: d(),
        children: n
      }) : null, l && l == "top" ? r(S, {
        isBlurred: o,
        fontWeight: z.bold,
        type: v.heading2,
        translate: !1,
        children: n
      }) : null, r(b, {
        disabled: t.disabled,
        readonly: t.readonly,
        value: i,
        color: g,
        bgColor: p,
        isBlurred: o,
        size: t.size ?? 24
      }), l && l == "right" ? r("span", {
        className: s.ratingValue,
        style: d(),
        children: n
      }) : null]
    })
  });
};
export {
  R as Rating
};
