import{j as e,F as I,aC as C,S as O,ac as b,M as p,B as u,J as i,aD as z,aE as B,aF as F,aG as M,o as s}from"./index-DR3HTfO6.js";function T({fullWidth:g=!1,multiple:r=!1,required:o=!1,label:f="",placeholder:h="",options:a=[],helperText:v="",error:y=!1,margin:m="",size:j,slotProps:x={},...d}){const w=a.find(l=>l.value===d.value)?.title;return e.jsxs(I,{margin:m,fullWidth:g,error:y,sx:x?.formControl?.sx,children:[e.jsx(C,{size:j,sx:x?.label?.sx,children:`${f}${o?"*":""}`}),e.jsxs(O,{multiple:r,input:e.jsx(F,{defaultValue:w,sx:{flex:1},required:o,label:f,inputProps:{margin:m},size:j}),renderValue:l=>{if(r)return e.jsx(u,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:l.map(n=>{const c=a.find(S=>S.value===n);return c&&c.title&&e.jsx(B,{size:"small",label:c.title},n)})});const t=a.find(n=>n.value===l);return t&&t.title&&e.jsxs(u,{children:[e.jsx(i,{component:"span",children:t.title}),e.jsx(i,{component:"span",variant:"body2",sx:{marginLeft:1,color:"text.secondary"},children:t.description})]})},IconComponent:l=>e.jsx(z,{...l,width:20,height:20}),...d,sx:b({"& .MuiInputBase-input":{width:"calc(100% - 46px)","& > .MuiBox-root:first-of-type":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},d.sx),children:[h?e.jsx(p,{disabled:!0,children:e.jsx("em",{children:h})}):null,!o&&!r&&e.jsx(p,{value:"",children:"None"}),a.map(l=>l&&l.value&&e.jsx(p,{value:l.value,disabled:l.disabled||!1,children:e.jsxs(u,{sx:b({display:"flex",flexDirection:"column",gap:1},x?.optionItem?.sx),children:[e.jsx(i,{component:"span",children:l.title}),l.description&&e.jsx(i,{component:"span",variant:"body2",sx:{maxWidth:510,fontSize:12,whiteSpace:"normal",color:"text.secondary"},children:l.description})]})},l.value))]}),e.jsx(M,{children:v})]})}T.propTypes={error:s.bool,required:s.bool,multiple:s.bool,fullWidth:s.bool,label:s.string,placeholder:s.string,options:s.array,helperText:s.string,margin:s.string,size:s.string,height:s.number,textDirection:s.oneOf(["row","column"]),slotProps:s.object};export{T as S};
