text: 'use strict';
  
  Object.defineProperty(exports, '__esModule', { value: true });
  
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
  
  var React = require('react');
  var React__default = _interopDefault(React);
  var PropTypes = _interopDefault(require('prop-types'));
  var classnames = _interopDefault(require('classnames'));
  var reactDom = require('react-dom');
  var moment = _interopDefault(require('moment'));
  
  var candidateSelectors = [
    'input',
    'select',
    'textarea',
    'a[href]',
    'button',
    '[tabindex]',
    'audio[controls]',
    'video[controls]',
    '[contenteditable]:not([contenteditable="false"])',
  ];
  var candidateSelector = candidateSelectors.join(',');
  
  var matches = typeof Element === 'undefined'
    ? function () {}
    : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
  
  function tabbable(el, options) {
    options = options || {};
  
    var elementDocument = el.ownerDocument || el;
    var regularTabbables = [];
    var orderedTabbables = [];
  
    var untouchabilityChecker = new UntouchabilityChecker(elementDocument);
    var candidates = el.querySelectorAll(candidateSelector);
  
    if (options.includeContainer) {
      if (matches.call(el, candidateSelector)) {
        candidates = Array.prototype.slice.apply(candidates);
        candidates.unshift(el);
      }
    }
  
    var i, candidate, candidateTabindex;
    for (i = 0; i < candidates.length; i++) {
      candidate = candidates[i];
  
      if (!isNodeMatchingSelectorTabbable(candidate, untouchabilityChecker)) continue;
  
      candidateTabindex = getTabindex(candidate);
      if (candidateTabindex === 0) {
        regularTabbables.push(candidate);
      } else {
        orderedTabbables.push({
          documentOrder: i,
          tabIndex: candidateTabindex,
          node: candidate,
        });
      }
    }
  
    var tabbableNodes = orderedTabbables
      .sort(sortOrderedTabbables)
      .map(function(a) { return a.node })
      .concat(regularTabbables);
  
    return tabbableNodes;
  }
  
  tabbable.isTabbable = isTabbable;
  tabbable.isFocusable = isFocusable;
  
  function isNodeMatchingSelectorTabbable(node, untouchabilityChecker) {
    if (
      !isNodeMatchingSelectorFocusable(node, untouchabilityChecker)
      || isNonTabbableRadio(node)
      || getTabindex(node) < 0
    ) {
      return false;
    }
    return true;
  }
  
  function isTabbable(node, untouchabilityChecker) {
    if (!node) throw new Error('No node provided');
    if (matches.call(node, candidateSelector) === false) return false;
    return isNodeMatchingSelectorTabbable(node, untouchabilityChecker);
  }
  
  function isNodeMatchingSelectorFocusable(node, untouchabilityChecker) {
    untouchabilityChecker = untouchabilityChecker || new UntouchabilityChecker(node.ownerDocument || node);
    if (
      node.disabled
      || isHiddenInput(node)
      || untouchabilityChecker.isUntouchable(node)
    ) {
      return false;
    }
    return true;
  }
  
  var focusableCandidateSelector = candidateSelectors.concat('iframe').join(',');
  function isFocusable(node, untouchabilityChecker) {
    if (!node) throw new Error('No node provided');
    if (matches.call(node, focusableCandidateSelector) === false) return false;
    return isNodeMatchingSelectorFocusable(node, untouchabilityChecker);
  }
  
  function getTabindex(node) {
    var tabindexAttr = parseInt(node.getAttribute('tabindex'), 10);
    if (!isNaN(tabindexAttr)) return tabindexAttr;
    // Browsers do not return `tabIndex` correctly for contentEditable nodes;
    // so if they don't have a tabindex attribute specifically set, assume it's 0.
    if (isContentEditable(node)) return 0;
    return node.tabIndex;
  }
  
  function sortOrderedTabbables(a, b) {
    return a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex;
  }
  
  // Array.prototype.find not available in IE.
  function find(list, predicate) {
    for (var i = 0, length = list.length; i < length; i++) {
      if (predicate(list[i])) return list[i];
    }
  }
  
  function isContentEditable(node) {
    return node.contentEditable === 'true';
  }
  
  function isInput(node) {
    return node.tagName === 'INPUT';
  }
  
  function isHiddenInput(node) {
    return isInput(node) && node.type === 'hidden';
  }
  
  function isRadio(node) {
    return isInput(node) && node.type === 'radio';
  }
  
  function isNonTabbableRadio(node) {
    return isRadio(node) && !isTabbableRadio(node);
  }
  
  function getCheckedRadio(nodes) {
    for (var i = 0; i < nodes.length; i++) {
      if (nodes[i].checked) {
        return nodes[i];
      }
    }
  }
  
  function isTabbableRadio(node) {
    if (!node.name) return true;
    // This won't account for the edge case where you have radio groups with the same
    // in separate forms on the same page.
    var radioSet = node.ownerDocument.querySelectorAll('input[type="radio"][name="' + node.name + '"]');
    var checked = getCheckedRadio(radioSet);
    return !checked || checked === node;
  }
  
  // An element is "untouchable" if *it or one of its ancestors* has
  // `visibility: hidden` or `display: none`.
  function UntouchabilityChecker(elementDocument) {
    this.doc = elementDocument;
    // Node cache must be refreshed on every check, in case
    // the content of the element has changed. The cache contains tuples
    // mapping nodes to their boolean result.
    this.cache = [];
  }
  
  // getComputedStyle accurately reflects `visibility: hidden` of ancestors
  // but not `display: none`, so we need to recursively check parents.
  UntouchabilityChecker.prototype.hasDisplayNone = function hasDisplayNone(node, nodeComputedStyle) {
    if (node === this.doc.documentElement) return false;
  
      // Search for a cached result.
      var cached = find(this.cache, function(item) {
        return item === node;
      });
      if (cached) return cached[1];
  
      nodeComputedStyle = nodeComputedStyle || this.doc.defaultView.getComputedStyle(node);
  
      var result = false;
  
      if (nodeComputedStyle.display === 'none') {
        result = true;
      } else if (node.parentNode) {
        result = this.hasDisplayNone(node.parentNode);
      }
  
      this.cache.push([node, result]);
  
      return result;
  };
  
  UntouchabilityChecker.prototype.isUntouchable = function isUntouchable(node) {
    if (node === this.doc.documentElement) return false;
    var computedStyle = this.doc.defaultView.getComputedStyle(node);
    if (this.hasDisplayNone(node, computedStyle)) return true;
    return computedStyle.visibility === 'hidden';
  };
  
  var tabbable_1 = tabbable;
  
  var tabbable$1 = /*#__PURE__*/Object.freeze({
    default: tabbable_1,
    __moduleExports: tabbable_1
  });
  
  var immutable = extend;
  
  var hasOwnProperty = Object.prototype.hasOwnProperty;
  
  function extend() {
      var target = {};
  
      for (var i = 0; i < arguments.length; i++) {
          var source = arguments[i];
  
          for (var key in source) {
              if (hasOwnProperty.call(source, key)) {
                  target[key] = source[key];
              }
          }
      }
  
      return target
  }
  
  var immutable$1 = /*#__PURE__*/Object.freeze({
    default: immutable,
    __moduleExports: immutable
  });
  
  var tabbable$2 = ( tabbable$1 && tabbable_1 ) || tabbable$1;
  
  var xtend = ( immutable$1 && immutable ) || immutable$1;
  
  var listeningFocusTrap = null;
  
  function focusTrap(element, userOptions) {
    var doc = document;
    var container =
      typeof element === 'string' ? doc.querySelector(element) : element;
  
    var config = xtend(
      {
        returnFocusOnDeactivate: true,
        escapeDeactivates: true
      },
      userOptions
    );
  
    var state = {
      firstTabbableNode: null,
      lastTabbableNode: null,
      nodeFocusedBeforeActivation: null,
      mostRecentlyFocusedNode: null,
      active: false,
      paused: false
    };
  
    var trap = {
      activate: activate,
      deactivate: deactivate,
      pause: pause,
      unpause: unpause
    };
  
    return trap;
  
    function activate(activateOptions) {
      if (state.active) return;
  
      updateTabbableNodes();
  
      state.active = true;
      state.paused = false;
      state.nodeFocusedBeforeActivation = doc.activeElement;
  
      var onActivate =
        activateOptions && activateOptions.onActivate
          ? activateOptions.onActivate
          : config.onActivate;
      if (onActivate) {
        onActivate();
      }
  
      addListeners();
      return trap;
    }
  
    function deactivate(deactivateOptions) {
      if (!state.active) return;
  
      removeListeners();
      state.active = false;
      state.paused = false;
  
      var onDeactivate =
        deactivateOptions && deactivateOptions.onDeactivate !== undefined
          ? deactivateOptions.onDeactivate
          : config.onDeactivate;
      if (onDeactivate) {
        onDeactivate();
      }
  
      var returnFocus =
        deactivateOptions && deactivateOptions.returnFocus !== undefined
          ? deactivateOptions.returnFocus
          : config.returnFocusOnDeactivate;
      if (returnFocus) {
        delay(function() {
          tryFocus(state.nodeFocusedBeforeActivation);
        });
      }
  
      return trap;
    }
  
    function pause() {
      if (state.paused || !state.active) return;
      state.paused = true;
      removeListeners();
    }
  
    function unpause() {
      if (!state.paused || !state.active) return;
      state.paused = false;
      addListeners();
    }
  
    function addListeners() {
      if (!state.active) return;
  
      // There can be only one listening focus trap at a time
      if (listeningFocusTrap) {
        listeningFocusTrap.pause();
      }
      listeningFocusTrap = trap;
  
      updateTabbableNodes();
  
      // Delay ensures that the focused element doesn't capture the event
      // that caused the focus trap activation.
      delay(function() {
        tryFocus(getInitialFocusNode());
      });
      doc.addEventListener('focusin', checkFocusIn, true);
      doc.addEventListener('mousedown', checkPointerDown, true);
      doc.addEventListener('touchstart', checkPointerDown, true);
      doc.addEventListener('click', checkClick, true);
      doc.addEventListener('keydown', checkKey, true);
  
      return trap;
    }
  
    function removeListeners() {
      if (!state.active || listeningFocusTrap !== trap) return;
  
      doc.removeEventListener('focusin', checkFocusIn, true);
      doc.removeEventListener('mousedown', checkPointerDown, true);
      doc.removeEventListener('touchstart', checkPointerDown, true);
      doc.removeEventListener('click', checkClick, true);
      doc.removeEventListener('keydown', checkKey, true);
  
      listeningFocusTrap = null;
  
      return trap;
    }
  
    function getNodeForOption(optionName) {
      var optionValue = config[optionName];
      var node = optionValue;
      if (!optionValue) {
        return null;
      }
      if (typeof optionValue === 'string') {
        node = doc.querySelector(optionValue);
        if (!node) {
          throw new Error('`' + optionName + '` refers to no known node');
        }
      }
      if (typeof optionValue === 'function') {
        node = optionValue();
        if (!node) {
          throw new Error('`' + optionName + '` did not return a node');
        }
      }
      return node;
    }
  
    function getInitialFocusNode() {
      var node;
      if (getNodeForOption('initialFocus') !== null) {
        node = getNodeForOption('initialFocus');
      } else if (container.contains(doc.activeElement)) {
        node = doc.activeElement;
      } else {
        node = state.firstTabbableNode || getNodeForOption('fallbackFocus');
      }
  
      if (!node) {
        throw new Error(
          "You can't have a focus-trap without at least one focusable element"
        );
      }
  
      return node;
    }
  
    // This needs to be done on mousedown and touchstart instead of click
    // so that it precedes the focus event.
    function checkPointerDown(e) {
      if (container.contains(e.target)) return;
      if (config.clickOutsideDeactivates) {
        deactivate({
          returnFocus: !tabbable$2.isFocusable(e.target)
        });
      } else {
        e.preventDefault();
      }
    }
  
    // In case focus escapes the trap for some strange reason, pull it back in.
    function checkFocusIn(e) {
      // In Firefox when you Tab out of an iframe the Document is briefly focused.
      if (container.contains(e.target) || e.target instanceof Document) {
        return;
      }
      e.stopImmediatePropagation();
      tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
    }
  
    function checkKey(e) {
      if (config.escapeDeactivates !== false && isEscapeEvent(e)) {
        e.preventDefault();
        deactivate();
        return;
      }
      if (isTabEvent(e)) {
        checkTab(e);
        return;
      }
    }
  
    // Hijack Tab events on the first and last focusable nodes of the trap,
    // in order to prevent focus from escaping. If it escapes for even a
    // moment it can end up scrolling the page and causing confusion so we
    // kind of need to capture the action at the keydown phase.
    function checkTab(e) {
      updateTabbableNodes();
      if (e.shiftKey && e.target === state.firstTabbableNode) {
        e.preventDefault();
        tryFocus(state.lastTabbableNode);
        return;
      }
      if (!e.shiftKey && e.target === state.lastTabbableNode) {
        e.preventDefault();
        tryFocus(state.firstTabbableNode);
        return;
      }
    }
  
    function checkClick(e) {
      if (config.clickOutsideDeactivates) return;
      if (container.contains(e.target)) return;
      e.preventDefault();
      e.stopImmediatePropagation();
    }
  
    function updateTabbableNodes() {
      var tabbableNodes = tabbable$2(container);
      state.firstTabbableNode = tabbableNodes[0] || getInitialFocusNode();
      state.lastTabbableNode =
        tabbableNodes[tabbableNodes.length - 1] || getInitialFocusNode();
    }
  
    function tryFocus(node) {
      if (node === doc.activeElement) return;
      if (!node || !node.focus) {
        tryFocus(getInitialFocusNode());
        return;
      }
  
      node.focus();
      state.mostRecentlyFocusedNode = node;
      if (isSelectableInput(node)) {
        node.select();
      }
    }
  }
  
  function isSelectableInput(node) {
    return (
      node.tagName &&
      node.tagName.toLowerCase() === 'input' &&
      typeof node.select === 'function'
    );
  }
  
  function isEscapeEvent(e) {
    return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;
  }
  
  function isTabEvent(e) {
    return e.key === 'Tab' || e.keyCode === 9;
  }
  
  function delay(fn) {
    return setTimeout(fn, 0);
  }
  
  var focusTrap_1 = focusTrap;
  
  var focusTrap$1 = /*#__PURE__*/Object.freeze({
    default: focusTrap_1,
    __moduleExports: focusTrap_1
  });
  
  var createFocusTrap = ( focusTrap$1 && focusTrap_1 ) || focusTrap$1;
  
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  
  
  
  
  var checkedProps = ['active', 'paused', 'tag', 'focusTrapOptions', '_createFocusTrap'];
  
  var FocusTrap = function (_React$Component) {
    _inherits(FocusTrap, _React$Component);
  
    function FocusTrap(props) {
      _classCallCheck(this, FocusTrap);
  
      var _this = _possibleConstructorReturn(this, (FocusTrap.__proto__ || Object.getPrototypeOf(FocusTrap)).call(this, props));
  
      _this.setNode = function (el) {
        _this.node = el;
      };
  
      if (typeof document !== 'undefined') {
        _this.previouslyFocusedElement = document.activeElement;
      }
      return _this;
    }
  
    _createClass(FocusTrap, [{
      key: 'componentDidMount',
      value: function componentDidMount() {
        // We need to hijack the returnFocusOnDeactivate option,
        // because React can move focus into the element before we arrived at
        // this lifecycle hook (e.g. with autoFocus inputs). So the component
        // captures the previouslyFocusedElement in componentWillMount,
        // then (optionally) returns focus to it in componentWillUnmount.
        var specifiedFocusTrapOptions = this.props.focusTrapOptions;
        var tailoredFocusTrapOptions = {
          returnFocusOnDeactivate: false
        };
        for (var optionName in specifiedFocusTrapOptions) {
          if (!specifiedFocusTrapOptions.hasOwnProperty(optionName)) continue;
          if (optionName === 'returnFocusOnDeactivate') continue;
          tailoredFocusTrapOptions[optionName] = specifiedFocusTrapOptions[optionName];
        }
  
        this.focusTrap = this.props._createFocusTrap(this.node, tailoredFocusTrapOptions);
        if (this.props.active) {
          this.focusTrap.activate();
        }
        if (this.props.paused) {
          this.focusTrap.pause();
        }
      }
    }, {
      key: 'componentDidUpdate',
      value: function componentDidUpdate(prevProps) {
        if (prevProps.active && !this.props.active) {
          var returnFocusOnDeactivate = this.props.focusTrapOptions.returnFocusOnDeactivate;
  
          var returnFocus = returnFocusOnDeactivate || false;
          var config = { returnFocus: returnFocus };
          this.focusTrap.deactivate(config);
        } else if (!prevProps.active && this.props.active) {
          this.focusTrap.activate();
        }
  
        if (prevProps.paused && !this.props.paused) {
          this.focusTrap.unpause();
        } else if (!prevProps.paused && this.props.paused) {
          this.focusTrap.pause();
        }
      }
    }, {
      key: 'componentWillUnmount',
      value: function componentWillUnmount() {
        this.focusTrap.deactivate();
        if (this.props.focusTrapOptions.returnFocusOnDeactivate !== false && this.previouslyFocusedElement && this.previouslyFocusedElement.focus) {
          this.previouslyFocusedElement.focus();
        }
      }
    }, {
      key: 'render',
      value: function render() {
        var elementProps = {
          ref: this.setNode
        };
  
        // This will get id, className, style, etc. -- arbitrary element props
        for (var prop in this.props) {
          if (!this.props.hasOwnProperty(prop)) continue;
          if (checkedProps.indexOf(prop) !== -1) continue;
          elementProps[prop] = this.props[prop];
        }
  
        return React__default.createElement(this.props.tag, elementProps, this.props.children);
      }
    }]);
  
    return FocusTrap;
  }(React__default.Component);
  
  FocusTrap.defaultProps = {
    active: true,
    tag: 'div',
    paused: false,
    focusTrapOptions: {},
    _createFocusTrap: createFocusTrap
  };
  
  var focusTrapReact = FocusTrap;
  
  var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
    return typeof obj;
  } : function (obj) {
    return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
  };
  
  var classCallCheck = function (instance, Constructor) {
    if (!(instance instanceof Constructor)) {
      throw new TypeError("Cannot call a class as a function");
    }
  };
  
  var createClass = function () {
    function defineProperties(target, props) {
      for (var i = 0; i < props.length; i++) {
        var descriptor = props[i];
        descriptor.enumerable = descriptor.enumerable || false;
        descriptor.configurable = true;
        if ("value" in descriptor) descriptor.writable = true;
        Object.defineProperty(target, descriptor.key, descriptor);
      }
    }
  
    return function (Constructor, protoProps, staticProps) {
      if (protoProps) defineProperties(Constructor.prototype, protoProps);
      if (staticProps) defineProperties(Constructor, staticProps);
      return Constructor;
    };
  }();
  
  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;
  };
  
  var inherits = function (subClass, superClass) {
    if (typeof superClass !== "function" && superClass !== null) {
      throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
    }
  
    subClass.prototype = Object.create(superClass && superClass.prototype, {
      constructor: {
        value: subClass,
        enumerable: false,
        writable: true,
        configurable: true
      }
    });
    if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  };
  
  var possibleConstructorReturn = function (self, call) {
    if (!self) {
      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
    }
  
    return call && (typeof call === "object" || typeof call === "function") ? call : self;
  };
  
  var ScreenReaderOnly = function ScreenReaderOnly(_ref) {
    var children = _ref.children;
  
    var classes = classnames("react-datepicker__screenReaderOnly", children.props.className);
  
    var props = _extends({}, children.props, {
      className: classes
    });
  
    return React.cloneElement(children, props);
  };
  
  ScreenReaderOnly.propTypes = {
    children: PropTypes.node
  };
  
  function generateYears(year, noOfYear, minDate, maxDate) {
    var list = [];
    for (var i = 0; i < 2 * noOfYear + 1; i++) {
      var newYear = year + noOfYear - i;
      var isInRange = true;
  
      if (minDate) {
        isInRange = minDate.year() <= newYear;
      }
  
      if (maxDate && isInRange) {
        isInRange = maxDate.year() >= newYear;
      }
  
      if (isInRange) {
        list.push(newYear);
      }
    }
  
    return list;
  }
  
  var YearDropdownOptions = function (_React$Component) {
    inherits(YearDropdownOptions, _React$Component);
  
    function YearDropdownOptions(props) {
      classCallCheck(this, YearDropdownOptions);
  
      var _this = possibleConstructorReturn(this, _React$Component.call(this, props));
  
      _this.renderOptions = function () {
        var selectedYear = _this.props.year;
        var options = _this.state.yearsList.map(function (year) {
          return React__default.createElement(
            "div",
            {
              className: classnames("react-datepicker__year-option", {
                "react-datepicker__year-option--selected_year": selectedYear === year,
                "react-datepicker__year-option--preselected": _this.props.accessibleMode && _this.state.preSelection === year
              }),
              key: year,
              ref: function ref(div) {
                if (_this.props.accessibleMode && _this.state.preSelection === year) {
                  _this.preSelectionDiv = div;
                }
              },
              onClick: _this.onChange.bind(_this, year)
            },
            selectedYear === year ? React__default.createElement(
              "span",
              { className: "react-datepicker__year-option--selected" },
              "\u2713"
            ) : "",
            year
          );
        });
  
        var minYear = _this.props.minDate ? _this.props.minDate.year() : null;
        var maxYear = _this.props.maxDate ? _this.props.maxDate.year() : null;
  
        if (!maxYear || !_this.state.yearsList.find(function (year) {
          return year === maxYear;
        })) {
          options.unshift(React__default.createElement(
            "div",
            {
              className: "react-datepicker__year-option",
              ref: "upcoming",
              key: "upcoming",
              onClick: _this.incrementYears
            },
            React__default.createElement("a", { className: "react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-upcoming" })
          ));
        }
  
        if (!minYear || !_this.state.yearsList.find(function (year) {
          return year === minYear;
        })) {
          options.push(React__default.createElement(
            "div",
            {
              className: "react-datepicker__year-option",
              ref: "previous",
              key: "previous",
              onClick: _this.decrementYears
            },
            React__default.createElement("a", { className: "react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous" })
          ));
        }
  
        return options;
      };
  
      _this.onFocus = function () {
        if (_this.props.accessibleMode) {
          _this.setState({ readInstructions: true });
        }
      };
  
      _this.onChange = function (year) {
        _this.props.onChange(year);
      };
  
      _this.handleClickOutside = function () {
        _this.props.onCancel();
      };
  
      _this.shiftYears = function (amount) {
        var years = _this.state.yearsList.map(function (year) {
          return year + amount;
        });
  
        _this.setState({
          yearsList: years
        });
      };
  
      _this.incrementYears = function () {
        return _this.shiftYears(1);
      };
  
      _this.decrementYears = function () {
        return _this.shiftYears(-1);
      };
  
      _this.onInputKeyDown = function (event) {
        var eventKey = event.key;
        var selectionChange = 0;
        switch (eventKey) {
          case "ArrowUp":
            event.preventDefault();
            event.stopPropagation();
            selectionChange = -1;
            break;
          case "ArrowDown":
            event.preventDefault();
            event.stopPropagation();
            selectionChange = 1;
            break;
          case "Escape":
            event.preventDefault();
            event.stopPropagation();
            _this.props.onCancel();
            break;
          case " ":
          case "Enter":
            event.preventDefault();
            event.stopPropagation();
            _this.props.onChange(_this.state.preSelection);
            break;
        }
        if (selectionChange) {
          _this.setState(function (_ref) {
            var preSelection = _ref.preSelection;
  
            var maxYear = _this.state.yearsList[0];
            var minYear = _this.state.yearsList[_this.state.yearsList.length - 1];
            var nextSelection = preSelection + selectionChange;
            if (nextSelection < minYear) nextSelection = maxYear;
            if (nextSelection > maxYear) nextSelection = minYear;
            return { preSelection: nextSelection };
          });
        }
      };
  
      var yearDropdownItemNumber = props.yearDropdownItemNumber,
          scrollableYearDropdown = props.scrollableYearDropdown;
  
      var noOfYear = yearDropdownItemNumber || (scrollableYearDropdown ? 10 : 5);
  
      _this.state = {
        yearsList: generateYears(_this.props.year, noOfYear, _this.props.minDate, _this.props.maxDate),
        preSelection: _this.props.year,
        readInstructions: false
      };
      return _this;
    }
  
    YearDropdownOptions.prototype.componentDidMount = function componentDidMount() {
      if (this.preSelectionDiv) {
        this.preSelectionDiv.scrollIntoView({
          behavior: "instant",
          block: "nearest",
          inline: "nearest"
        });
      }
    };
  
    YearDropdownOptions.prototype.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
      if (this.preSelectionDiv && prevState.preSelection !== this.state.preSelection) {
        this.preSelectionDiv.scrollIntoView({
          behavior: "instant",
          block: "nearest",
          inline: "nearest"
        });
      }
    };
  
    YearDropdownOptions.prototype.render = function render() {
      var dropdownClass = classnames({
        "react-datepicker__year-dropdown": true,
        "react-datepicker__year-dropdown--scrollable": this.props.scrollableYearDropdown
      });
  
      var screenReaderInstructions = void 0;
      if (this.state.readInstructions) {
        screenReaderInstructions = React__default.createElement(
          "p",
          { "aria-live": true },
          "You are focused on a year selector menu. Use the up and down arrows to select a year, then hit enter to confirm your selection.",
          this.state.preSelection,
          " is the currently focused year."
        );
      }
  
      return this.props.accessibleMode ? React__default.createElement(
        focusTrapReact,
        null,
        React__default.createElement(
          "div",
          {
            className: dropdownClass,
            tabIndex: "0",
            onKeyDown: this.onInputKeyDown,
            onFocus: this.onFocus
          },
          React__default.createElement(
            ScreenReaderOnly,
            null,
            React__default.createElement(
              "span",
              null,
              screenReaderInstructions
            )
          ),
          this.renderOptions()
        )
      ) : React__default.createElement(
        "div",
        { className: dropdownClass },
        this.renderOptions()
      );
    };
  
    return YearDropdownOptions;
  }(React__default.Component);
  
  YearDropdownOptions.propTypes = {
    minDate: PropTypes.object,
    maxDate: PropTypes.object,
    onCancel: PropTypes.func.isRequired,
    onChange: PropTypes.func.isRequired,
    scrollableYearDropdown: PropTypes.bool,
    year: PropTypes.number.isRequired,
    yearDropdownItemNumber: PropTypes.number,
    accessibleMode: PropTypes.bool
  };
  
  function _inheritsLoose(subClass, superClass) {
    subClass.prototype = Object.create(superClass.prototype);
    subClass.prototype.constructor = subClass;
    subClass.__proto__ = superClass;
  }
  
  function _objectWithoutProperties(source, excluded) {
    if (source == null) return {};
    var target = {};
    var sourceKeys = Object.keys(source);
    var key, i;
  
    for (i = 0; i < sourceKeys.length; i++) {
      key = sourceKeys[i];
      if (excluded.indexOf(key) >= 0) continue;
      target[key] = source[key];
    }
  
    if (Object.getOwnPropertySymbols) {
      var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
  
      for (i = 0; i < sourceSymbolKeys.length; i++) {
        key = sourceSymbolKeys[i];
        if (excluded.indexOf(key) >= 0) continue;
        if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
        target[key] = source[key];
      }
    }
  
    return target;
  }
  
  /**
   * Check whether some DOM node is our Component's node.
   */
  function isNodeFound(current, componentNode, ignoreClass) {
    if (current === componentNode) {
      return true;
    } // SVG <use/> elements do not technically reside in the rendered DOM, so
    // they do not have classList directly, but they offer a link to their
    // corresponding element, which can have classList. This extra check is for
    // that case.
    // See: http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGUseElement
    // Discussion: https://github.com/Pomax/react-onclickoutside/pull/17
  
  
    if (current.correspondingElement) {
      return current.correspondingElement.classList.contains(ignoreClass);
    }
  
    return current.classList.contains(ignoreClass);
  }
  /**
   * Try to find our node in a hierarchy of nodes, returning the document
   * node as highest node if our node is not found in the path up.
   */
  
  function findHighest(current, componentNode, ignoreClass) {
    if (current === componentNode) {
      return true;
    } // If source=local then this event came from 'somewhere'
    // inside and should be ignored. We could handle this with
    // a layered approach, too, but that requires going back to
    // thinking in terms of Dom node nesting, running counter
    // to React's 'you shouldn't care about the DOM' philosophy.
  
  
    while (current.parentNode) {
      if (isNodeFound(current, componentNode, ignoreClass)) {
        return true;
      }
  
      current = current.parentNode;
    }
  
    return current;
  }
  /**
   * Check if the browser scrollbar was clicked
   */
  
  function clickedScrollbar(evt) {
    return document.documentElement.clientWidth <= evt.clientX || document.documentElement.clientHeight <= evt.clientY;
  }
  
  // ideally will get replaced with external dep
  // when rafrex/detect-passive-events#4 and rafrex/detect-passive-events#5 get merged in
  var testPassiveEventSupport = function testPassiveEventSupport() {
    if (typeof window === 'undefined' || typeof window.addEventListener !== 'function') {
      return;
    }
  
    var passive = false;
    var options = Object.defineProperty({}, 'passive', {
      get: function get() {
        passive = true;
      }
    });
  
    var noop = function noop() {};
  
    window.addEventListener('testPassiveEventSupport', noop, options);
    window.removeEventListener('testPassiveEventSupport', noop, options);
    return passive;
  };
  
  function autoInc(seed) {
    if (seed === void 0) {
      seed = 0;
    }
  
    return function () {
      return ++seed;
    };
  }
  
  var uid = autoInc();
  
  var passiveEventSupport;
  var handlersMap = {};
  var enabledInstances = {};
  var touchEvents = ['touchstart', 'touchmove'];
  var IGNORE_CLASS_NAME = 'ignore-react-onclickoutside';
  /**
   * Options for addEventHandler and removeEventHandler
   */
  
  function getEventHandlerOptions(instance, eventName) {
    var handlerOptions = null;
    var isTouchEvent = touchEvents.indexOf(eventName) !== -1;
  
    if (isTouchEvent && passiveEventSupport) {
      handlerOptions = {
        passive: !instance.props.preventDefault
      };
    }
  
    return handlerOptions;
  }
  /**
   * This function generates the HOC function that you'll use
   * in order to impart onOutsideClick listening to an
   * arbitrary component. It gets called at the end of the
   * bootstrapping code to yield an instance of the
   * onClickOutsideHOC function defined inside setupHOC().
   */
  
  
  function onClickOutsideHOC(WrappedComponent, config) {
    var _class, _temp;
  
    return _temp = _class =
    /*#__PURE__*/
    function (_Component) {
      _inheritsLoose(onClickOutside, _Component);
  
      function onClickOutside(props) {
        var _this;
  
        _this = _Component.call(this, props) || this;
  
        _this.__outsideClickHandler = function (event) {
          if (typeof _this.__clickOutsideHandlerProp === 'function') {
            _this.__clickOutsideHandlerProp(event);
  
            return;
          }
  
          var instance = _this.getInstance();
  
          if (typeof instance.props.handleClickOutside === 'function') {
            instance.props.handleClickOutside(event);
            return;
          }
  
          if (typeof instance.handleClickOutside === 'function') {
            instance.handleClickOutside(event);
            return;
          }
  
          throw new Error('WrappedComponent lacks a handleClickOutside(event) function for processing outside click events.');
        };
  
        _this.enableOnClickOutside = function () {
          if (typeof document === 'undefined' || enabledInstances[_this._uid]) {
            return;
          }
  
          if (typeof passiveEventSupport === 'undefined') {
            passiveEventSupport = testPassiveEventSupport();
          }
  
          enabledInstances[_this._uid] = true;
          var events = _this.props.eventTypes;
  
          if (!events.forEach) {
            events = [events];
          }
  
          handlersMap[_this._uid] = function (event) {
            if (_this.props.disableOnClickOutside) return;
            if (_this.componentNode === null) return;
  
            if (_this.props.preventDefault) {
              event.preventDefault();
            }
  
            if (_this.props.stopPropagation) {
              event.stopPropagation();
            }
  
            if (_this.props.excludeScrollbar && clickedScrollbar(event)) return;
            var current = event.target;
  
            if (findHighest(current, _this.componentNode, _this.props.outsideClickIgnoreClass) !== document) {
              return;
            }
  
            _this.__outsideClickHandler(event);
          };
  
          events.forEach(function (eventName) {
            document.addEventListener(eventName, handlersMap[_this._uid], getEventHandlerOptions(_this, eventName));
          });
        };
  
        _this.disableOnClickOutside = function () {
          delete enabledInstances[_this._uid];
          var fn = handlersMap[_this._uid];
  
          if (fn && typeof document !== 'undefined') {
            var events = _this.props.eventTypes;
  
            if (!events.forEach) {
              events = [events];
            }
  
            events.forEach(function (eventName) {
              return document.removeEventListener(eventName, fn, getEventHandlerOptions(_this, eventName));
            });
            delete handlersMap[_this._uid];
          }
        };
  
        _this.getRef = function (ref) {
          return _this.instanceRef = ref;
        };
  
        _this._uid = uid();
        return _this;
      }
      /**
       * Access the WrappedComponent's instance.
       */
  
  
      var _proto = onClickOutside.prototype;
  
      _proto.getInstance = function getInstance() {
        if (!WrappedComponent.prototype.isReactComponent) {
          return this;
        }
  
        var ref = this.instanceRef;
        return ref.getInstance ? ref.getInstance() : ref;
      };
  
      /**
       * Add click listeners to the current document,
       * linked to this component's state.
       */
      _proto.componentDidMount = function componentDidMount() {
        // If we are in an environment without a DOM such
        // as shallow rendering or snapshots then we exit
        // early to prevent any unhandled errors being thrown.
        if (typeof document === 'undefined' || !document.createElement) {
          return;
        }
  
        var instance = this.getInstance();
  
        if (config && typeof config.handleClickOutside === 'function') {
          this.__clickOutsideHandlerProp = config.handleClickOutside(instance);
  
          if (typeof this.__clickOutsideHandlerProp !== 'function') {
            throw new Error('WrappedComponent lacks a function for processing outside click events specified by the handleClickOutside config option.');
          }
        }
  
        this.componentNode = reactDom.findDOMNode(this.getInstance());
        this.enableOnClickOutside();
      };
  
      _proto.componentDidUpdate = function componentDidUpdate() {
        this.componentNode = reactDom.findDOMNode(this.getInstance());
      };
      /**
       * Remove all document's event listeners for this component
       */
  
  
      _proto.componentWillUnmount = function componentWillUnmount() {
        this.disableOnClickOutside();
      };
      /**
       * Can be called to explicitly enable event listening
       * for clicks and touches outside of this element.
       */
  
  
      /**
       * Pass-through render
       */
      _proto.render = function render() {
        // eslint-disable-next-line no-unused-vars
        var _props = this.props,
            excludeScrollbar = _props.excludeScrollbar,
            props = _objectWithoutProperties(_props, ["excludeScrollbar"]);
  
        if (WrappedComponent.prototype.isReactComponent) {
          props.ref = this.getRef;
        } else {
          props.wrappedRef = this.getRef;
        }
  
        props.disableOnClickOutside = this.disableOnClickOutside;
        props.enableOnClickOutside = this.enableOnClickOutside;
        return React.createElement(WrappedComponent, props);
      };
  
      return onClickOutside;
    }(React.Component), _class.displayName = "OnClickOutside(" + (WrappedComponent.displayName || WrappedComponent.name || 'Component') + ")", _class.defaultProps = {
      eventTypes: ['mousedown', 'touchstart'],
      excludeScrollbar: config && config.excludeScrollbar || false,
      outsideClickIgnoreClass: IGNORE_CLASS_NAME,
      preventDefault: false,
      stopPropagation: false
    }, _class.getClass = function () {
      return WrappedComponent.getClass ? WrappedComponent.getClass() : WrappedComponent;
    }, _temp;
  }
  
  var dayOfWeekCodes = {
    1: "mon",
    2: "tue",
    3: "wed",
    4: "thu",
    5: "fri",
    6: "sat",
    7: "sun"
  };
  
  // These functions are not exported so
  // that we avoid magic strings like 'days'
  function set$1(date, unit, to) {
    return date.set(unit, to);
  }
  
  function add(date, amount, unit) {
    return date.add(amount, unit);
  }
  
  function subtract(date, amount, unit) {
    return date.subtract(amount, unit);
  }
  
  function get$1(date, unit) {
    return date.get(unit);
  }
  
  function getStartOf(date, unit) {
    return date.startOf(unit);
  }
  
  // ** Date Constructors **
  
  function newDate(point) {
    return moment(point);
  }
  
  function newDateWithOffset(utcOffset) {
    return moment().utc().utcOffset(utcOffset);
  }
  
  function now(maybeFixedUtcOffset) {
    if (maybeFixedUtcOffset == null) {
      return newDate();
    }
    return newDateWithOffset(maybeFixedUtcOffset);
  }
  
  function cloneDate(date) {
    return date.clone();
  }
  
  function parseDate(value, _ref) {
    var dateFormat = _ref.dateFormat,
        locale = _ref.locale,
        strictParsing = _ref.strictParsing;
  
    var m = moment(value, dateFormat, locale || moment.locale(), strictParsing);
    return m.isValid() ? m : null;
  }
  
  // ** Date "Reflection" **
  
  function isMoment(date) {
    return moment.isMoment(date);
  }
  
  function isDate(date) {
    return moment.isDate(date);
  }
  
  // ** Date Formatting **
  
  function formatDate(date, format) {
    return date.format(format);
  }
  
  function safeDateFormat(date, _ref2) {
    var dateFormat = _ref2.dateFormat,
        locale = _ref2.locale;
  
    return date && date.clone().locale(locale || moment.locale()).format(Array.isArray(dateFormat) ? dateFormat[0] : dateFormat) || "";
  }
  
  // ** Date Setters **
  
  function setTime(date, _ref3) {
    var hour = _ref3.hour,
        minute = _ref3.minute,
        second = _ref3.second,
        millisecond = _ref3.millisecond;
  
    date.set({ hour: hour, minute: minute, second: second, millisecond: millisecond });
    return date;
  }
  
  function setMonth(date, month) {
    return set$1(date, "month", month);
  }
  
  function setYear(date, year) {
    return set$1(date, "year", year);
  }
  
  // ** Date Getters **
  
  function getMillisecond(date) {
    return get$1(date, "millisecond");
  }
  
  function getSecond(date) {
    return get$1(date, "second");
  }
  
  function getMinute(date) {
    return get$1(date, "minute");
  }
  
  function getHour(date) {
    return get$1(date, "hour");
  }
  
  // Returns day of week
  function getDay(date) {
    return get$1(date, "day");
  }
  
  function getWeek(date) {
    return get$1(date, "week");
  }
  
  function getMonth(date) {
    return get$1(date, "month");
  }
  
  function getYear(date) {
    return get$1(date, "year");
  }
  
  // Returns day of month
  function getDate(date) {
    return get$1(date, "date");
  }
  
  function getDayOfWeekCode(day) {
    return dayOfWeekCodes[day.isoWeekday()];
  }
  
  // *** Start of ***
  
  function getStartOfDay(date) {
    return getStartOf(date, "day");
  }
  
  function getStartOfWeek(date) {
    return getStartOf(date, "week");
  }
  function getStartOfMonth(date) {
    return getStartOf(date, "month");
  }
  
  function getStartOfDate(date) {
    return getStartOf(date, "date");
  }
  
  // ** Date Math **
  
  // *** Addition ***
  
  function addMinutes(date, amount) {
    return add(date, amount, "minutes");
  }
  
  function addHours(date, amount) {
    return add(date, amount, "hours");
  }
  
  function addDays(date, amount) {
    return add(date, amount, "days");
  }
  
  function addWeeks(date, amount) {
    return add(date, amount, "weeks");
  }
  
  function addMonths(date, amount) {
    return add(date, amount, "months");
  }
  
  function addYears(date, amount) {
    return add(date, amount, "years");
  }
  
  // *** Subtraction ***
  function subtractDays(date, amount) {
    return subtract(date, amount, "days");
  }
  
  function subtractWeeks(date, amount) {
    return subtract(date, amount, "weeks");
  }
  
  function subtractMonths(date, amount) {
    return subtract(date, amount, "months");
  }
  
  function subtractYears(date, amount) {
    return subtract(date, amount, "years");
  }
  
  // ** Date Comparison **
  
  function isBefore(date1, date2) {
    return date1.isBefore(date2);
  }
  
  function isAfter(date1, date2) {
    return date1.isAfter(date2);
  }
  
  function equals(date1, date2) {
    return date1.isSame(date2);
  }
  
  function isSameYear(date1, date2) {
    if (date1 && date2) {
      return date1.isSame(date2, "year");
    } else {
      return !date1 && !date2;
    }
  }
  
  function isSameMonth(date1, date2) {
    if (date1 && date2) {
      return date1.isSame(date2, "month");
    } else {
      return !date1 && !date2;
    }
  }
  
  function isSameDay(moment1, moment2) {
    if (moment1 && moment2) {
      return moment1.isSame(moment2, "day");
    } else {
      return !moment1 && !moment2;
    }
  }
  
  function isSameTime(moment1, moment2) {
    if (moment1 && moment2) {
      return moment1.isSame(moment2, "second");
    } else {
      return !moment1 && !moment2;
    }
  }
  
  function isDayInRange(day, startDate, endDate) {
    var before = startDate.clone().startOf("day").subtract(1, "seconds");
    var after = endDate.clone().startOf("day").add(1, "seconds");
    return day.clone().startOf("day").isBetween(before, after);
  }
  
  // ** Date Localization **
  
  function localizeDate(date, locale) {
    return date.clone().locale(locale || moment.locale());
  }
  
  function getLocaleData(date) {
    return date.localeData();
  }
  
  function getLocaleDataForLocale(locale) {
    return moment.localeData(locale);
  }
  
  function getFormattedWeekdayInLocale(locale, date, formatFunc) {
    return formatFunc(locale.weekdays(date));
  }
  
  function getWeekdayMinInLocale(locale, date) {
    return locale.weekdaysMin(date);
  }
  
  function getWeekdayShortInLocale(locale, date) {
    return locale.weekdaysShort(date);
  }
  
  // TODO what is this format exactly?
  function getMonthInLocale(locale, date, format) {
    return locale.months(date, format);
  }
  
  function getMonthShortInLocale(locale, date) {
    return locale.monthsShort(date);
  }
  
  // ** Utils for some components **
  
  function isDayDisabled(day) {
    var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
        minDate = _ref4.minDate,
        maxDate = _ref4.maxDate,
        excludeDates = _ref4.excludeDates,
        includeDates = _ref4.includeDates,
        filterDate = _ref4.filterDate;
  
    return minDate && day.isBefore(minDate, "day") || maxDate && day.isAfter(maxDate, "day") || excludeDates && excludeDates.some(function (excludeDate) {
      return isSameDay(day, excludeDate);
    }) || includeDates && !includeDates.some(function (includeDate) {
      return isSameDay(day, includeDate);
    }) || filterDate && !filterDate(day.clone()) || false;
  }
  
  function isOutOfBounds(day) {
    var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
        minDate = _ref5.minDate,
        maxDate = _ref5.maxDate;
  
    return minDate && day.isBefore(minDate, "day") || maxDate && day.isAfter(maxDate, "day");
  }
  
  function isTimeDisabled(time, disabledTimes) {
    var l = disabledTimes.length;
    for (var i = 0; i < l; i++) {
      if (disabledTimes[i].get("hours") === time.get("hours") && disabledTimes[i].get("minutes") === time.get("minutes")) {
        return true;
      }
    }
  
    return false;
  }
  
  function isTimeInDisabledRange(time, _ref6) {
    var minTime = _ref6.minTime,
        maxTime = _ref6.maxTime;
  
    if (!minTime || !maxTime) {
      throw new Error("Both minTime and maxTime props required");
    }
  
    var base = moment().hours(0).minutes(0).seconds(0);
    var baseTime = base.clone().hours(time.get("hours")).minutes(time.get("minutes"));
    var min = base.clone().hours(minTime.get("hours")).minutes(minTime.get("minutes"));
    var max = base.clone().hours(maxTime.get("hours")).minutes(maxTime.get("minutes"));
  
    return !(baseTime.isSameOrAfter(min) && baseTime.isSameOrBefore(max));
  }
  
  function allDaysDisabledBefore(day, unit) {
    var _ref7 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
        minDate = _ref7.minDate,
        includeDates = _ref7.includeDates;
  
    var dateBefore = day.clone().subtract(1, unit);
    return minDate && dateBefore.isBefore(minDate, unit) || includeDates && includeDates.every(function (includeDate) {
      return dateBefore.isBefore(includeDate, unit);
    }) || false;
  }
  
  function allDaysDisabledAfter(day, unit) {
    var _ref8 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
        maxDate = _ref8.maxDate,
        includeDates = _ref8.includeDates;
  
    var dateAfter = day.clone().add(1, unit);
    return maxDate && dateAfter.isAfter(maxDate, unit) || includeDates && includeDates.every(function (includeDate) {
      return dateAfter.isAfter(includeDate, unit);
    }) || false;
  }
  
  function getEffectiveMinDate(_ref9) {
    var minDate = _ref9.minDate,
        includeDates = _ref9.includeDates;
  
    if (includeDates && minDate) {
      return moment.min(includeDates.filter(function (includeDate) {
        return minDate.isSameOrBefore(includeDate, "day");
      }));
    } else if (includeDates) {
      return moment.min(includeDates);
    } else {
      return minDate;
    }
  }
  
  function getEffectiveMaxDate(_ref10) {
    var maxDate = _ref10.maxDate,
        includeDates = _ref10.includeDates;
  
    if (includeDates && maxDate) {
      return moment.max(includeDates.filter(function (includeDate) {
        return maxDate.isSameOrAfter(includeDate, "day");
      }));
    } else if (includeDates) {
      return moment.max(includeDates);
    } else {
      return maxDate;
    }
  }
  
  function getHightLightDaysMap() {
    var highlightDates = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
    var defaultClassName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "react-datepicker__day--highlighted";
  
    var dateClasses = new Map();
    for (var i = 0, len = highlightDates.length; i < len; i++) {
      var obj = highlightDates[i];
      if (isMoment(obj)) {
        var key = obj.format("MM.DD.YYYY");
        var classNamesArr = dateClasses.get(key) || [];
        if (!classNamesArr.includes(defaultClassName)) {
          classNamesArr.push(defaultClassName);
          dateClasses.set(key, classNamesArr);
        }
      } else if ((typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object") {
        var keys = Object.keys(obj);
        var className = keys[0];
        var arrOfMoments = obj[keys[0]];
        if (typeof className === "string" && arrOfMoments.constructor === Array) {
          for (var k = 0, _len = arrOfMoments.length; k < _len; k++) {
            var _key = arrOfMoments[k].format("MM.DD.YYYY");
            var _classNamesArr = dateClasses.get(_key) || [];
            if (!_classNamesArr.includes(className)) {
              _classNamesArr.push(className);
              dateClasses.set(_key, _classNamesArr);
            }
          }
        }
      }
    }
  
    return dateClasses;
  }
  
  function timesToInjectAfter(startOfDay, currentTime, currentMultiplier, intervals, injectedTimes) {
    var l = injectedTimes.length;
    var times = [];
    for (var i = 0; i < l; i++) {
      var injectedTime = addMinutes(addHours(cloneDate(startOfDay), getHour(injectedTimes[i])), getMinute(injectedTimes[i]));
      var nextTime = addMinutes(cloneDate(startOfDay), (currentMultiplier + 1) * intervals);
  
      if (injectedTime.isBetween(currentTime, nextTime)) {
        times.push(injectedTimes[i]);
      }
    }
  
    return times;
  }
  
  var WrappedYearDropdownOptions = onClickOutsideHOC(YearDropdownOptions);
  
  var YearDropdown = function (_React$Component) {
    inherits(YearDropdown, _React$Component);
  
    function YearDropdown() {
      var _temp, _this, _ret;
  
      classCallCheck(this, YearDropdown);
  
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
  
      return _ret = (_temp = (_this = possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = {
        dropdownVisible: false
      }, _this.setReadViewRef = function (ref) {
        _this.readViewref = ref;
        _this.props.buttonRef(ref);
      }, _this.onReadViewKeyDown = function (event) {
        var eventKey = event.key;
        switch (eventKey) {
          case " ":
          case "Enter":
            event.preventDefault();
            event.stopPropagation();
            _this.toggleDropdown();
            break;
        }
      }, _this.onDropDownKeyDown = function (event) {
        var eventKey = event.key;
        switch (eventKey) {
          case " ":
          case "Enter":
            event.preventDefault();
            event.stopPropagation();
            _this.toggleDropdown();
            break;
        }
      }, _this.renderSelectOptions = function () {
        var minYear = _this.props.minDate ? getYear(_this.props.minDate) : 1900;
        var maxYear = _this.props.maxDate ? getYear(_this.props.maxDate) : 2100;
  
        var options = [];
        for (var i = minYear; i <= maxYear; i++) {
          options.push(React__default.createElement(
            "option",
            { key: i, value: i },
            i
          ));
        }
        return options;
      }, _this.onSelectChange = function (e) {
        _this.onChange(e.target.value);
      }, _this.renderSelectMode = function () {
        return React__default.createElement(
          "select",
          {
            value: _this.props.year,
            className: "react-datepicker__year-select",
            onChange: _this.onSelectChange
          },
          _this.renderSelectOptions()
        );
      }, _this.renderReadView = function (visible) {
        return React__default.createElement(
          "div",
          {
            key: "read",
            ref: _this.setReadViewRef,
            style: { visibility: visible ? "visible" : "hidden" },
            className: "react-datepicker__year-read-view",
            onClick: function onClick(event) {
              return _this.toggleDropdown(event);
            },
            onKeyDown: _this.onReadViewKeyDown,
            tabIndex: _this.props.accessibleMode ? "0" : undefined,
            "aria-label": "Button. Open the year selector. " + _this.props.year + " is currently selected."
          },
          React__default.createElement("span", { className: "react-datepicker__year-read-view--down-arrow" }),
          React__default.createElement(
            "span",
            { className: "react-datepicker__year-read-view--selected-year" },
            _this.props.year
          )
        );
      }, _this.renderDropdown = function () {
        return React__default.createElement(WrappedYearDropdownOptions, {
          key: "dropdown",
          ref: "options",
          year: _this.props.year,
          onChange: _this.onChange,
          onCancel: _this.toggleDropdown,
          minDate: _this.props.minDate,
          maxDate: _this.props.maxDate,
          scrollableYearDropdown: _this.props.scrollableYearDropdown,
          yearDropdownItemNumber: _this.props.yearDropdownItemNumber,
          accessibleMode: _this.props.accessibleMode
        });
      }, _this.renderScrollMode = function () {
        var dropdownVisible = _this.state.dropdownVisible;
  
        var result = [_this.renderReadView(!dropdownVisible)];
        if (dropdownVisible) {
          result.unshift(_this.renderDropdown());
        }
        return result;
      }, _this.onChange = function (year) {
        _this.toggleDropdown();
        if (year === _this.props.year) return;
        _this.props.onChange(year);
      }, _this.toggleDropdown = function () {
        var isOpen = !_this.state.dropdownVisible;
        _this.setState({
          dropdownVisible: isOpen
        });
        _this.props.onDropdownToggle(isOpen, 'year');
      }, _this.onSelect = function (date, event) {
        if (_this.props.onSelect) {
          _this.props.onSelect(date, event);
        }
      }, _temp), possibleConstructorReturn(_this, _ret);
    }
  
    YearDropdown.prototype.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
      if (this.props.accessibleMode && // in accessibleMode
      prevState.dropdownVisible !== this.state.dropdownVisible && // dropdown visibility changed
      this.state.dropdownVisible === false // dropdown is no longer visible
      ) {
          this.readViewref.focus();
        }
    };
  
    YearDropdown.prototype.render = function render() {
      var renderedDropdown = void 0;
      switch (this.props.dropdownMode) {
        case "scroll":
          renderedDropdown = this.renderScrollMode();
          break;
        case "select":
          renderedDropdown = this.renderSelectMode();
          break;
      }
  
      return React__default.createElement(
        "div",
        {
          className: "react-datepicker__year-dropdown-container react-datepicker__year-dropdown-container--" + this.props.dropdownMode
        },
        renderedDropdown
      );
    };
  
    return YearDropdown;
  }(React__default.Component);
  
  YearDropdown.propTypes = {
    adjustDateOnChange: PropTypes.bool,
    dropdownMode: PropTypes.oneOf(["scroll", "select"]).isRequired,
    maxDate: PropTypes.object,
    minDate: PropTypes.object,
    onChange: PropTypes.func.isRequired,
    scrollableYearDropdown: PropTypes.bool,
    year: PropTypes.number.isRequired,
    yearDropdownItemNumber: PropTypes.number,
    date: PropTypes.object,
    onSelect: PropTypes.func,
    setOpen: PropTypes.func,
    accessibleMode: PropTypes.bool,
    onDropdownToggle: PropTypes.func,
    buttonRef: PropTypes.func
  };
  
  var MonthDropdownOptions = function (_React$Component) {
    inherits(MonthDropdownOptions, _React$Component);
  
    function MonthDropdownOptions() {
      classCallCheck(this, MonthDropdownOptions);
  
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
  
      var _this = possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args)));
  
      _this.renderOptions = function () {
        return _this.props.monthNames.map(function (month, i) {
          return React__default.createElement(
            "div",
            {
              className: classnames("react-datepicker__month-option", {
                "react-datepicker__month-option--selected_month": _this.props.month === i,
                "react-datepicker__month-option--preselected": _this.props.accessibleMode && _this.state.preSelection === i
              }),
              key: month,
              ref: month,
              onClick: _this.onChange.bind(_this, i)
            },
            _this.props.month === i ? React__default.createElement(
              "span",
              { className: "react-datepicker__month-option--selected" },
              "\u2713"
            ) : "",
            month
          );
        });
      };
  
      _this.onFocus = function () {
        if (_this.props.accessibleMode) {
          _this.setState({ readInstructions: true });
        }
      };
  
      _this.onChange = function (month) {
        return _this.props.onChange(month);
      };
  
      _this.handleClickOutside = function () {
        return _this.props.onCancel();
      };
  
      _this.onInputKeyDown = function (event) {
        var eventKey = event.key;
        var selectionChange = 0;
        switch (eventKey) {
          case "ArrowUp":
            event.preventDefault();
            event.stopPropagation();
            selectionChange = -1;
            break;
          case "ArrowDown":
            event.preventDefault();
            event.stopPropagation();
            selectionChange = 1;
            break;
          case "Escape":
            event.preventDefault();
            event.stopPropagation();
            _this.props.onCancel();
            break;
          case " ":
          case "Enter":
            event.preventDefault();
            event.stopPropagation();
            _this.props.onChange(_this.state.preSelection);
            break;
        }
        if (selectionChange) {
          _this.setState(function (_ref) {
            var preSelection = _ref.preSelection;
  
            var nextSelection = preSelection + selectionChange;
            if (nextSelection < 0) nextSelection = 11;
            if (nextSelection === 12) nextSelection = 0;
            return { preSelection: nextSelection };
          });
        }
      };
  
      _this.state = {
        preSelection: _this.props.month,
        readInstructions: false
      };
      return _this;
    }
  
    MonthDropdownOptions.prototype.render = function render() {
      var screenReaderInstructions = void 0;
      if (this.state.readInstructions) {
        screenReaderInstructions = React__default.createElement(
          "p",
          { "aria-live": true },
          "You are focused on a month selector menu. Use the up and down arrows to select a year, then hit enter to confirm your selection.",
          this.props.monthNames[this.state.preSelection],
          " is the currently focused month."
        );
      }
  
      return this.props.accessibleMode ? React__default.createElement(
        focusTrapReact,
        null,
        React__default.createElement(
          "div",
          {
            className: "react-datepicker__month-dropdown",
            tabIndex: "0",
            onKeyDown: this.onInputKeyDown,
            onFocus: this.onFocus
          },
          React__default.createElement(
            ScreenReaderOnly,
            null,
            React__default.createElement(
              "span",
              null,
              screenReaderInstructions
            )
          ),
          this.renderOptions()
        )
      ) : React__default.createElement(
        "div",
        { className: "react-datepicker__month-dropdown" },
        this.renderOptions()
      );
    };
  
    return MonthDropdownOptions;
  }(React__default.Component);
  
  MonthDropdownOptions.propTypes = {
    onCancel: PropTypes.func.isRequired,
    onChange: PropTypes.func.isRequired,
    month: PropTypes.number.isRequired,
    monthNames: PropTypes.arrayOf(PropTypes.string.isRequired).isRequired,
    accessibleMode: PropTypes.bool
  };
  
  var WrappedMonthDropdownOptions = onClickOutsideHOC(MonthDropdownOptions);
  
  var MonthDropdown = function (_React$Component) {
    inherits(MonthDropdown, _React$Component);
  
    function MonthDropdown(props) {
      classCallCheck(this, MonthDropdown);
  
      var _this = possibleConstructorReturn(this, _React$Component.call(this, props));
  
      _this.setReadViewRef = function (ref) {
        _this.readViewref = ref;
        _this.props.buttonRef(ref);
      };
  
      _this.onReadViewKeyDown = function (event) {
        var eventKey = event.key;
        switch (eventKey) {
          case " ":
          case "Enter":
            event.preventDefault();
            event.stopPropagation();
            _this.toggleDropdown();
            break;
        }
      };
  
      _this.onDropDownKeyDown = function (event) {
        var eventKey = event.key;
        switch (eventKey) {
          case " ":
          case "Enter":
            event.preventDefault();
            event.stopPropagation();
            _this.toggleDropdown();
            break;
        }
      };
  
      _this.renderSelectOptions = function (monthNames) {
        return monthNames.map(function (M, i) {
          return React__default.createElement(
            "option",
            { key: i, value: i },
            M
          );
        });
      };
  
      _this.renderSelectMode = function (monthNames) {
        return React__default.createElement(
          "select",
          {
            value: _this.props.month,
            className: "react-datepicker__month-select",
            onChange: function onChange(e) {
              return _this.onChange(e.target.value);
            }
          },
          _this.renderSelectOptions(monthNames)
        );
      };
  
      _this.renderReadView = function (visible, monthNames) {
        return React__default.createElement(
          "div",
          {
            key: "read",
            ref: _this.setReadViewRef,
            style: { visibility: visible ? "visible" : "hidden" },
            className: "react-datepicker__month-read-view",
            onClick: _this.toggleDropdown,
            onKeyDown: _this.onReadViewKeyDown,
            tabIndex: _this.props.accessibleMode ? "0" : undefined,
            "aria-label": "Button. Open the month selector. " + monthNames[_this.props.month] + " is currently selected."
          },
          React__default.createElement("span", { className: "react-datepicker__month-read-view--down-arrow" }),
          React__default.createElement(
            "span",
            { className: "react-datepicker__month-read-view--selected-month" },
            monthNames[_this.props.month]
          )
        );
      };
  
      _this.renderDropdown = function (monthNames) {
        return React__default.createElement(WrappedMonthDropdownOptions, {
          key: "dropdown",
          ref: "options",
          month: _this.props.month,
          monthNames: monthNames,
          onChange: _this.onChange,
          onCancel: _this.toggleDropdown,
          accessibleMode: _this.props.accessibleMode
        });
      };
  
      _this.renderScrollMode = function (monthNames) {
        var dropdownVisible = _this.state.dropdownVisible;
  
        var result = [_this.renderReadView(!dropdownVisible, monthNames)];
        if (dropdownVisible) {
          result.unshift(_this.renderDropdown(monthNames));
        }
        return result;
      };
  
      _this.onChange = function (month) {
        _this.toggleDropdown();
        if (month !== _this.props.month) {
          _this.props.onChange(month);
        }
      };
  
      _this.toggleDropdown = function () {
        var isOpen = !_this.state.dropdownVisible;
        _this.setState({
          dropdownVisible: isOpen
        });
        _this.props.onDropdownToggle(isOpen, 'month');
      };
  
      _this.localeData = getLocaleDataForLocale(_this.props.locale);
      _this.monthNames = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map(_this.props.useShortMonthInDropdown ? function (M) {
        return getMonthShortInLocale(_this.localeData, newDate({ M: M }));
      } : function (M) {
        return getMonthInLocale(_this.localeData, newDate({ M: M }), _this.props.dateFormat);
      });
  
      _this.state = {
        dropdownVisible: false
      };
      return _this;
    }
  
    MonthDropdown.prototype.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
      var _this2 = this;
  
      if (this.props.accessibleMode && // in accessibleMode
      prevState.dropdownVisible !== this.state.dropdownVisible && // dropdown visibility changed
      this.state.dropdownVisible === false // dropdown is no longer visible
      ) {
          this.readViewref.focus();
        }
  
      if (prevProps.locale !== this.props.locale) {
        this.localeData = getLocaleDataForLocale(this.props.locale);
        this.monthNames = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map(this.props.useShortMonthInDropdown ? function (M) {
          return getMonthShortInLocale(_this2.localeData, newDate({ M: M }));
        } : function (M) {
          return getMonthInLocale(_this2.localeData, newDate({ M: M }), _this2.props.dateFormat);
        });
        this.forceUpdate();
      }
    };
  
    MonthDropdown.prototype.render = function render() {
      var renderedDropdown = void 0;
      switch (this.props.dropdownMode) {
        case "scroll":
          renderedDropdown = this.renderScrollMode(this.monthNames);
          break;
        case "select":
          renderedDropdown = this.renderSelectMode(this.monthNames);
          break;
      }
  
      return React__default.createElement(
        "div",
        {
          className: "react-datepicker__month-dropdown-container react-datepicker__month-dropdown-container--" + this.props.dropdownMode
        },
        renderedDropdown
      );
    };
  
    return MonthDropdown;
  }(React__default.Component);
  
  MonthDropdown.propTypes = {
    dropdownMode: PropTypes.oneOf(["scroll", "select"]).isRequired,
    locale: PropTypes.string,
    dateFormat: PropTypes.string.isRequired,
    month: PropTypes.number.isRequired,
    onChange: PropTypes.func.isRequired,
    useShortMonthInDropdown: PropTypes.bool,
    accessibleMode: PropTypes.bool,
    onDropdownToggle: PropTypes.func,
    buttonRef: PropTypes.func
  };
  
  function generateMonthYears(minDate, maxDate) {
    var list = [];
  
    var currDate = getStartOfMonth(cloneDate(minDate));
    var lastDate = getStartOfMonth(cloneDate(maxDate));
  
    while (!isAfter(currDate, lastDate)) {
      list.push(cloneDate(currDate));
  
      addMonths(currDate, 1);
    }
  
    return list;
  }
  
  var MonthYearDropdownOptions = function (_React$Component) {
    inherits(MonthYearDropdownOptions, _React$Component);
  
    function MonthYearDropdownOptions(props) {
      classCallCheck(this, MonthYearDropdownOptions);
  
      var _this = possibleConstructorReturn(this, _React$Component.call(this, props));
  
      _this.renderOptions = function () {
        return _this.state.monthYearsList.map(function (monthYear) {
          var monthYearPoint = monthYear.valueOf();
  
          var isSameMonthYear = isSameYear(_this.props.date, monthYear) && isSameMonth(_this.props.date, monthYear);
  
          var isPreselectionSameMonthYear = isSameYear(_this.state.preSelection, monthYear) && isSameMonth(_this.state.preSelection, monthYear);
  
          return React__default.createElement(
            "div",
            {
              className: classnames("react-datepicker__month-year-option", {
                "--selected_month-year": isSameMonthYear,
                "react-datepicker__month-year-option--preselected": _this.props.accessibleMode && isPreselectionSameMonthYear
              }),
              key: monthYearPoint,
              ref: function ref(div) {
                if (_this.props.accessibleMode && isPreselectionSameMonthYear) {
                  _this.preSelectionDiv = div;
                }
              },
              onClick: _this.onChange.bind(_this, monthYearPoint)
            },
            isSameMonthYear ? React__default.createElement(
              "span",
              { className: "react-datepicker__month-year-option--selected" },
              "\u2713"
            ) : "",
            formatDate(monthYear, _this.props.dateFormat)
          );
        });
      };
  
      _this.onFocus = function () {
        if (_this.props.accessibleMode) {
          _this.setState({ readInstructions: true });
        }
      };
  
      _this.onChange = function (monthYear) {
        return _this.props.onChange(monthYear);
      };
  
      _this.handleClickOutside = function () {
        _this.props.onCancel();
      };
  
      _this.onInputKeyDown = function (event) {
        var eventKey = event.key;
        var newSelection = void 0;
        switch (eventKey) {
          case "ArrowUp":
            event.preventDefault();
            event.stopPropagation();
            newSelection = addMonths(cloneDate(_this.state.preSelection), -1);
            break;
          case "ArrowDown":
            event.preventDefault();
            event.stopPropagation();
            newSelection = addMonths(cloneDate(_this.state.preSelection), 1);
            break;
          case "Escape":
            event.preventDefault();
            event.stopPropagation();
            _this.props.onCancel();
            break;
          case " ":
          case "Enter":
            event.preventDefault();
            event.stopPropagation();
            _this.props.onChange(_this.state.preSelection.valueOf());
            break;
        }
        if (newSelection) {
          var minMonthYear = _this.state.monthYearsList[0];
          var maxMonthYear = _this.state.monthYearsList[_this.state.monthYearsList.length - 1];
          if (isBefore(newSelection, minMonthYear)) newSelection = maxMonthYear;
          if (isAfter(newSelection, maxMonthYear)) newSelection = minMonthYear;
          _this.setState({ preSelection: newSelection });
        }
      };
  
      _this.state = {
        monthYearsList: generateMonthYears(_this.props.minDate, _this.props.maxDate),
        preSelection: getStartOfMonth(cloneDate(_this.props.date)),
        readInstructions: false
      };
      return _this;
    }
  
    MonthYearDropdownOptions.prototype.componentDidMount = function componentDidMount() {
      if (this.preSelectionDiv) {
        this.preSelectionDiv.scrollIntoView({
          behavior: "instant",
          block: "nearest",
          inline: "nearest"
        });
      }
    };
  
    MonthYearDropdownOptions.prototype.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
      if (this.preSelectionDiv) {
        this.preSelectionDiv.scrollIntoView({
          behavior: "instant",
          block: "nearest",
          inline: "nearest"
        });
      }
    };
  
    MonthYearDropdownOptions.prototype.render = function render() {
      var dropdownClass = classnames({
        "react-datepicker__month-year-dropdown": true,
        "react-datepicker__month-year-dropdown--scrollable": this.props.scrollableMonthYearDropdown
      });
  
      var screenReaderInstructions = void 0;
      if (this.state.readInstructions) {
        screenReaderInstructions = React__default.createElement(
          "p",
          { "aria-live": true },
          "You are focused on a month / year selector menu. Use the up and down arrows to select a month / year combination, then hit enter to confirm your selection.",
          formatDate(this.state.preSelection, this.props.dateFormat),
          " is the currently focused month / year."
        );
      }
  
      return this.props.accessibleMode ? React__default.createElement(
        focusTrapReact,
        null,
        React__default.createElement(
          "div",
          {
            className: dropdownClass,
            tabIndex: "0",
            onKeyDown: this.onInputKeyDown,
            onFocus: this.onFocus
          },
          React__default.createElement(
            ScreenReaderOnly,
            null,
            React__default.createElement(
              "span",
              null,
              screenReaderInstructions
            )
          ),
          this.renderOptions()
        )
      ) : React__default.createElement(
        "div",
        { className: dropdownClass },
        this.renderOptions()
      );
  
      return React__default.createElement(
        "div",
        { className: dropdownClass },
        this.renderOptions()
      );
    };
  
    return MonthYearDropdownOptions;
  }(React__default.Component);
  
  MonthYearDropdownOptions.propTypes = {
    minDate: PropTypes.object.isRequired,
    maxDate: PropTypes.object.isRequired,
    onCancel: PropTypes.func.isRequired,
    onChange: PropTypes.func.isRequired,
    scrollableMonthYearDropdown: PropTypes.bool,
    date: PropTypes.object.isRequired,
    dateFormat: PropTypes.string.isRequired,
    accessibleMode: PropTypes.bool
  };
  
  var WrappedMonthYearDropdownOptions = onClickOutsideHOC(MonthYearDropdownOptions);
  
  var MonthYearDropdown = function (_React$Component) {
    inherits(MonthYearDropdown, _React$Component);
  
    function MonthYearDropdown() {
      var _temp, _this, _ret;
  
      classCallCheck(this, MonthYearDropdown);
  
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
  
      return _ret = (_temp = (_this = possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.state = {
        dropdownVisible: false
      }, _this.setReadViewRef = function (ref) {
        _this.readViewref = ref;
      }, _this.onReadViewKeyDown = function (event) {
        var eventKey = event.key;
        switch (eventKey) {
          case " ":
          case "Enter":
            event.preventDefault();
            event.stopPropagation();
            _this.toggleDropdown();
            break;
        }
      }, _this.onDropDownKeyDown = function (event) {
        var eventKey = event.key;
        switch (eventKey) {
          case " ":
          case "Enter":
            event.preventDefault();
            event.stopPropagation();
            _this.toggleDropdown();
            break;
        }
      }, _this.renderSelectOptions = function () {
        var currDate = getStartOfMonth(localizeDate(_this.props.minDate, _this.props.locale));
        var lastDate = getStartOfMonth(localizeDate(_this.props.maxDate, _this.props.locale));
  
        var options = [];
  
        while (!isAfter(currDate, lastDate)) {
          var timepoint = currDate.valueOf();
          options.push(React__default.createElement(
            "option",
            { key: timepoint, value: timepoint },
            formatDate(currDate, _this.props.dateFormat)
          ));
  
          addMonths(currDate, 1);
        }
  
        return options;
      }, _this.onSelectChange = function (e) {
        _this.onChange(e.target.value);
      }, _this.renderSelectMode = function () {
        return React__default.createElement(
          "select",
          {
            value: getStartOfMonth(_this.props.date).valueOf(),
            className: "react-datepicker__month-year-select",
            onChange: _this.onSelectChange
          },
          _this.renderSelectOptions()
        );
      }, _this.renderReadView = function (visible) {
        var yearMonth = formatDate(localizeDate(newDate(_this.props.date), _this.props.locale), _this.props.dateFormat);
  
        return React__default.createElement(
          "div",
          {
            key: "read",
            ref: _this.setReadViewRef,
            style: { visibility: visible ? "visible" : "hidden" },
            className: "react-datepicker__month-year-read-view",
            onClick: function onClick(event) {
              return _this.toggleDropdown(event);
            },
            onKeyDown: _this.onReadViewKeyDown,
            tabIndex: _this.props.accessibleMode ? "0" : undefined,
            "aria-label": "Button. Open the month selector. " + yearMonth + " is currently selected."
          },
          React__default.createElement("span", { className: "react-datepicker__month-year-read-view--down-arrow" }),
          React__default.createElement(
            "span",
            { className: "react-datepicker__month-year-read-view--selected-month-year" },
            yearMonth
          )
        );
      }, _this.renderDropdown = function () {
        return React__default.createElement(WrappedMonthYearDropdownOptions, {
          key: "dropdown",
          ref: "options",
          date: _this.props.date,
          dateFormat: _this.props.dateFormat,
          onChange: _this.onChange,
          onCancel: _this.toggleDropdown,
          minDate: localizeDate(_this.props.minDate, _this.props.locale),
          maxDate: localizeDate(_this.props.maxDate, _this.props.locale),
          scrollableMonthYearDropdown: _this.props.scrollableMonthYearDropdown,
          accessibleMode: _this.props.accessibleMode
        });
      }, _this.renderScrollMode = function () {
        var dropdownVisible = _this.state.dropdownVisible;
  
        var result = [_this.renderReadView(!dropdownVisible)];
        if (dropdownVisible) {
          result.unshift(_this.renderDropdown());
        }
        return result;
      }, _this.onChange = function (monthYearPoint) {
        _this.toggleDropdown();
  
        var changedDate = newDate(parseInt(monthYearPoint));
  
        if (isSameYear(_this.props.date, changedDate) && isSameMonth(_this.props.date, changedDate)) {
          return;
        }
  
        _this.props.onChange(changedDate);
      }, _this.toggleDropdown = function () {
        return _this.setState({
          dropdownVisible: !_this.state.dropdownVisible
        });
      }, _temp), possibleConstructorReturn(_this, _ret);
    }
  
    MonthYearDropdown.prototype.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
      if (this.props.accessibleMode && // in accessibleMode
      prevState.dropdownVisible !== this.state.dropdownVisible && // dropdown visibility changed
      this.state.dropdownVisible === false // dropdown is no longer visible
      ) {
          this.readViewref.focus();
        }
    };
  
    MonthYearDropdown.prototype.render = function render() {
      var renderedDropdown = void 0;
      switch (this.props.dropdownMode) {
        case "scroll":
          renderedDropdown = this.renderScrollMode();
          break;
        case "select":
          renderedDropdown = this.renderSelectMode();
          break;
      }
  
      return React__default.createElement(
        "div",
        {
          className: "react-datepicker__month-year-dropdown-container react-datepicker__month-year-dropdown-container--" + this.props.dropdownMode
        },
        renderedDropdown
      );
    };
  
    return MonthYearDropdown;
  }(React__default.Component);
  
  MonthYearDropdown.propTypes = {
    dropdownMode: PropTypes.oneOf(["scroll", "select"]).isRequired,
    dateFormat: PropTypes.string.isRequired,
    locale: PropTypes.string,
    maxDate: PropTypes.object.isRequired,
    minDate: PropTypes.object.isRequired,
    date: PropTypes.object.isRequired,
    onChange: PropTypes.func.isRequired,
    scrollableMonthYearDropdown: PropTypes.bool,
    accessibleMode: PropTypes.bool
  };
  
  var Day = function (_React$Component) {
    inherits(Day, _React$Component);
  
    function Day() {
      var _temp, _this, _ret;
  
      classCallCheck(this, Day);
  
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
  
      return _ret = (_temp = (_this = possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleClick = function (event) {
        if (!_this.isDisabled() && _this.props.onClick) {
          _this.props.onClick(event);
        }
      }, _this.handleMouseEnter = function (event) {
        if (!_this.isDisabled() && _this.props.onMouseEnter) {
          _this.props.onMouseEnter(event);
        }
      }, _this.isSameDay = function (other) {
        return isSameDay(_this.props.day, other);
      }, _this.isKeyboardSelected = function () {
        return !_this.props.disabledKeyboardNavigation && (!_this.props.inline || _this.props.accessibleMode) && !_this.isSameDay(_this.props.selected) && _this.isSameDay(_this.props.preSelection);
      }, _this.isDisabled = function () {
        return isDayDisabled(_this.props.day, _this.props);
      }, _this.getHighLightedClass = function (defaultClassName) {
        var _this$props = _this.props,
            day = _this$props.day,
            highlightDates = _this$props.highlightDates;
  
  
        if (!highlightDates) {
          return false;
        }
  
        // Looking for className in the Map of {'day string, 'className'}
        var dayStr = day.format("MM.DD.YYYY");
        return highlightDates.get(dayStr);
      }, _this.isInRange = function () {
        var _this$props2 = _this.props,
            day = _this$props2.day,
            startDate = _this$props2.startDate,
            endDate = _this$props2.endDate;
  
        if (!startDate || !endDate) {
          return false;
        }
        return isDayInRange(day, startDate, endDate);
      }, _this.isInSelectingRange = function () {
        var _this$props3 = _this.props,
            day = _this$props3.day,
            selectsStart = _this$props3.selectsStart,
            selectsEnd = _this$props3.selectsEnd,
            selectingDate = _this$props3.selectingDate,
            startDate = _this$props3.startDate,
            endDate = _this$props3.endDate;
  
  
        if (!(selectsStart || selectsEnd) || !selectingDate || _this.isDisabled()) {
          return false;
        }
  
        if (selectsStart && endDate && selectingDate.isSameOrBefore(endDate)) {
          return isDayInRange(day, selectingDate, endDate);
        }
  
        if (selectsEnd && startDate && selectingDate.isSameOrAfter(startDate)) {
          return isDayInRange(day, startDate, selectingDate);
        }
  
        return false;
      }, _this.isSelectingRangeStart = function () {
        if (!_this.isInSelectingRange()) {
          return false;
        }
  
        var _this$props4 = _this.props,
            day = _this$props4.day,
            selectingDate = _this$props4.selectingDate,
            startDate = _this$props4.startDate,
            selectsStart = _this$props4.selectsStart;
  
  
        if (selectsStart) {
          return isSameDay(day, selectingDate);
        } else {
          return isSameDay(day, startDate);
        }
      }, _this.isSelectingRangeEnd = function () {
        if (!_this.isInSelectingRange()) {
          return false;
        }
  
        var _this$props5 = _this.props,
            day = _this$props5.day,
            selectingDate = _this$props5.selectingDate,
            endDate = _this$props5.endDate,
            selectsEnd = _this$props5.selectsEnd;
  
  
        if (selectsEnd) {
          return isSameDay(day, selectingDate);
        } else {
          return isSameDay(day, endDate);
        }
      }, _this.isRangeStart = function () {
        var _this$props6 = _this.props,
            day = _this$props6.day,
            startDate = _this$props6.startDate,
            endDate = _this$props6.endDate;
  
        if (!startDate || !endDate) {
          return false;
        }
        return isSameDay(startDate, day);
      }, _this.isRangeEnd = function () {
        var _this$props7 = _this.props,
            day = _this$props7.day,
            startDate = _this$props7.startDate,
            endDate = _this$props7.endDate;
  
        if (!startDate || !endDate) {
          return false;
        }
        return isSameDay(endDate, day);
      }, _this.isWeekend = function () {
        var weekday = getDay(_this.props.day);
        return weekday === 0 || weekday === 6;
      }, _this.isOutsideMonth = function () {
        return _this.props.month !== undefined && _this.props.month !== getMonth(_this.props.day);
      }, _this.getClassNames = function (date) {
        var dayClassName = _this.props.dayClassName ? _this.props.dayClassName(date) : undefined;
        return classnames("react-datepicker__day", dayClassName, "react-datepicker__day--" + getDayOfWeekCode(_this.props.day), {
          "react-datepicker__day--disabled": _this.isDisabled(),
          "react-datepicker__day--selected": _this.isSameDay(_this.props.selected),
          "react-datepicker__day--keyboard-selected": _this.isKeyboardSelected(),
          "react-datepicker__day--range-start": _this.isRangeStart(),
          "react-datepicker__day--range-end": _this.isRangeEnd(),
          "react-datepicker__day--in-range": _this.isInRange(),
          "react-datepicker__day--in-selecting-range": _this.isInSelectingRange(),
          "react-datepicker__day--selecting-range-start": _this.isSelectingRangeStart(),
          "react-datepicker__day--selecting-range-end": _this.isSelectingRangeEnd(),
          "react-datepicker__day--today": _this.isSameDay(now(_this.props.utcOffset)),
          "react-datepicker__day--weekend": _this.isWeekend(),
          "react-datepicker__day--outside-month": _this.isOutsideMonth()
        }, _this.getHighLightedClass("react-datepicker__day--highlighted"));
      }, _temp), possibleConstructorReturn(_this, _ret);
    }
  
    Day.prototype.render = function render() {
      return React__default.createElement(
        "div",
        {
          className: this.getClassNames(this.props.day),
          onClick: this.handleClick,
          onMouseEnter: this.handleMouseEnter,
          "aria-label": "day-" + getDate(this.props.day)
        },
        this.props.renderDayContents ? this.props.renderDayContents(getDate(this.props.day)) : getDate(this.props.day)
      );
    };
  
    return Day;
  }(React__default.Component);
  
  Day.propTypes = {
    disabledKeyboardNavigation: PropTypes.bool,
    day: PropTypes.object.isRequired,
    dayClassName: PropTypes.func,
    endDate: PropTypes.object,
    highlightDates: PropTypes.instanceOf(Map),
    inline: PropTypes.bool,
    month: PropTypes.number,
    onClick: PropTypes.func,
    onMouseEnter: PropTypes.func,
    preSelection: PropTypes.object,
    selected: PropTypes.object,
    selectingDate: PropTypes.object,
    selectsEnd: PropTypes.bool,
    selectsStart: PropTypes.bool,
    startDate: PropTypes.object,
    utcOffset: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
    renderDayContents: PropTypes.func,
    accessibleMode: PropTypes.bool
  };
  
  var WeekNumber = function (_React$Component) {
    inherits(WeekNumber, _React$Component);
  
    function WeekNumber() {
      var _temp, _this, _ret;
  
      classCallCheck(this, WeekNumber);
  
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
  
      return _ret = (_temp = (_this = possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleClick = function (event) {
        if (_this.props.onClick) {
          _this.props.onClick(event);
        }
      }, _temp), possibleConstructorReturn(_this, _ret);
    }
  
    WeekNumber.prototype.render = function render() {
      var weekNumberClasses = {
        "react-datepicker__week-number": true,
        "react-datepicker__week-number--clickable": !!this.props.onClick
      };
      return React__default.createElement(
        "div",
        {
          className: classnames(weekNumberClasses),
          "aria-label": "week-" + this.props.weekNumber,
          onClick: this.handleClick
        },
        this.props.weekNumber
      );
    };
  
    return WeekNumber;
  }(React__default.Component);
  
  WeekNumber.propTypes = {
    weekNumber: PropTypes.number.isRequired,
    onClick: PropTypes.func
  };
  
  var Week = function (_React$Component) {
    inherits(Week, _React$Component);
  
    function Week() {
      var _temp, _this, _ret;
  
      classCallCheck(this, Week);
  
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
  
      return _ret = (_temp = (_this = possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleDayClick = function (day, event) {
        if (_this.props.onDayClick) {
          _this.props.onDayClick(day, event);
        }
      }, _this.handleDayMouseEnter = function (day) {
        if (_this.props.onDayMouseEnter) {
          _this.props.onDayMouseEnter(day);
        }
      }, _this.handleWeekClick = function (day, weekNumber, event) {
        if (typeof _this.props.onWeekSelect === "function") {
          _this.props.onWeekSelect(day, weekNumber, event);
        }
        if (_this.props.shouldCloseOnSelect) {
          _this.props.setOpen(false);
        }
      }, _this.formatWeekNumber = function (startOfWeek) {
        if (_this.props.formatWeekNumber) {
          return _this.props.formatWeekNumber(startOfWeek);
        }
        return getWeek(startOfWeek);
      }, _this.renderDays = function () {
        var startOfWeek = getStartOfWeek(cloneDate(_this.props.day));
        var days = [];
        var weekNumber = _this.formatWeekNumber(startOfWeek);
        if (_this.props.showWeekNumber) {
          var onClickAction = _this.props.onWeekSelect ? _this.handleWeekClick.bind(_this, startOfWeek, weekNumber) : undefined;
          days.push(React__default.createElement(WeekNumber, { key: "W", weekNumber: weekNumber, onClick: onClickAction }));
        }
        return days.concat([0, 1, 2, 3, 4, 5, 6].map(function (offset) {
          var day = addDays(cloneDate(startOfWeek), offset);
          return React__default.createElement(Day, {
            key: offset,
            day: day,
            month: _this.props.month,
            onClick: _this.handleDayClick.bind(_this, day),
            onMouseEnter: _this.handleDayMouseEnter.bind(_this, day),
            minDate: _this.props.minDate,
            maxDate: _this.props.maxDate,
            excludeDates: _this.props.excludeDates,
            includeDates: _this.props.includeDates,
            inline: _this.props.inline,
            highlightDates: _this.props.highlightDates,
            selectingDate: _this.props.selectingDate,
            filterDate: _this.props.filterDate,
            preSelection: _this.props.preSelection,
            selected: _this.props.selected,
            selectsStart: _this.props.selectsStart,
            selectsEnd: _this.props.selectsEnd,
            startDate: _this.props.startDate,
            endDate: _this.props.endDate,
            dayClassName: _this.props.dayClassName,
            utcOffset: _this.props.utcOffset,
            renderDayContents: _this.props.renderDayContents,
            disabledKeyboardNavigation: _this.props.disabledKeyboardNavigation,
            accessibleMode: _this.props.accessibleMode
          });
        }));
      }, _temp), possibleConstructorReturn(_this, _ret);
    }
  
    Week.prototype.render = function render() {
      return React__default.createElement(
        "div",
        { className: "react-datepicker__week" },
        this.renderDays()
      );
    };
  
    createClass(Week, null, [{
      key: "defaultProps",
      get: function get$$1() {
        return {
          shouldCloseOnSelect: true
        };
      }
    }]);
    return Week;
  }(React__default.Component);
  
  Week.propTypes = {
    disabledKeyboardNavigation: PropTypes.bool,
    day: PropTypes.object.isRequired,
    dayClassName: PropTypes.func,
    endDate: PropTypes.object,
    excludeDates: PropTypes.array,
    filterDate: PropTypes.func,
    formatWeekNumber: PropTypes.func,
    highlightDates: PropTypes.instanceOf(Map),
    includeDates: PropTypes.array,
    inline: PropTypes.bool,
    maxDate: PropTypes.object,
    minDate: PropTypes.object,
    month: PropTypes.number,
    onDayClick: PropTypes.func,
    onDayMouseEnter: PropTypes.func,
    onWeekSelect: PropTypes.func,
    preSelection: PropTypes.object,
    selected: PropTypes.object,
    selectingDate: PropTypes.object,
    selectsEnd: PropTypes.bool,
    selectsStart: PropTypes.bool,
    showWeekNumber: PropTypes.bool,
    startDate: PropTypes.object,
    setOpen: PropTypes.func,
    shouldCloseOnSelect: PropTypes.bool,
    utcOffset: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
    renderDayContents: PropTypes.func,
    accessibleMode: PropTypes.bool
  };
  
  var FIXED_HEIGHT_STANDARD_WEEK_COUNT = 6;
  
  var Month = function (_React$Component) {
    inherits(Month, _React$Component);
  
    function Month(props) {
      classCallCheck(this, Month);
  
      var _this = possibleConstructorReturn(this, _React$Component.call(this, props));
  
      _this.handleDayClick = function (day, event) {
        if (_this.props.onDayClick) {
          _this.props.onDayClick(day, event);
        }
      };
  
      _this.handleDayMouseEnter = function (day) {
        if (_this.props.onDayMouseEnter) {
          _this.props.onDayMouseEnter(day);
        }
      };
  
      _this.handleMouseLeave = function () {
        if (_this.props.onMouseLeave) {
          _this.props.onMouseLeave();
        }
      };
  
      _this.onFocus = function () {
        if (_this.props.accessibleMode) {
          _this.setState({ readInstructions: true });
        }
      };
  
      _this.onBlur = function () {
        if (_this.props.accessibleMode) {
          _this.setState({ readInstructions: false });
        }
      };
  
      _this.onInputKeyDown = function (event) {
        var eventKey = event.key;
        // `preSelection` can be `null` but `day` is required. Use it as a fallback if necessary for invalid entries.
        var copy = _this.props.preSelection ? newDate(_this.props.preSelection) : newDate(_this.props.day);
        var newSelection = void 0;
        switch (eventKey) {
          case "ArrowLeft":
            newSelection = subtractDays(copy, 1);
            break;
          case "ArrowRight":
            newSelection = addDays(copy, 1);
            break;
          case "ArrowUp":
            newSelection = subtractWeeks(copy, 1);
            break;
          case "ArrowDown":
            newSelection = addWeeks(copy, 1);
            break;
          case "PageUp":
            newSelection = subtractMonths(copy, 1);
            break;
          case "PageDown":
            newSelection = addMonths(copy, 1);
            break;
          case "Home":
            newSelection = subtractYears(copy, 1);
            break;
          case "End":
            newSelection = addYears(copy, 1);
            break;
          case " ":
          case "Enter":
            event.preventDefault();
            _this.handleDayClick(copy, event);
            break;
        }
        if (!newSelection) return; // Let the input component handle this keydown
        event.preventDefault();
        _this.props.updateSelection(newSelection);
      };
  
      _this.isWeekInMonth = function (startOfWeek) {
        var day = _this.props.day;
        var endOfWeek = addDays(cloneDate(startOfWeek), 6);
        return isSameMonth(startOfWeek, day) || isSameMonth(endOfWeek, day);
      };
  
      _this.renderWeeks = function () {
        var weeks = [];
        var isFixedHeight = _this.props.fixedHeight;
        var currentWeekStart = getStartOfWeek(getStartOfMonth(cloneDate(_this.props.day)));
        var i = 0;
        var breakAfterNextPush = false;
  
        while (true) {
          weeks.push(React__default.createElement(Week, {
            key: i,
            day: currentWeekStart,
            month: getMonth(_this.props.day),
            onDayClick: _this.handleDayClick,
            onDayMouseEnter: _this.handleDayMouseEnter,
            onWeekSelect: _this.props.onWeekSelect,
            formatWeekNumber: _this.props.formatWeekNumber,
            minDate: _this.props.minDate,
            maxDate: _this.props.maxDate,
            excludeDates: _this.props.excludeDates,
            includeDates: _this.props.includeDates,
            inline: _this.props.inline,
            highlightDates: _this.props.highlightDates,
            selectingDate: _this.props.selectingDate,
            filterDate: _this.props.filterDate,
            preSelection: _this.props.preSelection,
            selected: _this.props.selected,
            selectsStart: _this.props.selectsStart,
            selectsEnd: _this.props.selectsEnd,
            showWeekNumber: _this.props.showWeekNumbers,
            startDate: _this.props.startDate,
            endDate: _this.props.endDate,
            dayClassName: _this.props.dayClassName,
            utcOffset: _this.props.utcOffset,
            setOpen: _this.props.setOpen,
            shouldCloseOnSelect: _this.props.shouldCloseOnSelect,
            disabledKeyboardNavigation: _this.props.disabledKeyboardNavigation,
            renderDayContents: _this.props.renderDayContents,
            accessibleMode: _this.props.accessibleMode
          }));
  
          if (breakAfterNextPush) break;
  
          i++;
          currentWeekStart = addWeeks(cloneDate(currentWeekStart), 1);
  
          // If one of these conditions is true, we will either break on this week
          // or break on the next week
          var isFixedAndFinalWeek = isFixedHeight && i >= FIXED_HEIGHT_STANDARD_WEEK_COUNT;
          var isNonFixedAndOutOfMonth = !isFixedHeight && !_this.isWeekInMonth(currentWeekStart);
  
          if (isFixedAndFinalWeek || isNonFixedAndOutOfMonth) {
            if (_this.props.peekNextMonth) {
              breakAfterNextPush = true;
            } else {
              break;
            }
          }
        }
  
        return weeks;
      };
  
      _this.getClassNames = function () {
        var _this$props = _this.props,
            selectingDate = _this$props.selectingDate,
            selectsStart = _this$props.selectsStart,
            selectsEnd = _this$props.selectsEnd;
  
        return classnames("react-datepicker__month", {
          "react-datepicker__month--accessible": _this.props.accessibleMode,
          "react-datepicker__month--selecting-range": selectingDate && (selectsStart || selectsEnd)
        });
      };
  
      _this.dayFormat = "MMMM D, YYYY.";
      _this.state = {
        readInstructions: false
      };
      return _this;
    }
  
    Month.prototype.render = function render() {
      var screenReaderInstructions = void 0;
      if (this.state.readInstructions) {
        screenReaderInstructions = React__default.createElement(
          "p",
          { "aria-live": true },
          "You are focused on a calendar. Use the arrow keys to navigate the days in the month. Use the page up and down keys to navigate from month to month. Use the home and end keys to navigate from year to year.",
          this.props.preSelection ? formatDate(this.props.preSelection, this.dayFormat) + " is the\n          currently focused date." : "No date is currently focused."
        );
      }
  
      return React__default.createElement(
        "div",
        {
          className: this.getClassNames(),
          onMouseLeave: this.handleMouseLeave,
          role: "listbox",
          "aria-label": "month-" + this.props.day.format("YYYY-MM"),
          tabIndex: this.props.accessibleMode ? 0 : -1,
          onKeyDown: this.onInputKeyDown,
          onFocus: this.onFocus,
          onBlur: this.onBlur
        },
        React__default.createElement(
          ScreenReaderOnly,
          null,
          React__default.createElement(
            "span",
            null,
            screenReaderInstructions
          )
        ),
        this.renderWeeks()
      );
    };
  
    return Month;
  }(React__default.Component);
  
  Month.propTypes = {
    disabledKeyboardNavigation: PropTypes.bool,
    day: PropTypes.object.isRequired,
    dayClassName: PropTypes.func,
    endDate: PropTypes.object,
    excludeDates: PropTypes.array,
    filterDate: PropTypes.func,
    fixedHeight: PropTypes.bool,
    formatWeekNumber: PropTypes.func,
    highlightDates: PropTypes.instanceOf(Map),
    includeDates: PropTypes.array,
    inline: PropTypes.bool,
    maxDate: PropTypes.object,
    minDate: PropTypes.object,
    onDayClick: PropTypes.func,
    onDayMouseEnter: PropTypes.func,
    onMouseLeave: PropTypes.func,
    onWeekSelect: PropTypes.func,
    peekNextMonth: PropTypes.bool,
    preSelection: PropTypes.object,
    selected: PropTypes.object,
    selectingDate: PropTypes.object,
    selectsEnd: PropTypes.bool,
    selectsStart: PropTypes.bool,
    showWeekNumbers: PropTypes.bool,
    startDate: PropTypes.object,
    setOpen: PropTypes.func,
    shouldCloseOnSelect: PropTypes.bool,
    utcOffset: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
    renderDayContents: PropTypes.func,
    updateSelection: PropTypes.func.isRequired,
    accessibleMode: PropTypes.bool
  };
  
  function doHoursAndMinutesAlign(time1, time2) {
    if (time1 == null || time2 == null) return false;
    return getHour(time1) === getHour(time2) && getMinute(time1) === getMinute(time2);
  }
  
  var Time = function (_React$Component) {
    inherits(Time, _React$Component);
    createClass(Time, null, [{
      key: "defaultProps",
      get: function get$$1() {
        return {
          intervals: 30,
          onTimeChange: function onTimeChange() {},
          todayButton: null,
          timeCaption: "Time"
        };
      }
    }]);
  
    function Time() {
      classCallCheck(this, Time);
  
      for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
  
      var _this = possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args)));
  
      _initialiseProps.call(_this);
  
      var times = _this.generateTimes();
      var preSelection = times.reduce(function (preSelection, time) {
        if (preSelection) return preSelection;
        if (doHoursAndMinutesAlign(time, _this.props.selected)) {
          return time;
        }
      }, null);
  
      if (preSelection == null) {
        // there is no exact pre-selection, find the element closest to the selected time and preselect it
        var currH = _this.props.selected ? getHour(_this.props.selected) : getHour(newDate());
        var currM = _this.props.selected ? getMinute(_this.props.selected) : getMinute(newDate());
        var closestTimeIndex = Math.floor((60 * currH + currM) / _this.props.intervals);
        var closestMinutes = closestTimeIndex * _this.props.intervals;
        preSelection = setTime(newDate(), {
          hour: Math.floor(closestMinutes / 60),
          minute: closestMinutes % 60,
          second: 0,
          millisecond: 0
        });
      }
  
      _this.timeFormat = "hh:mm A";
      _this.state = {
        preSelection: preSelection,
        needsScrollToPreSelection: false,
        readInstructions: false,
        isFocused: false
      };
      return _this;
    }
  
    Time.prototype.componentDidMount = function componentDidMount() {
      // code to ensure selected time will always be in focus within time window when it first appears
      var scrollParent = this.list;
  
      scrollParent.scrollTop = Time.calcCenterPosition(this.props.monthRef ? this.props.monthRef.clientHeight - this.header.clientHeight : this.list.clientHeight, this.selectedLi || this.preselectedLi);
    };
  
    Time.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
      // if selection changed, scroll to the selected item
      if (this.props.selected && this.props.selected.isSame(prevProps.selected) === false) {
        var scrollToElement = this.selectedLi;
  
        if (scrollToElement) {
          // an element matches the selected time, scroll to it
          scrollToElement.scrollIntoView({
            behavior: "instant",
            block: "nearest",
            inline: "nearest"
          });
        }
  
        // update preSelection to the selection
        this.setState(function (prevState) {
          return {
            preSelection: prevState.selected
          };
        });
      }
  
      if (this.state.needsScrollToPreSelection) {
        var _scrollToElement = this.preselectedLi;
  
        if (_scrollToElement) {
          // an element matches the selected time, scroll to it
          _scrollToElement.scrollIntoView({
            behavior: "instant",
            block: "nearest",
            inline: "nearest"
          });
        }
  
        this.setState({ needsScrollToPreSelection: false });
      }
    };
  
    Time.prototype.render = function render() {
      var _this2 = this;
  
      var height = null;
      if (this.props.monthRef && this.header) {
        height = this.props.monthRef.clientHeight - this.header.clientHeight;
      }
  
      var classNames = classnames("react-datepicker__time-container", {
        "react-datepicker__time-container--with-today-button": this.props.todayButton,
        "react-datepicker__time-container--focus": this.state.isFocused
      });
  
      var timeBoxClassNames = classnames("react-datepicker__time-box", {
        "react-datepicker__time-box--accessible": this.props.accessibleMode
      });
  
      var screenReaderInstructions = void 0;
      if (this.state.readInstructions) {
        screenReaderInstructions = React__default.createElement(
          "p",
          { "aria-live": true },
          "You are a in a time selector. Use the up and down keys to select from other common times then press enter to confirm.",
          this.state.preSelection ? formatDate(this.state.preSelection, this.timeFormat) + " is currently\n          focused." : "No time is currently focused."
        );
      }
  
      return React__default.createElement(
        "div",
        { className: classNames },
        React__default.createElement(
          "div",
          {
            className: "react-datepicker__header react-datepicker__header--time",
            ref: function ref(header) {
              _this2.header = header;
            }
          },
          React__default.createElement(
            "div",
            { className: "react-datepicker-time__header" },
            this.props.timeCaption
          ),
          React__default.createElement(
            ScreenReaderOnly,
            null,
            React__default.createElement(
              "span",
              null,
              screenReaderInstructions
            )
          )
        ),
        React__default.createElement(
          "div",
          { className: "react-datepicker__time" },
          React__default.createElement(
            "div",
            {
              className: timeBoxClassNames,
              tabIndex: this.props.accessibleMode ? 0 : -1,
              onKeyDown: this.onInputKeyDown,
              onFocus: this.onFocus,
              onBlur: this.onBlur
            },
            React__default.createElement(
              "ul",
              {
                className: "react-datepicker__time-list",
                ref: function ref(list) {
                  _this2.list = list;
                },
                style: height ? { height: height } : {},
                role: "listbox"
              },
              this.renderTimes.bind(this)()
            )
          )
        )
      );
    };
  
    return Time;
  }(React__default.Component);
  
  Time.propTypes = {
    format: PropTypes.string,
    includeTimes: PropTypes.array,
    intervals: PropTypes.number,
    selected: PropTypes.object,
    onChange: PropTypes.func,
    todayButton: PropTypes.node,
    minTime: PropTypes.object,
    maxTime: PropTypes.object,
    excludeTimes: PropTypes.array,
    monthRef: PropTypes.object,
    timeCaption: PropTypes.string,
    injectTimes: PropTypes.array,
    accessibleMode: PropTypes.bool
  };
  
  Time.calcCenterPosition = function (listHeight, centerLiRef) {
    return centerLiRef.offsetTop - (listHeight / 2 - centerLiRef.clientHeight / 2);
  };
  
  var _initialiseProps = function _initialiseProps() {
    var _this3 = this;
  
    this.onFocus = function () {
      if (_this3.props.accessibleMode) {
        _this3.setState({ readInstructions: true, isFocused: true });
      }
    };
  
    this.onBlur = function () {
      if (_this3.props.accessibleMode) {
        _this3.setState({ readInstructions: false, isFocused: false });
      }
    };
  
    this.onInputKeyDown = function (event) {
      var eventKey = event.key;
      var copy = newDate(_this3.state.preSelection);
      var newSelection = void 0;
      switch (eventKey) {
        case "ArrowUp":
          newSelection = addMinutes(copy, -_this3.props.intervals);
          break;
        case "ArrowDown":
          newSelection = addMinutes(copy, _this3.props.intervals);
          break;
        case " ":
        case "Enter":
          event.preventDefault();
          _this3.handleClick(_this3.state.preSelection);
          break;
      }
      if (!newSelection) return; // Let the input component handle this keydown
      event.preventDefault();
      _this3.setState({
        preSelection: newSelection,
        needsScrollToPreSelection: true
      });
    };
  
    this.handleClick = function (time) {
      if ((_this3.props.minTime || _this3.props.maxTime) && isTimeInDisabledRange(time, _this3.props) || _this3.props.excludeTimes && isTimeDisabled(time, _this3.props.excludeTimes) || _this3.props.includeTimes && !isTimeDisabled(time, _this3.props.includeTimes)) {
        return;
      }
  
      _this3.props.onChange(time);
    };
  
    this.liClasses = function (time, activeTime) {
      var classes = ["react-datepicker__time-list-item"];
  
      if (doHoursAndMinutesAlign(time, activeTime)) {
        classes.push("react-datepicker__time-list-item--selected");
      } else if (_this3.state.preSelection && doHoursAndMinutesAlign(time, _this3.state.preSelection)) {
        classes.push("react-datepicker__time-list-item--preselected");
      }
      if ((_this3.props.minTime || _this3.props.maxTime) && isTimeInDisabledRange(time, _this3.props) || _this3.props.excludeTimes && isTimeDisabled(time, _this3.props.excludeTimes) || _this3.props.includeTimes && !isTimeDisabled(time, _this3.props.includeTimes)) {
        classes.push("react-datepicker__time-list-item--disabled");
      }
      if (_this3.props.injectTimes && (getHour(time) * 60 + getMinute(time)) % _this3.props.intervals !== 0) {
        classes.push("react-datepicker__time-list-item--injected");
      }
  
      return classes.join(" ");
    };
  
    this.generateTimes = function () {
      var times = [];
      var intervals = _this3.props.intervals;
      var base = getStartOfDay(newDate());
      var multiplier = 1440 / intervals;
      var sortedInjectTimes = _this3.props.injectTimes && _this3.props.injectTimes.sort(function (a, b) {
        return a - b;
      });
      for (var i = 0; i < multiplier; i++) {
        var currentTime = addMinutes(cloneDate(base), i * intervals);
        times.push(currentTime);
  
        if (sortedInjectTimes) {
          var timesToInject = timesToInjectAfter(base, currentTime, i, intervals, sortedInjectTimes);
          times = times.concat(timesToInject);
        }
      }
      return times;
    };
  
    this.renderTimes = function () {
      var times = _this3.generateTimes();
      var activeTime = _this3.props.selected ? _this3.props.selected : newDate();
      var format = _this3.props.format ? _this3.props.format : _this3.timeFormat;
      var currH = getHour(activeTime);
      var currM = getMinute(activeTime);
      return times.map(function (time, i) {
        return React__default.createElement(
          "li",
          {
            key: i,
            onClick: _this3.handleClick.bind(_this3, time),
            className: _this3.liClasses(time, activeTime),
            ref: function ref(li) {
              if (li && li.classList.contains("react-datepicker__time-list-item--preselected")) {
                _this3.preselectedLi = li;
              }
  
              if (li && li.classList.contains("react-datepicker__time-list-item--selected")) {
                _this3.selectedLi = li;
              }
            },
            role: "option",
            id: i
          },
          formatDate(time, format)
        );
      });
    };
  };
  
  function CalendarContainer(_ref) {
    var className = _ref.className,
        children = _ref.children,
        _ref$arrowProps = _ref.arrowProps,
        arrowProps = _ref$arrowProps === undefined ? {} : _ref$arrowProps;
  
    return React__default.createElement(
      "div",
      { className: className },
      React__default.createElement("div", _extends({ className: "react-datepicker__triangle" }, arrowProps)),
      children
    );
  }
  
  CalendarContainer.propTypes = {
    className: PropTypes.string,
    children: PropTypes.node,
    arrowProps: PropTypes.object // react-popper arrow props
  };
  
  var FocusTrapContainer = React__default.forwardRef(function (props, ref) {
    return React__default.createElement("div", _extends({ ref: ref, className: "react-datepicker__focusTrap" }, props));
  });
  
  var DROPDOWN_FOCUS_CLASSNAMES = ["react-datepicker__year-select", "react-datepicker__month-select", "react-datepicker__month-year-select"];
  
  var isDropdownSelect = function isDropdownSelect() {
    var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  
    var classNames = (element.className || "").split(/\s+/);
    return DROPDOWN_FOCUS_CLASSNAMES.some(function (testClassname) {
      return classNames.indexOf(testClassname) >= 0;
    });
  };
  
  var Calendar = function (_React$Component) {
    inherits(Calendar, _React$Component);
    createClass(Calendar, null, [{
      key: "defaultProps",
      get: function get$$1() {
        return {
          onDropdownFocus: function onDropdownFocus() {},
          monthsShown: 1,
          forceShowMonthNavigation: false,
          timeCaption: "Time",
          previousMonthButtonLabel: "Previous Month",
          nextMonthButtonLabel: "Next Month",
          enableFocusTrap: true
        };
      }
    }]);
  
    function Calendar(props) {
      classCallCheck(this, Calendar);
  
      var _this = possibleConstructorReturn(this, _React$Component.call(this, props));
  
      _this.setMonthRef = function (node) {
        _this.monthRef = node;
      };
  
      _this.setYearRef = function (node) {
        _this.yearRef = node;
      };
  
      _this.handleOnDropdownToggle = function (isOpen, dropdown) {
        _this.setState({ pauseFocusTrap: isOpen });
        if (!isOpen) {
          var element = dropdown === 'month' ? _this.monthRef : _this.yearRef;
          if (element) {
            // The focus trap has been unpaused and will reinitialize focus
            // but does so on the wrong element (calendar)
            // This refocuses the previous element (dropdown button).
            // Duration arrived at by trial-and-error.
            setTimeout(function () {
              return element.focus();
            }, 25);
          }
        }
      };
  
      _this.handleClickOutside = function (event) {
        _this.props.onClickOutside(event);
      };
  
      _this.handleDropdownFocus = function (event) {
        if (isDropdownSelect(event.target)) {
          _this.props.onDropdownFocus();
        }
      };
  
      _this.getDateInView = function () {
        var _this$props = _this.props,
            preSelection = _this$props.preSelection,
            selected = _this$props.selected,
            openToDate = _this$props.openToDate,
            utcOffset = _this$props.utcOffset;
  
        var minDate = getEffectiveMinDate(_this.props);
        var maxDate = getEffectiveMaxDate(_this.props);
        var current = now(utcOffset);
        var initialDate = openToDate || selected || preSelection;
        if (initialDate) {
          return initialDate;
        } else {
          if (minDate && isBefore(current, minDate)) {
            return minDate;
          } else if (maxDate && isAfter(current, maxDate)) {
            return maxDate;
          }
        }
        return current;
      };
  
      _this.localizeDate = function (date) {
        return localizeDate(date, _this.props.locale);
      };
  
      _this.increaseMonth = function () {
        _this.setState({
          date: addMonths(cloneDate(_this.state.date), 1)
        }, function () {
          return _this.handleMonthChange(_this.state.date);
        });
      };
  
      _this.decreaseMonth = function () {
        _this.setState({
          date: subtractMonths(cloneDate(_this.state.date), 1)
        }, function () {
          return _this.handleMonthChange(_this.state.date);
        });
      };
  
      _this.handleDayClick = function (day, event) {
        return _this.props.onSelect(day, event);
      };
  
      _this.handleDayMouseEnter = function (day) {
        return _this.setState({ selectingDate: day });
      };
  
      _this.handleMonthMouseLeave = function () {
        return _this.setState({ selectingDate: null });
      };
  
      _this.handleYearChange = function (date) {
        if (_this.props.onYearChange) {
          _this.props.onYearChange(date);
        }
        if (_this.props.accessibleMode) {
          _this.handleSelectionChange(date);
        }
      };
  
      _this.handleMonthChange = function (date) {
        if (_this.props.onMonthChange) {
          _this.props.onMonthChange(date);
        }
        if (_this.props.accessibleMode) {
          _this.handleSelectionChange(date);
        }
      };
  
      _this.handleSelectionChange = function (date) {
        if (_this.props.adjustDateOnChange) {
          _this.props.updateSelection(date);
        } else {
          _this.props.updateSelection(getStartOfMonth(cloneDate(date)));
        }
      };
  
      _this.handleMonthYearChange = function (date) {
        _this.handleYearChange(date);
        _this.handleMonthChange(date);
      };
  
      _this.changeYear = function (year) {
        _this.setState({
          date: setYear(cloneDate(_this.state.date), year)
        }, function () {
          return _this.handleYearChange(_this.state.date);
        });
      };
  
      _this.changeMonth = function (month) {
        _this.setState({
          date: setMonth(cloneDate(_this.state.date), month)
        }, function () {
          return _this.handleMonthChange(_this.state.date);
        });
      };
  
      _this.changeMonthYear = function (monthYear) {
        _this.setState({
          date: setYear(setMonth(cloneDate(_this.state.date), getMonth(monthYear)), getYear(monthYear))
        }, function () {
          return _this.handleMonthYearChange(_this.state.date);
        });
      };
  
      _this.header = function () {
        var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.state.date;
  
        var startOfWeek = getStartOfWeek(cloneDate(date));
        var dayNames = [];
        if (_this.props.showWeekNumbers) {
          dayNames.push(React__default.createElement(
            "div",
            { key: "W", className: "react-datepicker__day-name" },
            _this.props.weekLabel || "#"
          ));
        }
        return dayNames.concat([0, 1, 2, 3, 4, 5, 6].map(function (offset) {
          var day = addDays(cloneDate(startOfWeek), offset);
          var localeData = getLocaleData(day);
          var weekDayName = _this.formatWeekday(localeData, day);
  
          return React__default.createElement(
            "div",
            { key: offset, className: "react-datepicker__day-name" },
            weekDayName
          );
        }));
      };
  
      _this.formatWeekday = function (localeData, day) {
        if (_this.props.formatWeekDay) {
          return getFormattedWeekdayInLocale(localeData, day, _this.props.formatWeekDay);
        }
        return _this.props.useWeekdaysShort ? getWeekdayShortInLocale(localeData, day) : getWeekdayMinInLocale(localeData, day);
      };
  
      _this.renderPreviousMonthButton = function () {
        if (_this.props.renderCustomHeader) {
          return;
        }
  
        var allPrevDaysDisabled = allDaysDisabledBefore(_this.state.date, "month", _this.props);
  
        if (!_this.props.forceShowMonthNavigation && !_this.props.showDisabledMonthNavigation && allPrevDaysDisabled || _this.props.showTimeSelectOnly) {
          return;
        }
  
        var classes = ["react-datepicker__navigation", "react-datepicker__navigation--previous"];
  
        var clickHandler = _this.decreaseMonth;
  
        if (allPrevDaysDisabled && _this.props.showDisabledMonthNavigation) {
          classes.push("react-datepicker__navigation--previous--disabled");
          clickHandler = null;
        }
  
        return React__default.createElement(
          "button",
          {
            type: "button",
            className: classes.join(" "),
            onClick: clickHandler
          },
          _this.props.previousMonthButtonLabel
        );
      };
  
      _this.renderNextMonthButton = function () {
        if (_this.props.renderCustomHeader) {
          return;
        }
  
        var allNextDaysDisabled = allDaysDisabledAfter(_this.state.date, "month", _this.props);
  
        if (!_this.props.forceShowMonthNavigation && !_this.props.showDisabledMonthNavigation && allNextDaysDisabled || _this.props.showTimeSelectOnly) {
          return;
        }
  
        var classes = ["react-datepicker__navigation", "react-datepicker__navigation--next"];
        if (_this.props.showTimeSelect) {
          classes.push("react-datepicker__navigation--next--with-time");
        }
        if (_this.props.todayButton) {
          classes.push("react-datepicker__navigation--next--with-today-button");
        }
  
        var clickHandler = _this.increaseMonth;
  
        if (allNextDaysDisabled && _this.props.showDisabledMonthNavigation) {
          classes.push("react-datepicker__navigation--next--disabled");
          clickHandler = null;
        }
  
        return React__default.createElement(
          "button",
          {
            type: "button",
            className: classes.join(" "),
            onClick: clickHandler
          },
          _this.props.nextMonthButtonLabel
        );
      };
  
      _this.renderCurrentMonth = function () {
        var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.state.date;
  
        var classes = ["react-datepicker__current-month"];
  
        if (_this.props.showYearDropdown) {
          classes.push("react-datepicker__current-month--hasYearDropdown");
        }
        if (_this.props.showMonthDropdown) {
          classes.push("react-datepicker__current-month--hasMonthDropdown");
        }
        if (_this.props.showMonthYearDropdown) {
          classes.push("react-datepicker__current-month--hasMonthYearDropdown");
        }
        return React__default.createElement(
          "div",
          { className: classes.join(" ") },
          formatDate(date, _this.props.dateFormat)
        );
      };
  
      _this.renderYearDropdown = function () {
        var overrideHide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  
        if (!_this.props.showYearDropdown || overrideHide) {
          return;
        }
        return React__default.createElement(YearDropdown, {
          adjustDateOnChange: _this.props.adjustDateOnChange,
          date: _this.state.date,
          onSelect: _this.props.onSelect,
          setOpen: _this.props.setOpen,
          dropdownMode: _this.props.dropdownMode,
          onChange: _this.changeYear,
          minDate: _this.props.minDate,
          maxDate: _this.props.maxDate,
          year: getYear(_this.state.date),
          scrollableYearDropdown: _this.props.scrollableYearDropdown,
          yearDropdownItemNumber: _this.props.yearDropdownItemNumber,
          accessibleMode: _this.props.accessibleMode,
          onDropdownToggle: _this.handleOnDropdownToggle,
          buttonRef: _this.setYearRef
        });
      };
  
      _this.renderMonthDropdown = function () {
        var overrideHide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  
        if (!_this.props.showMonthDropdown || overrideHide) {
          return;
        }
        return React__default.createElement(MonthDropdown, {
          dropdownMode: _this.props.dropdownMode,
          locale: _this.props.locale,
          dateFormat: _this.props.dateFormat,
          onChange: _this.changeMonth,
          month: getMonth(_this.state.date),
          useShortMonthInDropdown: _this.props.useShortMonthInDropdown,
          accessibleMode: _this.props.accessibleMode,
          onDropdownToggle: _this.handleOnDropdownToggle,
          buttonRef: _this.setMonthRef
        });
      };
  
      _this.renderMonthYearDropdown = function () {
        var overrideHide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  
        if (!_this.props.showMonthYearDropdown || overrideHide) {
          return;
        }
        return React__default.createElement(MonthYearDropdown, {
          dropdownMode: _this.props.dropdownMode,
          locale: _this.props.locale,
          dateFormat: _this.props.dateFormat,
          onChange: _this.changeMonthYear,
          minDate: _this.props.minDate,
          maxDate: _this.props.maxDate,
          date: _this.state.date,
          scrollableMonthYearDropdown: _this.props.scrollableMonthYearDropdown,
          accessibleMode: _this.props.accessibleMode
        });
      };
  
      _this.renderTodayButton = function () {
        if (!_this.props.todayButton || _this.props.showTimeSelectOnly) {
          return;
        }
        return React__default.createElement(
          "div",
          {
            className: "react-datepicker__today-button",
            onClick: function onClick(e) {
              return _this.props.onSelect(getStartOfDate(now(_this.props.utcOffset)), e);
            }
          },
          _this.props.todayButton
        );
      };
  
      _this.renderDefaultHeader = function (_ref) {
        var monthDate = _ref.monthDate,
            i = _ref.i;
        return React__default.createElement(
          "div",
          { className: "react-datepicker__header" },
          _this.renderCurrentMonth(monthDate),
          React__default.createElement(
            "div",
            {
              className: "react-datepicker__header__dropdown react-datepicker__header__dropdown--" + _this.props.dropdownMode,
              onFocus: _this.handleDropdownFocus
            },
            _this.renderMonthDropdown(i !== 0),
            _this.renderMonthYearDropdown(i !== 0),
            _this.renderYearDropdown(i !== 0)
          ),
          React__default.createElement(
            "div",
            { className: "react-datepicker__day-names" },
            _this.header(monthDate)
          )
        );
      };
  
      _this.renderCustomHeader = function (_ref2) {
        var monthDate = _ref2.monthDate,
            i = _ref2.i;
  
        if (i !== 0) {
          return null;
        }
  
        var prevMonthButtonDisabled = allDaysDisabledBefore(_this.state.date, "month", _this.props);
  
        var nextMonthButtonDisabled = allDaysDisabledAfter(_this.state.date, "month", _this.props);
  
        return React__default.createElement(
          "div",
          {
            className: "react-datepicker__header react-datepicker__header--custom",
            onFocus: _this.props.onDropdownFocus
          },
          _this.props.renderCustomHeader(_extends({}, _this.state, {
            changeMonth: _this.changeMonth,
            changeYear: _this.changeYear,
            decreaseMonth: _this.decreaseMonth,
            increaseMonth: _this.increaseMonth,
            prevMonthButtonDisabled: prevMonthButtonDisabled,
            nextMonthButtonDisabled: nextMonthButtonDisabled
          })),
          React__default.createElement(
            "div",
            { className: "react-datepicker__day-names" },
            _this.header(monthDate)
          )
        );
      };
  
      _this.renderMonths = function () {
        if (_this.props.showTimeSelectOnly) {
          return;
        }
  
        var monthList = [];
        for (var i = 0; i < _this.props.monthsShown; ++i) {
          var monthDate = addMonths(cloneDate(_this.state.date), i);
          var monthKey = "month-" + i;
          monthList.push(React__default.createElement(
            "div",
            {
              key: monthKey,
              ref: function ref(div) {
                _this.monthContainer = div;
              },
              className: "react-datepicker__month-container"
            },
            _this.props.renderCustomHeader ? _this.renderCustomHeader({ monthDate: monthDate, i: i }) : _this.renderDefaultHeader({ monthDate: monthDate, i: i }),
            React__default.createElement(Month, {
              day: monthDate,
              dayClassName: _this.props.dayClassName,
              onDayClick: _this.handleDayClick,
              onDayMouseEnter: _this.handleDayMouseEnter,
              onMouseLeave: _this.handleMonthMouseLeave,
              onWeekSelect: _this.props.onWeekSelect,
              formatWeekNumber: _this.props.formatWeekNumber,
              minDate: _this.props.minDate,
              maxDate: _this.props.maxDate,
              excludeDates: _this.props.excludeDates,
              highlightDates: _this.props.highlightDates,
              selectingDate: _this.state.selectingDate,
              includeDates: _this.props.includeDates,
              inline: _this.props.inline,
              fixedHeight: _this.props.fixedHeight,
              filterDate: _this.props.filterDate,
              preSelection: _this.props.preSelection,
              selected: _this.props.selected,
              selectsStart: _this.props.selectsStart,
              selectsEnd: _this.props.selectsEnd,
              showWeekNumbers: _this.props.showWeekNumbers,
              startDate: _this.props.startDate,
              endDate: _this.props.endDate,
              peekNextMonth: _this.props.peekNextMonth,
              utcOffset: _this.props.utcOffset,
              setOpen: _this.props.setOpen,
              shouldCloseOnSelect: _this.props.shouldCloseOnSelect,
              renderDayContents: _this.props.renderDayContents,
              disabledKeyboardNavigation: _this.props.disabledKeyboardNavigation,
              updateSelection: _this.props.updateSelection,
              accessibleMode: _this.props.accessibleMode
            })
          ));
        }
        return monthList;
      };
  
      _this.renderTimeSection = function () {
        if (_this.props.showTimeSelect && (_this.state.monthContainer || _this.props.showTimeSelectOnly)) {
          return React__default.createElement(Time, {
            selected: _this.props.selected,
            onChange: _this.props.onTimeChange,
            format: _this.props.timeFormat,
            includeTimes: _this.props.includeTimes,
            intervals: _this.props.timeIntervals,
            minTime: _this.props.minTime,
            maxTime: _this.props.maxTime,
            excludeTimes: _this.props.excludeTimes,
            timeCaption: _this.props.timeCaption,
            todayButton: _this.props.todayButton,
            showMonthDropdown: _this.props.showMonthDropdown,
            showMonthYearDropdown: _this.props.showMonthYearDropdown,
            showYearDropdown: _this.props.showYearDropdown,
            withPortal: _this.props.withPortal,
            monthRef: _this.state.monthContainer,
            injectTimes: _this.props.injectTimes,
            accessibleMode: _this.props.accessibleMode
          });
        }
      };
  
      _this.state = {
        date: _this.localizeDate(_this.getDateInView()),
        selectingDate: null,
        monthContainer: null,
        pauseFocusTrap: false
      };
      _this.monthRef = React__default.createRef();
      _this.yearRef = React__default.createRef();
      return _this;
    }
  
    Calendar.prototype.componentDidMount = function componentDidMount() {
      var _this2 = this;
  
      // monthContainer height is needed in time component
      // to determine the height for the ul in the time component
      // setState here so height is given after final component
      // layout is rendered
      if (this.props.showTimeSelect) {
        this.assignMonthContainer = function () {
          _this2.setState({ monthContainer: _this2.monthContainer });
        }();
      }
    };
  
    Calendar.prototype.componentDidUpdate = function componentDidUpdate(prevProps) {
      if (this.props.preSelection && !isSameDay(this.props.preSelection, prevProps.preSelection)) {
        this.setState({
          date: this.localizeDate(this.props.preSelection)
        });
      } else if (this.props.openToDate && !isSameDay(this.props.openToDate, prevProps.openToDate)) {
        this.setState({
          date: this.localizeDate(this.props.openToDate)
        });
      }
    };
  
    Calendar.prototype.render = function render() {
      var _this3 = this;
  
      var Container = this.props.container || CalendarContainer;
  
      var trapFocus = this.props.accessibleMode && !this.props.inline;
      var initialFocusTarget = this.props.showTimeSelectOnly ? ".react-datepicker__time-box--accessible" : ".react-datepicker__month--accessible";
  
      if (trapFocus) {
        return React__default.createElement(
          Container,
          {
            className: classnames("react-datepicker", this.props.className, {
              "react-datepicker--time-only": this.props.showTimeSelectOnly
            })
          },
          React__default.createElement(
            focusTrapReact,
            {
              paused: this.state.pauseFocusTrap,
              active: this.props.enableFocusTrap,
              tag: FocusTrapContainer,
              focusTrapOptions: {
                onDeactivate: function onDeactivate() {
                  return _this3.props.setOpen(false, true);
                },
                initialFocus: initialFocusTarget
              }
            },
            this.renderPreviousMonthButton(),
            this.renderNextMonthButton(),
            this.renderMonths(),
            this.renderTodayButton(),
            this.renderTimeSection(),
            this.props.children
          )
        );
      } else {
        return React__default.createElement(
          Container,
          {
            className: classnames("react-datepicker", this.props.className, {
              "react-datepicker--time-only": this.props.showTimeSelectOnly
            })
          },
          this.renderPreviousMonthButton(),
          this.renderNextMonthButton(),
          this.renderMonths(),
          this.renderTodayButton(),
          this.renderTimeSection(),
          this.props.children
        );
      }
    };
  
    return Calendar;
  }(React__default.Component);
  
  Calendar.propTypes = {
    adjustDateOnChange: PropTypes.bool,
    className: PropTypes.string,
    children: PropTypes.node,
    container: PropTypes.func,
    dateFormat: PropTypes.oneOfType([PropTypes.string, PropTypes.array]).isRequired,
    dayClassName: PropTypes.func,
    disabledKeyboardNavigation: PropTypes.bool,
    dropdownMode: PropTypes.oneOf(["scroll", "select"]),
    endDate: PropTypes.object,
    excludeDates: PropTypes.array,
    filterDate: PropTypes.func,
    fixedHeight: PropTypes.bool,
    formatWeekNumber: PropTypes.func,
    highlightDates: PropTypes.instanceOf(Map),
    includeDates: PropTypes.array,
    includeTimes: PropTypes.array,
    injectTimes: PropTypes.array,
    inline: PropTypes.bool,
    locale: PropTypes.string,
    maxDate: PropTypes.object,
    minDate: PropTypes.object,
    monthsShown: PropTypes.number,
    onClickOutside: PropTypes.func.isRequired,
    onMonthChange: PropTypes.func,
    onYearChange: PropTypes.func,
    forceShowMonthNavigation: PropTypes.bool,
    onDropdownFocus: PropTypes.func,
    onSelect: PropTypes.func.isRequired,
    onWeekSelect: PropTypes.func,
    showTimeSelect: PropTypes.bool,
    showTimeSelectOnly: PropTypes.bool,
    timeFormat: PropTypes.string,
    timeIntervals: PropTypes.number,
    onTimeChange: PropTypes.func,
    minTime: PropTypes.object,
    maxTime: PropTypes.object,
    excludeTimes: PropTypes.array,
    timeCaption: PropTypes.string,
    openToDate: PropTypes.object,
    peekNextMonth: PropTypes.bool,
    scrollableYearDropdown: PropTypes.bool,
    scrollableMonthYearDropdown: PropTypes.bool,
    preSelection: PropTypes.object,
    selected: PropTypes.object,
    selectsEnd: PropTypes.bool,
    selectsStart: PropTypes.bool,
    showMonthDropdown: PropTypes.bool,
    showMonthYearDropdown: PropTypes.bool,
    showWeekNumbers: PropTypes.bool,
    showYearDropdown: PropTypes.bool,
    startDate: PropTypes.object,
    todayButton: PropTypes.node,
    useWeekdaysShort: PropTypes.bool,
    formatWeekDay: PropTypes.func,
    withPortal: PropTypes.bool,
    utcOffset: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
    weekLabel: PropTypes.string,
    yearDropdownItemNumber: PropTypes.number,
    setOpen: PropTypes.func,
    shouldCloseOnSelect: PropTypes.bool,
    useShortMonthInDropdown: PropTypes.bool,
    showDisabledMonthNavigation: PropTypes.bool,
    previousMonthButtonLabel: PropTypes.string,
    nextMonthButtonLabel: PropTypes.string,
    renderCustomHeader: PropTypes.func,
    renderDayContents: PropTypes.func,
    updateSelection: PropTypes.func.isRequired,
    accessibleMode: PropTypes.bool,
    enableFocusTrap: PropTypes.bool
  };
  
  var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  
  function unwrapExports (x) {
  	return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
  }
  
  function createCommonjsModule(fn, module) {
  	return module = { exports: {} }, fn(module, module.exports), module.exports;
  }
  
  var objectWithoutPropertiesLoose = createCommonjsModule(function (module) {
  function _objectWithoutPropertiesLoose(source, excluded) {
    if (source == null) return {};
    var target = {};
    var sourceKeys = Object.keys(source);
    var key, i;
  
    for (i = 0; i < sourceKeys.length; i++) {
      key = sourceKeys[i];
      if (excluded.indexOf(key) >= 0) continue;
      target[key] = source[key];
    }
  
    return target;
  }
  
  module.exports = _objectWithoutPropertiesLoose;
  module.exports["default"] = module.exports, module.exports.__esModule = true;
  });
  
  var _objectWithoutPropertiesLoose = unwrapExports(objectWithoutPropertiesLoose);
  
  var _extends_1 = createCommonjsModule(function (module) {
  function _extends() {
    module.exports = _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;
    };
  
    module.exports["default"] = module.exports, module.exports.__esModule = true;
    return _extends.apply(this, arguments);
  }
  
  module.exports = _extends;
  module.exports["default"] = module.exports, module.exports.__esModule = true;
  });
  
  var _extends$1 = unwrapExports(_extends_1);
  
  var setPrototypeOf = createCommonjsModule(function (module) {
  function _setPrototypeOf(o, p) {
    module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
      o.__proto__ = p;
      return o;
    };
  
    module.exports["default"] = module.exports, module.exports.__esModule = true;
    return _setPrototypeOf(o, p);
  }
  
  module.exports = _setPrototypeOf;
  module.exports["default"] = module.exports, module.exports.__esModule = true;
  });
  
  unwrapExports(setPrototypeOf);
  
  var inheritsLoose = createCommonjsModule(function (module) {
  function _inheritsLoose(subClass, superClass) {
    subClass.prototype = Object.create(superClass.prototype);
    subClass.prototype.constructor = subClass;
    setPrototypeOf(subClass, superClass);
  }
  
  module.exports = _inheritsLoose;
  module.exports["default"] = module.exports, module.exports.__esModule = true;
  });
  
  var _inheritsLoose$1 = unwrapExports(inheritsLoose);
  
  var assertThisInitialized = createCommonjsModule(function (module) {
  function _assertThisInitialized(self) {
    if (self === void 0) {
      throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
    }
  
    return self;
  }
  
  module.exports = _assertThisInitialized;
  module.exports["default"] = module.exports, module.exports.__esModule = true;
  });
  
  var _assertThisInitialized = unwrapExports(assertThisInitialized);
  
  var defineProperty$1 = createCommonjsModule(function (module) {
  function _defineProperty(obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }
  
    return obj;
  }
  
  module.exports = _defineProperty;
  module.exports["default"] = module.exports, module.exports.__esModule = true;
  });
  
  var _defineProperty = unwrapExports(defineProperty$1);
  
  var toStr = Object.prototype.toString;
  
  var isArguments = function isArguments(value) {
  	var str = toStr.call(value);
  	var isArgs = str === '[object Arguments]';
  	if (!isArgs) {
  		isArgs = str !== '[object Array]' &&
  			value !== null &&
  			typeof value === 'object' &&
  			typeof value.length === 'number' &&
  			value.length >= 0 &&
  			toStr.call(value.callee) === '[object Function]';
  	}
  	return isArgs;
  };
  
  var keysShim;
  if (!Object.keys) {
  	// modified from https://github.com/es-shims/es5-shim
  	var has = Object.prototype.hasOwnProperty;
  	var toStr$1 = Object.prototype.toString;
  	var isArgs = isArguments; // eslint-disable-line global-require
  	var isEnumerable = Object.prototype.propertyIsEnumerable;
  	var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
  	var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
  	var dontEnums = [
  		'toString',
  		'toLocaleString',
  		'valueOf',
  		'hasOwnProperty',
  		'isPrototypeOf',
  		'propertyIsEnumerable',
  		'constructor'
  	];
  	var equalsConstructorPrototype = function (o) {
  		var ctor = o.constructor;
  		return ctor && ctor.prototype === o;
  	};
  	var excludedKeys = {
  		$applicationCache: true,
  		$console: true,
  		$external: true,
  		$frame: true,
  		$frameElement: true,
  		$frames: true,
  		$innerHeight: true,
  		$innerWidth: true,
  		$onmozfullscreenchange: true,
  		$onmozfullscreenerror: true,
  		$outerHeight: true,
  		$outerWidth: true,
  		$pageXOffset: true,
  		$pageYOffset: true,
  		$parent: true,
  		$scrollLeft: true,
  		$scrollTop: true,
  		$scrollX: true,
  		$scrollY: true,
  		$self: true,
  		$webkitIndexedDB: true,
  		$webkitStorageInfo: true,
  		$window: true
  	};
  	var hasAutomationEqualityBug = (function () {
  		/* global window */
  		if (typeof window === 'undefined') { return false; }
  		for (var k in window) {
  			try {
  				if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
  					try {
  						equalsConstructorPrototype(window[k]);
  					} catch (e) {
  						return true;
  					}
  				}
  			} catch (e) {
  				return true;
  			}
  		}
  		return false;
  	}());
  	var equalsConstructorPrototypeIfNotBuggy = function (o) {
  		/* global window */
  		if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
  			return equalsConstructorPrototype(o);
  		}
  		try {
  			return equalsConstructorPrototype(o);
  		} catch (e) {
  			return false;
  		}
  	};
  
  	keysShim = function keys(object) {
  		var isObject = object !== null && typeof object === 'object';
  		var isFunction = toStr$1.call(object) === '[object Function]';
  		var isArguments$$1 = isArgs(object);
  		var isString = isObject && toStr$1.call(object) === '[object String]';
  		var theKeys = [];
  
  		if (!isObject && !isFunction && !isArguments$$1) {
  			throw new TypeError('Object.keys called on a non-object');
  		}
  
  		var skipProto = hasProtoEnumBug && isFunction;
  		if (isString && object.length > 0 && !has.call(object, 0)) {
  			for (var i = 0; i < object.length; ++i) {
  				theKeys.push(String(i));
  			}
  		}
  
  		if (isArguments$$1 && object.length > 0) {
  			for (var j = 0; j < object.length; ++j) {
  				theKeys.push(String(j));
  			}
  		} else {
  			for (var name in object) {
  				if (!(skipProto && name === 'prototype') && has.call(object, name)) {
  					theKeys.push(String(name));
  				}
  			}
  		}
  
  		if (hasDontEnumBug) {
  			var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
  
  			for (var k = 0; k < dontEnums.length; ++k) {
  				if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
  					theKeys.push(dontEnums[k]);
  				}
  			}
  		}
  		return theKeys;
  	};
  }
  var implementation = keysShim;
  
  var implementation$1 = /*#__PURE__*/Object.freeze({
    default: implementation,
    __moduleExports: implementation
  });
  
  var require$$0 = ( implementation$1 && implementation ) || implementation$1;
  
  var slice = Array.prototype.slice;
  
  
  var origKeys = Object.keys;
  var keysShim$1 = origKeys ? function keys(o) { return origKeys(o); } : require$$0;
  
  var originalKeys = Object.keys;
  
  keysShim$1.shim = function shimObjectKeys() {
  	if (Object.keys) {
  		var keysWorksWithArguments = (function () {
  			// Safari 5.0 bug
  			var args = Object.keys(arguments);
  			return args && args.length === arguments.length;
  		}(1, 2));
  		if (!keysWorksWithArguments) {
  			Object.keys = function keys(object) { // eslint-disable-line func-name-matching
  				if (isArguments(object)) {
  					return originalKeys(slice.call(object));
  				}
  				return originalKeys(object);
  			};
  		}
  	} else {
  		Object.keys = keysShim$1;
  	}
  	return Object.keys || keysShim$1;
  };
  
  var objectKeys = keysShim$1;
  
  /* eslint complexity: [2, 18], max-statements: [2, 33] */
  var shams = function hasSymbols() {
  	if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
  	if (typeof Symbol.iterator === 'symbol') { return true; }
  
  	var obj = {};
  	var sym = Symbol('test');
  	var symObj = Object(sym);
  	if (typeof sym === 'string') { return false; }
  
  	if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
  	if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
  
  	// temp disabled per https://github.com/ljharb/object.assign/issues/17
  	// if (sym instanceof Symbol) { return false; }
  	// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
  	// if (!(symObj instanceof Symbol)) { return false; }
  
  	// if (typeof Symbol.prototype.toString !== 'function') { return false; }
  	// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
  
  	var symVal = 42;
  	obj[sym] = symVal;
  	for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
  	if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
  
  	if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
  
  	var syms = Object.getOwnPropertySymbols(obj);
  	if (syms.length !== 1 || syms[0] !== sym) { return false; }
  
  	if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
  
  	if (typeof Object.getOwnPropertyDescriptor === 'function') {
  		var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
  		if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
  	}
  
  	return true;
  };
  
  var origSymbol = typeof Symbol !== 'undefined' && Symbol;
  
  
  var hasSymbols = function hasNativeSymbols() {
  	if (typeof origSymbol !== 'function') { return false; }
  	if (typeof Symbol !== 'function') { return false; }
  	if (typeof origSymbol('foo') !== 'symbol') { return false; }
  	if (typeof Symbol('bar') !== 'symbol') { return false; }
  
  	return shams();
  };
  
  /* eslint no-invalid-this: 1 */
  
  var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
  var slice$1 = Array.prototype.slice;
  var toStr$2 = Object.prototype.toString;
  var funcType = '[object Function]';
  
  var implementation$2 = function bind(that) {
      var target = this;
      if (typeof target !== 'function' || toStr$2.call(target) !== funcType) {
          throw new TypeError(ERROR_MESSAGE + target);
      }
      var args = slice$1.call(arguments, 1);
  
      var bound;
      var binder = function () {
          if (this instanceof bound) {
              var result = target.apply(
                  this,
                  args.concat(slice$1.call(arguments))
              );
              if (Object(result) === result) {
                  return result;
              }
              return this;
          } else {
              return target.apply(
                  that,
                  args.concat(slice$1.call(arguments))
              );
          }
      };
  
      var boundLength = Math.max(0, target.length - args.length);
      var boundArgs = [];
      for (var i = 0; i < boundLength; i++) {
          boundArgs.push('$' + i);
      }
  
      bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
  
      if (target.prototype) {
          var Empty = function Empty() {};
          Empty.prototype = target.prototype;
          bound.prototype = new Empty();
          Empty.prototype = null;
      }
  
      return bound;
  };
  
  var functionBind = Function.prototype.bind || implementation$2;
  
  var src = functionBind.call(Function.call, Object.prototype.hasOwnProperty);
  
  var undefined$1;
  
  var $SyntaxError = SyntaxError;
  var $Function = Function;
  var $TypeError = TypeError;
  
  // eslint-disable-next-line consistent-return
  var getEvalledConstructor = function (expressionSyntax) {
  	try {
  		return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
  	} catch (e) {}
  };
  
  var $gOPD = Object.getOwnPropertyDescriptor;
  if ($gOPD) {
  	try {
  		$gOPD({}, '');
  	} catch (e) {
  		$gOPD = null; // this is IE 8, which has a broken gOPD
  	}
  }
  
  var throwTypeError = function () {
  	throw new $TypeError();
  };
  var ThrowTypeError = $gOPD
  	? (function () {
  		try {
  			return throwTypeError;
  		} catch (calleeThrows) {
  			try {
  				// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
  				return $gOPD(arguments, 'callee').get;
  			} catch (gOPDthrows) {
  				return throwTypeError;
  			}
  		}
  	}())
  	: throwTypeError;
  
  var hasSymbols$1 = hasSymbols();
  
  var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
  
  var needsEval = {};
  
  var TypedArray = typeof Uint8Array === 'undefined' ? undefined$1 : getProto(Uint8Array);
  
  var INTRINSICS = {
  	'%AggregateError%': typeof AggregateError === 'undefined' ? undefined$1 : AggregateError,
  	'%Array%': Array,
  	'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined$1 : ArrayBuffer,
  	'%ArrayIteratorPrototype%': hasSymbols$1 ? getProto([][Symbol.iterator]()) : undefined$1,
  	'%AsyncFromSyncIteratorPrototype%': undefined$1,
  	'%AsyncFunction%': needsEval,
  	'%AsyncGenerator%': needsEval,
  	'%AsyncGeneratorFunction%': needsEval,
  	'%AsyncIteratorPrototype%': needsEval,
  	'%Atomics%': typeof Atomics === 'undefined' ? undefined$1 : Atomics,
  	'%BigInt%': typeof BigInt === 'undefined' ? undefined$1 : BigInt,
  	'%Boolean%': Boolean,
  	'%DataView%': typeof DataView === 'undefined' ? undefined$1 : DataView,
  	'%Date%': Date,
  	'%decodeURI%': decodeURI,
  	'%decodeURIComponent%': decodeURIComponent,
  	'%encodeURI%': encodeURI,
  	'%encodeURIComponent%': encodeURIComponent,
  	'%Error%': Error,
  	'%eval%': eval, // eslint-disable-line no-eval
  	'%EvalError%': EvalError,
  	'%Float32Array%': typeof Float32Array === 'undefined' ? undefined$1 : Float32Array,
  	'%Float64Array%': typeof Float64Array === 'undefined' ? undefined$1 : Float64Array,
  	'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined$1 : FinalizationRegistry,
  	'%Function%': $Function,
  	'%GeneratorFunction%': needsEval,
  	'%Int8Array%': typeof Int8Array === 'undefined' ? undefined$1 : Int8Array,
  	'%Int16Array%': typeof Int16Array === 'undefined' ? undefined$1 : Int16Array,
  	'%Int32Array%': typeof Int32Array === 'undefined' ? undefined$1 : Int32Array,
  	'%isFinite%': isFinite,
  	'%isNaN%': isNaN,
  	'%IteratorPrototype%': hasSymbols$1 ? getProto(getProto([][Symbol.iterator]())) : undefined$1,
  	'%JSON%': typeof JSON === 'object' ? JSON : undefined$1,
  	'%Map%': typeof Map === 'undefined' ? undefined$1 : Map,
  	'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols$1 ? undefined$1 : getProto(new Map()[Symbol.iterator]()),
  	'%Math%': Math,
  	'%Number%': Number,
  	'%Object%': Object,
  	'%parseFloat%': parseFloat,
  	'%parseInt%': parseInt,
  	'%Promise%': typeof Promise === 'undefined' ? undefined$1 : Promise,
  	'%Proxy%': typeof Proxy === 'undefined' ? undefined$1 : Proxy,
  	'%RangeError%': RangeError,
  	'%ReferenceError%': ReferenceError,
  	'%Reflect%': typeof Reflect === 'undefined' ? undefined$1 : Reflect,
  	'%RegExp%': RegExp,
  	'%Set%': typeof Set === 'undefined' ? undefined$1 : Set,
  	'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols$1 ? undefined$1 : getProto(new Set()[Symbol.iterator]()),
  	'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined$1 : SharedArrayBuffer,
  	'%String%': String,
  	'%StringIteratorPrototype%': hasSymbols$1 ? getProto(''[Symbol.iterator]()) : undefined$1,
  	'%Symbol%': hasSymbols$1 ? Symbol : undefined$1,
  	'%SyntaxError%': $SyntaxError,
  	'%ThrowTypeError%': ThrowTypeError,
  	'%TypedArray%': TypedArray,
  	'%TypeError%': $TypeError,
  	'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined$1 : Uint8Array,
  	'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined$1 : Uint8ClampedArray,
  	'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined$1 : Uint16Array,
  	'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined$1 : Uint32Array,
  	'%URIError%': URIError,
  	'%WeakMap%': typeof WeakMap === 'undefined' ? undefined$1 : WeakMap,
  	'%WeakRef%': typeof WeakRef === 'undefined' ? undefined$1 : WeakRef,
  	'%WeakSet%': typeof WeakSet === 'undefined' ? undefined$1 : WeakSet
  };
  
  var doEval = function doEval(name) {
  	var value;
  	if (name === '%AsyncFunction%') {
  		value = getEvalledConstructor('async function () {}');
  	} else if (name === '%GeneratorFunction%') {
  		value = getEvalledConstructor('function* () {}');
  	} else if (name === '%AsyncGeneratorFunction%') {
  		value = getEvalledConstructor('async function* () {}');
  	} else if (name === '%AsyncGenerator%') {
  		var fn = doEval('%AsyncGeneratorFunction%');
  		if (fn) {
  			value = fn.prototype;
  		}
  	} else if (name === '%AsyncIteratorPrototype%') {
  		var gen = doEval('%AsyncGenerator%');
  		if (gen) {
  			value = getProto(gen.prototype);
  		}
  	}
  
  	INTRINSICS[name] = value;
  
  	return value;
  };
  
  var LEGACY_ALIASES = {
  	'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
  	'%ArrayPrototype%': ['Array', 'prototype'],
  	'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
  	'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
  	'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
  	'%ArrayProto_values%': ['Array', 'prototype', 'values'],
  	'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
  	'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
  	'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
  	'%BooleanPrototype%': ['Boolean', 'prototype'],
  	'%DataViewPrototype%': ['DataView', 'prototype'],
  	'%DatePrototype%': ['Date', 'prototype'],
  	'%ErrorPrototype%': ['Error', 'prototype'],
  	'%EvalErrorPrototype%': ['EvalError', 'prototype'],
  	'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
  	'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
  	'%FunctionPrototype%': ['Function', 'prototype'],
  	'%Generator%': ['GeneratorFunction', 'prototype'],
  	'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
  	'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
  	'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
  	'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
  	'%JSONParse%': ['JSON', 'parse'],
  	'%JSONStringify%': ['JSON', 'stringify'],
  	'%MapPrototype%': ['Map', 'prototype'],
  	'%NumberPrototype%': ['Number', 'prototype'],
  	'%ObjectPrototype%': ['Object', 'prototype'],
  	'%ObjProto_toString%': ['Object', 'prototype', 'toString'],
  	'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
  	'%PromisePrototype%': ['Promise', 'prototype'],
  	'%PromiseProto_then%': ['Promise', 'prototype', 'then'],
  	'%Promise_all%': ['Promise', 'all'],
  	'%Promise_reject%': ['Promise', 'reject'],
  	'%Promise_resolve%': ['Promise', 'resolve'],
  	'%RangeErrorPrototype%': ['RangeError', 'prototype'],
  	'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
  	'%RegExpPrototype%': ['RegExp', 'prototype'],
  	'%SetPrototype%': ['Set', 'prototype'],
  	'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
  	'%StringPrototype%': ['String', 'prototype'],
  	'%SymbolPrototype%': ['Symbol', 'prototype'],
  	'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
  	'%TypedArrayPrototype%': ['TypedArray', 'prototype'],
  	'%TypeErrorPrototype%': ['TypeError', 'prototype'],
  	'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
  	'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
  	'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
  	'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
  	'%URIErrorPrototype%': ['URIError', 'prototype'],
  	'%WeakMapPrototype%': ['WeakMap', 'prototype'],
  	'%WeakSetPrototype%': ['WeakSet', 'prototype']
  };
  
  
  
  var $concat = functionBind.call(Function.call, Array.prototype.concat);
  var $spliceApply = functionBind.call(Function.apply, Array.prototype.splice);
  var $replace = functionBind.call(Function.call, String.prototype.replace);
  var $strSlice = functionBind.call(Function.call, String.prototype.slice);
  
  /* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
  var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
  var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
  var stringToPath = function stringToPath(string) {
  	var first = $strSlice(string, 0, 1);
  	var last = $strSlice(string, -1);
  	if (first === '%' && last !== '%') {
  		throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
  	} else if (last === '%' && first !== '%') {
  		throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
  	}
  	var result = [];
  	$replace(string, rePropName, function (match, number, quote, subString) {
  		result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
  	});
  	return result;
  };
  /* end adaptation */
  
  var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
  	var intrinsicName = name;
  	var alias;
  	if (src(LEGACY_ALIASES, intrinsicName)) {
  		alias = LEGACY_ALIASES[intrinsicName];
  		intrinsicName = '%' + alias[0] + '%';
  	}
  
  	if (src(INTRINSICS, intrinsicName)) {
  		var value = INTRINSICS[intrinsicName];
  		if (value === needsEval) {
  			value = doEval(intrinsicName);
  		}
  		if (typeof value === 'undefined' && !allowMissing) {
  			throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
  		}
  
  		return {
  			alias: alias,
  			name: intrinsicName,
  			value: value
  		};
  	}
  
  	throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
  };
  
  var getIntrinsic = function GetIntrinsic(name, allowMissing) {
  	if (typeof name !== 'string' || name.length === 0) {
  		throw new $TypeError('intrinsic name must be a non-empty string');
  	}
  	if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
  		throw new $TypeError('"allowMissing" argument must be a boolean');
  	}
  
  	var parts = stringToPath(name);
  	var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
  
  	var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
  	var intrinsicRealName = intrinsic.name;
  	var value = intrinsic.value;
  	var skipFurtherCaching = false;
  
  	var alias = intrinsic.alias;
  	if (alias) {
  		intrinsicBaseName = alias[0];
  		$spliceApply(parts, $concat([0, 1], alias));
  	}
  
  	for (var i = 1, isOwn = true; i < parts.length; i += 1) {
  		var part = parts[i];
  		var first = $strSlice(part, 0, 1);
  		var last = $strSlice(part, -1);
  		if (
  			(
  				(first === '"' || first === "'" || first === '`')
  				|| (last === '"' || last === "'" || last === '`')
  			)
  			&& first !== last
  		) {
  			throw new $SyntaxError('property names with quotes must have matching quotes');
  		}
  		if (part === 'constructor' || !isOwn) {
  			skipFurtherCaching = true;
  		}
  
  		intrinsicBaseName += '.' + part;
  		intrinsicRealName = '%' + intrinsicBaseName + '%';
  
  		if (src(INTRINSICS, intrinsicRealName)) {
  			value = INTRINSICS[intrinsicRealName];
  		} else if (value != null) {
  			if (!(part in value)) {
  				if (!allowMissing) {
  					throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
  				}
  				return void undefined$1;
  			}
  			if ($gOPD && (i + 1) >= parts.length) {
  				var desc = $gOPD(value, part);
  				isOwn = !!desc;
  
  				// By convention, when a data property is converted to an accessor
  				// property to emulate a data property that does not suffer from
  				// the override mistake, that accessor's getter is marked with
  				// an `originalValue` property. Here, when we detect this, we
  				// uphold the illusion by pretending to see that original data
  				// property, i.e., returning the value rather than the getter
  				// itself.
  				if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
  					value = desc.get;
  				} else {
  					value = value[part];
  				}
  			} else {
  				isOwn = src(value, part);
  				value = value[part];
  			}
  
  			if (isOwn && !skipFurtherCaching) {
  				INTRINSICS[intrinsicRealName] = value;
  			}
  		}
  	}
  	return value;
  };
  
  var callBind = createCommonjsModule(function (module) {
  
  
  
  
  var $apply = getIntrinsic('%Function.prototype.apply%');
  var $call = getIntrinsic('%Function.prototype.call%');
  var $reflectApply = getIntrinsic('%Reflect.apply%', true) || functionBind.call($call, $apply);
  
  var $gOPD = getIntrinsic('%Object.getOwnPropertyDescriptor%', true);
  var $defineProperty = getIntrinsic('%Object.defineProperty%', true);
  var $max = getIntrinsic('%Math.max%');
  
  if ($defineProperty) {
  	try {
  		$defineProperty({}, 'a', { value: 1 });
  	} catch (e) {
  		// IE 8 has a broken defineProperty
  		$defineProperty = null;
  	}
  }
  
  module.exports = function callBind(originalFunction) {
  	var func = $reflectApply(functionBind, $call, arguments);
  	if ($gOPD && $defineProperty) {
  		var desc = $gOPD(func, 'length');
  		if (desc.configurable) {
  			// original length, plus the receiver, minus any additional arguments (after the receiver)
  			$defineProperty(
  				func,
  				'length',
  				{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
  			);
  		}
  	}
  	return func;
  };
  
  var applyBind = function applyBind() {
  	return $reflectApply(functionBind, $apply, arguments);
  };
  
  if ($defineProperty) {
  	$defineProperty(module.exports, 'apply', { value: applyBind });
  } else {
  	module.exports.apply = applyBind;
  }
  });
  var callBind_1 = callBind.apply;
  
  var callBind$1 = /*#__PURE__*/Object.freeze({
    default: callBind,
    __moduleExports: callBind,
    apply: callBind_1
  });
  
  var callBind$2 = ( callBind$1 && callBind ) || callBind$1;
  
  var $indexOf = callBind$2(getIntrinsic('String.prototype.indexOf'));
  
  var callBound = function callBoundIntrinsic(name, allowMissing) {
  	var intrinsic = getIntrinsic(name, !!allowMissing);
  	if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
  		return callBind$2(intrinsic);
  	}
  	return intrinsic;
  };
  
  var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
  
  
  var $toString = callBound('Object.prototype.toString');
  
  var isStandardArguments = function isArguments(value) {
  	if (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {
  		return false;
  	}
  	return $toString(value) === '[object Arguments]';
  };
  
  var isLegacyArguments = function isArguments(value) {
  	if (isStandardArguments(value)) {
  		return true;
  	}
  	return value !== null &&
  		typeof value === 'object' &&
  		typeof value.length === 'number' &&
  		value.length >= 0 &&
  		$toString(value) !== '[object Array]' &&
  		$toString(value.callee) === '[object Function]';
  };
  
  var supportsStandardArguments = (function () {
  	return isStandardArguments(arguments);
  }());
  
  isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests
  
  var isArguments$1 = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
  
  /* https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.is */
  
  var NumberIsNaN = function (value) {
  	return value !== value;
  };
  
  var objectIs = function is(a, b) {
  	if (a === 0 && b === 0) {
  		return 1 / a === 1 / b;
  	} else if (a === b) {
  		return true;
  	} else if (NumberIsNaN(a) && NumberIsNaN(b)) {
  		return true;
  	}
  	return false;
  };
  
  var objectIs$1 = /*#__PURE__*/Object.freeze({
    default: objectIs,
    __moduleExports: objectIs
  });
  
  var src$1 = functionBind.call(Function.call, Object.prototype.hasOwnProperty);
  
  var src$2 = /*#__PURE__*/Object.freeze({
    default: src$1,
    __moduleExports: src$1
  });
  
  var has$1 = ( src$2 && src$1 ) || src$2;
  
  var regexExec = RegExp.prototype.exec;
  var gOPD = Object.getOwnPropertyDescriptor;
  
  var tryRegexExecCall = function tryRegexExec(value) {
  	try {
  		var lastIndex = value.lastIndex;
  		value.lastIndex = 0;
  
  		regexExec.call(value);
  		return true;
  	} catch (e) {
  		return false;
  	} finally {
  		value.lastIndex = lastIndex;
  	}
  };
  var toStr$3 = Object.prototype.toString;
  var regexClass = '[object RegExp]';
  var hasToStringTag$1 = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
  
  var isRegex = function isRegex(value) {
  	if (!value || typeof value !== 'object') {
  		return false;
  	}
  	if (!hasToStringTag$1) {
  		return toStr$3.call(value) === regexClass;
  	}
  
  	var descriptor = gOPD(value, 'lastIndex');
  	var hasLastIndexDataProperty = descriptor && has$1(descriptor, 'value');
  	if (!hasLastIndexDataProperty) {
  		return false;
  	}
  
  	return tryRegexExecCall(value);
  };
  
  var hasSymbols$2 = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
  
  var toStr$4 = Object.prototype.toString;
  var concat = Array.prototype.concat;
  var origDefineProperty = Object.defineProperty;
  
  var isFunction = function (fn) {
  	return typeof fn === 'function' && toStr$4.call(fn) === '[object Function]';
  };
  
  var arePropertyDescriptorsSupported = function () {
  	var obj = {};
  	try {
  		origDefineProperty(obj, 'x', { enumerable: false, value: obj });
  		// eslint-disable-next-line no-unused-vars, no-restricted-syntax
  		for (var _ in obj) { // jscs:ignore disallowUnusedVariables
  			return false;
  		}
  		return obj.x === obj;
  	} catch (e) { /* this is IE 8. */
  		return false;
  	}
  };
  var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();
  
  var defineProperty$2 = function (object, name, value, predicate) {
  	if (name in object && (!isFunction(predicate) || !predicate())) {
  		return;
  	}
  	if (supportsDescriptors) {
  		origDefineProperty(object, name, {
  			configurable: true,
  			enumerable: false,
  			value: value,
  			writable: true
  		});
  	} else {
  		object[name] = value;
  	}
  };
  
  var defineProperties = function (object, map) {
  	var predicates = arguments.length > 2 ? arguments[2] : {};
  	var props = objectKeys(map);
  	if (hasSymbols$2) {
  		props = concat.call(props, Object.getOwnPropertySymbols(map));
  	}
  	for (var i = 0; i < props.length; i += 1) {
  		defineProperty$2(object, props[i], map[props[i]], predicates[props[i]]);
  	}
  };
  
  defineProperties.supportsDescriptors = !!supportsDescriptors;
  
  var defineProperties_1 = defineProperties;
  
  var $Object = Object;
  var $TypeError$1 = TypeError;
  
  var implementation$3 = function flags() {
  	if (this != null && this !== $Object(this)) {
  		throw new $TypeError$1('RegExp.prototype.flags getter called on non-object');
  	}
  	var result = '';
  	if (this.global) {
  		result += 'g';
  	}
  	if (this.ignoreCase) {
  		result += 'i';
  	}
  	if (this.multiline) {
  		result += 'm';
  	}
  	if (this.dotAll) {
  		result += 's';
  	}
  	if (this.unicode) {
  		result += 'u';
  	}
  	if (this.sticky) {
  		result += 'y';
  	}
  	return result;
  };
  
  var supportsDescriptors$1 = defineProperties_1.supportsDescriptors;
  var $gOPD$1 = Object.getOwnPropertyDescriptor;
  var $TypeError$2 = TypeError;
  
  var polyfill = function getPolyfill() {
  	if (!supportsDescriptors$1) {
  		throw new $TypeError$2('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors');
  	}
  	if ((/a/mig).flags === 'gim') {
  		var descriptor = $gOPD$1(RegExp.prototype, 'flags');
  		if (descriptor && typeof descriptor.get === 'function' && typeof (/a/).dotAll === 'boolean') {
  			return descriptor.get;
  		}
  	}
  	return implementation$3;
  };
  
  var supportsDescriptors$2 = defineProperties_1.supportsDescriptors;
  
  var gOPD$1 = Object.getOwnPropertyDescriptor;
  var defineProperty$3 = Object.defineProperty;
  var TypeErr = TypeError;
  var getProto$1 = Object.getPrototypeOf;
  var regex = /a/;
  
  var shim = function shimFlags() {
  	if (!supportsDescriptors$2 || !getProto$1) {
  		throw new TypeErr('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors');
  	}
  	var polyfill$$1 = polyfill();
  	var proto = getProto$1(regex);
  	var descriptor = gOPD$1(proto, 'flags');
  	if (!descriptor || descriptor.get !== polyfill$$1) {
  		defineProperty$3(proto, 'flags', {
  			configurable: true,
  			enumerable: false,
  			get: polyfill$$1
  		});
  	}
  	return polyfill$$1;
  };
  
  var flagsBound = callBind$2(implementation$3);
  
  defineProperties_1(flagsBound, {
  	getPolyfill: polyfill,
  	implementation: implementation$3,
  	shim: shim
  });
  
  var regexp_prototype_flags = flagsBound;
  
  var getDay$1 = Date.prototype.getDay;
  var tryDateObject = function tryDateObject(value) {
  	try {
  		getDay$1.call(value);
  		return true;
  	} catch (e) {
  		return false;
  	}
  };
  
  var toStr$5 = Object.prototype.toString;
  var dateClass = '[object Date]';
  var hasToStringTag$2 = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
  
  var isDateObject = function isDateObject(value) {
  	if (typeof value !== 'object' || value === null) { return false; }
  	return hasToStringTag$2 ? tryDateObject(value) : toStr$5.call(value) === dateClass;
  };
  
  var is = ( objectIs$1 && objectIs ) || objectIs$1;
  
  var getTime = Date.prototype.getTime;
  
  function deepEqual(actual, expected, options) {
    var opts = options || {};
  
    // 7.1. All identical values are equivalent, as determined by ===.
    if (opts.strict ? is(actual, expected) : actual === expected) {
      return true;
    }
  
    // 7.3. Other pairs that do not both pass typeof value == 'object', equivalence is determined by ==.
    if (!actual || !expected || (typeof actual !== 'object' && typeof expected !== 'object')) {
      return opts.strict ? is(actual, expected) : actual == expected;
    }
  
    /*
     * 7.4. For all other Object pairs, including Array objects, equivalence is
     * determined by having the same number of owned properties (as verified
     * with Object.prototype.hasOwnProperty.call), the same set of keys
     * (although not necessarily the same order), equivalent values for every
     * corresponding key, and an identical 'prototype' property. Note: this
     * accounts for both named and indexed properties on Arrays.
     */
    // eslint-disable-next-line no-use-before-define
    return objEquiv(actual, expected, opts);
  }
  
  function isUndefinedOrNull(value) {
    return value === null || value === undefined;
  }
  
  function isBuffer(x) {
    if (!x || typeof x !== 'object' || typeof x.length !== 'number') {
      return false;
    }
    if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
      return false;
    }
    if (x.length > 0 && typeof x[0] !== 'number') {
      return false;
    }
    return true;
  }
  
  function objEquiv(a, b, opts) {
    /* eslint max-statements: [2, 50] */
    var i, key;
    if (typeof a !== typeof b) { return false; }
    if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) { return false; }
  
    // an identical 'prototype' property.
    if (a.prototype !== b.prototype) { return false; }
  
    if (isArguments$1(a) !== isArguments$1(b)) { return false; }
  
    var aIsRegex = isRegex(a);
    var bIsRegex = isRegex(b);
    if (aIsRegex !== bIsRegex) { return false; }
    if (aIsRegex || bIsRegex) {
      return a.source === b.source && regexp_prototype_flags(a) === regexp_prototype_flags(b);
    }
  
    if (isDateObject(a) && isDateObject(b)) {
      return getTime.call(a) === getTime.call(b);
    }
  
    var aIsBuffer = isBuffer(a);
    var bIsBuffer = isBuffer(b);
    if (aIsBuffer !== bIsBuffer) { return false; }
    if (aIsBuffer || bIsBuffer) { // && would work too, because both are true or both false here
      if (a.length !== b.length) { return false; }
      for (i = 0; i < a.length; i++) {
        if (a[i] !== b[i]) { return false; }
      }
      return true;
    }
  
    if (typeof a !== typeof b) { return false; }
  
    try {
      var ka = objectKeys(a);
      var kb = objectKeys(b);
    } catch (e) { // happens when one is a string literal and the other isn't
      return false;
    }
    // having the same number of owned properties (keys incorporates hasOwnProperty)
    if (ka.length !== kb.length) { return false; }
  
    // the same set of keys (although not necessarily the same order),
    ka.sort();
    kb.sort();
    // ~~~cheap key test
    for (i = ka.length - 1; i >= 0; i--) {
      if (ka[i] != kb[i]) { return false; }
    }
    // equivalent values for every corresponding key, and ~~~possibly expensive deep test
    for (i = ka.length - 1; i >= 0; i--) {
      key = ka[i];
      if (!deepEqual(a[key], b[key], opts)) { return false; }
    }
  
    return true;
  }
  
  var deepEqual_1 = deepEqual;
  
  /**!
   * @fileOverview Kickass library to create and place poppers near their reference elements.
   * @version 1.16.1
   * @license
   * Copyright (c) 2016 Federico Zivolo and contributors
   *
   * Permission is hereby granted, free of charge, to any person obtaining a copy
   * of this software and associated documentation files (the "Software"), to deal
   * in the Software without restriction, including without limitation the rights
   * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   * copies of the Software, and to permit persons to whom the Software is
   * furnished to do so, subject to the following conditions:
   *
   * The above copyright notice and this permission notice shall be included in all
   * copies or substantial portions of the Software.
   *
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
   * SOFTWARE.
   */
  var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && typeof navigator !== 'undefined';
  
  var timeoutDuration = function () {
    var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
    for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
      if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
        return 1;
      }
    }
    return 0;
  }();
  
  function microtaskDebounce(fn) {
    var called = false;
    return function () {
      if (called) {
        return;
      }
      called = true;
      window.Promise.resolve().then(function () {
        called = false;
        fn();
      });
    };
  }
  
  function taskDebounce(fn) {
    var scheduled = false;
    return function () {
      if (!scheduled) {
        scheduled = true;
        setTimeout(function () {
          scheduled = false;
          fn();
        }, timeoutDuration);
      }
    };
  }
  
  var supportsMicroTasks = isBrowser && window.Promise;
  
  /**
  * Create a debounced version of a method, that's asynchronously deferred
  * but called in the minimum time possible.
  *
  * @method
  * @memberof Popper.Utils
  * @argument {Function} fn
  * @returns {Function}
  */
  var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  
  /**
   * Check if the given variable is a function
   * @method
   * @memberof Popper.Utils
   * @argument {Any} functionToCheck - variable to check
   * @returns {Boolean} answer to: is a function?
   */
  function isFunction$1(functionToCheck) {
    var getType = {};
    return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  }
  
  /**
   * Get CSS computed property of the given element
   * @method
   * @memberof Popper.Utils
   * @argument {Eement} element
   * @argument {String} property
   */
  function getStyleComputedProperty(element, property) {
    if (element.nodeType !== 1) {
      return [];
    }
    // NOTE: 1 DOM access here
    var window = element.ownerDocument.defaultView;
    var css = window.getComputedStyle(element, null);
    return property ? css[property] : css;
  }
  
  /**
   * Returns the parentNode or the host of the element
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @returns {Element} parent
   */
  function getParentNode(element) {
    if (element.nodeName === 'HTML') {
      return element;
    }
    return element.parentNode || element.host;
  }
  
  /**
   * Returns the scrolling parent of the given element
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @returns {Element} scroll parent
   */
  function getScrollParent(element) {
    // Return body, `getScroll` will take care to get the correct `scrollTop` from it
    if (!element) {
      return document.body;
    }
  
    switch (element.nodeName) {
      case 'HTML':
      case 'BODY':
        return element.ownerDocument.body;
      case '#document':
        return element.body;
    }
  
    // Firefox want us to check `-x` and `-y` variations as well
  
    var _getStyleComputedProp = getStyleComputedProperty(element),
        overflow = _getStyleComputedProp.overflow,
        overflowX = _getStyleComputedProp.overflowX,
        overflowY = _getStyleComputedProp.overflowY;
  
    if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
      return element;
    }
  
    return getScrollParent(getParentNode(element));
  }
  
  /**
   * Returns the reference node of the reference object, or the reference object itself.
   * @method
   * @memberof Popper.Utils
   * @param {Element|Object} reference - the reference element (the popper will be relative to this)
   * @returns {Element} parent
   */
  function getReferenceNode(reference) {
    return reference && reference.referenceNode ? reference.referenceNode : reference;
  }
  
  var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  
  /**
   * Determines if the browser is Internet Explorer
   * @method
   * @memberof Popper.Utils
   * @param {Number} version to check
   * @returns {Boolean} isIE
   */
  function isIE(version) {
    if (version === 11) {
      return isIE11;
    }
    if (version === 10) {
      return isIE10;
    }
    return isIE11 || isIE10;
  }
  
  /**
   * Returns the offset parent of the given element
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @returns {Element} offset parent
   */
  function getOffsetParent(element) {
    if (!element) {
      return document.documentElement;
    }
  
    var noOffsetParent = isIE(10) ? document.body : null;
  
    // NOTE: 1 DOM access here
    var offsetParent = element.offsetParent || null;
    // Skip hidden elements which don't have an offsetParent
    while (offsetParent === noOffsetParent && element.nextElementSibling) {
      offsetParent = (element = element.nextElementSibling).offsetParent;
    }
  
    var nodeName = offsetParent && offsetParent.nodeName;
  
    if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
      return element ? element.ownerDocument.documentElement : document.documentElement;
    }
  
    // .offsetParent will return the closest TH, TD or TABLE in case
    // no offsetParent is present, I hate this job...
    if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
      return getOffsetParent(offsetParent);
    }
  
    return offsetParent;
  }
  
  function isOffsetContainer(element) {
    var nodeName = element.nodeName;
  
    if (nodeName === 'BODY') {
      return false;
    }
    return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  }
  
  /**
   * Finds the root node (document, shadowDOM root) of the given element
   * @method
   * @memberof Popper.Utils
   * @argument {Element} node
   * @returns {Element} root node
   */
  function getRoot(node) {
    if (node.parentNode !== null) {
      return getRoot(node.parentNode);
    }
  
    return node;
  }
  
  /**
   * Finds the offset parent common to the two provided nodes
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element1
   * @argument {Element} element2
   * @returns {Element} common offset parent
   */
  function findCommonOffsetParent(element1, element2) {
    // This check is needed to avoid errors in case one of the elements isn't defined for any reason
    if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
      return document.documentElement;
    }
  
    // Here we make sure to give as "start" the element that comes first in the DOM
    var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
    var start = order ? element1 : element2;
    var end = order ? element2 : element1;
  
    // Get common ancestor container
    var range = document.createRange();
    range.setStart(start, 0);
    range.setEnd(end, 0);
    var commonAncestorContainer = range.commonAncestorContainer;
  
    // Both nodes are inside #document
  
    if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
      if (isOffsetContainer(commonAncestorContainer)) {
        return commonAncestorContainer;
      }
  
      return getOffsetParent(commonAncestorContainer);
    }
  
    // one of the nodes is inside shadowDOM, find which one
    var element1root = getRoot(element1);
    if (element1root.host) {
      return findCommonOffsetParent(element1root.host, element2);
    } else {
      return findCommonOffsetParent(element1, getRoot(element2).host);
    }
  }
  
  /**
   * Gets the scroll value of the given element in the given side (top and left)
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @argument {String} side `top` or `left`
   * @returns {number} amount of scrolled pixels
   */
  function getScroll(element) {
    var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  
    var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
    var nodeName = element.nodeName;
  
    if (nodeName === 'BODY' || nodeName === 'HTML') {
      var html = element.ownerDocument.documentElement;
      var scrollingElement = element.ownerDocument.scrollingElement || html;
      return scrollingElement[upperSide];
    }
  
    return element[upperSide];
  }
  
  /*
   * Sum or subtract the element scroll values (left and top) from a given rect object
   * @method
   * @memberof Popper.Utils
   * @param {Object} rect - Rect object you want to change
   * @param {HTMLElement} element - The element from the function reads the scroll values
   * @param {Boolean} subtract - set to true if you want to subtract the scroll values
   * @return {Object} rect - The modifier rect object
   */
  function includeScroll(rect, element) {
    var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  
    var scrollTop = getScroll(element, 'top');
    var scrollLeft = getScroll(element, 'left');
    var modifier = subtract ? -1 : 1;
    rect.top += scrollTop * modifier;
    rect.bottom += scrollTop * modifier;
    rect.left += scrollLeft * modifier;
    rect.right += scrollLeft * modifier;
    return rect;
  }
  
  /*
   * Helper to detect borders of a given element
   * @method
   * @memberof Popper.Utils
   * @param {CSSStyleDeclaration} styles
   * Result of `getStyleComputedProperty` on the given element
   * @param {String} axis - `x` or `y`
   * @return {number} borders - The borders size of the given axis
   */
  
  function getBordersSize(styles, axis) {
    var sideA = axis === 'x' ? 'Left' : 'Top';
    var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  
    return parseFloat(styles['border' + sideA + 'Width']) + parseFloat(styles['border' + sideB + 'Width']);
  }
  
  function getSize(axis, body, html, computedStyle) {
    return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
  }
  
  function getWindowSizes(document) {
    var body = document.body;
    var html = document.documentElement;
    var computedStyle = isIE(10) && getComputedStyle(html);
  
    return {
      height: getSize('Height', body, html, computedStyle),
      width: getSize('Width', body, html, computedStyle)
    };
  }
  
  var classCallCheck$1 = function (instance, Constructor) {
    if (!(instance instanceof Constructor)) {
      throw new TypeError("Cannot call a class as a function");
    }
  };
  
  var createClass$1 = function () {
    function defineProperties(target, props) {
      for (var i = 0; i < props.length; i++) {
        var descriptor = props[i];
        descriptor.enumerable = descriptor.enumerable || false;
        descriptor.configurable = true;
        if ("value" in descriptor) descriptor.writable = true;
        Object.defineProperty(target, descriptor.key, descriptor);
      }
    }
  
    return function (Constructor, protoProps, staticProps) {
      if (protoProps) defineProperties(Constructor.prototype, protoProps);
      if (staticProps) defineProperties(Constructor, staticProps);
      return Constructor;
    };
  }();
  
  
  
  
  
  var defineProperty$4 = function (obj, key, value) {
    if (key in obj) {
      Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
      });
    } else {
      obj[key] = value;
    }
  
    return obj;
  };
  
  var _extends$2 = 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;
  };
  
  /**
   * Given element offsets, generate an output similar to getBoundingClientRect
   * @method
   * @memberof Popper.Utils
   * @argument {Object} offsets
   * @returns {Object} ClientRect like output
   */
  function getClientRect(offsets) {
    return _extends$2({}, offsets, {
      right: offsets.left + offsets.width,
      bottom: offsets.top + offsets.height
    });
  }
  
  /**
   * Get bounding client rect of given element
   * @method
   * @memberof Popper.Utils
   * @param {HTMLElement} element
   * @return {Object} client rect
   */
  function getBoundingClientRect(element) {
    var rect = {};
  
    // IE10 10 FIX: Please, don't ask, the element isn't
    // considered in DOM in some circumstances...
    // This isn't reproducible in IE10 compatibility mode of IE11
    try {
      if (isIE(10)) {
        rect = element.getBoundingClientRect();
        var scrollTop = getScroll(element, 'top');
        var scrollLeft = getScroll(element, 'left');
        rect.top += scrollTop;
        rect.left += scrollLeft;
        rect.bottom += scrollTop;
        rect.right += scrollLeft;
      } else {
        rect = element.getBoundingClientRect();
      }
    } catch (e) {}
  
    var result = {
      left: rect.left,
      top: rect.top,
      width: rect.right - rect.left,
      height: rect.bottom - rect.top
    };
  
    // subtract scrollbar size from sizes
    var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
    var width = sizes.width || element.clientWidth || result.width;
    var height = sizes.height || element.clientHeight || result.height;
  
    var horizScrollbar = element.offsetWidth - width;
    var vertScrollbar = element.offsetHeight - height;
  
    // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
    // we make this check conditional for performance reasons
    if (horizScrollbar || vertScrollbar) {
      var styles = getStyleComputedProperty(element);
      horizScrollbar -= getBordersSize(styles, 'x');
      vertScrollbar -= getBordersSize(styles, 'y');
  
      result.width -= horizScrollbar;
      result.height -= vertScrollbar;
    }
  
    return getClientRect(result);
  }
  
  function getOffsetRectRelativeToArbitraryNode(children, parent) {
    var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  
    var isIE10 = isIE(10);
    var isHTML = parent.nodeName === 'HTML';
    var childrenRect = getBoundingClientRect(children);
    var parentRect = getBoundingClientRect(parent);
    var scrollParent = getScrollParent(children);
  
    var styles = getStyleComputedProperty(parent);
    var borderTopWidth = parseFloat(styles.borderTopWidth);
    var borderLeftWidth = parseFloat(styles.borderLeftWidth);
  
    // In cases where the parent is fixed, we must ignore negative scroll in offset calc
    if (fixedPosition && isHTML) {
      parentRect.top = Math.max(parentRect.top, 0);
      parentRect.left = Math.max(parentRect.left, 0);
    }
    var offsets = getClientRect({
      top: childrenRect.top - parentRect.top - borderTopWidth,
      left: childrenRect.left - parentRect.left - borderLeftWidth,
      width: childrenRect.width,
      height: childrenRect.height
    });
    offsets.marginTop = 0;
    offsets.marginLeft = 0;
  
    // Subtract margins of documentElement in case it's being used as parent
    // we do this only on HTML because it's the only element that behaves
    // differently when margins are applied to it. The margins are included in
    // the box of the documentElement, in the other cases not.
    if (!isIE10 && isHTML) {
      var marginTop = parseFloat(styles.marginTop);
      var marginLeft = parseFloat(styles.marginLeft);
  
      offsets.top -= borderTopWidth - marginTop;
      offsets.bottom -= borderTopWidth - marginTop;
      offsets.left -= borderLeftWidth - marginLeft;
      offsets.right -= borderLeftWidth - marginLeft;
  
      // Attach marginTop and marginLeft because in some circumstances we may need them
      offsets.marginTop = marginTop;
      offsets.marginLeft = marginLeft;
    }
  
    if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
      offsets = includeScroll(offsets, parent);
    }
  
    return offsets;
  }
  
  function getViewportOffsetRectRelativeToArtbitraryNode(element) {
    var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  
    var html = element.ownerDocument.documentElement;
    var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
    var width = Math.max(html.clientWidth, window.innerWidth || 0);
    var height = Math.max(html.clientHeight, window.innerHeight || 0);
  
    var scrollTop = !excludeScroll ? getScroll(html) : 0;
    var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  
    var offset = {
      top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
      left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
      width: width,
      height: height
    };
  
    return getClientRect(offset);
  }
  
  /**
   * Check if the given element is fixed or is inside a fixed parent
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @argument {Element} customContainer
   * @returns {Boolean} answer to "isFixed?"
   */
  function isFixed(element) {
    var nodeName = element.nodeName;
    if (nodeName === 'BODY' || nodeName === 'HTML') {
      return false;
    }
    if (getStyleComputedProperty(element, 'position') === 'fixed') {
      return true;
    }
    var parentNode = getParentNode(element);
    if (!parentNode) {
      return false;
    }
    return isFixed(parentNode);
  }
  
  /**
   * Finds the first parent of an element that has a transformed property defined
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @returns {Element} first transformed parent or documentElement
   */
  
  function getFixedPositionOffsetParent(element) {
    // This check is needed to avoid errors in case one of the elements isn't defined for any reason
    if (!element || !element.parentElement || isIE()) {
      return document.documentElement;
    }
    var el = element.parentElement;
    while (el && getStyleComputedProperty(el, 'transform') === 'none') {
      el = el.parentElement;
    }
    return el || document.documentElement;
  }
  
  /**
   * Computed the boundaries limits and return them
   * @method
   * @memberof Popper.Utils
   * @param {HTMLElement} popper
   * @param {HTMLElement} reference
   * @param {number} padding
   * @param {HTMLElement} boundariesElement - Element used to define the boundaries
   * @param {Boolean} fixedPosition - Is in fixed position mode
   * @returns {Object} Coordinates of the boundaries
   */
  function getBoundaries(popper, reference, padding, boundariesElement) {
    var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  
    // NOTE: 1 DOM access here
  
    var boundaries = { top: 0, left: 0 };
    var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
  
    // Handle viewport case
    if (boundariesElement === 'viewport') {
      boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
    } else {
      // Handle other cases based on DOM element used as boundaries
      var boundariesNode = void 0;
      if (boundariesElement === 'scrollParent') {
        boundariesNode = getScrollParent(getParentNode(reference));
        if (boundariesNode.nodeName === 'BODY') {
          boundariesNode = popper.ownerDocument.documentElement;
        }
      } else if (boundariesElement === 'window') {
        boundariesNode = popper.ownerDocument.documentElement;
      } else {
        boundariesNode = boundariesElement;
      }
  
      var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  
      // In case of HTML, we need a different computation
      if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
        var _getWindowSizes = getWindowSizes(popper.ownerDocument),
            height = _getWindowSizes.height,
            width = _getWindowSizes.width;
  
        boundaries.top += offsets.top - offsets.marginTop;
        boundaries.bottom = height + offsets.top;
        boundaries.left += offsets.left - offsets.marginLeft;
        boundaries.right = width + offsets.left;
      } else {
        // for all the other DOM elements, this one is good
        boundaries = offsets;
      }
    }
  
    // Add paddings
    padding = padding || 0;
    var isPaddingNumber = typeof padding === 'number';
    boundaries.left += isPaddingNumber ? padding : padding.left || 0;
    boundaries.top += isPaddingNumber ? padding : padding.top || 0;
    boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
    boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  
    return boundaries;
  }
  
  function getArea(_ref) {
    var width = _ref.width,
        height = _ref.height;
  
    return width * height;
  }
  
  /**
   * Utility used to transform the `auto` placement to the placement with more
   * available space.
   * @method
   * @memberof Popper.Utils
   * @argument {Object} data - The data object generated by update method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */
  function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
    var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  
    if (placement.indexOf('auto') === -1) {
      return placement;
    }
  
    var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  
    var rects = {
      top: {
        width: boundaries.width,
        height: refRect.top - boundaries.top
      },
      right: {
        width: boundaries.right - refRect.right,
        height: boundaries.height
      },
      bottom: {
        width: boundaries.width,
        height: boundaries.bottom - refRect.bottom
      },
      left: {
        width: refRect.left - boundaries.left,
        height: boundaries.height
      }
    };
  
    var sortedAreas = Object.keys(rects).map(function (key) {
      return _extends$2({
        key: key
      }, rects[key], {
        area: getArea(rects[key])
      });
    }).sort(function (a, b) {
      return b.area - a.area;
    });
  
    var filteredAreas = sortedAreas.filter(function (_ref2) {
      var width = _ref2.width,
          height = _ref2.height;
      return width >= popper.clientWidth && height >= popper.clientHeight;
    });
  
    var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  
    var variation = placement.split('-')[1];
  
    return computedPlacement + (variation ? '-' + variation : '');
  }
  
  /**
   * Get offsets to the reference element
   * @method
   * @memberof Popper.Utils
   * @param {Object} state
   * @param {Element} popper - the popper element
   * @param {Element} reference - the reference element (the popper will be relative to this)
   * @param {Element} fixedPosition - is in fixed position mode
   * @returns {Object} An object containing the offsets which will be applied to the popper
   */
  function getReferenceOffsets(state, popper, reference) {
    var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  
    var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, getReferenceNode(reference));
    return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  }
  
  /**
   * Get the outer sizes of the given element (offset size + margins)
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element
   * @returns {Object} object containing width and height properties
   */
  function getOuterSizes(element) {
    var window = element.ownerDocument.defaultView;
    var styles = window.getComputedStyle(element);
    var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
    var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
    var result = {
      width: element.offsetWidth + y,
      height: element.offsetHeight + x
    };
    return result;
  }
  
  /**
   * Get the opposite placement of the given one
   * @method
   * @memberof Popper.Utils
   * @argument {String} placement
   * @returns {String} flipped placement
   */
  function getOppositePlacement(placement) {
    var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
    return placement.replace(/left|right|bottom|top/g, function (matched) {
      return hash[matched];
    });
  }
  
  /**
   * Get offsets to the popper
   * @method
   * @memberof Popper.Utils
   * @param {Object} position - CSS position the Popper will get applied
   * @param {HTMLElement} popper - the popper element
   * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
   * @param {String} placement - one of the valid placement options
   * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
   */
  function getPopperOffsets(popper, referenceOffsets, placement) {
    placement = placement.split('-')[0];
  
    // Get popper node sizes
    var popperRect = getOuterSizes(popper);
  
    // Add position, width and height to our offsets object
    var popperOffsets = {
      width: popperRect.width,
      height: popperRect.height
    };
  
    // depending by the popper placement we have to compute its offsets slightly differently
    var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
    var mainSide = isHoriz ? 'top' : 'left';
    var secondarySide = isHoriz ? 'left' : 'top';
    var measurement = isHoriz ? 'height' : 'width';
    var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  
    popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
    if (placement === secondarySide) {
      popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
    } else {
      popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
    }
  
    return popperOffsets;
  }
  
  /**
   * Mimics the `find` method of Array
   * @method
   * @memberof Popper.Utils
   * @argument {Array} arr
   * @argument prop
   * @argument value
   * @returns index or -1
   */
  function find$1(arr, check) {
    // use native find if supported
    if (Array.prototype.find) {
      return arr.find(check);
    }
  
    // use `filter` to obtain the same behavior of `find`
    return arr.filter(check)[0];
  }
  
  /**
   * Return the index of the matching object
   * @method
   * @memberof Popper.Utils
   * @argument {Array} arr
   * @argument prop
   * @argument value
   * @returns index or -1
   */
  function findIndex(arr, prop, value) {
    // use native findIndex if supported
    if (Array.prototype.findIndex) {
      return arr.findIndex(function (cur) {
        return cur[prop] === value;
      });
    }
  
    // use `find` + `indexOf` if `findIndex` isn't supported
    var match = find$1(arr, function (obj) {
      return obj[prop] === value;
    });
    return arr.indexOf(match);
  }
  
  /**
   * Loop trough the list of modifiers and run them in order,
   * each of them will then edit the data object.
   * @method
   * @memberof Popper.Utils
   * @param {dataObject} data
   * @param {Array} modifiers
   * @param {String} ends - Optional modifier name used as stopper
   * @returns {dataObject}
   */
  function runModifiers(modifiers, data, ends) {
    var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  
    modifiersToRun.forEach(function (modifier) {
      if (modifier['function']) {
        // eslint-disable-line dot-notation
        console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
      }
      var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
      if (modifier.enabled && isFunction$1(fn)) {
        // Add properties to offsets to make them a complete clientRect object
        // we do this before each modifier to make sure the previous one doesn't
        // mess with these values
        data.offsets.popper = getClientRect(data.offsets.popper);
        data.offsets.reference = getClientRect(data.offsets.reference);
  
        data = fn(data, modifier);
      }
    });
  
    return data;
  }
  
  /**
   * Updates the position of the popper, computing the new offsets and applying
   * the new style.<br />
   * Prefer `scheduleUpdate` over `update` because of performance reasons.
   * @method
   * @memberof Popper
   */
  function update() {
    // if popper is destroyed, don't perform any further update
    if (this.state.isDestroyed) {
      return;
    }
  
    var data = {
      instance: this,
      styles: {},
      arrowStyles: {},
      attributes: {},
      flipped: false,
      offsets: {}
    };
  
    // compute reference element offsets
    data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  
    // compute auto placement, store placement inside the data object,
    // modifiers will be able to edit `placement` if needed
    // and refer to originalPlacement to know the original value
    data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  
    // store the computed placement inside `originalPlacement`
    data.originalPlacement = data.placement;
  
    data.positionFixed = this.options.positionFixed;
  
    // compute the popper offsets
    data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  
    data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  
    // run the modifiers
    data = runModifiers(this.modifiers, data);
  
    // the first `update` will call `onCreate` callback
    // the other ones will call `onUpdate` callback
    if (!this.state.isCreated) {
      this.state.isCreated = true;
      this.options.onCreate(data);
    } else {
      this.options.onUpdate(data);
    }
  }
  
  /**
   * Helper used to know if the given modifier is enabled.
   * @method
   * @memberof Popper.Utils
   * @returns {Boolean}
   */
  function isModifierEnabled(modifiers, modifierName) {
    return modifiers.some(function (_ref) {
      var name = _ref.name,
          enabled = _ref.enabled;
      return enabled && name === modifierName;
    });
  }
  
  /**
   * Get the prefixed supported property name
   * @method
   * @memberof Popper.Utils
   * @argument {String} property (camelCase)
   * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
   */
  function getSupportedPropertyName(property) {
    var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
    var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  
    for (var i = 0; i < prefixes.length; i++) {
      var prefix = prefixes[i];
      var toCheck = prefix ? '' + prefix + upperProp : property;
      if (typeof document.body.style[toCheck] !== 'undefined') {
        return toCheck;
      }
    }
    return null;
  }
  
  /**
   * Destroys the popper.
   * @method
   * @memberof Popper
   */
  function destroy() {
    this.state.isDestroyed = true;
  
    // touch DOM only if `applyStyle` modifier is enabled
    if (isModifierEnabled(this.modifiers, 'applyStyle')) {
      this.popper.removeAttribute('x-placement');
      this.popper.style.position = '';
      this.popper.style.top = '';
      this.popper.style.left = '';
      this.popper.style.right = '';
      this.popper.style.bottom = '';
      this.popper.style.willChange = '';
      this.popper.style[getSupportedPropertyName('transform')] = '';
    }
  
    this.disableEventListeners();
  
    // remove the popper if user explicitly asked for the deletion on destroy
    // do not use `remove` because IE11 doesn't support it
    if (this.options.removeOnDestroy) {
      this.popper.parentNode.removeChild(this.popper);
    }
    return this;
  }
  
  /**
   * Get the window associated with the element
   * @argument {Element} element
   * @returns {Window}
   */
  function getWindow(element) {
    var ownerDocument = element.ownerDocument;
    return ownerDocument ? ownerDocument.defaultView : window;
  }
  
  function attachToScrollParents(scrollParent, event, callback, scrollParents) {
    var isBody = scrollParent.nodeName === 'BODY';
    var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
    target.addEventListener(event, callback, { passive: true });
  
    if (!isBody) {
      attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
    }
    scrollParents.push(target);
  }
  
  /**
   * Setup needed event listeners used to update the popper position
   * @method
   * @memberof Popper.Utils
   * @private
   */
  function setupEventListeners(reference, options, state, updateBound) {
    // Resize event listener on window
    state.updateBound = updateBound;
    getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  
    // Scroll event listener on scroll parents
    var scrollElement = getScrollParent(reference);
    attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
    state.scrollElement = scrollElement;
    state.eventsEnabled = true;
  
    return state;
  }
  
  /**
   * It will add resize/scroll events and start recalculating
   * position of the popper element when they are triggered.
   * @method
   * @memberof Popper
   */
  function enableEventListeners() {
    if (!this.state.eventsEnabled) {
      this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
    }
  }
  
  /**
   * Remove event listeners used to update the popper position
   * @method
   * @memberof Popper.Utils
   * @private
   */
  function removeEventListeners(reference, state) {
    // Remove resize event listener on window
    getWindow(reference).removeEventListener('resize', state.updateBound);
  
    // Remove scroll event listener on scroll parents
    state.scrollParents.forEach(function (target) {
      target.removeEventListener('scroll', state.updateBound);
    });
  
    // Reset state
    state.updateBound = null;
    state.scrollParents = [];
    state.scrollElement = null;
    state.eventsEnabled = false;
    return state;
  }
  
  /**
   * It will remove resize/scroll events and won't recalculate popper position
   * when they are triggered. It also won't trigger `onUpdate` callback anymore,
   * unless you call `update` method manually.
   * @method
   * @memberof Popper
   */
  function disableEventListeners() {
    if (this.state.eventsEnabled) {
      cancelAnimationFrame(this.scheduleUpdate);
      this.state = removeEventListeners(this.reference, this.state);
    }
  }
  
  /**
   * Tells if a given input is a number
   * @method
   * @memberof Popper.Utils
   * @param {*} input to check
   * @return {Boolean}
   */
  function isNumeric(n) {
    return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  }
  
  /**
   * Set the style to the given popper
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element - Element to apply the style to
   * @argument {Object} styles
   * Object with a list of properties and values which will be applied to the element
   */
  function setStyles(element, styles) {
    Object.keys(styles).forEach(function (prop) {
      var unit = '';
      // add unit if the value is numeric and is one of the following
      if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
        unit = 'px';
      }
      element.style[prop] = styles[prop] + unit;
    });
  }
  
  /**
   * Set the attributes to the given popper
   * @method
   * @memberof Popper.Utils
   * @argument {Element} element - Element to apply the attributes to
   * @argument {Object} styles
   * Object with a list of properties and values which will be applied to the element
   */
  function setAttributes(element, attributes) {
    Object.keys(attributes).forEach(function (prop) {
      var value = attributes[prop];
      if (value !== false) {
        element.setAttribute(prop, attributes[prop]);
      } else {
        element.removeAttribute(prop);
      }
    });
  }
  
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by `update` method
   * @argument {Object} data.styles - List of style properties - values to apply to popper element
   * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The same data object
   */
  function applyStyle(data) {
    // any property present in `data.styles` will be applied to the popper,
    // in this way we can make the 3rd party modifiers add custom styles to it
    // Be aware, modifiers could override the properties defined in the previous
    // lines of this modifier!
    setStyles(data.instance.popper, data.styles);
  
    // any property present in `data.attributes` will be applied to the popper,
    // they will be set as HTML attributes of the element
    setAttributes(data.instance.popper, data.attributes);
  
    // if arrowElement is defined and arrowStyles has some properties
    if (data.arrowElement && Object.keys(data.arrowStyles).length) {
      setStyles(data.arrowElement, data.arrowStyles);
    }
  
    return data;
  }
  
  /**
   * Set the x-placement attribute before everything else because it could be used
   * to add margins to the popper margins needs to be calculated to get the
   * correct popper offsets.
   * @method
   * @memberof Popper.modifiers
   * @param {HTMLElement} reference - The reference element used to position the popper
   * @param {HTMLElement} popper - The HTML element used as popper
   * @param {Object} options - Popper.js options
   */
  function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
    // compute reference element offsets
    var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  
    // compute auto placement, store placement inside the data object,
    // modifiers will be able to edit `placement` if needed
    // and refer to originalPlacement to know the original value
    var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  
    popper.setAttribute('x-placement', placement);
  
    // Apply `position` to popper before anything else because
    // without the position applied we can't guarantee correct computations
    setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  
    return options;
  }
  
  /**
   * @function
   * @memberof Popper.Utils
   * @argument {Object} data - The data object generated by `update` method
   * @argument {Boolean} shouldRound - If the offsets should be rounded at all
   * @returns {Object} The popper's position offsets rounded
   *
   * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
   * good as it can be within reason.
   * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
   *
   * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
   * as well on High DPI screens).
   *
   * Firefox prefers no rounding for positioning and does not have blurriness on
   * high DPI screens.
   *
   * Only horizontal placement and left/right values need to be considered.
   */
  function getRoundedOffsets(data, shouldRound) {
    var _data$offsets = data.offsets,
        popper = _data$offsets.popper,
        reference = _data$offsets.reference;
    var round = Math.round,
        floor = Math.floor;
  
    var noRound = function noRound(v) {
      return v;
    };
  
    var referenceWidth = round(reference.width);
    var popperWidth = round(popper.width);
  
    var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
    var isVariation = data.placement.indexOf('-') !== -1;
    var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
    var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  
    var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
    var verticalToInteger = !shouldRound ? noRound : round;
  
    return {
      left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
      top: verticalToInteger(popper.top),
      bottom: verticalToInteger(popper.bottom),
      right: horizontalToInteger(popper.right)
    };
  }
  
  var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by `update` method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */
  function computeStyle(data, options) {
    var x = options.x,
        y = options.y;
    var popper = data.offsets.popper;
  
    // Remove this legacy support in Popper.js v2
  
    var legacyGpuAccelerationOption = find$1(data.instance.modifiers, function (modifier) {
      return modifier.name === 'applyStyle';
    }).gpuAcceleration;
    if (legacyGpuAccelerationOption !== undefined) {
      console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
    }
    var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  
    var offsetParent = getOffsetParent(data.instance.popper);
    var offsetParentRect = getBoundingClientRect(offsetParent);
  
    // Styles
    var styles = {
      position: popper.position
    };
  
    var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  
    var sideA = x === 'bottom' ? 'top' : 'bottom';
    var sideB = y === 'right' ? 'left' : 'right';
  
    // if gpuAcceleration is set to `true` and transform is supported,
    //  we use `translate3d` to apply the position to the popper we
    // automatically use the supported prefixed version if needed
    var prefixedProperty = getSupportedPropertyName('transform');
  
    // now, let's make a step back and look at this code closely (wtf?)
    // If the content of the popper grows once it's been positioned, it
    // may happen that the popper gets misplaced because of the new content
    // overflowing its reference element
    // To avoid this problem, we provide two options (x and y), which allow
    // the consumer to define the offset origin.
    // If we position a popper on top of a reference element, we can set
    // `x` to `top` to make the popper grow towards its top instead of
    // its bottom.
    var left = void 0,
        top = void 0;
    if (sideA === 'bottom') {
      // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
      // and not the bottom of the html element
      if (offsetParent.nodeName === 'HTML') {
        top = -offsetParent.clientHeight + offsets.bottom;
      } else {
        top = -offsetParentRect.height + offsets.bottom;
      }
    } else {
      top = offsets.top;
    }
    if (sideB === 'right') {
      if (offsetParent.nodeName === 'HTML') {
        left = -offsetParent.clientWidth + offsets.right;
      } else {
        left = -offsetParentRect.width + offsets.right;
      }
    } else {
      left = offsets.left;
    }
    if (gpuAcceleration && prefixedProperty) {
      styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
      styles[sideA] = 0;
      styles[sideB] = 0;
      styles.willChange = 'transform';
    } else {
      // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
      var invertTop = sideA === 'bottom' ? -1 : 1;
      var invertLeft = sideB === 'right' ? -1 : 1;
      styles[sideA] = top * invertTop;
      styles[sideB] = left * invertLeft;
      styles.willChange = sideA + ', ' + sideB;
    }
  
    // Attributes
    var attributes = {
      'x-placement': data.placement
    };
  
    // Update `data` attributes, styles and arrowStyles
    data.attributes = _extends$2({}, attributes, data.attributes);
    data.styles = _extends$2({}, styles, data.styles);
    data.arrowStyles = _extends$2({}, data.offsets.arrow, data.arrowStyles);
  
    return data;
  }
  
  /**
   * Helper used to know if the given modifier depends from another one.<br />
   * It checks if the needed modifier is listed and enabled.
   * @method
   * @memberof Popper.Utils
   * @param {Array} modifiers - list of modifiers
   * @param {String} requestingName - name of requesting modifier
   * @param {String} requestedName - name of requested modifier
   * @returns {Boolean}
   */
  function isModifierRequired(modifiers, requestingName, requestedName) {
    var requesting = find$1(modifiers, function (_ref) {
      var name = _ref.name;
      return name === requestingName;
    });
  
    var isRequired = !!requesting && modifiers.some(function (modifier) {
      return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
    });
  
    if (!isRequired) {
      var _requesting = '`' + requestingName + '`';
      var requested = '`' + requestedName + '`';
      console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
    }
    return isRequired;
  }
  
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by update method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */
  function arrow(data, options) {
    var _data$offsets$arrow;
  
    // arrow depends on keepTogether in order to work
    if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
      return data;
    }
  
    var arrowElement = options.element;
  
    // if arrowElement is a string, suppose it's a CSS selector
    if (typeof arrowElement === 'string') {
      arrowElement = data.instance.popper.querySelector(arrowElement);
  
      // if arrowElement is not found, don't run the modifier
      if (!arrowElement) {
        return data;
      }
    } else {
      // if the arrowElement isn't a query selector we must check that the
      // provided DOM node is child of its popper node
      if (!data.instance.popper.contains(arrowElement)) {
        console.warn('WARNING: `arrow.element` must be child of its popper element!');
        return data;
      }
    }
  
    var placement = data.placement.split('-')[0];
    var _data$offsets = data.offsets,
        popper = _data$offsets.popper,
        reference = _data$offsets.reference;
  
    var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  
    var len = isVertical ? 'height' : 'width';
    var sideCapitalized = isVertical ? 'Top' : 'Left';
    var side = sideCapitalized.toLowerCase();
    var altSide = isVertical ? 'left' : 'top';
    var opSide = isVertical ? 'bottom' : 'right';
    var arrowElementSize = getOuterSizes(arrowElement)[len];
  
    //
    // extends keepTogether behavior making sure the popper and its
    // reference have enough pixels in conjunction
    //
  
    // top/left side
    if (reference[opSide] - arrowElementSize < popper[side]) {
      data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
    }
    // bottom/right side
    if (reference[side] + arrowElementSize > popper[opSide]) {
      data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
    }
    data.offsets.popper = getClientRect(data.offsets.popper);
  
    // compute center of the popper
    var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  
    // Compute the sideValue using the updated popper offsets
    // take popper margin in account because we don't have this info available
    var css = getStyleComputedProperty(data.instance.popper);
    var popperMarginSide = parseFloat(css['margin' + sideCapitalized]);
    var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width']);
    var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  
    // prevent arrowElement from being placed not contiguously to its popper
    sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  
    data.arrowElement = arrowElement;
    data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty$4(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty$4(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  
    return data;
  }
  
  /**
   * Get the opposite placement variation of the given one
   * @method
   * @memberof Popper.Utils
   * @argument {String} placement variation
   * @returns {String} flipped placement variation
   */
  function getOppositeVariation(variation) {
    if (variation === 'end') {
      return 'start';
    } else if (variation === 'start') {
      return 'end';
    }
    return variation;
  }
  
  /**
   * List of accepted placements to use as values of the `placement` option.<br />
   * Valid placements are:
   * - `auto`
   * - `top`
   * - `right`
   * - `bottom`
   * - `left`
   *
   * Each placement can have a variation from this list:
   * - `-start`
   * - `-end`
   *
   * Variations are interpreted easily if you think of them as the left to right
   * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
   * is right.<br />
   * Vertically (`left` and `right`), `start` is top and `end` is bottom.
   *
   * Some valid examples are:
   * - `top-end` (on top of reference, right aligned)
   * - `right-start` (on right of reference, top aligned)
   * - `bottom` (on bottom, centered)
   * - `auto-end` (on the side with more space available, alignment depends by placement)
   *
   * @static
   * @type {Array}
   * @enum {String}
   * @readonly
   * @method placements
   * @memberof Popper
   */
  var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
  
  // Get rid of `auto` `auto-start` and `auto-end`
  var validPlacements = placements.slice(3);
  
  /**
   * Given an initial placement, returns all the subsequent placements
   * clockwise (or counter-clockwise).
   *
   * @method
   * @memberof Popper.Utils
   * @argument {String} placement - A valid placement (it accepts variations)
   * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
   * @returns {Array} placements including their variations
   */
  function clockwise(placement) {
    var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  
    var index = validPlacements.indexOf(placement);
    var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
    return counter ? arr.reverse() : arr;
  }
  
  var BEHAVIORS = {
    FLIP: 'flip',
    CLOCKWISE: 'clockwise',
    COUNTERCLOCKWISE: 'counterclockwise'
  };
  
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by update method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */
  function flip(data, options) {
    // if `inner` modifier is enabled, we can't use the `flip` modifier
    if (isModifierEnabled(data.instance.modifiers, 'inner')) {
      return data;
    }
  
    if (data.flipped && data.placement === data.originalPlacement) {
      // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
      return data;
    }
  
    var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  
    var placement = data.placement.split('-')[0];
    var placementOpposite = getOppositePlacement(placement);
    var variation = data.placement.split('-')[1] || '';
  
    var flipOrder = [];
  
    switch (options.behavior) {
      case BEHAVIORS.FLIP:
        flipOrder = [placement, placementOpposite];
        break;
      case BEHAVIORS.CLOCKWISE:
        flipOrder = clockwise(placement);
        break;
      case BEHAVIORS.COUNTERCLOCKWISE:
        flipOrder = clockwise(placement, true);
        break;
      default:
        flipOrder = options.behavior;
    }
  
    flipOrder.forEach(function (step, index) {
      if (placement !== step || flipOrder.length === index + 1) {
        return data;
      }
  
      placement = data.placement.split('-')[0];
      placementOpposite = getOppositePlacement(placement);
  
      var popperOffsets = data.offsets.popper;
      var refOffsets = data.offsets.reference;
  
      // using floor because the reference offsets may contain decimals we are not going to consider here
      var floor = Math.floor;
      var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
  
      var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
      var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
      var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
      var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  
      var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  
      // flip the variation if required
      var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  
      // flips variation if reference element overflows boundaries
      var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  
      // flips variation if popper content overflows boundaries
      var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  
      var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  
      if (overlapsRef || overflowsBoundaries || flippedVariation) {
        // this boolean to detect any flip loop
        data.flipped = true;
  
        if (overlapsRef || overflowsBoundaries) {
          placement = flipOrder[index + 1];
        }
  
        if (flippedVariation) {
          variation = getOppositeVariation(variation);
        }
  
        data.placement = placement + (variation ? '-' + variation : '');
  
        // this object contains `position`, we want to preserve it along with
        // any additional property we may add in the future
        data.offsets.popper = _extends$2({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  
        data = runModifiers(data.instance.modifiers, data, 'flip');
      }
    });
    return data;
  }
  
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by update method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */
  function keepTogether(data) {
    var _data$offsets = data.offsets,
        popper = _data$offsets.popper,
        reference = _data$offsets.reference;
  
    var placement = data.placement.split('-')[0];
    var floor = Math.floor;
    var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
    var side = isVertical ? 'right' : 'bottom';
    var opSide = isVertical ? 'left' : 'top';
    var measurement = isVertical ? 'width' : 'height';
  
    if (popper[side] < floor(reference[opSide])) {
      data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
    }
    if (popper[opSide] > floor(reference[side])) {
      data.offsets.popper[opSide] = floor(reference[side]);
    }
  
    return data;
  }
  
  /**
   * Converts a string containing value + unit into a px value number
   * @function
   * @memberof {modifiers~offset}
   * @private
   * @argument {String} str - Value + unit string
   * @argument {String} measurement - `height` or `width`
   * @argument {Object} popperOffsets
   * @argument {Object} referenceOffsets
   * @returns {Number|String}
   * Value in pixels, or original string if no values were extracted
   */
  function toValue(str, measurement, popperOffsets, referenceOffsets) {
    // separate value from unit
    var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
    var value = +split[1];
    var unit = split[2];
  
    // If it's not a number it's an operator, I guess
    if (!value) {
      return str;
    }
  
    if (unit.indexOf('%') === 0) {
      var element = void 0;
      switch (unit) {
        case '%p':
          element = popperOffsets;
          break;
        case '%':
        case '%r':
        default:
          element = referenceOffsets;
      }
  
      var rect = getClientRect(element);
      return rect[measurement] / 100 * value;
    } else if (unit === 'vh' || unit === 'vw') {
      // if is a vh or vw, we calculate the size based on the viewport
      var size = void 0;
      if (unit === 'vh') {
        size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
      } else {
        size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
      }
      return size / 100 * value;
    } else {
      // if is an explicit pixel unit, we get rid of the unit and keep the value
      // if is an implicit unit, it's px, and we return just the value
      return value;
    }
  }
  
  /**
   * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
   * @function
   * @memberof {modifiers~offset}
   * @private
   * @argument {String} offset
   * @argument {Object} popperOffsets
   * @argument {Object} referenceOffsets
   * @argument {String} basePlacement
   * @returns {Array} a two cells array with x and y offsets in numbers
   */
  function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
    var offsets = [0, 0];
  
    // Use height if placement is left or right and index is 0 otherwise use width
    // in this way the first offset will use an axis and the second one
    // will use the other one
    var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  
    // Split the offset string to obtain a list of values and operands
    // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
    var fragments = offset.split(/(\+|\-)/).map(function (frag) {
      return frag.trim();
    });
  
    // Detect if the offset string contains a pair of values or a single one
    // they could be separated by comma or space
    var divider = fragments.indexOf(find$1(fragments, function (frag) {
      return frag.search(/,|\s/) !== -1;
    }));
  
    if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
      console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
    }
  
    // If divider is found, we divide the list of values and operands to divide
    // them by ofset X and Y.
    var splitRegex = /\s*,\s*|\s+/;
    var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
  
    // Convert the values with units to absolute pixels to allow our computations
    ops = ops.map(function (op, index) {
      // Most of the units rely on the orientation of the popper
      var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
      var mergeWithPrevious = false;
      return op
      // This aggregates any `+` or `-` sign that aren't considered operators
      // e.g.: 10 + +5 => [10, +, +5]
      .reduce(function (a, b) {
        if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
          a[a.length - 1] = b;
          mergeWithPrevious = true;
          return a;
        } else if (mergeWithPrevious) {
          a[a.length - 1] += b;
          mergeWithPrevious = false;
          return a;
        } else {
          return a.concat(b);
        }
      }, [])
      // Here we convert the string values into number values (in px)
      .map(function (str) {
        return toValue(str, measurement, popperOffsets, referenceOffsets);
      });
    });
  
    // Loop trough the offsets arrays and execute the operations
    ops.forEach(function (op, index) {
      op.forEach(function (frag, index2) {
        if (isNumeric(frag)) {
          offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
        }
      });
    });
    return offsets;
  }
  
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by update method
   * @argument {Object} options - Modifiers configuration and options
   * @argument {Number|String} options.offset=0
   * The offset value as described in the modifier description
   * @returns {Object} The data object, properly modified
   */
  function offset(data, _ref) {
    var offset = _ref.offset;
    var placement = data.placement,
        _data$offsets = data.offsets,
        popper = _data$offsets.popper,
        reference = _data$offsets.reference;
  
    var basePlacement = placement.split('-')[0];
  
    var offsets = void 0;
    if (isNumeric(+offset)) {
      offsets = [+offset, 0];
    } else {
      offsets = parseOffset(offset, popper, reference, basePlacement);
    }
  
    if (basePlacement === 'left') {
      popper.top += offsets[0];
      popper.left -= offsets[1];
    } else if (basePlacement === 'right') {
      popper.top += offsets[0];
      popper.left += offsets[1];
    } else if (basePlacement === 'top') {
      popper.left += offsets[0];
      popper.top -= offsets[1];
    } else if (basePlacement === 'bottom') {
      popper.left += offsets[0];
      popper.top += offsets[1];
    }
  
    data.popper = popper;
    return data;
  }
  
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by `update` method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */
  function preventOverflow(data, options) {
    var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  
    // If offsetParent is the reference element, we really want to
    // go one step up and use the next offsetParent as reference to
    // avoid to make this modifier completely useless and look like broken
    if (data.instance.reference === boundariesElement) {
      boundariesElement = getOffsetParent(boundariesElement);
    }
  
    // NOTE: DOM access here
    // resets the popper's position so that the document size can be calculated excluding
    // the size of the popper element itself
    var transformProp = getSupportedPropertyName('transform');
    var popperStyles = data.instance.popper.style; // assignment to help minification
    var top = popperStyles.top,
        left = popperStyles.left,
        transform = popperStyles[transformProp];
  
    popperStyles.top = '';
    popperStyles.left = '';
    popperStyles[transformProp] = '';
  
    var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  
    // NOTE: DOM access here
    // restores the original style properties after the offsets have been computed
    popperStyles.top = top;
    popperStyles.left = left;
    popperStyles[transformProp] = transform;
  
    options.boundaries = boundaries;
  
    var order = options.priority;
    var popper = data.offsets.popper;
  
    var check = {
      primary: function primary(placement) {
        var value = popper[placement];
        if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
          value = Math.max(popper[placement], boundaries[placement]);
        }
        return defineProperty$4({}, placement, value);
      },
      secondary: function secondary(placement) {
        var mainSide = placement === 'right' ? 'left' : 'top';
        var value = popper[mainSide];
        if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
          value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
        }
        return defineProperty$4({}, mainSide, value);
      }
    };
  
    order.forEach(function (placement) {
      var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
      popper = _extends$2({}, popper, check[side](placement));
    });
  
    data.offsets.popper = popper;
  
    return data;
  }
  
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by `update` method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */
  function shift(data) {
    var placement = data.placement;
    var basePlacement = placement.split('-')[0];
    var shiftvariation = placement.split('-')[1];
  
    // if shift shiftvariation is specified, run the modifier
    if (shiftvariation) {
      var _data$offsets = data.offsets,
          reference = _data$offsets.reference,
          popper = _data$offsets.popper;
  
      var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
      var side = isVertical ? 'left' : 'top';
      var measurement = isVertical ? 'width' : 'height';
  
      var shiftOffsets = {
        start: defineProperty$4({}, side, reference[side]),
        end: defineProperty$4({}, side, reference[side] + reference[measurement] - popper[measurement])
      };
  
      data.offsets.popper = _extends$2({}, popper, shiftOffsets[shiftvariation]);
    }
  
    return data;
  }
  
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by update method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */
  function hide(data) {
    if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
      return data;
    }
  
    var refRect = data.offsets.reference;
    var bound = find$1(data.instance.modifiers, function (modifier) {
      return modifier.name === 'preventOverflow';
    }).boundaries;
  
    if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
      // Avoid unnecessary DOM access if visibility hasn't changed
      if (data.hide === true) {
        return data;
      }
  
      data.hide = true;
      data.attributes['x-out-of-boundaries'] = '';
    } else {
      // Avoid unnecessary DOM access if visibility hasn't changed
      if (data.hide === false) {
        return data;
      }
  
      data.hide = false;
      data.attributes['x-out-of-boundaries'] = false;
    }
  
    return data;
  }
  
  /**
   * @function
   * @memberof Modifiers
   * @argument {Object} data - The data object generated by `update` method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {Object} The data object, properly modified
   */
  function inner(data) {
    var placement = data.placement;
    var basePlacement = placement.split('-')[0];
    var _data$offsets = data.offsets,
        popper = _data$offsets.popper,
        reference = _data$offsets.reference;
  
    var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  
    var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  
    popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  
    data.placement = getOppositePlacement(placement);
    data.offsets.popper = getClientRect(popper);
  
    return data;
  }
  
  /**
   * Modifier function, each modifier can have a function of this type assigned
   * to its `fn` property.<br />
   * These functions will be called on each update, this means that you must
   * make sure they are performant enough to avoid performance bottlenecks.
   *
   * @function ModifierFn
   * @argument {dataObject} data - The data object generated by `update` method
   * @argument {Object} options - Modifiers configuration and options
   * @returns {dataObject} The data object, properly modified
   */
  
  /**
   * Modifiers are plugins used to alter the behavior of your poppers.<br />
   * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
   * needed by the library.
   *
   * Usually you don't want to override the `order`, `fn` and `onLoad` props.
   * All the other properties are configurations that could be tweaked.
   * @namespace modifiers
   */
  var modifiers = {
    /**
     * Modifier used to shift the popper on the start or end of its reference
     * element.<br />
     * It will read the variation of the `placement` property.<br />
     * It can be one either `-end` or `-start`.
     * @memberof modifiers
     * @inner
     */
    shift: {
      /** @prop {number} order=100 - Index used to define the order of execution */
      order: 100,
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,
      /** @prop {ModifierFn} */
      fn: shift
    },
  
    /**
     * The `offset` modifier can shift your popper on both its axis.
     *
     * It accepts the following units:
     * - `px` or unit-less, interpreted as pixels
     * - `%` or `%r`, percentage relative to the length of the reference element
     * - `%p`, percentage relative to the length of the popper element
     * - `vw`, CSS viewport width unit
     * - `vh`, CSS viewport height unit
     *
     * For length is intended the main axis relative to the placement of the popper.<br />
     * This means that if the placement is `top` or `bottom`, the length will be the
     * `width`. In case of `left` or `right`, it will be the `height`.
     *
     * You can provide a single value (as `Number` or `String`), or a pair of values
     * as `String` divided by a comma or one (or more) white spaces.<br />
     * The latter is a deprecated method because it leads to confusion and will be
     * removed in v2.<br />
     * Additionally, it accepts additions and subtractions between different units.
     * Note that multiplications and divisions aren't supported.
     *
     * Valid examples are:
     * ```
     * 10
     * '10%'
     * '10, 10'
     * '10%, 10'
     * '10 + 10%'
     * '10 - 5vh + 3%'
     * '-10px + 5vh, 5px - 6%'
     * ```
     * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
     * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
     * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
     *
     * @memberof modifiers
     * @inner
     */
    offset: {
      /** @prop {number} order=200 - Index used to define the order of execution */
      order: 200,
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,
      /** @prop {ModifierFn} */
      fn: offset,
      /** @prop {Number|String} offset=0
       * The offset value as described in the modifier description
       */
      offset: 0
    },
  
    /**
     * Modifier used to prevent the popper from being positioned outside the boundary.
     *
     * A scenario exists where the reference itself is not within the boundaries.<br />
     * We can say it has "escaped the boundaries" — or just "escaped".<br />
     * In this case we need to decide whether the popper should either:
     *
     * - detach from the reference and remain "trapped" in the boundaries, or
     * - if it should ignore the boundary and "escape with its reference"
     *
     * When `escapeWithReference` is set to`true` and reference is completely
     * outside its boundaries, the popper will overflow (or completely leave)
     * the boundaries in order to remain attached to the edge of the reference.
     *
     * @memberof modifiers
     * @inner
     */
    preventOverflow: {
      /** @prop {number} order=300 - Index used to define the order of execution */
      order: 300,
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,
      /** @prop {ModifierFn} */
      fn: preventOverflow,
      /**
       * @prop {Array} [priority=['left','right','top','bottom']]
       * Popper will try to prevent overflow following these priorities by default,
       * then, it could overflow on the left and on top of the `boundariesElement`
       */
      priority: ['left', 'right', 'top', 'bottom'],
      /**
       * @prop {number} padding=5
       * Amount of pixel used to define a minimum distance between the boundaries
       * and the popper. This makes sure the popper always has a little padding
       * between the edges of its container
       */
      padding: 5,
      /**
       * @prop {String|HTMLElement} boundariesElement='scrollParent'
       * Boundaries used by the modifier. Can be `scrollParent`, `window`,
       * `viewport` or any DOM element.
       */
      boundariesElement: 'scrollParent'
    },
  
    /**
     * Modifier used to make sure the reference and its popper stay near each other
     * without leaving any gap between the two. Especially useful when the arrow is
     * enabled and you want to ensure that it points to its reference element.
     * It cares only about the first axis. You can still have poppers with margin
     * between the popper and its reference element.
     * @memberof modifiers
     * @inner
     */
    keepTogether: {
      /** @prop {number} order=400 - Index used to define the order of execution */
      order: 400,
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,
      /** @prop {ModifierFn} */
      fn: keepTogether
    },
  
    /**
     * This modifier is used to move the `arrowElement` of the popper to make
     * sure it is positioned between the reference element and its popper element.
     * It will read the outer size of the `arrowElement` node to detect how many
     * pixels of conjunction are needed.
     *
     * It has no effect if no `arrowElement` is provided.
     * @memberof modifiers
     * @inner
     */
    arrow: {
      /** @prop {number} order=500 - Index used to define the order of execution */
      order: 500,
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,
      /** @prop {ModifierFn} */
      fn: arrow,
      /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
      element: '[x-arrow]'
    },
  
    /**
     * Modifier used to flip the popper's placement when it starts to overlap its
     * reference element.
     *
     * Requires the `preventOverflow` modifier before it in order to work.
     *
     * **NOTE:** this modifier will interrupt the current update cycle and will
     * restart it if it detects the need to flip the placement.
     * @memberof modifiers
     * @inner
     */
    flip: {
      /** @prop {number} order=600 - Index used to define the order of execution */
      order: 600,
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,
      /** @prop {ModifierFn} */
      fn: flip,
      /**
       * @prop {String|Array} behavior='flip'
       * The behavior used to change the popper's placement. It can be one of
       * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
       * placements (with optional variations)
       */
      behavior: 'flip',
      /**
       * @prop {number} padding=5
       * The popper will flip if it hits the edges of the `boundariesElement`
       */
      padding: 5,
      /**
       * @prop {String|HTMLElement} boundariesElement='viewport'
       * The element which will define the boundaries of the popper position.
       * The popper will never be placed outside of the defined boundaries
       * (except if `keepTogether` is enabled)
       */
      boundariesElement: 'viewport',
      /**
       * @prop {Boolean} flipVariations=false
       * The popper will switch placement variation between `-start` and `-end` when
       * the reference element overlaps its boundaries.
       *
       * The original placement should have a set variation.
       */
      flipVariations: false,
      /**
       * @prop {Boolean} flipVariationsByContent=false
       * The popper will switch placement variation between `-start` and `-end` when
       * the popper element overlaps its reference boundaries.
       *
       * The original placement should have a set variation.
       */
      flipVariationsByContent: false
    },
  
    /**
     * Modifier used to make the popper flow toward the inner of the reference element.
     * By default, when this modifier is disabled, the popper will be placed outside
     * the reference element.
     * @memberof modifiers
     * @inner
     */
    inner: {
      /** @prop {number} order=700 - Index used to define the order of execution */
      order: 700,
      /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
      enabled: false,
      /** @prop {ModifierFn} */
      fn: inner
    },
  
    /**
     * Modifier used to hide the popper when its reference element is outside of the
     * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
     * be used to hide with a CSS selector the popper when its reference is
     * out of boundaries.
     *
     * Requires the `preventOverflow` modifier before it in order to work.
     * @memberof modifiers
     * @inner
     */
    hide: {
      /** @prop {number} order=800 - Index used to define the order of execution */
      order: 800,
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,
      /** @prop {ModifierFn} */
      fn: hide
    },
  
    /**
     * Computes the style that will be applied to the popper element to gets
     * properly positioned.
     *
     * Note that this modifier will not touch the DOM, it just prepares the styles
     * so that `applyStyle` modifier can apply it. This separation is useful
     * in case you need to replace `applyStyle` with a custom implementation.
     *
     * This modifier has `850` as `order` value to maintain backward compatibility
     * with previous versions of Popper.js. Expect the modifiers ordering method
     * to change in future major versions of the library.
     *
     * @memberof modifiers
     * @inner
     */
    computeStyle: {
      /** @prop {number} order=850 - Index used to define the order of execution */
      order: 850,
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,
      /** @prop {ModifierFn} */
      fn: computeStyle,
      /**
       * @prop {Boolean} gpuAcceleration=true
       * If true, it uses the CSS 3D transformation to position the popper.
       * Otherwise, it will use the `top` and `left` properties
       */
      gpuAcceleration: true,
      /**
       * @prop {string} [x='bottom']
       * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
       * Change this if your popper should grow in a direction different from `bottom`
       */
      x: 'bottom',
      /**
       * @prop {string} [x='left']
       * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
       * Change this if your popper should grow in a direction different from `right`
       */
      y: 'right'
    },
  
    /**
     * Applies the computed styles to the popper element.
     *
     * All the DOM manipulations are limited to this modifier. This is useful in case
     * you want to integrate Popper.js inside a framework or view library and you
     * want to delegate all the DOM manipulations to it.
     *
     * Note that if you disable this modifier, you must make sure the popper element
     * has its position set to `absolute` before Popper.js can do its work!
     *
     * Just disable this modifier and define your own to achieve the desired effect.
     *
     * @memberof modifiers
     * @inner
     */
    applyStyle: {
      /** @prop {number} order=900 - Index used to define the order of execution */
      order: 900,
      /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
      enabled: true,
      /** @prop {ModifierFn} */
      fn: applyStyle,
      /** @prop {Function} */
      onLoad: applyStyleOnLoad,
      /**
       * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
       * @prop {Boolean} gpuAcceleration=true
       * If true, it uses the CSS 3D transformation to position the popper.
       * Otherwise, it will use the `top` and `left` properties
       */
      gpuAcceleration: undefined
    }
  };
  
  /**
   * The `dataObject` is an object containing all the information used by Popper.js.
   * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
   * @name dataObject
   * @property {Object} data.instance The Popper.js instance
   * @property {String} data.placement Placement applied to popper
   * @property {String} data.originalPlacement Placement originally defined on init
   * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
   * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
   * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
   * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
   * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
   * @property {Object} data.boundaries Offsets of the popper boundaries
   * @property {Object} data.offsets The measurements of popper, reference and arrow elements
   * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
   * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
   * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
   */
  
  /**
   * Default options provided to Popper.js constructor.<br />
   * These can be overridden using the `options` argument of Popper.js.<br />
   * To override an option, simply pass an object with the same
   * structure of the `options` object, as the 3rd argument. For example:
   * ```
   * new Popper(ref, pop, {
   *   modifiers: {
   *     preventOverflow: { enabled: false }
   *   }
   * })
   * ```
   * @type {Object}
   * @static
   * @memberof Popper
   */
  var Defaults = {
    /**
     * Popper's placement.
     * @prop {Popper.placements} placement='bottom'
     */
    placement: 'bottom',
  
    /**
     * Set this to true if you want popper to position it self in 'fixed' mode
     * @prop {Boolean} positionFixed=false
     */
    positionFixed: false,
  
    /**
     * Whether events (resize, scroll) are initially enabled.
     * @prop {Boolean} eventsEnabled=true
     */
    eventsEnabled: true,
  
    /**
     * Set to true if you want to automatically remove the popper when
     * you call the `destroy` method.
     * @prop {Boolean} removeOnDestroy=false
     */
    removeOnDestroy: false,
  
    /**
     * Callback called when the popper is created.<br />
     * By default, it is set to no-op.<br />
     * Access Popper.js instance with `data.instance`.
     * @prop {onCreate}
     */
    onCreate: function onCreate() {},
  
    /**
     * Callback called when the popper is updated. This callback is not called
     * on the initialization/creation of the popper, but only on subsequent
     * updates.<br />
     * By default, it is set to no-op.<br />
     * Access Popper.js instance with `data.instance`.
     * @prop {onUpdate}
     */
    onUpdate: function onUpdate() {},
  
    /**
     * List of modifiers used to modify the offsets before they are applied to the popper.
     * They provide most of the functionalities of Popper.js.
     * @prop {modifiers}
     */
    modifiers: modifiers
  };
  
  /**
   * @callback onCreate
   * @param {dataObject} data
   */
  
  /**
   * @callback onUpdate
   * @param {dataObject} data
   */
  
  // Utils
  // Methods
  var Popper = function () {
    /**
     * Creates a new Popper.js instance.
     * @class Popper
     * @param {Element|referenceObject} reference - The reference element used to position the popper
     * @param {Element} popper - The HTML / XML element used as the popper
     * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
     * @return {Object} instance - The generated Popper.js instance
     */
    function Popper(reference, popper) {
      var _this = this;
  
      var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
      classCallCheck$1(this, Popper);
  
      this.scheduleUpdate = function () {
        return requestAnimationFrame(_this.update);
      };
  
      // make update() debounced, so that it only runs at most once-per-tick
      this.update = debounce(this.update.bind(this));
  
      // with {} we create a new object with the options inside it
      this.options = _extends$2({}, Popper.Defaults, options);
  
      // init state
      this.state = {
        isDestroyed: false,
        isCreated: false,
        scrollParents: []
      };
  
      // get reference and popper elements (allow jQuery wrappers)
      this.reference = reference && reference.jquery ? reference[0] : reference;
      this.popper = popper && popper.jquery ? popper[0] : popper;
  
      // Deep merge modifiers options
      this.options.modifiers = {};
      Object.keys(_extends$2({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
        _this.options.modifiers[name] = _extends$2({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
      });
  
      // Refactoring modifiers' list (Object => Array)
      this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
        return _extends$2({
          name: name
        }, _this.options.modifiers[name]);
      })
      // sort the modifiers by order
      .sort(function (a, b) {
        return a.order - b.order;
      });
  
      // modifiers have the ability to execute arbitrary code when Popper.js get inited
      // such code is executed in the same order of its modifier
      // they could add new properties to their options configuration
      // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
      this.modifiers.forEach(function (modifierOptions) {
        if (modifierOptions.enabled && isFunction$1(modifierOptions.onLoad)) {
          modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
        }
      });
  
      // fire the first update to position the popper in the right place
      this.update();
  
      var eventsEnabled = this.options.eventsEnabled;
      if (eventsEnabled) {
        // setup event listeners, they will take care of update the position in specific situations
        this.enableEventListeners();
      }
  
      this.state.eventsEnabled = eventsEnabled;
    }
  
    // We can't use class properties because they don't get listed in the
    // class prototype and break stuff like Sinon stubs
  
  
    createClass$1(Popper, [{
      key: 'update',
      value: function update$$1() {
        return update.call(this);
      }
    }, {
      key: 'destroy',
      value: function destroy$$1() {
        return destroy.call(this);
      }
    }, {
      key: 'enableEventListeners',
      value: function enableEventListeners$$1() {
        return enableEventListeners.call(this);
      }
    }, {
      key: 'disableEventListeners',
      value: function disableEventListeners$$1() {
        return disableEventListeners.call(this);
      }
  
      /**
       * Schedules an update. It will run on the next UI update available.
       * @method scheduleUpdate
       * @memberof Popper
       */
  
  
      /**
       * Collection of utilities useful when writing custom modifiers.
       * Starting from version 1.7, this method is available only if you
       * include `popper-utils.js` before `popper.js`.
       *
       * **DEPRECATION**: This way to access PopperUtils is deprecated
       * and will be removed in v2! Use the PopperUtils module directly instead.
       * Due to the high instability of the methods contained in Utils, we can't
       * guarantee them to follow semver. Use them at your own risk!
       * @static
       * @private
       * @type {Object}
       * @deprecated since version 1.8
       * @member Utils
       * @memberof Popper
       */
  
    }]);
    return Popper;
  }();
  
  /**
   * The `referenceObject` is an object that provides an interface compatible with Popper.js
   * and lets you use it as replacement of a real DOM node.<br />
   * You can use this method to position a popper relatively to a set of coordinates
   * in case you don't have a DOM node to use as reference.
   *
   * ```
   * new Popper(referenceObject, popperNode);
   * ```
   *
   * NB: This feature isn't supported in Internet Explorer 10.
   * @name referenceObject
   * @property {Function} data.getBoundingClientRect
   * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
   * @property {number} data.clientWidth
   * An ES6 getter that will return the width of the virtual reference element.
   * @property {number} data.clientHeight
   * An ES6 getter that will return the height of the virtual reference element.
   */
  
  
  Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  Popper.placements = placements;
  Popper.Defaults = Defaults;
  
  var key = '__global_unique_id__';
  
  var gud = function() {
    return commonjsGlobal[key] = (commonjsGlobal[key] || 0) + 1;
  };
  
  /**
   * Copyright (c) 2014-present, Facebook, Inc.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   */
  
  /**
   * Similar to invariant but only logs a warning if the condition is not met.
   * This can be used to log issues in development environments in critical
   * paths. Removing the logging code for production environments will keep the
   * same logic and follow the same code paths.
   */
  
  var __DEV__ = process.env.NODE_ENV !== 'production';
  
  var warning = function() {};
  
  if (__DEV__) {
    var printWarning = function printWarning(format, args) {
      var len = arguments.length;
      args = new Array(len > 1 ? len - 1 : 0);
      for (var key = 1; key < len; key++) {
        args[key - 1] = arguments[key];
      }
      var argIndex = 0;
      var message = 'Warning: ' +
        format.replace(/%s/g, function() {
          return args[argIndex++];
        });
      if (typeof console !== 'undefined') {
        console.error(message);
      }
      try {
        // --- Welcome to debugging React ---
        // This error was thrown as a convenience so that you can use this stack
        // to find the callsite that caused this warning to fire.
        throw new Error(message);
      } catch (x) {}
    };
  
    warning = function(condition, format, args) {
      var len = arguments.length;
      args = new Array(len > 2 ? len - 2 : 0);
      for (var key = 2; key < len; key++) {
        args[key - 2] = arguments[key];
      }
      if (format === undefined) {
        throw new Error(
            '`warning(condition, format, ...args)` requires a warning ' +
            'message argument'
        );
      }
      if (!condition) {
        printWarning.apply(null, [format].concat(args));
      }
    };
  }
  
  var warning_1 = warning;
  
  var implementation$4 = createCommonjsModule(function (module, exports) {
  
  exports.__esModule = true;
  
  
  
  var _react2 = _interopRequireDefault(React__default);
  
  
  
  var _propTypes2 = _interopRequireDefault(PropTypes);
  
  
  
  var _gud2 = _interopRequireDefault(gud);
  
  
  
  var _warning2 = _interopRequireDefault(warning_1);
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  
  var MAX_SIGNED_31_BIT_INT = 1073741823;
  
  // Inlined Object.is polyfill.
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
  function objectIs(x, y) {
    if (x === y) {
      return x !== 0 || 1 / x === 1 / y;
    } else {
      return x !== x && y !== y;
    }
  }
  
  function createEventEmitter(value) {
    var handlers = [];
    return {
      on: function on(handler) {
        handlers.push(handler);
      },
      off: function off(handler) {
        handlers = handlers.filter(function (h) {
          return h !== handler;
        });
      },
      get: function get() {
        return value;
      },
      set: function set(newValue, changedBits) {
        value = newValue;
        handlers.forEach(function (handler) {
          return handler(value, changedBits);
        });
      }
    };
  }
  
  function onlyChild(children) {
    return Array.isArray(children) ? children[0] : children;
  }
  
  function createReactContext(defaultValue, calculateChangedBits) {
    var _Provider$childContex, _Consumer$contextType;
  
    var contextProp = '__create-react-context-' + (0, _gud2.default)() + '__';
  
    var Provider = function (_Component) {
      _inherits(Provider, _Component);
  
      function Provider() {
        var _temp, _this, _ret;
  
        _classCallCheck(this, Provider);
  
        for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
          args[_key] = arguments[_key];
        }
  
        return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.emitter = createEventEmitter(_this.props.value), _temp), _possibleConstructorReturn(_this, _ret);
      }
  
      Provider.prototype.getChildContext = function getChildContext() {
        var _ref;
  
        return _ref = {}, _ref[contextProp] = this.emitter, _ref;
      };
  
      Provider.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
        if (this.props.value !== nextProps.value) {
          var oldValue = this.props.value;
          var newValue = nextProps.value;
          var changedBits = void 0;
  
          if (objectIs(oldValue, newValue)) {
            changedBits = 0; // No change
          } else {
            changedBits = typeof calculateChangedBits === 'function' ? calculateChangedBits(oldValue, newValue) : MAX_SIGNED_31_BIT_INT;
            if (process.env.NODE_ENV !== 'production') {
              (0, _warning2.default)((changedBits & MAX_SIGNED_31_BIT_INT) === changedBits, 'calculateChangedBits: Expected the return value to be a ' + '31-bit integer. Instead received: %s', changedBits);
            }
  
            changedBits |= 0;
  
            if (changedBits !== 0) {
              this.emitter.set(nextProps.value, changedBits);
            }
          }
        }
      };
  
      Provider.prototype.render = function render() {
        return this.props.children;
      };
  
      return Provider;
    }(React__default.Component);
  
    Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[contextProp] = _propTypes2.default.object.isRequired, _Provider$childContex);
  
    var Consumer = function (_Component2) {
      _inherits(Consumer, _Component2);
  
      function Consumer() {
        var _temp2, _this2, _ret2;
  
        _classCallCheck(this, Consumer);
  
        for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
          args[_key2] = arguments[_key2];
        }
  
        return _ret2 = (_temp2 = (_this2 = _possibleConstructorReturn(this, _Component2.call.apply(_Component2, [this].concat(args))), _this2), _this2.state = {
          value: _this2.getValue()
        }, _this2.onUpdate = function (newValue, changedBits) {
          var observedBits = _this2.observedBits | 0;
          if ((observedBits & changedBits) !== 0) {
            _this2.setState({ value: _this2.getValue() });
          }
        }, _temp2), _possibleConstructorReturn(_this2, _ret2);
      }
  
      Consumer.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
        var observedBits = nextProps.observedBits;
  
        this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT // Subscribe to all changes by default
        : observedBits;
      };
  
      Consumer.prototype.componentDidMount = function componentDidMount() {
        if (this.context[contextProp]) {
          this.context[contextProp].on(this.onUpdate);
        }
        var observedBits = this.props.observedBits;
  
        this.observedBits = observedBits === undefined || observedBits === null ? MAX_SIGNED_31_BIT_INT // Subscribe to all changes by default
        : observedBits;
      };
  
      Consumer.prototype.componentWillUnmount = function componentWillUnmount() {
        if (this.context[contextProp]) {
          this.context[contextProp].off(this.onUpdate);
        }
      };
  
      Consumer.prototype.getValue = function getValue() {
        if (this.context[contextProp]) {
          return this.context[contextProp].get();
        } else {
          return defaultValue;
        }
      };
  
      Consumer.prototype.render = function render() {
        return onlyChild(this.props.children)(this.state.value);
      };
  
      return Consumer;
    }(React__default.Component);
  
    Consumer.contextTypes = (_Consumer$contextType = {}, _Consumer$contextType[contextProp] = _propTypes2.default.object, _Consumer$contextType);
  
  
    return {
      Provider: Provider,
      Consumer: Consumer
    };
  }
  
  exports.default = createReactContext;
  module.exports = exports['default'];
  });
  
  var implementation$5 = unwrapExports(implementation$4);
  
  var implementation$6 = /*#__PURE__*/Object.freeze({
    default: implementation$5,
    __moduleExports: implementation$4
  });
  
  var _implementation = ( implementation$6 && implementation$5 ) || implementation$6;
  
  var lib = createCommonjsModule(function (module, exports) {
  
  exports.__esModule = true;
  
  
  
  var _react2 = _interopRequireDefault(React__default);
  
  
  
  var _implementation2 = _interopRequireDefault(_implementation);
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  exports.default = _react2.default.createContext || _implementation2.default;
  module.exports = exports['default'];
  });
  
  var createContext = unwrapExports(lib);
  
  var ManagerReferenceNodeContext = createContext();
  var ManagerReferenceNodeSetterContext = createContext();
  
  var Manager =
  /*#__PURE__*/
  function (_React$Component) {
    _inheritsLoose$1(Manager, _React$Component);
  
    function Manager() {
      var _this;
  
      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
  
      _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
  
      _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "referenceNode", void 0);
  
      _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "setReferenceNode", function (newReferenceNode) {
        if (newReferenceNode && _this.referenceNode !== newReferenceNode) {
          _this.referenceNode = newReferenceNode;
  
          _this.forceUpdate();
        }
      });
  
      return _this;
    }
  
    var _proto = Manager.prototype;
  
    _proto.componentWillUnmount = function componentWillUnmount() {
      this.referenceNode = null;
    };
  
    _proto.render = function render() {
      return React.createElement(ManagerReferenceNodeContext.Provider, {
        value: this.referenceNode
      }, React.createElement(ManagerReferenceNodeSetterContext.Provider, {
        value: this.setReferenceNode
      }, this.props.children));
    };
  
    return Manager;
  }(React.Component);
  
  /**
   * Takes an argument and if it's an array, returns the first item in the array,
   * otherwise returns the argument. Used for Preact compatibility.
   */
  var unwrapArray = function unwrapArray(arg) {
    return Array.isArray(arg) ? arg[0] : arg;
  };
  /**
   * Takes a maybe-undefined function and arbitrary args and invokes the function
   * only if it is defined.
   */
  
  var safeInvoke = function safeInvoke(fn) {
    if (typeof fn === "function") {
      for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
        args[_key - 1] = arguments[_key];
      }
  
      return fn.apply(void 0, args);
    }
  };
  /**
   * Does a shallow equality check of two objects by comparing the reference
   * equality of each value.
   */
  
  var shallowEqual = function shallowEqual(objA, objB) {
    var aKeys = Object.keys(objA);
    var bKeys = Object.keys(objB);
  
    if (bKeys.length !== aKeys.length) {
      return false;
    }
  
    for (var i = 0; i < bKeys.length; i++) {
      var key = aKeys[i];
  
      if (objA[key] !== objB[key]) {
        return false;
      }
    }
  
    return true;
  };
  /**
   * Sets a ref using either a ref callback or a ref object
   */
  
  var setRef = function setRef(ref, node) {
    // if its a function call it
    if (typeof ref === "function") {
      return safeInvoke(ref, node);
    } // otherwise we should treat it as a ref object
    else if (ref != null) {
        ref.current = node;
      }
  };
  
  var initialStyle = {
    position: 'absolute',
    top: 0,
    left: 0,
    opacity: 0,
    pointerEvents: 'none'
  };
  var initialArrowStyle = {};
  var InnerPopper =
  /*#__PURE__*/
  function (_React$Component) {
    _inheritsLoose$1(InnerPopper, _React$Component);
  
    function InnerPopper() {
      var _this;
  
      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
  
      _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
  
      _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "state", {
        data: undefined,
        placement: undefined
      });
  
      _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "popperInstance", void 0);
  
      _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "popperNode", null);
  
      _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "arrowNode", null);
  
      _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "setPopperNode", function (popperNode) {
        if (!popperNode || _this.popperNode === popperNode) return;
        setRef(_this.props.innerRef, popperNode);
        _this.popperNode = popperNode;
  
        _this.updatePopperInstance();
      });
  
      _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "setArrowNode", function (arrowNode) {
        _this.arrowNode = arrowNode;
      });
  
      _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "updateStateModifier", {
        enabled: true,
        order: 900,
        fn: function fn(data) {
          var placement = data.placement;
  
          _this.setState({
            data: data,
            placement: placement
          });
  
          return data;
        }
      });
  
      _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getOptions", function () {
        return {
          placement: _this.props.placement,
          eventsEnabled: _this.props.eventsEnabled,
          positionFixed: _this.props.positionFixed,
          modifiers: _extends$1({}, _this.props.modifiers, {
            arrow: _extends$1({}, _this.props.modifiers && _this.props.modifiers.arrow, {
              enabled: !!_this.arrowNode,
              element: _this.arrowNode
            }),
            applyStyle: {
              enabled: false
            },
            updateStateModifier: _this.updateStateModifier
          })
        };
      });
  
      _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getPopperStyle", function () {
        return !_this.popperNode || !_this.state.data ? initialStyle : _extends$1({
          position: _this.state.data.offsets.popper.position
        }, _this.state.data.styles);
      });
  
      _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getPopperPlacement", function () {
        return !_this.state.data ? undefined : _this.state.placement;
      });
  
      _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getArrowStyle", function () {
        return !_this.arrowNode || !_this.state.data ? initialArrowStyle : _this.state.data.arrowStyles;
      });
  
      _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "getOutOfBoundariesState", function () {
        return _this.state.data ? _this.state.data.hide : undefined;
      });
  
      _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "destroyPopperInstance", function () {
        if (!_this.popperInstance) return;
  
        _this.popperInstance.destroy();
  
        _this.popperInstance = null;
      });
  
      _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "updatePopperInstance", function () {
        _this.destroyPopperInstance();
  
        var _assertThisInitialize = _assertThisInitialized(_assertThisInitialized(_this)),
            popperNode = _assertThisInitialize.popperNode;
  
        var referenceElement = _this.props.referenceElement;
        if (!referenceElement || !popperNode) return;
        _this.popperInstance = new Popper(referenceElement, popperNode, _this.getOptions());
      });
  
      _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "scheduleUpdate", function () {
        if (_this.popperInstance) {
          _this.popperInstance.scheduleUpdate();
        }
      });
  
      return _this;
    }
  
    var _proto = InnerPopper.prototype;
  
    _proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
      // If the Popper.js options have changed, update the instance (destroy + create)
      if (this.props.placement !== prevProps.placement || this.props.referenceElement !== prevProps.referenceElement || this.props.positionFixed !== prevProps.positionFixed || !deepEqual_1(this.props.modifiers, prevProps.modifiers, {
        strict: true
      })) {
        // develop only check that modifiers isn't being updated needlessly
        if (process.env.NODE_ENV === "development") {
          if (this.props.modifiers !== prevProps.modifiers && this.props.modifiers != null && prevProps.modifiers != null && shallowEqual(this.props.modifiers, prevProps.modifiers)) {
            console.warn("'modifiers' prop reference updated even though all values appear the same.\nConsider memoizing the 'modifiers' object to avoid needless rendering.");
          }
        }
  
        this.updatePopperInstance();
      } else if (this.props.eventsEnabled !== prevProps.eventsEnabled && this.popperInstance) {
        this.props.eventsEnabled ? this.popperInstance.enableEventListeners() : this.popperInstance.disableEventListeners();
      } // A placement difference in state means popper determined a new placement
      // apart from the props value. By the time the popper element is rendered with
      // the new position Popper has already measured it, if the place change triggers
      // a size change it will result in a misaligned popper. So we schedule an update to be sure.
  
  
      if (prevState.placement !== this.state.placement) {
        this.scheduleUpdate();
      }
    };
  
    _proto.componentWillUnmount = function componentWillUnmount() {
      setRef(this.props.innerRef, null);
      this.destroyPopperInstance();
    };
  
    _proto.render = function render() {
      return unwrapArray(this.props.children)({
        ref: this.setPopperNode,
        style: this.getPopperStyle(),
        placement: this.getPopperPlacement(),
        outOfBoundaries: this.getOutOfBoundariesState(),
        scheduleUpdate: this.scheduleUpdate,
        arrowProps: {
          ref: this.setArrowNode,
          style: this.getArrowStyle()
        }
      });
    };
  
    return InnerPopper;
  }(React.Component);
  
  _defineProperty(InnerPopper, "defaultProps", {
    placement: 'bottom',
    eventsEnabled: true,
    referenceElement: undefined,
    positionFixed: false
  });
  function Popper$1(_ref) {
    var referenceElement = _ref.referenceElement,
        props = _objectWithoutPropertiesLoose(_ref, ["referenceElement"]);
  
    return React.createElement(ManagerReferenceNodeContext.Consumer, null, function (referenceNode) {
      return React.createElement(InnerPopper, _extends$1({
        referenceElement: referenceElement !== undefined ? referenceElement : referenceNode
      }, props));
    });
  }
  
  var InnerReference =
  /*#__PURE__*/
  function (_React$Component) {
    _inheritsLoose$1(InnerReference, _React$Component);
  
    function InnerReference() {
      var _this;
  
      for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
        args[_key] = arguments[_key];
      }
  
      _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
  
      _defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "refHandler", function (node) {
        setRef(_this.props.innerRef, node);
        safeInvoke(_this.props.setReferenceNode, node);
      });
  
      return _this;
    }
  
    var _proto = InnerReference.prototype;
  
    _proto.componentWillUnmount = function componentWillUnmount() {
      setRef(this.props.innerRef, null);
    };
  
    _proto.render = function render() {
      warning_1(Boolean(this.props.setReferenceNode), '`Reference` should not be used outside of a `Manager` component.');
      return unwrapArray(this.props.children)({
        ref: this.refHandler
      });
    };
  
    return InnerReference;
  }(React.Component);
  
  function Reference(props) {
    return React.createElement(ManagerReferenceNodeSetterContext.Consumer, null, function (setReferenceNode) {
      return React.createElement(InnerReference, _extends$1({
        setReferenceNode: setReferenceNode
      }, props));
    });
  }
  
  // Public components
   // Public types
  
  var popperPlacementPositions = ["bottom", "bottom-end", "bottom-start", "left", "left-end", "left-start", "right", "right-end", "right-start", "top", "top-end", "top-start"];
  
  var PopperComponent = function (_React$Component) {
    inherits(PopperComponent, _React$Component);
  
    function PopperComponent() {
      classCallCheck(this, PopperComponent);
      return possibleConstructorReturn(this, _React$Component.apply(this, arguments));
    }
  
    PopperComponent.prototype.render = function render() {
      var _props = this.props,
          className = _props.className,
          hidePopper = _props.hidePopper,
          popperComponent = _props.popperComponent,
          popperModifiers = _props.popperModifiers,
          popperPlacement = _props.popperPlacement,
          popperProps = _props.popperProps,
          targetComponent = _props.targetComponent;
  
  
      var popper = void 0;
  
      if (!hidePopper) {
        var classes = classnames("react-datepicker-popper", className);
        popper = React__default.createElement(
          Popper$1,
          _extends({
            modifiers: popperModifiers,
            placement: popperPlacement
          }, popperProps),
          function (_ref) {
            var ref = _ref.ref,
                style = _ref.style,
                placement = _ref.placement,
                arrowProps = _ref.arrowProps;
            return React__default.createElement(
              "div",
              _extends({ ref: ref, style: style }, {
                className: classes,
                "data-placement": placement
              }),
              React__default.cloneElement(popperComponent, { arrowProps: arrowProps })
            );
          }
        );
      }
  
      if (this.props.popperContainer) {
        popper = React__default.createElement(this.props.popperContainer, {}, popper);
      }
  
      return React__default.createElement(
        Manager,
        null,
        React__default.createElement(
          Reference,
          null,
          function (_ref2) {
            var ref = _ref2.ref;
            return React__default.createElement(
              "div",
              { ref: ref, className: "react-datepicker-wrapper" },
              targetComponent
            );
          }
        ),
        popper
      );
    };
  
    createClass(PopperComponent, null, [{
      key: "defaultProps",
      get: function get$$1() {
        return {
          hidePopper: true,
          popperModifiers: {
            preventOverflow: {
              enabled: true,
              escapeWithReference: true,
              boundariesElement: "viewport"
            }
          },
          popperProps: {},
          popperPlacement: "bottom-start"
        };
      }
    }]);
    return PopperComponent;
  }(React__default.Component);
  
  PopperComponent.propTypes = {
    className: PropTypes.string,
    hidePopper: PropTypes.bool,
    popperComponent: PropTypes.element,
    popperModifiers: PropTypes.object, // <datepicker/> props
    popperPlacement: PropTypes.oneOf(popperPlacementPositions), // <datepicker/> props
    popperContainer: PropTypes.func,
    popperProps: PropTypes.object,
    targetComponent: PropTypes.element
  };
  
  var outsideClickIgnoreClass = "react-datepicker-ignore-onclickoutside";
  var WrappedCalendar = onClickOutsideHOC(Calendar);
  
  // Compares dates year+month combinations
  function hasPreSelectionChanged(date1, date2) {
    if (date1 && date2) {
      return getMonth(date1) !== getMonth(date2) || getYear(date1) !== getYear(date2);
    }
  
    return date1 !== date2;
  }
  
  function hasSelectionChanged(date1, date2) {
    if (date1 && date2) {
      return !equals(date1, date2);
    }
  
    return false;
  }
  
  /**
   * General datepicker component.
   */
  var INPUT_ERR_1 = "Date input not valid.";
  
  var DatePicker = function (_React$Component) {
    inherits(DatePicker, _React$Component);
    createClass(DatePicker, null, [{
      key: "defaultProps",
      get: function get$$1() {
        return {
          allowSameDay: false,
          dateFormat: "L",
          dateFormatCalendar: "MMMM YYYY",
          onChange: function onChange() {},
  
          disabled: false,
          disabledKeyboardNavigation: false,
          dropdownMode: "scroll",
          onFocus: function onFocus() {},
          onBlur: function onBlur() {},
          onKeyDown: function onKeyDown() {},
          onInputClick: function onInputClick() {},
          onSelect: function onSelect() {},
          onClickOutside: function onClickOutside() {},
          onMonthChange: function onMonthChange() {},
  
          preventOpenOnFocus: false,
          onYearChange: function onYearChange() {},
          onInputError: function onInputError() {},
  
          monthsShown: 1,
          readOnly: false,
          withPortal: false,
          shouldCloseOnSelect: true,
          showTimeSelect: false,
          timeIntervals: 30,
          timeCaption: "Time",
          previousMonthButtonLabel: "Previous Month",
          nextMonthButtonLabel: "Next month",
          renderDayContents: function renderDayContents(date) {
            return date;
          },
  
          strictParsing: false
        };
      }
    }]);
  
    function DatePicker(props) {
      classCallCheck(this, DatePicker);
  
      var _this = possibleConstructorReturn(this, _React$Component.call(this, props));
  
      _this.getPreSelection = function () {
        return _this.props.openToDate ? newDate(_this.props.openToDate) : _this.props.selectsEnd && _this.props.startDate ? newDate(_this.props.startDate) : _this.props.selectsStart && _this.props.endDate ? newDate(_this.props.endDate) : now(_this.props.utcOffset);
      };
  
      _this.calcInitialState = function () {
        var defaultPreSelection = _this.getPreSelection();
        var minDate = getEffectiveMinDate(_this.props);
        var maxDate = getEffectiveMaxDate(_this.props);
        var boundedPreSelection = minDate && isBefore(defaultPreSelection, minDate) ? minDate : maxDate && isAfter(defaultPreSelection, maxDate) ? maxDate : defaultPreSelection;
        return {
          open: _this.props.startOpen || false,
          preventFocus: false,
          preSelection: _this.props.selected ? newDate(_this.props.selected) : boundedPreSelection,
          // transforming highlighted days (perhaps nested array)
          // to flat Map for faster access in day.jsx
          highlightDates: getHightLightDaysMap(_this.props.highlightDates),
          focused: false,
          // We attempt to handle focus trap activation manually,
          // but that is not possible with custom inputs like buttons.
          // Err on the side of a11y and trap focus when we can't be certain
          // that the trigger comoponent will work with our keyDown logic.
          enableFocusTrap: _this.props.customInput && _this.props.customInput.type !== 'input' ? true : false
        };
      };
  
      _this.clearPreventFocusTimeout = function () {
        if (_this.preventFocusTimeout) {
          clearTimeout(_this.preventFocusTimeout);
        }
      };
  
      _this.setFocus = function () {
        if (_this.input && _this.input.focus) {
          _this.input.focus();
        }
      };
  
      _this.setBlur = function () {
        if (_this.input && _this.input.blur) {
          _this.input.blur();
        }
  
        if (_this.props.onBlur) {
          _this.props.onBlur();
        }
  
        _this.cancelFocusInput();
      };
  
      _this.setOpen = function (open) {
        var skipSetBlur = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  
        _this.setState({
          open: open,
          preSelection: open && _this.state.open ? _this.state.preSelection : _this.calcInitialState().preSelection,
          lastPreSelectChange: PRESELECT_CHANGE_VIA_NAVIGATE
        }, function () {
          if (!open) {
            _this.setState(function (prev) {
              return {
                focused: skipSetBlur ? prev.focused : false,
                enableFocusTrap: skipSetBlur ? false : prev.enableFocusTrap
              };
            }, function () {
              !skipSetBlur && _this.setBlur();
  
              _this.setState({ inputValue: null });
            });
          }
        });
      };
  
      _this.inputOk = function () {
        return isMoment(_this.state.preSelection) || isDate(_this.state.preSelection);
      };
  
      _this.isCalendarOpen = function () {
        return _this.props.open === undefined ? _this.state.open && !_this.props.disabled && !_this.props.readOnly : _this.props.open;
      };
  
      _this.handleFocus = function (event) {
        if (!_this.state.preventFocus) {
          _this.props.onFocus(event);
          if (!_this.props.preventOpenOnFocus && !_this.props.readOnly) {
            _this.setOpen(true);
          }
        }
        _this.setState({ focused: true });
      };
  
      _this.cancelFocusInput = function () {
        clearTimeout(_this.inputFocusTimeout);
        _this.inputFocusTimeout = null;
      };
  
      _this.deferFocusInput = function () {
        _this.cancelFocusInput();
        _this.inputFocusTimeout = setTimeout(function () {
          return _this.setFocus();
        }, 1);
      };
  
      _this.handleDropdownFocus = function () {
        _this.cancelFocusInput();
      };
  
      _this.handleBlur = function (event) {
        if (_this.props.accessibleMode === true) {
          // allow normal de-focusing in a11y mode
          return;
        }
  
        if (_this.state.open && !_this.props.withPortal) {
          _this.deferFocusInput();
        } else {
          _this.props.onBlur(event);
        }
        _this.setState({ focused: false });
      };
  
      _this.handleCalendarClickOutside = function (event) {
        if (!_this.props.inline) {
          _this.setOpen(false);
        }
        _this.props.onClickOutside(event);
        if (_this.props.withPortal) {
          event.preventDefault();
        }
      };
  
      _this.handleChange = function () {
        for (var _len = arguments.length, allArgs = Array(_len), _key = 0; _key < _len; _key++) {
          allArgs[_key] = arguments[_key];
        }
  
        var event = allArgs[0];
        if (_this.props.onChangeRaw) {
          _this.props.onChangeRaw.apply(_this, allArgs);
          if (typeof event.isDefaultPrevented !== "function" || event.isDefaultPrevented()) {
            return;
          }
        }
        _this.setState({
          inputValue: event.target.value,
          lastPreSelectChange: PRESELECT_CHANGE_VIA_INPUT
        });
        var date = parseDate(event.target.value, _this.props);
        if (date || !event.target.value) {
          _this.setSelected(date, event, true);
        }
      };
  
      _this.handleSelect = function (date, event) {
        // Preventing onFocus event to fix issue
        // https://github.com/Hacker0x01/react-datepicker/issues/628
        _this.setState({ preventFocus: true }, function () {
          _this.preventFocusTimeout = setTimeout(function () {
            return _this.setState({ preventFocus: false });
          }, 50);
          return _this.preventFocusTimeout;
        });
        _this.setSelected(date, event);
        if (!_this.props.shouldCloseOnSelect || _this.props.showTimeSelect) {
          _this.setPreSelection(date);
        } else if (!_this.props.inline) {
          _this.setOpen(false, true);
        }
      };
  
      _this.updateSelection = function (newSelection) {
        if (_this.props.adjustDateOnChange) {
          _this.setSelected(newSelection);
        }
        _this.setPreSelection(newSelection);
      };
  
      _this.setSelected = function (date, event, keepInput) {
        var changedDate = date;
  
        if (changedDate !== null && isDayDisabled(changedDate, _this.props)) {
          if (isOutOfBounds(changedDate, _this.props)) {
            _this.props.onChange(date, event);
            _this.props.onSelect(changedDate, event);
          }
  
          return;
        }
  
        if (changedDate !== null && _this.props.selected) {
          var selected = _this.props.selected;
          if (keepInput) selected = newDate(changedDate);
          changedDate = setTime(newDate(changedDate), {
            hour: getHour(selected),
            minute: getMinute(selected),
            second: getSecond(selected),
            millisecond: getMillisecond(selected)
          });
        }
  
        if (!isSameTime(_this.props.selected, changedDate) || _this.props.allowSameDay) {
          if (changedDate !== null) {
            if (!_this.props.inline) {
              _this.setState({
                preSelection: changedDate
              });
            }
          }
          _this.props.onChange(changedDate, event);
        }
  
        _this.props.onSelect(changedDate, event);
  
        if (!keepInput) {
          _this.setState({ inputValue: null });
        }
      };
  
      _this.setPreSelection = function (date) {
        var isDateRangePresent = typeof _this.props.minDate !== "undefined" && typeof _this.props.maxDate !== "undefined";
        var isValidDateSelection = isDateRangePresent && date ? isDayInRange(date, _this.props.minDate, _this.props.maxDate) : true;
        if (isValidDateSelection) {
          _this.setState({
            preSelection: date
          });
        }
      };
  
      _this.handleTimeChange = function (time) {
        var selected = _this.props.selected ? _this.props.selected : _this.getPreSelection();
        var changedDate = setTime(cloneDate(selected), {
          hour: getHour(time),
          minute: getMinute(time),
          second: 0,
          millisecond: 0
        });
  
        if (!isSameTime(selected, changedDate)) {
          _this.setState({
            preSelection: changedDate
          });
  
          _this.props.onChange(changedDate);
        }
  
        _this.props.onSelect(changedDate);
  
        if (_this.props.shouldCloseOnSelect) {
          _this.setOpen(false, true);
        }
        _this.setState({ inputValue: null });
      };
  
      _this.onInputClick = function () {
        if (!_this.props.disabled && !_this.props.readOnly) {
          _this.setOpen(true);
        }
  
        _this.props.onInputClick();
      };
  
      _this.onAccessibleModeButtonKeyDown = function (event) {
        var eventKey = event.key;
        if (eventKey === " " || eventKey === "Enter") {
          event.preventDefault();
          _this.onInputClick();
        }
      };
  
      _this.onInputKeyDown = function (event) {
        _this.props.onKeyDown(event);
  
        var eventKey = event.key;
        if (!_this.state.open && !_this.props.inline && !_this.props.preventOpenOnFocus) {
          if (eventKey === "ArrowDown" || eventKey === "ArrowUp") {
            event.preventDefault();
            _this.setState({ enableFocusTrap: true }, function () {
              _this.onInputClick();
            });
          }
          return;
        }
        if (_this.state.open && !_this.state.enableFocusTrap) {
          if (eventKey === "ArrowDown" || eventKey === "Tab") {
            event.preventDefault();
            _this.setState({ enableFocusTrap: true }, function () {
              _this.onInputClick();
            });
          } else if (eventKey === "Escape" || eventKey === "Enter") {
            event.preventDefault();
            _this.setOpen(false, true);
          }
          return;
        }
        var copy = newDate(_this.state.preSelection);
        if (eventKey === "Enter") {
          event.preventDefault();
          if (_this.inputOk() && _this.state.lastPreSelectChange === PRESELECT_CHANGE_VIA_NAVIGATE) {
            _this.handleSelect(copy, event);
            !_this.props.shouldCloseOnSelect && _this.setPreSelection(copy);
          } else {
            _this.setOpen(false, true);
          }
        } else if (eventKey === "Escape") {
          event.preventDefault();
  
          _this.setOpen(false, true);
          if (!_this.inputOk()) {
            _this.props.onInputError({ code: 1, msg: INPUT_ERR_1 });
          }
        } else if (eventKey === "Tab") {
          _this.setOpen(false, true);
        } else if (!_this.props.disabledKeyboardNavigation) {
          var newSelection = void 0;
          switch (eventKey) {
            case "ArrowLeft":
              newSelection = subtractDays(copy, 1);
              break;
            case "ArrowRight":
              newSelection = addDays(copy, 1);
              break;
            case "ArrowUp":
              newSelection = subtractWeeks(copy, 1);
              break;
            case "ArrowDown":
              newSelection = addWeeks(copy, 1);
              break;
            case "PageUp":
              newSelection = subtractMonths(copy, 1);
              break;
            case "PageDown":
              newSelection = addMonths(copy, 1);
              break;
            case "Home":
              newSelection = subtractYears(copy, 1);
              break;
            case "End":
              newSelection = addYears(copy, 1);
              break;
          }
          if (!newSelection) {
            if (_this.props.onInputError) {
              _this.props.onInputError({ code: 1, msg: INPUT_ERR_1 });
            }
            return; // Let the input component handle this keydown
          }
          event.preventDefault();
          _this.setState({ lastPreSelectChange: PRESELECT_CHANGE_VIA_NAVIGATE });
          _this.updateSelection(newSelection);
        }
      };
  
      _this.onClearClick = function (event) {
        if (event) {
          if (event.preventDefault) {
            event.preventDefault();
          }
        }
        _this.props.onChange(null, event);
        _this.setState({ inputValue: null });
      };
  
      _this.clear = function () {
        _this.onClearClick();
      };
  
      _this.renderCalendar = function () {
        if (!_this.props.inline && !_this.isCalendarOpen()) {
          return null;
        }
  
        var calendar = React__default.createElement(
          WrappedCalendar,
          {
            ref: function ref(elem) {
              _this.calendar = elem;
            },
            locale: _this.props.locale,
            adjustDateOnChange: _this.props.adjustDateOnChange,
            setOpen: _this.setOpen,
            shouldCloseOnSelect: _this.props.shouldCloseOnSelect,
            dateFormat: _this.props.dateFormatCalendar,
            useWeekdaysShort: _this.props.useWeekdaysShort,
            formatWeekDay: _this.props.formatWeekDay,
            dropdownMode: _this.props.dropdownMode,
            selected: _this.props.selected,
            preSelection: _this.state.preSelection,
            onSelect: _this.handleSelect,
            onWeekSelect: _this.props.onWeekSelect,
            openToDate: _this.props.openToDate,
            minDate: _this.props.minDate,
            maxDate: _this.props.maxDate,
            selectsStart: _this.props.selectsStart,
            selectsEnd: _this.props.selectsEnd,
            startDate: _this.props.startDate,
            endDate: _this.props.endDate,
            excludeDates: _this.props.excludeDates,
            filterDate: _this.props.filterDate,
            onClickOutside: _this.handleCalendarClickOutside,
            formatWeekNumber: _this.props.formatWeekNumber,
            highlightDates: _this.state.highlightDates,
            includeDates: _this.props.includeDates,
            includeTimes: _this.props.includeTimes,
            injectTimes: _this.props.injectTimes,
            inline: _this.props.inline,
            peekNextMonth: _this.props.peekNextMonth,
            showMonthDropdown: _this.props.showMonthDropdown,
            useShortMonthInDropdown: _this.props.useShortMonthInDropdown,
            showMonthYearDropdown: _this.props.showMonthYearDropdown,
            showWeekNumbers: _this.props.showWeekNumbers,
            showYearDropdown: _this.props.showYearDropdown,
            withPortal: _this.props.withPortal,
            forceShowMonthNavigation: _this.props.forceShowMonthNavigation,
            showDisabledMonthNavigation: _this.props.showDisabledMonthNavigation,
            scrollableYearDropdown: _this.props.scrollableYearDropdown,
            scrollableMonthYearDropdown: _this.props.scrollableMonthYearDropdown,
            todayButton: _this.props.todayButton,
            weekLabel: _this.props.weekLabel,
            utcOffset: _this.props.utcOffset,
            outsideClickIgnoreClass: outsideClickIgnoreClass,
            fixedHeight: _this.props.fixedHeight,
            monthsShown: _this.props.monthsShown,
            onDropdownFocus: _this.handleDropdownFocus,
            onMonthChange: _this.props.onMonthChange,
            onYearChange: _this.props.onYearChange,
            dayClassName: _this.props.dayClassName,
            showTimeSelect: _this.props.showTimeSelect,
            showTimeSelectOnly: _this.props.showTimeSelectOnly,
            onTimeChange: _this.handleTimeChange,
            timeFormat: _this.props.timeFormat,
            timeIntervals: _this.props.timeIntervals,
            minTime: _this.props.minTime,
            maxTime: _this.props.maxTime,
            excludeTimes: _this.props.excludeTimes,
            timeCaption: _this.props.timeCaption,
            className: _this.props.calendarClassName,
            container: _this.props.calendarContainer,
            yearDropdownItemNumber: _this.props.yearDropdownItemNumber,
            previousMonthButtonLabel: _this.props.previousMonthButtonLabel,
            nextMonthButtonLabel: _this.props.nextMonthButtonLabel,
            disabledKeyboardNavigation: _this.props.disabledKeyboardNavigation,
            renderCustomHeader: _this.props.renderCustomHeader,
            popperProps: _this.props.popperProps,
            renderDayContents: _this.props.renderDayContents,
            updateSelection: _this.updateSelection,
            accessibleMode: _this.props.accessibleMode,
            enableFocusTrap: _this.state.enableFocusTrap
          },
          _this.props.children
        );
  
        return calendar;
      };
  
      _this.renderDateInput = function () {
        var _classnames, _React$cloneElement;
  
        var className = classnames(_this.props.className, (_classnames = {}, _classnames[outsideClickIgnoreClass] = _this.state.open, _classnames));
  
        var customInput = _this.props.customInput || React__default.createElement("input", { type: "text" });
        var customInputRef = _this.props.customInputRef || "ref";
        var inputValue = typeof _this.props.value === "string" ? _this.props.value : typeof _this.state.inputValue === "string" ? _this.state.inputValue : safeDateFormat(_this.props.selected, _this.props);
  
        return React__default.cloneElement(customInput, (_React$cloneElement = {}, _React$cloneElement[customInputRef] = function (input) {
          _this.input = input;
        }, _React$cloneElement.value = inputValue, _React$cloneElement.onBlur = _this.handleBlur, _React$cloneElement.onChange = _this.handleChange, _React$cloneElement.onClick = _this.onInputClick, _React$cloneElement.onFocus = _this.handleFocus, _React$cloneElement.onKeyDown = _this.onInputKeyDown, _React$cloneElement.id = _this.props.id, _React$cloneElement.name = _this.props.name, _React$cloneElement.autoFocus = _this.props.autoFocus, _React$cloneElement.placeholder = _this.props.placeholderText, _React$cloneElement.disabled = _this.props.disabled, _React$cloneElement.autoComplete = _this.props.autoComplete, _React$cloneElement.className = className, _React$cloneElement.title = _this.props.title, _React$cloneElement.readOnly = _this.props.readOnly, _React$cloneElement.required = _this.props.required, _React$cloneElement.tabIndex = _this.props.tabIndex, _React$cloneElement["aria-label"] = _this.state.open ? 'Press the down key to enter a popover containing a calendar. Press the escape key to close the popover.' : 'Press the down key to open a popover containing a calendar.', _React$cloneElement));
      };
  
      _this.renderClearButton = function () {
        if (_this.props.isClearable && _this.props.selected != null) {
          return React__default.createElement("button", {
            type: "button",
            className: "react-datepicker__close-icon",
            onClick: _this.onClearClick,
            title: _this.props.clearButtonTitle,
            tabIndex: -1
          });
        } else {
          return null;
        }
      };
  
      _this.renderAccessibleButton = function () {
        if (_this.props.accessibleModeButton != null) {
          return React__default.cloneElement(_this.props.accessibleModeButton, {
            onClick: _this.onInputClick,
            onKeyDown: _this.onAccessibleModeButtonKeyDown,
            className: classnames(_this.props.accessibleModeButton.props.className, "react-datepicker__accessible-icon"),
            tabIndex: 0
          });
        } else {
          return null;
        }
      };
  
      _this.state = _this.calcInitialState();
      return _this;
    }
  
    DatePicker.prototype.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
      if (prevProps.inline && hasPreSelectionChanged(prevProps.selected, this.props.selected)) {
        this.setPreSelection(this.props.selected);
      }
      if (prevProps.highlightDates !== this.props.highlightDates) {
        this.setState({
          highlightDates: getHightLightDaysMap(this.props.highlightDates)
        });
      }
      if (!prevState.focused && hasSelectionChanged(prevProps.selected, this.props.selected)) {
        this.setState({ inputValue: null });
      }
    };
  
    DatePicker.prototype.componentWillUnmount = function componentWillUnmount() {
      this.clearPreventFocusTimeout();
    };
  
    DatePicker.prototype.render = function render() {
      var calendar = this.renderCalendar();
  
      if (this.props.inline && !this.props.withPortal) {
        return calendar;
      }
  
      if (this.props.withPortal) {
        return React__default.createElement(
          "div",
          null,
          !this.props.inline ? React__default.createElement(
            "div",
            { className: "react-datepicker__input-container" },
            this.renderDateInput(),
            this.renderClearButton(),
            this.renderAccessibleButton()
          ) : null,
          this.state.open || this.props.inline ? React__default.createElement(
            "div",
            { className: "react-datepicker__portal" },
            calendar
          ) : null
        );
      }
  
      return React__default.createElement(PopperComponent, {
        className: this.props.popperClassName,
        hidePopper: !this.isCalendarOpen(),
        popperModifiers: this.props.popperModifiers,
        targetComponent: React__default.createElement(
          "div",
          { className: "react-datepicker__input-container" },
          this.renderDateInput(),
          this.renderClearButton(),
          this.renderAccessibleButton()
        ),
        popperContainer: this.props.popperContainer,
        popperComponent: calendar,
        popperPlacement: this.props.popperPlacement,
        popperProps: this.props.popperProps
      });
    };
  
    return DatePicker;
  }(React__default.Component);
  
  DatePicker.propTypes = {
    adjustDateOnChange: PropTypes.bool,
    allowSameDay: PropTypes.bool,
    autoComplete: PropTypes.string,
    autoFocus: PropTypes.bool,
    calendarClassName: PropTypes.string,
    calendarContainer: PropTypes.func,
    children: PropTypes.node,
    className: PropTypes.string,
    customInput: PropTypes.element,
    customInputRef: PropTypes.string,
    // eslint-disable-next-line react/no-unused-prop-types
    dateFormat: PropTypes.oneOfType([PropTypes.string, PropTypes.array]),
    dateFormatCalendar: PropTypes.string,
    dayClassName: PropTypes.func,
    disabled: PropTypes.bool,
    disabledKeyboardNavigation: PropTypes.bool,
    dropdownMode: PropTypes.oneOf(["scroll", "select"]).isRequired,
    endDate: PropTypes.object,
    excludeDates: PropTypes.array,
    filterDate: PropTypes.func,
    fixedHeight: PropTypes.bool,
    formatWeekNumber: PropTypes.func,
    highlightDates: PropTypes.array,
    id: PropTypes.string,
    includeDates: PropTypes.array,
    includeTimes: PropTypes.array,
    injectTimes: PropTypes.array,
    inline: PropTypes.bool,
    isClearable: PropTypes.bool,
    locale: PropTypes.string,
    maxDate: PropTypes.object,
    minDate: PropTypes.object,
    monthsShown: PropTypes.number,
    name: PropTypes.string,
    onBlur: PropTypes.func,
    onChange: PropTypes.func.isRequired,
    onSelect: PropTypes.func,
    onWeekSelect: PropTypes.func,
    onClickOutside: PropTypes.func,
    onChangeRaw: PropTypes.func,
    onFocus: PropTypes.func,
    onInputClick: PropTypes.func,
    onKeyDown: PropTypes.func,
    onMonthChange: PropTypes.func,
    onYearChange: PropTypes.func,
    onInputError: PropTypes.func,
    open: PropTypes.bool,
    openToDate: PropTypes.object,
    peekNextMonth: PropTypes.bool,
    placeholderText: PropTypes.string,
    popperContainer: PropTypes.func,
    popperClassName: PropTypes.string, // <PopperComponent/> props
    popperModifiers: PropTypes.object, // <PopperComponent/> props
    popperPlacement: PropTypes.oneOf(popperPlacementPositions), // <PopperComponent/> props
    popperProps: PropTypes.object,
    preventOpenOnFocus: PropTypes.bool,
    readOnly: PropTypes.bool,
    required: PropTypes.bool,
    scrollableYearDropdown: PropTypes.bool,
    scrollableMonthYearDropdown: PropTypes.bool,
    selected: PropTypes.object,
    selectsEnd: PropTypes.bool,
    selectsStart: PropTypes.bool,
    showMonthDropdown: PropTypes.bool,
    showMonthYearDropdown: PropTypes.bool,
    showWeekNumbers: PropTypes.bool,
    showYearDropdown: PropTypes.bool,
    forceShowMonthNavigation: PropTypes.bool,
    showDisabledMonthNavigation: PropTypes.bool,
    startDate: PropTypes.object,
    startOpen: PropTypes.bool,
    tabIndex: PropTypes.number,
    timeCaption: PropTypes.string,
    title: PropTypes.string,
    todayButton: PropTypes.node,
    useWeekdaysShort: PropTypes.bool,
    formatWeekDay: PropTypes.func,
    utcOffset: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
    value: PropTypes.string,
    weekLabel: PropTypes.string,
    withPortal: PropTypes.bool,
    yearDropdownItemNumber: PropTypes.number,
    shouldCloseOnSelect: PropTypes.bool,
    showTimeSelect: PropTypes.bool,
    showTimeSelectOnly: PropTypes.bool,
    timeFormat: PropTypes.string,
    timeIntervals: PropTypes.number,
    minTime: PropTypes.object,
    maxTime: PropTypes.object,
    excludeTimes: PropTypes.array,
    useShortMonthInDropdown: PropTypes.bool,
    clearButtonTitle: PropTypes.string,
    previousMonthButtonLabel: PropTypes.string,
    nextMonthButtonLabel: PropTypes.string,
    renderCustomHeader: PropTypes.func,
    renderDayContents: PropTypes.func,
    accessibleMode: PropTypes.bool,
    accessibleModeButton: PropTypes.element,
    strictParsing: PropTypes.bool // eslint-disable-line react/no-unused-prop-types
  };
  
  
  var PRESELECT_CHANGE_VIA_INPUT = "input";
  var PRESELECT_CHANGE_VIA_NAVIGATE = "navigate";
  
  exports.default = DatePicker;
  exports.CalendarContainer = CalendarContainer;
  