@radui/ui 0.0.37 → 0.0.38

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.
@@ -1 +1 @@
1
- 'use client';import e,{createContext as r,useRef as t,useState as n,useId as o,useEffect as a,forwardRef as l,useContext as i}from"react";var c=function(){return c=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);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 o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)r.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]])}return t}function d(e,r,t){if(t||2===arguments.length)for(var n,o=0,a=r.length;o<a;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return e.concat(n||Array.prototype.slice.call(r))}function f(e){var r,t,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(r=0;r<o;r++)e[r]&&(t=f(e[r]))&&(n&&(n+=" "),n+=t)}else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function s(){for(var e,r,t=0,n="",o=arguments.length;t<o;t++)(e=arguments[t])&&(r=f(e))&&(n&&(n+=" "),n+=r);return n}"function"==typeof SuppressedError&&SuppressedError;var v=["div","span","button","input"].reduce((function(r,t){return r[t]=function(r){var t=e.forwardRef((function(t,n){var o=t.asChild,a=void 0!==o&&o,l=t.children,i=u(t,["asChild","children"]);if(a){var d=e.Children.toArray(l);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({},i),{ref:n}),l);var f=d[0];return e.cloneElement(f,c(c(c({},i),f.props),n?{ref:function(e){"function"==typeof n?n(e):n&&(n.current=e);var r=f.ref;"function"==typeof r?r(e):r&&(r.current=e)}}:{}))}return e.createElement(r,c(c({},i),{ref:n}),l)}));return t.displayName="Primitive.".concat(r),t}(t),r}),{}),p=r({orientation:"horizontal",loop:!0}),b=r({focusedItemId:null,setFocusedItemId:function(){},focusItems:[],setFocusItems:function(){},addFocusItem:function(){},groupRef:null}),m=l((function(r,t){var n,l=r.children,d=r["aria-label"],f=r["aria-labelledby"],s=u(r,["children","aria-label","aria-labelledby"]),m=o(),y=i(b),h=y.focusedItemId,g=y.setFocusedItemId,I=y.addFocusItem,E=y.focusItems,w=y.groupRef,A=i(p),C=A.orientation,P=A.loop,O=e.Children.toArray(l)[0],k=!0===(null===(n=null==O?void 0:O.props)||void 0===n?void 0:n.disabled),D=h===m;a((function(){E.includes(m)||I(m)}),[E,h,m,I]);var F=function(e){if(w&&w.current){g(e);var r=CSS.escape(e),t=w.current.querySelector("#".concat(r));t&&t.focus()}},R=function(e,r){for(var t,n=e,o=0;o<E.length;o++){if(n+=r,P)n<0&&(n=E.length-1),n>=E.length&&(n=0);else if(n<0||n>=E.length)return-1;var a=E[n],l=null===(t=null==w?void 0:w.current)||void 0===t?void 0:t.querySelector("#".concat(CSS.escape(a)));if(l)if(!("true"===l.getAttribute("data-child-disabled")))return n}return-1},S=function(){var e=E.indexOf(m),r=R(e,-1);-1!==r&&F(E[r])},x=function(){var e=E.indexOf(m),r=R(e,1);-1!==r&&F(E[r])};return e.createElement(v.button,c({asChild:!0,onFocus:function(e){e.preventDefault(),k||g(m)},tabIndex:!k&&D?0:-1,ref:t,id:m,onKeyDown:function(e){if(!k)switch(e.key){case"ArrowUp":e.preventDefault(),"vertical"===C&&S();break;case"ArrowLeft":e.preventDefault(),"horizontal"===C&&S();break;case"ArrowDown":e.preventDefault(),"vertical"===C&&x();break;case"ArrowRight":e.preventDefault(),"horizontal"===C&&x();break;case"Home":e.preventDefault(),function(){if(E.length>0){var e=R(-1,1);-1!==e&&F(E[e])}}();break;case"End":e.preventDefault(),function(){if(E.length>0){var e=R(E.length,-1);-1!==e&&F(E[e])}}()}},"data-child-disabled":k,role:"option","aria-selected":D,"aria-disabled":k,"aria-label":d,"aria-labelledby":f},s),l)}));m.displayName="RovingFocusItem";var y={Root:function(r){var t=r.children,n=r.orientation,o=void 0===n?"horizontal":n,a=r.loop,l=void 0===a||a,i=r["aria-label"],d=r["aria-labelledby"],f=u(r,["children","orientation","loop","aria-label","aria-labelledby"]),s={orientation:o,loop:l};return e.createElement(p.Provider,{value:s},e.createElement(v.div,c({role:"listbox","aria-orientation":o,"aria-label":i,"aria-labelledby":d},f),t))},Group:function(r){var l=r.children,i=r["aria-label"],f=r["aria-labelledby"],s=u(r,["children","aria-label","aria-labelledby"]),p=t(null),m=n([]),y=m[0],h=m[1],g=n(null),I=g[0],E=g[1],w=o();a((function(){!I&&y.length>0&&E(y[0])}),[y,I]);var A={focusedItemId:I,setFocusedItemId:E,focusItems:y,setFocusItems:h,addFocusItem:function(e){h((function(r){return d(d([],r,!0),[e],!1)}))},groupRef:p};return e.createElement(b.Provider,{value:A},e.createElement(v.div,c({id:w,ref:p,role:"group","aria-label":i,"aria-labelledby":f},s),l))},Item:m},h=r({type:"single",activeToggles:[],setActiveToggles:function(){}}),g=function(r){var t=r.type,o=void 0===t?"multiple":t,a=r.className,l=void 0===a?"":a,i=r.loop,u=void 0===i||i,d=r.orientation,f=void 0===d?"horizontal":d,v=r.customRootClass,p=void 0===v?"":v,b=r.componentName,m=void 0===b?"":b,g=r.value,I=void 0===g?null:g,E=r.color,w=void 0===E?"":E,A=r.children,C=function(e,r){if(void 0===e&&(e=""),void 0===r&&(r=""),e)return e;if(!r)return"";var t=r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return"".concat("rad-ui","-").concat(t)}(p,m),P=n(I||[]),O={activeToggles:P[0],setActiveToggles:P[1],type:o},k={};return w&&(k["data-accent-color"]=w),e.createElement(h.Provider,{value:O},e.createElement(y.Root,{loop:u,orientation:f},e.createElement(y.Group,c({className:s(C,l)},k),A)))},I=function(e,r,t){var n={}.checkForDefaultPrevented,o=void 0===n||n;return function(t){if("function"==typeof e&&e(t),!1===o||!t.defaultPrevented)return null==r?void 0:r(t)}},E=function(r){var t=r.children,o=r.label,a=void 0===o?"":o,l=r.defaultPressed,i=void 0!==l&&l,d=r.pressed,f=r.onPressedChange,s=void 0===f?function(){}:f,p=r.disabled,b=u(r,["children","label","defaultPressed","pressed","onPressedChange","disabled"]),m=n(i),y=m[0],h=m[1],g=void 0!==d,E=g?d:y,w=function(){if(!p){var e=!E;g||h(e),s(e)}},A=a?{"aria-label":a}:{};return A["aria-pressed"]=E?"true":"false",A["aria-disabled"]=p?"true":"false",e.createElement(v.button,c({onClick:I(b.onClick,w),onKeyDown:I(b.onKeyDown,(function(e){" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),w())})),"data-state":E?"on":"off",disabled:p},A,b),t)},w=function(r){var t=r.children,n=r.value,o=void 0===n?null:n,a=u(r,["children","value"]),l=i(h),f=l.type,s=l.activeToggles,v=l.setActiveToggles,p=null==s?void 0:s.includes(o),b={},m={};return p?(b["aria-pressed"]="true",m["data-active"]="true"):(b["aria-pressed"]="false",m["data-active"]="false"),e.createElement(y.Item,null,e.createElement(E,c({onClick:function(){var e=s||[];if("single"===f)return p?void v([]):void v([o]);"multiple"===f&&(e=p?e.filter((function(e){return e!==o})):d(d([],e,!0),[o],!1)),v(e)}},b,m,a),t))},A="ToggleGroup",C=function(r){var t=r.type,n=void 0===t?"single":t,o=r.items,a=void 0===o?[]:o,l=r.color,i=void 0===l?"":l;return e.createElement(g,{type:n,componentName:A,color:i},a.map((function(r,t){return e.createElement(w,{key:t,value:r.value},r.label)})))};C.displayName=A,C.Root=g,C.Item=w;export{C as default};
1
+ 'use client';import e,{createContext as r,useRef as t,useState as n,useId as a,useEffect as o,forwardRef as i,useContext as l}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,o=r.length;a<o;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 s(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=s(e[r]))&&(n&&(n+=" "),n+=t)}else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function f(){for(var e,r,t=0,n="",a=arguments.length;t<a;t++)(e=arguments[t])&&(r=s(e))&&(n&&(n+=" "),n+=r);return n}"function"==typeof SuppressedError&&SuppressedError;var v=["div","span","button","input","a"].reduce((function(r,t){return r[t]=function(r){var t=e.forwardRef((function(t,n){var a=t.asChild,o=void 0!==a&&a,i=t.children,l=u(t,["asChild","children"]);if(o){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({},l),{ref:n}),i);var s=d[0];return e.cloneElement(s,c(c(c({},l),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({},l),{ref:n}),i)}));return t.displayName="Primitive.".concat(r),t}(t),r}),{}),p=r({orientation:"horizontal",loop:!0,disableTabIndexing:!1}),b=r({focusedItemId:null,setFocusedItemId:function(){},focusItems:[],setFocusItems:function(){},addFocusItem:function(){},groupRef:null}),m=i((function(r,t){var n,i=r.children,d=r["aria-label"],s=r["aria-labelledby"],f=u(r,["children","aria-label","aria-labelledby"]),m=a(),y=l(b),g=y.focusedItemId,h=y.setFocusedItemId,I=y.addFocusItem,E=y.focusItems,w=y.groupRef,A=l(p),C=A.orientation,P=A.loop,O=A.disableTabIndexing,k=e.Children.toArray(i)[0],x=!0===(null===(n=null==k?void 0:k.props)||void 0===n?void 0:n.disabled),D=g===m,T=O||!x&&D?0:-1;o((function(){E.includes(m)||I(m)}),[E,g,m,I]);var F=function(e){if(w&&w.current){h(e);var r=CSS.escape(e),t=w.current.querySelector("#".concat(r));t&&t.focus()}},R=function(e,r){for(var t,n=e,a=0;a<E.length;a++){if(n+=r,P)n<0&&(n=E.length-1),n>=E.length&&(n=0);else if(n<0||n>=E.length)return-1;var o=E[n],i=null===(t=null==w?void 0:w.current)||void 0===t?void 0:t.querySelector("#".concat(CSS.escape(o)));if(i)if(!("true"===i.getAttribute("data-child-disabled")))return n}return-1},S=function(){var e=E.indexOf(m),r=R(e,-1);-1!==r&&F(E[r])},j=function(){var e=E.indexOf(m),r=R(e,1);-1!==r&&F(E[r])};return e.createElement(v.button,c({asChild:!0,onFocus:function(e){e.preventDefault(),x||h(m)},tabIndex:T,ref:t,id:m,onKeyDown:function(e){if(!x)switch(e.key){case"ArrowUp":e.preventDefault(),"vertical"===C&&S();break;case"ArrowLeft":e.preventDefault(),"horizontal"===C&&S();break;case"ArrowDown":e.preventDefault(),"vertical"===C&&j();break;case"ArrowRight":e.preventDefault(),"horizontal"===C&&j();break;case"Home":e.preventDefault(),function(){if(E.length>0){var e=R(-1,1);-1!==e&&F(E[e])}}();break;case"End":e.preventDefault(),function(){if(E.length>0){var e=R(E.length,-1);-1!==e&&F(E[e])}}()}},"data-child-disabled":x,role:"option","aria-selected":D,"aria-disabled":x,"aria-label":d,"aria-labelledby":s},f),i)}));m.displayName="RovingFocusItem";var y={Root:function(r){var t=r.children,n=r.orientation,a=void 0===n?"horizontal":n,o=r.loop,i=void 0===o||o,l=r["aria-label"],d=r["aria-labelledby"],s=r.disableTabIndexing,f=void 0!==s&&s,b=u(r,["children","orientation","loop","aria-label","aria-labelledby","disableTabIndexing"]),m={orientation:a,loop:i,disableTabIndexing:f};return e.createElement(p.Provider,{value:m},e.createElement(v.div,c({role:"listbox","aria-orientation":a,"aria-label":l,"aria-labelledby":d},b),t))},Group:function(r){var i=r.children,l=r["aria-label"],s=r["aria-labelledby"],f=u(r,["children","aria-label","aria-labelledby"]),p=t(null),m=n([]),y=m[0],g=m[1],h=n(null),I=h[0],E=h[1],w=a();o((function(){!I&&y.length>0&&E(y[0])}),[y,I]);var A={focusedItemId:I,setFocusedItemId:E,focusItems:y,setFocusItems:g,addFocusItem:function(e){g((function(r){return d(d([],r,!0),[e],!1)}))},groupRef:p};return e.createElement(b.Provider,{value:A},e.createElement(v.div,c({id:w,ref:p,role:"group","aria-label":l,"aria-labelledby":s},f),i))},Item:m},g=r({type:"single",activeToggles:[],setActiveToggles:function(){}}),h=function(r){var t=r.type,a=void 0===t?"multiple":t,o=r.className,i=void 0===o?"":o,l=r.loop,u=void 0===l||l,d=r.orientation,s=void 0===d?"horizontal":d,v=r.customRootClass,p=void 0===v?"":v,b=r.componentName,m=void 0===b?"":b,h=r.value,I=void 0===h?null:h,E=r.color,w=void 0===E?"":E,A=r.children,C=function(e,r){if(void 0===e&&(e=""),void 0===r&&(r=""),e)return e;if(!r)return"";var t=r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return"".concat("rad-ui","-").concat(t)}(p,m),P=n(I||[]),O={activeToggles:P[0],setActiveToggles:P[1],type:a},k={};return w&&(k["data-rad-ui-accent-color"]=w),e.createElement(g.Provider,{value:O},e.createElement(y.Root,{loop:u,orientation:s},e.createElement(y.Group,c({className:f(C,i)},k),A)))},I=function(e,r,t){var n={}.checkForDefaultPrevented,a=void 0===n||n;return function(t){if("function"==typeof e&&e(t),!1===a||!t.defaultPrevented)return null==r?void 0:r(t)}},E=function(r){var t=r.children,a=r.label,o=void 0===a?"":a,i=r.defaultPressed,l=void 0!==i&&i,d=r.pressed,s=r.onPressedChange,f=void 0===s?function(){}:s,p=r.disabled,b=u(r,["children","label","defaultPressed","pressed","onPressedChange","disabled"]),m=n(l),y=m[0],g=m[1],h=void 0!==d,E=h?d:y,w=function(){if(!p){var e=!E;h||g(e),f(e)}},A=o?{"aria-label":o}:{};return A["aria-pressed"]=E?"true":"false",A["aria-disabled"]=p?"true":"false",e.createElement(v.button,c({onClick:I(b.onClick,w),onKeyDown:I(b.onKeyDown,(function(e){" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),w())})),"data-state":E?"on":"off",disabled:p},A,b),t)},w=function(r){var t=r.children,n=r.value,a=void 0===n?null:n,o=u(r,["children","value"]),i=l(g),s=i.type,f=i.activeToggles,v=i.setActiveToggles,p=null==f?void 0:f.includes(a),b={},m={};return p?(b["aria-pressed"]="true",m["data-active"]="true"):(b["aria-pressed"]="false",m["data-active"]="false"),e.createElement(y.Item,null,e.createElement(E,c({onClick:function(){var e=f||[];if("single"===s)return p?void v([]):void v([a]);"multiple"===s&&(e=p?e.filter((function(e){return e!==a})):d(d([],e,!0),[a],!1)),v(e)}},b,m,o),t))},A="ToggleGroup",C=function(r){var t=r.type,n=void 0===t?"single":t,a=r.items,o=void 0===a?[]:a,i=r.color,l=void 0===i?"":i;return e.createElement(h,{type:n,componentName:A,color:l},o.map((function(r,t){return e.createElement(w,{key:t,value:r.value},r.label)})))};C.displayName=A,C.Root=h,C.Item=w;export{C as default};
@@ -2,4 +2,4 @@
2
2
  /*!
3
3
  * tabbable 6.2.0
4
4
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
5
- */var ue=["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(","),ae="undefined"==typeof Element,se=ae?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,fe=!ae&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},de=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)},pe=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var l=i.shift();if(!de(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{se.call(l,ue)&&r.filter(l)&&(n||!t.includes(l))&&o.push(l);var a=l.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(l),s=!de(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},me=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},ve=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))&&!me(e)?0:e.tabIndex},he=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},ge=function(e){return"INPUT"===e.tagName},ye=function(e){return function(e){return ge(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||fe(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)},we=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},be=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=se.call(e,"details>summary:first-of-type")?e.parentElement:e;if(se.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return we(e)}else{if("function"==typeof r){for(var i=e;e;){var l=e.parentElement,c=fe(e);if(l&&!l.shadowRoot&&!0===r(l))return we(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&&fe(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=fe(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},xe=function(e,t){return!(t.disabled||de(t)||function(e){return ge(e)&&"hidden"===e.type}(t)||be(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!!se.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Ee=function(e,t){return!(ye(t)||ve(t)<0||!xe(e,t))},Re=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ce=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=ve(e);return n<0&&t&&!me(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(he).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},Te=function(e,t){var n;return n=(t=t||{}).getShadowRoot?pe([e],t.includeContainer,{filter:Ee.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Re}):function(e,t,n){if(de(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ue));return t&&se.call(e,ue)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,Ee.bind(null,t)),Ce(n)};function Se(e,t,n){let{reference:r,floating:o}=e;const i=ne(t),l=re(t),c=te(l),u=Z(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(J(t)){case"start":p[l]-=d*(n&&a?-1:1);break;case"end":p[l]+=d*(n&&a?-1:1)}return p}async function Le(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}=Q(t,e),m=le(p),v=c[d?"floating"===f?"reference":"floating":f],h=ce(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)),w=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},b=ce(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,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 Pe(e){const t=L(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=w(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,c=Y(n)!==i||Y(r)!==l;return c&&(n=i,r=l),{width:n,height:r,$:c}}function Oe(e){return y(e)?e:e.contextElement}function Ae(e){const t=Oe(e);if(!w(t))return q(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Pe(t);let l=(i?Y(n.width):n.width)/r,c=(i?Y(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const ke=q(0);function Me(e){const t=v(e);return T()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ke}function De(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=Oe(e);let l=q(1);t&&(r?y(r)&&(l=Ae(r)):l=Ae(e));const c=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==v(e))&&t}(i,n,r)?Me(i):q(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=v(i),t=r&&y(r)?v(r):r;let n=e,o=M(n);for(;o&&r&&t!==n;){const e=Ae(o),t=o.getBoundingClientRect(),r=L(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=v(o),o=M(n)}}return ce({width:s,height:f,x:u,y:a})}function Ne(e,t){const n=P(e).scrollLeft;return t?t.left+n:De(h(e)).left+n}function Ie(e,t,n){void 0===n&&(n=!1);const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:Ne(e,r)),y:r.top+t.scrollTop}}function Fe(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=v(e),r=h(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=T();(!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=h(e),n=P(e),r=e.ownerDocument.body,o=X(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=X(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Ne(e);const c=-n.scrollTop;return"rtl"===L(r).direction&&(l+=X(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:c}}(h(e));else if(y(t))r=function(e,t){const n=De(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=w(e)?Ae(e):q(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=Me(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ce(r)}function je(e,t){const n=O(e);return!(n===t||!y(n)||S(n))&&("fixed"===L(n).position||je(n,t))}function Be(e,t,n){const r=w(t),o=h(t),i="fixed"===n,l=De(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const u=q(0);if(r||!r&&!i)if(("body"!==m(t)||x(o))&&(c=P(t)),r){const e=De(t,!0,i,t);u.x=e.x+t.clientLeft,u.y=e.y+t.clientTop}else o&&(u.x=Ne(o));const a=!o||r||i?q(0):Ie(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 We(e){return"static"===L(e).position}function Ve(e,t){if(!w(e)||"fixed"===L(e).position)return null;if(t)return t(e);let n=e.offsetParent;return h(e)===n&&(n=n.ownerDocument.body),n}function _e(e,t){const n=v(e);if(R(e))return n;if(!w(e)){let t=O(e);for(;t&&!S(t);){if(y(t)&&!We(t))return t;t=O(t)}return n}let r=Ve(e,t);for(;r&&E(r)&&We(r);)r=Ve(r,t);return r&&S(r)&&We(r)&&!C(r)?n:r||function(e){let t=O(e);for(;w(t)&&!S(t);){if(C(t))return t;if(R(t))return null;t=O(t)}return null}(e)||n}const He={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,l=h(r),c=!!t&&R(t.floating);if(r===l||c&&i)return n;let u={scrollLeft:0,scrollTop:0},a=q(1);const s=q(0),f=w(r);if((f||!f&&!i)&&(("body"!==m(r)||x(l))&&(u=P(r)),w(r))){const e=De(r);a=Ae(r),s.x=e.x+r.clientLeft,s.y=e.y+r.clientTop}const d=!l||f||i?q(0):Ie(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:h,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?R(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=k(e,[],!1).filter((e=>y(e)&&"body"!==m(e))),o=null;const i="fixed"===L(e).position;let l=i?O(e):e;for(;y(l)&&!S(l);){const t=L(l),n=C(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||x(l)&&!n&&je(e,l))?r=r.filter((e=>e!==l)):o=t,l=O(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],c=i.reduce(((e,n)=>{const r=Fe(t,n,o);return e.top=X(r.top,e.top),e.right=U(r.right,e.right),e.bottom=U(r.bottom,e.bottom),e.left=X(r.left,e.left),e}),Fe(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:_e,getElementRects:async function(e){const t=this.getOffsetParent||_e,n=this.getDimensions,r=await n(e.floating);return{reference:Be(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}=Pe(e);return{width:t,height:n}},getScale:Ae,isElement:y,isRTL:function(e){return"rtl"===L(e).direction}},Ke=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=Z(n),c=J(n),u="y"===ne(n),a=["left","top"].includes(l)?-1:1,s=i&&u?-1:1,f=Q(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}}}}},Ue=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}=Q(e,t),a={x:n,y:r},s=await Le(t,u),f=ne(Z(o)),d=ee(f);let p=a[d],m=a[f];if(i){const e="y"===d?"bottom":"right";p=G(p+s["y"===d?"top":"left"],p,p-s[e])}if(l){const e="y"===f?"bottom":"right";m=G(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}}}}}},Xe=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}=Q(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const g=Z(o),y=ne(c),w=Z(c)===c,b=await(null==u.isRTL?void 0:u.isRTL(a.floating)),x=d||(w||!v?[ie(c)]:function(e){const t=ie(e);return[oe(e),t,oe(t)]}(c)),E="none"!==m;!d&&E&&x.push(...function(e,t,n,r){const o=J(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[]}}(Z(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(oe)))),i}(c,v,m,b));const R=[c,...x],C=await Le(t,h),T=[];let S=(null==(r=i.flip)?void 0:r.overflows)||[];if(s&&T.push(C[g]),f){const e=function(e,t,n){void 0===n&&(n=!1);const r=J(e),o=re(e),i=te(o);let l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=ie(l)),[l,ie(l)]}(o,l,b);T.push(C[e[0]],C[e[1]])}if(S=[...S,{placement:o,overflows:T}],!T.every((e=>e<=0))){var L,P;const e=((null==(L=i.flip)?void 0:L.index)||0)+1,t=R[e];if(t)return{data:{index:e,overflows:S},reset:{placement:t}};let n=null==(P=S.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:P.placement;if(!n)switch(p){case"bestFit":{var O;const e=null==(O=S.filter((e=>{if(E){const t=ne(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:O[0];e&&(n=e);break}case"initialPlacement":n=c}if(o!==n)return{reset:{placement:n}}}return{}}}},Ye=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}=Q(e,t)||{};if(null==a)return{};const f=le(s),d={x:n,y:r},p=re(o),m=te(p),v=await l.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],x=d[p]-i.reference[p],E=await(null==l.getOffsetParent?void 0:l.getOffsetParent(a));let R=E?E[w]:0;R&&await(null==l.isElement?void 0:l.isElement(E))||(R=c.floating[w]||i.floating[m]);const C=b/2-x/2,T=R/2-v[m]/2-1,S=U(f[g],T),L=U(f[y],T),P=S,O=R-v[m]-L,A=R/2-v[m]/2+C,k=G(P,A,O),M=!u.arrow&&null!=J(o)&&A!==k&&i.reference[m]/2-(A<P?S:L)-v[m]/2<0,D=M?A<P?A-P:A-O:0;return{[p]:d[p]+D,data:{[p]:k,centerOffset:A-k-D,...M&&{alignmentOffset:D}},reset:M}}}),qe=(e,t,n)=>{const r=new Map,o={platform:He,...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}=Se(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:w}=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}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(a=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:s,y:f}=Se(a,d,u))),n=-1)}return{x:s,y:f,placement:d,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var $e="undefined"!=typeof document?r:o;function ze(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(!ze(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)&&!ze(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ge(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qe(e,t){const n=Ge(e);return Math.round(t*n)/n}function Ze(t){const n=e.useRef(t);return $e((()=>{n.current=t})),n}const Je=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?Ye({element:n.current,padding:r}).fn(t):{}:n?Ye({element:n,padding:r}).fn(t):{};var o}}),et=(e,t)=>({...Ke(e),options:[e,t]}),tt=(e,t)=>({...Ue(e),options:[e,t]}),nt=(e,t)=>({...Xe(e),options:[e,t]});function rt(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 ot={...e},it=ot.useInsertionEffect||(e=>e());function lt(t){const n=e.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return it((()=>{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 ct="undefined"!=typeof document?r:o;let ut=!1,at=0;const st=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+at++;const ft=ot.useId||function(){const[t,n]=e.useState((()=>ut?st():void 0));return ct((()=>{null==t&&n(st())}),[]),e.useEffect((()=>{ut=!0}),[]),t};let dt;"production"!==process.env.NODE_ENV&&(dt=new Set);const pt=e.forwardRef((function(t,n){const{context:{placement:r,elements:{floating:o},middlewareData:{arrow:i,shift:l}},width:c=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=dt)&&e.has(o)||(null==(i=dt)||i.add(o),console.warn(o))}("The `ref` prop is required for `FloatingArrow`."));const w=ft(),[b,x]=e.useState(!1);if(ct((()=>{if(!o)return;"rtl"===L(o).direction&&x(!0)}),[o]),!o)return null;const[E,R]=r.split("-"),C="top"===E||"bottom"===E;let T=p;(C&&null!=l&&l.x||!C&&null!=l&&l.y)&&(T=null);const S=2*d,P=S/2,O=c/2*(f/-8+1),A=u/2*f/4,k=!!v,M=T&&"end"===R?"bottom":"top";let D=T&&"end"===R?"right":"left";T&&b&&(D="end"===R?"left":"right");const N=null!=(null==i?void 0:i.x)?T||i.x:"",I=null!=(null==i?void 0:i.y)?T||i.y:"",F=v||"M0,0 H"+c+" L"+(c-O)+","+(u-A)+" Q"+c/2+","+u+" "+O+","+(u-A)+" Z",j={top:k?"rotate(180deg)":"",left:k?"rotate(90deg)":"rotate(-90deg)",bottom:k?"":"rotate(180deg)",right:k?"rotate(-90deg)":"rotate(90deg)"}[E];return a("svg",{...y,"aria-hidden":!0,ref:n,width:k?c:c+S,height:c,viewBox:"0 0 "+c+" "+(u>c?u:c),style:{position:"absolute",pointerEvents:"none",[D]:N,[M]:I,[E]:C||k?"100%":"calc(100% - "+S/2+"px)",transform:[j,h].filter((e=>!!e)).join(" "),...g},children:[S>0&&s("path",{clipPath:"url(#"+w+")",fill:"none",stroke:m,strokeWidth:S+(v?0:1),d:F}),s("path",{stroke:S&&!v?y.fill:"none",d:F}),s("clipPath",{id:w,children:s("rect",{x:-P,y:P*(k?-1:1),width:c+S,height:c})})]})}));const mt=e.createContext(null),vt=e.createContext(null),ht=()=>{var t;return(null==(t=e.useContext(mt))?void 0:t.id)||null},gt=()=>e.useContext(vt);function yt(e){return"data-floating-ui-"+e}function wt(e){const t=i(e);return ct((()=>{t.current=e})),t}const bt=yt("safe-polygon");function xt(e,t,n){return n&&!V(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}function Et(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}const Rt=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Ct(e,t){const n=Te(e,Rt());"prev"===t&&n.reverse();const r=n.indexOf(D(_(e)));return n.slice(r+1)[0]}function Tt(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!N(n,r)}function St(e){Te(e,Rt()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function Lt(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 Pt={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 Ot(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const At=e.forwardRef((function(t,n){const[r,o]=e.useState();ct((()=>(B()&&o("button"),document.addEventListener("keydown",Ot),()=>{document.removeEventListener("keydown",Ot)})),[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":!r||void 0,[yt("focus-guard")]:"",style:Pt};return s("span",{...t,...i})})),kt=e.createContext(null),Mt=yt("portal");function Dt(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=ft(),i=Nt(),[l,c]=e.useState(null),u=e.useRef(null);return ct((()=>()=>{null==l||l.remove(),queueMicrotask((()=>{u.current=null}))}),[l]),ct((()=>{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(Mt,""),e.appendChild(t),u.current=t,c(t)}),[n,o]),ct((()=>{if(null===r)return;if(!o)return;if(u.current)return;let e=r||(null==i?void 0:i.portalNode);e&&!y(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(Mt,""),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),d=e.useRef(null),p=e.useRef(null),m=e.useRef(null),v=e.useRef(null),h=null==c?void 0:c.modal,g=null==c?void 0:c.open,w=!!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&&Tt(e)){("focusin"===e.type?Lt:St)(l)}}}),[l,i,h]),e.useEffect((()=>{l&&(g||Lt(l))}),[g,l]),a(kt.Provider,{value:e.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:d,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:v,portalNode:l,setFocusManagerState:u})),[i,l]),children:[w&&l&&s(At,{"data-type":"outside",ref:d,onFocus:e=>{if(Tt(e,l)){var t;null==(t=m.current)||t.focus()}else{const e=Ct(document.body,"prev")||(null==c?void 0:c.domReference);null==e||e.focus()}}}),w&&l&&s("span",{"aria-owns":l.id,style:Pt}),l&&f.createPortal(n,l),w&&l&&s(At,{"data-type":"outside",ref:p,onFocus:e=>{if(Tt(e,l)){var t;null==(t=v.current)||t.focus()}else{const t=Ct(document.body,"next")||(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"))}}})]})}const Nt=()=>e.useContext(kt),It="data-floating-ui-focusable",Ft={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},jt={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Bt=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 Wt(t){const{open:n=!1,onOpenChange:r,elements:o}=t,i=ft(),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!=ht();if("production"!==process.env.NODE_ENV){const e=o.reference;e&&!y(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=dt)&&e.has(o)||(null==(i=dt)||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=lt(((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])}function Vt(t){void 0===t&&(t={});const{nodeId:n}=t,r=Wt({...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,d=e.useRef(null),p=gt();ct((()=>{s&&(d.current=s)}),[s]);const m=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,[d,p]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[m,v]=e.useState(o);ze(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))}),[]),x=e.useCallback((e=>{e!==T.current&&(T.current=e,w(e))}),[]),E=l||h,R=c||y,C=e.useRef(null),T=e.useRef(null),S=e.useRef(d),L=null!=a,P=Ze(a),O=Ze(i),A=Ze(s),k=e.useCallback((()=>{if(!C.current||!T.current)return;const e={placement:n,strategy:r,middleware:m};O.current&&(e.platform=O.current),qe(C.current,T.current,e).then((e=>{const t={...e,isPositioned:!1!==A.current};M.current&&!ze(S.current,t)&&(S.current=t,f.flushSync((()=>{p(t)})))}))}),[m,n,r,O,A]);$e((()=>{!1===s&&S.current.isPositioned&&(S.current.isPositioned=!1,p((e=>({...e,isPositioned:!1}))))}),[s]);const M=e.useRef(!1);$e((()=>(M.current=!0,()=>{M.current=!1})),[]),$e((()=>{if(E&&(C.current=E),R&&(T.current=R),E&&R){if(P.current)return P.current(E,R,k);k()}}),[E,R,k,P,L]);const D=e.useMemo((()=>({reference:C,floating:T,setReference:b,setFloating:x})),[b,x]),N=e.useMemo((()=>({reference:E,floating:R})),[E,R]),I=e.useMemo((()=>{const e={position:r,left:0,top:0};if(!N.floating)return e;const t=Qe(N.floating,d.x),n=Qe(N.floating,d.y);return u?{...e,transform:"translate("+t+"px, "+n+"px)",...Ge(N.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,u,N.floating,d.x,d.y]);return e.useMemo((()=>({...d,update:k,refs:D,elements:N,floatingStyles:I})),[d,k,D,N,I])}({...t,elements:{...i,...u&&{reference:u}}}),v=e.useCallback((e=>{const t=y(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;a(t),m.refs.setReference(t)}),[m.refs]),h=e.useCallback((e=>{(y(e)||null===e)&&(d.current=e,c(e)),(y(m.refs.reference.current)||null===m.refs.reference.current||null!==e&&!y(e))&&m.refs.setReference(e)}),[m.refs]),g=e.useMemo((()=>({...m.refs,setReference:h,setPositionReference:v,domReference:d})),[m.refs,h,v]),w=e.useMemo((()=>({...m.elements,domReference:s})),[m.elements,s]),b=e.useMemo((()=>({...m,...o,refs:g,elements:w,nodeId:n})),[m,g,w,n,o]);return ct((()=>{o.dataRef.current.floatingContext=b;const e=null==p?void 0:p.nodesRef.current.find((e=>e.id===n));e&&(e.context=b)})),e.useMemo((()=>({...m,context:b,refs:g,elements:w})),[m,g,w,b])}function _t(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=v(c.domReference);function t(){!r&&w(c.domReference)&&c.domReference===D(_(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){j(e.nativeEvent)||(d.current=!1)},onMouseLeave(){s.current=!1},onFocus(e){if(s.current)return;const t=K(e.nativeEvent);if(a&&y(t))try{if(B()&&I().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints)throw Error();if(!t.matches(":focus-visible"))return}catch(e){if(!d.current&&(!w(n=t)||!n.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")))return}var n;o(!0,e.nativeEvent,"focus")},onBlur(e){s.current=!1;const t=e.relatedTarget,n=e.nativeEvent,r=y(t)&&t.hasAttribute(yt("focus-guard"))&&"outside"===t.getAttribute("data-type");f.current=window.setTimeout((()=>{var e;const i=D(c.domReference?c.domReference.ownerDocument:document);(t||i!==c.domReference)&&(N(null==(e=l.current.floatingContext)?void 0:e.refs.floating.current,i)||N(c.domReference,i)||r||o(!1,n,"focus"))}))}})),[l,c.domReference,o,a]);return e.useMemo((()=>u?{reference:p}:{}),[u,p])}const Ht="active",Kt="selected";function Ut(e,t,n){const r=new Map,o="item"===n;let i=e;if(o&&e){const{[Ht]:t,[Kt]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1,[It]:""},...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&&[Ht,Kt].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 Xt=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);var Yt=function(n){var r,o,c=n.children,u=n.placement,a=void 0===u?"top":u,s=i(null),f=l(!1),p=f[0],m=f[1],v=Vt({placement:a,strategy:"fixed",onOpenChange:m,middleware:[(r={element:s,padding:4},{...Je(r),options:[r,o]}),et(5),nt({crossAxis:!0,fallbackAxisSideDirection:"start",padding:5}),tt({padding:5})]}),h=v.context,g=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=gt(),v=ht(),h=wt(s),g=wt(a),w=wt(r),b=e.useRef(),x=e.useRef(-1),E=e.useRef(),R=e.useRef(-1),C=e.useRef(!0),T=e.useRef(!1),S=e.useRef((()=>{})),L=e.useRef(!1),P=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(x.current),clearTimeout(R.current),C.current=!0,L.current=!1)}}),[u,l]),e.useEffect((()=>{if(!u)return;if(!h.current)return;if(!r)return;function e(e){P()&&o(!1,e,"hover")}const t=_(c.floating).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[c.floating,r,o,u,h,P]);const O=e.useCallback((function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const r=xt(g.current,"close",b.current);r&&!E.current?(clearTimeout(x.current),x.current=window.setTimeout((()=>o(!1,e,n)),r)):t&&(clearTimeout(x.current),o(!1,e,n))}),[g,o]),A=lt((()=>{S.current(),E.current=void 0})),k=lt((()=>{if(T.current){const e=_(c.floating).body;e.style.pointerEvents="",e.removeAttribute(bt),T.current=!1}})),M=lt((()=>!!i.current.openEvent&&["click","mousedown"].includes(i.current.openEvent.type)));e.useEffect((()=>{if(u&&y(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(x.current),C.current=!1,f&&!V(b.current)||d>0&&!xt(g.current,"open"))return;const t=xt(g.current,"open",b.current);t?x.current=window.setTimeout((()=>{w.current||o(!0,e,"hover")}),t):r||o(!0,e,"hover")}function n(e){if(M())return;S.current();const t=_(c.floating);if(clearTimeout(R.current),L.current=!1,h.current&&i.current.floatingContext){r||clearTimeout(x.current),E.current=h.current({...i.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){k(),A(),M()||O(e,!0,"safe-polygon")}});const n=E.current;return t.addEventListener("mousemove",n),void(S.current=()=>{t.removeEventListener("mousemove",n)})}("touch"!==b.current||!N(c.floating,e.relatedTarget))&&O(e)}function l(e){M()||i.current.floatingContext&&(null==h.current||h.current({...i.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){k(),A(),M()||O(e)}})(e))}}),[c,u,t,f,d,p,O,A,k,o,r,w,m,g,h,i,M]),ct((()=>{var e;if(u&&r&&null!=(e=h.current)&&e.__options.blockPointerEvents&&P()){T.current=!0;const e=c.floating;if(y(c.domReference)&&e){var t;const n=_(c.floating).body;n.setAttribute(bt,"");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,P]),ct((()=>{r||(b.current=void 0,L.current=!1,A(),k())}),[r,A,k]),e.useEffect((()=>()=>{A(),clearTimeout(x.current),clearTimeout(R.current),k()}),[u,c.domReference,A,k]);const D=e.useMemo((()=>{function e(e){b.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){const{nativeEvent:t}=e;function n(){C.current||w.current||o(!0,t,"hover")}f&&!V(b.current)||r||0===d||L.current&&e.movementX**2+e.movementY**2<2||(clearTimeout(R.current),"touch"===b.current?n():(L.current=!0,R.current=window.setTimeout(n,d)))}}}),[f,o,r,w,d]),I=e.useMemo((()=>({onMouseEnter(){clearTimeout(x.current)},onMouseLeave(e){M()||O(e.nativeEvent,!1)}})),[O,M]);return e.useMemo((()=>u?{reference:D,floating:I}:{}),[u,D,I])}(h,{move:!1}),b=_t(h,{}),x=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=gt(),g=lt("function"==typeof a?a:()=>!1),b="function"==typeof a?g:a,x=e.useRef(!1),E=e.useRef(!1),{escapeKey:R,outsidePress:C}=Bt(m),{escapeKey:P,outsidePress:A}=Bt(v),M=e.useRef(!1),D=lt((e=>{var t;if(!r||!c||!u||"Escape"!==e.key)return;if(M.current)return;const n=null==(t=l.current.floatingContext)?void 0:t.nodeId,i=h?Et(h.nodesRef.current,n):[];if(!R&&(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")})),I=lt((e=>{var t;const n=()=>{var t;D(e),null==(t=K(e))||t.removeEventListener("keydown",n)};null==(t=K(e))||t.addEventListener("keydown",n)})),F=lt((e=>{var t;const n=x.current;x.current=!1;const r=E.current;if(E.current=!1,"click"===s&&r)return;if(n)return;if("function"==typeof b&&!b(e))return;const c=K(e),u="["+yt("inert")+"]",a=_(i.floating).querySelectorAll(u);let f=y(c)?c:null;for(;f&&!S(f);){const e=O(f);if(S(e)||!y(e))break;f=e}if(a.length&&y(c)&&!c.matches("html,body")&&!N(c,i.floating)&&Array.from(a).every((e=>!N(f,e))))return;if(w(c)&&W){const t=S(c),n=L(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&&Et(h.nodesRef.current,d).some((t=>{var n;return H(e,null==(n=t.context)?void 0:n.elements.floating)}));if(H(e,i.floating)||H(e,i.domReference)||p)return;const m=h?Et(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")})),j=lt((e=>{var t;const n=()=>{var t;F(e),null==(t=K(e))||t.removeEventListener(s,n)};null==(t=K(e))||t.addEventListener(s,n)}));e.useEffect((()=>{if(!r||!c)return;l.current.__escapeKeyBubbles=R,l.current.__outsidePressBubbles=C;let e=-1;function t(e){o(!1,e,"ancestor-scroll")}function n(){window.clearTimeout(e),M.current=!0}function a(){e=window.setTimeout((()=>{M.current=!1}),T()?5:0)}const f=_(i.floating);u&&(f.addEventListener("keydown",P?I:D,P),f.addEventListener("compositionstart",n),f.addEventListener("compositionend",a)),b&&f.addEventListener(s,A?j:F,A);let d=[];return p&&(y(i.domReference)&&(d=k(i.domReference)),y(i.floating)&&(d=d.concat(k(i.floating))),!y(i.reference)&&i.reference&&i.reference.contextElement&&(d=d.concat(k(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",P?I:D,P),f.removeEventListener("compositionstart",n),f.removeEventListener("compositionend",a)),b&&f.removeEventListener(s,A?j:F,A),d.forEach((e=>{e.removeEventListener("scroll",t)})),window.clearTimeout(e)}}),[l,i,u,b,s,r,o,p,c,R,C,D,P,I,F,A,j]),e.useEffect((()=>{x.current=!1}),[b,s]);const B=e.useMemo((()=>({onKeyDown:D,...f&&{[Ft[d]]:e=>{o(!1,e.nativeEvent,"reference-press")},..."click"!==d&&{onClick(e){o(!1,e.nativeEvent,"reference-press")}}}})),[D,o,f,d]),W=e.useMemo((()=>({onKeyDown:D,onMouseDown(){E.current=!0},onMouseUp(){E.current=!0},[jt[s]]:()=>{x.current=!0}})),[D,s]);return e.useMemo((()=>c?{reference:B,floating:W}:{}),[c,B,W])}(h),E=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=Xt.get(c))?r:c,a=ft(),s=null!=ht(),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])}(h,{role:"tooltip"}),R=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=>Ut(e,t,"reference")),n),l=e.useCallback((e=>Ut(e,t,"floating")),r),c=e.useCallback((e=>Ut(e,t,"item")),o);return e.useMemo((()=>({getReferenceProps:i,getFloatingProps:l,getItemProps:c})),[i,l,c])}([g,b,x,E]);return t.createElement(d.Provider,{value:{isOpen:p,setIsOpen:m,data:v,interactions:R,context:h,arrowRef:s}},c)};Yt.displayName="Tooltip";var qt=function(){return qt=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},qt.apply(this,arguments)};function $t(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 zt=["div","span","button","input"].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=$t(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,qt(qt({},c),{ref:r}),l);var a=u[0];return t.cloneElement(a,qt(qt(qt({},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,qt(qt({},c),{ref:r}),l)}));return n.displayName="Primitive.".concat(e),n}(n),e}),{}),Gt=c((function(e,n){var r=e.children,o=e.asChild,i=$t(e,["children","asChild"]),l=u(d);if(!l)throw new Error("TooltipTrigger must be used within a TooltipRoot component");l.setIsOpen;var c=l.isOpen,a=l.interactions;l.data;var s=l.context,f=a.getReferenceProps,p=r.ref,m=rt([s.refs.setReference,n,p]);return t.createElement(zt.button,qt({asChild:o,ref:m,"data-state":c?"open":"closed"},f(i)),r)}));function Qt(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=Qt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Zt(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Qt(e))&&(r&&(r+=" "),r+=t);return r}Gt.displayName="TooltipTrigger";var Jt=c((function(e,n){var r=e.children,o=e.showArrow,i=void 0===o||o,l=$t(e,["children","showArrow"]),c=u(d);if(!c)throw new Error("TooltipContent must be used within a TooltipRoot component");var a=c.isOpen,s=c.data,f=c.interactions,p=c.context,m=c.arrowRef,v=rt([p.refs.setFloating,n]);if(!a)return null;var h=f.getFloatingProps;return t.createElement(Dt,null,t.createElement(zt.div,qt({className:"rad-ui-tooltip-floating-element",ref:v,style:qt({},s.floatingStyles)},h(l)),i&&t.createElement(pt,{className:Zt("rad-ui-arrow rad-ui-arrow"),ref:m,context:p}),r))}));Jt.displayName="TooltipContent";var en=function(){return console.warn("Direct usage of Tabs is not supported. Please use Tabs.Root, Tabs.List, etc. instead."),null};en.Root=Yt,en.Trigger=Gt,en.Content=Jt;export{en as default};
5
+ */var ue=["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(","),ae="undefined"==typeof Element,se=ae?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,fe=!ae&&Element.prototype.getRootNode?function(e){var t;return null==e||null===(t=e.getRootNode)||void 0===t?void 0:t.call(e)}:function(e){return null==e?void 0:e.ownerDocument},de=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)},pe=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var l=i.shift();if(!de(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{se.call(l,ue)&&r.filter(l)&&(n||!t.includes(l))&&o.push(l);var a=l.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(l),s=!de(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},me=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},ve=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))&&!me(e)?0:e.tabIndex},he=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},ge=function(e){return"INPUT"===e.tagName},ye=function(e){return function(e){return ge(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||fe(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)},we=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},be=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=se.call(e,"details>summary:first-of-type")?e.parentElement:e;if(se.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return we(e)}else{if("function"==typeof r){for(var i=e;e;){var l=e.parentElement,c=fe(e);if(l&&!l.shadowRoot&&!0===r(l))return we(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&&fe(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=fe(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},xe=function(e,t){return!(t.disabled||de(t)||function(e){return ge(e)&&"hidden"===e.type}(t)||be(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!!se.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Ee=function(e,t){return!(ye(t)||ve(t)<0||!xe(e,t))},Re=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ce=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=ve(e);return n<0&&t&&!me(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(he).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},Te=function(e,t){var n;return n=(t=t||{}).getShadowRoot?pe([e],t.includeContainer,{filter:Ee.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Re}):function(e,t,n){if(de(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(ue));return t&&se.call(e,ue)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,Ee.bind(null,t)),Ce(n)};function Se(e,t,n){let{reference:r,floating:o}=e;const i=ne(t),l=re(t),c=te(l),u=Z(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(J(t)){case"start":p[l]-=d*(n&&a?-1:1);break;case"end":p[l]+=d*(n&&a?-1:1)}return p}async function Le(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}=Q(t,e),m=le(p),v=c[d?"floating"===f?"reference":"floating":f],h=ce(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)),w=await(null==i.isElement?void 0:i.isElement(y))&&await(null==i.getScale?void 0:i.getScale(y))||{x:1,y:1},b=ce(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,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 Pe(e){const t=L(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=w(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,c=Y(n)!==i||Y(r)!==l;return c&&(n=i,r=l),{width:n,height:r,$:c}}function Oe(e){return y(e)?e:e.contextElement}function Ae(e){const t=Oe(e);if(!w(t))return q(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Pe(t);let l=(i?Y(n.width):n.width)/r,c=(i?Y(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),c&&Number.isFinite(c)||(c=1),{x:l,y:c}}const ke=q(0);function Me(e){const t=v(e);return T()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ke}function De(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=Oe(e);let l=q(1);t&&(r?y(r)&&(l=Ae(r)):l=Ae(e));const c=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==v(e))&&t}(i,n,r)?Me(i):q(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=v(i),t=r&&y(r)?v(r):r;let n=e,o=M(n);for(;o&&r&&t!==n;){const e=Ae(o),t=o.getBoundingClientRect(),r=L(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=v(o),o=M(n)}}return ce({width:s,height:f,x:u,y:a})}function Ne(e,t){const n=P(e).scrollLeft;return t?t.left+n:De(h(e)).left+n}function Ie(e,t,n){void 0===n&&(n=!1);const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:Ne(e,r)),y:r.top+t.scrollTop}}function Fe(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=v(e),r=h(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=T();(!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=h(e),n=P(e),r=e.ownerDocument.body,o=X(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=X(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Ne(e);const c=-n.scrollTop;return"rtl"===L(r).direction&&(l+=X(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:c}}(h(e));else if(y(t))r=function(e,t){const n=De(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=w(e)?Ae(e):q(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=Me(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ce(r)}function je(e,t){const n=O(e);return!(n===t||!y(n)||S(n))&&("fixed"===L(n).position||je(n,t))}function Be(e,t,n){const r=w(t),o=h(t),i="fixed"===n,l=De(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const u=q(0);if(r||!r&&!i)if(("body"!==m(t)||x(o))&&(c=P(t)),r){const e=De(t,!0,i,t);u.x=e.x+t.clientLeft,u.y=e.y+t.clientTop}else o&&(u.x=Ne(o));const a=!o||r||i?q(0):Ie(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 We(e){return"static"===L(e).position}function Ve(e,t){if(!w(e)||"fixed"===L(e).position)return null;if(t)return t(e);let n=e.offsetParent;return h(e)===n&&(n=n.ownerDocument.body),n}function _e(e,t){const n=v(e);if(R(e))return n;if(!w(e)){let t=O(e);for(;t&&!S(t);){if(y(t)&&!We(t))return t;t=O(t)}return n}let r=Ve(e,t);for(;r&&E(r)&&We(r);)r=Ve(r,t);return r&&S(r)&&We(r)&&!C(r)?n:r||function(e){let t=O(e);for(;w(t)&&!S(t);){if(C(t))return t;if(R(t))return null;t=O(t)}return null}(e)||n}const He={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,l=h(r),c=!!t&&R(t.floating);if(r===l||c&&i)return n;let u={scrollLeft:0,scrollTop:0},a=q(1);const s=q(0),f=w(r);if((f||!f&&!i)&&(("body"!==m(r)||x(l))&&(u=P(r)),w(r))){const e=De(r);a=Ae(r),s.x=e.x+r.clientLeft,s.y=e.y+r.clientTop}const d=!l||f||i?q(0):Ie(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:h,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?R(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=k(e,[],!1).filter((e=>y(e)&&"body"!==m(e))),o=null;const i="fixed"===L(e).position;let l=i?O(e):e;for(;y(l)&&!S(l);){const t=L(l),n=C(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||x(l)&&!n&&je(e,l))?r=r.filter((e=>e!==l)):o=t,l=O(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],c=i.reduce(((e,n)=>{const r=Fe(t,n,o);return e.top=X(r.top,e.top),e.right=U(r.right,e.right),e.bottom=U(r.bottom,e.bottom),e.left=X(r.left,e.left),e}),Fe(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:_e,getElementRects:async function(e){const t=this.getOffsetParent||_e,n=this.getDimensions,r=await n(e.floating);return{reference:Be(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}=Pe(e);return{width:t,height:n}},getScale:Ae,isElement:y,isRTL:function(e){return"rtl"===L(e).direction}},Ke=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=Z(n),c=J(n),u="y"===ne(n),a=["left","top"].includes(l)?-1:1,s=i&&u?-1:1,f=Q(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}}}}},Ue=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}=Q(e,t),a={x:n,y:r},s=await Le(t,u),f=ne(Z(o)),d=ee(f);let p=a[d],m=a[f];if(i){const e="y"===d?"bottom":"right";p=G(p+s["y"===d?"top":"left"],p,p-s[e])}if(l){const e="y"===f?"bottom":"right";m=G(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}}}}}},Xe=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}=Q(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const g=Z(o),y=ne(c),w=Z(c)===c,b=await(null==u.isRTL?void 0:u.isRTL(a.floating)),x=d||(w||!v?[ie(c)]:function(e){const t=ie(e);return[oe(e),t,oe(t)]}(c)),E="none"!==m;!d&&E&&x.push(...function(e,t,n,r){const o=J(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[]}}(Z(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(oe)))),i}(c,v,m,b));const R=[c,...x],C=await Le(t,h),T=[];let S=(null==(r=i.flip)?void 0:r.overflows)||[];if(s&&T.push(C[g]),f){const e=function(e,t,n){void 0===n&&(n=!1);const r=J(e),o=re(e),i=te(o);let l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=ie(l)),[l,ie(l)]}(o,l,b);T.push(C[e[0]],C[e[1]])}if(S=[...S,{placement:o,overflows:T}],!T.every((e=>e<=0))){var L,P;const e=((null==(L=i.flip)?void 0:L.index)||0)+1,t=R[e];if(t)return{data:{index:e,overflows:S},reset:{placement:t}};let n=null==(P=S.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:P.placement;if(!n)switch(p){case"bestFit":{var O;const e=null==(O=S.filter((e=>{if(E){const t=ne(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:O[0];e&&(n=e);break}case"initialPlacement":n=c}if(o!==n)return{reset:{placement:n}}}return{}}}},Ye=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}=Q(e,t)||{};if(null==a)return{};const f=le(s),d={x:n,y:r},p=re(o),m=te(p),v=await l.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],x=d[p]-i.reference[p],E=await(null==l.getOffsetParent?void 0:l.getOffsetParent(a));let R=E?E[w]:0;R&&await(null==l.isElement?void 0:l.isElement(E))||(R=c.floating[w]||i.floating[m]);const C=b/2-x/2,T=R/2-v[m]/2-1,S=U(f[g],T),L=U(f[y],T),P=S,O=R-v[m]-L,A=R/2-v[m]/2+C,k=G(P,A,O),M=!u.arrow&&null!=J(o)&&A!==k&&i.reference[m]/2-(A<P?S:L)-v[m]/2<0,D=M?A<P?A-P:A-O:0;return{[p]:d[p]+D,data:{[p]:k,centerOffset:A-k-D,...M&&{alignmentOffset:D}},reset:M}}}),qe=(e,t,n)=>{const r=new Map,o={platform:He,...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}=Se(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:w}=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}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(d=w.placement),w.rects&&(a=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:s,y:f}=Se(a,d,u))),n=-1)}return{x:s,y:f,placement:d,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var $e="undefined"!=typeof document?r:o;function ze(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(!ze(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)&&!ze(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function Ge(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qe(e,t){const n=Ge(e);return Math.round(t*n)/n}function Ze(t){const n=e.useRef(t);return $e((()=>{n.current=t})),n}const Je=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?Ye({element:n.current,padding:r}).fn(t):{}:n?Ye({element:n,padding:r}).fn(t):{};var o}}),et=(e,t)=>({...Ke(e),options:[e,t]}),tt=(e,t)=>({...Ue(e),options:[e,t]}),nt=(e,t)=>({...Xe(e),options:[e,t]});function rt(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 ot={...e},it=ot.useInsertionEffect||(e=>e());function lt(t){const n=e.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return it((()=>{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 ct="undefined"!=typeof document?r:o;let ut=!1,at=0;const st=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+at++;const ft=ot.useId||function(){const[t,n]=e.useState((()=>ut?st():void 0));return ct((()=>{null==t&&n(st())}),[]),e.useEffect((()=>{ut=!0}),[]),t};let dt;"production"!==process.env.NODE_ENV&&(dt=new Set);const pt=e.forwardRef((function(t,n){const{context:{placement:r,elements:{floating:o},middlewareData:{arrow:i,shift:l}},width:c=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=dt)&&e.has(o)||(null==(i=dt)||i.add(o),console.warn(o))}("The `ref` prop is required for `FloatingArrow`."));const w=ft(),[b,x]=e.useState(!1);if(ct((()=>{if(!o)return;"rtl"===L(o).direction&&x(!0)}),[o]),!o)return null;const[E,R]=r.split("-"),C="top"===E||"bottom"===E;let T=p;(C&&null!=l&&l.x||!C&&null!=l&&l.y)&&(T=null);const S=2*d,P=S/2,O=c/2*(f/-8+1),A=u/2*f/4,k=!!v,M=T&&"end"===R?"bottom":"top";let D=T&&"end"===R?"right":"left";T&&b&&(D="end"===R?"left":"right");const N=null!=(null==i?void 0:i.x)?T||i.x:"",I=null!=(null==i?void 0:i.y)?T||i.y:"",F=v||"M0,0 H"+c+" L"+(c-O)+","+(u-A)+" Q"+c/2+","+u+" "+O+","+(u-A)+" Z",j={top:k?"rotate(180deg)":"",left:k?"rotate(90deg)":"rotate(-90deg)",bottom:k?"":"rotate(180deg)",right:k?"rotate(-90deg)":"rotate(90deg)"}[E];return a("svg",{...y,"aria-hidden":!0,ref:n,width:k?c:c+S,height:c,viewBox:"0 0 "+c+" "+(u>c?u:c),style:{position:"absolute",pointerEvents:"none",[D]:N,[M]:I,[E]:C||k?"100%":"calc(100% - "+S/2+"px)",transform:[j,h].filter((e=>!!e)).join(" "),...g},children:[S>0&&s("path",{clipPath:"url(#"+w+")",fill:"none",stroke:m,strokeWidth:S+(v?0:1),d:F}),s("path",{stroke:S&&!v?y.fill:"none",d:F}),s("clipPath",{id:w,children:s("rect",{x:-P,y:P*(k?-1:1),width:c+S,height:c})})]})}));const mt=e.createContext(null),vt=e.createContext(null),ht=()=>{var t;return(null==(t=e.useContext(mt))?void 0:t.id)||null},gt=()=>e.useContext(vt);function yt(e){return"data-floating-ui-"+e}function wt(e){const t=i(e);return ct((()=>{t.current=e})),t}const bt=yt("safe-polygon");function xt(e,t,n){return n&&!V(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}function Et(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}const Rt=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Ct(e,t){const n=Te(e,Rt());"prev"===t&&n.reverse();const r=n.indexOf(D(_(e)));return n.slice(r+1)[0]}function Tt(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!N(n,r)}function St(e){Te(e,Rt()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function Lt(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 Pt={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 Ot(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const At=e.forwardRef((function(t,n){const[r,o]=e.useState();ct((()=>(B()&&o("button"),document.addEventListener("keydown",Ot),()=>{document.removeEventListener("keydown",Ot)})),[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":!r||void 0,[yt("focus-guard")]:"",style:Pt};return s("span",{...t,...i})})),kt=e.createContext(null),Mt=yt("portal");function Dt(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=ft(),i=Nt(),[l,c]=e.useState(null),u=e.useRef(null);return ct((()=>()=>{null==l||l.remove(),queueMicrotask((()=>{u.current=null}))}),[l]),ct((()=>{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(Mt,""),e.appendChild(t),u.current=t,c(t)}),[n,o]),ct((()=>{if(null===r)return;if(!o)return;if(u.current)return;let e=r||(null==i?void 0:i.portalNode);e&&!y(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(Mt,""),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),d=e.useRef(null),p=e.useRef(null),m=e.useRef(null),v=e.useRef(null),h=null==c?void 0:c.modal,g=null==c?void 0:c.open,w=!!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&&Tt(e)){("focusin"===e.type?Lt:St)(l)}}}),[l,i,h]),e.useEffect((()=>{l&&(g||Lt(l))}),[g,l]),a(kt.Provider,{value:e.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:d,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:v,portalNode:l,setFocusManagerState:u})),[i,l]),children:[w&&l&&s(At,{"data-type":"outside",ref:d,onFocus:e=>{if(Tt(e,l)){var t;null==(t=m.current)||t.focus()}else{const e=Ct(document.body,"prev")||(null==c?void 0:c.domReference);null==e||e.focus()}}}),w&&l&&s("span",{"aria-owns":l.id,style:Pt}),l&&f.createPortal(n,l),w&&l&&s(At,{"data-type":"outside",ref:p,onFocus:e=>{if(Tt(e,l)){var t;null==(t=v.current)||t.focus()}else{const t=Ct(document.body,"next")||(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"))}}})]})}const Nt=()=>e.useContext(kt),It="data-floating-ui-focusable",Ft={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},jt={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Bt=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 Wt(t){const{open:n=!1,onOpenChange:r,elements:o}=t,i=ft(),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!=ht();if("production"!==process.env.NODE_ENV){const e=o.reference;e&&!y(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=dt)&&e.has(o)||(null==(i=dt)||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=lt(((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])}function Vt(t){void 0===t&&(t={});const{nodeId:n}=t,r=Wt({...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,d=e.useRef(null),p=gt();ct((()=>{s&&(d.current=s)}),[s]);const m=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,[d,p]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[m,v]=e.useState(o);ze(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))}),[]),x=e.useCallback((e=>{e!==T.current&&(T.current=e,w(e))}),[]),E=l||h,R=c||y,C=e.useRef(null),T=e.useRef(null),S=e.useRef(d),L=null!=a,P=Ze(a),O=Ze(i),A=Ze(s),k=e.useCallback((()=>{if(!C.current||!T.current)return;const e={placement:n,strategy:r,middleware:m};O.current&&(e.platform=O.current),qe(C.current,T.current,e).then((e=>{const t={...e,isPositioned:!1!==A.current};M.current&&!ze(S.current,t)&&(S.current=t,f.flushSync((()=>{p(t)})))}))}),[m,n,r,O,A]);$e((()=>{!1===s&&S.current.isPositioned&&(S.current.isPositioned=!1,p((e=>({...e,isPositioned:!1}))))}),[s]);const M=e.useRef(!1);$e((()=>(M.current=!0,()=>{M.current=!1})),[]),$e((()=>{if(E&&(C.current=E),R&&(T.current=R),E&&R){if(P.current)return P.current(E,R,k);k()}}),[E,R,k,P,L]);const D=e.useMemo((()=>({reference:C,floating:T,setReference:b,setFloating:x})),[b,x]),N=e.useMemo((()=>({reference:E,floating:R})),[E,R]),I=e.useMemo((()=>{const e={position:r,left:0,top:0};if(!N.floating)return e;const t=Qe(N.floating,d.x),n=Qe(N.floating,d.y);return u?{...e,transform:"translate("+t+"px, "+n+"px)",...Ge(N.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,u,N.floating,d.x,d.y]);return e.useMemo((()=>({...d,update:k,refs:D,elements:N,floatingStyles:I})),[d,k,D,N,I])}({...t,elements:{...i,...u&&{reference:u}}}),v=e.useCallback((e=>{const t=y(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;a(t),m.refs.setReference(t)}),[m.refs]),h=e.useCallback((e=>{(y(e)||null===e)&&(d.current=e,c(e)),(y(m.refs.reference.current)||null===m.refs.reference.current||null!==e&&!y(e))&&m.refs.setReference(e)}),[m.refs]),g=e.useMemo((()=>({...m.refs,setReference:h,setPositionReference:v,domReference:d})),[m.refs,h,v]),w=e.useMemo((()=>({...m.elements,domReference:s})),[m.elements,s]),b=e.useMemo((()=>({...m,...o,refs:g,elements:w,nodeId:n})),[m,g,w,n,o]);return ct((()=>{o.dataRef.current.floatingContext=b;const e=null==p?void 0:p.nodesRef.current.find((e=>e.id===n));e&&(e.context=b)})),e.useMemo((()=>({...m,context:b,refs:g,elements:w})),[m,g,w,b])}function _t(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=v(c.domReference);function t(){!r&&w(c.domReference)&&c.domReference===D(_(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){j(e.nativeEvent)||(d.current=!1)},onMouseLeave(){s.current=!1},onFocus(e){if(s.current)return;const t=K(e.nativeEvent);if(a&&y(t))try{if(B()&&I().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints)throw Error();if(!t.matches(":focus-visible"))return}catch(e){if(!d.current&&(!w(n=t)||!n.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")))return}var n;o(!0,e.nativeEvent,"focus")},onBlur(e){s.current=!1;const t=e.relatedTarget,n=e.nativeEvent,r=y(t)&&t.hasAttribute(yt("focus-guard"))&&"outside"===t.getAttribute("data-type");f.current=window.setTimeout((()=>{var e;const i=D(c.domReference?c.domReference.ownerDocument:document);(t||i!==c.domReference)&&(N(null==(e=l.current.floatingContext)?void 0:e.refs.floating.current,i)||N(c.domReference,i)||r||o(!1,n,"focus"))}))}})),[l,c.domReference,o,a]);return e.useMemo((()=>u?{reference:p}:{}),[u,p])}const Ht="active",Kt="selected";function Ut(e,t,n){const r=new Map,o="item"===n;let i=e;if(o&&e){const{[Ht]:t,[Kt]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1,[It]:""},...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&&[Ht,Kt].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 Xt=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);var Yt=function(n){var r,o,c=n.children,u=n.placement,a=void 0===u?"top":u,s=i(null),f=l(!1),p=f[0],m=f[1],v=Vt({placement:a,strategy:"fixed",onOpenChange:m,middleware:[(r={element:s,padding:4},{...Je(r),options:[r,o]}),et(5),nt({crossAxis:!0,fallbackAxisSideDirection:"start",padding:5}),tt({padding:5})]}),h=v.context,g=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=gt(),v=ht(),h=wt(s),g=wt(a),w=wt(r),b=e.useRef(),x=e.useRef(-1),E=e.useRef(),R=e.useRef(-1),C=e.useRef(!0),T=e.useRef(!1),S=e.useRef((()=>{})),L=e.useRef(!1),P=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(x.current),clearTimeout(R.current),C.current=!0,L.current=!1)}}),[u,l]),e.useEffect((()=>{if(!u)return;if(!h.current)return;if(!r)return;function e(e){P()&&o(!1,e,"hover")}const t=_(c.floating).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[c.floating,r,o,u,h,P]);const O=e.useCallback((function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const r=xt(g.current,"close",b.current);r&&!E.current?(clearTimeout(x.current),x.current=window.setTimeout((()=>o(!1,e,n)),r)):t&&(clearTimeout(x.current),o(!1,e,n))}),[g,o]),A=lt((()=>{S.current(),E.current=void 0})),k=lt((()=>{if(T.current){const e=_(c.floating).body;e.style.pointerEvents="",e.removeAttribute(bt),T.current=!1}})),M=lt((()=>!!i.current.openEvent&&["click","mousedown"].includes(i.current.openEvent.type)));e.useEffect((()=>{if(u&&y(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(x.current),C.current=!1,f&&!V(b.current)||d>0&&!xt(g.current,"open"))return;const t=xt(g.current,"open",b.current);t?x.current=window.setTimeout((()=>{w.current||o(!0,e,"hover")}),t):r||o(!0,e,"hover")}function n(e){if(M())return;S.current();const t=_(c.floating);if(clearTimeout(R.current),L.current=!1,h.current&&i.current.floatingContext){r||clearTimeout(x.current),E.current=h.current({...i.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){k(),A(),M()||O(e,!0,"safe-polygon")}});const n=E.current;return t.addEventListener("mousemove",n),void(S.current=()=>{t.removeEventListener("mousemove",n)})}("touch"!==b.current||!N(c.floating,e.relatedTarget))&&O(e)}function l(e){M()||i.current.floatingContext&&(null==h.current||h.current({...i.current.floatingContext,tree:m,x:e.clientX,y:e.clientY,onClose(){k(),A(),M()||O(e)}})(e))}}),[c,u,t,f,d,p,O,A,k,o,r,w,m,g,h,i,M]),ct((()=>{var e;if(u&&r&&null!=(e=h.current)&&e.__options.blockPointerEvents&&P()){T.current=!0;const e=c.floating;if(y(c.domReference)&&e){var t;const n=_(c.floating).body;n.setAttribute(bt,"");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,P]),ct((()=>{r||(b.current=void 0,L.current=!1,A(),k())}),[r,A,k]),e.useEffect((()=>()=>{A(),clearTimeout(x.current),clearTimeout(R.current),k()}),[u,c.domReference,A,k]);const D=e.useMemo((()=>{function e(e){b.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){const{nativeEvent:t}=e;function n(){C.current||w.current||o(!0,t,"hover")}f&&!V(b.current)||r||0===d||L.current&&e.movementX**2+e.movementY**2<2||(clearTimeout(R.current),"touch"===b.current?n():(L.current=!0,R.current=window.setTimeout(n,d)))}}}),[f,o,r,w,d]),I=e.useMemo((()=>({onMouseEnter(){clearTimeout(x.current)},onMouseLeave(e){M()||O(e.nativeEvent,!1)}})),[O,M]);return e.useMemo((()=>u?{reference:D,floating:I}:{}),[u,D,I])}(h,{move:!1}),b=_t(h,{}),x=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=gt(),g=lt("function"==typeof a?a:()=>!1),b="function"==typeof a?g:a,x=e.useRef(!1),E=e.useRef(!1),{escapeKey:R,outsidePress:C}=Bt(m),{escapeKey:P,outsidePress:A}=Bt(v),M=e.useRef(!1),D=lt((e=>{var t;if(!r||!c||!u||"Escape"!==e.key)return;if(M.current)return;const n=null==(t=l.current.floatingContext)?void 0:t.nodeId,i=h?Et(h.nodesRef.current,n):[];if(!R&&(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")})),I=lt((e=>{var t;const n=()=>{var t;D(e),null==(t=K(e))||t.removeEventListener("keydown",n)};null==(t=K(e))||t.addEventListener("keydown",n)})),F=lt((e=>{var t;const n=x.current;x.current=!1;const r=E.current;if(E.current=!1,"click"===s&&r)return;if(n)return;if("function"==typeof b&&!b(e))return;const c=K(e),u="["+yt("inert")+"]",a=_(i.floating).querySelectorAll(u);let f=y(c)?c:null;for(;f&&!S(f);){const e=O(f);if(S(e)||!y(e))break;f=e}if(a.length&&y(c)&&!c.matches("html,body")&&!N(c,i.floating)&&Array.from(a).every((e=>!N(f,e))))return;if(w(c)&&W){const t=S(c),n=L(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&&Et(h.nodesRef.current,d).some((t=>{var n;return H(e,null==(n=t.context)?void 0:n.elements.floating)}));if(H(e,i.floating)||H(e,i.domReference)||p)return;const m=h?Et(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")})),j=lt((e=>{var t;const n=()=>{var t;F(e),null==(t=K(e))||t.removeEventListener(s,n)};null==(t=K(e))||t.addEventListener(s,n)}));e.useEffect((()=>{if(!r||!c)return;l.current.__escapeKeyBubbles=R,l.current.__outsidePressBubbles=C;let e=-1;function t(e){o(!1,e,"ancestor-scroll")}function n(){window.clearTimeout(e),M.current=!0}function a(){e=window.setTimeout((()=>{M.current=!1}),T()?5:0)}const f=_(i.floating);u&&(f.addEventListener("keydown",P?I:D,P),f.addEventListener("compositionstart",n),f.addEventListener("compositionend",a)),b&&f.addEventListener(s,A?j:F,A);let d=[];return p&&(y(i.domReference)&&(d=k(i.domReference)),y(i.floating)&&(d=d.concat(k(i.floating))),!y(i.reference)&&i.reference&&i.reference.contextElement&&(d=d.concat(k(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",P?I:D,P),f.removeEventListener("compositionstart",n),f.removeEventListener("compositionend",a)),b&&f.removeEventListener(s,A?j:F,A),d.forEach((e=>{e.removeEventListener("scroll",t)})),window.clearTimeout(e)}}),[l,i,u,b,s,r,o,p,c,R,C,D,P,I,F,A,j]),e.useEffect((()=>{x.current=!1}),[b,s]);const B=e.useMemo((()=>({onKeyDown:D,...f&&{[Ft[d]]:e=>{o(!1,e.nativeEvent,"reference-press")},..."click"!==d&&{onClick(e){o(!1,e.nativeEvent,"reference-press")}}}})),[D,o,f,d]),W=e.useMemo((()=>({onKeyDown:D,onMouseDown(){E.current=!0},onMouseUp(){E.current=!0},[jt[s]]:()=>{x.current=!0}})),[D,s]);return e.useMemo((()=>c?{reference:B,floating:W}:{}),[c,B,W])}(h),E=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=Xt.get(c))?r:c,a=ft(),s=null!=ht(),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])}(h,{role:"tooltip"}),R=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=>Ut(e,t,"reference")),n),l=e.useCallback((e=>Ut(e,t,"floating")),r),c=e.useCallback((e=>Ut(e,t,"item")),o);return e.useMemo((()=>({getReferenceProps:i,getFloatingProps:l,getItemProps:c})),[i,l,c])}([g,b,x,E]);return t.createElement(d.Provider,{value:{isOpen:p,setIsOpen:m,data:v,interactions:R,context:h,arrowRef:s}},c)};Yt.displayName="Tooltip";var qt=function(){return qt=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},qt.apply(this,arguments)};function $t(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 zt=["div","span","button","input","a"].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=$t(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,qt(qt({},c),{ref:r}),l);var a=u[0];return t.cloneElement(a,qt(qt(qt({},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,qt(qt({},c),{ref:r}),l)}));return n.displayName="Primitive.".concat(e),n}(n),e}),{}),Gt=c((function(e,n){var r=e.children,o=e.asChild,i=$t(e,["children","asChild"]),l=u(d);if(!l)throw new Error("TooltipTrigger must be used within a TooltipRoot component");l.setIsOpen;var c=l.isOpen,a=l.interactions;l.data;var s=l.context,f=a.getReferenceProps,p=r.ref,m=rt([s.refs.setReference,n,p]);return t.createElement(zt.button,qt({asChild:o,ref:m,"data-state":c?"open":"closed"},f(i)),r)}));function Qt(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=Qt(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Zt(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Qt(e))&&(r&&(r+=" "),r+=t);return r}Gt.displayName="TooltipTrigger";var Jt=c((function(e,n){var r=e.children,o=e.showArrow,i=void 0===o||o,l=$t(e,["children","showArrow"]),c=u(d);if(!c)throw new Error("TooltipContent must be used within a TooltipRoot component");var a=c.isOpen,s=c.data,f=c.interactions,p=c.context,m=c.arrowRef,v=rt([p.refs.setFloating,n]);if(!a)return null;var h=f.getFloatingProps;return t.createElement(Dt,null,t.createElement(zt.div,qt({className:"rad-ui-tooltip-floating-element",ref:v,style:qt({},s.floatingStyles)},h(l)),i&&t.createElement(pt,{className:Zt("rad-ui-arrow rad-ui-arrow"),ref:m,context:p}),r))}));Jt.displayName="TooltipContent";var en=function(){return console.warn("Direct usage of Tabs is not supported. Please use Tabs.Root, Tabs.List, etc. instead."),null};en.Root=Yt,en.Trigger=Gt,en.Content=Jt;export{en 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"].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}),p=r({focusedItemId:null,setFocusedItemId:function(){},focusItems:[],setFocusItems:function(){},addFocusItem:function(){},groupRef:null}),m=i((function(r,t){var n,i=r.children,d=r["aria-label"],s=r["aria-labelledby"],m=u(r,["children","aria-label","aria-labelledby"]),b=a(),y=o(p),h=y.focusedItemId,g=y.setFocusedItemId,I=y.addFocusItem,E=y.focusItems,w=y.groupRef,O=o(v),F=O.orientation,A=O.loop,D=e.Children.toArray(i)[0],k=!0===(null===(n=null==D?void 0:D.props)||void 0===n?void 0:n.disabled),x=h===b;l((function(){E.includes(b)||I(b)}),[E,h,b,I]);var P=function(e){if(w&&w.current){g(e);var r=CSS.escape(e),t=w.current.querySelector("#".concat(r));t&&t.focus()}},R=function(e,r){for(var t,n=e,a=0;a<E.length;a++){if(n+=r,A)n<0&&(n=E.length-1),n>=E.length&&(n=0);else if(n<0||n>=E.length)return-1;var l=E[n],i=null===(t=null==w?void 0:w.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},S=function(){var e=E.indexOf(b),r=R(e,-1);-1!==r&&P(E[r])},C=function(){var e=E.indexOf(b),r=R(e,1);-1!==r&&P(E[r])};return e.createElement(f.button,c({asChild:!0,onFocus:function(e){e.preventDefault(),k||g(b)},tabIndex:!k&&x?0:-1,ref:t,id:b,onKeyDown:function(e){if(!k)switch(e.key){case"ArrowUp":e.preventDefault(),"vertical"===F&&S();break;case"ArrowLeft":e.preventDefault(),"horizontal"===F&&S();break;case"ArrowDown":e.preventDefault(),"vertical"===F&&C();break;case"ArrowRight":e.preventDefault(),"horizontal"===F&&C();break;case"Home":e.preventDefault(),function(){if(E.length>0){var e=R(-1,1);-1!==e&&P(E[e])}}();break;case"End":e.preventDefault(),function(){if(E.length>0){var e=R(E.length,-1);-1!==e&&P(E[e])}}()}},"data-child-disabled":k,role:"option","aria-selected":x,"aria-disabled":k,"aria-label":d,"aria-labelledby":s},m),i)}));m.displayName="RovingFocusItem";var b={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=u(r,["children","orientation","loop","aria-label","aria-labelledby"]),p={orientation:a,loop:i};return e.createElement(v.Provider,{value:p},e.createElement(f.div,c({role:"listbox","aria-orientation":a,"aria-label":o,"aria-labelledby":d},s),t))},Group:function(r){var i=r.children,o=r["aria-label"],s=r["aria-labelledby"],v=u(r,["children","aria-label","aria-labelledby"]),m=t(null),b=n([]),y=b[0],h=b[1],g=n(null),I=g[0],E=g[1],w=a();l((function(){!I&&y.length>0&&E(y[0])}),[y,I]);var O={focusedItemId:I,setFocusedItemId:E,focusItems:y,setFocusItems:h,addFocusItem:function(e){h((function(r){return d(d([],r,!0),[e],!1)}))},groupRef:m};return e.createElement(p.Provider,{value:O},e.createElement(f.div,c({id:w,ref:m,role:"group","aria-label":o,"aria-labelledby":s},v),i))},Item:m},y=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,p=u(r,["role","label","description","disabled","children"]);return l&&(p["aria-label"]=l),o&&(p["aria-description"]=o),s&&(p["aria-disabled"]="true",o||(p["aria-description"]="Disabled Button")),e.createElement(f.button,c({role:n,disabled:s},p),v)};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}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),m=p[0],h=p[1];return e.createElement(e.Fragment,null,e.createElement(b.Item,null,e.createElement(y,c({className:g(s),onClick:function(){console.log("clicked",v),h(!m)},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,m?"v":">"),e.createElement("div",null,t)))),m&&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(b.Root,{orientation:"vertical"},e.createElement(b.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"].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=u(r,["children","aria-label","aria-labelledby"]),m=a(),y=o(p),h=y.focusedItemId,g=y.setFocusedItemId,I=y.addFocusItem,E=y.focusItems,x=y.groupRef,w=o(v),O=w.orientation,F=w.loop,A=w.disableTabIndexing,D=e.Children.toArray(i)[0],k=!0===(null===(n=null==D?void 0:D.props)||void 0===n?void 0:n.disabled),P=h===m,R=A||!k&&P?0:-1;l((function(){E.includes(m)||I(m)}),[E,h,m,I]);var S=function(e){if(x&&x.current){g(e);var r=CSS.escape(e),t=x.current.querySelector("#".concat(r));t&&t.focus()}},C=function(e,r){for(var t,n=e,a=0;a<E.length;a++){if(n+=r,F)n<0&&(n=E.length-1),n>=E.length&&(n=0);else if(n<0||n>=E.length)return-1;var l=E[n],i=null===(t=null==x?void 0:x.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},T=function(){var e=E.indexOf(m),r=C(e,-1);-1!==r&&S(E[r])},j=function(){var e=E.indexOf(m),r=C(e,1);-1!==r&&S(E[r])};return e.createElement(f.button,c({asChild:!0,onFocus:function(e){e.preventDefault(),k||g(m)},tabIndex:R,ref:t,id:m,onKeyDown:function(e){if(!k)switch(e.key){case"ArrowUp":e.preventDefault(),"vertical"===O&&T();break;case"ArrowLeft":e.preventDefault(),"horizontal"===O&&T();break;case"ArrowDown":e.preventDefault(),"vertical"===O&&j();break;case"ArrowRight":e.preventDefault(),"horizontal"===O&&j();break;case"Home":e.preventDefault(),function(){if(E.length>0){var e=C(-1,1);-1!==e&&S(E[e])}}();break;case"End":e.preventDefault(),function(){if(E.length>0){var e=C(E.length,-1);-1!==e&&S(E[e])}}()}},"data-child-disabled":k,role:"option","aria-selected":P,"aria-disabled":k,"aria-label":d,"aria-labelledby":s},b),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=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,p=u(r,["role","label","description","disabled","children"]);return l&&(p["aria-label"]=l),o&&(p["aria-description"]=o),s&&(p["aria-disabled"]="true",o||(p["aria-description"]="Disabled Button")),e.createElement(f.button,c({role:n,disabled:s},p),v)};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}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};
@@ -1 +1 @@
1
- 'use client';import r from"react";var e=function(){return e=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r},e.apply(this,arguments)};function t(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(r);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(r,n[o])&&(t[n[o]]=r[n[o]])}return t}"function"==typeof SuppressedError&&SuppressedError;var n=["div","span","button","input"].reduce((function(n,o){return n[o]=function(n){var o=r.forwardRef((function(o,a){var i=o.asChild,c=void 0!==i&&i,l=o.children,f=t(o,["asChild","children"]);if(c){var u=r.Children.toArray(l);if(1!==u.length||!r.isValidElement(u[0]))return console.warn("Primitive.".concat(n,": asChild prop requires exactly one valid child element.")),r.createElement(n,e(e({},f),{ref:a}),l);var s=u[0];return r.cloneElement(s,e(e(e({},f),s.props),a?{ref:function(r){"function"==typeof a?a(r):a&&(a.current=r);var e=s.ref;"function"==typeof e?e(r):e&&(e.current=r)}}:{}))}return r.createElement(n,e(e({},f),{ref:a}),l)}));return o.displayName="Primitive.".concat(n),o}(o),n}),{});function o(r){var e,t,n="";if("string"==typeof r||"number"==typeof r)n+=r;else if("object"==typeof r)if(Array.isArray(r)){var a=r.length;for(e=0;e<a;e++)r[e]&&(t=o(r[e]))&&(n&&(n+=" "),n+=t)}else for(t in r)r[t]&&(n&&(n+=" "),n+=t);return n}function a(){for(var r,e,t=0,n="",a=arguments.length;t<a;t++)(r=arguments[t])&&(e=o(r))&&(n&&(n+=" "),n+=e);return n}var i="VisuallyHidden",c=function(o){var c=o.children,l=o.customRootClass,f=o.className,u=t(o,["children","customRootClass","className"]),s=function(r,e){if(void 0===r&&(r=""),r)return r;var t=e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return"".concat("rad-ui","-").concat(t)}(l,i);return r.createElement(n.div,e({className:a(s,f)},u),c)};c.displayName=i;export{c as default};
1
+ 'use client';import r from"react";var e=function(){return e=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r},e.apply(this,arguments)};function t(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(r);o<n.length;o++)e.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(r,n[o])&&(t[n[o]]=r[n[o]])}return t}"function"==typeof SuppressedError&&SuppressedError;var n=["div","span","button","input","a"].reduce((function(n,o){return n[o]=function(n){var o=r.forwardRef((function(o,a){var i=o.asChild,c=void 0!==i&&i,l=o.children,f=t(o,["asChild","children"]);if(c){var u=r.Children.toArray(l);if(1!==u.length||!r.isValidElement(u[0]))return console.warn("Primitive.".concat(n,": asChild prop requires exactly one valid child element.")),r.createElement(n,e(e({},f),{ref:a}),l);var s=u[0];return r.cloneElement(s,e(e(e({},f),s.props),a?{ref:function(r){"function"==typeof a?a(r):a&&(a.current=r);var e=s.ref;"function"==typeof e?e(r):e&&(e.current=r)}}:{}))}return r.createElement(n,e(e({},f),{ref:a}),l)}));return o.displayName="Primitive.".concat(n),o}(o),n}),{});function o(r){var e,t,n="";if("string"==typeof r||"number"==typeof r)n+=r;else if("object"==typeof r)if(Array.isArray(r)){var a=r.length;for(e=0;e<a;e++)r[e]&&(t=o(r[e]))&&(n&&(n+=" "),n+=t)}else for(t in r)r[t]&&(n&&(n+=" "),n+=t);return n}function a(){for(var r,e,t=0,n="",a=arguments.length;t<a;t++)(r=arguments[t])&&(e=o(r))&&(n&&(n+=" "),n+=e);return n}var i="VisuallyHidden",c=function(o){var c=o.children,l=o.customRootClass,f=o.className,u=t(o,["children","customRootClass","className"]),s=function(r,e){if(void 0===r&&(r=""),r)return r;var t=e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return"".concat("rad-ui","-").concat(t)}(l,i);return r.createElement(n.div,e({className:a(s,f)},u),c)};c.displayName=i;export{c as default};