"use strict";exports.id=7169,exports.ids=[7169],exports.modules={47169:(e,t,r)=>{r.r(t),r.d(t,{default:()=>__WEBPACK_DEFAULT_EXPORT__});var n=r(16689),u=r.n(n),s=r(49642);let __WEBPACK_DEFAULT_EXPORT__=({children:e,isOpen:t,onDismiss:r,id:c="fs-dropdown"})=>{let[l,o]=(0,n.useState)(!1),a=(0,n.useRef)([]),f=(0,n.useRef)(0),d=(0,n.useRef)(null),i=t??l,E=(0,n.useCallback)(()=>{o(!1),r?.()},[r]),open=()=>{o(!0)},v=(0,n.useCallback)(()=>{o(e=>(e&&(r?.(),d.current?.focus()),!e))},[r]),_=(0,n.useCallback)(e=>{d.current=e},[]);(0,n.useEffect)(()=>{o(t??!1)},[t]),(0,n.useEffect)(()=>{i&&a?.current[0]?.focus()},[i]),(0,n.useEffect)(()=>{let e=!0,event=t=>{let r=a?.current.some(e=>t.target===e||e.contains(t.target));if(e){e=!1;return}r||E()};return i?document.addEventListener("click",event):document.removeEventListener("click",event),()=>{document.removeEventListener("click",event)}},[E,i]);let m=(0,n.useMemo)(()=>({isOpen:i,close:E,open,toggle:v,dropdownTriggerRef:d,addDropdownTriggerRef:_,selectedDropdownItemIndexRef:f,dropdownItemsRef:a,id:c}),[i,E,v,_,c]);return u().createElement(s.Z.Provider,{value:m},e)}}};