1import{a as e,c as t,t as n}from"./jsx-runtime-DGhcXTfs.js";import{o as r}from"./dist-Bz6ll_Ds.js";import{t as i}from"./dist-BSeLww1P.js";import{i as a,n as o,r as s,t as c}from"./dist-DUO2uJ64.js";import{n as l,t as u}from"./dist-DtSBH-Qt.js";import{t as d}from"./dist-VPiJ5I57.js";import{t as f}from"./dist-LT3hqqRi.js";var p=t(e(),1),m=Object.defineProperty,h=(e,t)=>m(e,`name`,{value:t,configurable:!0}),g=!1;function _(){let[e,t]=p.useState(g);return p.useEffect(()=>{g||(g=!0,t(!0))},[]),e}h(_,`useIsHydrated`);var v=p.useSyncExternalStore;function y(){return()=>{}}h(y,`subscribe`);function b(){return v(y,()=>!0,()=>!1)}h(b,`useIsHydratedModern`);var x=typeof v==`function`?b:_,S=n(),C=Object.defineProperty,w=(e,t)=>C(e,`name`,{value:t,configurable:!0}),T=`rovingFocusGroup.onEntryFocus`,E={bubbles:!1,cancelable:!0},D=`RovingFocusGroup`,[O,k,A]=l(D),[j,M]=a(D,[A]),[N,P]=j(D),F=p.forwardRef(w(function(e,t){return(0,S.jsx)(O.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,S.jsx)(O.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,S.jsx)(I,{...e,ref:t})})})},`RovingFocusGroup`)),I=p.forwardRef(w(function(e,t){let{__scopeRovingFocusGroup:n,orientation:a,loop:o=!1,dir:l,currentTabStopId:d,defaultCurrentTabStopId:m,onCurrentTabStopIdChange:h,onEntryFocus:g,preventScrollOnEntryFocus:_=!1,...v}=e,y=p.useRef(null),b=r(t,y),x=u(l),[C,w]=c({prop:d,defaultProp:m??null,onChange:h,caller:D}),[O,A]=p.useState(!1),j=f(g),M=k(n),P=p.useRef(!1),[F,I]=p.useState(0);return p.useEffect(()=>{let e=y.current;if(e)return e.addEventListener(T,j),()=>e.removeEventListener(T,j)},[j]),(0,S.jsx)(N,{scope:n,orientation:a,dir:x,loop:o,currentTabStopId:C,onItemFocus:p.useCallback(e=>w(e),[w]),onItemShiftTab:p.useCallback(()=>A(!0),[]),onFocusableItemAdd:p.useCallback(()=>I(e=>e+1),[]),onFocusableItemRemove:p.useCallback(()=>I(e=>e-1),[]),children:(0,S.jsx)(i.div,{tabIndex:O||F===0?-1:0,"data-orientation":a,...v,ref:b,style:{outline:`none`,...e.style},onMouseDown:s(e.onMouseDown,()=>{P.current=!0}),onFocus:s(e.onFocus,e=>{let t=!P.current;if(e.target===e.currentTarget&&t&&!O){let t=new CustomEvent(T,E);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=M().filter(e=>e.focusable);H([e.find(e=>e.active),e.find(e=>e.id===C),...e].filter(Boolean).map(e=>e.ref.current),_)}}P.current=!1}),onBlur:s(e.onBlur,()=>A(!1))})})},`RovingFocusGroupImpl`)),L=`RovingFocusGroupItem`,R=p.forwardRef(w(function(e,t){let{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:c,children:l,...u}=e,f=d(),m=c||f,h=P(L,n),g=h.currentTabStopId===m,_=k(n),{onFocusableItemAdd:v,onFocusableItemRemove:y,currentTabStopId:b}=h,C=x();return o(()=>{if(C&&r)return v(),()=>y()},[C,r,v,y]),p.useEffect(()=>{if(!C&&r)return v(),()=>y()},[C,r,v,y]),(0,S.jsx)(O.ItemSlot,{scope:n,id:m,focusable:r,active:a,children:(0,S.jsx)(i.span,{tabIndex:g?0:-1,"data-orientation":h.orientation,...u,ref:t,onMouseDown:s(e.onMouseDown,e=>{r?h.onItemFocus(m):e.preventDefault()}),onFocus:s(e.onFocus,()=>h.onItemFocus(m)),onKeyDown:s(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){h.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=V(e,h.orientation,h.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=_().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=h.loop?U(n,r+1):n.slice(r+1)}setTimeout(()=>H(n))}}),children:typeof l==`function`?l({isCurrentTabStop:g,hasTabStop:b!=null}):l})})},`RovingFocusGroupItem`)),z={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function B(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}w(B,`getDirectionAwareKey`);function V(e,t,n){let r=B(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return z[r]}w(V,`getFocusIntent`);function H(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}w(H,`focusFirst`);function U(e,t){return e.map((n,r)=>e[(t+r)%e.length])}w(U,`wrapArray`);var W=F,G=R;export{W as n,M as r,G as t};
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.