this.primereact = this.primereact || {};
this.primereact.listbox = (function (exports, React, api, tooltip, utils, virtualscroller, inputtext, ripple) {
  'use strict';

  function _interopNamespace(e) {
    if (e && e.__esModule) return e;
    var n = Object.create(null);
    if (e) {
      Object.keys(e).forEach(function (k) {
        if (k !== 'default') {
          var d = Object.getOwnPropertyDescriptor(e, k);
          Object.defineProperty(n, k, d.get ? d : {
            enumerable: true,
            get: function () { return e[k]; }
          });
        }
      });
    }
    n["default"] = e;
    return Object.freeze(n);
  }

  var React__namespace = /*#__PURE__*/_interopNamespace(React);

  function _extends() {
    _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;
    };

    return _extends.apply(this, arguments);
  }

  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;
  }

  function _arrayLikeToArray$1(arr, len) {
    if (len == null || len > arr.length) len = arr.length;

    for (var i = 0, arr2 = new Array(len); i < len; i++) {
      arr2[i] = arr[i];
    }

    return arr2;
  }

  function _arrayWithoutHoles(arr) {
    if (Array.isArray(arr)) return _arrayLikeToArray$1(arr);
  }

  function _iterableToArray(iter) {
    if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
  }

  function _unsupportedIterableToArray$1(o, minLen) {
    if (!o) return;
    if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
    var n = Object.prototype.toString.call(o).slice(8, -1);
    if (n === "Object" && o.constructor) n = o.constructor.name;
    if (n === "Map" || n === "Set") return Array.from(o);
    if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
  }

  function _nonIterableSpread() {
    throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  }

  function _toConsumableArray(arr) {
    return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray$1(arr) || _nonIterableSpread();
  }

  function _arrayWithHoles(arr) {
    if (Array.isArray(arr)) return arr;
  }

  function _iterableToArrayLimit(arr, i) {
    var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];

    if (_i == null) return;
    var _arr = [];
    var _n = true;
    var _d = false;

    var _s, _e;

    try {
      for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
        _arr.push(_s.value);

        if (i && _arr.length === i) break;
      }
    } catch (err) {
      _d = true;
      _e = err;
    } finally {
      try {
        if (!_n && _i["return"] != null) _i["return"]();
      } finally {
        if (_d) throw _e;
      }
    }

    return _arr;
  }

  function _nonIterableRest() {
    throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  }

  function _slicedToArray(arr, i) {
    return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest();
  }

  var ListBoxHeader = /*#__PURE__*/React__namespace.memo(function (props) {
    var onFilter = function onFilter(event) {
      if (props.onFilter) {
        props.onFilter({
          originalEvent: event,
          value: event.target.value
        });
      }
    };

    return /*#__PURE__*/React__namespace.createElement("div", {
      className: "p-listbox-header"
    }, /*#__PURE__*/React__namespace.createElement("div", {
      className: "p-listbox-filter-container"
    }, /*#__PURE__*/React__namespace.createElement(inputtext.InputText, {
      type: "text",
      value: props.filter,
      onChange: onFilter,
      className: "p-listbox-filter",
      disabled: props.disabled,
      placeholder: props.filterPlaceholder
    }), /*#__PURE__*/React__namespace.createElement("span", {
      className: "p-listbox-filter-icon pi pi-search"
    })));
  });
  ListBoxHeader.displayName = 'ListBoxHeader';

  var ListBoxItem = /*#__PURE__*/React__namespace.memo(function (props) {
    var onClick = function onClick(event) {
      if (props.onClick) {
        props.onClick({
          originalEvent: event,
          option: props.option
        });
      }

      event.preventDefault();
    };

    var onTouchEnd = function onTouchEnd(event) {
      if (props.onTouchEnd) {
        props.onTouchEnd({
          originalEvent: event,
          option: props.option
        });
      }
    };

    var onKeyDown = function onKeyDown(event) {
      var item = event.currentTarget;

      switch (event.which) {
        //down
        case 40:
          var nextItem = findNextItem(item);
          nextItem && nextItem.focus();
          event.preventDefault();
          break;
        //up

        case 38:
          var prevItem = findPrevItem(item);
          prevItem && prevItem.focus();
          event.preventDefault();
          break;
        //enter

        case 13:
          onClick(event);
          event.preventDefault();
          break;
      }
    };

    var findNextItem = function findNextItem(item) {
      var nextItem = item.nextElementSibling;
      return nextItem ? utils.DomHandler.hasClass(nextItem, 'p-disabled') || utils.DomHandler.hasClass(nextItem, 'p-listbox-item-group') ? findNextItem(nextItem) : nextItem : null;
    };

    var findPrevItem = function findPrevItem(item) {
      var prevItem = item.previousElementSibling;
      return prevItem ? utils.DomHandler.hasClass(prevItem, 'p-disabled') || utils.DomHandler.hasClass(prevItem, 'p-listbox-item-group') ? findPrevItem(prevItem) : prevItem : null;
    };

    var className = utils.classNames('p-listbox-item', {
      'p-highlight': props.selected,
      'p-disabled': props.disabled
    }, props.option.className);
    var content = props.template ? utils.ObjectUtils.getJSXElement(props.template, props.option) : props.label;
    return /*#__PURE__*/React__namespace.createElement("li", {
      className: className,
      onClick: onClick,
      onTouchEnd: onTouchEnd,
      onKeyDown: onKeyDown,
      tabIndex: props.tabIndex,
      "aria-label": props.label,
      key: props.label,
      role: "option",
      "aria-selected": props.selected
    }, content, /*#__PURE__*/React__namespace.createElement(ripple.Ripple, null));
  });
  ListBoxItem.displayName = 'ListBoxItem';

  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }

  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }

  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }

  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }

  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
  var ListBox = /*#__PURE__*/React__namespace.memo( /*#__PURE__*/React__namespace.forwardRef(function (props, ref) {
    var _React$useState = React__namespace.useState(''),
        _React$useState2 = _slicedToArray(_React$useState, 2),
        filterValueState = _React$useState2[0],
        setFilterValueState = _React$useState2[1];

    var elementRef = React__namespace.useRef(null);
    var virtualScrollerRef = React__namespace.useRef(null);
    var optionTouched = React__namespace.useRef(false);
    var filteredValue = (props.onFilterValueChange ? props.filterValue : filterValueState) || '';
    var hasFilter = filteredValue && filteredValue.trim().length > 0;

    var onOptionSelect = function onOptionSelect(event) {
      var option = event.option;

      if (props.disabled || isOptionDisabled(option)) {
        return;
      }

      props.multiple ? onOptionSelectMultiple(event.originalEvent, option) : onOptionSelectSingle(event.originalEvent, option);
      optionTouched.current = false;
    };

    var onOptionTouchEnd = function onOptionTouchEnd() {
      if (props.disabled) {
        return;
      }

      optionTouched.current = true;
    };

    var onOptionSelectSingle = function onOptionSelectSingle(event, option) {
      var selected = isSelected(option);
      var valueChanged = false;
      var value = null;
      var metaSelection = optionTouched.current ? false : props.metaKeySelection;

      if (metaSelection) {
        var metaKey = event.metaKey || event.ctrlKey;

        if (selected) {
          if (metaKey) {
            value = null;
            valueChanged = true;
          }
        } else {
          value = getOptionValue(option);
          valueChanged = true;
        }
      } else {
        value = selected ? null : getOptionValue(option);
        valueChanged = true;
      }

      if (valueChanged) {
        updateModel(event, value);
      }
    };

    var onOptionSelectMultiple = function onOptionSelectMultiple(event, option) {
      var selected = isSelected(option);
      var valueChanged = false;
      var value = null;
      var metaSelection = optionTouched ? false : props.metaKeySelection;

      if (metaSelection) {
        var metaKey = event.metaKey || event.ctrlKey;

        if (selected) {
          if (metaKey) value = removeOption(option);else value = [getOptionValue(option)];
          valueChanged = true;
        } else {
          value = metaKey ? props.value || [] : [];
          value = [].concat(_toConsumableArray(value), [getOptionValue(option)]);
          valueChanged = true;
        }
      } else {
        if (selected) value = removeOption(option);else value = [].concat(_toConsumableArray(props.value || []), [getOptionValue(option)]);
        valueChanged = true;
      }

      if (valueChanged) {
        props.onChange({
          originalEvent: event,
          value: value,
          stopPropagation: function stopPropagation() {},
          preventDefault: function preventDefault() {},
          target: {
            name: props.name,
            id: props.id,
            value: value
          }
        });
      }
    };

    var onFilter = function onFilter(event) {
      var originalEvent = event.originalEvent,
          value = event.value;

      if (props.onFilterValueChange) {
        props.onFilterValueChange({
          originalEvent: originalEvent,
          value: value
        });
      } else {
        setFilterValueState(value);
      }
    };

    var updateModel = function updateModel(event, value) {
      if (props.onChange) {
        props.onChange({
          originalEvent: event,
          value: value,
          stopPropagation: function stopPropagation() {},
          preventDefault: function preventDefault() {},
          target: {
            name: props.name,
            id: props.id,
            value: value
          }
        });
      }
    };

    var removeOption = function removeOption(option) {
      return props.value.filter(function (val) {
        return !utils.ObjectUtils.equals(val, getOptionValue(option), props.dataKey);
      });
    };

    var isSelected = function isSelected(option) {
      var optionValue = getOptionValue(option);
      return props.multiple && props.value ? props.value.some(function (val) {
        return utils.ObjectUtils.equals(val, optionValue, props.dataKey);
      }) : utils.ObjectUtils.equals(props.value, optionValue, props.dataKey);
    };

    var getOptionLabel = function getOptionLabel(option) {
      return props.optionLabel ? utils.ObjectUtils.resolveFieldData(option, props.optionLabel) : option && option['label'] !== undefined ? option['label'] : option;
    };

    var getOptionValue = function getOptionValue(option) {
      return props.optionValue ? utils.ObjectUtils.resolveFieldData(option, props.optionValue) : option && option['value'] !== undefined ? option['value'] : option;
    };

    var getOptionRenderKey = function getOptionRenderKey(option) {
      return props.dataKey ? utils.ObjectUtils.resolveFieldData(option, props.dataKey) : getOptionLabel(option);
    };

    var isOptionDisabled = function isOptionDisabled(option) {
      if (props.optionDisabled) {
        return utils.ObjectUtils.isFunction(props.optionDisabled) ? props.optionDisabled(option) : utils.ObjectUtils.resolveFieldData(option, props.optionDisabled);
      }

      return option && option['disabled'] !== undefined ? option['disabled'] : false;
    };

    var getOptionGroupRenderKey = function getOptionGroupRenderKey(optionGroup) {
      return utils.ObjectUtils.resolveFieldData(optionGroup, props.optionGroupLabel);
    };

    var getOptionGroupLabel = function getOptionGroupLabel(optionGroup) {
      return utils.ObjectUtils.resolveFieldData(optionGroup, props.optionGroupLabel);
    };

    var getOptionGroupChildren = function getOptionGroupChildren(optionGroup) {
      return utils.ObjectUtils.resolveFieldData(optionGroup, props.optionGroupChildren);
    };

    var getVisibleOptions = function getVisibleOptions() {
      if (hasFilter) {
        var filterValue = filteredValue.trim().toLocaleLowerCase(props.filterLocale);
        var searchFields = props.filterBy ? props.filterBy.split(',') : [props.optionLabel || 'label'];

        if (props.optionGroupLabel) {
          var filteredGroups = [];

          var _iterator = _createForOfIteratorHelper(props.options),
              _step;

          try {
            for (_iterator.s(); !(_step = _iterator.n()).done;) {
              var optgroup = _step.value;
              var filteredSubOptions = api.FilterService.filter(getOptionGroupChildren(optgroup), searchFields, filterValue, props.filterMatchMode, props.filterLocale);

              if (filteredSubOptions && filteredSubOptions.length) {
                filteredGroups.push(_objectSpread(_objectSpread({}, optgroup), {
                  items: filteredSubOptions
                }));
              }
            }
          } catch (err) {
            _iterator.e(err);
          } finally {
            _iterator.f();
          }

          return filteredGroups;
        } else {
          return api.FilterService.filter(props.options, searchFields, filterValue, props.filterMatchMode, props.filterLocale);
        }
      } else {
        return props.options;
      }
    };

    var createHeader = function createHeader() {
      return props.filter ? /*#__PURE__*/React__namespace.createElement(ListBoxHeader, {
        filter: filteredValue,
        onFilter: onFilter,
        disabled: props.disabled,
        filterPlaceholder: props.filterPlaceholder
      }) : null;
    };

    var createGroupChildren = function createGroupChildren(optionGroup) {
      var groupChildren = getOptionGroupChildren(optionGroup);
      return groupChildren.map(function (option, j) {
        var optionLabel = getOptionLabel(option);
        var optionKey = j + '_' + getOptionRenderKey(option);
        var disabled = isOptionDisabled(option);
        var tabIndex = disabled ? null : props.tabIndex || 0;
        return /*#__PURE__*/React__namespace.createElement(ListBoxItem, {
          key: optionKey,
          label: optionLabel,
          option: option,
          template: props.itemTemplate,
          selected: isSelected(option),
          onClick: onOptionSelect,
          onTouchEnd: onOptionTouchEnd,
          tabIndex: tabIndex,
          disabled: disabled
        });
      });
    };

    var createItem = function createItem(option, index) {
      if (props.optionGroupLabel) {
        var groupContent = props.optionGroupTemplate ? utils.ObjectUtils.getJSXElement(props.optionGroupTemplate, option, index) : getOptionGroupLabel(option);
        var groupChildrenContent = createGroupChildren(option);
        var key = index + '_' + getOptionGroupRenderKey(option);
        return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, {
          key: key
        }, /*#__PURE__*/React__namespace.createElement("li", {
          className: "p-listbox-item-group"
        }, groupContent), groupChildrenContent);
      } else {
        var optionLabel = getOptionLabel(option);
        var optionKey = index + '_' + getOptionRenderKey(option);
        var disabled = isOptionDisabled(option);
        var tabIndex = disabled ? null : props.tabIndex || 0;
        return /*#__PURE__*/React__namespace.createElement(ListBoxItem, {
          key: optionKey,
          label: optionLabel,
          option: option,
          template: props.itemTemplate,
          selected: isSelected(option),
          onClick: onOptionSelect,
          onTouchEnd: onOptionTouchEnd,
          tabIndex: tabIndex,
          disabled: disabled
        });
      }
    };

    var createItems = function createItems() {
      return visibleOptions ? visibleOptions.map(createItem) : null;
    };

    var createList = function createList() {
      if (props.virtualScrollerOptions) {
        var virtualScrollerProps = _objectSpread(_objectSpread({}, props.virtualScrollerOptions), {
          items: visibleOptions,
          onLazyLoad: function onLazyLoad(event) {
            return props.virtualScrollerOptions.onLazyLoad(_objectSpread(_objectSpread({}, event), {
              filter: visibleOptions
            }));
          },
          itemTemplate: function itemTemplate(item, option) {
            return item && createItem(item, option.index);
          },
          contentTemplate: function contentTemplate(option) {
            var className = utils.classNames('p-listbox-list', option.className);
            return /*#__PURE__*/React__namespace.createElement("ul", {
              ref: option.contentRef,
              className: className,
              role: "listbox",
              "aria-multiselectable": props.multiple
            }, option.children);
          }
        });

        return /*#__PURE__*/React__namespace.createElement(virtualscroller.VirtualScroller, _extends({
          ref: virtualScrollerRef
        }, virtualScrollerProps));
      } else {
        var items = createItems();
        return /*#__PURE__*/React__namespace.createElement("ul", {
          className: "p-listbox-list",
          role: "listbox",
          "aria-multiselectable": props.multiple
        }, items);
      }
    };

    var visibleOptions = getVisibleOptions();
    var hasTooltip = utils.ObjectUtils.isNotEmpty(props.tooltip);
    var otherProps = utils.ObjectUtils.findDiffKeys(props, ListBox.defaultProps);
    var className = utils.classNames('p-listbox p-component', {
      'p-disabled': props.disabled
    }, props.className);
    var listClassName = utils.classNames('p-listbox-list-wrapper', props.listClassName);
    var list = createList();
    var header = createHeader();
    return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("div", _extends({
      ref: elementRef,
      id: props.id,
      className: className,
      style: props.style
    }, otherProps), header, /*#__PURE__*/React__namespace.createElement("div", {
      className: listClassName,
      style: props.listStyle
    }, list)), hasTooltip && /*#__PURE__*/React__namespace.createElement(tooltip.Tooltip, _extends({
      target: elementRef,
      content: props.tooltip
    }, props.tooltipOptions)));
  }));
  ListBox.displayName = 'ListBox';
  ListBox.defaultProps = {
    __TYPE: 'ListBox',
    id: null,
    value: null,
    options: null,
    optionLabel: null,
    optionValue: null,
    optionDisabled: null,
    optionGroupLabel: null,
    optionGroupChildren: null,
    optionGroupTemplate: null,
    itemTemplate: null,
    style: null,
    listStyle: null,
    listClassName: null,
    className: null,
    virtualScrollerOptions: null,
    disabled: null,
    dataKey: null,
    multiple: false,
    metaKeySelection: false,
    filter: false,
    filterBy: null,
    filterValue: null,
    filterMatchMode: 'contains',
    filterPlaceholder: null,
    filterLocale: undefined,
    tabIndex: 0,
    tooltip: null,
    tooltipOptions: null,
    ariaLabelledBy: null,
    onChange: null,
    onFilterValueChange: null
  };

  exports.ListBox = ListBox;

  Object.defineProperty(exports, '__esModule', { value: true });

  return exports;

})({}, React, primereact.api, primereact.tooltip, primereact.utils, primereact.virtualscroller, primereact.inputtext, primereact.ripple);
