Socket
Socket
Sign inDemoInstall

@floating-ui/react-dom-interactions

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@floating-ui/react-dom-interactions - npm Package Compare versions

Comparing version 0.0.11 to 0.0.12

2

dist/floating-ui.react-dom-interactions.esm.js

@@ -1030,3 +1030,3 @@ import * as React from 'react';

return () => {
win.addEventListener('focus', onFocus);
win.removeEventListener('focus', onFocus);
win.removeEventListener('blur', onBlur);

@@ -1033,0 +1033,0 @@ };

@@ -1,1 +0,1 @@

import*as e from"react";import n,{useLayoutEffect as t,useEffect as r,useContext as o,useRef as u,useCallback as c,createContext as i,useState as l,forwardRef as a,useMemo as f}from"react";import{getOverflowAncestors as s,useFloating as d}from"@floating-ui/react-dom";export*from"@floating-ui/react-dom";import v from"point-in-polygon";import{createPortal as m}from"react-dom";var g="undefined"!=typeof document?t:r;function p(){const e=new Map;return{emit(n,t){var r;null==(r=e.get(n))||r.forEach((e=>e(t)))},on(n,t){e.set(n,[...e.get(n)||[],t])},off(n,t){e.set(n,(e.get(n)||[]).filter((e=>e!==t)))}}}let h=!1,y=0;const w=()=>"floating-ui-"+y++;const b=e["useId".toString()],E=null!=b?b:function(){const n=h?w():null,[t,r]=e.useState(n);return g((()=>{null===t&&r(w())}),[]),e.useEffect((()=>{h||(h=!0)}),[]),t},x=i(null),L=i(null),A=()=>{var e,n;return null!=(e=null==(n=o(x))?void 0:n.id)?e:null},I=()=>o(L),T=()=>{const e=E(),n=I(),t=A();return g((()=>{const r={id:e,parentId:t};return null==n||n.addNode(r),()=>{null==n||n.removeNode(r)}}),[n,e,t]),e},k=e=>{let{children:t,id:r}=e;const o=A();return n.createElement(x.Provider,{value:{id:r,parentId:o}},t)},O=e=>{let{children:t}=e;const r=u([]),o=c((e=>{r.current=[...r.current,e]}),[]),i=c((e=>{r.current=r.current.filter((n=>n!==e))}),[]);return n.createElement(L.Provider,{value:{nodesRef:r,addNode:o,removeNode:i,events:p()}},t)};function C(e){return Object.entries(null!=e?e:{}).reduce(((e,n)=>{let[t,r]=n;return e[t]=[r],e}),{})}function R(e,n,t){const r={reference:"reference"===t?C(e):{},floating:"floating"===t?C(e):{}};return n.forEach((e=>{var n;const o=null!=(n=null==e?void 0:e[t])?n:{};Object.keys(o).forEach((e=>{var n;"function"==typeof o[e]&&(null==r[t][e]&&(r[t][e]=[]),null==(n=r[t][e])||n.push(o[e]))}))})),{..."floating"===t&&{tabIndex:-1},...e,...n.reduce(((e,n)=>(Object.assign(e,null==n?void 0:n[t]),e)),{}),...Object.entries(r[t]).reduce(((e,n)=>{let[t,r]=n;return 0===t.indexOf("on")&&(e[t]=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];r.forEach((e=>e(...n)))}),e}),{})}}const D=function(e){return void 0===e&&(e=[]),{getReferenceProps:n=>R(n,e,"reference"),getFloatingProps:n=>R(n,e,"floating")}};function P(e){var n;return null!=(n=null==e?void 0:e.ownerDocument)?n:document}function j(e){var n;return null!=(n=P(e).defaultView)?n:window}function M(e){return!!e&&e instanceof j(e).Element}function N(e){return!!e&&e instanceof j(e).HTMLElement}function S(e,n){var t;let r=null!=(t=null==e?void 0:e.nodesRef.current.filter((e=>{var t;return e.parentId===n&&(null==(t=e.context)?void 0:t.open)})))?t:[],o=r;for(;o.length;){var u;o=null!=(u=null==e?void 0:e.nodesRef.current.filter((e=>{var n;return null==(n=o)?void 0:n.some((n=>{var t;return e.parentId===n.id&&(null==(t=e.context)?void 0:t.open)}))})))?u:[],r=r.concat(o)}return r}function B(e){let n,{timeout:t=0,debug:r=null}=void 0===e?{}:e;return e=>{let{x:o,y:u,placement:c,refs:i,onClose:l,nodeId:a,tree:f}=e;return function(e){var s;if("touch"===e.pointerType)return;const{target:d,clientX:m,clientY:g}=e,p=d;if("pointermove"===e.type&&M(i.reference.current)&&i.reference.current.contains(p)||null!=(s=i.floating.current)&&s.contains(p))return;if(f&&S(f,a).some((e=>{let{context:n}=e;return null==n?void 0:n.open})))return;if(!i.reference.current||!i.floating.current||null==c||null==o||null==u)return;const h=i.reference.current.getBoundingClientRect(),y=i.floating.current.getBoundingClientRect(),w=c.split("-")[0],b=o>y.right-y.width/2,E=u>y.bottom-y.height/2;switch(w){case"top":if(m>=y.left&&m<=y.right&&g>=y.bottom&&g<=h.top)return;break;case"bottom":if(m>=y.left&&m<=y.right&&g>=h.bottom&&g<=y.top)return;break;case"left":if(m>=y.right&&m<=h.left&&g>=y.left&&g<=y.right)return;break;case"right":if(m>=y.right&&m<=h.left&&g>=y.right&&g<=h.left)return}function x(e){let[n,t]=e;const r=y.width>h.width,o=y.height>h.height;switch(w){case"top":{const e=[r?n:b?n+1:n-1,t+1],o=[r?n:b?n-1:n+1,t+1],u=[[y.left,b||r?y.bottom-1:y.top],[y.right,b?r?y.bottom-1:y.top:y.bottom-1]];return b?[e,o,...u]:[e,...u,o]}case"bottom":{const e=[r?n:b?n+1:n-1,t-1],o=[r?n:b?n-1:n+1,t-1],u=[[y.left,b||r?y.top+1:y.bottom],[y.right,b?r?y.top+1:y.bottom:y.top+1]];return b?[e,o,...u]:[e,...u,o]}case"left":{const e=[n+1,o?t:E?t-1:t+1],r=[n+1,o?t:E?t+1:t-1],u=[[E||o?y.right-1:y.left,y.top],[E?o?y.right-1:y.left:y.right-1,y.bottom]];return E?[e,...u,r]:[...u,e,r]}case"right":{const e=[n-1,o?t:E?t+1:t-1],r=[n-1,o?t:E?t-1:t+1],u=[[E||o?y.left+1:y.right,y.top],[E?o?y.left+1:y.right:y.left+1,y.bottom]];return E?[e,r,...u]:[e,...u,r]}}}const L=x([o,u]);"production"!==process.env.NODE_ENV&&(null==r||r(x([o,u]).slice(0,4).join(", "))),v([m,g],L)?t&&(n=setTimeout(l,t)):(clearTimeout(n),l())}}}const K="floating-ui-root",F=e=>{let{children:n,id:t=K}=e;const[r,o]=l(!1),c=u(null);return g((()=>{const e=document.getElementById(t);e?c.current=e:(c.current=document.createElement("div"),c.current.id=t);const n=c.current;n.setAttribute("data-floating-ui-portal",""),document.body.contains(n)||document.body.appendChild(n),o(!0)}),[t]),r&&c.current?m(n,c.current):null};function V(){return V=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},V.apply(this,arguments)}const U=a((function(e,t){let{lockScroll:r=!1,...o}=e;return g((()=>{if(!r)return;const e=window.pageXOffset,n=window.pageYOffset,t=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:"-"+n+"px",left:"-"+e+"px",right:"0",[t]:o+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[t]:""}),window.scrollTo(e,n)}}),[r]),n.createElement("div",V({ref:t},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function q(e,n,t){return t&&"mouse"!==t?0:"number"==typeof e?e:null==e?void 0:e[n]}const H=function(e,n){let{enabled:t=!0,delay:o=0,handleClose:i=null,mouseOnly:l=!1,restMs:a=0}=void 0===n?{}:n;const{open:f,onOpenChange:s,dataRef:d,events:v,refs:m}=e,p=I(),h=u(),y=u(),w=u(),b=u(),E=u(!0);g((()=>{t&&(f||(h.current=void 0))})),r((()=>{if(t)return v.on("dismiss",e),()=>{v.off("dismiss",e)};function e(){clearTimeout(y.current),clearTimeout(b.current),E.current=!0}}),[t,v]),r((()=>{if(!t||!i)return;function e(){var e;null!=(e=d.current.openEvent)&&e.type.includes("mouse")&&s(!1)}const n=P(m.floating.current).documentElement;return n.addEventListener("mouseleave",e),()=>{n.removeEventListener("mouseleave",e)}}),[m.floating,s,t,i,d]);const x=c((function(e){void 0===e&&(e=!0),o?(clearTimeout(y.current),y.current=setTimeout((()=>s(!1)),q(o,"close",h.current))):e&&s(!1)}),[o,s]);function L(e){h.current=e.pointerType}return r((()=>{if(!t)return;function n(e){f||l&&"mouse"!==h.current||(E.current=!1,d.current.openEvent=e,o?(clearTimeout(y.current),y.current=setTimeout((()=>{s(!0)}),q(o,"open",h.current))):s(!0))}function r(n){var t;if("click"===(null==(t=d.current.openEvent)?void 0:t.type))return;const r=P(m.floating.current);if(clearTimeout(b.current),i)return clearTimeout(y.current),w.current&&r.removeEventListener("pointermove",w.current),w.current=i({...e,tree:p,x:n.clientX,y:n.clientY,onClose(){w.current&&r.removeEventListener("pointermove",w.current),x()}}),void r.addEventListener("pointermove",w.current);x()}const u=m.reference.current;return M(u)?(u.addEventListener("mouseenter",n),u.addEventListener("mouseleave",r),()=>{u.removeEventListener("mouseenter",n),u.removeEventListener("mouseleave",r)}):void 0}),[t,x,e,o,i,d,l,s,f,p,m.reference,m.floating]),t?{reference:{onPointerDown:L,onPointerEnter:L,onMouseMove(){f||0===a||(clearTimeout(b.current),b.current=setTimeout((()=>{E.current||s(!0)}),a))}},floating:{onMouseEnter(){clearTimeout(y.current)},onMouseLeave:()=>x(!1)}}:{}},X=i({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),Y=()=>o(X),W=e=>{let{children:t,delay:r}=e;const[o,u]=l({delay:r,initialDelay:r,currentId:null}),i=c((e=>{u((n=>({...n,currentId:e})))}),[]);return n.createElement(X.Provider,{value:{...o,setState:u,setCurrentId:i}},t)},z=(e,n)=>{let{open:t,onOpenChange:o}=e,{id:u}=n;const{currentId:c,initialDelay:i,setState:l}=Y();r((()=>{c&&o&&(l((e=>({...e,delay:{open:0,close:q(i,"close")}}))),c!==u&&o(!1))}),[u,o,l,c,i]),r((()=>{!t&&c===u&&o&&(o(!1),l((e=>({...e,delay:i,currentId:null}))))}),[t,l,c,u,o,i])},_=function(e,n){let{open:t}=e,{enabled:r=!0,role:o="dialog"}=void 0===n?{}:n;const u=E(),c=u+"-reference",i={id:u,role:o};return r?"tooltip"===o?{reference:{"aria-describedby":t?u:void 0},floating:i}:{reference:{"aria-expanded":t?"true":"false","aria-haspopup":o,"aria-controls":t?u:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:c}},floating:{...i,..."menu"===o&&{"aria-labelledby":c}}}:{}},G=function(e,n){let{open:t,onOpenChange:r,dataRef:o}=e,{enabled:u=!0}=void 0===n?{}:n;return u?{reference:{onClick(e){var n;t?"click"===(null==(n=o.current.openEvent)?void 0:n.type)&&r(!1):r(!0);o.current.openEvent=e.nativeEvent}}}:{}},J=function(e,n){let{open:t,onOpenChange:o,refs:u,events:i,nodeId:l}=e,{enabled:a=!0,escapeKey:f=!0,outsidePointerDown:d=!0,referencePointerDown:v=!1,ancestorScroll:m=!1}=void 0===n?{}:n;const g=I(),p=c((()=>{N(u.reference.current)&&u.reference.current.focus()}),[u.reference.current]);return r((()=>{if(!t||!a)return;function e(e){"Escape"===e.key&&(i.emit("dismiss"),o(!1),p())}function n(e){var n;const t=g&&S(g,l).some((n=>{var t,r;return null==(t=n.context)||null==(r=t.refs.floating.current)?void 0:r.contains(e.target)}));null!=(n=u.floating.current)&&n.contains(e.target)||M(u.reference.current)&&u.reference.current.contains(e.target)||t||(i.emit("dismiss"),o(!1),p())}function r(){o(!1)}const c=P(u.floating.current);f&&c.addEventListener("keydown",e),d&&c.addEventListener("mousedown",n);const v=(m?[...M(u.reference.current)?s(u.reference.current):[],...M(u.floating.current)?s(u.floating.current):[]]:[]).filter((e=>{var n;return e!==(null==(n=c.defaultView)?void 0:n.visualViewport)}));return v.forEach((e=>e.addEventListener("scroll",r,{passive:!0}))),()=>{f&&c.removeEventListener("keydown",e),d&&c.removeEventListener("mousedown",n),v.forEach((e=>e.removeEventListener("scroll",r)))}}),[f,d,i,g,l,t,o,p,m,a,u.floating,u.reference]),a?{reference:{onPointerDown(){v&&(i.emit("dismiss"),o(!1))}}}:{}},Q=function(e,n){let{open:t,onOpenChange:o,dataRef:c,refs:i,events:l}=e,{enabled:a=!0,keyboardOnly:f=!0}=void 0===n?{}:n;const s=u(!1);return r((()=>{var e;if(!a)return;const n=null!=(e=P(i.floating.current).defaultView)?e:window;function r(){s.current=!t}function o(){setTimeout((()=>{s.current=!1}))}return n.addEventListener("focus",o),n.addEventListener("blur",r),()=>{n.addEventListener("focus",o),n.removeEventListener("blur",r)}}),[i.floating,t,a]),r((()=>{if(a)return l.on("dismiss",e),()=>{l.off("dismiss",e)};function e(){s.current=!0}}),[l,a]),a?{reference:{onPointerDown(e){let{pointerType:n}=e;s.current=!(!n||!f)},onFocus(e){var n,t,r;s.current||"focus"===e.type&&"mousedown"===(null==(n=c.current.openEvent)?void 0:n.type)&&M(i.reference.current)&&null!=(t=i.reference.current)&&t.contains(null==(r=c.current.openEvent)?void 0:r.target)||(c.current.openEvent=e.nativeEvent,o(!0))},onBlur(e){var n;const t=e.relatedTarget;null!=(n=i.floating.current)&&n.contains(t)||M(i.reference.current)&&i.reference.current.contains(t)||(s.current=!1,o(!1))}}}:{}};function Z(e){e.preventDefault(),e.stopPropagation()}const $=["content"];function ee(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const ne=function(e,n){let{open:t,onOpenChange:o,refs:i}=e,{enabled:l=!0,initialContentFocus:a=0,order:f=$,modal:s=!0,inert:d=!1}=void 0===n?{}:n;const v=u(null),m=u(null),p=c((()=>f.map((e=>{return N(i.reference.current)&&"reference"===e?i.reference.current:i.floating.current&&"floating"===e?i.floating.current:"content"===e?Array.from(null!=(n=null==(t=i.floating.current)?void 0:t.querySelectorAll("a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,*[tabindex],*[contenteditable]"))?n:[]):null;var n,t})).filter(Boolean).flat()),[i.floating,i.reference,f]);function h(e){var n;const t=e.relatedTarget;null!=(n=i.floating.current)&&n.contains(t)||!M(i.reference.current)||i.reference.current.contains(t)||o(!1)}return g((()=>{const e=i.floating.current;if(!(l&&t&&e&&s))return;function n(){const n=P(e).createElement("div");return n.tabIndex=0,Object.assign(n.style,{position:"fixed",outline:"0",pointerEvents:"none"}),n.setAttribute("aria-hidden","true"),n}v.current||(v.current=n()),m.current||(m.current=n());const r=v.current,o=m.current;function u(e){var n;Z(e);const t=p();null==(n=t[e.target===o?0:t.length-1])||n.focus()}return e.insertAdjacentElement("beforebegin",r),e.insertAdjacentElement("afterend",o),r.addEventListener("focus",u),o.addEventListener("focus",u),()=>{var e,n;r.removeEventListener("focus",u),o.removeEventListener("focus",u),null!=(e=r.parentNode)&&e.contains(r)&&r.parentNode.removeChild(r),null!=(n=o.parentNode)&&n.contains(o)&&o.parentNode.removeChild(o)}}),[l,t,s,d,p,i.floating]),r((()=>{if(!l||!t||!d)return;function e(e){"Tab"===e.key&&Z(e)}const n=P(i.floating.current);return n.addEventListener("keydown",e),()=>{n.removeEventListener("keydown",e)}}),[l,t,d,i.floating]),r((()=>{if(!l)return;const e=p();if(d){if(t){const n=e[0];n!==i.floating.current||n.contains(n.ownerDocument.activeElement)||ee(n)}}else t?"number"==typeof a?ee(e[a]):a.current&&ee(e.find((e=>e===a.current))):s&&N(i.reference.current)&&ee(i.reference.current)}),[p,t,d,s,a,l,i.reference,i.floating]),r((()=>{if(!t||!s||!l)return;const e=P(i.floating.current).querySelectorAll("body > *:not([data-floating-ui-portal]"),n=[];return e.forEach((e=>{const t=e.getAttribute("aria-hidden");n.push(t),e.setAttribute("aria-hidden","true")})),()=>{e.forEach(((e,t)=>{const r=n[t];null===r?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r)}))}}),[t,s,l,i.floating]),l?s?{floating:{"aria-modal":"true"}}:{reference:{onBlur:h},floating:{onBlur:h}}:{}};function te(e,n){let{startingIndex:t=-1,decrement:r=!1}=void 0===n?{}:n;const o=le(e);let u=t;do{var c,i;u+=r?-1:1}while(null!=(c=o[u])&&c.hasAttribute("disabled")||"true"===(null==(i=o[u])?void 0:i.getAttribute("aria-disabled")));return-1===u?0:u}function re(e,n,t){switch(e){case"vertical":return n;case"horizontal":return t;default:return n||t}}function oe(e,n){return re(n,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function ue(e,n,t){return re(n,"ArrowDown"===e,t?"ArrowLeft"===e:"ArrowRight"===e)}function ce(e){return te(e)}function ie(e){return te(e,{decrement:!0,startingIndex:le(e).length})}function le(e){return e.current.filter((e=>null!=e))}const ae=function(e,n){let{open:t,onOpenChange:r,refs:o}=e,{listRef:i,activeIndex:a,onNavigate:f,enabled:s=!0,selectedIndex:d=null,loop:v=!1,nested:m=!1,rtl:p=!1,virtual:h=!1,focusItemOnOpen:y="auto",orientation:w="vertical"}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:n;const b=u(y),E=u(null!=d?d:-1),x=u(""),[L,A]=l(),I=c(((e,n)=>{var t,r;h?A(null==(t=le(e)[n.current])?void 0:t.id):null==(r=le(e)[n.current])||r.focus({preventScroll:!0})}),[h]);function T(e){"auto"===y&&(b.current=!e.pointerType)}if(g((()=>{s&&(null!=d&&(E.current=d),t&&b.current&&(f(E.current),I(i,E)))}),[t,d,i,f,I,s]),g((()=>{s&&t&&null!=a&&(E.current=a,f(E.current),I(i,E))}),[t,a,i,f,I,s]),g((()=>{null==d&&s&&(t&&(oe(x.current,w)||b.current&&(" "===x.current||"Enter"===x.current))&&(E.current=function(e,n,t){return re(n,"ArrowUp"===e,t?"ArrowRight"===e:"ArrowLeft"===e)}(x.current,w,p)?ie(i):ce(i),f(E.current),I(i,E)),x.current="")}),[t,i,d,f,I,s,w,p]),g((()=>{var e;s&&(t||null==d||null==(e=o.reference.current)||e.focus({preventScroll:!0}))}),[o.reference,d,t,s]),g((()=>{var e;s&&(t||("auto"===y&&(b.current=!0),E.current=null!=(e=null!=d?d:a)?e:-1,f(null)))}),[t,d,a,s,y]),!s)return{};function k(e){if(m&&function(e,n,t){return re(n,t?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(e.key,w,p))return Z(e),r(!1),void(N(o.reference.current)&&o.reference.current.focus());const n=E.current,t=ce(i),u=ie(i);if("Home"===e.key&&(E.current=t,f(E.current),I(i,E)),"End"===e.key&&(E.current=u,f(E.current),I(i,E)),oe(e.key,w)){if(Z(e),!h&&e.currentTarget.ownerDocument.activeElement===e.currentTarget)return E.current=null!=d?d:ue(e.key,w,p)?t:u,f(E.current),void I(i,E);ue(e.key,w,p)?E.current=v?n===u?t:te(i,{startingIndex:n}):Math.min(u,te(i,{startingIndex:n})):E.current=v?n===t?u:te(i,{startingIndex:n,decrement:!0}):Math.max(t,te(i,{startingIndex:n,decrement:!0})),f(E.current),I(i,E)}}return{reference:{...h&&{"aria-activedescendant":L},onPointerEnter:T,onPointerDown:T,onKeyDown(e){if(h&&t)return k(e);"auto"===y&&(b.current=!0),x.current=e.key,m?function(e,n,t){return re(n,t?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(e.key,w,p)&&(E.current=ce(i),Z(e),r(!0),f(E.current)):(oe(e.key,w)&&(E.current=null==d?ue(e.key,w,p)?ce(i):ie(i):d,Z(e),r(!0),f(E.current)),h&&!t&&k(e))}},floating:{"aria-orientation":"both"===w?void 0:w,...h&&{"aria-activedescendant":L},onKeyDown:k}}},fe=function(e,n){var t;let{open:r,dataRef:o}=e,{listRef:c,activeIndex:i,onMatch:l=(()=>{}),enabled:a=!0,findMatch:f=null,resetMs:s=500,ignoreKeys:d=[],selectedIndex:v=null}=void 0===n?{listRef:{current:[]},activeIndex:null}:n;const m=u(),p=u(""),h=u(null!=(t=null!=v?v:i)?t:-1),y=u(null);function w(e){if(!e.currentTarget.contains(P(e.currentTarget).activeElement))return;p.current.length>0&&(o.current.typing=!0," "===e.key&&Z(e));const n=c.current;if(null==n||["Home","End","Escape","Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight",...d].includes(e.key))return;n.every((e=>{var n,t;return!e||(null==(n=e[0])?void 0:n.toLowerCase())!==(null==(t=e[1])?void 0:t.toLowerCase())}))&&p.current===e.key&&(p.current="",h.current=y.current),p.current+=e.key,clearTimeout(m.current),m.current=setTimeout((()=>{p.current="",h.current=y.current,o.current.typing=!1}),s);const t=h.current,r=[...n.slice((null!=t?t:0)+1),...n.slice(0,(null!=t?t:0)+1)],u=f?f(r,p.current):r.find((e=>0===(null==e?void 0:e.toLowerCase().indexOf(p.current)))),i=u?n.indexOf(u):-1;-1!==i&&(l(i),y.current=i)}return g((()=>{r&&(clearTimeout(m.current),y.current=null,p.current="")}),[r]),g((()=>{var e;r&&""===p.current&&(h.current=null!=(e=null!=v?v:i)?e:-1)}),[r,v,i]),a?{reference:{onKeyDown:w},floating:{onKeyDown:w}}:{}};function se(e){let{open:n=!1,onOpenChange:t=(()=>{}),placement:r,middleware:o,strategy:c,nodeId:i}=void 0===e?{}:e;const a=I(),s=u({}),v=l((()=>p()))[0],m=d({placement:r,middleware:o,strategy:c}),h=f((()=>({...m,dataRef:s,nodeId:i,events:v,open:n,onOpenChange:t})),[m,s,i,v,n,t]);return g((()=>{const e=null==a?void 0:a.nodesRef.current.find((e=>e.id===i));e&&(e.context=h)})),f((()=>({context:h,...m})),[m,h])}export{W as FloatingDelayGroup,k as FloatingNode,U as FloatingOverlay,F as FloatingPortal,O as FloatingTree,B as safePolygon,G as useClick,z as useDelayGroup,Y as useDelayGroupContext,J as useDismiss,se as useFloating,T as useFloatingNodeId,A as useFloatingParentNodeId,I as useFloatingTree,Q as useFocus,ne as useFocusTrap,H as useHover,E as useId,D as useInteractions,ae as useListNavigation,_ as useRole,fe as useTypeahead};
import*as e from"react";import n,{useLayoutEffect as t,useEffect as r,useContext as o,useRef as u,useCallback as c,createContext as i,useState as l,forwardRef as a,useMemo as f}from"react";import{getOverflowAncestors as s,useFloating as d}from"@floating-ui/react-dom";export*from"@floating-ui/react-dom";import v from"point-in-polygon";import{createPortal as m}from"react-dom";var g="undefined"!=typeof document?t:r;function p(){const e=new Map;return{emit(n,t){var r;null==(r=e.get(n))||r.forEach((e=>e(t)))},on(n,t){e.set(n,[...e.get(n)||[],t])},off(n,t){e.set(n,(e.get(n)||[]).filter((e=>e!==t)))}}}let h=!1,y=0;const w=()=>"floating-ui-"+y++;const b=e["useId".toString()],E=null!=b?b:function(){const n=h?w():null,[t,r]=e.useState(n);return g((()=>{null===t&&r(w())}),[]),e.useEffect((()=>{h||(h=!0)}),[]),t},x=i(null),L=i(null),A=()=>{var e,n;return null!=(e=null==(n=o(x))?void 0:n.id)?e:null},I=()=>o(L),T=()=>{const e=E(),n=I(),t=A();return g((()=>{const r={id:e,parentId:t};return null==n||n.addNode(r),()=>{null==n||n.removeNode(r)}}),[n,e,t]),e},k=e=>{let{children:t,id:r}=e;const o=A();return n.createElement(x.Provider,{value:{id:r,parentId:o}},t)},O=e=>{let{children:t}=e;const r=u([]),o=c((e=>{r.current=[...r.current,e]}),[]),i=c((e=>{r.current=r.current.filter((n=>n!==e))}),[]);return n.createElement(L.Provider,{value:{nodesRef:r,addNode:o,removeNode:i,events:p()}},t)};function C(e){return Object.entries(null!=e?e:{}).reduce(((e,n)=>{let[t,r]=n;return e[t]=[r],e}),{})}function R(e,n,t){const r={reference:"reference"===t?C(e):{},floating:"floating"===t?C(e):{}};return n.forEach((e=>{var n;const o=null!=(n=null==e?void 0:e[t])?n:{};Object.keys(o).forEach((e=>{var n;"function"==typeof o[e]&&(null==r[t][e]&&(r[t][e]=[]),null==(n=r[t][e])||n.push(o[e]))}))})),{..."floating"===t&&{tabIndex:-1},...e,...n.reduce(((e,n)=>(Object.assign(e,null==n?void 0:n[t]),e)),{}),...Object.entries(r[t]).reduce(((e,n)=>{let[t,r]=n;return 0===t.indexOf("on")&&(e[t]=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];r.forEach((e=>e(...n)))}),e}),{})}}const D=function(e){return void 0===e&&(e=[]),{getReferenceProps:n=>R(n,e,"reference"),getFloatingProps:n=>R(n,e,"floating")}};function P(e){var n;return null!=(n=null==e?void 0:e.ownerDocument)?n:document}function j(e){var n;return null!=(n=P(e).defaultView)?n:window}function M(e){return!!e&&e instanceof j(e).Element}function N(e){return!!e&&e instanceof j(e).HTMLElement}function S(e,n){var t;let r=null!=(t=null==e?void 0:e.nodesRef.current.filter((e=>{var t;return e.parentId===n&&(null==(t=e.context)?void 0:t.open)})))?t:[],o=r;for(;o.length;){var u;o=null!=(u=null==e?void 0:e.nodesRef.current.filter((e=>{var n;return null==(n=o)?void 0:n.some((n=>{var t;return e.parentId===n.id&&(null==(t=e.context)?void 0:t.open)}))})))?u:[],r=r.concat(o)}return r}function B(e){let n,{timeout:t=0,debug:r=null}=void 0===e?{}:e;return e=>{let{x:o,y:u,placement:c,refs:i,onClose:l,nodeId:a,tree:f}=e;return function(e){var s;if("touch"===e.pointerType)return;const{target:d,clientX:m,clientY:g}=e,p=d;if("pointermove"===e.type&&M(i.reference.current)&&i.reference.current.contains(p)||null!=(s=i.floating.current)&&s.contains(p))return;if(f&&S(f,a).some((e=>{let{context:n}=e;return null==n?void 0:n.open})))return;if(!i.reference.current||!i.floating.current||null==c||null==o||null==u)return;const h=i.reference.current.getBoundingClientRect(),y=i.floating.current.getBoundingClientRect(),w=c.split("-")[0],b=o>y.right-y.width/2,E=u>y.bottom-y.height/2;switch(w){case"top":if(m>=y.left&&m<=y.right&&g>=y.bottom&&g<=h.top)return;break;case"bottom":if(m>=y.left&&m<=y.right&&g>=h.bottom&&g<=y.top)return;break;case"left":if(m>=y.right&&m<=h.left&&g>=y.left&&g<=y.right)return;break;case"right":if(m>=y.right&&m<=h.left&&g>=y.right&&g<=h.left)return}function x(e){let[n,t]=e;const r=y.width>h.width,o=y.height>h.height;switch(w){case"top":{const e=[r?n:b?n+1:n-1,t+1],o=[r?n:b?n-1:n+1,t+1],u=[[y.left,b||r?y.bottom-1:y.top],[y.right,b?r?y.bottom-1:y.top:y.bottom-1]];return b?[e,o,...u]:[e,...u,o]}case"bottom":{const e=[r?n:b?n+1:n-1,t-1],o=[r?n:b?n-1:n+1,t-1],u=[[y.left,b||r?y.top+1:y.bottom],[y.right,b?r?y.top+1:y.bottom:y.top+1]];return b?[e,o,...u]:[e,...u,o]}case"left":{const e=[n+1,o?t:E?t-1:t+1],r=[n+1,o?t:E?t+1:t-1],u=[[E||o?y.right-1:y.left,y.top],[E?o?y.right-1:y.left:y.right-1,y.bottom]];return E?[e,...u,r]:[...u,e,r]}case"right":{const e=[n-1,o?t:E?t+1:t-1],r=[n-1,o?t:E?t-1:t+1],u=[[E||o?y.left+1:y.right,y.top],[E?o?y.left+1:y.right:y.left+1,y.bottom]];return E?[e,r,...u]:[e,...u,r]}}}const L=x([o,u]);"production"!==process.env.NODE_ENV&&(null==r||r(x([o,u]).slice(0,4).join(", "))),v([m,g],L)?t&&(n=setTimeout(l,t)):(clearTimeout(n),l())}}}const K="floating-ui-root",F=e=>{let{children:n,id:t=K}=e;const[r,o]=l(!1),c=u(null);return g((()=>{const e=document.getElementById(t);e?c.current=e:(c.current=document.createElement("div"),c.current.id=t);const n=c.current;n.setAttribute("data-floating-ui-portal",""),document.body.contains(n)||document.body.appendChild(n),o(!0)}),[t]),r&&c.current?m(n,c.current):null};function V(){return V=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},V.apply(this,arguments)}const U=a((function(e,t){let{lockScroll:r=!1,...o}=e;return g((()=>{if(!r)return;const e=window.pageXOffset,n=window.pageYOffset,t=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:"-"+n+"px",left:"-"+e+"px",right:"0",[t]:o+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[t]:""}),window.scrollTo(e,n)}}),[r]),n.createElement("div",V({ref:t},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function q(e,n,t){return t&&"mouse"!==t?0:"number"==typeof e?e:null==e?void 0:e[n]}const H=function(e,n){let{enabled:t=!0,delay:o=0,handleClose:i=null,mouseOnly:l=!1,restMs:a=0}=void 0===n?{}:n;const{open:f,onOpenChange:s,dataRef:d,events:v,refs:m}=e,p=I(),h=u(),y=u(),w=u(),b=u(),E=u(!0);g((()=>{t&&(f||(h.current=void 0))})),r((()=>{if(t)return v.on("dismiss",e),()=>{v.off("dismiss",e)};function e(){clearTimeout(y.current),clearTimeout(b.current),E.current=!0}}),[t,v]),r((()=>{if(!t||!i)return;function e(){var e;null!=(e=d.current.openEvent)&&e.type.includes("mouse")&&s(!1)}const n=P(m.floating.current).documentElement;return n.addEventListener("mouseleave",e),()=>{n.removeEventListener("mouseleave",e)}}),[m.floating,s,t,i,d]);const x=c((function(e){void 0===e&&(e=!0),o?(clearTimeout(y.current),y.current=setTimeout((()=>s(!1)),q(o,"close",h.current))):e&&s(!1)}),[o,s]);function L(e){h.current=e.pointerType}return r((()=>{if(!t)return;function n(e){f||l&&"mouse"!==h.current||(E.current=!1,d.current.openEvent=e,o?(clearTimeout(y.current),y.current=setTimeout((()=>{s(!0)}),q(o,"open",h.current))):s(!0))}function r(n){var t;if("click"===(null==(t=d.current.openEvent)?void 0:t.type))return;const r=P(m.floating.current);if(clearTimeout(b.current),i)return clearTimeout(y.current),w.current&&r.removeEventListener("pointermove",w.current),w.current=i({...e,tree:p,x:n.clientX,y:n.clientY,onClose(){w.current&&r.removeEventListener("pointermove",w.current),x()}}),void r.addEventListener("pointermove",w.current);x()}const u=m.reference.current;return M(u)?(u.addEventListener("mouseenter",n),u.addEventListener("mouseleave",r),()=>{u.removeEventListener("mouseenter",n),u.removeEventListener("mouseleave",r)}):void 0}),[t,x,e,o,i,d,l,s,f,p,m.reference,m.floating]),t?{reference:{onPointerDown:L,onPointerEnter:L,onMouseMove(){f||0===a||(clearTimeout(b.current),b.current=setTimeout((()=>{E.current||s(!0)}),a))}},floating:{onMouseEnter(){clearTimeout(y.current)},onMouseLeave:()=>x(!1)}}:{}},X=i({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),Y=()=>o(X),W=e=>{let{children:t,delay:r}=e;const[o,u]=l({delay:r,initialDelay:r,currentId:null}),i=c((e=>{u((n=>({...n,currentId:e})))}),[]);return n.createElement(X.Provider,{value:{...o,setState:u,setCurrentId:i}},t)},z=(e,n)=>{let{open:t,onOpenChange:o}=e,{id:u}=n;const{currentId:c,initialDelay:i,setState:l}=Y();r((()=>{c&&o&&(l((e=>({...e,delay:{open:0,close:q(i,"close")}}))),c!==u&&o(!1))}),[u,o,l,c,i]),r((()=>{!t&&c===u&&o&&(o(!1),l((e=>({...e,delay:i,currentId:null}))))}),[t,l,c,u,o,i])},_=function(e,n){let{open:t}=e,{enabled:r=!0,role:o="dialog"}=void 0===n?{}:n;const u=E(),c=u+"-reference",i={id:u,role:o};return r?"tooltip"===o?{reference:{"aria-describedby":t?u:void 0},floating:i}:{reference:{"aria-expanded":t?"true":"false","aria-haspopup":o,"aria-controls":t?u:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:c}},floating:{...i,..."menu"===o&&{"aria-labelledby":c}}}:{}},G=function(e,n){let{open:t,onOpenChange:r,dataRef:o}=e,{enabled:u=!0}=void 0===n?{}:n;return u?{reference:{onClick(e){var n;t?"click"===(null==(n=o.current.openEvent)?void 0:n.type)&&r(!1):r(!0);o.current.openEvent=e.nativeEvent}}}:{}},J=function(e,n){let{open:t,onOpenChange:o,refs:u,events:i,nodeId:l}=e,{enabled:a=!0,escapeKey:f=!0,outsidePointerDown:d=!0,referencePointerDown:v=!1,ancestorScroll:m=!1}=void 0===n?{}:n;const g=I(),p=c((()=>{N(u.reference.current)&&u.reference.current.focus()}),[u.reference.current]);return r((()=>{if(!t||!a)return;function e(e){"Escape"===e.key&&(i.emit("dismiss"),o(!1),p())}function n(e){var n;const t=g&&S(g,l).some((n=>{var t,r;return null==(t=n.context)||null==(r=t.refs.floating.current)?void 0:r.contains(e.target)}));null!=(n=u.floating.current)&&n.contains(e.target)||M(u.reference.current)&&u.reference.current.contains(e.target)||t||(i.emit("dismiss"),o(!1),p())}function r(){o(!1)}const c=P(u.floating.current);f&&c.addEventListener("keydown",e),d&&c.addEventListener("mousedown",n);const v=(m?[...M(u.reference.current)?s(u.reference.current):[],...M(u.floating.current)?s(u.floating.current):[]]:[]).filter((e=>{var n;return e!==(null==(n=c.defaultView)?void 0:n.visualViewport)}));return v.forEach((e=>e.addEventListener("scroll",r,{passive:!0}))),()=>{f&&c.removeEventListener("keydown",e),d&&c.removeEventListener("mousedown",n),v.forEach((e=>e.removeEventListener("scroll",r)))}}),[f,d,i,g,l,t,o,p,m,a,u.floating,u.reference]),a?{reference:{onPointerDown(){v&&(i.emit("dismiss"),o(!1))}}}:{}},Q=function(e,n){let{open:t,onOpenChange:o,dataRef:c,refs:i,events:l}=e,{enabled:a=!0,keyboardOnly:f=!0}=void 0===n?{}:n;const s=u(!1);return r((()=>{var e;if(!a)return;const n=null!=(e=P(i.floating.current).defaultView)?e:window;function r(){s.current=!t}function o(){setTimeout((()=>{s.current=!1}))}return n.addEventListener("focus",o),n.addEventListener("blur",r),()=>{n.removeEventListener("focus",o),n.removeEventListener("blur",r)}}),[i.floating,t,a]),r((()=>{if(a)return l.on("dismiss",e),()=>{l.off("dismiss",e)};function e(){s.current=!0}}),[l,a]),a?{reference:{onPointerDown(e){let{pointerType:n}=e;s.current=!(!n||!f)},onFocus(e){var n,t,r;s.current||"focus"===e.type&&"mousedown"===(null==(n=c.current.openEvent)?void 0:n.type)&&M(i.reference.current)&&null!=(t=i.reference.current)&&t.contains(null==(r=c.current.openEvent)?void 0:r.target)||(c.current.openEvent=e.nativeEvent,o(!0))},onBlur(e){var n;const t=e.relatedTarget;null!=(n=i.floating.current)&&n.contains(t)||M(i.reference.current)&&i.reference.current.contains(t)||(s.current=!1,o(!1))}}}:{}};function Z(e){e.preventDefault(),e.stopPropagation()}const $=["content"];function ee(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const ne=function(e,n){let{open:t,onOpenChange:o,refs:i}=e,{enabled:l=!0,initialContentFocus:a=0,order:f=$,modal:s=!0,inert:d=!1}=void 0===n?{}:n;const v=u(null),m=u(null),p=c((()=>f.map((e=>{return N(i.reference.current)&&"reference"===e?i.reference.current:i.floating.current&&"floating"===e?i.floating.current:"content"===e?Array.from(null!=(n=null==(t=i.floating.current)?void 0:t.querySelectorAll("a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,*[tabindex],*[contenteditable]"))?n:[]):null;var n,t})).filter(Boolean).flat()),[i.floating,i.reference,f]);function h(e){var n;const t=e.relatedTarget;null!=(n=i.floating.current)&&n.contains(t)||!M(i.reference.current)||i.reference.current.contains(t)||o(!1)}return g((()=>{const e=i.floating.current;if(!(l&&t&&e&&s))return;function n(){const n=P(e).createElement("div");return n.tabIndex=0,Object.assign(n.style,{position:"fixed",outline:"0",pointerEvents:"none"}),n.setAttribute("aria-hidden","true"),n}v.current||(v.current=n()),m.current||(m.current=n());const r=v.current,o=m.current;function u(e){var n;Z(e);const t=p();null==(n=t[e.target===o?0:t.length-1])||n.focus()}return e.insertAdjacentElement("beforebegin",r),e.insertAdjacentElement("afterend",o),r.addEventListener("focus",u),o.addEventListener("focus",u),()=>{var e,n;r.removeEventListener("focus",u),o.removeEventListener("focus",u),null!=(e=r.parentNode)&&e.contains(r)&&r.parentNode.removeChild(r),null!=(n=o.parentNode)&&n.contains(o)&&o.parentNode.removeChild(o)}}),[l,t,s,d,p,i.floating]),r((()=>{if(!l||!t||!d)return;function e(e){"Tab"===e.key&&Z(e)}const n=P(i.floating.current);return n.addEventListener("keydown",e),()=>{n.removeEventListener("keydown",e)}}),[l,t,d,i.floating]),r((()=>{if(!l)return;const e=p();if(d){if(t){const n=e[0];n!==i.floating.current||n.contains(n.ownerDocument.activeElement)||ee(n)}}else t?"number"==typeof a?ee(e[a]):a.current&&ee(e.find((e=>e===a.current))):s&&N(i.reference.current)&&ee(i.reference.current)}),[p,t,d,s,a,l,i.reference,i.floating]),r((()=>{if(!t||!s||!l)return;const e=P(i.floating.current).querySelectorAll("body > *:not([data-floating-ui-portal]"),n=[];return e.forEach((e=>{const t=e.getAttribute("aria-hidden");n.push(t),e.setAttribute("aria-hidden","true")})),()=>{e.forEach(((e,t)=>{const r=n[t];null===r?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r)}))}}),[t,s,l,i.floating]),l?s?{floating:{"aria-modal":"true"}}:{reference:{onBlur:h},floating:{onBlur:h}}:{}};function te(e,n){let{startingIndex:t=-1,decrement:r=!1}=void 0===n?{}:n;const o=le(e);let u=t;do{var c,i;u+=r?-1:1}while(null!=(c=o[u])&&c.hasAttribute("disabled")||"true"===(null==(i=o[u])?void 0:i.getAttribute("aria-disabled")));return-1===u?0:u}function re(e,n,t){switch(e){case"vertical":return n;case"horizontal":return t;default:return n||t}}function oe(e,n){return re(n,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function ue(e,n,t){return re(n,"ArrowDown"===e,t?"ArrowLeft"===e:"ArrowRight"===e)}function ce(e){return te(e)}function ie(e){return te(e,{decrement:!0,startingIndex:le(e).length})}function le(e){return e.current.filter((e=>null!=e))}const ae=function(e,n){let{open:t,onOpenChange:r,refs:o}=e,{listRef:i,activeIndex:a,onNavigate:f,enabled:s=!0,selectedIndex:d=null,loop:v=!1,nested:m=!1,rtl:p=!1,virtual:h=!1,focusItemOnOpen:y="auto",orientation:w="vertical"}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:n;const b=u(y),E=u(null!=d?d:-1),x=u(""),[L,A]=l(),I=c(((e,n)=>{var t,r;h?A(null==(t=le(e)[n.current])?void 0:t.id):null==(r=le(e)[n.current])||r.focus({preventScroll:!0})}),[h]);function T(e){"auto"===y&&(b.current=!e.pointerType)}if(g((()=>{s&&(null!=d&&(E.current=d),t&&b.current&&(f(E.current),I(i,E)))}),[t,d,i,f,I,s]),g((()=>{s&&t&&null!=a&&(E.current=a,f(E.current),I(i,E))}),[t,a,i,f,I,s]),g((()=>{null==d&&s&&(t&&(oe(x.current,w)||b.current&&(" "===x.current||"Enter"===x.current))&&(E.current=function(e,n,t){return re(n,"ArrowUp"===e,t?"ArrowRight"===e:"ArrowLeft"===e)}(x.current,w,p)?ie(i):ce(i),f(E.current),I(i,E)),x.current="")}),[t,i,d,f,I,s,w,p]),g((()=>{var e;s&&(t||null==d||null==(e=o.reference.current)||e.focus({preventScroll:!0}))}),[o.reference,d,t,s]),g((()=>{var e;s&&(t||("auto"===y&&(b.current=!0),E.current=null!=(e=null!=d?d:a)?e:-1,f(null)))}),[t,d,a,s,y]),!s)return{};function k(e){if(m&&function(e,n,t){return re(n,t?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(e.key,w,p))return Z(e),r(!1),void(N(o.reference.current)&&o.reference.current.focus());const n=E.current,t=ce(i),u=ie(i);if("Home"===e.key&&(E.current=t,f(E.current),I(i,E)),"End"===e.key&&(E.current=u,f(E.current),I(i,E)),oe(e.key,w)){if(Z(e),!h&&e.currentTarget.ownerDocument.activeElement===e.currentTarget)return E.current=null!=d?d:ue(e.key,w,p)?t:u,f(E.current),void I(i,E);ue(e.key,w,p)?E.current=v?n===u?t:te(i,{startingIndex:n}):Math.min(u,te(i,{startingIndex:n})):E.current=v?n===t?u:te(i,{startingIndex:n,decrement:!0}):Math.max(t,te(i,{startingIndex:n,decrement:!0})),f(E.current),I(i,E)}}return{reference:{...h&&{"aria-activedescendant":L},onPointerEnter:T,onPointerDown:T,onKeyDown(e){if(h&&t)return k(e);"auto"===y&&(b.current=!0),x.current=e.key,m?function(e,n,t){return re(n,t?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(e.key,w,p)&&(E.current=ce(i),Z(e),r(!0),f(E.current)):(oe(e.key,w)&&(E.current=null==d?ue(e.key,w,p)?ce(i):ie(i):d,Z(e),r(!0),f(E.current)),h&&!t&&k(e))}},floating:{"aria-orientation":"both"===w?void 0:w,...h&&{"aria-activedescendant":L},onKeyDown:k}}},fe=function(e,n){var t;let{open:r,dataRef:o}=e,{listRef:c,activeIndex:i,onMatch:l=(()=>{}),enabled:a=!0,findMatch:f=null,resetMs:s=500,ignoreKeys:d=[],selectedIndex:v=null}=void 0===n?{listRef:{current:[]},activeIndex:null}:n;const m=u(),p=u(""),h=u(null!=(t=null!=v?v:i)?t:-1),y=u(null);function w(e){if(!e.currentTarget.contains(P(e.currentTarget).activeElement))return;p.current.length>0&&(o.current.typing=!0," "===e.key&&Z(e));const n=c.current;if(null==n||["Home","End","Escape","Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight",...d].includes(e.key))return;n.every((e=>{var n,t;return!e||(null==(n=e[0])?void 0:n.toLowerCase())!==(null==(t=e[1])?void 0:t.toLowerCase())}))&&p.current===e.key&&(p.current="",h.current=y.current),p.current+=e.key,clearTimeout(m.current),m.current=setTimeout((()=>{p.current="",h.current=y.current,o.current.typing=!1}),s);const t=h.current,r=[...n.slice((null!=t?t:0)+1),...n.slice(0,(null!=t?t:0)+1)],u=f?f(r,p.current):r.find((e=>0===(null==e?void 0:e.toLowerCase().indexOf(p.current)))),i=u?n.indexOf(u):-1;-1!==i&&(l(i),y.current=i)}return g((()=>{r&&(clearTimeout(m.current),y.current=null,p.current="")}),[r]),g((()=>{var e;r&&""===p.current&&(h.current=null!=(e=null!=v?v:i)?e:-1)}),[r,v,i]),a?{reference:{onKeyDown:w},floating:{onKeyDown:w}}:{}};function se(e){let{open:n=!1,onOpenChange:t=(()=>{}),placement:r,middleware:o,strategy:c,nodeId:i}=void 0===e?{}:e;const a=I(),s=u({}),v=l((()=>p()))[0],m=d({placement:r,middleware:o,strategy:c}),h=f((()=>({...m,dataRef:s,nodeId:i,events:v,open:n,onOpenChange:t})),[m,s,i,v,n,t]);return g((()=>{const e=null==a?void 0:a.nodesRef.current.find((e=>e.id===i));e&&(e.context=h)})),f((()=>({context:h,...m})),[m,h])}export{W as FloatingDelayGroup,k as FloatingNode,U as FloatingOverlay,F as FloatingPortal,O as FloatingTree,B as safePolygon,G as useClick,z as useDelayGroup,Y as useDelayGroupContext,J as useDismiss,se as useFloating,T as useFloatingNodeId,A as useFloatingParentNodeId,I as useFloatingTree,Q as useFocus,ne as useFocusTrap,H as useHover,E as useId,D as useInteractions,ae as useListNavigation,_ as useRole,fe as useTypeahead};

@@ -1104,3 +1104,3 @@ (function (global, factory) {

return () => {
win.addEventListener('focus', onFocus);
win.removeEventListener('focus', onFocus);
win.removeEventListener('blur', onBlur);

@@ -1107,0 +1107,0 @@ };

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@floating-ui/react-dom"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","@floating-ui/react-dom","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIReactDOM={},e.React,e.FloatingUIReactDOM,e.ReactDOM)}(this,(function(e,t,n,r){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var c=u(t),i=o(t),l="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;function a(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter((e=>e!==n)))}}}let s=!1,f=0;const d=()=>"floating-ui-"+f++;const v=c["useId".toString()],g=null!=v?v:function(){const e=s?d():null,[t,n]=c.useState(e);return l((()=>{null===t&&n(d())}),[]),c.useEffect((()=>{s||(s=!0)}),[]),t},p=t.createContext(null),m=t.createContext(null),y=()=>{var e,n;return null!=(e=null==(n=t.useContext(p))?void 0:n.id)?e:null},h=()=>t.useContext(m);function b(e){return Object.entries(null!=e?e:{}).reduce(((e,t)=>{let[n,r]=t;return e[n]=[r],e}),{})}function E(e,t,n){const r={reference:"reference"===n?b(e):{},floating:"floating"===n?b(e):{}};return t.forEach((e=>{var t;const o=null!=(t=null==e?void 0:e[n])?t:{};Object.keys(o).forEach((e=>{var t;"function"==typeof o[e]&&(null==r[n][e]&&(r[n][e]=[]),null==(t=r[n][e])||t.push(o[e]))}))})),{..."floating"===n&&{tabIndex:-1},...e,...t.reduce(((e,t)=>(Object.assign(e,null==t?void 0:t[n]),e)),{}),...Object.entries(r[n]).reduce(((e,t)=>{let[n,r]=t;return 0===n.indexOf("on")&&(e[n]=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.forEach((e=>e(...t)))}),e}),{})}}var w={exports:{}},x=function(e,t,n,r){var o=e[0],u=e[1],c=!1;void 0===n&&(n=0),void 0===r&&(r=t.length);for(var i=(r-n)/2,l=0,a=i-1;l<i;a=l++){var s=t[n+2*l+0],f=t[n+2*l+1],d=t[n+2*a+0],v=t[n+2*a+1];f>u!=v>u&&o<(d-s)*(u-f)/(v-f)+s&&(c=!c)}return c},O=function(e,t,n,r){var o=e[0],u=e[1],c=!1;void 0===n&&(n=0),void 0===r&&(r=t.length);for(var i=r-n,l=0,a=i-1;l<i;a=l++){var s=t[l+n][0],f=t[l+n][1],d=t[a+n][0],v=t[a+n][1];f>u!=v>u&&o<(d-s)*(u-f)/(v-f)+s&&(c=!c)}return c};w.exports=function(e,t,n,r){return t.length>0&&Array.isArray(t[0])?O(e,t,n,r):x(e,t,n,r)},w.exports.nested=O,w.exports.flat=x;var R=w.exports;function C(e){var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document}function k(e){var t;return null!=(t=C(e).defaultView)?t:window}function I(e){return!!e&&e instanceof k(e).Element}function T(e){return!!e&&e instanceof k(e).HTMLElement}function L(e,t){var n;let r=null!=(n=null==e?void 0:e.nodesRef.current.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})))?n:[],o=r;for(;o.length;){var u;o=null!=(u=null==e?void 0:e.nodesRef.current.filter((e=>{var t;return null==(t=o)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})))?u:[],r=r.concat(o)}return r}const D="floating-ui-root";function A(){return A=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A.apply(this,arguments)}const P=t.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return l((()=>{if(!n)return;const e=window.pageXOffset,t=window.pageYOffset,r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:"-"+t+"px",left:"-"+e+"px",right:"0",[r]:o+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[r]:""}),window.scrollTo(e,t)}}),[n]),i.default.createElement("div",A({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function j(e,t,n){return n&&"mouse"!==n?0:"number"==typeof e?e:null==e?void 0:e[t]}const M=t.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),F=()=>t.useContext(M);function N(e){e.preventDefault(),e.stopPropagation()}const S=["content"];function B(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const q="ArrowUp",K="ArrowDown",V="ArrowLeft",_="ArrowRight";function H(e,t){let{startingIndex:n=-1,decrement:r=!1}=void 0===t?{}:t;const o=W(e);let u=n;do{var c,i;u+=r?-1:1}while(null!=(c=o[u])&&c.hasAttribute("disabled")||"true"===(null==(i=o[u])?void 0:i.getAttribute("aria-disabled")));return-1===u?0:u}function U(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function G(e,t){return U(t,e===q||e===K,e===V||e===_)}function X(e,t,n){return U(t,e===K,n?e===V:e===_)}function Y(e){return H(e)}function z(e){return H(e,{decrement:!0,startingIndex:W(e).length})}function W(e){return e.current.filter((e=>null!=e))}e.FloatingDelayGroup=e=>{let{children:n,delay:r}=e;const[o,u]=t.useState({delay:r,initialDelay:r,currentId:null}),c=t.useCallback((e=>{u((t=>({...t,currentId:e})))}),[]);return i.default.createElement(M.Provider,{value:{...o,setState:u,setCurrentId:c}},n)},e.FloatingNode=e=>{let{children:t,id:n}=e;const r=y();return i.default.createElement(p.Provider,{value:{id:n,parentId:r}},t)},e.FloatingOverlay=P,e.FloatingPortal=e=>{let{children:n,id:o=D}=e;const[u,c]=t.useState(!1),i=t.useRef(null);return l((()=>{const e=document.getElementById(o);e?i.current=e:(i.current=document.createElement("div"),i.current.id=o);const t=i.current;t.setAttribute("data-floating-ui-portal",""),document.body.contains(t)||document.body.appendChild(t),c(!0)}),[o]),u&&i.current?r.createPortal(n,i.current):null},e.FloatingTree=e=>{let{children:n}=e;const r=t.useRef([]),o=t.useCallback((e=>{r.current=[...r.current,e]}),[]),u=t.useCallback((e=>{r.current=r.current.filter((t=>t!==e))}),[]);return i.default.createElement(m.Provider,{value:{nodesRef:r,addNode:o,removeNode:u,events:a()}},n)},e.safePolygon=function(e){let t,{timeout:n=0,debug:r=null}=void 0===e?{}:e;return e=>{let{x:o,y:u,placement:c,refs:i,onClose:l,nodeId:a,tree:s}=e;return function(e){var f;if("touch"===e.pointerType)return;const{target:d,clientX:v,clientY:g}=e,p=d;if("pointermove"===e.type&&I(i.reference.current)&&i.reference.current.contains(p)||null!=(f=i.floating.current)&&f.contains(p))return;if(s&&L(s,a).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if(!i.reference.current||!i.floating.current||null==c||null==o||null==u)return;const m=i.reference.current.getBoundingClientRect(),y=i.floating.current.getBoundingClientRect(),h=c.split("-")[0],b=o>y.right-y.width/2,E=u>y.bottom-y.height/2;switch(h){case"top":if(v>=y.left&&v<=y.right&&g>=y.bottom&&g<=m.top)return;break;case"bottom":if(v>=y.left&&v<=y.right&&g>=m.bottom&&g<=y.top)return;break;case"left":if(v>=y.right&&v<=m.left&&g>=y.left&&g<=y.right)return;break;case"right":if(v>=y.right&&v<=m.left&&g>=y.right&&g<=m.left)return}function w(e){let[t,n]=e;const r=y.width>m.width,o=y.height>m.height;switch(h){case"top":{const e=[r?t:b?t+1:t-1,n+1],o=[r?t:b?t-1:t+1,n+1],u=[[y.left,b||r?y.bottom-1:y.top],[y.right,b?r?y.bottom-1:y.top:y.bottom-1]];return b?[e,o,...u]:[e,...u,o]}case"bottom":{const e=[r?t:b?t+1:t-1,n-1],o=[r?t:b?t-1:t+1,n-1],u=[[y.left,b||r?y.top+1:y.bottom],[y.right,b?r?y.top+1:y.bottom:y.top+1]];return b?[e,o,...u]:[e,...u,o]}case"left":{const e=[t+1,o?n:E?n-1:n+1],r=[t+1,o?n:E?n+1:n-1],u=[[E||o?y.right-1:y.left,y.top],[E?o?y.right-1:y.left:y.right-1,y.bottom]];return E?[e,...u,r]:[...u,e,r]}case"right":{const e=[t-1,o?n:E?n+1:n-1],r=[t-1,o?n:E?n-1:n+1],u=[[E||o?y.left+1:y.right,y.top],[E?o?y.left+1:y.right:y.left+1,y.bottom]];return E?[e,r,...u]:[e,...u,r]}}}const x=w([o,u]);"production"!==process.env.NODE_ENV&&(null==r||r(w([o,u]).slice(0,4).join(", "))),R([v,g],x)?n&&(t=setTimeout(l,n)):(clearTimeout(t),l())}}},e.useClick=function(e,t){let{open:n,onOpenChange:r,dataRef:o}=e,{enabled:u=!0}=void 0===t?{}:t;return u?{reference:{onClick(e){var t;n?"click"===(null==(t=o.current.openEvent)?void 0:t.type)&&r(!1):r(!0);o.current.openEvent=e.nativeEvent}}}:{}},e.useDelayGroup=(e,n)=>{let{open:r,onOpenChange:o}=e,{id:u}=n;const{currentId:c,initialDelay:i,setState:l}=F();t.useEffect((()=>{c&&o&&(l((e=>({...e,delay:{open:0,close:j(i,"close")}}))),c!==u&&o(!1))}),[u,o,l,c,i]),t.useEffect((()=>{!r&&c===u&&o&&(o(!1),l((e=>({...e,delay:i,currentId:null}))))}),[r,l,c,u,o,i])},e.useDelayGroupContext=F,e.useDismiss=function(e,r){let{open:o,onOpenChange:u,refs:c,events:i,nodeId:l}=e,{enabled:a=!0,escapeKey:s=!0,outsidePointerDown:f=!0,referencePointerDown:d=!1,ancestorScroll:v=!1}=void 0===r?{}:r;const g=h(),p=t.useCallback((()=>{T(c.reference.current)&&c.reference.current.focus()}),[c.reference.current]);return t.useEffect((()=>{if(!o||!a)return;function e(e){"Escape"===e.key&&(i.emit("dismiss"),u(!1),p())}function t(e){var t;const n=g&&L(g,l).some((t=>{var n,r;return null==(n=t.context)||null==(r=n.refs.floating.current)?void 0:r.contains(e.target)}));null!=(t=c.floating.current)&&t.contains(e.target)||I(c.reference.current)&&c.reference.current.contains(e.target)||n||(i.emit("dismiss"),u(!1),p())}function r(){u(!1)}const d=C(c.floating.current);s&&d.addEventListener("keydown",e),f&&d.addEventListener("mousedown",t);const m=(v?[...I(c.reference.current)?n.getOverflowAncestors(c.reference.current):[],...I(c.floating.current)?n.getOverflowAncestors(c.floating.current):[]]:[]).filter((e=>{var t;return e!==(null==(t=d.defaultView)?void 0:t.visualViewport)}));return m.forEach((e=>e.addEventListener("scroll",r,{passive:!0}))),()=>{s&&d.removeEventListener("keydown",e),f&&d.removeEventListener("mousedown",t),m.forEach((e=>e.removeEventListener("scroll",r)))}}),[s,f,i,g,l,o,u,p,v,a,c.floating,c.reference]),a?{reference:{onPointerDown(){d&&(i.emit("dismiss"),u(!1))}}}:{}},e.useFloating=function(e){let{open:r=!1,onOpenChange:o=(()=>{}),placement:u,middleware:c,strategy:i,nodeId:s}=void 0===e?{}:e;const f=h(),d=t.useRef({}),v=t.useState((()=>a()))[0],g=n.useFloating({placement:u,middleware:c,strategy:i}),p=t.useMemo((()=>({...g,dataRef:d,nodeId:s,events:v,open:r,onOpenChange:o})),[g,d,s,v,r,o]);return l((()=>{const e=null==f?void 0:f.nodesRef.current.find((e=>e.id===s));e&&(e.context=p)})),t.useMemo((()=>({context:p,...g})),[g,p])},e.useFloatingNodeId=()=>{const e=g(),t=h(),n=y();return l((()=>{const r={id:e,parentId:n};return null==t||t.addNode(r),()=>{null==t||t.removeNode(r)}}),[t,e,n]),e},e.useFloatingParentNodeId=y,e.useFloatingTree=h,e.useFocus=function(e,n){let{open:r,onOpenChange:o,dataRef:u,refs:c,events:i}=e,{enabled:l=!0,keyboardOnly:a=!0}=void 0===n?{}:n;const s=t.useRef(!1);return t.useEffect((()=>{var e;if(!l)return;const t=null!=(e=C(c.floating.current).defaultView)?e:window;function n(){s.current=!r}function o(){setTimeout((()=>{s.current=!1}))}return t.addEventListener("focus",o),t.addEventListener("blur",n),()=>{t.addEventListener("focus",o),t.removeEventListener("blur",n)}}),[c.floating,r,l]),t.useEffect((()=>{if(l)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(){s.current=!0}}),[i,l]),l?{reference:{onPointerDown(e){let{pointerType:t}=e;s.current=!(!t||!a)},onFocus(e){var t,n,r;s.current||"focus"===e.type&&"mousedown"===(null==(t=u.current.openEvent)?void 0:t.type)&&I(c.reference.current)&&null!=(n=c.reference.current)&&n.contains(null==(r=u.current.openEvent)?void 0:r.target)||(u.current.openEvent=e.nativeEvent,o(!0))},onBlur(e){var t;const n=e.relatedTarget;null!=(t=c.floating.current)&&t.contains(n)||I(c.reference.current)&&c.reference.current.contains(n)||(s.current=!1,o(!1))}}}:{}},e.useFocusTrap=function(e,n){let{open:r,onOpenChange:o,refs:u}=e,{enabled:c=!0,initialContentFocus:i=0,order:a=S,modal:s=!0,inert:f=!1}=void 0===n?{}:n;const d=t.useRef(null),v=t.useRef(null),g=t.useCallback((()=>a.map((e=>{return T(u.reference.current)&&"reference"===e?u.reference.current:u.floating.current&&"floating"===e?u.floating.current:"content"===e?Array.from(null!=(t=null==(n=u.floating.current)?void 0:n.querySelectorAll("a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,*[tabindex],*[contenteditable]"))?t:[]):null;var t,n})).filter(Boolean).flat()),[u.floating,u.reference,a]);function p(e){var t;const n=e.relatedTarget;null!=(t=u.floating.current)&&t.contains(n)||!I(u.reference.current)||u.reference.current.contains(n)||o(!1)}return l((()=>{const e=u.floating.current;if(!(c&&r&&e&&s))return;function t(){const t=C(e).createElement("div");return t.tabIndex=0,Object.assign(t.style,{position:"fixed",outline:"0",pointerEvents:"none"}),t.setAttribute("aria-hidden","true"),t}d.current||(d.current=t()),v.current||(v.current=t());const n=d.current,o=v.current;function i(e){var t;N(e);const n=g();null==(t=n[e.target===o?0:n.length-1])||t.focus()}return e.insertAdjacentElement("beforebegin",n),e.insertAdjacentElement("afterend",o),n.addEventListener("focus",i),o.addEventListener("focus",i),()=>{var e,t;n.removeEventListener("focus",i),o.removeEventListener("focus",i),null!=(e=n.parentNode)&&e.contains(n)&&n.parentNode.removeChild(n),null!=(t=o.parentNode)&&t.contains(o)&&o.parentNode.removeChild(o)}}),[c,r,s,f,g,u.floating]),t.useEffect((()=>{if(!c||!r||!f)return;function e(e){"Tab"===e.key&&N(e)}const t=C(u.floating.current);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[c,r,f,u.floating]),t.useEffect((()=>{if(!c)return;const e=g();if(f){if(r){const t=e[0];t!==u.floating.current||t.contains(t.ownerDocument.activeElement)||B(t)}}else r?"number"==typeof i?B(e[i]):i.current&&B(e.find((e=>e===i.current))):s&&T(u.reference.current)&&B(u.reference.current)}),[g,r,f,s,i,c,u.reference,u.floating]),t.useEffect((()=>{if(!r||!s||!c)return;const e=C(u.floating.current).querySelectorAll("body > *:not([data-floating-ui-portal]"),t=[];return e.forEach((e=>{const n=e.getAttribute("aria-hidden");t.push(n),e.setAttribute("aria-hidden","true")})),()=>{e.forEach(((e,n)=>{const r=t[n];null===r?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r)}))}}),[r,s,c,u.floating]),c?s?{floating:{"aria-modal":"true"}}:{reference:{onBlur:p},floating:{onBlur:p}}:{}},e.useHover=function(e,n){let{enabled:r=!0,delay:o=0,handleClose:u=null,mouseOnly:c=!1,restMs:i=0}=void 0===n?{}:n;const{open:a,onOpenChange:s,dataRef:f,events:d,refs:v}=e,g=h(),p=t.useRef(),m=t.useRef(),y=t.useRef(),b=t.useRef(),E=t.useRef(!0);l((()=>{r&&(a||(p.current=void 0))})),t.useEffect((()=>{if(r)return d.on("dismiss",e),()=>{d.off("dismiss",e)};function e(){clearTimeout(m.current),clearTimeout(b.current),E.current=!0}}),[r,d]),t.useEffect((()=>{if(!r||!u)return;function e(){var e;null!=(e=f.current.openEvent)&&e.type.includes("mouse")&&s(!1)}const t=C(v.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[v.floating,s,r,u,f]);const w=t.useCallback((function(e){void 0===e&&(e=!0),o?(clearTimeout(m.current),m.current=setTimeout((()=>s(!1)),j(o,"close",p.current))):e&&s(!1)}),[o,s]);function x(e){p.current=e.pointerType}return t.useEffect((()=>{if(!r)return;function t(e){a||c&&"mouse"!==p.current||(E.current=!1,f.current.openEvent=e,o?(clearTimeout(m.current),m.current=setTimeout((()=>{s(!0)}),j(o,"open",p.current))):s(!0))}function n(t){var n;if("click"===(null==(n=f.current.openEvent)?void 0:n.type))return;const r=C(v.floating.current);if(clearTimeout(b.current),u)return clearTimeout(m.current),y.current&&r.removeEventListener("pointermove",y.current),y.current=u({...e,tree:g,x:t.clientX,y:t.clientY,onClose(){y.current&&r.removeEventListener("pointermove",y.current),w()}}),void r.addEventListener("pointermove",y.current);w()}const i=v.reference.current;return I(i)?(i.addEventListener("mouseenter",t),i.addEventListener("mouseleave",n),()=>{i.removeEventListener("mouseenter",t),i.removeEventListener("mouseleave",n)}):void 0}),[r,w,e,o,u,f,c,s,a,g,v.reference,v.floating]),r?{reference:{onPointerDown:x,onPointerEnter:x,onMouseMove(){a||0===i||(clearTimeout(b.current),b.current=setTimeout((()=>{E.current||s(!0)}),i))}},floating:{onMouseEnter(){clearTimeout(m.current)},onMouseLeave:()=>w(!1)}}:{}},e.useId=g,e.useInteractions=function(e){return void 0===e&&(e=[]),{getReferenceProps:t=>E(t,e,"reference"),getFloatingProps:t=>E(t,e,"floating")}},e.useListNavigation=function(e,n){let{open:r,onOpenChange:o,refs:u}=e,{listRef:c,activeIndex:i,onNavigate:a,enabled:s=!0,selectedIndex:f=null,loop:d=!1,nested:v=!1,rtl:g=!1,virtual:p=!1,focusItemOnOpen:m="auto",orientation:y="vertical"}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:n;const h=t.useRef(m),b=t.useRef(null!=f?f:-1),E=t.useRef(""),[w,x]=t.useState(),O=t.useCallback(((e,t)=>{var n,r;p?x(null==(n=W(e)[t.current])?void 0:n.id):null==(r=W(e)[t.current])||r.focus({preventScroll:!0})}),[p]);function R(e){"auto"===m&&(h.current=!e.pointerType)}if(l((()=>{s&&(null!=f&&(b.current=f),r&&h.current&&(a(b.current),O(c,b)))}),[r,f,c,a,O,s]),l((()=>{s&&r&&null!=i&&(b.current=i,a(b.current),O(c,b))}),[r,i,c,a,O,s]),l((()=>{null==f&&s&&(r&&(G(E.current,y)||h.current&&(" "===E.current||"Enter"===E.current))&&(b.current=function(e,t,n){return U(t,e===q,n?e===_:e===V)}(E.current,y,g)?z(c):Y(c),a(b.current),O(c,b)),E.current="")}),[r,c,f,a,O,s,y,g]),l((()=>{var e;s&&(r||null==f||null==(e=u.reference.current)||e.focus({preventScroll:!0}))}),[u.reference,f,r,s]),l((()=>{var e;s&&(r||("auto"===m&&(h.current=!0),b.current=null!=(e=null!=f?f:i)?e:-1,a(null)))}),[r,f,i,s,m]),!s)return{};function C(e){if(v&&function(e,t,n){return U(t,n?e===_:e===V,e===q)}(e.key,y,g))return N(e),o(!1),void(T(u.reference.current)&&u.reference.current.focus());const t=b.current,n=Y(c),r=z(c);if("Home"===e.key&&(b.current=n,a(b.current),O(c,b)),"End"===e.key&&(b.current=r,a(b.current),O(c,b)),G(e.key,y)){if(N(e),!p&&e.currentTarget.ownerDocument.activeElement===e.currentTarget)return b.current=null!=f?f:X(e.key,y,g)?n:r,a(b.current),void O(c,b);X(e.key,y,g)?b.current=d?t===r?n:H(c,{startingIndex:t}):Math.min(r,H(c,{startingIndex:t})):b.current=d?t===n?r:H(c,{startingIndex:t,decrement:!0}):Math.max(n,H(c,{startingIndex:t,decrement:!0})),a(b.current),O(c,b)}}return{reference:{...p&&{"aria-activedescendant":w},onPointerEnter:R,onPointerDown:R,onKeyDown(e){if(p&&r)return C(e);"auto"===m&&(h.current=!0),E.current=e.key,v?function(e,t,n){return U(t,n?e===V:e===_,e===K)}(e.key,y,g)&&(b.current=Y(c),N(e),o(!0),a(b.current)):(G(e.key,y)&&(b.current=null==f?X(e.key,y,g)?Y(c):z(c):f,N(e),o(!0),a(b.current)),p&&!r&&C(e))}},floating:{"aria-orientation":"both"===y?void 0:y,...p&&{"aria-activedescendant":w},onKeyDown:C}}},e.useRole=function(e,t){let{open:n}=e,{enabled:r=!0,role:o="dialog"}=void 0===t?{}:t;const u=g(),c=u+"-reference",i={id:u,role:o};return r?"tooltip"===o?{reference:{"aria-describedby":n?u:void 0},floating:i}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":o,"aria-controls":n?u:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:c}},floating:{...i,..."menu"===o&&{"aria-labelledby":c}}}:{}},e.useTypeahead=function(e,n){var r;let{open:o,dataRef:u}=e,{listRef:c,activeIndex:i,onMatch:a=(()=>{}),enabled:s=!0,findMatch:f=null,resetMs:d=500,ignoreKeys:v=[],selectedIndex:g=null}=void 0===n?{listRef:{current:[]},activeIndex:null}:n;const p=t.useRef(),m=t.useRef(""),y=t.useRef(null!=(r=null!=g?g:i)?r:-1),h=t.useRef(null);function b(e){if(!e.currentTarget.contains(C(e.currentTarget).activeElement))return;m.current.length>0&&(u.current.typing=!0," "===e.key&&N(e));const t=c.current;if(null==t||["Home","End","Escape","Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight",...v].includes(e.key))return;t.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLowerCase())!==(null==(n=e[1])?void 0:n.toLowerCase())}))&&m.current===e.key&&(m.current="",y.current=h.current),m.current+=e.key,clearTimeout(p.current),p.current=setTimeout((()=>{m.current="",y.current=h.current,u.current.typing=!1}),d);const n=y.current,r=[...t.slice((null!=n?n:0)+1),...t.slice(0,(null!=n?n:0)+1)],o=f?f(r,m.current):r.find((e=>0===(null==e?void 0:e.toLowerCase().indexOf(m.current)))),i=o?t.indexOf(o):-1;-1!==i&&(a(i),h.current=i)}return l((()=>{o&&(clearTimeout(p.current),h.current=null,m.current="")}),[o]),l((()=>{var e;o&&""===m.current&&(y.current=null!=(e=null!=g?g:i)?e:-1)}),[o,g,i]),s?{reference:{onKeyDown:b},floating:{onKeyDown:b}}:{}},Object.keys(n).forEach((function(t){"default"===t||e.hasOwnProperty(t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})),Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("@floating-ui/react-dom"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","@floating-ui/react-dom","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIReactDOM={},e.React,e.FloatingUIReactDOM,e.ReactDOM)}(this,(function(e,t,n,r){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var c=u(t),i=o(t),l="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;function a(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter((e=>e!==n)))}}}let s=!1,f=0;const d=()=>"floating-ui-"+f++;const v=c["useId".toString()],g=null!=v?v:function(){const e=s?d():null,[t,n]=c.useState(e);return l((()=>{null===t&&n(d())}),[]),c.useEffect((()=>{s||(s=!0)}),[]),t},p=t.createContext(null),m=t.createContext(null),y=()=>{var e,n;return null!=(e=null==(n=t.useContext(p))?void 0:n.id)?e:null},h=()=>t.useContext(m);function b(e){return Object.entries(null!=e?e:{}).reduce(((e,t)=>{let[n,r]=t;return e[n]=[r],e}),{})}function E(e,t,n){const r={reference:"reference"===n?b(e):{},floating:"floating"===n?b(e):{}};return t.forEach((e=>{var t;const o=null!=(t=null==e?void 0:e[n])?t:{};Object.keys(o).forEach((e=>{var t;"function"==typeof o[e]&&(null==r[n][e]&&(r[n][e]=[]),null==(t=r[n][e])||t.push(o[e]))}))})),{..."floating"===n&&{tabIndex:-1},...e,...t.reduce(((e,t)=>(Object.assign(e,null==t?void 0:t[n]),e)),{}),...Object.entries(r[n]).reduce(((e,t)=>{let[n,r]=t;return 0===n.indexOf("on")&&(e[n]=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r.forEach((e=>e(...t)))}),e}),{})}}var w={exports:{}},x=function(e,t,n,r){var o=e[0],u=e[1],c=!1;void 0===n&&(n=0),void 0===r&&(r=t.length);for(var i=(r-n)/2,l=0,a=i-1;l<i;a=l++){var s=t[n+2*l+0],f=t[n+2*l+1],d=t[n+2*a+0],v=t[n+2*a+1];f>u!=v>u&&o<(d-s)*(u-f)/(v-f)+s&&(c=!c)}return c},O=function(e,t,n,r){var o=e[0],u=e[1],c=!1;void 0===n&&(n=0),void 0===r&&(r=t.length);for(var i=r-n,l=0,a=i-1;l<i;a=l++){var s=t[l+n][0],f=t[l+n][1],d=t[a+n][0],v=t[a+n][1];f>u!=v>u&&o<(d-s)*(u-f)/(v-f)+s&&(c=!c)}return c};w.exports=function(e,t,n,r){return t.length>0&&Array.isArray(t[0])?O(e,t,n,r):x(e,t,n,r)},w.exports.nested=O,w.exports.flat=x;var R=w.exports;function C(e){var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document}function k(e){var t;return null!=(t=C(e).defaultView)?t:window}function I(e){return!!e&&e instanceof k(e).Element}function T(e){return!!e&&e instanceof k(e).HTMLElement}function L(e,t){var n;let r=null!=(n=null==e?void 0:e.nodesRef.current.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})))?n:[],o=r;for(;o.length;){var u;o=null!=(u=null==e?void 0:e.nodesRef.current.filter((e=>{var t;return null==(t=o)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})))?u:[],r=r.concat(o)}return r}const D="floating-ui-root";function A(){return A=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},A.apply(this,arguments)}const P=t.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return l((()=>{if(!n)return;const e=window.pageXOffset,t=window.pageYOffset,r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:"-"+t+"px",left:"-"+e+"px",right:"0",[r]:o+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[r]:""}),window.scrollTo(e,t)}}),[n]),i.default.createElement("div",A({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function j(e,t,n){return n&&"mouse"!==n?0:"number"==typeof e?e:null==e?void 0:e[t]}const M=t.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),F=()=>t.useContext(M);function N(e){e.preventDefault(),e.stopPropagation()}const S=["content"];function B(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const q="ArrowUp",K="ArrowDown",V="ArrowLeft",_="ArrowRight";function H(e,t){let{startingIndex:n=-1,decrement:r=!1}=void 0===t?{}:t;const o=W(e);let u=n;do{var c,i;u+=r?-1:1}while(null!=(c=o[u])&&c.hasAttribute("disabled")||"true"===(null==(i=o[u])?void 0:i.getAttribute("aria-disabled")));return-1===u?0:u}function U(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function G(e,t){return U(t,e===q||e===K,e===V||e===_)}function X(e,t,n){return U(t,e===K,n?e===V:e===_)}function Y(e){return H(e)}function z(e){return H(e,{decrement:!0,startingIndex:W(e).length})}function W(e){return e.current.filter((e=>null!=e))}e.FloatingDelayGroup=e=>{let{children:n,delay:r}=e;const[o,u]=t.useState({delay:r,initialDelay:r,currentId:null}),c=t.useCallback((e=>{u((t=>({...t,currentId:e})))}),[]);return i.default.createElement(M.Provider,{value:{...o,setState:u,setCurrentId:c}},n)},e.FloatingNode=e=>{let{children:t,id:n}=e;const r=y();return i.default.createElement(p.Provider,{value:{id:n,parentId:r}},t)},e.FloatingOverlay=P,e.FloatingPortal=e=>{let{children:n,id:o=D}=e;const[u,c]=t.useState(!1),i=t.useRef(null);return l((()=>{const e=document.getElementById(o);e?i.current=e:(i.current=document.createElement("div"),i.current.id=o);const t=i.current;t.setAttribute("data-floating-ui-portal",""),document.body.contains(t)||document.body.appendChild(t),c(!0)}),[o]),u&&i.current?r.createPortal(n,i.current):null},e.FloatingTree=e=>{let{children:n}=e;const r=t.useRef([]),o=t.useCallback((e=>{r.current=[...r.current,e]}),[]),u=t.useCallback((e=>{r.current=r.current.filter((t=>t!==e))}),[]);return i.default.createElement(m.Provider,{value:{nodesRef:r,addNode:o,removeNode:u,events:a()}},n)},e.safePolygon=function(e){let t,{timeout:n=0,debug:r=null}=void 0===e?{}:e;return e=>{let{x:o,y:u,placement:c,refs:i,onClose:l,nodeId:a,tree:s}=e;return function(e){var f;if("touch"===e.pointerType)return;const{target:d,clientX:v,clientY:g}=e,p=d;if("pointermove"===e.type&&I(i.reference.current)&&i.reference.current.contains(p)||null!=(f=i.floating.current)&&f.contains(p))return;if(s&&L(s,a).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if(!i.reference.current||!i.floating.current||null==c||null==o||null==u)return;const m=i.reference.current.getBoundingClientRect(),y=i.floating.current.getBoundingClientRect(),h=c.split("-")[0],b=o>y.right-y.width/2,E=u>y.bottom-y.height/2;switch(h){case"top":if(v>=y.left&&v<=y.right&&g>=y.bottom&&g<=m.top)return;break;case"bottom":if(v>=y.left&&v<=y.right&&g>=m.bottom&&g<=y.top)return;break;case"left":if(v>=y.right&&v<=m.left&&g>=y.left&&g<=y.right)return;break;case"right":if(v>=y.right&&v<=m.left&&g>=y.right&&g<=m.left)return}function w(e){let[t,n]=e;const r=y.width>m.width,o=y.height>m.height;switch(h){case"top":{const e=[r?t:b?t+1:t-1,n+1],o=[r?t:b?t-1:t+1,n+1],u=[[y.left,b||r?y.bottom-1:y.top],[y.right,b?r?y.bottom-1:y.top:y.bottom-1]];return b?[e,o,...u]:[e,...u,o]}case"bottom":{const e=[r?t:b?t+1:t-1,n-1],o=[r?t:b?t-1:t+1,n-1],u=[[y.left,b||r?y.top+1:y.bottom],[y.right,b?r?y.top+1:y.bottom:y.top+1]];return b?[e,o,...u]:[e,...u,o]}case"left":{const e=[t+1,o?n:E?n-1:n+1],r=[t+1,o?n:E?n+1:n-1],u=[[E||o?y.right-1:y.left,y.top],[E?o?y.right-1:y.left:y.right-1,y.bottom]];return E?[e,...u,r]:[...u,e,r]}case"right":{const e=[t-1,o?n:E?n+1:n-1],r=[t-1,o?n:E?n-1:n+1],u=[[E||o?y.left+1:y.right,y.top],[E?o?y.left+1:y.right:y.left+1,y.bottom]];return E?[e,r,...u]:[e,...u,r]}}}const x=w([o,u]);"production"!==process.env.NODE_ENV&&(null==r||r(w([o,u]).slice(0,4).join(", "))),R([v,g],x)?n&&(t=setTimeout(l,n)):(clearTimeout(t),l())}}},e.useClick=function(e,t){let{open:n,onOpenChange:r,dataRef:o}=e,{enabled:u=!0}=void 0===t?{}:t;return u?{reference:{onClick(e){var t;n?"click"===(null==(t=o.current.openEvent)?void 0:t.type)&&r(!1):r(!0);o.current.openEvent=e.nativeEvent}}}:{}},e.useDelayGroup=(e,n)=>{let{open:r,onOpenChange:o}=e,{id:u}=n;const{currentId:c,initialDelay:i,setState:l}=F();t.useEffect((()=>{c&&o&&(l((e=>({...e,delay:{open:0,close:j(i,"close")}}))),c!==u&&o(!1))}),[u,o,l,c,i]),t.useEffect((()=>{!r&&c===u&&o&&(o(!1),l((e=>({...e,delay:i,currentId:null}))))}),[r,l,c,u,o,i])},e.useDelayGroupContext=F,e.useDismiss=function(e,r){let{open:o,onOpenChange:u,refs:c,events:i,nodeId:l}=e,{enabled:a=!0,escapeKey:s=!0,outsidePointerDown:f=!0,referencePointerDown:d=!1,ancestorScroll:v=!1}=void 0===r?{}:r;const g=h(),p=t.useCallback((()=>{T(c.reference.current)&&c.reference.current.focus()}),[c.reference.current]);return t.useEffect((()=>{if(!o||!a)return;function e(e){"Escape"===e.key&&(i.emit("dismiss"),u(!1),p())}function t(e){var t;const n=g&&L(g,l).some((t=>{var n,r;return null==(n=t.context)||null==(r=n.refs.floating.current)?void 0:r.contains(e.target)}));null!=(t=c.floating.current)&&t.contains(e.target)||I(c.reference.current)&&c.reference.current.contains(e.target)||n||(i.emit("dismiss"),u(!1),p())}function r(){u(!1)}const d=C(c.floating.current);s&&d.addEventListener("keydown",e),f&&d.addEventListener("mousedown",t);const m=(v?[...I(c.reference.current)?n.getOverflowAncestors(c.reference.current):[],...I(c.floating.current)?n.getOverflowAncestors(c.floating.current):[]]:[]).filter((e=>{var t;return e!==(null==(t=d.defaultView)?void 0:t.visualViewport)}));return m.forEach((e=>e.addEventListener("scroll",r,{passive:!0}))),()=>{s&&d.removeEventListener("keydown",e),f&&d.removeEventListener("mousedown",t),m.forEach((e=>e.removeEventListener("scroll",r)))}}),[s,f,i,g,l,o,u,p,v,a,c.floating,c.reference]),a?{reference:{onPointerDown(){d&&(i.emit("dismiss"),u(!1))}}}:{}},e.useFloating=function(e){let{open:r=!1,onOpenChange:o=(()=>{}),placement:u,middleware:c,strategy:i,nodeId:s}=void 0===e?{}:e;const f=h(),d=t.useRef({}),v=t.useState((()=>a()))[0],g=n.useFloating({placement:u,middleware:c,strategy:i}),p=t.useMemo((()=>({...g,dataRef:d,nodeId:s,events:v,open:r,onOpenChange:o})),[g,d,s,v,r,o]);return l((()=>{const e=null==f?void 0:f.nodesRef.current.find((e=>e.id===s));e&&(e.context=p)})),t.useMemo((()=>({context:p,...g})),[g,p])},e.useFloatingNodeId=()=>{const e=g(),t=h(),n=y();return l((()=>{const r={id:e,parentId:n};return null==t||t.addNode(r),()=>{null==t||t.removeNode(r)}}),[t,e,n]),e},e.useFloatingParentNodeId=y,e.useFloatingTree=h,e.useFocus=function(e,n){let{open:r,onOpenChange:o,dataRef:u,refs:c,events:i}=e,{enabled:l=!0,keyboardOnly:a=!0}=void 0===n?{}:n;const s=t.useRef(!1);return t.useEffect((()=>{var e;if(!l)return;const t=null!=(e=C(c.floating.current).defaultView)?e:window;function n(){s.current=!r}function o(){setTimeout((()=>{s.current=!1}))}return t.addEventListener("focus",o),t.addEventListener("blur",n),()=>{t.removeEventListener("focus",o),t.removeEventListener("blur",n)}}),[c.floating,r,l]),t.useEffect((()=>{if(l)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(){s.current=!0}}),[i,l]),l?{reference:{onPointerDown(e){let{pointerType:t}=e;s.current=!(!t||!a)},onFocus(e){var t,n,r;s.current||"focus"===e.type&&"mousedown"===(null==(t=u.current.openEvent)?void 0:t.type)&&I(c.reference.current)&&null!=(n=c.reference.current)&&n.contains(null==(r=u.current.openEvent)?void 0:r.target)||(u.current.openEvent=e.nativeEvent,o(!0))},onBlur(e){var t;const n=e.relatedTarget;null!=(t=c.floating.current)&&t.contains(n)||I(c.reference.current)&&c.reference.current.contains(n)||(s.current=!1,o(!1))}}}:{}},e.useFocusTrap=function(e,n){let{open:r,onOpenChange:o,refs:u}=e,{enabled:c=!0,initialContentFocus:i=0,order:a=S,modal:s=!0,inert:f=!1}=void 0===n?{}:n;const d=t.useRef(null),v=t.useRef(null),g=t.useCallback((()=>a.map((e=>{return T(u.reference.current)&&"reference"===e?u.reference.current:u.floating.current&&"floating"===e?u.floating.current:"content"===e?Array.from(null!=(t=null==(n=u.floating.current)?void 0:n.querySelectorAll("a[href],area[href],input:not([disabled]),select:not([disabled]),textarea:not([disabled]),button:not([disabled]),iframe,object,embed,*[tabindex],*[contenteditable]"))?t:[]):null;var t,n})).filter(Boolean).flat()),[u.floating,u.reference,a]);function p(e){var t;const n=e.relatedTarget;null!=(t=u.floating.current)&&t.contains(n)||!I(u.reference.current)||u.reference.current.contains(n)||o(!1)}return l((()=>{const e=u.floating.current;if(!(c&&r&&e&&s))return;function t(){const t=C(e).createElement("div");return t.tabIndex=0,Object.assign(t.style,{position:"fixed",outline:"0",pointerEvents:"none"}),t.setAttribute("aria-hidden","true"),t}d.current||(d.current=t()),v.current||(v.current=t());const n=d.current,o=v.current;function i(e){var t;N(e);const n=g();null==(t=n[e.target===o?0:n.length-1])||t.focus()}return e.insertAdjacentElement("beforebegin",n),e.insertAdjacentElement("afterend",o),n.addEventListener("focus",i),o.addEventListener("focus",i),()=>{var e,t;n.removeEventListener("focus",i),o.removeEventListener("focus",i),null!=(e=n.parentNode)&&e.contains(n)&&n.parentNode.removeChild(n),null!=(t=o.parentNode)&&t.contains(o)&&o.parentNode.removeChild(o)}}),[c,r,s,f,g,u.floating]),t.useEffect((()=>{if(!c||!r||!f)return;function e(e){"Tab"===e.key&&N(e)}const t=C(u.floating.current);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[c,r,f,u.floating]),t.useEffect((()=>{if(!c)return;const e=g();if(f){if(r){const t=e[0];t!==u.floating.current||t.contains(t.ownerDocument.activeElement)||B(t)}}else r?"number"==typeof i?B(e[i]):i.current&&B(e.find((e=>e===i.current))):s&&T(u.reference.current)&&B(u.reference.current)}),[g,r,f,s,i,c,u.reference,u.floating]),t.useEffect((()=>{if(!r||!s||!c)return;const e=C(u.floating.current).querySelectorAll("body > *:not([data-floating-ui-portal]"),t=[];return e.forEach((e=>{const n=e.getAttribute("aria-hidden");t.push(n),e.setAttribute("aria-hidden","true")})),()=>{e.forEach(((e,n)=>{const r=t[n];null===r?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r)}))}}),[r,s,c,u.floating]),c?s?{floating:{"aria-modal":"true"}}:{reference:{onBlur:p},floating:{onBlur:p}}:{}},e.useHover=function(e,n){let{enabled:r=!0,delay:o=0,handleClose:u=null,mouseOnly:c=!1,restMs:i=0}=void 0===n?{}:n;const{open:a,onOpenChange:s,dataRef:f,events:d,refs:v}=e,g=h(),p=t.useRef(),m=t.useRef(),y=t.useRef(),b=t.useRef(),E=t.useRef(!0);l((()=>{r&&(a||(p.current=void 0))})),t.useEffect((()=>{if(r)return d.on("dismiss",e),()=>{d.off("dismiss",e)};function e(){clearTimeout(m.current),clearTimeout(b.current),E.current=!0}}),[r,d]),t.useEffect((()=>{if(!r||!u)return;function e(){var e;null!=(e=f.current.openEvent)&&e.type.includes("mouse")&&s(!1)}const t=C(v.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[v.floating,s,r,u,f]);const w=t.useCallback((function(e){void 0===e&&(e=!0),o?(clearTimeout(m.current),m.current=setTimeout((()=>s(!1)),j(o,"close",p.current))):e&&s(!1)}),[o,s]);function x(e){p.current=e.pointerType}return t.useEffect((()=>{if(!r)return;function t(e){a||c&&"mouse"!==p.current||(E.current=!1,f.current.openEvent=e,o?(clearTimeout(m.current),m.current=setTimeout((()=>{s(!0)}),j(o,"open",p.current))):s(!0))}function n(t){var n;if("click"===(null==(n=f.current.openEvent)?void 0:n.type))return;const r=C(v.floating.current);if(clearTimeout(b.current),u)return clearTimeout(m.current),y.current&&r.removeEventListener("pointermove",y.current),y.current=u({...e,tree:g,x:t.clientX,y:t.clientY,onClose(){y.current&&r.removeEventListener("pointermove",y.current),w()}}),void r.addEventListener("pointermove",y.current);w()}const i=v.reference.current;return I(i)?(i.addEventListener("mouseenter",t),i.addEventListener("mouseleave",n),()=>{i.removeEventListener("mouseenter",t),i.removeEventListener("mouseleave",n)}):void 0}),[r,w,e,o,u,f,c,s,a,g,v.reference,v.floating]),r?{reference:{onPointerDown:x,onPointerEnter:x,onMouseMove(){a||0===i||(clearTimeout(b.current),b.current=setTimeout((()=>{E.current||s(!0)}),i))}},floating:{onMouseEnter(){clearTimeout(m.current)},onMouseLeave:()=>w(!1)}}:{}},e.useId=g,e.useInteractions=function(e){return void 0===e&&(e=[]),{getReferenceProps:t=>E(t,e,"reference"),getFloatingProps:t=>E(t,e,"floating")}},e.useListNavigation=function(e,n){let{open:r,onOpenChange:o,refs:u}=e,{listRef:c,activeIndex:i,onNavigate:a,enabled:s=!0,selectedIndex:f=null,loop:d=!1,nested:v=!1,rtl:g=!1,virtual:p=!1,focusItemOnOpen:m="auto",orientation:y="vertical"}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:n;const h=t.useRef(m),b=t.useRef(null!=f?f:-1),E=t.useRef(""),[w,x]=t.useState(),O=t.useCallback(((e,t)=>{var n,r;p?x(null==(n=W(e)[t.current])?void 0:n.id):null==(r=W(e)[t.current])||r.focus({preventScroll:!0})}),[p]);function R(e){"auto"===m&&(h.current=!e.pointerType)}if(l((()=>{s&&(null!=f&&(b.current=f),r&&h.current&&(a(b.current),O(c,b)))}),[r,f,c,a,O,s]),l((()=>{s&&r&&null!=i&&(b.current=i,a(b.current),O(c,b))}),[r,i,c,a,O,s]),l((()=>{null==f&&s&&(r&&(G(E.current,y)||h.current&&(" "===E.current||"Enter"===E.current))&&(b.current=function(e,t,n){return U(t,e===q,n?e===_:e===V)}(E.current,y,g)?z(c):Y(c),a(b.current),O(c,b)),E.current="")}),[r,c,f,a,O,s,y,g]),l((()=>{var e;s&&(r||null==f||null==(e=u.reference.current)||e.focus({preventScroll:!0}))}),[u.reference,f,r,s]),l((()=>{var e;s&&(r||("auto"===m&&(h.current=!0),b.current=null!=(e=null!=f?f:i)?e:-1,a(null)))}),[r,f,i,s,m]),!s)return{};function C(e){if(v&&function(e,t,n){return U(t,n?e===_:e===V,e===q)}(e.key,y,g))return N(e),o(!1),void(T(u.reference.current)&&u.reference.current.focus());const t=b.current,n=Y(c),r=z(c);if("Home"===e.key&&(b.current=n,a(b.current),O(c,b)),"End"===e.key&&(b.current=r,a(b.current),O(c,b)),G(e.key,y)){if(N(e),!p&&e.currentTarget.ownerDocument.activeElement===e.currentTarget)return b.current=null!=f?f:X(e.key,y,g)?n:r,a(b.current),void O(c,b);X(e.key,y,g)?b.current=d?t===r?n:H(c,{startingIndex:t}):Math.min(r,H(c,{startingIndex:t})):b.current=d?t===n?r:H(c,{startingIndex:t,decrement:!0}):Math.max(n,H(c,{startingIndex:t,decrement:!0})),a(b.current),O(c,b)}}return{reference:{...p&&{"aria-activedescendant":w},onPointerEnter:R,onPointerDown:R,onKeyDown(e){if(p&&r)return C(e);"auto"===m&&(h.current=!0),E.current=e.key,v?function(e,t,n){return U(t,n?e===V:e===_,e===K)}(e.key,y,g)&&(b.current=Y(c),N(e),o(!0),a(b.current)):(G(e.key,y)&&(b.current=null==f?X(e.key,y,g)?Y(c):z(c):f,N(e),o(!0),a(b.current)),p&&!r&&C(e))}},floating:{"aria-orientation":"both"===y?void 0:y,...p&&{"aria-activedescendant":w},onKeyDown:C}}},e.useRole=function(e,t){let{open:n}=e,{enabled:r=!0,role:o="dialog"}=void 0===t?{}:t;const u=g(),c=u+"-reference",i={id:u,role:o};return r?"tooltip"===o?{reference:{"aria-describedby":n?u:void 0},floating:i}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":o,"aria-controls":n?u:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:c}},floating:{...i,..."menu"===o&&{"aria-labelledby":c}}}:{}},e.useTypeahead=function(e,n){var r;let{open:o,dataRef:u}=e,{listRef:c,activeIndex:i,onMatch:a=(()=>{}),enabled:s=!0,findMatch:f=null,resetMs:d=500,ignoreKeys:v=[],selectedIndex:g=null}=void 0===n?{listRef:{current:[]},activeIndex:null}:n;const p=t.useRef(),m=t.useRef(""),y=t.useRef(null!=(r=null!=g?g:i)?r:-1),h=t.useRef(null);function b(e){if(!e.currentTarget.contains(C(e.currentTarget).activeElement))return;m.current.length>0&&(u.current.typing=!0," "===e.key&&N(e));const t=c.current;if(null==t||["Home","End","Escape","Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight",...v].includes(e.key))return;t.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLowerCase())!==(null==(n=e[1])?void 0:n.toLowerCase())}))&&m.current===e.key&&(m.current="",y.current=h.current),m.current+=e.key,clearTimeout(p.current),p.current=setTimeout((()=>{m.current="",y.current=h.current,u.current.typing=!1}),d);const n=y.current,r=[...t.slice((null!=n?n:0)+1),...t.slice(0,(null!=n?n:0)+1)],o=f?f(r,m.current):r.find((e=>0===(null==e?void 0:e.toLowerCase().indexOf(m.current)))),i=o?t.indexOf(o):-1;-1!==i&&(a(i),h.current=i)}return l((()=>{o&&(clearTimeout(p.current),h.current=null,m.current="")}),[o]),l((()=>{var e;o&&""===m.current&&(y.current=null!=(e=null!=g?g:i)?e:-1)}),[o,g,i]),s?{reference:{onKeyDown:b},floating:{onKeyDown:b}}:{}},Object.keys(n).forEach((function(t){"default"===t||e.hasOwnProperty(t)||Object.defineProperty(e,t,{enumerable:!0,get:function(){return n[t]}})})),Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "@floating-ui/react-dom-interactions",
"version": "0.0.11",
"version": "0.0.12",
"@rollingversions": {

@@ -5,0 +5,0 @@ "baseVersion": [

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc