const _excluded = ["lineData"];
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
import React from "react";
import PropTypes from "prop-types";
import { makeStyles } from "@mui/styles";
import useTranslation from "../../utils/useTranslation";
const useStyles = makeStyles(theme => ({
  otherLines: {
    flex: "1 1",
    overflow: "auto",
    border: "1px solid #dddddd",
    borderRadius: 2,
    padding: theme.spacing(1),
    minHeight: 100
  }
}));
function LineData(_ref) {
  let {
      lineData = []
    } = _ref,
    props = _objectWithoutProperties(_ref, _excluded);
  const {
    t
  } = useTranslation();
  const classes = useStyles();
  return /*#__PURE__*/React.createElement("fieldset", _extends({
    className: classes.otherLines
  }, props), /*#__PURE__*/React.createElement("legend", null, t("Linien")), lineData && lineData.length ? /*#__PURE__*/React.createElement("div", null, lineData.sort((_ref2, _ref3) => {
    let {
      line_number: lineNumberA,
      km_start: kmStartA
    } = _ref2;
    let {
      line_number: lineNumberB,
      km_start: kmStartB
    } = _ref3;
    if (lineNumberA === lineNumberB) {
      return kmStartA < kmStartB ? -1 : 1;
    }
    return parseFloat(lineNumberA) < parseFloat(lineNumberB) ? -1 : 1;
  }).map(data => {
    const {
      line_number: lineNumber,
      km_start: kmStart,
      km_end: kmEnd
    } = data;
    return /*#__PURE__*/React.createElement("div", {
      key: "".concat(lineNumber, "-").concat(kmStart, "\n                }-").concat(kmEnd)
    }, "".concat(lineNumber ? "".concat(lineNumber, ", ") : "", "km ").concat(kmStart, " - ").concat(kmEnd));
  })) : /*#__PURE__*/React.createElement("div", null, t("Information nicht verfügbar")));
}
LineData.propTypes = {
  lineData: PropTypes.arrayOf(PropTypes.shape({
    line_number: PropTypes.string,
    km_start: PropTypes.number,
    km_end: PropTypes.number
  }))
};
export default LineData;
//# sourceMappingURL=LineData.js.map