import { __assign, __extends } from "tslib";
import 'brace/ext/language_tools';
import classNames from 'classnames';
import React, { Component } from 'react';
import AceEditor from 'react-ace';
;
var Editor = /** @class */ (function (_super) {
    __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 (React.createElement("div", { className: classNames({ 'lp-editor_': this.props.readOnly }, { 'lp-editor': !this.props.readOnly }, { "noSplitLine": this.props.noSplitLine }) },
            React.createElement(AceEditor, __assign({}, this.props))));
    };
    return Editor;
}(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 }
};
export default Editor;
