"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = exports.ShowRationale = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _react = _interopRequireDefault(require("react"));

var _styles = require("@material-ui/core/styles");

var _sized = require("./sized");

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

var Info = function Info(_ref) {
  var fg = _ref.fg;
  return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("rect", {
    x: "-115",
    y: "136.7",
    className: fg,
    width: "3",
    height: "3"
  }), /*#__PURE__*/_react["default"].createElement("polygon", {
    className: fg,
    points: "-112,147.7 -112,141.7 -115.8,141.7 -115.8,143.7 -114,143.7 -114,147.7 -116.2,147.7 -116.2,149.7 -109.8,149.7 -109.8,147.7"
  }));
};

Info.propTypes = {
  fg: _propTypes["default"].string
};

var Border = function Border(_ref2) {
  var className = _ref2.className;
  return /*#__PURE__*/_react["default"].createElement("path", {
    className: className,
    d: "M-113,158.5c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-105,158.5-113,158.5zM-113,130.5c-7.4,0-13.5,6.1-13.5,13.5s6.1,13.5,13.5,13.5s13.5-6.1,13.5-13.5S-105.6,130.5-113,130.5z"
  });
};

Border.propTypes = {
  className: _propTypes["default"].string
};

var Circle = function Circle() {
  return /*#__PURE__*/_react["default"].createElement("g", null, /*#__PURE__*/_react["default"].createElement("path", {
    style: {
      fill: '#D0CAC5',
      stroke: '#E6E3E0',
      strokeWidth: 0.75,
      strokeMiterlimit: 10
    },
    d: "M-111.7,160.9c-8.5,0-15.5-6.9-15.5-15.5c0-8.5,6.9-15.5,15.5-15.5s15.5,6.9,15.5,15.5C-96.2,154-103.1,160.9-111.7,160.9z"
  }), /*#__PURE__*/_react["default"].createElement("path", {
    style: {
      fill: '#B3ABA4',
      stroke: '#CDC7C2',
      strokeWidth: 0.5,
      strokeMiterlimit: 10
    },
    d: "M-112,159.5c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-104,159.5-112,159.5z"
  }), /*#__PURE__*/_react["default"].createElement("circle", {
    style: {
      fill: '#FFFFFF'
    },
    cx: "-113",
    cy: "144",
    r: "14"
  }));
};

var Root = function Root(_ref3) {
  var children = _ref3.children,
      size = _ref3.size;
  size = (0, _sized.normalizeSize)(size);
  var style = {
    height: size,
    width: size,
    display: 'inline-block',
    position: 'relative'
  };
  return /*#__PURE__*/_react["default"].createElement("div", {
    style: style
  }, /*#__PURE__*/_react["default"].createElement("svg", {
    preserveAspectRatio: "xMinYMin meet",
    viewBox: "-129 128 34 34"
  }, children));
};

Root.propTypes = {
  children: _propTypes["default"].oneOfType([_propTypes["default"].arrayOf(_propTypes["default"].node), _propTypes["default"].node]).isRequired,
  size: _propTypes["default"].number
};
var styles = {
  fg: {
    fill: '#1a9cff'
  },
  bg: {
    fill: '#bce2ff'
  },
  border: {
    fill: '#bbe3fd'
  },
  whiteBorder: {
    fill: 'white'
  }
};

var ShowRationale = /*#__PURE__*/function (_React$Component) {
  (0, _inherits2["default"])(ShowRationale, _React$Component);

  var _super = _createSuper(ShowRationale);

  function ShowRationale(props) {
    (0, _classCallCheck2["default"])(this, ShowRationale);
    return _super.call(this, props);
  }

  (0, _createClass2["default"])(ShowRationale, [{
    key: "render",
    value: function render() {
      var classes = this.props.classes;

      var info = /*#__PURE__*/_react["default"].createElement(Info, {
        fg: classes.fg
      });

      var icons = {
        check: /*#__PURE__*/_react["default"].createElement(Root, null, /*#__PURE__*/_react["default"].createElement(Circle, null), info, /*#__PURE__*/_react["default"].createElement(Border, {
          className: classes.border
        })),
        emoji: /*#__PURE__*/_react["default"].createElement(Root, null, /*#__PURE__*/_react["default"].createElement(Circle, null), info, /*#__PURE__*/_react["default"].createElement(Border, {
          className: classes.border
        })),
        open: {
          check: /*#__PURE__*/_react["default"].createElement(Root, null, /*#__PURE__*/_react["default"].createElement("circle", {
            style: {
              fill: '#FFFFFF'
            },
            cx: "-113",
            cy: "144",
            r: "14"
          }), /*#__PURE__*/_react["default"].createElement(Info, {
            fg: classes.bg,
            border: classes.whiteBorder
          })),
          emoji: /*#__PURE__*/_react["default"].createElement(Root, null, /*#__PURE__*/_react["default"].createElement("circle", {
            style: {
              fill: '#FFFFFF'
            },
            cx: "-113",
            cy: "144",
            r: "14"
          }), /*#__PURE__*/_react["default"].createElement(Info, {
            fg: classes.bg,
            border: classes.border
          }))
        }
      };

      if (this.props.open === true) {
        return icons.open[this.props.iconSet];
      } else {
        return icons[this.props.iconSet];
      }
    }
  }]);
  return ShowRationale;
}(_react["default"].Component);

exports.ShowRationale = ShowRationale;
(0, _defineProperty2["default"])(ShowRationale, "propTypes", {
  classes: _propTypes["default"].object.isRequired
});
ShowRationale.propTypes = {
  iconSet: _propTypes["default"].oneOf(['emoji', 'check']),
  open: _propTypes["default"].bool
};
ShowRationale.defaultProps = {
  iconSet: 'check',
  open: false
};

var _default = (0, _styles.withStyles)(styles)(ShowRationale);

exports["default"] = _default;
//# sourceMappingURL=show-rationale-icon.js.map