"use strict";

exports.__esModule = true;
exports["default"] = void 0;
var _react = _interopRequireDefault(require("react"));
var _sequenceUtils = require("@teselagen/sequence-utils");
var _AddOrEditAnnotationDialog = _interopRequireDefault(require("../AddOrEditAnnotationDialog"));
var _teselagenReactComponents = require("teselagen-react-components");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var renderTypes = function renderTypes(_ref) {
  var readOnly = _ref.readOnly;
  return /*#__PURE__*/_react["default"].createElement(_teselagenReactComponents.ReactSelectField, {
    inlineLabel: true,
    tooltipError: true,
    disabled: readOnly,
    defaultValue: "misc_feature",
    options: (0, _sequenceUtils.getFeatureTypes)().map(function (type) {
      return {
        label: /*#__PURE__*/_react["default"].createElement("div", {
          style: {
            display: "flex",
            alignItems: "center",
            marginRight: 10
          }
        }, /*#__PURE__*/_react["default"].createElement("div", {
          style: {
            background: (0, _sequenceUtils.getFeatureToColorMap)({
              includeHidden: true
            })[type],
            height: 15,
            width: 15,
            marginRight: 5
          }
        }), type),
        value: type
      };
    }),
    name: "type",
    label: "\u7C7B\u578B"
  });
};
var _default = (0, _AddOrEditAnnotationDialog["default"])({
  formName: "AddOrEditFeatureDialog",
  dialogProps: {
    // height: 500,
    width: 400
  },
  getProps: function getProps(props) {
    return {
      upsertAnnotation: props.upsertFeature,
      // renderLocations: true, //tnw enable this eventually for proteins
      renderLocations: !props.sequenceData.isProtein,
      renderTypes: renderTypes({
        readOnly: props.readOnly
      }),
      annotationTypePlural: "features"
    };
  }
});
exports["default"] = _default;
module.exports = exports.default;