"use strict";

exports.__esModule = true;
exports["default"] = void 0;
var _core = require("@blueprintjs/core");
var _react = _interopRequireDefault(require("react"));
var _teselagenReactComponents = require("teselagen-react-components");
var _ToolbarItem = _interopRequireDefault(require("./ToolbarItem"));
var _withEditorProps = _interopRequireWildcard(require("../withEditorProps"));
var _commands = _interopRequireDefault(require("../commands"));
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 }; }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
var _default = (0, _withEditorProps.connectToEditor)(function (_ref) {
  var _ref$annotationVisibi = _ref.annotationVisibility,
    annotationVisibility = _ref$annotationVisibi === void 0 ? {} : _ref$annotationVisibi,
    _ref$toolBar = _ref.toolBar,
    toolBar = _ref$toolBar === void 0 ? {} : _ref$toolBar;
  return {
    toggled: annotationVisibility.orfs,
    isOpen: toolBar.openItem === "orfTool"
  };
})(function (_ref2) {
  var toolbarItemProps = _ref2.toolbarItemProps,
    toggled = _ref2.toggled,
    annotationVisibilityToggle = _ref2.annotationVisibilityToggle,
    isOpen = _ref2.isOpen;
  return /*#__PURE__*/_react["default"].createElement(_ToolbarItem["default"], _extends({
    Icon: /*#__PURE__*/_react["default"].createElement(_core.Icon, {
      "data-test": "orfTool",
      icon: _teselagenReactComponents.orfIcon
    }),
    onIconClick: function onIconClick() {
      annotationVisibilityToggle("orfs");
    },
    toggled: toggled,
    tooltip: "显示ORFs",
    tooltipToggled: "隐藏ORFs",
    Dropdown: OrfToolDropdown,
    dropdowntooltip: (!isOpen ? "显示" : "隐藏") + "ORFs 选项"
  }, toolbarItemProps));
});
exports["default"] = _default;
var OrfToolDropdown = (0, _withEditorProps["default"])( /*#__PURE__*/function (_React$Component) {
  _inheritsLoose(OrfDropdown, _React$Component);
  function OrfDropdown(props) {
    var _this;
    _this = _React$Component.call(this, props) || this;
    _this.commands = (0, _commands["default"])(_assertThisInitialized(_this));
    return _this;
  }
  var _proto = OrfDropdown.prototype;
  _proto.render = function render() {
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: "veToolbarOrfOptionsHolder"
    }, /*#__PURE__*/_react["default"].createElement(_teselagenReactComponents.CmdCheckbox, {
      prefix: "\u663E\u793A ",
      cmd: this.commands.toggleOrfTranslations
    }), /*#__PURE__*/_react["default"].createElement(_teselagenReactComponents.CmdCheckbox, {
      prefix: "\u663E\u793A ",
      cmd: this.commands.useGtgAndCtgAsStartCodons
    }), /*#__PURE__*/_react["default"].createElement(_teselagenReactComponents.CmdDiv, {
      cmd: this.commands.minOrfSizeCmd
    }), /*#__PURE__*/_react["default"].createElement("div", {
      className: "vespacer"
    }), /*#__PURE__*/_react["default"].createElement(_teselagenReactComponents.InfoHelper, {
      displayToSide: true,
      content: "\u8981\u5E73\u79FB\u4EFB\u610F\u533A\u57DF\uFF0C\u8BF7\u53F3\u952E\u5355\u51FB\u6240\u9009\u5185\u5BB9."
    }));
  };
  return OrfDropdown;
}(_react["default"].Component));
// const OrfToolDropdown = withEditorProps(function({
//   useAdditionalOrfStartCodons,
//   useAdditionalOrfStartCodonsToggle,
//   annotationVisibility,
//   annotationVisibilityToggle,
//   editorName
// }) {
//   return (
//     <div className="veToolbarOrfOptionsHolder">
//       {/* <div className="vespacer" />
//       <MinOrfSize editorName={editorName} />
//       <Checkbox
//         onChange={function() {
//           annotationVisibilityToggle("orfTranslations");
//         }}
//         disabled={!annotationVisibility.orfs}
//         checked={annotationVisibility.orfTranslations}
//         label="Show translations for ORFs"
//       />
//       <Checkbox
//         onChange={function() {
//           annotationVisibilityToggle("cdsFeatureTranslations");
//         }}
//         checked={annotationVisibility.cdsFeatureTranslations}
//         label="Show translations for CDS features"
//       />
//       <Checkbox
//         onChange={useAdditionalOrfStartCodonsToggle}
//         checked={useAdditionalOrfStartCodons}
//         label="Use GTG and CTG as start codons"
//       /> */}
//       <div className="vespacer" />

//       <InfoHelper
//         displayToSide
//         content="To translate an arbitrary area, right click a selection."
//       />
//     </div>
//   );
// });

// export const MinOrfSize = connectToEditor(editorState => {
//   return {
//     sequenceLength: selectors.sequenceLengthSelector(editorState),
//     minimumOrfSize: editorState.minimumOrfSize
//   };
// })(
//   ({
//     minimumOrfSizeUpdate,
//     sequenceLength,
//     annotationVisibilityShow,
//     minimumOrfSize
//   }) => {
//     return (
//       <div data-test="min-orf-size" style={{ display: "flex" }}>
//         Minimum ORF Size:
//         <input
//           type="number"
//           className={classNames(Classes.INPUT, "minOrfSizeInput")}
//           onChange={function(event) {
//             let minimumOrfSize = parseInt(event.target.value, 10);
//             if (!(minimumOrfSize > -1)) return;
//             if (minimumOrfSize > sequenceLength) return;
//             annotationVisibilityShow("orfs");
//             minimumOrfSizeUpdate(minimumOrfSize);
//           }}
//           value={minimumOrfSize}
//         />
//       </div>
//     );
//   }
// );
module.exports = exports.default;