"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.CustomPatternsInput = CustomPatternsInput;
var _react = _interopRequireDefault(require("react"));
var _i18n = require("@kbn/i18n");
var _eui = require("@elastic/eui");
var _i18nReact = require("@kbn/i18n-react");
var _public = require("@kbn/kibana-react-plugin/public");
/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License
 * 2.0; you may not use this file except in compliance with the Elastic License
 * 2.0.
 */

function CustomPatternsInput({
  value,
  onChange
}) {
  const sampleCustomPatterns = `POSTFIX_QUEUEID [0-9A-F]{10,11}
MSG message-id=<%{GREEDYDATA}>`;
  return /*#__PURE__*/_react.default.createElement(_eui.EuiAccordion, {
    id: "customPatternsInput",
    buttonContent: /*#__PURE__*/_react.default.createElement(_i18nReact.FormattedMessage, {
      id: "xpack.grokDebugger.customPatternsButtonLabel",
      defaultMessage: "Custom Patterns"
    }),
    "data-test-subj": "btnToggleCustomPatternsInput"
  }, /*#__PURE__*/_react.default.createElement(_eui.EuiSpacer, {
    size: "m"
  }), /*#__PURE__*/_react.default.createElement(_eui.EuiCallOut, {
    title: /*#__PURE__*/_react.default.createElement(_i18nReact.FormattedMessage, {
      id: "xpack.grokDebugger.customPatterns.callOutTitle",
      defaultMessage: "Enter one custom pattern per line. For example:"
    })
  }, /*#__PURE__*/_react.default.createElement(_eui.EuiCodeBlock, null, sampleCustomPatterns)), /*#__PURE__*/_react.default.createElement(_eui.EuiSpacer, {
    size: "m"
  }), /*#__PURE__*/_react.default.createElement(_eui.EuiFormRow, {
    fullWidth: true,
    "data-test-subj": "aceCustomPatternsInput"
  }, /*#__PURE__*/_react.default.createElement(_public.CodeEditor, {
    languageId: "plaintext",
    value: value,
    height: 200,
    options: {
      tabSize: 2,
      automaticLayout: true
    },
    "aria-label": _i18n.i18n.translate('xpack.grokDebugger.customPatternsInput', {
      defaultMessage: 'Code editor for inputting custom patterns'
    }),
    onChange: onChange
  })));
}