'use strict';

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
var React = require('react');
var classnames = require('classnames');
var ramda = require('ramda');
var reactSelectCreatable_esm = require('./react-select-creatable.esm-CYabSQvs.js');
var index = require('./index-CNZKW5X0.js');
var _toArray = require('@babel/runtime/helpers/toArray');
var Close = require('@bigbinary/neeto-icons/Close');
var Tag = require('./Tag.js');
var jsxRuntime = require('react/jsx-runtime');
var neetoCist = require('@bigbinary/neeto-cist');
var Label = require('./Label.js');
require('@babel/runtime/helpers/esm/extends');
require('@babel/runtime/helpers/esm/objectSpread2');
require('@babel/runtime/helpers/esm/classCallCheck');
require('@babel/runtime/helpers/esm/createClass');
require('@babel/runtime/helpers/esm/inherits');
require('@babel/runtime/helpers/esm/createSuper');
require('@babel/runtime/helpers/esm/toConsumableArray');
require('@babel/runtime/helpers/extends');
require('@babel/runtime/helpers/esm/taggedTemplateLiteral');
require('@babel/runtime/helpers/esm/objectWithoutProperties');
require('@babel/runtime/helpers/esm/slicedToArray');
require('@babel/runtime/helpers/esm/typeof');
require('@babel/runtime/helpers/esm/defineProperty');
require('react-dom');
require('@babel/runtime/helpers/objectSpread2');
require('@babel/runtime/helpers/classCallCheck');
require('@babel/runtime/helpers/createClass');
require('@babel/runtime/helpers/inherits');
require('@babel/runtime/helpers/createSuper');
require('@babel/runtime/helpers/taggedTemplateLiteral');
require('@babel/runtime/helpers/typeof');
require('qs');
require('./en-B1i-pQJm.js');
require('./index-BgzkP01c.js');
require('dayjs');
require('dayjs/plugin/localeData');
require('dayjs/plugin/utc');
require('dayjs/plugin/weekday');
require('dayjs/plugin/weekOfYear');
require('i18next');
require('@bigbinary/neeto-icons/Help');
require('./Button.js');
require('react-router-dom');
require('./Spinner.js');
require('./Tooltip.js');
require('@tippyjs/react');
require('tippy.js');
require('@bigbinary/neeto-hotkeys');
require('./overlayManager.js');
require('./usePrefersReducedMotion-D2Ck84HM.js');
require('./Popover.js');
require('./Typography.js');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
var _toConsumableArray__default = /*#__PURE__*/_interopDefault(_toConsumableArray);
var _slicedToArray__default = /*#__PURE__*/_interopDefault(_slicedToArray);
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefault(_objectWithoutProperties);
var classnames__default = /*#__PURE__*/_interopDefault(classnames);
var _toArray__default = /*#__PURE__*/_interopDefault(_toArray);
var Close__default = /*#__PURE__*/_interopDefault(Close);

var _excluded$2 = ["children"],
  _excluded2 = ["children"];
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var STYLES = {
  border: {
    "default": "1px solid rgb(var(--neeto-ui-gray-400))",
    error: "1px solid rgb(var(--neeto-ui-error-800)) !important"
  },
  color: {
    "default": "rgb(var(--neeto-ui-gray-800))",
    error: "rgb(var(--neeto-ui-error-800)) !important"
  }
};
var CustomControl = function CustomControl(_ref) {
  var children = _ref.children,
    props = _objectWithoutProperties__default.default(_ref, _excluded$2);
  var getValue = props.getValue;
  var _props$selectProps = props.selectProps,
    isFocused = _props$selectProps.isFocused,
    prefix = _props$selectProps.prefix;
  var prevValue = React.useRef([]);
  var controlRef = React.useRef(null);
  var value = getValue();
  var scrollToBottom = function scrollToBottom() {
    var scrollContainer = controlRef.current;
    if (!scrollContainer) return;
    var scrollHeight = scrollContainer.scrollHeight,
      clientHeight = scrollContainer.clientHeight;
    scrollContainer.scrollTo({
      top: scrollHeight - clientHeight
    });
  };
  React.useEffect(function () {
    var isItemAdded = value.length > prevValue.current.length;
    var isItemDeleted = value.length < prevValue.current.length;
    if (isFocused && !isItemDeleted || isItemAdded) scrollToBottom();
    prevValue.current = value;
  }, [isFocused, value]);
  return /*#__PURE__*/jsxRuntime.jsxs(reactSelectCreatable_esm.components.Control, _objectSpread$2(_objectSpread$2({}, props), {}, {
    innerProps: _objectSpread$2(_objectSpread$2({}, props.innerProps), {}, {
      ref: controlRef
    }),
    children: [prefix && /*#__PURE__*/jsxRuntime.jsx("div", {
      className: "neeto-ui-email-input__prefix",
      children: prefix
    }), children]
  }));
};
var CustomDropdownIndicator = function CustomDropdownIndicator(props) {
  var suffix = props.selectProps.suffix;
  return suffix ? /*#__PURE__*/jsxRuntime.jsx(reactSelectCreatable_esm.components.DropdownIndicator, _objectSpread$2(_objectSpread$2({}, props), {}, {
    children: /*#__PURE__*/jsxRuntime.jsx("div", {
      className: "neeto-ui-email-input__suffix",
      children: suffix
    })
  })) : null;
};
var MultiValueRemove = function MultiValueRemove(props) {
  return /*#__PURE__*/jsxRuntime.jsx(reactSelectCreatable_esm.components.MultiValueRemove, _objectSpread$2(_objectSpread$2({}, props), {}, {
    innerProps: _objectSpread$2(_objectSpread$2({}, props.innerProps), {}, _defineProperty__default.default({}, "data-testid", "".concat(index.hyphenize(props.data.label), "-remove-icon"))),
    children: /*#__PURE__*/jsxRuntime.jsx(Close__default.default, {
      size: 16
    })
  }));
};
var CustomValueContainer = function CustomValueContainer(_ref2) {
  var children = _ref2.children,
    props = _objectWithoutProperties__default.default(_ref2, _excluded2);
  var getValue = props.getValue,
    _props$selectProps2 = props.selectProps,
    isFocused = _props$selectProps2.isFocused,
    visibleEmailsCount = _props$selectProps2.visibleEmailsCount,
    isAlwaysExpanded = _props$selectProps2.isAlwaysExpanded;
  var value = getValue();
  var _children = _toArray__default.default(children),
    firstChild = _children[0],
    rest = _children.slice(1);
  var shouldCollapse = !isAlwaysExpanded && !isFocused && value.length > visibleEmailsCount;
  return /*#__PURE__*/jsxRuntime.jsxs(reactSelectCreatable_esm.components.ValueContainer, _objectSpread$2(_objectSpread$2({}, props), {}, {
    innerProps: _objectSpread$2(_objectSpread$2({}, props.innerProps), {}, _defineProperty__default.default({}, "data-testid", "multi-email-input-container")),
    children: [shouldCollapse ? firstChild.slice(0, visibleEmailsCount) : firstChild, shouldCollapse && /*#__PURE__*/jsxRuntime.jsx(Tag, {
      label: "".concat(value.length - visibleEmailsCount, " more"),
      style: "secondary"
    }), rest]
  }));
};
var CustomClearIndicator = function CustomClearIndicator(props) {
  return /*#__PURE__*/jsxRuntime.jsx(reactSelectCreatable_esm.components.ClearIndicator, _objectSpread$2(_objectSpread$2({}, props), {}, {
    innerProps: _objectSpread$2(_objectSpread$2({}, props.innerProps), {}, _defineProperty__default.default({}, "data-testid", "clear-all-button")),
    children: /*#__PURE__*/jsxRuntime.jsx(Close__default.default, {
      className: "cursor-pointer",
      size: 16
    })
  }));
};
var SelectContainer = function SelectContainer(props) {
  return /*#__PURE__*/jsxRuntime.jsx(reactSelectCreatable_esm.components.SelectContainer, _objectSpread$2(_objectSpread$2({}, props), {}, {
    innerProps: _objectSpread$2(_objectSpread$2({}, props.innerProps), {}, _defineProperty__default.default({}, "data-testid", "multi-email-select-container"))
  }));
};
var Input = function Input(props) {
  var handlePaste = function handlePaste(event) {
    var handleEmailChange = props.selectProps.handleEmailChange;
    var text = event.clipboardData.getData("Text");
    if (!EMAIL_REGEX.test(text)) return;
    event === null || event === void 0 ? void 0 : event.preventDefault();
    setTimeout(function () {
      return handleEmailChange(text);
    });
  };
  return /*#__PURE__*/jsxRuntime.jsx(reactSelectCreatable_esm.components.Input, _objectSpread$2(_objectSpread$2({}, props), {}, {
    "data-testid": "email-select-input-field",
    onPaste: handlePaste
  }));
};
var EMAIL_REGEX = new RegExp("^[A-Z0-9._%+-]+@[A-Z0-9-]+(?:\\.[A-Z0-9-]+)*\\.[A-Z]{2,}$", "i");
var UNSTRICT_EMAIL_REGEX = /(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/g;
var EMAIL_SEPARATION_REGEX = /[^\s,]+/g;
var CUSTOM_STYLES = {
  input: ramda.assoc("overflow", "hidden"),
  multiValue: function multiValue(styles, _ref3) {
    var valid = _ref3.data.valid;
    return _objectSpread$2(_objectSpread$2({}, styles), {}, {
      border: valid ? STYLES.border["default"] : STYLES.border.error,
      color: valid ? STYLES.color["default"] : STYLES.color.error
    });
  }
};
var CUSTOM_COMPONENTS = {
  DropdownIndicator: CustomDropdownIndicator,
  Control: CustomControl,
  MultiValueRemove: MultiValueRemove,
  ValueContainer: CustomValueContainer,
  ClearIndicator: CustomClearIndicator,
  SelectContainer: SelectContainer,
  Input: Input
};

var _excluded$1 = ["label", "value"];
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), true).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var getEmailsMap = function getEmailsMap() {
  var inputEmails = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  var emails = [].concat(_toConsumableArray__default.default(inputEmails), _toConsumableArray__default.default(options));
  var emailsMap = new Map();
  emails.forEach(function (option) {
    var _emailsMap$get;
    var hasPersistedEntry = neetoCist.isPresent((_emailsMap$get = emailsMap.get(option.value)) === null || _emailsMap$get === void 0 ? void 0 : _emailsMap$get.id);
    if (!hasPersistedEntry) emailsMap.set(option.value, option);
  });
  return emailsMap;
};
var processEmailOptions = function processEmailOptions() {
  var inputEmails = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  var emailsMap = getEmailsMap(inputEmails, options);
  return function (email) {
    var emailDetails = emailsMap.get(email) || {
      value: email
    };
    return formatEmailInputOption(emailDetails);
  };
};
var formatEmailInputOption = function formatEmailInputOption(_ref) {
  var label = _ref.label,
    value = _ref.value,
    otherDetails = _objectWithoutProperties__default.default(_ref, _excluded$1);
  return _objectSpread$1(_objectSpread$1({
    label: label !== null && label !== void 0 ? label : value,
    value: value
  }, otherDetails), {}, {
    valid: EMAIL_REGEX.test(value)
  });
};
var pruneDuplicates = function pruneDuplicates(inputValues, options) {
  var emailProcessor = processEmailOptions(inputValues, options);
  var emails = ramda.pluck("value", inputValues);
  var uniqueValuesSet = new Set();
  var duplicates = [];
  emails.forEach(function (pristineEmail) {
    var email = pristineEmail.toLowerCase();
    if (uniqueValuesSet.has(email)) duplicates.push(pristineEmail);
    uniqueValuesSet.add(email);
  });
  var uniqueValues = Array.from(uniqueValuesSet);
  var uniqueEmails = uniqueValues.map(emailProcessor);
  return {
    uniqueEmails: uniqueEmails,
    duplicates: duplicates
  };
};
var renderValidEmails = function renderValidEmails(values) {
  return values.filter(function (email) {
    return email.valid && email;
  });
};
var getValidEmailsCount = function getValidEmailsCount(values) {
  return renderValidEmails(values).length;
};
var renderDefaultText = function renderDefaultText(count) {
  return count === 1 ? "email" : "emails";
};
var renderDuplicateEmailsWarningMessage = function renderDuplicateEmailsWarningMessage(duplicateEmails) {
  var count = duplicateEmails.length;
  return "Removed ".concat(count, " duplicate ").concat(renderDefaultText(count), " from the list: ").concat(duplicateEmails.join(", "));
};

var _excluded = ["label", "placeholder", "helpText", "value", "onChange", "error", "onBlur", "filterInvalidEmails", "counter", "disabled", "maxHeight", "required", "labelProps", "visibleEmailsCount", "isCreateable", "isAlwaysExpanded"];
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var MultiEmailInput = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
  var _ref$label = _ref.label,
    label = _ref$label === void 0 ? "Email(s)" : _ref$label,
    _ref$placeholder = _ref.placeholder,
    placeholder = _ref$placeholder === void 0 ? "" : _ref$placeholder,
    _ref$helpText = _ref.helpText,
    helpText = _ref$helpText === void 0 ? "" : _ref$helpText,
    _ref$value = _ref.value,
    value = _ref$value === void 0 ? [] : _ref$value,
    _ref$onChange = _ref.onChange,
    onChange = _ref$onChange === void 0 ? index.noop : _ref$onChange,
    _ref$error = _ref.error,
    error = _ref$error === void 0 ? "" : _ref$error,
    _ref$onBlur = _ref.onBlur,
    onBlur = _ref$onBlur === void 0 ? index.noop : _ref$onBlur,
    filterInvalidEmails = _ref.filterInvalidEmails,
    counter = _ref.counter,
    _ref$disabled = _ref.disabled,
    disabled = _ref$disabled === void 0 ? false : _ref$disabled,
    _ref$maxHeight = _ref.maxHeight,
    maxHeight = _ref$maxHeight === void 0 ? 200 : _ref$maxHeight,
    _ref$required = _ref.required,
    required = _ref$required === void 0 ? false : _ref$required,
    labelProps = _ref.labelProps,
    _ref$visibleEmailsCou = _ref.visibleEmailsCount,
    visibleEmailsCount = _ref$visibleEmailsCou === void 0 ? 3 : _ref$visibleEmailsCou,
    _ref$isCreateable = _ref.isCreateable,
    isCreateable = _ref$isCreateable === void 0 ? true : _ref$isCreateable,
    _ref$isAlwaysExpanded = _ref.isAlwaysExpanded,
    isAlwaysExpanded = _ref$isAlwaysExpanded === void 0 ? false : _ref$isAlwaysExpanded,
    otherProps = _objectWithoutProperties__default.default(_ref, _excluded);
  var _useState = React.useState(""),
    _useState2 = _slicedToArray__default.default(_useState, 2),
    inputValue = _useState2[0],
    setInputValue = _useState2[1];
  var _useState3 = React.useState(false),
    _useState4 = _slicedToArray__default.default(_useState3, 2),
    isFocused = _useState4[0],
    setIsFocused = _useState4[1];
  var _useState5 = React.useState([]),
    _useState6 = _slicedToArray__default.default(_useState5, 2),
    duplicateEmails = _useState6[0],
    setDuplicateEmails = _useState6[1];
  var _useState7 = React.useState(false),
    _useState8 = _slicedToArray__default.default(_useState7, 2),
    isMenuOpen = _useState8[0],
    setIsMenuOpen = _useState8[1];
  var isCounterVisible = !!counter && (!counter.startsFrom || getValidEmailsCount(value) >= counter.startsFrom);
  var isOptionsPresent = !!otherProps.options;
  var handleFilterEmails = function handleFilterEmails() {
    return onChange(renderValidEmails(value));
  };
  var handleEmailChange = function handleEmailChange(inputValue) {
    if (!isCreateable) return;
    var inputValues = inputValue.match(EMAIL_SEPARATION_REGEX);
    var emailMatches = inputValue.match(UNSTRICT_EMAIL_REGEX) || inputValues || [];
    var emails = emailMatches.map(function (email) {
      return {
        value: email
      };
    });
    var _pruneDuplicates = pruneDuplicates([].concat(_toConsumableArray__default.default(value), _toConsumableArray__default.default(emails)), otherProps.options),
      uniqueEmails = _pruneDuplicates.uniqueEmails,
      duplicates = _pruneDuplicates.duplicates;
    onChange(uniqueEmails);
    setDuplicateEmails(duplicates);
    setInputValue("");
    setIsMenuOpen(false);
  };
  var handleKeyDown = function handleKeyDown(event) {
    if (!inputValue) return;
    switch (event.key) {
      case "Enter":
        {
          handleEmailChange(inputValue);
          !isOptionsPresent && event.preventDefault();
          event.stopPropagation();
          return;
        }
      case "Tab":
      case ",":
      case " ":
        {
          handleEmailChange(inputValue);
          event.preventDefault();
          event.stopPropagation();
        }
    }
  };
  var onCreateOption = function onCreateOption(input) {
    var _otherProps$onCreateO;
    var _pruneDuplicates2 = pruneDuplicates([].concat(_toConsumableArray__default.default(value), [{
        value: input
      }]), otherProps.options),
      uniqueEmails = _pruneDuplicates2.uniqueEmails,
      duplicates = _pruneDuplicates2.duplicates;
    onChange(uniqueEmails);
    setDuplicateEmails(duplicates);
    otherProps === null || otherProps === void 0 ? void 0 : (_otherProps$onCreateO = otherProps.onCreateOption) === null || _otherProps$onCreateO === void 0 ? void 0 : _otherProps$onCreateO.call(otherProps, input);
  };
  var handleBlur = function handleBlur(event) {
    inputValue ? handleEmailChange(inputValue) : onBlur(event);
    setIsFocused(false);
    setDuplicateEmails([]);
  };
  var overrideProps = {};
  if (isOptionsPresent) {
    var isValidNewOption = function isValidNewOption(inputValue, _, selectOptions) {
      if (!isCreateable) return false;
      var isInputEmpty = ramda.isEmpty(inputValue.trim());
      var doesInputContainSeparator = inputValue.includes(",") || inputValue.includes(" ");
      var isInputPresentInOptions = selectOptions.find(function (option) {
        return option.value === inputValue.toLowerCase();
      });
      return !(isInputEmpty || doesInputContainSeparator || isInputPresentInOptions);
    };
    overrideProps = {
      onCreateOption: onCreateOption,
      isValidNewOption: isValidNewOption
    };
  }
  var isFilterEmailsLinkVisible = !!filterInvalidEmails && value.length > getValidEmailsCount(value);
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
    className: "neeto-ui-input__wrapper neeto-ui-email-input__wrapper",
    "data-testid": "email-input-wrapper",
    children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
      className: "neeto-ui-email-input__label-wrapper",
      children: [label && /*#__PURE__*/jsxRuntime.jsx(Label, _objectSpread(_objectSpread({
        required: required,
        className: "neeto-ui-email-input__label",
        "data-testid": "".concat(index.hyphenize(label), "-input-label")
      }, labelProps), {}, {
        children: label
      })), isCounterVisible && /*#__PURE__*/jsxRuntime.jsxs("p", {
        className: "neeto-ui-email-input__counter",
        "data-testid": "".concat(index.hyphenize(label), "-email-counter"),
        children: [getValidEmailsCount(value), " ", counter.label ? counter.label : renderDefaultText(getValidEmailsCount(value))]
      })]
    }), /*#__PURE__*/jsxRuntime.jsx(reactSelectCreatable_esm.CreatableSelect, _objectSpread({
      isMulti: true,
      required: true,
      blurInputOnSelect: false,
      classNamePrefix: "neeto-ui-react-select",
      components: CUSTOM_COMPONENTS,
      isDisabled: disabled,
      menuIsOpen: isMenuOpen,
      className: classnames__default.default("neeto-ui-react-select__container neeto-ui-react-select__container--medium neeto-ui-email-input__select", {
        "neeto-ui-react-select__container--error": !!error
      }),
      styles: _objectSpread(_objectSpread({}, CUSTOM_STYLES), {}, {
        control: ramda.mergeLeft({
          maxHeight: "".concat(maxHeight, "px"),
          overflowY: "auto"
        })
      }),
      onBlur: handleBlur,
      onFocus: function onFocus() {
        return setIsFocused(true);
      },
      onKeyDown: handleKeyDown,
      onInputChange: function onInputChange(inputValue) {
        setIsMenuOpen(Boolean(inputValue));
        setInputValue(inputValue);
      }
    }, _objectSpread(_objectSpread(_objectSpread({
      handleEmailChange: handleEmailChange,
      inputValue: inputValue,
      isAlwaysExpanded: isAlwaysExpanded,
      isFocused: isFocused,
      onChange: onChange,
      placeholder: placeholder,
      ref: ref,
      value: value,
      visibleEmailsCount: visibleEmailsCount
    }, !isOptionsPresent && {
      menuIsOpen: false
    }), otherProps), overrideProps))), !!error && /*#__PURE__*/jsxRuntime.jsxs("p", {
      className: "neeto-ui-input__error",
      "data-testid": "".concat(index.hyphenize(label), "-input-error"),
      children: [error, isFilterEmailsLinkVisible && /*#__PURE__*/jsxRuntime.jsxs("span", {
        className: "neeto-ui-font-semibold cursor-pointer",
        onClick: handleFilterEmails,
        children: ["\xA0", filterInvalidEmails.label ? filterInvalidEmails.label : "Click here to remove invalid emails."]
      })]
    }), !!helpText && /*#__PURE__*/jsxRuntime.jsx("p", {
      className: "neeto-ui-input__help-text",
      "data-testid": "".concat(index.hyphenize(label), "-input-help"),
      children: helpText
    }), !!duplicateEmails.length && /*#__PURE__*/jsxRuntime.jsx("p", {
      className: "neeto-ui-input__error",
      "data-testid": "".concat(index.hyphenize(label), "-duplicate-emails-warning"),
      children: renderDuplicateEmailsWarningMessage(duplicateEmails)
    })]
  });
});
MultiEmailInput.displayName = "MultiEmailInput";

module.exports = MultiEmailInput;
//# sourceMappingURL=MultiEmailInput.js.map
