import{booleanType as e,functionType as t,someType as n,stringType as r}from"../_util/type.mjs";import i from"../_util/classNames.mjs";import a from"../_util/omit.mjs";import{useInjectDisabled as o}from"../config-provider/DisabledContext.mjs";import s from"../_util/props-util/initDefaultProps.mjs";import{DefaultRenderEmpty as c}from"../config-provider/renderEmpty.mjs";import l from"../config-provider/hooks/useConfigInject.mjs";import u from"../_util/vue-types/index.mjs";import{getMergedStatus as d,getStatusClassNames as f}from"../_util/statusUtils.mjs";import{getTransitionDirection as p,getTransitionName as m}from"../_util/transition.mjs";import{FormItemInputContext as h,useInjectFormItemContext as g}from"../form/FormItemContext.mjs";import{useCompactItemContext as _}from"../space/Compact.mjs";import v from"../vc-select/OptGroup.mjs";import y from"../vc-select/Option.mjs";import{selectProps as b}from"../vc-select/Select.mjs";import x from"../vc-select/index.mjs";import S from"./style/index.mjs";import C from"./utils/iconUtil.mjs";import{computed as w,createVNode as T,defineComponent as E,ref as D}from"vue";var O=()=>({...a(b(),[`inputIcon`,`mode`,`getInputElement`,`getRawInputElement`,`backfill`]),value:n([Array,Object,String,Number]),defaultValue:n([Array,Object,String,Number]),notFoundContent:u.any,suffixIcon:u.any,itemIcon:u.any,size:r(),mode:r(),bordered:e(!0),transitionName:String,choiceTransitionName:r(``),popupClassName:String,dropdownClassName:String,placement:r(),status:r(),"onUpdate:value":t()}),k=`SECRET_COMBOBOX_MODE_DO_NOT_USE`,A=E({compatConfig:{MODE:3},name:`ASelect`,Option:y,OptGroup:v,inheritAttrs:!1,props:s(O(),{listHeight:256,listItemHeight:24}),SECRET_COMBOBOX_MODE_DO_NOT_USE:k,slots:Object,setup(e,{attrs:t,emit:n,slots:r,expose:s}){let u=D(),v=g(),y=h.useInject(),b=w(()=>d(y.status,e.status)),E=()=>{u.value?.focus()},O=()=>{u.value?.blur()},A=e=>{u.value?.scrollTo(e)},j=w(()=>{let{mode:t}=e;if(t!==`combobox`)return t===k?`combobox`:t}),{prefixCls:M,direction:N,configProvider:P,renderEmpty:ee,size:F,getPrefixCls:I,getPopupContainer:L,disabled:R,select:z}=l(`select`,e),{compactSize:B,compactItemClassnames:V}=_(M,N),H=w(()=>B.value||F.value),U=o(),W=w(()=>R.value??U.value),[G,K]=S(M),q=w(()=>I()),J=w(()=>e.placement===void 0?N.value===`rtl`?`bottomRight`:`bottomLeft`:e.placement),Y=w(()=>m(q.value,p(J.value),e.transitionName)),X=w(()=>i({[`${M.value}-lg`]:H.value===`large`,[`${M.value}-sm`]:H.value===`small`,[`${M.value}-rtl`]:N.value===`rtl`,[`${M.value}-borderless`]:!e.bordered,[`${M.value}-in-form-item`]:y.isFormItemInput},f(M.value,b.value,y.hasFeedback),V.value,K.value)),Z=(...e)=>{n(`update:value`,e[0]),n(`change`,...e),v.onFieldChange()},Q=e=>{n(`blur`,e),v.onFieldBlur()};s({blur:O,focus:E,scrollTo:A});let $=w(()=>j.value===`multiple`||j.value===`tags`),te=w(()=>e.showArrow===void 0?e.loading||!($.value||j.value===`combobox`):e.showArrow);return()=>{let{notFoundContent:n,listHeight:o=256,listItemHeight:s=24,popupClassName:l,dropdownClassName:d,virtual:f,dropdownMatchSelectWidth:p,id:m=v.id.value,placeholder:h=r.placeholder?.(),showArrow:g}=e,{hasFeedback:_,feedbackIcon:b}=y,{}=P,S;S=n===void 0?r.notFoundContent?r.notFoundContent():j.value===`combobox`?null:ee?.(`Select`)||T(c,{componentName:`Select`},null):n;let{suffixIcon:w,itemIcon:E,removeIcon:D,clearIcon:O}=C({...e,multiple:$.value,prefixCls:M.value,hasFeedback:_,feedbackIcon:b,showArrow:te.value},r),k=a(e,[`prefixCls`,`suffixIcon`,`itemIcon`,`removeIcon`,`clearIcon`,`size`,`bordered`,`status`]),A=i(l||d,{[`${M.value}-dropdown-${N.value}`]:N.value===`rtl`},K.value);return G(T(x,{ref:u,virtual:f,dropdownMatchSelectWidth:p,...k,...t,showSearch:e.showSearch??z?.value?.showSearch,placeholder:h,listHeight:o,listItemHeight:s,mode:j.value,prefixCls:M.value,direction:N.value,inputIcon:w,menuItemSelectedIcon:E,removeIcon:D,clearIcon:O,notFoundContent:S,class:[X.value,t.class],getPopupContainer:L?.value,dropdownClassName:A,onChange:Z,onBlur:Q,id:m,dropdownRender:k.dropdownRender||r.dropdownRender,transitionName:Y.value,children:r.default?.(),tagRender:e.tagRender||r.tagRender,optionLabelRender:r.optionLabel,maxTagPlaceholder:e.maxTagPlaceholder||r.maxTagPlaceholder,showArrow:_||g,disabled:W.value},{option:r.option}))}}});A.install=function(e){return e.component(A.name,A),e.component(A.Option.displayName,A.Option),e.component(A.OptGroup.displayName,A.OptGroup),e};var j=A.Option,M=A.OptGroup;export{M as SelectOptGroup,j as SelectOption,A as default,O as selectProps};