"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _reactstrap = require("reactstrap");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
var FISMInput = props => {
  var {
    id,
    name,
    placeholder,
    readOnly,
    autocomplete,
    required,
    inputStyle,
    bsSize,
    showValidity,
    value,
    valid,
    inputRef,
    onInputChange,
    enabledOptions,
    theSize
  } = props;
  var showValidProps = showValidity == 1 || showValidity == 4 ? {
    valid: valid,
    invalid: !valid
  } : {};
  var forceStyle = showValidity == 1 || showValidity == 4 ? {
    backgroundImage: valid ? "url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e\")" : "url(\"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%23dc3545' viewBox='0 0 12 12'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e\")",
    backgroundSize: "calc(0.75em + 0.375rem) calc(0.75em + 0.375rem)"
  } : {};
  return /*#__PURE__*/_react.default.createElement(_reactstrap.Input, _extends({
    id: id,
    name: name,
    type: "select",
    className: "custom-select ".concat(bsSize != undefined ? 'custom-select-' + bsSize : ''),
    multiple: true,
    innerRef: inputRef,
    placeholder: placeholder || "",
    readOnly: readOnly != undefined ? readOnly : false,
    required: required,
    autoComplete: autocomplete,
    style: _objectSpread(_objectSpread({}, inputStyle), forceStyle),
    bsSize: bsSize,
    size: theSize,
    value: value,
    onChange: onInputChange
  }, showValidProps), enabledOptions.map(opt => /*#__PURE__*/_react.default.createElement("option", {
    key: "".concat(name, "_option_").concat(opt.value),
    value: opt.value,
    disabled: opt.disabled
  }, opt.label)));
};
var _default = FISMInput;
exports.default = _default;