1import{j as o}from"./jsx-runtime-D_zvdyIk.js";import{r as v}from"./createLucideIcon-CiWnlb16.js";import{d as B,c1 as F,dD as H,dE as A,dF as P}from"./loginCallback-DUlVA6A0.js";const Q=({selectItems:e,setSelectedItem:r,label:t,placeholder:d,setLabelFromValue:p,fieldToChange:n,nested:h,nestedItems:m,nestedField:b,value:l,request:u,isArray:g,index:f,trigger:c,saveValueToStorage:C,id:_,className:L,onOptionSelect:x,dispatchAction:w,items:S})=>{const i=v.useRef(null),j=v.useRef(null),k=B(),[N,D]=v.useState(!1),E=()=>{D(!N),i.current.classList.toggle("select-active")},z=s=>{s.composedPath().includes(j.current)||(D(!1),i.current?.classList.remove("select-active"))};v.useEffect(()=>{if(p){const s=e.find(a=>a.label===p);y(s?.label)}else{const s=e.find(a=>a.value===l);y(l!==""&&l!==void 0?s?.label:d||s?.label)}return document.body.addEventListener("click",z),()=>document.body.removeEventListener("click",z)},[l]);const M=s=>{C&&localStorage.setItem("select",JSON.stringify(s)),h?(r&&r(a=>({...a,[b]:{...m,[n]:s}})),c&&c()):g?(r&&r(a=>[...a.slice(0,f),{...a[f],[n]:s},...a.slice(f+1)]),c&&c()):(r&&r(a=>({...a,[n]:s})),c&&c()),D(!1),i.current.classList.remove("select-active")},[O,y]=v.useState(e[0].label);return o.jsxs("div",{className:"select-wrapper",children:[t&&o.jsx("label",{id:_,children:t}),o.jsxs("div",{className:"select-container",ref:j,children:[o.jsxs("div",{className:`select ${L}`,onClick:E,ref:i,children:[o.jsx("div",{className:"select__value",children:O}),o.jsx("div",{className:"select__icon",children:o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 384 512",children:o.jsx("path",{d:"M192 384c-8.188 0-16.38-3.125-22.62-9.375l-160-160c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L192 306.8l137.4-137.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-160 160C208.4 380.9 200.2 384 192 384z"})})})]}),N&&o.jsx("div",{className:"select-options",children:e.map(({label:s,value:a},R)=>o.jsx("div",{className:"select-option",onClick:()=>{M(a),y(s),u&&u(),x&&x(a),w&&k(w({...S,[n]:a}))},children:s},R+s))})]})]})},$={control:(e,r)=>({...e,minHeight:"38px",borderRadius:"0.2rem",borderColor:r.isFocused?"#2486ff":"var(--search-select-border-color, var(--input-border-color))",boxShadow:r.isFocused?"0 0 0 1px #2486ff":"0 0 0 1px transparent",backgroundColor:r.isDisabled?"var(--gray_100)":"var(--input-bgc-color)",transition:"0.2s ease border",cursor:"pointer","&:hover":{borderColor:"#2486ff",boxShadow:"0 0 0 1px #2486ff"}}),valueContainer:e=>({...e,padding:"0 0 0 0.625rem"}),placeholder:(e,r)=>({...e,margin:0,fontSize:".9rem",color:r.isDisabled?"var(--gray_400)":"var(--gray_600)"}),singleValue:(e,r)=>({...e,margin:0,fontSize:".9rem",color:r.isDisabled?"var(--gray_400)":"var(--gray_600)"}),input:e=>({...e,margin:0,padding:0,fontSize:".9rem",color:"var(--input-color)"}),indicatorSeparator:()=>({display:"none"}),clearIndicator:e=>({...e,padding:"0 0 0 0.625rem",color:"var(--gray_400)","&:hover":{color:"var(--gray_600)"}}),dropdownIndicator:e=>({...e,padding:"0 0.625rem",marginLeft:"0.625rem",borderLeft:"1px solid var(--border)",color:"var(--gray_400)","&:hover":{color:"var(--gray_400)"}}),menu:e=>({...e,marginTop:"0.2rem",borderRadius:"0.2rem",border:"1px solid var(--border)",boxShadow:"none",backgroundColor:"var(--input-bgc-color)",zIndex:100}),menuList:e=>({...e,padding:0,maxHeight:"300px"}),groupHeading:e=>({...e,margin:0,padding:"0.5rem",color:"var(--input-label-color)"}),option:(e,r)=>({...e,padding:"0.5rem",fontSize:".9rem",cursor:"pointer",color:"var(--text-color)",backgroundColor:r.isFocused||r.isSelected?"var(--hover)":"transparent",borderBottom:"1px solid var(--border)","&:last-child":{borderBottom:"none"},"&:active":{backgroundColor:"var(--hover)"}})},J=e=>o.jsx(A.DropdownIndicator,{...e,children:o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 384 512",width:"16",height:"16",children:o.jsx("path",{d:"M192 384c-8.188 0-16.38-3.125-22.62-9.375l-160-160c-12.5-12.5-12.5-32.75 0-45.25s32.75-12.5 45.25 0L192 306.8l137.4-137.4c12.5-12.5 32.75-12.5 45.25 0s12.5 32.75 0 45.25l-160 160C208.4 380.9 200.2 384 192 384z"})})}),U=({value:e,defaultValue:r,options:t,label:d,placeholder:p,noOptionsMessage:n,onChange:h,isClearable:m,isSearchable:b,isDisabled:l,styles:u,components:g})=>o.jsxs("div",{className:"select-wrapper",children:[d&&o.jsx("label",{children:d}),o.jsx(F,{styles:H($,u??{}),components:{DropdownIndicator:J,...g},value:e,options:t,defaultValue:r,isClearable:m??!1,isSearchable:b??!1,placeholder:p??"ÐоиÑк...",isDisabled:l??!1,noOptionsMessage:()=>n??"ÐоиÑк не дал ÑезÑлÑÑаÑов",onChange:h})]}),W=({value:e,placeholder:r,noOptionsMessage:t,isClearable:d,isSearchable:p,isDisabled:n,pageSize:h=100,debounceTimeout:m=400,onChange:b,fetchOptions:l,className:u,styles:g,menuPortalTarget:f,cacheUniqs:c,components:C})=>{const _=v.useCallback(async(L,x,w)=>{const S=w?.page??1,{options:i,count:j}=await l(L,S,h),k=x.length+i.length;return{options:i,hasMore:k<j,additional:{page:S+1}}},[l,h]);return o.jsx(P,{value:e,loadOptions:_,additional:{page:1},debounceTimeout:m,isClearable:d??!1,isSearchable:p??!0,placeholder:r??"ÐоиÑк...",isDisabled:n??!1,noOptionsMessage:()=>t??"ÐоиÑк не дал ÑезÑлÑÑаÑов",onChange:b,className:u,styles:g,menuPortalTarget:f,cacheUniqs:c,components:C})};export{Q as S,U as a,W as b,J as c,$ as s};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.