import "../../../../@ant-design/cssinjs/es/extractStyle.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useCacheToken.mjs";
import "react";
import "../../../../@ant-design/cssinjs/es/StyleContext.mjs";
import { unit as t } from "../../../../@ant-design/cssinjs/es/util/index.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useCompatibleInsertionEffect.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useEffectCleanupRegister.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useHMR.mjs";
import "../../../../rc-util/es/warning.mjs";
import "../../../../@ant-design/cssinjs/es/theme/createTheme.mjs";
import "../../../../@ant-design/cssinjs/es/theme/ThemeCache.mjs";
import "../../../../@ant-design/cssinjs/es/transformers/legacyLogicalProperties.mjs";
import { clearFix as j, resetComponent as q } from "../../style/index.mjs";
import { genStyleHooks as O } from "../../theme/util/genComponentStyleHook.mjs";
import { merge as L } from "../../theme/util/statistic.mjs";
import G from "./bordered.mjs";
import X from "./ellipsis.mjs";
import Y from "./empty.mjs";
import J from "./expand.mjs";
import K from "./filter.mjs";
import N from "./fixed.mjs";
import Q from "./pagination.mjs";
import U from "./radius.mjs";
import Z from "./rtl.mjs";
import _ from "./selection.mjs";
import ee from "./size.mjs";
import oe from "./sorter.mjs";
import te from "./sticky.mjs";
import R from "./summary.mjs";
import re from "./virtual.mjs";
import { TinyColor as C } from "../../../../@ctrl/tinycolor/dist/module/index.mjs";
const le = (c) => {
  const {
    componentCls: e,
    fontWeightStrong: r,
    tablePaddingVertical: n,
    tablePaddingHorizontal: i,
    tableExpandColumnWidth: p,
    lineWidth: u,
    lineType: f,
    tableBorderColor: m,
    tableFontSize: x,
    tableBg: S,
    tableRadius: a,
    tableHeaderTextColor: s,
    motionDurationMid: d,
    tableHeaderBg: B,
    tableHeaderCellSplitColor: g,
    tableFooterTextColor: H,
    tableFooterBg: y,
    calc: l
  } = c, b = `${t(u)} ${f} ${m}`;
  return {
    [`${e}-wrapper`]: Object.assign(Object.assign({
      clear: "both",
      maxWidth: "100%"
    }, j()), {
      [e]: Object.assign(Object.assign({}, q(c)), {
        fontSize: x,
        background: S,
        borderRadius: `${t(a)} ${t(a)} 0 0`
      }),
      // https://github.com/ant-design/ant-design/issues/17611
      table: {
        width: "100%",
        textAlign: "start",
        borderRadius: `${t(a)} ${t(a)} 0 0`,
        borderCollapse: "separate",
        borderSpacing: 0
      },
      // ============================= Cell ==============================
      [`
          ${e}-cell,
          ${e}-thead > tr > th,
          ${e}-tbody > tr > th,
          ${e}-tbody > tr > td,
          tfoot > tr > th,
          tfoot > tr > td
        `]: {
        position: "relative",
        padding: `${t(n)} ${t(i)}`,
        overflowWrap: "break-word"
      },
      // ============================ Title =============================
      [`${e}-title`]: {
        padding: `${t(n)} ${t(i)}`
      },
      // ============================ Header ============================
      [`${e}-thead`]: {
        "\n          > tr > th,\n          > tr > td\n        ": {
          position: "relative",
          color: s,
          fontWeight: r,
          textAlign: "start",
          background: B,
          borderBottom: b,
          transition: `background ${d} ease`,
          "&[colspan]:not([colspan='1'])": {
            textAlign: "center"
          },
          [`&:not(:last-child):not(${e}-selection-column):not(${e}-row-expand-icon-cell):not([colspan])::before`]: {
            position: "absolute",
            top: "50%",
            insetInlineEnd: 0,
            width: 1,
            height: "1.6em",
            backgroundColor: g,
            transform: "translateY(-50%)",
            transition: `background-color ${d}`,
            content: '""'
          }
        },
        "> tr:not(:last-child) > th[colspan]": {
          borderBottom: 0
        }
      },
      // ============================ Body ============================
      [`${e}-tbody`]: {
        "> tr": {
          "> th, > td": {
            transition: `background ${d}, border-color ${d}`,
            borderBottom: b,
            // ========================= Nest Table ===========================
            [`
              > ${e}-wrapper:only-child,
              > ${e}-expanded-row-fixed > ${e}-wrapper:only-child
            `]: {
              [e]: {
                marginBlock: t(l(n).mul(-1).equal()),
                marginInline: `${t(l(p).sub(i).equal())}
                ${t(l(i).mul(-1).equal())}`,
                [`${e}-tbody > tr:last-child > td`]: {
                  borderBottom: 0,
                  "&:first-child, &:last-child": {
                    borderRadius: 0
                  }
                }
              }
            }
          },
          "> th": {
            position: "relative",
            color: s,
            fontWeight: r,
            textAlign: "start",
            background: B,
            borderBottom: b,
            transition: `background ${d} ease`
          }
        }
      },
      // ============================ Footer ============================
      [`${e}-footer`]: {
        padding: `${t(n)} ${t(i)}`,
        color: H,
        background: y
      }
    })
  };
}, ne = (c) => {
  const {
    colorFillAlter: e,
    colorBgContainer: r,
    colorTextHeading: n,
    colorFillSecondary: i,
    colorFillContent: p,
    controlItemBgActive: u,
    controlItemBgActiveHover: f,
    padding: m,
    paddingSM: x,
    paddingXS: S,
    colorBorderSecondary: a,
    borderRadiusLG: s,
    controlHeight: d,
    colorTextPlaceholder: B,
    fontSize: g,
    fontSizeSM: H,
    lineHeight: y,
    lineWidth: l,
    colorIcon: b,
    colorIconHover: P,
    opacityLoading: $,
    controlInteractiveSize: w
  } = c, F = new C(i).onBackground(r).toHexShortString(), M = new C(p).onBackground(r).toHexShortString(), h = new C(e).onBackground(r).toHexShortString(), v = new C(b), I = new C(P), k = w / 2 - l, z = k * 2 + l * 3;
  return {
    headerBg: h,
    headerColor: n,
    headerSortActiveBg: F,
    headerSortHoverBg: M,
    bodySortBg: h,
    rowHoverBg: h,
    rowSelectedBg: u,
    rowSelectedHoverBg: f,
    rowExpandedBg: e,
    cellPaddingBlock: m,
    cellPaddingInline: m,
    cellPaddingBlockMD: x,
    cellPaddingInlineMD: S,
    cellPaddingBlockSM: S,
    cellPaddingInlineSM: S,
    borderColor: a,
    headerBorderRadius: s,
    footerBg: h,
    footerColor: n,
    cellFontSize: g,
    cellFontSizeMD: g,
    cellFontSizeSM: g,
    headerSplitColor: a,
    fixedHeaderSortActiveBg: F,
    headerFilterHoverBg: p,
    filterDropdownMenuBg: r,
    filterDropdownBg: r,
    expandIconBg: r,
    selectionColumnWidth: d,
    stickyScrollBarBg: B,
    stickyScrollBarBorderRadius: 100,
    expandIconMarginTop: (g * y - l * 3) / 2 - Math.ceil((H * 1.4 - l * 3) / 2),
    headerIconColor: v.clone().setAlpha(v.getAlpha() * $).toRgbString(),
    headerIconHoverColor: I.clone().setAlpha(I.getAlpha() * $).toRgbString(),
    expandIconHalfInner: k,
    expandIconSize: z,
    expandIconScale: w / z
  };
}, We = O("Table", (c) => {
  const {
    colorTextHeading: e,
    colorSplit: r,
    colorBgContainer: n,
    controlInteractiveSize: i,
    headerBg: p,
    headerColor: u,
    headerSortActiveBg: f,
    headerSortHoverBg: m,
    bodySortBg: x,
    rowHoverBg: S,
    rowSelectedBg: a,
    rowSelectedHoverBg: s,
    rowExpandedBg: d,
    cellPaddingBlock: B,
    cellPaddingInline: g,
    cellPaddingBlockMD: H,
    cellPaddingInlineMD: y,
    cellPaddingBlockSM: l,
    cellPaddingInlineSM: b,
    borderColor: P,
    footerBg: $,
    footerColor: w,
    headerBorderRadius: F,
    cellFontSize: M,
    cellFontSizeMD: h,
    cellFontSizeSM: v,
    headerSplitColor: I,
    fixedHeaderSortActiveBg: k,
    headerFilterHoverBg: z,
    filterDropdownBg: D,
    expandIconBg: W,
    selectionColumnWidth: E,
    stickyScrollBarBg: V,
    calc: A
  } = c, T = 2, o = L(c, {
    tableFontSize: M,
    tableBg: n,
    tableRadius: F,
    tablePaddingVertical: B,
    tablePaddingHorizontal: g,
    tablePaddingVerticalMiddle: H,
    tablePaddingHorizontalMiddle: y,
    tablePaddingVerticalSmall: l,
    tablePaddingHorizontalSmall: b,
    tableBorderColor: P,
    tableHeaderTextColor: u,
    tableHeaderBg: p,
    tableFooterTextColor: w,
    tableFooterBg: $,
    tableHeaderCellSplitColor: I,
    tableHeaderSortBg: f,
    tableHeaderSortHoverBg: m,
    tableBodySortBg: x,
    tableFixedHeaderSortActiveBg: k,
    tableHeaderFilterActiveBg: z,
    tableFilterDropdownBg: D,
    tableRowHoverBg: S,
    tableSelectedRowBg: a,
    tableSelectedRowHoverBg: s,
    zIndexTableFixed: T,
    zIndexTableSticky: T + 1,
    tableFontSizeMiddle: h,
    tableFontSizeSmall: v,
    tableSelectionColumnWidth: E,
    tableExpandIconBg: W,
    tableExpandColumnWidth: A(i).add(A(c.padding).mul(2)).equal(),
    tableExpandedRowBg: d,
    // Dropdown
    tableFilterDropdownWidth: 120,
    tableFilterDropdownHeight: 264,
    tableFilterDropdownSearchWidth: 140,
    // Virtual Scroll Bar
    tableScrollThumbSize: 8,
    // Mac scroll bar size
    tableScrollThumbBg: V,
    tableScrollThumbBgHover: e,
    tableScrollBg: r
  });
  return [le(o), Q(o), R(o), oe(o), K(o), G(o), U(o), J(o), R(o), Y(o), _(o), N(o), te(o), X(o), ee(o), Z(o), re(o)];
}, ne, {
  unitless: {
    expandIconScale: !0
  }
});
export {
  We as default,
  ne as prepareComponentToken
};
