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