import { jsx as e, jsxs as h, Fragment as a } from "@emotion/react/jsx-runtime";
import { RouterNavLinkRootStyled as k, RouterNavLinkStyled as v, TypographyStyled as y, SkeletonStyled as L } from "./slots/NavLinkSlots.js";
import { useModuleSkeleton as z } from "@m4l/core";
import { classNavLinkRoot as x, NAV_LINK_SPECIFY as I, NAV_LINK_KEY_COMPONENT as _ } from "./constants.js";
import { NavLinkSlots as A } from "./slots/NavLinkEnum.js";
import { clsx as C } from "clsx";
import { useComponentSize as R } from "../../../../hooks/useComponentSize/index.js";
import { getPropDataTestId as T } from "../../../../test/getNameDataTestId.js";
const O = (c) => {
  const {
    children: i,
    text: m,
    size: s = "medium",
    disabled: t,
    skeletonWidth: d,
    color: S,
    dataTestId: p,
    whiteSpace: u = !1,
    ...f
  } = c, N = z(), { currentSize: o } = R(s), n = o === "small" || o === "medium" ? o : "medium", l = {
    disabled: t,
    size: s,
    whiteSpace: u
  };
  return /* @__PURE__ */ e(
    k,
    {
      ...T(_, A.root, p),
      children: N ? /* @__PURE__ */ e(a, { children: /* @__PURE__ */ e(L, { variant: "rounded" }) }) : /* @__PURE__ */ e(
        v,
        {
          size: n,
          role: "link",
          ownerState: l,
          disabled: t,
          "aria-disabled": t,
          ...f,
          children: (r) => /* @__PURE__ */ h(a, { children: [
            /* @__PURE__ */ e(
              y,
              {
                size: n,
                color: S,
                disabled: t,
                ownerState: l,
                skeletonWidth: d,
                className: C(
                  x,
                  I,
                  "M4lclassCssSpecificity",
                  { active: r.isActive, inactive: !r.isActive }
                ),
                children: m
              }
            ),
            typeof i == "function" ? i(r) : i
          ] })
        }
      )
    }
  );
};
export {
  O as NavLink
};
