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.6.1 to 0.6.2

src/utils/getAncestors.d.ts

2

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

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

import{useFloating as e,getOverflowAncestors as n}from"@floating-ui/react-dom";export*from"@floating-ui/react-dom";import*as t from"react";import{useLayoutEffect as r,useEffect as o,useRef as u}from"react";import{createPortal as c}from"react-dom";import{hideOthers as i}from"aria-hidden";var l="undefined"!=typeof document?r:o;function a(){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 s=!1,f=0;const d=()=>"floating-ui-"+f++;const v=t["useId".toString()],m=null!=v?v:function(){const[e,n]=t.useState((()=>s?d():void 0));return l((()=>{null==e&&n(d())}),[]),t.useEffect((()=>{s||(s=!0)}),[]),e},p=t.createContext(null),g=t.createContext(null),b=()=>{var e,n;return null!=(e=null==(n=t.useContext(p))?void 0:n.id)?e:null},h=()=>t.useContext(g),y=()=>{const e=m(),n=h(),t=b();return l((()=>{const r={id:e,parentId:t};return null==n||n.addNode(r),()=>{null==n||n.removeNode(r)}}),[n,e,t]),e},w=e=>{let{children:n,id:r}=e;const o=b();return t.createElement(p.Provider,{value:t.useMemo((()=>({id:r,parentId:o})),[r,o])},n)},E=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((n=>n!==e))}),[]),c=t.useState((()=>a()))[0];return t.createElement(g.Provider,{value:t.useMemo((()=>({nodesRef:r,addNode:o,removeNode:u,events:c})),[r,o,u,c])},n)};function x(n){let{open:r=!1,onOpenChange:o=(()=>{}),whileElementsMounted:u,placement:c,middleware:i,strategy:s,nodeId:f}=void 0===n?{}:n;const d=h(),v=t.useRef({}),m=t.useState((()=>a()))[0],p=e({placement:c,middleware:i,strategy:s,whileElementsMounted:u}),g=t.useMemo((()=>({...p,dataRef:v,nodeId:f,events:m,open:r,onOpenChange:o})),[p,v,f,m,r,o]);return l((()=>{const e=null==d?void 0:d.nodesRef.current.find((e=>e.id===f));e&&(e.context=g)})),t.useMemo((()=>({context:g,...p})),[p,g])}function R(e,n,t){const r={};return{..."floating"===t&&{tabIndex:-1},...e,...n.map((e=>e?e[t]:null)).concat(e).reduce(((e,n)=>n?(Object.entries(n).forEach((n=>{let[t,o]=n;0===t.indexOf("on")?(r[t]||(r[t]=[]),"function"==typeof o&&r[t].push(o),e[t]=function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];r[t].forEach((e=>e(...n)))}):e[t]=o})),e):e),{})}}const k=function(e){return void 0===e&&(e=[]),{getReferenceProps:n=>R(n,e,"reference"),getFloatingProps:n=>R(n,e,"floating"),getItemProps:n=>R(n,e,"item")}};function L(e){var n;return null!=(n=null==e?void 0:e.ownerDocument)?n:document}function I(e){var n;return null!=(n=L(e).defaultView)?n:window}function T(e){return!!e&&e instanceof I(e).Element}function C(e){return!!e&&e instanceof I(e).HTMLElement}function A(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 O(e){let n,{restMs:t=0,buffer:r=.5,debug:o=null}=void 0===e?{}:e,u=!1;return e=>{let{x:o,y:c,placement:i,refs:l,onClose:a,nodeId:s,tree:f,leave:d=!1}=e;return function(e){var v;function m(){clearTimeout(n),a()}if(clearTimeout(n),e.pointerType&&"mouse"!==e.pointerType)return;const{clientX:p,clientY:g}=e,b="composedPath"in e?e.composedPath()[0]:e.target;if("pointermove"===e.type&&T(l.reference.current)&&l.reference.current.contains(b))return;if(f&&A(f,s).some((e=>{let{context:n}=e;return null==n?void 0:n.open})))return;if(null!=(v=l.floating.current)&&v.contains(b)&&!d)return void(u=!0);if(!l.reference.current||!l.floating.current||null==i||null==o||null==c)return;const h=l.reference.current.getBoundingClientRect(),y=l.floating.current.getBoundingClientRect(),w=i.split("-")[0],E=o>y.right-y.width/2,x=c>y.bottom-y.height/2;if("top"===w&&c>=h.bottom-1||"bottom"===w&&c<=h.top+1||"left"===w&&o>=h.right-1||"right"===w&&o<=h.left+1)return m();switch(w){case"top":if(p>=y.left&&p<=y.right&&g>=y.top&&g<=h.top+1)return;break;case"bottom":if(p>=y.left&&p<=y.right&&g>=h.bottom-1&&g<=y.bottom)return;break;case"left":if(p>=y.left&&p<=h.left+1&&g>=y.top&&g<=y.bottom)return;break;case"right":if(p>=h.right-1&&p<=y.right&&g>=y.top&&g<=y.bottom)return}if(u)return m();const R=function(e){let[n,t]=e;const o=y.width>h.width,u=y.height>h.height;switch(w){case"top":return[[o?n+r/2:E?n+4*r:n-4*r,t+r+1],[o?n-r/2:E?n+4*r:n-4*r,t+r+1],...[[y.left,E||o?y.bottom-r:y.top],[y.right,E?o?y.bottom-r:y.top:y.bottom-r]]];case"bottom":return[[o?n+r/2:E?n+4*r:n-4*r,t-r],[o?n-r/2:E?n+4*r:n-4*r,t-r],...[[y.left,E||o?y.top+r:y.bottom],[y.right,E?o?y.top+r:y.bottom:y.top+r]]];case"left":{const e=[n+r+1,u?t+r/2:x?t+4*r:t-4*r],o=[n+r+1,u?t-r/2:x?t+4*r:t-4*r];return[...[[x||u?y.right-r:y.left,y.top],[x?u?y.right-r:y.left:y.right-r,y.bottom]],e,o]}case"right":return[[n-r,u?t+r/2:x?t+4*r:t-4*r],[n-r,u?t-r/2:x?t+4*r:t-4*r],...[[x||u?y.left+r:y.right,y.top],[x?u?y.left+r:y.right:y.left+r,y.bottom]]]}}([o,c]);!function(e,n){const[t,r]=e;let o=!1;const u=n.length;for(let e=0,c=u-1;e<u;c=e++){const[u,i]=n[e]||[0,0],[l,a]=n[c]||[0,0];i>=r!=a>=r&&t<=(l-u)*(r-i)/(a-i)+u&&(o=!o)}return o}([p,g],R)?m():t&&(n=setTimeout(a,t))}}}const M="floating-ui-root",D=function(e){let{id:n=M,enabled:r=!0}=void 0===e?{}:e;const o=t.useRef(null);return l((()=>{if(!r)return;const e=document.getElementById(n);e?o.current=e:(o.current=document.createElement("div"),o.current.id=n),document.body.contains(o.current)||document.body.appendChild(o.current)}),[n,r]),o.current},P=e=>{let{children:n,id:r=M,root:o=null}=e;const[u,i]=t.useState(!1),a=D({id:r,enabled:!o});return l((()=>{o||i(!0)}),[o]),o?c(n,o):u&&a?c(n,a):null};function S(){return S=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},S.apply(this,arguments)}const F="data-floating-ui-scroll-lock";const K=t.forwardRef((function(e,n){let{lockScroll:r=!1,...o}=e;return l((()=>{var e,n,t,o;if(!r)return;if(document.body.hasAttribute(F))return;document.body.setAttribute(F,"");const u=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",c=window.innerWidth-document.documentElement.clientWidth;if(!/iP(hone|ad|od)|iOS/.test(function(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}()))return Object.assign(document.body.style,{overflow:"hidden",[u]:c+"px"}),()=>{document.body.removeAttribute(F),Object.assign(document.body.style,{overflow:"",[u]:""})};const i=null!=(e=null==(n=window.visualViewport)?void 0:n.offsetLeft)?e:0,l=null!=(t=null==(o=window.visualViewport)?void 0:o.offsetTop)?t:0,a=window.pageXOffset,s=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(s-Math.floor(l))+"px",left:-(a-Math.floor(i))+"px",right:"0",[u]:c+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[u]:""}),document.body.removeAttribute(F),window.scrollTo(a,s)}}),[r]),t.createElement("div",S({ref:n},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function N(e){let n=e.activeElement;for(;null!=(null==(t=n)||null==(r=t.shadowRoot)?void 0:r.activeElement);){var t,r;n=n.shadowRoot.activeElement}return n}function j(e){e.preventDefault(),e.stopPropagation()}function B(e){const n=u(e);return l((()=>{n.current=e})),n}function U(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const V=t.forwardRef((function(e,n){return t.createElement("span",S({},e,{ref:n,tabIndex:0,style:{position:"fixed",opacity:"0",pointerEvents:"none",outline:"0"}}))}));function H(e){let{context:{refs:n,nodeId:r,onOpenChange:o},children:u,order:c=["content"],endGuard:l=!0,preventTabbing:a=!1,initialFocus:s=0,returnFocus:f=!0,modal:d=!0}=e;const v=B(c),m=B(o),p=h(),g=t.useCallback((()=>v.current.map((e=>{return C(n.reference.current)&&"reference"===e?n.reference.current:n.floating.current&&"floating"===e?n.floating.current:"content"===e?Array.from(null!=(t=null==(r=n.floating.current)?void 0:r.querySelectorAll("input:not([type='hidden']):not([disabled]),select:not([disabled]),textarea:not([disabled]),a[href],button:not([disabled]),[tabindex],iframe,object,embed,area[href],audio[controls],video[controls],[contenteditable]:not([contenteditable='false'])"))?t:[]):null;var t,r})).flat().filter((e=>{if(e===n.floating.current||e===n.reference.current)return!0;if(C(e)){var t;return"-"!==(null!=(t=e.getAttribute("tabindex"))?t:"0")[0].trim()}}))),[v,n.floating,n.reference]),b=t.useCallback((()=>C(n.reference.current)&&"combobox"===n.reference.current.getAttribute("role")&&"INPUT"===n.reference.current.tagName),[n]);return t.useEffect((()=>{if(!d)return;const e=0===g().filter((e=>e!==n.floating.current&&e!==n.reference.current)).length;function t(t){if("Tab"===t.key){(a||e)&&j(t);const r=g(),o="composedPath"in t?t.composedPath()[0]:t.target;"reference"===v.current[0]&&o===n.reference.current&&(j(t),t.shiftKey?U(r[r.length-1]):U(r[1])),"floating"===v.current[1]&&o===n.floating.current&&t.shiftKey&&(j(t),U(r[0]))}}const r=L(n.floating.current);return r.addEventListener("keydown",t),()=>{r.removeEventListener("keydown",t)}}),[a,d,g,v,n.floating,n.reference]),t.useEffect((()=>{function e(e){var t;const o=e.relatedTarget;null!=(t=n.floating.current)&&t.contains(o)||!T(n.reference.current)||n.reference.current.contains(o)||p&&A(p,r).some((e=>{let{context:n}=e;return null==n?void 0:n.open}))||p&&A(p,r).some((e=>{var n,t;return null==(n=e.context)||null==(t=n.refs.floating.current)?void 0:t.contains(o)}))||m.current(!1)}const t=n.floating.current,o=n.reference.current;if(t&&C(o)){let n;return!d&&t.addEventListener("focusout",e),d&&(n=v.current.includes("reference")?i([o,t]):i(t)),()=>{!d&&t.removeEventListener("focusout",e),null==n||n()}}}),[r,p,d,m,v,g,s,n.floating,n.reference]),t.useEffect((()=>{if(a)return;const e=n.floating.current,t=N(L(e));var r;if("number"==typeof s)U(null!=(r=g()[s])?r:e);else if(C(null==s?void 0:s.current)){var o;U(null!=(o=s.current)?o:e)}return()=>{f&&C(t)&&U(t)}}),[a,g,s,d,f,n.floating]),t.createElement(t.Fragment,null,d&&t.createElement(V,{onFocus:e=>{if(b())return;j(e);const n=g();"reference"===c[0]?U(n[0]):U(n[n.length-1])}}),t.cloneElement(u,c.includes("floating")?{tabIndex:0}:{}),d&&l&&t.createElement(V,{onFocus:e=>{b()||(j(e),U(g()[0]))}}))}function X(e,n,t){return t&&"mouse"!==t?0:"number"==typeof e?e:null==e?void 0:e[n]}const Y=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,m=h(),p=B(s),g=B(u),b=t.useRef(),y=t.useRef(),w=t.useRef(),E=t.useRef(),x=t.useRef(!0);t.useEffect((()=>{if(r)return d.on("dismiss",e),()=>{d.off("dismiss",e)};function e(){clearTimeout(y.current),clearTimeout(E.current),x.current=!0}}),[r,d,v.floating]),t.useEffect((()=>{if(!r||!g.current)return;function e(){var e;null!=(e=f.current.openEvent)&&e.type.includes("mouse")&&p.current(!1)}const n=L(v.floating.current).documentElement;return n.addEventListener("mouseleave",e),()=>{n.removeEventListener("mouseleave",e)}}),[v.floating,p,r,g,f]);const R=t.useCallback((function(e){void 0===e&&(e=!0);const n=X(o,"close",b.current);n&&!w.current?(clearTimeout(y.current),y.current=setTimeout((()=>p.current(!1)),n)):e&&p.current(!1)}),[o,p]),k=t.useCallback((()=>{w.current&&(L(v.floating.current).removeEventListener("pointermove",w.current),w.current=void 0)}),[v.floating]);if(t.useEffect((()=>{if(!r)return;function n(e){if(clearTimeout(y.current),x.current=!1,a||c&&"mouse"!==b.current||i>0&&0===X(o,"open"))return;f.current.openEvent=e;const n=X(o,"open",b.current);n?y.current=setTimeout((()=>{p.current(!0)}),n):p.current(!0)}function t(n){var t,r;if("click"===(null==(t=f.current.openEvent)?void 0:t.type)||"pointerdown"===(null==(r=f.current.openEvent)?void 0:r.type))return;const o=L(v.floating.current);if(clearTimeout(E.current),g.current)return clearTimeout(y.current),w.current&&o.removeEventListener("pointermove",w.current),w.current=g.current({...e,tree:m,x:n.clientX,y:n.clientY,onClose(){k(),R()}}),void o.addEventListener("pointermove",w.current);R()}function u(n){null==g.current||g.current({...e,tree:m,x:n.clientX,y:n.clientY,leave:!0,onClose(){k(),R()}})(n)}const l=v.floating.current,s=v.reference.current;return T(s)?(a&&s.addEventListener("pointerleave",u),null==l||l.addEventListener("pointerleave",u),s.addEventListener("mousemove",n,{once:!0}),s.addEventListener("mouseenter",n),s.addEventListener("mouseleave",t),()=>{a&&s.removeEventListener("pointerleave",u),null==l||l.removeEventListener("pointerleave",u),s.removeEventListener("mousemove",n),s.removeEventListener("mouseenter",n),s.removeEventListener("mouseleave",t)}):void 0}),[r,R,e,o,g,f,c,p,a,m,i,k,v.reference,v.floating]),l((()=>{a||(b.current=void 0,k())})),t.useEffect((()=>()=>{k(),clearTimeout(y.current),clearTimeout(E.current)}),[k]),!r)return{};function I(e){b.current=e.pointerType}return{reference:{onPointerDown:I,onPointerEnter:I,onMouseMove(){a||0===i||(clearTimeout(E.current),E.current=setTimeout((()=>{x.current||s(!0)}),i))}},floating:{onMouseEnter(){clearTimeout(y.current)},onMouseLeave(){R(!1)}}}},q=t.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),W=()=>t.useContext(q),z=e=>{let{children:n,delay:r}=e;const[o,u]=t.useState({delay:r,initialDelay:r,currentId:null}),c=t.useCallback((e=>{u((n=>({...n,currentId:e})))}),[]);return t.createElement(q.Provider,{value:t.useMemo((()=>({...o,setState:u,setCurrentId:c})),[o,u,c])},n)},G=(e,n)=>{let{open:r,onOpenChange:o}=e,{id:u}=n;const{currentId:c,initialDelay:i,setState:l}=W(),a=B(o);t.useEffect((()=>{c&&a.current&&(l((e=>({...e,delay:{open:1,close:X(i,"close")}}))),c!==u&&a.current(!1))}),[u,a,l,c,i]),t.useEffect((()=>{!r&&c===u&&a.current&&(a.current(!1),l((e=>({...e,delay:i,currentId:null}))))}),[r,l,c,u,a,i])},J=function(e,n){let{open:t}=e,{enabled:r=!0,role:o="dialog"}=void 0===n?{}:n;const u=m(),c=m(),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}}}:{}},Q=function(e,n){let{open:r,onOpenChange:o,dataRef:u,refs:c}=e,{enabled:i=!0,pointerDown:l=!1,toggle:a=!0,ignoreMouse:s=!1}=void 0===n?{}:n;const f=t.useRef();function d(){return C(c.reference.current)&&"BUTTON"===c.reference.current.tagName}return i?{reference:{onPointerDown(e){if(f.current=e.pointerType,("mouse"!==f.current||!s)&&l){var n;if(r)a&&"pointerdown"===(null==(n=u.current.openEvent)?void 0:n.type)&&o(!1);else o(!0);u.current.openEvent=e.nativeEvent}},onClick(e){if(l&&f.current)f.current=void 0;else if("mouse"!==f.current||!s){var n;if(r)a&&"click"===(null==(n=u.current.openEvent)?void 0:n.type)&&o(!1);else o(!0);u.current.openEvent=e.nativeEvent}},onKeyDown(e){f.current=void 0,d()||(" "===e.key&&e.preventDefault(),"Enter"===e.key&&(r?a&&o(!1):o(!0)))},onKeyUp(e){d()||" "===e.key&&(r?a&&o(!1):o(!0))}}}:{}};function Z(e,n){if(null==n)return!1;if("composedPath"in e)return e.composedPath().includes(n);const t=e;return null!=t.target&&n.contains(t.target)}const $=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,bubbles:m=!0}=void 0===r?{}:r;const p=h(),g=B(u),b=t.useCallback((()=>{var e;return null==(e=c.floating.current)?void 0:e.contains(N(L(c.floating.current)))}),[c.floating]),y=t.useCallback((()=>{C(c.reference.current)&&c.reference.current.focus()}),[c.reference]);return t.useEffect((()=>{if(!o||!a)return;function e(e){if("Escape"===e.key){if(!m&&!b())return;i.emit("dismiss"),g.current(!1),y()}}function t(e){const n=p&&A(p,l).some((n=>{var t;return Z(e,null==(t=n.context)?void 0:t.refs.floating.current)}));Z(e,c.floating.current)||T(c.reference.current)&&Z(e,c.reference.current)||n||(m||b())&&(i.emit("dismiss"),g.current(!1),y())}function r(){g.current(!1)}const u=L(c.floating.current);s&&u.addEventListener("keydown",e),f&&u.addEventListener("mousedown",t);const d=(v?[...T(c.reference.current)?n(c.reference.current):[],...T(c.floating.current)?n(c.floating.current):[]]:[]).filter((e=>{var n;return e!==(null==(n=u.defaultView)?void 0:n.visualViewport)}));return d.forEach((e=>e.addEventListener("scroll",r,{passive:!0}))),()=>{s&&u.removeEventListener("keydown",e),f&&u.removeEventListener("mousedown",t),d.forEach((e=>e.removeEventListener("scroll",r)))}}),[s,f,i,p,l,o,g,y,v,a,m,b,c.floating,c.reference]),a?{reference:{onPointerDown(){d&&(i.emit("dismiss"),u(!1))}}}:{}},_=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(""),f=t.useRef(!1);return t.useEffect((()=>{var e;if(!l)return;const n=null!=(e=L(c.floating.current).defaultView)?e:window;function t(){s.current&&(f.current=!r)}function o(){setTimeout((()=>{f.current=!1,s.current=""}))}return n.addEventListener("focus",o),n.addEventListener("blur",t),()=>{n.removeEventListener("focus",o),n.removeEventListener("blur",t)}}),[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:n}=e;s.current=n,f.current=!(!n||!a)},onFocus(e){var n,t,r;f.current||"focus"===e.type&&"mousedown"===(null==(n=u.current.openEvent)?void 0:n.type)&&T(c.reference.current)&&null!=(t=c.reference.current)&&t.contains(null==(r=u.current.openEvent)?void 0:r.target)||(u.current.openEvent=e.nativeEvent,o(!0))},onBlur(e){var n;const t=e.relatedTarget;null!=(n=c.floating.current)&&n.contains(t)||T(c.reference.current)&&c.reference.current.contains(t)||(f.current=!1,o(!1))}}}:{}};function ee(e){const n=u();return l((()=>{n.current=e}),[e]),n.current}function ne(e,n){return n<0||n>=e.current.length}function te(e,n){let{startingIndex:t=-1,decrement:r=!1,disabledIndices:o}=void 0===n?{}:n;const u=e.current;let c=t;do{var i,l;c+=r?-1:1}while(c>=0&&c<=u.length-1&&(o?o.includes(c):null==u[c]||(null==(i=u[c])?void 0:i.hasAttribute("disabled"))||"true"===(null==(l=u[c])?void 0:l.getAttribute("aria-disabled"))));return c}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)||"Enter"===e||" "==e||""===e}function ce(e,n){return te(e,{disabledIndices:n})}function ie(e,n){return te(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:n})}const le=function(e,n){let{open:r,onOpenChange:o,refs:u}=e,{listRef:c,activeIndex:i,onNavigate:a,enabled:s=!0,selectedIndex:f=null,allowEscape:d=!1,loop:v=!1,nested:m=!1,rtl:p=!1,virtual:g=!1,focusItemOnOpen:y="auto",focusItemOnHover:w=!0,openOnArrowKeyDown:E=!0,disabledIndices:x=(E?void 0:[]),orientation:R="vertical"}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:n;const k=b(),I=h(),T=ee(r),A=t.useRef(y),O=t.useRef(null!=f?f:-1),M=t.useRef(null),D=B(ee(a)),P=B(a),S=B(x),F=t.useRef(!1),K=t.useRef(-1),[U,V]=t.useState(),H=t.useCallback(((e,n)=>{K.current=requestAnimationFrame((()=>{var t,r;g?V(null==(t=e.current[n.current])?void 0:t.id):null==(r=e.current[n.current])||r.focus({preventScroll:!0})}))}),[g]);function X(e){if(F.current=!0,m&&function(e,n,t){return re(n,t?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(e.key,R,p))return j(e),o(!1),void(C(u.reference.current)&&u.reference.current.focus());const n=O.current,t=ce(c,x),i=ie(c,x);if("Home"===e.key&&(O.current=t,a(O.current)),"End"===e.key&&(O.current=i,a(O.current)),oe(e.key,R)){if(j(e),r&&!g&&N(e.currentTarget.ownerDocument)===e.currentTarget)return O.current=ue(e.key,R,p)?t:i,void a(O.current);ue(e.key,R,p)?O.current=v?n>=i?d&&n!==c.current.length?-1:t:te(c,{startingIndex:n,disabledIndices:x}):Math.min(i,te(c,{startingIndex:n,disabledIndices:x})):O.current=v?n<=t?d&&-1!==n?c.current.length:i:te(c,{startingIndex:n,decrement:!0,disabledIndices:x}):Math.max(t,te(c,{startingIndex:n,decrement:!0,disabledIndices:x})),ne(c,O.current)?a(null):a(O.current)}}return l((()=>{s&&(!T&&r&&A.current&&null!=f&&P.current(f),T&&!r&&(cancelAnimationFrame(K.current),O.current=-1,null==D.current||D.current(null)))}),[r,T,f,c,P,D,H,s]),l((()=>{if(s&&r)if(null==i){if(null!=f)return;T&&(O.current=-1,H(c,O)),!T&&A.current&&(null!=M.current||!0===A.current&&null==M.current)&&(O.current=null==M.current||ue(M.current,R,p)||m?ce(c,S.current):ie(c,S.current),P.current(O.current),H(c,O))}else ne(c,i)||(O.current=i,H(c,O))}),[r,T,i,f,m,c,P,H,s,d,R,p,g,S]),l((()=>{s&&!r&&T&&null!=f&&C(u.reference.current)&&u.reference.current.focus()}),[u.reference,f,r,T,s]),l((()=>{if(s&&!r&&T){var e,n;const t=null==I||null==(e=I.nodesRef.current.find((e=>e.id===k)))||null==(n=e.context)?void 0:n.refs.floating.current;t&&!t.contains(N(L(t)))&&t.focus({preventScroll:!0})}}),[s,r,T,I,k]),l((()=>{M.current=null})),s?{reference:{...g&&r&&null!=i&&{"aria-activedescendant":U},onKeyDown(e){if(F.current=!0,g&&r)return X(e);(0===e.key.indexOf("Arrow")||"Enter"===e.key||" "===e.key||""===e.key)&&(M.current=e.key),m?function(e,n,t){return re(n,t?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(e.key,R,p)&&(j(e),r?(O.current=ce(c,x),a(O.current)):o(!0)):oe(e.key,R)&&(null!=f&&(O.current=f),j(e),!r&&E?o(!0):X(e),r&&a(O.current))}},floating:{"aria-orientation":"both"===R?void 0:R,...g&&null!=i&&{"aria-activedescendant":U},onKeyDown:X,onPointerMove(){F.current=!1}},item:{onFocus(e){let{currentTarget:n}=e;const t=c.current.indexOf(n);-1!==t&&a(t)},onClick:e=>{let{currentTarget:n}=e;return n.focus({preventScroll:!0})},...w&&{onMouseMove(e){let{currentTarget:n}=e;const t=n;if(t){const e=c.current.indexOf(t);-1!==e&&a(e)}},onMouseLeave(){var e;F.current||(O.current=-1,H(c,O),P.current(null),g||null==(e=u.floating.current)||e.focus({preventScroll:!0}))}}}}:{}},ae=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=1e3,ignoreKeys:v=[],selectedIndex:m=null}=void 0===n?{listRef:{current:[]},activeIndex:null}:n;const p=t.useRef(),g=t.useRef(""),b=t.useRef(null!=(r=null!=m?m:i)?r:-1),h=t.useRef(null);function y(e){if(!e.currentTarget.contains(N(L(e.currentTarget))))return;g.current.length>0&&" "!==g.current[0]&&(u.current.typing=!0," "===e.key&&j(e));const n=c.current;if(null==n||["Home","End","Escape","Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight",...v].includes(e.key))return;n.every((e=>{var n,t;return!e||(null==(n=e[0])?void 0:n.toLocaleLowerCase())!==(null==(t=e[1])?void 0:t.toLocaleLowerCase())}))&&g.current===e.key&&(g.current="",b.current=h.current),g.current+=e.key,clearTimeout(p.current),p.current=setTimeout((()=>{g.current="",b.current=h.current,u.current.typing=!1}),d);const t=b.current,r=[...n.slice((null!=t?t:0)+1),...n.slice(0,(null!=t?t:0)+1)],o=f?f(r,g.current):r.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(g.current)))),i=o?n.indexOf(o):-1;-1!==i&&(a(i),h.current=i)}return l((()=>{o&&(clearTimeout(p.current),h.current=null,g.current="")}),[o]),l((()=>{var e;o&&""===g.current&&(b.current=null!=(e=null!=m?m:i)?e:-1)}),[o,m,i]),s?{reference:{onKeyDown:y},floating:{onKeyDown:y}}:{}};export{z as FloatingDelayGroup,H as FloatingFocusManager,w as FloatingNode,K as FloatingOverlay,P as FloatingPortal,E as FloatingTree,O as safePolygon,Q as useClick,G as useDelayGroup,W as useDelayGroupContext,$ as useDismiss,x as useFloating,y as useFloatingNodeId,b as useFloatingParentNodeId,D as useFloatingPortalNode,h as useFloatingTree,_ as useFocus,Y as useHover,m as useId,k as useInteractions,le as useListNavigation,J as useRole,ae as useTypeahead};
import{useFloating as e,getOverflowAncestors as n}from"@floating-ui/react-dom";export*from"@floating-ui/react-dom";import*as t from"react";import{useLayoutEffect as r,useEffect as o,useRef as u}from"react";import{createPortal as c}from"react-dom";import{hideOthers as i}from"aria-hidden";var l="undefined"!=typeof document?r:o;function a(){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 s=!1,f=0;const d=()=>"floating-ui-"+f++;const v=t["useId".toString()],m=null!=v?v:function(){const[e,n]=t.useState((()=>s?d():void 0));return l((()=>{null==e&&n(d())}),[]),t.useEffect((()=>{s||(s=!0)}),[]),e},p=t.createContext(null),g=t.createContext(null),b=()=>{var e,n;return null!=(e=null==(n=t.useContext(p))?void 0:n.id)?e:null},y=()=>t.useContext(g),h=()=>{const e=m(),n=y(),t=b();return l((()=>{const r={id:e,parentId:t};return null==n||n.addNode(r),()=>{null==n||n.removeNode(r)}}),[n,e,t]),e},E=e=>{let{children:n,id:r}=e;const o=b();return t.createElement(p.Provider,{value:t.useMemo((()=>({id:r,parentId:o})),[r,o])},n)},w=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((n=>n!==e))}),[]),c=t.useState((()=>a()))[0];return t.createElement(g.Provider,{value:t.useMemo((()=>({nodesRef:r,addNode:o,removeNode:u,events:c})),[r,o,u,c])},n)};function x(n){let{open:r=!1,onOpenChange:o=(()=>{}),whileElementsMounted:u,placement:c,middleware:i,strategy:s,nodeId:f}=void 0===n?{}:n;const d=y(),v=t.useRef({}),m=t.useState((()=>a()))[0],p=e({placement:c,middleware:i,strategy:s,whileElementsMounted:u}),g=t.useMemo((()=>({...p,dataRef:v,nodeId:f,events:m,open:r,onOpenChange:o})),[p,v,f,m,r,o]);return l((()=>{const e=null==d?void 0:d.nodesRef.current.find((e=>e.id===f));e&&(e.context=g)})),t.useMemo((()=>({context:g,...p})),[p,g])}function R(e,n,t){const r={};return{..."floating"===t&&{tabIndex:-1},...e,...n.map((e=>e?e[t]:null)).concat(e).reduce(((e,n)=>n?(Object.entries(n).forEach((n=>{let[t,o]=n;0===t.indexOf("on")?(r[t]||(r[t]=[]),"function"==typeof o&&r[t].push(o),e[t]=function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];r[t].forEach((e=>e(...n)))}):e[t]=o})),e):e),{})}}const L=function(e){return void 0===e&&(e=[]),{getReferenceProps:n=>R(n,e,"reference"),getFloatingProps:n=>R(n,e,"floating"),getItemProps:n=>R(n,e,"item")}};function k(e){var n;return null!=(n=null==e?void 0:e.ownerDocument)?n:document}function I(e){var n;return null!=(n=k(e).defaultView)?n:window}function T(e){return!!e&&e instanceof I(e).Element}function C(e){return!!e&&e instanceof I(e).HTMLElement}function A(e,n){var t;let r=null!=(t=e.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=e.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 O(e){let n,{restMs:t=0,buffer:r=.5,debug:o=null}=void 0===e?{}:e,u=!1;return e=>{let{x:o,y:c,placement:i,refs:l,onClose:a,nodeId:s,tree:f,leave:d=!1}=e;return function(e){var v;function m(){clearTimeout(n),a()}if(clearTimeout(n),e.pointerType&&"mouse"!==e.pointerType)return;const{clientX:p,clientY:g}=e,b="composedPath"in e?e.composedPath()[0]:e.target;if("pointermove"===e.type&&T(l.reference.current)&&l.reference.current.contains(b))return;if(f&&A(f.nodesRef.current,s).some((e=>{let{context:n}=e;return null==n?void 0:n.open})))return;if(null!=(v=l.floating.current)&&v.contains(b)&&!d)return void(u=!0);if(!l.reference.current||!l.floating.current||null==i||null==o||null==c)return;const y=l.reference.current.getBoundingClientRect(),h=l.floating.current.getBoundingClientRect(),E=i.split("-")[0],w=o>h.right-h.width/2,x=c>h.bottom-h.height/2;if("top"===E&&c>=y.bottom-1||"bottom"===E&&c<=y.top+1||"left"===E&&o>=y.right-1||"right"===E&&o<=y.left+1)return m();switch(E){case"top":if(p>=h.left&&p<=h.right&&g>=h.top&&g<=y.top+1)return;break;case"bottom":if(p>=h.left&&p<=h.right&&g>=y.bottom-1&&g<=h.bottom)return;break;case"left":if(p>=h.left&&p<=y.left+1&&g>=h.top&&g<=h.bottom)return;break;case"right":if(p>=y.right-1&&p<=h.right&&g>=h.top&&g<=h.bottom)return}if(u)return m();const R=function(e){let[n,t]=e;const o=h.width>y.width,u=h.height>y.height;switch(E){case"top":return[[o?n+r/2:w?n+4*r:n-4*r,t+r+1],[o?n-r/2:w?n+4*r:n-4*r,t+r+1],...[[h.left,w||o?h.bottom-r:h.top],[h.right,w?o?h.bottom-r:h.top:h.bottom-r]]];case"bottom":return[[o?n+r/2:w?n+4*r:n-4*r,t-r],[o?n-r/2:w?n+4*r:n-4*r,t-r],...[[h.left,w||o?h.top+r:h.bottom],[h.right,w?o?h.top+r:h.bottom:h.top+r]]];case"left":{const e=[n+r+1,u?t+r/2:x?t+4*r:t-4*r],o=[n+r+1,u?t-r/2:x?t+4*r:t-4*r];return[...[[x||u?h.right-r:h.left,h.top],[x?u?h.right-r:h.left:h.right-r,h.bottom]],e,o]}case"right":return[[n-r,u?t+r/2:x?t+4*r:t-4*r],[n-r,u?t-r/2:x?t+4*r:t-4*r],...[[x||u?h.left+r:h.right,h.top],[x?u?h.left+r:h.right:h.left+r,h.bottom]]]}}([o,c]);!function(e,n){const[t,r]=e;let o=!1;const u=n.length;for(let e=0,c=u-1;e<u;c=e++){const[u,i]=n[e]||[0,0],[l,a]=n[c]||[0,0];i>=r!=a>=r&&t<=(l-u)*(r-i)/(a-i)+u&&(o=!o)}return o}([p,g],R)?m():t&&(n=setTimeout(a,t))}}}const M="floating-ui-root",D=function(e){let{id:n=M,enabled:r=!0}=void 0===e?{}:e;const[o,u]=t.useState(null);return l((()=>{if(!r)return;const e=document.getElementById(n);if(e)u(e);else{const e=document.createElement("div");e.id=n,u(e),document.body.contains(e)||document.body.appendChild(e)}}),[n,r]),o},P=e=>{let{children:n,id:t=M,root:r=null}=e;const o=D({id:t,enabled:!r});return r?c(n,r):o?c(n,o):null};function S(){return S=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},S.apply(this,arguments)}const F="data-floating-ui-scroll-lock";const K=t.forwardRef((function(e,n){let{lockScroll:r=!1,...o}=e;return l((()=>{var e,n,t,o;if(!r)return;if(document.body.hasAttribute(F))return;document.body.setAttribute(F,"");const u=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",c=window.innerWidth-document.documentElement.clientWidth;if(!/iP(hone|ad|od)|iOS/.test(function(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}()))return Object.assign(document.body.style,{overflow:"hidden",[u]:c+"px"}),()=>{document.body.removeAttribute(F),Object.assign(document.body.style,{overflow:"",[u]:""})};const i=null!=(e=null==(n=window.visualViewport)?void 0:n.offsetLeft)?e:0,l=null!=(t=null==(o=window.visualViewport)?void 0:o.offsetTop)?t:0,a=window.pageXOffset,s=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(s-Math.floor(l))+"px",left:-(a-Math.floor(i))+"px",right:"0",[u]:c+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[u]:""}),document.body.removeAttribute(F),window.scrollTo(a,s)}}),[r]),t.createElement("div",S({ref:n},o,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}}))}));function j(e){let n=e.activeElement;for(;null!=(null==(t=n)||null==(r=t.shadowRoot)?void 0:r.activeElement);){var t,r;n=n.shadowRoot.activeElement}return n}const N="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function B(e){return C(e)&&e.matches(N)}function V(e){e.preventDefault(),e.stopPropagation()}function U(e){const n=u(e);return l((()=>{n.current=e})),n}function H(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const X=t.forwardRef((function(e,n){return t.createElement("span",S({},e,{ref:n,tabIndex:0,style:{position:"fixed",opacity:"0",pointerEvents:"none",outline:"0"}}))}));function Y(e){let{context:{refs:n,nodeId:r,onOpenChange:o},children:u,order:c=["content"],endGuard:l=!0,preventTabbing:a=!1,initialFocus:s=0,returnFocus:f=!0,modal:d=!0}=e;const v=U(c),m=U(o),p=y(),g=t.useCallback((()=>v.current.map((e=>{return C(n.reference.current)&&"reference"===e?n.reference.current:n.floating.current&&"floating"===e?n.floating.current:"content"===e?Array.from(null!=(t=null==(r=n.floating.current)?void 0:r.querySelectorAll("select:not([disabled]),a[href],button:not([disabled]),[tabindex],iframe,object,embed,area[href],audio[controls],video[controls],input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"))?t:[]):null;var t,r})).flat().filter((e=>{if(e===n.floating.current||e===n.reference.current)return!0;if(C(e)){var t;return"-"!==(null!=(t=e.getAttribute("tabindex"))?t:"0")[0].trim()}}))),[v,n]);t.useEffect((()=>{if(!d)return;const e=0===g().filter((e=>e!==n.floating.current&&e!==n.reference.current)).length;function t(t){if("Tab"===t.key){(a||e)&&V(t);const r=g(),o="composedPath"in t?t.composedPath()[0]:t.target;"reference"===v.current[0]&&o===n.reference.current&&(V(t),t.shiftKey?H(r[r.length-1]):H(r[1])),"floating"===v.current[1]&&o===n.floating.current&&t.shiftKey&&(V(t),H(r[0]))}}const r=k(n.floating.current);return r.addEventListener("keydown",t),()=>{r.removeEventListener("keydown",t)}}),[a,d,g,v,n]),t.useEffect((()=>{function e(e){var t,o;const u=e.relatedTarget,c=!(null!=(t=n.floating.current)&&t.contains(u)),i=T(n.reference.current)&&!n.reference.current.contains(u),l=p&&A(p.nodesRef.current,r).length>0,a=p&&e.currentTarget===n.reference.current&&(null==(o=function(e,n){var t;let r=[],o=null==(t=e.find((e=>e.id===n)))?void 0:t.parentId;for(;o;){const n=e.find((e=>e.id===o));o=null==n?void 0:n.parentId,n&&(r=r.concat(n))}return r}(p.nodesRef.current,r))?void 0:o.some((e=>{var n,t;return null==(n=e.context)||null==(t=n.refs.floating.current)?void 0:t.contains(u)})));c&&i&&!l&&!a&&m.current(!1)}const t=n.floating.current,o=n.reference.current;if(t&&C(o)){let n;return!d&&t.addEventListener("focusout",e),!d&&o.addEventListener("focusout",e),d&&(n=v.current.includes("reference")?i([o,t]):i(t)),()=>{!d&&t.removeEventListener("focusout",e),!d&&o.removeEventListener("focusout",e),null==n||n()}}}),[r,p,d,m,v,g,n]),t.useEffect((()=>{if(a)return;const e=n.floating.current,t=j(k(e));var r;if("number"==typeof s)H(null!=(r=g()[s])?r:e);else if(C(null==s?void 0:s.current)){var o;H(null!=(o=s.current)?o:e)}return()=>{f&&C(t)&&H(t)}}),[a,g,s,f,n]);const b=()=>C(n.reference.current)&&"combobox"===n.reference.current.getAttribute("role")&&B(n.reference.current);return t.createElement(t.Fragment,null,d&&t.createElement(X,{onFocus:e=>{if(b())return;V(e);const n=g();"reference"===c[0]?H(n[0]):H(n[n.length-1])}}),t.cloneElement(u,c.includes("floating")?{tabIndex:0}:{}),d&&l&&t.createElement(X,{onFocus:e=>{b()||(V(e),H(g()[0]))}}))}function q(e){const n=u();return l((()=>{n.current=e}),[e]),n.current}function W(e,n,t){return t&&"mouse"!==t?0:"number"==typeof e?e:null==e?void 0:e[n]}const z=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,m=y(),p=b(),g=U(s),h=U(u),E=q(a),w=t.useRef(),x=t.useRef(),R=t.useRef(),L=t.useRef(),I=t.useRef(!0),A=t.useRef(!1);t.useEffect((()=>{if(r)return d.on("dismiss",e),()=>{d.off("dismiss",e)};function e(){clearTimeout(x.current),clearTimeout(L.current),I.current=!0}}),[r,d,v]),t.useEffect((()=>{if(!r||!h.current)return;function e(){var e;null!=(e=f.current.openEvent)&&e.type.includes("mouse")&&g.current(!1)}const n=k(v.floating.current).documentElement;return n.addEventListener("mouseleave",e),()=>{n.removeEventListener("mouseleave",e)}}),[v,g,r,h,f]);const O=t.useCallback((function(e){void 0===e&&(e=!0);const n=W(o,"close",w.current);n&&!R.current?(clearTimeout(x.current),x.current=setTimeout((()=>g.current(!1)),n)):e&&g.current(!1)}),[o,g]),M=t.useCallback((()=>{R.current&&(k(v.floating.current).removeEventListener("pointermove",R.current),R.current=void 0)}),[v]),D=t.useCallback((()=>{k(v.floating.current).body.style.pointerEvents="",A.current=!1}),[v]);if(t.useEffect((()=>{if(!r)return;function n(e){if(clearTimeout(x.current),I.current=!1,a||c&&"mouse"!==w.current||i>0&&0===W(o,"open"))return;f.current.openEvent=e;const n=W(o,"open",w.current);n?x.current=setTimeout((()=>{g.current(!0)}),n):g.current(!0)}function t(n){var t,r;if("click"===(null==(t=f.current.openEvent)?void 0:t.type)||"pointerdown"===(null==(r=f.current.openEvent)?void 0:r.type))return;const o=k(v.floating.current);if(clearTimeout(L.current),h.current)return clearTimeout(x.current),R.current&&o.removeEventListener("pointermove",R.current),R.current=h.current({...e,tree:m,x:n.clientX,y:n.clientY,onClose(){M(),O()}}),void o.addEventListener("pointermove",R.current);O()}function u(n){null==h.current||h.current({...e,tree:m,x:n.clientX,y:n.clientY,leave:!0,onClose(){M(),O()}})(n)}const l=v.floating.current,s=v.reference.current;return T(s)?(a&&s.addEventListener("pointerleave",u),null==l||l.addEventListener("pointerleave",u),s.addEventListener("mousemove",n,{once:!0}),s.addEventListener("mouseenter",n),s.addEventListener("mouseleave",t),()=>{a&&s.removeEventListener("pointerleave",u),null==l||l.removeEventListener("pointerleave",u),s.removeEventListener("mousemove",n),s.removeEventListener("mouseenter",n),s.removeEventListener("mouseleave",t)}):void 0}),[r,O,e,o,h,f,c,g,a,m,i,M,v]),l((()=>{if(r&&a&&h.current){k(v.floating.current).body.style.pointerEvents="none",A.current=!0;const t=C(v.reference.current)&&v.reference.current,r=v.floating.current;if(t&&r){var e,n;const o=null==m||null==(e=m.nodesRef.current.find((e=>e.id===p)))||null==(n=e.context)?void 0:n.refs.floating.current;return o&&(o.style.pointerEvents=""),t.style.pointerEvents="auto",r.style.pointerEvents="auto",()=>{t.style.pointerEvents="",r.style.pointerEvents=""}}}}),[r,a,p,v,m,h]),l((()=>{E&&!a&&(w.current=void 0,M(),D())})),t.useEffect((()=>()=>{M(),clearTimeout(x.current),clearTimeout(L.current),A.current&&D()}),[M,D]),!r)return{};function P(e){w.current=e.pointerType}return{reference:{onPointerDown:P,onPointerEnter:P,onMouseMove(){a||0===i||(clearTimeout(L.current),L.current=setTimeout((()=>{I.current||s(!0)}),i))}},floating:{onMouseEnter(){clearTimeout(x.current)},onMouseLeave(){O(!1)}}}},G=t.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),J=()=>t.useContext(G),Q=e=>{let{children:n,delay:r}=e;const[o,u]=t.useState({delay:r,initialDelay:r,currentId:null}),c=t.useCallback((e=>{u((n=>({...n,currentId:e})))}),[]);return t.createElement(G.Provider,{value:t.useMemo((()=>({...o,setState:u,setCurrentId:c})),[o,u,c])},n)},Z=(e,n)=>{let{open:r,onOpenChange:o}=e,{id:u}=n;const{currentId:c,initialDelay:i,setState:l}=J(),a=U(o);t.useEffect((()=>{c&&a.current&&(l((e=>({...e,delay:{open:1,close:W(i,"close")}}))),c!==u&&a.current(!1))}),[u,a,l,c,i]),t.useEffect((()=>{!r&&c===u&&a.current&&(a.current(!1),l((e=>({...e,delay:i,currentId:null}))))}),[r,l,c,u,a,i])},$=function(e,n){let{open:t}=e,{enabled:r=!0,role:o="dialog"}=void 0===n?{}:n;const u=m(),c=m(),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}}}:{}},_=function(e,n){let{open:r,onOpenChange:o,dataRef:u,refs:c}=e,{enabled:i=!0,pointerDown:l=!1,toggle:a=!0,ignoreMouse:s=!1}=void 0===n?{}:n;const f=t.useRef();function d(){return C(c.reference.current)&&"BUTTON"===c.reference.current.tagName}function v(){return B(c.reference.current)}return i?{reference:{onPointerDown(e){if(0===e.button&&(f.current=e.pointerType,("mouse"!==f.current||!s)&&l)){var n;if(r)a&&"pointerdown"===(null==(n=u.current.openEvent)?void 0:n.type)&&o(!1);else o(!0);u.current.openEvent=e.nativeEvent}},onClick(e){if(l&&f.current)f.current=void 0;else if("mouse"!==f.current||!s){var n;if(r)a&&"click"===(null==(n=u.current.openEvent)?void 0:n.type)&&o(!1);else o(!0);u.current.openEvent=e.nativeEvent}},onKeyDown(e){f.current=void 0,d()||(" "!==e.key||v()||e.preventDefault(),"Enter"===e.key&&(r?a&&o(!1):o(!0)))},onKeyUp(e){d()||v()||" "===e.key&&(r?a&&o(!1):o(!0))}}}:{}};function ee(e,n){if(null==n)return!1;if("composedPath"in e)return e.composedPath().includes(n);const t=e;return null!=t.target&&n.contains(t.target)}const ne=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,bubbles:m=!0}=void 0===r?{}:r;const p=y(),g=U(u),b=t.useCallback((()=>{var e;return null==(e=c.floating.current)?void 0:e.contains(j(k(c.floating.current)))}),[c.floating]),h=t.useCallback((()=>{C(c.reference.current)&&c.reference.current.focus()}),[c.reference]);return t.useEffect((()=>{if(!o||!a)return;function e(e){if("Escape"===e.key){if(!m&&!b())return;i.emit("dismiss"),g.current(!1),h()}}function t(e){const n=p&&A(p.nodesRef.current,l).some((n=>{var t;return ee(e,null==(t=n.context)?void 0:t.refs.floating.current)}));ee(e,c.floating.current)||T(c.reference.current)&&ee(e,c.reference.current)||n||(m||b())&&(i.emit("dismiss"),g.current(!1),h())}function r(){g.current(!1)}const u=k(c.floating.current);s&&u.addEventListener("keydown",e),f&&u.addEventListener("mousedown",t);const d=(v?[...T(c.reference.current)?n(c.reference.current):[],...T(c.floating.current)?n(c.floating.current):[]]:[]).filter((e=>{var n;return e!==(null==(n=u.defaultView)?void 0:n.visualViewport)}));return d.forEach((e=>e.addEventListener("scroll",r,{passive:!0}))),()=>{s&&u.removeEventListener("keydown",e),f&&u.removeEventListener("mousedown",t),d.forEach((e=>e.removeEventListener("scroll",r)))}}),[s,f,i,p,l,o,g,h,v,a,m,b,c.floating,c.reference]),a?{reference:{onPointerDown(){d&&(i.emit("dismiss"),u(!1))}}}:{}},te=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(""),f=t.useRef(!1);return t.useEffect((()=>{var e;if(!l)return;const n=k(c.floating.current),t=null!=(e=n.defaultView)?e:window;function o(){s.current&&c.reference.current===j(n)&&(f.current=!r)}function u(){setTimeout((()=>{f.current=!1,s.current=""}))}return t.addEventListener("focus",u),t.addEventListener("blur",o),()=>{t.removeEventListener("focus",u),t.removeEventListener("blur",o)}}),[c,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:n}=e;s.current=n,f.current=!(!n||!a)},onFocus(e){var n,t,r;f.current||"focus"===e.type&&"mousedown"===(null==(n=u.current.openEvent)?void 0:n.type)&&T(c.reference.current)&&null!=(t=c.reference.current)&&t.contains(null==(r=u.current.openEvent)?void 0:r.target)||(u.current.openEvent=e.nativeEvent,o(!0))},onBlur(e){var n;const t=e.relatedTarget;null!=(n=c.floating.current)&&n.contains(t)||T(c.reference.current)&&c.reference.current.contains(t)||(f.current=!1,o(!1))}}}:{}};function re(e,n){return n<0||n>=e.current.length}function oe(e,n){let{startingIndex:t=-1,decrement:r=!1,disabledIndices:o}=void 0===n?{}:n;const u=e.current;let c=t;do{var i,l;c+=r?-1:1}while(c>=0&&c<=u.length-1&&(o?o.includes(c):null==u[c]||(null==(i=u[c])?void 0:i.hasAttribute("disabled"))||"true"===(null==(l=u[c])?void 0:l.getAttribute("aria-disabled"))));return c}function ue(e,n,t){switch(e){case"vertical":return n;case"horizontal":return t;default:return n||t}}function ce(e,n){return ue(n,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function ie(e,n,t){return ue(n,"ArrowDown"===e,t?"ArrowLeft"===e:"ArrowRight"===e)||"Enter"===e||" "==e||""===e}function le(e,n){return oe(e,{disabledIndices:n})}function ae(e,n){return oe(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:n})}const se=function(e,n){let{open:r,onOpenChange:o,refs:u}=e,{listRef:c,activeIndex:i,onNavigate:a,enabled:s=!0,selectedIndex:f=null,allowEscape:d=!1,loop:v=!1,nested:m=!1,rtl:p=!1,virtual:g=!1,focusItemOnOpen:h="auto",focusItemOnHover:E=!0,openOnArrowKeyDown:w=!0,disabledIndices:x=(w?void 0:[]),orientation:R="vertical"}=void 0===n?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:n;const L=b(),I=y(),T=q(r),A=t.useRef(h),O=t.useRef(null!=f?f:-1),M=t.useRef(null),D=U(q(a)),P=U(a),S=U(x),F=t.useRef(!1),K=t.useRef(-1),[N,B]=t.useState(),H=t.useCallback(((e,n)=>{K.current=requestAnimationFrame((()=>{var t,r;g?B(null==(t=e.current[n.current])?void 0:t.id):null==(r=e.current[n.current])||r.focus({preventScroll:!0})}))}),[g]);function X(e){if(F.current=!0,m&&function(e,n,t){return ue(n,t?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(e.key,R,p))return V(e),o(!1),void(C(u.reference.current)&&u.reference.current.focus());const n=O.current,t=le(c,x),i=ae(c,x);if("Home"===e.key&&(O.current=t,a(O.current)),"End"===e.key&&(O.current=i,a(O.current)),ce(e.key,R)){if(V(e),r&&!g&&j(e.currentTarget.ownerDocument)===e.currentTarget)return O.current=ie(e.key,R,p)?t:i,void a(O.current);ie(e.key,R,p)?O.current=v?n>=i?d&&n!==c.current.length?-1:t:oe(c,{startingIndex:n,disabledIndices:x}):Math.min(i,oe(c,{startingIndex:n,disabledIndices:x})):O.current=v?n<=t?d&&-1!==n?c.current.length:i:oe(c,{startingIndex:n,decrement:!0,disabledIndices:x}):Math.max(t,oe(c,{startingIndex:n,decrement:!0,disabledIndices:x})),re(c,O.current)?a(null):a(O.current)}}return l((()=>{s&&(!T&&r&&A.current&&null!=f&&P.current(f),T&&!r&&(cancelAnimationFrame(K.current),O.current=-1,null==D.current||D.current(null)))}),[r,T,f,c,P,D,H,s]),l((()=>{if(s&&r)if(null==i){if(null!=f)return;T&&(O.current=-1,H(c,O)),!T&&A.current&&(null!=M.current||!0===A.current&&null==M.current)&&(O.current=null==M.current||ie(M.current,R,p)||m?le(c,S.current):ae(c,S.current),P.current(O.current),H(c,O))}else re(c,i)||(O.current=i,H(c,O))}),[r,T,i,f,m,c,P,H,s,d,R,p,g,S]),l((()=>{s&&!r&&T&&null!=f&&C(u.reference.current)&&u.reference.current.focus()}),[u.reference,f,r,T,s]),l((()=>{if(s&&!r&&T){var e,n;const t=null==I||null==(e=I.nodesRef.current.find((e=>e.id===L)))||null==(n=e.context)?void 0:n.refs.floating.current;t&&!t.contains(j(k(t)))&&t.focus({preventScroll:!0})}}),[s,r,T,I,L]),l((()=>{M.current=null})),s?{reference:{...g&&r&&null!=i&&{"aria-activedescendant":N},onKeyDown(e){if(F.current=!0,g&&r)return X(e);(0===e.key.indexOf("Arrow")||"Enter"===e.key||" "===e.key||""===e.key)&&(M.current=e.key),m?function(e,n,t){return ue(n,t?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(e.key,R,p)&&(V(e),r?(O.current=le(c,x),a(O.current)):o(!0)):ce(e.key,R)&&(null!=f&&(O.current=f),V(e),!r&&w?o(!0):X(e),r&&a(O.current))}},floating:{"aria-orientation":"both"===R?void 0:R,...g&&null!=i&&{"aria-activedescendant":N},onKeyDown:X,onPointerMove(){F.current=!1}},item:{onFocus(e){let{currentTarget:n}=e;const t=c.current.indexOf(n);-1!==t&&a(t)},onClick:e=>{let{currentTarget:n}=e;return n.focus({preventScroll:!0})},...E&&{onMouseMove(e){let{currentTarget:n}=e;const t=n;if(t){const e=c.current.indexOf(t);-1!==e&&a(e)}},onMouseLeave(){var e;F.current||(O.current=-1,H(c,O),P.current(null),g||null==(e=u.floating.current)||e.focus({preventScroll:!0}))}}}}:{}},fe=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=1e3,ignoreKeys:v=[],selectedIndex:m=null}=void 0===n?{listRef:{current:[]},activeIndex:null}:n;const p=t.useRef(),g=t.useRef(""),b=t.useRef(null!=(r=null!=m?m:i)?r:-1),y=t.useRef(null);function h(e){if(!e.currentTarget.contains(j(k(e.currentTarget))))return;g.current.length>0&&" "!==g.current[0]&&(u.current.typing=!0," "===e.key&&V(e));const n=c.current;if(null==n||["Home","End","Escape","Enter","Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight",...v].includes(e.key))return;n.every((e=>{var n,t;return!e||(null==(n=e[0])?void 0:n.toLocaleLowerCase())!==(null==(t=e[1])?void 0:t.toLocaleLowerCase())}))&&g.current===e.key&&(g.current="",b.current=y.current),g.current+=e.key,clearTimeout(p.current),p.current=setTimeout((()=>{g.current="",b.current=y.current,u.current.typing=!1}),d);const t=b.current,r=[...n.slice((null!=t?t:0)+1),...n.slice(0,(null!=t?t:0)+1)],o=f?f(r,g.current):r.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(g.current)))),i=o?n.indexOf(o):-1;-1!==i&&(a(i),y.current=i)}return l((()=>{o&&(clearTimeout(p.current),y.current=null,g.current="")}),[o]),l((()=>{var e;o&&""===g.current&&(b.current=null!=(e=null!=m?m:i)?e:-1)}),[o,m,i]),s?{reference:{onKeyDown:h},floating:{onKeyDown:h}}:{}};export{Q as FloatingDelayGroup,Y as FloatingFocusManager,E as FloatingNode,K as FloatingOverlay,P as FloatingPortal,w as FloatingTree,O as safePolygon,_ as useClick,Z as useDelayGroup,J as useDelayGroupContext,ne as useDismiss,x as useFloating,h as useFloatingNodeId,b as useFloatingParentNodeId,D as useFloatingPortalNode,y as useFloatingTree,te as useFocus,z as useHover,m as useId,L as useInteractions,se as useListNavigation,$ as useRole,fe as useTypeahead};

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@floating-ui/react-dom"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","@floating-ui/react-dom","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIReactDOM={},e.FloatingUIReactDOM,e.React,e.ReactDOM)}(this,(function(e,t,n,r){"use strict";function o(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 u=o(n),c="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;function i(){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 l=!1,a=0;const s=()=>"floating-ui-"+a++;const f=u["useId".toString()],d=null!=f?f:function(){const[e,t]=u.useState((()=>l?s():void 0));return c((()=>{null==e&&t(s())}),[]),u.useEffect((()=>{l||(l=!0)}),[]),e},v=u.createContext(null),m=u.createContext(null),g=()=>{var e,t;return null!=(e=null==(t=u.useContext(v))?void 0:t.id)?e:null},p=()=>u.useContext(m);function b(e,t,n){const r={};return{..."floating"===n&&{tabIndex:-1},...e,...t.map((e=>e?e[n]:null)).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,o]=t;0===n.indexOf("on")?(r[n]||(r[n]=[]),"function"==typeof o&&r[n].push(o),e[n]=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];r[n].forEach((e=>e(...t)))}):e[n]=o})),e):e),{})}}function y(e){var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document}function h(e){var t;return null!=(t=y(e).defaultView)?t:window}function E(e){return!!e&&e instanceof h(e).Element}function w(e){return!!e&&e instanceof h(e).HTMLElement}function x(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 k="floating-ui-root",R=function(e){let{id:t=k,enabled:n=!0}=void 0===e?{}:e;const r=u.useRef(null);return c((()=>{if(!n)return;const e=document.getElementById(t);e?r.current=e:(r.current=document.createElement("div"),r.current.id=t),document.body.contains(r.current)||document.body.appendChild(r.current)}),[t,n]),r.current};function I(){return I=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},I.apply(this,arguments)}const O="data-floating-ui-scroll-lock";const T=u.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return c((()=>{var e,t,r,o;if(!n)return;if(document.body.hasAttribute(O))return;document.body.setAttribute(O,"");const u=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",c=window.innerWidth-document.documentElement.clientWidth;if(!/iP(hone|ad|od)|iOS/.test(function(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}()))return Object.assign(document.body.style,{overflow:"hidden",[u]:c+"px"}),()=>{document.body.removeAttribute(O),Object.assign(document.body.style,{overflow:"",[u]:""})};const i=null!=(e=null==(t=window.visualViewport)?void 0:t.offsetLeft)?e:0,l=null!=(r=null==(o=window.visualViewport)?void 0:o.offsetTop)?r:0,a=window.pageXOffset,s=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(s-Math.floor(l))+"px",left:-(a-Math.floor(i))+"px",right:"0",[u]:c+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[u]:""}),document.body.removeAttribute(O),window.scrollTo(a,s)}}),[n]),u.createElement("div",I({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));var L=new WeakMap,C=new WeakMap,M={},A=0,P=function(e,t,n){void 0===t&&(t=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e)),void 0===n&&(n="data-aria-hidden");var r=Array.isArray(e)?e:[e];M[n]||(M[n]=new WeakMap);var o=M[n],u=[],c=new Set,i=function(e){e&&!c.has(e)&&(c.add(e),i(e.parentNode))};r.forEach(i);var l=function(e){!e||r.indexOf(e)>=0||Array.prototype.forEach.call(e.children,(function(e){if(c.has(e))l(e);else{var t=e.getAttribute("aria-hidden"),r=null!==t&&"false"!==t,i=(L.get(e)||0)+1,a=(o.get(e)||0)+1;L.set(e,i),o.set(e,a),u.push(e),1===i&&r&&C.set(e,!0),1===a&&e.setAttribute(n,"true"),r||e.setAttribute("aria-hidden","true")}}))};return l(t),c.clear(),A++,function(){u.forEach((function(e){var t=L.get(e)-1,r=o.get(e)-1;L.set(e,t),o.set(e,r),t||(C.has(e)||e.removeAttribute("aria-hidden"),C.delete(e)),r||e.removeAttribute(n)})),--A||(L=new WeakMap,L=new WeakMap,C=new WeakMap,M={})}};function D(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(r=n.shadowRoot)?void 0:r.activeElement);){var n,r;t=t.shadowRoot.activeElement}return t}function F(e){e.preventDefault(),e.stopPropagation()}function S(e){const t=n.useRef(e);return c((()=>{t.current=e})),t}function j(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const N=u.forwardRef((function(e,t){return u.createElement("span",I({},e,{ref:t,tabIndex:0,style:{position:"fixed",opacity:"0",pointerEvents:"none",outline:"0"}}))}));function K(e,t,n){return n&&"mouse"!==n?0:"number"==typeof e?e:null==e?void 0:e[t]}const W=u.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),U=()=>u.useContext(W);function q(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}function B(e){const t=n.useRef();return c((()=>{t.current=e}),[e]),t.current}const V="ArrowUp",H="ArrowDown",G="ArrowLeft",X="ArrowRight";function Y(e,t){return t<0||t>=e.current.length}function _(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o}=void 0===t?{}:t;const u=e.current;let c=n;do{var i,l;c+=r?-1:1}while(c>=0&&c<=u.length-1&&(o?o.includes(c):null==u[c]||(null==(i=u[c])?void 0:i.hasAttribute("disabled"))||"true"===(null==(l=u[c])?void 0:l.getAttribute("aria-disabled"))));return c}function z(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function J(e,t){return z(t,e===V||e===H,e===G||e===X)}function Q(e,t,n){return z(t,e===H,n?e===G:e===X)||"Enter"===e||" "==e||""===e}function Z(e,t){return _(e,{disabledIndices:t})}function $(e,t){return _(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}e.FloatingDelayGroup=e=>{let{children:t,delay:n}=e;const[r,o]=u.useState({delay:n,initialDelay:n,currentId:null}),c=u.useCallback((e=>{o((t=>({...t,currentId:e})))}),[]);return u.createElement(W.Provider,{value:u.useMemo((()=>({...r,setState:o,setCurrentId:c})),[r,o,c])},t)},e.FloatingFocusManager=function(e){let{context:{refs:t,nodeId:n,onOpenChange:r},children:o,order:c=["content"],endGuard:i=!0,preventTabbing:l=!1,initialFocus:a=0,returnFocus:s=!0,modal:f=!0}=e;const d=S(c),v=S(r),m=p(),g=u.useCallback((()=>d.current.map((e=>{return w(t.reference.current)&&"reference"===e?t.reference.current:t.floating.current&&"floating"===e?t.floating.current:"content"===e?Array.from(null!=(n=null==(r=t.floating.current)?void 0:r.querySelectorAll("input:not([type='hidden']):not([disabled]),select:not([disabled]),textarea:not([disabled]),a[href],button:not([disabled]),[tabindex],iframe,object,embed,area[href],audio[controls],video[controls],[contenteditable]:not([contenteditable='false'])"))?n:[]):null;var n,r})).flat().filter((e=>{if(e===t.floating.current||e===t.reference.current)return!0;if(w(e)){var n;return"-"!==(null!=(n=e.getAttribute("tabindex"))?n:"0")[0].trim()}}))),[d,t.floating,t.reference]),b=u.useCallback((()=>w(t.reference.current)&&"combobox"===t.reference.current.getAttribute("role")&&"INPUT"===t.reference.current.tagName),[t]);return u.useEffect((()=>{if(!f)return;const e=0===g().filter((e=>e!==t.floating.current&&e!==t.reference.current)).length;function n(n){if("Tab"===n.key){(l||e)&&F(n);const r=g(),o="composedPath"in n?n.composedPath()[0]:n.target;"reference"===d.current[0]&&o===t.reference.current&&(F(n),n.shiftKey?j(r[r.length-1]):j(r[1])),"floating"===d.current[1]&&o===t.floating.current&&n.shiftKey&&(F(n),j(r[0]))}}const r=y(t.floating.current);return r.addEventListener("keydown",n),()=>{r.removeEventListener("keydown",n)}}),[l,f,g,d,t.floating,t.reference]),u.useEffect((()=>{function e(e){var r;const o=e.relatedTarget;null!=(r=t.floating.current)&&r.contains(o)||!E(t.reference.current)||t.reference.current.contains(o)||m&&x(m,n).some((e=>{let{context:t}=e;return null==t?void 0:t.open}))||m&&x(m,n).some((e=>{var t,n;return null==(t=e.context)||null==(n=t.refs.floating.current)?void 0:n.contains(o)}))||v.current(!1)}const r=t.floating.current,o=t.reference.current;if(r&&w(o)){let t;return!f&&r.addEventListener("focusout",e),f&&(t=d.current.includes("reference")?P([o,r]):P(r)),()=>{!f&&r.removeEventListener("focusout",e),null==t||t()}}}),[n,m,f,v,d,g,a,t.floating,t.reference]),u.useEffect((()=>{if(l)return;const e=t.floating.current,n=D(y(e));var r;if("number"==typeof a)j(null!=(r=g()[a])?r:e);else if(w(null==a?void 0:a.current)){var o;j(null!=(o=a.current)?o:e)}return()=>{s&&w(n)&&j(n)}}),[l,g,a,f,s,t.floating]),u.createElement(u.Fragment,null,f&&u.createElement(N,{onFocus:e=>{if(b())return;F(e);const t=g();"reference"===c[0]?j(t[0]):j(t[t.length-1])}}),u.cloneElement(o,c.includes("floating")?{tabIndex:0}:{}),f&&i&&u.createElement(N,{onFocus:e=>{b()||(F(e),j(g()[0]))}}))},e.FloatingNode=e=>{let{children:t,id:n}=e;const r=g();return u.createElement(v.Provider,{value:u.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},e.FloatingOverlay=T,e.FloatingPortal=e=>{let{children:t,id:n=k,root:o=null}=e;const[i,l]=u.useState(!1),a=R({id:n,enabled:!o});return c((()=>{o||l(!0)}),[o]),o?r.createPortal(t,o):i&&a?r.createPortal(t,a):null},e.FloatingTree=e=>{let{children:t}=e;const n=u.useRef([]),r=u.useCallback((e=>{n.current=[...n.current,e]}),[]),o=u.useCallback((e=>{n.current=n.current.filter((t=>t!==e))}),[]),c=u.useState((()=>i()))[0];return u.createElement(m.Provider,{value:u.useMemo((()=>({nodesRef:n,addNode:r,removeNode:o,events:c})),[n,r,o,c])},t)},e.safePolygon=function(e){let t,{restMs:n=0,buffer:r=.5,debug:o=null}=void 0===e?{}:e,u=!1;return e=>{let{x:o,y:c,placement:i,refs:l,onClose:a,nodeId:s,tree:f,leave:d=!1}=e;return function(e){var v;function m(){clearTimeout(t),a()}if(clearTimeout(t),e.pointerType&&"mouse"!==e.pointerType)return;const{clientX:g,clientY:p}=e,b="composedPath"in e?e.composedPath()[0]:e.target;if("pointermove"===e.type&&E(l.reference.current)&&l.reference.current.contains(b))return;if(f&&x(f,s).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if(null!=(v=l.floating.current)&&v.contains(b)&&!d)return void(u=!0);if(!l.reference.current||!l.floating.current||null==i||null==o||null==c)return;const y=l.reference.current.getBoundingClientRect(),h=l.floating.current.getBoundingClientRect(),w=i.split("-")[0],k=o>h.right-h.width/2,R=c>h.bottom-h.height/2;if("top"===w&&c>=y.bottom-1||"bottom"===w&&c<=y.top+1||"left"===w&&o>=y.right-1||"right"===w&&o<=y.left+1)return m();switch(w){case"top":if(g>=h.left&&g<=h.right&&p>=h.top&&p<=y.top+1)return;break;case"bottom":if(g>=h.left&&g<=h.right&&p>=y.bottom-1&&p<=h.bottom)return;break;case"left":if(g>=h.left&&g<=y.left+1&&p>=h.top&&p<=h.bottom)return;break;case"right":if(g>=y.right-1&&g<=h.right&&p>=h.top&&p<=h.bottom)return}if(u)return m();const I=function(e){let[t,n]=e;const o=h.width>y.width,u=h.height>y.height;switch(w){case"top":return[[o?t+r/2:k?t+4*r:t-4*r,n+r+1],[o?t-r/2:k?t+4*r:t-4*r,n+r+1],...[[h.left,k||o?h.bottom-r:h.top],[h.right,k?o?h.bottom-r:h.top:h.bottom-r]]];case"bottom":return[[o?t+r/2:k?t+4*r:t-4*r,n-r],[o?t-r/2:k?t+4*r:t-4*r,n-r],...[[h.left,k||o?h.top+r:h.bottom],[h.right,k?o?h.top+r:h.bottom:h.top+r]]];case"left":{const e=[t+r+1,u?n+r/2:R?n+4*r:n-4*r],o=[t+r+1,u?n-r/2:R?n+4*r:n-4*r];return[...[[R||u?h.right-r:h.left,h.top],[R?u?h.right-r:h.left:h.right-r,h.bottom]],e,o]}case"right":return[[t-r,u?n+r/2:R?n+4*r:n-4*r],[t-r,u?n-r/2:R?n+4*r:n-4*r],...[[R||u?h.left+r:h.right,h.top],[R?u?h.left+r:h.right:h.left+r,h.bottom]]]}}([o,c]);!function(e,t){const[n,r]=e;let o=!1;const u=t.length;for(let e=0,c=u-1;e<u;c=e++){const[u,i]=t[e]||[0,0],[l,a]=t[c]||[0,0];i>=r!=a>=r&&n<=(l-u)*(r-i)/(a-i)+u&&(o=!o)}return o}([g,p],I)?m():n&&(t=setTimeout(a,n))}}},e.useClick=function(e,t){let{open:n,onOpenChange:r,dataRef:o,refs:c}=e,{enabled:i=!0,pointerDown:l=!1,toggle:a=!0,ignoreMouse:s=!1}=void 0===t?{}:t;const f=u.useRef();function d(){return w(c.reference.current)&&"BUTTON"===c.reference.current.tagName}return i?{reference:{onPointerDown(e){if(f.current=e.pointerType,("mouse"!==f.current||!s)&&l){var t;if(n)a&&"pointerdown"===(null==(t=o.current.openEvent)?void 0:t.type)&&r(!1);else r(!0);o.current.openEvent=e.nativeEvent}},onClick(e){if(l&&f.current)f.current=void 0;else if("mouse"!==f.current||!s){var t;if(n)a&&"click"===(null==(t=o.current.openEvent)?void 0:t.type)&&r(!1);else r(!0);o.current.openEvent=e.nativeEvent}},onKeyDown(e){f.current=void 0,d()||(" "===e.key&&e.preventDefault(),"Enter"===e.key&&(n?a&&r(!1):r(!0)))},onKeyUp(e){d()||" "===e.key&&(n?a&&r(!1):r(!0))}}}:{}},e.useDelayGroup=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:c,initialDelay:i,setState:l}=U(),a=S(r);u.useEffect((()=>{c&&a.current&&(l((e=>({...e,delay:{open:1,close:K(i,"close")}}))),c!==o&&a.current(!1))}),[o,a,l,c,i]),u.useEffect((()=>{!n&&c===o&&a.current&&(a.current(!1),l((e=>({...e,delay:i,currentId:null}))))}),[n,l,c,o,a,i])},e.useDelayGroupContext=U,e.useDismiss=function(e,n){let{open:r,onOpenChange:o,refs:c,events:i,nodeId:l}=e,{enabled:a=!0,escapeKey:s=!0,outsidePointerDown:f=!0,referencePointerDown:d=!1,ancestorScroll:v=!1,bubbles:m=!0}=void 0===n?{}:n;const g=p(),b=S(o),h=u.useCallback((()=>{var e;return null==(e=c.floating.current)?void 0:e.contains(D(y(c.floating.current)))}),[c.floating]),k=u.useCallback((()=>{w(c.reference.current)&&c.reference.current.focus()}),[c.reference]);return u.useEffect((()=>{if(!r||!a)return;function e(e){if("Escape"===e.key){if(!m&&!h())return;i.emit("dismiss"),b.current(!1),k()}}function n(e){const t=g&&x(g,l).some((t=>{var n;return q(e,null==(n=t.context)?void 0:n.refs.floating.current)}));q(e,c.floating.current)||E(c.reference.current)&&q(e,c.reference.current)||t||(m||h())&&(i.emit("dismiss"),b.current(!1),k())}function o(){b.current(!1)}const u=y(c.floating.current);s&&u.addEventListener("keydown",e),f&&u.addEventListener("mousedown",n);const d=(v?[...E(c.reference.current)?t.getOverflowAncestors(c.reference.current):[],...E(c.floating.current)?t.getOverflowAncestors(c.floating.current):[]]:[]).filter((e=>{var t;return e!==(null==(t=u.defaultView)?void 0:t.visualViewport)}));return d.forEach((e=>e.addEventListener("scroll",o,{passive:!0}))),()=>{s&&u.removeEventListener("keydown",e),f&&u.removeEventListener("mousedown",n),d.forEach((e=>e.removeEventListener("scroll",o)))}}),[s,f,i,g,l,r,b,k,v,a,m,h,c.floating,c.reference]),a?{reference:{onPointerDown(){d&&(i.emit("dismiss"),o(!1))}}}:{}},e.useFloating=function(e){let{open:n=!1,onOpenChange:r=(()=>{}),whileElementsMounted:o,placement:l,middleware:a,strategy:s,nodeId:f}=void 0===e?{}:e;const d=p(),v=u.useRef({}),m=u.useState((()=>i()))[0],g=t.useFloating({placement:l,middleware:a,strategy:s,whileElementsMounted:o}),b=u.useMemo((()=>({...g,dataRef:v,nodeId:f,events:m,open:n,onOpenChange:r})),[g,v,f,m,n,r]);return c((()=>{const e=null==d?void 0:d.nodesRef.current.find((e=>e.id===f));e&&(e.context=b)})),u.useMemo((()=>({context:b,...g})),[g,b])},e.useFloatingNodeId=()=>{const e=d(),t=p(),n=g();return c((()=>{const r={id:e,parentId:n};return null==t||t.addNode(r),()=>{null==t||t.removeNode(r)}}),[t,e,n]),e},e.useFloatingParentNodeId=g,e.useFloatingPortalNode=R,e.useFloatingTree=p,e.useFocus=function(e,t){let{open:n,onOpenChange:r,dataRef:o,refs:c,events:i}=e,{enabled:l=!0,keyboardOnly:a=!0}=void 0===t?{}:t;const s=u.useRef(""),f=u.useRef(!1);return u.useEffect((()=>{var e;if(!l)return;const t=null!=(e=y(c.floating.current).defaultView)?e:window;function r(){s.current&&(f.current=!n)}function o(){setTimeout((()=>{f.current=!1,s.current=""}))}return t.addEventListener("focus",o),t.addEventListener("blur",r),()=>{t.removeEventListener("focus",o),t.removeEventListener("blur",r)}}),[c.floating,n,l]),u.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;s.current=t,f.current=!(!t||!a)},onFocus(e){var t,n,u;f.current||"focus"===e.type&&"mousedown"===(null==(t=o.current.openEvent)?void 0:t.type)&&E(c.reference.current)&&null!=(n=c.reference.current)&&n.contains(null==(u=o.current.openEvent)?void 0:u.target)||(o.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){var t;const n=e.relatedTarget;null!=(t=c.floating.current)&&t.contains(n)||E(c.reference.current)&&c.reference.current.contains(n)||(f.current=!1,r(!1))}}}:{}},e.useHover=function(e,t){let{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:i=!1,restMs:l=0}=void 0===t?{}:t;const{open:a,onOpenChange:s,dataRef:f,events:d,refs:v}=e,m=p(),g=S(s),b=S(o),h=u.useRef(),w=u.useRef(),x=u.useRef(),k=u.useRef(),R=u.useRef(!0);u.useEffect((()=>{if(n)return d.on("dismiss",e),()=>{d.off("dismiss",e)};function e(){clearTimeout(w.current),clearTimeout(k.current),R.current=!0}}),[n,d,v.floating]),u.useEffect((()=>{if(!n||!b.current)return;function e(){var e;null!=(e=f.current.openEvent)&&e.type.includes("mouse")&&g.current(!1)}const t=y(v.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[v.floating,g,n,b,f]);const I=u.useCallback((function(e){void 0===e&&(e=!0);const t=K(r,"close",h.current);t&&!x.current?(clearTimeout(w.current),w.current=setTimeout((()=>g.current(!1)),t)):e&&g.current(!1)}),[r,g]),O=u.useCallback((()=>{x.current&&(y(v.floating.current).removeEventListener("pointermove",x.current),x.current=void 0)}),[v.floating]);if(u.useEffect((()=>{if(!n)return;function t(e){if(clearTimeout(w.current),R.current=!1,a||i&&"mouse"!==h.current||l>0&&0===K(r,"open"))return;f.current.openEvent=e;const t=K(r,"open",h.current);t?w.current=setTimeout((()=>{g.current(!0)}),t):g.current(!0)}function o(t){var n,r;if("click"===(null==(n=f.current.openEvent)?void 0:n.type)||"pointerdown"===(null==(r=f.current.openEvent)?void 0:r.type))return;const o=y(v.floating.current);if(clearTimeout(k.current),b.current)return clearTimeout(w.current),x.current&&o.removeEventListener("pointermove",x.current),x.current=b.current({...e,tree:m,x:t.clientX,y:t.clientY,onClose(){O(),I()}}),void o.addEventListener("pointermove",x.current);I()}function u(t){null==b.current||b.current({...e,tree:m,x:t.clientX,y:t.clientY,leave:!0,onClose(){O(),I()}})(t)}const c=v.floating.current,s=v.reference.current;return E(s)?(a&&s.addEventListener("pointerleave",u),null==c||c.addEventListener("pointerleave",u),s.addEventListener("mousemove",t,{once:!0}),s.addEventListener("mouseenter",t),s.addEventListener("mouseleave",o),()=>{a&&s.removeEventListener("pointerleave",u),null==c||c.removeEventListener("pointerleave",u),s.removeEventListener("mousemove",t),s.removeEventListener("mouseenter",t),s.removeEventListener("mouseleave",o)}):void 0}),[n,I,e,r,b,f,i,g,a,m,l,O,v.reference,v.floating]),c((()=>{a||(h.current=void 0,O())})),u.useEffect((()=>()=>{O(),clearTimeout(w.current),clearTimeout(k.current)}),[O]),!n)return{};function T(e){h.current=e.pointerType}return{reference:{onPointerDown:T,onPointerEnter:T,onMouseMove(){a||0===l||(clearTimeout(k.current),k.current=setTimeout((()=>{R.current||s(!0)}),l))}},floating:{onMouseEnter(){clearTimeout(w.current)},onMouseLeave(){I(!1)}}}},e.useId=d,e.useInteractions=function(e){return void 0===e&&(e=[]),{getReferenceProps:t=>b(t,e,"reference"),getFloatingProps:t=>b(t,e,"floating"),getItemProps:t=>b(t,e,"item")}},e.useListNavigation=function(e,t){let{open:n,onOpenChange:r,refs:o}=e,{listRef:i,activeIndex:l,onNavigate:a,enabled:s=!0,selectedIndex:f=null,allowEscape:d=!1,loop:v=!1,nested:m=!1,rtl:b=!1,virtual:h=!1,focusItemOnOpen:E="auto",focusItemOnHover:x=!0,openOnArrowKeyDown:k=!0,disabledIndices:R=(k?void 0:[]),orientation:I="vertical"}=void 0===t?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:t;const O=g(),T=p(),L=B(n),C=u.useRef(E),M=u.useRef(null!=f?f:-1),A=u.useRef(null),P=S(B(a)),j=S(a),N=S(R),K=u.useRef(!1),W=u.useRef(-1),[U,q]=u.useState(),ee=u.useCallback(((e,t)=>{W.current=requestAnimationFrame((()=>{var n,r;h?q(null==(n=e.current[t.current])?void 0:n.id):null==(r=e.current[t.current])||r.focus({preventScroll:!0})}))}),[h]);function te(e){if(K.current=!0,m&&function(e,t,n){return z(t,n?e===X:e===G,e===V)}(e.key,I,b))return F(e),r(!1),void(w(o.reference.current)&&o.reference.current.focus());const t=M.current,u=Z(i,R),c=$(i,R);if("Home"===e.key&&(M.current=u,a(M.current)),"End"===e.key&&(M.current=c,a(M.current)),J(e.key,I)){if(F(e),n&&!h&&D(e.currentTarget.ownerDocument)===e.currentTarget)return M.current=Q(e.key,I,b)?u:c,void a(M.current);Q(e.key,I,b)?M.current=v?t>=c?d&&t!==i.current.length?-1:u:_(i,{startingIndex:t,disabledIndices:R}):Math.min(c,_(i,{startingIndex:t,disabledIndices:R})):M.current=v?t<=u?d&&-1!==t?i.current.length:c:_(i,{startingIndex:t,decrement:!0,disabledIndices:R}):Math.max(u,_(i,{startingIndex:t,decrement:!0,disabledIndices:R})),Y(i,M.current)?a(null):a(M.current)}}return c((()=>{s&&(!L&&n&&C.current&&null!=f&&j.current(f),L&&!n&&(cancelAnimationFrame(W.current),M.current=-1,null==P.current||P.current(null)))}),[n,L,f,i,j,P,ee,s]),c((()=>{if(s&&n)if(null==l){if(null!=f)return;L&&(M.current=-1,ee(i,M)),!L&&C.current&&(null!=A.current||!0===C.current&&null==A.current)&&(M.current=null==A.current||Q(A.current,I,b)||m?Z(i,N.current):$(i,N.current),j.current(M.current),ee(i,M))}else Y(i,l)||(M.current=l,ee(i,M))}),[n,L,l,f,m,i,j,ee,s,d,I,b,h,N]),c((()=>{s&&!n&&L&&null!=f&&w(o.reference.current)&&o.reference.current.focus()}),[o.reference,f,n,L,s]),c((()=>{if(s&&!n&&L){var e,t;const n=null==T||null==(e=T.nodesRef.current.find((e=>e.id===O)))||null==(t=e.context)?void 0:t.refs.floating.current;n&&!n.contains(D(y(n)))&&n.focus({preventScroll:!0})}}),[s,n,L,T,O]),c((()=>{A.current=null})),s?{reference:{...h&&n&&null!=l&&{"aria-activedescendant":U},onKeyDown(e){if(K.current=!0,h&&n)return te(e);(0===e.key.indexOf("Arrow")||"Enter"===e.key||" "===e.key||""===e.key)&&(A.current=e.key),m?function(e,t,n){return z(t,n?e===G:e===X,e===H)}(e.key,I,b)&&(F(e),n?(M.current=Z(i,R),a(M.current)):r(!0)):J(e.key,I)&&(null!=f&&(M.current=f),F(e),!n&&k?r(!0):te(e),n&&a(M.current))}},floating:{"aria-orientation":"both"===I?void 0:I,...h&&null!=l&&{"aria-activedescendant":U},onKeyDown:te,onPointerMove(){K.current=!1}},item:{onFocus(e){let{currentTarget:t}=e;const n=i.current.indexOf(t);-1!==n&&a(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...x&&{onMouseMove(e){let{currentTarget:t}=e;const n=t;if(n){const e=i.current.indexOf(n);-1!==e&&a(e)}},onMouseLeave(){var e;K.current||(M.current=-1,ee(i,M),j.current(null),h||null==(e=o.floating.current)||e.focus({preventScroll:!0}))}}}}:{}},e.useRole=function(e,t){let{open:n}=e,{enabled:r=!0,role:o="dialog"}=void 0===t?{}:t;const u=d(),c=d(),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,t){var n;let{open:r,dataRef:o}=e,{listRef:i,activeIndex:l,onMatch:a=(()=>{}),enabled:s=!0,findMatch:f=null,resetMs:d=1e3,ignoreKeys:v=[],selectedIndex:m=null}=void 0===t?{listRef:{current:[]},activeIndex:null}:t;const g=u.useRef(),p=u.useRef(""),b=u.useRef(null!=(n=null!=m?m:l)?n:-1),h=u.useRef(null);function E(e){if(!e.currentTarget.contains(D(y(e.currentTarget))))return;p.current.length>0&&" "!==p.current[0]&&(o.current.typing=!0," "===e.key&&F(e));const t=i.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.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&p.current===e.key&&(p.current="",b.current=h.current),p.current+=e.key,clearTimeout(g.current),g.current=setTimeout((()=>{p.current="",b.current=h.current,o.current.typing=!1}),d);const n=b.current,r=[...t.slice((null!=n?n:0)+1),...t.slice(0,(null!=n?n:0)+1)],u=f?f(r,p.current):r.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(p.current)))),c=u?t.indexOf(u):-1;-1!==c&&(a(c),h.current=c)}return c((()=>{r&&(clearTimeout(g.current),h.current=null,p.current="")}),[r]),c((()=>{var e;r&&""===p.current&&(b.current=null!=(e=null!=m?m:l)?e:-1)}),[r,m,l]),s?{reference:{onKeyDown:E},floating:{onKeyDown:E}}:{}},Object.keys(t).forEach((function(n){"default"===n||e.hasOwnProperty(n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})),Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@floating-ui/react-dom"),require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","@floating-ui/react-dom","react","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).FloatingUIReactDOM={},e.FloatingUIReactDOM,e.React,e.ReactDOM)}(this,(function(e,t,n,r){"use strict";function o(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 u=o(n),c="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;function i(){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 l=!1,a=0;const s=()=>"floating-ui-"+a++;const f=u["useId".toString()],d=null!=f?f:function(){const[e,t]=u.useState((()=>l?s():void 0));return c((()=>{null==e&&t(s())}),[]),u.useEffect((()=>{l||(l=!0)}),[]),e},v=u.createContext(null),m=u.createContext(null),p=()=>{var e,t;return null!=(e=null==(t=u.useContext(v))?void 0:t.id)?e:null},g=()=>u.useContext(m);function b(e,t,n){const r={};return{..."floating"===n&&{tabIndex:-1},...e,...t.map((e=>e?e[n]:null)).concat(e).reduce(((e,t)=>t?(Object.entries(t).forEach((t=>{let[n,o]=t;0===n.indexOf("on")?(r[n]||(r[n]=[]),"function"==typeof o&&r[n].push(o),e[n]=function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];r[n].forEach((e=>e(...t)))}):e[n]=o})),e):e),{})}}function y(e){var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document}function h(e){var t;return null!=(t=y(e).defaultView)?t:window}function E(e){return!!e&&e instanceof h(e).Element}function w(e){return!!e&&e instanceof h(e).HTMLElement}function x(e,t){var n;let r=null!=(n=e.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=e.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 k="floating-ui-root",R=function(e){let{id:t=k,enabled:n=!0}=void 0===e?{}:e;const[r,o]=u.useState(null);return c((()=>{if(!n)return;const e=document.getElementById(t);if(e)o(e);else{const e=document.createElement("div");e.id=t,o(e),document.body.contains(e)||document.body.appendChild(e)}}),[t,n]),r};function I(){return I=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},I.apply(this,arguments)}const O="data-floating-ui-scroll-lock";const T=u.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return c((()=>{var e,t,r,o;if(!n)return;if(document.body.hasAttribute(O))return;document.body.setAttribute(O,"");const u=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",c=window.innerWidth-document.documentElement.clientWidth;if(!/iP(hone|ad|od)|iOS/.test(function(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}()))return Object.assign(document.body.style,{overflow:"hidden",[u]:c+"px"}),()=>{document.body.removeAttribute(O),Object.assign(document.body.style,{overflow:"",[u]:""})};const i=null!=(e=null==(t=window.visualViewport)?void 0:t.offsetLeft)?e:0,l=null!=(r=null==(o=window.visualViewport)?void 0:o.offsetTop)?r:0,a=window.pageXOffset,s=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(s-Math.floor(l))+"px",left:-(a-Math.floor(i))+"px",right:"0",[u]:c+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[u]:""}),document.body.removeAttribute(O),window.scrollTo(a,s)}}),[n]),u.createElement("div",I({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));var L=new WeakMap,C=new WeakMap,M={},A=0,P=function(e,t,n){void 0===t&&(t=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e)),void 0===n&&(n="data-aria-hidden");var r=Array.isArray(e)?e:[e];M[n]||(M[n]=new WeakMap);var o=M[n],u=[],c=new Set,i=function(e){e&&!c.has(e)&&(c.add(e),i(e.parentNode))};r.forEach(i);var l=function(e){!e||r.indexOf(e)>=0||Array.prototype.forEach.call(e.children,(function(e){if(c.has(e))l(e);else{var t=e.getAttribute("aria-hidden"),r=null!==t&&"false"!==t,i=(L.get(e)||0)+1,a=(o.get(e)||0)+1;L.set(e,i),o.set(e,a),u.push(e),1===i&&r&&C.set(e,!0),1===a&&e.setAttribute(n,"true"),r||e.setAttribute("aria-hidden","true")}}))};return l(t),c.clear(),A++,function(){u.forEach((function(e){var t=L.get(e)-1,r=o.get(e)-1;L.set(e,t),o.set(e,r),t||(C.has(e)||e.removeAttribute("aria-hidden"),C.delete(e)),r||e.removeAttribute(n)})),--A||(L=new WeakMap,L=new WeakMap,C=new WeakMap,M={})}};function D(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(r=n.shadowRoot)?void 0:r.activeElement);){var n,r;t=t.shadowRoot.activeElement}return t}const F="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function S(e){return w(e)&&e.matches(F)}function j(e){e.preventDefault(),e.stopPropagation()}function N(e){const t=n.useRef(e);return c((()=>{t.current=e})),t}function K(e){requestAnimationFrame((()=>{null==e||e.focus()}))}const W=u.forwardRef((function(e,t){return u.createElement("span",I({},e,{ref:t,tabIndex:0,style:{position:"fixed",opacity:"0",pointerEvents:"none",outline:"0"}}))}));function q(e){const t=n.useRef();return c((()=>{t.current=e}),[e]),t.current}function B(e,t,n){return n&&"mouse"!==n?0:"number"==typeof e?e:null==e?void 0:e[t]}const U=u.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),V=()=>u.useContext(U);function H(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}const G="ArrowUp",X="ArrowDown",Y="ArrowLeft",_="ArrowRight";function z(e,t){return t<0||t>=e.current.length}function J(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o}=void 0===t?{}:t;const u=e.current;let c=n;do{var i,l;c+=r?-1:1}while(c>=0&&c<=u.length-1&&(o?o.includes(c):null==u[c]||(null==(i=u[c])?void 0:i.hasAttribute("disabled"))||"true"===(null==(l=u[c])?void 0:l.getAttribute("aria-disabled"))));return c}function Q(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Z(e,t){return Q(t,e===G||e===X,e===Y||e===_)}function $(e,t,n){return Q(t,e===X,n?e===Y:e===_)||"Enter"===e||" "==e||""===e}function ee(e,t){return J(e,{disabledIndices:t})}function te(e,t){return J(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}e.FloatingDelayGroup=e=>{let{children:t,delay:n}=e;const[r,o]=u.useState({delay:n,initialDelay:n,currentId:null}),c=u.useCallback((e=>{o((t=>({...t,currentId:e})))}),[]);return u.createElement(U.Provider,{value:u.useMemo((()=>({...r,setState:o,setCurrentId:c})),[r,o,c])},t)},e.FloatingFocusManager=function(e){let{context:{refs:t,nodeId:n,onOpenChange:r},children:o,order:c=["content"],endGuard:i=!0,preventTabbing:l=!1,initialFocus:a=0,returnFocus:s=!0,modal:f=!0}=e;const d=N(c),v=N(r),m=g(),p=u.useCallback((()=>d.current.map((e=>{return w(t.reference.current)&&"reference"===e?t.reference.current:t.floating.current&&"floating"===e?t.floating.current:"content"===e?Array.from(null!=(n=null==(r=t.floating.current)?void 0:r.querySelectorAll("select:not([disabled]),a[href],button:not([disabled]),[tabindex],iframe,object,embed,area[href],audio[controls],video[controls],input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"))?n:[]):null;var n,r})).flat().filter((e=>{if(e===t.floating.current||e===t.reference.current)return!0;if(w(e)){var n;return"-"!==(null!=(n=e.getAttribute("tabindex"))?n:"0")[0].trim()}}))),[d,t]);u.useEffect((()=>{if(!f)return;const e=0===p().filter((e=>e!==t.floating.current&&e!==t.reference.current)).length;function n(n){if("Tab"===n.key){(l||e)&&j(n);const r=p(),o="composedPath"in n?n.composedPath()[0]:n.target;"reference"===d.current[0]&&o===t.reference.current&&(j(n),n.shiftKey?K(r[r.length-1]):K(r[1])),"floating"===d.current[1]&&o===t.floating.current&&n.shiftKey&&(j(n),K(r[0]))}}const r=y(t.floating.current);return r.addEventListener("keydown",n),()=>{r.removeEventListener("keydown",n)}}),[l,f,p,d,t]),u.useEffect((()=>{function e(e){var r,o;const u=e.relatedTarget,c=!(null!=(r=t.floating.current)&&r.contains(u)),i=E(t.reference.current)&&!t.reference.current.contains(u),l=m&&x(m.nodesRef.current,n).length>0,a=m&&e.currentTarget===t.reference.current&&(null==(o=function(e,t){var n;let r=[],o=null==(n=e.find((e=>e.id===t)))?void 0:n.parentId;for(;o;){const t=e.find((e=>e.id===o));o=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}(m.nodesRef.current,n))?void 0:o.some((e=>{var t,n;return null==(t=e.context)||null==(n=t.refs.floating.current)?void 0:n.contains(u)})));c&&i&&!l&&!a&&v.current(!1)}const r=t.floating.current,o=t.reference.current;if(r&&w(o)){let t;return!f&&r.addEventListener("focusout",e),!f&&o.addEventListener("focusout",e),f&&(t=d.current.includes("reference")?P([o,r]):P(r)),()=>{!f&&r.removeEventListener("focusout",e),!f&&o.removeEventListener("focusout",e),null==t||t()}}}),[n,m,f,v,d,p,t]),u.useEffect((()=>{if(l)return;const e=t.floating.current,n=D(y(e));var r;if("number"==typeof a)K(null!=(r=p()[a])?r:e);else if(w(null==a?void 0:a.current)){var o;K(null!=(o=a.current)?o:e)}return()=>{s&&w(n)&&K(n)}}),[l,p,a,s,t]);const b=()=>w(t.reference.current)&&"combobox"===t.reference.current.getAttribute("role")&&S(t.reference.current);return u.createElement(u.Fragment,null,f&&u.createElement(W,{onFocus:e=>{if(b())return;j(e);const t=p();"reference"===c[0]?K(t[0]):K(t[t.length-1])}}),u.cloneElement(o,c.includes("floating")?{tabIndex:0}:{}),f&&i&&u.createElement(W,{onFocus:e=>{b()||(j(e),K(p()[0]))}}))},e.FloatingNode=e=>{let{children:t,id:n}=e;const r=p();return u.createElement(v.Provider,{value:u.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},e.FloatingOverlay=T,e.FloatingPortal=e=>{let{children:t,id:n=k,root:o=null}=e;const u=R({id:n,enabled:!o});return o?r.createPortal(t,o):u?r.createPortal(t,u):null},e.FloatingTree=e=>{let{children:t}=e;const n=u.useRef([]),r=u.useCallback((e=>{n.current=[...n.current,e]}),[]),o=u.useCallback((e=>{n.current=n.current.filter((t=>t!==e))}),[]),c=u.useState((()=>i()))[0];return u.createElement(m.Provider,{value:u.useMemo((()=>({nodesRef:n,addNode:r,removeNode:o,events:c})),[n,r,o,c])},t)},e.safePolygon=function(e){let t,{restMs:n=0,buffer:r=.5,debug:o=null}=void 0===e?{}:e,u=!1;return e=>{let{x:o,y:c,placement:i,refs:l,onClose:a,nodeId:s,tree:f,leave:d=!1}=e;return function(e){var v;function m(){clearTimeout(t),a()}if(clearTimeout(t),e.pointerType&&"mouse"!==e.pointerType)return;const{clientX:p,clientY:g}=e,b="composedPath"in e?e.composedPath()[0]:e.target;if("pointermove"===e.type&&E(l.reference.current)&&l.reference.current.contains(b))return;if(f&&x(f.nodesRef.current,s).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if(null!=(v=l.floating.current)&&v.contains(b)&&!d)return void(u=!0);if(!l.reference.current||!l.floating.current||null==i||null==o||null==c)return;const y=l.reference.current.getBoundingClientRect(),h=l.floating.current.getBoundingClientRect(),w=i.split("-")[0],k=o>h.right-h.width/2,R=c>h.bottom-h.height/2;if("top"===w&&c>=y.bottom-1||"bottom"===w&&c<=y.top+1||"left"===w&&o>=y.right-1||"right"===w&&o<=y.left+1)return m();switch(w){case"top":if(p>=h.left&&p<=h.right&&g>=h.top&&g<=y.top+1)return;break;case"bottom":if(p>=h.left&&p<=h.right&&g>=y.bottom-1&&g<=h.bottom)return;break;case"left":if(p>=h.left&&p<=y.left+1&&g>=h.top&&g<=h.bottom)return;break;case"right":if(p>=y.right-1&&p<=h.right&&g>=h.top&&g<=h.bottom)return}if(u)return m();const I=function(e){let[t,n]=e;const o=h.width>y.width,u=h.height>y.height;switch(w){case"top":return[[o?t+r/2:k?t+4*r:t-4*r,n+r+1],[o?t-r/2:k?t+4*r:t-4*r,n+r+1],...[[h.left,k||o?h.bottom-r:h.top],[h.right,k?o?h.bottom-r:h.top:h.bottom-r]]];case"bottom":return[[o?t+r/2:k?t+4*r:t-4*r,n-r],[o?t-r/2:k?t+4*r:t-4*r,n-r],...[[h.left,k||o?h.top+r:h.bottom],[h.right,k?o?h.top+r:h.bottom:h.top+r]]];case"left":{const e=[t+r+1,u?n+r/2:R?n+4*r:n-4*r],o=[t+r+1,u?n-r/2:R?n+4*r:n-4*r];return[...[[R||u?h.right-r:h.left,h.top],[R?u?h.right-r:h.left:h.right-r,h.bottom]],e,o]}case"right":return[[t-r,u?n+r/2:R?n+4*r:n-4*r],[t-r,u?n-r/2:R?n+4*r:n-4*r],...[[R||u?h.left+r:h.right,h.top],[R?u?h.left+r:h.right:h.left+r,h.bottom]]]}}([o,c]);!function(e,t){const[n,r]=e;let o=!1;const u=t.length;for(let e=0,c=u-1;e<u;c=e++){const[u,i]=t[e]||[0,0],[l,a]=t[c]||[0,0];i>=r!=a>=r&&n<=(l-u)*(r-i)/(a-i)+u&&(o=!o)}return o}([p,g],I)?m():n&&(t=setTimeout(a,n))}}},e.useClick=function(e,t){let{open:n,onOpenChange:r,dataRef:o,refs:c}=e,{enabled:i=!0,pointerDown:l=!1,toggle:a=!0,ignoreMouse:s=!1}=void 0===t?{}:t;const f=u.useRef();function d(){return w(c.reference.current)&&"BUTTON"===c.reference.current.tagName}function v(){return S(c.reference.current)}return i?{reference:{onPointerDown(e){if(0===e.button&&(f.current=e.pointerType,("mouse"!==f.current||!s)&&l)){var t;if(n)a&&"pointerdown"===(null==(t=o.current.openEvent)?void 0:t.type)&&r(!1);else r(!0);o.current.openEvent=e.nativeEvent}},onClick(e){if(l&&f.current)f.current=void 0;else if("mouse"!==f.current||!s){var t;if(n)a&&"click"===(null==(t=o.current.openEvent)?void 0:t.type)&&r(!1);else r(!0);o.current.openEvent=e.nativeEvent}},onKeyDown(e){f.current=void 0,d()||(" "!==e.key||v()||e.preventDefault(),"Enter"===e.key&&(n?a&&r(!1):r(!0)))},onKeyUp(e){d()||v()||" "===e.key&&(n?a&&r(!1):r(!0))}}}:{}},e.useDelayGroup=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:c,initialDelay:i,setState:l}=V(),a=N(r);u.useEffect((()=>{c&&a.current&&(l((e=>({...e,delay:{open:1,close:B(i,"close")}}))),c!==o&&a.current(!1))}),[o,a,l,c,i]),u.useEffect((()=>{!n&&c===o&&a.current&&(a.current(!1),l((e=>({...e,delay:i,currentId:null}))))}),[n,l,c,o,a,i])},e.useDelayGroupContext=V,e.useDismiss=function(e,n){let{open:r,onOpenChange:o,refs:c,events:i,nodeId:l}=e,{enabled:a=!0,escapeKey:s=!0,outsidePointerDown:f=!0,referencePointerDown:d=!1,ancestorScroll:v=!1,bubbles:m=!0}=void 0===n?{}:n;const p=g(),b=N(o),h=u.useCallback((()=>{var e;return null==(e=c.floating.current)?void 0:e.contains(D(y(c.floating.current)))}),[c.floating]),k=u.useCallback((()=>{w(c.reference.current)&&c.reference.current.focus()}),[c.reference]);return u.useEffect((()=>{if(!r||!a)return;function e(e){if("Escape"===e.key){if(!m&&!h())return;i.emit("dismiss"),b.current(!1),k()}}function n(e){const t=p&&x(p.nodesRef.current,l).some((t=>{var n;return H(e,null==(n=t.context)?void 0:n.refs.floating.current)}));H(e,c.floating.current)||E(c.reference.current)&&H(e,c.reference.current)||t||(m||h())&&(i.emit("dismiss"),b.current(!1),k())}function o(){b.current(!1)}const u=y(c.floating.current);s&&u.addEventListener("keydown",e),f&&u.addEventListener("mousedown",n);const d=(v?[...E(c.reference.current)?t.getOverflowAncestors(c.reference.current):[],...E(c.floating.current)?t.getOverflowAncestors(c.floating.current):[]]:[]).filter((e=>{var t;return e!==(null==(t=u.defaultView)?void 0:t.visualViewport)}));return d.forEach((e=>e.addEventListener("scroll",o,{passive:!0}))),()=>{s&&u.removeEventListener("keydown",e),f&&u.removeEventListener("mousedown",n),d.forEach((e=>e.removeEventListener("scroll",o)))}}),[s,f,i,p,l,r,b,k,v,a,m,h,c.floating,c.reference]),a?{reference:{onPointerDown(){d&&(i.emit("dismiss"),o(!1))}}}:{}},e.useFloating=function(e){let{open:n=!1,onOpenChange:r=(()=>{}),whileElementsMounted:o,placement:l,middleware:a,strategy:s,nodeId:f}=void 0===e?{}:e;const d=g(),v=u.useRef({}),m=u.useState((()=>i()))[0],p=t.useFloating({placement:l,middleware:a,strategy:s,whileElementsMounted:o}),b=u.useMemo((()=>({...p,dataRef:v,nodeId:f,events:m,open:n,onOpenChange:r})),[p,v,f,m,n,r]);return c((()=>{const e=null==d?void 0:d.nodesRef.current.find((e=>e.id===f));e&&(e.context=b)})),u.useMemo((()=>({context:b,...p})),[p,b])},e.useFloatingNodeId=()=>{const e=d(),t=g(),n=p();return c((()=>{const r={id:e,parentId:n};return null==t||t.addNode(r),()=>{null==t||t.removeNode(r)}}),[t,e,n]),e},e.useFloatingParentNodeId=p,e.useFloatingPortalNode=R,e.useFloatingTree=g,e.useFocus=function(e,t){let{open:n,onOpenChange:r,dataRef:o,refs:c,events:i}=e,{enabled:l=!0,keyboardOnly:a=!0}=void 0===t?{}:t;const s=u.useRef(""),f=u.useRef(!1);return u.useEffect((()=>{var e;if(!l)return;const t=y(c.floating.current),r=null!=(e=t.defaultView)?e:window;function o(){s.current&&c.reference.current===D(t)&&(f.current=!n)}function u(){setTimeout((()=>{f.current=!1,s.current=""}))}return r.addEventListener("focus",u),r.addEventListener("blur",o),()=>{r.removeEventListener("focus",u),r.removeEventListener("blur",o)}}),[c,n,l]),u.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;s.current=t,f.current=!(!t||!a)},onFocus(e){var t,n,u;f.current||"focus"===e.type&&"mousedown"===(null==(t=o.current.openEvent)?void 0:t.type)&&E(c.reference.current)&&null!=(n=c.reference.current)&&n.contains(null==(u=o.current.openEvent)?void 0:u.target)||(o.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){var t;const n=e.relatedTarget;null!=(t=c.floating.current)&&t.contains(n)||E(c.reference.current)&&c.reference.current.contains(n)||(f.current=!1,r(!1))}}}:{}},e.useHover=function(e,t){let{enabled:n=!0,delay:r=0,handleClose:o=null,mouseOnly:i=!1,restMs:l=0}=void 0===t?{}:t;const{open:a,onOpenChange:s,dataRef:f,events:d,refs:v}=e,m=g(),b=p(),h=N(s),x=N(o),k=q(a),R=u.useRef(),I=u.useRef(),O=u.useRef(),T=u.useRef(),L=u.useRef(!0),C=u.useRef(!1);u.useEffect((()=>{if(n)return d.on("dismiss",e),()=>{d.off("dismiss",e)};function e(){clearTimeout(I.current),clearTimeout(T.current),L.current=!0}}),[n,d,v]),u.useEffect((()=>{if(!n||!x.current)return;function e(){var e;null!=(e=f.current.openEvent)&&e.type.includes("mouse")&&h.current(!1)}const t=y(v.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[v,h,n,x,f]);const M=u.useCallback((function(e){void 0===e&&(e=!0);const t=B(r,"close",R.current);t&&!O.current?(clearTimeout(I.current),I.current=setTimeout((()=>h.current(!1)),t)):e&&h.current(!1)}),[r,h]),A=u.useCallback((()=>{O.current&&(y(v.floating.current).removeEventListener("pointermove",O.current),O.current=void 0)}),[v]),P=u.useCallback((()=>{y(v.floating.current).body.style.pointerEvents="",C.current=!1}),[v]);if(u.useEffect((()=>{if(!n)return;function t(e){if(clearTimeout(I.current),L.current=!1,a||i&&"mouse"!==R.current||l>0&&0===B(r,"open"))return;f.current.openEvent=e;const t=B(r,"open",R.current);t?I.current=setTimeout((()=>{h.current(!0)}),t):h.current(!0)}function o(t){var n,r;if("click"===(null==(n=f.current.openEvent)?void 0:n.type)||"pointerdown"===(null==(r=f.current.openEvent)?void 0:r.type))return;const o=y(v.floating.current);if(clearTimeout(T.current),x.current)return clearTimeout(I.current),O.current&&o.removeEventListener("pointermove",O.current),O.current=x.current({...e,tree:m,x:t.clientX,y:t.clientY,onClose(){A(),M()}}),void o.addEventListener("pointermove",O.current);M()}function u(t){null==x.current||x.current({...e,tree:m,x:t.clientX,y:t.clientY,leave:!0,onClose(){A(),M()}})(t)}const c=v.floating.current,s=v.reference.current;return E(s)?(a&&s.addEventListener("pointerleave",u),null==c||c.addEventListener("pointerleave",u),s.addEventListener("mousemove",t,{once:!0}),s.addEventListener("mouseenter",t),s.addEventListener("mouseleave",o),()=>{a&&s.removeEventListener("pointerleave",u),null==c||c.removeEventListener("pointerleave",u),s.removeEventListener("mousemove",t),s.removeEventListener("mouseenter",t),s.removeEventListener("mouseleave",o)}):void 0}),[n,M,e,r,x,f,i,h,a,m,l,A,v]),c((()=>{if(n&&a&&x.current){y(v.floating.current).body.style.pointerEvents="none",C.current=!0;const n=w(v.reference.current)&&v.reference.current,r=v.floating.current;if(n&&r){var e,t;const o=null==m||null==(e=m.nodesRef.current.find((e=>e.id===b)))||null==(t=e.context)?void 0:t.refs.floating.current;return o&&(o.style.pointerEvents=""),n.style.pointerEvents="auto",r.style.pointerEvents="auto",()=>{n.style.pointerEvents="",r.style.pointerEvents=""}}}}),[n,a,b,v,m,x]),c((()=>{k&&!a&&(R.current=void 0,A(),P())})),u.useEffect((()=>()=>{A(),clearTimeout(I.current),clearTimeout(T.current),C.current&&P()}),[A,P]),!n)return{};function D(e){R.current=e.pointerType}return{reference:{onPointerDown:D,onPointerEnter:D,onMouseMove(){a||0===l||(clearTimeout(T.current),T.current=setTimeout((()=>{L.current||s(!0)}),l))}},floating:{onMouseEnter(){clearTimeout(I.current)},onMouseLeave(){M(!1)}}}},e.useId=d,e.useInteractions=function(e){return void 0===e&&(e=[]),{getReferenceProps:t=>b(t,e,"reference"),getFloatingProps:t=>b(t,e,"floating"),getItemProps:t=>b(t,e,"item")}},e.useListNavigation=function(e,t){let{open:n,onOpenChange:r,refs:o}=e,{listRef:i,activeIndex:l,onNavigate:a,enabled:s=!0,selectedIndex:f=null,allowEscape:d=!1,loop:v=!1,nested:m=!1,rtl:b=!1,virtual:h=!1,focusItemOnOpen:E="auto",focusItemOnHover:x=!0,openOnArrowKeyDown:k=!0,disabledIndices:R=(k?void 0:[]),orientation:I="vertical"}=void 0===t?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:t;const O=p(),T=g(),L=q(n),C=u.useRef(E),M=u.useRef(null!=f?f:-1),A=u.useRef(null),P=N(q(a)),F=N(a),S=N(R),K=u.useRef(!1),W=u.useRef(-1),[B,U]=u.useState(),V=u.useCallback(((e,t)=>{W.current=requestAnimationFrame((()=>{var n,r;h?U(null==(n=e.current[t.current])?void 0:n.id):null==(r=e.current[t.current])||r.focus({preventScroll:!0})}))}),[h]);function H(e){if(K.current=!0,m&&function(e,t,n){return Q(t,n?e===_:e===Y,e===G)}(e.key,I,b))return j(e),r(!1),void(w(o.reference.current)&&o.reference.current.focus());const t=M.current,u=ee(i,R),c=te(i,R);if("Home"===e.key&&(M.current=u,a(M.current)),"End"===e.key&&(M.current=c,a(M.current)),Z(e.key,I)){if(j(e),n&&!h&&D(e.currentTarget.ownerDocument)===e.currentTarget)return M.current=$(e.key,I,b)?u:c,void a(M.current);$(e.key,I,b)?M.current=v?t>=c?d&&t!==i.current.length?-1:u:J(i,{startingIndex:t,disabledIndices:R}):Math.min(c,J(i,{startingIndex:t,disabledIndices:R})):M.current=v?t<=u?d&&-1!==t?i.current.length:c:J(i,{startingIndex:t,decrement:!0,disabledIndices:R}):Math.max(u,J(i,{startingIndex:t,decrement:!0,disabledIndices:R})),z(i,M.current)?a(null):a(M.current)}}return c((()=>{s&&(!L&&n&&C.current&&null!=f&&F.current(f),L&&!n&&(cancelAnimationFrame(W.current),M.current=-1,null==P.current||P.current(null)))}),[n,L,f,i,F,P,V,s]),c((()=>{if(s&&n)if(null==l){if(null!=f)return;L&&(M.current=-1,V(i,M)),!L&&C.current&&(null!=A.current||!0===C.current&&null==A.current)&&(M.current=null==A.current||$(A.current,I,b)||m?ee(i,S.current):te(i,S.current),F.current(M.current),V(i,M))}else z(i,l)||(M.current=l,V(i,M))}),[n,L,l,f,m,i,F,V,s,d,I,b,h,S]),c((()=>{s&&!n&&L&&null!=f&&w(o.reference.current)&&o.reference.current.focus()}),[o.reference,f,n,L,s]),c((()=>{if(s&&!n&&L){var e,t;const n=null==T||null==(e=T.nodesRef.current.find((e=>e.id===O)))||null==(t=e.context)?void 0:t.refs.floating.current;n&&!n.contains(D(y(n)))&&n.focus({preventScroll:!0})}}),[s,n,L,T,O]),c((()=>{A.current=null})),s?{reference:{...h&&n&&null!=l&&{"aria-activedescendant":B},onKeyDown(e){if(K.current=!0,h&&n)return H(e);(0===e.key.indexOf("Arrow")||"Enter"===e.key||" "===e.key||""===e.key)&&(A.current=e.key),m?function(e,t,n){return Q(t,n?e===Y:e===_,e===X)}(e.key,I,b)&&(j(e),n?(M.current=ee(i,R),a(M.current)):r(!0)):Z(e.key,I)&&(null!=f&&(M.current=f),j(e),!n&&k?r(!0):H(e),n&&a(M.current))}},floating:{"aria-orientation":"both"===I?void 0:I,...h&&null!=l&&{"aria-activedescendant":B},onKeyDown:H,onPointerMove(){K.current=!1}},item:{onFocus(e){let{currentTarget:t}=e;const n=i.current.indexOf(t);-1!==n&&a(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...x&&{onMouseMove(e){let{currentTarget:t}=e;const n=t;if(n){const e=i.current.indexOf(n);-1!==e&&a(e)}},onMouseLeave(){var e;K.current||(M.current=-1,V(i,M),F.current(null),h||null==(e=o.floating.current)||e.focus({preventScroll:!0}))}}}}:{}},e.useRole=function(e,t){let{open:n}=e,{enabled:r=!0,role:o="dialog"}=void 0===t?{}:t;const u=d(),c=d(),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,t){var n;let{open:r,dataRef:o}=e,{listRef:i,activeIndex:l,onMatch:a=(()=>{}),enabled:s=!0,findMatch:f=null,resetMs:d=1e3,ignoreKeys:v=[],selectedIndex:m=null}=void 0===t?{listRef:{current:[]},activeIndex:null}:t;const p=u.useRef(),g=u.useRef(""),b=u.useRef(null!=(n=null!=m?m:l)?n:-1),h=u.useRef(null);function E(e){if(!e.currentTarget.contains(D(y(e.currentTarget))))return;g.current.length>0&&" "!==g.current[0]&&(o.current.typing=!0," "===e.key&&j(e));const t=i.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.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&g.current===e.key&&(g.current="",b.current=h.current),g.current+=e.key,clearTimeout(p.current),p.current=setTimeout((()=>{g.current="",b.current=h.current,o.current.typing=!1}),d);const n=b.current,r=[...t.slice((null!=n?n:0)+1),...t.slice(0,(null!=n?n:0)+1)],u=f?f(r,g.current):r.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(g.current)))),c=u?t.indexOf(u):-1;-1!==c&&(a(c),h.current=c)}return c((()=>{r&&(clearTimeout(p.current),h.current=null,g.current="")}),[r]),c((()=>{var e;r&&""===g.current&&(b.current=null!=(e=null!=m?m:l)?e:-1)}),[r,m,l]),s?{reference:{onKeyDown:E},floating:{onKeyDown:E}}:{}},Object.keys(t).forEach((function(n){"default"===n||e.hasOwnProperty(n)||Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[n]}})})),Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "@floating-ui/react-dom-interactions",
"version": "0.6.1",
"version": "0.6.2",
"@rollingversions": {

@@ -59,2 +59,6 @@ "baseVersion": [

],
"peerDependencies": {
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
},
"dependencies": {

@@ -61,0 +65,0 @@ "@floating-ui/react-dom": "^0.7.1",

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

import type { FloatingTreeType, ReferenceType } from '../types';
export declare function getChildren<RT extends ReferenceType = ReferenceType>(tree: FloatingTreeType<RT>, id: string | undefined): import("../types").FloatingNodeType<RT>[];
import type { FloatingNodeType, ReferenceType } from '../types';
export declare function getChildren<RT extends ReferenceType = ReferenceType>(nodes: Array<FloatingNodeType<RT>>, id: string | undefined): FloatingNodeType<RT>[];

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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