"use strict";

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

var _lodash = _interopRequireDefault(require("lodash"));

var _boxplot = _interopRequireDefault(require("./boxplot"));

var _histogram = _interopRequireDefault(require("./histogram"));

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

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

var _styled = _interopRequireDefault(require("@emotion/styled"));

var _utils = require("./utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Ul =
/*#__PURE__*/
(0, _styled.default)('ul', {
  target: "eq4uxr00"
})("list-style:none;padding-inline-start:0;");

var Statistics = function Statistics(_ref) {
  var dtNode = _ref.dtNode,
      interpreter = _ref.interpreter,
      totalMin = _ref.totalMin,
      totalMax = _ref.totalMax,
      outputValues = _ref.outputValues;

  if (interpreter.version == 2) {
    var _interpreter$distribu = interpreter.distribution(dtNode),
        value = _interpreter$distribu.value,
        standard_deviation = _interpreter$distribu.standard_deviation,
        min = _interpreter$distribu.min,
        max = _interpreter$distribu.max,
        size = _interpreter$distribu.size;

    return _react.default.createElement("div", {
      className: "node-predictions"
    }, _react.default.createElement(_utils.H3NodeInformation, null, "Statistics"), _react.default.createElement(_utils.TextCenterDiv, null, _react.default.createElement(Ul, null, _react.default.createElement("li", null, size, " samples")), _lodash.default.isUndefined(standard_deviation) ? _react.default.createElement(_histogram.default, {
      distribution: value,
      outputValues: outputValues,
      size: size
    }) : _react.default.createElement(_boxplot.default, {
      mean: value,
      std: standard_deviation,
      min: min,
      max: max,
      size: size,
      totalMin: totalMin,
      totalMax: totalMax
    })));
  }

  return _react.default.createElement("div", null);
};

Statistics.propTypes = {
  dtNode: _propTypes.default.object.isRequired,
  interpreter: _propTypes.default.object.isRequired,
  totalMin: _propTypes.default.number,
  totalMax: _propTypes.default.number,
  outputValues: _propTypes.default.array
};
var _default = Statistics;
exports.default = _default;