1import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{n as t,t as n}from"./jsx-runtime-D3F0h15I.js";import{t as r}from"./detect-it.esm-DVND6rlI.js";import{t as i}from"./classnames-CfLRLWYq.js";import{V as a}from"./poll-D3ctfq3J.js";import{t as o}from"./info-BnsNWy2K.js";var s=e(t()),c=e(i()),l=n(),u=!r||{passive:!0,capture:!0},d=({style:e,items:t,value:n,classNamePrefix:r=`privacy-dropdown`,onClose:i,onChange:d})=>{let f=(0,s.useRef)(null),p=(0,s.useRef)(null),[m,h]=(0,s.useState)(n),g=(0,s.useCallback)(e=>{let t=e.currentTarget.getAttribute(`data-index`);e.preventDefault(),i(),t&&d(t)},[i,d]),_=(0,s.useCallback)(e=>{let n=e.currentTarget.getAttribute(`data-index`),r=t.findIndex(e=>e.value===n),a=null;switch(e.key){case`Escape`:i();break;case` `:case`Enter`:g(e);break;case`ArrowDown`:a=f.current?.children[r+1]??f.current?.firstElementChild;break;case`ArrowUp`:a=f.current?.children[r-1]??f.current?.lastElementChild;break;case`Tab`:a=e.shiftKey?f.current?.children[r-1]??f.current?.lastElementChild:f.current?.children[r+1]??f.current?.firstElementChild;break;case`Home`:a=f.current?.firstElementChild;break;case`End`:a=f.current?.lastElementChild}if(a&&a instanceof HTMLElement){let t=a.getAttribute(`data-index`);a.focus(),t&&h(t),e.preventDefault(),e.stopPropagation()}},[t,i,g,h]);return(0,s.useEffect)(()=>{let e=e=>{f.current&&e.target instanceof Node&&!f.current.contains(e.target)&&(i(),e.stopPropagation())};return document.addEventListener(`click`,e,{capture:!0}),document.addEventListener(`touchend`,e,u),p.current?.focus({preventScroll:!0}),()=>{document.removeEventListener(`click`,e,{capture:!0}),document.removeEventListener(`touchend`,e,u)}},[i]),(0,l.jsx)(`ul`,{style:e,role:`listbox`,ref:f,children:t.map(e=>(0,l.jsxs)(`li`,{role:`option`,tabIndex:0,"data-index":e.value,onKeyDown:_,onClick:g,className:(0,c.default)(`${r}__option`,{active:e.value===m}),"aria-selected":e.value===m,ref:e.value===m?p:null,children:[e.icon&&e.iconComponent&&(0,l.jsx)(`div`,{className:`${r}__option__icon`,children:(0,l.jsx)(a,{id:e.icon,icon:e.iconComponent})}),(0,l.jsxs)(`div`,{className:`${r}__option__content`,children:[(0,l.jsx)(`strong`,{children:e.text}),e.meta]}),e.extra&&(0,l.jsx)(`div`,{className:`${r}__option__additional`,title:e.extra,children:(0,l.jsx)(a,{id:`info-circle`,icon:o})})]},e.value))})};export{d as t}; 2//# sourceMappingURL=dropdown_selector-VQVO0oMi.js.map
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.