function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

var __rest = this && this.__rest || function (s, e) {
  var t = {};

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

  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
    if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
  }
  return t;
};

import * as React from 'react';
import classNames from 'classnames';
import { ConfigConsumer } from '../config-provider';
import LocaleReceiver from '../locale-provider/LocaleReceiver';

/* babel-plugin-inline-import './empty.svg' */
var emptyImg = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDIzLjAuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IuWbvuWxgl8xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4PSIwcHgiIHk9IjBweCIKCSB2aWV3Qm94PSIwIDAgMTg0IDE1MiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTg0IDE1MjsiIHhtbDpzcGFjZT0icHJlc2VydmUiPgo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPgoJLnN0MHtmaWxsOiNGNUY1RjU7fQoJLnN0MXtmaWxsOm5vbmU7c3Ryb2tlOiNEOUQ5RDk7fQoJLnN0MntmaWxsOiNGQUZBRkE7c3Ryb2tlOiNEOUQ5RDk7fQo8L3N0eWxlPgo8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwIDEpIj4KCTxlbGxpcHNlIGNsYXNzPSJzdDAiIGN4PSI5MiIgY3k9IjEwNy42IiByeD0iODAuMiIgcnk9IjE3LjUiLz4KCTxnPgoJCTxwYXRoIGNsYXNzPSJzdDEiIGQ9Ik0xNDkuNiw1Ni45bC0yNS40LTI4LjhjLTEuMi0yLTMtMy4yLTQuOS0zLjJINjQuN2MtMS45LDAtMy43LDEuMi00LjksMy4xTDM0LjQsNTYuOVY4MGgxMTUuMlY1Ni45eiIvPgoJCTxwYXRoIGNsYXNzPSJzdDIiIGQ9Ik0xMTYuMSw2NC44YzAtNCwyLjUtNy4zLDUuNi03LjNoMjh2NDUuNGMwLDUuMy0zLjMsOS43LTcuNCw5LjdINDEuOGMtNC4xLDAtNy40LTQuNC03LjQtOS43VjU3LjVoMjgKCQkJYzMuMSwwLDUuNiwzLjMsNS42LDcuM3YwLjFjMCw0LDIuNSw3LjMsNS42LDcuM2gzN0MxMTMuNiw3Mi4xLDExNi4xLDY4LjgsMTE2LjEsNjQuOEwxMTYuMSw2NC44eiIvPgoJPC9nPgo8L2c+Cjwvc3ZnPgo=";

var Empty = function Empty(props) {
  return /*#__PURE__*/React.createElement(ConfigConsumer, null, function (_ref) {
    var getPrefixCls = _ref.getPrefixCls;

    var className = props.className,
        customizePrefixCls = props.prefixCls,
        image = props.image,
        description = props.description,
        children = props.children,
        restProps = __rest(props, ["className", "prefixCls", "image", "description", "children"]);

    var prefixCls = getPrefixCls('empty', customizePrefixCls);
    return /*#__PURE__*/React.createElement(LocaleReceiver, {
      componentName: "Empty"
    }, function (locale) {
      var des = description || locale.description;
      var alt = typeof des === 'string' ? des : 'empty';
      var imageNode = null;

      if (!image) {
        imageNode = /*#__PURE__*/React.createElement("img", {
          alt: alt,
          src: emptyImg
        });
      } else if (typeof image === 'string') {
        imageNode = /*#__PURE__*/React.createElement("img", {
          alt: alt,
          src: image
        });
      } else {
        imageNode = image;
      }

      return /*#__PURE__*/React.createElement("div", _extends({
        className: classNames(prefixCls, className)
      }, restProps), /*#__PURE__*/React.createElement("div", {
        className: "".concat(prefixCls, "-image")
      }, imageNode), /*#__PURE__*/React.createElement("p", {
        className: "".concat(prefixCls, "-description")
      }, des), children && /*#__PURE__*/React.createElement("div", {
        className: "".concat(prefixCls, "-footer")
      }, children));
    });
  });
};

export default Empty;