import{j as e,z as S,y as I,bN as z,M as c,al as p,T as n,V as O,c6 as T,F as M,X as t}from"./vendor-mui-core-D7t4vMS5.js";import{t as V}from"./arrow-down.svg-Dz9H9vM-.js";import{a1 as W}from"./vendor-ux-Dl3wVbv_.js";function B({fullWidth:m=!1,multiple:a=!1,required:o=!1,label:x="",placeholder:j="",options:s=[],helperText:b="",error:v=!1,margin:u="",size:f,slotProps:y={},...h}){const g=s.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(z,{multiple:a,sx:{"& .MuiInputBase-input":{width:"calc(100% - 46px)","& > .MuiBox-root:first-of-type":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},input:e.jsx(T,{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=s.find(w=>w.value===i);return d&&d.title&&e.jsx(O,{size:"small",label:d.title},i)})});const r=s.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(V,{...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"}),s.map(l=>l&&l.value&&e.jsx(c,{value:l.value,disabled:l.disabled||!1,children:e.jsxs(p,{sx:W({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(M,{children:b})]})}B.propTypes={error:t.bool,required:t.bool,multiple:t.bool,fullWidth:t.bool,label:t.string,placeholder:t.string,options:t.array,helperText:t.string,margin:t.string,size:t.string,textDirection:t.oneOf(["row","column"]),slotProps:t.object};export{B as S};
