import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _extends from "@babel/runtime/helpers/esm/extends";
import { genComponentStyleHook, mergeToken } from '../../theme';
import { resetComponent, textEllipsis } from '../../style';
// ============================== Shared ==============================
var genSharedAnchorStyle = function genSharedAnchorStyle(token) {
  var _$concat2, _extends2, _$concat3;
  var componentCls = token.componentCls,
    holderOffsetBlock = token.holderOffsetBlock,
    anchorBallSize = token.anchorBallSize,
    lineWidthBold = token.lineWidthBold;
  return _defineProperty({}, "".concat(componentCls, "-wrapper"), (_$concat3 = {
    marginBlockStart: -holderOffsetBlock,
    paddingBlockStart: holderOffsetBlock,
    // delete overflow: auto
    // overflow: 'auto',
    backgroundColor: 'transparent'
  }, _defineProperty(_$concat3, componentCls, _extends(_extends({}, resetComponent(token)), (_extends2 = {
    position: 'relative',
    paddingInlineStart: lineWidthBold
  }, _defineProperty(_extends2, "".concat(componentCls, "-ink"), {
    position: 'absolute',
    insetBlockStart: 0,
    insetInlineStart: 0,
    height: '100%',
    '&::before': {
      position: 'relative',
      display: 'block',
      width: lineWidthBold,
      height: '100%',
      margin: '0 auto',
      backgroundColor: token.colorSplit,
      content: '" "'
    }
  }), _defineProperty(_extends2, "".concat(componentCls, "-ink-ball"), _defineProperty({
    position: 'absolute',
    left: {
      _skip_check_: true,
      value: '50%'
    },
    display: 'none',
    width: anchorBallSize,
    height: anchorBallSize,
    backgroundColor: token.colorBgContainer,
    border: "".concat(lineWidthBold, "px solid ").concat(token.colorPrimary),
    borderRadius: anchorBallSize,
    transform: 'translateX(-50%)',
    transition: "top ".concat(token.motionDurationSlow, " ease-in-out")
  }, "&".concat(componentCls, "-ink-ball-visible"), {
    display: 'inline-block'
  })), _defineProperty(_extends2, "".concat(componentCls, "-link"), (_$concat2 = {
    paddingBlock: token.anchorPaddingBlock,
    paddingInline: "".concat(token.anchorPaddingInline, "px 0"),
    '&-title': _extends(_extends({}, textEllipsis), {
      position: 'relative',
      display: 'block',
      marginBlockEnd: token.anchorTitleBlock,
      color: token.colorText,
      transition: "all ".concat(token.motionDurationSlow),
      '&:only-child': {
        marginBlockEnd: 0
      }
    })
  }, _defineProperty(_$concat2, "&-active > ".concat(componentCls, "-link-title"), {
    color: token.colorPrimary
  }), _defineProperty(_$concat2, "".concat(componentCls, "-link"), {
    paddingBlock: token.anchorPaddingBlockSecondary
  }), _$concat2)), _extends2))), _defineProperty(_$concat3, "".concat(componentCls, "-fixed ").concat(componentCls, "-ink ").concat(componentCls, "-ink-ball"), {
    display: 'none'
  }), _$concat3));
};
// ============================== Export ==============================
export default genComponentStyleHook('Anchor', function (token) {
  var fontSize = token.fontSize,
    fontSizeLG = token.fontSizeLG,
    padding = token.padding,
    paddingXXS = token.paddingXXS;
  var anchorToken = mergeToken(token, {
    holderOffsetBlock: paddingXXS,
    anchorPaddingBlock: paddingXXS,
    anchorPaddingBlockSecondary: paddingXXS / 2,
    anchorPaddingInline: padding,
    anchorTitleBlock: fontSize / 14 * 3,
    anchorBallSize: fontSizeLG / 2
  });
  return [genSharedAnchorStyle(anchorToken)];
});