"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _tslib = require("tslib");

require("brace/ext/language_tools");

var _classnames = _interopRequireDefault(require("classnames"));

var _react = _interopRequireWildcard(require("react"));

var _reactAce = _interopRequireDefault(require("react-ace"));

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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 Editor =
/** @class */
function (_super) {
  (0, _tslib.__extends)(Editor, _super);

  function Editor(props) {
    var _this = _super.call(this, props) || this;

    var mode = props.mode,
        theme = props.theme;

    if (mode === 'json') {
      require('brace/mode/json');

      require('brace/snippets/json');
    }

    if (mode === 'javascript') {
      require('brace/mode/javascript');

      require('brace/snippets/javascript');
    }

    if (mode == 'python') {
      require('brace/mode/python');

      require('brace/snippets/python');
    }

    if (mode == 'php') {
      require('brace/mode/php');

      require('brace/snippets/php');
    }

    if (theme == "tomorrow") {
      require('brace/theme/tomorrow');
    } else {
      require('brace/theme/github');
    }

    return _this;
  }

  Editor.prototype.render = function () {
    return /*#__PURE__*/_react["default"].createElement("div", {
      className: (0, _classnames["default"])({
        'lp-editor_': this.props.readOnly
      }, {
        'lp-editor': !this.props.readOnly
      }, {
        "noSplitLine": this.props.noSplitLine
      })
    }, /*#__PURE__*/_react["default"].createElement(_reactAce["default"], (0, _tslib.__assign)({}, this.props)));
  };

  return Editor;
}(_react.Component);

Editor.defaultProps = {
  mode: 'javascript',
  theme: 'github',
  showPrintMargin: true,
  showGutter: true,
  highlightActiveLine: true,
  fontSize: 14,
  noSplitLine: false,
  setOptions: {
    enableBasicAutocompletion: true,
    enableLiveAutocompletion: true,
    enableSnippets: true,
    showLineNumbers: true,
    tabSize: 4
  },
  editorProps: {
    $blockScrolling: true
  }
};
var _default = Editor;
exports["default"] = _default;