"use client";
import { jsxs as c, jsx as t, Fragment as y } from "react/jsx-runtime";
import { useState as g, useRef as A, useEffect as L, useLayoutEffect as R } from "react";
import { cn as l } from "../../utils/cn/cn.es.js";
import e from "../../modules/TypesOfTests/typesOfTests.module.css";
import { ComplexTooltipContent as S } from "../../components/ComplexTooltip/components/ComplexTooltipContent/ComplexTooltipContent.es.js";
import { Typography as N } from "../../components/Typography/Typography.es.js";
import { ComplexTooltip as b } from "../../components/ComplexTooltip/ComplexTooltip.es.js";
import { Button as w } from "../../components/Button/Button.es.js";
const M = 7, _ = ({
  title: u,
  items: n,
  colorScheme: s,
  buttonLabel: f,
  className: V,
  expandByDefault: o = !1,
  withParenthesis: H = !0,
  size: h = "lg"
}) => {
  const [p, v] = g(o), [r, C] = g(null), [k, T] = g(!1), d = A(null), E = o || p;
  L(() => {
    o || v(!1);
  }, [o]);
  const I = () => v((i) => !i), x = () => {
    C(null);
  };
  return R(() => {
    var m;
    if (!d.current) return;
    const a = (((m = d.current.firstElementChild) == null ? void 0 : m.getBoundingClientRect().height) || 0) * M;
    T(d.current.scrollHeight > a);
  }, [n.length]), /* @__PURE__ */ c("section", { className: l(e.root, V), "data-scheme": s, "data-size": h, children: [
    r !== null && /* @__PURE__ */ t("div", { className: l(e.popover, e.mobile), children: /* @__PURE__ */ t(
      S,
      {
        title: n[r].title,
        description: n[r].description,
        onClose: x,
        style: s,
        link: n[r].link,
        className: e.popoverContent
      }
    ) }),
    /* @__PURE__ */ c("div", { className: e.container, children: [
      /* @__PURE__ */ t("div", { className: e.header, children: /* @__PURE__ */ t(
        N,
        {
          as: "h2",
          defaultVariant: h === "lg" ? "displayMd" : "headingMd",
          mobileVariant: h === "lg" ? "headingLg" : "headingSm",
          children: H ? `(${u})` : u
        }
      ) }),
      /* @__PURE__ */ t(
        "div",
        {
          ref: d,
          className: l(e.content, !E && k && e.contentLimited),
          children: n.map((i, a) => /* @__PURE__ */ t(
            "div",
            {
              className: l(e.item, r === a && e.selectedItem),
              onClick: () => C((m) => m === a ? null : a),
              children: /* @__PURE__ */ t(
                b,
                {
                  title: i.title,
                  description: i.description,
                  style: "light",
                  trigger: "hover",
                  isBlurred: s === "dark",
                  link: i.link,
                  children: /* @__PURE__ */ t(
                    N,
                    {
                      as: "p",
                      defaultVariant: "headingLg",
                      mobileVariant: "headingXxs",
                      className: e.itemTitle,
                      children: i.title
                    }
                  )
                }
              )
            },
            i.title
          ))
        }
      ),
      k && !o && /* @__PURE__ */ c(y, { children: [
        /* @__PURE__ */ t("div", { className: l(e.actions, e.desktop), children: /* @__PURE__ */ c(
          w,
          {
            variant: s === "light" ? "muted" : "muted-invert",
            size: "lg",
            onClick: I,
            children: [
              p ? "Hide" : "View All",
              " ",
              f
            ]
          }
        ) }),
        /* @__PURE__ */ t("div", { className: l(e.actions, e.mobile), children: /* @__PURE__ */ c(
          w,
          {
            variant: s === "light" ? "muted" : "muted-invert",
            size: "md",
            onClick: I,
            children: [
              p ? "Hide" : "View All",
              " ",
              f
            ]
          }
        ) })
      ] })
    ] })
  ] });
};
export {
  _ as TypesOfTests
};
