import{d as b,a as r}from"./index-67d91626.js";import{r as t}from"./react-aa5cf9ec.js";import{c as p,g as v}from"./antd-0ecf45d2.js";function F({fetchOptions:a,debounceTimeout:s=800,mode:h,...d}){const[S,o]=t.useState(!1),[l,c]=t.useState(),u=t.useRef(0);t.useEffect(()=>{f()},[]);const f=async e=>{u.current+=1,u.current,c([]),o(!0);let m=(await a(e)).map(n=>({...n,value:n.id,label:n.name}));c(m),o(!1)},i=t.useMemo(()=>b(f,s),[a,s]);return r(p,{labelInValue:!0,filterOption:!1,onSearch:i,notFoundContent:S?r(v,{size:"small"}):null,...d,showSearch:!0,allowClear:!0,onClear:i,mode:h,children:l&&l.map(e=>r(p.Option,{value:e.value,children:e.label},e.value))})}export{F as D};
