import{j as e,y as S,x as I,bZ as O,M as c,ak as p,T as n,U as T,ca as W,F as z,W as s}from"./vendor-mui-core-DnR6WYuU.js";import{l as M}from"./arrow-down.svg-C4FUKwt4.js";import{K as B}from"./vendor-ux-DTEmWsko.js";function C({fullWidth:m=!1,multiple:a=!1,required:o=!1,label:x="",placeholder:j="",options:t=[],helperText:b="",error:v=!1,margin:u="",size:f,slotProps:y={},...h}){const g=t.find(l=>l.value===h.value)?.title;return e.jsxs(S,{margin:u,fullWidth:m,error:v,children:[e.jsx(I,{size:f,children:`${x}${o?"*":""}`}),e.jsxs(O,{multiple:a,sx:{"& .MuiInputBase-input":{width:"calc(100% - 46px)","& > .MuiBox-root:first-of-type":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},input:e.jsx(W,{defaultValue:g,sx:{flex:1},required:o,label:x,inputProps:{margin:u},size:f}),renderValue:l=>{if(a)return e.jsx(p,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:l.map(i=>{const d=t.find(w=>w.value===i);return d&&d.title&&e.jsx(T,{size:"small",label:d.title},i)})});const r=t.find(i=>i.value===l);return r&&r.title&&e.jsxs(p,{children:[e.jsx(n,{component:"span",children:r.title}),e.jsx(n,{component:"span",variant:"body2",sx:{marginLeft:1,color:"text.secondary"},children:r.description})]})},IconComponent:l=>e.jsx(M,{...l,width:20,height:20}),...h,children:[e.jsx(c,{disabled:!0,children:e.jsx("em",{children:j})}),!o&&!a&&e.jsx(c,{value:"",children:"None"}),t.map(l=>l&&l.value&&e.jsx(c,{value:l.value,disabled:l.disabled||!1,children:e.jsxs(p,{sx:B({display:"flex",flexDirection:"column"},y?.optionItem?.sx),children:[e.jsx(n,{component:"span",children:l.title}),l.description&&e.jsx(n,{component:"span",variant:"body2",sx:{maxWidth:510,fontSize:12,whiteSpace:"normal",color:"text.secondary"},children:l.description})]})},l.value))]}),e.jsx(z,{children:b})]})}C.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,textDirection:s.oneOf(["row","column"]),slotProps:s.object};export{C as S};
