import{j as e,M as r,aD as u}from"./vendor-mui-CBBEb17G.js";import{aP as c,aT as d,r as S,dK as I}from"./index-IP_FWtso.js";import{a as s}from"./vendor-react-BBazpZul.js";const D=({onSearch:l})=>{const[n,x]=s.useState(""),[a,h]=s.useState(""),[o,j]=s.useState(null),[i,p]=s.useState(""),[m,g]=s.useState("");return s.useEffect(()=>{if(n.length<1&&a.length<1&&i.length<1){o&&clearTimeout(o);return}o&&clearTimeout(o);const t=setTimeout(()=>l({name:n,code:a,brand:i,format:m}),1e3);j(t)},[n,a,i,m]),e.jsxs(r,{container:!0,spacing:2,className:"searchDrug",mt:-3,children:[e.jsx(r,{item:!0,xs:12,sm:6,md:4,children:e.jsx(c,{autoFocus:!0,value:n,label:"جستجو با نام دارو",onChange:t=>x(t),InputProps:{endAdornment:e.jsx(u,{position:"start",children:e.jsx(d,{})})}})}),e.jsx(r,{item:!0,xs:12,sm:6,md:4,children:e.jsx(c,{value:i,label:"جستجو با نام تجاری",onChange:t=>p(t),InputProps:{endAdornment:e.jsx(u,{position:"start",children:e.jsx(d,{})})}})}),e.jsx(r,{item:!0,xs:12,sm:6,md:2,children:e.jsx(c,{value:a,label:"جستجو با کد دارو",onChange:t=>h(t),InputProps:{endAdornment:e.jsx(u,{position:"start",children:e.jsx(d,{})})}})}),e.jsx(r,{item:!0,xs:12,sm:6,md:2,children:e.jsx(S,{items:I,label:"نوع دارو",value:m,onchange:t=>g(t)})})]})};export{D as S};
