import{n as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-C21x__mS.js";import{n}from"./iframe-GrlyTB2d.js";import{n as r,t as i}from"./SelectOptionContent-DAbmaofN.js";import{g as a,y as o}from"./formatters-CVj-3Vn0-BFaHJqZL.js";import{n as s,t as c}from"./PickerSelectionToolbar-VFoN-tr-.js";function l({value:e,open:t,onCommit:n,onOpen:r,onClose:i,isEqual:a}){let o=(0,u.useRef)(!1),[s,c]=(0,u.useState)(e);return(0,u.useEffect)(()=>{o.current&&!t&&(a(s,e)||n(s),i?.(s)),o.current=t},[s,a,i,n,t,e]),{draftValue:s,setDraftValue:c,prepareOpen:()=>{c(e),r?.()}}}var u;function d(){return(d=e((()=>{u=t()})))()}function f({item:e,textKey:t,codeKey:n,highlight:r}){return(0,p.jsx)(i,{label:e[t],code:n&&e[n],highlight:r})}var p;function m(){return(m=e((()=>{r(),p=n(),f.__docgenInfo={description:"Отдельная опция внутри `MultiSelect`. Отрисовывает состояние выбора и подсветку текста для найденных совпадений.",methods:[],displayName:`MultiSelectOption`,props:{item:{required:!0,tsType:{name:`CollectionItem`},description:``},textKey:{required:!0,tsType:{name:`string`},description:``},codeKey:{required:!1,tsType:{name:`string`},description:``},highlight:{required:!1,tsType:{name:`string`},description:``},selected:{required:!0,tsType:{name:`boolean`},description:``}}}})))()}var h,g,_,v;function y(){return(y=e((()=>{h=`_9oSdQi`,g=`iobHig`,_=`yatXso`,v={multiSelect:h,multiSelectTokens:g,multiSelectToken:_}})))()}function b({value:e}){return e?(0,x.jsx)(`div`,{className:v.multiSelectTokens,children:(0,x.jsx)(`div`,{className:v.multiSelectToken,children:e})}):null}var x;function S(){return(S=e((()=>{y(),x=n(),b.__docgenInfo={description:"Токен выбранного значения в `MultiSelect`. Показывает выбранный элемент и кнопку его удаления из текущего набора.",methods:[],displayName:`MultiSelectToken`,props:{value:{required:!0,tsType:{name:`union`,raw:`string | undefined`,elements:[{name:`string`},{name:`undefined`}]},description:``}}}})))()}function C(e){return a(e,A)}function w(e,t,n){if(n)return n;let r=e[0];return r?Object.keys(r).find(e=>e!==t)??t:t}function T(e,t,n){if(e.length===0)return;if(e.length>1)return C(e.length);let r=w(e,t,n);return e[0]?.[r]??e[0]?.[t]}function E(e){return function(t){return(0,k.jsx)(b,{value:T(t.selectedItems,e.codeKey,e.textKey)})}}function D(e){return(0,k.jsx)(c,{onSelectAll:e.selectAll,onDeselectAll:e.deselectAll})}function O(e){return function(t,n){return(0,k.jsx)(f,{item:t,selected:n.selected,highlight:n.highlightQuery,textKey:w([t],e.codeKey,e.textKey),codeKey:e.hideCode?void 0:e.codeKey})}}var k,A;function j(){return(j=e((()=>{o(),s(),m(),S(),k=n(),A={one:`элемент`,few:`элемента`,many:`элементов`},D.__docgenInfo={description:``,methods:[],displayName:`renderDefaultMultiSelectToolbar`,props:{selectedItems:{required:!0,tsType:{name:`Array`,elements:[{name:`CollectionItem`}],raw:`CollectionItem[]`},description:``},committedSelectedItems:{required:!0,tsType:{name:`Array`,elements:[{name:`CollectionItem`}],raw:`CollectionItem[]`},description:``},availableItems:{required:!0,tsType:{name:`Array`,elements:[{name:`CollectionItem`}],raw:`CollectionItem[]`},description:``},query:{required:!0,tsType:{name:`string`},description:``},open:{required:!0,tsType:{name:`boolean`},description:``},clearSelection:{required:!0,tsType:{name:`signature`,type:`function`,raw:`() => void`,signature:{arguments:[],return:{name:`void`}}},description:``},selectAll:{required:!0,tsType:{name:`signature`,type:`function`,raw:`() => void`,signature:{arguments:[],return:{name:`void`}}},description:``},deselectAll:{required:!0,tsType:{name:`signature`,type:`function`,raw:`() => void`,signature:{arguments:[],return:{name:`void`}}},description:``}}}})))()}export{D as a,S as c,d,l as f,j as i,v as l,E as n,w as o,C as r,b as s,O as t,y as u};