"use strict";

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

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = Calculator;

require("core-js/modules/es6.object.assign");

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

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

var _LearnosityCalculator = _interopRequireDefault(require("quiz-interactions/lib/components/common/components/LearnosityCalculator"));

var _formatMessage = _interopRequireDefault(require("format-message"));

var _Button = _interopRequireDefault(require("@instructure/ui-buttons/lib/components/Button"));

var _ScreenReaderContent = _interopRequireDefault(require("@instructure/ui-a11y/lib/components/ScreenReaderContent"));

var _IconCalculator = _interopRequireDefault(require("@instructure/ui-icons/lib/Line/IconCalculator"));

var CalculatorButton = function CalculatorButton(_ref) {
  var toggleCalculator = _ref.toggleCalculator,
      enabled = _ref.enabled;
  return _react.default.createElement(_Button.default, {
    icon: _IconCalculator.default,
    onClick: toggleCalculator,
    disabled: !enabled
  }, _react.default.createElement(_ScreenReaderContent.default, null, "Calculator"));
};

CalculatorButton.propTypes = {
  toggleCalculator: _propTypes.default.func.isRequired,
  enabled: _propTypes.default.bool.isRequired
};

function Calculator(props) {
  return _react.default.createElement(_LearnosityCalculator.default, Object.assign({}, props, {
    render: CalculatorButton
  }));
}

Calculator.propTypes = {
  activeCalculatorId: _propTypes.default.string,
  authenticateLearnosity: _propTypes.default.func.isRequired,
  calculatorType: _propTypes.default.oneOf(['none', 'basic', 'scientific']).isRequired,
  quizSessionId: _propTypes.default.number.isRequired
};