react-bootstrap-autosuggest
Version:
Autosuggest component for react-bootstrap
9 lines • 54.9 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-bootstrap"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-bootstrap","react-dom"],t):"object"==typeof exports?exports.ReactBootstrapAutosuggest=t(require("react"),require("react-bootstrap"),require("react-dom")):e.ReactBootstrapAutosuggest=t(e.React,e.ReactBootstrap,e.ReactDOM)}(this,function(e,t,n){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ObjectListAdapter=t.MapListAdapter=t.ArrayListAdapter=t.EmptyListAdapter=t.ListAdapter=t.ItemAdapter=void 0;var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(1),f=r(c),p=n(2),d=r(p),h=n(3),y=r(h),m=n(4),v=r(m),_=n(13),g=r(_),b=n(14),I=n(15),w=r(I),k=n(16),O=r(k),A=n(17),V=r(A),P=n(18),S=r(P),T=n(19),E=r(T),j=n(20),x=r(j),C=n(21),M=r(C),R=n(22),N=r(R),D=n(23),K=r(D),F=n(25),B=r(F);t.ItemAdapter=E.default,t.ListAdapter=x.default,t.EmptyListAdapter=M.default,t.ArrayListAdapter=N.default,t.MapListAdapter=K.default,t.ObjectListAdapter=B.default;var L=function(e){function t(e){var n;i(this,t);for(var r=arguments.length,u=Array(r>1?r-1:0),s=1;s<r;s++)u[s-1]=arguments[s];var l=o(this,(n=t.__proto__||Object.getPrototypeOf(t)).call.apply(n,[this,e].concat(a(u))));l._itemAdapter=e.itemAdapter||new E.default,l._itemAdapter.receiveProps(e),l._listAdapter=e.datalistAdapter||l._getListAdapter(e.datalist),l._listAdapter.receiveProps(e,l._itemAdapter);var c=l._getValueFromProps(e),f=c.inputValue,p=c.inputItem,d=c.inputItemEphemeral,h=c.selectedItems;l._setValueMeta(p,d,!0,!0),l._lastValidItem=p,l._lastValidValue=f,l._keyPressCount=0,l.state={open:!1,disableFilter:!1,inputValue:f,inputValueKeyPress:0,inputFocused:!1,selectedItems:h,searchValue:null},l._lastOnChangeValue=l._getCurrentValue(),l._lastOnSelectValue=p;var y=l;return y._renderSelected=l._renderSelected.bind(l),y._getItemKey=l._getItemKey.bind(l),y._isSelectedItem=l._isSelectedItem.bind(l),y._renderSuggested=l._renderSuggested.bind(l),y._handleToggleClick=l._handleToggleClick.bind(l),y._handleInputChange=l._handleInputChange.bind(l),y._handleItemSelect=l._handleItemSelect.bind(l),y._removeItem=l._removeItem.bind(l),y._handleShowAll=l._handleShowAll.bind(l),y._handleKeyDown=l._handleKeyDown.bind(l),y._handleKeyPress=l._handleKeyPress.bind(l),y._handleMenuClose=l._handleMenuClose.bind(l),y._handleInputFocus=l._handleInputFocus.bind(l),y._handleInputBlur=l._handleInputBlur.bind(l),y._handleFocus=l._handleFocus.bind(l),y._handleBlur=l._handleBlur.bind(l),l}return u(t,e),l(t,null,[{key:"defaultInputSelect",value:function(e,t,n){switch(e.type){case"text":case"search":case"url":case"tel":case"password":if(e.setSelectionRange)e.setSelectionRange(t.length,n.length);else if(e.createTextRange){var r=e.createTextRange();r.moveEnd("character",n.length),r.moveStart("character",t.length),r.select()}}}}]),l(t,[{key:"_getListAdapter",value:function(e){if(null==e)return new M.default;if(Array.isArray(e))return new N.default;if(e instanceof Map)return new K.default;if("object"==typeof e)return new B.default;throw Error("Unexpected datalist type: datalistAdapter required")}},{key:"_getValueFromProps",value:function(e){var t="",n=null,r=!1,a=[],i=e.value||e.defaultValue;if(null!=i)if(e.multiple)Array.isArray(i)?a=this._filterItems(i,e):(0,O.default)(!i,"Array expected for value property");else if(e.valueIsItem){var o=this._itemAdapter.getInputValue(i);null!=e.datalist?(n=this._listAdapter.findMatching(e.datalist,o),null!=n?t=n===i?o:this._itemAdapter.getInputValue(n):e.datalistOnly&&!e.datalistPartial?this._warnInvalidValue(i):(t=o,n=i)):(t=o,n=i)}else i&&(null!=e.datalist?(n=this._listAdapter.findMatching(e.datalist,i),null!=n?t=this._itemAdapter.getInputValue(n):e.datalistOnly&&!e.datalistPartial?this._warnInvalidValue(i):(t=i.toString(),n=this._itemAdapter.newFromValue(i),r=!0)):(t=i.toString(),n=this._itemAdapter.newFromValue(i),r=!0));return{inputValue:t,inputItem:n,inputItemEphemeral:r,selectedItems:a}}},{key:"_filterItems",value:function(e,t){if(null!=t.datalist||!t.allowDuplicates){var n=[],r={},a=!1,i=!0,o=!1,u=void 0;try{for(var s,l=e[Symbol.iterator]();!(i=(s=l.next()).done);i=!0){var c=s.value,f=this._itemAdapter.getInputValue(c);if(t.allowDuplicates||!r[f]){var p=this._listAdapter.findMatching(t.datalist,f);null!=p?(n.push(p),r[f]=!0,a=!0):t.datalistOnly&&!t.datalistPartial?(this._warnInvalidValue(f),a=!0):(n.push(c),r[f]=!0)}else a=!0}}catch(e){o=!0,u=e}finally{try{!i&&l.return&&l.return()}finally{if(o)throw u}}if(a)return n}return e}},{key:"_warnInvalidValue",value:function(e){(0,O.default)(!1,'Value "%s" does not match any datalist value',e)}},{key:"_setInputValue",value:function(e,t){this.setState({inputValue:e,inputValueKeyPress:this._keyPressCount},t)}},{key:"_setValueMeta",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null!=e,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n;this._inputItem=e,this._inputItemEphemeral=t,this._valueIsValid=n,this._valueWasValidated=r}},{key:"_clearInput",value:function(){this._setValueMeta(null,!1,!0,!0),this._setInputValue("")}},{key:"_getValueUsing",value:function(e,t,n,r){return e.multiple?r:e.valueIsItem?n:t}},{key:"_getCurrentValue",value:function(){return this._getValueUsing(this.props,this.state.inputValue,this._inputItem,this.state.selectedItems)}},{key:"componentDidMount",value:function(){this._autoCompleteAfterRender=!this.refs.input.setSelectionRange}},{key:"componentWillReceiveProps",value:function(e){if(e.itemAdapter!=this.props.itemAdapter&&(this._itemAdapter=e.itemAdapter||new E.default),this._itemAdapter.receiveProps(e),e.datalist!=this.props.datalist||e.datalistAdapter!=this.props.datalistAdapter)if(e.datalistAdapter)this._listAdapter=e.datalistAdapter;else{var t=this._getListAdapter(e.datalist);t.constructor!=this._listAdapter.constructor&&(this._listAdapter=t)}this._listAdapter.receiveProps(e,this._itemAdapter);var n=e.value,r=this.state.inputValue,a=n!==this.props.value&&n!==this._getValueUsing(e,r,this._inputItem,this.state.selectedItems),i=void 0,o=void 0,u=void 0,s=void 0;if(!a){if(e.datalistOnly){var l=!e.datalistPartial&&null!=e.datalist,c=!this.props.datalistOnly||!e.datalistPartial&&this.props.datalistPartial||e.datalist!=this.props.datalist;r?(i=this._listAdapter.findMatching(e.datalist,r),null==i&&(l||this._inputItemEphemeral?this._inputItemEphemeral&&n===r&&(u=!0):i=this._inputItem),(o=null==i&&c)&&this._focused&&(this._setValueMeta(null,!1,!1,!0),c&&l&&null!=this._lastValidItem&&(this._lastValidItem=this._listAdapter.findMatching(e.datalist,this._lastValidValue),null==this._lastValidItem&&(this._lastValidValue="")),o=!1)):(i=null,o=!1),s=e.multiple&&l&&c}e.multiple&&!e.allowDuplicates&&this.props.allowDuplicates&&(s=!0)}if(a||o){var f=void 0,p=void 0;if(u)r="",f=!1,p=[];else{var d=this._getValueFromProps(e);r=d.inputValue,i=d.inputItem,f=d.inputItemEphemeral,p=d.selectedItems}i===this._inputItem&&this._focused?a&&e.multiple&&this.setState({selectedItems:p}):(this._setValueMeta(i,f,!0,!0),this._setInputValue(r),this.setState({selectedItems:p}),s=!1,this._lastValidItem=i,this._lastValidValue=r,a&&(this._lastOnChangeValue=this._getValueUsing(e,r,i,p)))}else r&&e.datalist!=this.props.datalist&&this._focused&&this._checkAutoComplete(r,e);if(s){var h=this._filterItems(this.state.selectedItems,e);this.setState({selectedItems:h})}e.datalistMessage&&e.datalistMessage!=this.props.datalistMessage&&this._focused&&this._open("message",e)}},{key:"shouldComponentUpdate",value:function(e,t){return!(0,d.default)(this.props,e)||!(0,d.default)(this.state,t)}},{key:"componentWillUpdate",value:function(e,t){var n=this.refs.suggestions;this._menuFocusedBeforeUpdate=n&&n.isFocused();var r=t.inputValue;if(r!=this.state.inputValue){var a=void 0,i=void 0,o=void 0;if(this._valueWasValidated?(a=this._inputItem,o=this._valueIsValid):(r?(a=this._listAdapter.findMatching(e.datalist,r),null!=a||e.datalistOnly?(i=!1,o=null!=a):(a=this._itemAdapter.newFromValue(r),i=!0,o=!0)):(a=null,i=!1,o=!e.required),this._setValueMeta(a,i,o)),o&&(this._lastValidItem=a,this._lastValidValue=a&&!i?this._itemAdapter.getInputValue(a):r),o){var u=e.multiple,s=e.onChange;if(!u&&s){var l=this._getValueUsing(e,r,a,t.selectedItems);l!==this._lastOnChangeValue&&(this._lastOnChangeValue=l,s(l))}var c=e.onSelect;c&&a!==this._lastOnSelectValue&&(this._lastOnSelectValue=a,c(a))}}var f=e.onToggle;f&&t.open!=this.state.open&&f(t.open)}},{key:"componentDidUpdate",value:function(e,t){this.state.open&&!t.open&&"keydown"===this._lastOpenEventType||this.state.disableFilter&&!t.disableFilter&&this._menuFocusedBeforeUpdate?this.refs.suggestions.focusFirst():!this.state.open&&t.open&&this._menuFocusedBeforeUpdate&&(this._menuFocusedBeforeUpdate=!1,this._focusInput())}},{key:"componentWillUnmount",value:function(){clearTimeout(this._focusTimeoutId),this._focusTimeoutId=null,clearTimeout(this._searchTimeoutId),this._searchTimeoutId=null}},{key:"_focusInput",value:function(){var e=w.default.findDOMNode(this.refs.input);e instanceof HTMLElement&&e.focus()}},{key:"_open",value:function(e,t){this._lastOpenEventType=e;var n="autocomplete"!==e&&this._hasNoOrExactMatch(t);this.setState({open:!0,disableFilter:n});var r=t.onSearch,a=this.state,i=a.inputValue,o=a.searchValue;r&&o!==i&&(this.setState({searchValue:i}),r(i))}},{key:"_close",value:function(){this.setState({open:!1})}},{key:"_toggleOpen",value:function(e,t){this.state.open?this._close():this._open(e,t)}},{key:"_canOpen",value:function(){var e=this.props.datalist;return null==e&&this.props.onSearch||!this._listAdapter.isEmpty(e)||!!this.props.datalistMessage}},{key:"_hasNoOrExactMatch",value:function(e){var t=this;if(null!=this._inputItem&&!this._inputItemEphemeral)return!0;var n=this._itemAdapter.foldValue(this.state.inputValue);return null==this._listAdapter.find(e.datalist,function(e){return t._itemAdapter.itemIncludedByInput(e,n)})}},{key:"render",value:function(){var e=this.props.showToggle,t=this._canOpen(),n="auto"===e?t:e,r={autosuggest:!0,open:this.state.open,disabled:this.props.disabled,dropdown:n&&!this.props.dropup,dropup:n&&this.props.dropup};return g.default.createElement("div",{key:"dropdown",className:(0,f.default)(r),onFocus:this._handleFocus,onBlur:this._handleBlur},this._renderInputGroup(n,t),this._renderMenu())}},{key:"_renderInputGroup",value:function(e,t){var n=this.props.addonBefore?g.default.createElement("span",{className:"input-group-addon",key:"addonBefore"},this.props.addonBefore):null,r=this.props.addonAfter?g.default.createElement("span",{className:"input-group-addon",key:"addonAfter"},this.props.addonAfter):null,a=this.props.buttonBefore?g.default.createElement("span",{className:"input-group-btn"},this.props.buttonBefore):null,i=e&&this._renderToggle(t),o=i||this.props.buttonAfter?g.default.createElement("span",{className:"input-group-btn"},this.props.buttonAfter,i):null,u=(0,f.default)({"input-group":n||r||a||o,"input-group-sm":"small"===this.props.bsSize,"input-group-lg":"large"===this.props.bsSize,"input-group-toggle":!!i});return u?g.default.createElement("div",{className:u,key:"input-group"},n,a,this._renderChoices(),r,o):this._renderChoices()}},{key:"_renderToggle",value:function(e){return g.default.createElement(b.Dropdown.Toggle,{ref:"toggle",key:"toggle",id:this.props.toggleId,bsSize:this.props.bsSize,disabled:this.props.disabled||!e,open:this.state.open,onClick:this._handleToggleClick,onKeyDown:this._handleKeyDown})}},{key:"_renderChoices",value:function(){if(this.props.multiple){var e=this.props.choicesClass,t=void 0===e?V.default:e;return g.default.createElement(t,{ref:"choices",autoHeight:!(this.props.showToggle||this.props.addonAfter||this.props.addonBefore||this.props.buttonAfter||this.props.buttonBefore),disabled:this.props.disabled,focused:this.state.inputFocused,inputValue:this.state.inputValue,items:this.state.selectedItems,onKeyPress:this._handleKeyPress,onRemove:this._removeItem,renderItem:this._renderSelected},this._renderInput())}return this._renderInput()}},{key:"_renderSelected",value:function(e){return this._itemAdapter.renderSelected(e)}},{key:"_renderInput",value:function(){var e=this.context.$bs_formGroup,n=e&&e.controlId,r={},a=!0,i=!1,o=void 0;try{for(var u,l=Object.keys(this.props)[Symbol.iterator]();!(a=(u=l.next()).done);a=!0){var c=u.value;t.propTypes[c]||(r[c]=this.props[c])}}catch(e){i=!0,o=e}finally{try{!a&&l.return&&l.return()}finally{if(i)throw o}}var p=!this.props.multiple||!this.state.selectedItems.length;return g.default.createElement("input",s({autoComplete:"off"},r,{className:(0,f.default)(this.props.className,{"form-control":!this.props.multiple}),ref:"input",key:"input",id:n,disabled:this.props.disabled,required:this.props.required&&p,placeholder:p?this.props.placeholder:void 0,type:this.props.type,value:this.state.inputValue,onChange:this._handleInputChange,onKeyDown:this._handleKeyDown,onKeyPress:this._handleKeyPress,onFocus:this._handleInputFocus,onBlur:this._handleInputBlur}))}},{key:"_renderMenu",value:function(){var e=this;this._pseudofocusedItem=null;var t=this.state.open;if(!t)return null;var n=this.props.datalist,r=this._itemAdapter.foldValue(this.state.inputValue);this._foldedInputValue=r;var a=void 0;a=this.state.disableFilter?this._listAdapter.toArray(n):this._listAdapter.filter(n,function(t){return e._itemAdapter.itemIncludedByInput(t,r)&&e._allowItem(t)}),a=this._itemAdapter.sortItems(a,r);var i=a.length<this._listAdapter.getLength(n),o=void 0;a.length>0&&this.state.inputFocused&&(!this.props.multiple||this.props.datalistOnly)&&(this._pseudofocusedItem=a[o=0]);var u=this.props,s=u.suggestionsClass,l=void 0===s?S.default:s,c=u.datalistMessage,f=u.onDatalistMessageSelect,p=u.toggleId;return g.default.createElement(l,{ref:"suggestions",datalistMessage:c,filtered:i,focusedIndex:o,getItemKey:this._getItemKey,isSelectedItem:this._isSelectedItem,items:a,labelledBy:p,onClose:this._handleMenuClose,onDatalistMessageSelect:f,onDisableFilter:this._handleShowAll,onSelect:this._handleItemSelect,open:t,renderItem:this._renderSuggested})}},{key:"_allowItem",value:function(e){var t=this;if(this.props.allowDuplicates)return!0;var n=this._itemAdapter.getInputValue(e);return!this.state.selectedItems.find(function(e){return t._itemAdapter.getInputValue(e)===n})}},{key:"_getItemKey",value:function(e){return this._itemAdapter.getReactKey(e)}},{key:"_isSelectedItem",value:function(e){return this._itemAdapter.itemMatchesInput(e,this._foldedInputValue)}},{key:"_renderSuggested",value:function(e){return this._itemAdapter.renderSuggested(e)}},{key:"_handleToggleClick",value:function(){this._toggleOpen("click",this.props)}},{key:"_handleInputChange",value:function(e){var t=this,n=e.target,r=n.value,a=this._keyPressCount>this.state.inputValueKeyPress;if(a&&r?this._autoCompleteAfterRender?(this._setValueMeta(),this._setInputValue(r,function(){t._checkAutoComplete(r,t.props)})):this._checkAutoComplete(r,this.props)||(this._setValueMeta(),this._setInputValue(r)):(this._setValueMeta(),this._setInputValue(r)),a||this.state.open){var i=this.props.onSearch;i&&(clearTimeout(this._searchTimeoutId),this._searchTimeoutId=setTimeout(function(){t._searchTimeoutId=null,r!=t.state.searchValue&&(t.setState({searchValue:r}),i(r))},this.props.searchDebounce))}}},{key:"_checkAutoComplete",value:function(e,t){var n=this,r=!1,a=t.datalist,i=this._itemAdapter.foldValue(e),o=this._listAdapter.filter(a,function(e){return n._itemAdapter.itemIncludedByInput(e,i)&&n._allowItem(e)});if(o.length>0){var u=t.datalistOnly,s=t.datalistPartial;if(1===o.length&&u&&!s){var l=o[0],c=this._itemAdapter.getInputValue(l),f=void 0,p=t.inputSelect;if(e!=c&&p&&this._itemAdapter.foldValue(c).startsWith(i)){var d=this.refs.input;f=function(){p(d,e,c)}}this._setValueMeta(l),this._setInputValue(c,f),r=!0,(this.state.open?t.closeOnCompletion:e!=c&&!t.closeOnCompletion)&&this._toggleOpen("autocomplete",t)}else{var h=o.find(function(e){return n._itemAdapter.itemMatchesInput(e,i)});h&&(this._setValueMeta(h),this._setInputValue(e),r=!0),this.state.open||h&&!(o.length>1)||this._open("autocomplete",t)}}return r}},{key:"_handleItemSelect",value:function(e){if(this.props.multiple)this._addItem(e);else{var t=this._itemAdapter.getInputValue(e);this._setValueMeta(e),this._setInputValue(t)}this._close()}},{key:"_addItem",value:function(e){if(this._allowItem(e)){var t=[].concat(a(this.state.selectedItems),[e]);this.setState({selectedItems:t});var n=this.props,r=n.onAdd,i=n.onChange;r&&r(e),i&&i(t)}this._clearInput(),this.state.open&&this._close()}},{key:"_removeItem",value:function(e){var t=this.state.selectedItems,n=t.slice(0,e).concat(t.slice(e+1));this.setState({selectedItems:n});var r=this.props,a=r.onRemove,i=r.onChange;a&&a(e),i&&i(n)}},{key:"_addInputValue",value:function(){return!!this._inputItem&&(this._addItem(this._inputItem),!0)}},{key:"_handleShowAll",value:function(){this.setState({disableFilter:!0})}},{key:"_handleKeyDown",value:function(e){if(!this.props.disabled)switch(e.keyCode||e.which){case y.default.codes.down:case y.default.codes["page down"]:this.state.open?this.refs.suggestions.focusFirst():this._canOpen()&&this._open("keydown",this.props),e.preventDefault();break;case y.default.codes.left:case y.default.codes.backspace:this.refs.choices&&this.refs.input&&0===this._getCursorPosition(this.refs.input)&&(this.refs.choices.focusLast(),e.preventDefault());break;case y.default.codes.right:this.refs.choices&&this.refs.input&&this._getCursorPosition(this.refs.input)===this.state.inputValue.length&&(this.refs.choices.focusFirst(),e.preventDefault());break;case y.default.codes.enter:if(this.props.multiple&&this.state.inputValue&&(e.preventDefault(),this._addInputValue()))break;this.state.open&&this.state.inputFocused&&(e.preventDefault(),this._pseudofocusedItem?this._handleItemSelect(this._pseudofocusedItem):this._close());break;case y.default.codes.esc:case y.default.codes.tab:this._handleMenuClose(e)}}},{key:"_getCursorPosition",value:function(e){var t=w.default.findDOMNode(e);if(t instanceof HTMLInputElement)return t.selectionStart}},{key:"_handleKeyPress",value:function(){++this._keyPressCount}},{key:"_handleMenuClose",value:function(){this.state.open&&this._close()}},{key:"_handleInputFocus",value:function(){this.setState({inputFocused:!0})}},{key:"_handleInputBlur",value:function(){this.setState({inputFocused:!1})}},{key:"_handleFocus",value:function(){if(this._focusTimeoutId)clearTimeout(this._focusTimeoutId),this._focusTimeoutId=null;else{this._focused=!0;var e=this.props.onFocus;if(e){e(this._getCurrentValue())}}}},{key:"_handleBlur",value:function(){var e=this;this._focusTimeoutId=setTimeout(function(){e._focusTimeoutId=null,e._focused=!1;var t=e.state.inputValue,n=e.props.onBlur;if(e.props.multiple)t&&!e._addInputValue()&&e._clearInput();else if(t!=e._lastValidValue){var r=void 0;return n&&(r=function(){var t=e._getCurrentValue();n(t)}),e._setValueMeta(e._lastValidItem,!1,!0,!0),void e._setInputValue(e._lastValidValue,r)}if(n){var a=e._getCurrentValue();n(a)}},1)}}]),t}(g.default.Component);L.propTypes={addonAfter:v.default.node,addonBefore:v.default.node,allowDuplicates:v.default.bool,bsSize:v.default.oneOf(["small","large"]),buttonAfter:v.default.node,buttonBefore:v.default.node,choicesClass:v.default.oneOfType([v.default.func,v.default.string]),closeOnCompletion:v.default.bool,datalist:v.default.any,datalistAdapter:v.default.object,datalistMessage:v.default.node,datalistOnly:v.default.bool,datalistPartial:v.default.bool,defaultValue:v.default.any,disabled:v.default.bool,dropup:v.default.bool,groupClassName:v.default.string,inputSelect:v.default.func,itemAdapter:v.default.object,itemReactKeyPropName:v.default.string,itemSortKeyPropName:v.default.string,itemValuePropName:v.default.string,multiple:v.default.bool,onAdd:v.default.func,onBlur:v.default.func,onChange:v.default.func,onDatalistMessageSelect:v.default.func,onFocus:v.default.func,onRemove:v.default.func,onSearch:v.default.func,onSelect:v.default.func,onToggle:v.default.func,placeholder:v.default.string,required:v.default.bool,searchDebounce:v.default.number,showToggle:v.default.oneOfType([v.default.bool,v.default.oneOf(["auto"])]),suggestionsClass:v.default.oneOfType([v.default.func,v.default.string]),toggleId:v.default.oneOfType([v.default.string,v.default.number]),type:v.default.string,value:v.default.any,valueIsItem:v.default.bool},L.contextTypes={$bs_formGroup:v.default.object},L.defaultProps={closeOnCompletion:!1,datalistOnly:!1,datalistPartial:!1,disabled:!1,dropup:!1,inputSelect:L.defaultInputSelect,multiple:!1,itemReactKeyPropName:"key",itemSortKeyPropName:"sortKey",itemValuePropName:"value",searchDebounce:250,showToggle:"auto",type:"text",valueIsItem:!1},t.default=L},function(e,t,n){var r,a;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var a=typeof r;if("string"===a||"number"===a)e.push(r);else if(Array.isArray(r))e.push(n.apply(null,r));else if("object"===a)for(var o in r)i.call(r,o)&&r[o]&&e.push(o)}}return e.join(" ")}var i={}.hasOwnProperty;void 0!==e&&e.exports?e.exports=n:(r=[],void 0!==(a=function(){return n}.apply(t,r))&&(e.exports=a))}()},function(e,t){"use strict";function n(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!==e&&t!==t}function r(e,t){if(n(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(var o=0;o<r.length;o++)if(!a.call(t,r[o])||!n(e[r[o]],t[r[o]]))return!1;return!0}var a=Object.prototype.hasOwnProperty;e.exports=r},function(e,t){t=e.exports=function(e){if(e&&"object"==typeof e){var t=e.which||e.keyCode||e.charCode;t&&(e=t)}if("number"==typeof e)return i[e];var a=String(e),o=n[a.toLowerCase()];if(o)return o;var o=r[a.toLowerCase()];return o||(1===a.length?a.charCodeAt(0):void 0)};var n=t.code=t.codes={backspace:8,tab:9,enter:13,shift:16,ctrl:17,alt:18,"pause/break":19,"caps lock":20,esc:27,space:32,"page up":33,"page down":34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,delete:46,command:91,"left command":91,"right command":93,"numpad *":106,"numpad +":107,"numpad -":109,"numpad .":110,"numpad /":111,"num lock":144,"scroll lock":145,"my computer":182,"my calculator":183,";":186,"=":187,",":188,"-":189,".":190,"/":191,"`":192,"[":219,"\\":220,"]":221,"'":222},r=t.aliases={windows:91,"⇧":16,"⌥":18,"⌃":17,"⌘":91,ctl:17,control:17,option:18,pause:19,break:19,caps:20,return:13,escape:27,spc:32,pgup:33,pgdn:34,ins:45,del:46,cmd:91};/*!
* Programatically add the following
*/
for(a=97;a<123;a++)n[String.fromCharCode(a)]=a-32;for(var a=48;a<58;a++)n[a-48]=a;for(a=1;a<13;a++)n["f"+a]=a+111;for(a=0;a<10;a++)n["numpad "+a]=a+96;var i=t.names=t.title={};for(a in n)i[n[a]]=a;for(var o in r)n[o]=r[o]},function(e,t,n){(function(t){if("production"!==t.env.NODE_ENV){var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,a=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r};e.exports=n(6)(a,!0)}else e.exports=n(12)()}).call(t,n(5))},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function a(e){if(c===setTimeout)return setTimeout(e,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function i(e){if(f===clearTimeout)return clearTimeout(e);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function o(){y&&d&&(y=!1,d.length?h=d.concat(h):m=-1,h.length&&u())}function u(){if(!y){var e=a(o);y=!0;for(var t=h.length;t;){for(d=h,h=[];++m<t;)d&&d[m].run();m=-1,t=h.length}d=null,y=!1,i(e)}}function s(e,t){this.fun=e,this.array=t}function l(){}var c,f,p=e.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:n}catch(e){c=n}try{f="function"==typeof clearTimeout?clearTimeout:r}catch(e){f=r}}();var d,h=[],y=!1,m=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];h.push(new s(e,t)),1!==h.length||y||a(u)},s.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=l,p.addListener=l,p.once=l,p.off=l,p.removeListener=l,p.removeAllListeners=l,p.emit=l,p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t,n){(function(t){"use strict";var r=n(7),a=n(8),i=n(9),o=n(10),u=n(11);e.exports=function(e,n){function s(e){var t=e&&(O&&e[O]||e[A]);if("function"==typeof t)return t}function l(e,t){return e===t?0!==e||1/e==1/t:e!==e&&t!==t}function c(e){this.message=e,this.stack=""}function f(e){function r(r,l,f,p,d,h,y){if(p=p||V,h=h||f,y!==o)if(n)a(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");else if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var m=p+":"+f;!u[m]&&s<3&&(i(!1,"You are manually calling a React.PropTypes validation function for the `%s` prop on `%s`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details.",h,p),u[m]=!0,s++)}return null==l[f]?r?new c(null===l[f]?"The "+d+" `"+h+"` is marked as required in `"+p+"`, but its value is `null`.":"The "+d+" `"+h+"` is marked as required in `"+p+"`, but its value is `undefined`."):null:e(l,f,p,d,h)}if("production"!==t.env.NODE_ENV)var u={},s=0;var l=r.bind(null,!1);return l.isRequired=r.bind(null,!0),l}function p(e){function t(t,n,r,a,i,o){var u=t[n];if(I(u)!==e)return new c("Invalid "+a+" `"+i+"` of type `"+w(u)+"` supplied to `"+r+"`, expected `"+e+"`.");return null}return f(t)}function d(e){function t(t,n,r,a,i){if("function"!=typeof e)return new c("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var u=t[n];if(!Array.isArray(u)){return new c("Invalid "+a+" `"+i+"` of type `"+I(u)+"` supplied to `"+r+"`, expected an array.")}for(var s=0;s<u.length;s++){var l=e(u,s,r,a,i+"["+s+"]",o);if(l instanceof Error)return l}return null}return f(t)}function h(e){function t(t,n,r,a,i){if(!(t[n]instanceof e)){var o=e.name||V;return new c("Invalid "+a+" `"+i+"` of type `"+k(t[n])+"` supplied to `"+r+"`, expected instance of `"+o+"`.")}return null}return f(t)}function y(e){function n(t,n,r,a,i){for(var o=t[n],u=0;u<e.length;u++)if(l(o,e[u]))return null;return new c("Invalid "+a+" `"+i+"` of value `"+o+"` supplied to `"+r+"`, expected one of "+JSON.stringify(e)+".")}return Array.isArray(e)?f(n):("production"!==t.env.NODE_ENV&&i(!1,"Invalid argument supplied to oneOf, expected an instance of array."),r.thatReturnsNull)}function m(e){function t(t,n,r,a,i){if("function"!=typeof e)return new c("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var u=t[n],s=I(u);if("object"!==s)return new c("Invalid "+a+" `"+i+"` of type `"+s+"` supplied to `"+r+"`, expected an object.");for(var l in u)if(u.hasOwnProperty(l)){var f=e(u,l,r,a,i+"."+l,o);if(f instanceof Error)return f}return null}return f(t)}function v(e){function n(t,n,r,a,i){for(var u=0;u<e.length;u++){if(null==(0,e[u])(t,n,r,a,i,o))return null}return new c("Invalid "+a+" `"+i+"` supplied to `"+r+"`.")}return Array.isArray(e)?f(n):("production"!==t.env.NODE_ENV&&i(!1,"Invalid argument supplied to oneOfType, expected an instance of array."),r.thatReturnsNull)}function _(e){function t(t,n,r,a,i){var u=t[n],s=I(u);if("object"!==s)return new c("Invalid "+a+" `"+i+"` of type `"+s+"` supplied to `"+r+"`, expected `object`.");for(var l in e){var f=e[l];if(f){var p=f(u,l,r,a,i+"."+l,o);if(p)return p}}return null}return f(t)}function g(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(g);if(null===t||e(t))return!0;var n=s(t);if(!n)return!1;var r,a=n.call(t);if(n!==t.entries){for(;!(r=a.next()).done;)if(!g(r.value))return!1}else for(;!(r=a.next()).done;){var i=r.value;if(i&&!g(i[1]))return!1}return!0;default:return!1}}function b(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function I(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":b(t,e)?"symbol":t}function w(e){var t=I(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function k(e){return e.constructor&&e.constructor.name?e.constructor.name:V}var O="function"==typeof Symbol&&Symbol.iterator,A="@@iterator",V="<<anonymous>>",P={array:p("array"),bool:p("boolean"),func:p("function"),number:p("number"),object:p("object"),string:p("string"),symbol:p("symbol"),any:function(){return f(r.thatReturnsNull)}(),arrayOf:d,element:function(){function t(t,n,r,a,i){var o=t[n];if(!e(o)){return new c("Invalid "+a+" `"+i+"` of type `"+I(o)+"` supplied to `"+r+"`, expected a single ReactElement.")}return null}return f(t)}(),instanceOf:h,node:function(){function e(e,t,n,r,a){return g(e[t])?null:new c("Invalid "+r+" `"+a+"` supplied to `"+n+"`, expected a ReactNode.")}return f(e)}(),objectOf:m,oneOf:y,oneOfType:v,shape:_};return c.prototype=Error.prototype,P.checkPropTypes=u,P.PropTypes=P,P}}).call(t,n(5))},function(e,t){"use strict";function n(e){return function(){return e}}var r=function(){};r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){(function(t){"use strict";function n(e,t,n,a,i,o,u,s){if(r(t),!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,a,i,o,u,s],f=0;l=new Error(t.replace(/%s/g,function(){return c[f++]})),l.name="Invariant Violation"}throw l.framesToPop=1,l}}var r=function(e){};"production"!==t.env.NODE_ENV&&(r=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")}),e.exports=n}).call(t,n(5))},function(e,t,n){(function(t){"use strict";var r=n(7),a=r;"production"!==t.env.NODE_ENV&&function(){var e=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var a=0,i="Warning: "+e.replace(/%s/g,function(){return n[a++]});"undefined"!=typeof console&&console.error(i);try{throw new Error(i)}catch(e){}};a=function(t,n){if(void 0===n)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==n.indexOf("Failed Composite propType: ")&&!t){for(var r=arguments.length,a=Array(r>2?r-2:0),i=2;i<r;i++)a[i-2]=arguments[i];e.apply(void 0,[n].concat(a))}}}(),e.exports=a}).call(t,n(5))},function(e,t){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){(function(t){"use strict";function r(e,n,r,s,l){if("production"!==t.env.NODE_ENV)for(var c in e)if(e.hasOwnProperty(c)){var f;try{a("function"==typeof e[c],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",s||"React class",r,c),f=e[c](n,c,s,r,null,o)}catch(e){f=e}if(i(!f||f instanceof Error,"%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",s||"React class",r,c,typeof f),f instanceof Error&&!(f.message in u)){u[f.message]=!0;var p=l?l():"";i(!1,"Failed %s type: %s%s",r,f.message,null!=p?p:"")}}}if("production"!==t.env.NODE_ENV)var a=n(8),i=n(9),o=n(10),u={};e.exports=r}).call(t,n(5))},function(e,t,n){"use strict";var r=n(7),a=n(8);e.exports=function(){function e(){a(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t){e.exports=n},function(e,t,n){(function(t){"use strict";var n=function(){};"production"!==t.env.NODE_ENV&&(n=function(e,t,n){var r=arguments.length;n=new Array(r>2?r-2:0);for(var a=2;a<r;a++)n[a-2]=arguments[a];if(void 0===t)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(t.length<10||/^[s\W]*$/.test(t))throw new Error("The warning format should be able to uniquely identify this warning. Please, use a more descriptive format than: "+t);if(!e){var i=0,o="Warning: "+t.replace(/%s/g,function(){return n[i++]});"undefined"!=typeof console&&console.error(o);try{throw new Error(o)}catch(e){}}}),e.exports=n}).call(t,n(5))},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(1),c=r(l),f=n(2),p=r(f),d=n(3),h=r(d),y=n(4),m=r(y),v=n(13),_=r(v),g=n(15),b=r(g),I=function(e){function t(){var e;i(this,t);for(var n=arguments.length,r=Array(n),u=0;u<n;u++)r[u]=arguments[u];var s=o(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(a(r)))),l=s;return l._handleKeyDown=s._handleKeyDown.bind(s),l._handleKeyPress=s._handleKeyPress.bind(s),l._handleClose=s._handleClose.bind(s),l._handleClick=s._handleClick.bind(s),l._focusInput=s._focusInput.bind(s),s}return u(t,e),s(t,[{key:"shouldComponentUpdate",value:function(e){return!(0,p.default)(this.props,e)}},{key:"render",value:function(){var e=this,t=this.props,n=t.autoHeight,r=t.disabled,a=t.focused,i=t.inputValue,o=t.items,u=t.renderItem,s=t.children,l=o.length>0,f=void 0;return l&&(f={width:.75*(i.length+1)+"em"}),_.default.createElement("ul",{className:(0,c.default)("form-control","autosuggest-choices",{focused:a,"has-items":l,"auto-height":n}),disabled:r,onClick:this._focusInput},o.map(function(t,n){return _.default.createElement("li",{key:n,"data-index":n,tabIndex:r?void 0:"-1",className:"autosuggest-choice",onKeyDown:e._handleKeyDown,onKeyPress:e._handleKeyPress},_.default.createElement("span",{className:"autosuggest-choice-close",onClick:e._handleClose}),_.default.createElement("span",{className:"autosuggest-choice-label",onClick:e._handleClick},u(t)))}),_.default.createElement("li",{className:"autosuggest-input-choice",style:f},s))}},{key:"_handleKeyDown",value:function(e){switch(e.keyCode){case h.default.codes.left:this._focusPrevious(),e.preventDefault();break;case h.default.codes.right:this._focusNext(),e.preventDefault();break;case h.default.codes.backspace:this._removeActive(-1),e.preventDefault();break;case h.default.codes.delete:this._removeActive(0),e.preventDefault()}}},{key:"_handleKeyPress",value:function(e){this._focusInput();var t=this.props.onKeyPress;t&&t(e)}},{key:"_handleClose",value:function(e){if(!this.props.disabled&&e.target instanceof HTMLElement){var t=e.target.parentNode;if(t instanceof Element){var n=Number(t.getAttribute("data-index"));this._remove(n)}}e.stopPropagation()}},{key:"_handleClick",value:function(e){e.stopPropagation()}},{key:"focusFirst",value:function(){var e=this._getFocusableMenuItems(!1);e.length>0&&e[0].focus()}},{key:"focusLast",value:function(){var e=this._getFocusableMenuItems(!1);e.length>0&&e[e.length-1].focus()}},{key:"_focusPrevious",value:function(){var e=this._getItemsAndActiveIndex(!0),t=e.items,n=e.activeIndex;n>0?t[n-1].focus():t.length>0&&t[t.length-1].focus()}},{key:"_focusNext",value:function(){var e=this._getItemsAndActiveIndex(!0),t=e.items,n=e.activeIndex;n<t.length-1?t[n+1].focus():t.length>0&&t[0].focus()}},{key:"_focusInput",value:function(){var e=b.default.findDOMNode(this);if(e instanceof Element){var t=e.querySelector("input");t&&t.focus()}}},{key:"_remove",value:function(e){var t=this.props.onRemove;t&&t(e)}},{key:"_removeActive",value:function(e){var t=this._getItemsAndActiveIndex(!1),n=t.items,r=t.activeIndex;if(r>=0){var a=r+e;a<0||a>=n.length-1?this._focusInput():0!=e&&n[a].focus(),this._remove(r)}}},{key:"_getItemsAndActiveIndex",value:function(e){var t=this._getFocusableMenuItems(e),n=document.activeElement;return{items:t,activeIndex:n?t.indexOf(n):-1}}},{key:"_getFocusableMenuItems",value:function(e){var t=b.default.findDOMNode(this);return t instanceof Element?Array.from(t.querySelectorAll(e?'[tabIndex="-1"],input':'[tabIndex="-1"]')):[]}}]),t}(_.default.Component);I.propTypes={autoHeight:m.default.bool,disabled:m.default.bool,focused:m.default.bool,inputValue:m.default.string,items:m.default.arrayOf(m.default.any).isRequired,onKeyPress:m.default.func,onRemove:m.default.func,renderItem:m.default.func.isRequired},t.default=I},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=n(2),l=r(s),c=n(4),f=r(c),p=n(13),d=r(p),h=n(14),y=n(15),m=r(y),v=function(e){function t(){return a(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),u(t,[{key:"shouldComponentUpdate",value:function(e){return!(0,l.default)(this.props,e)}},{key:"isFocused",value:function(){var e=m.default.findDOMNode(this.refs.menu);return null!=e&&document&&e.contains(document.activeElement)}},{key:"focusFirst",value:function(){this.refs.menu.focusNext()}},{key:"render",value:function(){var e=this.props,t=e.items,n=e.datalistMessage,r=e.onDatalistMessageSelect;return d.default.createElement(h.Dropdown.Menu,{labelledBy:this.props.labelledBy,onClose:this.props.onClose,open:this.props.open,ref:"menu"},t.map(this._renderItem,this),this.props.filtered&&d.default.createElement(h.MenuItem,{key:"show-all",onSelect:this.props.onDisableFilter},d.default.createElement("span",{className:"show-all"},0===t.length?d.default.createElement("span",{className:"no-matches"}):null)),n&&d.default.createElement(h.MenuItem,{key:"datalist-message",disabled:null==r,onSelect:r},n))}},{key:"_renderItem",value:function(e,t){var n=this.props.isSelectedItem(e);return d.default.createElement(h.MenuItem,{active:n,className:t!==this.props.focusedIndex||n?void 0:"pseudofocused",eventKey:e,key:this.props.getItemKey(e),onSelect:this.props.onSelect},this.props.renderItem(e))}}]),t}(d.default.Component);v.propTypes={datalistMessage:f.default.node,filtered:f.default.bool,focusedIndex:f.default.number,getItemKey:f.default.func.isRequired,isSelectedItem:f.default.func.isRequired,items:f.default.arrayOf(f.default.any).isRequired,labelledBy:f.default.oneOfType([f.default.string,f.default.number]),onClose:f.default.func,onDatalistMessageSelect:f.default.func,onDisableFilter:f.default.func,onSelect:f.default.func.isRequired,open:f.default.bool,renderItem:f.default.func.isRequired},t.default=v},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e){return"number"==typeof e?e:e.toString()}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function(){function e(){n(this,e)}return a(e,[{key:"receiveProps",value:function(e){this.props=e}},{key:"getReactKey",value:function(e){var t=this.props.itemReactKeyPropName;if(t){var n=e[t];if(null!=n)return n}return r(this.getRawValue(e))}},{key:"getSortKey",value:function(e){var t=this.props.itemSortKeyPropName;if(t){var n=e[t];if(null!=n)return n}return r(this.getRawValue(e))}},{key:"getInputValue",value:function(e){return this.getRawValue(e).toString()}},{key:"getRawValue",value:function(e){var t=this.props.itemValuePropName;if(t){var n=e[t];if(null!=n)return n}return e}},{key:"getTextRepresentations",value:function(e){return[this.foldValue(this.getInputValue(e))]}},{key:"foldValue",value:function(e){return e.toLowerCase()}},{key:"newFromValue",value:function(e){return e}},{key:"itemIncludedByInput",value:function(e,t){var n=!0,r=!1,a=void 0;try{for(var i,o=this.getTextRepresentations(e)[Symbol.iterator]();!(n=(i=o.next()).done);n=!0){if(i.value.indexOf(t)>=0)return!0}}catch(e){r=!0,a=e}finally{try{!n&&o.return&&o.return()}finally{if(r)throw a}}return!1}},{key:"itemMatchesInput",value:function(e,t){var n=!0,r=!1,a=void 0;try{for(var i,o=this.getTextRepresentations(e)[Symbol.iterator]();!(n=(i=o.next()).done);n=!0){if(i.value===t)return!0}}catch(e){r=!0,a=e}finally{try{!n&&o.return&&o.return()}finally{if(r)throw a}}return!1}},{key:"sortItems",value:function(e,t){var n=this;return e.sort(function(e,r){return n.compareItemsWithValue(e,r,t)}),e}},{key:"compareItemsWithValue",value:function(e,t,n){var r=this.itemMatchesInput(e,n);if(r!=this.itemMatchesInput(t,n))return r?-1:1;var a=this.itemInclusionRankForInput(e,n),i=this.itemInclusionRankForInput(t,n);return a!=i?a-i:this.compareItems(e,t)}},{key:"itemInclusionRankForInput",value:function(e,t){var n=!1,r=!0,a=!1,i=void 0;try{for(var o,u=this.getTextRepresentations(e)[Symbol.iterator]();!(r=(o=u.next()).done);r=!0){var s=o.value,l=s.indexOf(t);if(0===l)return 0;l>0&&(n=!0)}}catch(e){a=!0,i=e}finally{try{!r&&u.return&&u.return()}finally{if(a)throw i}}return n?1:2}},{key:"compareItems",value:function(e,t){var n=this.getSortKey(e),r=this.getSortKey(t);return n<r?-1:n==r?0:1}},{key:"renderItem",value:function(e){return this.getInputValue(e)}},{key:"renderSuggested",value:function(e){return this.renderItem(e)}},{key:"renderSelected",value:function(e){return this.renderItem(e)}}]),e}();t.default=i},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=n(19),o=(function(e){e&&e.__esModule}(i),function(){function e(){r(this,e)}return a(e,[{key:"receiveProps",value:function(e,t){this.props=e,this.itemAdapter=t}},{key:"isEmpty",value:function(e){return!this.getLength(e)}},{key:"filter",value:function(e,t){return this.toArray(e).filter(t)}},{key:"find",value:function(e,t){return this.toArray(e).find(t)}},{key:"findMatching",value:function(e,t){var n=this,r=this.itemAdapter.foldValue(t);return this.find(e,function(e){return n.itemAdapter.itemMatchesInput(e,r)})}}]),e}());t.default=o},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(20),s=function(e){return e&&e.__esModule?e:{default:e}}(u),l=function(e){function t(){return r(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),o(t,[{key:"getLength",value:function(){return 0}},{key:"filter",value:function(){return[]}},{key:"find",value:function(){}},{key:"toArray",value:function(){return[]}}]),t}(s.default);t.default=l},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(20),s=function(e){return e&&e.__esModule?e:{default:e}}(u),l=function(e){function t(){return r(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return i(t,e),o(t,[{key:"getLength",value:function(e){return e.length}},{key:"filter",value:function(e,t){return e.filter(t)}},{key:"find",value:function(e,t){return e.find(t)}},{key:"toArray",value:function(e){return e.slice()}}]),t}(s.default);t.default=l},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(24),s=function(e){ret