import { DialogFooter, wrapDialog } from "teselagen-react-components";
import { Button, Callout, Card } from "@blueprintjs/core";
import { hideDialog } from "../GlobalDialogUtils";
import SimpleCircularOrLinearView from "../SimpleCircularOrLinearView";
import React, { useState } from "react";
import { tidyUpSequenceData } from "@teselagen/sequence-utils";
export var MultipleSeqsDetectedOnImportDialog = wrapDialog({
  title: "Multiple Sequences Detected"
  // style: { height: 600, width: 800 }
})(function (_ref) {
  var results = _ref.results,
    finishDisplayingSeq = _ref.finishDisplayingSeq;
  var _useState = useState(results[0].parsedSequence),
    _selectedSeqData = _useState[0],
    setSelectedSeqData = _useState[1];
  var selectedSeqData = tidyUpSequenceData(_selectedSeqData);
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
    className: "bp3-dialog-body"
  }, /*#__PURE__*/React.createElement(Callout, {
    intent: "primary"
  }, "Multiple sequences were detected in the input file. Please choose one to continue"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("div", {
    style: {
      display: "flex"
    }
  }, /*#__PURE__*/React.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.createElement("div", {
      key: i
    }, /*#__PURE__*/React.createElement(Button, {
      active: parsedSequence === selectedSeqData,
      onClick: function onClick() {
        setSelectedSeqData(parsedSequence);
      },
      minimal: true
    }, name));
  })), "\xA0", /*#__PURE__*/React.createElement(Card, {
    elevation: 1
  }, /*#__PURE__*/React.createElement(SimpleCircularOrLinearView, {
    sequenceData: selectedSeqData || {
      sequence: ""
    }
    // tabHeight={tabHeight}
    ,
    editorName: "previewEditor",
    height: null,
    isProtein: selectedSeqData && selectedSeqData.isProtein,
    annotationLabelVisibility: {
      features: true,
      parts: true,
      cutsites: false,
      primers: true
    }
  })))), /*#__PURE__*/React.createElement(DialogFooter, {
    text: "Select",
    onClick: function onClick() {
      finishDisplayingSeq(selectedSeqData);
      hideDialog();
    }
  }));
});