@react-hive/honey-layout 18.5.0 → 18.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -33,7 +33,7 @@ import{HONEY_BREAKPOINTS as e,HoneyStyleProvider as t,css as n,isCssColorPropert
33
33
  min-height: ${t};
34
34
  }
35
35
  `}
36
- `,$=({ref:e,children:t,columns:n,spacing:r,columnsGrowing:o=!0,applyColumnMaxWidth:i=!1,...u})=>{const c=(0,T.useMemo)(()=>({columns:n,spacing:r,isColumnsGrowing:o,applyColumnMaxWidth:i}),[n,r,o,i]);return(0,m().jsx)(P,{value:c,children:(0,m().jsx)(D,{ref:e,spacing:r,"data-testid":"honey-grid",...u,children:t})})},I=()=>{const e=(0,T.useContext)(P);if(!e)throw new Error("The `useHoneyGridContext()` hook can only be used inside <HoneyGrid/> component!");return e},N=({children:e,...t})=>{const{columns:n,spacing:r,isColumnsGrowing:o,applyColumnMaxWidth:i}=I();return(0,m().jsx)(M,{columns:n,spacing:r,applyMaxWidth:i,$flexGrow:o?1:0,"data-testid":"honey-grid-column",...t,children:e})},F=(e,t,n)=>"function"==typeof t?t(e):"string"==typeof e||"number"==typeof e?e:t?e[t]:n,W=({children:e,loading:t=!1,loadingOverContent:n=!1,error:r=!1,empty:o=!1,loadingContent:i=null,errorContent:u=null,emptyContent:c=null})=>r?u:!n&&t?i:(0,m().jsxs)(m().Fragment,{children:[n&&t&&i,o?c:e]}),H=l(L,({$overflow:e="hidden auto"})=>({$overflow:e}))``,z=({children:e,items:t,itemKey:n,loading:r,loadingOverContent:o,loadingContent:i,error:u,errorContent:c,empty:l=!1,emptyContent:s,...a})=>(0,m().jsx)(H,{role:"list","aria-busy":r,"data-testid":"honey-list",...a,children:(0,m().jsx)(W,{loading:r,loadingOverContent:o,loadingContent:i,error:u,errorContent:c,empty:l||0===t?.length,emptyContent:s,children:t?.map((t,r,o)=>(0,m().jsx)(T.Fragment,{children:e(t,r,o)},String(F(t,n,r))))})}),B=({children:e,mount:t,unmountDelay:n,alwaysMounted:r=!1,keepAfterMount:o=!1})=>{const[i,u]=(0,T.useState)(r||t),c=(0,T.useRef)(void 0);return(0,T.useLayoutEffect)(()=>{if(t&&!r)return clearTimeout(c.current),u(!0),()=>{o||(c.current=setTimeout(()=>u(!1),n))}},[t,r,n]),i?e:null};var U={551(e,t,n){var r="Expected a function",o=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt,s="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,a="object"==typeof self&&self&&self.Object===Object&&self,f=s||a||Function("return this")(),d=Object.prototype.toString,p=Math.max,v=Math.min,m=function(){return f.Date.now()};function h(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==d.call(e)}(e))return NaN;if(h(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=h(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var n=u.test(e);return n||c.test(e)?l(e.slice(2),n?2:8):i.test(e)?NaN:+e}e.exports=function(e,t,n){var o=!0,i=!0;if("function"!=typeof e)throw new TypeError(r);return h(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),function(e,t,n){var o,i,u,c,l,s,a=0,f=!1,d=!1,y=!0;if("function"!=typeof e)throw new TypeError(r);function b(t){var n=o,r=i;return o=i=void 0,a=t,c=e.apply(r,n)}function x(e){var n=e-s;return void 0===s||n>=t||n<0||d&&e-a>=u}function w(){var e=m();if(x(e))return E(e);l=setTimeout(w,function(e){var n=t-(e-s);return d?v(n,u-(e-a)):n}(e))}function E(e){return l=void 0,y&&o?b(e):(o=i=void 0,c)}function R(){var e=m(),n=x(e);if(o=arguments,i=this,s=e,n){if(void 0===l)return function(e){return a=e,l=setTimeout(w,t),f?b(e):c}(s);if(d)return l=setTimeout(w,t),b(s)}return void 0===l&&(l=setTimeout(w,t)),c}return t=g(t)||0,h(n)&&(f=!!n.leading,u=(d="maxWait"in n)?p(g(n.maxWait)||0,t):u,y="trailing"in n?!!n.trailing:y),R.cancel=function(){void 0!==l&&clearTimeout(l),a=0,o=s=i=l=void 0},R.flush=function(){return void 0===l?c:E(m())},R}(e,t,{leading:o,maxWait:t,trailing:i})}}},K={};function V(e){var t=K[e];if(void 0!==t)return t.exports;var n=K[e]={exports:{}};return U[e](n,n.exports,V),n.exports}V.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return V.d(t,{a:t}),t},V.d=(e,t)=>{for(var n in t)V.o(t,n)&&!V.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},V.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),V.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const q=e=>{const t=(0,T.useRef)(e);return t.current=e,t};var X=V(551);V.n(X);var Y=d(551),G=d.n(Y);const Z=(e,{resizeThrottle:t=0,overrideScreenState:n}={})=>{const[r,o]=(0,T.useState)(()=>({...S(e.breakpoints),...n}));return(0,T.useEffect)(()=>{const r=G()(()=>{o({...S(e.breakpoints),...n})},t);return r(),window.addEventListener("resize",r),window.screen.orientation.addEventListener("change",r),()=>{r.cancel(),window.removeEventListener("resize",r),window.screen.orientation.removeEventListener("change",r)}},[]),r},Q=(0,T.createContext)(void 0),J=()=>{const e=(0,T.useContext)(Q);return y(e,"[@react-hive/honey-layout]: The `useHoneyLayout()` hook must be used inside <HoneyLayoutProvider/> component."),e},ee=(e,t)=>{const{registerOverlay:n,unregisterOverlay:r}=J(),o=(0,T.useRef)(null);return(0,T.useEffect)(()=>{if(!e)return;const i=n(t);return o.current=i,()=>{o.current=null,r(i.id)}},[e,t.onKeyUp]),o.current},te=()=>()=>{},ne=(e,{enabled:t=!0,onKeyUp:n}={})=>{const{getOverlaysSnapshot:r,subscribeOverlays:o}=J(),i=(0,T.useCallback)(()=>t?r().find(t=>t.id===e)??null:null,[t,e]),u=(0,T.useSyncExternalStore)(t?o:te,i,i);return(0,T.useEffect)(()=>{if(u&&n)return u.addListener("keyup",n),()=>{u.removeListener("keyup",n)}},[u,n]),u},re=({ref:e,children:t,active:n,overlayId:r,onDeactivate:o,onKeyUp:i,...u})=>{const c=q(i),l=q(o),s=(0,T.useCallback)((e,...t)=>{c.current?c.current(e,...t):"Escape"===e&&l.current()},[]),a=ee(n,{id:r,onKeyUp:s}),f=E(a?.setContainerRef,e);return(0,m().jsx)(L,{ref:f,inert:!n,...u,children:x(t,{overlay:a,isActive:n,deactivateOverlay:l.current})})},oe=(0,T.createContext)(void 0);function ie(){return"undefined"!=typeof window}function ue(e){return se(e)?(e.nodeName||"").toLowerCase():"#document"}function ce(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function le(e){var t;return null==(t=(se(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function se(e){return!!ie()&&(e instanceof Node||e instanceof ce(e).Node)}function ae(e){return!!ie()&&(e instanceof Element||e instanceof ce(e).Element)}function fe(e){return!!ie()&&(e instanceof HTMLElement||e instanceof ce(e).HTMLElement)}function de(e){return!(!ie()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof ce(e).ShadowRoot)}function pe(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Re(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==o&&"contents"!==o}function ve(e){return/^(table|td|th)$/.test(ue(e))}function me(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}const he=/transform|translate|scale|rotate|perspective|filter/,ge=/paint|layout|strict|content/,ye=e=>!!e&&"none"!==e;let be;function xe(e){const t=ae(e)?Re(e):e;return ye(t.transform)||ye(t.translate)||ye(t.scale)||ye(t.rotate)||ye(t.perspective)||!we()&&(ye(t.backdropFilter)||ye(t.filter))||he.test(t.willChange||"")||ge.test(t.contain||"")}function we(){return null==be&&(be="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),be}function Ee(e){return/^(html|body|#document)$/.test(ue(e))}function Re(e){return ce(e).getComputedStyle(e)}function Oe(e){return ae(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ce(e){if("html"===ue(e))return e;const t=e.assignedSlot||e.parentNode||de(e)&&e.host||le(e);return de(t)?t.host:t}function Se(e){const t=Ce(e);return Ee(t)?(e.ownerDocument||e).body:fe(t)&&pe(t)?t:Se(t)}function _e(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Se(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),u=ce(o);if(i){const e=je(u);return t.concat(u,u.visualViewport||[],pe(o)?o:[],e&&n?_e(e):[])}return t.concat(o,_e(o,[],n))}function je(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var ke=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","area[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"].join(","),Ae="undefined"==typeof Element,Le=Ae?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Te=!Ae&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},Pe=function(e,t){var n;void 0===t&&(t=!0);var r=null==e||null===(n=e.getAttribute)||void 0===n?void 0:n.call(e,"inert");return""===r||"true"===r||t&&e&&("function"==typeof e.closest?e.closest("[inert]"):Pe(e.parentNode))},Me=function(e,t,n){if(Pe(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ke));return t&&Le.call(e,ke)&&r.unshift(e),r.filter(n)},De=function(e,t,n){for(var r=[],o=Array.from(e);o.length;){var i=o.shift();if(!Pe(i,!1))if("SLOT"===i.tagName){var u=i.assignedElements(),c=u.length?u:i.children,l=De(c,!0,n);n.flatten?r.push.apply(r,l):r.push({scopeParent:i,candidates:l})}else{Le.call(i,ke)&&n.filter(i)&&(t||!e.includes(i))&&r.push(i);var s=i.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(i),a=!Pe(s,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(i));if(s&&a){var f=De(!0===s?i.children:s.children,!0,n);n.flatten?r.push.apply(r,f):r.push({scopeParent:i,candidates:f})}else o.unshift.apply(o,i.children)}}return r},$e=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Ie=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!$e(e)?0:e.tabIndex},Ne=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Fe=function(e){return"INPUT"===e.tagName},We=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},He=function(e,t){return!(t.disabled||function(e){return Fe(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("full-native"===n&&"checkVisibility"in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});var o=getComputedStyle(e).visibility;if("hidden"===o||"collapse"===o)return!0;var i=Le.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Le.call(i,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"full-native"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return We(e)}else{if("function"==typeof r){for(var u=e;e;){var c=e.parentElement,l=Te(e);if(c&&!c.shadowRoot&&!0===r(c))return We(e);e=e.assignedSlot?e.assignedSlot:c||l===e.ownerDocument?c:l.host}e=u}if(function(e){var t,n,r,o,i=e&&Te(e),u=null===(t=i)||void 0===t?void 0:t.host,c=!1;if(i&&i!==e)for(c=!!(null!==(n=u)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(u)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!c&&u;){var l,s,a;c=!(null===(s=u=null===(l=i=Te(u))||void 0===l?void 0:l.host)||void 0===s||null===(a=s.ownerDocument)||void 0===a||!a.contains(u))}return c}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1}(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!!Le.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},ze=function(e,t){return!(function(e){return function(e){return Fe(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Te(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)}(t)||Ie(t)<0||!He(e,t))},Be=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ue=function(e){var t=[],n=[];return e.forEach(function(e,r){var o=!!e.scopeParent,i=o?e.scopeParent:e,u=function(e,t){var n=Ie(e);return n<0&&t&&!$e(e)?0:n}(i,o),c=o?Ue(e.candidates):i;0===u?o?t.push.apply(t,c):t.push(i):n.push({documentOrder:r,tabIndex:u,item:e,isScope:o,content:c})}),n.sort(Ne).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},Ke=function(e,t){var n;return n=(t=t||{}).getShadowRoot?De([e],t.includeContainer,{filter:ze.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Be}):Me(e,t.includeContainer,ze.bind(null,t)),Ue(n)},Ve=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Le.call(e,ke)&&ze(t,e)};function qe(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function Xe(){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 Ye(){return/apple/i.test(navigator.vendor)}function Ge(){const e=/android/i;return e.test(qe())||e.test(Xe())}function Ze(){return Xe().includes("jsdom/")}const Qe="data-floating-ui-focusable";function Je(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}function et(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&de(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function tt(e){return"composedPath"in e?e.composedPath()[0]:e.target}function nt(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}function rt(e){return(null==e?void 0:e.ownerDocument)||document}function ot(e){return fe(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function it(e){return!!e&&"combobox"===e.getAttribute("role")&&ot(e)}function ut(e){return e?e.hasAttribute(Qe)?e:e.querySelector("["+Qe+"]")||e:null}function ct(e,t,n){return void 0===n&&(n=!0),e.filter(e=>{var r;return e.parentId===t&&(!n||(null==(r=e.context)?void 0:r.open))}).flatMap(t=>[t,...ct(e,t.id,n)])}function lt(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}function st(e){e.preventDefault(),e.stopPropagation()}function at(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var ft="undefined"!=typeof document?T.useLayoutEffect:function(){};function dt(e){const t=T.useRef(e);return ft(()=>{t.current=e}),t}const pt={...T}.useInsertionEffect||(e=>e());function vt(e){const t=T.useRef(()=>{});return pt(()=>{t.current=e}),T.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)},[])}const mt=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ht(e,t){const n=Ke(e,mt()),r=n.length;if(0===r)return;const o=Je(rt(e)),i=n.indexOf(o);return n[-1===i?1===t?0:r-1:i+t]}function gt(e){return ht(rt(e).body,1)||e}function yt(e){return ht(rt(e).body,-1)||e}function bt(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!et(n,r)}function xt(e){Ke(e,mt()).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})}function wt(e){e.querySelectorAll("[data-tabindex]").forEach(e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")})}v();const Et=["start","end"],Rt=["top","right","bottom","left"].reduce((e,t)=>e.concat(t,t+"-"+Et[0],t+"-"+Et[1]),[]),Ot=Math.min,Ct=Math.max,St=Math.round,_t=Math.floor,jt=e=>({x:e,y:e}),kt={left:"right",right:"left",bottom:"top",top:"bottom"};function At(e,t,n){return Ct(e,Ot(t,n))}function Lt(e,t){return"function"==typeof e?e(t):e}function Tt(e){return e.split("-")[0]}function Pt(e){return e.split("-")[1]}function Mt(e){return"x"===e?"y":"x"}function Dt(e){return"y"===e?"height":"width"}function $t(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function It(e){return Mt($t(e))}function Nt(e,t,n){void 0===n&&(n=!1);const r=Pt(e),o=It(e),i=Dt(o);let u="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(u=Ut(u)),[u,Ut(u)]}function Ft(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Wt=["left","right"],Ht=["right","left"],zt=["top","bottom"],Bt=["bottom","top"];function Ut(e){const t=Tt(e);return kt[t]+e.slice(t.length)}function Kt(e){return"number"!=typeof e?function(e){var t,n,r,o;return{top:null!=(t=e.top)?t:0,right:null!=(n=e.right)?n:0,bottom:null!=(r=e.bottom)?r:0,left:null!=(o=e.left)?o:0}}(e):{top:e,right:e,bottom:e,left:e}}function Vt(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function qt(e,t,n){let{reference:r,floating:o}=e;const i=$t(t),u=It(t),c=Dt(u),l=Tt(t),s="y"===i,a=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(l){case"top":p={x:a,y:r.y-o.height};break;case"bottom":p={x:a,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}const v=Pt(t);return v&&(p[u]+=d*("end"===v?1:-1)*(n&&s?-1:1)),p}async function Xt(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:u,elements:c,strategy:l}=e,{boundary:s="clippingAncestors",rootBoundary:a="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=Lt(t,e),v=Kt(p),m=c[d?"floating"===f?"reference":"floating":f],h=Vt(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:s,rootBoundary:a,strategy:l})),g="floating"===f?{x:r,y:o,width:u.floating.width,height:u.floating.height}:u.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},x=Vt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:g,offsetParent:y,strategy:l}):g);return{top:(h.top-x.top+v.top)/b.y,bottom:(x.bottom-h.bottom+v.bottom)/b.y,left:(h.left-x.left+v.left)/b.x,right:(x.right-h.right+v.right)/b.x}}const Yt=new Set(["left","top"]);function Gt(e){const t=Re(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=fe(e),i=o?e.offsetWidth:n,u=o?e.offsetHeight:r,c=St(n)!==i||St(r)!==u;return c&&(n=i,r=u),{width:n,height:r,$:c}}function Zt(e){return ae(e)?e:e.contextElement}function Qt(e){const t=Zt(e);if(!fe(t))return jt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Gt(t);let u=(i?St(n.width):n.width)/r,c=(i?St(n.height):n.height)/o;return u&&Number.isFinite(u)||(u=1),c&&Number.isFinite(c)||(c=1),{x:u,y:c}}const Jt=jt(0);function en(e){const t=ce(e);return we()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Jt}function tn(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=Zt(e);let u=jt(1);t&&(r?ae(r)&&(u=Qt(r)):u=Qt(e));const c=function(e,t,n){return void 0===t&&(t=!1),!!n&&t&&n===ce(e)}(i,n,r)?en(i):jt(0);let l=(o.left+c.x)/u.x,s=(o.top+c.y)/u.y,a=o.width/u.x,f=o.height/u.y;if(i&&r){const e=ce(i),t=ae(r)?ce(r):r;let n=e,o=je(n);for(;o&&t!==n;){const e=Qt(o),t=o.getBoundingClientRect(),r=Re(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,u=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,s*=e.y,a*=e.x,f*=e.y,l+=i,s+=u,n=ce(o),o=je(n)}}return Vt({width:a,height:f,x:l,y:s})}function nn(e,t){const n=Oe(e).scrollLeft;return t?t.left+n:tn(le(e)).left+n}function rn(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-nn(e,n),y:n.top+t.scrollTop}}function on(e,t,n){let r;if("viewport"===t||"layoutViewport"===t)r=function(e,t,n){void 0===n&&(n="viewport");const r="layoutViewport"===n,o=ce(e),i=le(e),u=o.visualViewport;let c=i.clientWidth,l=i.clientHeight,s=0,a=0;if(u){const e=!we()||"fixed"===t;r?e||(s=-u.offsetLeft,a=-u.offsetTop):(c=u.width,l=u.height,e&&(s=u.offsetLeft,a=u.offsetTop))}if(nn(i)<=0){const e=i.ownerDocument,t=e.body,n=getComputedStyle(t),r="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(i.clientWidth-t.clientWidth-r),u="stable both-edges"===getComputedStyle(i).scrollbarGutter?o/2:o;u<=25&&(c-=u)}return{width:c,height:l,x:s,y:a}}(e,n,t);else if("document"===t)r=function(e){const t=Oe(e),n=e.ownerDocument.body,r=Ct(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=Ct(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+nn(e);const u=-t.scrollTop;return"rtl"===Re(n).direction&&(i+=Ct(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:i,y:u}}(le(e));else if(ae(t))r=function(e,t){const n=tn(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Qt(e);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=en(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Vt(r)}function un(e,t,n){const r=fe(t),o=le(t),i="fixed"===n,u=tn(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const l=jt(0);if((r||!i)&&(("body"!==ue(t)||pe(o))&&(c=Oe(t)),r)){const e=tn(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}!r&&o&&(l.x=nn(o));const s=!o||r||i?jt(0):rn(o,c);return{x:u.left+c.scrollLeft-l.x-s.x,y:u.top+c.scrollTop-l.y-s.y,width:u.width,height:u.height}}function cn(e){return"static"===Re(e).position}function ln(e,t){if(!fe(e)||"fixed"===Re(e).position)return null;if(t)return t(e);let n=e.offsetParent;return le(e)===n&&(n=n.ownerDocument.body),n}function sn(e,t){const n=ce(e);if(me(e))return n;if(!fe(e)){let t=Ce(e);for(;t&&!Ee(t);){if(ae(t)&&!cn(t))return t;t=Ce(t)}return n}let r=ln(e,t);for(;r&&ve(r)&&cn(r);)r=ln(r,t);return r&&Ee(r)&&cn(r)&&!xe(r)?n:r||function(e){let t=Ce(e);for(;fe(t)&&!Ee(t);){if(xe(t))return t;if(me(t))return null;t=Ce(t)}return null}(e)||n}const an={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,u=le(r),c=!!t&&me(t.floating);if(r===u||c&&i)return n;let l={scrollLeft:0,scrollTop:0},s=jt(1);const a=jt(0),f=fe(r);if((f||!i)&&(("body"!==ue(r)||pe(u))&&(l=Oe(r)),f)){const e=tn(r);s=Qt(r),a.x=e.x+r.clientLeft,a.y=e.y+r.clientTop}const d=!u||f||i?jt(0):rn(u,l);return{width:n.width*s.x,height:n.height*s.y,x:n.x*s.x-l.scrollLeft*s.x+a.x+d.x,y:n.y*s.y-l.scrollTop*s.y+a.y+d.y}},getDocumentElement:le,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?me(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=_e(e,[],!1).filter(e=>ae(e)&&"body"!==ue(e)),o=null;const i="fixed"===Re(e).position;let u=i?Ce(e):e;for(;ae(u)&&!Ee(u);){const e=Re(u),t=xe(u),n=o?o.position:i?"fixed":"";t||"fixed"!==n&&("absolute"!==n||"static"!==e.position)?o=e:r=r.filter(e=>e!==u),u=Ce(u)}return t.set(e,r),r}(t,this._c):[].concat(n),r],u=on(t,i[0],o);let c=u.top,l=u.right,s=u.bottom,a=u.left;for(let e=1;e<i.length;e++){const n=on(t,i[e],o);c=Ct(n.top,c),l=Ot(n.right,l),s=Ot(n.bottom,s),a=Ct(n.left,a)}return{width:l-a,height:s-c,x:a,y:c}},getOffsetParent:sn,getElementRects:async function(e){const t=this.getOffsetParent||sn,n=this.getDimensions,r=await n(e.floating);return{reference:un(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return e.getClientRects?Array.from(e.getClientRects()):[]},getDimensions:function(e){const{width:t,height:n}=Gt(e);return{width:t,height:n}},getScale:Qt,isElement:ae,isRTL:function(e){return"rtl"===Re(e).direction}};function fn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}const dn=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:u,initialPlacement:c,platform:l,elements:s}=t,{mainAxis:a=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:m=!0,...h}=Lt(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const g=Tt(o),y=$t(c),b=Tt(c)===c,x=await(null==l.isRTL?void 0:l.isRTL(s.floating)),w=d||(b||!m?[Ut(c)]:function(e){const t=Ut(e);return[Ft(e),t,Ft(t)]}(c)),E="none"!==v;!d&&E&&w.push(...function(e,t,n,r){const o=Pt(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Ht:Wt:t?Wt:Ht;case"left":case"right":return t?zt:Bt;default:return[]}}(Tt(e),"start"===n,r);return o&&(i=i.map(e=>e+"-"+o),t&&(i=i.concat(i.map(Ft)))),i}(c,m,v,x));const R=[c,...w],O=await l.detectOverflow(t,h),C=[];let S=(null==(r=i.flip)?void 0:r.overflows)||[];if(a&&C.push(O[g]),f){const e=Nt(o,u,x);C.push(O[e[0]],O[e[1]])}if(S=[...S,{placement:o,overflows:C}],!C.every(e=>e<=0)){var _,j;const e=((null==(_=i.flip)?void 0:_.index)||0)+1,t=R[e];if(t&&("alignment"!==f||y===$t(t)||S.every(e=>$t(e.placement)!==y||e.overflows[0]>0)))return{data:{index:e,overflows:S},reset:{placement:t}};let n=null==(j=S.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:j.placement;if(!n)switch(p){case"bestFit":{var k;const e=null==(k=S.filter(e=>{if(E){const t=$t(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:k[0];e&&(n=e);break}case"initialPlacement":n=c}if(o!==n)return{reset:{placement:n}}}return{}}}},pn=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:u,elements:c,middlewareData:l}=t,{element:s,padding:a=0}=Lt(e,t)||{};if(null==s)return{};const f=Kt(a),d={x:n,y:r},p=It(o),v=Dt(p),m=await u.getDimensions(s),h="y"===p,g=h?"top":"left",y=h?"bottom":"right",b=h?"clientHeight":"clientWidth",x=i.reference[v]+i.reference[p]-d[p]-i.floating[v],w=d[p]-i.reference[p],E=await(null==u.getOffsetParent?void 0:u.getOffsetParent(s));let R=E?E[b]:0;R&&await(null==u.isElement?void 0:u.isElement(E))||(R=c.floating[b]||i.floating[v]);const O=x/2-w/2,C=R/2-m[v]/2-1,S=Ot(f[g],C),_=Ot(f[y],C),j=R-m[v]-_,k=R/2-m[v]/2+O,A=At(S,k,j),L=!l.arrow&&null!=Pt(o)&&k!==A&&i.reference[v]/2-(k<S?S:_)-m[v]/2<0,T=L?k<S?k-S:k-j:0;return{[p]:d[p]+T,data:{[p]:A,centerOffset:k-A-T,...L&&{alignmentOffset:T}},reset:L}}}),vn=(e,t,n)=>{const r=new Map,o=null!=n?n:{},i={...an,...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:u}=n,c=u.detectOverflow?u:{...u,detectOverflow:Xt},l=await(null==u.isRTL?void 0:u.isRTL(t));let s=await u.getElementRects({reference:e,floating:t,strategy:o}),{x:a,y:f}=qt(s,r,l),d=r,p=0;const v={};for(let n=0;n<i.length;n++){const m=i[n];if(!m)continue;const{name:h,fn:g}=m,{x:y,y:b,data:x,reset:w}=await g({x:a,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:v,rects:s,platform:c,elements:{reference:e,floating:t}});a=null!=y?y:a,f=null!=b?b:f,v[h]={...v[h],...x},w&&p<50&&(p++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(s=!0===w.rects?await u.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:a,y:f}=qt(s,d,l))),n=-1)}return{x:a,y:f,placement:d,strategy:o,middlewareData:v}})(e,t,{...o,platform:i})};var mn="undefined"!=typeof document?T.useLayoutEffect:function(){};function hn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!hn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!==r--;){const n=o[r];if(!("_owner"===n&&e.$$typeof||hn(e[n],t[n])))return!1}return!0}return e!=e&&t!=t}function gn(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yn(e,t){const n=gn(e);return Math.round(t*n)/n}function bn(e){const t=T.useRef(e);return mn(()=>{t.current=e}),t}const xn="data-floating-ui-focusable",wn="active",En="selected",Rn={...T};let On=!1,Cn=0;const Sn=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Cn++,_n=Rn.useId||function(){const[e,t]=T.useState(()=>On?Sn():void 0);return ft(()=>{null==e&&t(Sn())},[]),T.useEffect(()=>{On=!0},[]),e},jn=T.forwardRef(function(e,t){const{context:{placement:n,elements:{floating:r},middlewareData:{arrow:o,shift:i}},width:u=14,height:c=7,tipRadius:l=0,strokeWidth:s=0,staticOffset:a,stroke:f,d,style:{transform:p,...v}={},...h}=e,g=_n(),[y,b]=T.useState(!1);if(ft(()=>{r&&"rtl"===Re(r).direction&&b(!0)},[r]),!r)return null;const[x,w]=n.split("-"),E="top"===x||"bottom"===x;let R=a;(E&&null!=i&&i.x||!E&&null!=i&&i.y)&&(R=null);const O=2*s,C=O/2,S=u/2*(l/-8+1),_=c/2*l/4,j=!!d,k=R&&"end"===w?"bottom":"top";let A=R&&"end"===w?"right":"left";R&&y&&(A="end"===w?"left":"right");const L=null!=(null==o?void 0:o.x)?R||o.x:"",P=null!=(null==o?void 0:o.y)?R||o.y:"",M=d||"M0,0 H"+u+" L"+(u-S)+","+(c-_)+" Q"+u/2+","+c+" "+S+","+(c-_)+" Z",D={top:j?"rotate(180deg)":"",left:j?"rotate(90deg)":"rotate(-90deg)",bottom:j?"":"rotate(180deg)",right:j?"rotate(-90deg)":"rotate(90deg)"}[x];return(0,m().jsxs)("svg",{...h,"aria-hidden":!0,ref:t,width:j?u:u+O,height:u,viewBox:"0 0 "+u+" "+(c>u?c:u),style:{position:"absolute",pointerEvents:"none",[A]:L,[k]:P,[x]:E||j?"100%":"calc(100% - "+O/2+"px)",transform:[D,p].filter(e=>!!e).join(" "),...v},children:[O>0&&(0,m().jsx)("path",{clipPath:"url(#"+g+")",fill:"none",stroke:f,strokeWidth:O+(d?0:1),d:M}),(0,m().jsx)("path",{stroke:O&&!d?h.fill:"none",d:M}),(0,m().jsx)("clipPath",{id:g,children:(0,m().jsx)("rect",{x:-C,y:C*(j?-1:1),width:u+O,height:u})})]})});function kn(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;null==(r=e.get(t))||r.delete(n)}}}const An=T.createContext(null),Ln=T.createContext(null),Tn=()=>{var e;return(null==(e=T.useContext(An))?void 0:e.id)||null},Pn=()=>T.useContext(Ln);function Mn(e){const{children:t,id:n}=e,r=Tn();return(0,m().jsx)(An.Provider,{value:T.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Dn(e){const{children:t}=e,n=T.useRef([]),r=T.useCallback(e=>{n.current=[...n.current,e]},[]),o=T.useCallback(e=>{n.current=n.current.filter(t=>t!==e)},[]),[i]=T.useState(()=>kn());return(0,m().jsx)(Ln.Provider,{value:T.useMemo(()=>({nodesRef:n,addNode:r,removeNode:o,events:i}),[r,o,i]),children:t})}function $n(e){return"data-floating-ui-"+e}function In(e){-1!==e.current&&(clearTimeout(e.current),e.current=-1)}const Nn=$n("safe-polygon");function Fn(e,t,n){if(n&&!at(n))return 0;if("number"==typeof e)return e;if("function"==typeof e){const n=e();return"number"==typeof n?n:null==n?void 0:n[t]}return null==e?void 0:e[t]}function Wn(e){return"function"==typeof e?e():e}let Hn=0;function zn(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Hn);const i=()=>null==e?void 0:e.focus({preventScroll:n});o?i():Hn=requestAnimationFrame(i)}function Bn(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&de(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}const Un={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Kn(e){return"inert"===e?Un.inert:"aria-hidden"===e?Un["aria-hidden"]:Un.none}let Vn=new WeakSet,qn={},Xn=0;function Yn(e){return e?de(e)?e.host:Yn(e.parentNode):null}const Gn=(e,t)=>t.map(t=>{if(e.contains(t))return t;const n=Yn(t);return e.contains(n)?n:null}).filter(e=>null!=e);function Zn(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=(o=e[0],(null==o?void 0:o.ownerDocument)||document).body;var o;return function(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,u=Gn(t,e),c=new Set,l=new Set(u),s=[];qn[o]||(qn[o]=new WeakMap);const a=qn[o];return u.forEach(function e(t){t&&!c.has(t)&&(c.add(t),t.parentNode&&e(t.parentNode))}),function e(t){t&&!l.has(t)&&[].forEach.call(t.children,t=>{if("script"!==ue(t))if(c.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=Kn(i),u=(r.get(t)||0)+1,c=(a.get(t)||0)+1;r.set(t,u),a.set(t,c),s.push(t),1===u&&n&&Vn.add(t),1===c&&t.setAttribute(o,""),!n&&i&&t.setAttribute(i,"inert"===i?"":"true")}})}(t),c.clear(),Xn++,()=>{s.forEach(e=>{const t=Kn(i),n=(t.get(e)||0)-1,r=(a.get(e)||0)-1;t.set(e,n),a.set(e,r),n||(!Vn.has(e)&&i&&e.removeAttribute(i),Vn.delete(e)),r||e.removeAttribute(o)}),Xn--,Xn||(Un.inert=new WeakMap,Un["aria-hidden"]=new WeakMap,Un.none=new WeakMap,Vn=new WeakSet,qn={})}}(e.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))),r,t,n)}const Qn={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},Jn=T.forwardRef(function(e,t){const[n,r]=T.useState();ft(()=>{Ye()&&r("button")},[]);const o={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[$n("focus-guard")]:"",style:Qn};return(0,m().jsx)("span",{...e,...o})}),er={clipPath:"inset(50%)",position:"fixed",top:0,left:0},tr=T.createContext(null),nr=$n("portal");function rr(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,i=function(e){void 0===e&&(e={});const{id:t,root:n}=e,r=_n(),o=or(),[i,u]=T.useState(null),c=T.useRef(null);return ft(()=>()=>{null==i||i.remove(),queueMicrotask(()=>{c.current=null})},[i]),ft(()=>{if(!r)return;if(c.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=r,n.setAttribute(nr,""),e.appendChild(n),c.current=n,u(n)},[t,r]),ft(()=>{if(null===n)return;if(!r)return;if(c.current)return;let e=n||(null==o?void 0:o.portalNode);e&&!se(e)&&(e=e.current),e=e||document.body;let i=null;t&&(i=document.createElement("div"),i.id=t,e.appendChild(i));const l=document.createElement("div");l.id=r,l.setAttribute(nr,""),e=i||e,e.appendChild(l),c.current=l,u(l)},[t,n,r,o]),i}({id:n,root:r}),[u,c]=T.useState(null),l=T.useRef(null),s=T.useRef(null),a=T.useRef(null),f=T.useRef(null),d=null==u?void 0:u.modal,v=null==u?void 0:u.open,h=!!u&&!u.modal&&u.open&&o&&!(!r&&!i);return T.useEffect(()=>{if(i&&o&&!d)return i.addEventListener("focusin",e,!0),i.addEventListener("focusout",e,!0),()=>{i.removeEventListener("focusin",e,!0),i.removeEventListener("focusout",e,!0)};function e(e){i&&bt(e)&&("focusin"===e.type?wt:xt)(i)}},[i,o,d]),T.useEffect(()=>{i&&(v||wt(i))},[v,i]),(0,m().jsxs)(tr.Provider,{value:T.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:l,afterOutsideRef:s,beforeInsideRef:a,afterInsideRef:f,portalNode:i,setFocusManagerState:c}),[o,i]),children:[h&&i&&(0,m().jsx)(Jn,{"data-type":"outside",ref:l,onFocus:e=>{if(bt(e,i)){var t;null==(t=a.current)||t.focus()}else{const e=yt(u?u.domReference:null);null==e||e.focus()}}}),h&&i&&(0,m().jsx)("span",{"aria-owns":i.id,style:er}),i&&p().createPortal(t,i),h&&i&&(0,m().jsx)(Jn,{"data-type":"outside",ref:s,onFocus:e=>{if(bt(e,i)){var t;null==(t=f.current)||t.focus()}else{const t=gt(u?u.domReference:null);null==t||t.focus(),(null==u?void 0:u.closeOnFocusOut)&&(null==u||u.onOpenChange(!1,e.nativeEvent,"focus-out"))}}})]})}const or=()=>T.useContext(tr);function ir(e){return T.useMemo(()=>t=>{e.forEach(e=>{e&&(e.current=t)})},e)}let ur=[];function cr(){ur=ur.filter(e=>{var t;return null==(t=e.deref())?void 0:t.isConnected})}function lr(){cr();const e=ur[ur.length-1];return null==e?void 0:e.deref()}function sr(e,t){var n;if(!(t.current.includes("floating")||null!=(n=e.getAttribute("role"))&&n.includes("dialog")))return;const r=mt(),o=function(e,t){return(t=t||{}).getShadowRoot?De([e],t.includeContainer,{filter:He.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):Me(e,t.includeContainer,He.bind(null,t))}(e,r),i=o.filter(e=>{const t=e.getAttribute("data-tabindex")||"";return Ve(e,r)||e.hasAttribute("data-tabindex")&&!t.startsWith("-")}),u=e.getAttribute("tabindex");t.current.includes("floating")||0===i.length?"0"!==u&&e.setAttribute("tabindex","0"):("-1"!==u||e.hasAttribute("data-tabindex")&&"-1"!==e.getAttribute("data-tabindex"))&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}const ar=T.forwardRef(function(e,t){return(0,m().jsx)("button",{...e,type:"button",ref:t,tabIndex:-1,style:Qn})});function fr(e){const{context:t,children:n,disabled:r=!1,order:o=["content"],guards:i=!0,initialFocus:u=0,returnFocus:c=!0,restoreFocus:l=!1,modal:s=!0,visuallyHiddenDismiss:a=!1,closeOnFocusOut:f=!0,outsideElementsInert:d=!1,getInsideElements:p=()=>[]}=e,{open:v,onOpenChange:h,events:g,dataRef:y,elements:{domReference:b,floating:x}}=t,w=vt(()=>{var e;return null==(e=y.current.floatingContext)?void 0:e.nodeId}),E=vt(p),R="number"==typeof u&&u<0,O=it(b)&&R,C="undefined"!=typeof HTMLElement&&"inert"in HTMLElement.prototype,S=!C||i,_=!S||C&&d,j=dt(o),k=dt(u),A=dt(c),L=Pn(),P=or(),M=T.useRef(null),D=T.useRef(null),$=T.useRef(!1),I=T.useRef(!1),N=T.useRef(-1),F=T.useRef(-1),W=null!=P,H=ut(x),z=vt(function(e){return void 0===e&&(e=H),e?Ke(e,mt()):[]}),B=vt(e=>{const t=z(e);return j.current.map(e=>b&&"reference"===e?b:H&&"floating"===e?H:t).filter(Boolean).flat()});T.useEffect(()=>{if(r)return;if(!s)return;function e(e){if("Tab"===e.key){et(H,Je(rt(H)))&&0===z().length&&!O&&st(e);const t=B(),n=tt(e);"reference"===j.current[0]&&n===b&&(st(e),e.shiftKey?zn(t[t.length-1]):zn(t[1])),"floating"===j.current[1]&&n===H&&e.shiftKey&&(st(e),zn(t[0]))}}const t=rt(H);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[r,b,H,s,j,O,z,B]),T.useEffect(()=>{if(!r&&x)return x.addEventListener("focusin",e),()=>{x.removeEventListener("focusin",e)};function e(e){const t=tt(e),n=z().indexOf(t);-1!==n&&(N.current=n)}},[r,x,z]),T.useEffect(()=>{if(r)return;if(!f)return;function e(){I.current=!0,setTimeout(()=>{I.current=!1})}function t(e){const t=e.relatedTarget,n=e.currentTarget,r=tt(e);queueMicrotask(()=>{const o=w(),i=!(et(b,t)||et(x,t)||et(t,x)||et(null==P?void 0:P.portalNode,t)||null!=t&&t.hasAttribute($n("focus-guard"))||L&&(ct(L.nodesRef.current,o).find(e=>{var n,r;return et(null==(n=e.context)?void 0:n.elements.floating,t)||et(null==(r=e.context)?void 0:r.elements.domReference,t)})||lt(L.nodesRef.current,o).find(e=>{var n,r,o;return[null==(n=e.context)?void 0:n.elements.floating,ut(null==(r=e.context)?void 0:r.elements.floating)].includes(t)||(null==(o=e.context)?void 0:o.elements.domReference)===t})));if(n===b&&H&&sr(H,j),l&&n!==b&&(null==r||!r.isConnected)&&Je(rt(H))===rt(H).body){fe(H)&&H.focus();const e=N.current,t=z(),n=t[e]||t[t.length-1]||H;fe(n)&&n.focus()}y.current.insideReactTree?y.current.insideReactTree=!1:!O&&s||!t||!i||I.current||t===lr()||($.current=!0,h(!1,e,"focus-out"))})}const n=Boolean(!L&&P);function o(){In(F),y.current.insideReactTree=!0,F.current=window.setTimeout(()=>{y.current.insideReactTree=!1})}return x&&fe(b)?(b.addEventListener("focusout",t),b.addEventListener("pointerdown",e),x.addEventListener("focusout",t),n&&x.addEventListener("focusout",o,!0),()=>{b.removeEventListener("focusout",t),b.removeEventListener("pointerdown",e),x.removeEventListener("focusout",t),n&&x.removeEventListener("focusout",o,!0)}):void 0},[r,b,x,H,s,L,P,h,f,l,z,O,w,j,y]);const U=T.useRef(null),K=T.useRef(null),V=ir([U,null==P?void 0:P.beforeInsideRef]),q=ir([K,null==P?void 0:P.afterInsideRef]);function X(e){return!r&&a&&s?(0,m().jsx)(ar,{ref:"start"===e?M:D,onClick:e=>h(!1,e.nativeEvent),children:"string"==typeof a?a:"Dismiss"}):null}T.useEffect(()=>{var e,t;if(r)return;if(!x)return;const n=Array.from((null==P||null==(e=P.portalNode)?void 0:e.querySelectorAll("["+$n("portal")+"]"))||[]),o=null==(t=(L?lt(L.nodesRef.current,w()):[]).find(e=>{var t;return it((null==(t=e.context)?void 0:t.elements.domReference)||null)}))||null==(t=t.context)?void 0:t.elements.domReference,i=[x,o,...n,...E(),M.current,D.current,U.current,K.current,null==P?void 0:P.beforeOutsideRef.current,null==P?void 0:P.afterOutsideRef.current,j.current.includes("reference")||O?b:null].filter(e=>null!=e),u=s||O?Zn(i,!_,_):Zn(i);return()=>{u()}},[r,b,x,s,j,P,O,S,_,L,w,E]),ft(()=>{if(r||!fe(H))return;const e=Je(rt(H));queueMicrotask(()=>{const t=B(H),n=k.current,r=("number"==typeof n?t[n]:n.current)||H,o=et(H,e);R||o||!v||zn(r,{preventScroll:r===H})})},[r,v,H,R,B,k]),ft(()=>{if(r||!H)return;const e=rt(H);var t;function n(e){let{reason:t,event:n,nested:r}=e;if(["hover","safe-polygon"].includes(t)&&"mouseleave"===n.type&&($.current=!0),"outside-press"===t)if(r)$.current=!1;else if(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(Ge()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(n)||function(e){return!Ze()&&(!Ge()&&0===e.width&&0===e.height||Ge()&&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&&"touch"===e.pointerType)}(n))$.current=!1;else{let e=!1;document.createElement("div").focus({get preventScroll(){return e=!0,!1}}),$.current=!e}}t=Je(e),cr(),t&&"body"!==ue(t)&&(ur.push(new WeakRef(t)),ur.length>20&&(ur=ur.slice(-20))),g.on("openchange",n);const o=e.createElement("span");return o.setAttribute("tabindex","-1"),o.setAttribute("aria-hidden","true"),Object.assign(o.style,Qn),W&&b&&b.insertAdjacentElement("afterend",o),()=>{g.off("openchange",n);const t=Je(e),r=et(x,t)||L&&ct(L.nodesRef.current,w(),!1).some(e=>{var n;return et(null==(n=e.context)?void 0:n.elements.floating,t)}),i=function(){if("boolean"==typeof A.current){const e=b||lr();return e&&e.isConnected?e:o}return A.current.current||o}();queueMicrotask(()=>{const n=function(e){const t=mt();return Ve(e,t)?e:Ke(e,t)[0]||e}(i);A.current&&!$.current&&fe(n)&&(n===t||t===e.body||r)&&n.focus({preventScroll:!0}),o.remove()})}},[r,x,H,A,y,g,L,W,b,w]),T.useEffect(()=>(queueMicrotask(()=>{$.current=!1}),()=>{queueMicrotask(cr)}),[r]),ft(()=>{if(!r&&P)return P.setFocusManagerState({modal:s,closeOnFocusOut:f,open:v,onOpenChange:h,domReference:b}),()=>{P.setFocusManagerState(null)}},[r,P,s,v,h,f,b]),ft(()=>{r||H&&sr(H,j)},[r,H,j]);const Y=!r&&S&&(!s||!O)&&(W||s);return(0,m().jsxs)(m().Fragment,{children:[Y&&(0,m().jsx)(Jn,{"data-type":"inside",ref:V,onFocus:e=>{if(s){const e=B();zn("reference"===o[0]?e[0]:e[e.length-1])}else if(null!=P&&P.preserveTabOrder&&P.portalNode)if($.current=!1,bt(e,P.portalNode)){const e=gt(b);null==e||e.focus()}else{var t;null==(t=P.beforeOutsideRef.current)||t.focus()}}}),!O&&X("start"),n,X("end"),Y&&(0,m().jsx)(Jn,{"data-type":"inside",ref:q,onFocus:e=>{if(s)zn(B()[0]);else if(null!=P&&P.preserveTabOrder&&P.portalNode)if(f&&($.current=!0),bt(e,P.portalNode)){const e=yt(b);null==e||e.focus()}else{var t;null==(t=P.afterOutsideRef.current)||t.focus()}}})]})}function dr(e){return fe(e.target)&&"BUTTON"===e.target.tagName}function pr(e){return ot(e)}function vr(e){return null!=e&&null!=e.clientX}const mr={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},hr={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},gr=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};function yr(){return qe().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints&&Ye()}function br(e,t,n){const r=new Map,o="item"===n;let i=e;if(o&&e){const{[wn]:t,[En]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1,[xn]:""},...i,...t.map(t=>{const r=t?t[n]:null;return"function"==typeof r?e?r(e):null:r}).concat(e).reduce((e,t)=>t?(Object.entries(t).forEach(t=>{let[n,i]=t;var u;o&&[wn,En].includes(n)||(0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof i&&(null==(u=r.get(n))||u.push(i),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];return null==(e=r.get(n))?void 0:e.map(e=>e(...o)).find(e=>void 0!==e)})):e[n]=i)}),e):e,{})}}const xr=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]),wr=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase());function Er(e,t){return"function"==typeof e?e(t):e}function Rr(e,t,n){return void 0===n&&(n=!0),e.filter(e=>{var r;return e.parentId===t&&(!n||(null==(r=e.context)?void 0:r.open))}).flatMap(t=>[t,...Rr(e,t.id,n)])}function Or(e,t){const[n,r]=e;let o=!1;const i=t.length;for(let e=0,u=i-1;e<i;u=e++){const[i,c]=t[e]||[0,0],[l,s]=t[u]||[0,0];c>=r!=s>=r&&n<=(l-i)*(r-c)/(s-c)+i&&(o=!o)}return o}function Cr(e){void 0===e&&(e={});const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,o={current:-1};let i=!1,u=null,c=null,l="undefined"!=typeof performance?performance.now():0;const s=e=>{let{x:n,y:s,placement:a,elements:f,onClose:d,nodeId:p,tree:v}=e;return function(e){function m(){In(o),d()}if(In(o),!f.domReference||!f.floating||null==a||null==n||null==s)return;const{clientX:h,clientY:g}=e,y=[h,g],b=function(e){return"composedPath"in e?e.composedPath()[0]:e.target}(e),x="mouseleave"===e.type,w=Bn(f.floating,b),E=Bn(f.domReference,b),R=f.domReference.getBoundingClientRect(),O=f.floating.getBoundingClientRect(),C=a.split("-")[0],S=n>O.right-O.width/2,_=s>O.bottom-O.height/2,j=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,R),k=O.width>R.width,A=O.height>R.height,L=(k?R:O).left,T=(k?R:O).right,P=(A?R:O).top,M=(A?R:O).bottom;if(w&&(i=!0,!x))return;if(E&&(i=!1),E&&!x)return void(i=!0);if(x&&ae(e.relatedTarget)&&Bn(f.floating,e.relatedTarget))return;if(v&&Rr(v.nodesRef.current,p).length)return;if("top"===C&&s>=R.bottom-1||"bottom"===C&&s<=R.top+1||"left"===C&&n>=R.right-1||"right"===C&&n<=R.left+1)return m();let D=[];switch(C){case"top":D=[[L,R.top+1],[L,O.bottom-1],[T,O.bottom-1],[T,R.top+1]];break;case"bottom":D=[[L,O.top+1],[L,R.bottom-1],[T,R.bottom-1],[T,O.top+1]];break;case"left":D=[[O.right-1,M],[O.right-1,P],[R.left+1,P],[R.left+1,M]];break;case"right":D=[[R.right-1,M],[R.right-1,P],[O.left+1,P],[O.left+1,M]]}if(!Or([h,g],D)){if(i&&!j)return m();if(!x&&r){const t=function(e,t){const n=performance.now(),r=n-l;if(null===u||null===c||0===r)return u=e,c=t,l=n,null;const o=e-u,i=t-c,s=Math.sqrt(o*o+i*i);return u=e,c=t,l=n,s/r}(e.clientX,e.clientY);if(null!==t&&t<.1)return m()}Or([h,g],function(e){let[n,r]=e;switch(C){case"top":return[[k?n+t/2:S?n+4*t:n-4*t,r+t+1],[k?n-t/2:S?n+4*t:n-4*t,r+t+1],[O.left,S||k?O.bottom-t:O.top],[O.right,S?k?O.bottom-t:O.top:O.bottom-t]];case"bottom":return[[k?n+t/2:S?n+4*t:n-4*t,r-t],[k?n-t/2:S?n+4*t:n-4*t,r-t],[O.left,S||k?O.top+t:O.bottom],[O.right,S?k?O.top+t:O.bottom:O.top+t]];case"left":{const e=[n+t+1,A?r+t/2:_?r+4*t:r-4*t],o=[n+t+1,A?r-t/2:_?r+4*t:r-4*t];return[[_||A?O.right-t:O.left,O.top],[_?A?O.right-t:O.left:O.right-t,O.bottom],e,o]}case"right":return[[n-t,A?r+t/2:_?r+4*t:r-4*t],[n-t,A?r-t/2:_?r+4*t:r-4*t],[_||A?O.left+t:O.right,O.top],[_?A?O.left+t:O.right:O.left+t,O.bottom]]}}([n,s]))?!i&&r&&(o.current=window.setTimeout(m,40)):m()}}};return s.__options={blockPointerEvents:n},s}const Sr=({children:e,enabled:t=!0,...n})=>{const r=Tn();return!t||r?e:(0,m().jsx)(Dn,{...n,children:e})},_r=l(L,({$width:e="max-content"})=>({$width:e}))``,jr=({children:e,enabled:t=!0,...n})=>t?(0,m().jsx)(rr,{...n,children:e}):e,kr=(e,{enabled:t=!0,event:n="click",dismissOptions:r,clickOptions:o,hoverOptions:i,focusOptions:u,clientPointsOptions:c,roleOptions:l,extraInteractions:s=[]})=>{const a=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=e,{enabled:u=!0,escapeKey:c=!0,outsidePress:l=!0,outsidePressEvent:s="pointerdown",referencePress:a=!1,referencePressEvent:f="pointerdown",ancestorScroll:d=!1,bubbles:p,capture:v}=t,m=Pn(),h=vt("function"==typeof l?l:()=>!1),g="function"==typeof l?h:l,y=T.useRef(!1),{escapeKey:b,outsidePress:x}=gr(p),{escapeKey:w,outsidePress:E}=gr(v),R=T.useRef(!1),O=vt(e=>{var t;if(!n||!u||!c||"Escape"!==e.key)return;if(R.current)return;const o=null==(t=i.current.floatingContext)?void 0:t.nodeId,l=m?ct(m.nodesRef.current,o):[];if(!b&&(e.stopPropagation(),l.length>0)){let e=!0;if(l.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)}),!e)return}r(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")}),C=vt(e=>{var t;const n=()=>{var t;O(e),null==(t=tt(e))||t.removeEventListener("keydown",n)};null==(t=tt(e))||t.addEventListener("keydown",n)}),S=vt(e=>{var t;const n=i.current.insideReactTree;i.current.insideReactTree=!1;const u=y.current;if(y.current=!1,"click"===s&&u)return;if(n)return;if("function"==typeof g&&!g(e))return;const c=tt(e),l="["+$n("inert")+"]",a=rt(o.floating).querySelectorAll(l);let f=ae(c)?c:null;for(;f&&!Ee(f);){const e=Ce(f);if(Ee(e)||!ae(e))break;f=e}if(a.length&&ae(c)&&!c.matches("html,body")&&!et(c,o.floating)&&Array.from(a).every(e=>!et(f,e)))return;if(fe(c)&&k){const t=Ee(c),n=Re(c),r=/auto|scroll/,o=t||r.test(n.overflowX),i=t||r.test(n.overflowY),u=o&&c.clientWidth>0&&c.scrollWidth>c.clientWidth,l=i&&c.clientHeight>0&&c.scrollHeight>c.clientHeight,s="rtl"===n.direction,a=l&&(s?e.offsetX<=c.offsetWidth-c.clientWidth:e.offsetX>c.clientWidth),f=u&&e.offsetY>c.clientHeight;if(a||f)return}const d=null==(t=i.current.floatingContext)?void 0:t.nodeId,p=m&&ct(m.nodesRef.current,d).some(t=>{var n;return nt(e,null==(n=t.context)?void 0:n.elements.floating)});if(nt(e,o.floating)||nt(e,o.domReference)||p)return;const v=m?ct(m.nodesRef.current,d):[];if(v.length>0){let e=!0;if(v.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)}),!e)return}r(!1,e,"outside-press")}),_=vt(e=>{var t;const n=()=>{var t;S(e),null==(t=tt(e))||t.removeEventListener(s,n)};null==(t=tt(e))||t.addEventListener(s,n)});T.useEffect(()=>{if(!n||!u)return;i.current.__escapeKeyBubbles=b,i.current.__outsidePressBubbles=x;let e=-1;function t(e){r(!1,e,"ancestor-scroll")}function l(){window.clearTimeout(e),R.current=!0}function a(){e=window.setTimeout(()=>{R.current=!1},we()?5:0)}const f=rt(o.floating);c&&(f.addEventListener("keydown",w?C:O,w),f.addEventListener("compositionstart",l),f.addEventListener("compositionend",a)),g&&f.addEventListener(s,E?_:S,E);let p=[];return d&&(ae(o.domReference)&&(p=_e(o.domReference)),ae(o.floating)&&(p=p.concat(_e(o.floating))),!ae(o.reference)&&o.reference&&o.reference.contextElement&&(p=p.concat(_e(o.reference.contextElement)))),p=p.filter(e=>{var t;return e!==(null==(t=f.defaultView)?void 0:t.visualViewport)}),p.forEach(e=>{e.addEventListener("scroll",t)}),()=>{c&&(f.removeEventListener("keydown",w?C:O,w),f.removeEventListener("compositionstart",l),f.removeEventListener("compositionend",a)),g&&f.removeEventListener(s,E?_:S,E),p.forEach(e=>{e.removeEventListener("scroll",t)}),window.clearTimeout(e)}},[i,o,c,g,s,n,r,d,u,b,x,O,w,C,S,E,_]),T.useEffect(()=>{i.current.insideReactTree=!1},[i,g,s]);const j=T.useMemo(()=>({onKeyDown:O,...a&&{[mr[f]]:e=>{r(!1,e.nativeEvent,"reference-press")},..."click"!==f&&{onClick(e){r(!1,e.nativeEvent,"reference-press")}}}}),[O,r,a,f]),k=T.useMemo(()=>{function e(e){0===e.button&&(y.current=!0)}return{onKeyDown:O,onMouseDown:e,onMouseUp:e,[hr[s]]:()=>{i.current.insideReactTree=!0}}},[O,s,i]);return T.useMemo(()=>u?{reference:j,floating:k}:{},[u,j,k])}(e,{escapeKey:!1,...r}),f=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:i}}=e,{enabled:u=!0,event:c="click",toggle:l=!0,ignoreMouse:s=!1,keyboardHandlers:a=!0,stickIfOpen:f=!0}=t,d=T.useRef(),p=T.useRef(!1),v=T.useMemo(()=>({onPointerDown(e){d.current=e.pointerType},onMouseDown(e){const t=d.current;0===e.button&&"click"!==c&&(at(t,!0)&&s||(!n||!l||o.current.openEvent&&f&&"mousedown"!==o.current.openEvent.type?(e.preventDefault(),r(!0,e.nativeEvent,"click")):r(!1,e.nativeEvent,"click")))},onClick(e){const t=d.current;"mousedown"===c&&d.current?d.current=void 0:at(t,!0)&&s||(!n||!l||o.current.openEvent&&f&&"click"!==o.current.openEvent.type?r(!0,e.nativeEvent,"click"):r(!1,e.nativeEvent,"click"))},onKeyDown(e){d.current=void 0,e.defaultPrevented||!a||dr(e)||(" "!==e.key||pr(i)||(e.preventDefault(),p.current=!0),function(e){return fe(e.target)&&"A"===e.target.tagName}(e)||"Enter"===e.key&&r(!n||!l,e.nativeEvent,"click"))},onKeyUp(e){e.defaultPrevented||!a||dr(e)||pr(i)||" "===e.key&&p.current&&(p.current=!1,r(!n||!l,e.nativeEvent,"click"))}}),[o,i,c,s,a,r,n,f,l]);return T.useMemo(()=>u?{reference:v}:{},[u,v])}(e,{enabled:t&&"click"===n,...o}),d=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:u}=e,{enabled:c=!0,delay:l=0,handleClose:s=null,mouseOnly:a=!1,restMs:f=0,move:d=!0}=t,p=Pn(),v=Tn(),m=dt(s),h=dt(l),g=dt(n),y=dt(f),b=T.useRef(),x=T.useRef(-1),w=T.useRef(),E=T.useRef(-1),R=T.useRef(!0),O=T.useRef(!1),C=T.useRef(()=>{}),S=T.useRef(!1),_=vt(()=>{var e;const t=null==(e=o.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t});T.useEffect(()=>{if(c)return i.on("openchange",e),()=>{i.off("openchange",e)};function e(e){let{open:t}=e;t||(In(x),In(E),R.current=!0,S.current=!1)}},[c,i]),T.useEffect(()=>{if(!c)return;if(!m.current)return;if(!n)return;function e(e){_()&&r(!1,e,"hover")}const t=rt(u.floating).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}},[u.floating,n,r,c,m,_]);const j=T.useCallback(function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const o=Fn(h.current,"close",b.current);o&&!w.current?(In(x),x.current=window.setTimeout(()=>r(!1,e,n),o)):t&&(In(x),r(!1,e,n))},[h,r]),k=vt(()=>{C.current(),w.current=void 0}),A=vt(()=>{if(O.current){const e=rt(u.floating).body;e.style.pointerEvents="",e.removeAttribute(Nn),O.current=!1}}),L=vt(()=>!!o.current.openEvent&&["click","mousedown"].includes(o.current.openEvent.type));T.useEffect(()=>{if(c&&ae(u.domReference)){const r=u.domReference,o=u.floating;return n&&r.addEventListener("mouseleave",i),d&&r.addEventListener("mousemove",e,{once:!0}),r.addEventListener("mouseenter",e),r.addEventListener("mouseleave",t),o&&(o.addEventListener("mouseleave",i),o.addEventListener("mouseenter",l),o.addEventListener("mouseleave",s)),()=>{n&&r.removeEventListener("mouseleave",i),d&&r.removeEventListener("mousemove",e),r.removeEventListener("mouseenter",e),r.removeEventListener("mouseleave",t),o&&(o.removeEventListener("mouseleave",i),o.removeEventListener("mouseenter",l),o.removeEventListener("mouseleave",s))}}function e(e){if(In(x),R.current=!1,a&&!at(b.current)||Wn(y.current)>0&&!Fn(h.current,"open"))return;const t=Fn(h.current,"open",b.current);t?x.current=window.setTimeout(()=>{g.current||r(!0,e,"hover")},t):n||r(!0,e,"hover")}function t(e){if(L())return void A();C.current();const t=rt(u.floating);if(In(E),S.current=!1,m.current&&o.current.floatingContext){n||In(x),w.current=m.current({...o.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){A(),k(),L()||j(e,!0,"safe-polygon")}});const r=w.current;return t.addEventListener("mousemove",r),void(C.current=()=>{t.removeEventListener("mousemove",r)})}("touch"!==b.current||!et(u.floating,e.relatedTarget))&&j(e)}function i(e){L()||o.current.floatingContext&&(null==m.current||m.current({...o.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){A(),k(),L()||j(e)}})(e))}function l(){In(x)}function s(e){L()||j(e,!1)}},[u,c,e,a,d,j,k,A,r,n,g,p,h,m,o,L,y]),ft(()=>{var e;if(c&&n&&null!=(e=m.current)&&null!=(e=e.__options)&&e.blockPointerEvents&&_()){O.current=!0;const e=u.floating;if(ae(u.domReference)&&e){var t;const n=rt(u.floating).body;n.setAttribute(Nn,"");const r=u.domReference,o=null==p||null==(t=p.nodesRef.current.find(e=>e.id===v))||null==(t=t.context)?void 0:t.elements.floating;return o&&(o.style.pointerEvents=""),n.style.pointerEvents="none",r.style.pointerEvents="auto",e.style.pointerEvents="auto",()=>{n.style.pointerEvents="",r.style.pointerEvents="",e.style.pointerEvents=""}}}},[c,n,v,u,p,m,_]),ft(()=>{n||(b.current=void 0,S.current=!1,k(),A())},[n,k,A]),T.useEffect(()=>()=>{k(),In(x),In(E),A()},[c,u.domReference,k,A]);const P=T.useMemo(()=>{function e(e){b.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){const{nativeEvent:t}=e;function o(){R.current||g.current||r(!0,t,"hover")}a&&!at(b.current)||n||0===Wn(y.current)||S.current&&e.movementX**2+e.movementY**2<2||(In(E),"touch"===b.current?o():(S.current=!0,E.current=window.setTimeout(o,Wn(y.current))))}}},[a,r,n,g,y]);return T.useMemo(()=>c?{reference:P}:{},[c,P])}(e,{restMs:150,enabled:t&&"hover"===n,handleClose:Cr(),...i}),p=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:i,elements:u}=e,{enabled:c=!0,visibleOnly:l=!0}=t,s=T.useRef(!1),a=T.useRef(-1),f=T.useRef(!0);T.useEffect(()=>{if(!c)return;const e=ce(u.domReference);function t(){!n&&fe(u.domReference)&&u.domReference===Je(rt(u.domReference))&&(s.current=!0)}function r(){f.current=!0}function o(){f.current=!1}return e.addEventListener("blur",t),yr()&&(e.addEventListener("keydown",r,!0),e.addEventListener("pointerdown",o,!0)),()=>{e.removeEventListener("blur",t),yr()&&(e.removeEventListener("keydown",r,!0),e.removeEventListener("pointerdown",o,!0))}},[u.domReference,n,c]),T.useEffect(()=>{if(c)return o.on("openchange",e),()=>{o.off("openchange",e)};function e(e){let{reason:t}=e;"reference-press"!==t&&"escape-key"!==t||(s.current=!0)}},[o,c]),T.useEffect(()=>()=>{In(a)},[]);const d=T.useMemo(()=>({onMouseLeave(){s.current=!1},onFocus(e){if(s.current)return;const t=tt(e.nativeEvent);if(l&&ae(t))if(yr()&&!e.relatedTarget){if(!f.current&&!ot(t))return}else if(!function(e){if(!e||Ze())return!0;try{return e.matches(":focus-visible")}catch(e){return!0}}(t))return;r(!0,e.nativeEvent,"focus")},onBlur(e){s.current=!1;const t=e.relatedTarget,n=e.nativeEvent,o=ae(t)&&t.hasAttribute($n("focus-guard"))&&"outside"===t.getAttribute("data-type");a.current=window.setTimeout(()=>{var e;const c=Je(u.domReference?u.domReference.ownerDocument:document);(t||c!==u.domReference)&&(et(null==(e=i.current.floatingContext)?void 0:e.refs.floating.current,c)||et(u.domReference,c)||o||r(!1,n,"focus"))})}}),[i,u.domReference,r,l]);return T.useMemo(()=>c?{reference:d}:{},[c,d])}(e,{enabled:t&&"focus"===n,...u}),v=function(e,t){void 0===t&&(t={});const{open:n,dataRef:r,elements:{floating:o,domReference:i},refs:u}=e,{enabled:c=!0,axis:l="both",x:s=null,y:a=null}=t,f=T.useRef(!1),d=T.useRef(null),[p,v]=T.useState(),[m,h]=T.useState([]),g=vt((e,t)=>{f.current||r.current.openEvent&&!vr(r.current.openEvent)||u.setPositionReference(function(e,t){let n=null,r=null,o=!1;return{contextElement:e||void 0,getBoundingClientRect(){var i;const u=(null==e?void 0:e.getBoundingClientRect())||{width:0,height:0,x:0,y:0},c="x"===t.axis||"both"===t.axis,l="y"===t.axis||"both"===t.axis,s=["mouseenter","mousemove"].includes((null==(i=t.dataRef.current.openEvent)?void 0:i.type)||"")&&"touch"!==t.pointerType;let a=u.width,f=u.height,d=u.x,p=u.y;return null==n&&t.x&&c&&(n=u.x-t.x),null==r&&t.y&&l&&(r=u.y-t.y),d-=n||0,p-=r||0,a=0,f=0,!o||s?(a="y"===t.axis?u.width:0,f="x"===t.axis?u.height:0,d=c&&null!=t.x?t.x:d,p=l&&null!=t.y?t.y:p):o&&!s&&(f="x"===t.axis?u.height:f,a="y"===t.axis?u.width:a),o=!0,{width:a,height:f,x:d,y:p,top:p,right:d+a,bottom:p+f,left:d}}}}(i,{x:e,y:t,axis:l,dataRef:r,pointerType:p}))}),y=vt(e=>{null==s&&null==a&&(n?d.current||h([]):g(e.clientX,e.clientY))}),b=at(p)?o:n,x=T.useCallback(()=>{if(!b||!c||null!=s||null!=a)return;const e=ce(o);function t(n){const r=tt(n);et(o,r)?(e.removeEventListener("mousemove",t),d.current=null):g(n.clientX,n.clientY)}if(!r.current.openEvent||vr(r.current.openEvent)){e.addEventListener("mousemove",t);const n=()=>{e.removeEventListener("mousemove",t),d.current=null};return d.current=n,n}u.setPositionReference(i)},[b,c,s,a,o,r,u,i,g]);T.useEffect(()=>x(),[x,m]),T.useEffect(()=>{c&&!o&&(f.current=!1)},[c,o]),T.useEffect(()=>{!c&&n&&(f.current=!0)},[c,n]),ft(()=>{!c||null==s&&null==a||(f.current=!1,g(s,a))},[c,s,a,g]);const w=T.useMemo(()=>{function e(e){let{pointerType:t}=e;v(t)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:y,onMouseEnter:y}},[y]);return T.useMemo(()=>c?{reference:w}:{},[c,w])}(e,{enabled:t&&"point"===n,...c}),m=function(e,t){var n,r;void 0===t&&(t={});const{open:o,elements:i,floatingId:u}=e,{enabled:c=!0,role:l="dialog"}=t,s=_n(),a=(null==(n=i.domReference)?void 0:n.id)||s,f=T.useMemo(()=>{var e;return(null==(e=ut(i.floating))?void 0:e.id)||u},[i.floating,u]),d=null!=(r=xr.get(l))?r:l,p=null!=Tn(),v=T.useMemo(()=>"tooltip"===d||"label"===l?{["aria-"+("label"===l?"labelledby":"describedby")]:o?f:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":"alertdialog"===d?"dialog":d,"aria-controls":o?f:void 0,..."listbox"===d&&{role:"combobox"},..."menu"===d&&{id:a},..."menu"===d&&p&&{role:"menuitem"},..."select"===l&&{"aria-autocomplete":"none"},..."combobox"===l&&{"aria-autocomplete":"list"}},[d,f,p,o,a,l]),m=T.useMemo(()=>{const e={id:f,...d&&{role:d}};return"tooltip"===d||"label"===l?e:{...e,..."menu"===d&&{"aria-labelledby":a}}},[d,f,a,l]),h=T.useCallback(e=>{let{active:t,selected:n}=e;const r={role:"option",...t&&{id:f+"-fui-option"}};switch(l){case"select":case"combobox":return{...r,"aria-selected":n}}return{}},[f,l]);return T.useMemo(()=>c?{reference:v,floating:m,item:h}:{},[c,v,m,h])}(e,l);return function(e){void 0===e&&(e=[]);const t=e.map(e=>null==e?void 0:e.reference),n=e.map(e=>null==e?void 0:e.floating),r=e.map(e=>null==e?void 0:e.item),o=T.useCallback(t=>br(t,e,"reference"),t),i=T.useCallback(t=>br(t,e,"floating"),n),u=T.useCallback(t=>br(t,e,"item"),r);return T.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:u}),[o,i,u])}([a,f,d,p,v,m,...s])},Ar=({enabled:e=!0,event:t,dismissOptions:n,clickOptions:r,hoverOptions:o,focusOptions:i,clientPointsOptions:u,roleOptions:c,extraInteractions:l,open:s,floatingOptions:a,useOffset:f=!0,offsetOptions:d,useFlip:v=!0,flipOptions:m,useShift:h=!0,shiftOptions:g,useArrow:y=!1,arrowOptions:x,transitionOptions:w,useAutoPlacement:E=!1,autoPlacementOptions:R,useAutoUpdate:O=!1,autoUpdateOptions:C,useAutoSize:S=!1,sizeOptions:_,minAcceptableWidth:j=null,minAcceptableHeight:k=null,maxAcceptableWidth:A,maxAcceptableHeight:L,onOpen:P,onClose:M})=>{const{theme:D}=J(),$=function(){const e=_n(),t=Pn(),n=Tn();return ft(()=>{if(!e)return;const r={id:e,parentId:n};return null==t||t.addNode(r),()=>{null==t||t.removeNode(r)}},[t,e,n]),e}(),[I,N]=(0,T.useState)(!1),F=(0,T.useRef)(null),W=e&&(s??I);(0,T.useEffect)(()=>{W&&P?.()},[W]),((e,t)=>{const n=(0,T.useRef)(e);(0,T.useEffect)(()=>{if(n.current!==e)return n.current=e,t(e)},[e])})(e,e=>{e||N(!1)});const H=[];f&&H.push((e=>{const t=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:u,middlewareData:c}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),u=Tt(n),c=Pt(n),l="y"===$t(n),s=Yt.has(u)?-1:1,a=i&&l?-1:1,f=Lt(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:v}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&"number"==typeof v&&(p="end"===c?-1*v:v),l?{x:p*a,y:d*s}:{x:d*s,y:p*a}}(t,e);return u===(null==(n=c.offset)?void 0:n.placement)&&null!=(r=c.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:u}}}}}(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})(d??D.spacings.base));let z=null;if(E?H.push((e=>{const t=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,o;const{rects:i,middlewareData:u,placement:c,platform:l,elements:s}=t,{crossAxis:a=!1,alignment:f,allowedPlacements:d=Rt,autoAlignment:p=!0,...v}=Lt(e,t),m=void 0!==f||d===Rt?function(e,t,n){return(e?[...n.filter(t=>Pt(t)===e),...n.filter(t=>Pt(t)!==e)]:n.filter(e=>Tt(e)===e)).filter(n=>!e||Pt(n)===e||!!t&&Ft(n)!==n)}(f||null,p,d):d,h=(null==(n=u.autoPlacement)?void 0:n.index)||0,g=m[h];if(null==g)return{};if(c!==g)return{reset:{placement:m[0]}};const y=await l.detectOverflow(t,v),b=Nt(g,i,await(null==l.isRTL?void 0:l.isRTL(s.floating))),x=[y[Tt(g)],y[b[0]],y[b[1]]],w=[...(null==(r=u.autoPlacement)?void 0:r.overflows)||[],{placement:g,overflows:x}],E=m[h+1];if(E)return{data:{index:h+1,overflows:w},reset:{placement:E}};const R=w.map(e=>{const t=Pt(e.placement);return[e.placement,t&&a?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),O=(null==(o=R.filter(e=>e[2].slice(0,Pt(e[0])?2:3).every(e=>e<=0))[0])?void 0:o[0])||R[0][0];return O!==c?{data:{index:h+1,overflows:w},reset:{placement:O}}:{}}}}(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})(R)):v&&(z=(e=>{const t=dn(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})({crossAxis:!1,fallbackStrategy:"bestFit",...m})),S){const e=(e=>{const t=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:u=()=>{},...c}=Lt(e,t),l=await o.detectOverflow(t,c),s=Tt(n),a=Pt(n),f="y"===$t(n),{width:d,height:p}=r.floating;let v,m;"top"===s||"bottom"===s?(v=s,m=a===(await(null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(m=s,v="end"===a?"top":"bottom");const h=p-l.top-l.bottom,g=d-l.left-l.right,y=Ot(p-l[v],h),b=Ot(d-l[m],g),x=t.middlewareData.shift,w=!x;let E=y,R=b;null!=x&&x.enabled.x&&(R=g),null!=x&&x.enabled.y&&(E=h),w&&!a&&(f?R=d-2*Ct(l.left,l.right):E=p-2*Ct(l.top,l.bottom)),await u({...t,availableWidth:R,availableHeight:E});const O=await o.getDimensions(i.floating);return d!==O.width||p!==O.height?{reset:{rects:!0}}:{}}}}(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})({..._,apply({elements:e,rects:t,availableWidth:n,availableHeight:r}){const o=b(j)?j(t.reference):j??t.reference.width,i=b(A)?A(t.reference):Math.min(n,A??1/0),u=b(k)?k(t.reference):k??0,c=b(L)?L(t.reference):Math.min(r,L??1/0);Object.assign(e.floating.style,{minWidth:`${Math.min(o,i)}px`,maxWidth:`${i}px`,minHeight:`${Math.min(u,c)}px`,maxHeight:`${c}px`})}});z?"initialPlacement"===m?.fallbackStrategy?H.push(e,z):H.push(z,e):H.push(e)}else z&&H.push(z);h&&H.push((e=>{const t=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:u=!0,crossAxis:c=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=Lt(e,t),a={x:n,y:r},f=await i.detectOverflow(t,s),d=$t(o),p=Mt(d);let v=a[p],m=a[d];const h=(e,t)=>At(t+f["y"===e?"top":"left"],t,t-f["y"===e?"bottom":"right"]);u&&(v=h(p,v)),c&&(m=h(d,m));const g=l.fn({...t,[p]:v,[d]:m});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:u,[d]:c}}}}}}(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})({padding:D.spacings.base,...g})),y&&H.push(((e,t)=>{const n=(e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(o=n,{}.hasOwnProperty.call(o,"current"))?null!=n.current?pn({element:n.current,padding:r}).fn(t):{}:n?pn({element:n,padding:r}).fn(t):{};var o}}))(e);return{name:n.name,fn:n.fn,options:[e,t]}})({element:F,padding:D.spacings.base,...x}));const B=function(e){var t,n;let{elements:r,...o}=void 0===e?{}:e;const{nodeId:i}=o,u=function(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=_n(),i=T.useRef({}),[u]=T.useState(()=>kn()),c=null!=Tn(),[l,s]=T.useState(r.reference),a=vt((e,t,r)=>{i.current.openEvent=e?t:void 0,u.emit("openchange",{open:e,event:t,reason:r,nested:c}),null==n||n(e,t,r)}),f=T.useMemo(()=>({setPositionReference:s}),[]),d=T.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return T.useMemo(()=>({dataRef:i,open:t,onOpenChange:a,elements:d,events:u,floatingId:o,refs:f}),[t,a,d,u,o,f])}({...o,elements:{reference:null!=(t=null==r?void 0:r.reference)?t:null,floating:null!=(n=null==r?void 0:r.floating)?n:null}}),c=o.rootContext||u,l=c.elements,[s,a]=T.useState(null),[f,d]=T.useState(null),v=(null==l?void 0:l.domReference)||s,m=T.useRef(null),h=Pn();ft(()=>{v&&(m.current=v)},[v]);const g=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:u}={},transform:c=!0,whileElementsMounted:l,open:s}=e,[a,f]=T.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,v]=T.useState(r);hn(d,r)||v(r);const[m,h]=T.useState(null),[g,y]=T.useState(null),b=T.useCallback(e=>{e!==R.current&&(R.current=e,h(e))},[]),x=T.useCallback(e=>{e!==O.current&&(O.current=e,y(e))},[]),w=i||m,E=u||g,R=T.useRef(null),O=T.useRef(null),C=T.useRef(a),S=null!=l,_=bn(l),j=bn(o),k=bn(s),A=T.useCallback(()=>{if(!R.current||!O.current)return;const e={placement:t,strategy:n,middleware:d};j.current&&(e.platform=j.current),vn(R.current,O.current,e).then(e=>{const t={...e,isPositioned:!1!==k.current};L.current&&!hn(C.current,t)&&(C.current=t,p().flushSync(()=>{f(t)}))})},[d,t,n,j,k]);mn(()=>{!1===s&&C.current.isPositioned&&(C.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[s]);const L=T.useRef(!1);mn(()=>(L.current=!0,()=>{L.current=!1}),[]),mn(()=>{if(w&&(R.current=w),E&&(O.current=E),w&&E){if(_.current)return _.current(w,E,A);A()}},[w,E,A,_,S]);const P=T.useMemo(()=>({reference:R,floating:O,setReference:b,setFloating:x}),[b,x]),M=T.useMemo(()=>({reference:w,floating:E}),[w,E]),D=T.useMemo(()=>{const e={position:n,left:0,top:0};if(!M.floating)return e;const t=yn(M.floating,a.x),r=yn(M.floating,a.y);return c?{...e,transform:"translate("+t+"px, "+r+"px)",...gn(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,c,M.floating,a.x,a.y]);return T.useMemo(()=>({...a,update:A,refs:P,elements:M,floatingStyles:D}),[a,A,P,M,D])}({...o,elements:{...l,...f&&{reference:f}}}),y=T.useCallback(e=>{const t=ae(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),g.refs.setReference(t)},[g.refs]),b=T.useCallback(e=>{(ae(e)||null===e)&&(m.current=e,a(e)),(ae(g.refs.reference.current)||null===g.refs.reference.current||null!==e&&!ae(e))&&g.refs.setReference(e)},[g.refs]),x=T.useMemo(()=>({...g.refs,setReference:b,setPositionReference:y,domReference:m}),[g.refs,b,y]),w=T.useMemo(()=>({...g.elements,domReference:v}),[g.elements,v]),E=T.useMemo(()=>({...g,...c,refs:x,elements:w,nodeId:i}),[g,x,w,i,c]);return ft(()=>{c.dataRef.current.floatingContext=E;const e=null==h?void 0:h.nodesRef.current.find(e=>e.id===i);e&&(e.context=E)}),T.useMemo(()=>({...g,context:E,refs:x,elements:w}),[g,x,w,E])}({nodeId:$,open:W,middleware:H,onOpenChange:(e,t,n)=>{N(e),e||M?.(n,t)},...O&&{whileElementsMounted:(e,t,n)=>function(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:u="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,s=Zt(e),a=o||i?[...s?_e(s):[],...t?_e(t):[]]:[];a.forEach(e=>{o&&e.addEventListener("scroll",n),i&&e.addEventListener("resize",n)});const f=s&&c?function(e,t,n){let r,o=null;const i=le(e);function u(){var e;clearTimeout(r),null==(e=o)||e.disconnect(),o=null}function c(n,l){void 0===n&&(n=!1),void 0===l&&(l=1),u();const s=e.getBoundingClientRect(),{left:a,top:f,width:d,height:p}=s;if(n||t(),!d||!p)return;const v={rootMargin:-_t(f)+"px "+-_t(i.clientWidth-(a+d))+"px "+-_t(i.clientHeight-(f+p))+"px "+-_t(a)+"px",threshold:Ct(0,Ot(1,l))||1};let m=!0;function h(t){const n=t[0].intersectionRatio;if(!fn(s,e.getBoundingClientRect()))return c();if(n!==l){if(!m)return c();n?c(!1,n):r=setTimeout(()=>{c(!1,1e-7)},1e3)}m=!1}try{o=new IntersectionObserver(h,{...v,root:i.ownerDocument})}catch(e){o=new IntersectionObserver(h,v)}o.observe(e)}const l=ce(e),s=()=>c(n);return l.addEventListener("resize",s),c(!0),()=>{l.removeEventListener("resize",s),u()}}(s,n,i):null;let d,p=-1,v=null;u&&(v=new ResizeObserver(e=>{let[r]=e;r&&r.target===s&&v&&t&&(v.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=v)||e.observe(t)})),n()}),s&&!l&&v.observe(s),t&&v.observe(t));let m=l?tn(e):null;return l&&function t(){const r=tn(e);m&&!fn(m,r)&&n(),m=r,d=requestAnimationFrame(t)}(),n(),()=>{var e;a.forEach(e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==f||f(),null==(e=v)||e.disconnect(),v=null,l&&cancelAnimationFrame(d)}}(e,t,n,C)},...a}),U=kr(B.context,{enabled:e,event:t,dismissOptions:n,clickOptions:r,hoverOptions:o,focusOptions:i,clientPointsOptions:u,roleOptions:c,extraInteractions:l}),K=function(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:u=250}=t,c=e.placement,l=c.split("-")[0],s=T.useMemo(()=>({side:l,placement:c}),[l,c]),a="number"==typeof u,f=(a?u:u.open)||0,d=(a?u:u.close)||0,[v,m]=T.useState(()=>({...Er(i,s),...Er(n,s)})),{isMounted:h,status:g}=function(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,[u,c]=T.useState("unmounted"),l=function(e,t){const[n,r]=T.useState(e);return e&&!n&&r(!0),T.useEffect(()=>{if(!e&&n){const e=setTimeout(()=>r(!1),t);return()=>clearTimeout(e)}},[e,n,t]),n}(n,i);return l||"close"!==u||c("unmounted"),ft(()=>{if(r){if(n){c("initial");const e=requestAnimationFrame(()=>{p().flushSync(()=>{c("open")})});return()=>{cancelAnimationFrame(e)}}c("close")}},[n,r]),{isMounted:l,status:u}}(e,{duration:u}),y=dt(n),b=dt(r),x=dt(o),w=dt(i);return ft(()=>{const e=Er(y.current,s),t=Er(x.current,s),n=Er(w.current,s),r=Er(b.current,s)||Object.keys(e).reduce((e,t)=>(e[t]="",e),{});if("initial"===g&&m(t=>({transitionProperty:t.transitionProperty,...n,...e})),"open"===g&&m({transitionProperty:Object.keys(r).map(wr).join(","),transitionDuration:f+"ms",...n,...r}),"close"===g){const r=t||e;m({transitionProperty:Object.keys(r).map(wr).join(","),transitionDuration:d+"ms",...n,...r})}},[d,x,y,b,w,f,g,s]),{isMounted:h,styles:v}}(B.context,{duration:250,...w});return{nodeId:$,isOpen:W,floating:B,arrowRef:F,interactions:U,transition:K}},Lr=()=>{const e=(0,T.useContext)(oe);return y(e,"[@react-hive/honey-layout]: The `useHoneyPopupContext()` hook can only be used inside <HoneyPopup/> component."),e},Tr=({children:e,referenceUserProps:t,referenceProps:n,content:r,contentProps:o,focusManagerProps:i,arrowProps:u,portalProps:c,adjustStyles:l,context:s,...a})=>{const{useArrow:f,onClose:d}=a,p=q(d),{nodeId:v,floating:h,isOpen:g,arrowRef:y,interactions:b,transition:w}=Ar(a),E=(0,T.useCallback)(()=>{p.current?.("escape-key")},[]),R=(0,T.useMemo)(()=>({context:s,floatingContext:h.context}),[s,h.context]);return(0,m().jsx)(_r,{ref:h.refs.setReference,...b.getReferenceProps(t),...n,"data-testid":"honey-popup",children:(0,m().jsxs)(oe,{value:R,children:[x(e,R),(0,m().jsx)(Mn,{id:v,children:w.isMounted&&(0,m().jsx)(jr,{...c,children:(0,m().jsx)(fr,{context:h.context,disabled:!g,...i,children:(0,m().jsxs)(re,{ref:h.refs.setFloating,active:g,style:l?.({...h.floatingStyles,...w.styles},{middlewareData:h.middlewareData})??{...h.floatingStyles,...w.styles},onDeactivate:E,...b.getFloatingProps(),...o,"data-testid":"honey-popup-floating-content",children:[f&&(0,m().jsx)(jn,{ref:y,context:h.context,fill:"white",...u}),x(r,R)]})})})})]})})},Pr=({useTree:e=!1,...t})=>(0,m().jsx)(Sr,{enabled:e,children:(0,m().jsx)(Tr,{...t})}),Mr=l(L,{row:!0,centerY:!0})`
36
+ `,$=({ref:e,children:t,columns:n,spacing:r,columnsGrowing:o=!0,applyColumnMaxWidth:i=!1,...u})=>{const c=(0,T.useMemo)(()=>({columns:n,spacing:r,isColumnsGrowing:o,applyColumnMaxWidth:i}),[n,r,o,i]);return(0,m().jsx)(P,{value:c,children:(0,m().jsx)(D,{ref:e,spacing:r,"data-testid":"honey-grid",...u,children:t})})},I=()=>{const e=(0,T.useContext)(P);if(!e)throw new Error("The `useHoneyGridContext()` hook can only be used inside <HoneyGrid/> component!");return e},N=({children:e,...t})=>{const{columns:n,spacing:r,isColumnsGrowing:o,applyColumnMaxWidth:i}=I();return(0,m().jsx)(M,{columns:n,spacing:r,applyMaxWidth:i,$flexGrow:o?1:0,"data-testid":"honey-grid-column",...t,children:e})},F=(e,t,n)=>"function"==typeof t?t(e):"string"==typeof e||"number"==typeof e?e:t?e[t]:n,W=({children:e,loading:t=!1,loadingOverContent:n=!1,error:r=!1,empty:o=!1,loadingContent:i=null,errorContent:u=null,emptyContent:c=null})=>r?u:!n&&t?i:(0,m().jsxs)(m().Fragment,{children:[n&&t&&i,o?c:e]}),H=l(L,({$overflow:e="hidden auto"})=>({$overflow:e}))``,z=({children:e,items:t,itemKey:n,loading:r,loadingOverContent:o,loadingContent:i,error:u,errorContent:c,empty:l=!1,emptyContent:s,...a})=>(0,m().jsx)(H,{role:"list","aria-busy":r,"data-testid":"honey-list",...a,children:(0,m().jsx)(W,{loading:r,loadingOverContent:o,loadingContent:i,error:u,errorContent:c,empty:l||0===t?.length,emptyContent:s,children:t?.map((t,r,o)=>(0,m().jsx)(T.Fragment,{children:e(t,r,o)},String(F(t,n,r))))})}),B=({children:e,mount:t,unmountDelay:n,alwaysMounted:r=!1,keepAfterMount:o=!1})=>{const[i,u]=(0,T.useState)(r||t),c=(0,T.useRef)(void 0);return(0,T.useLayoutEffect)(()=>{if(t&&!r)return clearTimeout(c.current),u(!0),()=>{o||(c.current=setTimeout(()=>u(!1),n))}},[t,r,n]),i?e:null};var U={551(e,t,n){var r="Expected a function",o=/^\s+|\s+$/g,i=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt,s="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,a="object"==typeof self&&self&&self.Object===Object&&self,f=s||a||Function("return this")(),d=Object.prototype.toString,p=Math.max,v=Math.min,m=function(){return f.Date.now()};function h(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function g(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==d.call(e)}(e))return NaN;if(h(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=h(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var n=u.test(e);return n||c.test(e)?l(e.slice(2),n?2:8):i.test(e)?NaN:+e}e.exports=function(e,t,n){var o=!0,i=!0;if("function"!=typeof e)throw new TypeError(r);return h(n)&&(o="leading"in n?!!n.leading:o,i="trailing"in n?!!n.trailing:i),function(e,t,n){var o,i,u,c,l,s,a=0,f=!1,d=!1,y=!0;if("function"!=typeof e)throw new TypeError(r);function b(t){var n=o,r=i;return o=i=void 0,a=t,c=e.apply(r,n)}function x(e){var n=e-s;return void 0===s||n>=t||n<0||d&&e-a>=u}function w(){var e=m();if(x(e))return E(e);l=setTimeout(w,function(e){var n=t-(e-s);return d?v(n,u-(e-a)):n}(e))}function E(e){return l=void 0,y&&o?b(e):(o=i=void 0,c)}function R(){var e=m(),n=x(e);if(o=arguments,i=this,s=e,n){if(void 0===l)return function(e){return a=e,l=setTimeout(w,t),f?b(e):c}(s);if(d)return l=setTimeout(w,t),b(s)}return void 0===l&&(l=setTimeout(w,t)),c}return t=g(t)||0,h(n)&&(f=!!n.leading,u=(d="maxWait"in n)?p(g(n.maxWait)||0,t):u,y="trailing"in n?!!n.trailing:y),R.cancel=function(){void 0!==l&&clearTimeout(l),a=0,o=s=i=l=void 0},R.flush=function(){return void 0===l?c:E(m())},R}(e,t,{leading:o,maxWait:t,trailing:i})}}},K={};function V(e){var t=K[e];if(void 0!==t)return t.exports;var n=K[e]={exports:{}};return U[e](n,n.exports,V),n.exports}V.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return V.d(t,{a:t}),t},V.d=(e,t)=>{for(var n in t)V.o(t,n)&&!V.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},V.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),V.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);const q=e=>{const t=(0,T.useRef)(e);return t.current=e,t};var X=V(551);V.n(X);var Y=d(551),G=d.n(Y);const Z=(e,{resizeThrottle:t=0,overrideScreenState:n}={})=>{const[r,o]=(0,T.useState)(()=>({...S(e.breakpoints),...n}));return(0,T.useEffect)(()=>{const r=G()(()=>{const t={...S(e.breakpoints),...n};o(e=>{return n=e,r=t,Object.keys(r).every(e=>n[e]===r[e])?e:t;var n,r})},t);return r(),window.addEventListener("resize",r),window.screen.orientation.addEventListener("change",r),()=>{r.cancel(),window.removeEventListener("resize",r),window.screen.orientation.removeEventListener("change",r)}},[]),r},Q=(0,T.createContext)(void 0),J=()=>{const e=(0,T.useContext)(Q);return y(e,"[@react-hive/honey-layout]: The `useHoneyLayout()` hook must be used inside <HoneyLayoutProvider/> component."),e},ee=(e,t)=>{const{registerOverlay:n,unregisterOverlay:r}=J(),o=(0,T.useRef)(null);return(0,T.useEffect)(()=>{if(!e)return;const i=n(t);return o.current=i,()=>{o.current=null,r(i.id)}},[e,t.onKeyUp]),o.current},te=()=>()=>{},ne=(e,{enabled:t=!0,onKeyUp:n}={})=>{const{getOverlaysSnapshot:r,subscribeOverlays:o}=J(),i=(0,T.useCallback)(()=>t?r().find(t=>t.id===e)??null:null,[t,e]),u=(0,T.useSyncExternalStore)(t?o:te,i,i);return(0,T.useEffect)(()=>{if(u&&n)return u.addListener("keyup",n),()=>{u.removeListener("keyup",n)}},[u,n]),u},re=({ref:e,children:t,active:n,overlayId:r,onDeactivate:o,onKeyUp:i,...u})=>{const c=q(i),l=q(o),s=(0,T.useCallback)((e,...t)=>{c.current?c.current(e,...t):"Escape"===e&&l.current()},[]),a=ee(n,{id:r,onKeyUp:s}),f=E(a?.setContainerRef,e);return(0,m().jsx)(L,{ref:f,inert:!n,...u,children:x(t,{overlay:a,isActive:n,deactivateOverlay:l.current})})},oe=(0,T.createContext)(void 0);function ie(){return"undefined"!=typeof window}function ue(e){return se(e)?(e.nodeName||"").toLowerCase():"#document"}function ce(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function le(e){var t;return null==(t=(se(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function se(e){return!!ie()&&(e instanceof Node||e instanceof ce(e).Node)}function ae(e){return!!ie()&&(e instanceof Element||e instanceof ce(e).Element)}function fe(e){return!!ie()&&(e instanceof HTMLElement||e instanceof ce(e).HTMLElement)}function de(e){return!(!ie()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof ce(e).ShadowRoot)}function pe(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Re(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==o&&"contents"!==o}function ve(e){return/^(table|td|th)$/.test(ue(e))}function me(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}const he=/transform|translate|scale|rotate|perspective|filter/,ge=/paint|layout|strict|content/,ye=e=>!!e&&"none"!==e;let be;function xe(e){const t=ae(e)?Re(e):e;return ye(t.transform)||ye(t.translate)||ye(t.scale)||ye(t.rotate)||ye(t.perspective)||!we()&&(ye(t.backdropFilter)||ye(t.filter))||he.test(t.willChange||"")||ge.test(t.contain||"")}function we(){return null==be&&(be="undefined"!=typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),be}function Ee(e){return/^(html|body|#document)$/.test(ue(e))}function Re(e){return ce(e).getComputedStyle(e)}function Oe(e){return ae(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ce(e){if("html"===ue(e))return e;const t=e.assignedSlot||e.parentNode||de(e)&&e.host||le(e);return de(t)?t.host:t}function Se(e){const t=Ce(e);return Ee(t)?(e.ownerDocument||e).body:fe(t)&&pe(t)?t:Se(t)}function _e(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=Se(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),u=ce(o);if(i){const e=je(u);return t.concat(u,u.visualViewport||[],pe(o)?o:[],e&&n?_e(e):[])}return t.concat(o,_e(o,[],n))}function je(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var ke=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","area[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"].join(","),Ae="undefined"==typeof Element,Le=Ae?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Te=!Ae&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},Pe=function(e,t){var n;void 0===t&&(t=!0);var r=null==e||null===(n=e.getAttribute)||void 0===n?void 0:n.call(e,"inert");return""===r||"true"===r||t&&e&&("function"==typeof e.closest?e.closest("[inert]"):Pe(e.parentNode))},Me=function(e,t,n){if(Pe(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ke));return t&&Le.call(e,ke)&&r.unshift(e),r.filter(n)},De=function(e,t,n){for(var r=[],o=Array.from(e);o.length;){var i=o.shift();if(!Pe(i,!1))if("SLOT"===i.tagName){var u=i.assignedElements(),c=u.length?u:i.children,l=De(c,!0,n);n.flatten?r.push.apply(r,l):r.push({scopeParent:i,candidates:l})}else{Le.call(i,ke)&&n.filter(i)&&(t||!e.includes(i))&&r.push(i);var s=i.shadowRoot||"function"==typeof n.getShadowRoot&&n.getShadowRoot(i),a=!Pe(s,!1)&&(!n.shadowRootFilter||n.shadowRootFilter(i));if(s&&a){var f=De(!0===s?i.children:s.children,!0,n);n.flatten?r.push.apply(r,f):r.push({scopeParent:i,candidates:f})}else o.unshift.apply(o,i.children)}}return r},$e=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Ie=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||function(e){var t,n=null==e||null===(t=e.getAttribute)||void 0===t?void 0:t.call(e,"contenteditable");return""===n||"true"===n}(e))&&!$e(e)?0:e.tabIndex},Ne=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Fe=function(e){return"INPUT"===e.tagName},We=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},He=function(e,t){return!(t.disabled||function(e){return Fe(e)&&"hidden"===e.type}(t)||function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("full-native"===n&&"checkVisibility"in e)return!e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});var o=getComputedStyle(e).visibility;if("hidden"===o||"collapse"===o)return!0;var i=Le.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Le.call(i,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"full-native"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return We(e)}else{if("function"==typeof r){for(var u=e;e;){var c=e.parentElement,l=Te(e);if(c&&!c.shadowRoot&&!0===r(c))return We(e);e=e.assignedSlot?e.assignedSlot:c||l===e.ownerDocument?c:l.host}e=u}if(function(e){var t,n,r,o,i=e&&Te(e),u=null===(t=i)||void 0===t?void 0:t.host,c=!1;if(i&&i!==e)for(c=!!(null!==(n=u)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(u)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!c&&u;){var l,s,a;c=!(null===(s=u=null===(l=i=Te(u))||void 0===l?void 0:l.host)||void 0===s||null===(a=s.ownerDocument)||void 0===a||!a.contains(u))}return c}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1}(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!!Le.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},ze=function(e,t){return!(function(e){return function(e){return Fe(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Te(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)}(t)||Ie(t)<0||!He(e,t))},Be=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ue=function(e){var t=[],n=[];return e.forEach(function(e,r){var o=!!e.scopeParent,i=o?e.scopeParent:e,u=function(e,t){var n=Ie(e);return n<0&&t&&!$e(e)?0:n}(i,o),c=o?Ue(e.candidates):i;0===u?o?t.push.apply(t,c):t.push(i):n.push({documentOrder:r,tabIndex:u,item:e,isScope:o,content:c})}),n.sort(Ne).reduce(function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e},[]).concat(t)},Ke=function(e,t){var n;return n=(t=t||{}).getShadowRoot?De([e],t.includeContainer,{filter:ze.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Be}):Me(e,t.includeContainer,ze.bind(null,t)),Ue(n)},Ve=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Le.call(e,ke)&&ze(t,e)};function qe(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function Xe(){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 Ye(){return/apple/i.test(navigator.vendor)}function Ge(){const e=/android/i;return e.test(qe())||e.test(Xe())}function Ze(){return Xe().includes("jsdom/")}const Qe="data-floating-ui-focusable";function Je(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}function et(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&de(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function tt(e){return"composedPath"in e?e.composedPath()[0]:e.target}function nt(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}function rt(e){return(null==e?void 0:e.ownerDocument)||document}function ot(e){return fe(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function it(e){return!!e&&"combobox"===e.getAttribute("role")&&ot(e)}function ut(e){return e?e.hasAttribute(Qe)?e:e.querySelector("["+Qe+"]")||e:null}function ct(e,t,n){return void 0===n&&(n=!0),e.filter(e=>{var r;return e.parentId===t&&(!n||(null==(r=e.context)?void 0:r.open))}).flatMap(t=>[t,...ct(e,t.id,n)])}function lt(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}function st(e){e.preventDefault(),e.stopPropagation()}function at(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}var ft="undefined"!=typeof document?T.useLayoutEffect:function(){};function dt(e){const t=T.useRef(e);return ft(()=>{t.current=e}),t}const pt={...T}.useInsertionEffect||(e=>e());function vt(e){const t=T.useRef(()=>{});return pt(()=>{t.current=e}),T.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)},[])}const mt=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ht(e,t){const n=Ke(e,mt()),r=n.length;if(0===r)return;const o=Je(rt(e)),i=n.indexOf(o);return n[-1===i?1===t?0:r-1:i+t]}function gt(e){return ht(rt(e).body,1)||e}function yt(e){return ht(rt(e).body,-1)||e}function bt(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!et(n,r)}function xt(e){Ke(e,mt()).forEach(e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")})}function wt(e){e.querySelectorAll("[data-tabindex]").forEach(e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")})}v();const Et=["start","end"],Rt=["top","right","bottom","left"].reduce((e,t)=>e.concat(t,t+"-"+Et[0],t+"-"+Et[1]),[]),Ot=Math.min,Ct=Math.max,St=Math.round,_t=Math.floor,jt=e=>({x:e,y:e}),kt={left:"right",right:"left",bottom:"top",top:"bottom"};function At(e,t,n){return Ct(e,Ot(t,n))}function Lt(e,t){return"function"==typeof e?e(t):e}function Tt(e){return e.split("-")[0]}function Pt(e){return e.split("-")[1]}function Mt(e){return"x"===e?"y":"x"}function Dt(e){return"y"===e?"height":"width"}function $t(e){const t=e[0];return"t"===t||"b"===t?"y":"x"}function It(e){return Mt($t(e))}function Nt(e,t,n){void 0===n&&(n=!1);const r=Pt(e),o=It(e),i=Dt(o);let u="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(u=Ut(u)),[u,Ut(u)]}function Ft(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Wt=["left","right"],Ht=["right","left"],zt=["top","bottom"],Bt=["bottom","top"];function Ut(e){const t=Tt(e);return kt[t]+e.slice(t.length)}function Kt(e){return"number"!=typeof e?function(e){var t,n,r,o;return{top:null!=(t=e.top)?t:0,right:null!=(n=e.right)?n:0,bottom:null!=(r=e.bottom)?r:0,left:null!=(o=e.left)?o:0}}(e):{top:e,right:e,bottom:e,left:e}}function Vt(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function qt(e,t,n){let{reference:r,floating:o}=e;const i=$t(t),u=It(t),c=Dt(u),l=Tt(t),s="y"===i,a=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[c]/2-o[c]/2;let p;switch(l){case"top":p={x:a,y:r.y-o.height};break;case"bottom":p={x:a,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}const v=Pt(t);return v&&(p[u]+=d*("end"===v?1:-1)*(n&&s?-1:1)),p}async function Xt(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:u,elements:c,strategy:l}=e,{boundary:s="clippingAncestors",rootBoundary:a="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=Lt(t,e),v=Kt(p),m=c[d?"floating"===f?"reference":"floating":f],h=Vt(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:s,rootBoundary:a,strategy:l})),g="floating"===f?{x:r,y:o,width:u.floating.width,height:u.floating.height}:u.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(c.floating)),b=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},x=Vt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:g,offsetParent:y,strategy:l}):g);return{top:(h.top-x.top+v.top)/b.y,bottom:(x.bottom-h.bottom+v.bottom)/b.y,left:(h.left-x.left+v.left)/b.x,right:(x.right-h.right+v.right)/b.x}}const Yt=new Set(["left","top"]);function Gt(e){const t=Re(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=fe(e),i=o?e.offsetWidth:n,u=o?e.offsetHeight:r,c=St(n)!==i||St(r)!==u;return c&&(n=i,r=u),{width:n,height:r,$:c}}function Zt(e){return ae(e)?e:e.contextElement}function Qt(e){const t=Zt(e);if(!fe(t))return jt(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Gt(t);let u=(i?St(n.width):n.width)/r,c=(i?St(n.height):n.height)/o;return u&&Number.isFinite(u)||(u=1),c&&Number.isFinite(c)||(c=1),{x:u,y:c}}const Jt=jt(0);function en(e){const t=ce(e);return we()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:Jt}function tn(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=Zt(e);let u=jt(1);t&&(r?ae(r)&&(u=Qt(r)):u=Qt(e));const c=function(e,t,n){return void 0===t&&(t=!1),!!n&&t&&n===ce(e)}(i,n,r)?en(i):jt(0);let l=(o.left+c.x)/u.x,s=(o.top+c.y)/u.y,a=o.width/u.x,f=o.height/u.y;if(i&&r){const e=ce(i),t=ae(r)?ce(r):r;let n=e,o=je(n);for(;o&&t!==n;){const e=Qt(o),t=o.getBoundingClientRect(),r=Re(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,u=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,s*=e.y,a*=e.x,f*=e.y,l+=i,s+=u,n=ce(o),o=je(n)}}return Vt({width:a,height:f,x:l,y:s})}function nn(e,t){const n=Oe(e).scrollLeft;return t?t.left+n:tn(le(e)).left+n}function rn(e,t){const n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-nn(e,n),y:n.top+t.scrollTop}}function on(e,t,n){let r;if("viewport"===t||"layoutViewport"===t)r=function(e,t,n){void 0===n&&(n="viewport");const r="layoutViewport"===n,o=ce(e),i=le(e),u=o.visualViewport;let c=i.clientWidth,l=i.clientHeight,s=0,a=0;if(u){const e=!we()||"fixed"===t;r?e||(s=-u.offsetLeft,a=-u.offsetTop):(c=u.width,l=u.height,e&&(s=u.offsetLeft,a=u.offsetTop))}if(nn(i)<=0){const e=i.ownerDocument,t=e.body,n=getComputedStyle(t),r="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(i.clientWidth-t.clientWidth-r),u="stable both-edges"===getComputedStyle(i).scrollbarGutter?o/2:o;u<=25&&(c-=u)}return{width:c,height:l,x:s,y:a}}(e,n,t);else if("document"===t)r=function(e){const t=Oe(e),n=e.ownerDocument.body,r=Ct(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),o=Ct(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let i=-t.scrollLeft+nn(e);const u=-t.scrollTop;return"rtl"===Re(n).direction&&(i+=Ct(e.clientWidth,n.clientWidth)-r),{width:r,height:o,x:i,y:u}}(le(e));else if(ae(t))r=function(e,t){const n=tn(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Qt(e);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=en(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Vt(r)}function un(e,t,n){const r=fe(t),o=le(t),i="fixed"===n,u=tn(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const l=jt(0);if((r||!i)&&(("body"!==ue(t)||pe(o))&&(c=Oe(t)),r)){const e=tn(t,!0,i,t);l.x=e.x+t.clientLeft,l.y=e.y+t.clientTop}!r&&o&&(l.x=nn(o));const s=!o||r||i?jt(0):rn(o,c);return{x:u.left+c.scrollLeft-l.x-s.x,y:u.top+c.scrollTop-l.y-s.y,width:u.width,height:u.height}}function cn(e){return"static"===Re(e).position}function ln(e,t){if(!fe(e)||"fixed"===Re(e).position)return null;if(t)return t(e);let n=e.offsetParent;return le(e)===n&&(n=n.ownerDocument.body),n}function sn(e,t){const n=ce(e);if(me(e))return n;if(!fe(e)){let t=Ce(e);for(;t&&!Ee(t);){if(ae(t)&&!cn(t))return t;t=Ce(t)}return n}let r=ln(e,t);for(;r&&ve(r)&&cn(r);)r=ln(r,t);return r&&Ee(r)&&cn(r)&&!xe(r)?n:r||function(e){let t=Ce(e);for(;fe(t)&&!Ee(t);){if(xe(t))return t;if(me(t))return null;t=Ce(t)}return null}(e)||n}const an={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,u=le(r),c=!!t&&me(t.floating);if(r===u||c&&i)return n;let l={scrollLeft:0,scrollTop:0},s=jt(1);const a=jt(0),f=fe(r);if((f||!i)&&(("body"!==ue(r)||pe(u))&&(l=Oe(r)),f)){const e=tn(r);s=Qt(r),a.x=e.x+r.clientLeft,a.y=e.y+r.clientTop}const d=!u||f||i?jt(0):rn(u,l);return{width:n.width*s.x,height:n.height*s.y,x:n.x*s.x-l.scrollLeft*s.x+a.x+d.x,y:n.y*s.y-l.scrollTop*s.y+a.y+d.y}},getDocumentElement:le,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?me(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=_e(e,[],!1).filter(e=>ae(e)&&"body"!==ue(e)),o=null;const i="fixed"===Re(e).position;let u=i?Ce(e):e;for(;ae(u)&&!Ee(u);){const e=Re(u),t=xe(u),n=o?o.position:i?"fixed":"";t||"fixed"!==n&&("absolute"!==n||"static"!==e.position)?o=e:r=r.filter(e=>e!==u),u=Ce(u)}return t.set(e,r),r}(t,this._c):[].concat(n),r],u=on(t,i[0],o);let c=u.top,l=u.right,s=u.bottom,a=u.left;for(let e=1;e<i.length;e++){const n=on(t,i[e],o);c=Ct(n.top,c),l=Ot(n.right,l),s=Ot(n.bottom,s),a=Ct(n.left,a)}return{width:l-a,height:s-c,x:a,y:c}},getOffsetParent:sn,getElementRects:async function(e){const t=this.getOffsetParent||sn,n=this.getDimensions,r=await n(e.floating);return{reference:un(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return e.getClientRects?Array.from(e.getClientRects()):[]},getDimensions:function(e){const{width:t,height:n}=Gt(e);return{width:t,height:n}},getScale:Qt,isElement:ae,isRTL:function(e){return"rtl"===Re(e).direction}};function fn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}const dn=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:u,initialPlacement:c,platform:l,elements:s}=t,{mainAxis:a=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:m=!0,...h}=Lt(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const g=Tt(o),y=$t(c),b=Tt(c)===c,x=await(null==l.isRTL?void 0:l.isRTL(s.floating)),w=d||(b||!m?[Ut(c)]:function(e){const t=Ut(e);return[Ft(e),t,Ft(t)]}(c)),E="none"!==v;!d&&E&&w.push(...function(e,t,n,r){const o=Pt(e);let i=function(e,t,n){switch(e){case"top":case"bottom":return n?t?Ht:Wt:t?Wt:Ht;case"left":case"right":return t?zt:Bt;default:return[]}}(Tt(e),"start"===n,r);return o&&(i=i.map(e=>e+"-"+o),t&&(i=i.concat(i.map(Ft)))),i}(c,m,v,x));const R=[c,...w],O=await l.detectOverflow(t,h),C=[];let S=(null==(r=i.flip)?void 0:r.overflows)||[];if(a&&C.push(O[g]),f){const e=Nt(o,u,x);C.push(O[e[0]],O[e[1]])}if(S=[...S,{placement:o,overflows:C}],!C.every(e=>e<=0)){var _,j;const e=((null==(_=i.flip)?void 0:_.index)||0)+1,t=R[e];if(t&&("alignment"!==f||y===$t(t)||S.every(e=>$t(e.placement)!==y||e.overflows[0]>0)))return{data:{index:e,overflows:S},reset:{placement:t}};let n=null==(j=S.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:j.placement;if(!n)switch(p){case"bestFit":{var k;const e=null==(k=S.filter(e=>{if(E){const t=$t(e.placement);return t===y||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:k[0];e&&(n=e);break}case"initialPlacement":n=c}if(o!==n)return{reset:{placement:n}}}return{}}}},pn=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:u,elements:c,middlewareData:l}=t,{element:s,padding:a=0}=Lt(e,t)||{};if(null==s)return{};const f=Kt(a),d={x:n,y:r},p=It(o),v=Dt(p),m=await u.getDimensions(s),h="y"===p,g=h?"top":"left",y=h?"bottom":"right",b=h?"clientHeight":"clientWidth",x=i.reference[v]+i.reference[p]-d[p]-i.floating[v],w=d[p]-i.reference[p],E=await(null==u.getOffsetParent?void 0:u.getOffsetParent(s));let R=E?E[b]:0;R&&await(null==u.isElement?void 0:u.isElement(E))||(R=c.floating[b]||i.floating[v]);const O=x/2-w/2,C=R/2-m[v]/2-1,S=Ot(f[g],C),_=Ot(f[y],C),j=R-m[v]-_,k=R/2-m[v]/2+O,A=At(S,k,j),L=!l.arrow&&null!=Pt(o)&&k!==A&&i.reference[v]/2-(k<S?S:_)-m[v]/2<0,T=L?k<S?k-S:k-j:0;return{[p]:d[p]+T,data:{[p]:A,centerOffset:k-A-T,...L&&{alignmentOffset:T}},reset:L}}}),vn=(e,t,n)=>{const r=new Map,o=null!=n?n:{},i={...an,...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:u}=n,c=u.detectOverflow?u:{...u,detectOverflow:Xt},l=await(null==u.isRTL?void 0:u.isRTL(t));let s=await u.getElementRects({reference:e,floating:t,strategy:o}),{x:a,y:f}=qt(s,r,l),d=r,p=0;const v={};for(let n=0;n<i.length;n++){const m=i[n];if(!m)continue;const{name:h,fn:g}=m,{x:y,y:b,data:x,reset:w}=await g({x:a,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:v,rects:s,platform:c,elements:{reference:e,floating:t}});a=null!=y?y:a,f=null!=b?b:f,v[h]={...v[h],...x},w&&p<50&&(p++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(s=!0===w.rects?await u.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:a,y:f}=qt(s,d,l))),n=-1)}return{x:a,y:f,placement:d,strategy:o,middlewareData:v}})(e,t,{...o,platform:i})};var mn="undefined"!=typeof document?T.useLayoutEffect:function(){};function hn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;0!==r--;)if(!hn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;0!==r--;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;0!==r--;){const n=o[r];if(!("_owner"===n&&e.$$typeof||hn(e[n],t[n])))return!1}return!0}return e!=e&&t!=t}function gn(e){return"undefined"==typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yn(e,t){const n=gn(e);return Math.round(t*n)/n}function bn(e){const t=T.useRef(e);return mn(()=>{t.current=e}),t}const xn="data-floating-ui-focusable",wn="active",En="selected",Rn={...T};let On=!1,Cn=0;const Sn=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Cn++,_n=Rn.useId||function(){const[e,t]=T.useState(()=>On?Sn():void 0);return ft(()=>{null==e&&t(Sn())},[]),T.useEffect(()=>{On=!0},[]),e},jn=T.forwardRef(function(e,t){const{context:{placement:n,elements:{floating:r},middlewareData:{arrow:o,shift:i}},width:u=14,height:c=7,tipRadius:l=0,strokeWidth:s=0,staticOffset:a,stroke:f,d,style:{transform:p,...v}={},...h}=e,g=_n(),[y,b]=T.useState(!1);if(ft(()=>{r&&"rtl"===Re(r).direction&&b(!0)},[r]),!r)return null;const[x,w]=n.split("-"),E="top"===x||"bottom"===x;let R=a;(E&&null!=i&&i.x||!E&&null!=i&&i.y)&&(R=null);const O=2*s,C=O/2,S=u/2*(l/-8+1),_=c/2*l/4,j=!!d,k=R&&"end"===w?"bottom":"top";let A=R&&"end"===w?"right":"left";R&&y&&(A="end"===w?"left":"right");const L=null!=(null==o?void 0:o.x)?R||o.x:"",P=null!=(null==o?void 0:o.y)?R||o.y:"",M=d||"M0,0 H"+u+" L"+(u-S)+","+(c-_)+" Q"+u/2+","+c+" "+S+","+(c-_)+" Z",D={top:j?"rotate(180deg)":"",left:j?"rotate(90deg)":"rotate(-90deg)",bottom:j?"":"rotate(180deg)",right:j?"rotate(-90deg)":"rotate(90deg)"}[x];return(0,m().jsxs)("svg",{...h,"aria-hidden":!0,ref:t,width:j?u:u+O,height:u,viewBox:"0 0 "+u+" "+(c>u?c:u),style:{position:"absolute",pointerEvents:"none",[A]:L,[k]:P,[x]:E||j?"100%":"calc(100% - "+O/2+"px)",transform:[D,p].filter(e=>!!e).join(" "),...v},children:[O>0&&(0,m().jsx)("path",{clipPath:"url(#"+g+")",fill:"none",stroke:f,strokeWidth:O+(d?0:1),d:M}),(0,m().jsx)("path",{stroke:O&&!d?h.fill:"none",d:M}),(0,m().jsx)("clipPath",{id:g,children:(0,m().jsx)("rect",{x:-C,y:C*(j?-1:1),width:u+O,height:u})})]})});function kn(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;null==(r=e.get(t))||r.delete(n)}}}const An=T.createContext(null),Ln=T.createContext(null),Tn=()=>{var e;return(null==(e=T.useContext(An))?void 0:e.id)||null},Pn=()=>T.useContext(Ln);function Mn(e){const{children:t,id:n}=e,r=Tn();return(0,m().jsx)(An.Provider,{value:T.useMemo(()=>({id:n,parentId:r}),[n,r]),children:t})}function Dn(e){const{children:t}=e,n=T.useRef([]),r=T.useCallback(e=>{n.current=[...n.current,e]},[]),o=T.useCallback(e=>{n.current=n.current.filter(t=>t!==e)},[]),[i]=T.useState(()=>kn());return(0,m().jsx)(Ln.Provider,{value:T.useMemo(()=>({nodesRef:n,addNode:r,removeNode:o,events:i}),[r,o,i]),children:t})}function $n(e){return"data-floating-ui-"+e}function In(e){-1!==e.current&&(clearTimeout(e.current),e.current=-1)}const Nn=$n("safe-polygon");function Fn(e,t,n){if(n&&!at(n))return 0;if("number"==typeof e)return e;if("function"==typeof e){const n=e();return"number"==typeof n?n:null==n?void 0:n[t]}return null==e?void 0:e[t]}function Wn(e){return"function"==typeof e?e():e}let Hn=0;function zn(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Hn);const i=()=>null==e?void 0:e.focus({preventScroll:n});o?i():Hn=requestAnimationFrame(i)}function Bn(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&de(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}const Un={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Kn(e){return"inert"===e?Un.inert:"aria-hidden"===e?Un["aria-hidden"]:Un.none}let Vn=new WeakSet,qn={},Xn=0;function Yn(e){return e?de(e)?e.host:Yn(e.parentNode):null}const Gn=(e,t)=>t.map(t=>{if(e.contains(t))return t;const n=Yn(t);return e.contains(n)?n:null}).filter(e=>null!=e);function Zn(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=(o=e[0],(null==o?void 0:o.ownerDocument)||document).body;var o;return function(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,u=Gn(t,e),c=new Set,l=new Set(u),s=[];qn[o]||(qn[o]=new WeakMap);const a=qn[o];return u.forEach(function e(t){t&&!c.has(t)&&(c.add(t),t.parentNode&&e(t.parentNode))}),function e(t){t&&!l.has(t)&&[].forEach.call(t.children,t=>{if("script"!==ue(t))if(c.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=Kn(i),u=(r.get(t)||0)+1,c=(a.get(t)||0)+1;r.set(t,u),a.set(t,c),s.push(t),1===u&&n&&Vn.add(t),1===c&&t.setAttribute(o,""),!n&&i&&t.setAttribute(i,"inert"===i?"":"true")}})}(t),c.clear(),Xn++,()=>{s.forEach(e=>{const t=Kn(i),n=(t.get(e)||0)-1,r=(a.get(e)||0)-1;t.set(e,n),a.set(e,r),n||(!Vn.has(e)&&i&&e.removeAttribute(i),Vn.delete(e)),r||e.removeAttribute(o)}),Xn--,Xn||(Un.inert=new WeakMap,Un["aria-hidden"]=new WeakMap,Un.none=new WeakMap,Vn=new WeakSet,qn={})}}(e.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))),r,t,n)}const Qn={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},Jn=T.forwardRef(function(e,t){const[n,r]=T.useState();ft(()=>{Ye()&&r("button")},[]);const o={ref:t,tabIndex:0,role:n,"aria-hidden":!n||void 0,[$n("focus-guard")]:"",style:Qn};return(0,m().jsx)("span",{...e,...o})}),er={clipPath:"inset(50%)",position:"fixed",top:0,left:0},tr=T.createContext(null),nr=$n("portal");function rr(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,i=function(e){void 0===e&&(e={});const{id:t,root:n}=e,r=_n(),o=or(),[i,u]=T.useState(null),c=T.useRef(null);return ft(()=>()=>{null==i||i.remove(),queueMicrotask(()=>{c.current=null})},[i]),ft(()=>{if(!r)return;if(c.current)return;const e=t?document.getElementById(t):null;if(!e)return;const n=document.createElement("div");n.id=r,n.setAttribute(nr,""),e.appendChild(n),c.current=n,u(n)},[t,r]),ft(()=>{if(null===n)return;if(!r)return;if(c.current)return;let e=n||(null==o?void 0:o.portalNode);e&&!se(e)&&(e=e.current),e=e||document.body;let i=null;t&&(i=document.createElement("div"),i.id=t,e.appendChild(i));const l=document.createElement("div");l.id=r,l.setAttribute(nr,""),e=i||e,e.appendChild(l),c.current=l,u(l)},[t,n,r,o]),i}({id:n,root:r}),[u,c]=T.useState(null),l=T.useRef(null),s=T.useRef(null),a=T.useRef(null),f=T.useRef(null),d=null==u?void 0:u.modal,v=null==u?void 0:u.open,h=!!u&&!u.modal&&u.open&&o&&!(!r&&!i);return T.useEffect(()=>{if(i&&o&&!d)return i.addEventListener("focusin",e,!0),i.addEventListener("focusout",e,!0),()=>{i.removeEventListener("focusin",e,!0),i.removeEventListener("focusout",e,!0)};function e(e){i&&bt(e)&&("focusin"===e.type?wt:xt)(i)}},[i,o,d]),T.useEffect(()=>{i&&(v||wt(i))},[v,i]),(0,m().jsxs)(tr.Provider,{value:T.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:l,afterOutsideRef:s,beforeInsideRef:a,afterInsideRef:f,portalNode:i,setFocusManagerState:c}),[o,i]),children:[h&&i&&(0,m().jsx)(Jn,{"data-type":"outside",ref:l,onFocus:e=>{if(bt(e,i)){var t;null==(t=a.current)||t.focus()}else{const e=yt(u?u.domReference:null);null==e||e.focus()}}}),h&&i&&(0,m().jsx)("span",{"aria-owns":i.id,style:er}),i&&p().createPortal(t,i),h&&i&&(0,m().jsx)(Jn,{"data-type":"outside",ref:s,onFocus:e=>{if(bt(e,i)){var t;null==(t=f.current)||t.focus()}else{const t=gt(u?u.domReference:null);null==t||t.focus(),(null==u?void 0:u.closeOnFocusOut)&&(null==u||u.onOpenChange(!1,e.nativeEvent,"focus-out"))}}})]})}const or=()=>T.useContext(tr);function ir(e){return T.useMemo(()=>t=>{e.forEach(e=>{e&&(e.current=t)})},e)}let ur=[];function cr(){ur=ur.filter(e=>{var t;return null==(t=e.deref())?void 0:t.isConnected})}function lr(){cr();const e=ur[ur.length-1];return null==e?void 0:e.deref()}function sr(e,t){var n;if(!(t.current.includes("floating")||null!=(n=e.getAttribute("role"))&&n.includes("dialog")))return;const r=mt(),o=function(e,t){return(t=t||{}).getShadowRoot?De([e],t.includeContainer,{filter:He.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):Me(e,t.includeContainer,He.bind(null,t))}(e,r),i=o.filter(e=>{const t=e.getAttribute("data-tabindex")||"";return Ve(e,r)||e.hasAttribute("data-tabindex")&&!t.startsWith("-")}),u=e.getAttribute("tabindex");t.current.includes("floating")||0===i.length?"0"!==u&&e.setAttribute("tabindex","0"):("-1"!==u||e.hasAttribute("data-tabindex")&&"-1"!==e.getAttribute("data-tabindex"))&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}const ar=T.forwardRef(function(e,t){return(0,m().jsx)("button",{...e,type:"button",ref:t,tabIndex:-1,style:Qn})});function fr(e){const{context:t,children:n,disabled:r=!1,order:o=["content"],guards:i=!0,initialFocus:u=0,returnFocus:c=!0,restoreFocus:l=!1,modal:s=!0,visuallyHiddenDismiss:a=!1,closeOnFocusOut:f=!0,outsideElementsInert:d=!1,getInsideElements:p=()=>[]}=e,{open:v,onOpenChange:h,events:g,dataRef:y,elements:{domReference:b,floating:x}}=t,w=vt(()=>{var e;return null==(e=y.current.floatingContext)?void 0:e.nodeId}),E=vt(p),R="number"==typeof u&&u<0,O=it(b)&&R,C="undefined"!=typeof HTMLElement&&"inert"in HTMLElement.prototype,S=!C||i,_=!S||C&&d,j=dt(o),k=dt(u),A=dt(c),L=Pn(),P=or(),M=T.useRef(null),D=T.useRef(null),$=T.useRef(!1),I=T.useRef(!1),N=T.useRef(-1),F=T.useRef(-1),W=null!=P,H=ut(x),z=vt(function(e){return void 0===e&&(e=H),e?Ke(e,mt()):[]}),B=vt(e=>{const t=z(e);return j.current.map(e=>b&&"reference"===e?b:H&&"floating"===e?H:t).filter(Boolean).flat()});T.useEffect(()=>{if(r)return;if(!s)return;function e(e){if("Tab"===e.key){et(H,Je(rt(H)))&&0===z().length&&!O&&st(e);const t=B(),n=tt(e);"reference"===j.current[0]&&n===b&&(st(e),e.shiftKey?zn(t[t.length-1]):zn(t[1])),"floating"===j.current[1]&&n===H&&e.shiftKey&&(st(e),zn(t[0]))}}const t=rt(H);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}},[r,b,H,s,j,O,z,B]),T.useEffect(()=>{if(!r&&x)return x.addEventListener("focusin",e),()=>{x.removeEventListener("focusin",e)};function e(e){const t=tt(e),n=z().indexOf(t);-1!==n&&(N.current=n)}},[r,x,z]),T.useEffect(()=>{if(r)return;if(!f)return;function e(){I.current=!0,setTimeout(()=>{I.current=!1})}function t(e){const t=e.relatedTarget,n=e.currentTarget,r=tt(e);queueMicrotask(()=>{const o=w(),i=!(et(b,t)||et(x,t)||et(t,x)||et(null==P?void 0:P.portalNode,t)||null!=t&&t.hasAttribute($n("focus-guard"))||L&&(ct(L.nodesRef.current,o).find(e=>{var n,r;return et(null==(n=e.context)?void 0:n.elements.floating,t)||et(null==(r=e.context)?void 0:r.elements.domReference,t)})||lt(L.nodesRef.current,o).find(e=>{var n,r,o;return[null==(n=e.context)?void 0:n.elements.floating,ut(null==(r=e.context)?void 0:r.elements.floating)].includes(t)||(null==(o=e.context)?void 0:o.elements.domReference)===t})));if(n===b&&H&&sr(H,j),l&&n!==b&&(null==r||!r.isConnected)&&Je(rt(H))===rt(H).body){fe(H)&&H.focus();const e=N.current,t=z(),n=t[e]||t[t.length-1]||H;fe(n)&&n.focus()}y.current.insideReactTree?y.current.insideReactTree=!1:!O&&s||!t||!i||I.current||t===lr()||($.current=!0,h(!1,e,"focus-out"))})}const n=Boolean(!L&&P);function o(){In(F),y.current.insideReactTree=!0,F.current=window.setTimeout(()=>{y.current.insideReactTree=!1})}return x&&fe(b)?(b.addEventListener("focusout",t),b.addEventListener("pointerdown",e),x.addEventListener("focusout",t),n&&x.addEventListener("focusout",o,!0),()=>{b.removeEventListener("focusout",t),b.removeEventListener("pointerdown",e),x.removeEventListener("focusout",t),n&&x.removeEventListener("focusout",o,!0)}):void 0},[r,b,x,H,s,L,P,h,f,l,z,O,w,j,y]);const U=T.useRef(null),K=T.useRef(null),V=ir([U,null==P?void 0:P.beforeInsideRef]),q=ir([K,null==P?void 0:P.afterInsideRef]);function X(e){return!r&&a&&s?(0,m().jsx)(ar,{ref:"start"===e?M:D,onClick:e=>h(!1,e.nativeEvent),children:"string"==typeof a?a:"Dismiss"}):null}T.useEffect(()=>{var e,t;if(r)return;if(!x)return;const n=Array.from((null==P||null==(e=P.portalNode)?void 0:e.querySelectorAll("["+$n("portal")+"]"))||[]),o=null==(t=(L?lt(L.nodesRef.current,w()):[]).find(e=>{var t;return it((null==(t=e.context)?void 0:t.elements.domReference)||null)}))||null==(t=t.context)?void 0:t.elements.domReference,i=[x,o,...n,...E(),M.current,D.current,U.current,K.current,null==P?void 0:P.beforeOutsideRef.current,null==P?void 0:P.afterOutsideRef.current,j.current.includes("reference")||O?b:null].filter(e=>null!=e),u=s||O?Zn(i,!_,_):Zn(i);return()=>{u()}},[r,b,x,s,j,P,O,S,_,L,w,E]),ft(()=>{if(r||!fe(H))return;const e=Je(rt(H));queueMicrotask(()=>{const t=B(H),n=k.current,r=("number"==typeof n?t[n]:n.current)||H,o=et(H,e);R||o||!v||zn(r,{preventScroll:r===H})})},[r,v,H,R,B,k]),ft(()=>{if(r||!H)return;const e=rt(H);var t;function n(e){let{reason:t,event:n,nested:r}=e;if(["hover","safe-polygon"].includes(t)&&"mouseleave"===n.type&&($.current=!0),"outside-press"===t)if(r)$.current=!1;else if(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(Ge()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(n)||function(e){return!Ze()&&(!Ge()&&0===e.width&&0===e.height||Ge()&&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&&"touch"===e.pointerType)}(n))$.current=!1;else{let e=!1;document.createElement("div").focus({get preventScroll(){return e=!0,!1}}),$.current=!e}}t=Je(e),cr(),t&&"body"!==ue(t)&&(ur.push(new WeakRef(t)),ur.length>20&&(ur=ur.slice(-20))),g.on("openchange",n);const o=e.createElement("span");return o.setAttribute("tabindex","-1"),o.setAttribute("aria-hidden","true"),Object.assign(o.style,Qn),W&&b&&b.insertAdjacentElement("afterend",o),()=>{g.off("openchange",n);const t=Je(e),r=et(x,t)||L&&ct(L.nodesRef.current,w(),!1).some(e=>{var n;return et(null==(n=e.context)?void 0:n.elements.floating,t)}),i=function(){if("boolean"==typeof A.current){const e=b||lr();return e&&e.isConnected?e:o}return A.current.current||o}();queueMicrotask(()=>{const n=function(e){const t=mt();return Ve(e,t)?e:Ke(e,t)[0]||e}(i);A.current&&!$.current&&fe(n)&&(n===t||t===e.body||r)&&n.focus({preventScroll:!0}),o.remove()})}},[r,x,H,A,y,g,L,W,b,w]),T.useEffect(()=>(queueMicrotask(()=>{$.current=!1}),()=>{queueMicrotask(cr)}),[r]),ft(()=>{if(!r&&P)return P.setFocusManagerState({modal:s,closeOnFocusOut:f,open:v,onOpenChange:h,domReference:b}),()=>{P.setFocusManagerState(null)}},[r,P,s,v,h,f,b]),ft(()=>{r||H&&sr(H,j)},[r,H,j]);const Y=!r&&S&&(!s||!O)&&(W||s);return(0,m().jsxs)(m().Fragment,{children:[Y&&(0,m().jsx)(Jn,{"data-type":"inside",ref:V,onFocus:e=>{if(s){const e=B();zn("reference"===o[0]?e[0]:e[e.length-1])}else if(null!=P&&P.preserveTabOrder&&P.portalNode)if($.current=!1,bt(e,P.portalNode)){const e=gt(b);null==e||e.focus()}else{var t;null==(t=P.beforeOutsideRef.current)||t.focus()}}}),!O&&X("start"),n,X("end"),Y&&(0,m().jsx)(Jn,{"data-type":"inside",ref:q,onFocus:e=>{if(s)zn(B()[0]);else if(null!=P&&P.preserveTabOrder&&P.portalNode)if(f&&($.current=!0),bt(e,P.portalNode)){const e=yt(b);null==e||e.focus()}else{var t;null==(t=P.afterOutsideRef.current)||t.focus()}}})]})}function dr(e){return fe(e.target)&&"BUTTON"===e.target.tagName}function pr(e){return ot(e)}function vr(e){return null!=e&&null!=e.clientX}const mr={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},hr={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},gr=e=>{var t,n;return{escapeKey:"boolean"==typeof e?e:null!=(t=null==e?void 0:e.escapeKey)&&t,outsidePress:"boolean"==typeof e?e:null==(n=null==e?void 0:e.outsidePress)||n}};function yr(){return qe().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints&&Ye()}function br(e,t,n){const r=new Map,o="item"===n;let i=e;if(o&&e){const{[wn]:t,[En]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1,[xn]:""},...i,...t.map(t=>{const r=t?t[n]:null;return"function"==typeof r?e?r(e):null:r}).concat(e).reduce((e,t)=>t?(Object.entries(t).forEach(t=>{let[n,i]=t;var u;o&&[wn,En].includes(n)||(0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof i&&(null==(u=r.get(n))||u.push(i),e[n]=function(){for(var e,t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];return null==(e=r.get(n))?void 0:e.map(e=>e(...o)).find(e=>void 0!==e)})):e[n]=i)}),e):e,{})}}const xr=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]),wr=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,t)=>(t?"-":"")+e.toLowerCase());function Er(e,t){return"function"==typeof e?e(t):e}function Rr(e,t,n){return void 0===n&&(n=!0),e.filter(e=>{var r;return e.parentId===t&&(!n||(null==(r=e.context)?void 0:r.open))}).flatMap(t=>[t,...Rr(e,t.id,n)])}function Or(e,t){const[n,r]=e;let o=!1;const i=t.length;for(let e=0,u=i-1;e<i;u=e++){const[i,c]=t[e]||[0,0],[l,s]=t[u]||[0,0];c>=r!=s>=r&&n<=(l-i)*(r-c)/(s-c)+i&&(o=!o)}return o}function Cr(e){void 0===e&&(e={});const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,o={current:-1};let i=!1,u=null,c=null,l="undefined"!=typeof performance?performance.now():0;const s=e=>{let{x:n,y:s,placement:a,elements:f,onClose:d,nodeId:p,tree:v}=e;return function(e){function m(){In(o),d()}if(In(o),!f.domReference||!f.floating||null==a||null==n||null==s)return;const{clientX:h,clientY:g}=e,y=[h,g],b=function(e){return"composedPath"in e?e.composedPath()[0]:e.target}(e),x="mouseleave"===e.type,w=Bn(f.floating,b),E=Bn(f.domReference,b),R=f.domReference.getBoundingClientRect(),O=f.floating.getBoundingClientRect(),C=a.split("-")[0],S=n>O.right-O.width/2,_=s>O.bottom-O.height/2,j=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,R),k=O.width>R.width,A=O.height>R.height,L=(k?R:O).left,T=(k?R:O).right,P=(A?R:O).top,M=(A?R:O).bottom;if(w&&(i=!0,!x))return;if(E&&(i=!1),E&&!x)return void(i=!0);if(x&&ae(e.relatedTarget)&&Bn(f.floating,e.relatedTarget))return;if(v&&Rr(v.nodesRef.current,p).length)return;if("top"===C&&s>=R.bottom-1||"bottom"===C&&s<=R.top+1||"left"===C&&n>=R.right-1||"right"===C&&n<=R.left+1)return m();let D=[];switch(C){case"top":D=[[L,R.top+1],[L,O.bottom-1],[T,O.bottom-1],[T,R.top+1]];break;case"bottom":D=[[L,O.top+1],[L,R.bottom-1],[T,R.bottom-1],[T,O.top+1]];break;case"left":D=[[O.right-1,M],[O.right-1,P],[R.left+1,P],[R.left+1,M]];break;case"right":D=[[R.right-1,M],[R.right-1,P],[O.left+1,P],[O.left+1,M]]}if(!Or([h,g],D)){if(i&&!j)return m();if(!x&&r){const t=function(e,t){const n=performance.now(),r=n-l;if(null===u||null===c||0===r)return u=e,c=t,l=n,null;const o=e-u,i=t-c,s=Math.sqrt(o*o+i*i);return u=e,c=t,l=n,s/r}(e.clientX,e.clientY);if(null!==t&&t<.1)return m()}Or([h,g],function(e){let[n,r]=e;switch(C){case"top":return[[k?n+t/2:S?n+4*t:n-4*t,r+t+1],[k?n-t/2:S?n+4*t:n-4*t,r+t+1],[O.left,S||k?O.bottom-t:O.top],[O.right,S?k?O.bottom-t:O.top:O.bottom-t]];case"bottom":return[[k?n+t/2:S?n+4*t:n-4*t,r-t],[k?n-t/2:S?n+4*t:n-4*t,r-t],[O.left,S||k?O.top+t:O.bottom],[O.right,S?k?O.top+t:O.bottom:O.top+t]];case"left":{const e=[n+t+1,A?r+t/2:_?r+4*t:r-4*t],o=[n+t+1,A?r-t/2:_?r+4*t:r-4*t];return[[_||A?O.right-t:O.left,O.top],[_?A?O.right-t:O.left:O.right-t,O.bottom],e,o]}case"right":return[[n-t,A?r+t/2:_?r+4*t:r-4*t],[n-t,A?r-t/2:_?r+4*t:r-4*t],[_||A?O.left+t:O.right,O.top],[_?A?O.left+t:O.right:O.left+t,O.bottom]]}}([n,s]))?!i&&r&&(o.current=window.setTimeout(m,40)):m()}}};return s.__options={blockPointerEvents:n},s}const Sr=({children:e,enabled:t=!0,...n})=>{const r=Tn();return!t||r?e:(0,m().jsx)(Dn,{...n,children:e})},_r=l(L,({$width:e="max-content"})=>({$width:e}))``,jr=({children:e,enabled:t=!0,...n})=>t?(0,m().jsx)(rr,{...n,children:e}):e,kr=(e,{enabled:t=!0,event:n="click",dismissOptions:r,clickOptions:o,hoverOptions:i,focusOptions:u,clientPointsOptions:c,roleOptions:l,extraInteractions:s=[]})=>{const a=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=e,{enabled:u=!0,escapeKey:c=!0,outsidePress:l=!0,outsidePressEvent:s="pointerdown",referencePress:a=!1,referencePressEvent:f="pointerdown",ancestorScroll:d=!1,bubbles:p,capture:v}=t,m=Pn(),h=vt("function"==typeof l?l:()=>!1),g="function"==typeof l?h:l,y=T.useRef(!1),{escapeKey:b,outsidePress:x}=gr(p),{escapeKey:w,outsidePress:E}=gr(v),R=T.useRef(!1),O=vt(e=>{var t;if(!n||!u||!c||"Escape"!==e.key)return;if(R.current)return;const o=null==(t=i.current.floatingContext)?void 0:t.nodeId,l=m?ct(m.nodesRef.current,o):[];if(!b&&(e.stopPropagation(),l.length>0)){let e=!0;if(l.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)}),!e)return}r(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")}),C=vt(e=>{var t;const n=()=>{var t;O(e),null==(t=tt(e))||t.removeEventListener("keydown",n)};null==(t=tt(e))||t.addEventListener("keydown",n)}),S=vt(e=>{var t;const n=i.current.insideReactTree;i.current.insideReactTree=!1;const u=y.current;if(y.current=!1,"click"===s&&u)return;if(n)return;if("function"==typeof g&&!g(e))return;const c=tt(e),l="["+$n("inert")+"]",a=rt(o.floating).querySelectorAll(l);let f=ae(c)?c:null;for(;f&&!Ee(f);){const e=Ce(f);if(Ee(e)||!ae(e))break;f=e}if(a.length&&ae(c)&&!c.matches("html,body")&&!et(c,o.floating)&&Array.from(a).every(e=>!et(f,e)))return;if(fe(c)&&k){const t=Ee(c),n=Re(c),r=/auto|scroll/,o=t||r.test(n.overflowX),i=t||r.test(n.overflowY),u=o&&c.clientWidth>0&&c.scrollWidth>c.clientWidth,l=i&&c.clientHeight>0&&c.scrollHeight>c.clientHeight,s="rtl"===n.direction,a=l&&(s?e.offsetX<=c.offsetWidth-c.clientWidth:e.offsetX>c.clientWidth),f=u&&e.offsetY>c.clientHeight;if(a||f)return}const d=null==(t=i.current.floatingContext)?void 0:t.nodeId,p=m&&ct(m.nodesRef.current,d).some(t=>{var n;return nt(e,null==(n=t.context)?void 0:n.elements.floating)});if(nt(e,o.floating)||nt(e,o.domReference)||p)return;const v=m?ct(m.nodesRef.current,d):[];if(v.length>0){let e=!0;if(v.forEach(t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)}),!e)return}r(!1,e,"outside-press")}),_=vt(e=>{var t;const n=()=>{var t;S(e),null==(t=tt(e))||t.removeEventListener(s,n)};null==(t=tt(e))||t.addEventListener(s,n)});T.useEffect(()=>{if(!n||!u)return;i.current.__escapeKeyBubbles=b,i.current.__outsidePressBubbles=x;let e=-1;function t(e){r(!1,e,"ancestor-scroll")}function l(){window.clearTimeout(e),R.current=!0}function a(){e=window.setTimeout(()=>{R.current=!1},we()?5:0)}const f=rt(o.floating);c&&(f.addEventListener("keydown",w?C:O,w),f.addEventListener("compositionstart",l),f.addEventListener("compositionend",a)),g&&f.addEventListener(s,E?_:S,E);let p=[];return d&&(ae(o.domReference)&&(p=_e(o.domReference)),ae(o.floating)&&(p=p.concat(_e(o.floating))),!ae(o.reference)&&o.reference&&o.reference.contextElement&&(p=p.concat(_e(o.reference.contextElement)))),p=p.filter(e=>{var t;return e!==(null==(t=f.defaultView)?void 0:t.visualViewport)}),p.forEach(e=>{e.addEventListener("scroll",t)}),()=>{c&&(f.removeEventListener("keydown",w?C:O,w),f.removeEventListener("compositionstart",l),f.removeEventListener("compositionend",a)),g&&f.removeEventListener(s,E?_:S,E),p.forEach(e=>{e.removeEventListener("scroll",t)}),window.clearTimeout(e)}},[i,o,c,g,s,n,r,d,u,b,x,O,w,C,S,E,_]),T.useEffect(()=>{i.current.insideReactTree=!1},[i,g,s]);const j=T.useMemo(()=>({onKeyDown:O,...a&&{[mr[f]]:e=>{r(!1,e.nativeEvent,"reference-press")},..."click"!==f&&{onClick(e){r(!1,e.nativeEvent,"reference-press")}}}}),[O,r,a,f]),k=T.useMemo(()=>{function e(e){0===e.button&&(y.current=!0)}return{onKeyDown:O,onMouseDown:e,onMouseUp:e,[hr[s]]:()=>{i.current.insideReactTree=!0}}},[O,s,i]);return T.useMemo(()=>u?{reference:j,floating:k}:{},[u,j,k])}(e,{escapeKey:!1,...r}),f=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:i}}=e,{enabled:u=!0,event:c="click",toggle:l=!0,ignoreMouse:s=!1,keyboardHandlers:a=!0,stickIfOpen:f=!0}=t,d=T.useRef(),p=T.useRef(!1),v=T.useMemo(()=>({onPointerDown(e){d.current=e.pointerType},onMouseDown(e){const t=d.current;0===e.button&&"click"!==c&&(at(t,!0)&&s||(!n||!l||o.current.openEvent&&f&&"mousedown"!==o.current.openEvent.type?(e.preventDefault(),r(!0,e.nativeEvent,"click")):r(!1,e.nativeEvent,"click")))},onClick(e){const t=d.current;"mousedown"===c&&d.current?d.current=void 0:at(t,!0)&&s||(!n||!l||o.current.openEvent&&f&&"click"!==o.current.openEvent.type?r(!0,e.nativeEvent,"click"):r(!1,e.nativeEvent,"click"))},onKeyDown(e){d.current=void 0,e.defaultPrevented||!a||dr(e)||(" "!==e.key||pr(i)||(e.preventDefault(),p.current=!0),function(e){return fe(e.target)&&"A"===e.target.tagName}(e)||"Enter"===e.key&&r(!n||!l,e.nativeEvent,"click"))},onKeyUp(e){e.defaultPrevented||!a||dr(e)||pr(i)||" "===e.key&&p.current&&(p.current=!1,r(!n||!l,e.nativeEvent,"click"))}}),[o,i,c,s,a,r,n,f,l]);return T.useMemo(()=>u?{reference:v}:{},[u,v])}(e,{enabled:t&&"click"===n,...o}),d=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:i,elements:u}=e,{enabled:c=!0,delay:l=0,handleClose:s=null,mouseOnly:a=!1,restMs:f=0,move:d=!0}=t,p=Pn(),v=Tn(),m=dt(s),h=dt(l),g=dt(n),y=dt(f),b=T.useRef(),x=T.useRef(-1),w=T.useRef(),E=T.useRef(-1),R=T.useRef(!0),O=T.useRef(!1),C=T.useRef(()=>{}),S=T.useRef(!1),_=vt(()=>{var e;const t=null==(e=o.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t});T.useEffect(()=>{if(c)return i.on("openchange",e),()=>{i.off("openchange",e)};function e(e){let{open:t}=e;t||(In(x),In(E),R.current=!0,S.current=!1)}},[c,i]),T.useEffect(()=>{if(!c)return;if(!m.current)return;if(!n)return;function e(e){_()&&r(!1,e,"hover")}const t=rt(u.floating).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}},[u.floating,n,r,c,m,_]);const j=T.useCallback(function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const o=Fn(h.current,"close",b.current);o&&!w.current?(In(x),x.current=window.setTimeout(()=>r(!1,e,n),o)):t&&(In(x),r(!1,e,n))},[h,r]),k=vt(()=>{C.current(),w.current=void 0}),A=vt(()=>{if(O.current){const e=rt(u.floating).body;e.style.pointerEvents="",e.removeAttribute(Nn),O.current=!1}}),L=vt(()=>!!o.current.openEvent&&["click","mousedown"].includes(o.current.openEvent.type));T.useEffect(()=>{if(c&&ae(u.domReference)){const r=u.domReference,o=u.floating;return n&&r.addEventListener("mouseleave",i),d&&r.addEventListener("mousemove",e,{once:!0}),r.addEventListener("mouseenter",e),r.addEventListener("mouseleave",t),o&&(o.addEventListener("mouseleave",i),o.addEventListener("mouseenter",l),o.addEventListener("mouseleave",s)),()=>{n&&r.removeEventListener("mouseleave",i),d&&r.removeEventListener("mousemove",e),r.removeEventListener("mouseenter",e),r.removeEventListener("mouseleave",t),o&&(o.removeEventListener("mouseleave",i),o.removeEventListener("mouseenter",l),o.removeEventListener("mouseleave",s))}}function e(e){if(In(x),R.current=!1,a&&!at(b.current)||Wn(y.current)>0&&!Fn(h.current,"open"))return;const t=Fn(h.current,"open",b.current);t?x.current=window.setTimeout(()=>{g.current||r(!0,e,"hover")},t):n||r(!0,e,"hover")}function t(e){if(L())return void A();C.current();const t=rt(u.floating);if(In(E),S.current=!1,m.current&&o.current.floatingContext){n||In(x),w.current=m.current({...o.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){A(),k(),L()||j(e,!0,"safe-polygon")}});const r=w.current;return t.addEventListener("mousemove",r),void(C.current=()=>{t.removeEventListener("mousemove",r)})}("touch"!==b.current||!et(u.floating,e.relatedTarget))&&j(e)}function i(e){L()||o.current.floatingContext&&(null==m.current||m.current({...o.current.floatingContext,tree:p,x:e.clientX,y:e.clientY,onClose(){A(),k(),L()||j(e)}})(e))}function l(){In(x)}function s(e){L()||j(e,!1)}},[u,c,e,a,d,j,k,A,r,n,g,p,h,m,o,L,y]),ft(()=>{var e;if(c&&n&&null!=(e=m.current)&&null!=(e=e.__options)&&e.blockPointerEvents&&_()){O.current=!0;const e=u.floating;if(ae(u.domReference)&&e){var t;const n=rt(u.floating).body;n.setAttribute(Nn,"");const r=u.domReference,o=null==p||null==(t=p.nodesRef.current.find(e=>e.id===v))||null==(t=t.context)?void 0:t.elements.floating;return o&&(o.style.pointerEvents=""),n.style.pointerEvents="none",r.style.pointerEvents="auto",e.style.pointerEvents="auto",()=>{n.style.pointerEvents="",r.style.pointerEvents="",e.style.pointerEvents=""}}}},[c,n,v,u,p,m,_]),ft(()=>{n||(b.current=void 0,S.current=!1,k(),A())},[n,k,A]),T.useEffect(()=>()=>{k(),In(x),In(E),A()},[c,u.domReference,k,A]);const P=T.useMemo(()=>{function e(e){b.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){const{nativeEvent:t}=e;function o(){R.current||g.current||r(!0,t,"hover")}a&&!at(b.current)||n||0===Wn(y.current)||S.current&&e.movementX**2+e.movementY**2<2||(In(E),"touch"===b.current?o():(S.current=!0,E.current=window.setTimeout(o,Wn(y.current))))}}},[a,r,n,g,y]);return T.useMemo(()=>c?{reference:P}:{},[c,P])}(e,{restMs:150,enabled:t&&"hover"===n,handleClose:Cr(),...i}),p=function(e,t){void 0===t&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:i,elements:u}=e,{enabled:c=!0,visibleOnly:l=!0}=t,s=T.useRef(!1),a=T.useRef(-1),f=T.useRef(!0);T.useEffect(()=>{if(!c)return;const e=ce(u.domReference);function t(){!n&&fe(u.domReference)&&u.domReference===Je(rt(u.domReference))&&(s.current=!0)}function r(){f.current=!0}function o(){f.current=!1}return e.addEventListener("blur",t),yr()&&(e.addEventListener("keydown",r,!0),e.addEventListener("pointerdown",o,!0)),()=>{e.removeEventListener("blur",t),yr()&&(e.removeEventListener("keydown",r,!0),e.removeEventListener("pointerdown",o,!0))}},[u.domReference,n,c]),T.useEffect(()=>{if(c)return o.on("openchange",e),()=>{o.off("openchange",e)};function e(e){let{reason:t}=e;"reference-press"!==t&&"escape-key"!==t||(s.current=!0)}},[o,c]),T.useEffect(()=>()=>{In(a)},[]);const d=T.useMemo(()=>({onMouseLeave(){s.current=!1},onFocus(e){if(s.current)return;const t=tt(e.nativeEvent);if(l&&ae(t))if(yr()&&!e.relatedTarget){if(!f.current&&!ot(t))return}else if(!function(e){if(!e||Ze())return!0;try{return e.matches(":focus-visible")}catch(e){return!0}}(t))return;r(!0,e.nativeEvent,"focus")},onBlur(e){s.current=!1;const t=e.relatedTarget,n=e.nativeEvent,o=ae(t)&&t.hasAttribute($n("focus-guard"))&&"outside"===t.getAttribute("data-type");a.current=window.setTimeout(()=>{var e;const c=Je(u.domReference?u.domReference.ownerDocument:document);(t||c!==u.domReference)&&(et(null==(e=i.current.floatingContext)?void 0:e.refs.floating.current,c)||et(u.domReference,c)||o||r(!1,n,"focus"))})}}),[i,u.domReference,r,l]);return T.useMemo(()=>c?{reference:d}:{},[c,d])}(e,{enabled:t&&"focus"===n,...u}),v=function(e,t){void 0===t&&(t={});const{open:n,dataRef:r,elements:{floating:o,domReference:i},refs:u}=e,{enabled:c=!0,axis:l="both",x:s=null,y:a=null}=t,f=T.useRef(!1),d=T.useRef(null),[p,v]=T.useState(),[m,h]=T.useState([]),g=vt((e,t)=>{f.current||r.current.openEvent&&!vr(r.current.openEvent)||u.setPositionReference(function(e,t){let n=null,r=null,o=!1;return{contextElement:e||void 0,getBoundingClientRect(){var i;const u=(null==e?void 0:e.getBoundingClientRect())||{width:0,height:0,x:0,y:0},c="x"===t.axis||"both"===t.axis,l="y"===t.axis||"both"===t.axis,s=["mouseenter","mousemove"].includes((null==(i=t.dataRef.current.openEvent)?void 0:i.type)||"")&&"touch"!==t.pointerType;let a=u.width,f=u.height,d=u.x,p=u.y;return null==n&&t.x&&c&&(n=u.x-t.x),null==r&&t.y&&l&&(r=u.y-t.y),d-=n||0,p-=r||0,a=0,f=0,!o||s?(a="y"===t.axis?u.width:0,f="x"===t.axis?u.height:0,d=c&&null!=t.x?t.x:d,p=l&&null!=t.y?t.y:p):o&&!s&&(f="x"===t.axis?u.height:f,a="y"===t.axis?u.width:a),o=!0,{width:a,height:f,x:d,y:p,top:p,right:d+a,bottom:p+f,left:d}}}}(i,{x:e,y:t,axis:l,dataRef:r,pointerType:p}))}),y=vt(e=>{null==s&&null==a&&(n?d.current||h([]):g(e.clientX,e.clientY))}),b=at(p)?o:n,x=T.useCallback(()=>{if(!b||!c||null!=s||null!=a)return;const e=ce(o);function t(n){const r=tt(n);et(o,r)?(e.removeEventListener("mousemove",t),d.current=null):g(n.clientX,n.clientY)}if(!r.current.openEvent||vr(r.current.openEvent)){e.addEventListener("mousemove",t);const n=()=>{e.removeEventListener("mousemove",t),d.current=null};return d.current=n,n}u.setPositionReference(i)},[b,c,s,a,o,r,u,i,g]);T.useEffect(()=>x(),[x,m]),T.useEffect(()=>{c&&!o&&(f.current=!1)},[c,o]),T.useEffect(()=>{!c&&n&&(f.current=!0)},[c,n]),ft(()=>{!c||null==s&&null==a||(f.current=!1,g(s,a))},[c,s,a,g]);const w=T.useMemo(()=>{function e(e){let{pointerType:t}=e;v(t)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:y,onMouseEnter:y}},[y]);return T.useMemo(()=>c?{reference:w}:{},[c,w])}(e,{enabled:t&&"point"===n,...c}),m=function(e,t){var n,r;void 0===t&&(t={});const{open:o,elements:i,floatingId:u}=e,{enabled:c=!0,role:l="dialog"}=t,s=_n(),a=(null==(n=i.domReference)?void 0:n.id)||s,f=T.useMemo(()=>{var e;return(null==(e=ut(i.floating))?void 0:e.id)||u},[i.floating,u]),d=null!=(r=xr.get(l))?r:l,p=null!=Tn(),v=T.useMemo(()=>"tooltip"===d||"label"===l?{["aria-"+("label"===l?"labelledby":"describedby")]:o?f:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":"alertdialog"===d?"dialog":d,"aria-controls":o?f:void 0,..."listbox"===d&&{role:"combobox"},..."menu"===d&&{id:a},..."menu"===d&&p&&{role:"menuitem"},..."select"===l&&{"aria-autocomplete":"none"},..."combobox"===l&&{"aria-autocomplete":"list"}},[d,f,p,o,a,l]),m=T.useMemo(()=>{const e={id:f,...d&&{role:d}};return"tooltip"===d||"label"===l?e:{...e,..."menu"===d&&{"aria-labelledby":a}}},[d,f,a,l]),h=T.useCallback(e=>{let{active:t,selected:n}=e;const r={role:"option",...t&&{id:f+"-fui-option"}};switch(l){case"select":case"combobox":return{...r,"aria-selected":n}}return{}},[f,l]);return T.useMemo(()=>c?{reference:v,floating:m,item:h}:{},[c,v,m,h])}(e,l);return function(e){void 0===e&&(e=[]);const t=e.map(e=>null==e?void 0:e.reference),n=e.map(e=>null==e?void 0:e.floating),r=e.map(e=>null==e?void 0:e.item),o=T.useCallback(t=>br(t,e,"reference"),t),i=T.useCallback(t=>br(t,e,"floating"),n),u=T.useCallback(t=>br(t,e,"item"),r);return T.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:u}),[o,i,u])}([a,f,d,p,v,m,...s])},Ar=({enabled:e=!0,event:t,dismissOptions:n,clickOptions:r,hoverOptions:o,focusOptions:i,clientPointsOptions:u,roleOptions:c,extraInteractions:l,open:s,floatingOptions:a,useOffset:f=!0,offsetOptions:d,useFlip:v=!0,flipOptions:m,useShift:h=!0,shiftOptions:g,useArrow:y=!1,arrowOptions:x,transitionOptions:w,useAutoPlacement:E=!1,autoPlacementOptions:R,useAutoUpdate:O=!1,autoUpdateOptions:C,useAutoSize:S=!1,sizeOptions:_,minAcceptableWidth:j=null,minAcceptableHeight:k=null,maxAcceptableWidth:A,maxAcceptableHeight:L,onOpen:P,onClose:M})=>{const{theme:D}=J(),$=function(){const e=_n(),t=Pn(),n=Tn();return ft(()=>{if(!e)return;const r={id:e,parentId:n};return null==t||t.addNode(r),()=>{null==t||t.removeNode(r)}},[t,e,n]),e}(),[I,N]=(0,T.useState)(!1),F=(0,T.useRef)(null),W=e&&(s??I);(0,T.useEffect)(()=>{W&&P?.()},[W]),((e,t)=>{const n=(0,T.useRef)(e);(0,T.useEffect)(()=>{if(n.current!==e)return n.current=e,t(e)},[e])})(e,e=>{e||N(!1)});const H=[];f&&H.push((e=>{const t=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:u,middlewareData:c}=t,l=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),u=Tt(n),c=Pt(n),l="y"===$t(n),s=Yt.has(u)?-1:1,a=i&&l?-1:1,f=Lt(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:v}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&"number"==typeof v&&(p="end"===c?-1*v:v),l?{x:p*a,y:d*s}:{x:d*s,y:p*a}}(t,e);return u===(null==(n=c.offset)?void 0:n.placement)&&null!=(r=c.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:u}}}}}(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})(d??D.spacings.base));let z=null;if(E?H.push((e=>{const t=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,o;const{rects:i,middlewareData:u,placement:c,platform:l,elements:s}=t,{crossAxis:a=!1,alignment:f,allowedPlacements:d=Rt,autoAlignment:p=!0,...v}=Lt(e,t),m=void 0!==f||d===Rt?function(e,t,n){return(e?[...n.filter(t=>Pt(t)===e),...n.filter(t=>Pt(t)!==e)]:n.filter(e=>Tt(e)===e)).filter(n=>!e||Pt(n)===e||!!t&&Ft(n)!==n)}(f||null,p,d):d,h=(null==(n=u.autoPlacement)?void 0:n.index)||0,g=m[h];if(null==g)return{};if(c!==g)return{reset:{placement:m[0]}};const y=await l.detectOverflow(t,v),b=Nt(g,i,await(null==l.isRTL?void 0:l.isRTL(s.floating))),x=[y[Tt(g)],y[b[0]],y[b[1]]],w=[...(null==(r=u.autoPlacement)?void 0:r.overflows)||[],{placement:g,overflows:x}],E=m[h+1];if(E)return{data:{index:h+1,overflows:w},reset:{placement:E}};const R=w.map(e=>{const t=Pt(e.placement);return[e.placement,t&&a?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),O=(null==(o=R.filter(e=>e[2].slice(0,Pt(e[0])?2:3).every(e=>e<=0))[0])?void 0:o[0])||R[0][0];return O!==c?{data:{index:h+1,overflows:w},reset:{placement:O}}:{}}}}(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})(R)):v&&(z=(e=>{const t=dn(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})({crossAxis:!1,fallbackStrategy:"bestFit",...m})),S){const e=(e=>{const t=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:i}=t,{apply:u=()=>{},...c}=Lt(e,t),l=await o.detectOverflow(t,c),s=Tt(n),a=Pt(n),f="y"===$t(n),{width:d,height:p}=r.floating;let v,m;"top"===s||"bottom"===s?(v=s,m=a===(await(null==o.isRTL?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(m=s,v="end"===a?"top":"bottom");const h=p-l.top-l.bottom,g=d-l.left-l.right,y=Ot(p-l[v],h),b=Ot(d-l[m],g),x=t.middlewareData.shift,w=!x;let E=y,R=b;null!=x&&x.enabled.x&&(R=g),null!=x&&x.enabled.y&&(E=h),w&&!a&&(f?R=d-2*Ct(l.left,l.right):E=p-2*Ct(l.top,l.bottom)),await u({...t,availableWidth:R,availableHeight:E});const O=await o.getDimensions(i.floating);return d!==O.width||p!==O.height?{reset:{rects:!0}}:{}}}}(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})({..._,apply({elements:e,rects:t,availableWidth:n,availableHeight:r}){const o=b(j)?j(t.reference):j??t.reference.width,i=b(A)?A(t.reference):Math.min(n,A??1/0),u=b(k)?k(t.reference):k??0,c=b(L)?L(t.reference):Math.min(r,L??1/0);Object.assign(e.floating.style,{minWidth:`${Math.min(o,i)}px`,maxWidth:`${i}px`,minHeight:`${Math.min(u,c)}px`,maxHeight:`${c}px`})}});z?"initialPlacement"===m?.fallbackStrategy?H.push(e,z):H.push(z,e):H.push(e)}else z&&H.push(z);h&&H.push((e=>{const t=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:u=!0,crossAxis:c=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...s}=Lt(e,t),a={x:n,y:r},f=await i.detectOverflow(t,s),d=$t(o),p=Mt(d);let v=a[p],m=a[d];const h=(e,t)=>At(t+f["y"===e?"top":"left"],t,t-f["y"===e?"bottom":"right"]);u&&(v=h(p,v)),c&&(m=h(d,m));const g=l.fn({...t,[p]:v,[d]:m});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:u,[d]:c}}}}}}(e);return{name:t.name,fn:t.fn,options:[e,void 0]}})({padding:D.spacings.base,...g})),y&&H.push(((e,t)=>{const n=(e=>({name:"arrow",options:e,fn(t){const{element:n,padding:r}="function"==typeof e?e(t):e;return n&&(o=n,{}.hasOwnProperty.call(o,"current"))?null!=n.current?pn({element:n.current,padding:r}).fn(t):{}:n?pn({element:n,padding:r}).fn(t):{};var o}}))(e);return{name:n.name,fn:n.fn,options:[e,t]}})({element:F,padding:D.spacings.base,...x}));const B=function(e){var t,n;let{elements:r,...o}=void 0===e?{}:e;const{nodeId:i}=o,u=function(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=_n(),i=T.useRef({}),[u]=T.useState(()=>kn()),c=null!=Tn(),[l,s]=T.useState(r.reference),a=vt((e,t,r)=>{i.current.openEvent=e?t:void 0,u.emit("openchange",{open:e,event:t,reason:r,nested:c}),null==n||n(e,t,r)}),f=T.useMemo(()=>({setPositionReference:s}),[]),d=T.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return T.useMemo(()=>({dataRef:i,open:t,onOpenChange:a,elements:d,events:u,floatingId:o,refs:f}),[t,a,d,u,o,f])}({...o,elements:{reference:null!=(t=null==r?void 0:r.reference)?t:null,floating:null!=(n=null==r?void 0:r.floating)?n:null}}),c=o.rootContext||u,l=c.elements,[s,a]=T.useState(null),[f,d]=T.useState(null),v=(null==l?void 0:l.domReference)||s,m=T.useRef(null),h=Pn();ft(()=>{v&&(m.current=v)},[v]);const g=function(e){void 0===e&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:u}={},transform:c=!0,whileElementsMounted:l,open:s}=e,[a,f]=T.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,v]=T.useState(r);hn(d,r)||v(r);const[m,h]=T.useState(null),[g,y]=T.useState(null),b=T.useCallback(e=>{e!==R.current&&(R.current=e,h(e))},[]),x=T.useCallback(e=>{e!==O.current&&(O.current=e,y(e))},[]),w=i||m,E=u||g,R=T.useRef(null),O=T.useRef(null),C=T.useRef(a),S=null!=l,_=bn(l),j=bn(o),k=bn(s),A=T.useCallback(()=>{if(!R.current||!O.current)return;const e={placement:t,strategy:n,middleware:d};j.current&&(e.platform=j.current),vn(R.current,O.current,e).then(e=>{const t={...e,isPositioned:!1!==k.current};L.current&&!hn(C.current,t)&&(C.current=t,p().flushSync(()=>{f(t)}))})},[d,t,n,j,k]);mn(()=>{!1===s&&C.current.isPositioned&&(C.current.isPositioned=!1,f(e=>({...e,isPositioned:!1})))},[s]);const L=T.useRef(!1);mn(()=>(L.current=!0,()=>{L.current=!1}),[]),mn(()=>{if(w&&(R.current=w),E&&(O.current=E),w&&E){if(_.current)return _.current(w,E,A);A()}},[w,E,A,_,S]);const P=T.useMemo(()=>({reference:R,floating:O,setReference:b,setFloating:x}),[b,x]),M=T.useMemo(()=>({reference:w,floating:E}),[w,E]),D=T.useMemo(()=>{const e={position:n,left:0,top:0};if(!M.floating)return e;const t=yn(M.floating,a.x),r=yn(M.floating,a.y);return c?{...e,transform:"translate("+t+"px, "+r+"px)",...gn(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,c,M.floating,a.x,a.y]);return T.useMemo(()=>({...a,update:A,refs:P,elements:M,floatingStyles:D}),[a,A,P,M,D])}({...o,elements:{...l,...f&&{reference:f}}}),y=T.useCallback(e=>{const t=ae(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;d(t),g.refs.setReference(t)},[g.refs]),b=T.useCallback(e=>{(ae(e)||null===e)&&(m.current=e,a(e)),(ae(g.refs.reference.current)||null===g.refs.reference.current||null!==e&&!ae(e))&&g.refs.setReference(e)},[g.refs]),x=T.useMemo(()=>({...g.refs,setReference:b,setPositionReference:y,domReference:m}),[g.refs,b,y]),w=T.useMemo(()=>({...g.elements,domReference:v}),[g.elements,v]),E=T.useMemo(()=>({...g,...c,refs:x,elements:w,nodeId:i}),[g,x,w,i,c]);return ft(()=>{c.dataRef.current.floatingContext=E;const e=null==h?void 0:h.nodesRef.current.find(e=>e.id===i);e&&(e.context=E)}),T.useMemo(()=>({...g,context:E,refs:x,elements:w}),[g,x,w,E])}({nodeId:$,open:W,middleware:H,onOpenChange:(e,t,n)=>{N(e),e||M?.(n,t)},...O&&{whileElementsMounted:(e,t,n)=>function(e,t,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:u="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,s=Zt(e),a=o||i?[...s?_e(s):[],...t?_e(t):[]]:[];a.forEach(e=>{o&&e.addEventListener("scroll",n),i&&e.addEventListener("resize",n)});const f=s&&c?function(e,t,n){let r,o=null;const i=le(e);function u(){var e;clearTimeout(r),null==(e=o)||e.disconnect(),o=null}function c(n,l){void 0===n&&(n=!1),void 0===l&&(l=1),u();const s=e.getBoundingClientRect(),{left:a,top:f,width:d,height:p}=s;if(n||t(),!d||!p)return;const v={rootMargin:-_t(f)+"px "+-_t(i.clientWidth-(a+d))+"px "+-_t(i.clientHeight-(f+p))+"px "+-_t(a)+"px",threshold:Ct(0,Ot(1,l))||1};let m=!0;function h(t){const n=t[0].intersectionRatio;if(!fn(s,e.getBoundingClientRect()))return c();if(n!==l){if(!m)return c();n?c(!1,n):r=setTimeout(()=>{c(!1,1e-7)},1e3)}m=!1}try{o=new IntersectionObserver(h,{...v,root:i.ownerDocument})}catch(e){o=new IntersectionObserver(h,v)}o.observe(e)}const l=ce(e),s=()=>c(n);return l.addEventListener("resize",s),c(!0),()=>{l.removeEventListener("resize",s),u()}}(s,n,i):null;let d,p=-1,v=null;u&&(v=new ResizeObserver(e=>{let[r]=e;r&&r.target===s&&v&&t&&(v.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=v)||e.observe(t)})),n()}),s&&!l&&v.observe(s),t&&v.observe(t));let m=l?tn(e):null;return l&&function t(){const r=tn(e);m&&!fn(m,r)&&n(),m=r,d=requestAnimationFrame(t)}(),n(),()=>{var e;a.forEach(e=>{o&&e.removeEventListener("scroll",n),i&&e.removeEventListener("resize",n)}),null==f||f(),null==(e=v)||e.disconnect(),v=null,l&&cancelAnimationFrame(d)}}(e,t,n,C)},...a}),U=kr(B.context,{enabled:e,event:t,dismissOptions:n,clickOptions:r,hoverOptions:o,focusOptions:i,clientPointsOptions:u,roleOptions:c,extraInteractions:l}),K=function(e,t){void 0===t&&(t={});const{initial:n={opacity:0},open:r,close:o,common:i,duration:u=250}=t,c=e.placement,l=c.split("-")[0],s=T.useMemo(()=>({side:l,placement:c}),[l,c]),a="number"==typeof u,f=(a?u:u.open)||0,d=(a?u:u.close)||0,[v,m]=T.useState(()=>({...Er(i,s),...Er(n,s)})),{isMounted:h,status:g}=function(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,[u,c]=T.useState("unmounted"),l=function(e,t){const[n,r]=T.useState(e);return e&&!n&&r(!0),T.useEffect(()=>{if(!e&&n){const e=setTimeout(()=>r(!1),t);return()=>clearTimeout(e)}},[e,n,t]),n}(n,i);return l||"close"!==u||c("unmounted"),ft(()=>{if(r){if(n){c("initial");const e=requestAnimationFrame(()=>{p().flushSync(()=>{c("open")})});return()=>{cancelAnimationFrame(e)}}c("close")}},[n,r]),{isMounted:l,status:u}}(e,{duration:u}),y=dt(n),b=dt(r),x=dt(o),w=dt(i);return ft(()=>{const e=Er(y.current,s),t=Er(x.current,s),n=Er(w.current,s),r=Er(b.current,s)||Object.keys(e).reduce((e,t)=>(e[t]="",e),{});if("initial"===g&&m(t=>({transitionProperty:t.transitionProperty,...n,...e})),"open"===g&&m({transitionProperty:Object.keys(r).map(wr).join(","),transitionDuration:f+"ms",...n,...r}),"close"===g){const r=t||e;m({transitionProperty:Object.keys(r).map(wr).join(","),transitionDuration:d+"ms",...n,...r})}},[d,x,y,b,w,f,g,s]),{isMounted:h,styles:v}}(B.context,{duration:250,...w});return{nodeId:$,isOpen:W,floating:B,arrowRef:F,interactions:U,transition:K}},Lr=()=>{const e=(0,T.useContext)(oe);return y(e,"[@react-hive/honey-layout]: The `useHoneyPopupContext()` hook can only be used inside <HoneyPopup/> component."),e},Tr=({children:e,referenceUserProps:t,referenceProps:n,content:r,contentProps:o,focusManagerProps:i,arrowProps:u,portalProps:c,adjustStyles:l,context:s,...a})=>{const{useArrow:f,onClose:d}=a,p=q(d),{nodeId:v,floating:h,isOpen:g,arrowRef:y,interactions:b,transition:w}=Ar(a),E=(0,T.useCallback)(()=>{p.current?.("escape-key")},[]),R=(0,T.useMemo)(()=>({context:s,floatingContext:h.context}),[s,h.context]);return(0,m().jsx)(_r,{ref:h.refs.setReference,...b.getReferenceProps(t),...n,"data-testid":"honey-popup",children:(0,m().jsxs)(oe,{value:R,children:[x(e,R),(0,m().jsx)(Mn,{id:v,children:w.isMounted&&(0,m().jsx)(jr,{...c,children:(0,m().jsx)(fr,{context:h.context,disabled:!g,...i,children:(0,m().jsxs)(re,{ref:h.refs.setFloating,active:g,style:l?.({...h.floatingStyles,...w.styles},{middlewareData:h.middlewareData})??{...h.floatingStyles,...w.styles},onDeactivate:E,...b.getFloatingProps(),...o,"data-testid":"honey-popup-floating-content",children:[f&&(0,m().jsx)(jn,{ref:y,context:h.context,fill:"white",...u}),x(r,R)]})})})})]})})},Pr=({useTree:e=!1,...t})=>(0,m().jsx)(Sr,{enabled:e,children:(0,m().jsx)(Tr,{...t})}),Mr=l(L,{row:!0,centerY:!0})`
37
37
  cursor: pointer;
38
38
  `,Dr=({option:e,renderOption:t,...n})=>{const{context:r,floatingContext:o}=Lr(),i=b(e.disabled)?e.disabled({context:r,floatingContext:o}):!0===e.disabled;return(0,m().jsx)(Mr,{onClick:()=>{i||e.onClick?.({context:r,floatingContext:o})},role:"menuitem","aria-disabled":i,"data-testid":"honey-context-menu-option",...n,children:t?.({option:e,context:r,isDisabled:i})??e.label})},$r=({options:e,renderOption:t,optionProps:n,popupProps:r,...o})=>{const{floatingOptions:i}=r??{},{context:u,floatingContext:c}=Lr(),l=(0,T.useMemo)(()=>e?.filter(e=>b(e.visible)?e.visible({context:u,floatingContext:c}):!1!==e.visible),[e]);return(0,m().jsx)(z,{items:l,itemKey:"id","data-testid":"honey-context-menu-options",...o,children:e=>e.options?.length?(0,m().jsx)(Pr,{context:u,content:(0,m().jsx)($r,{options:e.options,renderOption:t,optionProps:n,popupProps:r,...o}),event:"hover",referenceProps:{$width:"100%"},floatingOptions:{placement:"right-start",...i},useArrow:!0,"data-testid":"honey-sub-context-menu",...r,children:(0,m().jsx)(Dr,{option:e,renderOption:t,...n})}):(0,m().jsx)(Dr,{option:e,renderOption:t,...n})})},Ir=({options:e,renderOption:t,optionProps:n,referenceUserProps:r,roleOptions:o,optionsProps:i,context:u,...c})=>(0,m().jsx)(Pr,{context:u,referenceUserProps:{onClick:e=>e.stopPropagation(),...r},content:(0,m().jsx)($r,{options:e,renderOption:t,optionProps:n,popupProps:c,...i}),roleOptions:{role:"menu",...o},useArrow:!0,"data-testid":"honey-context-menu",...c}),Nr=(0,T.createContext)(void 0),Fr=()=>{const e=(0,T.useContext)(Nr);return y(e,"[@react-hive/honey-layout]: The `useHoneyLayerRegistryContext()` hook can only be used inside <HoneyLayerRegistry/> component."),e},Wr=({children:e})=>{const t=(0,T.useContext)(Nr),[n,r]=(0,T.useState)([]),o=(0,T.useMemo)(()=>({layers:n,registerLayer:e=>{const t=w();return r(n=>[...n,{id:t,payload:e}]),t},unregisterLayer:e=>{r(t=>t.filter(t=>t.id!==e))},getLayerIndex:e=>n.findIndex(t=>t.id===e)}),[n]);return t?e:(0,m().jsx)(Nr,{value:o,children:e})},Hr=({children:e,theme:n,mediaQueryOptions:r,...o})=>{const i=Z(n,r),{getOverlaysSnapshot:u,registerOverlay:c,subscribeOverlays:l,unregisterOverlay:s}=(()=>{const e=(0,T.useRef)([]),t=(0,T.useRef)(new Set),n=(0,T.useCallback)(()=>e.current,[]),r=(0,T.useCallback)(e=>(t.current.add(e),()=>{t.current.delete(e)}),[]),o=(0,T.useCallback)(()=>{t.current.forEach(e=>e())},[]);(0,T.useEffect)(()=>{const t=t=>{e.current.length&&e.current[e.current.length-1].notifyListeners("keyup",t.code,t)};return document.addEventListener("keyup",t),()=>{document.removeEventListener("keyup",t)}},[]);const i=(0,T.useCallback)(t=>{const n=t.id??w(),r=[["keyup",t.onKeyUp]],i={current:null},u={containerRef:i,id:n,setContainerRef:e=>{i.current=e},addListener:(e,t)=>{r.push([e,t])},removeListener:(e,t)=>{const n=r.findIndex(([n,r])=>n===e&&r===t);-1!==n&&r.splice(n,1)},notifyListeners:(e,n,o)=>{const i=t.listenKeys??[];i.length&&!i.includes(n)||(o.preventDefault(),r.forEach(([t,r])=>{t===e&&r(n,u,o)}))}};return e.current=[...e.current,u],o(),u},[]),u=(0,T.useCallback)(t=>{const n=e.current.filter(e=>e.id!==t);n.length!==e.current.length&&(e.current=n,o())},[]);return(0,T.useMemo)(()=>({getOverlaysSnapshot:n,registerOverlay:i,subscribeOverlays:r,unregisterOverlay:u}),[])})(),a=(0,T.useMemo)(()=>({theme:n,screenState:i,getOverlaysSnapshot:u,registerOverlay:c,subscribeOverlays:l,unregisterOverlay:s}),[n,i]);return(0,m().jsx)(t,{theme:n,...o,children:(0,m().jsx)(Q,{value:a,children:e})})};var zr=d(117),Br=d.n(zr);const Ur=({theme:e,...n})=>{const r=(0,T.useContext)(Q),o=(0,T.useMemo)(()=>Br()(r?.theme,e),[r?.theme,e]);return(0,m().jsx)(t,{theme:o,...n})},Kr=({durationMs:e,timingFunction:t="ease-in-out",extraProperties:r=[],activeClassName:o})=>({active:i=!1})=>n`
39
39
  opacity: ${i?1:0};