var __assign = this && this.__assign || function () {
  __assign = Object.assign || function (t) {
    for (var s, i = 1, n = arguments.length; i < n; i++) {
      s = arguments[i];

      for (var p in s) {
        if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
      }
    }

    return t;
  };

  return __assign.apply(this, arguments);
};

import { jsx as _jsx } from "react/jsx-runtime";
import * as React from 'react';
import { useNProgress } from '@tanem/react-nprogress';
import "./style/load-progress.css";
var prefixCls = 'dmc-load-progress';

var LoadProgress = function LoadProgress(props) {
  var _a = useNProgress(props),
      animationDuration = _a.animationDuration,
      isFinished = _a.isFinished,
      progress = _a.progress;

  var className = props.className;
  var wrapperStyle = {
    opacity: isFinished ? 0 : 1,
    transition: "opacity " + animationDuration + "ms linear"
  };
  var lineBarStyle = {
    marginLeft: (-1 + progress) * 100 + "%",
    transition: "margin-left " + animationDuration + "ms linear"
  };
  return _jsx("div", __assign({
    className: prefixCls + " " + className,
    style: wrapperStyle
  }, {
    children: _jsx("div", __assign({
      className: prefixCls + "-line-bar",
      style: lineBarStyle
    }, {
      children: _jsx("div", {
        className: prefixCls + "-line-bar-container"
      }, void 0)
    }), void 0)
  }), void 0);
};

LoadProgress.defaultProps = {
  animationDuration: 200,
  incrementDuration: 800,
  isAnimating: true,
  minimum: 0.08
};
LoadProgress.displayName = 'LoadProgress';
export default LoadProgress;
var LoadProgressMemo = /*#__PURE__*/React.memo(LoadProgress);
LoadProgressMemo.displayName = 'LoadProgressMemo';
export { LoadProgressMemo };

