"use strict";(globalThis.webpackChunk_jbrowse_web=globalThis.webpackChunk_jbrowse_web||[]).push([[2777],{54767:(e,t,n)=>{n.d(t,{x:()=>l});var r=n(7552),c=n(24979),u=n(74795),o=n(89301),s=n(69500);function i(e){return e.substring(2).toLowerCase()}function l(e){const{children:t,disableReactTree:n=!1,mouseEvent:l="onClick",onClickAway:a,touchEvent:d="onTouchEnd"}=e,f=r.useRef(!1),m=r.useRef(null),v=r.useRef(!1),E=r.useRef(!1);r.useEffect((()=>(setTimeout((()=>{v.current=!0}),0),()=>{v.current=!1})),[]);const h=(0,c.A)(t.ref,m),b=(0,u.A)((e=>{const t=E.current;E.current=!1;const r=(0,o.A)(m.current);if(!v.current||!m.current||"clientX"in e&&function(e,t){return t.documentElement.clientWidth<e.clientX||t.documentElement.clientHeight<e.clientY}(e,r))return;if(f.current)return void(f.current=!1);let c;c=e.composedPath?e.composedPath().indexOf(m.current)>-1:!r.documentElement.contains(e.target)||m.current.contains(e.target),c||!n&&t||a(e)})),w=e=>n=>{E.current=!0;const r=t.props[e];r&&r(n)},g={ref:h};return!1!==d&&(g[d]=w(d)),r.useEffect((()=>{if(!1!==d){const e=i(d),t=(0,o.A)(m.current),n=()=>{f.current=!0};return t.addEventListener(e,b),t.addEventListener("touchmove",n),()=>{t.removeEventListener(e,b),t.removeEventListener("touchmove",n)}}}),[b,d]),!1!==l&&(g[l]=w(l)),r.useEffect((()=>{if(!1!==l){const e=i(l),t=(0,o.A)(m.current);return t.addEventListener(e,b),()=>{t.removeEventListener(e,b)}}}),[b,l]),(0,s.jsx)(r.Fragment,{children:r.cloneElement(t,g)})}},42777:(e,t,n)=>{n.r(t),n.d(t,{default:()=>r.x});var r=n(54767)}}]);
//# sourceMappingURL=2777.34287f2d.chunk.js.map