Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@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.8 to 0.0.9

5

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

@@ -50,5 +50,6 @@ import * as React from 'react';

return id;
}
} // `toString()` prevents bundlers from trying to `import { useId } from 'react'`
const useReactId = React.useId;
const useReactId = React[/*#__PURE__*/'useId'.toString()];
/**

@@ -55,0 +56,0 @@ * Uses React 18's built-in `useId()` when available, or falls back to a

2

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

@@ -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 d,useFloating as s}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,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),I=()=>{var e,n;return null!=(e=null==(n=o(x))?void 0:n.id)?e:null},A=()=>o(L),T=()=>{const e=E(),n=A(),t=I();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=I();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 R(e){return Object.entries(null!=e?e:{}).reduce(((e,n)=>{let[t,r]=n;return e[t]=[r],e}),{})}function C(e,n,t){const r={reference:"reference"===t?R(e):{},floating:"floating"===t?R(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=>C(n,e,"reference"),getFloatingProps:n=>C(n,e,"floating")}};function P(e){var n;return null!=(n=null==e?void 0:e.ownerDocument)?n:document}function M(e){var n;return null!=(n=P(e).defaultView)?n:window}function S(e){return!!e&&e instanceof M(e).Element}function j(e){return!!e&&e instanceof M(e).HTMLElement}function B(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 N(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 d;if("touch"===e.pointerType)return;const{target:s,clientX:m,clientY:g}=e,p=s;if("pointermove"===e.type&&S(i.reference.current)&&i.reference.current.contains(p)||null!=(d=i.floating.current)&&d.contains(p))return;if(f&&B(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=i(K),V=e=>{let{children:t,id:r=K}=e;const[o,c]=l(!1),i=u(null);return g((()=>{const e=document.getElementById(r);e?i.current=e:(i.current=document.createElement("div"),i.current.id=r);const n=i.current;document.body.contains(n)||document.body.appendChild(n),c(!0)}),[r]),o&&i.current?n.createElement(F.Provider,{value:r},m(t,i.current)):null};function q(){return q=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},q.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",q({ref:t},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function H(e,n,t){return t&&"mouse"!==t?0:"number"==typeof e?e:null==e?void 0:e[n]}const X=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:d,dataRef:s,events:v,refs:m}=e,p=A(),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=s.current.openEvent)&&e.type.includes("mouse")&&d(!1)}const n=P(m.floating.current).documentElement;return n.addEventListener("mouseleave",e),()=>{n.removeEventListener("mouseleave",e)}}),[m.floating,d,t,i,s]);const x=c((function(e){void 0===e&&(e=!0),o?(clearTimeout(y.current),y.current=setTimeout((()=>d(!1)),H(o,"close",h.current))):e&&d(!1)}),[o,d]);function L(e){h.current=e.pointerType}return r((()=>{if(!t)return;function n(e){f||l&&"mouse"!==h.current||(E.current=!1,s.current.openEvent=e,o?(clearTimeout(y.current),y.current=setTimeout((()=>{d(!0)}),H(o,"open",h.current))):d(!0))}function r(n){var t;if("click"===(null==(t=s.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 S(u)?(u.addEventListener("mouseenter",n),u.addEventListener("mouseleave",r),()=>{u.removeEventListener("mouseenter",n),u.removeEventListener("mouseleave",r)}):void 0}),[t,x,e,o,i,s,l,d,f,p,m.reference,m.floating]),t?{reference:{onPointerDown:L,onPointerEnter:L,onMouseMove(){f||0===a||(clearTimeout(b.current),b.current=setTimeout((()=>{E.current||d(!0)}),a))}},floating:{onMouseEnter(){clearTimeout(y.current)},onMouseLeave:()=>x(!1)}}:{}},Y=i({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),W=()=>o(Y),z=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(Y.Provider,{value:{...o,setState:u,setCurrentId:i}},t)},_=(e,n)=>{let{open:t,onOpenChange:o}=e,{id:u}=n;const{currentId:c,initialDelay:i,setState:l}=W();r((()=>{c&&o&&(l((e=>({...e,delay:{open:0,close:H(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])},G=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}}}:{}},J=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}}}:{}},Q=function(e,n){let{open:t,onOpenChange:o,refs:u,events:i,nodeId:l}=e,{enabled:a=!0,escapeKey:f=!0,outsidePointerDown:s=!0,referencePointerDown:v=!1,ancestorScroll:m=!1}=void 0===n?{}:n;const g=A(),p=c((()=>{j(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&&B(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)||S(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),s&&c.addEventListener("mousedown",n);const v=(m?[...S(u.reference.current)?d(u.reference.current):[],...S(u.floating.current)?d(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),s&&c.removeEventListener("mousedown",n),v.forEach((e=>e.removeEventListener("scroll",r)))}}),[f,s,i,g,l,t,o,p,m,a,u.floating,u.reference]),a?{reference:{onPointerDown(){v&&(i.emit("dismiss"),o(!1))}}}:{}},Z=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 d=u(!1);return r((()=>{var e;if(!a)return;const n=null!=(e=P(i.floating.current).defaultView)?e:window;function r(){d.current=!t}function o(){setTimeout((()=>{d.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(){d.current=!0}}),[l,a]),a?{reference:{onPointerDown(e){let{pointerType:n}=e;d.current=!(!n||!f)},onFocus(e){var n,t,r;d.current||"focus"===e.type&&"mousedown"===(null==(n=c.current.openEvent)?void 0:n.type)&&S(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)||S(i.reference.current)&&i.reference.current.contains(t)||(d.current=!1,o(!1))}}}:{}};function $(e){e.preventDefault(),e.stopPropagation()}function ee(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const ne=function(e,n){let{open:t,onOpenChange:i,refs:l,nodeId:a}=e,{enabled:f=!0,initialContentFocus:d=0,order:s=["content"],modal:v=!0,inert:m=!1}=void 0===n?{}:n;const g=o(F),p=A(),h=u(0),y=c((()=>s.map((e=>{return j(l.reference.current)&&"reference"===e?l.reference.current:l.floating.current&&"floating"===e?l.floating.current:"content"===e?Array.from(null!=(n=null==(t=l.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()),[l.floating,l.reference,s]);function w(e){var n;const t=e.relatedTarget;null!=(n=l.floating.current)&&n.contains(t)||!S(l.reference.current)||l.reference.current.contains(t)||i(!1)}return r((()=>{if(!f)return;const e=y();if(m){if(t){const n=e[0];n!==l.floating.current||n.contains(n.ownerDocument.activeElement)||ee(n)}}else t?"number"==typeof d?ee(e[d]):d.current&&ee(e.find((e=>e===d.current))):v&&j(l.reference.current)&&ee(l.reference.current)}),[y,t,m,v,d,f,l.reference,l.floating]),r((()=>{if(!v||!f)return;const e=P(l.floating.current);if(!t)return e.removeEventListener("keydown",n),void(h.current=0);function n(e){var n;if((null==p||null==(n=p.nodesRef.current)||!n.filter((e=>{let{parentId:n}=e;return n===a})).some((e=>{let{context:n}=e;return null==n?void 0:n.open})))&&"Tab"===e.key){$(e);const n=y();if(m)return;e.shiftKey?h.current=0===h.current?n.length-1:h.current-1:h.current=h.current===n.length-1?0:h.current+1,ee(n[h.current])}}return e.addEventListener("keydown",n),()=>{e.removeEventListener("keydown",n)}}),[y,null==p?void 0:p.nodesRef,a,t,v,m,f,l.floating]),r((()=>{if(!t||!v||!f)return;const e=P(l.floating.current),n=e.querySelector("#"+g),r=e.querySelectorAll("body > *:not(#"+g+")"),o=[];return r.forEach((e=>{const n=e.getAttribute("aria-hidden");o.push(n),e.setAttribute("aria-hidden","hidden")})),()=>{(null==n?void 0:n.firstElementChild)===l.floating.current&&r.forEach(((e,n)=>{const t=o[n];null===t?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t)}))}}),[t,v,g,f,l.floating]),f?v?{floating:{"aria-modal":"true"}}:{reference:{onBlur:w},floating:{onBlur:w}}:{}};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:d=!0,selectedIndex:s=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!=s?s:-1),x=u(""),[L,I]=l(),A=c(((e,n)=>{var t,r;h?I(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((()=>{d&&(null!=s&&(E.current=s),t&&b.current&&(f(E.current),A(i,E)))}),[t,s,i,f,A,d]),g((()=>{d&&t&&null!=a&&(E.current=a,f(E.current),A(i,E))}),[t,a,i,f,A,d]),g((()=>{null==s&&d&&(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),A(i,E)),x.current="")}),[t,i,s,f,A,d,w,p]),g((()=>{var e;d&&(t||null==s||null==(e=o.reference.current)||e.focus({preventScroll:!0}))}),[o.reference,s,t,d]),g((()=>{var e;d&&(t||("auto"===y&&(b.current=!0),E.current=null!=(e=null!=s?s:a)?e:-1,f(null)))}),[t,s,a,d,y]),!d)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 $(e),r(!1),void(j(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),A(i,E)),"End"===e.key&&(E.current=u,f(E.current),A(i,E)),oe(e.key,w)){if($(e),!h&&e.currentTarget.ownerDocument.activeElement===e.currentTarget)return E.current=null!=s?s:ue(e.key,w,p)?t:u,f(E.current),void A(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),A(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),$(e),r(!0),f(E.current)):(oe(e.key,w)&&(E.current=null==s?ue(e.key,w,p)?ce(i):ie(i):s,$(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:d=500,ignoreKeys:s=[],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&&$(e));const n=c.current;if(null==n||["Home","End","Escape","Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight",...s].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}),d);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 de(e){let{open:n=!1,onOpenChange:t=(()=>{}),placement:r,middleware:o,strategy:c,nodeId:i}=void 0===e?{}:e;const a=A(),d=u({}),v=l((()=>p()))[0],m=s({placement:r,middleware:o,strategy:c}),h=f((()=>({...m,dataRef:d,nodeId:i,events:v,open:n,onOpenChange:t})),[m,d,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{z as FloatingDelayGroup,k as FloatingNode,U as FloatingOverlay,V as FloatingPortal,O as FloatingTree,N as safePolygon,J as useClick,_ as useDelayGroup,W as useDelayGroupContext,Q as useDismiss,de as useFloating,T as useFloatingNodeId,I as useFloatingParentNodeId,A as useFloatingTree,Z as useFocus,ne as useFocusTrap,X as useHover,E as useId,D as useInteractions,ae as useListNavigation,G 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 d,useFloating as s}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),I=()=>{var e,n;return null!=(e=null==(n=o(x))?void 0:n.id)?e:null},A=()=>o(L),T=()=>{const e=E(),n=A(),t=I();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=I();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 R(e){return Object.entries(null!=e?e:{}).reduce(((e,n)=>{let[t,r]=n;return e[t]=[r],e}),{})}function C(e,n,t){const r={reference:"reference"===t?R(e):{},floating:"floating"===t?R(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=>C(n,e,"reference"),getFloatingProps:n=>C(n,e,"floating")}};function P(e){var n;return null!=(n=null==e?void 0:e.ownerDocument)?n:document}function M(e){var n;return null!=(n=P(e).defaultView)?n:window}function S(e){return!!e&&e instanceof M(e).Element}function j(e){return!!e&&e instanceof M(e).HTMLElement}function B(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 N(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 d;if("touch"===e.pointerType)return;const{target:s,clientX:m,clientY:g}=e,p=s;if("pointermove"===e.type&&S(i.reference.current)&&i.reference.current.contains(p)||null!=(d=i.floating.current)&&d.contains(p))return;if(f&&B(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=i(K),V=e=>{let{children:t,id:r=K}=e;const[o,c]=l(!1),i=u(null);return g((()=>{const e=document.getElementById(r);e?i.current=e:(i.current=document.createElement("div"),i.current.id=r);const n=i.current;document.body.contains(n)||document.body.appendChild(n),c(!0)}),[r]),o&&i.current?n.createElement(F.Provider,{value:r},m(t,i.current)):null};function q(){return q=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},q.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",q({ref:t},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function H(e,n,t){return t&&"mouse"!==t?0:"number"==typeof e?e:null==e?void 0:e[n]}const X=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:d,dataRef:s,events:v,refs:m}=e,p=A(),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=s.current.openEvent)&&e.type.includes("mouse")&&d(!1)}const n=P(m.floating.current).documentElement;return n.addEventListener("mouseleave",e),()=>{n.removeEventListener("mouseleave",e)}}),[m.floating,d,t,i,s]);const x=c((function(e){void 0===e&&(e=!0),o?(clearTimeout(y.current),y.current=setTimeout((()=>d(!1)),H(o,"close",h.current))):e&&d(!1)}),[o,d]);function L(e){h.current=e.pointerType}return r((()=>{if(!t)return;function n(e){f||l&&"mouse"!==h.current||(E.current=!1,s.current.openEvent=e,o?(clearTimeout(y.current),y.current=setTimeout((()=>{d(!0)}),H(o,"open",h.current))):d(!0))}function r(n){var t;if("click"===(null==(t=s.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 S(u)?(u.addEventListener("mouseenter",n),u.addEventListener("mouseleave",r),()=>{u.removeEventListener("mouseenter",n),u.removeEventListener("mouseleave",r)}):void 0}),[t,x,e,o,i,s,l,d,f,p,m.reference,m.floating]),t?{reference:{onPointerDown:L,onPointerEnter:L,onMouseMove(){f||0===a||(clearTimeout(b.current),b.current=setTimeout((()=>{E.current||d(!0)}),a))}},floating:{onMouseEnter(){clearTimeout(y.current)},onMouseLeave:()=>x(!1)}}:{}},Y=i({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),W=()=>o(Y),z=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(Y.Provider,{value:{...o,setState:u,setCurrentId:i}},t)},_=(e,n)=>{let{open:t,onOpenChange:o}=e,{id:u}=n;const{currentId:c,initialDelay:i,setState:l}=W();r((()=>{c&&o&&(l((e=>({...e,delay:{open:0,close:H(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])},G=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}}}:{}},J=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}}}:{}},Q=function(e,n){let{open:t,onOpenChange:o,refs:u,events:i,nodeId:l}=e,{enabled:a=!0,escapeKey:f=!0,outsidePointerDown:s=!0,referencePointerDown:v=!1,ancestorScroll:m=!1}=void 0===n?{}:n;const g=A(),p=c((()=>{j(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&&B(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)||S(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),s&&c.addEventListener("mousedown",n);const v=(m?[...S(u.reference.current)?d(u.reference.current):[],...S(u.floating.current)?d(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),s&&c.removeEventListener("mousedown",n),v.forEach((e=>e.removeEventListener("scroll",r)))}}),[f,s,i,g,l,t,o,p,m,a,u.floating,u.reference]),a?{reference:{onPointerDown(){v&&(i.emit("dismiss"),o(!1))}}}:{}},Z=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 d=u(!1);return r((()=>{var e;if(!a)return;const n=null!=(e=P(i.floating.current).defaultView)?e:window;function r(){d.current=!t}function o(){setTimeout((()=>{d.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(){d.current=!0}}),[l,a]),a?{reference:{onPointerDown(e){let{pointerType:n}=e;d.current=!(!n||!f)},onFocus(e){var n,t,r;d.current||"focus"===e.type&&"mousedown"===(null==(n=c.current.openEvent)?void 0:n.type)&&S(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)||S(i.reference.current)&&i.reference.current.contains(t)||(d.current=!1,o(!1))}}}:{}};function $(e){e.preventDefault(),e.stopPropagation()}function ee(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const ne=function(e,n){let{open:t,onOpenChange:i,refs:l,nodeId:a}=e,{enabled:f=!0,initialContentFocus:d=0,order:s=["content"],modal:v=!0,inert:m=!1}=void 0===n?{}:n;const g=o(F),p=A(),h=u(0),y=c((()=>s.map((e=>{return j(l.reference.current)&&"reference"===e?l.reference.current:l.floating.current&&"floating"===e?l.floating.current:"content"===e?Array.from(null!=(n=null==(t=l.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()),[l.floating,l.reference,s]);function w(e){var n;const t=e.relatedTarget;null!=(n=l.floating.current)&&n.contains(t)||!S(l.reference.current)||l.reference.current.contains(t)||i(!1)}return r((()=>{if(!f)return;const e=y();if(m){if(t){const n=e[0];n!==l.floating.current||n.contains(n.ownerDocument.activeElement)||ee(n)}}else t?"number"==typeof d?ee(e[d]):d.current&&ee(e.find((e=>e===d.current))):v&&j(l.reference.current)&&ee(l.reference.current)}),[y,t,m,v,d,f,l.reference,l.floating]),r((()=>{if(!v||!f)return;const e=P(l.floating.current);if(!t)return e.removeEventListener("keydown",n),void(h.current=0);function n(e){var n;if((null==p||null==(n=p.nodesRef.current)||!n.filter((e=>{let{parentId:n}=e;return n===a})).some((e=>{let{context:n}=e;return null==n?void 0:n.open})))&&"Tab"===e.key){$(e);const n=y();if(m)return;e.shiftKey?h.current=0===h.current?n.length-1:h.current-1:h.current=h.current===n.length-1?0:h.current+1,ee(n[h.current])}}return e.addEventListener("keydown",n),()=>{e.removeEventListener("keydown",n)}}),[y,null==p?void 0:p.nodesRef,a,t,v,m,f,l.floating]),r((()=>{if(!t||!v||!f)return;const e=P(l.floating.current),n=e.querySelector("#"+g),r=e.querySelectorAll("body > *:not(#"+g+")"),o=[];return r.forEach((e=>{const n=e.getAttribute("aria-hidden");o.push(n),e.setAttribute("aria-hidden","hidden")})),()=>{(null==n?void 0:n.firstElementChild)===l.floating.current&&r.forEach(((e,n)=>{const t=o[n];null===t?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t)}))}}),[t,v,g,f,l.floating]),f?v?{floating:{"aria-modal":"true"}}:{reference:{onBlur:w},floating:{onBlur:w}}:{}};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:d=!0,selectedIndex:s=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!=s?s:-1),x=u(""),[L,I]=l(),A=c(((e,n)=>{var t,r;h?I(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((()=>{d&&(null!=s&&(E.current=s),t&&b.current&&(f(E.current),A(i,E)))}),[t,s,i,f,A,d]),g((()=>{d&&t&&null!=a&&(E.current=a,f(E.current),A(i,E))}),[t,a,i,f,A,d]),g((()=>{null==s&&d&&(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),A(i,E)),x.current="")}),[t,i,s,f,A,d,w,p]),g((()=>{var e;d&&(t||null==s||null==(e=o.reference.current)||e.focus({preventScroll:!0}))}),[o.reference,s,t,d]),g((()=>{var e;d&&(t||("auto"===y&&(b.current=!0),E.current=null!=(e=null!=s?s:a)?e:-1,f(null)))}),[t,s,a,d,y]),!d)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 $(e),r(!1),void(j(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),A(i,E)),"End"===e.key&&(E.current=u,f(E.current),A(i,E)),oe(e.key,w)){if($(e),!h&&e.currentTarget.ownerDocument.activeElement===e.currentTarget)return E.current=null!=s?s:ue(e.key,w,p)?t:u,f(E.current),void A(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),A(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),$(e),r(!0),f(E.current)):(oe(e.key,w)&&(E.current=null==s?ue(e.key,w,p)?ce(i):ie(i):s,$(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:d=500,ignoreKeys:s=[],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&&$(e));const n=c.current;if(null==n||["Home","End","Escape","Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight",...s].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}),d);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 de(e){let{open:n=!1,onOpenChange:t=(()=>{}),placement:r,middleware:o,strategy:c,nodeId:i}=void 0===e?{}:e;const a=A(),d=u({}),v=l((()=>p()))[0],m=s({placement:r,middleware:o,strategy:c}),h=f((()=>({...m,dataRef:d,nodeId:i,events:v,open:n,onOpenChange:t})),[m,d,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{z as FloatingDelayGroup,k as FloatingNode,U as FloatingOverlay,V as FloatingPortal,O as FloatingTree,N as safePolygon,J as useClick,_ as useDelayGroup,W as useDelayGroupContext,Q as useDismiss,de as useFloating,T as useFloatingNodeId,I as useFloatingParentNodeId,A as useFloatingTree,Z as useFocus,ne as useFocusTrap,X as useHover,E as useId,D as useInteractions,ae as useListNavigation,G as useRole,fe as useTypeahead};

@@ -72,5 +72,6 @@ (function (global, factory) {

return id;
}
} // `toString()` prevents bundlers from trying to `import { useId } from 'react'`
const useReactId = React__namespace.useId;
const useReactId = React__namespace[/*#__PURE__*/'useId'.toString()];
/**

@@ -77,0 +78,0 @@ * Uses React 18's built-in `useId()` when available, or falls back to a

@@ -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 f=!1,s=0;const d=()=>"floating-ui-"+s++;const v=c.useId,g=null!=v?v:function(){const e=f?d():null,[t,n]=c.useState(e);return l((()=>{null===t&&n(d())}),[]),c.useEffect((()=>{f||(f=!0)}),[]),t},m=t.createContext(null),p=t.createContext(null),y=()=>{var e,n;return null!=(e=null==(n=t.useContext(m))?void 0:n.id)?e:null},h=()=>t.useContext(p);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 f=t[n+2*l+0],s=t[n+2*l+1],d=t[n+2*a+0],v=t[n+2*a+1];s>u!=v>u&&o<(d-f)*(u-s)/(v-s)+f&&(c=!c)}return c},R=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 f=t[l+n][0],s=t[l+n][1],d=t[a+n][0],v=t[a+n][1];s>u!=v>u&&o<(d-f)*(u-s)/(v-s)+f&&(c=!c)}return c};w.exports=function(e,t,n,r){return t.length>0&&Array.isArray(t[0])?R(e,t,n,r):x(e,t,n,r)},w.exports.nested=R,w.exports.flat=x;var O=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",P=t.createContext(D);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 j=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 M(e,t,n){return n&&"mouse"!==n?0:"number"==typeof e?e:null==e?void 0:e[t]}const F=t.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),S=()=>t.useContext(F);function N(e){e.preventDefault(),e.stopPropagation()}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(F.Provider,{value:{...o,setState:u,setCurrentId:c}},n)},e.FloatingNode=e=>{let{children:t,id:n}=e;const r=y();return i.default.createElement(m.Provider,{value:{id:n,parentId:r}},t)},e.FloatingOverlay=j,e.FloatingPortal=e=>{let{children:n,id:o=D}=e;const[u,c]=t.useState(!1),a=t.useRef(null);return l((()=>{const e=document.getElementById(o);e?a.current=e:(a.current=document.createElement("div"),a.current.id=o);const t=a.current;document.body.contains(t)||document.body.appendChild(t),c(!0)}),[o]),u&&a.current?i.default.createElement(P.Provider,{value:o},r.createPortal(n,a.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(p.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:f}=e;return function(e){var s;if("touch"===e.pointerType)return;const{target:d,clientX:v,clientY:g}=e,m=d;if("pointermove"===e.type&&I(i.reference.current)&&i.reference.current.contains(m)||null!=(s=i.floating.current)&&s.contains(m))return;if(f&&L(f,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 p=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<=p.top)return;break;case"bottom":if(v>=y.left&&v<=y.right&&g>=p.bottom&&g<=y.top)return;break;case"left":if(v>=y.right&&v<=p.left&&g>=y.left&&g<=y.right)return;break;case"right":if(v>=y.right&&v<=p.left&&g>=y.right&&g<=p.left)return}function w(e){let[t,n]=e;const r=y.width>p.width,o=y.height>p.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(", "))),O([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}=S();t.useEffect((()=>{c&&o&&(l((e=>({...e,delay:{open:0,close:M(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=S,e.useDismiss=function(e,r){let{open:o,onOpenChange:u,refs:c,events:i,nodeId:l}=e,{enabled:a=!0,escapeKey:f=!0,outsidePointerDown:s=!0,referencePointerDown:d=!1,ancestorScroll:v=!1}=void 0===r?{}:r;const g=h(),m=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),m())}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),m())}function r(){u(!1)}const d=C(c.floating.current);f&&d.addEventListener("keydown",e),s&&d.addEventListener("mousedown",t);const p=(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 p.forEach((e=>e.addEventListener("scroll",r,{passive:!0}))),()=>{f&&d.removeEventListener("keydown",e),s&&d.removeEventListener("mousedown",t),p.forEach((e=>e.removeEventListener("scroll",r)))}}),[f,s,i,g,l,o,u,m,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:f}=void 0===e?{}:e;const s=h(),d=t.useRef({}),v=t.useState((()=>a()))[0],g=n.useFloating({placement:u,middleware:c,strategy:i}),m=t.useMemo((()=>({...g,dataRef:d,nodeId:f,events:v,open:r,onOpenChange:o})),[g,d,f,v,r,o]);return l((()=>{const e=null==s?void 0:s.nodesRef.current.find((e=>e.id===f));e&&(e.context=m)})),t.useMemo((()=>({context:m,...g})),[g,m])},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 f=t.useRef(!1);return t.useEffect((()=>{var e;if(!l)return;const t=null!=(e=C(c.floating.current).defaultView)?e:window;function n(){f.current=!r}function o(){setTimeout((()=>{f.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(){f.current=!0}}),[i,l]),l?{reference:{onPointerDown(e){let{pointerType:t}=e;f.current=!(!t||!a)},onFocus(e){var t,n,r;f.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)||(f.current=!1,o(!1))}}}:{}},e.useFocusTrap=function(e,n){let{open:r,onOpenChange:o,refs:u,nodeId:c}=e,{enabled:i=!0,initialContentFocus:l=0,order:a=["content"],modal:f=!0,inert:s=!1}=void 0===n?{}:n;const d=t.useContext(P),v=h(),g=t.useRef(0),m=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 t.useEffect((()=>{if(!i)return;const e=m();if(s){if(r){const t=e[0];t!==u.floating.current||t.contains(t.ownerDocument.activeElement)||B(t)}}else r?"number"==typeof l?B(e[l]):l.current&&B(e.find((e=>e===l.current))):f&&T(u.reference.current)&&B(u.reference.current)}),[m,r,s,f,l,i,u.reference,u.floating]),t.useEffect((()=>{if(!f||!i)return;const e=C(u.floating.current);if(!r)return e.removeEventListener("keydown",t),void(g.current=0);function t(e){var t;if((null==v||null==(t=v.nodesRef.current)||!t.filter((e=>{let{parentId:t}=e;return t===c})).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))&&"Tab"===e.key){N(e);const t=m();if(s)return;e.shiftKey?g.current=0===g.current?t.length-1:g.current-1:g.current=g.current===t.length-1?0:g.current+1,B(t[g.current])}}return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}),[m,null==v?void 0:v.nodesRef,c,r,f,s,i,u.floating]),t.useEffect((()=>{if(!r||!f||!i)return;const e=C(u.floating.current),t=e.querySelector("#"+d),n=e.querySelectorAll("body > *:not(#"+d+")"),o=[];return n.forEach((e=>{const t=e.getAttribute("aria-hidden");o.push(t),e.setAttribute("aria-hidden","hidden")})),()=>{(null==t?void 0:t.firstElementChild)===u.floating.current&&n.forEach(((e,t)=>{const n=o[t];null===n?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n)}))}}),[r,f,d,i,u.floating]),i?f?{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:f,dataRef:s,events:d,refs:v}=e,g=h(),m=t.useRef(),p=t.useRef(),y=t.useRef(),b=t.useRef(),E=t.useRef(!0);l((()=>{r&&(a||(m.current=void 0))})),t.useEffect((()=>{if(r)return d.on("dismiss",e),()=>{d.off("dismiss",e)};function e(){clearTimeout(p.current),clearTimeout(b.current),E.current=!0}}),[r,d]),t.useEffect((()=>{if(!r||!u)return;function e(){var e;null!=(e=s.current.openEvent)&&e.type.includes("mouse")&&f(!1)}const t=C(v.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[v.floating,f,r,u,s]);const w=t.useCallback((function(e){void 0===e&&(e=!0),o?(clearTimeout(p.current),p.current=setTimeout((()=>f(!1)),M(o,"close",m.current))):e&&f(!1)}),[o,f]);function x(e){m.current=e.pointerType}return t.useEffect((()=>{if(!r)return;function t(e){a||c&&"mouse"!==m.current||(E.current=!1,s.current.openEvent=e,o?(clearTimeout(p.current),p.current=setTimeout((()=>{f(!0)}),M(o,"open",m.current))):f(!0))}function n(t){var n;if("click"===(null==(n=s.current.openEvent)?void 0:n.type))return;const r=C(v.floating.current);if(clearTimeout(b.current),u)return clearTimeout(p.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,s,c,f,a,g,v.reference,v.floating]),r?{reference:{onPointerDown:x,onPointerEnter:x,onMouseMove(){a||0===i||(clearTimeout(b.current),b.current=setTimeout((()=>{E.current||f(!0)}),i))}},floating:{onMouseEnter(){clearTimeout(p.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:f=!0,selectedIndex:s=null,loop:d=!1,nested:v=!1,rtl:g=!1,virtual:m=!1,focusItemOnOpen:p="auto",orientation:y="vertical"}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:n;const h=t.useRef(p),b=t.useRef(null!=s?s:-1),E=t.useRef(""),[w,x]=t.useState(),R=t.useCallback(((e,t)=>{var n,r;m?x(null==(n=W(e)[t.current])?void 0:n.id):null==(r=W(e)[t.current])||r.focus({preventScroll:!0})}),[m]);function O(e){"auto"===p&&(h.current=!e.pointerType)}if(l((()=>{f&&(null!=s&&(b.current=s),r&&h.current&&(a(b.current),R(c,b)))}),[r,s,c,a,R,f]),l((()=>{f&&r&&null!=i&&(b.current=i,a(b.current),R(c,b))}),[r,i,c,a,R,f]),l((()=>{null==s&&f&&(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),R(c,b)),E.current="")}),[r,c,s,a,R,f,y,g]),l((()=>{var e;f&&(r||null==s||null==(e=u.reference.current)||e.focus({preventScroll:!0}))}),[u.reference,s,r,f]),l((()=>{var e;f&&(r||("auto"===p&&(h.current=!0),b.current=null!=(e=null!=s?s:i)?e:-1,a(null)))}),[r,s,i,f,p]),!f)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),R(c,b)),"End"===e.key&&(b.current=r,a(b.current),R(c,b)),G(e.key,y)){if(N(e),!m&&e.currentTarget.ownerDocument.activeElement===e.currentTarget)return b.current=null!=s?s:X(e.key,y,g)?n:r,a(b.current),void R(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),R(c,b)}}return{reference:{...m&&{"aria-activedescendant":w},onPointerEnter:O,onPointerDown:O,onKeyDown(e){if(m&&r)return C(e);"auto"===p&&(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==s?X(e.key,y,g)?Y(c):z(c):s,N(e),o(!0),a(b.current)),m&&!r&&C(e))}},floating:{"aria-orientation":"both"===y?void 0:y,...m&&{"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:f=!0,findMatch:s=null,resetMs:d=500,ignoreKeys:v=[],selectedIndex:g=null}=void 0===n?{listRef:{current:[]},activeIndex:null}:n;const m=t.useRef(),p=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;p.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())}))&&p.current===e.key&&(p.current="",y.current=h.current),p.current+=e.key,clearTimeout(m.current),m.current=setTimeout((()=>{p.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=s?s(r,p.current):r.find((e=>0===(null==e?void 0:e.toLowerCase().indexOf(p.current)))),i=o?t.indexOf(o):-1;-1!==i&&(a(i),h.current=i)}return l((()=>{o&&(clearTimeout(m.current),h.current=null,p.current="")}),[o]),l((()=>{var e;o&&""===p.current&&(y.current=null!=(e=null!=g?g:i)?e:-1)}),[o,g,i]),f?{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 f=!1,s=0;const d=()=>"floating-ui-"+s++;const v=c["useId".toString()],g=null!=v?v:function(){const e=f?d():null,[t,n]=c.useState(e);return l((()=>{null===t&&n(d())}),[]),c.useEffect((()=>{f||(f=!0)}),[]),t},m=t.createContext(null),p=t.createContext(null),y=()=>{var e,n;return null!=(e=null==(n=t.useContext(m))?void 0:n.id)?e:null},h=()=>t.useContext(p);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 f=t[n+2*l+0],s=t[n+2*l+1],d=t[n+2*a+0],v=t[n+2*a+1];s>u!=v>u&&o<(d-f)*(u-s)/(v-s)+f&&(c=!c)}return c},R=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 f=t[l+n][0],s=t[l+n][1],d=t[a+n][0],v=t[a+n][1];s>u!=v>u&&o<(d-f)*(u-s)/(v-s)+f&&(c=!c)}return c};w.exports=function(e,t,n,r){return t.length>0&&Array.isArray(t[0])?R(e,t,n,r):x(e,t,n,r)},w.exports.nested=R,w.exports.flat=x;var O=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",P=t.createContext(D);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 j=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 M(e,t,n){return n&&"mouse"!==n?0:"number"==typeof e?e:null==e?void 0:e[t]}const F=t.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),S=()=>t.useContext(F);function N(e){e.preventDefault(),e.stopPropagation()}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(F.Provider,{value:{...o,setState:u,setCurrentId:c}},n)},e.FloatingNode=e=>{let{children:t,id:n}=e;const r=y();return i.default.createElement(m.Provider,{value:{id:n,parentId:r}},t)},e.FloatingOverlay=j,e.FloatingPortal=e=>{let{children:n,id:o=D}=e;const[u,c]=t.useState(!1),a=t.useRef(null);return l((()=>{const e=document.getElementById(o);e?a.current=e:(a.current=document.createElement("div"),a.current.id=o);const t=a.current;document.body.contains(t)||document.body.appendChild(t),c(!0)}),[o]),u&&a.current?i.default.createElement(P.Provider,{value:o},r.createPortal(n,a.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(p.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:f}=e;return function(e){var s;if("touch"===e.pointerType)return;const{target:d,clientX:v,clientY:g}=e,m=d;if("pointermove"===e.type&&I(i.reference.current)&&i.reference.current.contains(m)||null!=(s=i.floating.current)&&s.contains(m))return;if(f&&L(f,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 p=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<=p.top)return;break;case"bottom":if(v>=y.left&&v<=y.right&&g>=p.bottom&&g<=y.top)return;break;case"left":if(v>=y.right&&v<=p.left&&g>=y.left&&g<=y.right)return;break;case"right":if(v>=y.right&&v<=p.left&&g>=y.right&&g<=p.left)return}function w(e){let[t,n]=e;const r=y.width>p.width,o=y.height>p.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(", "))),O([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}=S();t.useEffect((()=>{c&&o&&(l((e=>({...e,delay:{open:0,close:M(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=S,e.useDismiss=function(e,r){let{open:o,onOpenChange:u,refs:c,events:i,nodeId:l}=e,{enabled:a=!0,escapeKey:f=!0,outsidePointerDown:s=!0,referencePointerDown:d=!1,ancestorScroll:v=!1}=void 0===r?{}:r;const g=h(),m=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),m())}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),m())}function r(){u(!1)}const d=C(c.floating.current);f&&d.addEventListener("keydown",e),s&&d.addEventListener("mousedown",t);const p=(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 p.forEach((e=>e.addEventListener("scroll",r,{passive:!0}))),()=>{f&&d.removeEventListener("keydown",e),s&&d.removeEventListener("mousedown",t),p.forEach((e=>e.removeEventListener("scroll",r)))}}),[f,s,i,g,l,o,u,m,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:f}=void 0===e?{}:e;const s=h(),d=t.useRef({}),v=t.useState((()=>a()))[0],g=n.useFloating({placement:u,middleware:c,strategy:i}),m=t.useMemo((()=>({...g,dataRef:d,nodeId:f,events:v,open:r,onOpenChange:o})),[g,d,f,v,r,o]);return l((()=>{const e=null==s?void 0:s.nodesRef.current.find((e=>e.id===f));e&&(e.context=m)})),t.useMemo((()=>({context:m,...g})),[g,m])},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 f=t.useRef(!1);return t.useEffect((()=>{var e;if(!l)return;const t=null!=(e=C(c.floating.current).defaultView)?e:window;function n(){f.current=!r}function o(){setTimeout((()=>{f.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(){f.current=!0}}),[i,l]),l?{reference:{onPointerDown(e){let{pointerType:t}=e;f.current=!(!t||!a)},onFocus(e){var t,n,r;f.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)||(f.current=!1,o(!1))}}}:{}},e.useFocusTrap=function(e,n){let{open:r,onOpenChange:o,refs:u,nodeId:c}=e,{enabled:i=!0,initialContentFocus:l=0,order:a=["content"],modal:f=!0,inert:s=!1}=void 0===n?{}:n;const d=t.useContext(P),v=h(),g=t.useRef(0),m=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 t.useEffect((()=>{if(!i)return;const e=m();if(s){if(r){const t=e[0];t!==u.floating.current||t.contains(t.ownerDocument.activeElement)||B(t)}}else r?"number"==typeof l?B(e[l]):l.current&&B(e.find((e=>e===l.current))):f&&T(u.reference.current)&&B(u.reference.current)}),[m,r,s,f,l,i,u.reference,u.floating]),t.useEffect((()=>{if(!f||!i)return;const e=C(u.floating.current);if(!r)return e.removeEventListener("keydown",t),void(g.current=0);function t(e){var t;if((null==v||null==(t=v.nodesRef.current)||!t.filter((e=>{let{parentId:t}=e;return t===c})).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))&&"Tab"===e.key){N(e);const t=m();if(s)return;e.shiftKey?g.current=0===g.current?t.length-1:g.current-1:g.current=g.current===t.length-1?0:g.current+1,B(t[g.current])}}return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}}),[m,null==v?void 0:v.nodesRef,c,r,f,s,i,u.floating]),t.useEffect((()=>{if(!r||!f||!i)return;const e=C(u.floating.current),t=e.querySelector("#"+d),n=e.querySelectorAll("body > *:not(#"+d+")"),o=[];return n.forEach((e=>{const t=e.getAttribute("aria-hidden");o.push(t),e.setAttribute("aria-hidden","hidden")})),()=>{(null==t?void 0:t.firstElementChild)===u.floating.current&&n.forEach(((e,t)=>{const n=o[t];null===n?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",n)}))}}),[r,f,d,i,u.floating]),i?f?{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:f,dataRef:s,events:d,refs:v}=e,g=h(),m=t.useRef(),p=t.useRef(),y=t.useRef(),b=t.useRef(),E=t.useRef(!0);l((()=>{r&&(a||(m.current=void 0))})),t.useEffect((()=>{if(r)return d.on("dismiss",e),()=>{d.off("dismiss",e)};function e(){clearTimeout(p.current),clearTimeout(b.current),E.current=!0}}),[r,d]),t.useEffect((()=>{if(!r||!u)return;function e(){var e;null!=(e=s.current.openEvent)&&e.type.includes("mouse")&&f(!1)}const t=C(v.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[v.floating,f,r,u,s]);const w=t.useCallback((function(e){void 0===e&&(e=!0),o?(clearTimeout(p.current),p.current=setTimeout((()=>f(!1)),M(o,"close",m.current))):e&&f(!1)}),[o,f]);function x(e){m.current=e.pointerType}return t.useEffect((()=>{if(!r)return;function t(e){a||c&&"mouse"!==m.current||(E.current=!1,s.current.openEvent=e,o?(clearTimeout(p.current),p.current=setTimeout((()=>{f(!0)}),M(o,"open",m.current))):f(!0))}function n(t){var n;if("click"===(null==(n=s.current.openEvent)?void 0:n.type))return;const r=C(v.floating.current);if(clearTimeout(b.current),u)return clearTimeout(p.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,s,c,f,a,g,v.reference,v.floating]),r?{reference:{onPointerDown:x,onPointerEnter:x,onMouseMove(){a||0===i||(clearTimeout(b.current),b.current=setTimeout((()=>{E.current||f(!0)}),i))}},floating:{onMouseEnter(){clearTimeout(p.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:f=!0,selectedIndex:s=null,loop:d=!1,nested:v=!1,rtl:g=!1,virtual:m=!1,focusItemOnOpen:p="auto",orientation:y="vertical"}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:n;const h=t.useRef(p),b=t.useRef(null!=s?s:-1),E=t.useRef(""),[w,x]=t.useState(),R=t.useCallback(((e,t)=>{var n,r;m?x(null==(n=W(e)[t.current])?void 0:n.id):null==(r=W(e)[t.current])||r.focus({preventScroll:!0})}),[m]);function O(e){"auto"===p&&(h.current=!e.pointerType)}if(l((()=>{f&&(null!=s&&(b.current=s),r&&h.current&&(a(b.current),R(c,b)))}),[r,s,c,a,R,f]),l((()=>{f&&r&&null!=i&&(b.current=i,a(b.current),R(c,b))}),[r,i,c,a,R,f]),l((()=>{null==s&&f&&(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),R(c,b)),E.current="")}),[r,c,s,a,R,f,y,g]),l((()=>{var e;f&&(r||null==s||null==(e=u.reference.current)||e.focus({preventScroll:!0}))}),[u.reference,s,r,f]),l((()=>{var e;f&&(r||("auto"===p&&(h.current=!0),b.current=null!=(e=null!=s?s:i)?e:-1,a(null)))}),[r,s,i,f,p]),!f)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),R(c,b)),"End"===e.key&&(b.current=r,a(b.current),R(c,b)),G(e.key,y)){if(N(e),!m&&e.currentTarget.ownerDocument.activeElement===e.currentTarget)return b.current=null!=s?s:X(e.key,y,g)?n:r,a(b.current),void R(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),R(c,b)}}return{reference:{...m&&{"aria-activedescendant":w},onPointerEnter:O,onPointerDown:O,onKeyDown(e){if(m&&r)return C(e);"auto"===p&&(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==s?X(e.key,y,g)?Y(c):z(c):s,N(e),o(!0),a(b.current)),m&&!r&&C(e))}},floating:{"aria-orientation":"both"===y?void 0:y,...m&&{"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:f=!0,findMatch:s=null,resetMs:d=500,ignoreKeys:v=[],selectedIndex:g=null}=void 0===n?{listRef:{current:[]},activeIndex:null}:n;const m=t.useRef(),p=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;p.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())}))&&p.current===e.key&&(p.current="",y.current=h.current),p.current+=e.key,clearTimeout(m.current),m.current=setTimeout((()=>{p.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=s?s(r,p.current):r.find((e=>0===(null==e?void 0:e.toLowerCase().indexOf(p.current)))),i=o?t.indexOf(o):-1;-1!==i&&(a(i),h.current=i)}return l((()=>{o&&(clearTimeout(m.current),h.current=null,p.current="")}),[o]),l((()=>{var e;o&&""===p.current&&(y.current=null!=(e=null!=g?g:i)?e:-1)}),[o,g,i]),f?{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.8",
"version": "0.0.9",
"@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