"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireWildcard(require("react"));
var _constant = require("./constant");
require("./style.css");
const LanguageSelector = _ref => {
  let {
    handleLangSelectorChange,
    lang = _constant.EXPLAIN_TEXT
  } = _ref;
  const langOptions = (0, _react.useMemo)(() => {
    const options = [];
    for (const value in _constant.LANGUAGE_MAP) {
      if (Object.hasOwnProperty.call(_constant.LANGUAGE_MAP, value)) {
        const name = _constant.LANGUAGE_MAP[value];
        options.push( /*#__PURE__*/_react.default.createElement("option", {
          key: value,
          value: value
        }, name));
      }
    }
    return options;
  }, []);
  return /*#__PURE__*/_react.default.createElement("select", {
    name: "language",
    className: "sf-lang-selector",
    value: lang || '',
    onChange: e => handleLangSelectorChange(e.target.value)
  }, langOptions);
};
var _default = exports.default = LanguageSelector;