"use strict";

exports.__esModule = true;
exports.MultipleSeqsDetectedOnImportDialog = void 0;
var _teselagenReactComponents = require("teselagen-react-components");
var _core = require("@blueprintjs/core");
var _GlobalDialogUtils = require("../GlobalDialogUtils");
var _SimpleCircularOrLinearView = _interopRequireDefault(require("../SimpleCircularOrLinearView"));
var _react = _interopRequireWildcard(require("react"));
var _sequenceUtils = require("@teselagen/sequence-utils");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var MultipleSeqsDetectedOnImportDialog = (0, _teselagenReactComponents.wrapDialog)({
  title: "Multiple Sequences Detected"
  // style: { height: 600, width: 800 }
})(function (_ref) {
  var results = _ref.results,
    finishDisplayingSeq = _ref.finishDisplayingSeq;
  var _useState = (0, _react.useState)(results[0].parsedSequence),
    _selectedSeqData = _useState[0],
    setSelectedSeqData = _useState[1];
  var selectedSeqData = (0, _sequenceUtils.tidyUpSequenceData)(_selectedSeqData);
  return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
    className: "bp3-dialog-body"
  }, /*#__PURE__*/_react["default"].createElement(_core.Callout, {
    intent: "primary"
  }, "Multiple sequences were detected in the input file. Please choose one to continue"), /*#__PURE__*/_react["default"].createElement("br", null), /*#__PURE__*/_react["default"].createElement("div", {
    style: {
      display: "flex"
    }
  }, /*#__PURE__*/_react["default"].createElement("div", {
    style: {
      maxHeight: 300,
      overflowY: "auto"
    }
  }, results.map(function (res, i) {
    var parsedSequence = res.parsedSequence;
    if (!parsedSequence) return null;
    var name = parsedSequence.name;
    return /*#__PURE__*/_react["default"].createElement("div", {
      key: i
    }, /*#__PURE__*/_react["default"].createElement(_core.Button, {
      active: parsedSequence === selectedSeqData,
      onClick: function onClick() {
        setSelectedSeqData(parsedSequence);
      },
      minimal: true
    }, name));
  })), "\xA0", /*#__PURE__*/_react["default"].createElement(_core.Card, {
    elevation: 1
  }, /*#__PURE__*/_react["default"].createElement(_SimpleCircularOrLinearView["default"], {
    sequenceData: selectedSeqData || {
      sequence: ""
    }
    // tabHeight={tabHeight}
    ,
    editorName: "previewEditor",
    height: null,
    isProtein: selectedSeqData && selectedSeqData.isProtein,
    annotationLabelVisibility: {
      features: true,
      parts: true,
      cutsites: false,
      primers: true
    }
  })))), /*#__PURE__*/_react["default"].createElement(_teselagenReactComponents.DialogFooter, {
    text: "Select",
    onClick: function onClick() {
      finishDisplayingSeq(selectedSeqData);
      (0, _GlobalDialogUtils.hideDialog)();
    }
  }));
});
exports.MultipleSeqsDetectedOnImportDialog = MultipleSeqsDetectedOnImportDialog;