var _extends = Object.assign || 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; };

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }

// require PrototypeString.js
import React, { forwardRef, useContext } from 'react';
import Context from '../Context/instance.js';

var InputSafe = forwardRef(function (_ref, ref) {
  var _ref$value = _ref.value,
      value = _ref$value === undefined ? '' : _ref$value,
      others = _objectWithoutProperties(_ref, ['value']);

  // context
  var context = useContext(Context) || {};
  var locale = context.locale || function (key) {
    return key || '';
  };

  var lvl = value.safeLvl();
  return React.createElement(
    'ul',
    _extends({ ref: ref }, others, { className: 'input-safe lvl' + lvl + (others.className ? ' ' + others.className : '') }),
    React.createElement(
      'li',
      null,
      React.createElement('div', { className: 'input-safe-progress' }),
      React.createElement(
        'span',
        { className: 'input-safe-caption' },
        locale('弱', 'low')
      )
    ),
    React.createElement(
      'li',
      null,
      React.createElement('div', { className: 'input-safe-progress' }),
      React.createElement(
        'span',
        { className: 'input-safe-caption' },
        locale('中', 'medium')
      )
    ),
    React.createElement(
      'li',
      null,
      React.createElement('div', { className: 'input-safe-progress' }),
      React.createElement(
        'span',
        { className: 'input-safe-caption' },
        locale('强', 'strong')
      )
    )
  );
});

export default InputSafe;