"use strict";var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;exports.__esModule = true;exports.FileUploaderFileStatusIcon = void 0;var _react = _interopRequireWildcard(require("react"));

var _ResponsiveLayout = require("../../../../components/ResponsiveLayout");
var _ThemeContext = require("../../../../lib/theming/ThemeContext");
var _ThemeHelpers = require("../../../../lib/theming/ThemeHelpers");
var _fileUtils = require("../../fileUtils");
var _LoadingIcon = require("../../../icons2022/LoadingIcon");

var _FileUploaderFile = require("../FileUploaderFile.styles");

var _DeleteIcon = require("./DeleteIcon");
var _ErrorIcon = require("./ErrorIcon");

// import { ActionIcon } from './ActionIcon';











var FileUploaderFileStatusIcon = exports.FileUploaderFileStatusIcon = function FileUploaderFileStatusIcon(_ref)








{var hovered = _ref.hovered,isTileView = _ref.isTileView,disabled = _ref.disabled,focusedByTab = _ref.focusedByTab,isInvalid = _ref.isInvalid,status = _ref.status,size = _ref.size,hasValidation = _ref.hasValidation;
  var _useResponsiveLayout = (0, _ResponsiveLayout.useResponsiveLayout)(),isMobile = _useResponsiveLayout.isMobile;
  var theme = (0, _react.useContext)(_ThemeContext.ThemeContext);
  var versionGTE5_5 = (0, _ThemeHelpers.isThemeGTE)(theme, '5.5');

  var iconClassNames = isTileView ? _FileUploaderFile.jsTileStyles.iconColor(theme) : _FileUploaderFile.jsRowStyles.iconColor(theme);
  var IconDelete = /*#__PURE__*/_react.default.createElement(_DeleteIcon.DeleteIcon, { size: size, className: iconClassNames });
  // const IconAction = <ActionIcon size={size} className={iconClassNames} />;
  var IconError = /*#__PURE__*/_react.default.createElement(_ErrorIcon.ErrorIcon, { size: size });

  if (versionGTE5_5) {
    if (status === _fileUtils.FileUploaderFileStatus.Loading) {
      return hovered || isTileView ? IconDelete : /*#__PURE__*/_react.default.createElement(_LoadingIcon.LoadingIcon, { size: size });
    }
    if (disabled || !isMobile && !hovered && !focusedByTab) {
      return null;
    }
    if (isInvalid || hasValidation) {
      return IconDelete;
    }
  } else {
    if (hovered || focusedByTab) {
      return IconDelete;
    }
    if (isInvalid) {
      return IconError;
    }
  }

  switch (status) {
    case _fileUtils.FileUploaderFileStatus.Loading:
      return /*#__PURE__*/_react.default.createElement(_LoadingIcon.LoadingIcon, { size: size });
    // TODO - IF-2270 - добавить логику для действий по наведению и клику, пока только удаление
    default:
      return IconDelete;
  }
};