@floating-ui/react
Advanced tools
Comparing version 0.23.0 to 0.23.1
@@ -1,1 +0,1 @@ | ||
import{platform as e,getOverflowAncestors as t,offset as n,detectOverflow as r,useFloating as o}from"@floating-ui/react-dom";export{arrow,autoPlacement,autoUpdate,computePosition,detectOverflow,flip,getOverflowAncestors,hide,inline,limitShift,offset,platform,shift,size}from"@floating-ui/react-dom";import*as u from"react";import{useLayoutEffect as i,useEffect as c,useRef as l}from"react";import{hideOthers as s}from"aria-hidden";import{tabbable as a}from"tabbable";import{createPortal as f,flushSync as d}from"react-dom";function m(){return m=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},m.apply(this,arguments)}var p="undefined"!=typeof document?i:c;let v=!1,g=0;const h=()=>"floating-ui-"+g++;const b=u["useId".toString()]||function(){const[e,t]=u.useState((()=>v?h():void 0));return p((()=>{null==e&&t(h())}),[]),u.useEffect((()=>{v||(v=!0)}),[]),e},y=u.forwardRef((function(t,n){var r;let{context:{placement:o,elements:{floating:i},middlewareData:{arrow:c}},width:l=14,height:s=7,tipRadius:a=0,strokeWidth:f=0,staticOffset:d,stroke:p,d:v,...g}=t;f*=2;const h=f/2,y=l/2*(a/-8+1),w=s/2*a/4,[E,R]=o.split("-"),x=!!i&&e.isRTL(i),I=!!v,k="top"===E||"bottom"===E,C=d&&"end"===R?"bottom":"top";let M=d&&"end"===R?"right":"left";d&&x&&(M="end"===R?"left":"right");const T=I?0:h,O=null!=(null==c?void 0:c.x)?d||c.x:"",L=null!=(null==c?void 0:c.y)?d||c.y+T:"",P=v||"M0,0 H"+l+" L"+(l-y)+","+(s-w)+" Q"+l/2+","+s+" "+y+","+(s-w)+" Z",A={top:I?"rotate(180deg)":"",left:I?"rotate(90deg)":"rotate(-90deg)",bottom:I?"":"rotate(180deg)",right:I?"rotate(-90deg)":"rotate(90deg)"}[E],S=b();return u.createElement("svg",m({},g,{suppressHydrationWarning:!0,"aria-hidden":!0,ref:n,width:I?l:l+f,height:l,viewBox:"0 0 "+l+" "+(s>l?s:l),style:{...g.style,position:"absolute",pointerEvents:"none",[M]:O,[C]:L,[E]:k||I?"100%":"calc(100% - "+f/2+"px)",transform:A+(null!=(r=g.style)&&r.transform?" "+g.style.transform:"")}}),f>0&&u.createElement("path",{clipPath:"url(#"+S+")",fill:"none",stroke:p,strokeWidth:f+(v?0:1),d:P}),u.createElement("path",{stroke:f&&!v?g.fill:"none",d:P}),u.createElement("clipPath",{id:S},u.createElement("rect",{x:-h,y:h*(I?-1:1),width:l+f,height:l})))}));function w(){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){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}const E=u.createContext(null),R=u.createContext(null),x=()=>{var e;return(null==(e=u.useContext(E))?void 0:e.id)||null},I=()=>u.useContext(R),k=e=>{const t=b(),n=I(),r=x(),o=e||r;return p((()=>{const e={id:t,parentId:o};return null==n||n.addNode(e),()=>{null==n||n.removeNode(e)}}),[n,t,o]),t},C=e=>{let{children:t,id:n}=e;const r=x();return u.createElement(E.Provider,{value:u.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},M=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))}),[]),i=u.useState((()=>w()))[0];return u.createElement(R.Provider,{value:u.useMemo((()=>({nodesRef:n,addNode:r,removeNode:o,events:i})),[n,r,o,i])},t)};function T(e){return(null==e?void 0:e.ownerDocument)||document}function O(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function L(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function P(e){return T(e).defaultView||window}function A(e){return!!e&&e instanceof P(e).Element}function S(e){return!!e&&e instanceof P(e).HTMLElement}function D(e){if(0===e.mozInputSource&&e.isTrusted)return!0;const t=/Android/i;return(t.test(O())||t.test(L()))&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType}function N(e){return 0===e.width&&0===e.height||1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"!==e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail}function F(){return/apple/i.test(navigator.vendor)}function K(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function B(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&(r=n,"undefined"!=typeof ShadowRoot&&(r instanceof P(r).ShadowRoot||r instanceof ShadowRoot))){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}var r;return!1}function H(e){const t=l(e);return p((()=>{t.current=e})),t}function _(e,t,n){return n&&!K(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}const q=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:{domReference:c,floating:l},refs:s}=e,{enabled:a=!0,delay:f=0,handleClose:d=null,mouseOnly:m=!1,restMs:v=0,move:g=!0}=t,h=I(),b=x(),y=H(d),w=H(f),E=u.useRef(),R=u.useRef(),k=u.useRef(),C=u.useRef(),M=u.useRef(!0),O=u.useRef(!1),L=u.useRef((()=>{})),P=u.useCallback((()=>{var e;const t=null==(e=o.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[o]);u.useEffect((()=>{if(a)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(){clearTimeout(R.current),clearTimeout(C.current),M.current=!0}}),[a,i]),u.useEffect((()=>{if(!a||!y.current||!n)return;function e(){P()&&r(!1)}const t=T(l).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[l,n,r,a,y,o,P]);const S=u.useCallback((function(e){void 0===e&&(e=!0);const t=_(w.current,"close",E.current);t&&!k.current?(clearTimeout(R.current),R.current=setTimeout((()=>r(!1)),t)):e&&(clearTimeout(R.current),r(!1))}),[w,r]),D=u.useCallback((()=>{L.current(),k.current=void 0}),[]),N=u.useCallback((()=>{if(O.current){const e=T(s.floating.current).body;e.style.pointerEvents="",e.removeAttribute("data-floating-ui-safe-polygon"),O.current=!1}}),[s]);return u.useEffect((()=>{if(a&&A(c)){const e=c;return n&&e.addEventListener("mouseleave",s),null==l||l.addEventListener("mouseleave",s),g&&e.addEventListener("mousemove",u,{once:!0}),e.addEventListener("mouseenter",u),e.addEventListener("mouseleave",i),()=>{n&&e.removeEventListener("mouseleave",s),null==l||l.removeEventListener("mouseleave",s),g&&e.removeEventListener("mousemove",u),e.removeEventListener("mouseenter",u),e.removeEventListener("mouseleave",i)}}function t(){return!!o.current.openEvent&&["click","mousedown"].includes(o.current.openEvent.type)}function u(e){if(clearTimeout(R.current),M.current=!1,m&&!K(E.current)||v>0&&0===_(w.current,"open"))return;o.current.openEvent=e;const t=_(w.current,"open",E.current);t?R.current=setTimeout((()=>{r(!0)}),t):r(!0)}function i(r){if(t())return;L.current();const o=T(l);if(clearTimeout(C.current),y.current){n||clearTimeout(R.current),k.current=y.current({...e,tree:h,x:r.clientX,y:r.clientY,onClose(){N(),D(),S()}});const t=k.current;return o.addEventListener("mousemove",t),void(L.current=()=>{o.removeEventListener("mousemove",t)})}("touch"!==E.current||!B(l,r.relatedTarget))&&S()}function s(n){t()||null==y.current||y.current({...e,tree:h,x:n.clientX,y:n.clientY,onClose(){N(),D(),S()}})(n)}}),[c,l,a,e,m,v,g,S,D,N,r,n,h,w,y,o]),p((()=>{var e;if(a&&n&&null!=(e=y.current)&&e.__options.blockPointerEvents&&P()){const e=T(l).body;if(e.setAttribute("data-floating-ui-safe-polygon",""),e.style.pointerEvents="none",O.current=!0,A(c)&&l){var t,r;const e=c,n=null==h||null==(t=h.nodesRef.current.find((e=>e.id===b)))||null==(r=t.context)?void 0:r.elements.floating;return n&&(n.style.pointerEvents=""),e.style.pointerEvents="auto",l.style.pointerEvents="auto",()=>{e.style.pointerEvents="",l.style.pointerEvents=""}}}}),[a,n,b,l,c,h,y,o,P]),p((()=>{n||(E.current=void 0,D(),N())}),[n,D,N]),u.useEffect((()=>()=>{D(),clearTimeout(R.current),clearTimeout(C.current),N()}),[a,D,N]),u.useMemo((()=>{if(!a)return{};function e(e){E.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){n||0===v||(clearTimeout(C.current),C.current=setTimeout((()=>{M.current||r(!0)}),v))}},floating:{onMouseEnter(){clearTimeout(R.current)},onMouseLeave(){i.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),S(!1)}}}}),[i,a,v,n,r,S])},j=u.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),W=()=>u.useContext(j),U=e=>{let{children:t,delay:n,timeoutMs:r=0}=e;const[o,i]=u.useReducer(((e,t)=>({...e,...t})),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),c=u.useRef(null),l=u.useCallback((e=>{i({currentId:e})}),[]);return p((()=>{o.currentId?null===c.current?c.current=o.currentId:i({isInstantPhase:!0}):(i({isInstantPhase:!1}),c.current=null)}),[o.currentId]),u.createElement(j.Provider,{value:u.useMemo((()=>({...o,setState:i,setCurrentId:l})),[o,i,l])},t)},V=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:u,setCurrentId:i,initialDelay:c,setState:l,timeoutMs:s}=W();p((()=>{u&&(l({delay:{open:1,close:_(c,"close")}}),u!==o&&r(!1))}),[o,r,l,u,c]),p((()=>{function e(){r(!1),l({delay:c,currentId:null})}if(!n&&u===o){if(s){const t=window.setTimeout(e,s);return()=>{clearTimeout(t)}}e()}}),[n,l,u,o,r,c,s]),p((()=>{n&&i(o)}),[n,i,o])};function X(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}let Y=0;function z(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Y);const u=()=>null==e?void 0:e.focus({preventScroll:n});o?u():Y=requestAnimationFrame(u)}function Z(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}function G(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Q(e){return S(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function J(e){e.preventDefault(),e.stopPropagation()}const $=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ee(e,t){const n=a(e,$());"prev"===t&&n.reverse();const r=n.indexOf(X(T(e)));return n.slice(r+1)[0]}function te(){return ee(document.body,"next")}function ne(){return ee(document.body,"prev")}function re(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!B(n,r)}function oe(e){a(e,$()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function ue(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const ie={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function ce(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const le=u.forwardRef((function(e,t){const[n,r]=u.useState();return p((()=>(F()&&r("button"),document.addEventListener("keydown",ce),()=>{document.removeEventListener("keydown",ce)})),[]),u.createElement("span",m({},e,{ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,"data-floating-ui-focus-guard":"",style:ie}))})),se=u.createContext(null),ae=function(e){let{id:t,root:n}=void 0===e?{}:e;const[r,o]=u.useState(null),i=u.useRef(null),c=b(),l=de(),s=u.useMemo((()=>({id:t,root:n,portalContext:l,uniqueId:c})),[t,n,l,c]),a=u.useRef();return p((()=>{const e=i.current;return()=>{null==r||r.remove(),null==e||e.remove()}}),[r,s]),p((()=>{if(a.current===s)return;a.current=s;const{id:e,root:t,portalContext:n,uniqueId:r}=s,u=e?document.getElementById(e):null,i="data-floating-ui-portal";if(u){const e=document.createElement("div");e.id=r,e.setAttribute(i,""),u.appendChild(e),o(e)}else{let u=(null==n?void 0:n.portalNode)||t||document.body,c=null;e&&(c=document.createElement("div"),c.id=e,u.appendChild(c));const l=document.createElement("div");l.id=r,l.setAttribute(i,""),u=c||u,u.appendChild(l),o(l)}}),[s]),r},fe=e=>{let{children:t,id:n,root:r=null,preserveTabOrder:o=!0}=e;const i=ae({id:n,root:r}),[c,l]=u.useState(null),s=u.useRef(null),a=u.useRef(null),d=u.useRef(null),m=u.useRef(null),p=!!c&&!c.modal&&!(!r&&!i)&&o;return u.useEffect((()=>{if(i&&o&&(null==c||!c.modal))return i.addEventListener("focusin",e,!0),i.addEventListener("focusout",e,!0),()=>{i.removeEventListener("focusin",e,!0),i.removeEventListener("focusout",e,!0)};function e(e){if(i&&re(e)){("focusin"===e.type?ue:oe)(i)}}}),[i,o,null==c?void 0:c.modal]),u.createElement(se.Provider,{value:u.useMemo((()=>({preserveTabOrder:o,beforeOutsideRef:s,afterOutsideRef:a,beforeInsideRef:d,afterInsideRef:m,portalNode:i,setFocusManagerState:l})),[o,i])},p&&i&&u.createElement(le,{"data-type":"outside",ref:s,onFocus:e=>{if(re(e,i)){var t;null==(t=d.current)||t.focus()}else{const e=ne()||(null==c?void 0:c.refs.domReference.current);null==e||e.focus()}}}),p&&i&&u.createElement("span",{"aria-owns":i.id,style:ie}),i&&f(t,i),p&&i&&u.createElement(le,{"data-type":"outside",ref:a,onFocus:e=>{if(re(e,i)){var t;null==(t=m.current)||t.focus()}else{const e=te()||(null==c?void 0:c.refs.domReference.current);null==e||e.focus(),(null==c?void 0:c.closeOnFocusOut)&&(null==c||c.onOpenChange(!1))}}}))},de=()=>u.useContext(se),me=u.forwardRef((function(e,t){return u.createElement("button",m({},e,{type:"button",ref:t,tabIndex:-1,style:ie}))}));function pe(e){let{context:t,children:n,order:r=["content"],guards:o=!0,initialFocus:i=0,returnFocus:c=!0,modal:l=!0,visuallyHiddenDismiss:f=!1,closeOnFocusOut:d=!0}=e;const{open:m,refs:v,nodeId:g,onOpenChange:h,events:b,dataRef:y,elements:{domReference:w,floating:E}}=t,R=H(r),x=H(i),k=H(c),C=I(),M=de(),[O,L]=u.useState(null),P="number"==typeof i&&i<0,A=u.useRef(null),D=u.useRef(null),N=u.useRef(!1),F=u.useRef(null),K=u.useRef(!1),_=null!=M,q=w&&"combobox"===w.getAttribute("role")&&Q(w),j=u.useCallback((function(e){return void 0===e&&(e=E),e?a(e,$()):[]}),[E]),W=u.useCallback((e=>{const t=j(e);return R.current.map((e=>w&&"reference"===e?w:E&&"floating"===e?E:t)).filter(Boolean).flat()}),[w,E,R,j]);u.useEffect((()=>{if(!l)return;function e(e){if("Tab"===e.key){0!==j().length||q||J(e);const t=W(),n=G(e);"reference"===R.current[0]&&n===w&&(J(e),e.shiftKey?z(t[t.length-1]):z(t[1])),"floating"===R.current[1]&&n===E&&e.shiftKey&&(J(e),z(t[0]))}}const t=T(E);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[w,E,l,R,v,q,j,W]),u.useEffect((()=>{if(d)return E&&S(w)?(w.addEventListener("focusout",t),w.addEventListener("pointerdown",e),!l&&E.addEventListener("focusout",t),()=>{w.removeEventListener("focusout",t),w.removeEventListener("pointerdown",e),!l&&E.removeEventListener("focusout",t)}):void 0;function e(){K.current=!0,setTimeout((()=>{K.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const e=!(B(w,t)||B(E,t)||B(t,E)||B(null==M?void 0:M.portalNode,t)||null!=t&&t.hasAttribute("data-floating-ui-focus-guard")||C&&(Z(C.nodesRef.current,g).find((e=>{var n,r;return B(null==(n=e.context)?void 0:n.elements.floating,t)||B(null==(r=e.context)?void 0:r.elements.domReference,t)}))||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}(C.nodesRef.current,g).find((e=>{var n,r;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(r=e.context)?void 0:r.elements.domReference)===t}))));t&&e&&!K.current&&t!==F.current&&(N.current=!0,h(!1))}))}}),[w,E,l,g,C,M,h,d]),u.useEffect((()=>{var e;const t=Array.from((null==M||null==(e=M.portalNode)?void 0:e.querySelectorAll("[data-floating-ui-portal]"))||[]);if(E&&l){const e=[E,...t,...[A.current,D.current].filter(Boolean)],n=s(R.current.includes("reference")||q?e.concat(w||[]):e);return()=>{n()}}}),[w,E,l,R,M,q]),u.useEffect((()=>{if(l&&!o&&E){const e=[],t=$(),n=a(T(E).body,t),r=W(),o=n.filter((e=>!r.includes(e)));return o.forEach(((t,n)=>{e[n]=t.getAttribute("tabindex"),t.setAttribute("tabindex","-1")})),()=>{o.forEach(((t,n)=>{const r=e[n];null==r?t.removeAttribute("tabindex"):t.setAttribute("tabindex",r)}))}}}),[E,l,o,W]),p((()=>{if(!E)return;let e=!1;const t=T(E),n=X(t),r=y.current;function o(t){if("escapeKey"===t.type&&v.domReference.current&&(F.current=v.domReference.current),["referencePress","escapeKey"].includes(t.type))return;const n=t.data.returnFocus;"object"==typeof n?(N.current=!1,e=n.preventScroll):N.current=!n}return F.current=n,queueMicrotask((()=>{const e=W(E),t=x.current,r=("number"==typeof t?e[t]:t.current)||E,o=B(E,n);P||o||!m||z(r,{preventScroll:r===E})})),b.on("dismiss",o),()=>{b.off("dismiss",o);const n=X(t);(B(E,n)||C&&Z(C.nodesRef.current,g).some((e=>{var t;return B(null==(t=e.context)?void 0:t.elements.floating,n)}))||r.openEvent&&["click","mousedown"].includes(r.openEvent.type))&&v.domReference.current&&(F.current=v.domReference.current),k.current&&S(F.current)&&!N.current&&z(F.current,{cancelPrevious:!1,preventScroll:e})}}),[m,E,W,k,x,y,v,b,P,C,g]),p((()=>{if(M)return M.setFocusManagerState({...t,modal:l,closeOnFocusOut:d}),()=>{M.setFocusManagerState(null)}}),[M,l,d,t]),p((()=>{if(!P&&E&&(e(),"function"==typeof MutationObserver)){const t=new MutationObserver(e);return t.observe(E,{childList:!0,subtree:!0}),()=>{t.disconnect()}}function e(){X(T(E))!==v.domReference.current&&L(j().length)}}),[E,j,P,v]);const U=o&&(_||l)&&!q;function V(e){return f&&l?u.createElement(me,{ref:"start"===e?A:D,onClick:()=>h(!1)},"string"==typeof f?f:"Dismiss"):null}return u.createElement(u.Fragment,null,U&&u.createElement(le,{"data-type":"inside",ref:null==M?void 0:M.beforeInsideRef,onFocus:e=>{if(l){const e=W();z("reference"===r[0]?e[0]:e[e.length-1])}else if(null!=M&&M.preserveTabOrder&&M.portalNode)if(N.current=!1,re(e,M.portalNode)){const e=te()||w;null==e||e.focus()}else{var t;null==(t=M.beforeOutsideRef.current)||t.focus()}}}),q?null:V("start"),u.cloneElement(n,0===O||r.includes("floating")?{tabIndex:0}:{}),V("end"),U&&u.createElement(le,{"data-type":"inside",ref:null==M?void 0:M.afterInsideRef,onFocus:e=>{if(l)z(W()[0]);else if(null!=M&&M.preserveTabOrder&&M.portalNode)if(d&&(N.current=!0),re(e,M.portalNode)){const e=ne()||w;null==e||e.focus()}else{var t;null==(t=M.afterOutsideRef.current)||t.focus()}}}))}function ve(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const ge=u.createContext({register:()=>{},unregister:()=>{},map:new Map,elementsRef:{current:[]}});function he(e){let{children:t,elementsRef:n,labelsRef:r}=e;const[o,i]=u.useState((()=>new Map)),c=u.useCallback((e=>{i((t=>new Map(t).set(e,null)))}),[]),l=u.useCallback((e=>{i((t=>{const n=new Map(t);return n.delete(e),n}))}),[]);return p((()=>{if(o.size<2)return;const e=new Map(o);Array.from(e.keys()).sort(ve).forEach(((t,n)=>{e.set(t,n)})),function(e,t){if(e.size!==t.size)return!1;for(const[n,r]of e.entries())if(r!==t.get(n))return!1;return!0}(o,e)||i(e)}),[o]),u.createElement(ge.Provider,{value:{register:c,unregister:l,map:o,elementsRef:n,labelsRef:r}},t)}function be(e){let{label:t}=void 0===e?{}:e;const[n,r]=u.useState(null),o=u.useRef(null),{register:i,unregister:c,map:l,elementsRef:s,labelsRef:a}=u.useContext(ge),f=u.useCallback((e=>{if(o.current=e,null!==n&&(s.current[n]=e,a)){var r;const o=void 0!==t;a.current[n]=o?t:null!=(r=null==e?void 0:e.textContent)?r:null}}),[n,s,a,t]);return p((()=>{const e=o.current;if(e)return i(e),()=>{c(e)}}),[i,c]),p((()=>{const e=o.current?l.get(o.current):null;null!=e&&r(e)}),[l]),u.useMemo((()=>({ref:f,index:null==n?-1:n})),[n,f])}const ye="data-floating-ui-scroll-lock",we=u.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return p((()=>{var e,t;if(!n)return;if(document.body.hasAttribute(ye))return;document.body.setAttribute(ye,"");const r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth;if(!/iP(hone|ad|od)|iOS/.test(O()))return Object.assign(document.body.style,{overflow:"hidden",[r]:o+"px"}),()=>{document.body.removeAttribute(ye),Object.assign(document.body.style,{overflow:"",[r]:""})};const u=(null==(e=window.visualViewport)?void 0:e.offsetLeft)||0,i=(null==(t=window.visualViewport)?void 0:t.offsetTop)||0,c=window.pageXOffset,l=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(l-Math.floor(i))+"px",left:-(c-Math.floor(u))+"px",right:"0",[r]:o+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[r]:""}),document.body.removeAttribute(ye),window.scrollTo(c,l)}}),[n]),u.createElement("div",m({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function Ee(e){return S(e.target)&&"BUTTON"===e.target.tagName}function Re(e){return Q(e)}const xe=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:i}}=e,{enabled:c=!0,event:l="click",toggle:s=!0,ignoreMouse:a=!1,keyboardHandlers:f=!0}=t,d=u.useRef(),m=u.useRef(!1);return u.useMemo((()=>c?{reference:{onPointerDown(e){d.current=e.pointerType},onMouseDown(e){0===e.button&&(K(d.current,!0)&&a||"click"!==l&&(n?!s||o.current.openEvent&&"mousedown"!==o.current.openEvent.type||r(!1):(e.preventDefault(),r(!0)),o.current.openEvent=e.nativeEvent))},onClick(e){"mousedown"===l&&d.current?d.current=void 0:K(d.current,!0)&&a||(n?!s||o.current.openEvent&&"click"!==o.current.openEvent.type||r(!1):r(!0),o.current.openEvent=e.nativeEvent)},onKeyDown(e){d.current=void 0,f&&!Ee(e)&&(" "!==e.key||Re(i)||(e.preventDefault(),m.current=!0),"Enter"===e.key&&(n?s&&r(!1):r(!0)))},onKeyUp(e){!f||Ee(e)||Re(i)||" "===e.key&&m.current&&(m.current=!1,n?s&&r(!1):r(!0))}}}:{}),[c,o,l,a,f,i,s,n,r])},Ie=u["useInsertionEffect".toString()]||(e=>e());function ke(e){const t=u.useRef((()=>{}));return Ie((()=>{t.current=e})),u.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}function Ce(e){return null!=e&&null!=e.clientX}const Me=function(e,t){let{open:n,refs:r,dataRef:o,elements:{floating:i}}=e,{enabled:c=!0,axis:l="both",x:s=null,y:a=null}=void 0===t?{}:t;const f=u.useRef(!1),d=u.useRef(null),[m,v]=u.useState(),[g,h]=u.useState([]),b=ke(((e,t)=>{f.current||o.current.openEvent&&!Ce(o.current.openEvent)||r.setPositionReference(function(e,t){let n=null,r=null,o=!1;return{contextElement:e.current||void 0,getBoundingClientRect(){var u,i;const c=(null==(u=e.current)?void 0:u.getBoundingClientRect())||{width:0,height:0,x:0,y:0},l="x"===t.axis||"both"===t.axis,s="y"===t.axis||"both"===t.axis,a=["mouseenter","mousemove"].includes((null==(i=t.dataRef.current.openEvent)?void 0:i.type)||"")&&"touch"!==t.pointerType;let f=c.width,d=c.height,m=c.x,p=c.y;return null==n&&t.x&&l&&(n=c.x-t.x),null==r&&t.y&&s&&(r=c.y-t.y),m-=n||0,p-=r||0,f=0,d=0,!o||a?(f="y"===t.axis?c.width:0,d="x"===t.axis?c.height:0,m=l&&null!=t.x?t.x:m,p=s&&null!=t.y?t.y:p):o&&!a&&(d="x"===t.axis?c.height:d,f="y"===t.axis?c.width:f),o=!0,{width:f,height:d,x:m,y:p,top:p,right:m+f,bottom:p+d,left:m}}}}(r.domReference,{x:e,y:t,axis:l,dataRef:o,pointerType:m}))})),y=ke((e=>{null==s&&null==a&&(n?d.current||h([]):b(e.clientX,e.clientY))})),w=K(m)?i:n,E=u.useCallback((()=>{if(!w||!c||null!=s||null!=a)return;const e=P(r.floating.current);function t(n){const o=G(n);B(r.floating.current,o)?(e.removeEventListener("mousemove",t),d.current=null):b(n.clientX,n.clientY)}if(!o.current.openEvent||Ce(o.current.openEvent)){e.addEventListener("mousemove",t);const n=()=>{e.removeEventListener("mousemove",t),d.current=null};return d.current=n,n}r.setPositionReference(r.domReference.current)}),[o,c,w,r,b,s,a]);return u.useEffect((()=>E()),[E,g]),u.useEffect((()=>{c&&!i&&(f.current=!1)}),[c,i]),u.useEffect((()=>{!c&&n&&(f.current=!0)}),[c,n]),p((()=>{!c||null==s&&null==a||(f.current=!1,b(s,a))}),[c,s,a,b]),u.useMemo((()=>{if(!c)return{};function e(e){let{pointerType:t}=e;v(t)}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove:y,onMouseEnter:y}}}),[c,y])};function Te(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 Oe={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Le={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Pe=function(e,n){void 0===n&&(n={});const{open:r,onOpenChange:o,events:i,nodeId:c,elements:{reference:l,domReference:s,floating:a},dataRef:f}=e,{enabled:d=!0,escapeKey:m=!0,outsidePress:p=!0,outsidePressEvent:v="pointerdown",referencePress:g=!1,referencePressEvent:h="pointerdown",ancestorScroll:b=!1,bubbles:y}=n,w=I(),E=null!=x(),R=ke("function"==typeof p?p:()=>!1),k="function"==typeof p?R:p,C=u.useRef(!1),{escapeKeyBubbles:M,outsidePressBubbles:O}=(e=>{var t,n;return{escapeKeyBubbles:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePressBubbles:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}})(y),L=ke((e=>{if(!r||!d||!m||"Escape"!==e.key)return;const t=w?Z(w.nodesRef.current,c):[];if(!M&&(e.stopPropagation(),t.length>0)){let e=!0;if(t.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}i.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),o(!1)})),F=ke((e=>{const t=C.current;if(C.current=!1,t)return;if("function"==typeof k&&!k(e))return;const n=G(e);if(S(n)&&a){const t=n.clientWidth>0&&n.scrollWidth>n.clientWidth,r=n.clientHeight>0&&n.scrollHeight>n.clientHeight;let o=r&&e.offsetX>n.clientWidth;if(r){"rtl"===P(a).getComputedStyle(n).direction&&(o=e.offsetX<=n.offsetWidth-n.clientWidth)}if(o||t&&e.offsetY>n.clientHeight)return}const r=w&&Z(w.nodesRef.current,c).some((t=>{var n;return Te(e,null==(n=t.context)?void 0:n.elements.floating)}));if(Te(e,a)||Te(e,s)||r)return;const u=w?Z(w.nodesRef.current,c):[];if(u.length>0){let e=!0;if(u.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}i.emit("dismiss",{type:"outsidePress",data:{returnFocus:E?{preventScroll:!0}:D(e)||N(e)}}),o(!1)}));return u.useEffect((()=>{if(!r||!d)return;function e(){o(!1)}f.current.__escapeKeyBubbles=M,f.current.__outsidePressBubbles=O;const n=T(a);m&&n.addEventListener("keydown",L),k&&n.addEventListener(v,F);let u=[];return b&&(A(s)&&(u=t(s)),A(a)&&(u=u.concat(t(a))),!A(l)&&l&&l.contextElement&&(u=u.concat(t(l.contextElement)))),u=u.filter((e=>{var t;return e!==(null==(t=n.defaultView)?void 0:t.visualViewport)})),u.forEach((t=>{t.addEventListener("scroll",e,{passive:!0})})),()=>{m&&n.removeEventListener("keydown",L),k&&n.removeEventListener(v,F),u.forEach((t=>{t.removeEventListener("scroll",e)}))}}),[f,a,s,l,m,k,v,r,o,b,d,M,O,L,F]),u.useEffect((()=>{C.current=!1}),[k,v]),u.useMemo((()=>d?{reference:{onKeyDown:L,[Oe[h]]:()=>{g&&(i.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),o(!1))}},floating:{onKeyDown:L,[Le[v]]:()=>{C.current=!0}}}:{}),[d,i,g,v,h,o,L])},Ae=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,refs:c,elements:{floating:l,domReference:s}}=e,{enabled:a=!0,keyboardOnly:f=!0}=t,d=u.useRef(""),m=u.useRef(!1),p=u.useRef();return u.useEffect((()=>{if(!a)return;const e=T(l).defaultView||window;function t(){!n&&S(s)&&s===X(T(s))&&(m.current=!0)}return e.addEventListener("blur",t),()=>{e.removeEventListener("blur",t)}}),[l,s,n,a]),u.useEffect((()=>{if(a)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(e){"referencePress"!==e.type&&"escapeKey"!==e.type||(m.current=!0)}}),[i,a]),u.useEffect((()=>()=>{clearTimeout(p.current)}),[]),u.useMemo((()=>a?{reference:{onPointerDown(e){let{pointerType:t}=e;d.current=t,m.current=!(!t||!f)},onMouseLeave(){m.current=!1},onFocus(e){var t;m.current||"focus"===e.type&&"mousedown"===(null==(t=o.current.openEvent)?void 0:t.type)&&o.current.openEvent&&Te(o.current.openEvent,s)||(o.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){m.current=!1;const t=e.relatedTarget,n=A(t)&&t.hasAttribute("data-floating-ui-focus-guard")&&"outside"===t.getAttribute("data-type");p.current=setTimeout((()=>{B(c.floating.current,t)||B(s,t)||n||r(!1)}))}}}:{}),[a,f,s,c,o,r])};let Se=!1;function De(e,t,n){return Math.floor(e/t)!==n}function Ne(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 i=e.current;let c=n;do{var l,s;c+=r?-u:u}while(c>=0&&c<=i.length-1&&(o?o.includes(c):null==i[c]||(null==(l=i[c])?void 0:l.hasAttribute("disabled"))||"true"===(null==(s=i[c])?void 0:s.getAttribute("aria-disabled"))));return c}function Ke(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Be(e,t){return Ke(t,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function He(e,t,n){return Ke(t,"ArrowDown"===e,n?"ArrowLeft"===e:"ArrowRight"===e)||"Enter"===e||" "==e||""===e}function _e(e,t){return Fe(e,{disabledIndices:t})}function qe(e,t){return Fe(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}const je=(e,t)=>{const{open:n,onOpenChange:r,refs:o,elements:{domReference:i,floating:c}}=e,{listRef:l,activeIndex:s,onNavigate:a=(()=>{}),enabled:f=!0,selectedIndex:d=null,allowEscape:m=!1,loop:v=!1,nested:g=!1,rtl:h=!1,virtual:b=!1,focusItemOnOpen:y="auto",focusItemOnHover:w=!0,openOnArrowKeyDown:E=!0,disabledIndices:R,orientation:k="vertical",cols:C=1,scrollItemIntoView:M=!0}=t,L=x(),P=I(),A=ke(a),K=u.useRef(y),_=u.useRef(null!=d?d:-1),q=u.useRef(null),j=u.useRef(!0),W=u.useRef(A),U=u.useRef(!!c),V=u.useRef(!1),Y=u.useRef(!1),Z=H(R),G=H(n),Q=H(M),[$,ee]=u.useState(),te=ke((function(e,t,n){void 0===n&&(n=!1);const r=e.current[t.current];r&&(b?ee(r.id):z(r,{preventScroll:!0,sync:!(!O().toLowerCase().startsWith("mac")||navigator.maxTouchPoints||!F())&&(Se||V.current)}),requestAnimationFrame((()=>{const e=Q.current;e&&r&&(n||!j.current)&&(null==r.scrollIntoView||r.scrollIntoView("boolean"==typeof e?{block:"nearest",inline:"nearest"}:e))})))}));p((()=>{document.createElement("div").focus({get preventScroll(){return Se=!0,!1}})}),[]),p((()=>{f&&(n&&c?K.current&&null!=d&&(Y.current=!0,A(d)):U.current&&(_.current=-1,W.current(null)))}),[f,n,c,d,A]),p((()=>{if(f&&n&&c)if(null==s){if(V.current=!1,null!=d)return;if(U.current&&(_.current=-1,te(l,_)),!U.current&&K.current&&(null!=q.current||!0===K.current&&null==q.current)){let e=0;const t=()=>{if(null==l.current[0]){if(e<2){(e?requestAnimationFrame:queueMicrotask)(t)}e++}else _.current=null==q.current||He(q.current,k,h)||g?_e(l,Z.current):qe(l,Z.current),q.current=null,A(_.current)};t()}}else Ne(l,s)||(_.current=s,te(l,_,Y.current),Y.current=!1)}),[f,n,c,s,d,g,l,k,h,A,te,Z]),p((()=>{if(f&&U.current&&!c&&P){var e,t;const n=P.nodesRef.current,r=null==(e=n.find((e=>e.id===L)))||null==(t=e.context)?void 0:t.elements.floating,o=X(T(c)),u=n.some((e=>e.context&&B(e.context.elements.floating,o)));r&&!u&&r.focus({preventScroll:!0})}}),[f,c,P,L]),p((()=>{W.current=A,U.current=!!c})),p((()=>{n||(q.current=null)}),[n]);const ne=null!=s,re=u.useMemo((()=>{function e(e){if(!n)return;const t=l.current.indexOf(e);-1!==t&&A(t)}return{onFocus(t){let{currentTarget:n}=t;e(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...w&&{onMouseMove(t){let{currentTarget:n}=t;e(n)},onPointerLeave(e){let{pointerType:t}=e;j.current&&"touch"!==t&&(_.current=-1,te(l,_),A(null),b||z(o.floating.current,{preventScroll:!0}))}}}}),[n,o,te,w,l,A,b]);return u.useMemo((()=>{if(!f)return{};const e=Z.current;function t(t){if(j.current=!1,V.current=!0,!G.current&&t.currentTarget===o.floating.current)return;if(g&&function(e,t,n){return Ke(t,n?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(t.key,k,h))return J(t),r(!1),void(S(i)&&i.focus());const u=_.current,c=_e(l,e),s=qe(l,e);if("Home"===t.key&&(J(t),_.current=c,A(_.current)),"End"===t.key&&(J(t),_.current=s,A(_.current)),C>1){const n=_.current;if("ArrowUp"===t.key){if(J(t),-1===n)_.current=s;else if(_.current=Fe(l,{startingIndex:n,amount:C,decrement:!0,disabledIndices:e}),v&&(n-C<c||_.current<0)){const e=n%C,t=s%C,r=s-(t-e);_.current=t===e?s:t>e?r:r-C}Ne(l,_.current)&&(_.current=n),A(_.current)}if("ArrowDown"===t.key&&(J(t),-1===n?_.current=c:(_.current=Fe(l,{startingIndex:n,amount:C,disabledIndices:e}),v&&n+C>s&&(_.current=Fe(l,{startingIndex:n%C-C,amount:C,disabledIndices:e}))),Ne(l,_.current)&&(_.current=n),A(_.current)),"both"===k){const r=Math.floor(n/C);"ArrowRight"===t.key&&(J(t),n%C!=C-1?(_.current=Fe(l,{startingIndex:n,disabledIndices:e}),v&&De(_.current,C,r)&&(_.current=Fe(l,{startingIndex:n-n%C-1,disabledIndices:e}))):v&&(_.current=Fe(l,{startingIndex:n-n%C-1,disabledIndices:e})),De(_.current,C,r)&&(_.current=n)),"ArrowLeft"===t.key&&(J(t),n%C!=0?(_.current=Fe(l,{startingIndex:n,disabledIndices:e,decrement:!0}),v&&De(_.current,C,r)&&(_.current=Fe(l,{startingIndex:n+(C-n%C),decrement:!0,disabledIndices:e}))):v&&(_.current=Fe(l,{startingIndex:n+(C-n%C),decrement:!0,disabledIndices:e})),De(_.current,C,r)&&(_.current=n));const o=Math.floor(s/C)===r;return Ne(l,_.current)&&(_.current=v&&o?"ArrowLeft"===t.key?s:Fe(l,{startingIndex:n-n%C-1,disabledIndices:e}):n),void A(_.current)}}if(Be(t.key,k)){if(J(t),n&&!b&&X(t.currentTarget.ownerDocument)===t.currentTarget)return _.current=He(t.key,k,h)?c:s,void A(_.current);He(t.key,k,h)?_.current=v?u>=s?m&&u!==l.current.length?-1:c:Fe(l,{startingIndex:u,disabledIndices:e}):Math.min(s,Fe(l,{startingIndex:u,disabledIndices:e})):_.current=v?u<=c?m&&-1!==u?l.current.length:s:Fe(l,{startingIndex:u,decrement:!0,disabledIndices:e}):Math.max(c,Fe(l,{startingIndex:u,decrement:!0,disabledIndices:e})),Ne(l,_.current)?A(null):A(_.current)}}function u(e){"auto"===y&&D(e.nativeEvent)&&(K.current=!0)}const c=b&&n&&ne&&{"aria-activedescendant":$};return{reference:{...c,onKeyDown(o){j.current=!1;const u=0===o.key.indexOf("Arrow");if(b&&n)return t(o);if(!n&&!E&&u)return;const i=u||"Enter"===o.key||""===o.key.trim(),c=Be(o.key,k),s=function(e,t,n){return Ke(t,n?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(o.key,k,h);i&&(q.current=g&&c?null:o.key),g?s&&(J(o),n?(_.current=_e(l,e),A(_.current)):r(!0)):c&&(null!=d&&(_.current=d),J(o),!n&&E?r(!0):t(o),n&&A(_.current))},onFocus(){n&&A(null)},onPointerDown:function(e){K.current=y,"auto"===y&&N(e.nativeEvent)&&(K.current=!0)},onMouseDown:u,onClick:u},floating:{"aria-orientation":"both"===k?void 0:k,...c,onKeyDown:t,onPointerMove(){j.current=!0}},item:re}}),[i,o,$,Z,G,l,f,k,h,b,n,ne,g,d,E,m,C,v,y,A,r,re])};function We(e){return u.useMemo((()=>e.every((e=>null==e))?null:t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}),e)}const Ue=function(e,t){void 0===t&&(t={});const{open:n,floatingId:r}=e,{enabled:o=!0,role:i="dialog"}=t,c=b();return u.useMemo((()=>{const e={id:r,role:i};return o?"tooltip"===i?{reference:{"aria-describedby":n?r:void 0},floating:e}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===i?"dialog":i,"aria-controls":n?r:void 0,..."listbox"===i&&{role:"combobox"},..."menu"===i&&{id:c}},floating:{...e,..."menu"===i&&{"aria-labelledby":c}}}:{}}),[o,i,n,r,c])},Ve=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Xe(e,t){return"function"==typeof e?e(t):e}function Ye(e,t){void 0===t&&(t={});const{open:n,elements:{floating:r}}=e,{duration:o=250}=t,i=("number"==typeof o?o:o.close)||0,[c,l]=u.useState(!1),[s,a]=u.useState("unmounted"),f=function(e,t){const[n,r]=u.useState(e);return e&&!n&&r(!0),u.useEffect((()=>{if(!e){const e=setTimeout((()=>r(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,i);return p((()=>{c&&!f&&a("unmounted")}),[c,f]),p((()=>{if(r){if(n){a("initial");const e=requestAnimationFrame((()=>{a("open")}));return()=>{cancelAnimationFrame(e)}}l(!0),a("close")}}),[n,r]),{isMounted:f,status:s}}function ze(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:c=250}=t,l=e.placement,s=l.split("-")[0],a=u.useMemo((()=>({side:s,placement:l})),[s,l]),f="number"==typeof c,d=(f?c:c.open)||0,m=(f?c:c.close)||0,[v,g]=u.useState((()=>({...Xe(i,a),...Xe(n,a)}))),{isMounted:h,status:b}=Ye(e,{duration:c}),y=H(n),w=H(r),E=H(o),R=H(i);return p((()=>{const e=Xe(y.current,a),t=Xe(E.current,a),n=Xe(R.current,a),r=Xe(w.current,a)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===b&&g((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===b&&g({transitionProperty:Object.keys(r).map(Ve).join(","),transitionDuration:d+"ms",...n,...r}),"close"===b){const r=t||e;g({transitionProperty:Object.keys(r).map(Ve).join(","),transitionDuration:m+"ms",...n,...r})}}),[m,E,y,w,R,d,b,a]),{isMounted:h,styles:v}}const Ze=(e,t)=>{var n;const{open:r,dataRef:o}=e,{listRef:i,activeIndex:c,onMatch:l,onTypingChange:s,enabled:a=!0,findMatch:f=null,resetMs:d=750,ignoreKeys:m=[],selectedIndex:v=null}=t,g=u.useRef(),h=u.useRef(""),b=u.useRef(null!=(n=null!=v?v:c)?n:-1),y=u.useRef(null),w=ke(l),E=ke(s),R=H(f),x=H(m);return p((()=>{r&&(clearTimeout(g.current),y.current=null,h.current="")}),[r]),p((()=>{var e;r&&""===h.current&&(b.current=null!=(e=null!=v?v:c)?e:-1)}),[r,v,c]),u.useMemo((()=>{if(!a)return{};function e(e){e?o.current.typing||(o.current.typing=e,E(e)):o.current.typing&&(o.current.typing=e,E(e))}function t(e,t,n){const r=R.current?R.current(t,n):t.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(n.toLocaleLowerCase()))));return r?e.indexOf(r):-1}function n(n){const o=i.current;if(h.current.length>0&&" "!==h.current[0]&&(-1===t(o,o,h.current)?e(!1):" "===n.key&&J(n)),null==o||x.current.includes(n.key)||1!==n.key.length||n.ctrlKey||n.metaKey||n.altKey)return;r&&" "!==n.key&&(J(n),e(!0));o.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&h.current===n.key&&(h.current="",b.current=y.current),h.current+=n.key,clearTimeout(g.current),g.current=setTimeout((()=>{h.current="",b.current=y.current,e(!1)}),d);const u=b.current,c=t(o,[...o.slice((u||0)+1),...o.slice(0,(u||0)+1)],h.current);-1!==c?(w(c),y.current=c):(h.current="",e(!1))}return{reference:{onKeyDown:n},floating:{onKeyDown:n}}}),[a,r,o,i,d,x,R,w,E])};function Ge(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Qe=e=>({name:"inner",options:e,async fn(t){const{listRef:o,overflowRef:u,onFallbackChange:i,offset:c=0,index:l=0,minItemsVisible:s=4,referenceOverflowThreshold:a=0,scrollRef:f,...m}=e,{rects:p,elements:{floating:v}}=t,g=o.current[l];if(!g)return{};const h={...t,...await n(-g.offsetTop-p.reference.height/2-g.offsetHeight/2-c).fn(t)},b=(null==f?void 0:f.current)||v,y=await r(Ge(h,b.scrollHeight),m),w=await r(h,{...m,elementContext:"reference"}),E=Math.max(0,y.top),R=h.y+E,x=Math.max(0,b.scrollHeight-E-Math.max(0,y.bottom));return b.style.maxHeight=x+"px",b.scrollTop=E,i&&(b.offsetHeight<g.offsetHeight*Math.min(s,o.current.length-1)-1||w.top>=-a||w.bottom>=-a?d((()=>i(!0))):d((()=>i(!1)))),u&&(u.current=await r(Ge({...h,y:R},b.offsetHeight),m)),{y:R}}}),Je=(e,t)=>{let{open:n,elements:r}=e,{enabled:o=!0,overflowRef:i,scrollRef:c,onChange:l}=t;const s=ke(l),a=u.useRef(!1),f=u.useRef(null),m=u.useRef(null);return u.useEffect((()=>{if(!o)return;function e(e){if(e.ctrlKey||!t||null==i.current)return;const n=e.deltaY,r=i.current.top>=-.5,o=i.current.bottom>=-.5,u=t.scrollHeight-t.clientHeight,c=n<0?-1:1,l=n<0?"max":"min";t.scrollHeight<=t.clientHeight||(!r&&n>0||!o&&n<0?(e.preventDefault(),d((()=>{s((e=>e+Math[l](n,u*c)))}))):/firefox/i.test(L())&&(t.scrollTop+=n))}const t=(null==c?void 0:c.current)||r.floating;return n&&t?(t.addEventListener("wheel",e),requestAnimationFrame((()=>{f.current=t.scrollTop,null!=i.current&&(m.current={...i.current})})),()=>{f.current=null,m.current=null,t.removeEventListener("wheel",e)}):void 0}),[o,n,r.floating,i,c,s]),u.useMemo((()=>o?{floating:{onKeyDown(){a.current=!0},onWheel(){a.current=!1},onPointerMove(){a.current=!1},onScroll(){const e=(null==c?void 0:c.current)||r.floating;if(i.current&&e&&a.current){if(null!==f.current){const t=e.scrollTop-f.current;(i.current.bottom<-.5&&t<-1||i.current.top<-.5&&t>1)&&d((()=>s((e=>e+t))))}requestAnimationFrame((()=>{f.current=e.scrollTop}))}}}}:{}),[o,i,r.floating,c,s])};function $e(e){let t,{buffer:n=.5,blockPointerEvents:r=!1,requireIntent:o=!0}=void 0===e?{}:e,u=!1,i=!1,c=null,l=null,s=performance.now();const a=e=>{let{x:r,y:a,placement:f,elements:d,onClose:m,nodeId:p,tree:v}=e;return function(e){function g(){clearTimeout(t),m()}if(clearTimeout(t),!d.domReference||!d.floating||null==f||null==r||null==a)return;const{clientX:h,clientY:b}=e,y=[h,b],w=G(e),E="mouseleave"===e.type,R=B(d.floating,w),x=B(d.domReference,w),I=d.domReference.getBoundingClientRect(),k=d.floating.getBoundingClientRect(),C=f.split("-")[0],M=r>k.right-k.width/2,T=a>k.bottom-k.height/2,O=function(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}(y,I);if(R&&(i=!0,!E))return;if(x&&(i=!1),x&&!E)return void(i=!0);if(E&&A(e.relatedTarget)&&B(d.floating,e.relatedTarget))return;if(v&&Z(v.nodesRef.current,p).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if("top"===C&&a>=I.bottom-1||"bottom"===C&&a<=I.top+1||"left"===C&&r>=I.right-1||"right"===C&&r<=I.left+1)return g();let L=[];switch(C){case"top":L=[[k.left,I.top+1],[k.left,k.bottom-1],[k.right,k.bottom-1],[k.right,I.top+1]],u=h>=k.left&&h<=k.right&&b>=k.top&&b<=I.top+1;break;case"bottom":L=[[k.left,k.top+1],[k.left,I.bottom-1],[k.right,I.bottom-1],[k.right,k.top+1]],u=h>=k.left&&h<=k.right&&b>=I.bottom-1&&b<=k.bottom;break;case"left":L=[[k.right-1,k.bottom],[k.right-1,k.top],[I.left+1,k.top],[I.left+1,k.bottom]],u=h>=k.left&&h<=I.left+1&&b>=k.top&&b<=k.bottom;break;case"right":L=[[I.right-1,k.bottom],[I.right-1,k.top],[k.left+1,k.top],[k.left+1,k.bottom]],u=h>=I.right-1&&h<=k.right&&b>=k.top&&b<=k.bottom}const P=u?L:function(e){let[t,r]=e;const o=k.width>I.width,u=k.height>I.height;switch(C){case"top":return[[o?t+n/2:M?t+4*n:t-4*n,r+n+1],[o?t-n/2:M?t+4*n:t-4*n,r+n+1],...[[k.left,M||o?k.bottom-n:k.top],[k.right,M?o?k.bottom-n:k.top:k.bottom-n]]];case"bottom":return[[o?t+n/2:M?t+4*n:t-4*n,r-n],[o?t-n/2:M?t+4*n:t-4*n,r-n],...[[k.left,M||o?k.top+n:k.bottom],[k.right,M?o?k.top+n:k.bottom:k.top+n]]];case"left":{const e=[t+n+1,u?r+n/2:T?r+4*n:r-4*n],o=[t+n+1,u?r-n/2:T?r+4*n:r-4*n];return[...[[T||u?k.right-n:k.left,k.top],[T?u?k.right-n:k.left:k.right-n,k.bottom]],e,o]}case"right":return[[t-n,u?r+n/2:T?r+4*n:r-4*n],[t-n,u?r-n/2:T?r+4*n:r-4*n],...[[T||u?k.left+n:k.right,k.top],[T?u?k.left+n:k.right:k.left+n,k.bottom]]]}}([r,a]);if(!u){if(i&&!O)return g();if(!E&&o){const t=function(e,t){const n=performance.now(),r=n-s;if(null===c||null===l||0===r)return c=e,l=t,s=n,null;const o=e-c,u=t-l,i=Math.sqrt(o*o+u*u);return c=e,l=t,s=n,i/r}(e.clientX,e.clientY),n=.1;if(null!==t&&t<n)return g()}!function(e,t){const[n,r]=e;let o=!1;const u=t.length;for(let e=0,i=u-1;e<u;i=e++){const[u,c]=t[e]||[0,0],[l,s]=t[i]||[0,0];c>=r!=s>=r&&n<=(l-u)*(r-c)/(s-c)+u&&(o=!o)}return o}([h,b],P)?g():!i&&o&&(t=window.setTimeout(g,40))}}};return a.__options={blockPointerEvents:r},a}function et(e){void 0===e&&(e={});const{open:t=!1,onOpenChange:n,nodeId:r}=e,i=o(e),c=I(),l=u.useRef(null),s=u.useRef({}),a=u.useState((()=>w()))[0],f=b(),[d,m]=u.useState(null),v=u.useCallback((e=>{const t=A(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;i.refs.setReference(t)}),[i.refs]),g=u.useCallback((e=>{(A(e)||null===e)&&(l.current=e,m(e)),(A(i.refs.reference.current)||null===i.refs.reference.current||null!==e&&!A(e))&&i.refs.setReference(e)}),[i.refs]),h=u.useMemo((()=>({...i.refs,setReference:g,setPositionReference:v,domReference:l})),[i.refs,g,v]),y=u.useMemo((()=>({...i.elements,domReference:d})),[i.elements,d]),E=ke(n),R=u.useMemo((()=>({...i,refs:h,elements:y,dataRef:s,nodeId:r,floatingId:f,events:a,open:t,onOpenChange:E})),[i,r,f,a,t,E,h,y]);return p((()=>{const e=null==c?void 0:c.nodesRef.current.find((e=>e.id===r));e&&(e.context=R)})),u.useMemo((()=>({...i,context:R,refs:h,elements:y,reference:g,positionReference:v})),[i,h,y,R,g,v])}function tt(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;var u;0===n.indexOf("on")?(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];return null==(e=r.get(n))?void 0:e.map((e=>e(...o))).find((e=>void 0!==e))})):e[n]=o})),e):e),{})}}const nt=function(e){void 0===e&&(e=[]);const t=e,n=u.useCallback((t=>tt(t,e,"reference")),t),r=u.useCallback((t=>tt(t,e,"floating")),t),o=u.useCallback((t=>tt(t,e,"item")),e.map((e=>null==e?void 0:e.item)));return u.useMemo((()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o})),[n,r,o])};export{y as FloatingArrow,U as FloatingDelayGroup,pe as FloatingFocusManager,he as FloatingList,C as FloatingNode,we as FloatingOverlay,fe as FloatingPortal,M as FloatingTree,Qe as inner,$e as safePolygon,xe as useClick,Me as useClientPoint,V as useDelayGroup,W as useDelayGroupContext,Pe as useDismiss,et as useFloating,k as useFloatingNodeId,x as useFloatingParentNodeId,ae as useFloatingPortalNode,I as useFloatingTree,Ae as useFocus,q as useHover,b as useId,Je as useInnerOffset,nt as useInteractions,be as useListItem,je as useListNavigation,We as useMergeRefs,Ue as useRole,Ye as useTransitionStatus,ze as useTransitionStyles,Ze as useTypeahead}; | ||
import{platform as e,getOverflowAncestors as t,offset as n,detectOverflow as r,useFloating as o}from"@floating-ui/react-dom";export{arrow,autoPlacement,autoUpdate,computePosition,detectOverflow,flip,getOverflowAncestors,hide,inline,limitShift,offset,platform,shift,size}from"@floating-ui/react-dom";import*as u from"react";import{useLayoutEffect as i,useEffect as c,useRef as l}from"react";import{hideOthers as s}from"aria-hidden";import{tabbable as a}from"tabbable";import{createPortal as f,flushSync as d}from"react-dom";function m(){return m=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},m.apply(this,arguments)}var p="undefined"!=typeof document?i:c;let v=!1,g=0;const h=()=>"floating-ui-"+g++;const b=u["useId".toString()]||function(){const[e,t]=u.useState((()=>v?h():void 0));return p((()=>{null==e&&t(h())}),[]),u.useEffect((()=>{v||(v=!0)}),[]),e},y=u.forwardRef((function(t,n){var r;let{context:{placement:o,elements:{floating:i},middlewareData:{arrow:c}},width:l=14,height:s=7,tipRadius:a=0,strokeWidth:f=0,staticOffset:d,stroke:p,d:v,...g}=t;f*=2;const h=f/2,y=l/2*(a/-8+1),w=s/2*a/4,[E,R]=o.split("-"),x=!!i&&e.isRTL(i),I=!!v,k="top"===E||"bottom"===E,C=d&&"end"===R?"bottom":"top";let M=d&&"end"===R?"right":"left";d&&x&&(M="end"===R?"left":"right");const T=I?0:h,O=null!=(null==c?void 0:c.x)?d||c.x:"",L=null!=(null==c?void 0:c.y)?d||c.y+T:"",P=v||"M0,0 H"+l+" L"+(l-y)+","+(s-w)+" Q"+l/2+","+s+" "+y+","+(s-w)+" Z",A={top:I?"rotate(180deg)":"",left:I?"rotate(90deg)":"rotate(-90deg)",bottom:I?"":"rotate(180deg)",right:I?"rotate(-90deg)":"rotate(90deg)"}[E],S=b();return u.createElement("svg",m({},g,{suppressHydrationWarning:!0,"aria-hidden":!0,ref:n,width:I?l:l+f,height:l,viewBox:"0 0 "+l+" "+(s>l?s:l),style:{...g.style,position:"absolute",pointerEvents:"none",[M]:O,[C]:L,[E]:k||I?"100%":"calc(100% - "+f/2+"px)",transform:A+(null!=(r=g.style)&&r.transform?" "+g.style.transform:"")}}),f>0&&u.createElement("path",{clipPath:"url(#"+S+")",fill:"none",stroke:p,strokeWidth:f+(v?0:1),d:P}),u.createElement("path",{stroke:f&&!v?g.fill:"none",d:P}),u.createElement("clipPath",{id:S},u.createElement("rect",{x:-h,y:h*(I?-1:1),width:l+f,height:l})))}));function w(){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){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}const E=u.createContext(null),R=u.createContext(null),x=()=>{var e;return(null==(e=u.useContext(E))?void 0:e.id)||null},I=()=>u.useContext(R),k=e=>{const t=b(),n=I(),r=x(),o=e||r;return p((()=>{const e={id:t,parentId:o};return null==n||n.addNode(e),()=>{null==n||n.removeNode(e)}}),[n,t,o]),t},C=e=>{let{children:t,id:n}=e;const r=x();return u.createElement(E.Provider,{value:u.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},M=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))}),[]),i=u.useState((()=>w()))[0];return u.createElement(R.Provider,{value:u.useMemo((()=>({nodesRef:n,addNode:r,removeNode:o,events:i})),[n,r,o,i])},t)};function T(e){return(null==e?void 0:e.ownerDocument)||document}function O(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function L(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function P(e){return T(e).defaultView||window}function A(e){return!!e&&e instanceof P(e).Element}function S(e){return!!e&&e instanceof P(e).HTMLElement}function D(e){if(0===e.mozInputSource&&e.isTrusted)return!0;const t=/Android/i;return(t.test(O())||t.test(L()))&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType}function N(e){return 0===e.width&&0===e.height||1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"!==e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail}function F(){return/apple/i.test(navigator.vendor)}function K(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function B(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&(r=n,"undefined"!=typeof ShadowRoot&&(r instanceof P(r).ShadowRoot||r instanceof ShadowRoot))){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}var r;return!1}function H(e){const t=l(e);return p((()=>{t.current=e})),t}function _(e,t,n){return n&&!K(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}const q=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:{domReference:c,floating:l},refs:s}=e,{enabled:a=!0,delay:f=0,handleClose:d=null,mouseOnly:m=!1,restMs:v=0,move:g=!0}=t,h=I(),b=x(),y=H(d),w=H(f),E=u.useRef(),R=u.useRef(),k=u.useRef(),C=u.useRef(),M=u.useRef(!0),O=u.useRef(!1),L=u.useRef((()=>{})),P=u.useCallback((()=>{var e;const t=null==(e=o.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[o]);u.useEffect((()=>{if(a)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(){clearTimeout(R.current),clearTimeout(C.current),M.current=!0}}),[a,i]),u.useEffect((()=>{if(!a||!y.current||!n)return;function e(){P()&&r(!1)}const t=T(l).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[l,n,r,a,y,o,P]);const S=u.useCallback((function(e){void 0===e&&(e=!0);const t=_(w.current,"close",E.current);t&&!k.current?(clearTimeout(R.current),R.current=setTimeout((()=>r(!1)),t)):e&&(clearTimeout(R.current),r(!1))}),[w,r]),D=u.useCallback((()=>{L.current(),k.current=void 0}),[]),N=u.useCallback((()=>{if(O.current){const e=T(s.floating.current).body;e.style.pointerEvents="",e.removeAttribute("data-floating-ui-safe-polygon"),O.current=!1}}),[s]);return u.useEffect((()=>{if(a&&A(c)){const e=c;return n&&e.addEventListener("mouseleave",s),null==l||l.addEventListener("mouseleave",s),g&&e.addEventListener("mousemove",u,{once:!0}),e.addEventListener("mouseenter",u),e.addEventListener("mouseleave",i),()=>{n&&e.removeEventListener("mouseleave",s),null==l||l.removeEventListener("mouseleave",s),g&&e.removeEventListener("mousemove",u),e.removeEventListener("mouseenter",u),e.removeEventListener("mouseleave",i)}}function t(){return!!o.current.openEvent&&["click","mousedown"].includes(o.current.openEvent.type)}function u(e){if(clearTimeout(R.current),M.current=!1,m&&!K(E.current)||v>0&&0===_(w.current,"open"))return;o.current.openEvent=e;const t=_(w.current,"open",E.current);t?R.current=setTimeout((()=>{r(!0)}),t):r(!0)}function i(r){if(t())return;L.current();const o=T(l);if(clearTimeout(C.current),y.current){n||clearTimeout(R.current),k.current=y.current({...e,tree:h,x:r.clientX,y:r.clientY,onClose(){N(),D(),S()}});const t=k.current;return o.addEventListener("mousemove",t),void(L.current=()=>{o.removeEventListener("mousemove",t)})}("touch"!==E.current||!B(l,r.relatedTarget))&&S()}function s(n){t()||null==y.current||y.current({...e,tree:h,x:n.clientX,y:n.clientY,onClose(){N(),D(),S()}})(n)}}),[c,l,a,e,m,v,g,S,D,N,r,n,h,w,y,o]),p((()=>{var e;if(a&&n&&null!=(e=y.current)&&e.__options.blockPointerEvents&&P()){const e=T(l).body;if(e.setAttribute("data-floating-ui-safe-polygon",""),e.style.pointerEvents="none",O.current=!0,A(c)&&l){var t,r;const e=c,n=null==h||null==(t=h.nodesRef.current.find((e=>e.id===b)))||null==(r=t.context)?void 0:r.elements.floating;return n&&(n.style.pointerEvents=""),e.style.pointerEvents="auto",l.style.pointerEvents="auto",()=>{e.style.pointerEvents="",l.style.pointerEvents=""}}}}),[a,n,b,l,c,h,y,o,P]),p((()=>{n||(E.current=void 0,D(),N())}),[n,D,N]),u.useEffect((()=>()=>{D(),clearTimeout(R.current),clearTimeout(C.current),N()}),[a,D,N]),u.useMemo((()=>{if(!a)return{};function e(e){E.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){n||0===v||(clearTimeout(C.current),C.current=setTimeout((()=>{M.current||r(!0)}),v))}},floating:{onMouseEnter(){clearTimeout(R.current)},onMouseLeave(){i.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),S(!1)}}}}),[i,a,v,n,r,S])},j=u.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),W=()=>u.useContext(j),U=e=>{let{children:t,delay:n,timeoutMs:r=0}=e;const[o,i]=u.useReducer(((e,t)=>({...e,...t})),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),c=u.useRef(null),l=u.useCallback((e=>{i({currentId:e})}),[]);return p((()=>{o.currentId?null===c.current?c.current=o.currentId:i({isInstantPhase:!0}):(i({isInstantPhase:!1}),c.current=null)}),[o.currentId]),u.createElement(j.Provider,{value:u.useMemo((()=>({...o,setState:i,setCurrentId:l})),[o,i,l])},t)},V=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:u,setCurrentId:i,initialDelay:c,setState:l,timeoutMs:s}=W();p((()=>{u&&(l({delay:{open:1,close:_(c,"close")}}),u!==o&&r(!1))}),[o,r,l,u,c]),p((()=>{function e(){r(!1),l({delay:c,currentId:null})}if(!n&&u===o){if(s){const t=window.setTimeout(e,s);return()=>{clearTimeout(t)}}e()}}),[n,l,u,o,r,c,s]),p((()=>{n&&i(o)}),[n,i,o])};function X(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}let Y=0;function z(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Y);const u=()=>null==e?void 0:e.focus({preventScroll:n});o?u():Y=requestAnimationFrame(u)}function Z(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}function G(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Q(e){return S(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function J(e){e.preventDefault(),e.stopPropagation()}const $=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ee(e,t){const n=a(e,$());"prev"===t&&n.reverse();const r=n.indexOf(X(T(e)));return n.slice(r+1)[0]}function te(){return ee(document.body,"next")}function ne(){return ee(document.body,"prev")}function re(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!B(n,r)}function oe(e){a(e,$()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function ue(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const ie={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function ce(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const le=u.forwardRef((function(e,t){const[n,r]=u.useState();return p((()=>(F()&&r("button"),document.addEventListener("keydown",ce),()=>{document.removeEventListener("keydown",ce)})),[]),u.createElement("span",m({},e,{ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,"data-floating-ui-focus-guard":"",style:ie}))})),se=u.createContext(null),ae=function(e){let{id:t,root:n}=void 0===e?{}:e;const[r,o]=u.useState(null),i=b(),c=de(),l=u.useMemo((()=>({id:t,root:n,portalContext:c,uniqueId:i})),[t,n,c,i]),s=u.useRef();return p((()=>()=>{null==r||r.remove()}),[r,l]),p((()=>{if(s.current===l)return;s.current=l;const{id:e,root:t,portalContext:n,uniqueId:r}=l,u=e?document.getElementById(e):null,i="data-floating-ui-portal";if(u){const e=document.createElement("div");e.id=r,e.setAttribute(i,""),u.appendChild(e),o(e)}else{let u=(null==n?void 0:n.portalNode)||t||document.body,c=null;e&&(c=document.createElement("div"),c.id=e,u.appendChild(c));const l=document.createElement("div");l.id=r,l.setAttribute(i,""),u=c||u,u.appendChild(l),o(l)}}),[l]),r},fe=e=>{let{children:t,id:n,root:r=null,preserveTabOrder:o=!0}=e;const i=ae({id:n,root:r}),[c,l]=u.useState(null),s=u.useRef(null),a=u.useRef(null),d=u.useRef(null),m=u.useRef(null),p=!!c&&!c.modal&&c.open&&o&&!(!r&&!i);return u.useEffect((()=>{if(i&&o&&(null==c||!c.modal))return i.addEventListener("focusin",e,!0),i.addEventListener("focusout",e,!0),()=>{i.removeEventListener("focusin",e,!0),i.removeEventListener("focusout",e,!0)};function e(e){if(i&&re(e)){("focusin"===e.type?ue:oe)(i)}}}),[i,o,null==c?void 0:c.modal]),u.createElement(se.Provider,{value:u.useMemo((()=>({preserveTabOrder:o,beforeOutsideRef:s,afterOutsideRef:a,beforeInsideRef:d,afterInsideRef:m,portalNode:i,setFocusManagerState:l})),[o,i])},p&&i&&u.createElement(le,{"data-type":"outside",ref:s,onFocus:e=>{if(re(e,i)){var t;null==(t=d.current)||t.focus()}else{const e=ne()||(null==c?void 0:c.refs.domReference.current);null==e||e.focus()}}}),p&&i&&u.createElement("span",{"aria-owns":i.id,style:ie}),i&&f(t,i),p&&i&&u.createElement(le,{"data-type":"outside",ref:a,onFocus:e=>{if(re(e,i)){var t;null==(t=m.current)||t.focus()}else{const e=te()||(null==c?void 0:c.refs.domReference.current);null==e||e.focus(),(null==c?void 0:c.closeOnFocusOut)&&(null==c||c.onOpenChange(!1))}}}))},de=()=>u.useContext(se),me=u.forwardRef((function(e,t){return u.createElement("button",m({},e,{type:"button",ref:t,tabIndex:-1,style:ie}))}));function pe(e){let{context:t,children:n,order:r=["content"],guards:o=!0,initialFocus:i=0,returnFocus:c=!0,modal:l=!0,visuallyHiddenDismiss:f=!1,closeOnFocusOut:d=!0}=e;const{open:m,refs:v,nodeId:g,onOpenChange:h,events:b,dataRef:y,elements:{domReference:w,floating:E}}=t,R=H(r),x=H(i),k=H(c),C=I(),M=de(),[O,L]=u.useState(null),P="number"==typeof i&&i<0,A=u.useRef(null),D=u.useRef(null),N=u.useRef(!1),F=u.useRef(null),K=u.useRef(!1),_=null!=M,q=w&&"combobox"===w.getAttribute("role")&&Q(w),j=u.useCallback((function(e){return void 0===e&&(e=E),e?a(e,$()):[]}),[E]),W=u.useCallback((e=>{const t=j(e);return R.current.map((e=>w&&"reference"===e?w:E&&"floating"===e?E:t)).filter(Boolean).flat()}),[w,E,R,j]);u.useEffect((()=>{if(!l)return;function e(e){if("Tab"===e.key){0!==j().length||q||J(e);const t=W(),n=G(e);"reference"===R.current[0]&&n===w&&(J(e),e.shiftKey?z(t[t.length-1]):z(t[1])),"floating"===R.current[1]&&n===E&&e.shiftKey&&(J(e),z(t[0]))}}const t=T(E);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[w,E,l,R,v,q,j,W]),u.useEffect((()=>{if(d)return E&&S(w)?(w.addEventListener("focusout",t),w.addEventListener("pointerdown",e),!l&&E.addEventListener("focusout",t),()=>{w.removeEventListener("focusout",t),w.removeEventListener("pointerdown",e),!l&&E.removeEventListener("focusout",t)}):void 0;function e(){K.current=!0,setTimeout((()=>{K.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const e=!(B(w,t)||B(E,t)||B(t,E)||B(null==M?void 0:M.portalNode,t)||null!=t&&t.hasAttribute("data-floating-ui-focus-guard")||C&&(Z(C.nodesRef.current,g).find((e=>{var n,r;return B(null==(n=e.context)?void 0:n.elements.floating,t)||B(null==(r=e.context)?void 0:r.elements.domReference,t)}))||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}(C.nodesRef.current,g).find((e=>{var n,r;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(r=e.context)?void 0:r.elements.domReference)===t}))));t&&e&&!K.current&&t!==F.current&&(N.current=!0,h(!1))}))}}),[w,E,l,g,C,M,h,d]),u.useEffect((()=>{var e;const t=Array.from((null==M||null==(e=M.portalNode)?void 0:e.querySelectorAll("[data-floating-ui-portal]"))||[]);if(E&&l){const e=[E,...t,...[A.current,D.current].filter(Boolean)],n=s(R.current.includes("reference")||q?e.concat(w||[]):e);return()=>{n()}}}),[w,E,l,R,M,q]),u.useEffect((()=>{if(l&&!o&&E){const e=[],t=$(),n=a(T(E).body,t),r=W(),o=n.filter((e=>!r.includes(e)));return o.forEach(((t,n)=>{e[n]=t.getAttribute("tabindex"),t.setAttribute("tabindex","-1")})),()=>{o.forEach(((t,n)=>{const r=e[n];null==r?t.removeAttribute("tabindex"):t.setAttribute("tabindex",r)}))}}}),[E,l,o,W]),p((()=>{if(!E)return;const e=X(T(E));queueMicrotask((()=>{const t=W(E),n=x.current,r=("number"==typeof n?t[n]:n.current)||E,o=B(E,e);P||o||!m||z(r,{preventScroll:r===E})}))}),[m,E,P,W,x]),p((()=>{if(!E)return;let e=!1;const t=T(E),n=X(t),r=y.current;function o(t){if("escapeKey"===t.type&&v.domReference.current&&(F.current=v.domReference.current),["referencePress","escapeKey"].includes(t.type))return;const n=t.data.returnFocus;"object"==typeof n?(N.current=!1,e=n.preventScroll):N.current=!n}return F.current=n,b.on("dismiss",o),()=>{b.off("dismiss",o);const n=X(t);(B(E,n)||C&&Z(C.nodesRef.current,g).some((e=>{var t;return B(null==(t=e.context)?void 0:t.elements.floating,n)}))||r.openEvent&&["click","mousedown"].includes(r.openEvent.type))&&v.domReference.current&&(F.current=v.domReference.current),k.current&&S(F.current)&&!N.current&&z(F.current,{cancelPrevious:!1,preventScroll:e})}}),[E,k,y,v,b,C,g]),p((()=>{if(M)return M.setFocusManagerState({...t,modal:l,closeOnFocusOut:d,open:m}),()=>{M.setFocusManagerState(null)}}),[M,l,m,d,t]),p((()=>{if(!P&&E&&(e(),"function"==typeof MutationObserver)){const t=new MutationObserver(e);return t.observe(E,{childList:!0,subtree:!0}),()=>{t.disconnect()}}function e(){X(T(E))!==v.domReference.current&&L(j().length)}}),[E,j,P,v]);const U=o&&!q&&(_||l);function V(e){return f&&l?u.createElement(me,{ref:"start"===e?A:D,onClick:()=>h(!1)},"string"==typeof f?f:"Dismiss"):null}return u.createElement(u.Fragment,null,U&&u.createElement(le,{"data-type":"inside",ref:null==M?void 0:M.beforeInsideRef,onFocus:e=>{if(l){const e=W();z("reference"===r[0]?e[0]:e[e.length-1])}else if(null!=M&&M.preserveTabOrder&&M.portalNode)if(N.current=!1,re(e,M.portalNode)){const e=te()||w;null==e||e.focus()}else{var t;null==(t=M.beforeOutsideRef.current)||t.focus()}}}),q?null:V("start"),u.cloneElement(n,0===O||r.includes("floating")?{tabIndex:0}:{}),V("end"),U&&u.createElement(le,{"data-type":"inside",ref:null==M?void 0:M.afterInsideRef,onFocus:e=>{if(l)z(W()[0]);else if(null!=M&&M.preserveTabOrder&&M.portalNode)if(d&&(N.current=!0),re(e,M.portalNode)){const e=ne()||w;null==e||e.focus()}else{var t;null==(t=M.afterOutsideRef.current)||t.focus()}}}))}function ve(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const ge=u.createContext({register:()=>{},unregister:()=>{},map:new Map,elementsRef:{current:[]}});function he(e){let{children:t,elementsRef:n,labelsRef:r}=e;const[o,i]=u.useState((()=>new Map)),c=u.useCallback((e=>{i((t=>new Map(t).set(e,null)))}),[]),l=u.useCallback((e=>{i((t=>{const n=new Map(t);return n.delete(e),n}))}),[]);return p((()=>{const e=new Map(o);Array.from(e.keys()).sort(ve).forEach(((t,n)=>{e.set(t,n)})),function(e,t){if(e.size!==t.size)return!1;for(const[n,r]of e.entries())if(r!==t.get(n))return!1;return!0}(o,e)||i(e)}),[o]),u.createElement(ge.Provider,{value:{register:c,unregister:l,map:o,elementsRef:n,labelsRef:r}},t)}function be(e){let{label:t}=void 0===e?{}:e;const[n,r]=u.useState(null),o=u.useRef(null),{register:i,unregister:c,map:l,elementsRef:s,labelsRef:a}=u.useContext(ge),f=u.useCallback((e=>{if(o.current=e,null!==n&&(s.current[n]=e,a)){var r;const o=void 0!==t;a.current[n]=o?t:null!=(r=null==e?void 0:e.textContent)?r:null}}),[n,s,a,t]);return p((()=>{const e=o.current;if(e)return i(e),()=>{c(e)}}),[i,c]),p((()=>{const e=o.current?l.get(o.current):null;null!=e&&r(e)}),[l]),u.useMemo((()=>({ref:f,index:null==n?-1:n})),[n,f])}const ye="data-floating-ui-scroll-lock",we=u.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return p((()=>{var e,t;if(!n)return;if(document.body.hasAttribute(ye))return;document.body.setAttribute(ye,"");const r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth;if(!/iP(hone|ad|od)|iOS/.test(O()))return Object.assign(document.body.style,{overflow:"hidden",[r]:o+"px"}),()=>{document.body.removeAttribute(ye),Object.assign(document.body.style,{overflow:"",[r]:""})};const u=(null==(e=window.visualViewport)?void 0:e.offsetLeft)||0,i=(null==(t=window.visualViewport)?void 0:t.offsetTop)||0,c=window.pageXOffset,l=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(l-Math.floor(i))+"px",left:-(c-Math.floor(u))+"px",right:"0",[r]:o+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[r]:""}),document.body.removeAttribute(ye),window.scrollTo(c,l)}}),[n]),u.createElement("div",m({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function Ee(e){return S(e.target)&&"BUTTON"===e.target.tagName}function Re(e){return Q(e)}const xe=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:i}}=e,{enabled:c=!0,event:l="click",toggle:s=!0,ignoreMouse:a=!1,keyboardHandlers:f=!0}=t,d=u.useRef(),m=u.useRef(!1);return u.useMemo((()=>c?{reference:{onPointerDown(e){d.current=e.pointerType},onMouseDown(e){0===e.button&&(K(d.current,!0)&&a||"click"!==l&&(n?!s||o.current.openEvent&&"mousedown"!==o.current.openEvent.type||r(!1):(e.preventDefault(),r(!0)),o.current.openEvent=e.nativeEvent))},onClick(e){"mousedown"===l&&d.current?d.current=void 0:K(d.current,!0)&&a||(n?!s||o.current.openEvent&&"click"!==o.current.openEvent.type||r(!1):r(!0),o.current.openEvent=e.nativeEvent)},onKeyDown(e){d.current=void 0,f&&!Ee(e)&&(" "!==e.key||Re(i)||(e.preventDefault(),m.current=!0),"Enter"===e.key&&(n?s&&r(!1):r(!0)))},onKeyUp(e){!f||Ee(e)||Re(i)||" "===e.key&&m.current&&(m.current=!1,n?s&&r(!1):r(!0))}}}:{}),[c,o,l,a,f,i,s,n,r])},Ie=u["useInsertionEffect".toString()]||(e=>e());function ke(e){const t=u.useRef((()=>{}));return Ie((()=>{t.current=e})),u.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}function Ce(e){return null!=e&&null!=e.clientX}const Me=function(e,t){let{open:n,refs:r,dataRef:o,elements:{floating:i}}=e,{enabled:c=!0,axis:l="both",x:s=null,y:a=null}=void 0===t?{}:t;const f=u.useRef(!1),d=u.useRef(null),[m,v]=u.useState(),[g,h]=u.useState([]),b=ke(((e,t)=>{f.current||o.current.openEvent&&!Ce(o.current.openEvent)||r.setPositionReference(function(e,t){let n=null,r=null,o=!1;return{contextElement:e.current||void 0,getBoundingClientRect(){var u,i;const c=(null==(u=e.current)?void 0:u.getBoundingClientRect())||{width:0,height:0,x:0,y:0},l="x"===t.axis||"both"===t.axis,s="y"===t.axis||"both"===t.axis,a=["mouseenter","mousemove"].includes((null==(i=t.dataRef.current.openEvent)?void 0:i.type)||"")&&"touch"!==t.pointerType;let f=c.width,d=c.height,m=c.x,p=c.y;return null==n&&t.x&&l&&(n=c.x-t.x),null==r&&t.y&&s&&(r=c.y-t.y),m-=n||0,p-=r||0,f=0,d=0,!o||a?(f="y"===t.axis?c.width:0,d="x"===t.axis?c.height:0,m=l&&null!=t.x?t.x:m,p=s&&null!=t.y?t.y:p):o&&!a&&(d="x"===t.axis?c.height:d,f="y"===t.axis?c.width:f),o=!0,{width:f,height:d,x:m,y:p,top:p,right:m+f,bottom:p+d,left:m}}}}(r.domReference,{x:e,y:t,axis:l,dataRef:o,pointerType:m}))})),y=ke((e=>{null==s&&null==a&&(n?d.current||h([]):b(e.clientX,e.clientY))})),w=K(m)?i:n,E=u.useCallback((()=>{if(!w||!c||null!=s||null!=a)return;const e=P(r.floating.current);function t(n){const o=G(n);B(r.floating.current,o)?(e.removeEventListener("mousemove",t),d.current=null):b(n.clientX,n.clientY)}if(!o.current.openEvent||Ce(o.current.openEvent)){e.addEventListener("mousemove",t);const n=()=>{e.removeEventListener("mousemove",t),d.current=null};return d.current=n,n}r.setPositionReference(r.domReference.current)}),[o,c,w,r,b,s,a]);return u.useEffect((()=>E()),[E,g]),u.useEffect((()=>{c&&!i&&(f.current=!1)}),[c,i]),u.useEffect((()=>{!c&&n&&(f.current=!0)}),[c,n]),p((()=>{!c||null==s&&null==a||(f.current=!1,b(s,a))}),[c,s,a,b]),u.useMemo((()=>{if(!c)return{};function e(e){let{pointerType:t}=e;v(t)}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove:y,onMouseEnter:y}}}),[c,y])};function Te(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 Oe={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Le={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Pe=function(e,n){void 0===n&&(n={});const{open:r,onOpenChange:o,events:i,nodeId:c,elements:{reference:l,domReference:s,floating:a},dataRef:f}=e,{enabled:d=!0,escapeKey:m=!0,outsidePress:p=!0,outsidePressEvent:v="pointerdown",referencePress:g=!1,referencePressEvent:h="pointerdown",ancestorScroll:b=!1,bubbles:y}=n,w=I(),E=null!=x(),R=ke("function"==typeof p?p:()=>!1),k="function"==typeof p?R:p,C=u.useRef(!1),{escapeKeyBubbles:M,outsidePressBubbles:O}=(e=>{var t,n;return{escapeKeyBubbles:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePressBubbles:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}})(y),L=ke((e=>{if(!r||!d||!m||"Escape"!==e.key)return;const t=w?Z(w.nodesRef.current,c):[];if(!M&&(e.stopPropagation(),t.length>0)){let e=!0;if(t.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}i.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),o(!1)})),F=ke((e=>{const t=C.current;if(C.current=!1,t)return;if("function"==typeof k&&!k(e))return;const n=G(e);if(S(n)&&a){const t=n.clientWidth>0&&n.scrollWidth>n.clientWidth,r=n.clientHeight>0&&n.scrollHeight>n.clientHeight;let o=r&&e.offsetX>n.clientWidth;if(r){"rtl"===P(a).getComputedStyle(n).direction&&(o=e.offsetX<=n.offsetWidth-n.clientWidth)}if(o||t&&e.offsetY>n.clientHeight)return}const r=w&&Z(w.nodesRef.current,c).some((t=>{var n;return Te(e,null==(n=t.context)?void 0:n.elements.floating)}));if(Te(e,a)||Te(e,s)||r)return;const u=w?Z(w.nodesRef.current,c):[];if(u.length>0){let e=!0;if(u.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}i.emit("dismiss",{type:"outsidePress",data:{returnFocus:E?{preventScroll:!0}:D(e)||N(e)}}),o(!1)}));return u.useEffect((()=>{if(!r||!d)return;function e(){o(!1)}f.current.__escapeKeyBubbles=M,f.current.__outsidePressBubbles=O;const n=T(a);m&&n.addEventListener("keydown",L),k&&n.addEventListener(v,F);let u=[];return b&&(A(s)&&(u=t(s)),A(a)&&(u=u.concat(t(a))),!A(l)&&l&&l.contextElement&&(u=u.concat(t(l.contextElement)))),u=u.filter((e=>{var t;return e!==(null==(t=n.defaultView)?void 0:t.visualViewport)})),u.forEach((t=>{t.addEventListener("scroll",e,{passive:!0})})),()=>{m&&n.removeEventListener("keydown",L),k&&n.removeEventListener(v,F),u.forEach((t=>{t.removeEventListener("scroll",e)}))}}),[f,a,s,l,m,k,v,r,o,b,d,M,O,L,F]),u.useEffect((()=>{C.current=!1}),[k,v]),u.useMemo((()=>d?{reference:{onKeyDown:L,[Oe[h]]:()=>{g&&(i.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),o(!1))}},floating:{onKeyDown:L,[Le[v]]:()=>{C.current=!0}}}:{}),[d,i,g,v,h,o,L])},Ae=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,refs:c,elements:{floating:l,domReference:s}}=e,{enabled:a=!0,keyboardOnly:f=!0}=t,d=u.useRef(""),m=u.useRef(!1),p=u.useRef();return u.useEffect((()=>{if(!a)return;const e=T(l).defaultView||window;function t(){!n&&S(s)&&s===X(T(s))&&(m.current=!0)}return e.addEventListener("blur",t),()=>{e.removeEventListener("blur",t)}}),[l,s,n,a]),u.useEffect((()=>{if(a)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(e){"referencePress"!==e.type&&"escapeKey"!==e.type||(m.current=!0)}}),[i,a]),u.useEffect((()=>()=>{clearTimeout(p.current)}),[]),u.useMemo((()=>a?{reference:{onPointerDown(e){let{pointerType:t}=e;d.current=t,m.current=!(!t||!f)},onMouseLeave(){m.current=!1},onFocus(e){var t;m.current||"focus"===e.type&&"mousedown"===(null==(t=o.current.openEvent)?void 0:t.type)&&o.current.openEvent&&Te(o.current.openEvent,s)||(o.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){m.current=!1;const t=e.relatedTarget,n=A(t)&&t.hasAttribute("data-floating-ui-focus-guard")&&"outside"===t.getAttribute("data-type");p.current=setTimeout((()=>{B(c.floating.current,t)||B(s,t)||n||r(!1)}))}}}:{}),[a,f,s,c,o,r])};let Se=!1;function De(e,t,n){return Math.floor(e/t)!==n}function Ne(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 i=e.current;let c=n;do{var l,s;c+=r?-u:u}while(c>=0&&c<=i.length-1&&(o?o.includes(c):null==i[c]||(null==(l=i[c])?void 0:l.hasAttribute("disabled"))||"true"===(null==(s=i[c])?void 0:s.getAttribute("aria-disabled"))));return c}function Ke(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function Be(e,t){return Ke(t,"ArrowUp"===e||"ArrowDown"===e,"ArrowLeft"===e||"ArrowRight"===e)}function He(e,t,n){return Ke(t,"ArrowDown"===e,n?"ArrowLeft"===e:"ArrowRight"===e)||"Enter"===e||" "==e||""===e}function _e(e,t){return Fe(e,{disabledIndices:t})}function qe(e,t){return Fe(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}const je=(e,t)=>{const{open:n,onOpenChange:r,refs:o,elements:{domReference:i,floating:c}}=e,{listRef:l,activeIndex:s,onNavigate:a=(()=>{}),enabled:f=!0,selectedIndex:d=null,allowEscape:m=!1,loop:v=!1,nested:g=!1,rtl:h=!1,virtual:b=!1,focusItemOnOpen:y="auto",focusItemOnHover:w=!0,openOnArrowKeyDown:E=!0,disabledIndices:R,orientation:k="vertical",cols:C=1,scrollItemIntoView:M=!0}=t,L=x(),P=I(),A=ke(a),K=u.useRef(y),_=u.useRef(null!=d?d:-1),q=u.useRef(null),j=u.useRef(!0),W=u.useRef(A),U=u.useRef(!!c),V=u.useRef(!1),Y=u.useRef(!1),Z=H(R),G=H(n),Q=H(M),[$,ee]=u.useState(),te=ke((function(e,t,n){void 0===n&&(n=!1);const r=e.current[t.current];r&&(b?ee(r.id):z(r,{preventScroll:!0,sync:!(!O().toLowerCase().startsWith("mac")||navigator.maxTouchPoints||!F())&&(Se||V.current)}),requestAnimationFrame((()=>{const e=Q.current;e&&r&&(n||!j.current)&&(null==r.scrollIntoView||r.scrollIntoView("boolean"==typeof e?{block:"nearest",inline:"nearest"}:e))})))}));p((()=>{document.createElement("div").focus({get preventScroll(){return Se=!0,!1}})}),[]),p((()=>{f&&(n&&c?K.current&&null!=d&&(Y.current=!0,A(d)):U.current&&(_.current=-1,W.current(null)))}),[f,n,c,d,A]),p((()=>{if(f&&n&&c)if(null==s){if(V.current=!1,null!=d)return;if(U.current&&(_.current=-1,te(l,_)),!U.current&&K.current&&(null!=q.current||!0===K.current&&null==q.current)){let e=0;const t=()=>{if(null==l.current[0]){if(e<2){(e?requestAnimationFrame:queueMicrotask)(t)}e++}else _.current=null==q.current||He(q.current,k,h)||g?_e(l,Z.current):qe(l,Z.current),q.current=null,A(_.current)};t()}}else Ne(l,s)||(_.current=s,te(l,_,Y.current),Y.current=!1)}),[f,n,c,s,d,g,l,k,h,A,te,Z]),p((()=>{if(f&&U.current&&!c&&P){var e,t;const n=P.nodesRef.current,r=null==(e=n.find((e=>e.id===L)))||null==(t=e.context)?void 0:t.elements.floating,o=X(T(c)),u=n.some((e=>e.context&&B(e.context.elements.floating,o)));r&&!u&&r.focus({preventScroll:!0})}}),[f,c,P,L]),p((()=>{W.current=A,U.current=!!c})),p((()=>{n||(q.current=null)}),[n]);const ne=null!=s,re=u.useMemo((()=>{function e(e){if(!n)return;const t=l.current.indexOf(e);-1!==t&&A(t)}return{onFocus(t){let{currentTarget:n}=t;e(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...w&&{onMouseMove(t){let{currentTarget:n}=t;e(n)},onPointerLeave(e){let{pointerType:t}=e;j.current&&"touch"!==t&&(_.current=-1,te(l,_),A(null),b||z(o.floating.current,{preventScroll:!0}))}}}}),[n,o,te,w,l,A,b]);return u.useMemo((()=>{if(!f)return{};const e=Z.current;function t(t){if(j.current=!1,V.current=!0,!G.current&&t.currentTarget===o.floating.current)return;if(g&&function(e,t,n){return Ke(t,n?"ArrowRight"===e:"ArrowLeft"===e,"ArrowUp"===e)}(t.key,k,h))return J(t),r(!1),void(S(i)&&i.focus());const u=_.current,c=_e(l,e),s=qe(l,e);if("Home"===t.key&&(J(t),_.current=c,A(_.current)),"End"===t.key&&(J(t),_.current=s,A(_.current)),C>1){const n=_.current;if("ArrowUp"===t.key){if(J(t),-1===n)_.current=s;else if(_.current=Fe(l,{startingIndex:n,amount:C,decrement:!0,disabledIndices:e}),v&&(n-C<c||_.current<0)){const e=n%C,t=s%C,r=s-(t-e);_.current=t===e?s:t>e?r:r-C}Ne(l,_.current)&&(_.current=n),A(_.current)}if("ArrowDown"===t.key&&(J(t),-1===n?_.current=c:(_.current=Fe(l,{startingIndex:n,amount:C,disabledIndices:e}),v&&n+C>s&&(_.current=Fe(l,{startingIndex:n%C-C,amount:C,disabledIndices:e}))),Ne(l,_.current)&&(_.current=n),A(_.current)),"both"===k){const r=Math.floor(n/C);"ArrowRight"===t.key&&(J(t),n%C!=C-1?(_.current=Fe(l,{startingIndex:n,disabledIndices:e}),v&&De(_.current,C,r)&&(_.current=Fe(l,{startingIndex:n-n%C-1,disabledIndices:e}))):v&&(_.current=Fe(l,{startingIndex:n-n%C-1,disabledIndices:e})),De(_.current,C,r)&&(_.current=n)),"ArrowLeft"===t.key&&(J(t),n%C!=0?(_.current=Fe(l,{startingIndex:n,disabledIndices:e,decrement:!0}),v&&De(_.current,C,r)&&(_.current=Fe(l,{startingIndex:n+(C-n%C),decrement:!0,disabledIndices:e}))):v&&(_.current=Fe(l,{startingIndex:n+(C-n%C),decrement:!0,disabledIndices:e})),De(_.current,C,r)&&(_.current=n));const o=Math.floor(s/C)===r;return Ne(l,_.current)&&(_.current=v&&o?"ArrowLeft"===t.key?s:Fe(l,{startingIndex:n-n%C-1,disabledIndices:e}):n),void A(_.current)}}if(Be(t.key,k)){if(J(t),n&&!b&&X(t.currentTarget.ownerDocument)===t.currentTarget)return _.current=He(t.key,k,h)?c:s,void A(_.current);He(t.key,k,h)?_.current=v?u>=s?m&&u!==l.current.length?-1:c:Fe(l,{startingIndex:u,disabledIndices:e}):Math.min(s,Fe(l,{startingIndex:u,disabledIndices:e})):_.current=v?u<=c?m&&-1!==u?l.current.length:s:Fe(l,{startingIndex:u,decrement:!0,disabledIndices:e}):Math.max(c,Fe(l,{startingIndex:u,decrement:!0,disabledIndices:e})),Ne(l,_.current)?A(null):A(_.current)}}function u(e){"auto"===y&&D(e.nativeEvent)&&(K.current=!0)}const c=b&&n&&ne&&{"aria-activedescendant":$};return{reference:{...c,onKeyDown(o){j.current=!1;const u=0===o.key.indexOf("Arrow");if(b&&n)return t(o);if(!n&&!E&&u)return;const i=u||"Enter"===o.key||""===o.key.trim(),c=Be(o.key,k),s=function(e,t,n){return Ke(t,n?"ArrowLeft"===e:"ArrowRight"===e,"ArrowDown"===e)}(o.key,k,h);i&&(q.current=g&&c?null:o.key),g?s&&(J(o),n?(_.current=_e(l,e),A(_.current)):r(!0)):c&&(null!=d&&(_.current=d),J(o),!n&&E?r(!0):t(o),n&&A(_.current))},onFocus(){n&&A(null)},onPointerDown:function(e){K.current=y,"auto"===y&&N(e.nativeEvent)&&(K.current=!0)},onMouseDown:u,onClick:u},floating:{"aria-orientation":"both"===k?void 0:k,...c,onKeyDown:t,onPointerMove(){j.current=!0}},item:re}}),[i,o,$,Z,G,l,f,k,h,b,n,ne,g,d,E,m,C,v,y,A,r,re])};function We(e){return u.useMemo((()=>e.every((e=>null==e))?null:t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}),e)}const Ue=function(e,t){void 0===t&&(t={});const{open:n,floatingId:r}=e,{enabled:o=!0,role:i="dialog"}=t,c=b();return u.useMemo((()=>{const e={id:r,role:i};return o?"tooltip"===i?{reference:{"aria-describedby":n?r:void 0},floating:e}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===i?"dialog":i,"aria-controls":n?r:void 0,..."listbox"===i&&{role:"combobox"},..."menu"===i&&{id:c}},floating:{...e,..."menu"===i&&{"aria-labelledby":c}}}:{}}),[o,i,n,r,c])},Ve=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Xe(e,t){return"function"==typeof e?e(t):e}function Ye(e,t){void 0===t&&(t={});const{open:n,elements:{floating:r}}=e,{duration:o=250}=t,i=("number"==typeof o?o:o.close)||0,[c,l]=u.useState(!1),[s,a]=u.useState("unmounted"),f=function(e,t){const[n,r]=u.useState(e);return e&&!n&&r(!0),u.useEffect((()=>{if(!e){const e=setTimeout((()=>r(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,i);return p((()=>{c&&!f&&a("unmounted")}),[c,f]),p((()=>{if(r){if(n){a("initial");const e=requestAnimationFrame((()=>{a("open")}));return()=>{cancelAnimationFrame(e)}}l(!0),a("close")}}),[n,r]),{isMounted:f,status:s}}function ze(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:c=250}=t,l=e.placement,s=l.split("-")[0],a=u.useMemo((()=>({side:s,placement:l})),[s,l]),f="number"==typeof c,d=(f?c:c.open)||0,m=(f?c:c.close)||0,[v,g]=u.useState((()=>({...Xe(i,a),...Xe(n,a)}))),{isMounted:h,status:b}=Ye(e,{duration:c}),y=H(n),w=H(r),E=H(o),R=H(i);return p((()=>{const e=Xe(y.current,a),t=Xe(E.current,a),n=Xe(R.current,a),r=Xe(w.current,a)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===b&&g((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===b&&g({transitionProperty:Object.keys(r).map(Ve).join(","),transitionDuration:d+"ms",...n,...r}),"close"===b){const r=t||e;g({transitionProperty:Object.keys(r).map(Ve).join(","),transitionDuration:m+"ms",...n,...r})}}),[m,E,y,w,R,d,b,a]),{isMounted:h,styles:v}}const Ze=(e,t)=>{var n;const{open:r,dataRef:o}=e,{listRef:i,activeIndex:c,onMatch:l,onTypingChange:s,enabled:a=!0,findMatch:f=null,resetMs:d=750,ignoreKeys:m=[],selectedIndex:v=null}=t,g=u.useRef(),h=u.useRef(""),b=u.useRef(null!=(n=null!=v?v:c)?n:-1),y=u.useRef(null),w=ke(l),E=ke(s),R=H(f),x=H(m);return p((()=>{r&&(clearTimeout(g.current),y.current=null,h.current="")}),[r]),p((()=>{var e;r&&""===h.current&&(b.current=null!=(e=null!=v?v:c)?e:-1)}),[r,v,c]),u.useMemo((()=>{if(!a)return{};function e(e){e?o.current.typing||(o.current.typing=e,E(e)):o.current.typing&&(o.current.typing=e,E(e))}function t(e,t,n){const r=R.current?R.current(t,n):t.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(n.toLocaleLowerCase()))));return r?e.indexOf(r):-1}function n(n){const o=i.current;if(h.current.length>0&&" "!==h.current[0]&&(-1===t(o,o,h.current)?e(!1):" "===n.key&&J(n)),null==o||x.current.includes(n.key)||1!==n.key.length||n.ctrlKey||n.metaKey||n.altKey)return;r&&" "!==n.key&&(J(n),e(!0));o.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&h.current===n.key&&(h.current="",b.current=y.current),h.current+=n.key,clearTimeout(g.current),g.current=setTimeout((()=>{h.current="",b.current=y.current,e(!1)}),d);const u=b.current,c=t(o,[...o.slice((u||0)+1),...o.slice(0,(u||0)+1)],h.current);-1!==c?(w(c),y.current=c):" "!==n.key&&(h.current="")}return{reference:{onKeyDown:n},floating:{onKeyDown:n,onKeyUp(t){" "===t.key&&e(!1)}}}}),[a,r,o,i,d,x,R,w,E])};function Ge(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Qe=e=>({name:"inner",options:e,async fn(t){const{listRef:o,overflowRef:u,onFallbackChange:i,offset:c=0,index:l=0,minItemsVisible:s=4,referenceOverflowThreshold:a=0,scrollRef:f,...m}=e,{rects:p,elements:{floating:v}}=t,g=o.current[l];if(!g)return{};const h={...t,...await n(-g.offsetTop-p.reference.height/2-g.offsetHeight/2-c).fn(t)},b=(null==f?void 0:f.current)||v,y=await r(Ge(h,b.scrollHeight),m),w=await r(h,{...m,elementContext:"reference"}),E=Math.max(0,y.top),R=h.y+E,x=Math.max(0,b.scrollHeight-E-Math.max(0,y.bottom));return b.style.maxHeight=x+"px",b.scrollTop=E,i&&(b.offsetHeight<g.offsetHeight*Math.min(s,o.current.length-1)-1||w.top>=-a||w.bottom>=-a?d((()=>i(!0))):d((()=>i(!1)))),u&&(u.current=await r(Ge({...h,y:R},b.offsetHeight),m)),{y:R}}}),Je=(e,t)=>{let{open:n,elements:r}=e,{enabled:o=!0,overflowRef:i,scrollRef:c,onChange:l}=t;const s=ke(l),a=u.useRef(!1),f=u.useRef(null),m=u.useRef(null);return u.useEffect((()=>{if(!o)return;function e(e){if(e.ctrlKey||!t||null==i.current)return;const n=e.deltaY,r=i.current.top>=-.5,o=i.current.bottom>=-.5,u=t.scrollHeight-t.clientHeight,c=n<0?-1:1,l=n<0?"max":"min";t.scrollHeight<=t.clientHeight||(!r&&n>0||!o&&n<0?(e.preventDefault(),d((()=>{s((e=>e+Math[l](n,u*c)))}))):/firefox/i.test(L())&&(t.scrollTop+=n))}const t=(null==c?void 0:c.current)||r.floating;return n&&t?(t.addEventListener("wheel",e),requestAnimationFrame((()=>{f.current=t.scrollTop,null!=i.current&&(m.current={...i.current})})),()=>{f.current=null,m.current=null,t.removeEventListener("wheel",e)}):void 0}),[o,n,r.floating,i,c,s]),u.useMemo((()=>o?{floating:{onKeyDown(){a.current=!0},onWheel(){a.current=!1},onPointerMove(){a.current=!1},onScroll(){const e=(null==c?void 0:c.current)||r.floating;if(i.current&&e&&a.current){if(null!==f.current){const t=e.scrollTop-f.current;(i.current.bottom<-.5&&t<-1||i.current.top<-.5&&t>1)&&d((()=>s((e=>e+t))))}requestAnimationFrame((()=>{f.current=e.scrollTop}))}}}}:{}),[o,i,r.floating,c,s])};function $e(e){let t,{buffer:n=.5,blockPointerEvents:r=!1,requireIntent:o=!0}=void 0===e?{}:e,u=!1,i=!1,c=null,l=null,s=performance.now();const a=e=>{let{x:r,y:a,placement:f,elements:d,onClose:m,nodeId:p,tree:v}=e;return function(e){function g(){clearTimeout(t),m()}if(clearTimeout(t),!d.domReference||!d.floating||null==f||null==r||null==a)return;const{clientX:h,clientY:b}=e,y=[h,b],w=G(e),E="mouseleave"===e.type,R=B(d.floating,w),x=B(d.domReference,w),I=d.domReference.getBoundingClientRect(),k=d.floating.getBoundingClientRect(),C=f.split("-")[0],M=r>k.right-k.width/2,T=a>k.bottom-k.height/2,O=function(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}(y,I);if(R&&(i=!0,!E))return;if(x&&(i=!1),x&&!E)return void(i=!0);if(E&&A(e.relatedTarget)&&B(d.floating,e.relatedTarget))return;if(v&&Z(v.nodesRef.current,p).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if("top"===C&&a>=I.bottom-1||"bottom"===C&&a<=I.top+1||"left"===C&&r>=I.right-1||"right"===C&&r<=I.left+1)return g();let L=[];switch(C){case"top":L=[[k.left,I.top+1],[k.left,k.bottom-1],[k.right,k.bottom-1],[k.right,I.top+1]],u=h>=k.left&&h<=k.right&&b>=k.top&&b<=I.top+1;break;case"bottom":L=[[k.left,k.top+1],[k.left,I.bottom-1],[k.right,I.bottom-1],[k.right,k.top+1]],u=h>=k.left&&h<=k.right&&b>=I.bottom-1&&b<=k.bottom;break;case"left":L=[[k.right-1,k.bottom],[k.right-1,k.top],[I.left+1,k.top],[I.left+1,k.bottom]],u=h>=k.left&&h<=I.left+1&&b>=k.top&&b<=k.bottom;break;case"right":L=[[I.right-1,k.bottom],[I.right-1,k.top],[k.left+1,k.top],[k.left+1,k.bottom]],u=h>=I.right-1&&h<=k.right&&b>=k.top&&b<=k.bottom}const P=u?L:function(e){let[t,r]=e;const o=k.width>I.width,u=k.height>I.height;switch(C){case"top":return[[o?t+n/2:M?t+4*n:t-4*n,r+n+1],[o?t-n/2:M?t+4*n:t-4*n,r+n+1],...[[k.left,M||o?k.bottom-n:k.top],[k.right,M?o?k.bottom-n:k.top:k.bottom-n]]];case"bottom":return[[o?t+n/2:M?t+4*n:t-4*n,r-n],[o?t-n/2:M?t+4*n:t-4*n,r-n],...[[k.left,M||o?k.top+n:k.bottom],[k.right,M?o?k.top+n:k.bottom:k.top+n]]];case"left":{const e=[t+n+1,u?r+n/2:T?r+4*n:r-4*n],o=[t+n+1,u?r-n/2:T?r+4*n:r-4*n];return[...[[T||u?k.right-n:k.left,k.top],[T?u?k.right-n:k.left:k.right-n,k.bottom]],e,o]}case"right":return[[t-n,u?r+n/2:T?r+4*n:r-4*n],[t-n,u?r-n/2:T?r+4*n:r-4*n],...[[T||u?k.left+n:k.right,k.top],[T?u?k.left+n:k.right:k.left+n,k.bottom]]]}}([r,a]);if(!u){if(i&&!O)return g();if(!E&&o){const t=function(e,t){const n=performance.now(),r=n-s;if(null===c||null===l||0===r)return c=e,l=t,s=n,null;const o=e-c,u=t-l,i=Math.sqrt(o*o+u*u);return c=e,l=t,s=n,i/r}(e.clientX,e.clientY),n=.1;if(null!==t&&t<n)return g()}!function(e,t){const[n,r]=e;let o=!1;const u=t.length;for(let e=0,i=u-1;e<u;i=e++){const[u,c]=t[e]||[0,0],[l,s]=t[i]||[0,0];c>=r!=s>=r&&n<=(l-u)*(r-c)/(s-c)+u&&(o=!o)}return o}([h,b],P)?g():!i&&o&&(t=window.setTimeout(g,40))}}};return a.__options={blockPointerEvents:r},a}function et(e){void 0===e&&(e={});const{open:t=!1,onOpenChange:n,nodeId:r}=e,i=o(e),c=I(),l=u.useRef(null),s=u.useRef({}),a=u.useState((()=>w()))[0],f=b(),[d,m]=u.useState(null),v=u.useCallback((e=>{const t=A(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;i.refs.setReference(t)}),[i.refs]),g=u.useCallback((e=>{(A(e)||null===e)&&(l.current=e,m(e)),(A(i.refs.reference.current)||null===i.refs.reference.current||null!==e&&!A(e))&&i.refs.setReference(e)}),[i.refs]),h=u.useMemo((()=>({...i.refs,setReference:g,setPositionReference:v,domReference:l})),[i.refs,g,v]),y=u.useMemo((()=>({...i.elements,domReference:d})),[i.elements,d]),E=ke(n),R=u.useMemo((()=>({...i,refs:h,elements:y,dataRef:s,nodeId:r,floatingId:f,events:a,open:t,onOpenChange:E})),[i,r,f,a,t,E,h,y]);return p((()=>{const e=null==c?void 0:c.nodesRef.current.find((e=>e.id===r));e&&(e.context=R)})),u.useMemo((()=>({...i,context:R,refs:h,elements:y,reference:g,positionReference:v})),[i,h,y,R,g,v])}function tt(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;var u;0===n.indexOf("on")?(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];return null==(e=r.get(n))?void 0:e.map((e=>e(...o))).find((e=>void 0!==e))})):e[n]=o})),e):e),{})}}const nt=function(e){void 0===e&&(e=[]);const t=e,n=u.useCallback((t=>tt(t,e,"reference")),t),r=u.useCallback((t=>tt(t,e,"floating")),t),o=u.useCallback((t=>tt(t,e,"item")),e.map((e=>null==e?void 0:e.item)));return u.useMemo((()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o})),[n,r,o])};export{y as FloatingArrow,U as FloatingDelayGroup,pe as FloatingFocusManager,he as FloatingList,C as FloatingNode,we as FloatingOverlay,fe as FloatingPortal,M as FloatingTree,Qe as inner,$e as safePolygon,xe as useClick,Me as useClientPoint,V as useDelayGroup,W as useDelayGroupContext,Pe as useDismiss,et as useFloating,k as useFloatingNodeId,x as useFloatingParentNodeId,ae as useFloatingPortalNode,I as useFloatingTree,Ae as useFocus,q as useHover,b as useId,Je as useInnerOffset,nt as useInteractions,be as useListItem,je as useListNavigation,We as useMergeRefs,Ue as useRole,Ye as useTransitionStatus,ze as useTransitionStyles,Ze 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);function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}var c="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;let l=!1,s=0;const a=()=>"floating-ui-"+s++;const f=u["useId".toString()]||function(){const[e,t]=u.useState((()=>l?a():void 0));return c((()=>{null==e&&t(a())}),[]),u.useEffect((()=>{l||(l=!0)}),[]),e},d=u.forwardRef((function(e,n){var r;let{context:{placement:o,elements:{floating:c},middlewareData:{arrow:l}},width:s=14,height:a=7,tipRadius:d=0,strokeWidth:m=0,staticOffset:p,stroke:v,d:g,...h}=e;m*=2;const y=m/2,b=s/2*(d/-8+1),w=a/2*d/4,[E,R]=o.split("-"),x=!!c&&t.platform.isRTL(c),I=!!g,O="top"===E||"bottom"===E,k=p&&"end"===R?"bottom":"top";let C=p&&"end"===R?"right":"left";p&&x&&(C="end"===R?"left":"right");const M=I?0:y,T=null!=(null==l?void 0:l.x)?p||l.x:"",P=null!=(null==l?void 0:l.y)?p||l.y+M:"",S=g||"M0,0 H"+s+" L"+(s-b)+","+(a-w)+" Q"+s/2+","+a+" "+b+","+(a-w)+" Z",A={top:I?"rotate(180deg)":"",left:I?"rotate(90deg)":"rotate(-90deg)",bottom:I?"":"rotate(180deg)",right:I?"rotate(-90deg)":"rotate(90deg)"}[E],L=f();return u.createElement("svg",i({},h,{suppressHydrationWarning:!0,"aria-hidden":!0,ref:n,width:I?s:s+m,height:s,viewBox:"0 0 "+s+" "+(a>s?a:s),style:{...h.style,position:"absolute",pointerEvents:"none",[C]:T,[k]:P,[E]:O||I?"100%":"calc(100% - "+m/2+"px)",transform:A+(null!=(r=h.style)&&r.transform?" "+h.style.transform:"")}}),m>0&&u.createElement("path",{clipPath:"url(#"+L+")",fill:"none",stroke:v,strokeWidth:m+(g?0:1),d:S}),u.createElement("path",{stroke:m&&!g?h.fill:"none",d:S}),u.createElement("clipPath",{id:L},u.createElement("rect",{x:-y,y:y*(I?-1:1),width:s+m,height:s})))}));function m(){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){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}const p=u.createContext(null),v=u.createContext(null),g=()=>{var e;return(null==(e=u.useContext(p))?void 0:e.id)||null},h=()=>u.useContext(v);function y(e){return(null==e?void 0:e.ownerDocument)||document}function b(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function w(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function E(e){return y(e).defaultView||window}function R(e){return!!e&&e instanceof E(e).Element}function x(e){return!!e&&e instanceof E(e).HTMLElement}function I(e){if(0===e.mozInputSource&&e.isTrusted)return!0;const t=/Android/i;return(t.test(b())||t.test(w()))&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType}function O(e){return 0===e.width&&0===e.height||1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"!==e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail}function k(){return/apple/i.test(navigator.vendor)}function C(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function M(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&(r=n,"undefined"!=typeof ShadowRoot&&(r instanceof E(r).ShadowRoot||r instanceof ShadowRoot))){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}var r;return!1}function T(e){const t=n.useRef(e);return c((()=>{t.current=e})),t}const P="data-floating-ui-safe-polygon";function S(e,t,n){return n&&!C(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}const A=u.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),L=()=>u.useContext(A);var D=new WeakMap,N=new WeakMap,F={},j=0,K=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];F[n]||(F[n]=new WeakMap);var o=F[n],u=[],i=new Set,c=function(e){e&&!i.has(e)&&(i.add(e),c(e.parentNode))};r.forEach(c);var l=function(e){!e||r.indexOf(e)>=0||Array.prototype.forEach.call(e.children,(function(e){if(i.has(e))l(e);else{var t=e.getAttribute("aria-hidden"),r=null!==t&&"false"!==t,c=(D.get(e)||0)+1,s=(o.get(e)||0)+1;D.set(e,c),o.set(e,s),u.push(e),1===c&&r&&N.set(e,!0),1===s&&e.setAttribute(n,"true"),r||e.setAttribute("aria-hidden","true")}}))};return l(t),i.clear(),j++,function(){u.forEach((function(e){var t=D.get(e)-1,r=o.get(e)-1;D.set(e,t),o.set(e,r),t||(N.has(e)||e.removeAttribute("aria-hidden"),N.delete(e)),r||e.removeAttribute(n)})),--j||(D=new WeakMap,D=new WeakMap,N=new WeakMap,F={})}},_=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"].join(","),B="undefined"==typeof Element,H=B?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,q=!B&&Element.prototype.getRootNode?function(e){return e.getRootNode()}:function(e){return e.ownerDocument},W=function e(t,n,r){for(var o=[],u=Array.from(t);u.length;){var i=u.shift();if("SLOT"===i.tagName){var c=i.assignedElements(),l=e(c.length?c:i.children,!0,r);r.flatten?o.push.apply(o,l):o.push({scopeParent:i,candidates:l})}else{H.call(i,_)&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var s=i.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(i),a=!r.shadowRootFilter||r.shadowRootFilter(i);if(s&&a){var f=e(!0===s?i.children:s.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:i,candidates:f})}else u.unshift.apply(u,i.children)}}return o},U=function(e,t){return e.tabIndex<0&&(t||/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||e.isContentEditable)&&isNaN(parseInt(e.getAttribute("tabindex"),10))?0:e.tabIndex},z=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},V=function(e){return"INPUT"===e.tagName},X=function(e){return function(e){return V(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||q(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!o||o===e}(e)},Y=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},G=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=H.call(e,"details>summary:first-of-type")?e.parentElement:e;if(H.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Y(e)}else{if("function"==typeof r){for(var u=e;e;){var i=e.parentElement,c=q(e);if(i&&!i.shadowRoot&&!0===r(i))return Y(e);e=e.assignedSlot?e.assignedSlot:i||c===e.ownerDocument?i:c.host}e=u}if(function(e){for(var t,n=q(e).host,r=!!(null!==(t=n)&&void 0!==t&&t.ownerDocument.contains(n)||e.ownerDocument.contains(e));!r&&n;){var o;r=!(null===(o=n=q(n).host)||void 0===o||!o.ownerDocument.contains(n))}return r}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Z=function(e,t){return!(t.disabled||function(e){return V(e)&&"hidden"===e.type}(t)||G(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!H.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},$=function(e,t){return!(X(t)||U(t)<0||!Z(e,t))},Q=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},J=function e(t){var n=[],r=[];return t.forEach((function(t,o){var u=!!t.scopeParent,i=u?t.scopeParent:t,c=U(i,u),l=u?e(t.candidates):i;0===c?u?n.push.apply(n,l):n.push(i):r.push({documentOrder:o,tabIndex:c,item:t,isScope:u,content:l})})),r.sort(z).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},ee=function(e,t){var n;return n=(t=t||{}).getShadowRoot?W([e],t.includeContainer,{filter:$.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Q}):function(e,t,n){var r=Array.prototype.slice.apply(e.querySelectorAll(_));return t&&H.call(e,_)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,$.bind(null,t)),J(n)};function te(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}let ne=0;function re(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(ne);const u=()=>null==e?void 0:e.focus({preventScroll:n});o?u():ne=requestAnimationFrame(u)}function oe(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}function ue(e){return"composedPath"in e?e.composedPath()[0]:e.target}function ie(e){return x(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function ce(e){e.preventDefault(),e.stopPropagation()}const le=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function se(e,t){const n=ee(e,le());"prev"===t&&n.reverse();const r=n.indexOf(te(y(e)));return n.slice(r+1)[0]}function ae(){return se(document.body,"next")}function fe(){return se(document.body,"prev")}function de(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!M(n,r)}function me(e){ee(e,le()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function pe(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const ve={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function ge(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const he=u.forwardRef((function(e,t){const[n,r]=u.useState();return c((()=>(k()&&r("button"),document.addEventListener("keydown",ge),()=>{document.removeEventListener("keydown",ge)})),[]),u.createElement("span",i({},e,{ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,"data-floating-ui-focus-guard":"",style:ve}))})),ye=u.createContext(null),be=function(e){let{id:t,root:n}=void 0===e?{}:e;const[r,o]=u.useState(null),i=u.useRef(null),l=f(),s=we(),a=u.useMemo((()=>({id:t,root:n,portalContext:s,uniqueId:l})),[t,n,s,l]),d=u.useRef();return c((()=>{const e=i.current;return()=>{null==r||r.remove(),null==e||e.remove()}}),[r,a]),c((()=>{if(d.current===a)return;d.current=a;const{id:e,root:t,portalContext:n,uniqueId:r}=a,u=e?document.getElementById(e):null,i="data-floating-ui-portal";if(u){const e=document.createElement("div");e.id=r,e.setAttribute(i,""),u.appendChild(e),o(e)}else{let u=(null==n?void 0:n.portalNode)||t||document.body,c=null;e&&(c=document.createElement("div"),c.id=e,u.appendChild(c));const l=document.createElement("div");l.id=r,l.setAttribute(i,""),u=c||u,u.appendChild(l),o(l)}}),[a]),r},we=()=>u.useContext(ye),Ee=u.forwardRef((function(e,t){return u.createElement("button",i({},e,{type:"button",ref:t,tabIndex:-1,style:ve}))}));function Re(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const xe=u.createContext({register:()=>{},unregister:()=>{},map:new Map,elementsRef:{current:[]}});const Ie="data-floating-ui-scroll-lock",Oe=u.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return c((()=>{var e,t;if(!n)return;if(document.body.hasAttribute(Ie))return;document.body.setAttribute(Ie,"");const r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth;if(!/iP(hone|ad|od)|iOS/.test(b()))return Object.assign(document.body.style,{overflow:"hidden",[r]:o+"px"}),()=>{document.body.removeAttribute(Ie),Object.assign(document.body.style,{overflow:"",[r]:""})};const u=(null==(e=window.visualViewport)?void 0:e.offsetLeft)||0,i=(null==(t=window.visualViewport)?void 0:t.offsetTop)||0,c=window.pageXOffset,l=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(l-Math.floor(i))+"px",left:-(c-Math.floor(u))+"px",right:"0",[r]:o+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[r]:""}),document.body.removeAttribute(Ie),window.scrollTo(c,l)}}),[n]),u.createElement("div",i({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function ke(e){return x(e.target)&&"BUTTON"===e.target.tagName}function Ce(e){return ie(e)}const Me=u["useInsertionEffect".toString()]||(e=>e());function Te(e){const t=u.useRef((()=>{}));return Me((()=>{t.current=e})),u.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}function Pe(e){return null!=e&&null!=e.clientX}function Se(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 Ae={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Le={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"};let De=!1;const Ne="ArrowUp",Fe="ArrowDown",je="ArrowLeft",Ke="ArrowRight";function _e(e,t,n){return Math.floor(e/t)!==n}function Be(e,t){return t<0||t>=e.current.length}function He(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:u=1}=void 0===t?{}:t;const i=e.current;let c=n;do{var l,s;c+=r?-u:u}while(c>=0&&c<=i.length-1&&(o?o.includes(c):null==i[c]||(null==(l=i[c])?void 0:l.hasAttribute("disabled"))||"true"===(null==(s=i[c])?void 0:s.getAttribute("aria-disabled"))));return c}function qe(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function We(e,t){return qe(t,e===Ne||e===Fe,e===je||e===Ke)}function Ue(e,t,n){return qe(t,e===Fe,n?e===je:e===Ke)||"Enter"===e||" "==e||""===e}function ze(e,t){return He(e,{disabledIndices:t})}function Ve(e,t){return He(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}const Xe=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Ye(e,t){return"function"==typeof e?e(t):e}function Ge(e,t){void 0===t&&(t={});const{open:n,elements:{floating:r}}=e,{duration:o=250}=t,i=("number"==typeof o?o:o.close)||0,[l,s]=u.useState(!1),[a,f]=u.useState("unmounted"),d=function(e,t){const[n,r]=u.useState(e);return e&&!n&&r(!0),u.useEffect((()=>{if(!e){const e=setTimeout((()=>r(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,i);return c((()=>{l&&!d&&f("unmounted")}),[l,d]),c((()=>{if(r){if(n){f("initial");const e=requestAnimationFrame((()=>{f("open")}));return()=>{cancelAnimationFrame(e)}}s(!0),f("close")}}),[n,r]),{isMounted:d,status:a}}function Ze(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}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;var u;0===n.indexOf("on")?(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];return null==(e=r.get(n))?void 0:e.map((e=>e(...o))).find((e=>void 0!==e))})):e[n]=o})),e):e),{})}}Object.defineProperty(e,"arrow",{enumerable:!0,get:function(){return t.arrow}}),Object.defineProperty(e,"autoPlacement",{enumerable:!0,get:function(){return t.autoPlacement}}),Object.defineProperty(e,"autoUpdate",{enumerable:!0,get:function(){return t.autoUpdate}}),Object.defineProperty(e,"computePosition",{enumerable:!0,get:function(){return t.computePosition}}),Object.defineProperty(e,"detectOverflow",{enumerable:!0,get:function(){return t.detectOverflow}}),Object.defineProperty(e,"flip",{enumerable:!0,get:function(){return t.flip}}),Object.defineProperty(e,"getOverflowAncestors",{enumerable:!0,get:function(){return t.getOverflowAncestors}}),Object.defineProperty(e,"hide",{enumerable:!0,get:function(){return t.hide}}),Object.defineProperty(e,"inline",{enumerable:!0,get:function(){return t.inline}}),Object.defineProperty(e,"limitShift",{enumerable:!0,get:function(){return t.limitShift}}),Object.defineProperty(e,"offset",{enumerable:!0,get:function(){return t.offset}}),Object.defineProperty(e,"platform",{enumerable:!0,get:function(){return t.platform}}),Object.defineProperty(e,"shift",{enumerable:!0,get:function(){return t.shift}}),Object.defineProperty(e,"size",{enumerable:!0,get:function(){return t.size}}),e.FloatingArrow=d,e.FloatingDelayGroup=e=>{let{children:t,delay:n,timeoutMs:r=0}=e;const[o,i]=u.useReducer(((e,t)=>({...e,...t})),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),l=u.useRef(null),s=u.useCallback((e=>{i({currentId:e})}),[]);return c((()=>{o.currentId?null===l.current?l.current=o.currentId:i({isInstantPhase:!0}):(i({isInstantPhase:!1}),l.current=null)}),[o.currentId]),u.createElement(A.Provider,{value:u.useMemo((()=>({...o,setState:i,setCurrentId:s})),[o,i,s])},t)},e.FloatingFocusManager=function(e){let{context:t,children:n,order:r=["content"],guards:o=!0,initialFocus:i=0,returnFocus:l=!0,modal:s=!0,visuallyHiddenDismiss:a=!1,closeOnFocusOut:f=!0}=e;const{open:d,refs:m,nodeId:p,onOpenChange:v,events:g,dataRef:b,elements:{domReference:w,floating:E}}=t,R=T(r),I=T(i),O=T(l),k=h(),C=we(),[P,S]=u.useState(null),A="number"==typeof i&&i<0,L=u.useRef(null),D=u.useRef(null),N=u.useRef(!1),F=u.useRef(null),j=u.useRef(!1),_=null!=C,B=w&&"combobox"===w.getAttribute("role")&&ie(w),H=u.useCallback((function(e){return void 0===e&&(e=E),e?ee(e,le()):[]}),[E]),q=u.useCallback((e=>{const t=H(e);return R.current.map((e=>w&&"reference"===e?w:E&&"floating"===e?E:t)).filter(Boolean).flat()}),[w,E,R,H]);u.useEffect((()=>{if(!s)return;function e(e){if("Tab"===e.key){0!==H().length||B||ce(e);const t=q(),n=ue(e);"reference"===R.current[0]&&n===w&&(ce(e),e.shiftKey?re(t[t.length-1]):re(t[1])),"floating"===R.current[1]&&n===E&&e.shiftKey&&(ce(e),re(t[0]))}}const t=y(E);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[w,E,s,R,m,B,H,q]),u.useEffect((()=>{if(f)return E&&x(w)?(w.addEventListener("focusout",t),w.addEventListener("pointerdown",e),!s&&E.addEventListener("focusout",t),()=>{w.removeEventListener("focusout",t),w.removeEventListener("pointerdown",e),!s&&E.removeEventListener("focusout",t)}):void 0;function e(){j.current=!0,setTimeout((()=>{j.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const e=!(M(w,t)||M(E,t)||M(t,E)||M(null==C?void 0:C.portalNode,t)||null!=t&&t.hasAttribute("data-floating-ui-focus-guard")||k&&(oe(k.nodesRef.current,p).find((e=>{var n,r;return M(null==(n=e.context)?void 0:n.elements.floating,t)||M(null==(r=e.context)?void 0:r.elements.domReference,t)}))||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}(k.nodesRef.current,p).find((e=>{var n,r;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(r=e.context)?void 0:r.elements.domReference)===t}))));t&&e&&!j.current&&t!==F.current&&(N.current=!0,v(!1))}))}}),[w,E,s,p,k,C,v,f]),u.useEffect((()=>{var e;const t=Array.from((null==C||null==(e=C.portalNode)?void 0:e.querySelectorAll("[data-floating-ui-portal]"))||[]);if(E&&s){const e=[E,...t,...[L.current,D.current].filter(Boolean)],n=K(R.current.includes("reference")||B?e.concat(w||[]):e);return()=>{n()}}}),[w,E,s,R,C,B]),u.useEffect((()=>{if(s&&!o&&E){const e=[],t=le(),n=ee(y(E).body,t),r=q(),o=n.filter((e=>!r.includes(e)));return o.forEach(((t,n)=>{e[n]=t.getAttribute("tabindex"),t.setAttribute("tabindex","-1")})),()=>{o.forEach(((t,n)=>{const r=e[n];null==r?t.removeAttribute("tabindex"):t.setAttribute("tabindex",r)}))}}}),[E,s,o,q]),c((()=>{if(!E)return;let e=!1;const t=y(E),n=te(t),r=b.current;function o(t){if("escapeKey"===t.type&&m.domReference.current&&(F.current=m.domReference.current),["referencePress","escapeKey"].includes(t.type))return;const n=t.data.returnFocus;"object"==typeof n?(N.current=!1,e=n.preventScroll):N.current=!n}return F.current=n,queueMicrotask((()=>{const e=q(E),t=I.current,r=("number"==typeof t?e[t]:t.current)||E,o=M(E,n);A||o||!d||re(r,{preventScroll:r===E})})),g.on("dismiss",o),()=>{g.off("dismiss",o);const n=te(t);(M(E,n)||k&&oe(k.nodesRef.current,p).some((e=>{var t;return M(null==(t=e.context)?void 0:t.elements.floating,n)}))||r.openEvent&&["click","mousedown"].includes(r.openEvent.type))&&m.domReference.current&&(F.current=m.domReference.current),O.current&&x(F.current)&&!N.current&&re(F.current,{cancelPrevious:!1,preventScroll:e})}}),[d,E,q,O,I,b,m,g,A,k,p]),c((()=>{if(C)return C.setFocusManagerState({...t,modal:s,closeOnFocusOut:f}),()=>{C.setFocusManagerState(null)}}),[C,s,f,t]),c((()=>{if(!A&&E&&(e(),"function"==typeof MutationObserver)){const t=new MutationObserver(e);return t.observe(E,{childList:!0,subtree:!0}),()=>{t.disconnect()}}function e(){te(y(E))!==m.domReference.current&&S(H().length)}}),[E,H,A,m]);const W=o&&(_||s)&&!B;function U(e){return a&&s?u.createElement(Ee,{ref:"start"===e?L:D,onClick:()=>v(!1)},"string"==typeof a?a:"Dismiss"):null}return u.createElement(u.Fragment,null,W&&u.createElement(he,{"data-type":"inside",ref:null==C?void 0:C.beforeInsideRef,onFocus:e=>{if(s){const e=q();re("reference"===r[0]?e[0]:e[e.length-1])}else if(null!=C&&C.preserveTabOrder&&C.portalNode)if(N.current=!1,de(e,C.portalNode)){const e=ae()||w;null==e||e.focus()}else{var t;null==(t=C.beforeOutsideRef.current)||t.focus()}}}),B?null:U("start"),u.cloneElement(n,0===P||r.includes("floating")?{tabIndex:0}:{}),U("end"),W&&u.createElement(he,{"data-type":"inside",ref:null==C?void 0:C.afterInsideRef,onFocus:e=>{if(s)re(q()[0]);else if(null!=C&&C.preserveTabOrder&&C.portalNode)if(f&&(N.current=!0),de(e,C.portalNode)){const e=fe()||w;null==e||e.focus()}else{var t;null==(t=C.afterOutsideRef.current)||t.focus()}}}))},e.FloatingList=function(e){let{children:t,elementsRef:n,labelsRef:r}=e;const[o,i]=u.useState((()=>new Map)),l=u.useCallback((e=>{i((t=>new Map(t).set(e,null)))}),[]),s=u.useCallback((e=>{i((t=>{const n=new Map(t);return n.delete(e),n}))}),[]);return c((()=>{if(o.size<2)return;const e=new Map(o);Array.from(e.keys()).sort(Re).forEach(((t,n)=>{e.set(t,n)})),function(e,t){if(e.size!==t.size)return!1;for(const[n,r]of e.entries())if(r!==t.get(n))return!1;return!0}(o,e)||i(e)}),[o]),u.createElement(xe.Provider,{value:{register:l,unregister:s,map:o,elementsRef:n,labelsRef:r}},t)},e.FloatingNode=e=>{let{children:t,id:n}=e;const r=g();return u.createElement(p.Provider,{value:u.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},e.FloatingOverlay=Oe,e.FloatingPortal=e=>{let{children:t,id:n,root:o=null,preserveTabOrder:i=!0}=e;const c=be({id:n,root:o}),[l,s]=u.useState(null),a=u.useRef(null),f=u.useRef(null),d=u.useRef(null),m=u.useRef(null),p=!!l&&!l.modal&&!(!o&&!c)&&i;return u.useEffect((()=>{if(c&&i&&(null==l||!l.modal))return c.addEventListener("focusin",e,!0),c.addEventListener("focusout",e,!0),()=>{c.removeEventListener("focusin",e,!0),c.removeEventListener("focusout",e,!0)};function e(e){if(c&&de(e)){("focusin"===e.type?pe:me)(c)}}}),[c,i,null==l?void 0:l.modal]),u.createElement(ye.Provider,{value:u.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:a,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:m,portalNode:c,setFocusManagerState:s})),[i,c])},p&&c&&u.createElement(he,{"data-type":"outside",ref:a,onFocus:e=>{if(de(e,c)){var t;null==(t=d.current)||t.focus()}else{const e=fe()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus()}}}),p&&c&&u.createElement("span",{"aria-owns":c.id,style:ve}),c&&r.createPortal(t,c),p&&c&&u.createElement(he,{"data-type":"outside",ref:f,onFocus:e=>{if(de(e,c)){var t;null==(t=m.current)||t.focus()}else{const e=ae()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1))}}}))},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))}),[]),i=u.useState((()=>m()))[0];return u.createElement(v.Provider,{value:u.useMemo((()=>({nodesRef:n,addNode:r,removeNode:o,events:i})),[n,r,o,i])},t)},e.inner=e=>({name:"inner",options:e,async fn(n){const{listRef:o,overflowRef:u,onFallbackChange:i,offset:c=0,index:l=0,minItemsVisible:s=4,referenceOverflowThreshold:a=0,scrollRef:f,...d}=e,{rects:m,elements:{floating:p}}=n,v=o.current[l];if(!v)return{};const g={...n,...await t.offset(-v.offsetTop-m.reference.height/2-v.offsetHeight/2-c).fn(n)},h=(null==f?void 0:f.current)||p,y=await t.detectOverflow(Ze(g,h.scrollHeight),d),b=await t.detectOverflow(g,{...d,elementContext:"reference"}),w=Math.max(0,y.top),E=g.y+w,R=Math.max(0,h.scrollHeight-w-Math.max(0,y.bottom));return h.style.maxHeight=R+"px",h.scrollTop=w,i&&(h.offsetHeight<v.offsetHeight*Math.min(s,o.current.length-1)-1||b.top>=-a||b.bottom>=-a?r.flushSync((()=>i(!0))):r.flushSync((()=>i(!1)))),u&&(u.current=await t.detectOverflow(Ze({...g,y:E},h.offsetHeight),d)),{y:E}}}),e.safePolygon=function(e){let t,{buffer:n=.5,blockPointerEvents:r=!1,requireIntent:o=!0}=void 0===e?{}:e,u=!1,i=!1,c=null,l=null,s=performance.now();const a=e=>{let{x:r,y:a,placement:f,elements:d,onClose:m,nodeId:p,tree:v}=e;return function(e){function g(){clearTimeout(t),m()}if(clearTimeout(t),!d.domReference||!d.floating||null==f||null==r||null==a)return;const{clientX:h,clientY:y}=e,b=[h,y],w=ue(e),E="mouseleave"===e.type,x=M(d.floating,w),I=M(d.domReference,w),O=d.domReference.getBoundingClientRect(),k=d.floating.getBoundingClientRect(),C=f.split("-")[0],T=r>k.right-k.width/2,P=a>k.bottom-k.height/2,S=function(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}(b,O);if(x&&(i=!0,!E))return;if(I&&(i=!1),I&&!E)return void(i=!0);if(E&&R(e.relatedTarget)&&M(d.floating,e.relatedTarget))return;if(v&&oe(v.nodesRef.current,p).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if("top"===C&&a>=O.bottom-1||"bottom"===C&&a<=O.top+1||"left"===C&&r>=O.right-1||"right"===C&&r<=O.left+1)return g();let A=[];switch(C){case"top":A=[[k.left,O.top+1],[k.left,k.bottom-1],[k.right,k.bottom-1],[k.right,O.top+1]],u=h>=k.left&&h<=k.right&&y>=k.top&&y<=O.top+1;break;case"bottom":A=[[k.left,k.top+1],[k.left,O.bottom-1],[k.right,O.bottom-1],[k.right,k.top+1]],u=h>=k.left&&h<=k.right&&y>=O.bottom-1&&y<=k.bottom;break;case"left":A=[[k.right-1,k.bottom],[k.right-1,k.top],[O.left+1,k.top],[O.left+1,k.bottom]],u=h>=k.left&&h<=O.left+1&&y>=k.top&&y<=k.bottom;break;case"right":A=[[O.right-1,k.bottom],[O.right-1,k.top],[k.left+1,k.top],[k.left+1,k.bottom]],u=h>=O.right-1&&h<=k.right&&y>=k.top&&y<=k.bottom}const L=u?A:function(e){let[t,r]=e;const o=k.width>O.width,u=k.height>O.height;switch(C){case"top":return[[o?t+n/2:T?t+4*n:t-4*n,r+n+1],[o?t-n/2:T?t+4*n:t-4*n,r+n+1],...[[k.left,T||o?k.bottom-n:k.top],[k.right,T?o?k.bottom-n:k.top:k.bottom-n]]];case"bottom":return[[o?t+n/2:T?t+4*n:t-4*n,r-n],[o?t-n/2:T?t+4*n:t-4*n,r-n],...[[k.left,T||o?k.top+n:k.bottom],[k.right,T?o?k.top+n:k.bottom:k.top+n]]];case"left":{const e=[t+n+1,u?r+n/2:P?r+4*n:r-4*n],o=[t+n+1,u?r-n/2:P?r+4*n:r-4*n];return[...[[P||u?k.right-n:k.left,k.top],[P?u?k.right-n:k.left:k.right-n,k.bottom]],e,o]}case"right":return[[t-n,u?r+n/2:P?r+4*n:r-4*n],[t-n,u?r-n/2:P?r+4*n:r-4*n],...[[P||u?k.left+n:k.right,k.top],[P?u?k.left+n:k.right:k.left+n,k.bottom]]]}}([r,a]);if(!u){if(i&&!S)return g();if(!E&&o){const t=function(e,t){const n=performance.now(),r=n-s;if(null===c||null===l||0===r)return c=e,l=t,s=n,null;const o=e-c,u=t-l,i=Math.sqrt(o*o+u*u);return c=e,l=t,s=n,i/r}(e.clientX,e.clientY),n=.1;if(null!==t&&t<n)return g()}!function(e,t){const[n,r]=e;let o=!1;const u=t.length;for(let e=0,i=u-1;e<u;i=e++){const[u,c]=t[e]||[0,0],[l,s]=t[i]||[0,0];c>=r!=s>=r&&n<=(l-u)*(r-c)/(s-c)+u&&(o=!o)}return o}([h,y],L)?g():!i&&o&&(t=window.setTimeout(g,40))}}};return a.__options={blockPointerEvents:r},a},e.useClick=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:i}}=e,{enabled:c=!0,event:l="click",toggle:s=!0,ignoreMouse:a=!1,keyboardHandlers:f=!0}=t,d=u.useRef(),m=u.useRef(!1);return u.useMemo((()=>c?{reference:{onPointerDown(e){d.current=e.pointerType},onMouseDown(e){0===e.button&&(C(d.current,!0)&&a||"click"!==l&&(n?!s||o.current.openEvent&&"mousedown"!==o.current.openEvent.type||r(!1):(e.preventDefault(),r(!0)),o.current.openEvent=e.nativeEvent))},onClick(e){"mousedown"===l&&d.current?d.current=void 0:C(d.current,!0)&&a||(n?!s||o.current.openEvent&&"click"!==o.current.openEvent.type||r(!1):r(!0),o.current.openEvent=e.nativeEvent)},onKeyDown(e){d.current=void 0,f&&!ke(e)&&(" "!==e.key||Ce(i)||(e.preventDefault(),m.current=!0),"Enter"===e.key&&(n?s&&r(!1):r(!0)))},onKeyUp(e){!f||ke(e)||Ce(i)||" "===e.key&&m.current&&(m.current=!1,n?s&&r(!1):r(!0))}}}:{}),[c,o,l,a,f,i,s,n,r])},e.useClientPoint=function(e,t){let{open:n,refs:r,dataRef:o,elements:{floating:i}}=e,{enabled:l=!0,axis:s="both",x:a=null,y:f=null}=void 0===t?{}:t;const d=u.useRef(!1),m=u.useRef(null),[p,v]=u.useState(),[g,h]=u.useState([]),y=Te(((e,t)=>{d.current||o.current.openEvent&&!Pe(o.current.openEvent)||r.setPositionReference(function(e,t){let n=null,r=null,o=!1;return{contextElement:e.current||void 0,getBoundingClientRect(){var u,i;const c=(null==(u=e.current)?void 0:u.getBoundingClientRect())||{width:0,height:0,x:0,y:0},l="x"===t.axis||"both"===t.axis,s="y"===t.axis||"both"===t.axis,a=["mouseenter","mousemove"].includes((null==(i=t.dataRef.current.openEvent)?void 0:i.type)||"")&&"touch"!==t.pointerType;let f=c.width,d=c.height,m=c.x,p=c.y;return null==n&&t.x&&l&&(n=c.x-t.x),null==r&&t.y&&s&&(r=c.y-t.y),m-=n||0,p-=r||0,f=0,d=0,!o||a?(f="y"===t.axis?c.width:0,d="x"===t.axis?c.height:0,m=l&&null!=t.x?t.x:m,p=s&&null!=t.y?t.y:p):o&&!a&&(d="x"===t.axis?c.height:d,f="y"===t.axis?c.width:f),o=!0,{width:f,height:d,x:m,y:p,top:p,right:m+f,bottom:p+d,left:m}}}}(r.domReference,{x:e,y:t,axis:s,dataRef:o,pointerType:p}))})),b=Te((e=>{null==a&&null==f&&(n?m.current||h([]):y(e.clientX,e.clientY))})),w=C(p)?i:n,R=u.useCallback((()=>{if(!w||!l||null!=a||null!=f)return;const e=E(r.floating.current);function t(n){const o=ue(n);M(r.floating.current,o)?(e.removeEventListener("mousemove",t),m.current=null):y(n.clientX,n.clientY)}if(!o.current.openEvent||Pe(o.current.openEvent)){e.addEventListener("mousemove",t);const n=()=>{e.removeEventListener("mousemove",t),m.current=null};return m.current=n,n}r.setPositionReference(r.domReference.current)}),[o,l,w,r,y,a,f]);return u.useEffect((()=>R()),[R,g]),u.useEffect((()=>{l&&!i&&(d.current=!1)}),[l,i]),u.useEffect((()=>{!l&&n&&(d.current=!0)}),[l,n]),c((()=>{!l||null==a&&null==f||(d.current=!1,y(a,f))}),[l,a,f,y]),u.useMemo((()=>{if(!l)return{};function e(e){let{pointerType:t}=e;v(t)}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove:b,onMouseEnter:b}}}),[l,b])},e.useDelayGroup=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:u,setCurrentId:i,initialDelay:l,setState:s,timeoutMs:a}=L();c((()=>{u&&(s({delay:{open:1,close:S(l,"close")}}),u!==o&&r(!1))}),[o,r,s,u,l]),c((()=>{function e(){r(!1),s({delay:l,currentId:null})}if(!n&&u===o){if(a){const t=window.setTimeout(e,a);return()=>{clearTimeout(t)}}e()}}),[n,s,u,o,r,l,a]),c((()=>{n&&i(o)}),[n,i,o])},e.useDelayGroupContext=L,e.useDismiss=function(e,n){void 0===n&&(n={});const{open:r,onOpenChange:o,events:i,nodeId:c,elements:{reference:l,domReference:s,floating:a},dataRef:f}=e,{enabled:d=!0,escapeKey:m=!0,outsidePress:p=!0,outsidePressEvent:v="pointerdown",referencePress:b=!1,referencePressEvent:w="pointerdown",ancestorScroll:k=!1,bubbles:C}=n,M=h(),T=null!=g(),P=Te("function"==typeof p?p:()=>!1),S="function"==typeof p?P:p,A=u.useRef(!1),{escapeKeyBubbles:L,outsidePressBubbles:D}=(e=>{var t,n;return{escapeKeyBubbles:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePressBubbles:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}})(C),N=Te((e=>{if(!r||!d||!m||"Escape"!==e.key)return;const t=M?oe(M.nodesRef.current,c):[];if(!L&&(e.stopPropagation(),t.length>0)){let e=!0;if(t.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}i.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),o(!1)})),F=Te((e=>{const t=A.current;if(A.current=!1,t)return;if("function"==typeof S&&!S(e))return;const n=ue(e);if(x(n)&&a){const t=n.clientWidth>0&&n.scrollWidth>n.clientWidth,r=n.clientHeight>0&&n.scrollHeight>n.clientHeight;let o=r&&e.offsetX>n.clientWidth;if(r){"rtl"===E(a).getComputedStyle(n).direction&&(o=e.offsetX<=n.offsetWidth-n.clientWidth)}if(o||t&&e.offsetY>n.clientHeight)return}const r=M&&oe(M.nodesRef.current,c).some((t=>{var n;return Se(e,null==(n=t.context)?void 0:n.elements.floating)}));if(Se(e,a)||Se(e,s)||r)return;const u=M?oe(M.nodesRef.current,c):[];if(u.length>0){let e=!0;if(u.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}i.emit("dismiss",{type:"outsidePress",data:{returnFocus:T?{preventScroll:!0}:I(e)||O(e)}}),o(!1)}));return u.useEffect((()=>{if(!r||!d)return;function e(){o(!1)}f.current.__escapeKeyBubbles=L,f.current.__outsidePressBubbles=D;const n=y(a);m&&n.addEventListener("keydown",N),S&&n.addEventListener(v,F);let u=[];return k&&(R(s)&&(u=t.getOverflowAncestors(s)),R(a)&&(u=u.concat(t.getOverflowAncestors(a))),!R(l)&&l&&l.contextElement&&(u=u.concat(t.getOverflowAncestors(l.contextElement)))),u=u.filter((e=>{var t;return e!==(null==(t=n.defaultView)?void 0:t.visualViewport)})),u.forEach((t=>{t.addEventListener("scroll",e,{passive:!0})})),()=>{m&&n.removeEventListener("keydown",N),S&&n.removeEventListener(v,F),u.forEach((t=>{t.removeEventListener("scroll",e)}))}}),[f,a,s,l,m,S,v,r,o,k,d,L,D,N,F]),u.useEffect((()=>{A.current=!1}),[S,v]),u.useMemo((()=>d?{reference:{onKeyDown:N,[Ae[w]]:()=>{b&&(i.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),o(!1))}},floating:{onKeyDown:N,[Le[v]]:()=>{A.current=!0}}}:{}),[d,i,b,v,w,o,N])},e.useFloating=function(e){void 0===e&&(e={});const{open:n=!1,onOpenChange:r,nodeId:o}=e,i=t.useFloating(e),l=h(),s=u.useRef(null),a=u.useRef({}),d=u.useState((()=>m()))[0],p=f(),[v,g]=u.useState(null),y=u.useCallback((e=>{const t=R(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;i.refs.setReference(t)}),[i.refs]),b=u.useCallback((e=>{(R(e)||null===e)&&(s.current=e,g(e)),(R(i.refs.reference.current)||null===i.refs.reference.current||null!==e&&!R(e))&&i.refs.setReference(e)}),[i.refs]),w=u.useMemo((()=>({...i.refs,setReference:b,setPositionReference:y,domReference:s})),[i.refs,b,y]),E=u.useMemo((()=>({...i.elements,domReference:v})),[i.elements,v]),x=Te(r),I=u.useMemo((()=>({...i,refs:w,elements:E,dataRef:a,nodeId:o,floatingId:p,events:d,open:n,onOpenChange:x})),[i,o,p,d,n,x,w,E]);return c((()=>{const e=null==l?void 0:l.nodesRef.current.find((e=>e.id===o));e&&(e.context=I)})),u.useMemo((()=>({...i,context:I,refs:w,elements:E,reference:b,positionReference:y})),[i,w,E,I,b,y])},e.useFloatingNodeId=e=>{const t=f(),n=h(),r=g(),o=e||r;return c((()=>{const e={id:t,parentId:o};return null==n||n.addNode(e),()=>{null==n||n.removeNode(e)}}),[n,t,o]),t},e.useFloatingParentNodeId=g,e.useFloatingPortalNode=be,e.useFloatingTree=h,e.useFocus=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,refs:c,elements:{floating:l,domReference:s}}=e,{enabled:a=!0,keyboardOnly:f=!0}=t,d=u.useRef(""),m=u.useRef(!1),p=u.useRef();return u.useEffect((()=>{if(!a)return;const e=y(l).defaultView||window;function t(){!n&&x(s)&&s===te(y(s))&&(m.current=!0)}return e.addEventListener("blur",t),()=>{e.removeEventListener("blur",t)}}),[l,s,n,a]),u.useEffect((()=>{if(a)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(e){"referencePress"!==e.type&&"escapeKey"!==e.type||(m.current=!0)}}),[i,a]),u.useEffect((()=>()=>{clearTimeout(p.current)}),[]),u.useMemo((()=>a?{reference:{onPointerDown(e){let{pointerType:t}=e;d.current=t,m.current=!(!t||!f)},onMouseLeave(){m.current=!1},onFocus(e){var t;m.current||"focus"===e.type&&"mousedown"===(null==(t=o.current.openEvent)?void 0:t.type)&&o.current.openEvent&&Se(o.current.openEvent,s)||(o.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){m.current=!1;const t=e.relatedTarget,n=R(t)&&t.hasAttribute("data-floating-ui-focus-guard")&&"outside"===t.getAttribute("data-type");p.current=setTimeout((()=>{M(c.floating.current,t)||M(s,t)||n||r(!1)}))}}}:{}),[a,f,s,c,o,r])},e.useHover=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:{domReference:l,floating:s},refs:a}=e,{enabled:f=!0,delay:d=0,handleClose:m=null,mouseOnly:p=!1,restMs:v=0,move:b=!0}=t,w=h(),E=g(),x=T(m),I=T(d),O=u.useRef(),k=u.useRef(),A=u.useRef(),L=u.useRef(),D=u.useRef(!0),N=u.useRef(!1),F=u.useRef((()=>{})),j=u.useCallback((()=>{var e;const t=null==(e=o.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[o]);u.useEffect((()=>{if(f)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(){clearTimeout(k.current),clearTimeout(L.current),D.current=!0}}),[f,i]),u.useEffect((()=>{if(!f||!x.current||!n)return;function e(){j()&&r(!1)}const t=y(s).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[s,n,r,f,x,o,j]);const K=u.useCallback((function(e){void 0===e&&(e=!0);const t=S(I.current,"close",O.current);t&&!A.current?(clearTimeout(k.current),k.current=setTimeout((()=>r(!1)),t)):e&&(clearTimeout(k.current),r(!1))}),[I,r]),_=u.useCallback((()=>{F.current(),A.current=void 0}),[]),B=u.useCallback((()=>{if(N.current){const e=y(a.floating.current).body;e.style.pointerEvents="",e.removeAttribute(P),N.current=!1}}),[a]);return u.useEffect((()=>{if(f&&R(l)){const e=l;return n&&e.addEventListener("mouseleave",c),null==s||s.addEventListener("mouseleave",c),b&&e.addEventListener("mousemove",u,{once:!0}),e.addEventListener("mouseenter",u),e.addEventListener("mouseleave",i),()=>{n&&e.removeEventListener("mouseleave",c),null==s||s.removeEventListener("mouseleave",c),b&&e.removeEventListener("mousemove",u),e.removeEventListener("mouseenter",u),e.removeEventListener("mouseleave",i)}}function t(){return!!o.current.openEvent&&["click","mousedown"].includes(o.current.openEvent.type)}function u(e){if(clearTimeout(k.current),D.current=!1,p&&!C(O.current)||v>0&&0===S(I.current,"open"))return;o.current.openEvent=e;const t=S(I.current,"open",O.current);t?k.current=setTimeout((()=>{r(!0)}),t):r(!0)}function i(r){if(t())return;F.current();const o=y(s);if(clearTimeout(L.current),x.current){n||clearTimeout(k.current),A.current=x.current({...e,tree:w,x:r.clientX,y:r.clientY,onClose(){B(),_(),K()}});const t=A.current;return o.addEventListener("mousemove",t),void(F.current=()=>{o.removeEventListener("mousemove",t)})}("touch"!==O.current||!M(s,r.relatedTarget))&&K()}function c(n){t()||null==x.current||x.current({...e,tree:w,x:n.clientX,y:n.clientY,onClose(){B(),_(),K()}})(n)}}),[l,s,f,e,p,v,b,K,_,B,r,n,w,I,x,o]),c((()=>{var e;if(f&&n&&null!=(e=x.current)&&e.__options.blockPointerEvents&&j()){const e=y(s).body;if(e.setAttribute(P,""),e.style.pointerEvents="none",N.current=!0,R(l)&&s){var t,r;const e=l,n=null==w||null==(t=w.nodesRef.current.find((e=>e.id===E)))||null==(r=t.context)?void 0:r.elements.floating;return n&&(n.style.pointerEvents=""),e.style.pointerEvents="auto",s.style.pointerEvents="auto",()=>{e.style.pointerEvents="",s.style.pointerEvents=""}}}}),[f,n,E,s,l,w,x,o,j]),c((()=>{n||(O.current=void 0,_(),B())}),[n,_,B]),u.useEffect((()=>()=>{_(),clearTimeout(k.current),clearTimeout(L.current),B()}),[f,_,B]),u.useMemo((()=>{if(!f)return{};function e(e){O.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){n||0===v||(clearTimeout(L.current),L.current=setTimeout((()=>{D.current||r(!0)}),v))}},floating:{onMouseEnter(){clearTimeout(k.current)},onMouseLeave(){i.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),K(!1)}}}}),[i,f,v,n,r,K])},e.useId=f,e.useInnerOffset=(e,t)=>{let{open:n,elements:o}=e,{enabled:i=!0,overflowRef:c,scrollRef:l,onChange:s}=t;const a=Te(s),f=u.useRef(!1),d=u.useRef(null),m=u.useRef(null);return u.useEffect((()=>{if(!i)return;function e(e){if(e.ctrlKey||!t||null==c.current)return;const n=e.deltaY,o=c.current.top>=-.5,u=c.current.bottom>=-.5,i=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((e=>e+Math[s](n,i*l)))}))):/firefox/i.test(w())&&(t.scrollTop+=n))}const t=(null==l?void 0:l.current)||o.floating;return n&&t?(t.addEventListener("wheel",e),requestAnimationFrame((()=>{d.current=t.scrollTop,null!=c.current&&(m.current={...c.current})})),()=>{d.current=null,m.current=null,t.removeEventListener("wheel",e)}):void 0}),[i,n,o.floating,c,l,a]),u.useMemo((()=>i?{floating:{onKeyDown(){f.current=!0},onWheel(){f.current=!1},onPointerMove(){f.current=!1},onScroll(){const e=(null==l?void 0:l.current)||o.floating;if(c.current&&e&&f.current){if(null!==d.current){const t=e.scrollTop-d.current;(c.current.bottom<-.5&&t<-1||c.current.top<-.5&&t>1)&&r.flushSync((()=>a((e=>e+t))))}requestAnimationFrame((()=>{d.current=e.scrollTop}))}}}}:{}),[i,c,o.floating,l,a])},e.useInteractions=function(e){void 0===e&&(e=[]);const t=e,n=u.useCallback((t=>$e(t,e,"reference")),t),r=u.useCallback((t=>$e(t,e,"floating")),t),o=u.useCallback((t=>$e(t,e,"item")),e.map((e=>null==e?void 0:e.item)));return u.useMemo((()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o})),[n,r,o])},e.useListItem=function(e){let{label:t}=void 0===e?{}:e;const[n,r]=u.useState(null),o=u.useRef(null),{register:i,unregister:l,map:s,elementsRef:a,labelsRef:f}=u.useContext(xe),d=u.useCallback((e=>{if(o.current=e,null!==n&&(a.current[n]=e,f)){var r;const o=void 0!==t;f.current[n]=o?t:null!=(r=null==e?void 0:e.textContent)?r:null}}),[n,a,f,t]);return c((()=>{const e=o.current;if(e)return i(e),()=>{l(e)}}),[i,l]),c((()=>{const e=o.current?s.get(o.current):null;null!=e&&r(e)}),[s]),u.useMemo((()=>({ref:d,index:null==n?-1:n})),[n,d])},e.useListNavigation=(e,t)=>{const{open:n,onOpenChange:r,refs:o,elements:{domReference:i,floating:l}}=e,{listRef:s,activeIndex:a,onNavigate:f=(()=>{}),enabled:d=!0,selectedIndex:m=null,allowEscape:p=!1,loop:v=!1,nested:w=!1,rtl:E=!1,virtual:R=!1,focusItemOnOpen:C="auto",focusItemOnHover:P=!0,openOnArrowKeyDown:S=!0,disabledIndices:A,orientation:L="vertical",cols:D=1,scrollItemIntoView:N=!0}=t,F=g(),j=h(),K=Te(f),_=u.useRef(C),B=u.useRef(null!=m?m:-1),H=u.useRef(null),q=u.useRef(!0),W=u.useRef(K),U=u.useRef(!!l),z=u.useRef(!1),V=u.useRef(!1),X=T(A),Y=T(n),G=T(N),[Z,$]=u.useState(),Q=Te((function(e,t,n){void 0===n&&(n=!1);const r=e.current[t.current];r&&(R?$(r.id):re(r,{preventScroll:!0,sync:!(!b().toLowerCase().startsWith("mac")||navigator.maxTouchPoints||!k())&&(De||z.current)}),requestAnimationFrame((()=>{const e=G.current;e&&r&&(n||!q.current)&&(null==r.scrollIntoView||r.scrollIntoView("boolean"==typeof e?{block:"nearest",inline:"nearest"}:e))})))}));c((()=>{document.createElement("div").focus({get preventScroll(){return De=!0,!1}})}),[]),c((()=>{d&&(n&&l?_.current&&null!=m&&(V.current=!0,K(m)):U.current&&(B.current=-1,W.current(null)))}),[d,n,l,m,K]),c((()=>{if(d&&n&&l)if(null==a){if(z.current=!1,null!=m)return;if(U.current&&(B.current=-1,Q(s,B)),!U.current&&_.current&&(null!=H.current||!0===_.current&&null==H.current)){let e=0;const t=()=>{if(null==s.current[0]){if(e<2){(e?requestAnimationFrame:queueMicrotask)(t)}e++}else B.current=null==H.current||Ue(H.current,L,E)||w?ze(s,X.current):Ve(s,X.current),H.current=null,K(B.current)};t()}}else Be(s,a)||(B.current=a,Q(s,B,V.current),V.current=!1)}),[d,n,l,a,m,w,s,L,E,K,Q,X]),c((()=>{if(d&&U.current&&!l&&j){var e,t;const n=j.nodesRef.current,r=null==(e=n.find((e=>e.id===F)))||null==(t=e.context)?void 0:t.elements.floating,o=te(y(l)),u=n.some((e=>e.context&&M(e.context.elements.floating,o)));r&&!u&&r.focus({preventScroll:!0})}}),[d,l,j,F]),c((()=>{W.current=K,U.current=!!l})),c((()=>{n||(H.current=null)}),[n]);const J=null!=a,ee=u.useMemo((()=>{function e(e){if(!n)return;const t=s.current.indexOf(e);-1!==t&&K(t)}return{onFocus(t){let{currentTarget:n}=t;e(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...P&&{onMouseMove(t){let{currentTarget:n}=t;e(n)},onPointerLeave(e){let{pointerType:t}=e;q.current&&"touch"!==t&&(B.current=-1,Q(s,B),K(null),R||re(o.floating.current,{preventScroll:!0}))}}}}),[n,o,Q,P,s,K,R]);return u.useMemo((()=>{if(!d)return{};const e=X.current;function t(t){if(q.current=!1,z.current=!0,!Y.current&&t.currentTarget===o.floating.current)return;if(w&&function(e,t,n){return qe(t,n?e===Ke:e===je,e===Ne)}(t.key,L,E))return ce(t),r(!1),void(x(i)&&i.focus());const u=B.current,c=ze(s,e),l=Ve(s,e);if("Home"===t.key&&(ce(t),B.current=c,K(B.current)),"End"===t.key&&(ce(t),B.current=l,K(B.current)),D>1){const n=B.current;if(t.key===Ne){if(ce(t),-1===n)B.current=l;else if(B.current=He(s,{startingIndex:n,amount:D,decrement:!0,disabledIndices:e}),v&&(n-D<c||B.current<0)){const e=n%D,t=l%D,r=l-(t-e);B.current=t===e?l:t>e?r:r-D}Be(s,B.current)&&(B.current=n),K(B.current)}if(t.key===Fe&&(ce(t),-1===n?B.current=c:(B.current=He(s,{startingIndex:n,amount:D,disabledIndices:e}),v&&n+D>l&&(B.current=He(s,{startingIndex:n%D-D,amount:D,disabledIndices:e}))),Be(s,B.current)&&(B.current=n),K(B.current)),"both"===L){const r=Math.floor(n/D);t.key===Ke&&(ce(t),n%D!=D-1?(B.current=He(s,{startingIndex:n,disabledIndices:e}),v&&_e(B.current,D,r)&&(B.current=He(s,{startingIndex:n-n%D-1,disabledIndices:e}))):v&&(B.current=He(s,{startingIndex:n-n%D-1,disabledIndices:e})),_e(B.current,D,r)&&(B.current=n)),t.key===je&&(ce(t),n%D!=0?(B.current=He(s,{startingIndex:n,disabledIndices:e,decrement:!0}),v&&_e(B.current,D,r)&&(B.current=He(s,{startingIndex:n+(D-n%D),decrement:!0,disabledIndices:e}))):v&&(B.current=He(s,{startingIndex:n+(D-n%D),decrement:!0,disabledIndices:e})),_e(B.current,D,r)&&(B.current=n));const o=Math.floor(l/D)===r;return Be(s,B.current)&&(B.current=v&&o?t.key===je?l:He(s,{startingIndex:n-n%D-1,disabledIndices:e}):n),void K(B.current)}}if(We(t.key,L)){if(ce(t),n&&!R&&te(t.currentTarget.ownerDocument)===t.currentTarget)return B.current=Ue(t.key,L,E)?c:l,void K(B.current);Ue(t.key,L,E)?B.current=v?u>=l?p&&u!==s.current.length?-1:c:He(s,{startingIndex:u,disabledIndices:e}):Math.min(l,He(s,{startingIndex:u,disabledIndices:e})):B.current=v?u<=c?p&&-1!==u?s.current.length:l:He(s,{startingIndex:u,decrement:!0,disabledIndices:e}):Math.max(c,He(s,{startingIndex:u,decrement:!0,disabledIndices:e})),Be(s,B.current)?K(null):K(B.current)}}function u(e){"auto"===C&&I(e.nativeEvent)&&(_.current=!0)}const c=R&&n&&J&&{"aria-activedescendant":Z};return{reference:{...c,onKeyDown(o){q.current=!1;const u=0===o.key.indexOf("Arrow");if(R&&n)return t(o);if(!n&&!S&&u)return;const i=u||"Enter"===o.key||""===o.key.trim(),c=We(o.key,L),l=function(e,t,n){return qe(t,n?e===je:e===Ke,e===Fe)}(o.key,L,E);i&&(H.current=w&&c?null:o.key),w?l&&(ce(o),n?(B.current=ze(s,e),K(B.current)):r(!0)):c&&(null!=m&&(B.current=m),ce(o),!n&&S?r(!0):t(o),n&&K(B.current))},onFocus(){n&&K(null)},onPointerDown:function(e){_.current=C,"auto"===C&&O(e.nativeEvent)&&(_.current=!0)},onMouseDown:u,onClick:u},floating:{"aria-orientation":"both"===L?void 0:L,...c,onKeyDown:t,onPointerMove(){q.current=!0}},item:ee}}),[i,o,Z,X,Y,s,d,L,E,R,n,J,w,m,S,p,D,v,C,K,r,ee])},e.useMergeRefs=function(e){return u.useMemo((()=>e.every((e=>null==e))?null:t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}),e)},e.useRole=function(e,t){void 0===t&&(t={});const{open:n,floatingId:r}=e,{enabled:o=!0,role:i="dialog"}=t,c=f();return u.useMemo((()=>{const e={id:r,role:i};return o?"tooltip"===i?{reference:{"aria-describedby":n?r:void 0},floating:e}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===i?"dialog":i,"aria-controls":n?r:void 0,..."listbox"===i&&{role:"combobox"},..."menu"===i&&{id:c}},floating:{...e,..."menu"===i&&{"aria-labelledby":c}}}:{}}),[o,i,n,r,c])},e.useTransitionStatus=Ge,e.useTransitionStyles=function(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:l=250}=t,s=e.placement,a=s.split("-")[0],f=u.useMemo((()=>({side:a,placement:s})),[a,s]),d="number"==typeof l,m=(d?l:l.open)||0,p=(d?l:l.close)||0,[v,g]=u.useState((()=>({...Ye(i,f),...Ye(n,f)}))),{isMounted:h,status:y}=Ge(e,{duration:l}),b=T(n),w=T(r),E=T(o),R=T(i);return c((()=>{const e=Ye(b.current,f),t=Ye(E.current,f),n=Ye(R.current,f),r=Ye(w.current,f)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===y&&g((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===y&&g({transitionProperty:Object.keys(r).map(Xe).join(","),transitionDuration:m+"ms",...n,...r}),"close"===y){const r=t||e;g({transitionProperty:Object.keys(r).map(Xe).join(","),transitionDuration:p+"ms",...n,...r})}}),[p,E,b,w,R,m,y,f]),{isMounted:h,styles:v}},e.useTypeahead=(e,t)=>{var n;const{open:r,dataRef:o}=e,{listRef:i,activeIndex:l,onMatch:s,onTypingChange:a,enabled:f=!0,findMatch:d=null,resetMs:m=750,ignoreKeys:p=[],selectedIndex:v=null}=t,g=u.useRef(),h=u.useRef(""),y=u.useRef(null!=(n=null!=v?v:l)?n:-1),b=u.useRef(null),w=Te(s),E=Te(a),R=T(d),x=T(p);return c((()=>{r&&(clearTimeout(g.current),b.current=null,h.current="")}),[r]),c((()=>{var e;r&&""===h.current&&(y.current=null!=(e=null!=v?v:l)?e:-1)}),[r,v,l]),u.useMemo((()=>{if(!f)return{};function e(e){e?o.current.typing||(o.current.typing=e,E(e)):o.current.typing&&(o.current.typing=e,E(e))}function t(e,t,n){const r=R.current?R.current(t,n):t.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(n.toLocaleLowerCase()))));return r?e.indexOf(r):-1}function n(n){const o=i.current;if(h.current.length>0&&" "!==h.current[0]&&(-1===t(o,o,h.current)?e(!1):" "===n.key&&ce(n)),null==o||x.current.includes(n.key)||1!==n.key.length||n.ctrlKey||n.metaKey||n.altKey)return;r&&" "!==n.key&&(ce(n),e(!0));o.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&h.current===n.key&&(h.current="",y.current=b.current),h.current+=n.key,clearTimeout(g.current),g.current=setTimeout((()=>{h.current="",y.current=b.current,e(!1)}),m);const u=y.current,c=t(o,[...o.slice((u||0)+1),...o.slice(0,(u||0)+1)],h.current);-1!==c?(w(c),b.current=c):(h.current="",e(!1))}return{reference:{onKeyDown:n},floating:{onKeyDown:n}}}),[f,r,o,i,m,x,R,w,E])},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);function i(){return i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i.apply(this,arguments)}var c="undefined"!=typeof document?n.useLayoutEffect:n.useEffect;let l=!1,s=0;const a=()=>"floating-ui-"+s++;const f=u["useId".toString()]||function(){const[e,t]=u.useState((()=>l?a():void 0));return c((()=>{null==e&&t(a())}),[]),u.useEffect((()=>{l||(l=!0)}),[]),e},d=u.forwardRef((function(e,n){var r;let{context:{placement:o,elements:{floating:c},middlewareData:{arrow:l}},width:s=14,height:a=7,tipRadius:d=0,strokeWidth:m=0,staticOffset:p,stroke:v,d:g,...h}=e;m*=2;const y=m/2,b=s/2*(d/-8+1),w=a/2*d/4,[E,R]=o.split("-"),x=!!c&&t.platform.isRTL(c),I=!!g,O="top"===E||"bottom"===E,k=p&&"end"===R?"bottom":"top";let C=p&&"end"===R?"right":"left";p&&x&&(C="end"===R?"left":"right");const M=I?0:y,T=null!=(null==l?void 0:l.x)?p||l.x:"",P=null!=(null==l?void 0:l.y)?p||l.y+M:"",S=g||"M0,0 H"+s+" L"+(s-b)+","+(a-w)+" Q"+s/2+","+a+" "+b+","+(a-w)+" Z",A={top:I?"rotate(180deg)":"",left:I?"rotate(90deg)":"rotate(-90deg)",bottom:I?"":"rotate(180deg)",right:I?"rotate(-90deg)":"rotate(90deg)"}[E],L=f();return u.createElement("svg",i({},h,{suppressHydrationWarning:!0,"aria-hidden":!0,ref:n,width:I?s:s+m,height:s,viewBox:"0 0 "+s+" "+(a>s?a:s),style:{...h.style,position:"absolute",pointerEvents:"none",[C]:T,[k]:P,[E]:O||I?"100%":"calc(100% - "+m/2+"px)",transform:A+(null!=(r=h.style)&&r.transform?" "+h.style.transform:"")}}),m>0&&u.createElement("path",{clipPath:"url(#"+L+")",fill:"none",stroke:v,strokeWidth:m+(g?0:1),d:S}),u.createElement("path",{stroke:m&&!g?h.fill:"none",d:S}),u.createElement("clipPath",{id:L},u.createElement("rect",{x:-y,y:y*(I?-1:1),width:s+m,height:s})))}));function m(){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){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}const p=u.createContext(null),v=u.createContext(null),g=()=>{var e;return(null==(e=u.useContext(p))?void 0:e.id)||null},h=()=>u.useContext(v);function y(e){return(null==e?void 0:e.ownerDocument)||document}function b(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function w(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function E(e){return y(e).defaultView||window}function R(e){return!!e&&e instanceof E(e).Element}function x(e){return!!e&&e instanceof E(e).HTMLElement}function I(e){if(0===e.mozInputSource&&e.isTrusted)return!0;const t=/Android/i;return(t.test(b())||t.test(w()))&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType}function O(e){return 0===e.width&&0===e.height||1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"!==e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail}function k(){return/apple/i.test(navigator.vendor)}function C(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function M(e,t){if(!e||!t)return!1;const n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&(r=n,"undefined"!=typeof ShadowRoot&&(r instanceof E(r).ShadowRoot||r instanceof ShadowRoot))){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}var r;return!1}function T(e){const t=n.useRef(e);return c((()=>{t.current=e})),t}const P="data-floating-ui-safe-polygon";function S(e,t,n){return n&&!C(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}const A=u.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),L=()=>u.useContext(A);var D=new WeakMap,N=new WeakMap,F={},j=0,K=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];F[n]||(F[n]=new WeakMap);var o=F[n],u=[],i=new Set,c=function(e){e&&!i.has(e)&&(i.add(e),c(e.parentNode))};r.forEach(c);var l=function(e){!e||r.indexOf(e)>=0||Array.prototype.forEach.call(e.children,(function(e){if(i.has(e))l(e);else{var t=e.getAttribute("aria-hidden"),r=null!==t&&"false"!==t,c=(D.get(e)||0)+1,s=(o.get(e)||0)+1;D.set(e,c),o.set(e,s),u.push(e),1===c&&r&&N.set(e,!0),1===s&&e.setAttribute(n,"true"),r||e.setAttribute("aria-hidden","true")}}))};return l(t),i.clear(),j++,function(){u.forEach((function(e){var t=D.get(e)-1,r=o.get(e)-1;D.set(e,t),o.set(e,r),t||(N.has(e)||e.removeAttribute("aria-hidden"),N.delete(e)),r||e.removeAttribute(n)})),--j||(D=new WeakMap,D=new WeakMap,N=new WeakMap,F={})}},_=["input","select","textarea","a[href]","button","[tabindex]:not(slot)","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details"].join(","),B="undefined"==typeof Element,H=B?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,q=!B&&Element.prototype.getRootNode?function(e){return e.getRootNode()}:function(e){return e.ownerDocument},W=function e(t,n,r){for(var o=[],u=Array.from(t);u.length;){var i=u.shift();if("SLOT"===i.tagName){var c=i.assignedElements(),l=e(c.length?c:i.children,!0,r);r.flatten?o.push.apply(o,l):o.push({scopeParent:i,candidates:l})}else{H.call(i,_)&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var s=i.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(i),a=!r.shadowRootFilter||r.shadowRootFilter(i);if(s&&a){var f=e(!0===s?i.children:s.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:i,candidates:f})}else u.unshift.apply(u,i.children)}}return o},U=function(e,t){return e.tabIndex<0&&(t||/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||e.isContentEditable)&&isNaN(parseInt(e.getAttribute("tabindex"),10))?0:e.tabIndex},z=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},V=function(e){return"INPUT"===e.tagName},X=function(e){return function(e){return V(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||q(e),r=function(e){return n.querySelectorAll('input[type="radio"][name="'+e+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)t=r(window.CSS.escape(e.name));else try{t=r(e.name)}catch(e){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",e.message),!1}var o=function(e,t){for(var n=0;n<e.length;n++)if(e[n].checked&&e[n].form===t)return e[n]}(t,e.form);return!o||o===e}(e)},Y=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},G=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=H.call(e,"details>summary:first-of-type")?e.parentElement:e;if(H.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Y(e)}else{if("function"==typeof r){for(var u=e;e;){var i=e.parentElement,c=q(e);if(i&&!i.shadowRoot&&!0===r(i))return Y(e);e=e.assignedSlot?e.assignedSlot:i||c===e.ownerDocument?i:c.host}e=u}if(function(e){for(var t,n=q(e).host,r=!!(null!==(t=n)&&void 0!==t&&t.ownerDocument.contains(n)||e.ownerDocument.contains(e));!r&&n;){var o;r=!(null===(o=n=q(n).host)||void 0===o||!o.ownerDocument.contains(n))}return r}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Z=function(e,t){return!(t.disabled||function(e){return V(e)&&"hidden"===e.type}(t)||G(t,e)||function(e){return"DETAILS"===e.tagName&&Array.prototype.slice.apply(e.children).some((function(e){return"SUMMARY"===e.tagName}))}(t)||function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if("FIELDSET"===t.tagName&&t.disabled){for(var n=0;n<t.children.length;n++){var r=t.children.item(n);if("LEGEND"===r.tagName)return!!H.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},$=function(e,t){return!(X(t)||U(t)<0||!Z(e,t))},Q=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},J=function e(t){var n=[],r=[];return t.forEach((function(t,o){var u=!!t.scopeParent,i=u?t.scopeParent:t,c=U(i,u),l=u?e(t.candidates):i;0===c?u?n.push.apply(n,l):n.push(i):r.push({documentOrder:o,tabIndex:c,item:t,isScope:u,content:l})})),r.sort(z).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},ee=function(e,t){var n;return n=(t=t||{}).getShadowRoot?W([e],t.includeContainer,{filter:$.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Q}):function(e,t,n){var r=Array.prototype.slice.apply(e.querySelectorAll(_));return t&&H.call(e,_)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,$.bind(null,t)),J(n)};function te(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}let ne=0;function re(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(ne);const u=()=>null==e?void 0:e.focus({preventScroll:n});o?u():ne=requestAnimationFrame(u)}function oe(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}function ue(e){return"composedPath"in e?e.composedPath()[0]:e.target}function ie(e){return x(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function ce(e){e.preventDefault(),e.stopPropagation()}const le=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function se(e,t){const n=ee(e,le());"prev"===t&&n.reverse();const r=n.indexOf(te(y(e)));return n.slice(r+1)[0]}function ae(){return se(document.body,"next")}function fe(){return se(document.body,"prev")}function de(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!M(n,r)}function me(e){ee(e,le()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function pe(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const ve={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function ge(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const he=u.forwardRef((function(e,t){const[n,r]=u.useState();return c((()=>(k()&&r("button"),document.addEventListener("keydown",ge),()=>{document.removeEventListener("keydown",ge)})),[]),u.createElement("span",i({},e,{ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,"data-floating-ui-focus-guard":"",style:ve}))})),ye=u.createContext(null),be=function(e){let{id:t,root:n}=void 0===e?{}:e;const[r,o]=u.useState(null),i=f(),l=we(),s=u.useMemo((()=>({id:t,root:n,portalContext:l,uniqueId:i})),[t,n,l,i]),a=u.useRef();return c((()=>()=>{null==r||r.remove()}),[r,s]),c((()=>{if(a.current===s)return;a.current=s;const{id:e,root:t,portalContext:n,uniqueId:r}=s,u=e?document.getElementById(e):null,i="data-floating-ui-portal";if(u){const e=document.createElement("div");e.id=r,e.setAttribute(i,""),u.appendChild(e),o(e)}else{let u=(null==n?void 0:n.portalNode)||t||document.body,c=null;e&&(c=document.createElement("div"),c.id=e,u.appendChild(c));const l=document.createElement("div");l.id=r,l.setAttribute(i,""),u=c||u,u.appendChild(l),o(l)}}),[s]),r},we=()=>u.useContext(ye),Ee=u.forwardRef((function(e,t){return u.createElement("button",i({},e,{type:"button",ref:t,tabIndex:-1,style:ve}))}));function Re(e,t){const n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}const xe=u.createContext({register:()=>{},unregister:()=>{},map:new Map,elementsRef:{current:[]}});const Ie="data-floating-ui-scroll-lock",Oe=u.forwardRef((function(e,t){let{lockScroll:n=!1,...r}=e;return c((()=>{var e,t;if(!n)return;if(document.body.hasAttribute(Ie))return;document.body.setAttribute(Ie,"");const r=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",o=window.innerWidth-document.documentElement.clientWidth;if(!/iP(hone|ad|od)|iOS/.test(b()))return Object.assign(document.body.style,{overflow:"hidden",[r]:o+"px"}),()=>{document.body.removeAttribute(Ie),Object.assign(document.body.style,{overflow:"",[r]:""})};const u=(null==(e=window.visualViewport)?void 0:e.offsetLeft)||0,i=(null==(t=window.visualViewport)?void 0:t.offsetTop)||0,c=window.pageXOffset,l=window.pageYOffset;return Object.assign(document.body.style,{position:"fixed",overflow:"hidden",top:-(l-Math.floor(i))+"px",left:-(c-Math.floor(u))+"px",right:"0",[r]:o+"px"}),()=>{Object.assign(document.body.style,{position:"",overflow:"",top:"",left:"",right:"",[r]:""}),document.body.removeAttribute(Ie),window.scrollTo(c,l)}}),[n]),u.createElement("div",i({ref:t},r,{style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}}))}));function ke(e){return x(e.target)&&"BUTTON"===e.target.tagName}function Ce(e){return ie(e)}const Me=u["useInsertionEffect".toString()]||(e=>e());function Te(e){const t=u.useRef((()=>{}));return Me((()=>{t.current=e})),u.useCallback((function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)}),[])}function Pe(e){return null!=e&&null!=e.clientX}function Se(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 Ae={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Le={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"};let De=!1;const Ne="ArrowUp",Fe="ArrowDown",je="ArrowLeft",Ke="ArrowRight";function _e(e,t,n){return Math.floor(e/t)!==n}function Be(e,t){return t<0||t>=e.current.length}function He(e,t){let{startingIndex:n=-1,decrement:r=!1,disabledIndices:o,amount:u=1}=void 0===t?{}:t;const i=e.current;let c=n;do{var l,s;c+=r?-u:u}while(c>=0&&c<=i.length-1&&(o?o.includes(c):null==i[c]||(null==(l=i[c])?void 0:l.hasAttribute("disabled"))||"true"===(null==(s=i[c])?void 0:s.getAttribute("aria-disabled"))));return c}function qe(e,t,n){switch(e){case"vertical":return t;case"horizontal":return n;default:return t||n}}function We(e,t){return qe(t,e===Ne||e===Fe,e===je||e===Ke)}function Ue(e,t,n){return qe(t,e===Fe,n?e===je:e===Ke)||"Enter"===e||" "==e||""===e}function ze(e,t){return He(e,{disabledIndices:t})}function Ve(e,t){return He(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}const Xe=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,((e,t)=>(t?"-":"")+e.toLowerCase()));function Ye(e,t){return"function"==typeof e?e(t):e}function Ge(e,t){void 0===t&&(t={});const{open:n,elements:{floating:r}}=e,{duration:o=250}=t,i=("number"==typeof o?o:o.close)||0,[l,s]=u.useState(!1),[a,f]=u.useState("unmounted"),d=function(e,t){const[n,r]=u.useState(e);return e&&!n&&r(!0),u.useEffect((()=>{if(!e){const e=setTimeout((()=>r(!1)),t);return()=>clearTimeout(e)}}),[e,t]),n}(n,i);return c((()=>{l&&!d&&f("unmounted")}),[l,d]),c((()=>{if(r){if(n){f("initial");const e=requestAnimationFrame((()=>{f("open")}));return()=>{cancelAnimationFrame(e)}}s(!0),f("close")}}),[n,r]),{isMounted:d,status:a}}function Ze(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}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;var u;0===n.indexOf("on")?(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];return null==(e=r.get(n))?void 0:e.map((e=>e(...o))).find((e=>void 0!==e))})):e[n]=o})),e):e),{})}}Object.defineProperty(e,"arrow",{enumerable:!0,get:function(){return t.arrow}}),Object.defineProperty(e,"autoPlacement",{enumerable:!0,get:function(){return t.autoPlacement}}),Object.defineProperty(e,"autoUpdate",{enumerable:!0,get:function(){return t.autoUpdate}}),Object.defineProperty(e,"computePosition",{enumerable:!0,get:function(){return t.computePosition}}),Object.defineProperty(e,"detectOverflow",{enumerable:!0,get:function(){return t.detectOverflow}}),Object.defineProperty(e,"flip",{enumerable:!0,get:function(){return t.flip}}),Object.defineProperty(e,"getOverflowAncestors",{enumerable:!0,get:function(){return t.getOverflowAncestors}}),Object.defineProperty(e,"hide",{enumerable:!0,get:function(){return t.hide}}),Object.defineProperty(e,"inline",{enumerable:!0,get:function(){return t.inline}}),Object.defineProperty(e,"limitShift",{enumerable:!0,get:function(){return t.limitShift}}),Object.defineProperty(e,"offset",{enumerable:!0,get:function(){return t.offset}}),Object.defineProperty(e,"platform",{enumerable:!0,get:function(){return t.platform}}),Object.defineProperty(e,"shift",{enumerable:!0,get:function(){return t.shift}}),Object.defineProperty(e,"size",{enumerable:!0,get:function(){return t.size}}),e.FloatingArrow=d,e.FloatingDelayGroup=e=>{let{children:t,delay:n,timeoutMs:r=0}=e;const[o,i]=u.useReducer(((e,t)=>({...e,...t})),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),l=u.useRef(null),s=u.useCallback((e=>{i({currentId:e})}),[]);return c((()=>{o.currentId?null===l.current?l.current=o.currentId:i({isInstantPhase:!0}):(i({isInstantPhase:!1}),l.current=null)}),[o.currentId]),u.createElement(A.Provider,{value:u.useMemo((()=>({...o,setState:i,setCurrentId:s})),[o,i,s])},t)},e.FloatingFocusManager=function(e){let{context:t,children:n,order:r=["content"],guards:o=!0,initialFocus:i=0,returnFocus:l=!0,modal:s=!0,visuallyHiddenDismiss:a=!1,closeOnFocusOut:f=!0}=e;const{open:d,refs:m,nodeId:p,onOpenChange:v,events:g,dataRef:b,elements:{domReference:w,floating:E}}=t,R=T(r),I=T(i),O=T(l),k=h(),C=we(),[P,S]=u.useState(null),A="number"==typeof i&&i<0,L=u.useRef(null),D=u.useRef(null),N=u.useRef(!1),F=u.useRef(null),j=u.useRef(!1),_=null!=C,B=w&&"combobox"===w.getAttribute("role")&&ie(w),H=u.useCallback((function(e){return void 0===e&&(e=E),e?ee(e,le()):[]}),[E]),q=u.useCallback((e=>{const t=H(e);return R.current.map((e=>w&&"reference"===e?w:E&&"floating"===e?E:t)).filter(Boolean).flat()}),[w,E,R,H]);u.useEffect((()=>{if(!s)return;function e(e){if("Tab"===e.key){0!==H().length||B||ce(e);const t=q(),n=ue(e);"reference"===R.current[0]&&n===w&&(ce(e),e.shiftKey?re(t[t.length-1]):re(t[1])),"floating"===R.current[1]&&n===E&&e.shiftKey&&(ce(e),re(t[0]))}}const t=y(E);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[w,E,s,R,m,B,H,q]),u.useEffect((()=>{if(f)return E&&x(w)?(w.addEventListener("focusout",t),w.addEventListener("pointerdown",e),!s&&E.addEventListener("focusout",t),()=>{w.removeEventListener("focusout",t),w.removeEventListener("pointerdown",e),!s&&E.removeEventListener("focusout",t)}):void 0;function e(){j.current=!0,setTimeout((()=>{j.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const e=!(M(w,t)||M(E,t)||M(t,E)||M(null==C?void 0:C.portalNode,t)||null!=t&&t.hasAttribute("data-floating-ui-focus-guard")||k&&(oe(k.nodesRef.current,p).find((e=>{var n,r;return M(null==(n=e.context)?void 0:n.elements.floating,t)||M(null==(r=e.context)?void 0:r.elements.domReference,t)}))||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}(k.nodesRef.current,p).find((e=>{var n,r;return(null==(n=e.context)?void 0:n.elements.floating)===t||(null==(r=e.context)?void 0:r.elements.domReference)===t}))));t&&e&&!j.current&&t!==F.current&&(N.current=!0,v(!1))}))}}),[w,E,s,p,k,C,v,f]),u.useEffect((()=>{var e;const t=Array.from((null==C||null==(e=C.portalNode)?void 0:e.querySelectorAll("[data-floating-ui-portal]"))||[]);if(E&&s){const e=[E,...t,...[L.current,D.current].filter(Boolean)],n=K(R.current.includes("reference")||B?e.concat(w||[]):e);return()=>{n()}}}),[w,E,s,R,C,B]),u.useEffect((()=>{if(s&&!o&&E){const e=[],t=le(),n=ee(y(E).body,t),r=q(),o=n.filter((e=>!r.includes(e)));return o.forEach(((t,n)=>{e[n]=t.getAttribute("tabindex"),t.setAttribute("tabindex","-1")})),()=>{o.forEach(((t,n)=>{const r=e[n];null==r?t.removeAttribute("tabindex"):t.setAttribute("tabindex",r)}))}}}),[E,s,o,q]),c((()=>{if(!E)return;const e=te(y(E));queueMicrotask((()=>{const t=q(E),n=I.current,r=("number"==typeof n?t[n]:n.current)||E,o=M(E,e);A||o||!d||re(r,{preventScroll:r===E})}))}),[d,E,A,q,I]),c((()=>{if(!E)return;let e=!1;const t=y(E),n=te(t),r=b.current;function o(t){if("escapeKey"===t.type&&m.domReference.current&&(F.current=m.domReference.current),["referencePress","escapeKey"].includes(t.type))return;const n=t.data.returnFocus;"object"==typeof n?(N.current=!1,e=n.preventScroll):N.current=!n}return F.current=n,g.on("dismiss",o),()=>{g.off("dismiss",o);const n=te(t);(M(E,n)||k&&oe(k.nodesRef.current,p).some((e=>{var t;return M(null==(t=e.context)?void 0:t.elements.floating,n)}))||r.openEvent&&["click","mousedown"].includes(r.openEvent.type))&&m.domReference.current&&(F.current=m.domReference.current),O.current&&x(F.current)&&!N.current&&re(F.current,{cancelPrevious:!1,preventScroll:e})}}),[E,O,b,m,g,k,p]),c((()=>{if(C)return C.setFocusManagerState({...t,modal:s,closeOnFocusOut:f,open:d}),()=>{C.setFocusManagerState(null)}}),[C,s,d,f,t]),c((()=>{if(!A&&E&&(e(),"function"==typeof MutationObserver)){const t=new MutationObserver(e);return t.observe(E,{childList:!0,subtree:!0}),()=>{t.disconnect()}}function e(){te(y(E))!==m.domReference.current&&S(H().length)}}),[E,H,A,m]);const W=o&&!B&&(_||s);function U(e){return a&&s?u.createElement(Ee,{ref:"start"===e?L:D,onClick:()=>v(!1)},"string"==typeof a?a:"Dismiss"):null}return u.createElement(u.Fragment,null,W&&u.createElement(he,{"data-type":"inside",ref:null==C?void 0:C.beforeInsideRef,onFocus:e=>{if(s){const e=q();re("reference"===r[0]?e[0]:e[e.length-1])}else if(null!=C&&C.preserveTabOrder&&C.portalNode)if(N.current=!1,de(e,C.portalNode)){const e=ae()||w;null==e||e.focus()}else{var t;null==(t=C.beforeOutsideRef.current)||t.focus()}}}),B?null:U("start"),u.cloneElement(n,0===P||r.includes("floating")?{tabIndex:0}:{}),U("end"),W&&u.createElement(he,{"data-type":"inside",ref:null==C?void 0:C.afterInsideRef,onFocus:e=>{if(s)re(q()[0]);else if(null!=C&&C.preserveTabOrder&&C.portalNode)if(f&&(N.current=!0),de(e,C.portalNode)){const e=fe()||w;null==e||e.focus()}else{var t;null==(t=C.afterOutsideRef.current)||t.focus()}}}))},e.FloatingList=function(e){let{children:t,elementsRef:n,labelsRef:r}=e;const[o,i]=u.useState((()=>new Map)),l=u.useCallback((e=>{i((t=>new Map(t).set(e,null)))}),[]),s=u.useCallback((e=>{i((t=>{const n=new Map(t);return n.delete(e),n}))}),[]);return c((()=>{const e=new Map(o);Array.from(e.keys()).sort(Re).forEach(((t,n)=>{e.set(t,n)})),function(e,t){if(e.size!==t.size)return!1;for(const[n,r]of e.entries())if(r!==t.get(n))return!1;return!0}(o,e)||i(e)}),[o]),u.createElement(xe.Provider,{value:{register:l,unregister:s,map:o,elementsRef:n,labelsRef:r}},t)},e.FloatingNode=e=>{let{children:t,id:n}=e;const r=g();return u.createElement(p.Provider,{value:u.useMemo((()=>({id:n,parentId:r})),[n,r])},t)},e.FloatingOverlay=Oe,e.FloatingPortal=e=>{let{children:t,id:n,root:o=null,preserveTabOrder:i=!0}=e;const c=be({id:n,root:o}),[l,s]=u.useState(null),a=u.useRef(null),f=u.useRef(null),d=u.useRef(null),m=u.useRef(null),p=!!l&&!l.modal&&l.open&&i&&!(!o&&!c);return u.useEffect((()=>{if(c&&i&&(null==l||!l.modal))return c.addEventListener("focusin",e,!0),c.addEventListener("focusout",e,!0),()=>{c.removeEventListener("focusin",e,!0),c.removeEventListener("focusout",e,!0)};function e(e){if(c&&de(e)){("focusin"===e.type?pe:me)(c)}}}),[c,i,null==l?void 0:l.modal]),u.createElement(ye.Provider,{value:u.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:a,afterOutsideRef:f,beforeInsideRef:d,afterInsideRef:m,portalNode:c,setFocusManagerState:s})),[i,c])},p&&c&&u.createElement(he,{"data-type":"outside",ref:a,onFocus:e=>{if(de(e,c)){var t;null==(t=d.current)||t.focus()}else{const e=fe()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus()}}}),p&&c&&u.createElement("span",{"aria-owns":c.id,style:ve}),c&&r.createPortal(t,c),p&&c&&u.createElement(he,{"data-type":"outside",ref:f,onFocus:e=>{if(de(e,c)){var t;null==(t=m.current)||t.focus()}else{const e=ae()||(null==l?void 0:l.refs.domReference.current);null==e||e.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1))}}}))},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))}),[]),i=u.useState((()=>m()))[0];return u.createElement(v.Provider,{value:u.useMemo((()=>({nodesRef:n,addNode:r,removeNode:o,events:i})),[n,r,o,i])},t)},e.inner=e=>({name:"inner",options:e,async fn(n){const{listRef:o,overflowRef:u,onFallbackChange:i,offset:c=0,index:l=0,minItemsVisible:s=4,referenceOverflowThreshold:a=0,scrollRef:f,...d}=e,{rects:m,elements:{floating:p}}=n,v=o.current[l];if(!v)return{};const g={...n,...await t.offset(-v.offsetTop-m.reference.height/2-v.offsetHeight/2-c).fn(n)},h=(null==f?void 0:f.current)||p,y=await t.detectOverflow(Ze(g,h.scrollHeight),d),b=await t.detectOverflow(g,{...d,elementContext:"reference"}),w=Math.max(0,y.top),E=g.y+w,R=Math.max(0,h.scrollHeight-w-Math.max(0,y.bottom));return h.style.maxHeight=R+"px",h.scrollTop=w,i&&(h.offsetHeight<v.offsetHeight*Math.min(s,o.current.length-1)-1||b.top>=-a||b.bottom>=-a?r.flushSync((()=>i(!0))):r.flushSync((()=>i(!1)))),u&&(u.current=await t.detectOverflow(Ze({...g,y:E},h.offsetHeight),d)),{y:E}}}),e.safePolygon=function(e){let t,{buffer:n=.5,blockPointerEvents:r=!1,requireIntent:o=!0}=void 0===e?{}:e,u=!1,i=!1,c=null,l=null,s=performance.now();const a=e=>{let{x:r,y:a,placement:f,elements:d,onClose:m,nodeId:p,tree:v}=e;return function(e){function g(){clearTimeout(t),m()}if(clearTimeout(t),!d.domReference||!d.floating||null==f||null==r||null==a)return;const{clientX:h,clientY:y}=e,b=[h,y],w=ue(e),E="mouseleave"===e.type,x=M(d.floating,w),I=M(d.domReference,w),O=d.domReference.getBoundingClientRect(),k=d.floating.getBoundingClientRect(),C=f.split("-")[0],T=r>k.right-k.width/2,P=a>k.bottom-k.height/2,S=function(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}(b,O);if(x&&(i=!0,!E))return;if(I&&(i=!1),I&&!E)return void(i=!0);if(E&&R(e.relatedTarget)&&M(d.floating,e.relatedTarget))return;if(v&&oe(v.nodesRef.current,p).some((e=>{let{context:t}=e;return null==t?void 0:t.open})))return;if("top"===C&&a>=O.bottom-1||"bottom"===C&&a<=O.top+1||"left"===C&&r>=O.right-1||"right"===C&&r<=O.left+1)return g();let A=[];switch(C){case"top":A=[[k.left,O.top+1],[k.left,k.bottom-1],[k.right,k.bottom-1],[k.right,O.top+1]],u=h>=k.left&&h<=k.right&&y>=k.top&&y<=O.top+1;break;case"bottom":A=[[k.left,k.top+1],[k.left,O.bottom-1],[k.right,O.bottom-1],[k.right,k.top+1]],u=h>=k.left&&h<=k.right&&y>=O.bottom-1&&y<=k.bottom;break;case"left":A=[[k.right-1,k.bottom],[k.right-1,k.top],[O.left+1,k.top],[O.left+1,k.bottom]],u=h>=k.left&&h<=O.left+1&&y>=k.top&&y<=k.bottom;break;case"right":A=[[O.right-1,k.bottom],[O.right-1,k.top],[k.left+1,k.top],[k.left+1,k.bottom]],u=h>=O.right-1&&h<=k.right&&y>=k.top&&y<=k.bottom}const L=u?A:function(e){let[t,r]=e;const o=k.width>O.width,u=k.height>O.height;switch(C){case"top":return[[o?t+n/2:T?t+4*n:t-4*n,r+n+1],[o?t-n/2:T?t+4*n:t-4*n,r+n+1],...[[k.left,T||o?k.bottom-n:k.top],[k.right,T?o?k.bottom-n:k.top:k.bottom-n]]];case"bottom":return[[o?t+n/2:T?t+4*n:t-4*n,r-n],[o?t-n/2:T?t+4*n:t-4*n,r-n],...[[k.left,T||o?k.top+n:k.bottom],[k.right,T?o?k.top+n:k.bottom:k.top+n]]];case"left":{const e=[t+n+1,u?r+n/2:P?r+4*n:r-4*n],o=[t+n+1,u?r-n/2:P?r+4*n:r-4*n];return[...[[P||u?k.right-n:k.left,k.top],[P?u?k.right-n:k.left:k.right-n,k.bottom]],e,o]}case"right":return[[t-n,u?r+n/2:P?r+4*n:r-4*n],[t-n,u?r-n/2:P?r+4*n:r-4*n],...[[P||u?k.left+n:k.right,k.top],[P?u?k.left+n:k.right:k.left+n,k.bottom]]]}}([r,a]);if(!u){if(i&&!S)return g();if(!E&&o){const t=function(e,t){const n=performance.now(),r=n-s;if(null===c||null===l||0===r)return c=e,l=t,s=n,null;const o=e-c,u=t-l,i=Math.sqrt(o*o+u*u);return c=e,l=t,s=n,i/r}(e.clientX,e.clientY),n=.1;if(null!==t&&t<n)return g()}!function(e,t){const[n,r]=e;let o=!1;const u=t.length;for(let e=0,i=u-1;e<u;i=e++){const[u,c]=t[e]||[0,0],[l,s]=t[i]||[0,0];c>=r!=s>=r&&n<=(l-u)*(r-c)/(s-c)+u&&(o=!o)}return o}([h,y],L)?g():!i&&o&&(t=window.setTimeout(g,40))}}};return a.__options={blockPointerEvents:r},a},e.useClick=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:i}}=e,{enabled:c=!0,event:l="click",toggle:s=!0,ignoreMouse:a=!1,keyboardHandlers:f=!0}=t,d=u.useRef(),m=u.useRef(!1);return u.useMemo((()=>c?{reference:{onPointerDown(e){d.current=e.pointerType},onMouseDown(e){0===e.button&&(C(d.current,!0)&&a||"click"!==l&&(n?!s||o.current.openEvent&&"mousedown"!==o.current.openEvent.type||r(!1):(e.preventDefault(),r(!0)),o.current.openEvent=e.nativeEvent))},onClick(e){"mousedown"===l&&d.current?d.current=void 0:C(d.current,!0)&&a||(n?!s||o.current.openEvent&&"click"!==o.current.openEvent.type||r(!1):r(!0),o.current.openEvent=e.nativeEvent)},onKeyDown(e){d.current=void 0,f&&!ke(e)&&(" "!==e.key||Ce(i)||(e.preventDefault(),m.current=!0),"Enter"===e.key&&(n?s&&r(!1):r(!0)))},onKeyUp(e){!f||ke(e)||Ce(i)||" "===e.key&&m.current&&(m.current=!1,n?s&&r(!1):r(!0))}}}:{}),[c,o,l,a,f,i,s,n,r])},e.useClientPoint=function(e,t){let{open:n,refs:r,dataRef:o,elements:{floating:i}}=e,{enabled:l=!0,axis:s="both",x:a=null,y:f=null}=void 0===t?{}:t;const d=u.useRef(!1),m=u.useRef(null),[p,v]=u.useState(),[g,h]=u.useState([]),y=Te(((e,t)=>{d.current||o.current.openEvent&&!Pe(o.current.openEvent)||r.setPositionReference(function(e,t){let n=null,r=null,o=!1;return{contextElement:e.current||void 0,getBoundingClientRect(){var u,i;const c=(null==(u=e.current)?void 0:u.getBoundingClientRect())||{width:0,height:0,x:0,y:0},l="x"===t.axis||"both"===t.axis,s="y"===t.axis||"both"===t.axis,a=["mouseenter","mousemove"].includes((null==(i=t.dataRef.current.openEvent)?void 0:i.type)||"")&&"touch"!==t.pointerType;let f=c.width,d=c.height,m=c.x,p=c.y;return null==n&&t.x&&l&&(n=c.x-t.x),null==r&&t.y&&s&&(r=c.y-t.y),m-=n||0,p-=r||0,f=0,d=0,!o||a?(f="y"===t.axis?c.width:0,d="x"===t.axis?c.height:0,m=l&&null!=t.x?t.x:m,p=s&&null!=t.y?t.y:p):o&&!a&&(d="x"===t.axis?c.height:d,f="y"===t.axis?c.width:f),o=!0,{width:f,height:d,x:m,y:p,top:p,right:m+f,bottom:p+d,left:m}}}}(r.domReference,{x:e,y:t,axis:s,dataRef:o,pointerType:p}))})),b=Te((e=>{null==a&&null==f&&(n?m.current||h([]):y(e.clientX,e.clientY))})),w=C(p)?i:n,R=u.useCallback((()=>{if(!w||!l||null!=a||null!=f)return;const e=E(r.floating.current);function t(n){const o=ue(n);M(r.floating.current,o)?(e.removeEventListener("mousemove",t),m.current=null):y(n.clientX,n.clientY)}if(!o.current.openEvent||Pe(o.current.openEvent)){e.addEventListener("mousemove",t);const n=()=>{e.removeEventListener("mousemove",t),m.current=null};return m.current=n,n}r.setPositionReference(r.domReference.current)}),[o,l,w,r,y,a,f]);return u.useEffect((()=>R()),[R,g]),u.useEffect((()=>{l&&!i&&(d.current=!1)}),[l,i]),u.useEffect((()=>{!l&&n&&(d.current=!0)}),[l,n]),c((()=>{!l||null==a&&null==f||(d.current=!1,y(a,f))}),[l,a,f,y]),u.useMemo((()=>{if(!l)return{};function e(e){let{pointerType:t}=e;v(t)}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove:b,onMouseEnter:b}}}),[l,b])},e.useDelayGroup=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:u,setCurrentId:i,initialDelay:l,setState:s,timeoutMs:a}=L();c((()=>{u&&(s({delay:{open:1,close:S(l,"close")}}),u!==o&&r(!1))}),[o,r,s,u,l]),c((()=>{function e(){r(!1),s({delay:l,currentId:null})}if(!n&&u===o){if(a){const t=window.setTimeout(e,a);return()=>{clearTimeout(t)}}e()}}),[n,s,u,o,r,l,a]),c((()=>{n&&i(o)}),[n,i,o])},e.useDelayGroupContext=L,e.useDismiss=function(e,n){void 0===n&&(n={});const{open:r,onOpenChange:o,events:i,nodeId:c,elements:{reference:l,domReference:s,floating:a},dataRef:f}=e,{enabled:d=!0,escapeKey:m=!0,outsidePress:p=!0,outsidePressEvent:v="pointerdown",referencePress:b=!1,referencePressEvent:w="pointerdown",ancestorScroll:k=!1,bubbles:C}=n,M=h(),T=null!=g(),P=Te("function"==typeof p?p:()=>!1),S="function"==typeof p?P:p,A=u.useRef(!1),{escapeKeyBubbles:L,outsidePressBubbles:D}=(e=>{var t,n;return{escapeKeyBubbles:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePressBubbles:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}})(C),N=Te((e=>{if(!r||!d||!m||"Escape"!==e.key)return;const t=M?oe(M.nodesRef.current,c):[];if(!L&&(e.stopPropagation(),t.length>0)){let e=!0;if(t.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}i.emit("dismiss",{type:"escapeKey",data:{returnFocus:{preventScroll:!1}}}),o(!1)})),F=Te((e=>{const t=A.current;if(A.current=!1,t)return;if("function"==typeof S&&!S(e))return;const n=ue(e);if(x(n)&&a){const t=n.clientWidth>0&&n.scrollWidth>n.clientWidth,r=n.clientHeight>0&&n.scrollHeight>n.clientHeight;let o=r&&e.offsetX>n.clientWidth;if(r){"rtl"===E(a).getComputedStyle(n).direction&&(o=e.offsetX<=n.offsetWidth-n.clientWidth)}if(o||t&&e.offsetY>n.clientHeight)return}const r=M&&oe(M.nodesRef.current,c).some((t=>{var n;return Se(e,null==(n=t.context)?void 0:n.elements.floating)}));if(Se(e,a)||Se(e,s)||r)return;const u=M?oe(M.nodesRef.current,c):[];if(u.length>0){let e=!0;if(u.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}i.emit("dismiss",{type:"outsidePress",data:{returnFocus:T?{preventScroll:!0}:I(e)||O(e)}}),o(!1)}));return u.useEffect((()=>{if(!r||!d)return;function e(){o(!1)}f.current.__escapeKeyBubbles=L,f.current.__outsidePressBubbles=D;const n=y(a);m&&n.addEventListener("keydown",N),S&&n.addEventListener(v,F);let u=[];return k&&(R(s)&&(u=t.getOverflowAncestors(s)),R(a)&&(u=u.concat(t.getOverflowAncestors(a))),!R(l)&&l&&l.contextElement&&(u=u.concat(t.getOverflowAncestors(l.contextElement)))),u=u.filter((e=>{var t;return e!==(null==(t=n.defaultView)?void 0:t.visualViewport)})),u.forEach((t=>{t.addEventListener("scroll",e,{passive:!0})})),()=>{m&&n.removeEventListener("keydown",N),S&&n.removeEventListener(v,F),u.forEach((t=>{t.removeEventListener("scroll",e)}))}}),[f,a,s,l,m,S,v,r,o,k,d,L,D,N,F]),u.useEffect((()=>{A.current=!1}),[S,v]),u.useMemo((()=>d?{reference:{onKeyDown:N,[Ae[w]]:()=>{b&&(i.emit("dismiss",{type:"referencePress",data:{returnFocus:!1}}),o(!1))}},floating:{onKeyDown:N,[Le[v]]:()=>{A.current=!0}}}:{}),[d,i,b,v,w,o,N])},e.useFloating=function(e){void 0===e&&(e={});const{open:n=!1,onOpenChange:r,nodeId:o}=e,i=t.useFloating(e),l=h(),s=u.useRef(null),a=u.useRef({}),d=u.useState((()=>m()))[0],p=f(),[v,g]=u.useState(null),y=u.useCallback((e=>{const t=R(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;i.refs.setReference(t)}),[i.refs]),b=u.useCallback((e=>{(R(e)||null===e)&&(s.current=e,g(e)),(R(i.refs.reference.current)||null===i.refs.reference.current||null!==e&&!R(e))&&i.refs.setReference(e)}),[i.refs]),w=u.useMemo((()=>({...i.refs,setReference:b,setPositionReference:y,domReference:s})),[i.refs,b,y]),E=u.useMemo((()=>({...i.elements,domReference:v})),[i.elements,v]),x=Te(r),I=u.useMemo((()=>({...i,refs:w,elements:E,dataRef:a,nodeId:o,floatingId:p,events:d,open:n,onOpenChange:x})),[i,o,p,d,n,x,w,E]);return c((()=>{const e=null==l?void 0:l.nodesRef.current.find((e=>e.id===o));e&&(e.context=I)})),u.useMemo((()=>({...i,context:I,refs:w,elements:E,reference:b,positionReference:y})),[i,w,E,I,b,y])},e.useFloatingNodeId=e=>{const t=f(),n=h(),r=g(),o=e||r;return c((()=>{const e={id:t,parentId:o};return null==n||n.addNode(e),()=>{null==n||n.removeNode(e)}}),[n,t,o]),t},e.useFloatingParentNodeId=g,e.useFloatingPortalNode=be,e.useFloatingTree=h,e.useFocus=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,refs:c,elements:{floating:l,domReference:s}}=e,{enabled:a=!0,keyboardOnly:f=!0}=t,d=u.useRef(""),m=u.useRef(!1),p=u.useRef();return u.useEffect((()=>{if(!a)return;const e=y(l).defaultView||window;function t(){!n&&x(s)&&s===te(y(s))&&(m.current=!0)}return e.addEventListener("blur",t),()=>{e.removeEventListener("blur",t)}}),[l,s,n,a]),u.useEffect((()=>{if(a)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(e){"referencePress"!==e.type&&"escapeKey"!==e.type||(m.current=!0)}}),[i,a]),u.useEffect((()=>()=>{clearTimeout(p.current)}),[]),u.useMemo((()=>a?{reference:{onPointerDown(e){let{pointerType:t}=e;d.current=t,m.current=!(!t||!f)},onMouseLeave(){m.current=!1},onFocus(e){var t;m.current||"focus"===e.type&&"mousedown"===(null==(t=o.current.openEvent)?void 0:t.type)&&o.current.openEvent&&Se(o.current.openEvent,s)||(o.current.openEvent=e.nativeEvent,r(!0))},onBlur(e){m.current=!1;const t=e.relatedTarget,n=R(t)&&t.hasAttribute("data-floating-ui-focus-guard")&&"outside"===t.getAttribute("data-type");p.current=setTimeout((()=>{M(c.floating.current,t)||M(s,t)||n||r(!1)}))}}}:{}),[a,f,s,c,o,r])},e.useHover=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:{domReference:l,floating:s},refs:a}=e,{enabled:f=!0,delay:d=0,handleClose:m=null,mouseOnly:p=!1,restMs:v=0,move:b=!0}=t,w=h(),E=g(),x=T(m),I=T(d),O=u.useRef(),k=u.useRef(),A=u.useRef(),L=u.useRef(),D=u.useRef(!0),N=u.useRef(!1),F=u.useRef((()=>{})),j=u.useCallback((()=>{var e;const t=null==(e=o.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[o]);u.useEffect((()=>{if(f)return i.on("dismiss",e),()=>{i.off("dismiss",e)};function e(){clearTimeout(k.current),clearTimeout(L.current),D.current=!0}}),[f,i]),u.useEffect((()=>{if(!f||!x.current||!n)return;function e(){j()&&r(!1)}const t=y(s).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[s,n,r,f,x,o,j]);const K=u.useCallback((function(e){void 0===e&&(e=!0);const t=S(I.current,"close",O.current);t&&!A.current?(clearTimeout(k.current),k.current=setTimeout((()=>r(!1)),t)):e&&(clearTimeout(k.current),r(!1))}),[I,r]),_=u.useCallback((()=>{F.current(),A.current=void 0}),[]),B=u.useCallback((()=>{if(N.current){const e=y(a.floating.current).body;e.style.pointerEvents="",e.removeAttribute(P),N.current=!1}}),[a]);return u.useEffect((()=>{if(f&&R(l)){const e=l;return n&&e.addEventListener("mouseleave",c),null==s||s.addEventListener("mouseleave",c),b&&e.addEventListener("mousemove",u,{once:!0}),e.addEventListener("mouseenter",u),e.addEventListener("mouseleave",i),()=>{n&&e.removeEventListener("mouseleave",c),null==s||s.removeEventListener("mouseleave",c),b&&e.removeEventListener("mousemove",u),e.removeEventListener("mouseenter",u),e.removeEventListener("mouseleave",i)}}function t(){return!!o.current.openEvent&&["click","mousedown"].includes(o.current.openEvent.type)}function u(e){if(clearTimeout(k.current),D.current=!1,p&&!C(O.current)||v>0&&0===S(I.current,"open"))return;o.current.openEvent=e;const t=S(I.current,"open",O.current);t?k.current=setTimeout((()=>{r(!0)}),t):r(!0)}function i(r){if(t())return;F.current();const o=y(s);if(clearTimeout(L.current),x.current){n||clearTimeout(k.current),A.current=x.current({...e,tree:w,x:r.clientX,y:r.clientY,onClose(){B(),_(),K()}});const t=A.current;return o.addEventListener("mousemove",t),void(F.current=()=>{o.removeEventListener("mousemove",t)})}("touch"!==O.current||!M(s,r.relatedTarget))&&K()}function c(n){t()||null==x.current||x.current({...e,tree:w,x:n.clientX,y:n.clientY,onClose(){B(),_(),K()}})(n)}}),[l,s,f,e,p,v,b,K,_,B,r,n,w,I,x,o]),c((()=>{var e;if(f&&n&&null!=(e=x.current)&&e.__options.blockPointerEvents&&j()){const e=y(s).body;if(e.setAttribute(P,""),e.style.pointerEvents="none",N.current=!0,R(l)&&s){var t,r;const e=l,n=null==w||null==(t=w.nodesRef.current.find((e=>e.id===E)))||null==(r=t.context)?void 0:r.elements.floating;return n&&(n.style.pointerEvents=""),e.style.pointerEvents="auto",s.style.pointerEvents="auto",()=>{e.style.pointerEvents="",s.style.pointerEvents=""}}}}),[f,n,E,s,l,w,x,o,j]),c((()=>{n||(O.current=void 0,_(),B())}),[n,_,B]),u.useEffect((()=>()=>{_(),clearTimeout(k.current),clearTimeout(L.current),B()}),[f,_,B]),u.useMemo((()=>{if(!f)return{};function e(e){O.current=e.pointerType}return{reference:{onPointerDown:e,onPointerEnter:e,onMouseMove(){n||0===v||(clearTimeout(L.current),L.current=setTimeout((()=>{D.current||r(!0)}),v))}},floating:{onMouseEnter(){clearTimeout(k.current)},onMouseLeave(){i.emit("dismiss",{type:"mouseLeave",data:{returnFocus:!1}}),K(!1)}}}}),[i,f,v,n,r,K])},e.useId=f,e.useInnerOffset=(e,t)=>{let{open:n,elements:o}=e,{enabled:i=!0,overflowRef:c,scrollRef:l,onChange:s}=t;const a=Te(s),f=u.useRef(!1),d=u.useRef(null),m=u.useRef(null);return u.useEffect((()=>{if(!i)return;function e(e){if(e.ctrlKey||!t||null==c.current)return;const n=e.deltaY,o=c.current.top>=-.5,u=c.current.bottom>=-.5,i=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((e=>e+Math[s](n,i*l)))}))):/firefox/i.test(w())&&(t.scrollTop+=n))}const t=(null==l?void 0:l.current)||o.floating;return n&&t?(t.addEventListener("wheel",e),requestAnimationFrame((()=>{d.current=t.scrollTop,null!=c.current&&(m.current={...c.current})})),()=>{d.current=null,m.current=null,t.removeEventListener("wheel",e)}):void 0}),[i,n,o.floating,c,l,a]),u.useMemo((()=>i?{floating:{onKeyDown(){f.current=!0},onWheel(){f.current=!1},onPointerMove(){f.current=!1},onScroll(){const e=(null==l?void 0:l.current)||o.floating;if(c.current&&e&&f.current){if(null!==d.current){const t=e.scrollTop-d.current;(c.current.bottom<-.5&&t<-1||c.current.top<-.5&&t>1)&&r.flushSync((()=>a((e=>e+t))))}requestAnimationFrame((()=>{d.current=e.scrollTop}))}}}}:{}),[i,c,o.floating,l,a])},e.useInteractions=function(e){void 0===e&&(e=[]);const t=e,n=u.useCallback((t=>$e(t,e,"reference")),t),r=u.useCallback((t=>$e(t,e,"floating")),t),o=u.useCallback((t=>$e(t,e,"item")),e.map((e=>null==e?void 0:e.item)));return u.useMemo((()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o})),[n,r,o])},e.useListItem=function(e){let{label:t}=void 0===e?{}:e;const[n,r]=u.useState(null),o=u.useRef(null),{register:i,unregister:l,map:s,elementsRef:a,labelsRef:f}=u.useContext(xe),d=u.useCallback((e=>{if(o.current=e,null!==n&&(a.current[n]=e,f)){var r;const o=void 0!==t;f.current[n]=o?t:null!=(r=null==e?void 0:e.textContent)?r:null}}),[n,a,f,t]);return c((()=>{const e=o.current;if(e)return i(e),()=>{l(e)}}),[i,l]),c((()=>{const e=o.current?s.get(o.current):null;null!=e&&r(e)}),[s]),u.useMemo((()=>({ref:d,index:null==n?-1:n})),[n,d])},e.useListNavigation=(e,t)=>{const{open:n,onOpenChange:r,refs:o,elements:{domReference:i,floating:l}}=e,{listRef:s,activeIndex:a,onNavigate:f=(()=>{}),enabled:d=!0,selectedIndex:m=null,allowEscape:p=!1,loop:v=!1,nested:w=!1,rtl:E=!1,virtual:R=!1,focusItemOnOpen:C="auto",focusItemOnHover:P=!0,openOnArrowKeyDown:S=!0,disabledIndices:A,orientation:L="vertical",cols:D=1,scrollItemIntoView:N=!0}=t,F=g(),j=h(),K=Te(f),_=u.useRef(C),B=u.useRef(null!=m?m:-1),H=u.useRef(null),q=u.useRef(!0),W=u.useRef(K),U=u.useRef(!!l),z=u.useRef(!1),V=u.useRef(!1),X=T(A),Y=T(n),G=T(N),[Z,$]=u.useState(),Q=Te((function(e,t,n){void 0===n&&(n=!1);const r=e.current[t.current];r&&(R?$(r.id):re(r,{preventScroll:!0,sync:!(!b().toLowerCase().startsWith("mac")||navigator.maxTouchPoints||!k())&&(De||z.current)}),requestAnimationFrame((()=>{const e=G.current;e&&r&&(n||!q.current)&&(null==r.scrollIntoView||r.scrollIntoView("boolean"==typeof e?{block:"nearest",inline:"nearest"}:e))})))}));c((()=>{document.createElement("div").focus({get preventScroll(){return De=!0,!1}})}),[]),c((()=>{d&&(n&&l?_.current&&null!=m&&(V.current=!0,K(m)):U.current&&(B.current=-1,W.current(null)))}),[d,n,l,m,K]),c((()=>{if(d&&n&&l)if(null==a){if(z.current=!1,null!=m)return;if(U.current&&(B.current=-1,Q(s,B)),!U.current&&_.current&&(null!=H.current||!0===_.current&&null==H.current)){let e=0;const t=()=>{if(null==s.current[0]){if(e<2){(e?requestAnimationFrame:queueMicrotask)(t)}e++}else B.current=null==H.current||Ue(H.current,L,E)||w?ze(s,X.current):Ve(s,X.current),H.current=null,K(B.current)};t()}}else Be(s,a)||(B.current=a,Q(s,B,V.current),V.current=!1)}),[d,n,l,a,m,w,s,L,E,K,Q,X]),c((()=>{if(d&&U.current&&!l&&j){var e,t;const n=j.nodesRef.current,r=null==(e=n.find((e=>e.id===F)))||null==(t=e.context)?void 0:t.elements.floating,o=te(y(l)),u=n.some((e=>e.context&&M(e.context.elements.floating,o)));r&&!u&&r.focus({preventScroll:!0})}}),[d,l,j,F]),c((()=>{W.current=K,U.current=!!l})),c((()=>{n||(H.current=null)}),[n]);const J=null!=a,ee=u.useMemo((()=>{function e(e){if(!n)return;const t=s.current.indexOf(e);-1!==t&&K(t)}return{onFocus(t){let{currentTarget:n}=t;e(n)},onClick:e=>{let{currentTarget:t}=e;return t.focus({preventScroll:!0})},...P&&{onMouseMove(t){let{currentTarget:n}=t;e(n)},onPointerLeave(e){let{pointerType:t}=e;q.current&&"touch"!==t&&(B.current=-1,Q(s,B),K(null),R||re(o.floating.current,{preventScroll:!0}))}}}}),[n,o,Q,P,s,K,R]);return u.useMemo((()=>{if(!d)return{};const e=X.current;function t(t){if(q.current=!1,z.current=!0,!Y.current&&t.currentTarget===o.floating.current)return;if(w&&function(e,t,n){return qe(t,n?e===Ke:e===je,e===Ne)}(t.key,L,E))return ce(t),r(!1),void(x(i)&&i.focus());const u=B.current,c=ze(s,e),l=Ve(s,e);if("Home"===t.key&&(ce(t),B.current=c,K(B.current)),"End"===t.key&&(ce(t),B.current=l,K(B.current)),D>1){const n=B.current;if(t.key===Ne){if(ce(t),-1===n)B.current=l;else if(B.current=He(s,{startingIndex:n,amount:D,decrement:!0,disabledIndices:e}),v&&(n-D<c||B.current<0)){const e=n%D,t=l%D,r=l-(t-e);B.current=t===e?l:t>e?r:r-D}Be(s,B.current)&&(B.current=n),K(B.current)}if(t.key===Fe&&(ce(t),-1===n?B.current=c:(B.current=He(s,{startingIndex:n,amount:D,disabledIndices:e}),v&&n+D>l&&(B.current=He(s,{startingIndex:n%D-D,amount:D,disabledIndices:e}))),Be(s,B.current)&&(B.current=n),K(B.current)),"both"===L){const r=Math.floor(n/D);t.key===Ke&&(ce(t),n%D!=D-1?(B.current=He(s,{startingIndex:n,disabledIndices:e}),v&&_e(B.current,D,r)&&(B.current=He(s,{startingIndex:n-n%D-1,disabledIndices:e}))):v&&(B.current=He(s,{startingIndex:n-n%D-1,disabledIndices:e})),_e(B.current,D,r)&&(B.current=n)),t.key===je&&(ce(t),n%D!=0?(B.current=He(s,{startingIndex:n,disabledIndices:e,decrement:!0}),v&&_e(B.current,D,r)&&(B.current=He(s,{startingIndex:n+(D-n%D),decrement:!0,disabledIndices:e}))):v&&(B.current=He(s,{startingIndex:n+(D-n%D),decrement:!0,disabledIndices:e})),_e(B.current,D,r)&&(B.current=n));const o=Math.floor(l/D)===r;return Be(s,B.current)&&(B.current=v&&o?t.key===je?l:He(s,{startingIndex:n-n%D-1,disabledIndices:e}):n),void K(B.current)}}if(We(t.key,L)){if(ce(t),n&&!R&&te(t.currentTarget.ownerDocument)===t.currentTarget)return B.current=Ue(t.key,L,E)?c:l,void K(B.current);Ue(t.key,L,E)?B.current=v?u>=l?p&&u!==s.current.length?-1:c:He(s,{startingIndex:u,disabledIndices:e}):Math.min(l,He(s,{startingIndex:u,disabledIndices:e})):B.current=v?u<=c?p&&-1!==u?s.current.length:l:He(s,{startingIndex:u,decrement:!0,disabledIndices:e}):Math.max(c,He(s,{startingIndex:u,decrement:!0,disabledIndices:e})),Be(s,B.current)?K(null):K(B.current)}}function u(e){"auto"===C&&I(e.nativeEvent)&&(_.current=!0)}const c=R&&n&&J&&{"aria-activedescendant":Z};return{reference:{...c,onKeyDown(o){q.current=!1;const u=0===o.key.indexOf("Arrow");if(R&&n)return t(o);if(!n&&!S&&u)return;const i=u||"Enter"===o.key||""===o.key.trim(),c=We(o.key,L),l=function(e,t,n){return qe(t,n?e===je:e===Ke,e===Fe)}(o.key,L,E);i&&(H.current=w&&c?null:o.key),w?l&&(ce(o),n?(B.current=ze(s,e),K(B.current)):r(!0)):c&&(null!=m&&(B.current=m),ce(o),!n&&S?r(!0):t(o),n&&K(B.current))},onFocus(){n&&K(null)},onPointerDown:function(e){_.current=C,"auto"===C&&O(e.nativeEvent)&&(_.current=!0)},onMouseDown:u,onClick:u},floating:{"aria-orientation":"both"===L?void 0:L,...c,onKeyDown:t,onPointerMove(){q.current=!0}},item:ee}}),[i,o,Z,X,Y,s,d,L,E,R,n,J,w,m,S,p,D,v,C,K,r,ee])},e.useMergeRefs=function(e){return u.useMemo((()=>e.every((e=>null==e))?null:t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}),e)},e.useRole=function(e,t){void 0===t&&(t={});const{open:n,floatingId:r}=e,{enabled:o=!0,role:i="dialog"}=t,c=f();return u.useMemo((()=>{const e={id:r,role:i};return o?"tooltip"===i?{reference:{"aria-describedby":n?r:void 0},floating:e}:{reference:{"aria-expanded":n?"true":"false","aria-haspopup":"alertdialog"===i?"dialog":i,"aria-controls":n?r:void 0,..."listbox"===i&&{role:"combobox"},..."menu"===i&&{id:c}},floating:{...e,..."menu"===i&&{"aria-labelledby":c}}}:{}}),[o,i,n,r,c])},e.useTransitionStatus=Ge,e.useTransitionStyles=function(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:l=250}=t,s=e.placement,a=s.split("-")[0],f=u.useMemo((()=>({side:a,placement:s})),[a,s]),d="number"==typeof l,m=(d?l:l.open)||0,p=(d?l:l.close)||0,[v,g]=u.useState((()=>({...Ye(i,f),...Ye(n,f)}))),{isMounted:h,status:y}=Ge(e,{duration:l}),b=T(n),w=T(r),E=T(o),R=T(i);return c((()=>{const e=Ye(b.current,f),t=Ye(E.current,f),n=Ye(R.current,f),r=Ye(w.current,f)||Object.keys(e).reduce(((e,t)=>(e[t]="",e)),{});if("initial"===y&&g((t=>({transitionProperty:t.transitionProperty,...n,...e}))),"open"===y&&g({transitionProperty:Object.keys(r).map(Xe).join(","),transitionDuration:m+"ms",...n,...r}),"close"===y){const r=t||e;g({transitionProperty:Object.keys(r).map(Xe).join(","),transitionDuration:p+"ms",...n,...r})}}),[p,E,b,w,R,m,y,f]),{isMounted:h,styles:v}},e.useTypeahead=(e,t)=>{var n;const{open:r,dataRef:o}=e,{listRef:i,activeIndex:l,onMatch:s,onTypingChange:a,enabled:f=!0,findMatch:d=null,resetMs:m=750,ignoreKeys:p=[],selectedIndex:v=null}=t,g=u.useRef(),h=u.useRef(""),y=u.useRef(null!=(n=null!=v?v:l)?n:-1),b=u.useRef(null),w=Te(s),E=Te(a),R=T(d),x=T(p);return c((()=>{r&&(clearTimeout(g.current),b.current=null,h.current="")}),[r]),c((()=>{var e;r&&""===h.current&&(y.current=null!=(e=null!=v?v:l)?e:-1)}),[r,v,l]),u.useMemo((()=>{if(!f)return{};function e(e){e?o.current.typing||(o.current.typing=e,E(e)):o.current.typing&&(o.current.typing=e,E(e))}function t(e,t,n){const r=R.current?R.current(t,n):t.find((e=>0===(null==e?void 0:e.toLocaleLowerCase().indexOf(n.toLocaleLowerCase()))));return r?e.indexOf(r):-1}function n(n){const o=i.current;if(h.current.length>0&&" "!==h.current[0]&&(-1===t(o,o,h.current)?e(!1):" "===n.key&&ce(n)),null==o||x.current.includes(n.key)||1!==n.key.length||n.ctrlKey||n.metaKey||n.altKey)return;r&&" "!==n.key&&(ce(n),e(!0));o.every((e=>{var t,n;return!e||(null==(t=e[0])?void 0:t.toLocaleLowerCase())!==(null==(n=e[1])?void 0:n.toLocaleLowerCase())}))&&h.current===n.key&&(h.current="",y.current=b.current),h.current+=n.key,clearTimeout(g.current),g.current=setTimeout((()=>{h.current="",y.current=b.current,e(!1)}),m);const u=y.current,c=t(o,[...o.slice((u||0)+1),...o.slice(0,(u||0)+1)],h.current);-1!==c?(w(c),b.current=c):" "!==n.key&&(h.current="")}return{reference:{onKeyDown:n},floating:{onKeyDown:n,onKeyUp(t){" "===t.key&&e(!1)}}}}),[f,r,o,i,m,x,R,w,E])},Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "@floating-ui/react", | ||
"version": "0.23.0", | ||
"version": "0.23.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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
572956
12981