import React from 'react';
import logger from './utils/logger';
function getInitials(name) {
  return name.split(/[\s-]+/).map(function (namePart) {
    return namePart[0];
  }).join('');
}
function getKey(prefix, suffix) {
  return "".concat(prefix, "-").concat(suffix).replace(/\s/g, '');
}
function hasClass(allClasses, className) {
  return Boolean(allClasses && allClasses.split(' ').includes(className));
}
function isIE11() {
  if (typeof window === 'undefined') {
    logger.warn('`window` object does not exist');
    return false;
  }

  // @ts-ignore
  return !!window.MSInputMethodContext && !!document.documentMode;
}
function warnIfOverwriting(props, propertyName, componentName) {
  if (props[propertyName]) {
    logger.warn("Prop `".concat(propertyName.toString(), "` on `").concat(componentName, "` will be overwritten"));
  }
}
function withKey(element, prefix, suffix) {
  if (element) {
    return /*#__PURE__*/React.cloneElement(element, {
      key: getKey(prefix, suffix)
    });
  }
  return null;
}
function sleep(ms) {
  return new Promise(function (resolve) {
    setTimeout(resolve, ms);
  });
}
export { getInitials, getKey, hasClass, isIE11, warnIfOverwriting, withKey, sleep };