"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _cssinjs = require("../../_util/cssinjs");
var _genComponentStyleHook = _interopRequireDefault(require("../../theme/util/genComponentStyleHook"));
var _util = require("../util");
const genBorderBeamStyle = token => {
  const {
    componentCls
  } = token;
  const defaultBeamGradient = `linear-gradient(to left, ${token.colorPrimary} 0%, ${token.colorPrimaryHover} ${_util.MAX_BEAM_COLOR_STOP_PERCENT}%, transparent)`;
  // =========================== Animation ============================
  const antBorderBeamMove = new _cssinjs.Keyframes('antBorderBeamMove', {
    from: {
      offsetDistance: '0%'
    },
    to: {
      offsetDistance: '100%'
    }
  });
  // ============================= Style ==============================
  return {
    [componentCls]: {
      // Container
      display: 'none',
      position: 'absolute',
      inset: 'var(--ant-border-beam-inset-offset, 0px)',
      borderRadius: 'var(--ant-border-beam-border-radius, 0px)',
      zIndex: 1,
      overflow: 'hidden',
      pointerEvents: 'none',
      // Border Beam
      padding: token.lineWidth,
      // Border Beam Effect
      '@supports ((mask-composite: exclude) or (-webkit-mask-composite: xor))': {
        WebkitMask: 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)',
        WebkitMaskComposite: 'xor',
        mask: 'linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)',
        maskComposite: 'exclude',
        '@supports (offset-path: rect(0 auto auto 0 round 1px))': {
          display: 'block',
          '&::before': {
            content: '""',
            position: 'absolute',
            top: 0,
            left: 0,
            width: 100,
            aspectRatio: '1 / 1',
            opacity: 0.95,
            backgroundImage: 'var(--ant-border-beam-beam-gradient, ' + defaultBeamGradient + ')',
            offsetAnchor: '90% 50%',
            offsetDistance: '0%',
            offsetPath: 'rect(0 auto auto 0 round 100px)',
            offsetRotate: 'auto',
            animationName: antBorderBeamMove,
            animationDuration: '6s',
            animationTimingFunction: 'linear',
            animationIterationCount: 'infinite',
            willChange: 'offset-distance'
          }
        }
      },
      '@media (prefers-reduced-motion: reduce)': {
        '&::before': {
          display: 'none'
        }
      }
    }
  };
};
var _default = exports.default = (0, _genComponentStyleHook.default)('BorderBeam', genBorderBeamStyle);