import{slicedToArray as e}from"../../../../../_virtual/_rollupPluginBabelHelpers.js";import o,{useState as n}from"react";import t from"../hooks/useDropdownMultiCombobox.js";import l from"../components/DropdownWrapperUI.js";var i=function(i){var r=i.options,u=i.isMenuOpen,s=i.autoFocus,a=i.defaultValue,d=i.value,p=i.inputValue,c=i.onChange,g=i.onInputChange,m=i.onMenuClose,v=i.onMenuOpen,O=i.onOptionSelect,f=i.filterOption,b=i.showSelectedOptions,I=void 0===b||b,P=i.clearable,h=void 0===P||P,w=i.searchable,M=void 0===w||w,S=i.multi,j=void 0===S||S,x=i.closeMenuOnSelect,y=void 0===x||x,D=i.dropdownRef,B=i.onFocus,C=i.onBlur,F=i.onKeyDown,V=i.onClear,R=i.onOptionRemove,A=i.loading,K=void 0!==A&&A,T=i.size,z=void 0===T?"medium":T,L=i.id,_=n(Array.isArray(a)?a:[]),k=e(_,2),E=k[0],H=k[1],U=n(!1),W=e(U,2),q=W[0],G=W[1],J=t(r,E,H,u,s,a,d,p,c,g,m,v,O,f,I,L),N=J.isOpen,Q=J.inputValue,X=J.highlightedIndex,Y=J.getToggleButtonProps,Z=J.getLabelProps,$=J.getMenuProps,ee=J.getItemProps,oe=J.getInputProps,ne=J.reset,te=J.toggleMenu,le=J.filteredOptions,ie=J.selectedItems,re=J.addSelectedItem,ue=J.removeSelectedItem,se=J.getDropdownProps,ae=Object.assign(Object.assign({},i),{isOpen:N,inputValue:null!=Q?Q:null,highlightedIndex:X,selectedItems:ie||[],filteredOptions:le,getToggleButtonProps:Y,getLabelProps:Z,getMenuProps:$,getItemProps:ee,getInputProps:function(e){return oe(Object.assign(Object.assign({},e||{}),{disabled:i.readOnly||i.disabled,onFocus:function(o){var n;G(!0),null==B||B(o),null===(n=null==e?void 0:e.onFocus)||void 0===n||n.call(e,o)},onBlur:function(o){var n;G(!1),null==C||C(o),null===(n=null==e?void 0:e.onBlur)||void 0===n||n.call(e,o)},onKeyDown:function(o){var n;null==F||F(o),null===(n=null==e?void 0:e.onKeyDown)||void 0===n||n.call(e,o)}}))},reset:ne,contextOnClear:function(){ne(),void 0===d&&H([]),null==V||V()},contextOnOptionRemove:function(e){ue&&ue(e),null==R||R(e)},addSelectedItem:re,removeSelectedItem:ue,isFocused:q,clearable:h,searchable:M,multi:j,closeMenuOnSelect:y,size:z,getDropdownProps:se,toggleMenu:te,loading:K});return o.createElement(l,{contextValue:ae,dropdownRef:D})};export{i as default};
//# sourceMappingURL=DropdownMultiComboboxController.js.map
