@radui/ui 0.0.43 → 0.0.44

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.
@@ -0,0 +1,5 @@
1
+ 'use client';import*as e from"react";import t,{createContext as n,useLayoutEffect as r,useEffect as o,useRef as i,useState as c,forwardRef as l,useContext as u}from"react";import{jsxs as a,jsx as s,Fragment as f}from"react/jsx-runtime";import*as d from"react-dom";var p=function(){return p=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},p.apply(this,arguments)};function m(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}"function"==typeof SuppressedError&&SuppressedError;var v=n({rootClass:""}),h=n({isOpen:!1,handleOpenChange:function(){},handleOverlayClick:function(){},getItemProps:function(){},getReferenceProps:function(){},getFloatingProps:function(){},refs:{setReference:function(){},setFloating:function(){}},floatingStyles:{position:"absolute"}});function g(){return"undefined"!=typeof window}function y(e){return E(e)?(e.nodeName||"").toLowerCase():"#document"}function w(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function b(e){var t;return null==(t=(E(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function E(e){return!!g()&&(e instanceof Node||e instanceof w(e).Node)}function x(e){return!!g()&&(e instanceof Element||e instanceof w(e).Element)}function R(e){return!!g()&&(e instanceof HTMLElement||e instanceof w(e).HTMLElement)}function C(e){return!(!g()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof w(e).ShadowRoot)}function S(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=A(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function k(e){return["table","td","th"].includes(y(e))}function L(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function O(e){const t=P(),n=x(e)?A(e):e;return["transform","translate","scale","rotate","perspective"].some((e=>!!n[e]&&"none"!==n[e]))||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","translate","scale","rotate","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function P(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function T(e){return["html","body","#document"].includes(y(e))}function A(e){return w(e).getComputedStyle(e)}function M(e){return x(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function N(e){if("html"===y(e))return e;const t=e.assignedSlot||e.parentNode||C(e)&&e.host||b(e);return C(t)?t.host:t}function D(e){const t=N(e);return T(t)?e.ownerDocument?e.ownerDocument.body:e.body:R(t)&&S(t)?t:D(t)}function F(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=D(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),c=w(o);if(i){const e=I(c);return t.concat(c,c.visualViewport||[],S(o)?o:[],e&&n?F(e):[])}return t.concat(o,F(o,[],n))}function I(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function W(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 B(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&C(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function j(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function _(){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 H(e){return!_().includes("jsdom/")&&(!X()&&0===e.width&&0===e.height||X()&&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)}function V(){return/apple/i.test(navigator.vendor)}function X(){const e=/android/i;return e.test(j())||e.test(_())}function q(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}function Y(e){return(null==e?void 0:e.ownerDocument)||document}function K(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 U(e){return"composedPath"in e?e.composedPath()[0]:e.target}function $(e){return R(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function z(e){e.preventDefault(),e.stopPropagation()}const Z=["top","right","bottom","left"],G=Math.min,Q=Math.max,J=Math.round,ee=e=>({x:e,y:e}),te={left:"right",right:"left",bottom:"top",top:"bottom"},ne={start:"end",end:"start"};function re(e,t,n){return Q(e,G(t,n))}function oe(e,t){return"function"==typeof e?e(t):e}function ie(e){return e.split("-")[0]}function ce(e){return e.split("-")[1]}function le(e){return"x"===e?"y":"x"}function ue(e){return"y"===e?"height":"width"}function ae(e){return["top","bottom"].includes(ie(e))?"y":"x"}function se(e){return le(ae(e))}function fe(e){return e.replace(/start|end/g,(e=>ne[e]))}function de(e){return e.replace(/left|right|bottom|top/g,(e=>te[e]))}function pe(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function me(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}}
2
+ /*!
3
+ * tabbable 6.2.0
4
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
5
+ */var ve=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"].join(","),he="undefined"==typeof Element,ge=he?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ye=!he&&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},we=function e(t,n){var r;void 0===n&&(n=!0);var o=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},be=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var c=i.shift();if(!we(c,!1))if("SLOT"===c.tagName){var l=c.assignedElements(),u=e(l.length?l:c.children,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:c,candidates:u})}else{ge.call(c,ve)&&r.filter(c)&&(n||!t.includes(c))&&o.push(c);var a=c.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(c),s=!we(a,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(c));if(a&&s){var f=e(!0===a?c.children:a.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:c,candidates:f})}else i.unshift.apply(i,c.children)}}return o},Ee=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},xe=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))&&!Ee(e)?0:e.tabIndex},Re=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ce=function(e){return"INPUT"===e.tagName},Se=function(e){return function(e){return Ce(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||ye(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)},ke=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Le=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=ge.call(e,"details>summary:first-of-type")?e.parentElement:e;if(ge.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return ke(e)}else{if("function"==typeof r){for(var i=e;e;){var c=e.parentElement,l=ye(e);if(c&&!c.shadowRoot&&!0===r(c))return ke(e);e=e.assignedSlot?e.assignedSlot:c||l===e.ownerDocument?c:l.host}e=i}if(function(e){var t,n,r,o,i=e&&ye(e),c=null===(t=i)||void 0===t?void 0:t.host,l=!1;if(i&&i!==e)for(l=!!(null!==(n=c)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(c)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!l&&c;){var u,a,s;l=!(null===(a=c=null===(u=i=ye(c))||void 0===u?void 0:u.host)||void 0===a||null===(s=a.ownerDocument)||void 0===s||!s.contains(c))}return l}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Oe=function(e,t){return!(t.disabled||we(t)||function(e){return Ce(e)&&"hidden"===e.type}(t)||Le(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!!ge.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Pe=function(e,t){return!(Se(t)||xe(t)<0||!Oe(e,t))},Te=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ae=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,c=i?t.scopeParent:t,l=function(e,t){var n=xe(e);return n<0&&t&&!Ee(e)?0:n}(c,i),u=i?e(t.candidates):c;0===l?i?n.push.apply(n,u):n.push(c):r.push({documentOrder:o,tabIndex:l,item:t,isScope:i,content:u})})),r.sort(Re).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},Me=function(e,t){var n;return n=(t=t||{}).getShadowRoot?be([e],t.includeContainer,{filter:Pe.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Te}):function(e,t,n){if(we(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ve));return t&&ge.call(e,ve)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,Pe.bind(null,t)),Ae(n)};function Ne(e,t,n){let{reference:r,floating:o}=e;const i=ae(t),c=se(t),l=ue(c),u=ie(t),a="y"===i,s=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[l]/2-o[l]/2;let p;switch(u){case"top":p={x:s,y:r.y-o.height};break;case"bottom":p={x:s,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}}switch(ce(t)){case"start":p[c]-=d*(n&&a?-1:1);break;case"end":p[c]+=d*(n&&a?-1:1)}return p}async function De(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:c,elements:l,strategy:u}=e,{boundary:a="clippingAncestors",rootBoundary:s="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=oe(t,e),m=pe(p),v=l[d?"floating"===f?"reference":"floating":f],h=me(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(v)))||n?v:v.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(l.floating)),boundary:a,rootBoundary:s,strategy:u})),g="floating"===f?{x:r,y:o,width:c.floating.width,height:c.floating.height}:c.reference,y=await(null==i.getOffsetParent?void 0:i.getOffsetParent(l.floating)),w=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},b=me(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:g,offsetParent:y,strategy:u}):g);return{top:(h.top-b.top+m.top)/w.y,bottom:(b.bottom-h.bottom+m.bottom)/w.y,left:(h.left-b.left+m.left)/w.x,right:(b.right-h.right+m.right)/w.x}}function Fe(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ie(e){return Z.some((t=>e[t]>=0))}function We(e){const t=A(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=R(e),i=o?e.offsetWidth:n,c=o?e.offsetHeight:r,l=J(n)!==i||J(r)!==c;return l&&(n=i,r=c),{width:n,height:r,$:l}}function Be(e){return x(e)?e:e.contextElement}function je(e){const t=Be(e);if(!R(t))return ee(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=We(t);let c=(i?J(n.width):n.width)/r,l=(i?J(n.height):n.height)/o;return c&&Number.isFinite(c)||(c=1),l&&Number.isFinite(l)||(l=1),{x:c,y:l}}const _e=ee(0);function He(e){const t=w(e);return P()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:_e}function Ve(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=Be(e);let c=ee(1);t&&(r?x(r)&&(c=je(r)):c=je(e));const l=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==w(e))&&t}(i,n,r)?He(i):ee(0);let u=(o.left+l.x)/c.x,a=(o.top+l.y)/c.y,s=o.width/c.x,f=o.height/c.y;if(i){const e=w(i),t=r&&x(r)?w(r):r;let n=e,o=I(n);for(;o&&r&&t!==n;){const e=je(o),t=o.getBoundingClientRect(),r=A(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,c=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;u*=e.x,a*=e.y,s*=e.x,f*=e.y,u+=i,a+=c,n=w(o),o=I(n)}}return me({width:s,height:f,x:u,y:a})}function Xe(e,t){const n=M(e).scrollLeft;return t?t.left+n:Ve(b(e)).left+n}function qe(e,t,n){void 0===n&&(n=!1);const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:Xe(e,r)),y:r.top+t.scrollTop}}function Ye(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=w(e),r=b(e),o=n.visualViewport;let i=r.clientWidth,c=r.clientHeight,l=0,u=0;if(o){i=o.width,c=o.height;const e=P();(!e||e&&"fixed"===t)&&(l=o.offsetLeft,u=o.offsetTop)}return{width:i,height:c,x:l,y:u}}(e,n);else if("document"===t)r=function(e){const t=b(e),n=M(e),r=e.ownerDocument.body,o=Q(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Q(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let c=-n.scrollLeft+Xe(e);const l=-n.scrollTop;return"rtl"===A(r).direction&&(c+=Q(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:c,y:l}}(b(e));else if(x(t))r=function(e,t){const n=Ve(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=R(e)?je(e):ee(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=He(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return me(r)}function Ke(e,t){const n=N(e);return!(n===t||!x(n)||T(n))&&("fixed"===A(n).position||Ke(n,t))}function Ue(e,t,n){const r=R(t),o=b(t),i="fixed"===n,c=Ve(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const u=ee(0);if(r||!r&&!i)if(("body"!==y(t)||S(o))&&(l=M(t)),r){const e=Ve(t,!0,i,t);u.x=e.x+t.clientLeft,u.y=e.y+t.clientTop}else o&&(u.x=Xe(o));const a=!o||r||i?ee(0):qe(o,l);return{x:c.left+l.scrollLeft-u.x-a.x,y:c.top+l.scrollTop-u.y-a.y,width:c.width,height:c.height}}function $e(e){return"static"===A(e).position}function ze(e,t){if(!R(e)||"fixed"===A(e).position)return null;if(t)return t(e);let n=e.offsetParent;return b(e)===n&&(n=n.ownerDocument.body),n}function Ze(e,t){const n=w(e);if(L(e))return n;if(!R(e)){let t=N(e);for(;t&&!T(t);){if(x(t)&&!$e(t))return t;t=N(t)}return n}let r=ze(e,t);for(;r&&k(r)&&$e(r);)r=ze(r,t);return r&&T(r)&&$e(r)&&!O(r)?n:r||function(e){let t=N(e);for(;R(t)&&!T(t);){if(O(t))return t;if(L(t))return null;t=N(t)}return null}(e)||n}const Ge={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,c=b(r),l=!!t&&L(t.floating);if(r===c||l&&i)return n;let u={scrollLeft:0,scrollTop:0},a=ee(1);const s=ee(0),f=R(r);if((f||!f&&!i)&&(("body"!==y(r)||S(c))&&(u=M(r)),R(r))){const e=Ve(r);a=je(r),s.x=e.x+r.clientLeft,s.y=e.y+r.clientTop}const d=!c||f||i?ee(0):qe(c,u,!0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-u.scrollLeft*a.x+s.x+d.x,y:n.y*a.y-u.scrollTop*a.y+s.y+d.y}},getDocumentElement:b,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?L(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=F(e,[],!1).filter((e=>x(e)&&"body"!==y(e))),o=null;const i="fixed"===A(e).position;let c=i?N(e):e;for(;x(c)&&!T(c);){const t=A(c),n=O(c);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||S(c)&&!n&&Ke(e,c))?r=r.filter((e=>e!==c)):o=t,c=N(c)}return t.set(e,r),r}(t,this._c):[].concat(n),r],c=i[0],l=i.reduce(((e,n)=>{const r=Ye(t,n,o);return e.top=Q(r.top,e.top),e.right=G(r.right,e.right),e.bottom=G(r.bottom,e.bottom),e.left=Q(r.left,e.left),e}),Ye(t,c,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:Ze,getElementRects:async function(e){const t=this.getOffsetParent||Ze,n=this.getDimensions,r=await n(e.floating);return{reference:Ue(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=We(e);return{width:t,height:n}},getScale:je,isElement:x,isRTL:function(e){return"rtl"===A(e).direction}},Qe=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:c,middlewareData:l}=t,u=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),c=ie(n),l=ce(n),u="y"===ae(n),a=["left","top"].includes(c)?-1:1,s=i&&u?-1:1,f=oe(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&"number"==typeof m&&(p="end"===l?-1*m:m),u?{x:p*s,y:d*a}:{x:d*a,y:p*s}}(t,e);return c===(null==(n=l.offset)?void 0:n.placement)&&null!=(r=l.arrow)&&r.alignmentOffset?{}:{x:o+u.x,y:i+u.y,data:{...u,placement:c}}}}},Je=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:l={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...u}=oe(e,t),a={x:n,y:r},s=await De(t,u),f=ae(ie(o)),d=le(f);let p=a[d],m=a[f];if(i){const e="y"===d?"bottom":"right";p=re(p+s["y"===d?"top":"left"],p,p-s[e])}if(c){const e="y"===f?"bottom":"right";m=re(m+s["y"===f?"top":"left"],m,m-s[e])}const v=l.fn({...t,[d]:p,[f]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[d]:i,[f]:c}}}}}},et=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:c,initialPlacement:l,platform:u,elements:a}=t,{mainAxis:s=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...h}=oe(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const g=ie(o),y=ae(l),w=ie(l)===l,b=await(null==u.isRTL?void 0:u.isRTL(a.floating)),E=d||(w||!v?[de(l)]:function(e){const t=de(e);return[fe(e),t,fe(t)]}(l)),x="none"!==m;!d&&x&&E.push(...function(e,t,n,r){const o=ce(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],c=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:c;default:return[]}}(ie(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(fe)))),i}(l,v,m,b));const R=[l,...E],C=await De(t,h),S=[];let k=(null==(r=i.flip)?void 0:r.overflows)||[];if(s&&S.push(C[g]),f){const e=function(e,t,n){void 0===n&&(n=!1);const r=ce(e),o=se(e),i=ue(o);let c="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(c=de(c)),[c,de(c)]}(o,c,b);S.push(C[e[0]],C[e[1]])}if(k=[...k,{placement:o,overflows:S}],!S.every((e=>e<=0))){var L,O;const e=((null==(L=i.flip)?void 0:L.index)||0)+1,t=R[e];if(t)return{data:{index:e,overflows:k},reset:{placement:t}};let n=null==(O=k.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:O.placement;if(!n)switch(p){case"bestFit":{var P;const e=null==(P=k.filter((e=>{if(x){const t=ae(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:P[0];e&&(n=e);break}case"initialPlacement":n=l}if(o!==n)return{reset:{placement:n}}}return{}}}},tt=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=oe(e,t);switch(r){case"referenceHidden":{const e=Fe(await De(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ie(e)}}}case"escaped":{const e=Fe(await De(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ie(e)}}}default:return{}}}}},nt=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:c,elements:l,middlewareData:u}=t,{element:a,padding:s=0}=oe(e,t)||{};if(null==a)return{};const f=pe(s),d={x:n,y:r},p=se(o),m=ue(p),v=await c.getDimensions(a),h="y"===p,g=h?"top":"left",y=h?"bottom":"right",w=h?"clientHeight":"clientWidth",b=i.reference[m]+i.reference[p]-d[p]-i.floating[m],E=d[p]-i.reference[p],x=await(null==c.getOffsetParent?void 0:c.getOffsetParent(a));let R=x?x[w]:0;R&&await(null==c.isElement?void 0:c.isElement(x))||(R=l.floating[w]||i.floating[m]);const C=b/2-E/2,S=R/2-v[m]/2-1,k=G(f[g],S),L=G(f[y],S),O=k,P=R-v[m]-L,T=R/2-v[m]/2+C,A=re(O,T,P),M=!u.arrow&&null!=ce(o)&&T!==A&&i.reference[m]/2-(T<O?k:L)-v[m]/2<0,N=M?T<O?T-O:T-P:0;return{[p]:d[p]+N,data:{[p]:A,centerOffset:T-A-N,...M&&{alignmentOffset:N}},reset:M}}}),rt=(e,t,n)=>{const r=new Map,o={platform:Ge,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:c}=n,l=i.filter(Boolean),u=await(null==c.isRTL?void 0:c.isRTL(t));let a=await c.getElementRects({reference:e,floating:t,strategy:o}),{x:s,y:f}=Ne(a,r,u),d=r,p={},m=0;for(let n=0;n<l.length;n++){const{name:i,fn:v}=l[n],{x:h,y:g,data:y,reset:w}=await v({x:s,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:a,platform:c,elements:{reference:e,floating:t}});s=null!=h?h:s,f=null!=g?g:f,p={...p,[i]:{...p[i],...y}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(a=!0===w.rects?await c.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:s,y:f}=Ne(a,d,u))),n=-1)}return{x:s,y:f,placement:d,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var ot="undefined"!=typeof document?r:o;function it(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(!it(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)&&!it(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function ct(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function lt(e,t){const n=ct(e);return Math.round(t*n)/n}function ut(t){const n=e.useRef(t);return ot((()=>{n.current=t})),n}const at=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?nt({element:n.current,padding:r}).fn(t):{}:n?nt({element:n,padding:r}).fn(t):{};var o}});function st(t){return e.useMemo((()=>t.every((e=>null==e))?null:e=>{t.forEach((t=>{"function"==typeof t?t(e):null!=t&&(t.current=e)}))}),t)}const ft={...e},dt=ft.useInsertionEffect||(e=>e());function pt(t){const n=e.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return dt((()=>{n.current=t})),e.useCallback((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return null==n.current?void 0:n.current(...t)}),[])}var mt="undefined"!=typeof document?r:o;let vt=!1,ht=0;const gt=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+ht++;const yt=ft.useId||function(){const[t,n]=e.useState((()=>vt?gt():void 0));return mt((()=>{null==t&&n(gt())}),[]),e.useEffect((()=>{vt=!0}),[]),t};let wt;"production"!==process.env.NODE_ENV&&(wt=new Set);const bt=e.forwardRef((function(t,n){const{context:{placement:r,elements:{floating:o},middlewareData:{arrow:i,shift:c}},width:l=14,height:u=7,tipRadius:f=0,strokeWidth:d=0,staticOffset:p,stroke:m,d:v,style:{transform:h,...g}={},...y}=t;"production"!==process.env.NODE_ENV&&(n||function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");var i;null!=(e=wt)&&e.has(o)||(null==(i=wt)||i.add(o),console.warn(o))}("The `ref` prop is required for `FloatingArrow`."));const w=yt(),[b,E]=e.useState(!1);if(mt((()=>{if(!o)return;"rtl"===A(o).direction&&E(!0)}),[o]),!o)return null;const[x,R]=r.split("-"),C="top"===x||"bottom"===x;let S=p;(C&&null!=c&&c.x||!C&&null!=c&&c.y)&&(S=null);const k=2*d,L=k/2,O=l/2*(f/-8+1),P=u/2*f/4,T=!!v,M=S&&"end"===R?"bottom":"top";let N=S&&"end"===R?"right":"left";S&&b&&(N="end"===R?"left":"right");const D=null!=(null==i?void 0:i.x)?S||i.x:"",F=null!=(null==i?void 0:i.y)?S||i.y:"",I=v||"M0,0 H"+l+" L"+(l-O)+","+(u-P)+" Q"+l/2+","+u+" "+O+","+(u-P)+" Z",W={top:T?"rotate(180deg)":"",left:T?"rotate(90deg)":"rotate(-90deg)",bottom:T?"":"rotate(180deg)",right:T?"rotate(-90deg)":"rotate(90deg)"}[x];return a("svg",{...y,"aria-hidden":!0,ref:n,width:T?l:l+k,height:l,viewBox:"0 0 "+l+" "+(u>l?u:l),style:{position:"absolute",pointerEvents:"none",[N]:D,[M]:F,[x]:C||T?"100%":"calc(100% - "+k/2+"px)",transform:[W,h].filter((e=>!!e)).join(" "),...g},children:[k>0&&s("path",{clipPath:"url(#"+w+")",fill:"none",stroke:m,strokeWidth:k+(v?0:1),d:I}),s("path",{stroke:k&&!v?y.fill:"none",d:I}),s("clipPath",{id:w,children:s("rect",{x:-L,y:L*(T?-1:1),width:l+k,height:l})})]})}));const Et=e.createContext(null),xt=e.createContext(null),Rt=()=>{var t;return(null==(t=e.useContext(Et))?void 0:t.id)||null},Ct=()=>e.useContext(xt);function St(e){return"data-floating-ui-"+e}function kt(e){const t=i(e);return mt((()=>{t.current=e})),t}const Lt=St("safe-polygon");function Ot(e,t,n){return n&&!q(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}let Pt=0;function Tt(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Pt);const i=()=>null==e?void 0:e.focus({preventScroll:n});o?i():Pt=requestAnimationFrame(i)}function At(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 Mt(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}let Nt=new WeakMap,Dt=new WeakSet,Ft={},It=0;const Wt=e=>e&&(e.host||Wt(e.parentNode));function Bt(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,c=(l=t,e.map((e=>{if(l.contains(e))return e;const t=Wt(e);return l.contains(t)?t:null})).filter((e=>null!=e)));var l;const u=new Set,a=new Set(c),s=[];Ft[o]||(Ft[o]=new WeakMap);const f=Ft[o];return c.forEach((function e(t){if(!t||u.has(t))return;u.add(t),t.parentNode&&e(t.parentNode)})),function e(t){if(!t||a.has(t))return;[].forEach.call(t.children,(t=>{if("script"!==y(t))if(u.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=Nt.get(t)||0,c=i?r+1:r,l=(f.get(t)||0)+1;Nt.set(t,c),f.set(t,l),s.push(t),1===c&&n&&Dt.add(t),1===l&&t.setAttribute(o,""),!n&&i&&t.setAttribute(i,"true")}}))}(t),u.clear(),It++,()=>{s.forEach((e=>{const t=Nt.get(e)||0,n=i?t-1:t,r=(f.get(e)||0)-1;Nt.set(e,n),f.set(e,r),n||(!Dt.has(e)&&i&&e.removeAttribute(i),Dt.delete(e)),r||e.removeAttribute(o)})),It--,It||(Nt=new WeakMap,Nt=new WeakMap,Dt=new WeakSet,Ft={})}}function jt(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=Y(e[0]).body;return Bt(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const _t=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Ht(e,t){const n=Me(e,_t());"prev"===t&&n.reverse();const r=n.indexOf(W(Y(e)));return n.slice(r+1)[0]}function Vt(){return Ht(document.body,"next")}function Xt(){return Ht(document.body,"prev")}function qt(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!B(n,r)}function Yt(e){Me(e,_t()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function Kt(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const Ut={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function $t(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const zt=e.forwardRef((function(t,n){const[r,o]=e.useState();mt((()=>(V()&&o("button"),document.addEventListener("keydown",$t),()=>{document.removeEventListener("keydown",$t)})),[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":!r||void 0,[St("focus-guard")]:"",style:Ut};return s("span",{...t,...i})})),Zt=e.createContext(null),Gt=St("portal");const Qt=()=>e.useContext(Zt),Jt="data-floating-ui-focusable";function en(e){return e?e.hasAttribute(Jt)?e:e.querySelector("["+Jt+"]")||e:null}let tn=[];function nn(e){tn=tn.filter((e=>e.isConnected)),e&&"body"!==y(e)&&(tn.push(e),tn.length>20&&(tn=tn.slice(-20)))}function rn(){return tn.slice().reverse().find((e=>e.isConnected))}function on(e){const t=_t();return function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==ge.call(e,ve)&&Pe(t,e)}(e,t)?e:Me(e,t)[0]||e}const cn=e.forwardRef((function(e,t){return s("button",{...e,type:"button",ref:t,tabIndex:-1,style:Ut})}));let ln=0;let un=()=>{};const an=e.forwardRef((function(e,t){const{lockScroll:n=!1,...r}=e;return mt((()=>{if(n)return ln++,1===ln&&(un=function(){const e=/iP(hone|ad|od)|iOS/.test(j()),t=document.body.style,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",r=window.innerWidth-document.documentElement.clientWidth,o=t.left?parseFloat(t.left):window.scrollX,i=t.top?parseFloat(t.top):window.scrollY;if(t.overflow="hidden",r&&(t[n]=r+"px"),e){var c,l;const e=(null==(c=window.visualViewport)?void 0:c.offsetLeft)||0,n=(null==(l=window.visualViewport)?void 0:l.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(i-Math.floor(n))+"px",left:-(o-Math.floor(e))+"px",right:"0"})}return()=>{Object.assign(t,{overflow:"",[n]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(o,i))}}()),()=>{ln--,0===ln&&un()}}),[n]),s("div",{ref:t,...r,style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}})})),sn={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},fn={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},dn=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 pn(t){const{open:n=!1,onOpenChange:r,elements:o}=t,i=yt(),c=e.useRef({}),[l]=e.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}())),u=null!=Rt();if("production"!==process.env.NODE_ENV){const e=o.reference;e&&!x(e)&&function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");var i;null!=(e=wt)&&e.has(o)||(null==(i=wt)||i.add(o),console.error(o))}("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,s]=e.useState(o.reference),f=pt(((e,t,n)=>{c.current.openEvent=e?t:void 0,l.emit("openchange",{open:e,event:t,reason:n,nested:u}),null==r||r(e,t,n)})),d=e.useMemo((()=>({setPositionReference:s})),[]),p=e.useMemo((()=>({reference:a||o.reference||null,floating:o.floating||null,domReference:o.reference})),[a,o.reference,o.floating]);return e.useMemo((()=>({dataRef:c,open:n,onOpenChange:f,elements:p,events:l,floatingId:i,refs:d})),[n,f,p,l,i,d])}const mn="active",vn="selected";function hn(e,t,n){const r=new Map,o="item"===n;let i=e;if(o&&e){const{[mn]:t,[vn]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1,[Jt]:""},...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 c;o&&[mn,vn].includes(n)||(0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof i&&(null==(c=r.get(n))||c.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 gn=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);var yn={Portal:function(t){const{children:n,id:r,root:o,preserveTabOrder:i=!0}=t,c=function(t){void 0===t&&(t={});const{id:n,root:r}=t,o=yt(),i=Qt(),[c,l]=e.useState(null),u=e.useRef(null);return mt((()=>()=>{null==c||c.remove(),queueMicrotask((()=>{u.current=null}))}),[c]),mt((()=>{if(!o)return;if(u.current)return;const e=n?document.getElementById(n):null;if(!e)return;const t=document.createElement("div");t.id=o,t.setAttribute(Gt,""),e.appendChild(t),u.current=t,l(t)}),[n,o]),mt((()=>{if(null===r)return;if(!o)return;if(u.current)return;let e=r||(null==i?void 0:i.portalNode);e&&!x(e)&&(e=e.current),e=e||document.body;let t=null;n&&(t=document.createElement("div"),t.id=n,e.appendChild(t));const c=document.createElement("div");c.id=o,c.setAttribute(Gt,""),e=t||e,e.appendChild(c),u.current=c,l(c)}),[n,r,o,i]),c}({id:r,root:o}),[l,u]=e.useState(null),f=e.useRef(null),p=e.useRef(null),m=e.useRef(null),v=e.useRef(null),h=null==l?void 0:l.modal,g=null==l?void 0:l.open,y=!!l&&!l.modal&&l.open&&i&&!(!o&&!c);return e.useEffect((()=>{if(c&&i&&!h)return c.addEventListener("focusin",e,!0),c.addEventListener("focusout",e,!0),()=>{c.removeEventListener("focusin",e,!0),c.removeEventListener("focusout",e,!0)};function e(e){if(c&&qt(e)){("focusin"===e.type?Kt:Yt)(c)}}}),[c,i,h]),e.useEffect((()=>{c&&(g||Kt(c))}),[g,c]),a(Zt.Provider,{value:e.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:f,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:v,portalNode:c,setFocusManagerState:u})),[i,c]),children:[y&&c&&s(zt,{"data-type":"outside",ref:f,onFocus:e=>{if(qt(e,c)){var t;null==(t=m.current)||t.focus()}else{const e=Xt()||(null==l?void 0:l.domReference);null==e||e.focus()}}}),y&&c&&s("span",{"aria-owns":c.id,style:Ut}),c&&d.createPortal(n,c),y&&c&&s(zt,{"data-type":"outside",ref:p,onFocus:e=>{if(qt(e,c)){var t;null==(t=v.current)||t.focus()}else{const t=Vt()||(null==l?void 0:l.domReference);null==t||t.focus(),(null==l?void 0:l.closeOnFocusOut)&&(null==l||l.onOpenChange(!1,e.nativeEvent,"focus-out"))}}})]})},Overlay:an,FocusManager:function(t){const{context:n,children:r,disabled:o=!1,order:i=["content"],guards:c=!0,initialFocus:l=0,returnFocus:u=!0,restoreFocus:d=!1,modal:p=!0,visuallyHiddenDismiss:m=!1,closeOnFocusOut:v=!0,outsideElementsInert:h=!1}=t,{open:g,onOpenChange:y,events:w,dataRef:b,elements:{domReference:E,floating:x}}=n,C=pt((()=>{var e;return null==(e=b.current.floatingContext)?void 0:e.nodeId})),S="number"==typeof l&&l<0,k=!!(L=E)&&"combobox"===L.getAttribute("role")&&$(L)&&S;var L;const O="undefined"!=typeof HTMLElement&&"inert"in HTMLElement.prototype,P=!O||c,T=!P||O&&h,A=kt(i),M=kt(l),N=kt(u),D=Ct(),F=Qt(),I=e.useRef(null),j=e.useRef(null),_=e.useRef(!1),V=e.useRef(!1),q=e.useRef(-1),K=null!=F,Z=en(x),G=pt((function(e){return void 0===e&&(e=Z),e?Me(e,_t()):[]})),Q=pt((e=>{const t=G(e);return A.current.map((e=>E&&"reference"===e?E:Z&&"floating"===e?Z:t)).filter(Boolean).flat()}));e.useEffect((()=>{if(o)return;if(!p)return;function e(e){if("Tab"===e.key){B(Z,W(Y(Z)))&&0===G().length&&!k&&z(e);const t=Q(),n=U(e);"reference"===A.current[0]&&n===E&&(z(e),e.shiftKey?Tt(t[t.length-1]):Tt(t[1])),"floating"===A.current[1]&&n===Z&&e.shiftKey&&(z(e),Tt(t[0]))}}const t=Y(Z);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[o,E,Z,p,A,k,G,Q]),e.useEffect((()=>{if(!o&&x)return x.addEventListener("focusin",e),()=>{x.removeEventListener("focusin",e)};function e(e){const t=U(e),n=G().indexOf(t);-1!==n&&(q.current=n)}}),[o,x,G]),e.useEffect((()=>{if(!o&&v)return x&&R(E)?(E.addEventListener("focusout",t),E.addEventListener("pointerdown",e),x.addEventListener("focusout",t),()=>{E.removeEventListener("focusout",t),E.removeEventListener("pointerdown",e),x.removeEventListener("focusout",t)}):void 0;function e(){V.current=!0,setTimeout((()=>{V.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const n=C(),r=!(B(E,t)||B(x,t)||B(t,x)||B(null==F?void 0:F.portalNode,t)||null!=t&&t.hasAttribute(St("focus-guard"))||D&&(Mt(D.nodesRef.current,n).find((e=>{var n,r;return B(null==(n=e.context)?void 0:n.elements.floating,t)||B(null==(r=e.context)?void 0:r.elements.domReference,t)}))||At(D.nodesRef.current,n).find((e=>{var n,r,o;return[null==(n=e.context)?void 0:n.elements.floating,en(null==(r=e.context)?void 0:r.elements.floating)].includes(t)||(null==(o=e.context)?void 0:o.elements.domReference)===t}))));if(d&&r&&W(Y(Z))===Y(Z).body){R(Z)&&Z.focus();const e=q.current,t=G(),n=t[e]||t[t.length-1]||Z;R(n)&&n.focus()}!k&&p||!t||!r||V.current||t===rn()||(_.current=!0,y(!1,e,"focus-out"))}))}}),[o,E,x,Z,p,D,F,y,v,d,G,k,C]);const J=e.useRef(null),ee=e.useRef(null),te=st([J,null==F?void 0:F.beforeInsideRef]),ne=st([ee,null==F?void 0:F.afterInsideRef]);function re(e){return!o&&m&&p?s(cn,{ref:"start"===e?I:j,onClick:e=>y(!1,e.nativeEvent),children:"string"==typeof m?m:"Dismiss"}):null}e.useEffect((()=>{var e;if(o)return;if(!x)return;const t=Array.from((null==F||null==(e=F.portalNode)?void 0:e.querySelectorAll("["+St("portal")+"]"))||[]),n=D&&!p?At(null==D?void 0:D.nodesRef.current,C()).map((e=>{var t;return null==(t=e.context)?void 0:t.elements.floating})):[],r=[x,...t,...n,I.current,j.current,J.current,ee.current,null==F?void 0:F.beforeOutsideRef.current,null==F?void 0:F.afterOutsideRef.current,A.current.includes("reference")||k?E:null].filter((e=>null!=e)),i=p||k?jt(r,!T,T):jt(r);return()=>{i()}}),[o,E,x,p,A,F,k,P,T,D,C]),mt((()=>{if(o||!R(Z))return;const e=W(Y(Z));queueMicrotask((()=>{const t=Q(Z),n=M.current,r=("number"==typeof n?t[n]:n.current)||Z,o=B(Z,e);S||o||!g||Tt(r,{preventScroll:r===Z})}))}),[o,g,Z,S,Q,M]),mt((()=>{if(o||!Z)return;let e=!1;const t=Y(Z),n=W(t);let r=b.current.openEvent;function i(t){let{open:n,reason:o,event:i,nested:c}=t;n&&(r=i),"escape-key"===o&&E&&nn(E),["hover","safe-polygon"].includes(o)&&"mouseleave"===i.type&&(_.current=!0),"outside-press"===o&&(c?(_.current=!1,e=!0):_.current=!(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(X()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(i)||H(i)))}nn(n),w.on("openchange",i);const c=t.createElement("span");return c.setAttribute("tabindex","-1"),c.setAttribute("aria-hidden","true"),Object.assign(c.style,Ut),K&&E&&E.insertAdjacentElement("afterend",c),()=>{w.off("openchange",i);const n=W(t),o=B(x,n)||D&&Mt(D.nodesRef.current,C()).some((e=>{var t;return B(null==(t=e.context)?void 0:t.elements.floating,n)}));(o||r&&["click","mousedown"].includes(r.type))&&E&&nn(E);const l="boolean"==typeof N.current?rn()||c:N.current.current||c;queueMicrotask((()=>{const r=on(l);N.current&&!_.current&&R(r)&&(r===n||n===t.body||o)&&r.focus({preventScroll:e}),c.remove()}))}}),[o,x,Z,N,b,w,D,K,E,C]),e.useEffect((()=>{queueMicrotask((()=>{_.current=!1}))}),[o]),mt((()=>{if(!o&&F)return F.setFocusManagerState({modal:p,closeOnFocusOut:v,open:g,onOpenChange:y,domReference:E}),()=>{F.setFocusManagerState(null)}}),[o,F,p,g,y,v,E]),mt((()=>{if(o)return;if(!Z)return;if("function"!=typeof MutationObserver)return;if(S)return;const e=()=>{const e=Z.getAttribute("tabindex"),t=G(),n=W(Y(x)),r=t.indexOf(n);-1!==r&&(q.current=r),A.current.includes("floating")||n!==E&&0===t.length?"0"!==e&&Z.setAttribute("tabindex","0"):"-1"!==e&&Z.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(Z,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}}),[o,x,Z,E,A,G,S]);const oe=!o&&P&&(!p||!k)&&(K||p);return a(f,{children:[oe&&s(zt,{"data-type":"inside",ref:te,onFocus:e=>{if(p){const e=Q();Tt("reference"===i[0]?e[0]:e[e.length-1])}else if(null!=F&&F.preserveTabOrder&&F.portalNode)if(_.current=!1,qt(e,F.portalNode)){const e=Vt()||E;null==e||e.focus()}else{var t;null==(t=F.beforeOutsideRef.current)||t.focus()}}}),!k&&re("start"),r,re("end"),oe&&s(zt,{"data-type":"inside",ref:ne,onFocus:e=>{if(p)Tt(Q()[0]);else if(null!=F&&F.preserveTabOrder&&F.portalNode)if(v&&(_.current=!0),qt(e,F.portalNode)){const e=Xt()||E;null==e||e.focus()}else{var t;null==(t=F.afterOutsideRef.current)||t.focus()}}})]})},useFloating:function(t){void 0===t&&(t={});const{nodeId:n}=t,r=pn({...t,elements:{reference:null,floating:null,...t.elements}}),o=t.rootContext||r,i=o.elements,[c,l]=e.useState(null),[u,a]=e.useState(null),s=(null==i?void 0:i.domReference)||c,f=e.useRef(null),p=Ct();mt((()=>{s&&(f.current=s)}),[s]);const m=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:c,floating:l}={},transform:u=!0,whileElementsMounted:a,open:s}=t,[f,p]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[m,v]=e.useState(o);it(m,o)||v(o);const[h,g]=e.useState(null),[y,w]=e.useState(null),b=e.useCallback((e=>{e!==C.current&&(C.current=e,g(e))}),[]),E=e.useCallback((e=>{e!==S.current&&(S.current=e,w(e))}),[]),x=c||h,R=l||y,C=e.useRef(null),S=e.useRef(null),k=e.useRef(f),L=null!=a,O=ut(a),P=ut(i),T=ut(s),A=e.useCallback((()=>{if(!C.current||!S.current)return;const e={placement:n,strategy:r,middleware:m};P.current&&(e.platform=P.current),rt(C.current,S.current,e).then((e=>{const t={...e,isPositioned:!1!==T.current};M.current&&!it(k.current,t)&&(k.current=t,d.flushSync((()=>{p(t)})))}))}),[m,n,r,P,T]);ot((()=>{!1===s&&k.current.isPositioned&&(k.current.isPositioned=!1,p((e=>({...e,isPositioned:!1}))))}),[s]);const M=e.useRef(!1);ot((()=>(M.current=!0,()=>{M.current=!1})),[]),ot((()=>{if(x&&(C.current=x),R&&(S.current=R),x&&R){if(O.current)return O.current(x,R,A);A()}}),[x,R,A,O,L]);const N=e.useMemo((()=>({reference:C,floating:S,setReference:b,setFloating:E})),[b,E]),D=e.useMemo((()=>({reference:x,floating:R})),[x,R]),F=e.useMemo((()=>{const e={position:r,left:0,top:0};if(!D.floating)return e;const t=lt(D.floating,f.x),n=lt(D.floating,f.y);return u?{...e,transform:"translate("+t+"px, "+n+"px)",...ct(D.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,u,D.floating,f.x,f.y]);return e.useMemo((()=>({...f,update:A,refs:N,elements:D,floatingStyles:F})),[f,A,N,D,F])}({...t,elements:{...i,...u&&{reference:u}}}),v=e.useCallback((e=>{const t=x(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;a(t),m.refs.setReference(t)}),[m.refs]),h=e.useCallback((e=>{(x(e)||null===e)&&(f.current=e,l(e)),(x(m.refs.reference.current)||null===m.refs.reference.current||null!==e&&!x(e))&&m.refs.setReference(e)}),[m.refs]),g=e.useMemo((()=>({...m.refs,setReference:h,setPositionReference:v,domReference:f})),[m.refs,h,v]),y=e.useMemo((()=>({...m.elements,domReference:s})),[m.elements,s]),w=e.useMemo((()=>({...m,...o,refs:g,elements:y,nodeId:n})),[m,g,y,n,o]);return mt((()=>{o.dataRef.current.floatingContext=w;const e=null==p?void 0:p.nodesRef.current.find((e=>e.id===n));e&&(e.context=w)})),e.useMemo((()=>({...m,context:w,refs:g,elements:y})),[m,g,y,w])},Arrow:bt,arrow:(e,t)=>({...at(e),options:[e,t]}),useRole:function(t,n){var r;void 0===n&&(n={});const{open:o,floatingId:i}=t,{enabled:c=!0,role:l="dialog"}=n,u=null!=(r=gn.get(l))?r:l,a=yt(),s=null!=Rt(),f=e.useMemo((()=>"tooltip"===u||"label"===l?{["aria-"+("label"===l?"labelledby":"describedby")]:o?i:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":"alertdialog"===u?"dialog":u,"aria-controls":o?i:void 0,..."listbox"===u&&{role:"combobox"},..."menu"===u&&{id:a},..."menu"===u&&s&&{role:"menuitem"},..."select"===l&&{"aria-autocomplete":"none"},..."combobox"===l&&{"aria-autocomplete":"list"}}),[u,i,s,o,a,l]),d=e.useMemo((()=>{const e={id:i,...u&&{role:u}};return"tooltip"===u||"label"===l?e:{...e,..."menu"===u&&{"aria-labelledby":a}}}),[u,i,a,l]),p=e.useCallback((e=>{let{active:t,selected:n}=e;const r={role:"option",...t&&{id:i+"-option"}};switch(l){case"select":return{...r,"aria-selected":t&&n};case"combobox":return{...r,...t&&{"aria-selected":!0}}}return{}}),[i,l]);return e.useMemo((()=>c?{reference:f,floating:d,item:p}:{}),[c,f,d,p])},useFocus:function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,events:i,dataRef:c,elements:l}=t,{enabled:u=!0,visibleOnly:a=!0}=n,s=e.useRef(!1),f=e.useRef(),d=e.useRef(!0);e.useEffect((()=>{if(!u)return;const e=w(l.domReference);function t(){!r&&R(l.domReference)&&l.domReference===W(Y(l.domReference))&&(s.current=!0)}function n(){d.current=!0}return e.addEventListener("blur",t),e.addEventListener("keydown",n,!0),()=>{e.removeEventListener("blur",t),e.removeEventListener("keydown",n,!0)}}),[l.domReference,r,u]),e.useEffect((()=>{if(u)return i.on("openchange",e),()=>{i.off("openchange",e)};function e(e){let{reason:t}=e;"reference-press"!==t&&"escape-key"!==t||(s.current=!0)}}),[i,u]),e.useEffect((()=>()=>{clearTimeout(f.current)}),[]);const p=e.useMemo((()=>({onPointerDown(e){H(e.nativeEvent)||(d.current=!1)},onMouseLeave(){s.current=!1},onFocus(e){if(s.current)return;const t=U(e.nativeEvent);if(a&&x(t))try{if(V()&&j().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints)throw Error();if(!t.matches(":focus-visible"))return}catch(e){if(!d.current&&!$(t))return}o(!0,e.nativeEvent,"focus")},onBlur(e){s.current=!1;const t=e.relatedTarget,n=e.nativeEvent,r=x(t)&&t.hasAttribute(St("focus-guard"))&&"outside"===t.getAttribute("data-type");f.current=window.setTimeout((()=>{var e;const i=W(l.domReference?l.domReference.ownerDocument:document);(t||i!==l.domReference)&&(B(null==(e=c.current.floatingContext)?void 0:e.refs.floating.current,i)||B(l.domReference,i)||r||o(!1,n,"focus"))}))}})),[c,l.domReference,o,a]);return e.useMemo((()=>u?{reference:p}:{}),[u,p])},useInteractions:function(t){void 0===t&&(t=[]);const n=t.map((e=>null==e?void 0:e.reference)),r=t.map((e=>null==e?void 0:e.floating)),o=t.map((e=>null==e?void 0:e.item)),i=e.useCallback((e=>hn(e,t,"reference")),n),c=e.useCallback((e=>hn(e,t,"floating")),r),l=e.useCallback((e=>hn(e,t,"item")),o);return e.useMemo((()=>({getReferenceProps:i,getFloatingProps:c,getItemProps:l})),[i,c,l])},useDismiss:function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,elements:i,dataRef:c}=t,{enabled:l=!0,escapeKey:u=!0,outsidePress:a=!0,outsidePressEvent:s="pointerdown",referencePress:f=!1,referencePressEvent:d="pointerdown",ancestorScroll:p=!1,bubbles:m,capture:v}=n,h=Ct(),g=pt("function"==typeof a?a:()=>!1),y="function"==typeof a?g:a,w=e.useRef(!1),b=e.useRef(!1),{escapeKey:E,outsidePress:C}=dn(m),{escapeKey:S,outsidePress:k}=dn(v),L=e.useRef(!1),O=pt((e=>{var t;if(!r||!l||!u||"Escape"!==e.key)return;if(L.current)return;const n=null==(t=c.current.floatingContext)?void 0:t.nodeId,i=h?Mt(h.nodesRef.current,n):[];if(!E&&(e.stopPropagation(),i.length>0)){let e=!0;if(i.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}o(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")})),M=pt((e=>{var t;const n=()=>{var t;O(e),null==(t=U(e))||t.removeEventListener("keydown",n)};null==(t=U(e))||t.addEventListener("keydown",n)})),D=pt((e=>{var t;const n=w.current;w.current=!1;const r=b.current;if(b.current=!1,"click"===s&&r)return;if(n)return;if("function"==typeof y&&!y(e))return;const l=U(e),u="["+St("inert")+"]",a=Y(i.floating).querySelectorAll(u);let f=x(l)?l:null;for(;f&&!T(f);){const e=N(f);if(T(e)||!x(e))break;f=e}if(a.length&&x(l)&&!l.matches("html,body")&&!B(l,i.floating)&&Array.from(a).every((e=>!B(f,e))))return;if(R(l)&&j){const t=T(l),n=A(l),r=/auto|scroll/,o=t||r.test(n.overflowX),i=t||r.test(n.overflowY),c=o&&l.clientWidth>0&&l.scrollWidth>l.clientWidth,u=i&&l.clientHeight>0&&l.scrollHeight>l.clientHeight,a="rtl"===n.direction,s=u&&(a?e.offsetX<=l.offsetWidth-l.clientWidth:e.offsetX>l.clientWidth),f=c&&e.offsetY>l.clientHeight;if(s||f)return}const d=null==(t=c.current.floatingContext)?void 0:t.nodeId,p=h&&Mt(h.nodesRef.current,d).some((t=>{var n;return K(e,null==(n=t.context)?void 0:n.elements.floating)}));if(K(e,i.floating)||K(e,i.domReference)||p)return;const m=h?Mt(h.nodesRef.current,d):[];if(m.length>0){let e=!0;if(m.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}o(!1,e,"outside-press")})),I=pt((e=>{var t;const n=()=>{var t;D(e),null==(t=U(e))||t.removeEventListener(s,n)};null==(t=U(e))||t.addEventListener(s,n)}));e.useEffect((()=>{if(!r||!l)return;c.current.__escapeKeyBubbles=E,c.current.__outsidePressBubbles=C;let e=-1;function t(e){o(!1,e,"ancestor-scroll")}function n(){window.clearTimeout(e),L.current=!0}function a(){e=window.setTimeout((()=>{L.current=!1}),P()?5:0)}const f=Y(i.floating);u&&(f.addEventListener("keydown",S?M:O,S),f.addEventListener("compositionstart",n),f.addEventListener("compositionend",a)),y&&f.addEventListener(s,k?I:D,k);let d=[];return p&&(x(i.domReference)&&(d=F(i.domReference)),x(i.floating)&&(d=d.concat(F(i.floating))),!x(i.reference)&&i.reference&&i.reference.contextElement&&(d=d.concat(F(i.reference.contextElement)))),d=d.filter((e=>{var t;return e!==(null==(t=f.defaultView)?void 0:t.visualViewport)})),d.forEach((e=>{e.addEventListener("scroll",t,{passive:!0})})),()=>{u&&(f.removeEventListener("keydown",S?M:O,S),f.removeEventListener("compositionstart",n),f.removeEventListener("compositionend",a)),y&&f.removeEventListener(s,k?I:D,k),d.forEach((e=>{e.removeEventListener("scroll",t)})),window.clearTimeout(e)}}),[c,i,u,y,s,r,o,p,l,E,C,O,S,M,D,k,I]),e.useEffect((()=>{w.current=!1}),[y,s]);const W=e.useMemo((()=>({onKeyDown:O,...f&&{[sn[d]]:e=>{o(!1,e.nativeEvent,"reference-press")},..."click"!==d&&{onClick(e){o(!1,e.nativeEvent,"reference-press")}}}})),[O,o,f,d]),j=e.useMemo((()=>({onKeyDown:O,onMouseDown(){b.current=!0},onMouseUp(){b.current=!0},[fn[s]]:()=>{w.current=!0}})),[O,s]);return e.useMemo((()=>l?{reference:W,floating:j}:{}),[l,W,j])},useHover:function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,dataRef:i,events:c,elements:l}=t,{enabled:u=!0,delay:a=0,handleClose:s=null,mouseOnly:f=!1,restMs:d=0,move:p=!0}=n,m=Ct(),v=Rt(),h=kt(s),g=kt(a),y=kt(r),w=e.useRef(),b=e.useRef(-1),E=e.useRef(),R=e.useRef(-1),C=e.useRef(!0),S=e.useRef(!1),k=e.useRef((()=>{})),L=e.useRef(!1),O=e.useCallback((()=>{var e;const t=null==(e=i.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[i]);e.useEffect((()=>{if(u)return c.on("openchange",e),()=>{c.off("openchange",e)};function e(e){let{open:t}=e;t||(clearTimeout(b.current),clearTimeout(R.current),C.current=!0,L.current=!1)}}),[u,c]),e.useEffect((()=>{if(!u)return;if(!h.current)return;if(!r)return;function e(e){O()&&o(!1,e,"hover")}const t=Y(l.floating).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[l.floating,r,o,u,h,O]);const P=e.useCallback((function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const r=Ot(g.current,"close",w.current);r&&!E.current?(clearTimeout(b.current),b.current=window.setTimeout((()=>o(!1,e,n)),r)):t&&(clearTimeout(b.current),o(!1,e,n))}),[g,o]),T=pt((()=>{k.current(),E.current=void 0})),A=pt((()=>{if(S.current){const e=Y(l.floating).body;e.style.pointerEvents="",e.removeAttribute(Lt),S.current=!1}})),M=pt((()=>!!i.current.openEvent&&["click","mousedown"].includes(i.current.openEvent.type)));e.useEffect((()=>{if(u&&x(l.domReference)){var e;const o=l.domReference;return r&&o.addEventListener("mouseleave",c),null==(e=l.floating)||e.addEventListener("mouseleave",c),p&&o.addEventListener("mousemove",t,{once:!0}),o.addEventListener("mouseenter",t),o.addEventListener("mouseleave",n),()=>{var e;r&&o.removeEventListener("mouseleave",c),null==(e=l.floating)||e.removeEventListener("mouseleave",c),p&&o.removeEventListener("mousemove",t),o.removeEventListener("mouseenter",t),o.removeEventListener("mouseleave",n)}}function t(e){if(clearTimeout(b.current),C.current=!1,f&&!q(w.current)||d>0&&!Ot(g.current,"open"))return;const t=Ot(g.current,"open",w.current);t?b.current=window.setTimeout((()=>{y.current||o(!0,e,"hover")}),t):r||o(!0,e,"hover")}function n(e){if(M())return;k.current();const t=Y(l.floating);if(clearTimeout(R.current),L.current=!1,h.current&&i.current.floatingContext){r||clearTimeout(b.current),E.current=h.current({...i.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){A(),T(),M()||P(e,!0,"safe-polygon")}});const n=E.current;return t.addEventListener("mousemove",n),void(k.current=()=>{t.removeEventListener("mousemove",n)})}("touch"!==w.current||!B(l.floating,e.relatedTarget))&&P(e)}function c(e){M()||i.current.floatingContext&&(null==h.current||h.current({...i.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){A(),T(),M()||P(e)}})(e))}}),[l,u,t,f,d,p,P,T,A,o,r,y,m,g,h,i,M]),mt((()=>{var e;if(u&&r&&null!=(e=h.current)&&e.__options.blockPointerEvents&&O()){S.current=!0;const e=l.floating;if(x(l.domReference)&&e){var t;const n=Y(l.floating).body;n.setAttribute(Lt,"");const r=l.domReference,o=null==m||null==(t=m.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=""}}}}),[u,r,v,l,m,h,O]),mt((()=>{r||(w.current=void 0,L.current=!1,T(),A())}),[r,T,A]),e.useEffect((()=>()=>{T(),clearTimeout(b.current),clearTimeout(R.current),A()}),[u,l.domReference,T,A]);const N=e.useMemo((()=>{function e(e){w.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){const{nativeEvent:t}=e;function n(){C.current||y.current||o(!0,t,"hover")}f&&!q(w.current)||r||0===d||L.current&&e.movementX**2+e.movementY**2<2||(clearTimeout(R.current),"touch"===w.current?n():(L.current=!0,R.current=window.setTimeout(n,d)))}}}),[f,o,r,y,d]),D=e.useMemo((()=>({onMouseEnter(){clearTimeout(b.current)},onMouseLeave(e){M()||P(e.nativeEvent,!1)}})),[P,M]);return e.useMemo((()=>u?{reference:N,floating:D}:{}),[u,N,D])},flip:(e,t)=>({...et(e),options:[e,t]}),shift:(e,t)=>({...Je(e),options:[e,t]}),hide:(e,t)=>({...tt(e),options:[e,t]}),offset:(e,t)=>({...Qe(e),options:[e,t]}),useMergeRefs:st},wn=function(e){var n=e.children,r=e.open,o=e.onOpenChange,i=void 0===o?function(){}:o,l=e.onClickOutside,u=void 0===l?function(){}:l,a=m(e,["children","open","onOpenChange","onClickOutside"]),s=c(r),f=s[0],d=s[1],v=function(e){d(e),i(e)},g=yn.useFloating({open:f,onOpenChange:v}),y=g.context,w=g.refs,b=g.floatingStyles,E=yn.useDismiss(y),x=yn.useRole(y,{role:"dialog"}),R=yn.useInteractions([E,x]),C={isOpen:f,handleOpenChange:v,floaterContext:y,handleOverlayClick:function(){u()},getReferenceProps:R.getReferenceProps,getFloatingProps:R.getFloatingProps,getItemProps:R.getItemProps,refs:w,floatingStyles:b};return t.createElement(h.Provider,{value:C},t.createElement("div",p({},a),n))};wn.displayName="DialogPrimitive";var bn=["div","span","button","input","a","img","p","h2"].reduce((function(e,n){return e[n]=function(e){var n=t.forwardRef((function(n,r){var o=n.asChild,i=void 0!==o&&o,c=n.children,l=m(n,["asChild","children"]);if(i){var u=t.Children.toArray(c);if(1!==u.length||!t.isValidElement(u[0]))return console.warn("Primitive.".concat(e,": asChild prop requires exactly one valid child element.")),t.createElement(e,p(p({},l),{ref:r}),c);var a=u[0];return t.cloneElement(a,p(p(p({},l),a.props),r?{ref:function(e){"function"==typeof r?r(e):r&&(r.current=e);var t=a.ref;"function"==typeof t?t(e):t&&(t.current=e)}}:{}))}return t.createElement(e,p(p({},l),{ref:r}),c)}));return n.displayName="Primitive.".concat(e),n}(n),e}),{}),En=l((function(e,n){var r=e.role,o=void 0===r?"button":r,i=e.label,c=void 0===i?"":i,l=e.description,u=void 0===l?"":l,a=e.disabled,s=void 0!==a&&a,f=e.children,d=m(e,["role","label","description","disabled","children"]);return c&&(d["aria-label"]=c),u&&(d["aria-description"]=u),s&&(d["aria-disabled"]="true",u||(d["aria-description"]="Disabled Button")),t.createElement(bn.button,p({ref:n,role:o,disabled:s},d),f)}));En.displayName="ButtonPrimitive";var xn="right-scroll-bar-position",Rn="width-before-scroll-bar";function Cn(e,t){return"function"==typeof e?e(t):e&&(e.current=t),e}var Sn="undefined"!=typeof window?e.useLayoutEffect:e.useEffect,kn=new WeakMap;function Ln(e,t){var n,r,o,i=(n=null,r=function(t){return e.forEach((function(e){return Cn(e,t)}))},(o=c((function(){return{value:n,callback:r,facade:{get current(){return o.value},set current(e){var t=o.value;t!==e&&(o.value=e,o.callback(e,t))}}}}))[0]).callback=r,o.facade);return Sn((function(){var t=kn.get(i);if(t){var n=new Set(t),r=new Set(e),o=i.current;n.forEach((function(e){r.has(e)||Cn(e,null)})),r.forEach((function(e){n.has(e)||Cn(e,o)}))}kn.set(i,e)}),[e]),i}function On(e){return e}var Pn=function(t){var n=t.sideCar,r=m(t,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=n.read();if(!o)throw new Error("Sidecar medium not found");return e.createElement(o,p({},r))};Pn.isSideCarExport=!0;var Tn=function(e){void 0===e&&(e={});var t=function(e,t){void 0===t&&(t=On);var n=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var o=t(e,r);return n.push(o),function(){n=n.filter((function(e){return e!==o}))}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var o=n;n=[],o.forEach(e),t=n}var i=function(){var n=t;t=[],n.forEach(e)},c=function(){return Promise.resolve().then(i)};c(),n={push:function(e){t.push(e),c()},filter:function(e){return t=t.filter(e),n}}}}}(null);return t.options=p({async:!0,ssr:!1},e),t}(),An=function(){},Mn=e.forwardRef((function(t,n){var r=e.useRef(null),o=e.useState({onScrollCapture:An,onWheelCapture:An,onTouchMoveCapture:An}),i=o[0],c=o[1],l=t.forwardProps,u=t.children,a=t.className,s=t.removeScrollBar,f=t.enabled,d=t.shards,v=t.sideCar,h=t.noRelative,g=t.noIsolation,y=t.inert,w=t.allowPinchZoom,b=t.as,E=void 0===b?"div":b,x=t.gapMode,R=m(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=v,S=Ln([r,n]),k=p(p({},R),i);return e.createElement(e.Fragment,null,f&&e.createElement(C,{sideCar:Tn,removeScrollBar:s,shards:d,noRelative:h,noIsolation:g,inert:y,setCallbacks:c,allowPinchZoom:!!w,lockRef:r,gapMode:x}),l?e.cloneElement(e.Children.only(u),p(p({},k),{ref:S})):e.createElement(E,p({},k,{className:a,ref:S}),u))}));Mn.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Mn.classNames={fullWidth:Rn,zeroRight:xn};function Nn(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return t&&e.setAttribute("nonce",t),e}var Dn=function(){var e=0,t=null;return{add:function(n){var r,o;0==e&&(t=Nn())&&(o=n,(r=t).styleSheet?r.styleSheet.cssText=o:r.appendChild(document.createTextNode(o)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(t)),e++},remove:function(){! --e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Fn=function(){var t,n=(t=Dn(),function(n,r){e.useEffect((function(){return t.add(n),function(){t.remove()}}),[n&&r])});return function(e){var t=e.styles,r=e.dynamic;return n(t,r),null}},In={left:0,top:0,right:0,gap:0},Wn=function(e){return parseInt(e||"",10)||0},Bn=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return In;var t=function(e){var t=window.getComputedStyle(document.body),n=t["padding"===e?"paddingLeft":"marginLeft"],r=t["padding"===e?"paddingTop":"marginTop"],o=t["padding"===e?"paddingRight":"marginRight"];return[Wn(n),Wn(r),Wn(o)]}(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},jn=Fn(),_n="data-scroll-locked",Hn=function(e,t,n,r){var o=e.left,i=e.top,c=e.right,l=e.gap;return void 0===n&&(n="margin"),"\n .".concat("with-scroll-bars-hidden"," {\n overflow: hidden ").concat(r,";\n padding-right: ").concat(l,"px ").concat(r,";\n }\n body[").concat(_n,"] {\n overflow: hidden ").concat(r,";\n overscroll-behavior: contain;\n ").concat([t&&"position: relative ".concat(r,";"),"margin"===n&&"\n padding-left: ".concat(o,"px;\n padding-top: ").concat(i,"px;\n padding-right: ").concat(c,"px;\n margin-left:0;\n margin-top:0;\n margin-right: ").concat(l,"px ").concat(r,";\n "),"padding"===n&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),"\n }\n \n .").concat(xn," {\n right: ").concat(l,"px ").concat(r,";\n }\n \n .").concat(Rn," {\n margin-right: ").concat(l,"px ").concat(r,";\n }\n \n .").concat(xn," .").concat(xn," {\n right: 0 ").concat(r,";\n }\n \n .").concat(Rn," .").concat(Rn," {\n margin-right: 0 ").concat(r,";\n }\n \n body[").concat(_n,"] {\n ").concat("--removed-body-scroll-bar-size",": ").concat(l,"px;\n }\n")},Vn=function(){var e=parseInt(document.body.getAttribute(_n)||"0",10);return isFinite(e)?e:0},Xn=function(t){var n=t.noRelative,r=t.noImportant,o=t.gapMode,i=void 0===o?"margin":o;e.useEffect((function(){return document.body.setAttribute(_n,(Vn()+1).toString()),function(){var e=Vn()-1;e<=0?document.body.removeAttribute(_n):document.body.setAttribute(_n,e.toString())}}),[]);var c=e.useMemo((function(){return Bn(i)}),[i]);return e.createElement(jn,{styles:Hn(c,!n,i,r?"":"!important")})},qn=!1;if("undefined"!=typeof window)try{var Yn=Object.defineProperty({},"passive",{get:function(){return qn=!0,!0}});window.addEventListener("test",Yn,Yn),window.removeEventListener("test",Yn,Yn)}catch(e){qn=!1}var Kn=!!qn&&{passive:!1},Un=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return"hidden"!==n[t]&&!(n.overflowY===n.overflowX&&!function(e){return"TEXTAREA"===e.tagName}(e)&&"visible"===n[t])},$n=function(e,t){var n=t.ownerDocument,r=t;do{if("undefined"!=typeof ShadowRoot&&r instanceof ShadowRoot&&(r=r.host),zn(e,r)){var o=Zn(e,r);if(o[1]>o[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},zn=function(e,t){return"v"===e?function(e){return Un(e,"overflowY")}(t):function(e){return Un(e,"overflowX")}(t)},Zn=function(e,t){return"v"===e?[(n=t).scrollTop,n.scrollHeight,n.clientHeight]:function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]}(t);var n},Gn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Qn=function(e){return[e.deltaX,e.deltaY]},Jn=function(e){return e&&"current"in e?e.current:e},er=function(e){return"\n .block-interactivity-".concat(e," {pointer-events: none;}\n .allow-interactivity-").concat(e," {pointer-events: all;}\n")},tr=0,nr=[];function rr(e){for(var t=null;null!==e;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var or,ir=(or=function(t){var n=e.useRef([]),r=e.useRef([0,0]),o=e.useRef(),i=e.useState(tr++)[0],c=e.useState(Fn)[0],l=e.useRef(t);e.useEffect((function(){l.current=t}),[t]),e.useEffect((function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(i));var e=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([t.lockRef.current],(t.shards||[]).map(Jn),!0).filter(Boolean);return e.forEach((function(e){return e.classList.add("allow-interactivity-".concat(i))})),function(){document.body.classList.remove("block-interactivity-".concat(i)),e.forEach((function(e){return e.classList.remove("allow-interactivity-".concat(i))}))}}}),[t.inert,t.lockRef.current,t.shards]);var u=e.useCallback((function(e,t){if("touches"in e&&2===e.touches.length||"wheel"===e.type&&e.ctrlKey)return!l.current.allowPinchZoom;var n,i=Gn(e),c=r.current,u="deltaX"in e?e.deltaX:c[0]-i[0],a="deltaY"in e?e.deltaY:c[1]-i[1],s=e.target,f=Math.abs(u)>Math.abs(a)?"h":"v";if("touches"in e&&"h"===f&&"range"===s.type)return!1;var d=$n(f,s);if(!d)return!0;if(d?n=f:(n="v"===f?"h":"v",d=$n(f,s)),!d)return!1;if(!o.current&&"changedTouches"in e&&(u||a)&&(o.current=n),!n)return!0;var p=o.current||n;return function(e,t,n,r){var o=function(e,t){return"h"===e&&"rtl"===t?-1:1}(e,window.getComputedStyle(t).direction),i=o*r,c=n.target,l=t.contains(c),u=!1,a=i>0,s=0,f=0;do{var d=Zn(e,c),p=d[0],m=d[1]-d[2]-o*p;(p||m)&&zn(e,c)&&(s+=m,f+=p),c=c.parentNode.host||c.parentNode}while(!l&&c!==document.body||l&&(t.contains(c)||t===c));return(a&&Math.abs(s)<1||!a&&Math.abs(f)<1)&&(u=!0),u}(p,t,e,"h"===p?u:a)}),[]),a=e.useCallback((function(e){var t=e;if(nr.length&&nr[nr.length-1]===c){var r="deltaY"in t?Qn(t):Gn(t),o=n.current.filter((function(e){return e.name===t.type&&(e.target===t.target||t.target===e.shadowParent)&&(n=e.delta,o=r,n[0]===o[0]&&n[1]===o[1]);var n,o}))[0];if(o&&o.should)t.cancelable&&t.preventDefault();else if(!o){var i=(l.current.shards||[]).map(Jn).filter(Boolean).filter((function(e){return e.contains(t.target)}));(i.length>0?u(t,i[0]):!l.current.noIsolation)&&t.cancelable&&t.preventDefault()}}}),[]),s=e.useCallback((function(e,t,r,o){var i={name:e,delta:t,target:r,should:o,shadowParent:rr(r)};n.current.push(i),setTimeout((function(){n.current=n.current.filter((function(e){return e!==i}))}),1)}),[]),f=e.useCallback((function(e){r.current=Gn(e),o.current=void 0}),[]),d=e.useCallback((function(e){s(e.type,Qn(e),e.target,u(e,t.lockRef.current))}),[]),p=e.useCallback((function(e){s(e.type,Gn(e),e.target,u(e,t.lockRef.current))}),[]);e.useEffect((function(){return nr.push(c),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:p}),document.addEventListener("wheel",a,Kn),document.addEventListener("touchmove",a,Kn),document.addEventListener("touchstart",f,Kn),function(){nr=nr.filter((function(e){return e!==c})),document.removeEventListener("wheel",a,Kn),document.removeEventListener("touchmove",a,Kn),document.removeEventListener("touchstart",f,Kn)}}),[]);var m=t.removeScrollBar,v=t.inert;return e.createElement(e.Fragment,null,v?e.createElement(c,{styles:er(i)}):null,m?e.createElement(Xn,{noRelative:t.noRelative,gapMode:t.gapMode}):null)},Tn.useMedium(or),Pn),cr=e.forwardRef((function(t,n){return e.createElement(Mn,p({},t,{ref:n,sideCar:ir}))}));cr.classNames=Mn.classNames;var lr=wn,ur=function(e){var n=e.children,r=e.asChild,o=m(e,["children","asChild"]),i=u(h),c=i.handleOpenChange,l=i.getItemProps;return t.createElement(En,p({asChild:r,onClick:function(){return c(!1)}},l(),o),n)},ar=function(e){var n=e.children,r=m(e,["children"]),o=u(h),i=o.isOpen,c=o.getFloatingProps,l=o.floaterContext,a=o.refs;return t.createElement(t.Fragment,null,i&&t.createElement(yn.FocusManager,{context:l,returnFocus:!0},t.createElement("div",p({ref:a.setFloating},c(),r),n)))},sr=function(e){var n=e.children,r=e.asChild,o=e.className,i=void 0===o?"":o,c=m(e,["children","asChild","className"]),l=u(h),a=l.handleOpenChange,s=l.getReferenceProps,f=l.refs;return t.createElement(En,p({ref:(null==f?void 0:f.setReference)||null,asChild:r,className:i,onClick:function(){return a(!0)}},s(),c),n)},fr=function(e){var n=m(e,[]),r=u(h),o=r.isOpen,i=r.handleOverlayClick;return t.createElement(t.Fragment,null,o&&t.createElement(cr,null,t.createElement(yn.Overlay,p({onClick:i},n))))},dr=function(e){var n=e.children,r=i(null),l=c(!1),u=l[0],a=l[1];return o((function(){var e=document.querySelector("#rad-ui-theme-container"),t=document.body,n=e||t;r.current=n,a(!0)}),[]),u?t.createElement(yn.Portal,{root:r.current},n):null};function pr(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=pr(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function mr(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=pr(e))&&(r&&(r+=" "),r+=t);return r}var vr=function(){return console.warn("Direct usage of Dialog is not supported. Please use Dialog.Root, Dialog.Content, etc. instead."),null};vr.Root=function(e){var n=e.children,r=e.customRootClass,o=void 0===r?"":r,i=e.className,c=void 0===i?"":i,l=m(e,["children","customRootClass","className"]),u=function(e,t){void 0===e&&(e="");var n=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return e?"".concat(e,"-").concat(n):"".concat("rad-ui","-").concat(n)}(o,"Dialog"),a={rootClass:u};return t.createElement(lr,p({className:mr(u,c)},l),t.createElement(v.Provider,{value:a},n))},vr.Trigger=function(e){var n=e.children,r=e.asChild,o=e.className,i=void 0===o?"":o,c=m(e,["children","asChild","className"]),l=u(v).rootClass;return t.createElement(sr,p({className:mr("".concat(l,"-trigger"),i),asChild:r},c),n)},vr.Portal=function(e){var n=e.children;return t.createElement(dr,null,n)},vr.Overlay=function(e){var n=e.className,r=void 0===n?"":n,o=u(v).rootClass;return t.createElement(t.Fragment,null,t.createElement(fr,{className:mr("".concat(o,"-overlay"),r)}))},vr.Content=function(e){var n=e.children,r=e.className,o=void 0===r?"":r,i=u(v).rootClass;return t.createElement(t.Fragment,null,t.createElement(ar,{className:mr("".concat(i,"-content"),o)},n))},vr.Title=function(e){var n=e.children,r=e.className,o=void 0===r?"":r,i=u(v).rootClass;return t.createElement(bn.h2,{className:mr("".concat(i,"-title"),o)},n)},vr.Description=function(e){var n=e.children,r=e.className,o=void 0===r?"":r,i=u(v).rootClass;return t.createElement(bn.p,{className:mr("".concat(i,"-description"),o)},n)},vr.Close=function(e){var n=e.children,r=e.asChild,o=e.className,i=void 0===o?"":o,c=m(e,["children","asChild","className"]),l=u(v).rootClass;return t.createElement(ur,p({className:mr("".concat(l,"-close"),i),asChild:r},c),n)};export{vr as default};
@@ -0,0 +1,5 @@
1
+ 'use client';import*as e from"react";import t,{createContext as n,useRef as r,useState as o,useId as i,useEffect as l,forwardRef as c,useContext as u,useLayoutEffect as a,useCallback as s}from"react";import{jsxs as f,jsx as d,Fragment as p}from"react/jsx-runtime";import*as m from"react-dom";var v=function(){return v=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},v.apply(this,arguments)};function h(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}function g(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var y=n({}),b=["div","span","button","input","a","img","p","h2"].reduce((function(e,n){return e[n]=function(e){var n=t.forwardRef((function(n,r){var o=n.asChild,i=void 0!==o&&o,l=n.children,c=h(n,["asChild","children"]);if(i){var u=t.Children.toArray(l);if(1!==u.length||!t.isValidElement(u[0]))return console.warn("Primitive.".concat(e,": asChild prop requires exactly one valid child element.")),t.createElement(e,v(v({},c),{ref:r}),l);var a=u[0];return t.cloneElement(a,v(v(v({},c),a.props),r?{ref:function(e){"function"==typeof r?r(e):r&&(r.current=e);var t=a.ref;"function"==typeof t?t(e):t&&(t.current=e)}}:{}))}return t.createElement(e,v(v({},c),{ref:r}),l)}));return n.displayName="Primitive.".concat(e),n}(n),e}),{}),w=n({orientation:"horizontal",loop:!0,disableTabIndexing:!1}),x=n({focusedItemId:null,setFocusedItemId:function(){},focusItems:[],setFocusItems:function(){},addFocusItem:function(){},groupRef:null}),E=c((function(e,n){var r,o=e.children,c=e["aria-label"],a=e["aria-labelledby"],s=e.role,f=void 0===s?"button":s,d=h(e,["children","aria-label","aria-labelledby","role"]),p=i(),m=u(x),g=m.focusedItemId,y=m.setFocusedItemId,E=m.addFocusItem,R=m.focusItems,C=m.groupRef,S=u(w),O=S.orientation,L=S.loop,k=S.disableTabIndexing,T=t.Children.toArray(o)[0],A=!0===(null===(r=null==T?void 0:T.props)||void 0===r?void 0:r.disabled),P=g===p,I=k||!A&&P?0:-1;l((function(){R.includes(p)||E(p)}),[R,g,p,E]);var M=function(e){if(C&&C.current){y(e);var t=CSS.escape(e),n=C.current.querySelector("#".concat(t));n&&n.focus()}},D=function(e,t){for(var n,r=e,o=0;o<R.length;o++){if(r+=t,L)r<0&&(r=R.length-1),r>=R.length&&(r=0);else if(r<0||r>=R.length)return-1;var i=R[r],l=null===(n=null==C?void 0:C.current)||void 0===n?void 0:n.querySelector("#".concat(CSS.escape(i)));if(l)if(!("true"===l.getAttribute("data-child-disabled")))return r}return-1},N=function(){var e=R.indexOf(p),t=D(e,-1);-1!==t&&M(R[t])},F=function(){var e=R.indexOf(p),t=D(e,1);-1!==t&&M(R[t])};return t.createElement(b.button,v({asChild:!0,onFocus:function(e){e.preventDefault(),A&&e.target.blur(),A||y(p)},tabIndex:I,ref:n,id:p,onKeyDown:function(e){if(!A)switch(e.key){case"ArrowUp":e.preventDefault(),"vertical"===O&&N();break;case"ArrowLeft":e.preventDefault(),"horizontal"===O&&N();break;case"ArrowDown":e.preventDefault(),"vertical"===O&&F();break;case"ArrowRight":e.preventDefault(),"horizontal"===O&&F();break;case"Home":e.preventDefault(),function(){if(R.length>0){var e=D(-1,1);-1!==e&&M(R[e])}}();break;case"End":e.preventDefault(),function(){if(R.length>0){var e=D(R.length,-1);-1!==e&&M(R[e])}}()}},"data-child-disabled":A,role:f,"aria-selected":P,"aria-disabled":A,"aria-label":c,"aria-labelledby":a},d),o)}));E.displayName="RovingFocusItem";var R={Root:function(e){var n=e.children,r=e.orientation,o=void 0===r?"horizontal":r,i=e.loop,l=void 0===i||i,c=e["aria-label"],u=e["aria-labelledby"],a=e.disableTabIndexing,s=void 0!==a&&a,f=h(e,["children","orientation","loop","aria-label","aria-labelledby","disableTabIndexing"]),d={orientation:o,loop:l,disableTabIndexing:s};return t.createElement(w.Provider,{value:d},t.createElement(b.div,v({role:"listbox","aria-orientation":o,"aria-label":c,"aria-labelledby":u},f),n))},Group:function(e){var n=e.children,c=e["aria-label"],u=e["aria-labelledby"],a=h(e,["children","aria-label","aria-labelledby"]),s=r(null),f=o([]),d=f[0],p=f[1],m=o(null),y=m[0],w=m[1],E=i();l((function(){!y&&d.length>0&&w(d[0])}),[d,y]);var R={focusedItemId:y,setFocusedItemId:w,focusItems:d,setFocusItems:p,addFocusItem:function(e){p((function(t){return g(g([],t,!0),[e],!1)}))},groupRef:s};return t.createElement(x.Provider,{value:R},t.createElement(b.div,v({id:E,ref:s,role:"group","aria-label":c,"aria-labelledby":u},a),n))},Item:E};function C(){return"undefined"!=typeof window}function S(e){return k(e)?(e.nodeName||"").toLowerCase():"#document"}function O(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function L(e){var t;return null==(t=(k(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function k(e){return!!C()&&(e instanceof Node||e instanceof O(e).Node)}function T(e){return!!C()&&(e instanceof Element||e instanceof O(e).Element)}function A(e){return!!C()&&(e instanceof HTMLElement||e instanceof O(e).HTMLElement)}function P(e){return!(!C()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof O(e).ShadowRoot)}function I(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=W(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function M(e){return["table","td","th"].includes(S(e))}function D(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function N(e){const t=F(),n=T(e)?W(e):e;return["transform","translate","scale","rotate","perspective"].some((e=>!!n[e]&&"none"!==n[e]))||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","translate","scale","rotate","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function F(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function V(e){return["html","body","#document"].includes(S(e))}function W(e){return O(e).getComputedStyle(e)}function B(e){return T(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function j(e){if("html"===S(e))return e;const t=e.assignedSlot||e.parentNode||P(e)&&e.host||L(e);return P(t)?t.host:t}function H(e){const t=j(e);return V(t)?e.ownerDocument?e.ownerDocument.body:e.body:A(t)&&I(t)?t:H(t)}function q(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=H(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=O(o);if(i){const e=_(l);return t.concat(l,l.visualViewport||[],I(o)?o:[],e&&n?q(e):[])}return t.concat(o,q(o,[],n))}function _(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function K(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 U(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&P(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function X(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function z(){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 Y(e){return!z().includes("jsdom/")&&(!G()&&0===e.width&&0===e.height||G()&&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)}function $(){return/apple/i.test(navigator.vendor)}function G(){const e=/android/i;return e.test(X())||e.test(z())}function Z(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}function Q(e){return(null==e?void 0:e.ownerDocument)||document}function J(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 ee(e){return"composedPath"in e?e.composedPath()[0]:e.target}function te(e){return A(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function ne(e){e.preventDefault(),e.stopPropagation()}const re=["top","right","bottom","left"],oe=Math.min,ie=Math.max,le=Math.round,ce=e=>({x:e,y:e}),ue={left:"right",right:"left",bottom:"top",top:"bottom"},ae={start:"end",end:"start"};function se(e,t,n){return ie(e,oe(t,n))}function fe(e,t){return"function"==typeof e?e(t):e}function de(e){return e.split("-")[0]}function pe(e){return e.split("-")[1]}function me(e){return"x"===e?"y":"x"}function ve(e){return"y"===e?"height":"width"}function he(e){return["top","bottom"].includes(de(e))?"y":"x"}function ge(e){return me(he(e))}function ye(e){return e.replace(/start|end/g,(e=>ae[e]))}function be(e){return e.replace(/left|right|bottom|top/g,(e=>ue[e]))}function we(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function xe(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}}
2
+ /*!
3
+ * tabbable 6.2.0
4
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
5
+ */var Ee=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"].join(","),Re="undefined"==typeof Element,Ce=Re?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Se=!Re&&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},Oe=function e(t,n){var r;void 0===n&&(n=!0);var o=null==t||null===(r=t.getAttribute)||void 0===r?void 0:r.call(t,"inert");return""===o||"true"===o||n&&t&&e(t.parentNode)},Le=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var l=i.shift();if(!Oe(l,!1))if("SLOT"===l.tagName){var c=l.assignedElements(),u=e(c.length?c:l.children,!0,r);r.flatten?o.push.apply(o,u):o.push({scopeParent:l,candidates:u})}else{Ce.call(l,Ee)&&r.filter(l)&&(n||!t.includes(l))&&o.push(l);var a=l.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(l),s=!Oe(a,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(a&&s){var f=e(!0===a?l.children:a.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:l,candidates:f})}else i.unshift.apply(i,l.children)}}return o},ke=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},Te=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))&&!ke(e)?0:e.tabIndex},Ae=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Pe=function(e){return"INPUT"===e.tagName},Ie=function(e){return function(e){return Pe(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||Se(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)},Me=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},De=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=Ce.call(e,"details>summary:first-of-type")?e.parentElement:e;if(Ce.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Me(e)}else{if("function"==typeof r){for(var i=e;e;){var l=e.parentElement,c=Se(e);if(l&&!l.shadowRoot&&!0===r(l))return Me(e);e=e.assignedSlot?e.assignedSlot:l||c===e.ownerDocument?l:c.host}e=i}if(function(e){var t,n,r,o,i=e&&Se(e),l=null===(t=i)||void 0===t?void 0:t.host,c=!1;if(i&&i!==e)for(c=!!(null!==(n=l)&&void 0!==n&&null!==(r=n.ownerDocument)&&void 0!==r&&r.contains(l)||null!=e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(e));!c&&l;){var u,a,s;c=!(null===(a=l=null===(u=i=Se(l))||void 0===u?void 0:u.host)||void 0===a||null===(s=a.ownerDocument)||void 0===s||!s.contains(l))}return c}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Ne=function(e,t){return!(t.disabled||Oe(t)||function(e){return Pe(e)&&"hidden"===e.type}(t)||De(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!!Ce.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Fe=function(e,t){return!(Ie(t)||Te(t)<0||!Ne(e,t))},Ve=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},We=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,l=i?t.scopeParent:t,c=function(e,t){var n=Te(e);return n<0&&t&&!ke(e)?0:n}(l,i),u=i?e(t.candidates):l;0===c?i?n.push.apply(n,u):n.push(l):r.push({documentOrder:o,tabIndex:c,item:t,isScope:i,content:u})})),r.sort(Ae).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},Be=function(e,t){var n;return n=(t=t||{}).getShadowRoot?Le([e],t.includeContainer,{filter:Fe.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Ve}):function(e,t,n){if(Oe(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(Ee));return t&&Ce.call(e,Ee)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,Fe.bind(null,t)),We(n)};function je(e,t,n){let{reference:r,floating:o}=e;const i=he(t),l=ge(t),c=ve(l),u=de(t),a="y"===i,s=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(u){case"top":p={x:s,y:r.y-o.height};break;case"bottom":p={x:s,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}}switch(pe(t)){case"start":p[l]-=d*(n&&a?-1:1);break;case"end":p[l]+=d*(n&&a?-1:1)}return p}async function He(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:l,elements:c,strategy:u}=e,{boundary:a="clippingAncestors",rootBoundary:s="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=fe(t,e),m=we(p),v=c[d?"floating"===f?"reference":"floating":f],h=xe(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(v)))||n?v:v.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(c.floating)),boundary:a,rootBoundary:s,strategy:u})),g="floating"===f?{x:r,y:o,width:l.floating.width,height:l.floating.height}:l.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},w=xe(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:g,offsetParent:y,strategy:u}):g);return{top:(h.top-w.top+m.top)/b.y,bottom:(w.bottom-h.bottom+m.bottom)/b.y,left:(h.left-w.left+m.left)/b.x,right:(w.right-h.right+m.right)/b.x}}function qe(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function _e(e){return re.some((t=>e[t]>=0))}function Ke(e){const t=W(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=A(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,c=le(n)!==i||le(r)!==l;return c&&(n=i,r=l),{width:n,height:r,$:c}}function Ue(e){return T(e)?e:e.contextElement}function Xe(e){const t=Ue(e);if(!A(t))return ce(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Ke(t);let l=(i?le(n.width):n.width)/r,c=(i?le(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const ze=ce(0);function Ye(e){const t=O(e);return F()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ze}function $e(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=Ue(e);let l=ce(1);t&&(r?T(r)&&(l=Xe(r)):l=Xe(e));const c=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==O(e))&&t}(i,n,r)?Ye(i):ce(0);let u=(o.left+c.x)/l.x,a=(o.top+c.y)/l.y,s=o.width/l.x,f=o.height/l.y;if(i){const e=O(i),t=r&&T(r)?O(r):r;let n=e,o=_(n);for(;o&&r&&t!==n;){const e=Xe(o),t=o.getBoundingClientRect(),r=W(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,l=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;u*=e.x,a*=e.y,s*=e.x,f*=e.y,u+=i,a+=l,n=O(o),o=_(n)}}return xe({width:s,height:f,x:u,y:a})}function Ge(e,t){const n=B(e).scrollLeft;return t?t.left+n:$e(L(e)).left+n}function Ze(e,t,n){void 0===n&&(n=!1);const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:Ge(e,r)),y:r.top+t.scrollTop}}function Qe(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=O(e),r=L(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,c=0,u=0;if(o){i=o.width,l=o.height;const e=F();(!e||e&&"fixed"===t)&&(c=o.offsetLeft,u=o.offsetTop)}return{width:i,height:l,x:c,y:u}}(e,n);else if("document"===t)r=function(e){const t=L(e),n=B(e),r=e.ownerDocument.body,o=ie(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ie(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Ge(e);const c=-n.scrollTop;return"rtl"===W(r).direction&&(l+=ie(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:c}}(L(e));else if(T(t))r=function(e,t){const n=$e(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=A(e)?Xe(e):ce(1);return{width:e.clientWidth*i.x,height:e.clientHeight*i.y,x:o*i.x,y:r*i.y}}(t,n);else{const n=Ye(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return xe(r)}function Je(e,t){const n=j(e);return!(n===t||!T(n)||V(n))&&("fixed"===W(n).position||Je(n,t))}function et(e,t,n){const r=A(t),o=L(t),i="fixed"===n,l=$e(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const u=ce(0);if(r||!r&&!i)if(("body"!==S(t)||I(o))&&(c=B(t)),r){const e=$e(t,!0,i,t);u.x=e.x+t.clientLeft,u.y=e.y+t.clientTop}else o&&(u.x=Ge(o));const a=!o||r||i?ce(0):Ze(o,c);return{x:l.left+c.scrollLeft-u.x-a.x,y:l.top+c.scrollTop-u.y-a.y,width:l.width,height:l.height}}function tt(e){return"static"===W(e).position}function nt(e,t){if(!A(e)||"fixed"===W(e).position)return null;if(t)return t(e);let n=e.offsetParent;return L(e)===n&&(n=n.ownerDocument.body),n}function rt(e,t){const n=O(e);if(D(e))return n;if(!A(e)){let t=j(e);for(;t&&!V(t);){if(T(t)&&!tt(t))return t;t=j(t)}return n}let r=nt(e,t);for(;r&&M(r)&&tt(r);)r=nt(r,t);return r&&V(r)&&tt(r)&&!N(r)?n:r||function(e){let t=j(e);for(;A(t)&&!V(t);){if(N(t))return t;if(D(t))return null;t=j(t)}return null}(e)||n}const ot={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,l=L(r),c=!!t&&D(t.floating);if(r===l||c&&i)return n;let u={scrollLeft:0,scrollTop:0},a=ce(1);const s=ce(0),f=A(r);if((f||!f&&!i)&&(("body"!==S(r)||I(l))&&(u=B(r)),A(r))){const e=$e(r);a=Xe(r),s.x=e.x+r.clientLeft,s.y=e.y+r.clientTop}const d=!l||f||i?ce(0):Ze(l,u,!0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-u.scrollLeft*a.x+s.x+d.x,y:n.y*a.y-u.scrollTop*a.y+s.y+d.y}},getDocumentElement:L,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?D(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=q(e,[],!1).filter((e=>T(e)&&"body"!==S(e))),o=null;const i="fixed"===W(e).position;let l=i?j(e):e;for(;T(l)&&!V(l);){const t=W(l),n=N(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||I(l)&&!n&&Je(e,l))?r=r.filter((e=>e!==l)):o=t,l=j(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],c=i.reduce(((e,n)=>{const r=Qe(t,n,o);return e.top=ie(r.top,e.top),e.right=oe(r.right,e.right),e.bottom=oe(r.bottom,e.bottom),e.left=ie(r.left,e.left),e}),Qe(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:rt,getElementRects:async function(e){const t=this.getOffsetParent||rt,n=this.getDimensions,r=await n(e.floating);return{reference:et(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=Ke(e);return{width:t,height:n}},getScale:Xe,isElement:T,isRTL:function(e){return"rtl"===W(e).direction}},it=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:l,middlewareData:c}=t,u=await async function(e,t){const{placement:n,platform:r,elements:o}=e,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),l=de(n),c=pe(n),u="y"===he(n),a=["left","top"].includes(l)?-1:1,s=i&&u?-1:1,f=fe(t,e);let{mainAxis:d,crossAxis:p,alignmentAxis:m}="number"==typeof f?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&"number"==typeof m&&(p="end"===c?-1*m:m),u?{x:p*s,y:d*a}:{x:d*a,y:p*s}}(t,e);return l===(null==(n=c.offset)?void 0:n.placement)&&null!=(r=c.arrow)&&r.alignmentOffset?{}:{x:o+u.x,y:i+u.y,data:{...u,placement:l}}}}},lt=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...u}=fe(e,t),a={x:n,y:r},s=await He(t,u),f=he(de(o)),d=me(f);let p=a[d],m=a[f];if(i){const e="y"===d?"bottom":"right";p=se(p+s["y"===d?"top":"left"],p,p-s[e])}if(l){const e="y"===f?"bottom":"right";m=se(m+s["y"===f?"top":"left"],m,m-s[e])}const v=c.fn({...t,[d]:p,[f]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[d]:i,[f]:l}}}}}},ct=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:c,platform:u,elements:a}=t,{mainAxis:s=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...h}=fe(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const g=de(o),y=he(c),b=de(c)===c,w=await(null==u.isRTL?void 0:u.isRTL(a.floating)),x=d||(b||!v?[be(c)]:function(e){const t=be(e);return[ye(e),t,ye(t)]}(c)),E="none"!==m;!d&&E&&x.push(...function(e,t,n,r){const o=pe(e);let i=function(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:l;default:return[]}}(de(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(ye)))),i}(c,v,m,w));const R=[c,...x],C=await He(t,h),S=[];let O=(null==(r=i.flip)?void 0:r.overflows)||[];if(s&&S.push(C[g]),f){const e=function(e,t,n){void 0===n&&(n=!1);const r=pe(e),o=ge(e),i=ve(o);let l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=be(l)),[l,be(l)]}(o,l,w);S.push(C[e[0]],C[e[1]])}if(O=[...O,{placement:o,overflows:S}],!S.every((e=>e<=0))){var L,k;const e=((null==(L=i.flip)?void 0:L.index)||0)+1,t=R[e];if(t)return{data:{index:e,overflows:O},reset:{placement:t}};let n=null==(k=O.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:k.placement;if(!n)switch(p){case"bestFit":{var T;const e=null==(T=O.filter((e=>{if(E){const t=he(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:T[0];e&&(n=e);break}case"initialPlacement":n=c}if(o!==n)return{reset:{placement:n}}}return{}}}},ut=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=fe(e,t);switch(r){case"referenceHidden":{const e=qe(await He(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:_e(e)}}}case"escaped":{const e=qe(await He(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:_e(e)}}}default:return{}}}}},at=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:l,elements:c,middlewareData:u}=t,{element:a,padding:s=0}=fe(e,t)||{};if(null==a)return{};const f=we(s),d={x:n,y:r},p=ge(o),m=ve(p),v=await l.getDimensions(a),h="y"===p,g=h?"top":"left",y=h?"bottom":"right",b=h?"clientHeight":"clientWidth",w=i.reference[m]+i.reference[p]-d[p]-i.floating[m],x=d[p]-i.reference[p],E=await(null==l.getOffsetParent?void 0:l.getOffsetParent(a));let R=E?E[b]:0;R&&await(null==l.isElement?void 0:l.isElement(E))||(R=c.floating[b]||i.floating[m]);const C=w/2-x/2,S=R/2-v[m]/2-1,O=oe(f[g],S),L=oe(f[y],S),k=O,T=R-v[m]-L,A=R/2-v[m]/2+C,P=se(k,A,T),I=!u.arrow&&null!=pe(o)&&A!==P&&i.reference[m]/2-(A<k?O:L)-v[m]/2<0,M=I?A<k?A-k:A-T:0;return{[p]:d[p]+M,data:{[p]:P,centerOffset:A-P-M,...I&&{alignmentOffset:M}},reset:I}}}),st=(e,t,n)=>{const r=new Map,o={platform:ot,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,c=i.filter(Boolean),u=await(null==l.isRTL?void 0:l.isRTL(t));let a=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:s,y:f}=je(a,r,u),d=r,p={},m=0;for(let n=0;n<c.length;n++){const{name:i,fn:v}=c[n],{x:h,y:g,data:y,reset:b}=await v({x:s,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:a,platform:l,elements:{reference:e,floating:t}});s=null!=h?h:s,f=null!=g?g:f,p={...p,[i]:{...p[i],...y}},b&&m<=50&&(m++,"object"==typeof b&&(b.placement&&(d=b.placement),b.rects&&(a=!0===b.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):b.rects),({x:s,y:f}=je(a,d,u))),n=-1)}return{x:s,y:f,placement:d,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var ft="undefined"!=typeof document?a:l;function dt(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(!dt(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)&&!dt(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function pt(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function mt(e,t){const n=pt(e);return Math.round(t*n)/n}function vt(t){const n=e.useRef(t);return ft((()=>{n.current=t})),n}const ht=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?at({element:n.current,padding:r}).fn(t):{}:n?at({element:n,padding:r}).fn(t):{};var o}});function gt(t){return e.useMemo((()=>t.every((e=>null==e))?null:e=>{t.forEach((t=>{"function"==typeof t?t(e):null!=t&&(t.current=e)}))}),t)}const yt={...e},bt=yt.useInsertionEffect||(e=>e());function wt(t){const n=e.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return bt((()=>{n.current=t})),e.useCallback((function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return null==n.current?void 0:n.current(...t)}),[])}var xt="undefined"!=typeof document?a:l;let Et=!1,Rt=0;const Ct=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Rt++;const St=yt.useId||function(){const[t,n]=e.useState((()=>Et?Ct():void 0));return xt((()=>{null==t&&n(Ct())}),[]),e.useEffect((()=>{Et=!0}),[]),t};let Ot;"production"!==process.env.NODE_ENV&&(Ot=new Set);const Lt=e.forwardRef((function(t,n){const{context:{placement:r,elements:{floating:o},middlewareData:{arrow:i,shift:l}},width:c=14,height:u=7,tipRadius:a=0,strokeWidth:s=0,staticOffset:p,stroke:m,d:v,style:{transform:h,...g}={},...y}=t;"production"!==process.env.NODE_ENV&&(n||function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");var i;null!=(e=Ot)&&e.has(o)||(null==(i=Ot)||i.add(o),console.warn(o))}("The `ref` prop is required for `FloatingArrow`."));const b=St(),[w,x]=e.useState(!1);if(xt((()=>{if(!o)return;"rtl"===W(o).direction&&x(!0)}),[o]),!o)return null;const[E,R]=r.split("-"),C="top"===E||"bottom"===E;let S=p;(C&&null!=l&&l.x||!C&&null!=l&&l.y)&&(S=null);const O=2*s,L=O/2,k=c/2*(a/-8+1),T=u/2*a/4,A=!!v,P=S&&"end"===R?"bottom":"top";let I=S&&"end"===R?"right":"left";S&&w&&(I="end"===R?"left":"right");const M=null!=(null==i?void 0:i.x)?S||i.x:"",D=null!=(null==i?void 0:i.y)?S||i.y:"",N=v||"M0,0 H"+c+" L"+(c-k)+","+(u-T)+" Q"+c/2+","+u+" "+k+","+(u-T)+" Z",F={top:A?"rotate(180deg)":"",left:A?"rotate(90deg)":"rotate(-90deg)",bottom:A?"":"rotate(180deg)",right:A?"rotate(-90deg)":"rotate(90deg)"}[E];return f("svg",{...y,"aria-hidden":!0,ref:n,width:A?c:c+O,height:c,viewBox:"0 0 "+c+" "+(u>c?u:c),style:{position:"absolute",pointerEvents:"none",[I]:M,[P]:D,[E]:C||A?"100%":"calc(100% - "+O/2+"px)",transform:[F,h].filter((e=>!!e)).join(" "),...g},children:[O>0&&d("path",{clipPath:"url(#"+b+")",fill:"none",stroke:m,strokeWidth:O+(v?0:1),d:N}),d("path",{stroke:O&&!v?y.fill:"none",d:N}),d("clipPath",{id:b,children:d("rect",{x:-L,y:L*(A?-1:1),width:c+O,height:c})})]})}));const kt=e.createContext(null),Tt=e.createContext(null),At=()=>{var t;return(null==(t=e.useContext(kt))?void 0:t.id)||null},Pt=()=>e.useContext(Tt);function It(e){return"data-floating-ui-"+e}function Mt(e){const t=r(e);return xt((()=>{t.current=e})),t}const Dt=It("safe-polygon");function Nt(e,t,n){return n&&!Z(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}let Ft=0;function Vt(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Ft);const i=()=>null==e?void 0:e.focus({preventScroll:n});o?i():Ft=requestAnimationFrame(i)}function Wt(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 Bt(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}let jt=new WeakMap,Ht=new WeakSet,qt={},_t=0;const Kt=e=>e&&(e.host||Kt(e.parentNode));function Ut(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,l=(c=t,e.map((e=>{if(c.contains(e))return e;const t=Kt(e);return c.contains(t)?t:null})).filter((e=>null!=e)));var c;const u=new Set,a=new Set(l),s=[];qt[o]||(qt[o]=new WeakMap);const f=qt[o];return l.forEach((function e(t){if(!t||u.has(t))return;u.add(t),t.parentNode&&e(t.parentNode)})),function e(t){if(!t||a.has(t))return;[].forEach.call(t.children,(t=>{if("script"!==S(t))if(u.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=jt.get(t)||0,l=i?r+1:r,c=(f.get(t)||0)+1;jt.set(t,l),f.set(t,c),s.push(t),1===l&&n&&Ht.add(t),1===c&&t.setAttribute(o,""),!n&&i&&t.setAttribute(i,"true")}}))}(t),u.clear(),_t++,()=>{s.forEach((e=>{const t=jt.get(e)||0,n=i?t-1:t,r=(f.get(e)||0)-1;jt.set(e,n),f.set(e,r),n||(!Ht.has(e)&&i&&e.removeAttribute(i),Ht.delete(e)),r||e.removeAttribute(o)})),_t--,_t||(jt=new WeakMap,jt=new WeakMap,Ht=new WeakSet,qt={})}}function Xt(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=Q(e[0]).body;return Ut(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const zt=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Yt(e,t){const n=Be(e,zt());"prev"===t&&n.reverse();const r=n.indexOf(K(Q(e)));return n.slice(r+1)[0]}function $t(){return Yt(document.body,"next")}function Gt(){return Yt(document.body,"prev")}function Zt(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!U(n,r)}function Qt(e){Be(e,zt()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function Jt(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const en={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0};function tn(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const nn=e.forwardRef((function(t,n){const[r,o]=e.useState();xt((()=>($()&&o("button"),document.addEventListener("keydown",tn),()=>{document.removeEventListener("keydown",tn)})),[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":!r||void 0,[It("focus-guard")]:"",style:en};return d("span",{...t,...i})})),rn=e.createContext(null),on=It("portal");const ln=()=>e.useContext(rn),cn="data-floating-ui-focusable";function un(e){return e?e.hasAttribute(cn)?e:e.querySelector("["+cn+"]")||e:null}let an=[];function sn(e){an=an.filter((e=>e.isConnected)),e&&"body"!==S(e)&&(an.push(e),an.length>20&&(an=an.slice(-20)))}function fn(){return an.slice().reverse().find((e=>e.isConnected))}function dn(e){const t=zt();return function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==Ce.call(e,Ee)&&Fe(t,e)}(e,t)?e:Be(e,t)[0]||e}const pn=e.forwardRef((function(e,t){return d("button",{...e,type:"button",ref:t,tabIndex:-1,style:en})}));let mn=0;let vn=()=>{};const hn=e.forwardRef((function(e,t){const{lockScroll:n=!1,...r}=e;return xt((()=>{if(n)return mn++,1===mn&&(vn=function(){const e=/iP(hone|ad|od)|iOS/.test(X()),t=document.body.style,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",r=window.innerWidth-document.documentElement.clientWidth,o=t.left?parseFloat(t.left):window.scrollX,i=t.top?parseFloat(t.top):window.scrollY;if(t.overflow="hidden",r&&(t[n]=r+"px"),e){var l,c;const e=(null==(l=window.visualViewport)?void 0:l.offsetLeft)||0,n=(null==(c=window.visualViewport)?void 0:c.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(i-Math.floor(n))+"px",left:-(o-Math.floor(e))+"px",right:"0"})}return()=>{Object.assign(t,{overflow:"",[n]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(o,i))}}()),()=>{mn--,0===mn&&vn()}}),[n]),d("div",{ref:t,...r,style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}})})),gn={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},yn={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},bn=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 wn(t){const{open:n=!1,onOpenChange:r,elements:o}=t,i=St(),l=e.useRef({}),[c]=e.useState((()=>function(){const e=new Map;return{emit(t,n){var r;null==(r=e.get(t))||r.forEach((e=>e(n)))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,(null==(r=e.get(t))?void 0:r.filter((e=>e!==n)))||[])}}}())),u=null!=At();if("production"!==process.env.NODE_ENV){const e=o.reference;e&&!T(e)&&function(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");var i;null!=(e=Ot)&&e.has(o)||(null==(i=Ot)||i.add(o),console.error(o))}("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[a,s]=e.useState(o.reference),f=wt(((e,t,n)=>{l.current.openEvent=e?t:void 0,c.emit("openchange",{open:e,event:t,reason:n,nested:u}),null==r||r(e,t,n)})),d=e.useMemo((()=>({setPositionReference:s})),[]),p=e.useMemo((()=>({reference:a||o.reference||null,floating:o.floating||null,domReference:o.reference})),[a,o.reference,o.floating]);return e.useMemo((()=>({dataRef:l,open:n,onOpenChange:f,elements:p,events:c,floatingId:i,refs:d})),[n,f,p,c,i,d])}const xn="active",En="selected";function Rn(e,t,n){const r=new Map,o="item"===n;let i=e;if(o&&e){const{[xn]:t,[En]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1,[cn]:""},...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 l;o&&[xn,En].includes(n)||(0===n.indexOf("on")?(r.has(n)||r.set(n,[]),"function"==typeof i&&(null==(l=r.get(n))||l.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 Cn=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);var Sn={Portal:function(t){const{children:n,id:r,root:o,preserveTabOrder:i=!0}=t,l=function(t){void 0===t&&(t={});const{id:n,root:r}=t,o=St(),i=ln(),[l,c]=e.useState(null),u=e.useRef(null);return xt((()=>()=>{null==l||l.remove(),queueMicrotask((()=>{u.current=null}))}),[l]),xt((()=>{if(!o)return;if(u.current)return;const e=n?document.getElementById(n):null;if(!e)return;const t=document.createElement("div");t.id=o,t.setAttribute(on,""),e.appendChild(t),u.current=t,c(t)}),[n,o]),xt((()=>{if(null===r)return;if(!o)return;if(u.current)return;let e=r||(null==i?void 0:i.portalNode);e&&!T(e)&&(e=e.current),e=e||document.body;let t=null;n&&(t=document.createElement("div"),t.id=n,e.appendChild(t));const l=document.createElement("div");l.id=o,l.setAttribute(on,""),e=t||e,e.appendChild(l),u.current=l,c(l)}),[n,r,o,i]),l}({id:r,root:o}),[c,u]=e.useState(null),a=e.useRef(null),s=e.useRef(null),p=e.useRef(null),v=e.useRef(null),h=null==c?void 0:c.modal,g=null==c?void 0:c.open,y=!!c&&!c.modal&&c.open&&i&&!(!o&&!l);return e.useEffect((()=>{if(l&&i&&!h)return l.addEventListener("focusin",e,!0),l.addEventListener("focusout",e,!0),()=>{l.removeEventListener("focusin",e,!0),l.removeEventListener("focusout",e,!0)};function e(e){if(l&&Zt(e)){("focusin"===e.type?Jt:Qt)(l)}}}),[l,i,h]),e.useEffect((()=>{l&&(g||Jt(l))}),[g,l]),f(rn.Provider,{value:e.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:a,afterOutsideRef:s,beforeInsideRef:p,afterInsideRef:v,portalNode:l,setFocusManagerState:u})),[i,l]),children:[y&&l&&d(nn,{"data-type":"outside",ref:a,onFocus:e=>{if(Zt(e,l)){var t;null==(t=p.current)||t.focus()}else{const e=Gt()||(null==c?void 0:c.domReference);null==e||e.focus()}}}),y&&l&&d("span",{"aria-owns":l.id,style:en}),l&&m.createPortal(n,l),y&&l&&d(nn,{"data-type":"outside",ref:s,onFocus:e=>{if(Zt(e,l)){var t;null==(t=v.current)||t.focus()}else{const t=$t()||(null==c?void 0:c.domReference);null==t||t.focus(),(null==c?void 0:c.closeOnFocusOut)&&(null==c||c.onOpenChange(!1,e.nativeEvent,"focus-out"))}}})]})},Overlay:hn,FocusManager:function(t){const{context:n,children:r,disabled:o=!1,order:i=["content"],guards:l=!0,initialFocus:c=0,returnFocus:u=!0,restoreFocus:a=!1,modal:s=!0,visuallyHiddenDismiss:m=!1,closeOnFocusOut:v=!0,outsideElementsInert:h=!1}=t,{open:g,onOpenChange:y,events:b,dataRef:w,elements:{domReference:x,floating:E}}=n,R=wt((()=>{var e;return null==(e=w.current.floatingContext)?void 0:e.nodeId})),C="number"==typeof c&&c<0,S=!!(O=x)&&"combobox"===O.getAttribute("role")&&te(O)&&C;var O;const L="undefined"!=typeof HTMLElement&&"inert"in HTMLElement.prototype,k=!L||l,T=!k||L&&h,P=Mt(i),I=Mt(c),M=Mt(u),D=Pt(),N=ln(),F=e.useRef(null),V=e.useRef(null),W=e.useRef(!1),B=e.useRef(!1),j=e.useRef(-1),H=null!=N,q=un(E),_=wt((function(e){return void 0===e&&(e=q),e?Be(e,zt()):[]})),X=wt((e=>{const t=_(e);return P.current.map((e=>x&&"reference"===e?x:q&&"floating"===e?q:t)).filter(Boolean).flat()}));e.useEffect((()=>{if(o)return;if(!s)return;function e(e){if("Tab"===e.key){U(q,K(Q(q)))&&0===_().length&&!S&&ne(e);const t=X(),n=ee(e);"reference"===P.current[0]&&n===x&&(ne(e),e.shiftKey?Vt(t[t.length-1]):Vt(t[1])),"floating"===P.current[1]&&n===q&&e.shiftKey&&(ne(e),Vt(t[0]))}}const t=Q(q);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[o,x,q,s,P,S,_,X]),e.useEffect((()=>{if(!o&&E)return E.addEventListener("focusin",e),()=>{E.removeEventListener("focusin",e)};function e(e){const t=ee(e),n=_().indexOf(t);-1!==n&&(j.current=n)}}),[o,E,_]),e.useEffect((()=>{if(!o&&v)return E&&A(x)?(x.addEventListener("focusout",t),x.addEventListener("pointerdown",e),E.addEventListener("focusout",t),()=>{x.removeEventListener("focusout",t),x.removeEventListener("pointerdown",e),E.removeEventListener("focusout",t)}):void 0;function e(){B.current=!0,setTimeout((()=>{B.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const n=R(),r=!(U(x,t)||U(E,t)||U(t,E)||U(null==N?void 0:N.portalNode,t)||null!=t&&t.hasAttribute(It("focus-guard"))||D&&(Bt(D.nodesRef.current,n).find((e=>{var n,r;return U(null==(n=e.context)?void 0:n.elements.floating,t)||U(null==(r=e.context)?void 0:r.elements.domReference,t)}))||Wt(D.nodesRef.current,n).find((e=>{var n,r,o;return[null==(n=e.context)?void 0:n.elements.floating,un(null==(r=e.context)?void 0:r.elements.floating)].includes(t)||(null==(o=e.context)?void 0:o.elements.domReference)===t}))));if(a&&r&&K(Q(q))===Q(q).body){A(q)&&q.focus();const e=j.current,t=_(),n=t[e]||t[t.length-1]||q;A(n)&&n.focus()}!S&&s||!t||!r||B.current||t===fn()||(W.current=!0,y(!1,e,"focus-out"))}))}}),[o,x,E,q,s,D,N,y,v,a,_,S,R]);const z=e.useRef(null),$=e.useRef(null),Z=gt([z,null==N?void 0:N.beforeInsideRef]),J=gt([$,null==N?void 0:N.afterInsideRef]);function re(e){return!o&&m&&s?d(pn,{ref:"start"===e?F:V,onClick:e=>y(!1,e.nativeEvent),children:"string"==typeof m?m:"Dismiss"}):null}e.useEffect((()=>{var e;if(o)return;if(!E)return;const t=Array.from((null==N||null==(e=N.portalNode)?void 0:e.querySelectorAll("["+It("portal")+"]"))||[]),n=D&&!s?Wt(null==D?void 0:D.nodesRef.current,R()).map((e=>{var t;return null==(t=e.context)?void 0:t.elements.floating})):[],r=[E,...t,...n,F.current,V.current,z.current,$.current,null==N?void 0:N.beforeOutsideRef.current,null==N?void 0:N.afterOutsideRef.current,P.current.includes("reference")||S?x:null].filter((e=>null!=e)),i=s||S?Xt(r,!T,T):Xt(r);return()=>{i()}}),[o,x,E,s,P,N,S,k,T,D,R]),xt((()=>{if(o||!A(q))return;const e=K(Q(q));queueMicrotask((()=>{const t=X(q),n=I.current,r=("number"==typeof n?t[n]:n.current)||q,o=U(q,e);C||o||!g||Vt(r,{preventScroll:r===q})}))}),[o,g,q,C,X,I]),xt((()=>{if(o||!q)return;let e=!1;const t=Q(q),n=K(t);let r=w.current.openEvent;function i(t){let{open:n,reason:o,event:i,nested:l}=t;n&&(r=i),"escape-key"===o&&x&&sn(x),["hover","safe-polygon"].includes(o)&&"mouseleave"===i.type&&(W.current=!0),"outside-press"===o&&(l?(W.current=!1,e=!0):W.current=!(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(G()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(i)||Y(i)))}sn(n),b.on("openchange",i);const l=t.createElement("span");return l.setAttribute("tabindex","-1"),l.setAttribute("aria-hidden","true"),Object.assign(l.style,en),H&&x&&x.insertAdjacentElement("afterend",l),()=>{b.off("openchange",i);const n=K(t),o=U(E,n)||D&&Bt(D.nodesRef.current,R()).some((e=>{var t;return U(null==(t=e.context)?void 0:t.elements.floating,n)}));(o||r&&["click","mousedown"].includes(r.type))&&x&&sn(x);const c="boolean"==typeof M.current?fn()||l:M.current.current||l;queueMicrotask((()=>{const r=dn(c);M.current&&!W.current&&A(r)&&(r===n||n===t.body||o)&&r.focus({preventScroll:e}),l.remove()}))}}),[o,E,q,M,w,b,D,H,x,R]),e.useEffect((()=>{queueMicrotask((()=>{W.current=!1}))}),[o]),xt((()=>{if(!o&&N)return N.setFocusManagerState({modal:s,closeOnFocusOut:v,open:g,onOpenChange:y,domReference:x}),()=>{N.setFocusManagerState(null)}}),[o,N,s,g,y,v,x]),xt((()=>{if(o)return;if(!q)return;if("function"!=typeof MutationObserver)return;if(C)return;const e=()=>{const e=q.getAttribute("tabindex"),t=_(),n=K(Q(E)),r=t.indexOf(n);-1!==r&&(j.current=r),P.current.includes("floating")||n!==x&&0===t.length?"0"!==e&&q.setAttribute("tabindex","0"):"-1"!==e&&q.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(q,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}}),[o,E,q,x,P,_,C]);const oe=!o&&k&&(!s||!S)&&(H||s);return f(p,{children:[oe&&d(nn,{"data-type":"inside",ref:Z,onFocus:e=>{if(s){const e=X();Vt("reference"===i[0]?e[0]:e[e.length-1])}else if(null!=N&&N.preserveTabOrder&&N.portalNode)if(W.current=!1,Zt(e,N.portalNode)){const e=$t()||x;null==e||e.focus()}else{var t;null==(t=N.beforeOutsideRef.current)||t.focus()}}}),!S&&re("start"),r,re("end"),oe&&d(nn,{"data-type":"inside",ref:J,onFocus:e=>{if(s)Vt(X()[0]);else if(null!=N&&N.preserveTabOrder&&N.portalNode)if(v&&(W.current=!0),Zt(e,N.portalNode)){const e=Gt()||x;null==e||e.focus()}else{var t;null==(t=N.afterOutsideRef.current)||t.focus()}}})]})},useFloating:function(t){void 0===t&&(t={});const{nodeId:n}=t,r=wn({...t,elements:{reference:null,floating:null,...t.elements}}),o=t.rootContext||r,i=o.elements,[l,c]=e.useState(null),[u,a]=e.useState(null),s=(null==i?void 0:i.domReference)||l,f=e.useRef(null),d=Pt();xt((()=>{s&&(f.current=s)}),[s]);const p=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:l,floating:c}={},transform:u=!0,whileElementsMounted:a,open:s}=t,[f,d]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[p,v]=e.useState(o);dt(p,o)||v(o);const[h,g]=e.useState(null),[y,b]=e.useState(null),w=e.useCallback((e=>{e!==C.current&&(C.current=e,g(e))}),[]),x=e.useCallback((e=>{e!==S.current&&(S.current=e,b(e))}),[]),E=l||h,R=c||y,C=e.useRef(null),S=e.useRef(null),O=e.useRef(f),L=null!=a,k=vt(a),T=vt(i),A=vt(s),P=e.useCallback((()=>{if(!C.current||!S.current)return;const e={placement:n,strategy:r,middleware:p};T.current&&(e.platform=T.current),st(C.current,S.current,e).then((e=>{const t={...e,isPositioned:!1!==A.current};I.current&&!dt(O.current,t)&&(O.current=t,m.flushSync((()=>{d(t)})))}))}),[p,n,r,T,A]);ft((()=>{!1===s&&O.current.isPositioned&&(O.current.isPositioned=!1,d((e=>({...e,isPositioned:!1}))))}),[s]);const I=e.useRef(!1);ft((()=>(I.current=!0,()=>{I.current=!1})),[]),ft((()=>{if(E&&(C.current=E),R&&(S.current=R),E&&R){if(k.current)return k.current(E,R,P);P()}}),[E,R,P,k,L]);const M=e.useMemo((()=>({reference:C,floating:S,setReference:w,setFloating:x})),[w,x]),D=e.useMemo((()=>({reference:E,floating:R})),[E,R]),N=e.useMemo((()=>{const e={position:r,left:0,top:0};if(!D.floating)return e;const t=mt(D.floating,f.x),n=mt(D.floating,f.y);return u?{...e,transform:"translate("+t+"px, "+n+"px)",...pt(D.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,u,D.floating,f.x,f.y]);return e.useMemo((()=>({...f,update:P,refs:M,elements:D,floatingStyles:N})),[f,P,M,D,N])}({...t,elements:{...i,...u&&{reference:u}}}),v=e.useCallback((e=>{const t=T(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;a(t),p.refs.setReference(t)}),[p.refs]),h=e.useCallback((e=>{(T(e)||null===e)&&(f.current=e,c(e)),(T(p.refs.reference.current)||null===p.refs.reference.current||null!==e&&!T(e))&&p.refs.setReference(e)}),[p.refs]),g=e.useMemo((()=>({...p.refs,setReference:h,setPositionReference:v,domReference:f})),[p.refs,h,v]),y=e.useMemo((()=>({...p.elements,domReference:s})),[p.elements,s]),b=e.useMemo((()=>({...p,...o,refs:g,elements:y,nodeId:n})),[p,g,y,n,o]);return xt((()=>{o.dataRef.current.floatingContext=b;const e=null==d?void 0:d.nodesRef.current.find((e=>e.id===n));e&&(e.context=b)})),e.useMemo((()=>({...p,context:b,refs:g,elements:y})),[p,g,y,b])},Arrow:Lt,arrow:(e,t)=>({...ht(e),options:[e,t]}),useRole:function(t,n){var r;void 0===n&&(n={});const{open:o,floatingId:i}=t,{enabled:l=!0,role:c="dialog"}=n,u=null!=(r=Cn.get(c))?r:c,a=St(),s=null!=At(),f=e.useMemo((()=>"tooltip"===u||"label"===c?{["aria-"+("label"===c?"labelledby":"describedby")]:o?i:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":"alertdialog"===u?"dialog":u,"aria-controls":o?i:void 0,..."listbox"===u&&{role:"combobox"},..."menu"===u&&{id:a},..."menu"===u&&s&&{role:"menuitem"},..."select"===c&&{"aria-autocomplete":"none"},..."combobox"===c&&{"aria-autocomplete":"list"}}),[u,i,s,o,a,c]),d=e.useMemo((()=>{const e={id:i,...u&&{role:u}};return"tooltip"===u||"label"===c?e:{...e,..."menu"===u&&{"aria-labelledby":a}}}),[u,i,a,c]),p=e.useCallback((e=>{let{active:t,selected:n}=e;const r={role:"option",...t&&{id:i+"-option"}};switch(c){case"select":return{...r,"aria-selected":t&&n};case"combobox":return{...r,...t&&{"aria-selected":!0}}}return{}}),[i,c]);return e.useMemo((()=>l?{reference:f,floating:d,item:p}:{}),[l,f,d,p])},useFocus:function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,events:i,dataRef:l,elements:c}=t,{enabled:u=!0,visibleOnly:a=!0}=n,s=e.useRef(!1),f=e.useRef(),d=e.useRef(!0);e.useEffect((()=>{if(!u)return;const e=O(c.domReference);function t(){!r&&A(c.domReference)&&c.domReference===K(Q(c.domReference))&&(s.current=!0)}function n(){d.current=!0}return e.addEventListener("blur",t),e.addEventListener("keydown",n,!0),()=>{e.removeEventListener("blur",t),e.removeEventListener("keydown",n,!0)}}),[c.domReference,r,u]),e.useEffect((()=>{if(u)return i.on("openchange",e),()=>{i.off("openchange",e)};function e(e){let{reason:t}=e;"reference-press"!==t&&"escape-key"!==t||(s.current=!0)}}),[i,u]),e.useEffect((()=>()=>{clearTimeout(f.current)}),[]);const p=e.useMemo((()=>({onPointerDown(e){Y(e.nativeEvent)||(d.current=!1)},onMouseLeave(){s.current=!1},onFocus(e){if(s.current)return;const t=ee(e.nativeEvent);if(a&&T(t))try{if($()&&X().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints)throw Error();if(!t.matches(":focus-visible"))return}catch(e){if(!d.current&&!te(t))return}o(!0,e.nativeEvent,"focus")},onBlur(e){s.current=!1;const t=e.relatedTarget,n=e.nativeEvent,r=T(t)&&t.hasAttribute(It("focus-guard"))&&"outside"===t.getAttribute("data-type");f.current=window.setTimeout((()=>{var e;const i=K(c.domReference?c.domReference.ownerDocument:document);(t||i!==c.domReference)&&(U(null==(e=l.current.floatingContext)?void 0:e.refs.floating.current,i)||U(c.domReference,i)||r||o(!1,n,"focus"))}))}})),[l,c.domReference,o,a]);return e.useMemo((()=>u?{reference:p}:{}),[u,p])},useInteractions:function(t){void 0===t&&(t=[]);const n=t.map((e=>null==e?void 0:e.reference)),r=t.map((e=>null==e?void 0:e.floating)),o=t.map((e=>null==e?void 0:e.item)),i=e.useCallback((e=>Rn(e,t,"reference")),n),l=e.useCallback((e=>Rn(e,t,"floating")),r),c=e.useCallback((e=>Rn(e,t,"item")),o);return e.useMemo((()=>({getReferenceProps:i,getFloatingProps:l,getItemProps:c})),[i,l,c])},useDismiss:function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,elements:i,dataRef:l}=t,{enabled:c=!0,escapeKey:u=!0,outsidePress:a=!0,outsidePressEvent:s="pointerdown",referencePress:f=!1,referencePressEvent:d="pointerdown",ancestorScroll:p=!1,bubbles:m,capture:v}=n,h=Pt(),g=wt("function"==typeof a?a:()=>!1),y="function"==typeof a?g:a,b=e.useRef(!1),w=e.useRef(!1),{escapeKey:x,outsidePress:E}=bn(m),{escapeKey:R,outsidePress:C}=bn(v),S=e.useRef(!1),O=wt((e=>{var t;if(!r||!c||!u||"Escape"!==e.key)return;if(S.current)return;const n=null==(t=l.current.floatingContext)?void 0:t.nodeId,i=h?Bt(h.nodesRef.current,n):[];if(!x&&(e.stopPropagation(),i.length>0)){let e=!0;if(i.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__escapeKeyBubbles||(e=!1)})),!e)return}o(!1,function(e){return"nativeEvent"in e}(e)?e.nativeEvent:e,"escape-key")})),L=wt((e=>{var t;const n=()=>{var t;O(e),null==(t=ee(e))||t.removeEventListener("keydown",n)};null==(t=ee(e))||t.addEventListener("keydown",n)})),k=wt((e=>{var t;const n=b.current;b.current=!1;const r=w.current;if(w.current=!1,"click"===s&&r)return;if(n)return;if("function"==typeof y&&!y(e))return;const c=ee(e),u="["+It("inert")+"]",a=Q(i.floating).querySelectorAll(u);let f=T(c)?c:null;for(;f&&!V(f);){const e=j(f);if(V(e)||!T(e))break;f=e}if(a.length&&T(c)&&!c.matches("html,body")&&!U(c,i.floating)&&Array.from(a).every((e=>!U(f,e))))return;if(A(c)&&M){const t=V(c),n=W(c),r=/auto|scroll/,o=t||r.test(n.overflowX),i=t||r.test(n.overflowY),l=o&&c.clientWidth>0&&c.scrollWidth>c.clientWidth,u=i&&c.clientHeight>0&&c.scrollHeight>c.clientHeight,a="rtl"===n.direction,s=u&&(a?e.offsetX<=c.offsetWidth-c.clientWidth:e.offsetX>c.clientWidth),f=l&&e.offsetY>c.clientHeight;if(s||f)return}const d=null==(t=l.current.floatingContext)?void 0:t.nodeId,p=h&&Bt(h.nodesRef.current,d).some((t=>{var n;return J(e,null==(n=t.context)?void 0:n.elements.floating)}));if(J(e,i.floating)||J(e,i.domReference)||p)return;const m=h?Bt(h.nodesRef.current,d):[];if(m.length>0){let e=!0;if(m.forEach((t=>{var n;null==(n=t.context)||!n.open||t.context.dataRef.current.__outsidePressBubbles||(e=!1)})),!e)return}o(!1,e,"outside-press")})),P=wt((e=>{var t;const n=()=>{var t;k(e),null==(t=ee(e))||t.removeEventListener(s,n)};null==(t=ee(e))||t.addEventListener(s,n)}));e.useEffect((()=>{if(!r||!c)return;l.current.__escapeKeyBubbles=x,l.current.__outsidePressBubbles=E;let e=-1;function t(e){o(!1,e,"ancestor-scroll")}function n(){window.clearTimeout(e),S.current=!0}function a(){e=window.setTimeout((()=>{S.current=!1}),F()?5:0)}const f=Q(i.floating);u&&(f.addEventListener("keydown",R?L:O,R),f.addEventListener("compositionstart",n),f.addEventListener("compositionend",a)),y&&f.addEventListener(s,C?P:k,C);let d=[];return p&&(T(i.domReference)&&(d=q(i.domReference)),T(i.floating)&&(d=d.concat(q(i.floating))),!T(i.reference)&&i.reference&&i.reference.contextElement&&(d=d.concat(q(i.reference.contextElement)))),d=d.filter((e=>{var t;return e!==(null==(t=f.defaultView)?void 0:t.visualViewport)})),d.forEach((e=>{e.addEventListener("scroll",t,{passive:!0})})),()=>{u&&(f.removeEventListener("keydown",R?L:O,R),f.removeEventListener("compositionstart",n),f.removeEventListener("compositionend",a)),y&&f.removeEventListener(s,C?P:k,C),d.forEach((e=>{e.removeEventListener("scroll",t)})),window.clearTimeout(e)}}),[l,i,u,y,s,r,o,p,c,x,E,O,R,L,k,C,P]),e.useEffect((()=>{b.current=!1}),[y,s]);const I=e.useMemo((()=>({onKeyDown:O,...f&&{[gn[d]]:e=>{o(!1,e.nativeEvent,"reference-press")},..."click"!==d&&{onClick(e){o(!1,e.nativeEvent,"reference-press")}}}})),[O,o,f,d]),M=e.useMemo((()=>({onKeyDown:O,onMouseDown(){w.current=!0},onMouseUp(){w.current=!0},[yn[s]]:()=>{b.current=!0}})),[O,s]);return e.useMemo((()=>c?{reference:I,floating:M}:{}),[c,I,M])},useHover:function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,dataRef:i,events:l,elements:c}=t,{enabled:u=!0,delay:a=0,handleClose:s=null,mouseOnly:f=!1,restMs:d=0,move:p=!0}=n,m=Pt(),v=At(),h=Mt(s),g=Mt(a),y=Mt(r),b=e.useRef(),w=e.useRef(-1),x=e.useRef(),E=e.useRef(-1),R=e.useRef(!0),C=e.useRef(!1),S=e.useRef((()=>{})),O=e.useRef(!1),L=e.useCallback((()=>{var e;const t=null==(e=i.current.openEvent)?void 0:e.type;return(null==t?void 0:t.includes("mouse"))&&"mousedown"!==t}),[i]);e.useEffect((()=>{if(u)return l.on("openchange",e),()=>{l.off("openchange",e)};function e(e){let{open:t}=e;t||(clearTimeout(w.current),clearTimeout(E.current),R.current=!0,O.current=!1)}}),[u,l]),e.useEffect((()=>{if(!u)return;if(!h.current)return;if(!r)return;function e(e){L()&&o(!1,e,"hover")}const t=Q(c.floating).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[c.floating,r,o,u,h,L]);const k=e.useCallback((function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const r=Nt(g.current,"close",b.current);r&&!x.current?(clearTimeout(w.current),w.current=window.setTimeout((()=>o(!1,e,n)),r)):t&&(clearTimeout(w.current),o(!1,e,n))}),[g,o]),A=wt((()=>{S.current(),x.current=void 0})),P=wt((()=>{if(C.current){const e=Q(c.floating).body;e.style.pointerEvents="",e.removeAttribute(Dt),C.current=!1}})),I=wt((()=>!!i.current.openEvent&&["click","mousedown"].includes(i.current.openEvent.type)));e.useEffect((()=>{if(u&&T(c.domReference)){var e;const o=c.domReference;return r&&o.addEventListener("mouseleave",l),null==(e=c.floating)||e.addEventListener("mouseleave",l),p&&o.addEventListener("mousemove",t,{once:!0}),o.addEventListener("mouseenter",t),o.addEventListener("mouseleave",n),()=>{var e;r&&o.removeEventListener("mouseleave",l),null==(e=c.floating)||e.removeEventListener("mouseleave",l),p&&o.removeEventListener("mousemove",t),o.removeEventListener("mouseenter",t),o.removeEventListener("mouseleave",n)}}function t(e){if(clearTimeout(w.current),R.current=!1,f&&!Z(b.current)||d>0&&!Nt(g.current,"open"))return;const t=Nt(g.current,"open",b.current);t?w.current=window.setTimeout((()=>{y.current||o(!0,e,"hover")}),t):r||o(!0,e,"hover")}function n(e){if(I())return;S.current();const t=Q(c.floating);if(clearTimeout(E.current),O.current=!1,h.current&&i.current.floatingContext){r||clearTimeout(w.current),x.current=h.current({...i.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){P(),A(),I()||k(e,!0,"safe-polygon")}});const n=x.current;return t.addEventListener("mousemove",n),void(S.current=()=>{t.removeEventListener("mousemove",n)})}("touch"!==b.current||!U(c.floating,e.relatedTarget))&&k(e)}function l(e){I()||i.current.floatingContext&&(null==h.current||h.current({...i.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){P(),A(),I()||k(e)}})(e))}}),[c,u,t,f,d,p,k,A,P,o,r,y,m,g,h,i,I]),xt((()=>{var e;if(u&&r&&null!=(e=h.current)&&e.__options.blockPointerEvents&&L()){C.current=!0;const e=c.floating;if(T(c.domReference)&&e){var t;const n=Q(c.floating).body;n.setAttribute(Dt,"");const r=c.domReference,o=null==m||null==(t=m.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=""}}}}),[u,r,v,c,m,h,L]),xt((()=>{r||(b.current=void 0,O.current=!1,A(),P())}),[r,A,P]),e.useEffect((()=>()=>{A(),clearTimeout(w.current),clearTimeout(E.current),P()}),[u,c.domReference,A,P]);const M=e.useMemo((()=>{function e(e){b.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){const{nativeEvent:t}=e;function n(){R.current||y.current||o(!0,t,"hover")}f&&!Z(b.current)||r||0===d||O.current&&e.movementX**2+e.movementY**2<2||(clearTimeout(E.current),"touch"===b.current?n():(O.current=!0,E.current=window.setTimeout(n,d)))}}}),[f,o,r,y,d]),D=e.useMemo((()=>({onMouseEnter(){clearTimeout(w.current)},onMouseLeave(e){I()||k(e.nativeEvent,!1)}})),[k,I]);return e.useMemo((()=>u?{reference:M,floating:D}:{}),[u,M,D])},flip:(e,t)=>({...ct(e),options:[e,t]}),shift:(e,t)=>({...lt(e),options:[e,t]}),hide:(e,t)=>({...ut(e),options:[e,t]}),offset:(e,t)=>({...it(e),options:[e,t]}),useMergeRefs:gt};var On=c((function(e,n){var r=e.role,o=void 0===r?"button":r,i=e.label,l=void 0===i?"":i,c=e.description,u=void 0===c?"":c,a=e.disabled,s=void 0!==a&&a,f=e.children,d=h(e,["role","label","description","disabled","children"]);return l&&(d["aria-label"]=l),u&&(d["aria-description"]=u),s&&(d["aria-disabled"]="true",u||(d["aria-description"]="Disabled Button")),t.createElement(b.button,v({ref:n,role:o,disabled:s},d),f)}));On.displayName="ButtonPrimitive";var Ln=function(){return console.warn("Direct usage of Select is not supported. Please use Select.Root, Select.Content, etc. instead."),null};Ln.Root=function(e){var n=e.children,i=e.className,c=e.value,u=e.defaultValue,a=void 0===u?"":u,f=e.onValueChange;e.onClickOutside;var d=e.placement,p=void 0===d?"bottom-start":d,m=h(e,["children","className","value","defaultValue","onValueChange","onClickOutside","placement"]),g=t.useState(!1),w=g[0],x=g[1],E=function(e,t,n){var i=o(t),c=i[0],u=i[1],a=void 0!==e,f=a?e:c,d=r(a),p=r(e);l((function(){"production"!==process.env.NODE_ENV&&(d.current!==a&&console.warn("Component changed from ".concat(d.current?"controlled":"uncontrolled"," to ").concat(a?"controlled":"uncontrolled",".")),d.current=a)}),[a]),l((function(){"production"!==process.env.NODE_ENV&&a&&!n&&e!==p.current&&console.warn("A component is changing a controlled value without an onChange handler. This will render a controlled component as uncontrolled."),p.current=e}),[e,a,n]);var m=s((function(e){var t="function"==typeof e?e(f):e;a||u(t),n&&n(t)}),[a,n,f]);return[f,m]}(c,a,f),C=E[0],S=E[1],O=Sn.useFloating({open:w,onOpenChange:x,placement:p}),L=O.refs,k=O.floatingStyles,T=O.context,A=Sn.useDismiss(T),P=Sn.useRole(T,{role:"listbox"}),I=Sn.useInteractions([A,P]),M=I.getReferenceProps,D=I.getFloatingProps,N=I.getItemProps,F={isOpen:w,setIsOpen:x,selectedValue:C,setSelectedValue:S,handleSelect:function(e){S(e),x(!1)},floatingContext:T,refs:L,getFloatingProps:D,getReferenceProps:M,floatingStyles:k,getItemProps:N};return t.createElement(y.Provider,{value:F},t.createElement(R.Root,null,t.createElement(b.div,v({},m,{className:i}),n)))},Ln.Content=function(e){var n=e.children,r=h(e,["children"]),o=u(y),i=o.isOpen;o.setIsOpen,o.selectedValue;var l=o.floatingContext,c=o.refs,a=o.getFloatingProps,s=o.floatingStyles;return t.createElement(t.Fragment,null,i&&t.createElement(Sn.FocusManager,{context:l},t.createElement(R.Group,null,t.createElement("div",v({ref:c.setFloating,style:s},a(),r),n))))},Ln.Portal=function(e){var n=e.children,r=u(y).isOpen,i=o(!1),c=i[0],a=i[1],s=document.querySelector("#rad-ui-theme-container")||document.body;return l((function(){s&&a(!0)}),[s]),r&&c?t.createElement(Sn.Portal,{root:s},n):null},Ln.Overlay=function(e){e.className;var n=u(y),r=n.isOpen,o=n.handleOverlayClick;return t.createElement(t.Fragment,null,r&&t.createElement(Sn.Overlay,{onClick:o}))},Ln.Item=function(e){var n=e.children,r=e.value,o=e.disabled,i=h(e,["children","value","disabled"]),l=u(y),c=l.handleSelect,a=l.selectedValue,s=l.getItemProps;return t.createElement(R.Item,null,t.createElement(On,v({disabled:o,"data-value":r,"aria-selected":r===a,onClick:function(){return c(r)}},i,s()),n))},Ln.Trigger=function(e){var n=e.children,r=h(e,["children"]),o=u(y),i=o.isOpen,l=o.setIsOpen,c=o.selectedValue,a=o.refs,s=o.getReferenceProps;return t.createElement("button",v({onClick:function(){return l(!i)}},r,{"aria-expanded":i,ref:a.setReference},s(),{role:"combobox"}),c||n)};var kn=t.createContext({rootClass:""});var Tn=function(){return console.warn("Direct usage of Select is not supported. Please use Select.Root, Select.Content, etc. instead."),null};Tn.Root=function(e){var n=e.customRootClass,r=e.children,o=e.defaultValue,i=e.value,l=e.onValueChange,c=h(e,["customRootClass","children","defaultValue","value","onValueChange"]),u=function(e,t){void 0===e&&(e="");var n=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return e?"".concat(e,"-").concat(n):"".concat("rad-ui","-").concat(n)}(n,"Select");return t.createElement(kn.Provider,{value:{rootClass:u}},t.createElement(Ln.Root,v({className:"".concat(u,"-root"),defaultValue:o,value:i,onValueChange:l},c),r))},Tn.Content=function(e){e.customRootClass;var n=e.children,r=e.position,o=void 0===r?"popper":r,i=h(e,["customRootClass","children","position"]),l=u(kn).rootClass;return t.createElement(Ln.Content,v({className:"".concat(l,"-content"),position:o,"data-position":o},i),n)},Tn.Item=function(e){e.customRootClass;var n=e.children,r=e.value,o=e.disabled,i=h(e,["customRootClass","children","value","disabled"]),l=u(kn).rootClass;return t.createElement(Ln.Item,v({className:"".concat(l,"-item"),value:r,disabled:o,"data-disabled":o?"":void 0,role:"option","aria-disabled":o?"true":void 0},i),t.createElement("span",{className:"".concat(l,"-text")},n))},Tn.Trigger=function(e){e.customRootClass;var n=e.children,r=e.disabled,o=e.placeholder,i=h(e,["customRootClass","children","disabled","placeholder"]),l=u(kn).rootClass,c=t.useRef(null);return console.log(c),t.createElement(Ln.Trigger,v({className:"".concat(l,"-trigger"),"aria-disabled":r?"true":void 0,"data-placeholder":o?"":void 0,ref:c},i),n)},Tn.Portal=function(e){var n=e.children;return document.querySelector("#rad-ui-theme-container")||document.body,t.createElement(Ln.Portal,null,n)},Tn.Indicator=function(){var e=u(kn).rootClass;return t.createElement("div",{className:"".concat(e,"-item-indicator")},t.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t.createElement("path",{d:"M13.3332 4L5.99984 11.3333L2.6665 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})))};export{Tn as default};
@@ -1 +1 @@
1
- 'use client';import e,{createContext as r,useRef as t,useState as n,useId as a,useEffect as l,forwardRef as i,useContext as o}from"react";var c=function(){return c=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},c.apply(this,arguments)};function u(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)r.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(t[n[a]]=e[n[a]])}return t}function d(e,r,t){if(t||2===arguments.length)for(var n,a=0,l=r.length;a<l;a++)!n&&a in r||(n||(n=Array.prototype.slice.call(r,0,a)),n[a]=r[a]);return e.concat(n||Array.prototype.slice.call(r))}"function"==typeof SuppressedError&&SuppressedError;var s=r({}),f=["div","span","button","input","a","img","p","h2"].reduce((function(r,t){return r[t]=function(r){var t=e.forwardRef((function(t,n){var a=t.asChild,l=void 0!==a&&a,i=t.children,o=u(t,["asChild","children"]);if(l){var d=e.Children.toArray(i);if(1!==d.length||!e.isValidElement(d[0]))return console.warn("Primitive.".concat(r,": asChild prop requires exactly one valid child element.")),e.createElement(r,c(c({},o),{ref:n}),i);var s=d[0];return e.cloneElement(s,c(c(c({},o),s.props),n?{ref:function(e){"function"==typeof n?n(e):n&&(n.current=e);var r=s.ref;"function"==typeof r?r(e):r&&(r.current=e)}}:{}))}return e.createElement(r,c(c({},o),{ref:n}),i)}));return t.displayName="Primitive.".concat(r),t}(t),r}),{}),v=r({orientation:"horizontal",loop:!0,disableTabIndexing:!1}),b=r({focusedItemId:null,setFocusedItemId:function(){},focusItems:[],setFocusItems:function(){},addFocusItem:function(){},groupRef:null}),p=i((function(r,t){var n,i=r.children,d=r["aria-label"],s=r["aria-labelledby"],p=r.role,m=void 0===p?"button":p,h=u(r,["children","aria-label","aria-labelledby","role"]),y=a(),g=o(b),I=g.focusedItemId,E=g.setFocusedItemId,x=g.addFocusItem,w=g.focusItems,O=g.groupRef,F=o(v),A=F.orientation,D=F.loop,k=F.disableTabIndexing,P=e.Children.toArray(i)[0],R=!0===(null===(n=null==P?void 0:P.props)||void 0===n?void 0:n.disabled),S=I===y,C=k||!R&&S?0:-1;l((function(){w.includes(y)||x(y)}),[w,I,y,x]);var T=function(e){if(O&&O.current){E(e);var r=CSS.escape(e),t=O.current.querySelector("#".concat(r));t&&t.focus()}},j=function(e,r){for(var t,n=e,a=0;a<w.length;a++){if(n+=r,D)n<0&&(n=w.length-1),n>=w.length&&(n=0);else if(n<0||n>=w.length)return-1;var l=w[n],i=null===(t=null==O?void 0:O.current)||void 0===t?void 0:t.querySelector("#".concat(CSS.escape(l)));if(i)if(!("true"===i.getAttribute("data-child-disabled")))return n}return-1},N=function(){var e=w.indexOf(y),r=j(e,-1);-1!==r&&T(w[r])},z=function(){var e=w.indexOf(y),r=j(e,1);-1!==r&&T(w[r])};return e.createElement(f.button,c({asChild:!0,onFocus:function(e){e.preventDefault(),R&&e.target.blur(),R||E(y)},tabIndex:C,ref:t,id:y,onKeyDown:function(e){if(!R)switch(e.key){case"ArrowUp":e.preventDefault(),"vertical"===A&&N();break;case"ArrowLeft":e.preventDefault(),"horizontal"===A&&N();break;case"ArrowDown":e.preventDefault(),"vertical"===A&&z();break;case"ArrowRight":e.preventDefault(),"horizontal"===A&&z();break;case"Home":e.preventDefault(),function(){if(w.length>0){var e=j(-1,1);-1!==e&&T(w[e])}}();break;case"End":e.preventDefault(),function(){if(w.length>0){var e=j(w.length,-1);-1!==e&&T(w[e])}}()}},"data-child-disabled":R,role:m,"aria-selected":S,"aria-disabled":R,"aria-label":d,"aria-labelledby":s},h),i)}));p.displayName="RovingFocusItem";var m={Root:function(r){var t=r.children,n=r.orientation,a=void 0===n?"horizontal":n,l=r.loop,i=void 0===l||l,o=r["aria-label"],d=r["aria-labelledby"],s=r.disableTabIndexing,b=void 0!==s&&s,p=u(r,["children","orientation","loop","aria-label","aria-labelledby","disableTabIndexing"]),m={orientation:a,loop:i,disableTabIndexing:b};return e.createElement(v.Provider,{value:m},e.createElement(f.div,c({role:"listbox","aria-orientation":a,"aria-label":o,"aria-labelledby":d},p),t))},Group:function(r){var i=r.children,o=r["aria-label"],s=r["aria-labelledby"],v=u(r,["children","aria-label","aria-labelledby"]),p=t(null),m=n([]),h=m[0],y=m[1],g=n(null),I=g[0],E=g[1],x=a();l((function(){!I&&h.length>0&&E(h[0])}),[h,I]);var w={focusedItemId:I,setFocusedItemId:E,focusItems:h,setFocusItems:y,addFocusItem:function(e){y((function(r){return d(d([],r,!0),[e],!1)}))},groupRef:p};return e.createElement(b.Provider,{value:w},e.createElement(f.div,c({id:x,ref:p,role:"group","aria-label":o,"aria-labelledby":s},v),i))},Item:p},h=function(r){var t=r.role,n=void 0===t?"button":t,a=r.label,l=void 0===a?"":a,i=r.description,o=void 0===i?"":i,d=r.disabled,s=void 0!==d&&d,v=r.children,b=u(r,["role","label","description","disabled","children"]);return l&&(b["aria-label"]=l),o&&(b["aria-description"]=o),s&&(b["aria-disabled"]="true",o||(b["aria-description"]="Disabled Button")),e.createElement(f.button,c({role:n,disabled:s},b),v)};function y(e){var r,t,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(r=0;r<a;r++)e[r]&&(t=y(e[r]))&&(n&&(n+=" "),n+=t)}else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function g(){for(var e,r,t=0,n="",a=arguments.length;t<a;t++)(e=arguments[t])&&(r=y(e))&&(n&&(n+=" "),n+=r);return n}var I=function(r){var t=r.children,l=r.item,i=r.level,o=void 0===i?0:i,d=r.className,s=void 0===d?"":d,f=u(r,["children","item","level","className"]),v=a(),b=n(!1),p=b[0],y=b[1];return e.createElement(e.Fragment,null,e.createElement(m.Item,null,e.createElement(h,c({className:g(s),onClick:function(){console.log("clicked",v),y(!p)},style:{display:"block",alignItems:"center",gap:"0.5rem"}},f),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",paddingLeft:"".concat(16*o,"px")}},e.createElement("div",null,p?"v":">"),e.createElement("div",null,t)))),p&&l.items&&e.createElement(e.Fragment,null,l.items.map((function(r){var t=o+1;return e.createElement(I,{level:t,key:r.label,item:r},r.label)}))))},E=function(){return console.warn("Direct usage of Tree is not supported. Please use Tree.Root and Tree.Item instead."),null};E.displayName="Tree",E.Root=function(r){var n=r.children,a=u(r,["children"]),l=t(null);return e.createElement(s.Provider,{value:{}},e.createElement(m.Root,{orientation:"vertical"},e.createElement(m.Group,null,e.createElement(f.div,c({},a,{ref:l}),n))))},E.Item=I;export{E as default};
1
+ 'use client';import e,{createContext as r,useRef as t,useState as n,useId as a,useEffect as l,forwardRef as i,useContext as o}from"react";var c=function(){return c=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var a in r=arguments[t])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},c.apply(this,arguments)};function u(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.indexOf(n)<0&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)r.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(t[n[a]]=e[n[a]])}return t}function d(e,r,t){if(t||2===arguments.length)for(var n,a=0,l=r.length;a<l;a++)!n&&a in r||(n||(n=Array.prototype.slice.call(r,0,a)),n[a]=r[a]);return e.concat(n||Array.prototype.slice.call(r))}"function"==typeof SuppressedError&&SuppressedError;var s=r({}),f=["div","span","button","input","a","img","p","h2"].reduce((function(r,t){return r[t]=function(r){var t=e.forwardRef((function(t,n){var a=t.asChild,l=void 0!==a&&a,i=t.children,o=u(t,["asChild","children"]);if(l){var d=e.Children.toArray(i);if(1!==d.length||!e.isValidElement(d[0]))return console.warn("Primitive.".concat(r,": asChild prop requires exactly one valid child element.")),e.createElement(r,c(c({},o),{ref:n}),i);var s=d[0];return e.cloneElement(s,c(c(c({},o),s.props),n?{ref:function(e){"function"==typeof n?n(e):n&&(n.current=e);var r=s.ref;"function"==typeof r?r(e):r&&(r.current=e)}}:{}))}return e.createElement(r,c(c({},o),{ref:n}),i)}));return t.displayName="Primitive.".concat(r),t}(t),r}),{}),v=r({orientation:"horizontal",loop:!0,disableTabIndexing:!1}),p=r({focusedItemId:null,setFocusedItemId:function(){},focusItems:[],setFocusItems:function(){},addFocusItem:function(){},groupRef:null}),b=i((function(r,t){var n,i=r.children,d=r["aria-label"],s=r["aria-labelledby"],b=r.role,m=void 0===b?"button":b,y=u(r,["children","aria-label","aria-labelledby","role"]),h=a(),g=o(p),I=g.focusedItemId,E=g.setFocusedItemId,x=g.addFocusItem,w=g.focusItems,O=g.groupRef,F=o(v),A=F.orientation,D=F.loop,P=F.disableTabIndexing,k=e.Children.toArray(i)[0],R=!0===(null===(n=null==k?void 0:k.props)||void 0===n?void 0:n.disabled),S=I===h,C=P||!R&&S?0:-1;l((function(){w.includes(h)||x(h)}),[w,I,h,x]);var T=function(e){if(O&&O.current){E(e);var r=CSS.escape(e),t=O.current.querySelector("#".concat(r));t&&t.focus()}},j=function(e,r){for(var t,n=e,a=0;a<w.length;a++){if(n+=r,D)n<0&&(n=w.length-1),n>=w.length&&(n=0);else if(n<0||n>=w.length)return-1;var l=w[n],i=null===(t=null==O?void 0:O.current)||void 0===t?void 0:t.querySelector("#".concat(CSS.escape(l)));if(i)if(!("true"===i.getAttribute("data-child-disabled")))return n}return-1},N=function(){var e=w.indexOf(h),r=j(e,-1);-1!==r&&T(w[r])},z=function(){var e=w.indexOf(h),r=j(e,1);-1!==r&&T(w[r])};return e.createElement(f.button,c({asChild:!0,onFocus:function(e){e.preventDefault(),R&&e.target.blur(),R||E(h)},tabIndex:C,ref:t,id:h,onKeyDown:function(e){if(!R)switch(e.key){case"ArrowUp":e.preventDefault(),"vertical"===A&&N();break;case"ArrowLeft":e.preventDefault(),"horizontal"===A&&N();break;case"ArrowDown":e.preventDefault(),"vertical"===A&&z();break;case"ArrowRight":e.preventDefault(),"horizontal"===A&&z();break;case"Home":e.preventDefault(),function(){if(w.length>0){var e=j(-1,1);-1!==e&&T(w[e])}}();break;case"End":e.preventDefault(),function(){if(w.length>0){var e=j(w.length,-1);-1!==e&&T(w[e])}}()}},"data-child-disabled":R,role:m,"aria-selected":S,"aria-disabled":R,"aria-label":d,"aria-labelledby":s},y),i)}));b.displayName="RovingFocusItem";var m={Root:function(r){var t=r.children,n=r.orientation,a=void 0===n?"horizontal":n,l=r.loop,i=void 0===l||l,o=r["aria-label"],d=r["aria-labelledby"],s=r.disableTabIndexing,p=void 0!==s&&s,b=u(r,["children","orientation","loop","aria-label","aria-labelledby","disableTabIndexing"]),m={orientation:a,loop:i,disableTabIndexing:p};return e.createElement(v.Provider,{value:m},e.createElement(f.div,c({role:"listbox","aria-orientation":a,"aria-label":o,"aria-labelledby":d},b),t))},Group:function(r){var i=r.children,o=r["aria-label"],s=r["aria-labelledby"],v=u(r,["children","aria-label","aria-labelledby"]),b=t(null),m=n([]),y=m[0],h=m[1],g=n(null),I=g[0],E=g[1],x=a();l((function(){!I&&y.length>0&&E(y[0])}),[y,I]);var w={focusedItemId:I,setFocusedItemId:E,focusItems:y,setFocusItems:h,addFocusItem:function(e){h((function(r){return d(d([],r,!0),[e],!1)}))},groupRef:b};return e.createElement(p.Provider,{value:w},e.createElement(f.div,c({id:x,ref:b,role:"group","aria-label":o,"aria-labelledby":s},v),i))},Item:b},y=i((function(r,t){var n=r.role,a=void 0===n?"button":n,l=r.label,i=void 0===l?"":l,o=r.description,d=void 0===o?"":o,s=r.disabled,v=void 0!==s&&s,p=r.children,b=u(r,["role","label","description","disabled","children"]);return i&&(b["aria-label"]=i),d&&(b["aria-description"]=d),v&&(b["aria-disabled"]="true",d||(b["aria-description"]="Disabled Button")),e.createElement(f.button,c({ref:t,role:a,disabled:v},b),p)}));function h(e){var r,t,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(r=0;r<a;r++)e[r]&&(t=h(e[r]))&&(n&&(n+=" "),n+=t)}else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function g(){for(var e,r,t=0,n="",a=arguments.length;t<a;t++)(e=arguments[t])&&(r=h(e))&&(n&&(n+=" "),n+=r);return n}y.displayName="ButtonPrimitive";var I=function(r){var t=r.children,l=r.item,i=r.level,o=void 0===i?0:i,d=r.className,s=void 0===d?"":d,f=u(r,["children","item","level","className"]),v=a(),p=n(!1),b=p[0],h=p[1];return e.createElement(e.Fragment,null,e.createElement(m.Item,null,e.createElement(y,c({className:g(s),onClick:function(){console.log("clicked",v),h(!b)},style:{display:"block",alignItems:"center",gap:"0.5rem"}},f),e.createElement("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem",paddingLeft:"".concat(16*o,"px")}},e.createElement("div",null,b?"v":">"),e.createElement("div",null,t)))),b&&l.items&&e.createElement(e.Fragment,null,l.items.map((function(r){var t=o+1;return e.createElement(I,{level:t,key:r.label,item:r},r.label)}))))},E=function(){return console.warn("Direct usage of Tree is not supported. Please use Tree.Root and Tree.Item instead."),null};E.displayName="Tree",E.Root=function(r){var n=r.children,a=u(r,["children"]),l=t(null);return e.createElement(s.Provider,{value:{}},e.createElement(m.Root,{orientation:"vertical"},e.createElement(m.Group,null,e.createElement(f.div,c({},a,{ref:l}),n))))},E.Item=I;export{E as default};