import _objectSpread from "@babel/runtime/helpers/objectSpread2";
import { makeStyles } from '@material-ui/core/styles';
import LaunchIcon from '@material-ui/icons/Launch';
import { merge } from 'lodash';
import Markdown from 'markdown-to-jsx';
import Link from '@material-ui/core/Link';
import { jsx as _jsx } from "react/jsx-runtime";
import { jsxs as _jsxs } from "react/jsx-runtime";
var useStyles = makeStyles(function (theme) {
  return {
    root: {
      fontSize: '0.8em',
      marginLeft: '0.3em'
    },
    link: {
      color: theme.palette.type === 'dark' ? '#1FA5FF' : theme.palette.primary
    }
  };
});

var Anchor = function Anchor(props) {
  var classes = useStyles();
  return /*#__PURE__*/_jsxs("a", _objectSpread(_objectSpread({
    target: "_blank",
    rel: "noopener noreferrer nofollow"
  }, props), {}, {
    children: [props.children, /*#__PURE__*/_jsx(LaunchIcon, {
      className: classes.root
    })]
  })), /*#__PURE__*/_jsxs(Link, _objectSpread(_objectSpread({
    target: "_blank",
    rel: "noopener noreferrer nofollow"
  }, props), {}, {
    className: classes.link,
    children: [props.children, /*#__PURE__*/_jsx(LaunchIcon, {
      className: classes.link
    })]
  }));
};

export default (function (props) {
  return props.children ? /*#__PURE__*/_jsx(Markdown, _objectSpread(_objectSpread({}, merge({
    options: {
      overrides: {
        a: Anchor,
        Link: Anchor
      }
    }
  }, props)), {}, {
    children: props.children.replace(/\\/g, '\\\\').replace('\\*', '*')
  })) : null;
});
//# sourceMappingURL=Markdown.js.map