'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var React = require('react');
var emoji = require('@evo/emoji');
var Image = require('@prom-ui/core/Image');

function _interopNamespaceCompat(e) {
  if (e && typeof e === 'object' && 'default' in e) return e;
  var n = Object.create(null);
  if (e) {
    Object.keys(e).forEach(function (k) {
      if (k !== 'default') {
        var d = Object.getOwnPropertyDescriptor(e, k);
        Object.defineProperty(n, k, d.get ? d : {
          enumerable: true,
          get: function () { return e[k]; }
        });
      }
    });
  }
  n.default = e;
  return Object.freeze(n);
}

var React__namespace = /*#__PURE__*/_interopNamespaceCompat(React);

function _extends() {
  _extends = Object.assign ? Object.assign.bind() : 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);
}
function _objectWithoutPropertiesLoose(source, excluded) {
  if (source == null) return {};
  var target = {};
  var sourceKeys = Object.keys(source);
  var key, i;
  for (i = 0; i < sourceKeys.length; i++) {
    key = sourceKeys[i];
    if (excluded.indexOf(key) >= 0) continue;
    target[key] = source[key];
  }
  return target;
}
function _objectWithoutProperties(source, excluded) {
  if (source == null) return {};
  var target = _objectWithoutPropertiesLoose(source, excluded);
  var key, i;
  if (Object.getOwnPropertySymbols) {
    var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
    for (i = 0; i < sourceSymbolKeys.length; i++) {
      key = sourceSymbolKeys[i];
      if (excluded.indexOf(key) >= 0) continue;
      if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
      target[key] = source[key];
    }
  }
  return target;
}

var _excluded = ["shortName", "viewType", "width", "height"];
var ImageEmoji = /*#__PURE__*/React__namespace.forwardRef(function (_ref, ref) {
  var shortName = _ref.shortName,
    _ref$viewType = _ref.viewType,
    viewType = _ref$viewType === void 0 ? 'apple' : _ref$viewType,
    _ref$width = _ref.width,
    width = _ref$width === void 0 ? 20 : _ref$width,
    _ref$height = _ref.height,
    height = _ref$height === void 0 ? 20 : _ref$height,
    props = _objectWithoutProperties(_ref, _excluded);
  return /*#__PURE__*/React__namespace.createElement(Image.Image, _extends({
    "image-as": emoji.Emoji,
    "image-alt": "hidden",
    alt: shortName ? ":".concat(shortName, ":") : ''
    // @ts-ignore
    ,
    width: width
    // @ts-ignore
    ,
    height: height
  }, props, {
    name: shortName,
    type: viewType,
    ref: ref
  }));
});
ImageEmoji.displayName = 'ImageEmoji';

exports.ImageEmoji = ImageEmoji;
