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

@floating-ui/react-dom-interactions

Package Overview
Dependencies
Maintainers
2
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.9.0 to 0.9.1

2

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

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

import{useFloating as e,offset as t,detectOverflow as n,getOverflowAncestors as r}from"@floating-ui/react-dom";export*from"@floating-ui/react-dom";import*as o from"react";import{useLayoutEffect as u,useEffect as c,useRef as i}from"react";import{createPortal as l,flushSync as s}from"react-dom";import{hideOthers as a}from"aria-hidden";var f="undefined"!=typeof document?u:c;function d(){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 m=!1,v=0;const g=()=>"floating-ui-"+v++;const p=o["useId".toString()],h=null!=p?p:function(){const[e,t]=o.useState((()=>m?g():void 0));return f((()=>{null==e&&t(g())}),[]),o.useEffect((()=>{m||(m=!0)}),[]),e},b=o.createContext(null),y=o.createContext(null),w=()=>{var e,t;return null!=(e=null==(t=o.useContext(b))?void 0:t.id)?e:null},E=()=>o.useContext(y),R=()=>{const e=h(),t=E(),n=w();return f((()=>{const r={id:e,parentId:n};return null==t||t.addNode(r),()=>{null==t||t.removeNode(r)}}),[t,e,n]),e},x=e=>{let{children:t,id:n}=e;const r=w();return o.createElement(b.Provider,{value:o.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},I=e=>{let{children:t}=e;const n=o.useRef([]),r=o.useCallback((e=>{n.current=[...n.current,e]}),[]),u=o.useCallback((e=>{n.current=n.current.filter((t=>t!==e))}),[]),c=o.useState((()=>d()))[0];return o.createElement(y.Provider,{value:o.useMemo((()=>({nodesRef:n,addNode:r,removeNode:u,events:c})),[n,r,u,c])},t)};function k(e){var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document}function L(e){var t;return null!=(t=k(e).defaultView)?t:window}function T(e){return!!e&&e instanceof L(e).Element}function C(e){return!!e&&e instanceof L(e).HTMLElement}function A(t){let{open:n=!1,onOpenChange:r=(()=>{}),whileElementsMounted:u,placement:c,middleware:i,strategy:l,nodeId:s}=void 0===t?{}:t;const a=E(),m=o.useRef(null),v=o.useRef({}),g=o.useState((()=>d()))[0],p=e({placement:c,middleware:i,strategy:l,whileElementsMounted:u}),h=o.useMemo((()=>({...p.refs,domReference:m})),[p.refs]),b=o.useMemo((()=>({...p,refs:h,dataRef:v,nodeId:s,events:g,open:n,onOpenChange:r})),[p,s,g,n,r,h]);f((()=>{const e=null==a?void 0:a.nodesRef.current.find((e=>e.id===s));e&&(e.context=b)}));const{reference:y}=p,w=o.useCallback((e=>{(T(e)||null===e)&&(b.refs.domReference.current=e),y(e)}),[y,b.refs]);return o.useMemo((()=>({...p,context:b,refs:h,reference:w})),[p,h,b,w])}function M(e,t,n){const r=new Map;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;if(0===n.indexOf("on")){var u;if(r.has(n)||r.set(n,[]),"function"==typeof o)null==(u=r.get(n))||u.push(o);e[n]=function(){for(var e,t=arguments.length,o=new Array(t),u=0;u<t;u++)o[u]=arguments[u];null==(e=r.get(n))||e.forEach((e=>e(...o)))}}else e[n]=o})),e):e),{})}}const O=function(e){return void 0===e&&(e=[]),{getReferenceProps:t=>M(t,e,"reference"),getFloatingProps:t=>M(t,e,"floating"),getItemProps:t=>M(t,e,"item")}};function D(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}function P(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:s,nodeId:a,tree:f,leave:d=!1}=e;return function(e){var m,v;function g(){clearTimeout(t),s()}if(clearTimeout(t),e.pointerType&&"mouse"!==e.pointerType)return;const{clientX:p,clientY:h}=e,b="composedPath"in e?e.composedPath()[0]:e.target;if("pointermove"===e.type&&null!=(m=l.domReference.current)&&m.contains(b))return;if(f&&D(f.nodesRef.current,a).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.domReference.current||!l.floating.current||null==i||null==o||null==c)return;const y=l.domReference.current.getBoundingClientRect(),w=l.floating.current.getBoundingClientRect(),E=i.split("-")[0],R=o>w.right-w.width/2,x=c>w.bottom-w.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 g();switch(E){case"top":if(p>=w.left&&p<=w.right&&h>=w.top&&h<=y.top+1)return;break;case"bottom":if(p>=w.left&&p<=w.right&&h>=y.bottom-1&&h<=w.bottom)return;break;case"left":if(p>=w.left&&p<=y.left+1&&h>=w.top&&h<=w.bottom)return;break;case"right":if(p>=y.right-1&&p<=w.right&&h>=w.top&&h<=w.bottom)return}if(u)return g();const I=function(e){let[t,n]=e;const o=w.width>y.width,u=w.height>y.height;switch(E){case"top":return[[o?t+r/2:R?t+4*r:t-4*r,n+r+1],[o?t-r/2:R?t+4*r:t-4*r,n+r+1],...[[w.left,R||o?w.bottom-r:w.top],[w.right,R?o?w.bottom-r:w.top:w.bottom-r]]];case"bottom":return[[o?t+r/2:R?t+4*r:t-4*r,n-r],[o?t-r/2:R?t+4*r:t-4*r,n-r],...[[w.left,R||o?w.top+r:w.bottom],[w.right,R?o?w.top+r:w.bottom:w.top+r]]];case"left":{const e=[t+r+1,u?n+r/2:x?n+4*r:n-4*r],o=[t+r+1,u?n-r/2:x?n+4*r:n-4*r];return[...[[x||u?w.right-r:w.left,w.top],[x?u?w.right-r:w.left:w.right-r,w.bottom]],e,o]}case"right":return[[t-r,u?n+r/2:x?n+4*r:n-4*r],[t-r,u?n-r/2:x?n+4*r:n-4*r],...[[x||u?w.left+r:w.right,w.top],[x?u?w.left+r:w.right:w.left+r,w.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,s]=t[c]||[0,0];i>=r!=s>=r&&n<=(l-u)*(r-i)/(s-i)+u&&(o=!o)}return o}([p,h],I)?g():n&&(t=setTimeout(s,n))}}}const S="floating-ui-root",K=function(e){let{id:t=S,enabled:n=!0}=void 0===e?{}:e;const[r,u]=o.useState(null);return f((()=>{if(!n)return;const e=document.getElementById(t);if(e)u(e);else{const e=document.createElement("div");e.id=t,u(e),document.body.contains(e)||document.body.appendChild(e)}}),[t,n]),r},F=e=>{let{children:t,id:n=S,root:r=null}=e;const o=K({id:n,enabled:!r});return r?l(t,r):o?l(t,o):null};function H(){return H=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},H.apply(this,arguments)}const j="data-floating-ui-scroll-lock",N=o.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return f((()=>{var e,t,r,o;if(!n)return;if(document.body.hasAttribute(j))return;document.body.setAttribute(j,"");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(j),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,s=window.pageXOffset,a=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(a-Math.floor(l))+"px",left:-(s-Math.floor(i))+"px",right:"0",[u]:c+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[u]:""}),document.body.removeAttribute(j),window.scrollTo(s,a)}}),[n]),o.createElement("div",H({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function V(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 X="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Y(e){return C(e)&&e.matches(X)}function B(e){e.preventDefault(),e.stopPropagation()}function W(e){const t=i(e);return f((()=>{t.current=e})),t}function q(e,t){void 0===t&&(t=!1),requestAnimationFrame((()=>{null==e||e.focus({preventScroll:t})}))}const U=o.forwardRef((function(e,t){return o.createElement("span",H({},e,{ref:t,tabIndex:0,style:{position:"fixed",opacity:"0",pointerEvents:"none",outline:"0"}}))}));function z(e){var t;let{context:{refs:n,nodeId:r,onOpenChange:u,dataRef:c,events:i},children:l,order:s=["content"],endGuard:f=!0,preventTabbing:d=!1,initialFocus:m=0,returnFocus:v=!0,modal:g=!0}=e;const p=W(s),h=W(u),b=E(),y=null==(null==b||null==(t=b.nodesRef.current.find((e=>e.id===r)))?void 0:t.parentId),w=o.useCallback((()=>p.current.map((e=>{return"reference"===e?n.domReference.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.domReference.current)return!0;if(C(e)){var t;return"-"!==(null!=(t=e.getAttribute("tabindex"))?t:"0")[0].trim()}}))),[p,n]);o.useEffect((()=>{if(!g)return;const e=0===w().filter((e=>e!==n.floating.current&&e!==n.domReference.current)).length;function t(t){if("Tab"===t.key){(d||e)&&B(t);const r=w(),o="composedPath"in t?t.composedPath()[0]:t.target;"reference"===p.current[0]&&o===n.domReference.current&&(B(t),t.shiftKey?q(r[r.length-1]):q(r[1])),"floating"===p.current[1]&&o===n.floating.current&&t.shiftKey&&(B(t),q(r[0]))}}const r=k(n.floating.current);return r.addEventListener("keydown",t),()=>{r.removeEventListener("keydown",t)}}),[d,g,w,p,n]),o.useEffect((()=>{function e(e){var t,o;const u=e.relatedTarget,c=!(null!=(t=n.floating.current)&&t.contains(u)),i=T(n.domReference.current)&&!n.domReference.current.contains(u),l=b&&D(b.nodesRef.current,r).length>0,s=b&&e.currentTarget===n.domReference.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}(b.nodesRef.current,r))?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&&!s&&h.current(!1)}const t=n.floating.current,o=n.domReference.current;if(t&&C(o)){let n;return!g&&t.addEventListener("focusout",e),!g&&o.addEventListener("focusout",e),g&&(n=p.current.includes("reference")?a([o,t]):a(t)),()=>{!g&&t.removeEventListener("focusout",e),!g&&o.removeEventListener("focusout",e),null==n||n()}}}),[r,b,g,h,p,c,w,n]),o.useEffect((()=>{if(d&&!y)return;const e=n.floating.current,t=k(e);let r=v,o=!1,u=V(t);if(u===t.body&&n.domReference.current&&(u=n.domReference.current),!d)if("number"==typeof m){var c;const t=null!=(c=w()[m])?c:e;q(t,t===e)}else if(C(m.current)){var l;const t=null!=(l=m.current)?l:e;q(t,t===e)}function s(e){void 0===e&&(e=!1),"object"==typeof e?(r=!0,o=e.preventScroll):r=e}return i.on("dismiss",s),()=>{i.off("dismiss",s),r&&C(u)&&q(u,o)}}),[d,w,m,v,n,i,y]);const R=()=>{var e;return"combobox"===(null==(e=n.domReference.current)?void 0:e.getAttribute("role"))&&Y(n.domReference.current)};return o.createElement(o.Fragment,null,g&&o.createElement(U,{onFocus:e=>{if(R())return;B(e);const t=w();"reference"===s[0]?q(t[0]):q(t[t.length-1])}}),o.cloneElement(l,s.includes("floating")?{tabIndex:0}:{}),g&&f&&o.createElement(U,{onFocus:e=>{R()||(B(e),q(w()[0]))}}))}function G(e){const t=i();return f((()=>{t.current=e}),[e]),t.current}function J(e,t,n){return n&&"mouse"!==n?0:"number"==typeof e?e:null==e?void 0:e[t]}const Q=function(e,t){let{enabled:n=!0,delay:r=0,handleClose:u=null,mouseOnly:c=!1,restMs:i=0,move:l=!0}=void 0===t?{}:t;const{open:s,onOpenChange:a,dataRef:d,events:m,refs:v}=e,g=E(),p=w(),h=W(a),b=W(u),y=W(r),R=G(s),x=o.useRef(),I=o.useRef(),L=o.useRef(),C=o.useRef(),A=o.useRef(!0),M=o.useRef(!1),O=o.useCallback((()=>{var e;const t=null==(e=d.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[d]);o.useEffect((()=>{if(n)return m.on("dismiss",e),()=>{m.off("dismiss",e)};function e(){clearTimeout(I.current),clearTimeout(C.current),A.current=!0}}),[n,m,v]),o.useEffect((()=>{if(!n||!b.current)return;function e(){O()&&h.current(!1)}const t=k(v.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[v,h,n,b,d,O]);const D=o.useCallback((function(e){void 0===e&&(e=!0);const t=J(y.current,"close",x.current);t&&!L.current?(clearTimeout(I.current),I.current=setTimeout((()=>h.current(!1)),t)):e&&(clearTimeout(I.current),h.current(!1))}),[y,h]),P=o.useCallback((()=>{L.current&&(k(v.floating.current).removeEventListener("pointermove",L.current),L.current=void 0)}),[v]),S=o.useCallback((()=>{k(v.floating.current).body.style.pointerEvents="",M.current=!1}),[v]);if(o.useEffect((()=>{if(!n)return;function t(){return!!d.current.openEvent&&["click","mousedown"].includes(d.current.openEvent.type)}function r(e){if(clearTimeout(I.current),A.current=!1,s||c&&"mouse"!==x.current||i>0&&0===J(y.current,"open"))return;d.current.openEvent=e;const t=J(y.current,"open",x.current);t?I.current=setTimeout((()=>{h.current(!0)}),t):h.current(!0)}function o(n){if(t())return;const r=k(v.floating.current);if(clearTimeout(C.current),b.current)return clearTimeout(I.current),L.current&&r.removeEventListener("pointermove",L.current),L.current=b.current({...e,tree:g,x:n.clientX,y:n.clientY,onClose(){S(),P(),D()}}),void r.addEventListener("pointermove",L.current);D()}function u(n){t()||null==b.current||b.current({...e,tree:g,x:n.clientX,y:n.clientY,leave:!0,onClose(){S(),P(),D()}})(n)}const a=v.floating.current,f=v.domReference.current;return T(f)?(s&&f.addEventListener("mouseleave",u),null==a||a.addEventListener("mouseleave",u),l&&f.addEventListener("mousemove",r),f.addEventListener("mouseenter",r),f.addEventListener("mouseleave",o),()=>{s&&f.removeEventListener("mouseleave",u),null==a||a.removeEventListener("mouseleave",u),l&&f.removeEventListener("mousemove",r),f.removeEventListener("mouseenter",r),f.removeEventListener("mouseleave",o)}):void 0}),[n,e,c,i,l,D,P,S,s,g,v,y,b,d,h]),f((()=>{if(n&&s&&b.current&&O()){k(v.floating.current).body.style.pointerEvents="none",M.current=!0;const n=v.domReference.current,r=v.floating.current;if(T(n)&&r){var e,t;const o=null==g||null==(e=g.nodesRef.current.find((e=>e.id===p)))||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,s,p,v,g,b,d,O]),f((()=>{R&&!s&&(x.current=void 0,P(),S())})),o.useEffect((()=>()=>{P(),clearTimeout(I.current),clearTimeout(C.current),M.current&&S()}),[n,P,S]),!n)return{};function K(e){x.current=e.pointerType}return{reference:{onPointerDown:K,onPointerEnter:K,onMouseMove(){s||0===i||(clearTimeout(C.current),C.current=setTimeout((()=>{A.current||a(!0)}),i))}},floating:{onMouseEnter(){clearTimeout(I.current)},onMouseLeave(){D(!1)}}}},Z=o.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),$=()=>o.useContext(Z),_=e=>{let{children:t,delay:n}=e;const[r,u]=o.useState({delay:n,initialDelay:n,currentId:null}),c=o.useCallback((e=>{u((t=>({...t,currentId:e})))}),[]);return o.createElement(Z.Provider,{value:o.useMemo((()=>({...r,setState:u,setCurrentId:c})),[r,u,c])},t)},ee=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:u}=t;const{currentId:c,initialDelay:i,setState:l}=$(),s=W(r);o.useEffect((()=>{c&&s.current&&(l((e=>({...e,delay:{open:1,close:J(i,"close")}}))),c!==u&&s.current(!1))}),[u,s,l,c,i]),o.useEffect((()=>{!n&&c===u&&s.current&&(s.current(!1),l((e=>({...e,delay:i,currentId:null}))))}),[n,l,c,u,s,i])};function te(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:e.elements.floating[t]}}}}const ne=e=>({name:"inner",options:e,async fn(r){const{listRef:o,overflowRef:u,onFallbackChange:c,offset:i=0,index:l=0,minItemsVisible:a=4,referenceOverflowThreshold:f=0,...d}=e,{rects:m,elements:{floating:v}}=r,g=o.current[l];if(!g)return{};const p={...r,...await t(-g.offsetTop-m.reference.height/2-g.offsetHeight/2-i).fn(r)},h=await n(te(p,"scrollHeight"),d),b=await n(p,{...d,elementContext:"reference"}),y=Math.max(0,h.top),w=p.y+y,E=Math.max(0,v.scrollHeight-y-Math.max(0,h.bottom));return v.style.maxHeight=E+"px",v.scrollTop=y,c&&(v.offsetHeight<g.offsetHeight*Math.min(a,o.current.length-1)-1||b.top>=-f||b.bottom>=-f?s((()=>c(!0))):s((()=>c(!1)))),u&&(u.current=await n(te({...p,y:w},"offsetHeight"),d)),{y:w}}}),re=(e,t)=>{let{open:n,refs:r}=e,{enabled:u=!0,overflowRef:c,onChange:i}=t;const l=W(i),a=o.useRef(!1),f=o.useRef(null),d=o.useRef(null);return o.useEffect((()=>{if(!u)return;function e(e){if(e.ctrlKey||!t||null==c.current)return;const n=e.deltaY,r=c.current.top>=-.5,o=c.current.bottom>=-.5,u=t.scrollHeight-t.clientHeight,i=n<0?-1:1,a=n<0?"max":"min";t.scrollHeight<=t.clientHeight||(!r&&n>0||!o&&n<0?(e.preventDefault(),s((()=>{l.current((e=>e+Math[a](n,u*i)))}))):/firefox/i.test(function(){const e=navigator.userAgentData;return null!=e&&e.brands?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}())&&(t.scrollTop+=n))}const t=r.floating.current;return n&&t?(t.addEventListener("wheel",e),requestAnimationFrame((()=>{f.current=t.scrollTop,null!=c.current&&(d.current={...c.current})})),()=>{f.current=null,d.current=null,t.removeEventListener("wheel",e)}):void 0}),[u,n,r,c,l]),u?{floating:{onKeyDown(){a.current=!0},onWheel(){a.current=!1},onPointerMove(){a.current=!1},onScroll(){const e=r.floating.current;if(c.current&&e&&a.current){if(null!==f.current){const t=e.scrollTop-f.current;(c.current.bottom<-.5&&t<-1||c.current.top<-.5&&t>1)&&s((()=>i((e=>e+t))))}requestAnimationFrame((()=>{f.current=e.scrollTop}))}}}}:{}},oe=function(e,t){let{open:n}=e,{enabled:r=!0,role:o="dialog"}=void 0===t?{}:t;const u=h(),c=h(),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":"alertdialog"===o?"dialog":o,"aria-controls":n?u:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:c}},floating:{...i,..."menu"===o&&{"aria-labelledby":c}}}:{}},ue=function(e,t){let{open:n,onOpenChange:r,dataRef:u,refs:c}=e,{enabled:i=!0,pointerDown:l=!1,toggle:s=!0,ignoreMouse:a=!1}=void 0===t?{}:t;const f=o.useRef();function d(){var e;return"BUTTON"===(null==(e=c.domReference.current)?void 0:e.tagName)}function m(){return Y(c.domReference.current)}return i?{reference:{onPointerDown(e){f.current=e.pointerType},onMouseDown(e){0===e.button&&("mouse"===f.current&&a||l&&(n?!s||u.current.openEvent&&"mousedown"!==u.current.openEvent.type||r(!1):r(!0),u.current.openEvent=e.nativeEvent))},onClick(e){l&&f.current?f.current=void 0:"mouse"===f.current&&a||(n?!s||u.current.openEvent&&"click"!==u.current.openEvent.type||r(!1):r(!0),u.current.openEvent=e.nativeEvent)},onKeyDown(e){f.current=void 0,d()||(" "!==e.key||m()||e.preventDefault(),"Enter"===e.key&&(n?s&&r(!1):r(!0)))},onKeyUp(e){d()||m()||" "===e.key&&(n?s&&r(!1):r(!0))}}}:{}};function ce(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 ie=function(e,t){let{open:n,onOpenChange:u,refs:c,events:i,nodeId:l}=e,{enabled:s=!0,escapeKey:a=!0,outsidePointerDown:f=!0,referencePointerDown:d=!1,ancestorScroll:m=!1,bubbles:v=!0}=void 0===t?{}:t;const g=E(),p=W(u),h=null!=w();return o.useEffect((()=>{if(!n||!s)return;function e(e){if("Escape"===e.key){if(!v&&g&&D(g.nodesRef.current,l).length>0)return;i.emit("dismiss",{preventScroll:!1}),p.current(!1)}}function t(e){if(T(e.target)&&c.floating.current){var t;const n=null!=(t=c.floating.current.ownerDocument.defaultView)?t:window,o=r(c.floating.current).filter(T).find((e=>{const{overflow:t,overflowX:r,overflowY:o}=n.getComputedStyle(e);return/scroll|auto/.test(t+r+o)}));let u=e.offsetX>e.target.clientWidth;if(T(o)){"rtl"===n.getComputedStyle(o).direction&&(u=e.offsetX<=o.offsetWidth-o.clientWidth)}if(u||e.offsetY>e.target.clientHeight)return}const n=g&&D(g.nodesRef.current,l).some((t=>{var n;return ce(e,null==(n=t.context)?void 0:n.refs.floating.current)}));ce(e,c.floating.current)||ce(e,c.domReference.current)||n||!v&&g&&D(g.nodesRef.current,l).length>0||(i.emit("dismiss",!!h&&{preventScroll:!0}),p.current(!1))}function o(){p.current(!1)}const u=k(c.floating.current);a&&u.addEventListener("keydown",e),f&&u.addEventListener("pointerdown",t);const d=(m?[...T(c.reference.current)?r(c.reference.current):[],...T(c.floating.current)?r(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}))),()=>{a&&u.removeEventListener("keydown",e),f&&u.removeEventListener("pointerdown",t),d.forEach((e=>e.removeEventListener("scroll",o)))}}),[a,f,i,g,l,n,p,m,s,v,c,h]),s?{reference:{onPointerDown(){d&&(i.emit("dismiss"),u(!1))}}}:{}},le=function(e,t){let{open:n,onOpenChange:r,dataRef:u,refs:c,events:i}=e,{enabled:l=!0,keyboardOnly:s=!0}=void 0===t?{}:t;const a=o.useRef(""),f=o.useRef(!1);return o.useEffect((()=>{var e;if(!l)return;const t=k(c.floating.current),r=null!=(e=t.defaultView)?e:window;function o(){a.current&&c.domReference.current===V(t)&&(f.current=!n)}function u(){setTimeout((()=>{f.current=!1,a.current=""}))}return r.addEventListener("focus",u),r.addEventListener("blur",o),()=>{r.removeEventListener("focus",u),r.removeEventListener("blur",o)}}),[c,n,l]),o.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;a.current=t,f.current=!(!t||!s)},onFocus(e){var t,n,o;f.current||"focus"===e.type&&"mousedown"===(null==(t=u.current.openEvent)?void 0:t.type)&&null!=(n=c.domReference.current)&&n.contains(null==(o=u.current.openEvent)?void 0:o.target)||(u.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){var t,n;const o=e.relatedTarget;null!=(t=c.floating.current)&&t.contains(o)||null!=(n=c.domReference.current)&&n.contains(o)||(f.current=!1,r(!1))}}}:{}};function se(e,t,n){return Math.floor(e/t)!==n}function ae(e,t){return t<0||t>=e.current.length}function fe(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:u=1}=void 0===t?{}:t;const c=e.current;let i=n;do{var l,s;i+=r?-u:u}while(i>=0&&i<=c.length-1&&(o?o.includes(i):null==c[i]||(null==(l=c[i])?void 0:l.hasAttribute("disabled"))||"true"===(null==(s=c[i])?void 0:s.getAttribute("aria-disabled"))));return i}function de(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function me(e,t){return de(t,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function ve(e,t,n){return de(t,"ArrowDown"===e,n?"ArrowLeft"===e:"ArrowRight"===e)||"Enter"===e||" "==e||""===e}function ge(e,t){return fe(e,{disabledIndices:t})}function pe(e,t){return fe(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}const he=function(e,t){let{open:n,onOpenChange:r,refs:u}=e,{listRef:c,activeIndex:i,onNavigate:l=(()=>{}),enabled:s=!0,selectedIndex:a=null,allowEscape:d=!1,loop:m=!1,nested:v=!1,rtl:g=!1,virtual:p=!1,focusItemOnOpen:h="auto",focusItemOnHover:b=!0,openOnArrowKeyDown:y=!0,disabledIndices:R,orientation:x="vertical",cols:I=1}=void 0===t?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:t;const L=w(),T=E(),A=G(n),M=o.useRef(h),O=o.useRef(null!=a?a:-1),D=o.useRef(null),P=W(G(l)),S=W(l),K=W(R),F=o.useRef(!1),H=o.useRef(-1),[j,N]=o.useState(),X=o.useCallback(((e,t)=>{H.current=requestAnimationFrame((()=>{var n,r;p?N(null==(n=e.current[t.current])?void 0:n.id):null==(r=e.current[t.current])||r.focus({preventScroll:!0})}))}),[p]);function Y(e){if(F.current=!0,v&&function(e,t,n){return de(t,n?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(e.key,x,g))return B(e),r(!1),void(C(u.domReference.current)&&u.domReference.current.focus());const t=O.current,o=ge(c,R),i=pe(c,R);if("Home"===e.key&&(O.current=o,l(O.current)),"End"===e.key&&(O.current=i,l(O.current)),I>1){const t=O.current;if("ArrowUp"===e.key){if(B(e),-1===t)O.current=i;else if(O.current=fe(c,{startingIndex:t,amount:I,decrement:!0,disabledIndices:R}),m&&(t-I<o||O.current<0)){const e=t%I,n=i%I,r=i-(n-e);O.current=n===e?i:n>e?r:r-I}ae(c,O.current)&&(O.current=t),l(O.current)}if("ArrowDown"===e.key&&(B(e),-1===t?O.current=o:(O.current=fe(c,{startingIndex:t,amount:I,disabledIndices:R}),m&&t+I>i&&(O.current=fe(c,{startingIndex:t%I-I,amount:I,disabledIndices:R}))),ae(c,O.current)&&(O.current=t),l(O.current)),"both"===x){const n=Math.floor(t/I);"ArrowRight"===e.key&&(B(e),t%I!=I-1?(O.current=fe(c,{startingIndex:t,disabledIndices:R}),m&&se(O.current,I,n)&&(O.current=fe(c,{startingIndex:t-t%I-1,disabledIndices:R}))):m&&(O.current=fe(c,{startingIndex:t-t%I-1,disabledIndices:R})),se(O.current,I,n)&&(O.current=t)),"ArrowLeft"===e.key&&(B(e),t%I!=0?(O.current=fe(c,{startingIndex:t,disabledIndices:R,decrement:!0}),m&&se(O.current,I,n)&&(O.current=fe(c,{startingIndex:t+(I-t%I),decrement:!0,disabledIndices:R}))):m&&(O.current=fe(c,{startingIndex:t+(I-t%I),decrement:!0,disabledIndices:R})),se(O.current,I,n)&&(O.current=t));const r=Math.floor(i/I)===n;return ae(c,O.current)&&(O.current=m&&r?"ArrowLeft"===e.key?i:fe(c,{startingIndex:t-t%I-1,disabledIndices:R}):t),void l(O.current)}}if(me(e.key,x)){if(B(e),n&&!p&&V(e.currentTarget.ownerDocument)===e.currentTarget)return O.current=ve(e.key,x,g)?o:i,void l(O.current);ve(e.key,x,g)?O.current=m?t>=i?d&&t!==c.current.length?-1:o:fe(c,{startingIndex:t,disabledIndices:R}):Math.min(i,fe(c,{startingIndex:t,disabledIndices:R})):O.current=m?t<=o?d&&-1!==t?c.current.length:i:fe(c,{startingIndex:t,decrement:!0,disabledIndices:R}):Math.max(o,fe(c,{startingIndex:t,decrement:!0,disabledIndices:R})),ae(c,O.current)?l(null):l(O.current)}}return f((()=>{s&&(!A&&n&&M.current&&null!=a&&S.current(a),A&&!n&&(cancelAnimationFrame(H.current),O.current=-1,null==P.current||P.current(null)))}),[n,A,a,c,S,P,X,s]),f((()=>{if(s&&n)if(null==i){if(null!=a)return;A&&(O.current=-1,X(c,O)),!A&&M.current&&(null!=D.current||!0===M.current&&null==D.current)&&(O.current=null==D.current||ve(D.current,x,g)||v?ge(c,K.current):pe(c,K.current),S.current(O.current),X(c,O))}else ae(c,i)||(O.current=i,X(c,O))}),[n,A,i,a,v,c,S,X,s,d,x,g,p,K]),f((()=>{if(s&&!n&&A){var e,t;const n=null==T||null==(e=T.nodesRef.current.find((e=>e.id===L)))||null==(t=e.context)?void 0:t.refs.floating.current;n&&!n.contains(V(k(n)))&&n.focus({preventScroll:!0})}}),[s,n,A,T,L]),f((()=>{D.current=null})),s?{reference:{...p&&n&&null!=i&&{"aria-activedescendant":j},onKeyDown(e){if(F.current=!0,p&&n)return Y(e);(0===e.key.indexOf("Arrow")||"Enter"===e.key||" "===e.key||""===e.key)&&(D.current=e.key),v?function(e,t,n){return de(t,n?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(e.key,x,g)&&(B(e),n?(O.current=ge(c,R),l(O.current)):r(!0)):me(e.key,x)&&(null!=a&&(O.current=a),B(e),!n&&y?r(!0):Y(e),n&&l(O.current))}},floating:{"aria-orientation":"both"===x?void 0:x,...p&&null!=i&&{"aria-activedescendant":j},onKeyDown:Y,onPointerMove(){F.current=!1}},item:{onFocus(e){let{currentTarget:t}=e;const n=c.current.indexOf(t);-1!==n&&l(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...b&&{onMouseMove(e){let{currentTarget:t}=e;const n=t;if(n){const e=c.current.indexOf(n);-1!==e&&l(e)}},onPointerLeave(){var e;F.current||(O.current=-1,X(c,O),S.current(null),p||null==(e=u.floating.current)||e.focus({preventScroll:!0}))}}}}:{}},be=function(e,t){var n;let{open:r,dataRef:u}=e,{listRef:c,activeIndex:i,onMatch:l=(()=>{}),enabled:s=!0,findMatch:a=null,resetMs:d=1e3,ignoreKeys:m=[],selectedIndex:v=null}=void 0===t?{listRef:{current:[]},activeIndex:null}:t;const g=o.useRef(),p=o.useRef(""),h=o.useRef(null!=(n=null!=v?v:i)?n:-1),b=o.useRef(null);function y(e){if(!e.currentTarget.contains(V(k(e.currentTarget))))return;p.current.length>0&&" "!==p.current[0]&&(u.current.typing=!0," "===e.key&&B(e));const t=c.current;if(null==t||m.includes(e.key)||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)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="",h.current=b.current),p.current+=e.key,clearTimeout(g.current),g.current=setTimeout((()=>{p.current="",h.current=b.current,u.current.typing=!1}),d);const n=h.current,r=[...t.slice((null!=n?n:0)+1),...t.slice(0,(null!=n?n:0)+1)],o=a?a(r,p.current):r.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(p.current)))),i=o?t.indexOf(o):-1;-1!==i&&(l(i),b.current=i)}return f((()=>{r&&(clearTimeout(g.current),b.current=null,p.current="")}),[r]),f((()=>{var e;r&&""===p.current&&(h.current=null!=(e=null!=v?v:i)?e:-1)}),[r,v,i]),s?{reference:{onKeyDown:y},floating:{onKeyDown:y}}:{}};export{_ as FloatingDelayGroup,z as FloatingFocusManager,x as FloatingNode,N as FloatingOverlay,F as FloatingPortal,I as FloatingTree,ne as inner,P as safePolygon,ue as useClick,ee as useDelayGroup,$ as useDelayGroupContext,ie as useDismiss,A as useFloating,R as useFloatingNodeId,w as useFloatingParentNodeId,K as useFloatingPortalNode,E as useFloatingTree,le as useFocus,Q as useHover,h as useId,re as useInnerOffset,O as useInteractions,he as useListNavigation,oe as useRole,be as useTypeahead};
import{useFloating as e,offset as t,detectOverflow as n,getOverflowAncestors as r}from"@floating-ui/react-dom";export*from"@floating-ui/react-dom";import*as o from"react";import{useLayoutEffect as u,useEffect as c,useRef as i}from"react";import{createPortal as l,flushSync as s}from"react-dom";import{hideOthers as a}from"aria-hidden";var f="undefined"!=typeof document?u:c;function d(){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 m=!1,v=0;const g=()=>"floating-ui-"+v++;const p=o["useId".toString()],h=null!=p?p:function(){const[e,t]=o.useState((()=>m?g():void 0));return f((()=>{null==e&&t(g())}),[]),o.useEffect((()=>{m||(m=!0)}),[]),e},b=o.createContext(null),y=o.createContext(null),w=()=>{var e,t;return null!=(e=null==(t=o.useContext(b))?void 0:t.id)?e:null},E=()=>o.useContext(y),R=()=>{const e=h(),t=E(),n=w();return f((()=>{const r={id:e,parentId:n};return null==t||t.addNode(r),()=>{null==t||t.removeNode(r)}}),[t,e,n]),e},x=e=>{let{children:t,id:n}=e;const r=w();return o.createElement(b.Provider,{value:o.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},I=e=>{let{children:t}=e;const n=o.useRef([]),r=o.useCallback((e=>{n.current=[...n.current,e]}),[]),u=o.useCallback((e=>{n.current=n.current.filter((t=>t!==e))}),[]),c=o.useState((()=>d()))[0];return o.createElement(y.Provider,{value:o.useMemo((()=>({nodesRef:n,addNode:r,removeNode:u,events:c})),[n,r,u,c])},t)};function k(e){var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document}function T(e){var t;return null!=(t=k(e).defaultView)?t:window}function L(e){return!!e&&e instanceof T(e).Element}function C(e){return!!e&&e instanceof T(e).HTMLElement}function A(t){let{open:n=!1,onOpenChange:r=(()=>{}),whileElementsMounted:u,placement:c,middleware:i,strategy:l,nodeId:s}=void 0===t?{}:t;const a=E(),m=o.useRef(null),v=o.useRef({}),g=o.useState((()=>d()))[0],p=e({placement:c,middleware:i,strategy:l,whileElementsMounted:u}),h=o.useMemo((()=>({...p.refs,domReference:m})),[p.refs]),b=o.useMemo((()=>({...p,refs:h,dataRef:v,nodeId:s,events:g,open:n,onOpenChange:r})),[p,s,g,n,r,h]);f((()=>{const e=null==a?void 0:a.nodesRef.current.find((e=>e.id===s));e&&(e.context=b)}));const{reference:y}=p,w=o.useCallback((e=>{(L(e)||null===e)&&(b.refs.domReference.current=e),y(e)}),[y,b.refs]);return o.useMemo((()=>({...p,context:b,refs:h,reference:w})),[p,h,b,w])}function M(e,t,n){const r=new Map;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;if(0===n.indexOf("on")){var u;if(r.has(n)||r.set(n,[]),"function"==typeof o)null==(u=r.get(n))||u.push(o);e[n]=function(){for(var e,t=arguments.length,o=new Array(t),u=0;u<t;u++)o[u]=arguments[u];null==(e=r.get(n))||e.forEach((e=>e(...o)))}}else e[n]=o})),e):e),{})}}const O=function(e){return void 0===e&&(e=[]),{getReferenceProps:t=>M(t,e,"reference"),getFloatingProps:t=>M(t,e,"floating"),getItemProps:t=>M(t,e,"item")}};function D(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}function P(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:s,nodeId:a,tree:f,leave:d=!1}=e;return function(e){var m,v;function g(){clearTimeout(t),s()}if(clearTimeout(t),e.pointerType&&"mouse"!==e.pointerType)return;const{clientX:p,clientY:h}=e,b="composedPath"in e?e.composedPath()[0]:e.target;if("pointermove"===e.type&&null!=(m=l.domReference.current)&&m.contains(b))return;if(f&&D(f.nodesRef.current,a).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.domReference.current||!l.floating.current||null==i||null==o||null==c)return;const y=l.domReference.current.getBoundingClientRect(),w=l.floating.current.getBoundingClientRect(),E=i.split("-")[0],R=o>w.right-w.width/2,x=c>w.bottom-w.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 g();switch(E){case"top":if(p>=w.left&&p<=w.right&&h>=w.top&&h<=y.top+1)return;break;case"bottom":if(p>=w.left&&p<=w.right&&h>=y.bottom-1&&h<=w.bottom)return;break;case"left":if(p>=w.left&&p<=y.left+1&&h>=w.top&&h<=w.bottom)return;break;case"right":if(p>=y.right-1&&p<=w.right&&h>=w.top&&h<=w.bottom)return}if(u)return g();const I=function(e){let[t,n]=e;const o=w.width>y.width,u=w.height>y.height;switch(E){case"top":return[[o?t+r/2:R?t+4*r:t-4*r,n+r+1],[o?t-r/2:R?t+4*r:t-4*r,n+r+1],...[[w.left,R||o?w.bottom-r:w.top],[w.right,R?o?w.bottom-r:w.top:w.bottom-r]]];case"bottom":return[[o?t+r/2:R?t+4*r:t-4*r,n-r],[o?t-r/2:R?t+4*r:t-4*r,n-r],...[[w.left,R||o?w.top+r:w.bottom],[w.right,R?o?w.top+r:w.bottom:w.top+r]]];case"left":{const e=[t+r+1,u?n+r/2:x?n+4*r:n-4*r],o=[t+r+1,u?n-r/2:x?n+4*r:n-4*r];return[...[[x||u?w.right-r:w.left,w.top],[x?u?w.right-r:w.left:w.right-r,w.bottom]],e,o]}case"right":return[[t-r,u?n+r/2:x?n+4*r:n-4*r],[t-r,u?n-r/2:x?n+4*r:n-4*r],...[[x||u?w.left+r:w.right,w.top],[x?u?w.left+r:w.right:w.left+r,w.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,s]=t[c]||[0,0];i>=r!=s>=r&&n<=(l-u)*(r-i)/(s-i)+u&&(o=!o)}return o}([p,h],I)?g():n&&(t=setTimeout(s,n))}}}const S="floating-ui-root",H=function(e){let{id:t=S,enabled:n=!0}=void 0===e?{}:e;const[r,u]=o.useState(null);return f((()=>{if(!n)return;const e=document.getElementById(t);if(e)u(e);else{const e=document.createElement("div");e.id=t,u(e),document.body.contains(e)||document.body.appendChild(e)}}),[t,n]),r},K=e=>{let{children:t,id:n=S,root:r=null}=e;const o=H({id:n,enabled:!r});return r?l(t,r):o?l(t,o):null};function F(){return F=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},F.apply(this,arguments)}const j="data-floating-ui-scroll-lock",N=o.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return f((()=>{var e,t,r,o;if(!n)return;if(document.body.hasAttribute(j))return;document.body.setAttribute(j,"");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(j),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,s=window.pageXOffset,a=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(a-Math.floor(l))+"px",left:-(s-Math.floor(i))+"px",right:"0",[u]:c+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[u]:""}),document.body.removeAttribute(j),window.scrollTo(s,a)}}),[n]),o.createElement("div",F({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function V(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 W="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function B(e){return C(e)&&e.matches(W)}function X(e){e.preventDefault(),e.stopPropagation()}function Y(e){const t=i(e);return f((()=>{t.current=e})),t}function q(e,t){void 0===t&&(t=!1),requestAnimationFrame((()=>{null==e||e.focus({preventScroll:t})}))}const U=o.forwardRef((function(e,t){return o.createElement("span",F({},e,{ref:t,tabIndex:0,style:{position:"fixed",opacity:"0",pointerEvents:"none",outline:"0"}}))}));function z(e){var t;let{context:{refs:n,nodeId:r,onOpenChange:u,dataRef:c,events:i},children:l,order:s=["content"],endGuard:f=!0,preventTabbing:d=!1,initialFocus:m=0,returnFocus:v=!0,modal:g=!0}=e;const p=Y(s),h=Y(u),b=E(),y=null==(null==b||null==(t=b.nodesRef.current.find((e=>e.id===r)))?void 0:t.parentId),w=o.useCallback((()=>p.current.map((e=>{return"reference"===e?n.domReference.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.domReference.current)return!0;if(C(e)){var t;return"-"!==(null!=(t=e.getAttribute("tabindex"))?t:"0")[0].trim()}}))),[p,n]);o.useEffect((()=>{if(!g)return;const e=0===w().filter((e=>e!==n.floating.current&&e!==n.domReference.current)).length;function t(t){if("Tab"===t.key){(d||e)&&X(t);const r=w(),o="composedPath"in t?t.composedPath()[0]:t.target;"reference"===p.current[0]&&o===n.domReference.current&&(X(t),t.shiftKey?q(r[r.length-1]):q(r[1])),"floating"===p.current[1]&&o===n.floating.current&&t.shiftKey&&(X(t),q(r[0]))}}const r=k(n.floating.current);return r.addEventListener("keydown",t),()=>{r.removeEventListener("keydown",t)}}),[d,g,w,p,n]),o.useEffect((()=>{function e(e){var t,o;const u=e.relatedTarget,c=!(null!=(t=n.floating.current)&&t.contains(u)),i=L(n.domReference.current)&&!n.domReference.current.contains(u),l=b&&D(b.nodesRef.current,r).length>0,s=b&&e.currentTarget===n.domReference.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}(b.nodesRef.current,r))?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&&!s&&h.current(!1)}const t=n.floating.current,o=n.domReference.current;if(t&&C(o)){let n;return!g&&t.addEventListener("focusout",e),!g&&o.addEventListener("focusout",e),g&&(n=p.current.includes("reference")?a([o,t]):a(t)),()=>{!g&&t.removeEventListener("focusout",e),!g&&o.removeEventListener("focusout",e),null==n||n()}}}),[r,b,g,h,p,c,w,n]),o.useEffect((()=>{if(d&&!y)return;const e=n.floating.current,t=k(e);let r=v,o=!1,u=V(t);if(u===t.body&&n.domReference.current&&(u=n.domReference.current),!d)if("number"==typeof m){var c;const t=null!=(c=w()[m])?c:e;q(t,t===e)}else if(C(m.current)){var l;const t=null!=(l=m.current)?l:e;q(t,t===e)}function s(e){void 0===e&&(e=!1),"object"==typeof e?(r=!0,o=e.preventScroll):r=e}return i.on("dismiss",s),()=>{i.off("dismiss",s),r&&C(u)&&q(u,o)}}),[d,w,m,v,n,i,y]);const R=()=>{var e;return"combobox"===(null==(e=n.domReference.current)?void 0:e.getAttribute("role"))&&B(n.domReference.current)};return o.createElement(o.Fragment,null,g&&o.createElement(U,{onFocus:e=>{if(R())return;X(e);const t=w();"reference"===s[0]?q(t[0]):q(t[t.length-1])}}),o.cloneElement(l,s.includes("floating")?{tabIndex:0}:{}),g&&f&&o.createElement(U,{onFocus:e=>{R()||(X(e),q(w()[0]))}}))}function G(e){const t=i();return f((()=>{t.current=e}),[e]),t.current}function J(e,t,n){return n&&"mouse"!==n?0:"number"==typeof e?e:null==e?void 0:e[t]}const Q=function(e,t){let{enabled:n=!0,delay:r=0,handleClose:u=null,mouseOnly:c=!1,restMs:i=0,move:l=!0}=void 0===t?{}:t;const{open:s,onOpenChange:a,dataRef:d,events:m,refs:v}=e,g=E(),p=w(),h=Y(a),b=Y(u),y=Y(r),R=G(s),x=o.useRef(),I=o.useRef(),T=o.useRef(),C=o.useRef(),A=o.useRef(!0),M=o.useRef(!1),O=o.useCallback((()=>{var e;const t=null==(e=d.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[d]);o.useEffect((()=>{if(n)return m.on("dismiss",e),()=>{m.off("dismiss",e)};function e(){clearTimeout(I.current),clearTimeout(C.current),A.current=!0}}),[n,m,v]),o.useEffect((()=>{if(!n||!b.current)return;function e(){O()&&h.current(!1)}const t=k(v.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[v,h,n,b,d,O]);const D=o.useCallback((function(e){void 0===e&&(e=!0);const t=J(y.current,"close",x.current);t&&!T.current?(clearTimeout(I.current),I.current=setTimeout((()=>h.current(!1)),t)):e&&(clearTimeout(I.current),h.current(!1))}),[y,h]),P=o.useCallback((()=>{T.current&&(k(v.floating.current).removeEventListener("pointermove",T.current),T.current=void 0)}),[v]),S=o.useCallback((()=>{k(v.floating.current).body.style.pointerEvents="",M.current=!1}),[v]);if(o.useEffect((()=>{if(!n)return;function t(){return!!d.current.openEvent&&["click","mousedown"].includes(d.current.openEvent.type)}function r(e){if(clearTimeout(I.current),A.current=!1,c&&"mouse"!==x.current||i>0&&0===J(y.current,"open"))return;d.current.openEvent=e;const t=J(y.current,"open",x.current);t?I.current=setTimeout((()=>{h.current(!0)}),t):h.current(!0)}function o(n){if(t())return;const r=k(v.floating.current);if(clearTimeout(C.current),b.current)return clearTimeout(I.current),T.current&&r.removeEventListener("pointermove",T.current),T.current=b.current({...e,tree:g,x:n.clientX,y:n.clientY,onClose(){S(),P(),D()}}),void r.addEventListener("pointermove",T.current);D()}function u(n){t()||null==b.current||b.current({...e,tree:g,x:n.clientX,y:n.clientY,leave:!0,onClose(){S(),P(),D()}})(n)}const a=v.floating.current,f=v.domReference.current;return L(f)?(s&&f.addEventListener("mouseleave",u),null==a||a.addEventListener("mouseleave",u),l&&f.addEventListener("mousemove",r,{once:!0}),f.addEventListener("mouseenter",r),f.addEventListener("mouseleave",o),()=>{s&&f.removeEventListener("mouseleave",u),null==a||a.removeEventListener("mouseleave",u),l&&f.removeEventListener("mousemove",r),f.removeEventListener("mouseenter",r),f.removeEventListener("mouseleave",o)}):void 0}),[n,e,c,i,l,D,P,S,s,g,v,y,b,d,h]),f((()=>{if(n&&s&&b.current&&O()){k(v.floating.current).body.style.pointerEvents="none",M.current=!0;const n=v.domReference.current,r=v.floating.current;if(L(n)&&r){var e,t;const o=null==g||null==(e=g.nodesRef.current.find((e=>e.id===p)))||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,s,p,v,g,b,d,O]),f((()=>{R&&!s&&(x.current=void 0,P(),S())})),o.useEffect((()=>()=>{P(),clearTimeout(I.current),clearTimeout(C.current),M.current&&S()}),[n,P,S]),!n)return{};function H(e){x.current=e.pointerType}return{reference:{onPointerDown:H,onPointerEnter:H,onMouseMove(){s||0===i||(clearTimeout(C.current),C.current=setTimeout((()=>{A.current||a(!0)}),i))}},floating:{onMouseEnter(){clearTimeout(I.current)},onMouseLeave(){D(!1)}}}},Z=o.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),$=()=>o.useContext(Z),_=e=>{let{children:t,delay:n}=e;const[r,u]=o.useState({delay:n,initialDelay:n,currentId:null}),c=o.useCallback((e=>{u((t=>({...t,currentId:e})))}),[]);return o.createElement(Z.Provider,{value:o.useMemo((()=>({...r,setState:u,setCurrentId:c})),[r,u,c])},t)},ee=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:u}=t;const{currentId:c,initialDelay:i,setState:l}=$(),s=Y(r);o.useEffect((()=>{c&&s.current&&(l((e=>({...e,delay:{open:1,close:J(i,"close")}}))),c!==u&&s.current(!1))}),[u,s,l,c,i]),o.useEffect((()=>{!n&&c===u&&s.current&&(s.current(!1),l((e=>({...e,delay:i,currentId:null}))))}),[n,l,c,u,s,i])};function te(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:e.elements.floating[t]}}}}const ne=e=>({name:"inner",options:e,async fn(r){const{listRef:o,overflowRef:u,onFallbackChange:c,offset:i=0,index:l=0,minItemsVisible:a=4,referenceOverflowThreshold:f=0,...d}=e,{rects:m,elements:{floating:v}}=r,g=o.current[l];if(!g)return{};const p={...r,...await t(-g.offsetTop-m.reference.height/2-g.offsetHeight/2-i).fn(r)},h=await n(te(p,"scrollHeight"),d),b=await n(p,{...d,elementContext:"reference"}),y=Math.max(0,h.top),w=p.y+y,E=Math.max(0,v.scrollHeight-y-Math.max(0,h.bottom));return v.style.maxHeight=E+"px",v.scrollTop=y,c&&(v.offsetHeight<g.offsetHeight*Math.min(a,o.current.length-1)-1||b.top>=-f||b.bottom>=-f?s((()=>c(!0))):s((()=>c(!1)))),u&&(u.current=await n(te({...p,y:w},"offsetHeight"),d)),{y:w}}}),re=(e,t)=>{let{open:n,refs:r}=e,{enabled:u=!0,overflowRef:c,onChange:i}=t;const l=Y(i),a=o.useRef(!1),f=o.useRef(null),d=o.useRef(null);return o.useEffect((()=>{if(!u)return;function e(e){if(e.ctrlKey||!t||null==c.current)return;const n=e.deltaY,r=c.current.top>=-.5,o=c.current.bottom>=-.5,u=t.scrollHeight-t.clientHeight,i=n<0?-1:1,a=n<0?"max":"min";t.scrollHeight<=t.clientHeight||(!r&&n>0||!o&&n<0?(e.preventDefault(),s((()=>{l.current((e=>e+Math[a](n,u*i)))}))):/firefox/i.test(function(){const e=navigator.userAgentData;return null!=e&&e.brands?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}())&&(t.scrollTop+=n))}const t=r.floating.current;return n&&t?(t.addEventListener("wheel",e),requestAnimationFrame((()=>{f.current=t.scrollTop,null!=c.current&&(d.current={...c.current})})),()=>{f.current=null,d.current=null,t.removeEventListener("wheel",e)}):void 0}),[u,n,r,c,l]),u?{floating:{onKeyDown(){a.current=!0},onWheel(){a.current=!1},onPointerMove(){a.current=!1},onScroll(){const e=r.floating.current;if(c.current&&e&&a.current){if(null!==f.current){const t=e.scrollTop-f.current;(c.current.bottom<-.5&&t<-1||c.current.top<-.5&&t>1)&&s((()=>i((e=>e+t))))}requestAnimationFrame((()=>{f.current=e.scrollTop}))}}}}:{}},oe=function(e,t){let{open:n}=e,{enabled:r=!0,role:o="dialog"}=void 0===t?{}:t;const u=h(),c=h(),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":"alertdialog"===o?"dialog":o,"aria-controls":n?u:void 0,..."listbox"===o&&{role:"combobox"},..."menu"===o&&{id:c}},floating:{...i,..."menu"===o&&{"aria-labelledby":c}}}:{}},ue=function(e,t){let{open:n,onOpenChange:r,dataRef:u,refs:c}=e,{enabled:i=!0,pointerDown:l=!1,toggle:s=!0,ignoreMouse:a=!1}=void 0===t?{}:t;const f=o.useRef();function d(){var e;return"BUTTON"===(null==(e=c.domReference.current)?void 0:e.tagName)}function m(){return B(c.domReference.current)}return i?{reference:{onPointerDown(e){f.current=e.pointerType},onMouseDown(e){0===e.button&&("mouse"===f.current&&a||l&&(n?!s||u.current.openEvent&&"mousedown"!==u.current.openEvent.type||r(!1):r(!0),u.current.openEvent=e.nativeEvent))},onClick(e){l&&f.current?f.current=void 0:"mouse"===f.current&&a||(n?!s||u.current.openEvent&&"click"!==u.current.openEvent.type||r(!1):r(!0),u.current.openEvent=e.nativeEvent)},onKeyDown(e){f.current=void 0,d()||(" "!==e.key||m()||e.preventDefault(),"Enter"===e.key&&(n?s&&r(!1):r(!0)))},onKeyUp(e){d()||m()||" "===e.key&&(n?s&&r(!1):r(!0))}}}:{}};function ce(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 ie=function(e,t){let{open:n,onOpenChange:u,refs:c,events:i,nodeId:l}=e,{enabled:s=!0,escapeKey:a=!0,outsidePointerDown:f=!0,referencePointerDown:d=!1,ancestorScroll:m=!1,bubbles:v=!0}=void 0===t?{}:t;const g=E(),p=Y(u),h=null!=w();return o.useEffect((()=>{if(!n||!s)return;function e(e){if("Escape"===e.key){if(!v&&g&&D(g.nodesRef.current,l).length>0)return;i.emit("dismiss",{preventScroll:!1}),p.current(!1)}}function t(e){if(L(e.target)&&c.floating.current){var t;const n=null!=(t=c.floating.current.ownerDocument.defaultView)?t:window,r=e.target.scrollWidth>e.target.clientWidth,o=e.target.scrollHeight>e.target.clientHeight;let u=o&&e.offsetX>e.target.clientWidth;if(o){"rtl"===n.getComputedStyle(e.target).direction&&(u=e.offsetX<=e.target.offsetWidth-e.target.clientWidth)}if(u||r&&e.offsetY>e.target.clientHeight)return}const n=g&&D(g.nodesRef.current,l).some((t=>{var n;return ce(e,null==(n=t.context)?void 0:n.refs.floating.current)}));ce(e,c.floating.current)||ce(e,c.domReference.current)||n||!v&&g&&D(g.nodesRef.current,l).length>0||(i.emit("dismiss",!!h&&{preventScroll:!0}),p.current(!1))}function o(){p.current(!1)}const u=k(c.floating.current);a&&u.addEventListener("keydown",e),f&&u.addEventListener("pointerdown",t);const d=(m?[...L(c.reference.current)?r(c.reference.current):[],...L(c.floating.current)?r(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}))),()=>{a&&u.removeEventListener("keydown",e),f&&u.removeEventListener("pointerdown",t),d.forEach((e=>e.removeEventListener("scroll",o)))}}),[a,f,i,g,l,n,p,m,s,v,c,h]),s?{reference:{onPointerDown(){d&&(i.emit("dismiss"),u(!1))}}}:{}},le=function(e,t){let{open:n,onOpenChange:r,dataRef:u,refs:c,events:i}=e,{enabled:l=!0,keyboardOnly:s=!0}=void 0===t?{}:t;const a=o.useRef(""),f=o.useRef(!1),d=o.useRef();return o.useEffect((()=>{var e;if(!l)return;const t=null!=(e=k(c.floating.current).defaultView)?e:window;function r(){!n&&C(c.domReference.current)&&c.domReference.current.blur()}return t.addEventListener("blur",r),()=>{t.removeEventListener("blur",r)}}),[c,n,l]),o.useEffect((()=>{if(l)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(){f.current=!0}}),[i,l]),o.useEffect((()=>()=>{clearTimeout(d.current)}),[]),l?{reference:{onPointerDown(e){let{pointerType:t}=e;a.current=t,f.current=!(!t||!s)},onPointerLeave(){f.current=!1},onFocus(e){var t,n,o;f.current||"focus"===e.type&&"mousedown"===(null==(t=u.current.openEvent)?void 0:t.type)&&null!=(n=c.domReference.current)&&n.contains(null==(o=u.current.openEvent)?void 0:o.target)||(u.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){const t=e.relatedTarget;d.current=setTimeout((()=>{var e,n;null!=(e=c.floating.current)&&e.contains(t)||null!=(n=c.domReference.current)&&n.contains(t)||(f.current=!1,r(!1))}))}}}:{}};function se(e,t,n){return Math.floor(e/t)!==n}function ae(e,t){return t<0||t>=e.current.length}function fe(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:u=1}=void 0===t?{}:t;const c=e.current;let i=n;do{var l,s;i+=r?-u:u}while(i>=0&&i<=c.length-1&&(o?o.includes(i):null==c[i]||(null==(l=c[i])?void 0:l.hasAttribute("disabled"))||"true"===(null==(s=c[i])?void 0:s.getAttribute("aria-disabled"))));return i}function de(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function me(e,t){return de(t,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function ve(e,t,n){return de(t,"ArrowDown"===e,n?"ArrowLeft"===e:"ArrowRight"===e)||"Enter"===e||" "==e||""===e}function ge(e,t){return fe(e,{disabledIndices:t})}function pe(e,t){return fe(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}const he=function(e,t){let{open:n,onOpenChange:r,refs:u}=e,{listRef:c,activeIndex:i,onNavigate:l=(()=>{}),enabled:s=!0,selectedIndex:a=null,allowEscape:d=!1,loop:m=!1,nested:v=!1,rtl:g=!1,virtual:p=!1,focusItemOnOpen:h="auto",focusItemOnHover:b=!0,openOnArrowKeyDown:y=!0,disabledIndices:R,orientation:x="vertical",cols:I=1}=void 0===t?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:t;const T=w(),L=E(),A=G(n),M=o.useRef(h),O=o.useRef(null!=a?a:-1),D=o.useRef(null),P=Y(G(l)),S=Y(l),H=Y(R),K=o.useRef(!1),F=o.useRef(-1),[j,N]=o.useState(),W=o.useCallback(((e,t)=>{F.current=requestAnimationFrame((()=>{var n,r;p?N(null==(n=e.current[t.current])?void 0:n.id):null==(r=e.current[t.current])||r.focus({preventScroll:!0})}))}),[p]);function B(e){if(K.current=!0,v&&function(e,t,n){return de(t,n?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(e.key,x,g))return X(e),r(!1),void(C(u.domReference.current)&&u.domReference.current.focus());const t=O.current,o=ge(c,R),i=pe(c,R);if("Home"===e.key&&(O.current=o,l(O.current)),"End"===e.key&&(O.current=i,l(O.current)),I>1){const t=O.current;if("ArrowUp"===e.key){if(X(e),-1===t)O.current=i;else if(O.current=fe(c,{startingIndex:t,amount:I,decrement:!0,disabledIndices:R}),m&&(t-I<o||O.current<0)){const e=t%I,n=i%I,r=i-(n-e);O.current=n===e?i:n>e?r:r-I}ae(c,O.current)&&(O.current=t),l(O.current)}if("ArrowDown"===e.key&&(X(e),-1===t?O.current=o:(O.current=fe(c,{startingIndex:t,amount:I,disabledIndices:R}),m&&t+I>i&&(O.current=fe(c,{startingIndex:t%I-I,amount:I,disabledIndices:R}))),ae(c,O.current)&&(O.current=t),l(O.current)),"both"===x){const n=Math.floor(t/I);"ArrowRight"===e.key&&(X(e),t%I!=I-1?(O.current=fe(c,{startingIndex:t,disabledIndices:R}),m&&se(O.current,I,n)&&(O.current=fe(c,{startingIndex:t-t%I-1,disabledIndices:R}))):m&&(O.current=fe(c,{startingIndex:t-t%I-1,disabledIndices:R})),se(O.current,I,n)&&(O.current=t)),"ArrowLeft"===e.key&&(X(e),t%I!=0?(O.current=fe(c,{startingIndex:t,disabledIndices:R,decrement:!0}),m&&se(O.current,I,n)&&(O.current=fe(c,{startingIndex:t+(I-t%I),decrement:!0,disabledIndices:R}))):m&&(O.current=fe(c,{startingIndex:t+(I-t%I),decrement:!0,disabledIndices:R})),se(O.current,I,n)&&(O.current=t));const r=Math.floor(i/I)===n;return ae(c,O.current)&&(O.current=m&&r?"ArrowLeft"===e.key?i:fe(c,{startingIndex:t-t%I-1,disabledIndices:R}):t),void l(O.current)}}if(me(e.key,x)){if(X(e),n&&!p&&V(e.currentTarget.ownerDocument)===e.currentTarget)return O.current=ve(e.key,x,g)?o:i,void l(O.current);ve(e.key,x,g)?O.current=m?t>=i?d&&t!==c.current.length?-1:o:fe(c,{startingIndex:t,disabledIndices:R}):Math.min(i,fe(c,{startingIndex:t,disabledIndices:R})):O.current=m?t<=o?d&&-1!==t?c.current.length:i:fe(c,{startingIndex:t,decrement:!0,disabledIndices:R}):Math.max(o,fe(c,{startingIndex:t,decrement:!0,disabledIndices:R})),ae(c,O.current)?l(null):l(O.current)}}return f((()=>{s&&(!A&&n&&M.current&&null!=a&&S.current(a),A&&!n&&(cancelAnimationFrame(F.current),O.current=-1,null==P.current||P.current(null)))}),[n,A,a,c,S,P,W,s]),f((()=>{if(s&&n)if(null==i){if(null!=a)return;A&&(O.current=-1,W(c,O)),!A&&M.current&&(null!=D.current||!0===M.current&&null==D.current)&&(O.current=null==D.current||ve(D.current,x,g)||v?ge(c,H.current):pe(c,H.current),S.current(O.current),W(c,O))}else ae(c,i)||(O.current=i,W(c,O))}),[n,A,i,a,v,c,S,W,s,d,x,g,p,H]),f((()=>{if(s&&!n&&A){var e,t;const n=null==L||null==(e=L.nodesRef.current.find((e=>e.id===T)))||null==(t=e.context)?void 0:t.refs.floating.current;n&&!n.contains(V(k(n)))&&n.focus({preventScroll:!0})}}),[s,n,A,L,T]),f((()=>{D.current=null})),s?{reference:{...p&&n&&null!=i&&{"aria-activedescendant":j},onKeyDown(e){if(K.current=!0,p&&n)return B(e);(0===e.key.indexOf("Arrow")||"Enter"===e.key||" "===e.key||""===e.key)&&(D.current=e.key),v?function(e,t,n){return de(t,n?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(e.key,x,g)&&(X(e),n?(O.current=ge(c,R),l(O.current)):r(!0)):me(e.key,x)&&(null!=a&&(O.current=a),X(e),!n&&y?r(!0):B(e),n&&l(O.current))}},floating:{"aria-orientation":"both"===x?void 0:x,...p&&null!=i&&{"aria-activedescendant":j},onKeyDown:B,onPointerMove(){K.current=!1}},item:{onFocus(e){let{currentTarget:t}=e;const n=c.current.indexOf(t);-1!==n&&l(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...b&&{onMouseMove(e){let{currentTarget:t}=e;const n=t;if(n){const e=c.current.indexOf(n);-1!==e&&l(e)}},onPointerLeave(){var e;K.current||(O.current=-1,W(c,O),S.current(null),p||null==(e=u.floating.current)||e.focus({preventScroll:!0}))}}}}:{}},be=function(e,t){var n;let{open:r,dataRef:u}=e,{listRef:c,activeIndex:i,onMatch:l=(()=>{}),enabled:s=!0,findMatch:a=null,resetMs:d=1e3,ignoreKeys:m=[],selectedIndex:v=null}=void 0===t?{listRef:{current:[]},activeIndex:null}:t;const g=o.useRef(),p=o.useRef(""),h=o.useRef(null!=(n=null!=v?v:i)?n:-1),b=o.useRef(null);function y(e){if(!e.currentTarget.contains(V(k(e.currentTarget))))return;p.current.length>0&&" "!==p.current[0]&&(u.current.typing=!0," "===e.key&&X(e));const t=c.current;if(null==t||m.includes(e.key)||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)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="",h.current=b.current),p.current+=e.key,clearTimeout(g.current),g.current=setTimeout((()=>{p.current="",h.current=b.current,u.current.typing=!1}),d);const n=h.current,r=[...t.slice((null!=n?n:0)+1),...t.slice(0,(null!=n?n:0)+1)],o=a?a(r,p.current):r.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(p.current)))),i=o?t.indexOf(o):-1;-1!==i&&(l(i),b.current=i)}return f((()=>{r&&(clearTimeout(g.current),b.current=null,p.current="")}),[r]),f((()=>{var e;r&&""===p.current&&(h.current=null!=(e=null!=v?v:i)?e:-1)}),[r,v,i]),s?{reference:{onKeyDown:y},floating:{onKeyDown:y}}:{}};export{_ as FloatingDelayGroup,z as FloatingFocusManager,x as FloatingNode,N as FloatingOverlay,K as FloatingPortal,I as FloatingTree,ne as inner,P as safePolygon,ue as useClick,ee as useDelayGroup,$ as useDelayGroupContext,ie as useDismiss,A as useFloating,R as useFloatingNodeId,w as useFloatingParentNodeId,H as useFloatingPortalNode,E as useFloatingTree,le as useFocus,Q as useHover,h as useId,re as useInnerOffset,O as useInteractions,he as useListNavigation,oe as useRole,be 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 h(e){var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document}function y(e){var t;return null!=(t=h(e).defaultView)?t:window}function b(e){return!!e&&e instanceof y(e).Element}function w(e){return!!e&&e instanceof y(e).HTMLElement}function E(e,t,n){const r=new Map;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;if(0===n.indexOf("on")){var u;if(r.has(n)||r.set(n,[]),"function"==typeof o)null==(u=r.get(n))||u.push(o);e[n]=function(){for(var e,t=arguments.length,o=new Array(t),u=0;u<t;u++)o[u]=arguments[u];null==(e=r.get(n))||e.forEach((e=>e(...o)))}}else e[n]=o})),e):e),{})}}function R(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 x="floating-ui-root",I=function(e){let{id:t=x,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 k(){return k=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},k.apply(this,arguments)}const O="data-floating-ui-scroll-lock",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",k({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));var M=new WeakMap,L=new WeakMap,C={},A=0,D=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];C[n]||(C[n]=new WeakMap);var o=C[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=(M.get(e)||0)+1,a=(o.get(e)||0)+1;M.set(e,i),o.set(e,a),u.push(e),1===i&&r&&L.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=M.get(e)-1,r=o.get(e)-1;M.set(e,t),o.set(e,r),t||(L.has(e)||e.removeAttribute("aria-hidden"),L.delete(e)),r||e.removeAttribute(n)})),--A||(M=new WeakMap,M=new WeakMap,L=new WeakMap,C={})}};function P(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 H(e){const t=n.useRef(e);return c((()=>{t.current=e})),t}function K(e,t){void 0===t&&(t=!1),requestAnimationFrame((()=>{null==e||e.focus({preventScroll:t})}))}const N=u.forwardRef((function(e,t){return u.createElement("span",k({},e,{ref:t,tabIndex:0,style:{position:"fixed",opacity:"0",pointerEvents:"none",outline:"0"}}))}));function W(e){const t=n.useRef();return c((()=>{t.current=e}),[e]),t.current}function q(e,t,n){return n&&"mouse"!==n?0:"number"==typeof e?e:null==e?void 0:e[t]}const V=u.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),X=()=>u.useContext(V);function Y(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:e.elements.floating[t]}}}}function B(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 U="ArrowUp",G="ArrowDown",_="ArrowLeft",z="ArrowRight";function J(e,t,n){return Math.floor(e/t)!==n}function Q(e,t){return t<0||t>=e.current.length}function Z(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:u=1}=void 0===t?{}:t;const c=e.current;let i=n;do{var l,a;i+=r?-u:u}while(i>=0&&i<=c.length-1&&(o?o.includes(i):null==c[i]||(null==(l=c[i])?void 0:l.hasAttribute("disabled"))||"true"===(null==(a=c[i])?void 0:a.getAttribute("aria-disabled"))));return i}function $(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function ee(e,t){return $(t,e===U||e===G,e===_||e===z)}function te(e,t,n){return $(t,e===G,n?e===_:e===z)||"Enter"===e||" "==e||""===e}function ne(e,t){return Z(e,{disabledIndices:t})}function re(e,t){return Z(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(V.Provider,{value:u.useMemo((()=>({...r,setState:o,setCurrentId:c})),[r,o,c])},t)},e.FloatingFocusManager=function(e){var t;let{context:{refs:n,nodeId:r,onOpenChange:o,dataRef:c,events:i},children:l,order:a=["content"],endGuard:s=!0,preventTabbing:f=!1,initialFocus:d=0,returnFocus:v=!0,modal:m=!0}=e;const g=H(a),y=H(o),E=p(),x=null==(null==E||null==(t=E.nodesRef.current.find((e=>e.id===r)))?void 0:t.parentId),I=u.useCallback((()=>g.current.map((e=>{return"reference"===e?n.domReference.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.domReference.current)return!0;if(w(e)){var t;return"-"!==(null!=(t=e.getAttribute("tabindex"))?t:"0")[0].trim()}}))),[g,n]);u.useEffect((()=>{if(!m)return;const e=0===I().filter((e=>e!==n.floating.current&&e!==n.domReference.current)).length;function t(t){if("Tab"===t.key){(f||e)&&j(t);const r=I(),o="composedPath"in t?t.composedPath()[0]:t.target;"reference"===g.current[0]&&o===n.domReference.current&&(j(t),t.shiftKey?K(r[r.length-1]):K(r[1])),"floating"===g.current[1]&&o===n.floating.current&&t.shiftKey&&(j(t),K(r[0]))}}const r=h(n.floating.current);return r.addEventListener("keydown",t),()=>{r.removeEventListener("keydown",t)}}),[f,m,I,g,n]),u.useEffect((()=>{function e(e){var t,o;const u=e.relatedTarget,c=!(null!=(t=n.floating.current)&&t.contains(u)),i=b(n.domReference.current)&&!n.domReference.current.contains(u),l=E&&R(E.nodesRef.current,r).length>0,a=E&&e.currentTarget===n.domReference.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}(E.nodesRef.current,r))?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&&y.current(!1)}const t=n.floating.current,o=n.domReference.current;if(t&&w(o)){let n;return!m&&t.addEventListener("focusout",e),!m&&o.addEventListener("focusout",e),m&&(n=g.current.includes("reference")?D([o,t]):D(t)),()=>{!m&&t.removeEventListener("focusout",e),!m&&o.removeEventListener("focusout",e),null==n||n()}}}),[r,E,m,y,g,c,I,n]),u.useEffect((()=>{if(f&&!x)return;const e=n.floating.current,t=h(e);let r=v,o=!1,u=P(t);if(u===t.body&&n.domReference.current&&(u=n.domReference.current),!f)if("number"==typeof d){var c;const t=null!=(c=I()[d])?c:e;K(t,t===e)}else if(w(d.current)){var l;const t=null!=(l=d.current)?l:e;K(t,t===e)}function a(e){void 0===e&&(e=!1),"object"==typeof e?(r=!0,o=e.preventScroll):r=e}return i.on("dismiss",a),()=>{i.off("dismiss",a),r&&w(u)&&K(u,o)}}),[f,I,d,v,n,i,x]);const k=()=>{var e;return"combobox"===(null==(e=n.domReference.current)?void 0:e.getAttribute("role"))&&S(n.domReference.current)};return u.createElement(u.Fragment,null,m&&u.createElement(N,{onFocus:e=>{if(k())return;j(e);const t=I();"reference"===a[0]?K(t[0]):K(t[t.length-1])}}),u.cloneElement(l,a.includes("floating")?{tabIndex:0}:{}),m&&s&&u.createElement(N,{onFocus:e=>{k()||(j(e),K(I()[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=x,root:o=null}=e;const u=I({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.inner=e=>({name:"inner",options:e,async fn(n){const{listRef:o,overflowRef:u,onFallbackChange:c,offset:i=0,index:l=0,minItemsVisible:a=4,referenceOverflowThreshold:s=0,...f}=e,{rects:d,elements:{floating:v}}=n,m=o.current[l];if(!m)return{};const g={...n,...await t.offset(-m.offsetTop-d.reference.height/2-m.offsetHeight/2-i).fn(n)},p=await t.detectOverflow(Y(g,"scrollHeight"),f),h=await t.detectOverflow(g,{...f,elementContext:"reference"}),y=Math.max(0,p.top),b=g.y+y,w=Math.max(0,v.scrollHeight-y-Math.max(0,p.bottom));return v.style.maxHeight=w+"px",v.scrollTop=y,c&&(v.offsetHeight<m.offsetHeight*Math.min(a,o.current.length-1)-1||h.top>=-s||h.bottom>=-s?r.flushSync((()=>c(!0))):r.flushSync((()=>c(!1)))),u&&(u.current=await t.detectOverflow(Y({...g,y:b},"offsetHeight"),f)),{y:b}}}),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,m;function g(){clearTimeout(t),a()}if(clearTimeout(t),e.pointerType&&"mouse"!==e.pointerType)return;const{clientX:p,clientY:h}=e,y="composedPath"in e?e.composedPath()[0]:e.target;if("pointermove"===e.type&&null!=(v=l.domReference.current)&&v.contains(y))return;if(f&&R(f.nodesRef.current,s).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if(null!=(m=l.floating.current)&&m.contains(y)&&!d)return void(u=!0);if(!l.domReference.current||!l.floating.current||null==i||null==o||null==c)return;const b=l.domReference.current.getBoundingClientRect(),w=l.floating.current.getBoundingClientRect(),E=i.split("-")[0],x=o>w.right-w.width/2,I=c>w.bottom-w.height/2;if("top"===E&&c>=b.bottom-1||"bottom"===E&&c<=b.top+1||"left"===E&&o>=b.right-1||"right"===E&&o<=b.left+1)return g();switch(E){case"top":if(p>=w.left&&p<=w.right&&h>=w.top&&h<=b.top+1)return;break;case"bottom":if(p>=w.left&&p<=w.right&&h>=b.bottom-1&&h<=w.bottom)return;break;case"left":if(p>=w.left&&p<=b.left+1&&h>=w.top&&h<=w.bottom)return;break;case"right":if(p>=b.right-1&&p<=w.right&&h>=w.top&&h<=w.bottom)return}if(u)return g();const k=function(e){let[t,n]=e;const o=w.width>b.width,u=w.height>b.height;switch(E){case"top":return[[o?t+r/2:x?t+4*r:t-4*r,n+r+1],[o?t-r/2:x?t+4*r:t-4*r,n+r+1],...[[w.left,x||o?w.bottom-r:w.top],[w.right,x?o?w.bottom-r:w.top:w.bottom-r]]];case"bottom":return[[o?t+r/2:x?t+4*r:t-4*r,n-r],[o?t-r/2:x?t+4*r:t-4*r,n-r],...[[w.left,x||o?w.top+r:w.bottom],[w.right,x?o?w.top+r:w.bottom:w.top+r]]];case"left":{const e=[t+r+1,u?n+r/2:I?n+4*r:n-4*r],o=[t+r+1,u?n-r/2:I?n+4*r:n-4*r];return[...[[I||u?w.right-r:w.left,w.top],[I?u?w.right-r:w.left:w.right-r,w.bottom]],e,o]}case"right":return[[t-r,u?n+r/2:I?n+4*r:n-4*r],[t-r,u?n-r/2:I?n+4*r:n-4*r],...[[I||u?w.left+r:w.right,w.top],[I?u?w.left+r:w.right:w.left+r,w.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,h],k)?g():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(){var e;return"BUTTON"===(null==(e=c.domReference.current)?void 0:e.tagName)}function v(){return S(c.domReference.current)}return i?{reference:{onPointerDown(e){f.current=e.pointerType},onMouseDown(e){0===e.button&&("mouse"===f.current&&s||l&&(n?!a||o.current.openEvent&&"mousedown"!==o.current.openEvent.type||r(!1):r(!0),o.current.openEvent=e.nativeEvent))},onClick(e){l&&f.current?f.current=void 0:"mouse"===f.current&&s||(n?!a||o.current.openEvent&&"click"!==o.current.openEvent.type||r(!1):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}=X(),a=H(r);u.useEffect((()=>{c&&a.current&&(l((e=>({...e,delay:{open:1,close:q(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=X,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 y=p(),w=H(o),E=null!=g();return u.useEffect((()=>{if(!r||!a)return;function e(e){if("Escape"===e.key){if(!m&&y&&R(y.nodesRef.current,l).length>0)return;i.emit("dismiss",{preventScroll:!1}),w.current(!1)}}function n(e){if(b(e.target)&&c.floating.current){var n;const r=null!=(n=c.floating.current.ownerDocument.defaultView)?n:window,o=t.getOverflowAncestors(c.floating.current).filter(b).find((e=>{const{overflow:t,overflowX:n,overflowY:o}=r.getComputedStyle(e);return/scroll|auto/.test(t+n+o)}));let u=e.offsetX>e.target.clientWidth;if(b(o)){"rtl"===r.getComputedStyle(o).direction&&(u=e.offsetX<=o.offsetWidth-o.clientWidth)}if(u||e.offsetY>e.target.clientHeight)return}const r=y&&R(y.nodesRef.current,l).some((t=>{var n;return B(e,null==(n=t.context)?void 0:n.refs.floating.current)}));B(e,c.floating.current)||B(e,c.domReference.current)||r||!m&&y&&R(y.nodesRef.current,l).length>0||(i.emit("dismiss",!!E&&{preventScroll:!0}),w.current(!1))}function o(){w.current(!1)}const u=h(c.floating.current);s&&u.addEventListener("keydown",e),f&&u.addEventListener("pointerdown",n);const d=(v?[...b(c.reference.current)?t.getOverflowAncestors(c.reference.current):[],...b(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("pointerdown",n),d.forEach((e=>e.removeEventListener("scroll",o)))}}),[s,f,i,y,l,r,w,v,a,m,c,E]),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(null),m=u.useRef({}),g=u.useState((()=>i()))[0],h=t.useFloating({placement:l,middleware:a,strategy:s,whileElementsMounted:o}),y=u.useMemo((()=>({...h.refs,domReference:v})),[h.refs]),w=u.useMemo((()=>({...h,refs:y,dataRef:m,nodeId:f,events:g,open:n,onOpenChange:r})),[h,f,g,n,r,y]);c((()=>{const e=null==d?void 0:d.nodesRef.current.find((e=>e.id===f));e&&(e.context=w)}));const{reference:E}=h,R=u.useCallback((e=>{(b(e)||null===e)&&(w.refs.domReference.current=e),E(e)}),[E,w.refs]);return u.useMemo((()=>({...h,context:w,refs:y,reference:R})),[h,y,w,R])},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=I,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=h(c.floating.current),r=null!=(e=t.defaultView)?e:window;function o(){s.current&&c.domReference.current===P(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)&&null!=(n=c.domReference.current)&&n.contains(null==(u=o.current.openEvent)?void 0:u.target)||(o.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){var t,n;const o=e.relatedTarget;null!=(t=c.floating.current)&&t.contains(o)||null!=(n=c.domReference.current)&&n.contains(o)||(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,move:a=!0}=void 0===t?{}:t;const{open:s,onOpenChange:f,dataRef:d,events:v,refs:m}=e,y=p(),w=g(),E=H(f),R=H(o),x=H(r),I=W(s),k=u.useRef(),O=u.useRef(),T=u.useRef(),M=u.useRef(),L=u.useRef(!0),C=u.useRef(!1),A=u.useCallback((()=>{var e;const t=null==(e=d.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[d]);u.useEffect((()=>{if(n)return v.on("dismiss",e),()=>{v.off("dismiss",e)};function e(){clearTimeout(O.current),clearTimeout(M.current),L.current=!0}}),[n,v,m]),u.useEffect((()=>{if(!n||!R.current)return;function e(){A()&&E.current(!1)}const t=h(m.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[m,E,n,R,d,A]);const D=u.useCallback((function(e){void 0===e&&(e=!0);const t=q(x.current,"close",k.current);t&&!T.current?(clearTimeout(O.current),O.current=setTimeout((()=>E.current(!1)),t)):e&&(clearTimeout(O.current),E.current(!1))}),[x,E]),P=u.useCallback((()=>{T.current&&(h(m.floating.current).removeEventListener("pointermove",T.current),T.current=void 0)}),[m]),F=u.useCallback((()=>{h(m.floating.current).body.style.pointerEvents="",C.current=!1}),[m]);if(u.useEffect((()=>{if(!n)return;function t(){return!!d.current.openEvent&&["click","mousedown"].includes(d.current.openEvent.type)}function r(e){if(clearTimeout(O.current),L.current=!1,s||i&&"mouse"!==k.current||l>0&&0===q(x.current,"open"))return;d.current.openEvent=e;const t=q(x.current,"open",k.current);t?O.current=setTimeout((()=>{E.current(!0)}),t):E.current(!0)}function o(n){if(t())return;const r=h(m.floating.current);if(clearTimeout(M.current),R.current)return clearTimeout(O.current),T.current&&r.removeEventListener("pointermove",T.current),T.current=R.current({...e,tree:y,x:n.clientX,y:n.clientY,onClose(){F(),P(),D()}}),void r.addEventListener("pointermove",T.current);D()}function u(n){t()||null==R.current||R.current({...e,tree:y,x:n.clientX,y:n.clientY,leave:!0,onClose(){F(),P(),D()}})(n)}const c=m.floating.current,f=m.domReference.current;return b(f)?(s&&f.addEventListener("mouseleave",u),null==c||c.addEventListener("mouseleave",u),a&&f.addEventListener("mousemove",r),f.addEventListener("mouseenter",r),f.addEventListener("mouseleave",o),()=>{s&&f.removeEventListener("mouseleave",u),null==c||c.removeEventListener("mouseleave",u),a&&f.removeEventListener("mousemove",r),f.removeEventListener("mouseenter",r),f.removeEventListener("mouseleave",o)}):void 0}),[n,e,i,l,a,D,P,F,s,y,m,x,R,d,E]),c((()=>{if(n&&s&&R.current&&A()){h(m.floating.current).body.style.pointerEvents="none",C.current=!0;const n=m.domReference.current,r=m.floating.current;if(b(n)&&r){var e,t;const o=null==y||null==(e=y.nodesRef.current.find((e=>e.id===w)))||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,s,w,m,y,R,d,A]),c((()=>{I&&!s&&(k.current=void 0,P(),F())})),u.useEffect((()=>()=>{P(),clearTimeout(O.current),clearTimeout(M.current),C.current&&F()}),[n,P,F]),!n)return{};function S(e){k.current=e.pointerType}return{reference:{onPointerDown:S,onPointerEnter:S,onMouseMove(){s||0===l||(clearTimeout(M.current),M.current=setTimeout((()=>{L.current||f(!0)}),l))}},floating:{onMouseEnter(){clearTimeout(O.current)},onMouseLeave(){D(!1)}}}},e.useId=d,e.useInnerOffset=(e,t)=>{let{open:n,refs:o}=e,{enabled:c=!0,overflowRef:i,onChange:l}=t;const a=H(l),s=u.useRef(!1),f=u.useRef(null),d=u.useRef(null);return u.useEffect((()=>{if(!c)return;function e(e){if(e.ctrlKey||!t||null==i.current)return;const n=e.deltaY,o=i.current.top>=-.5,u=i.current.bottom>=-.5,c=t.scrollHeight-t.clientHeight,l=n<0?-1:1,s=n<0?"max":"min";t.scrollHeight<=t.clientHeight||(!o&&n>0||!u&&n<0?(e.preventDefault(),r.flushSync((()=>{a.current((e=>e+Math[s](n,c*l)))}))):/firefox/i.test(function(){const e=navigator.userAgentData;return null!=e&&e.brands?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}())&&(t.scrollTop+=n))}const t=o.floating.current;return n&&t?(t.addEventListener("wheel",e),requestAnimationFrame((()=>{f.current=t.scrollTop,null!=i.current&&(d.current={...i.current})})),()=>{f.current=null,d.current=null,t.removeEventListener("wheel",e)}):void 0}),[c,n,o,i,a]),c?{floating:{onKeyDown(){s.current=!0},onWheel(){s.current=!1},onPointerMove(){s.current=!1},onScroll(){const e=o.floating.current;if(i.current&&e&&s.current){if(null!==f.current){const t=e.scrollTop-f.current;(i.current.bottom<-.5&&t<-1||i.current.top<-.5&&t>1)&&r.flushSync((()=>l((e=>e+t))))}requestAnimationFrame((()=>{f.current=e.scrollTop}))}}}}:{}},e.useInteractions=function(e){return void 0===e&&(e=[]),{getReferenceProps:t=>E(t,e,"reference"),getFloatingProps:t=>E(t,e,"floating"),getItemProps:t=>E(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:y=!1,virtual:b=!1,focusItemOnOpen:E="auto",focusItemOnHover:R=!0,openOnArrowKeyDown:x=!0,disabledIndices:I,orientation:k="vertical",cols:O=1}=void 0===t?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:t;const T=g(),M=p(),L=W(n),C=u.useRef(E),A=u.useRef(null!=f?f:-1),D=u.useRef(null),F=H(W(a)),S=H(a),K=H(I),N=u.useRef(!1),q=u.useRef(-1),[V,X]=u.useState(),Y=u.useCallback(((e,t)=>{q.current=requestAnimationFrame((()=>{var n,r;b?X(null==(n=e.current[t.current])?void 0:n.id):null==(r=e.current[t.current])||r.focus({preventScroll:!0})}))}),[b]);function B(e){if(N.current=!0,m&&function(e,t,n){return $(t,n?e===z:e===_,e===U)}(e.key,k,y))return j(e),r(!1),void(w(o.domReference.current)&&o.domReference.current.focus());const t=A.current,u=ne(i,I),c=re(i,I);if("Home"===e.key&&(A.current=u,a(A.current)),"End"===e.key&&(A.current=c,a(A.current)),O>1){const t=A.current;if(e.key===U){if(j(e),-1===t)A.current=c;else if(A.current=Z(i,{startingIndex:t,amount:O,decrement:!0,disabledIndices:I}),v&&(t-O<u||A.current<0)){const e=t%O,n=c%O,r=c-(n-e);A.current=n===e?c:n>e?r:r-O}Q(i,A.current)&&(A.current=t),a(A.current)}if(e.key===G&&(j(e),-1===t?A.current=u:(A.current=Z(i,{startingIndex:t,amount:O,disabledIndices:I}),v&&t+O>c&&(A.current=Z(i,{startingIndex:t%O-O,amount:O,disabledIndices:I}))),Q(i,A.current)&&(A.current=t),a(A.current)),"both"===k){const n=Math.floor(t/O);e.key===z&&(j(e),t%O!=O-1?(A.current=Z(i,{startingIndex:t,disabledIndices:I}),v&&J(A.current,O,n)&&(A.current=Z(i,{startingIndex:t-t%O-1,disabledIndices:I}))):v&&(A.current=Z(i,{startingIndex:t-t%O-1,disabledIndices:I})),J(A.current,O,n)&&(A.current=t)),e.key===_&&(j(e),t%O!=0?(A.current=Z(i,{startingIndex:t,disabledIndices:I,decrement:!0}),v&&J(A.current,O,n)&&(A.current=Z(i,{startingIndex:t+(O-t%O),decrement:!0,disabledIndices:I}))):v&&(A.current=Z(i,{startingIndex:t+(O-t%O),decrement:!0,disabledIndices:I})),J(A.current,O,n)&&(A.current=t));const r=Math.floor(c/O)===n;return Q(i,A.current)&&(A.current=v&&r?e.key===_?c:Z(i,{startingIndex:t-t%O-1,disabledIndices:I}):t),void a(A.current)}}if(ee(e.key,k)){if(j(e),n&&!b&&P(e.currentTarget.ownerDocument)===e.currentTarget)return A.current=te(e.key,k,y)?u:c,void a(A.current);te(e.key,k,y)?A.current=v?t>=c?d&&t!==i.current.length?-1:u:Z(i,{startingIndex:t,disabledIndices:I}):Math.min(c,Z(i,{startingIndex:t,disabledIndices:I})):A.current=v?t<=u?d&&-1!==t?i.current.length:c:Z(i,{startingIndex:t,decrement:!0,disabledIndices:I}):Math.max(u,Z(i,{startingIndex:t,decrement:!0,disabledIndices:I})),Q(i,A.current)?a(null):a(A.current)}}return c((()=>{s&&(!L&&n&&C.current&&null!=f&&S.current(f),L&&!n&&(cancelAnimationFrame(q.current),A.current=-1,null==F.current||F.current(null)))}),[n,L,f,i,S,F,Y,s]),c((()=>{if(s&&n)if(null==l){if(null!=f)return;L&&(A.current=-1,Y(i,A)),!L&&C.current&&(null!=D.current||!0===C.current&&null==D.current)&&(A.current=null==D.current||te(D.current,k,y)||m?ne(i,K.current):re(i,K.current),S.current(A.current),Y(i,A))}else Q(i,l)||(A.current=l,Y(i,A))}),[n,L,l,f,m,i,S,Y,s,d,k,y,b,K]),c((()=>{if(s&&!n&&L){var e,t;const n=null==M||null==(e=M.nodesRef.current.find((e=>e.id===T)))||null==(t=e.context)?void 0:t.refs.floating.current;n&&!n.contains(P(h(n)))&&n.focus({preventScroll:!0})}}),[s,n,L,M,T]),c((()=>{D.current=null})),s?{reference:{...b&&n&&null!=l&&{"aria-activedescendant":V},onKeyDown(e){if(N.current=!0,b&&n)return B(e);(0===e.key.indexOf("Arrow")||"Enter"===e.key||" "===e.key||""===e.key)&&(D.current=e.key),m?function(e,t,n){return $(t,n?e===_:e===z,e===G)}(e.key,k,y)&&(j(e),n?(A.current=ne(i,I),a(A.current)):r(!0)):ee(e.key,k)&&(null!=f&&(A.current=f),j(e),!n&&x?r(!0):B(e),n&&a(A.current))}},floating:{"aria-orientation":"both"===k?void 0:k,...b&&null!=l&&{"aria-activedescendant":V},onKeyDown:B,onPointerMove(){N.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})},...R&&{onMouseMove(e){let{currentTarget:t}=e;const n=t;if(n){const e=i.current.indexOf(n);-1!==e&&a(e)}},onPointerLeave(){var e;N.current||(A.current=-1,Y(i,A),S.current(null),b||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":"alertdialog"===o?"dialog":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(""),y=u.useRef(null!=(n=null!=m?m:l)?n:-1),b=u.useRef(null);function w(e){if(!e.currentTarget.contains(P(h(e.currentTarget))))return;p.current.length>0&&" "!==p.current[0]&&(o.current.typing=!0," "===e.key&&j(e));const t=i.current;if(null==t||v.includes(e.key)||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)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="",y.current=b.current),p.current+=e.key,clearTimeout(g.current),g.current=setTimeout((()=>{p.current="",y.current=b.current,o.current.typing=!1}),d);const n=y.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),b.current=c)}return c((()=>{r&&(clearTimeout(g.current),b.current=null,p.current="")}),[r]),c((()=>{var e;r&&""===p.current&&(y.current=null!=(e=null!=m?m:l)?e:-1)}),[r,m,l]),s?{reference:{onKeyDown:w},floating:{onKeyDown:w}}:{}},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),g=()=>{var e,t;return null!=(e=null==(t=u.useContext(v))?void 0:t.id)?e:null},p=()=>u.useContext(m);function h(e){var t;return null!=(t=null==e?void 0:e.ownerDocument)?t:document}function b(e){var t;return null!=(t=h(e).defaultView)?t:window}function y(e){return!!e&&e instanceof b(e).Element}function w(e){return!!e&&e instanceof b(e).HTMLElement}function E(e,t,n){const r=new Map;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;if(0===n.indexOf("on")){var u;if(r.has(n)||r.set(n,[]),"function"==typeof o)null==(u=r.get(n))||u.push(o);e[n]=function(){for(var e,t=arguments.length,o=new Array(t),u=0;u<t;u++)o[u]=arguments[u];null==(e=r.get(n))||e.forEach((e=>e(...o)))}}else e[n]=o})),e):e),{})}}function R(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 x="floating-ui-root",I=function(e){let{id:t=x,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 k(){return k=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},k.apply(this,arguments)}const T="data-floating-ui-scroll-lock",O=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(T))return;document.body.setAttribute(T,"");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(T),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(T),window.scrollTo(a,s)}}),[n]),u.createElement("div",k({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));var M=new WeakMap,L=new WeakMap,C={},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];C[n]||(C[n]=new WeakMap);var o=C[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=(M.get(e)||0)+1,a=(o.get(e)||0)+1;M.set(e,i),o.set(e,a),u.push(e),1===i&&r&&L.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=M.get(e)-1,r=o.get(e)-1;M.set(e,t),o.set(e,r),t||(L.has(e)||e.removeAttribute("aria-hidden"),L.delete(e)),r||e.removeAttribute(n)})),--A||(M=new WeakMap,M=new WeakMap,L=new WeakMap,C={})}};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 H(e){const t=n.useRef(e);return c((()=>{t.current=e})),t}function K(e,t){void 0===t&&(t=!1),requestAnimationFrame((()=>{null==e||e.focus({preventScroll:t})}))}const N=u.forwardRef((function(e,t){return u.createElement("span",k({},e,{ref:t,tabIndex:0,style:{position:"fixed",opacity:"0",pointerEvents:"none",outline:"0"}}))}));function W(e){const t=n.useRef();return c((()=>{t.current=e}),[e]),t.current}function q(e,t,n){return n&&"mouse"!==n?0:"number"==typeof e?e:null==e?void 0:e[t]}const V=u.createContext({delay:1e3,initialDelay:1e3,currentId:null,setCurrentId:()=>{},setState:()=>{}}),B=()=>u.useContext(V);function X(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:e.elements.floating[t]}}}}function Y(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 U="ArrowUp",G="ArrowDown",_="ArrowLeft",z="ArrowRight";function J(e,t,n){return Math.floor(e/t)!==n}function Q(e,t){return t<0||t>=e.current.length}function Z(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:u=1}=void 0===t?{}:t;const c=e.current;let i=n;do{var l,a;i+=r?-u:u}while(i>=0&&i<=c.length-1&&(o?o.includes(i):null==c[i]||(null==(l=c[i])?void 0:l.hasAttribute("disabled"))||"true"===(null==(a=c[i])?void 0:a.getAttribute("aria-disabled"))));return i}function $(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function ee(e,t){return $(t,e===U||e===G,e===_||e===z)}function te(e,t,n){return $(t,e===G,n?e===_:e===z)||"Enter"===e||" "==e||""===e}function ne(e,t){return Z(e,{disabledIndices:t})}function re(e,t){return Z(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(V.Provider,{value:u.useMemo((()=>({...r,setState:o,setCurrentId:c})),[r,o,c])},t)},e.FloatingFocusManager=function(e){var t;let{context:{refs:n,nodeId:r,onOpenChange:o,dataRef:c,events:i},children:l,order:a=["content"],endGuard:s=!0,preventTabbing:f=!1,initialFocus:d=0,returnFocus:v=!0,modal:m=!0}=e;const g=H(a),b=H(o),E=p(),x=null==(null==E||null==(t=E.nodesRef.current.find((e=>e.id===r)))?void 0:t.parentId),I=u.useCallback((()=>g.current.map((e=>{return"reference"===e?n.domReference.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.domReference.current)return!0;if(w(e)){var t;return"-"!==(null!=(t=e.getAttribute("tabindex"))?t:"0")[0].trim()}}))),[g,n]);u.useEffect((()=>{if(!m)return;const e=0===I().filter((e=>e!==n.floating.current&&e!==n.domReference.current)).length;function t(t){if("Tab"===t.key){(f||e)&&j(t);const r=I(),o="composedPath"in t?t.composedPath()[0]:t.target;"reference"===g.current[0]&&o===n.domReference.current&&(j(t),t.shiftKey?K(r[r.length-1]):K(r[1])),"floating"===g.current[1]&&o===n.floating.current&&t.shiftKey&&(j(t),K(r[0]))}}const r=h(n.floating.current);return r.addEventListener("keydown",t),()=>{r.removeEventListener("keydown",t)}}),[f,m,I,g,n]),u.useEffect((()=>{function e(e){var t,o;const u=e.relatedTarget,c=!(null!=(t=n.floating.current)&&t.contains(u)),i=y(n.domReference.current)&&!n.domReference.current.contains(u),l=E&&R(E.nodesRef.current,r).length>0,a=E&&e.currentTarget===n.domReference.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}(E.nodesRef.current,r))?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&&b.current(!1)}const t=n.floating.current,o=n.domReference.current;if(t&&w(o)){let n;return!m&&t.addEventListener("focusout",e),!m&&o.addEventListener("focusout",e),m&&(n=g.current.includes("reference")?P([o,t]):P(t)),()=>{!m&&t.removeEventListener("focusout",e),!m&&o.removeEventListener("focusout",e),null==n||n()}}}),[r,E,m,b,g,c,I,n]),u.useEffect((()=>{if(f&&!x)return;const e=n.floating.current,t=h(e);let r=v,o=!1,u=D(t);if(u===t.body&&n.domReference.current&&(u=n.domReference.current),!f)if("number"==typeof d){var c;const t=null!=(c=I()[d])?c:e;K(t,t===e)}else if(w(d.current)){var l;const t=null!=(l=d.current)?l:e;K(t,t===e)}function a(e){void 0===e&&(e=!1),"object"==typeof e?(r=!0,o=e.preventScroll):r=e}return i.on("dismiss",a),()=>{i.off("dismiss",a),r&&w(u)&&K(u,o)}}),[f,I,d,v,n,i,x]);const k=()=>{var e;return"combobox"===(null==(e=n.domReference.current)?void 0:e.getAttribute("role"))&&S(n.domReference.current)};return u.createElement(u.Fragment,null,m&&u.createElement(N,{onFocus:e=>{if(k())return;j(e);const t=I();"reference"===a[0]?K(t[0]):K(t[t.length-1])}}),u.cloneElement(l,a.includes("floating")?{tabIndex:0}:{}),m&&s&&u.createElement(N,{onFocus:e=>{k()||(j(e),K(I()[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=O,e.FloatingPortal=e=>{let{children:t,id:n=x,root:o=null}=e;const u=I({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.inner=e=>({name:"inner",options:e,async fn(n){const{listRef:o,overflowRef:u,onFallbackChange:c,offset:i=0,index:l=0,minItemsVisible:a=4,referenceOverflowThreshold:s=0,...f}=e,{rects:d,elements:{floating:v}}=n,m=o.current[l];if(!m)return{};const g={...n,...await t.offset(-m.offsetTop-d.reference.height/2-m.offsetHeight/2-i).fn(n)},p=await t.detectOverflow(X(g,"scrollHeight"),f),h=await t.detectOverflow(g,{...f,elementContext:"reference"}),b=Math.max(0,p.top),y=g.y+b,w=Math.max(0,v.scrollHeight-b-Math.max(0,p.bottom));return v.style.maxHeight=w+"px",v.scrollTop=b,c&&(v.offsetHeight<m.offsetHeight*Math.min(a,o.current.length-1)-1||h.top>=-s||h.bottom>=-s?r.flushSync((()=>c(!0))):r.flushSync((()=>c(!1)))),u&&(u.current=await t.detectOverflow(X({...g,y:y},"offsetHeight"),f)),{y:y}}}),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,m;function g(){clearTimeout(t),a()}if(clearTimeout(t),e.pointerType&&"mouse"!==e.pointerType)return;const{clientX:p,clientY:h}=e,b="composedPath"in e?e.composedPath()[0]:e.target;if("pointermove"===e.type&&null!=(v=l.domReference.current)&&v.contains(b))return;if(f&&R(f.nodesRef.current,s).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if(null!=(m=l.floating.current)&&m.contains(b)&&!d)return void(u=!0);if(!l.domReference.current||!l.floating.current||null==i||null==o||null==c)return;const y=l.domReference.current.getBoundingClientRect(),w=l.floating.current.getBoundingClientRect(),E=i.split("-")[0],x=o>w.right-w.width/2,I=c>w.bottom-w.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 g();switch(E){case"top":if(p>=w.left&&p<=w.right&&h>=w.top&&h<=y.top+1)return;break;case"bottom":if(p>=w.left&&p<=w.right&&h>=y.bottom-1&&h<=w.bottom)return;break;case"left":if(p>=w.left&&p<=y.left+1&&h>=w.top&&h<=w.bottom)return;break;case"right":if(p>=y.right-1&&p<=w.right&&h>=w.top&&h<=w.bottom)return}if(u)return g();const k=function(e){let[t,n]=e;const o=w.width>y.width,u=w.height>y.height;switch(E){case"top":return[[o?t+r/2:x?t+4*r:t-4*r,n+r+1],[o?t-r/2:x?t+4*r:t-4*r,n+r+1],...[[w.left,x||o?w.bottom-r:w.top],[w.right,x?o?w.bottom-r:w.top:w.bottom-r]]];case"bottom":return[[o?t+r/2:x?t+4*r:t-4*r,n-r],[o?t-r/2:x?t+4*r:t-4*r,n-r],...[[w.left,x||o?w.top+r:w.bottom],[w.right,x?o?w.top+r:w.bottom:w.top+r]]];case"left":{const e=[t+r+1,u?n+r/2:I?n+4*r:n-4*r],o=[t+r+1,u?n-r/2:I?n+4*r:n-4*r];return[...[[I||u?w.right-r:w.left,w.top],[I?u?w.right-r:w.left:w.right-r,w.bottom]],e,o]}case"right":return[[t-r,u?n+r/2:I?n+4*r:n-4*r],[t-r,u?n-r/2:I?n+4*r:n-4*r],...[[I||u?w.left+r:w.right,w.top],[I?u?w.left+r:w.right:w.left+r,w.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,h],k)?g():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(){var e;return"BUTTON"===(null==(e=c.domReference.current)?void 0:e.tagName)}function v(){return S(c.domReference.current)}return i?{reference:{onPointerDown(e){f.current=e.pointerType},onMouseDown(e){0===e.button&&("mouse"===f.current&&s||l&&(n?!a||o.current.openEvent&&"mousedown"!==o.current.openEvent.type||r(!1):r(!0),o.current.openEvent=e.nativeEvent))},onClick(e){l&&f.current?f.current=void 0:"mouse"===f.current&&s||(n?!a||o.current.openEvent&&"click"!==o.current.openEvent.type||r(!1):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}=B(),a=H(r);u.useEffect((()=>{c&&a.current&&(l((e=>({...e,delay:{open:1,close:q(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=B,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 b=p(),w=H(o),E=null!=g();return u.useEffect((()=>{if(!r||!a)return;function e(e){if("Escape"===e.key){if(!m&&b&&R(b.nodesRef.current,l).length>0)return;i.emit("dismiss",{preventScroll:!1}),w.current(!1)}}function n(e){if(y(e.target)&&c.floating.current){var t;const n=null!=(t=c.floating.current.ownerDocument.defaultView)?t:window,r=e.target.scrollWidth>e.target.clientWidth,o=e.target.scrollHeight>e.target.clientHeight;let u=o&&e.offsetX>e.target.clientWidth;if(o){"rtl"===n.getComputedStyle(e.target).direction&&(u=e.offsetX<=e.target.offsetWidth-e.target.clientWidth)}if(u||r&&e.offsetY>e.target.clientHeight)return}const n=b&&R(b.nodesRef.current,l).some((t=>{var n;return Y(e,null==(n=t.context)?void 0:n.refs.floating.current)}));Y(e,c.floating.current)||Y(e,c.domReference.current)||n||!m&&b&&R(b.nodesRef.current,l).length>0||(i.emit("dismiss",!!E&&{preventScroll:!0}),w.current(!1))}function o(){w.current(!1)}const u=h(c.floating.current);s&&u.addEventListener("keydown",e),f&&u.addEventListener("pointerdown",n);const d=(v?[...y(c.reference.current)?t.getOverflowAncestors(c.reference.current):[],...y(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("pointerdown",n),d.forEach((e=>e.removeEventListener("scroll",o)))}}),[s,f,i,b,l,r,w,v,a,m,c,E]),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(null),m=u.useRef({}),g=u.useState((()=>i()))[0],h=t.useFloating({placement:l,middleware:a,strategy:s,whileElementsMounted:o}),b=u.useMemo((()=>({...h.refs,domReference:v})),[h.refs]),w=u.useMemo((()=>({...h,refs:b,dataRef:m,nodeId:f,events:g,open:n,onOpenChange:r})),[h,f,g,n,r,b]);c((()=>{const e=null==d?void 0:d.nodesRef.current.find((e=>e.id===f));e&&(e.context=w)}));const{reference:E}=h,R=u.useCallback((e=>{(y(e)||null===e)&&(w.refs.domReference.current=e),E(e)}),[E,w.refs]);return u.useMemo((()=>({...h,context:w,refs:b,reference:R})),[h,b,w,R])},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=I,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),d=u.useRef();return u.useEffect((()=>{var e;if(!l)return;const t=null!=(e=h(c.floating.current).defaultView)?e:window;function r(){!n&&w(c.domReference.current)&&c.domReference.current.blur()}return t.addEventListener("blur",r),()=>{t.removeEventListener("blur",r)}}),[c,n,l]),u.useEffect((()=>{if(l)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(){f.current=!0}}),[i,l]),u.useEffect((()=>()=>{clearTimeout(d.current)}),[]),l?{reference:{onPointerDown(e){let{pointerType:t}=e;s.current=t,f.current=!(!t||!a)},onPointerLeave(){f.current=!1},onFocus(e){var t,n,u;f.current||"focus"===e.type&&"mousedown"===(null==(t=o.current.openEvent)?void 0:t.type)&&null!=(n=c.domReference.current)&&n.contains(null==(u=o.current.openEvent)?void 0:u.target)||(o.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){const t=e.relatedTarget;d.current=setTimeout((()=>{var e,n;null!=(e=c.floating.current)&&e.contains(t)||null!=(n=c.domReference.current)&&n.contains(t)||(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,move:a=!0}=void 0===t?{}:t;const{open:s,onOpenChange:f,dataRef:d,events:v,refs:m}=e,b=p(),w=g(),E=H(f),R=H(o),x=H(r),I=W(s),k=u.useRef(),T=u.useRef(),O=u.useRef(),M=u.useRef(),L=u.useRef(!0),C=u.useRef(!1),A=u.useCallback((()=>{var e;const t=null==(e=d.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[d]);u.useEffect((()=>{if(n)return v.on("dismiss",e),()=>{v.off("dismiss",e)};function e(){clearTimeout(T.current),clearTimeout(M.current),L.current=!0}}),[n,v,m]),u.useEffect((()=>{if(!n||!R.current)return;function e(){A()&&E.current(!1)}const t=h(m.floating.current).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[m,E,n,R,d,A]);const P=u.useCallback((function(e){void 0===e&&(e=!0);const t=q(x.current,"close",k.current);t&&!O.current?(clearTimeout(T.current),T.current=setTimeout((()=>E.current(!1)),t)):e&&(clearTimeout(T.current),E.current(!1))}),[x,E]),D=u.useCallback((()=>{O.current&&(h(m.floating.current).removeEventListener("pointermove",O.current),O.current=void 0)}),[m]),F=u.useCallback((()=>{h(m.floating.current).body.style.pointerEvents="",C.current=!1}),[m]);if(u.useEffect((()=>{if(!n)return;function t(){return!!d.current.openEvent&&["click","mousedown"].includes(d.current.openEvent.type)}function r(e){if(clearTimeout(T.current),L.current=!1,i&&"mouse"!==k.current||l>0&&0===q(x.current,"open"))return;d.current.openEvent=e;const t=q(x.current,"open",k.current);t?T.current=setTimeout((()=>{E.current(!0)}),t):E.current(!0)}function o(n){if(t())return;const r=h(m.floating.current);if(clearTimeout(M.current),R.current)return clearTimeout(T.current),O.current&&r.removeEventListener("pointermove",O.current),O.current=R.current({...e,tree:b,x:n.clientX,y:n.clientY,onClose(){F(),D(),P()}}),void r.addEventListener("pointermove",O.current);P()}function u(n){t()||null==R.current||R.current({...e,tree:b,x:n.clientX,y:n.clientY,leave:!0,onClose(){F(),D(),P()}})(n)}const c=m.floating.current,f=m.domReference.current;return y(f)?(s&&f.addEventListener("mouseleave",u),null==c||c.addEventListener("mouseleave",u),a&&f.addEventListener("mousemove",r,{once:!0}),f.addEventListener("mouseenter",r),f.addEventListener("mouseleave",o),()=>{s&&f.removeEventListener("mouseleave",u),null==c||c.removeEventListener("mouseleave",u),a&&f.removeEventListener("mousemove",r),f.removeEventListener("mouseenter",r),f.removeEventListener("mouseleave",o)}):void 0}),[n,e,i,l,a,P,D,F,s,b,m,x,R,d,E]),c((()=>{if(n&&s&&R.current&&A()){h(m.floating.current).body.style.pointerEvents="none",C.current=!0;const n=m.domReference.current,r=m.floating.current;if(y(n)&&r){var e,t;const o=null==b||null==(e=b.nodesRef.current.find((e=>e.id===w)))||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,s,w,m,b,R,d,A]),c((()=>{I&&!s&&(k.current=void 0,D(),F())})),u.useEffect((()=>()=>{D(),clearTimeout(T.current),clearTimeout(M.current),C.current&&F()}),[n,D,F]),!n)return{};function S(e){k.current=e.pointerType}return{reference:{onPointerDown:S,onPointerEnter:S,onMouseMove(){s||0===l||(clearTimeout(M.current),M.current=setTimeout((()=>{L.current||f(!0)}),l))}},floating:{onMouseEnter(){clearTimeout(T.current)},onMouseLeave(){P(!1)}}}},e.useId=d,e.useInnerOffset=(e,t)=>{let{open:n,refs:o}=e,{enabled:c=!0,overflowRef:i,onChange:l}=t;const a=H(l),s=u.useRef(!1),f=u.useRef(null),d=u.useRef(null);return u.useEffect((()=>{if(!c)return;function e(e){if(e.ctrlKey||!t||null==i.current)return;const n=e.deltaY,o=i.current.top>=-.5,u=i.current.bottom>=-.5,c=t.scrollHeight-t.clientHeight,l=n<0?-1:1,s=n<0?"max":"min";t.scrollHeight<=t.clientHeight||(!o&&n>0||!u&&n<0?(e.preventDefault(),r.flushSync((()=>{a.current((e=>e+Math[s](n,c*l)))}))):/firefox/i.test(function(){const e=navigator.userAgentData;return null!=e&&e.brands?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}())&&(t.scrollTop+=n))}const t=o.floating.current;return n&&t?(t.addEventListener("wheel",e),requestAnimationFrame((()=>{f.current=t.scrollTop,null!=i.current&&(d.current={...i.current})})),()=>{f.current=null,d.current=null,t.removeEventListener("wheel",e)}):void 0}),[c,n,o,i,a]),c?{floating:{onKeyDown(){s.current=!0},onWheel(){s.current=!1},onPointerMove(){s.current=!1},onScroll(){const e=o.floating.current;if(i.current&&e&&s.current){if(null!==f.current){const t=e.scrollTop-f.current;(i.current.bottom<-.5&&t<-1||i.current.top<-.5&&t>1)&&r.flushSync((()=>l((e=>e+t))))}requestAnimationFrame((()=>{f.current=e.scrollTop}))}}}}:{}},e.useInteractions=function(e){return void 0===e&&(e=[]),{getReferenceProps:t=>E(t,e,"reference"),getFloatingProps:t=>E(t,e,"floating"),getItemProps:t=>E(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:y=!1,focusItemOnOpen:E="auto",focusItemOnHover:R=!0,openOnArrowKeyDown:x=!0,disabledIndices:I,orientation:k="vertical",cols:T=1}=void 0===t?{listRef:{current:[]},activeIndex:null,onNavigate:()=>{}}:t;const O=g(),M=p(),L=W(n),C=u.useRef(E),A=u.useRef(null!=f?f:-1),P=u.useRef(null),F=H(W(a)),S=H(a),K=H(I),N=u.useRef(!1),q=u.useRef(-1),[V,B]=u.useState(),X=u.useCallback(((e,t)=>{q.current=requestAnimationFrame((()=>{var n,r;y?B(null==(n=e.current[t.current])?void 0:n.id):null==(r=e.current[t.current])||r.focus({preventScroll:!0})}))}),[y]);function Y(e){if(N.current=!0,m&&function(e,t,n){return $(t,n?e===z:e===_,e===U)}(e.key,k,b))return j(e),r(!1),void(w(o.domReference.current)&&o.domReference.current.focus());const t=A.current,u=ne(i,I),c=re(i,I);if("Home"===e.key&&(A.current=u,a(A.current)),"End"===e.key&&(A.current=c,a(A.current)),T>1){const t=A.current;if(e.key===U){if(j(e),-1===t)A.current=c;else if(A.current=Z(i,{startingIndex:t,amount:T,decrement:!0,disabledIndices:I}),v&&(t-T<u||A.current<0)){const e=t%T,n=c%T,r=c-(n-e);A.current=n===e?c:n>e?r:r-T}Q(i,A.current)&&(A.current=t),a(A.current)}if(e.key===G&&(j(e),-1===t?A.current=u:(A.current=Z(i,{startingIndex:t,amount:T,disabledIndices:I}),v&&t+T>c&&(A.current=Z(i,{startingIndex:t%T-T,amount:T,disabledIndices:I}))),Q(i,A.current)&&(A.current=t),a(A.current)),"both"===k){const n=Math.floor(t/T);e.key===z&&(j(e),t%T!=T-1?(A.current=Z(i,{startingIndex:t,disabledIndices:I}),v&&J(A.current,T,n)&&(A.current=Z(i,{startingIndex:t-t%T-1,disabledIndices:I}))):v&&(A.current=Z(i,{startingIndex:t-t%T-1,disabledIndices:I})),J(A.current,T,n)&&(A.current=t)),e.key===_&&(j(e),t%T!=0?(A.current=Z(i,{startingIndex:t,disabledIndices:I,decrement:!0}),v&&J(A.current,T,n)&&(A.current=Z(i,{startingIndex:t+(T-t%T),decrement:!0,disabledIndices:I}))):v&&(A.current=Z(i,{startingIndex:t+(T-t%T),decrement:!0,disabledIndices:I})),J(A.current,T,n)&&(A.current=t));const r=Math.floor(c/T)===n;return Q(i,A.current)&&(A.current=v&&r?e.key===_?c:Z(i,{startingIndex:t-t%T-1,disabledIndices:I}):t),void a(A.current)}}if(ee(e.key,k)){if(j(e),n&&!y&&D(e.currentTarget.ownerDocument)===e.currentTarget)return A.current=te(e.key,k,b)?u:c,void a(A.current);te(e.key,k,b)?A.current=v?t>=c?d&&t!==i.current.length?-1:u:Z(i,{startingIndex:t,disabledIndices:I}):Math.min(c,Z(i,{startingIndex:t,disabledIndices:I})):A.current=v?t<=u?d&&-1!==t?i.current.length:c:Z(i,{startingIndex:t,decrement:!0,disabledIndices:I}):Math.max(u,Z(i,{startingIndex:t,decrement:!0,disabledIndices:I})),Q(i,A.current)?a(null):a(A.current)}}return c((()=>{s&&(!L&&n&&C.current&&null!=f&&S.current(f),L&&!n&&(cancelAnimationFrame(q.current),A.current=-1,null==F.current||F.current(null)))}),[n,L,f,i,S,F,X,s]),c((()=>{if(s&&n)if(null==l){if(null!=f)return;L&&(A.current=-1,X(i,A)),!L&&C.current&&(null!=P.current||!0===C.current&&null==P.current)&&(A.current=null==P.current||te(P.current,k,b)||m?ne(i,K.current):re(i,K.current),S.current(A.current),X(i,A))}else Q(i,l)||(A.current=l,X(i,A))}),[n,L,l,f,m,i,S,X,s,d,k,b,y,K]),c((()=>{if(s&&!n&&L){var e,t;const n=null==M||null==(e=M.nodesRef.current.find((e=>e.id===O)))||null==(t=e.context)?void 0:t.refs.floating.current;n&&!n.contains(D(h(n)))&&n.focus({preventScroll:!0})}}),[s,n,L,M,O]),c((()=>{P.current=null})),s?{reference:{...y&&n&&null!=l&&{"aria-activedescendant":V},onKeyDown(e){if(N.current=!0,y&&n)return Y(e);(0===e.key.indexOf("Arrow")||"Enter"===e.key||" "===e.key||""===e.key)&&(P.current=e.key),m?function(e,t,n){return $(t,n?e===_:e===z,e===G)}(e.key,k,b)&&(j(e),n?(A.current=ne(i,I),a(A.current)):r(!0)):ee(e.key,k)&&(null!=f&&(A.current=f),j(e),!n&&x?r(!0):Y(e),n&&a(A.current))}},floating:{"aria-orientation":"both"===k?void 0:k,...y&&null!=l&&{"aria-activedescendant":V},onKeyDown:Y,onPointerMove(){N.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})},...R&&{onMouseMove(e){let{currentTarget:t}=e;const n=t;if(n){const e=i.current.indexOf(n);-1!==e&&a(e)}},onPointerLeave(){var e;N.current||(A.current=-1,X(i,A),S.current(null),y||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":"alertdialog"===o?"dialog":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),y=u.useRef(null);function w(e){if(!e.currentTarget.contains(D(h(e.currentTarget))))return;p.current.length>0&&" "!==p.current[0]&&(o.current.typing=!0," "===e.key&&j(e));const t=i.current;if(null==t||v.includes(e.key)||1!==e.key.length||e.ctrlKey||e.metaKey||e.altKey)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=y.current),p.current+=e.key,clearTimeout(g.current),g.current=setTimeout((()=>{p.current="",b.current=y.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),y.current=c)}return c((()=>{r&&(clearTimeout(g.current),y.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:w},floating:{onKeyDown:w}}:{}},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.9.0",
"version": "0.9.1",
"@rollingversions": {

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

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

Sorry, the diff of this file is not supported yet

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

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