/* index.tsx generated by @compiled/babel-plugin v0.38.1 */
import "./index.compiled.css";
import * as React from 'react';
import { ax, ix } from "@compiled/react/runtime";
import { useFlexibleUiOptionContext } from '../../../../../state/flexible-ui-context';
import ImageIcon from '../../common/image-icon';
/**
 * Media: Image
 * [aspect-ratio: 16 / 9] The context box is fixed to aspect ratio of 16:9.
 * [object-fit: cover] The replaced content is sized to maintain
 * its aspect ratio while filling the element's entire content box.
 * If the object's aspect ratio does not match the aspect ratio of its box,
 * then the object will be clipped to fit.
 * [object-position] Center alignment of the selected replaced element's
 * contents within the element's box.
 */
var styles = null;
/**
 * A base element that displays a Media.
 * @internal
 * @param props - The props necessary for the Media element.
 */
var MediaElement = function MediaElement(_ref) {
  var name = _ref.name,
    className = _ref.className,
    _ref$testId = _ref.testId,
    testId = _ref$testId === void 0 ? 'smart-element-media' : _ref$testId,
    type = _ref.type,
    url = _ref.url,
    onLoad = _ref.onLoad,
    onError = _ref.onError;
  var ui = useFlexibleUiOptionContext();
  if (!type || !url) {
    return null;
  }
  return /*#__PURE__*/React.createElement("div", {
    "data-smart-element": name,
    "data-smart-element-media": type,
    "data-testid": testId
    // eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop
    ,
    className: ax(["_1h1tcq2i _1e0c1txw _1bsb1osq _4t3i1ns9 _jqez1osq _1lg71osq _6slq1osq _x1m21osq _1chb1osq _1usb1osq _5c331osq _l9z01osq _6o691dfr _vr2g1dfr _173baqso _1niwaqso _t0h9stnw _1ulbstnw _byj21ooe _3hvr1ooe _1c0s1ssb _15j31ssb _1npy1ssb _19he1ssb _n3vc1wug _1qj91wug _4fdy1wug _18cv1wug _1aoq15vq _1iqz15vq _6fioj63w _l0jmidpf _12zuh2mm", className])
  }, /*#__PURE__*/React.createElement(ImageIcon, {
    hideLoadingSkeleton: ui === null || ui === void 0 ? void 0 : ui.hideLoadingSkeleton,
    testId: "".concat(testId, "-image"),
    url: url,
    onError: onError,
    onLoad: onLoad,
    defaultIcon: null
  }));
};
export default MediaElement;