import { genSettingTriggerBtnStyle as a } from "../../ap-table/style/index.mjs";
import { multiRows as l, resetScrollbar as r } from "../../style/index.mjs";
import { genComponentStyleHook as t } from "../../utils/cssinjs/index.mjs";
const d = {
  agGridSearchFormWrapperMarginBlockEnd: 10,
  agGridCellPaddingBlockMedium: 9,
  agGridCellPaddingBlockMini: 6,
  agGridLineClamp: 2,
  agGridEllipsisTooltipMaxWidth: 300,
  agGridEllipsisTooltipPadding: "6px 8px"
}, n = (i) => {
  const { componentCls: e } = i;
  return {
    [e]: {
      ...r(i),
      "&-adaptive": {
        height: "100%",
        display: "flex",
        flexDirection: "column",
        [`${e}-grid-wrapper`]: {
          minHeight: 0,
          flex: 1,
          position: "relative"
        }
      },
      "&-auto-height": {
        ".ag-center-cols-viewport": {
          minHeight: "unset !important"
        }
      },
      "&-wrapper": {
        padding: i.space,
        paddingBlockEnd: i.spaceLG,
        backgroundColor: "#fff",
        // 如果渲染了分页器，则取消容器的底部边距，防止双重边距
        "&:has(ul.ant-pagination)": {
          paddingBottom: 0
        }
      },
      [`${e}__search-wrapper`]: {
        padding: i.space,
        paddingBlockEnd: 0,
        backgroundColor: "#fff",
        borderRadius: i.borderRadius,
        marginBlockEnd: i.agGridSearchFormWrapperMarginBlockEnd
      },
      [`${e}__table-wrapper`]: {
        flex: 1,
        minHeight: 0,
        maxHeight: "100%",
        width: "100%",
        display: "flex",
        flexDirection: "column"
      },
      [`${e}__table-wrapper-card`]: {
        padding: i.space,
        paddingBlockEnd: i.spaceLG,
        borderRadius: i.borderRadius,
        backgroundColor: "#fff",
        "&:has(ul.ant-pagination)": {
          paddingBlockEnd: 0
        }
      },
      [`${e}-pagination`]: {
        marginBlock: i.space,
        display: "flex",
        flexWrap: "wrap",
        alignItems: "center",
        rowGap: i.space,
        ".ant-pagination-total-text": {
          flex: 1,
          height: "unset",
          lineHeight: i.lineHeight,
          display: "flex",
          alignItems: "center"
        }
      },
      [`${e}__table-loading-wrapper`]: {
        position: "absolute",
        top: 0,
        left: 0,
        width: "100%",
        height: "100%",
        zIndex: 2,
        display: "flex",
        justifyContent: "center",
        alignItems: "center",
        backgroundColor: "hsla(0,0%,100%,.5)"
      },
      [`${e}-table-header`]: {
        "&__title": {
          ...l(i),
          fontWeight: 700,
          "&--single": {
            flex: "unset"
          }
        }
      },
      ...a(i),
      [`${e}__cell--left`]: {
        textAlign: "left"
      },
      [`${e}__cell--center`]: {
        textAlign: "center"
      },
      [`${e}__cell--right`]: {
        textAlign: "right"
      },
      [`${e}__cell--multiline`]: {
        ".ag-cell-value": {
          display: "-webkit-box",
          WebkitBoxOrient: "vertical",
          WebkitLineClamp: i.agGridLineClamp,
          wordBreak: "break-all"
        }
      },
      "&-size-mini": {
        ".ag-cell": {
          lineHeight: i.lineHeight,
          paddingBlock: i.agGridCellPaddingBlockMini,
          width: "100%",
          display: "flex",
          alignItems: "center",
          "& > div": {
            width: "100%"
          }
        }
      },
      "&-size-medium": {
        ".ag-cell": {
          lineHeight: i.lineHeight,
          paddingBlock: i.agGridCellPaddingBlockMedium,
          display: "flex",
          alignItems: "center",
          "& > div": {
            width: "100%"
          }
        }
      },
      [`${e}__tooltip`]: {
        fontSize: i.fontSize,
        maxWidth: i.agGridEllipsisTooltipMaxWidth,
        wordBreak: "break-all",
        backgroundColor: "#fff",
        padding: i.agGridEllipsisTooltipPadding,
        borderRadius: i.borderRadius,
        boxShadow: "0 6px 16px 0 rgba(0, 0, 0, 0.08),0 3px 6px -4px rgba(0, 0, 0, 0.12),0 9px 28px 8px rgba(0, 0, 0, 0.05)"
      },
      ".ag-unselectable": {
        userSelect: "text",
        WebkitUserSelect: "text"
      },
      ".ag-checkbox.ag-labeled[disabled] .ag-input-field-input[disabled]": {
        cursor: "not-allowed"
      },
      "&-borderless .ag-body-vertical-content-no-gap .ag-row-last": {
        borderBottom: "var(--ag-row-border)"
      },
      [`${e}-empty`]: {
        pointerEvents: "auto"
      }
    }
  };
}, s = t(
  "AgGrid",
  (i) => [n(i)],
  d,
  {
    skipUnit: ["agGridLineClamp"]
  }
);
export {
  s as default,
  d as defaultToken,
  n as genAgGridStyle
};
