import{j as e,z as I,y as z,bN as O,M as p,al as u,T as i,V as T,c3 as C,F as M,X as s}from"./vendor-mui-core-CDEc-eG6.js";import{t as V}from"./arrow-down.svg-Dz9H9vM-.js";import{a1 as b}from"./vendor-ux-bFYdDLNG.js";function W({fullWidth:g=!1,multiple:a=!1,required:o=!1,label:f="",placeholder:h="",options:t=[],helperText:v="",error:y=!1,margin:m="",size:j,slotProps:x={},...d}){const w=t.find(l=>l.value===d.value)?.title;return e.jsxs(I,{margin:m,fullWidth:g,error:y,sx:x?.formControl?.sx,children:[e.jsx(z,{size:j,sx:x?.label?.sx,children:`${f}${o?"*":""}`}),e.jsxs(O,{multiple:a,input:e.jsx(C,{defaultValue:w,sx:{flex:1},required:o,label:f,inputProps:{margin:m},size:j}),renderValue:l=>{if(a)return e.jsx(u,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:l.map(r=>{const c=t.find(S=>S.value===r);return c&&c.title&&e.jsx(T,{size:"small",label:c.title},r)})});const n=t.find(r=>r.value===l);return n&&n.title&&e.jsxs(u,{children:[e.jsx(i,{component:"span",children:n.title}),e.jsx(i,{component:"span",variant:"body2",sx:{marginLeft:1,color:"text.secondary"},children:n.description})]})},IconComponent:l=>e.jsx(V,{...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&&!a&&e.jsx(p,{value:"",children:"None"}),t.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})]})}W.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{W as S};
