"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = _interopRequireDefault(require("react"));
var _ImageSt = require("./Image.st.css.js");
var _excluded = ["width", "fit", "position", "showBorder", "borderRadius", "transparent", "alt"],
  _excluded2 = ["dataHook", "src", "style", "className"];
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/Image/Image.tsx";
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var placeholder = {
  source: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='164' height='120' viewBox='0 0 164 120'%3E%3Cg fill='none'%3E%3Crect width='164' height='120' fill='%23DAEFFE'/%3E%3Cpath fill='%23B9E3FF' d='M-8.52651283e-14,120 L49.0917544,74.9616932 C52.151039,72.1550101 56.848961,72.1550101 59.9082456,74.9616932 L71.293,85.4057534 L96.9019846,59.8591624 C100.0299,56.7386931 105.095216,56.744729 108.215685,59.8726439 C108.284098,59.9412201 108.35126,60.0110332 108.417137,60.0820486 L164,120 L-8.52651283e-14,120 Z'/%3E%3Ccircle cx='67.5' cy='43.5' r='10.5' fill='%23F5FBFF'/%3E%3C/g%3E%3C/svg%3E%0A",
  style: {
    objectFit: 'cover'
  }
};
var Image = _ref => {
  var {
      width = '100%',
      fit = 'cover',
      position = 'center',
      showBorder = false,
      borderRadius,
      transparent = false,
      alt = ''
    } = _ref,
    propsWithNoDefaults = (0, _objectWithoutProperties2.default)(_ref, _excluded);
  var _width$propsWithNoDef = _objectSpread({
      width
    }, propsWithNoDefaults),
    {
      dataHook,
      src,
      style,
      className
    } = _width$propsWithNoDef,
    otherProps = (0, _objectWithoutProperties2.default)(_width$propsWithNoDef, _excluded2);
  var source = src || placeholder.source;
  var isTiled = !!src && fit === 'tile';
  var imgStyle = !src ? placeholder.style : isTiled ? {
    backgroundPosition: position,
    backgroundImage: source ? "url(\"".concat(source, "\")") : undefined
  } : {
    objectFit: fit,
    objectPosition: position
  };
  return /*#__PURE__*/_react.default.createElement("img", (0, _extends2.default)({}, otherProps, {
    className: (0, _ImageSt.st)(_ImageSt.classes.root, {
      tiled: isTiled,
      showBorder,
      transparent
    }, className),
    "data-hook": dataHook,
    "data-transparent": transparent,
    src: source,
    alt: alt,
    style: _objectSpread(_objectSpread(_objectSpread({}, style), imgStyle), {}, {
      borderRadius
    }),
    __self: void 0,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 41,
      columnNumber: 5
    }
  }));
};
Image.displayName = 'Image';
var _default = exports.default = Image;
//# sourceMappingURL=Image.js.map