1import{r as x,e5 as ae,z as U,K as $,E as le,A as de,j as Q,eT as ce}from"./index-BHKzQZPi.js";import{C as ue}from"./useCompositeListItem-O0yDsrXc.js";import{i as fe}from"./isElementDisabled-CwHw_lZC.js";import{s as ee,C as he,e as ge,i as te,b as D,c as X,H as pe,E as Ie,A as ne,d as Z,V as me,f as xe,g as Ee,h as Re,M as ye}from"./composite-6kDpAzGJ.js";import{g as oe}from"./shadowDom-OW3R94mT.js";import{g as Ce,c as Ke,d as Ae,e as q,f as be,h as Me,j as Se,k as _e,b as Oe}from"./composite-DlEpwgxk.js";import{u as ke}from"./DirectionContext-BErkBO3C.js";const Te="data-composite-item-active",He=[];function Le(E){const{itemSizes:K,cols:l=1,loopFocus:A=!0,onLoop:d,dense:_=!1,orientation:i="both",direction:R,highlightedIndex:N,onHighlightedIndexChange:v,rootRef:G,enableHomeAndEndKeys:g=!1,stopEventPropagation:O=!1,disabledIndices:a,modifierKeys:k=He}=E,[W,V]=x.useState(0),b=l>1,p=x.useRef(null),T=ae(p,G),t=x.useRef([]),H=x.useRef(!1),r=N??W,I=U((e,s=!1)=>{if((v??V)(e),s){const o=t.current[e];ee(p.current,o,R,i)}}),L=U(e=>{if(e.size===0||H.current)return;H.current=!0;const s=Array.from(e.keys()),o=s.find(c=>c?.hasAttribute(Te))??null,u=o?s.indexOf(o):-1;u!==-1&&I(u),ee(p.current,o,R,i)}),Y=U((e,s,o)=>d?d?.(e,s,o,t):o),M=x.useMemo(()=>({"aria-orientation":i==="both"?void 0:i,ref:T,onFocus(e){const s=p.current,o=oe(e.nativeEvent);!s||o==null||!te(o)||o.setSelectionRange(0,o.value.length??0)},onKeyDown(e){const s=g?he:ge;if(!s.has(e.key)||Ye(e,k)||!p.current)return;const u=R==="rtl",c=u?ne:X,F={horizontal:c,vertical:D,both:c}[i],y=u?X:ne,P={horizontal:y,vertical:Z,both:y}[i],C=oe(e.nativeEvent);if(C!=null&&te(C)&&!fe(C)){const m=C.selectionStart,f=C.selectionEnd,B=C.value??"";if(m==null||e.shiftKey||m!==f||e.key!==P&&m<B.length||e.key!==F&&m>0)return}let n=r;const w=Ce(t,a),z=Ke(t,a);if(b){const m=K||Array.from({length:t.current.length},()=>({width:1,height:1})),f=Ae(m,l,_),B=f.findIndex(h=>h!=null&&!q(t.current,h,a)),ie=f.reduce((h,S,re)=>S!=null&&!q(t.current,S,a)?re:h,-1);n=f[be(f.map(h=>h!=null?t.current[h]:null),{event:e,orientation:i,loopFocus:A,onLoop:Y,cols:l,disabledIndices:Se([...a||t.current.map((h,S)=>q(t.current,S)?S:void 0),void 0],f),minIndex:B,maxIndex:ie,prevIndex:Me(r>z?w:r,m,f,l,e.key===D?"bl":e.key===X?"tr":"tl"),rtl:u})]}const J={horizontal:[c],vertical:[D],both:[c,D]}[i],j={horizontal:[y],vertical:[Z],both:[y,Z]}[i],se=b?s:{horizontal:g?Ee:Re,vertical:g?me:xe,both:s}[i];g&&(e.key===pe?n=w:e.key===Ie&&(n=z)),n===r&&(J.includes(e.key)||j.includes(e.key))&&(A&&n===z&&J.includes(e.key)?(n=w,d&&(n=d(e,r,n,t))):A&&n===w&&j.includes(e.key)?(n=z,d&&(n=d(e,r,n,t))):n=_e(t.current,{startingIndex:n,decrement:j.includes(e.key),disabledIndices:a})),n!==r&&!Oe(t.current,n)&&(O&&e.stopPropagation(),se.has(e.key)&&e.preventDefault(),I(n,!0),queueMicrotask(()=>{t.current[n]?.focus()}))}}),[l,_,R,a,t,g,r,b,K,A,d,Y,T,k,I,i,O]);return x.useMemo(()=>({props:M,highlightedIndex:r,onHighlightedIndexChange:I,elementsRef:t,disabledIndices:a,onMapChange:L,relayKeyboardEvent:M.onKeyDown}),[M,r,I,t,a,L])}function Ye(E,K){for(const l of ye.values())if(!K.includes(l)&&E.getModifierState(l))return!0;return!1}function We(E){const{render:K,className:l,style:A,refs:d=$,props:_=$,state:i=le,stateAttributesMapping:R,highlightedIndex:N,onHighlightedIndexChange:v,orientation:G,dense:g,itemSizes:O,loopFocus:a,onLoop:k,cols:W,enableHomeAndEndKeys:V,onMapChange:b,stopEventPropagation:p=!0,rootRef:T,disabledIndices:t,modifierKeys:H,highlightItemOnHover:r=!1,tag:I="div",...L}=E,Y=ke(),{props:M,highlightedIndex:e,onHighlightedIndexChange:s,elementsRef:o,onMapChange:u,relayKeyboardEvent:c}=Le({itemSizes:O,cols:W,loopFocus:a,onLoop:k,dense:g,orientation:G,highlightedIndex:N,onHighlightedIndexChange:v,rootRef:T,stopEventPropagation:p,enableHomeAndEndKeys:V,direction:Y,disabledIndices:t,modifierKeys:H}),F=de(I,E,{state:i,ref:d,props:[M,..._,L],stateAttributesMapping:R}),y=x.useMemo(()=>({highlightedIndex:e,onHighlightedIndexChange:s,highlightItemOnHover:r,relayKeyboardEvent:c}),[e,s,r,c]);return Q.jsx(ce.Provider,{value:y,children:Q.jsx(ue,{elementsRef:o,onMapChange:P=>{b?.(P),u(P)},children:F})})}export{Te as A,We as C};
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.