@radui/ui 0.0.36 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -1
- package/dist/components/Accordion.js +1 -1
- package/dist/components/AlertDialog.js +2 -2
- package/dist/components/Collapsible.js +1 -1
- package/dist/components/Disclosure.js +1 -1
- package/dist/components/Dropdown.js +1 -5
- package/dist/components/Heading.js +1 -1
- package/dist/components/HoverCard.js +2 -2
- package/dist/components/RadioCards.js +1 -1
- package/dist/components/RadioGroup.js +1 -1
- package/dist/components/Switch.js +1 -1
- package/dist/components/Tabs.js +1 -1
- package/dist/components/ToggleGroup.js +1 -1
- package/dist/components/Tooltip.js +2 -2
- package/dist/components/Tree.js +1 -1
- package/dist/themes/default.css +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -10,6 +10,10 @@ Head over to [Storybook](https://main--657eda33d6033847be90aaf8.chromatic.com/)
|
|
|
10
10
|
|
|
11
11
|
Rad UI is a React UI library designed to simplify and enhance the process of building user interfaces. With a focus on ease of use and flexibility, Rad UI empowers developers to create engaging and efficient user experiences. Whether you're starting a new project or improving an existing one, Rad UI provides a collection of components and utilities to streamline development.
|
|
12
12
|
|
|
13
|
+
## Documentation
|
|
14
|
+
|
|
15
|
+
For full documentation, visit [Documentation](https://www.rad-ui.com/docs/first-steps/introduction).
|
|
16
|
+
|
|
13
17
|
## Installation
|
|
14
18
|
|
|
15
19
|
To install Rad UI, run the following command from the root of your project's directory:
|
|
@@ -26,6 +30,7 @@ Please note that Rad UI is under development and will receive a full official re
|
|
|
26
30
|
What sets this apart: Rad UI stands out with its focus on simplicity, flexibility, and ease of integration into React projects.
|
|
27
31
|
<!--
|
|
28
32
|
|
|
33
|
+
|
|
29
34
|
## Dependencies
|
|
30
35
|
|
|
31
36
|
Describe any dependencies that must be installed for this software to work.
|
|
@@ -59,6 +64,13 @@ If you have questions, concerns, bug reports, etc, please file an issue in this
|
|
|
59
64
|
We encourage interested developers in getting involved in building a better future for the web. We can use all the help we can get to make the code and the docs a little bit every day.
|
|
60
65
|
For more details, you can read on how to contribute to development of Rad UI in [Contribution Docs](https://www.rad-ui.com/docs/contributing/before-you-start).
|
|
61
66
|
|
|
67
|
+
[Setting Up Dev Environment](https://www.rad-ui.com/docs/contributing/setting-up-dev-environment)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## Where can I get more help, if I need it?
|
|
71
|
+
[GitHub Discussions](https://github.com/rad-ui/ui/discussions)
|
|
72
|
+
[Discord](https://discord.com/invite/nMaQfeEPNp)
|
|
73
|
+
|
|
62
74
|
## Open source licensing info
|
|
63
75
|
|
|
64
76
|
For Licensing info you can check out [LICENSE](LICENSE).
|
|
@@ -71,4 +83,4 @@ Node versions tested in 18.19.0 - 21.4.0
|
|
|
71
83
|
|
|
72
84
|
1. Project heavily inspired by RadixUI, Floating UI, shadcn/ui and many other libraries that defined the modern web that we know today
|
|
73
85
|
|
|
74
|
-
This project is tested with BrowserStack
|
|
86
|
+
This project is tested with BrowserStack
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import e,{createContext as n,useRef as t,useState as r,useId as o,useEffect as i,forwardRef as a,useContext as l,useCallback as c}from"react";function u(e){var n,t,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(n=0;n<o;n++)e[n]&&(t=u(e[n]))&&(r&&(r+=" "),r+=t)}else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function d(){for(var e,n,t=0,r="",o=arguments.length;t<o;t++)(e=arguments[t])&&(n=u(e))&&(r&&(r+=" "),r+=n);return r}var s=n({rootClass:"",activeItem:null,setActiveItem:function(){},accordionRef:void 0,transitionDuration:0,transitionTimingFunction:"ease-out"}),f=function(){return f=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},f.apply(this,arguments)};function v(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}function m(e,n,t){if(t||2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var p=["div","span","button","input"].reduce((function(n,t){return n[t]=function(n){var t=e.forwardRef((function(t,r){var o=t.asChild,i=void 0!==o&&o,a=t.children,l=v(t,["asChild","children"]);if(i){var c=e.Children.toArray(a);if(1!==c.length||!e.isValidElement(c[0]))return console.warn("Primitive.".concat(n,": asChild prop requires exactly one valid child element.")),e.createElement(n,f(f({},l),{ref:r}),a);var u=c[0];return e.cloneElement(u,f(f(f({},l),u.props),r?{ref:function(e){"function"==typeof r?r(e):r&&(r.current=e);var n=u.ref;"function"==typeof n?n(e):n&&(n.current=e)}}:{}))}return e.createElement(n,f(f({},l),{ref:r}),a)}));return t.displayName="Primitive.".concat(n),t}(t),n}),{}),h=n({direction:"horizontal",loop:!0}),b=n({focusedItemId:null,setFocusedItemId:function(){},focusItems:[],setFocusItems:function(){},addFocusItem:function(){},groupRef:null}),g=a((function(n,t){var r,a=n.children,c=n["aria-label"],u=n["aria-labelledby"],d=v(n,["children","aria-label","aria-labelledby"]),s=o(),m=l(b),g=m.focusedItemId,y=m.setFocusedItemId,C=m.addFocusItem,I=m.focusItems,E=m.groupRef,w=l(h),A=w.direction,F=w.loop,D=e.Children.toArray(a)[0],O=!0===(null===(r=null==D?void 0:D.props)||void 0===r?void 0:r.disabled),N=g===s;i((function(){I.includes(s)||C(s)}),[I,g,s,C]);var P=function(e){if(E&&E.current){y(e);var n=CSS.escape(e),t=E.current.querySelector("#".concat(n));t&&t.focus()}},R=function(e,n){for(var t,r=e,o=0;o<I.length;o++){if(r+=n,F)r<0&&(r=I.length-1),r>=I.length&&(r=0);else if(r<0||r>=I.length)return-1;var i=I[r],a=null===(t=null==E?void 0:E.current)||void 0===t?void 0:t.querySelector("#".concat(CSS.escape(i)));if(a)if(!("true"===a.getAttribute("data-child-disabled")))return r}return-1},T=function(){var e=I.indexOf(s),n=R(e,-1);-1!==n&&P(I[n])},x=function(){var e=I.indexOf(s),n=R(e,1);-1!==n&&P(I[n])};return e.createElement(p.button,f({asChild:!0,onFocus:function(e){e.preventDefault(),O||y(s)},tabIndex:!O&&N?0:-1,ref:t,id:s,onKeyDown:function(e){if(!O)switch(e.key){case"ArrowUp":e.preventDefault(),"vertical"===A&&T();break;case"ArrowLeft":e.preventDefault(),"horizontal"===A&&T();break;case"ArrowDown":e.preventDefault(),"vertical"===A&&x();break;case"ArrowRight":e.preventDefault(),"horizontal"===A&&x();break;case"Home":e.preventDefault(),function(){if(I.length>0){var e=R(-1,1);-1!==e&&P(I[e])}}();break;case"End":e.preventDefault(),function(){if(I.length>0){var e=R(I.length,-1);-1!==e&&P(I[e])}}()}},"data-child-disabled":O,role:"option","aria-selected":N,"aria-disabled":O,"aria-label":c,"aria-labelledby":u},d),a)}));g.displayName="RovingFocusItem";var y={Root:function(n){var t=n.children,r=n.direction,o=void 0===r?"horizontal":r,i=n.loop,a=void 0===i||i,l=n["aria-label"],c=n["aria-labelledby"],u=v(n,["children","direction","loop","aria-label","aria-labelledby"]),d={direction:o,loop:a};return e.createElement(h.Provider,{value:d},e.createElement(p.div,f({role:"listbox","aria-orientation":o,"aria-label":l,"aria-labelledby":c},u),t))},Group:function(n){var a=n.children,l=n["aria-label"],c=n["aria-labelledby"],u=v(n,["children","aria-label","aria-labelledby"]),d=t(null),s=r([]),h=s[0],g=s[1],y=r(null),C=y[0],I=y[1],E=o();i((function(){!C&&h.length>0&&I(h[0])}),[h,C]);var w={focusedItemId:C,setFocusedItemId:I,focusItems:h,setFocusItems:g,addFocusItem:function(e){g((function(n){return m(m([],n,!0),[e],!1)}))},groupRef:d};return e.createElement(b.Provider,{value:w},e.createElement(p.div,f({id:E,ref:d,role:"group","aria-label":l,"aria-labelledby":c},u),a))},Item:g},C=n({itemValue:0,setItemValue:function(){}}),I=n(void 0),E=function(){var e=l(I);if(!e)throw new Error("Collapsible compound components must be used within a CollapsiblePrimitive.Root component");return e};var w=e.forwardRef((function(n,o){var a=n.children,l=n.className;n.asChild;var c=v(n,["children","className","asChild"]),u=E(),d=u.open,s=u.contentId,m=u.transitionDuration,h=u.transitionTimingFunction,b=t(null),g=o||b,y=r(d?void 0:0),C=y[0],I=y[1],w=r(d),A=w[0],F=w[1],D=t(),O=t();return i((function(){d&&F(!0)}),[d]),i((function(){if(D.current&&clearTimeout(D.current),O.current&&cancelAnimationFrame(O.current),b.current){if(0===m)return I(d?void 0:0),void(d||setTimeout((function(){return F(!1)}),0));if(d)I(0),O.current=requestAnimationFrame((function(){var e;null===(e=b.current)||void 0===e||e.offsetHeight,O.current=requestAnimationFrame((function(){if(b.current){var e=b.current.scrollHeight;I(e)}}))})),D.current=setTimeout((function(){I(void 0)}),m);else{var e=b.current.scrollHeight;I(e),O.current=requestAnimationFrame((function(){var e;null===(e=b.current)||void 0===e||e.offsetHeight,O.current=requestAnimationFrame((function(){I(0)}))})),D.current=setTimeout((function(){F(!1)}),m)}return function(){D.current&&clearTimeout(D.current),O.current&&cancelAnimationFrame(O.current)}}}),[d,m]),A||d?e.createElement(p.div,f({id:s,ref:g,"aria-hidden":!d,"data-state":d?"open":"closed",className:l,style:f({height:void 0!==C?"".concat(C,"px"):void 0,overflow:"hidden"},m>0?{transition:"height ".concat(m,"ms ").concat(h)}:{})},c),a):null}));w.displayName="CollapsiblePrimitiveContent";var A=e.forwardRef((function(n,t){var r=n.children,o=n.asChild,i=void 0!==o&&o,a=v(n,["children","asChild"]),l=E(),c=l.open,u=l.onOpenChange,d=l.disabled,s=l.contentId;return e.createElement(p.button,f({"aria-controls":s,"aria-expanded":c,"data-state":c?"open":"closed","data-disabled":d?"true":void 0,ref:t,onClick:function(e){var n;null===(n=a.onClick)||void 0===n||n.call(a,e),d||u(!c)},asChild:i},a),r)}));A.displayName="CollapsiblePrimitiveTrigger";var F=function(){return console.warn("Direct usage of CollapsiblePrimitive is not supported. Please use CollapsiblePrimitive.Root, CollapsiblePrimitive.Content, etc. instead."),null};F.Root=function(n){var a=n.children,l=n.defaultOpen,u=void 0!==l&&l,d=n.open,s=n.onOpenChange,m=n.disabled,h=void 0!==m&&m,b=n.transitionDuration,g=void 0===b?300:b,y=n.transitionTimingFunction,C=void 0===y?"linear":y,E=v(n,["children","defaultOpen","open","onOpenChange","disabled","transitionDuration","transitionTimingFunction"]),w=o(),A=function(e,n,o){var a=r(n),l=a[0],u=a[1],d=void 0!==e,s=d?e:l,f=t(d),v=t(e);i((function(){"production"!==process.env.NODE_ENV&&(f.current!==d&&console.warn("Component changed from ".concat(f.current?"controlled":"uncontrolled"," to ").concat(d?"controlled":"uncontrolled",".")),f.current=d)}),[d]),i((function(){"production"!==process.env.NODE_ENV&&d&&!o&&e!==v.current&&console.warn("A component is changing a controlled value without an onChange handler. This will render a controlled component as uncontrolled."),v.current=e}),[e,d,o]);var m=c((function(e){var n="function"==typeof e?e(s):e;d||u(n),o&&o(n)}),[d,o,s]);return[s,m]}(d,u,s),F=A[0],D=A[1];return e.createElement(I.Provider,{value:{open:F,onOpenChange:function(e){h||D(e)},disabled:h,contentId:w,transitionDuration:g,transitionTimingFunction:C}},e.createElement(p.div,f({},E,{"data-state":F?"open":"closed","data-disabled":h?"":void 0}),a))},F.Content=w,F.Trigger=A;var D=function(){return console.warn("Direct usage of Accordion is not supported. Please use Accordion.Root, Accordion.Item, etc. instead."),null};D.Root=function(n){var o=n.children,i=n.direction,a=void 0===i?"vertical":i,l=n.transitionDuration,c=void 0===l?0:l,u=n.transitionTimingFunction,f=void 0===u?"linear":u,v=n.customRootClass,m=t(null),p=function(e,n){if(void 0===e&&(e=""),e)return e;var t=n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return"".concat("rad-ui","-").concat(t)}(v,"Accordion"),h=r(null),b=h[0],g=h[1];return e.createElement(s.Provider,{value:{rootClass:p,activeItem:b,setActiveItem:g,accordionRef:m,transitionDuration:c,transitionTimingFunction:f}},e.createElement(y.Root,{direction:a},e.createElement(y.Group,{className:d("".concat(p,"-root"))},e.createElement("div",{ref:m},o))))},D.Item=function(n){var a=n.children,c=n.value,u=n.className,m=void 0===u?"":u,p=v(n,["children","value","className"]),h=t(null),b=r(null!=c?c:0),g=b[0],y=b[1],I=l(s),E=I.rootClass,w=I.activeItem,A=I.transitionDuration,D=I.transitionTimingFunction,O=r(g===w),N=O[0],P=O[1];i((function(){P(g===w)}),[w]);var R=o();return e.createElement(C.Provider,{value:{itemValue:g,setItemValue:y}},e.createElement(F.Root,{open:N,transitionDuration:A,transitionTimingFunction:D,asChild:!0},e.createElement("div",f({ref:h,className:d("".concat(E,"-item"),m)},p,{id:"accordion-data-item-".concat(R),role:"region","data-state":N?"open":"closed"}),a)))},D.Header=function(n){var t=n.children,r=n.className,o=void 0===r?"":r,i=l(s).rootClass;return e.createElement("div",{className:d("".concat(i,"-header"),o)},t)},D.Trigger=function(n){var r=n.children,o=n.index,i=n.className,a=void 0===i?"":i,c=t(null),u=l(s),f=u.setActiveItem,v=u.rootClass,m=u.activeItem,h=l(C).itemValue;return e.createElement(y.Item,null,e.createElement(F.Trigger,{asChild:!0},e.createElement(p.button,{className:d("".concat(v,"-trigger"),a),ref:c,onClick:function(e){m===h?f(null):m!==h&&f(h)},"aria-expanded":m===h,"aria-controls":"content-".concat(o)},r)))},D.Content=function(n){var t=n.children,r=n.index,o=n.className,i=void 0===o?"":o,a=l(s),c=a.activeItem,u=a.rootClass,f=c===r;return l(C).itemValue!==c?null:e.createElement(F.Content,{asChild:!0,className:d("".concat(u,"-content"),i),id:"content-".concat(r),role:"region","aria-labelledby":"section-".concat(r),"aria-hidden":!f},t)};export{D as default};
|
|
1
|
+
'use client';import e,{createContext as n,useRef as t,useState as r,useId as i,useEffect as o,forwardRef as a,useContext as l,useCallback as c}from"react";function u(e){var n,t,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(n=0;n<i;n++)e[n]&&(t=u(e[n]))&&(r&&(r+=" "),r+=t)}else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function d(){for(var e,n,t=0,r="",i=arguments.length;t<i;t++)(e=arguments[t])&&(n=u(e))&&(r&&(r+=" "),r+=n);return r}var s=n({rootClass:"",activeItems:[],setActiveItems:function(){},accordionRef:void 0,transitionDuration:0,transitionTimingFunction:"ease-out",openMultiple:!1}),f=function(){return f=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var i in n=arguments[t])Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i]);return e},f.apply(this,arguments)};function v(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)n.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(t[r[i]]=e[r[i]])}return t}function m(e,n,t){if(t||2===arguments.length)for(var r,i=0,o=n.length;i<o;i++)!r&&i in n||(r||(r=Array.prototype.slice.call(n,0,i)),r[i]=n[i]);return e.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var p=["div","span","button","input"].reduce((function(n,t){return n[t]=function(n){var t=e.forwardRef((function(t,r){var i=t.asChild,o=void 0!==i&&i,a=t.children,l=v(t,["asChild","children"]);if(o){var c=e.Children.toArray(a);if(1!==c.length||!e.isValidElement(c[0]))return console.warn("Primitive.".concat(n,": asChild prop requires exactly one valid child element.")),e.createElement(n,f(f({},l),{ref:r}),a);var u=c[0];return e.cloneElement(u,f(f(f({},l),u.props),r?{ref:function(e){"function"==typeof r?r(e):r&&(r.current=e);var n=u.ref;"function"==typeof n?n(e):n&&(n.current=e)}}:{}))}return e.createElement(n,f(f({},l),{ref:r}),a)}));return t.displayName="Primitive.".concat(n),t}(t),n}),{}),h=n({orientation:"horizontal",loop:!0}),b=n({focusedItemId:null,setFocusedItemId:function(){},focusItems:[],setFocusItems:function(){},addFocusItem:function(){},groupRef:null}),g=a((function(n,t){var r,a=n.children,c=n["aria-label"],u=n["aria-labelledby"],d=v(n,["children","aria-label","aria-labelledby"]),s=i(),m=l(b),g=m.focusedItemId,C=m.setFocusedItemId,y=m.addFocusItem,I=m.focusItems,E=m.groupRef,w=l(h),A=w.orientation,F=w.loop,D=e.Children.toArray(a)[0],O=!0===(null===(r=null==D?void 0:D.props)||void 0===r?void 0:r.disabled),N=g===s;o((function(){I.includes(s)||y(s)}),[I,g,s,y]);var P=function(e){if(E&&E.current){C(e);var n=CSS.escape(e),t=E.current.querySelector("#".concat(n));t&&t.focus()}},R=function(e,n){for(var t,r=e,i=0;i<I.length;i++){if(r+=n,F)r<0&&(r=I.length-1),r>=I.length&&(r=0);else if(r<0||r>=I.length)return-1;var o=I[r],a=null===(t=null==E?void 0:E.current)||void 0===t?void 0:t.querySelector("#".concat(CSS.escape(o)));if(a)if(!("true"===a.getAttribute("data-child-disabled")))return r}return-1},T=function(){var e=I.indexOf(s),n=R(e,-1);-1!==n&&P(I[n])},x=function(){var e=I.indexOf(s),n=R(e,1);-1!==n&&P(I[n])};return e.createElement(p.button,f({asChild:!0,onFocus:function(e){e.preventDefault(),O||C(s)},tabIndex:!O&&N?0:-1,ref:t,id:s,onKeyDown:function(e){if(!O)switch(e.key){case"ArrowUp":e.preventDefault(),"vertical"===A&&T();break;case"ArrowLeft":e.preventDefault(),"horizontal"===A&&T();break;case"ArrowDown":e.preventDefault(),"vertical"===A&&x();break;case"ArrowRight":e.preventDefault(),"horizontal"===A&&x();break;case"Home":e.preventDefault(),function(){if(I.length>0){var e=R(-1,1);-1!==e&&P(I[e])}}();break;case"End":e.preventDefault(),function(){if(I.length>0){var e=R(I.length,-1);-1!==e&&P(I[e])}}()}},"data-child-disabled":O,role:"option","aria-selected":N,"aria-disabled":O,"aria-label":c,"aria-labelledby":u},d),a)}));g.displayName="RovingFocusItem";var C={Root:function(n){var t=n.children,r=n.orientation,i=void 0===r?"horizontal":r,o=n.loop,a=void 0===o||o,l=n["aria-label"],c=n["aria-labelledby"],u=v(n,["children","orientation","loop","aria-label","aria-labelledby"]),d={orientation:i,loop:a};return e.createElement(h.Provider,{value:d},e.createElement(p.div,f({role:"listbox","aria-orientation":i,"aria-label":l,"aria-labelledby":c},u),t))},Group:function(n){var a=n.children,l=n["aria-label"],c=n["aria-labelledby"],u=v(n,["children","aria-label","aria-labelledby"]),d=t(null),s=r([]),h=s[0],g=s[1],C=r(null),y=C[0],I=C[1],E=i();o((function(){!y&&h.length>0&&I(h[0])}),[h,y]);var w={focusedItemId:y,setFocusedItemId:I,focusItems:h,setFocusItems:g,addFocusItem:function(e){g((function(n){return m(m([],n,!0),[e],!1)}))},groupRef:d};return e.createElement(b.Provider,{value:w},e.createElement(p.div,f({id:E,ref:d,role:"group","aria-label":l,"aria-labelledby":c},u),a))},Item:g},y=n({itemValue:0,setItemValue:function(){},disabled:!1}),I=n(void 0),E=function(){var e=l(I);if(!e)throw new Error("Collapsible compound components must be used within a CollapsiblePrimitive.Root component");return e};var w=e.forwardRef((function(n,i){var a=n.children,l=n.className;n.asChild;var c=v(n,["children","className","asChild"]),u=E(),d=u.open,s=u.contentId,m=u.transitionDuration,h=u.transitionTimingFunction,b=t(null),g=i||b,C=r(d?void 0:0),y=C[0],I=C[1],w=r(d),A=w[0],F=w[1],D=t(),O=t();return o((function(){d&&F(!0)}),[d]),o((function(){if(D.current&&clearTimeout(D.current),O.current&&cancelAnimationFrame(O.current),b.current){if(0===m)return I(d?void 0:0),void(d||setTimeout((function(){return F(!1)}),0));if(d)I(0),O.current=requestAnimationFrame((function(){var e;null===(e=b.current)||void 0===e||e.offsetHeight,O.current=requestAnimationFrame((function(){if(b.current){var e=b.current.scrollHeight;I(e)}}))})),D.current=setTimeout((function(){I(void 0)}),m);else{var e=b.current.scrollHeight;I(e),O.current=requestAnimationFrame((function(){var e;null===(e=b.current)||void 0===e||e.offsetHeight,O.current=requestAnimationFrame((function(){I(0)}))})),D.current=setTimeout((function(){F(!1)}),m)}return function(){D.current&&clearTimeout(D.current),O.current&&cancelAnimationFrame(O.current)}}}),[d,m]),A||d?e.createElement(p.div,f({id:s,ref:g,"aria-hidden":!d,"data-state":d?"open":"closed",className:l,style:f({height:void 0!==y?"".concat(y,"px"):void 0,overflow:"hidden"},m>0?{transition:"height ".concat(m,"ms ").concat(h)}:{})},c),a):null}));w.displayName="CollapsiblePrimitiveContent";var A=e.forwardRef((function(n,t){var r=n.children,i=n.asChild,o=void 0!==i&&i,a=v(n,["children","asChild"]),l=E(),c=l.open,u=l.onOpenChange,d=l.disabled,s=l.contentId;return e.createElement(p.button,f({"aria-controls":s,"aria-expanded":c,"data-state":c?"open":"closed","data-disabled":d?"true":void 0,ref:t,onClick:function(e){var n;null===(n=a.onClick)||void 0===n||n.call(a,e),d||u(!c)},asChild:o},a),r)}));A.displayName="CollapsiblePrimitiveTrigger";var F=function(){return console.warn("Direct usage of CollapsiblePrimitive is not supported. Please use CollapsiblePrimitive.Root, CollapsiblePrimitive.Content, etc. instead."),null};F.Root=function(n){var a=n.children,l=n.defaultOpen,u=void 0!==l&&l,d=n.open,s=n.onOpenChange,m=n.disabled,h=void 0!==m&&m,b=n.transitionDuration,g=void 0===b?300:b,C=n.transitionTimingFunction,y=void 0===C?"linear":C,E=v(n,["children","defaultOpen","open","onOpenChange","disabled","transitionDuration","transitionTimingFunction"]),w=i(),A=function(e,n,i){var a=r(n),l=a[0],u=a[1],d=void 0!==e,s=d?e:l,f=t(d),v=t(e);o((function(){"production"!==process.env.NODE_ENV&&(f.current!==d&&console.warn("Component changed from ".concat(f.current?"controlled":"uncontrolled"," to ").concat(d?"controlled":"uncontrolled",".")),f.current=d)}),[d]),o((function(){"production"!==process.env.NODE_ENV&&d&&!i&&e!==v.current&&console.warn("A component is changing a controlled value without an onChange handler. This will render a controlled component as uncontrolled."),v.current=e}),[e,d,i]);var m=c((function(e){var n="function"==typeof e?e(s):e;d||u(n),i&&i(n)}),[d,i,s]);return[s,m]}(d,u,s),F=A[0],D=A[1];return e.createElement(I.Provider,{value:{open:F,onOpenChange:function(e){h||D(e)},disabled:h,contentId:w,transitionDuration:g,transitionTimingFunction:y}},e.createElement(p.div,f({},E,{"data-state":F?"open":"closed","data-disabled":h?"":void 0}),a))},F.Content=w,F.Trigger=A;var D=function(){return console.warn("Direct usage of Accordion is not supported. Please use Accordion.Root, Accordion.Item, etc. instead."),null};D.Root=function(n){var i=n.children,o=n.orientation,a=void 0===o?"vertical":o,l=n.asChild,c=n.transitionDuration,u=void 0===c?0:c,f=n.transitionTimingFunction,v=void 0===f?"linear":f,m=n.customRootClass,h=n.loop,b=void 0===h||h,g=n.openMultiple,y=void 0!==g&&g,I=t(null),E=function(e,n){if(void 0===e&&(e=""),e)return e;var t=n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return"".concat("rad-ui","-").concat(t)}(m,"Accordion"),w=r([]),A=w[0],F=w[1];return e.createElement(s.Provider,{value:{rootClass:E,activeItems:A,setActiveItems:F,accordionRef:I,transitionDuration:u,transitionTimingFunction:v,openMultiple:y}},e.createElement(C.Root,{orientation:a,loop:b},e.createElement(C.Group,null,e.createElement(p.div,{className:d("".concat(E,"-root")),ref:I,asChild:l},i))))},D.Item=function(n){var a=n.children,c=n.value,u=n.className,m=void 0===u?"":u,h=n.disabled,b=void 0!==h&&h;n.asChild;var g=v(n,["children","value","className","disabled","asChild"]),C=t(null),I=r(null!=c?c:0),E=I[0],w=I[1],A=l(s),D=A.rootClass,O=A.activeItems,N=A.transitionDuration,P=A.transitionTimingFunction,R=r(O.includes(E)),T=R[0],x=R[1];o((function(){x(O.includes(E))}),[O,E]);var S=i();return o((function(){void 0!==c&&c!==E&&w(c)}),[c]),e.createElement(y.Provider,{value:{itemValue:E,setItemValue:w,disabled:b}},e.createElement(F.Root,{open:T,disabled:b,transitionDuration:N,transitionTimingFunction:P,asChild:!0},e.createElement(p.div,f({ref:C,className:d("".concat(D,"-item"),m)},g,{id:"accordion-data-item-".concat(S),role:"region","data-state":T?"open":"closed"}),a)))},D.Header=function(n){var t=n.children,r=n.className,i=void 0===r?"":r,o=l(s).rootClass;return e.createElement("div",{className:d("".concat(o,"-header"),i)},t)},D.Trigger=function(n){var r=n.children,i=n.index,o=n.className,a=void 0===o?"":o,c=t(null),u=l(s),f=u.setActiveItems,v=u.rootClass,h=u.activeItems,b=u.openMultiple,g=l(y),I=g.itemValue,E=g.disabled;return e.createElement(C.Item,null,e.createElement(F.Trigger,{disabled:E,asChild:!0},e.createElement(p.button,{className:d("".concat(v,"-trigger"),a),ref:c,"aria-disabled":E,onClick:function(e){var n=h||[];b?n.includes(I)?f(n.filter((function(e){return e!==I}))):f(m(m([],n,!0),[I],!1)):n.includes(I)?f([]):f([I])},"aria-expanded":h.includes(I),"aria-controls":"content-".concat(i)},r)))},D.Content=function(n){var t=n.children,r=n.index,i=n.className,o=void 0===i?"":i,a=l(s),c=a.activeItems,u=a.rootClass,f=l(y).itemValue,v=c.includes(f);return v?e.createElement(F.Content,{asChild:!0,className:d("".concat(u,"-content"),o),id:"content-".concat(r),role:"region","aria-labelledby":"section-".concat(r),"aria-hidden":!v},t):null};export{D as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
'use client';import*as e from"react";import t,{createContext as n,useLayoutEffect as r,useEffect as o,useRef as i,useState as l,useContext as u}from"react";import{jsxs as c,jsx as s,Fragment as a}from"react/jsx-runtime";import*as f from"react-dom";var d=n({isOpen:!1,handleOpenChange:function(){},rootClass:"",handleOverlayClick:function(){}});function p(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=p(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function m(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=p(e))&&(r&&(r+=" "),r+=t);return r}function v(){return"undefined"!=typeof window}function h(e){return w(e)?(e.nodeName||"").toLowerCase():"#document"}function g(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function y(e){var t;return null==(t=(w(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function w(e){return!!v()&&(e instanceof Node||e instanceof g(e).Node)}function b(e){return!!v()&&(e instanceof Element||e instanceof g(e).Element)}function x(e){return!!v()&&(e instanceof HTMLElement||e instanceof g(e).HTMLElement)}function E(e){return!(!v()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof g(e).ShadowRoot)}function R(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=k(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function C(e){return["table","td","th"].includes(h(e))}function O(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function
|
|
1
|
+
'use client';import*as e from"react";import t,{createContext as n,useLayoutEffect as r,useEffect as o,useRef as i,useState as l,useContext as u}from"react";import{jsxs as c,jsx as s,Fragment as a}from"react/jsx-runtime";import*as f from"react-dom";var d=n({isOpen:!1,handleOpenChange:function(){},rootClass:"",handleOverlayClick:function(){}});function p(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=p(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function m(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=p(e))&&(r&&(r+=" "),r+=t);return r}function v(){return"undefined"!=typeof window}function h(e){return w(e)?(e.nodeName||"").toLowerCase():"#document"}function g(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function y(e){var t;return null==(t=(w(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function w(e){return!!v()&&(e instanceof Node||e instanceof g(e).Node)}function b(e){return!!v()&&(e instanceof Element||e instanceof g(e).Element)}function x(e){return!!v()&&(e instanceof HTMLElement||e instanceof g(e).HTMLElement)}function E(e){return!(!v()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof g(e).ShadowRoot)}function R(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=k(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function C(e){return["table","td","th"].includes(h(e))}function O(e){return[":popover-open",":modal"].some((t=>{try{return e.matches(t)}catch(e){return!1}}))}function L(e){const t=S(),n=b(e)?k(e):e;return["transform","translate","scale","rotate","perspective"].some((e=>!!n[e]&&"none"!==n[e]))||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||["transform","translate","scale","rotate","perspective","filter"].some((e=>(n.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(n.contain||"").includes(e)))}function S(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function A(e){return["html","body","#document"].includes(h(e))}function k(e){return g(e).getComputedStyle(e)}function T(e){return b(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function P(e){if("html"===h(e))return e;const t=e.assignedSlot||e.parentNode||E(e)&&e.host||y(e);return E(t)?t.host:t}function M(e){const t=P(e);return A(t)?e.ownerDocument?e.ownerDocument.body:e.body:x(t)&&R(t)?t:M(t)}function N(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);const o=M(e),i=o===(null==(r=e.ownerDocument)?void 0:r.body),l=g(o);if(i){const e=D(l);return t.concat(l,l.visualViewport||[],R(o)?o:[],e&&n?N(e):[])}return t.concat(o,N(o,[],n))}function D(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function I(e){let t=e.activeElement;for(;null!=(null==(n=t)||null==(n=n.shadowRoot)?void 0:n.activeElement);){var n;t=t.shadowRoot.activeElement}return t}function F(e,t){if(!e||!t)return!1;const n=null==t.getRootNode?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&E(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function W(){const e=navigator.userAgentData;return null!=e&&e.platform?e.platform:navigator.platform}function j(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map((e=>{let{brand:t,version:n}=e;return t+"/"+n})).join(" "):navigator.userAgent}function B(e){return!j().includes("jsdom/")&&(!V()&&0===e.width&&0===e.height||V()&&1===e.width&&1===e.height&&0===e.pressure&&0===e.detail&&"mouse"===e.pointerType||e.width<1&&e.height<1&&0===e.pressure&&0===e.detail&&"touch"===e.pointerType)}function H(){return/apple/i.test(navigator.vendor)}function V(){const e=/android/i;return e.test(W())||e.test(j())}function _(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}function q(e){return(null==e?void 0:e.ownerDocument)||document}function K(e,t){if(null==t)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return null!=n.target&&t.contains(n.target)}function X(e){return"composedPath"in e?e.composedPath()[0]:e.target}function U(e){return x(e)&&e.matches("input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])")}function Y(e){e.preventDefault(),e.stopPropagation()}const $=["top","right","bottom","left"],z=Math.min,Z=Math.max,G=Math.round,Q=e=>({x:e,y:e}),J={left:"right",right:"left",bottom:"top",top:"bottom"},ee={start:"end",end:"start"};function te(e,t,n){return Z(e,z(t,n))}function ne(e,t){return"function"==typeof e?e(t):e}function re(e){return e.split("-")[0]}function oe(e){return e.split("-")[1]}function ie(e){return"x"===e?"y":"x"}function le(e){return"y"===e?"height":"width"}function ue(e){return["top","bottom"].includes(re(e))?"y":"x"}function ce(e){return ie(ue(e))}function se(e){return e.replace(/start|end/g,(e=>ee[e]))}function ae(e){return e.replace(/left|right|bottom|top/g,(e=>J[e]))}function fe(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}function de(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}
|
|
2
2
|
/*!
|
|
3
3
|
* tabbable 6.2.0
|
|
4
4
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
5
|
-
*/var de=["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(","),pe="undefined"==typeof Element,me=pe?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ve=!pe&&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},he=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)},ge=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var l=i.shift();if(!he(l,!1))if("SLOT"===l.tagName){var u=l.assignedElements(),c=e(u.length?u:l.children,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:l,candidates:c})}else{me.call(l,de)&&r.filter(l)&&(n||!t.includes(l))&&o.push(l);var s=l.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(l),a=!he(s,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(s&&a){var f=e(!0===s?l.children:s.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},ye=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},we=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))&&!ye(e)?0:e.tabIndex},be=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},xe=function(e){return"INPUT"===e.tagName},Ee=function(e){return function(e){return xe(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||ve(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)},Re=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Ce=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=me.call(e,"details>summary:first-of-type")?e.parentElement:e;if(me.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Re(e)}else{if("function"==typeof r){for(var i=e;e;){var l=e.parentElement,u=ve(e);if(l&&!l.shadowRoot&&!0===r(l))return Re(e);e=e.assignedSlot?e.assignedSlot:l||u===e.ownerDocument?l:u.host}e=i}if(function(e){var t,n,r,o,i=e&&ve(e),l=null===(t=i)||void 0===t?void 0:t.host,u=!1;if(i&&i!==e)for(u=!!(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));!u&&l;){var c,s,a;u=!(null===(s=l=null===(c=i=ve(l))||void 0===c?void 0:c.host)||void 0===s||null===(a=s.ownerDocument)||void 0===a||!a.contains(l))}return u}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Oe=function(e,t){return!(t.disabled||he(t)||function(e){return xe(e)&&"hidden"===e.type}(t)||Ce(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!!me.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Se=function(e,t){return!(Ee(t)||we(t)<0||!Oe(e,t))},Le=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},Ae=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,l=i?t.scopeParent:t,u=function(e,t){var n=we(e);return n<0&&t&&!ye(e)?0:n}(l,i),c=i?e(t.candidates):l;0===u?i?n.push.apply(n,c):n.push(l):r.push({documentOrder:o,tabIndex:u,item:t,isScope:i,content:c})})),r.sort(be).reduce((function(e,t){return t.isScope?e.push.apply(e,t.content):e.push(t.content),e}),[]).concat(n)},ke=function(e,t){var n;return n=(t=t||{}).getShadowRoot?ge([e],t.includeContainer,{filter:Se.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Le}):function(e,t,n){if(he(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(de));return t&&me.call(e,de)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,Se.bind(null,t)),Ae(n)};function Te(e,t,n){let{reference:r,floating:o}=e;const i=le(t),l=ue(t),u=ie(l),c=ne(t),s="y"===i,a=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[u]/2-o[u]/2;let p;switch(c){case"top":p={x:a,y:r.y-o.height};break;case"bottom":p={x:a,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(re(t)){case"start":p[l]-=d*(n&&s?-1:1);break;case"end":p[l]+=d*(n&&s?-1:1)}return p}async function Pe(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:l,elements:u,strategy:c}=e,{boundary:s="clippingAncestors",rootBoundary:a="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=te(t,e),m=ae(p),v=u[d?"floating"===f?"reference":"floating":f],h=fe(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(u.floating)),boundary:s,rootBoundary:a,strategy:c})),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(u.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=fe(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:g,offsetParent:y,strategy:c}):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 Me(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ne(e){return Y.some((t=>e[t]>=0))}function De(e){const t=k(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=x(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,u=Z(n)!==i||Z(r)!==l;return u&&(n=i,r=l),{width:n,height:r,$:u}}function Ie(e){return b(e)?e:e.contextElement}function Fe(e){const t=Ie(e);if(!x(t))return G(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=De(t);let l=(i?Z(n.width):n.width)/r,u=(i?Z(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),u&&Number.isFinite(u)||(u=1),{x:l,y:u}}const We=G(0);function je(e){const t=g(e);return L()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:We}function Be(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=Ie(e);let l=G(1);t&&(r?b(r)&&(l=Fe(r)):l=Fe(e));const u=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==g(e))&&t}(i,n,r)?je(i):G(0);let c=(o.left+u.x)/l.x,s=(o.top+u.y)/l.y,a=o.width/l.x,f=o.height/l.y;if(i){const e=g(i),t=r&&b(r)?g(r):r;let n=e,o=D(n);for(;o&&r&&t!==n;){const e=Fe(o),t=o.getBoundingClientRect(),r=k(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,l=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,s*=e.y,a*=e.x,f*=e.y,c+=i,s+=l,n=g(o),o=D(n)}}return fe({width:a,height:f,x:c,y:s})}function He(e,t){const n=T(e).scrollLeft;return t?t.left+n:Be(y(e)).left+n}function Ve(e,t,n){void 0===n&&(n=!1);const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:He(e,r)),y:r.top+t.scrollTop}}function _e(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=g(e),r=y(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,u=0,c=0;if(o){i=o.width,l=o.height;const e=L();(!e||e&&"fixed"===t)&&(u=o.offsetLeft,c=o.offsetTop)}return{width:i,height:l,x:u,y:c}}(e,n);else if("document"===t)r=function(e){const t=y(e),n=T(e),r=e.ownerDocument.body,o=z(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=z(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+He(e);const u=-n.scrollTop;return"rtl"===k(r).direction&&(l+=z(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:u}}(y(e));else if(b(t))r=function(e,t){const n=Be(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=x(e)?Fe(e):G(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=je(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return fe(r)}function qe(e,t){const n=P(e);return!(n===t||!b(n)||A(n))&&("fixed"===k(n).position||qe(n,t))}function Ke(e,t,n){const r=x(t),o=y(t),i="fixed"===n,l=Be(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const c=G(0);if(r||!r&&!i)if(("body"!==h(t)||R(o))&&(u=T(t)),r){const e=Be(t,!0,i,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else o&&(c.x=He(o));const s=!o||r||i?G(0):Ve(o,u);return{x:l.left+u.scrollLeft-c.x-s.x,y:l.top+u.scrollTop-c.y-s.y,width:l.width,height:l.height}}function Xe(e){return"static"===k(e).position}function Ue(e,t){if(!x(e)||"fixed"===k(e).position)return null;if(t)return t(e);let n=e.offsetParent;return y(e)===n&&(n=n.ownerDocument.body),n}function Ye(e,t){const n=g(e);if(O(e))return n;if(!x(e)){let t=P(e);for(;t&&!A(t);){if(b(t)&&!Xe(t))return t;t=P(t)}return n}let r=Ue(e,t);for(;r&&C(r)&&Xe(r);)r=Ue(r,t);return r&&A(r)&&Xe(r)&&!S(r)?n:r||function(e){let t=P(e);for(;x(t)&&!A(t);){if(S(t))return t;if(O(t))return null;t=P(t)}return null}(e)||n}const $e={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,l=y(r),u=!!t&&O(t.floating);if(r===l||u&&i)return n;let c={scrollLeft:0,scrollTop:0},s=G(1);const a=G(0),f=x(r);if((f||!f&&!i)&&(("body"!==h(r)||R(l))&&(c=T(r)),x(r))){const e=Be(r);s=Fe(r),a.x=e.x+r.clientLeft,a.y=e.y+r.clientTop}const d=!l||f||i?G(0):Ve(l,c,!0);return{width:n.width*s.x,height:n.height*s.y,x:n.x*s.x-c.scrollLeft*s.x+a.x+d.x,y:n.y*s.y-c.scrollTop*s.y+a.y+d.y}},getDocumentElement:y,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?O(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=N(e,[],!1).filter((e=>b(e)&&"body"!==h(e))),o=null;const i="fixed"===k(e).position;let l=i?P(e):e;for(;b(l)&&!A(l);){const t=k(l),n=S(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||R(l)&&!n&&qe(e,l))?r=r.filter((e=>e!==l)):o=t,l=P(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],u=i.reduce(((e,n)=>{const r=_e(t,n,o);return e.top=z(r.top,e.top),e.right=$(r.right,e.right),e.bottom=$(r.bottom,e.bottom),e.left=z(r.left,e.left),e}),_e(t,l,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}},getOffsetParent:Ye,getElementRects:async function(e){const t=this.getOffsetParent||Ye,n=this.getDimensions,r=await n(e.floating);return{reference:Ke(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}=De(e);return{width:t,height:n}},getScale:Fe,isElement:b,isRTL:function(e){return"rtl"===k(e).direction}},ze=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:u}=t,c=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=ne(n),u=re(n),c="y"===le(n),s=["left","top"].includes(l)?-1:1,a=i&&c?-1:1,f=te(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 u&&"number"==typeof m&&(p="end"===u?-1*m:m),c?{x:p*a,y:d*s}:{x:d*s,y:p*a}}(t,e);return l===(null==(n=u.offset)?void 0:n.placement)&&null!=(r=u.arrow)&&r.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:l}}}}},Ze=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:u={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=te(e,t),s={x:n,y:r},a=await Pe(t,c),f=le(ne(o)),d=oe(f);let p=s[d],m=s[f];if(i){const e="y"===d?"bottom":"right";p=ee(p+a["y"===d?"top":"left"],p,p-a[e])}if(l){const e="y"===f?"bottom":"right";m=ee(m+a["y"===f?"top":"left"],m,m-a[e])}const v=u.fn({...t,[d]:p,[f]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[d]:i,[f]:l}}}}}},Ge=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:u,platform:c,elements:s}=t,{mainAxis:a=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...h}=te(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const g=ne(o),y=le(u),w=ne(u)===u,b=await(null==c.isRTL?void 0:c.isRTL(s.floating)),x=d||(w||!v?[se(u)]:function(e){const t=se(e);return[ce(e),t,ce(t)]}(u)),E="none"!==m;!d&&E&&x.push(...function(e,t,n,r){const o=re(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[]}}(ne(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(ce)))),i}(u,v,m,b));const R=[u,...x],C=await Pe(t,h),O=[];let S=(null==(r=i.flip)?void 0:r.overflows)||[];if(a&&O.push(C[g]),f){const e=function(e,t,n){void 0===n&&(n=!1);const r=re(e),o=ue(e),i=ie(o);let l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=se(l)),[l,se(l)]}(o,l,b);O.push(C[e[0]],C[e[1]])}if(S=[...S,{placement:o,overflows:O}],!O.every((e=>e<=0))){var L,A;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==(A=S.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:A.placement;if(!n)switch(p){case"bestFit":{var k;const e=null==(k=S.filter((e=>{if(E){const t=le(e.placement);return t===y||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:k[0];e&&(n=e);break}case"initialPlacement":n=u}if(o!==n)return{reset:{placement:n}}}return{}}}},Qe=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=te(e,t);switch(r){case"referenceHidden":{const e=Me(await Pe(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ne(e)}}}case"escaped":{const e=Me(await Pe(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ne(e)}}}default:return{}}}}},Je=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:l,elements:u,middlewareData:c}=t,{element:s,padding:a=0}=te(e,t)||{};if(null==s)return{};const f=ae(a),d={x:n,y:r},p=ue(o),m=ie(p),v=await l.getDimensions(s),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(s));let R=E?E[w]:0;R&&await(null==l.isElement?void 0:l.isElement(E))||(R=u.floating[w]||i.floating[m]);const C=b/2-x/2,O=R/2-v[m]/2-1,S=$(f[g],O),L=$(f[y],O),A=S,k=R-v[m]-L,T=R/2-v[m]/2+C,P=ee(A,T,k),M=!c.arrow&&null!=re(o)&&T!==P&&i.reference[m]/2-(T<A?S:L)-v[m]/2<0,N=M?T<A?T-A:T-k:0;return{[p]:d[p]+N,data:{[p]:P,centerOffset:T-P-N,...M&&{alignmentOffset:N}},reset:M}}}),et=(e,t,n)=>{const r=new Map,o={platform:$e,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,u=i.filter(Boolean),c=await(null==l.isRTL?void 0:l.isRTL(t));let s=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:a,y:f}=Te(s,r,c),d=r,p={},m=0;for(let n=0;n<u.length;n++){const{name:i,fn:v}=u[n],{x:h,y:g,data:y,reset:w}=await v({x:a,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:s,platform:l,elements:{reference:e,floating:t}});a=null!=h?h:a,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&&(s=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:a,y:f}=Te(s,d,c))),n=-1)}return{x:a,y:f,placement:d,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var tt="undefined"!=typeof document?r:o;function nt(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(!nt(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)&&!nt(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function rt(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ot(e,t){const n=rt(e);return Math.round(t*n)/n}function it(t){const n=e.useRef(t);return tt((()=>{n.current=t})),n}const lt=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?Je({element:n.current,padding:r}).fn(t):{}:n?Je({element:n,padding:r}).fn(t):{};var o}});function ut(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 ct={...e},st=ct.useInsertionEffect||(e=>e());function at(t){const n=e.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return st((()=>{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 ft="undefined"!=typeof document?r:o;let dt=!1,pt=0;const mt=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+pt++;const vt=ct.useId||function(){const[t,n]=e.useState((()=>dt?mt():void 0));return ft((()=>{null==t&&n(mt())}),[]),e.useEffect((()=>{dt=!0}),[]),t};let ht;"production"!==process.env.NODE_ENV&&(ht=new Set);const gt=e.forwardRef((function(t,n){const{context:{placement:r,elements:{floating:o},middlewareData:{arrow:i,shift:l}},width:u=14,height:a=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=ht)&&e.has(o)||(null==(i=ht)||i.add(o),console.warn(o))}("The `ref` prop is required for `FloatingArrow`."));const w=vt(),[b,x]=e.useState(!1);if(ft((()=>{if(!o)return;"rtl"===k(o).direction&&x(!0)}),[o]),!o)return null;const[E,R]=r.split("-"),C="top"===E||"bottom"===E;let O=p;(C&&null!=l&&l.x||!C&&null!=l&&l.y)&&(O=null);const S=2*d,L=S/2,A=u/2*(f/-8+1),T=a/2*f/4,P=!!v,M=O&&"end"===R?"bottom":"top";let N=O&&"end"===R?"right":"left";O&&b&&(N="end"===R?"left":"right");const D=null!=(null==i?void 0:i.x)?O||i.x:"",I=null!=(null==i?void 0:i.y)?O||i.y:"",F=v||"M0,0 H"+u+" L"+(u-A)+","+(a-T)+" Q"+u/2+","+a+" "+A+","+(a-T)+" Z",W={top:P?"rotate(180deg)":"",left:P?"rotate(90deg)":"rotate(-90deg)",bottom:P?"":"rotate(180deg)",right:P?"rotate(-90deg)":"rotate(90deg)"}[E];return c("svg",{...y,"aria-hidden":!0,ref:n,width:P?u:u+S,height:u,viewBox:"0 0 "+u+" "+(a>u?a:u),style:{position:"absolute",pointerEvents:"none",[N]:D,[M]:I,[E]:C||P?"100%":"calc(100% - "+S/2+"px)",transform:[W,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:-L,y:L*(P?-1:1),width:u+S,height:u})})]})}));const yt=e.createContext(null),wt=e.createContext(null),bt=()=>{var t;return(null==(t=e.useContext(yt))?void 0:t.id)||null},xt=()=>e.useContext(wt);function Et(e){return"data-floating-ui-"+e}function Rt(e){const t=i(e);return ft((()=>{t.current=e})),t}const Ct=Et("safe-polygon");function Ot(e,t,n){return n&&!V(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}let St=0;function Lt(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(St);const i=()=>null==e?void 0:e.focus({preventScroll:n});o?i():St=requestAnimationFrame(i)}function At(e,t){var n;let r=[],o=null==(n=e.find((e=>e.id===t)))?void 0:n.parentId;for(;o;){const t=e.find((e=>e.id===o));o=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}function kt(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}let Tt=new WeakMap,Pt=new WeakSet,Mt={},Nt=0;const Dt=e=>e&&(e.host||Dt(e.parentNode));function It(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,l=(u=t,e.map((e=>{if(u.contains(e))return e;const t=Dt(e);return u.contains(t)?t:null})).filter((e=>null!=e)));var u;const c=new Set,s=new Set(l),a=[];Mt[o]||(Mt[o]=new WeakMap);const f=Mt[o];return l.forEach((function e(t){if(!t||c.has(t))return;c.add(t),t.parentNode&&e(t.parentNode)})),function e(t){if(!t||s.has(t))return;[].forEach.call(t.children,(t=>{if("script"!==h(t))if(c.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=Tt.get(t)||0,l=i?r+1:r,u=(f.get(t)||0)+1;Tt.set(t,l),f.set(t,u),a.push(t),1===l&&n&&Pt.add(t),1===u&&t.setAttribute(o,""),!n&&i&&t.setAttribute(i,"true")}}))}(t),c.clear(),Nt++,()=>{a.forEach((e=>{const t=Tt.get(e)||0,n=i?t-1:t,r=(f.get(e)||0)-1;Tt.set(e,n),f.set(e,r),n||(!Pt.has(e)&&i&&e.removeAttribute(i),Pt.delete(e)),r||e.removeAttribute(o)})),Nt--,Nt||(Tt=new WeakMap,Tt=new WeakMap,Pt=new WeakSet,Mt={})}}function Ft(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=_(e[0]).body;return It(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const Wt=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function jt(e,t){const n=ke(e,Wt());"prev"===t&&n.reverse();const r=n.indexOf(I(_(e)));return n.slice(r+1)[0]}function Bt(){return jt(document.body,"next")}function Ht(){return jt(document.body,"prev")}function Vt(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!F(n,r)}function _t(e){ke(e,Wt()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function qt(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 Kt={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 Xt(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const Ut=e.forwardRef((function(t,n){const[r,o]=e.useState();ft((()=>(/apple/i.test(navigator.vendor)&&o("button"),document.addEventListener("keydown",Xt),()=>{document.removeEventListener("keydown",Xt)})),[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":!r||void 0,[Et("focus-guard")]:"",style:Kt};return s("span",{...t,...i})})),Yt=e.createContext(null),$t=Et("portal");const zt=()=>e.useContext(Yt),Zt="data-floating-ui-focusable";function Gt(e){return e?e.hasAttribute(Zt)?e:e.querySelector("["+Zt+"]")||e:null}let Qt=[];function Jt(e){Qt=Qt.filter((e=>e.isConnected)),e&&"body"!==h(e)&&(Qt.push(e),Qt.length>20&&(Qt=Qt.slice(-20)))}function en(){return Qt.slice().reverse().find((e=>e.isConnected))}function tn(e){const t=Wt();return function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==me.call(e,de)&&Se(t,e)}(e,t)?e:ke(e,t)[0]||e}const nn=e.forwardRef((function(e,t){return s("button",{...e,type:"button",ref:t,tabIndex:-1,style:Kt})}));let rn=0;let on=()=>{};const ln=e.forwardRef((function(e,t){const{lockScroll:n=!1,...r}=e;return ft((()=>{if(n)return rn++,1===rn&&(on=function(){const e=/iP(hone|ad|od)|iOS/.test(W()),t=document.body.style,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",r=window.innerWidth-document.documentElement.clientWidth,o=t.left?parseFloat(t.left):window.scrollX,i=t.top?parseFloat(t.top):window.scrollY;if(t.overflow="hidden",r&&(t[n]=r+"px"),e){var l,u;const e=(null==(l=window.visualViewport)?void 0:l.offsetLeft)||0,n=(null==(u=window.visualViewport)?void 0:u.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(i-Math.floor(n))+"px",left:-(o-Math.floor(e))+"px",right:"0"})}return()=>{Object.assign(t,{overflow:"",[n]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(o,i))}}()),()=>{rn--,0===rn&&on()}}),[n]),s("div",{ref:t,...r,style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}})})),un={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},cn={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},sn=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 an(t){const{open:n=!1,onOpenChange:r,elements:o}=t,i=vt(),l=e.useRef({}),[u]=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)))||[])}}}())),c=null!=bt();if("production"!==process.env.NODE_ENV){const e=o.reference;e&&!b(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=ht)&&e.has(o)||(null==(i=ht)||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[s,a]=e.useState(o.reference),f=at(((e,t,n)=>{l.current.openEvent=e?t:void 0,u.emit("openchange",{open:e,event:t,reason:n,nested:c}),null==r||r(e,t,n)})),d=e.useMemo((()=>({setPositionReference:a})),[]),p=e.useMemo((()=>({reference:s||o.reference||null,floating:o.floating||null,domReference:o.reference})),[s,o.reference,o.floating]);return e.useMemo((()=>({dataRef:l,open:n,onOpenChange:f,elements:p,events:u,floatingId:i,refs:d})),[n,f,p,u,i,d])}const fn="active",dn="selected";function pn(e,t,n){const r=new Map,o="item"===n;let i=e;if(o&&e){const{[fn]:t,[dn]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1,[Zt]:""},...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&&[fn,dn].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 mn=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);var vn={Portal:function(t){const{children:n,id:r,root:o,preserveTabOrder:i=!0}=t,l=function(t){void 0===t&&(t={});const{id:n,root:r}=t,o=vt(),i=zt(),[l,u]=e.useState(null),c=e.useRef(null);return ft((()=>()=>{null==l||l.remove(),queueMicrotask((()=>{c.current=null}))}),[l]),ft((()=>{if(!o)return;if(c.current)return;const e=n?document.getElementById(n):null;if(!e)return;const t=document.createElement("div");t.id=o,t.setAttribute($t,""),e.appendChild(t),c.current=t,u(t)}),[n,o]),ft((()=>{if(null===r)return;if(!o)return;if(c.current)return;let e=r||(null==i?void 0:i.portalNode);e&&!b(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($t,""),e=t||e,e.appendChild(l),c.current=l,u(l)}),[n,r,o,i]),l}({id:r,root:o}),[u,a]=e.useState(null),d=e.useRef(null),p=e.useRef(null),m=e.useRef(null),v=e.useRef(null),h=null==u?void 0:u.modal,g=null==u?void 0:u.open,y=!!u&&!u.modal&&u.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&&Vt(e)){("focusin"===e.type?qt:_t)(l)}}}),[l,i,h]),e.useEffect((()=>{l&&(g||qt(l))}),[g,l]),c(Yt.Provider,{value:e.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:d,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:v,portalNode:l,setFocusManagerState:a})),[i,l]),children:[y&&l&&s(Ut,{"data-type":"outside",ref:d,onFocus:e=>{if(Vt(e,l)){var t;null==(t=m.current)||t.focus()}else{const e=Ht()||(null==u?void 0:u.domReference);null==e||e.focus()}}}),y&&l&&s("span",{"aria-owns":l.id,style:Kt}),l&&f.createPortal(n,l),y&&l&&s(Ut,{"data-type":"outside",ref:p,onFocus:e=>{if(Vt(e,l)){var t;null==(t=v.current)||t.focus()}else{const t=Bt()||(null==u?void 0:u.domReference);null==t||t.focus(),(null==u?void 0:u.closeOnFocusOut)&&(null==u||u.onOpenChange(!1,e.nativeEvent,"focus-out"))}}})]})},Overlay:ln,FocusManager:function(t){const{context:n,children:r,disabled:o=!1,order:i=["content"],guards:l=!0,initialFocus:u=0,returnFocus:f=!0,restoreFocus:d=!1,modal:p=!0,visuallyHiddenDismiss:m=!1,closeOnFocusOut:v=!0,outsideElementsInert:h=!1}=t,{open:g,onOpenChange:y,events:w,dataRef:b,elements:{domReference:E,floating:R}}=n,C=at((()=>{var e;return null==(e=b.current.floatingContext)?void 0:e.nodeId})),O="number"==typeof u&&u<0,S=U(E)&&O,L="undefined"!=typeof HTMLElement&&"inert"in HTMLElement.prototype,A=!L||l,k=!A||L&&h,T=Rt(i),P=Rt(u),M=Rt(f),N=xt(),D=zt(),W=e.useRef(null),j=e.useRef(null),V=e.useRef(!1),q=e.useRef(!1),Y=e.useRef(-1),$=null!=D,z=Gt(R),Z=at((function(e){return void 0===e&&(e=z),e?ke(e,Wt()):[]})),G=at((e=>{const t=Z(e);return T.current.map((e=>E&&"reference"===e?E:z&&"floating"===e?z:t)).filter(Boolean).flat()}));e.useEffect((()=>{if(o)return;if(!p)return;function e(e){if("Tab"===e.key){F(z,I(_(z)))&&0===Z().length&&!S&&X(e);const t=G(),n=K(e);"reference"===T.current[0]&&n===E&&(X(e),e.shiftKey?Lt(t[t.length-1]):Lt(t[1])),"floating"===T.current[1]&&n===z&&e.shiftKey&&(X(e),Lt(t[0]))}}const t=_(z);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[o,E,z,p,T,S,Z,G]),e.useEffect((()=>{if(!o&&R)return R.addEventListener("focusin",e),()=>{R.removeEventListener("focusin",e)};function e(e){const t=K(e),n=Z().indexOf(t);-1!==n&&(Y.current=n)}}),[o,R,Z]),e.useEffect((()=>{if(!o&&v)return R&&x(E)?(E.addEventListener("focusout",t),E.addEventListener("pointerdown",e),R.addEventListener("focusout",t),()=>{E.removeEventListener("focusout",t),E.removeEventListener("pointerdown",e),R.removeEventListener("focusout",t)}):void 0;function e(){q.current=!0,setTimeout((()=>{q.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const n=C(),r=!(F(E,t)||F(R,t)||F(t,R)||F(null==D?void 0:D.portalNode,t)||null!=t&&t.hasAttribute(Et("focus-guard"))||N&&(kt(N.nodesRef.current,n).find((e=>{var n,r;return F(null==(n=e.context)?void 0:n.elements.floating,t)||F(null==(r=e.context)?void 0:r.elements.domReference,t)}))||At(N.nodesRef.current,n).find((e=>{var n,r,o;return[null==(n=e.context)?void 0:n.elements.floating,Gt(null==(r=e.context)?void 0:r.elements.floating)].includes(t)||(null==(o=e.context)?void 0:o.elements.domReference)===t}))));if(d&&r&&I(_(z))===_(z).body){x(z)&&z.focus();const e=Y.current,t=Z(),n=t[e]||t[t.length-1]||z;x(n)&&n.focus()}!S&&p||!t||!r||q.current||t===en()||(V.current=!0,y(!1,e,"focus-out"))}))}}),[o,E,R,z,p,N,D,y,v,d,Z,S,C]);const Q=e.useRef(null),J=e.useRef(null),ee=ut([Q,null==D?void 0:D.beforeInsideRef]),te=ut([J,null==D?void 0:D.afterInsideRef]);function ne(e){return!o&&m&&p?s(nn,{ref:"start"===e?W:j,onClick:e=>y(!1,e.nativeEvent),children:"string"==typeof m?m:"Dismiss"}):null}e.useEffect((()=>{var e;if(o)return;if(!R)return;const t=Array.from((null==D||null==(e=D.portalNode)?void 0:e.querySelectorAll("["+Et("portal")+"]"))||[]),n=N&&!p?At(null==N?void 0:N.nodesRef.current,C()).map((e=>{var t;return null==(t=e.context)?void 0:t.elements.floating})):[],r=[R,...t,...n,W.current,j.current,Q.current,J.current,null==D?void 0:D.beforeOutsideRef.current,null==D?void 0:D.afterOutsideRef.current,T.current.includes("reference")||S?E:null].filter((e=>null!=e)),i=p||S?Ft(r,!k,k):Ft(r);return()=>{i()}}),[o,E,R,p,T,D,S,A,k,N,C]),ft((()=>{if(o||!x(z))return;const e=I(_(z));queueMicrotask((()=>{const t=G(z),n=P.current,r=("number"==typeof n?t[n]:n.current)||z,o=F(z,e);O||o||!g||Lt(r,{preventScroll:r===z})}))}),[o,g,z,O,G,P]),ft((()=>{if(o||!z)return;let e=!1;const t=_(z),n=I(t);let r=b.current.openEvent;function i(t){let{open:n,reason:o,event:i,nested:l}=t;n&&(r=i),"escape-key"===o&&E&&Jt(E),["hover","safe-polygon"].includes(o)&&"mouseleave"===i.type&&(V.current=!0),"outside-press"===o&&(l?(V.current=!1,e=!0):V.current=!(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(H()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(i)||B(i)))}Jt(n),w.on("openchange",i);const l=t.createElement("span");return l.setAttribute("tabindex","-1"),l.setAttribute("aria-hidden","true"),Object.assign(l.style,Kt),$&&E&&E.insertAdjacentElement("afterend",l),()=>{w.off("openchange",i);const n=I(t),o=F(R,n)||N&&kt(N.nodesRef.current,C()).some((e=>{var t;return F(null==(t=e.context)?void 0:t.elements.floating,n)}));(o||r&&["click","mousedown"].includes(r.type))&&E&&Jt(E);const u="boolean"==typeof M.current?en()||l:M.current.current||l;queueMicrotask((()=>{const r=tn(u);M.current&&!V.current&&x(r)&&(r===n||n===t.body||o)&&r.focus({preventScroll:e}),l.remove()}))}}),[o,R,z,M,b,w,N,$,E,C]),e.useEffect((()=>{queueMicrotask((()=>{V.current=!1}))}),[o]),ft((()=>{if(!o&&D)return D.setFocusManagerState({modal:p,closeOnFocusOut:v,open:g,onOpenChange:y,domReference:E}),()=>{D.setFocusManagerState(null)}}),[o,D,p,g,y,v,E]),ft((()=>{if(o)return;if(!z)return;if("function"!=typeof MutationObserver)return;if(O)return;const e=()=>{const e=z.getAttribute("tabindex"),t=Z(),n=I(_(R)),r=t.indexOf(n);-1!==r&&(Y.current=r),T.current.includes("floating")||n!==E&&0===t.length?"0"!==e&&z.setAttribute("tabindex","0"):"-1"!==e&&z.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(z,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}}),[o,R,z,E,T,Z,O]);const re=!o&&A&&(!p||!S)&&($||p);return c(a,{children:[re&&s(Ut,{"data-type":"inside",ref:ee,onFocus:e=>{if(p){const e=G();Lt("reference"===i[0]?e[0]:e[e.length-1])}else if(null!=D&&D.preserveTabOrder&&D.portalNode)if(V.current=!1,Vt(e,D.portalNode)){const e=Bt()||E;null==e||e.focus()}else{var t;null==(t=D.beforeOutsideRef.current)||t.focus()}}}),!S&&ne("start"),r,ne("end"),re&&s(Ut,{"data-type":"inside",ref:te,onFocus:e=>{if(p)Lt(G()[0]);else if(null!=D&&D.preserveTabOrder&&D.portalNode)if(v&&(V.current=!0),Vt(e,D.portalNode)){const e=Ht()||E;null==e||e.focus()}else{var t;null==(t=D.afterOutsideRef.current)||t.focus()}}})]})},useFloating:function(t){void 0===t&&(t={});const{nodeId:n}=t,r=an({...t,elements:{reference:null,floating:null,...t.elements}}),o=t.rootContext||r,i=o.elements,[l,u]=e.useState(null),[c,s]=e.useState(null),a=(null==i?void 0:i.domReference)||l,d=e.useRef(null),p=xt();ft((()=>{a&&(d.current=a)}),[a]);const m=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:l,floating:u}={},transform:c=!0,whileElementsMounted:s,open:a}=t,[d,p]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[m,v]=e.useState(o);nt(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!==O.current&&(O.current=e,w(e))}),[]),E=l||h,R=u||y,C=e.useRef(null),O=e.useRef(null),S=e.useRef(d),L=null!=s,A=it(s),k=it(i),T=it(a),P=e.useCallback((()=>{if(!C.current||!O.current)return;const e={placement:n,strategy:r,middleware:m};k.current&&(e.platform=k.current),et(C.current,O.current,e).then((e=>{const t={...e,isPositioned:!1!==T.current};M.current&&!nt(S.current,t)&&(S.current=t,f.flushSync((()=>{p(t)})))}))}),[m,n,r,k,T]);tt((()=>{!1===a&&S.current.isPositioned&&(S.current.isPositioned=!1,p((e=>({...e,isPositioned:!1}))))}),[a]);const M=e.useRef(!1);tt((()=>(M.current=!0,()=>{M.current=!1})),[]),tt((()=>{if(E&&(C.current=E),R&&(O.current=R),E&&R){if(A.current)return A.current(E,R,P);P()}}),[E,R,P,A,L]);const N=e.useMemo((()=>({reference:C,floating:O,setReference:b,setFloating:x})),[b,x]),D=e.useMemo((()=>({reference:E,floating:R})),[E,R]),I=e.useMemo((()=>{const e={position:r,left:0,top:0};if(!D.floating)return e;const t=ot(D.floating,d.x),n=ot(D.floating,d.y);return c?{...e,transform:"translate("+t+"px, "+n+"px)",...rt(D.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,c,D.floating,d.x,d.y]);return e.useMemo((()=>({...d,update:P,refs:N,elements:D,floatingStyles:I})),[d,P,N,D,I])}({...t,elements:{...i,...c&&{reference:c}}}),v=e.useCallback((e=>{const t=b(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;s(t),m.refs.setReference(t)}),[m.refs]),h=e.useCallback((e=>{(b(e)||null===e)&&(d.current=e,u(e)),(b(m.refs.reference.current)||null===m.refs.reference.current||null!==e&&!b(e))&&m.refs.setReference(e)}),[m.refs]),g=e.useMemo((()=>({...m.refs,setReference:h,setPositionReference:v,domReference:d})),[m.refs,h,v]),y=e.useMemo((()=>({...m.elements,domReference:a})),[m.elements,a]),w=e.useMemo((()=>({...m,...o,refs:g,elements:y,nodeId:n})),[m,g,y,n,o]);return ft((()=>{o.dataRef.current.floatingContext=w;const e=null==p?void 0:p.nodesRef.current.find((e=>e.id===n));e&&(e.context=w)})),e.useMemo((()=>({...m,context:w,refs:g,elements:y})),[m,g,y,w])},Arrow:gt,arrow:(e,t)=>({...lt(e),options:[e,t]}),useRole:function(t,n){var r;void 0===n&&(n={});const{open:o,floatingId:i}=t,{enabled:l=!0,role:u="dialog"}=n,c=null!=(r=mn.get(u))?r:u,s=vt(),a=null!=bt(),f=e.useMemo((()=>"tooltip"===c||"label"===u?{["aria-"+("label"===u?"labelledby":"describedby")]:o?i:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":"alertdialog"===c?"dialog":c,"aria-controls":o?i:void 0,..."listbox"===c&&{role:"combobox"},..."menu"===c&&{id:s},..."menu"===c&&a&&{role:"menuitem"},..."select"===u&&{"aria-autocomplete":"none"},..."combobox"===u&&{"aria-autocomplete":"list"}}),[c,i,a,o,s,u]),d=e.useMemo((()=>{const e={id:i,...c&&{role:c}};return"tooltip"===c||"label"===u?e:{...e,..."menu"===c&&{"aria-labelledby":s}}}),[c,i,s,u]),p=e.useCallback((e=>{let{active:t,selected:n}=e;const r={role:"option",...t&&{id:i+"-option"}};switch(u){case"select":return{...r,"aria-selected":t&&n};case"combobox":return{...r,...t&&{"aria-selected":!0}}}return{}}),[i,u]);return e.useMemo((()=>l?{reference:f,floating:d,item:p}:{}),[l,f,d,p])},useInteractions:function(t){void 0===t&&(t=[]);const n=t.map((e=>null==e?void 0:e.reference)),r=t.map((e=>null==e?void 0:e.floating)),o=t.map((e=>null==e?void 0:e.item)),i=e.useCallback((e=>pn(e,t,"reference")),n),l=e.useCallback((e=>pn(e,t,"floating")),r),u=e.useCallback((e=>pn(e,t,"item")),o);return e.useMemo((()=>({getReferenceProps:i,getFloatingProps:l,getItemProps:u})),[i,l,u])},useDismiss:function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,elements:i,dataRef:l}=t,{enabled:u=!0,escapeKey:c=!0,outsidePress:s=!0,outsidePressEvent:a="pointerdown",referencePress:f=!1,referencePressEvent:d="pointerdown",ancestorScroll:p=!1,bubbles:m,capture:v}=n,h=xt(),g=at("function"==typeof s?s:()=>!1),y="function"==typeof s?g:s,w=e.useRef(!1),E=e.useRef(!1),{escapeKey:R,outsidePress:C}=sn(m),{escapeKey:O,outsidePress:S}=sn(v),T=e.useRef(!1),M=at((e=>{var t;if(!r||!u||!c||"Escape"!==e.key)return;if(T.current)return;const n=null==(t=l.current.floatingContext)?void 0:t.nodeId,i=h?kt(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")})),D=at((e=>{var t;const n=()=>{var t;M(e),null==(t=K(e))||t.removeEventListener("keydown",n)};null==(t=K(e))||t.addEventListener("keydown",n)})),I=at((e=>{var t;const n=w.current;w.current=!1;const r=E.current;if(E.current=!1,"click"===a&&r)return;if(n)return;if("function"==typeof y&&!y(e))return;const u=K(e),c="["+Et("inert")+"]",s=_(i.floating).querySelectorAll(c);let f=b(u)?u:null;for(;f&&!A(f);){const e=P(f);if(A(e)||!b(e))break;f=e}if(s.length&&b(u)&&!u.matches("html,body")&&!F(u,i.floating)&&Array.from(s).every((e=>!F(f,e))))return;if(x(u)&&B){const t=A(u),n=k(u),r=/auto|scroll/,o=t||r.test(n.overflowX),i=t||r.test(n.overflowY),l=o&&u.clientWidth>0&&u.scrollWidth>u.clientWidth,c=i&&u.clientHeight>0&&u.scrollHeight>u.clientHeight,s="rtl"===n.direction,a=c&&(s?e.offsetX<=u.offsetWidth-u.clientWidth:e.offsetX>u.clientWidth),f=l&&e.offsetY>u.clientHeight;if(a||f)return}const d=null==(t=l.current.floatingContext)?void 0:t.nodeId,p=h&&kt(h.nodesRef.current,d).some((t=>{var n;return q(e,null==(n=t.context)?void 0:n.elements.floating)}));if(q(e,i.floating)||q(e,i.domReference)||p)return;const m=h?kt(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")})),W=at((e=>{var t;const n=()=>{var t;I(e),null==(t=K(e))||t.removeEventListener(a,n)};null==(t=K(e))||t.addEventListener(a,n)}));e.useEffect((()=>{if(!r||!u)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),T.current=!0}function s(){e=window.setTimeout((()=>{T.current=!1}),L()?5:0)}const f=_(i.floating);c&&(f.addEventListener("keydown",O?D:M,O),f.addEventListener("compositionstart",n),f.addEventListener("compositionend",s)),y&&f.addEventListener(a,S?W:I,S);let d=[];return p&&(b(i.domReference)&&(d=N(i.domReference)),b(i.floating)&&(d=d.concat(N(i.floating))),!b(i.reference)&&i.reference&&i.reference.contextElement&&(d=d.concat(N(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})})),()=>{c&&(f.removeEventListener("keydown",O?D:M,O),f.removeEventListener("compositionstart",n),f.removeEventListener("compositionend",s)),y&&f.removeEventListener(a,S?W:I,S),d.forEach((e=>{e.removeEventListener("scroll",t)})),window.clearTimeout(e)}}),[l,i,c,y,a,r,o,p,u,R,C,M,O,D,I,S,W]),e.useEffect((()=>{w.current=!1}),[y,a]);const j=e.useMemo((()=>({onKeyDown:M,...f&&{[un[d]]:e=>{o(!1,e.nativeEvent,"reference-press")},..."click"!==d&&{onClick(e){o(!1,e.nativeEvent,"reference-press")}}}})),[M,o,f,d]),B=e.useMemo((()=>({onKeyDown:M,onMouseDown(){E.current=!0},onMouseUp(){E.current=!0},[cn[a]]:()=>{w.current=!0}})),[M,a]);return e.useMemo((()=>u?{reference:j,floating:B}:{}),[u,j,B])},useHover:function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,dataRef:i,events:l,elements:u}=t,{enabled:c=!0,delay:s=0,handleClose:a=null,mouseOnly:f=!1,restMs:d=0,move:p=!0}=n,m=xt(),v=bt(),h=Rt(a),g=Rt(s),y=Rt(r),w=e.useRef(),x=e.useRef(-1),E=e.useRef(),R=e.useRef(-1),C=e.useRef(!0),O=e.useRef(!1),S=e.useRef((()=>{})),L=e.useRef(!1),A=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(c)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)}}),[c,l]),e.useEffect((()=>{if(!c)return;if(!h.current)return;if(!r)return;function e(e){A()&&o(!1,e,"hover")}const t=_(u.floating).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[u.floating,r,o,c,h,A]);const k=e.useCallback((function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const r=Ot(g.current,"close",w.current);r&&!E.current?(clearTimeout(x.current),x.current=window.setTimeout((()=>o(!1,e,n)),r)):t&&(clearTimeout(x.current),o(!1,e,n))}),[g,o]),T=at((()=>{S.current(),E.current=void 0})),P=at((()=>{if(O.current){const e=_(u.floating).body;e.style.pointerEvents="",e.removeAttribute(Ct),O.current=!1}})),M=at((()=>!!i.current.openEvent&&["click","mousedown"].includes(i.current.openEvent.type)));e.useEffect((()=>{if(c&&b(u.domReference)){var e;const o=u.domReference;return r&&o.addEventListener("mouseleave",l),null==(e=u.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=u.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(w.current)||d>0&&!Ot(g.current,"open"))return;const t=Ot(g.current,"open",w.current);t?x.current=window.setTimeout((()=>{y.current||o(!0,e,"hover")}),t):r||o(!0,e,"hover")}function n(e){if(M())return;S.current();const t=_(u.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(){P(),T(),M()||k(e,!0,"safe-polygon")}});const n=E.current;return t.addEventListener("mousemove",n),void(S.current=()=>{t.removeEventListener("mousemove",n)})}("touch"!==w.current||!F(u.floating,e.relatedTarget))&&k(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(){P(),T(),M()||k(e)}})(e))}}),[u,c,t,f,d,p,k,T,P,o,r,y,m,g,h,i,M]),ft((()=>{var e;if(c&&r&&null!=(e=h.current)&&e.__options.blockPointerEvents&&A()){O.current=!0;const e=u.floating;if(b(u.domReference)&&e){var t;const n=_(u.floating).body;n.setAttribute(Ct,"");const r=u.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=""}}}}),[c,r,v,u,m,h,A]),ft((()=>{r||(w.current=void 0,L.current=!1,T(),P())}),[r,T,P]),e.useEffect((()=>()=>{T(),clearTimeout(x.current),clearTimeout(R.current),P()}),[c,u.domReference,T,P]);const N=e.useMemo((()=>{function e(e){w.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){const{nativeEvent:t}=e;function n(){C.current||y.current||o(!0,t,"hover")}f&&!V(w.current)||r||0===d||L.current&&e.movementX**2+e.movementY**2<2||(clearTimeout(R.current),"touch"===w.current?n():(L.current=!0,R.current=window.setTimeout(n,d)))}}}),[f,o,r,y,d]),D=e.useMemo((()=>({onMouseEnter(){clearTimeout(x.current)},onMouseLeave(e){M()||k(e.nativeEvent,!1)}})),[k,M]);return e.useMemo((()=>c?{reference:N,floating:D}:{}),[c,N,D])},flip:(e,t)=>({...Ge(e),options:[e,t]}),shift:(e,t)=>({...Ze(e),options:[e,t]}),hide:(e,t)=>({...Qe(e),options:[e,t]}),offset:(e,t)=>({...ze(e),options:[e,t]})},hn="AlertDialog",gn=function(e){var n=e.children,r=e.customRootClass,o=void 0===r?"":r,i=e.open,u=e.onOpenChange,c=e.onClickOutside,s=void 0===c?function(){}:c,a=vn.useFloating().context,f=function(e,t){if(void 0===e&&(e=""),e)return e;var n=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return"".concat("rad-ui","-").concat(n)}(o,hn),p=l(i),v=p[0],h=p[1],g={isOpen:v,handleOpenChange:function(e){h(e),u(e)},floaterContext:a,rootClass:f,handleOverlayClick:function(){s()}};return t.createElement(d.Provider,{value:g},t.createElement("div",{className:m(f)},n))};gn.displayName=hn;var yn=function(e){var n=e.children,r=u(d),o=r.isOpen,i=r.rootClass;return t.createElement(t.Fragment,null,o&&t.createElement("div",{className:m("".concat(i,"-content"))},n))},wn=function(){return wn=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},wn.apply(this,arguments)};function bn(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 xn=["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,u=bn(n,["asChild","children"]);if(i){var c=t.Children.toArray(l);if(1!==c.length||!t.isValidElement(c[0]))return console.warn("Primitive.".concat(e,": asChild prop requires exactly one valid child element.")),t.createElement(e,wn(wn({},u),{ref:r}),l);var s=c[0];return t.cloneElement(s,wn(wn(wn({},u),s.props),r?{ref:function(e){"function"==typeof r?r(e):r&&(r.current=e);var t=s.ref;"function"==typeof t?t(e):t&&(t.current=e)}}:{}))}return t.createElement(e,wn(wn({},u),{ref:r}),l)}));return n.displayName="Primitive.".concat(e),n}(n),e}),{}),En=function(e){var n=e.role,r=void 0===n?"button":n,o=e.label,i=void 0===o?"":o,l=e.description,u=void 0===l?"":l,c=e.disabled,s=void 0!==c&&c,a=e.children,f=bn(e,["role","label","description","disabled","children"]);return i&&(f["aria-label"]=i),u&&(f["aria-description"]=u),s&&(f["aria-disabled"]="true",u||(f["aria-description"]="Disabled Button")),t.createElement(xn.button,wn({role:r,disabled:s},f),a)},Rn=function(e){var n=e.children,r=bn(e,["children"]),o=u(d),i=o.rootClass,l=o.handleOpenChange;return t.createElement(En,wn({onClick:function(){return l(!0)}},r,{className:m("".concat(i,"-trigger"))}),n)},Cn=function(e){var n=e.children,r=u(d).rootClass,o=document.getElementsByClassName(r)[0];return t.createElement(vn.Portal,{root:o||document.body},n)},On=function(){var e=u(d),n=e.isOpen,r=e.rootClass,o=e.handleOverlayClick;return t.createElement(t.Fragment,null,n&&t.createElement(vn.Overlay,{className:m("".concat(r,"-overlay")),onClick:o}))},Sn=function(e){var n=e.children,r=u(d),o=r.rootClass,i=r.handleOpenChange;return t.createElement(En,{onClick:function(){return i(!1)},className:m("".concat(o,"-cancel"))},n)},Ln=function(e){var n=e.children,r=u(d),o=r.rootClass,i=r.handleOpenChange;return t.createElement(En,{onClick:function(){return i(!1)},className:m("".concat(o,"-action"))},n)},An=function(e){var n=e.children,r=e.open,o=void 0!==r&&r,i=e.onOpenChange,u=void 0===i?function(){}:i,c=e.content,s=l(o),a=s[0],f=s[1];return t.createElement(gn,{open:a,onOpenChange:function(e){f(e),u(e)}},t.createElement(Rn,null,n),t.createElement(Cn,null,t.createElement(On,null),t.createElement(yn,null,c,t.createElement(Sn,null,"Cancel"),t.createElement(Ln,null,"Continue"))))};An.Root=gn,An.Content=yn,An.Trigger=Rn,An.Portal=Cn,An.Overlay=On,An.Cancel=Sn,An.Action=Ln;export{An as default};
|
|
5
|
+
*/var pe=["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(","),me="undefined"==typeof Element,ve=me?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,he=!me&&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},ge=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)},ye=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var l=i.shift();if(!ge(l,!1))if("SLOT"===l.tagName){var u=l.assignedElements(),c=e(u.length?u:l.children,!0,r);r.flatten?o.push.apply(o,c):o.push({scopeParent:l,candidates:c})}else{ve.call(l,pe)&&r.filter(l)&&(n||!t.includes(l))&&o.push(l);var s=l.shadowRoot||"function"==typeof r.getShadowRoot&&r.getShadowRoot(l),a=!ge(s,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(l));if(s&&a){var f=e(!0===s?l.children:s.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},we=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},be=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))&&!we(e)?0:e.tabIndex},xe=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},Ee=function(e){return"INPUT"===e.tagName},Re=function(e){return function(e){return Ee(e)&&"radio"===e.type}(e)&&!function(e){if(!e.name)return!0;var t,n=e.form||he(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)},Ce=function(e){var t=e.getBoundingClientRect(),n=t.width,r=t.height;return 0===n&&0===r},Oe=function(e,t){var n=t.displayCheck,r=t.getShadowRoot;if("hidden"===getComputedStyle(e).visibility)return!0;var o=ve.call(e,"details>summary:first-of-type")?e.parentElement:e;if(ve.call(o,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return Ce(e)}else{if("function"==typeof r){for(var i=e;e;){var l=e.parentElement,u=he(e);if(l&&!l.shadowRoot&&!0===r(l))return Ce(e);e=e.assignedSlot?e.assignedSlot:l||u===e.ownerDocument?l:u.host}e=i}if(function(e){var t,n,r,o,i=e&&he(e),l=null===(t=i)||void 0===t?void 0:t.host,u=!1;if(i&&i!==e)for(u=!!(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));!u&&l;){var c,s,a;u=!(null===(s=l=null===(c=i=he(l))||void 0===c?void 0:c.host)||void 0===s||null===(a=s.ownerDocument)||void 0===a||!a.contains(l))}return u}(e))return!e.getClientRects().length;if("legacy-full"!==n)return!0}return!1},Le=function(e,t){return!(t.disabled||ge(t)||function(e){return Ee(e)&&"hidden"===e.type}(t)||Oe(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!!ve.call(t,"fieldset[disabled] *")||!r.contains(e)}return!0}t=t.parentElement}return!1}(t))},Se=function(e,t){return!(Re(t)||be(t)<0||!Le(e,t))},Ae=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},ke=function e(t){var n=[],r=[];return t.forEach((function(t,o){var i=!!t.scopeParent,l=i?t.scopeParent:t,u=function(e,t){var n=be(e);return n<0&&t&&!we(e)?0:n}(l,i),c=i?e(t.candidates):l;0===u?i?n.push.apply(n,c):n.push(l):r.push({documentOrder:o,tabIndex:u,item:t,isScope:i,content:c})})),r.sort(xe).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?ye([e],t.includeContainer,{filter:Se.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Ae}):function(e,t,n){if(ge(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(pe));return t&&ve.call(e,pe)&&r.unshift(e),r.filter(n)}(e,t.includeContainer,Se.bind(null,t)),ke(n)};function Pe(e,t,n){let{reference:r,floating:o}=e;const i=ue(t),l=ce(t),u=le(l),c=re(t),s="y"===i,a=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,d=r[u]/2-o[u]/2;let p;switch(c){case"top":p={x:a,y:r.y-o.height};break;case"bottom":p={x:a,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(oe(t)){case"start":p[l]-=d*(n&&s?-1:1);break;case"end":p[l]+=d*(n&&s?-1:1)}return p}async function Me(e,t){var n;void 0===t&&(t={});const{x:r,y:o,platform:i,rects:l,elements:u,strategy:c}=e,{boundary:s="clippingAncestors",rootBoundary:a="viewport",elementContext:f="floating",altBoundary:d=!1,padding:p=0}=ne(t,e),m=fe(p),v=u[d?"floating"===f?"reference":"floating":f],h=de(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(u.floating)),boundary:s,rootBoundary:a,strategy:c})),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(u.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=de(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:g,offsetParent:y,strategy:c}):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 Ne(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function De(e){return $.some((t=>e[t]>=0))}function Ie(e){const t=k(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=x(e),i=o?e.offsetWidth:n,l=o?e.offsetHeight:r,u=G(n)!==i||G(r)!==l;return u&&(n=i,r=l),{width:n,height:r,$:u}}function Fe(e){return b(e)?e:e.contextElement}function We(e){const t=Fe(e);if(!x(t))return Q(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Ie(t);let l=(i?G(n.width):n.width)/r,u=(i?G(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),u&&Number.isFinite(u)||(u=1),{x:l,y:u}}const je=Q(0);function Be(e){const t=g(e);return S()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:je}function He(e,t,n,r){void 0===t&&(t=!1),void 0===n&&(n=!1);const o=e.getBoundingClientRect(),i=Fe(e);let l=Q(1);t&&(r?b(r)&&(l=We(r)):l=We(e));const u=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==g(e))&&t}(i,n,r)?Be(i):Q(0);let c=(o.left+u.x)/l.x,s=(o.top+u.y)/l.y,a=o.width/l.x,f=o.height/l.y;if(i){const e=g(i),t=r&&b(r)?g(r):r;let n=e,o=D(n);for(;o&&r&&t!==n;){const e=We(o),t=o.getBoundingClientRect(),r=k(o),i=t.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,l=t.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,s*=e.y,a*=e.x,f*=e.y,c+=i,s+=l,n=g(o),o=D(n)}}return de({width:a,height:f,x:c,y:s})}function Ve(e,t){const n=T(e).scrollLeft;return t?t.left+n:He(y(e)).left+n}function _e(e,t,n){void 0===n&&(n=!1);const r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:Ve(e,r)),y:r.top+t.scrollTop}}function qe(e,t,n){let r;if("viewport"===t)r=function(e,t){const n=g(e),r=y(e),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,u=0,c=0;if(o){i=o.width,l=o.height;const e=S();(!e||e&&"fixed"===t)&&(u=o.offsetLeft,c=o.offsetTop)}return{width:i,height:l,x:u,y:c}}(e,n);else if("document"===t)r=function(e){const t=y(e),n=T(e),r=e.ownerDocument.body,o=Z(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Z(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Ve(e);const u=-n.scrollTop;return"rtl"===k(r).direction&&(l+=Z(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:u}}(y(e));else if(b(t))r=function(e,t){const n=He(e,!0,"fixed"===t),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=x(e)?We(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=Be(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return de(r)}function Ke(e,t){const n=P(e);return!(n===t||!b(n)||A(n))&&("fixed"===k(n).position||Ke(n,t))}function Xe(e,t,n){const r=x(t),o=y(t),i="fixed"===n,l=He(e,!0,i,t);let u={scrollLeft:0,scrollTop:0};const c=Q(0);if(r||!r&&!i)if(("body"!==h(t)||R(o))&&(u=T(t)),r){const e=He(t,!0,i,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else o&&(c.x=Ve(o));const s=!o||r||i?Q(0):_e(o,u);return{x:l.left+u.scrollLeft-c.x-s.x,y:l.top+u.scrollTop-c.y-s.y,width:l.width,height:l.height}}function Ue(e){return"static"===k(e).position}function Ye(e,t){if(!x(e)||"fixed"===k(e).position)return null;if(t)return t(e);let n=e.offsetParent;return y(e)===n&&(n=n.ownerDocument.body),n}function $e(e,t){const n=g(e);if(O(e))return n;if(!x(e)){let t=P(e);for(;t&&!A(t);){if(b(t)&&!Ue(t))return t;t=P(t)}return n}let r=Ye(e,t);for(;r&&C(r)&&Ue(r);)r=Ye(r,t);return r&&A(r)&&Ue(r)&&!L(r)?n:r||function(e){let t=P(e);for(;x(t)&&!A(t);){if(L(t))return t;if(O(t))return null;t=P(t)}return null}(e)||n}const ze={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i="fixed"===o,l=y(r),u=!!t&&O(t.floating);if(r===l||u&&i)return n;let c={scrollLeft:0,scrollTop:0},s=Q(1);const a=Q(0),f=x(r);if((f||!f&&!i)&&(("body"!==h(r)||R(l))&&(c=T(r)),x(r))){const e=He(r);s=We(r),a.x=e.x+r.clientLeft,a.y=e.y+r.clientTop}const d=!l||f||i?Q(0):_e(l,c,!0);return{width:n.width*s.x,height:n.height*s.y,x:n.x*s.x-c.scrollLeft*s.x+a.x+d.x,y:n.y*s.y-c.scrollTop*s.y+a.y+d.y}},getDocumentElement:y,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[..."clippingAncestors"===n?O(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let r=N(e,[],!1).filter((e=>b(e)&&"body"!==h(e))),o=null;const i="fixed"===k(e).position;let l=i?P(e):e;for(;b(l)&&!A(l);){const t=k(l),n=L(l);n||"fixed"!==t.position||(o=null),(i?!n&&!o:!n&&"static"===t.position&&o&&["absolute","fixed"].includes(o.position)||R(l)&&!n&&Ke(e,l))?r=r.filter((e=>e!==l)):o=t,l=P(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=i[0],u=i.reduce(((e,n)=>{const r=qe(t,n,o);return e.top=Z(r.top,e.top),e.right=z(r.right,e.right),e.bottom=z(r.bottom,e.bottom),e.left=Z(r.left,e.left),e}),qe(t,l,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}},getOffsetParent:$e,getElementRects:async function(e){const t=this.getOffsetParent||$e,n=this.getDimensions,r=await n(e.floating);return{reference:Xe(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}=Ie(e);return{width:t,height:n}},getScale:We,isElement:b,isRTL:function(e){return"rtl"===k(e).direction}},Ze=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:u}=t,c=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=re(n),u=oe(n),c="y"===ue(n),s=["left","top"].includes(l)?-1:1,a=i&&c?-1:1,f=ne(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 u&&"number"==typeof m&&(p="end"===u?-1*m:m),c?{x:p*a,y:d*s}:{x:d*s,y:p*a}}(t,e);return l===(null==(n=u.offset)?void 0:n.placement)&&null!=(r=u.arrow)&&r.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:l}}}}},Ge=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:u={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=ne(e,t),s={x:n,y:r},a=await Me(t,c),f=ue(re(o)),d=ie(f);let p=s[d],m=s[f];if(i){const e="y"===d?"bottom":"right";p=te(p+a["y"===d?"top":"left"],p,p-a[e])}if(l){const e="y"===f?"bottom":"right";m=te(m+a["y"===f?"top":"left"],m,m-a[e])}const v=u.fn({...t,[d]:p,[f]:m});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[d]:i,[f]:l}}}}}},Qe=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:u,platform:c,elements:s}=t,{mainAxis:a=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:v=!0,...h}=ne(e,t);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const g=re(o),y=ue(u),w=re(u)===u,b=await(null==c.isRTL?void 0:c.isRTL(s.floating)),x=d||(w||!v?[ae(u)]:function(e){const t=ae(e);return[se(e),t,se(t)]}(u)),E="none"!==m;!d&&E&&x.push(...function(e,t,n,r){const o=oe(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[]}}(re(e),"start"===n,r);return o&&(i=i.map((e=>e+"-"+o)),t&&(i=i.concat(i.map(se)))),i}(u,v,m,b));const R=[u,...x],C=await Me(t,h),O=[];let L=(null==(r=i.flip)?void 0:r.overflows)||[];if(a&&O.push(C[g]),f){const e=function(e,t,n){void 0===n&&(n=!1);const r=oe(e),o=ce(e),i=le(o);let l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return t.reference[i]>t.floating[i]&&(l=ae(l)),[l,ae(l)]}(o,l,b);O.push(C[e[0]],C[e[1]])}if(L=[...L,{placement:o,overflows:O}],!O.every((e=>e<=0))){var S,A;const e=((null==(S=i.flip)?void 0:S.index)||0)+1,t=R[e];if(t)return{data:{index:e,overflows:L},reset:{placement:t}};let n=null==(A=L.filter((e=>e.overflows[0]<=0)).sort(((e,t)=>e.overflows[1]-t.overflows[1]))[0])?void 0:A.placement;if(!n)switch(p){case"bestFit":{var k;const e=null==(k=L.filter((e=>{if(E){const t=ue(e.placement);return t===y||"y"===t}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,t)=>e+t),0)])).sort(((e,t)=>e[1]-t[1]))[0])?void 0:k[0];e&&(n=e);break}case"initialPlacement":n=u}if(o!==n)return{reset:{placement:n}}}return{}}}},Je=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=ne(e,t);switch(r){case"referenceHidden":{const e=Ne(await Me(t,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:De(e)}}}case"escaped":{const e=Ne(await Me(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:De(e)}}}default:return{}}}}},et=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:l,elements:u,middlewareData:c}=t,{element:s,padding:a=0}=ne(e,t)||{};if(null==s)return{};const f=fe(a),d={x:n,y:r},p=ce(o),m=le(p),v=await l.getDimensions(s),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(s));let R=E?E[w]:0;R&&await(null==l.isElement?void 0:l.isElement(E))||(R=u.floating[w]||i.floating[m]);const C=b/2-x/2,O=R/2-v[m]/2-1,L=z(f[g],O),S=z(f[y],O),A=L,k=R-v[m]-S,T=R/2-v[m]/2+C,P=te(A,T,k),M=!c.arrow&&null!=oe(o)&&T!==P&&i.reference[m]/2-(T<A?L:S)-v[m]/2<0,N=M?T<A?T-A:T-k:0;return{[p]:d[p]+N,data:{[p]:P,centerOffset:T-P-N,...M&&{alignmentOffset:N}},reset:M}}}),tt=(e,t,n)=>{const r=new Map,o={platform:ze,...n},i={...o.platform,_c:r};return(async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,u=i.filter(Boolean),c=await(null==l.isRTL?void 0:l.isRTL(t));let s=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:a,y:f}=Pe(s,r,c),d=r,p={},m=0;for(let n=0;n<u.length;n++){const{name:i,fn:v}=u[n],{x:h,y:g,data:y,reset:w}=await v({x:a,y:f,initialPlacement:r,placement:d,strategy:o,middlewareData:p,rects:s,platform:l,elements:{reference:e,floating:t}});a=null!=h?h:a,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&&(s=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:o}):w.rects),({x:a,y:f}=Pe(s,d,c))),n=-1)}return{x:a,y:f,placement:d,strategy:o,middlewareData:p}})(e,t,{...o,platform:i})};var nt="undefined"!=typeof document?r:o;function rt(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(!rt(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)&&!rt(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function ot(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function it(e,t){const n=ot(e);return Math.round(t*n)/n}function lt(t){const n=e.useRef(t);return nt((()=>{n.current=t})),n}const ut=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?et({element:n.current,padding:r}).fn(t):{}:n?et({element:n,padding:r}).fn(t):{};var o}});function ct(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 st={...e},at=st.useInsertionEffect||(e=>e());function ft(t){const n=e.useRef((()=>{if("production"!==process.env.NODE_ENV)throw new Error("Cannot call an event handler while rendering.")}));return at((()=>{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 dt="undefined"!=typeof document?r:o;let pt=!1,mt=0;const vt=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+mt++;const ht=st.useId||function(){const[t,n]=e.useState((()=>pt?vt():void 0));return dt((()=>{null==t&&n(vt())}),[]),e.useEffect((()=>{pt=!0}),[]),t};let gt;"production"!==process.env.NODE_ENV&&(gt=new Set);const yt=e.forwardRef((function(t,n){const{context:{placement:r,elements:{floating:o},middlewareData:{arrow:i,shift:l}},width:u=14,height:a=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=gt)&&e.has(o)||(null==(i=gt)||i.add(o),console.warn(o))}("The `ref` prop is required for `FloatingArrow`."));const w=ht(),[b,x]=e.useState(!1);if(dt((()=>{if(!o)return;"rtl"===k(o).direction&&x(!0)}),[o]),!o)return null;const[E,R]=r.split("-"),C="top"===E||"bottom"===E;let O=p;(C&&null!=l&&l.x||!C&&null!=l&&l.y)&&(O=null);const L=2*d,S=L/2,A=u/2*(f/-8+1),T=a/2*f/4,P=!!v,M=O&&"end"===R?"bottom":"top";let N=O&&"end"===R?"right":"left";O&&b&&(N="end"===R?"left":"right");const D=null!=(null==i?void 0:i.x)?O||i.x:"",I=null!=(null==i?void 0:i.y)?O||i.y:"",F=v||"M0,0 H"+u+" L"+(u-A)+","+(a-T)+" Q"+u/2+","+a+" "+A+","+(a-T)+" Z",W={top:P?"rotate(180deg)":"",left:P?"rotate(90deg)":"rotate(-90deg)",bottom:P?"":"rotate(180deg)",right:P?"rotate(-90deg)":"rotate(90deg)"}[E];return c("svg",{...y,"aria-hidden":!0,ref:n,width:P?u:u+L,height:u,viewBox:"0 0 "+u+" "+(a>u?a:u),style:{position:"absolute",pointerEvents:"none",[N]:D,[M]:I,[E]:C||P?"100%":"calc(100% - "+L/2+"px)",transform:[W,h].filter((e=>!!e)).join(" "),...g},children:[L>0&&s("path",{clipPath:"url(#"+w+")",fill:"none",stroke:m,strokeWidth:L+(v?0:1),d:F}),s("path",{stroke:L&&!v?y.fill:"none",d:F}),s("clipPath",{id:w,children:s("rect",{x:-S,y:S*(P?-1:1),width:u+L,height:u})})]})}));const wt=e.createContext(null),bt=e.createContext(null),xt=()=>{var t;return(null==(t=e.useContext(wt))?void 0:t.id)||null},Et=()=>e.useContext(bt);function Rt(e){return"data-floating-ui-"+e}function Ct(e){const t=i(e);return dt((()=>{t.current=e})),t}const Ot=Rt("safe-polygon");function Lt(e,t,n){return n&&!_(n)?0:"number"==typeof e?e:null==e?void 0:e[t]}let St=0;function At(e,t){void 0===t&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(St);const i=()=>null==e?void 0:e.focus({preventScroll:n});o?i():St=requestAnimationFrame(i)}function kt(e,t){var n;let r=[],o=null==(n=e.find((e=>e.id===t)))?void 0:n.parentId;for(;o;){const t=e.find((e=>e.id===o));o=null==t?void 0:t.parentId,t&&(r=r.concat(t))}return r}function Tt(e,t){let n=e.filter((e=>{var n;return e.parentId===t&&(null==(n=e.context)?void 0:n.open)})),r=n;for(;r.length;)r=e.filter((e=>{var t;return null==(t=r)?void 0:t.some((t=>{var n;return e.parentId===t.id&&(null==(n=e.context)?void 0:n.open)}))})),n=n.concat(r);return n}let Pt=new WeakMap,Mt=new WeakSet,Nt={},Dt=0;const It=e=>e&&(e.host||It(e.parentNode));function Ft(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,l=(u=t,e.map((e=>{if(u.contains(e))return e;const t=It(e);return u.contains(t)?t:null})).filter((e=>null!=e)));var u;const c=new Set,s=new Set(l),a=[];Nt[o]||(Nt[o]=new WeakMap);const f=Nt[o];return l.forEach((function e(t){if(!t||c.has(t))return;c.add(t),t.parentNode&&e(t.parentNode)})),function e(t){if(!t||s.has(t))return;[].forEach.call(t.children,(t=>{if("script"!==h(t))if(c.has(t))e(t);else{const e=i?t.getAttribute(i):null,n=null!==e&&"false"!==e,r=Pt.get(t)||0,l=i?r+1:r,u=(f.get(t)||0)+1;Pt.set(t,l),f.set(t,u),a.push(t),1===l&&n&&Mt.add(t),1===u&&t.setAttribute(o,""),!n&&i&&t.setAttribute(i,"true")}}))}(t),c.clear(),Dt++,()=>{a.forEach((e=>{const t=Pt.get(e)||0,n=i?t-1:t,r=(f.get(e)||0)-1;Pt.set(e,n),f.set(e,r),n||(!Mt.has(e)&&i&&e.removeAttribute(i),Mt.delete(e)),r||e.removeAttribute(o)})),Dt--,Dt||(Pt=new WeakMap,Pt=new WeakMap,Mt=new WeakSet,Nt={})}}function Wt(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=!1);const r=q(e[0]).body;return Ft(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const jt=()=>({getShadowRoot:!0,displayCheck:"function"==typeof ResizeObserver&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Bt(e,t){const n=Te(e,jt());"prev"===t&&n.reverse();const r=n.indexOf(I(q(e)));return n.slice(r+1)[0]}function Ht(){return Bt(document.body,"next")}function Vt(){return Bt(document.body,"prev")}function _t(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!F(n,r)}function qt(e){Te(e,jt()).forEach((e=>{e.dataset.tabindex=e.getAttribute("tabindex")||"",e.setAttribute("tabindex","-1")}))}function Kt(e){e.querySelectorAll("[data-tabindex]").forEach((e=>{const t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute("tabindex",t):e.removeAttribute("tabindex")}))}const Xt={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 Ut(e){"Tab"===e.key&&(e.target,clearTimeout(undefined))}const Yt=e.forwardRef((function(t,n){const[r,o]=e.useState();dt((()=>(H()&&o("button"),document.addEventListener("keydown",Ut),()=>{document.removeEventListener("keydown",Ut)})),[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":!r||void 0,[Rt("focus-guard")]:"",style:Xt};return s("span",{...t,...i})})),$t=e.createContext(null),zt=Rt("portal");const Zt=()=>e.useContext($t),Gt="data-floating-ui-focusable";function Qt(e){return e?e.hasAttribute(Gt)?e:e.querySelector("["+Gt+"]")||e:null}let Jt=[];function en(e){Jt=Jt.filter((e=>e.isConnected)),e&&"body"!==h(e)&&(Jt.push(e),Jt.length>20&&(Jt=Jt.slice(-20)))}function tn(){return Jt.slice().reverse().find((e=>e.isConnected))}function nn(e){const t=jt();return function(e,t){if(t=t||{},!e)throw new Error("No node provided");return!1!==ve.call(e,pe)&&Se(t,e)}(e,t)?e:Te(e,t)[0]||e}const rn=e.forwardRef((function(e,t){return s("button",{...e,type:"button",ref:t,tabIndex:-1,style:Xt})}));let on=0;let ln=()=>{};const un=e.forwardRef((function(e,t){const{lockScroll:n=!1,...r}=e;return dt((()=>{if(n)return on++,1===on&&(ln=function(){const e=/iP(hone|ad|od)|iOS/.test(W()),t=document.body.style,n=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",r=window.innerWidth-document.documentElement.clientWidth,o=t.left?parseFloat(t.left):window.scrollX,i=t.top?parseFloat(t.top):window.scrollY;if(t.overflow="hidden",r&&(t[n]=r+"px"),e){var l,u;const e=(null==(l=window.visualViewport)?void 0:l.offsetLeft)||0,n=(null==(u=window.visualViewport)?void 0:u.offsetTop)||0;Object.assign(t,{position:"fixed",top:-(i-Math.floor(n))+"px",left:-(o-Math.floor(e))+"px",right:"0"})}return()=>{Object.assign(t,{overflow:"",[n]:""}),e&&(Object.assign(t,{position:"",top:"",left:"",right:""}),window.scrollTo(o,i))}}()),()=>{on--,0===on&&ln()}}),[n]),s("div",{ref:t,...r,style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...r.style}})})),cn={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},sn={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},an=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 fn(t){const{open:n=!1,onOpenChange:r,elements:o}=t,i=ht(),l=e.useRef({}),[u]=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)))||[])}}}())),c=null!=xt();if("production"!==process.env.NODE_ENV){const e=o.reference;e&&!b(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=gt)&&e.has(o)||(null==(i=gt)||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[s,a]=e.useState(o.reference),f=ft(((e,t,n)=>{l.current.openEvent=e?t:void 0,u.emit("openchange",{open:e,event:t,reason:n,nested:c}),null==r||r(e,t,n)})),d=e.useMemo((()=>({setPositionReference:a})),[]),p=e.useMemo((()=>({reference:s||o.reference||null,floating:o.floating||null,domReference:o.reference})),[s,o.reference,o.floating]);return e.useMemo((()=>({dataRef:l,open:n,onOpenChange:f,elements:p,events:u,floatingId:i,refs:d})),[n,f,p,u,i,d])}const dn="active",pn="selected";function mn(e,t,n){const r=new Map,o="item"===n;let i=e;if(o&&e){const{[dn]:t,[pn]:n,...r}=e;i=r}return{..."floating"===n&&{tabIndex:-1,[Gt]:""},...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&&[dn,pn].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 vn=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);var hn={Portal:function(t){const{children:n,id:r,root:o,preserveTabOrder:i=!0}=t,l=function(t){void 0===t&&(t={});const{id:n,root:r}=t,o=ht(),i=Zt(),[l,u]=e.useState(null),c=e.useRef(null);return dt((()=>()=>{null==l||l.remove(),queueMicrotask((()=>{c.current=null}))}),[l]),dt((()=>{if(!o)return;if(c.current)return;const e=n?document.getElementById(n):null;if(!e)return;const t=document.createElement("div");t.id=o,t.setAttribute(zt,""),e.appendChild(t),c.current=t,u(t)}),[n,o]),dt((()=>{if(null===r)return;if(!o)return;if(c.current)return;let e=r||(null==i?void 0:i.portalNode);e&&!b(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(zt,""),e=t||e,e.appendChild(l),c.current=l,u(l)}),[n,r,o,i]),l}({id:r,root:o}),[u,a]=e.useState(null),d=e.useRef(null),p=e.useRef(null),m=e.useRef(null),v=e.useRef(null),h=null==u?void 0:u.modal,g=null==u?void 0:u.open,y=!!u&&!u.modal&&u.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&&_t(e)){("focusin"===e.type?Kt:qt)(l)}}}),[l,i,h]),e.useEffect((()=>{l&&(g||Kt(l))}),[g,l]),c($t.Provider,{value:e.useMemo((()=>({preserveTabOrder:i,beforeOutsideRef:d,afterOutsideRef:p,beforeInsideRef:m,afterInsideRef:v,portalNode:l,setFocusManagerState:a})),[i,l]),children:[y&&l&&s(Yt,{"data-type":"outside",ref:d,onFocus:e=>{if(_t(e,l)){var t;null==(t=m.current)||t.focus()}else{const e=Vt()||(null==u?void 0:u.domReference);null==e||e.focus()}}}),y&&l&&s("span",{"aria-owns":l.id,style:Xt}),l&&f.createPortal(n,l),y&&l&&s(Yt,{"data-type":"outside",ref:p,onFocus:e=>{if(_t(e,l)){var t;null==(t=v.current)||t.focus()}else{const t=Ht()||(null==u?void 0:u.domReference);null==t||t.focus(),(null==u?void 0:u.closeOnFocusOut)&&(null==u||u.onOpenChange(!1,e.nativeEvent,"focus-out"))}}})]})},Overlay:un,FocusManager:function(t){const{context:n,children:r,disabled:o=!1,order:i=["content"],guards:l=!0,initialFocus:u=0,returnFocus:f=!0,restoreFocus:d=!1,modal:p=!0,visuallyHiddenDismiss:m=!1,closeOnFocusOut:v=!0,outsideElementsInert:h=!1}=t,{open:g,onOpenChange:y,events:w,dataRef:b,elements:{domReference:E,floating:R}}=n,C=ft((()=>{var e;return null==(e=b.current.floatingContext)?void 0:e.nodeId})),O="number"==typeof u&&u<0,L=!!(S=E)&&"combobox"===S.getAttribute("role")&&U(S)&&O;var S;const A="undefined"!=typeof HTMLElement&&"inert"in HTMLElement.prototype,k=!A||l,T=!k||A&&h,P=Ct(i),M=Ct(u),N=Ct(f),D=Et(),W=Zt(),j=e.useRef(null),H=e.useRef(null),_=e.useRef(!1),K=e.useRef(!1),$=e.useRef(-1),z=null!=W,Z=Qt(R),G=ft((function(e){return void 0===e&&(e=Z),e?Te(e,jt()):[]})),Q=ft((e=>{const t=G(e);return P.current.map((e=>E&&"reference"===e?E:Z&&"floating"===e?Z:t)).filter(Boolean).flat()}));e.useEffect((()=>{if(o)return;if(!p)return;function e(e){if("Tab"===e.key){F(Z,I(q(Z)))&&0===G().length&&!L&&Y(e);const t=Q(),n=X(e);"reference"===P.current[0]&&n===E&&(Y(e),e.shiftKey?At(t[t.length-1]):At(t[1])),"floating"===P.current[1]&&n===Z&&e.shiftKey&&(Y(e),At(t[0]))}}const t=q(Z);return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[o,E,Z,p,P,L,G,Q]),e.useEffect((()=>{if(!o&&R)return R.addEventListener("focusin",e),()=>{R.removeEventListener("focusin",e)};function e(e){const t=X(e),n=G().indexOf(t);-1!==n&&($.current=n)}}),[o,R,G]),e.useEffect((()=>{if(!o&&v)return R&&x(E)?(E.addEventListener("focusout",t),E.addEventListener("pointerdown",e),R.addEventListener("focusout",t),()=>{E.removeEventListener("focusout",t),E.removeEventListener("pointerdown",e),R.removeEventListener("focusout",t)}):void 0;function e(){K.current=!0,setTimeout((()=>{K.current=!1}))}function t(e){const t=e.relatedTarget;queueMicrotask((()=>{const n=C(),r=!(F(E,t)||F(R,t)||F(t,R)||F(null==W?void 0:W.portalNode,t)||null!=t&&t.hasAttribute(Rt("focus-guard"))||D&&(Tt(D.nodesRef.current,n).find((e=>{var n,r;return F(null==(n=e.context)?void 0:n.elements.floating,t)||F(null==(r=e.context)?void 0:r.elements.domReference,t)}))||kt(D.nodesRef.current,n).find((e=>{var n,r,o;return[null==(n=e.context)?void 0:n.elements.floating,Qt(null==(r=e.context)?void 0:r.elements.floating)].includes(t)||(null==(o=e.context)?void 0:o.elements.domReference)===t}))));if(d&&r&&I(q(Z))===q(Z).body){x(Z)&&Z.focus();const e=$.current,t=G(),n=t[e]||t[t.length-1]||Z;x(n)&&n.focus()}!L&&p||!t||!r||K.current||t===tn()||(_.current=!0,y(!1,e,"focus-out"))}))}}),[o,E,R,Z,p,D,W,y,v,d,G,L,C]);const J=e.useRef(null),ee=e.useRef(null),te=ct([J,null==W?void 0:W.beforeInsideRef]),ne=ct([ee,null==W?void 0:W.afterInsideRef]);function re(e){return!o&&m&&p?s(rn,{ref:"start"===e?j:H,onClick:e=>y(!1,e.nativeEvent),children:"string"==typeof m?m:"Dismiss"}):null}e.useEffect((()=>{var e;if(o)return;if(!R)return;const t=Array.from((null==W||null==(e=W.portalNode)?void 0:e.querySelectorAll("["+Rt("portal")+"]"))||[]),n=D&&!p?kt(null==D?void 0:D.nodesRef.current,C()).map((e=>{var t;return null==(t=e.context)?void 0:t.elements.floating})):[],r=[R,...t,...n,j.current,H.current,J.current,ee.current,null==W?void 0:W.beforeOutsideRef.current,null==W?void 0:W.afterOutsideRef.current,P.current.includes("reference")||L?E:null].filter((e=>null!=e)),i=p||L?Wt(r,!T,T):Wt(r);return()=>{i()}}),[o,E,R,p,P,W,L,k,T,D,C]),dt((()=>{if(o||!x(Z))return;const e=I(q(Z));queueMicrotask((()=>{const t=Q(Z),n=M.current,r=("number"==typeof n?t[n]:n.current)||Z,o=F(Z,e);O||o||!g||At(r,{preventScroll:r===Z})}))}),[o,g,Z,O,Q,M]),dt((()=>{if(o||!Z)return;let e=!1;const t=q(Z),n=I(t);let r=b.current.openEvent;function i(t){let{open:n,reason:o,event:i,nested:l}=t;n&&(r=i),"escape-key"===o&&E&&en(E),["hover","safe-polygon"].includes(o)&&"mouseleave"===i.type&&(_.current=!0),"outside-press"===o&&(l?(_.current=!1,e=!0):_.current=!(function(e){return!(0!==e.mozInputSource||!e.isTrusted)||(V()&&e.pointerType?"click"===e.type&&1===e.buttons:0===e.detail&&!e.pointerType)}(i)||B(i)))}en(n),w.on("openchange",i);const l=t.createElement("span");return l.setAttribute("tabindex","-1"),l.setAttribute("aria-hidden","true"),Object.assign(l.style,Xt),z&&E&&E.insertAdjacentElement("afterend",l),()=>{w.off("openchange",i);const n=I(t),o=F(R,n)||D&&Tt(D.nodesRef.current,C()).some((e=>{var t;return F(null==(t=e.context)?void 0:t.elements.floating,n)}));(o||r&&["click","mousedown"].includes(r.type))&&E&&en(E);const u="boolean"==typeof N.current?tn()||l:N.current.current||l;queueMicrotask((()=>{const r=nn(u);N.current&&!_.current&&x(r)&&(r===n||n===t.body||o)&&r.focus({preventScroll:e}),l.remove()}))}}),[o,R,Z,N,b,w,D,z,E,C]),e.useEffect((()=>{queueMicrotask((()=>{_.current=!1}))}),[o]),dt((()=>{if(!o&&W)return W.setFocusManagerState({modal:p,closeOnFocusOut:v,open:g,onOpenChange:y,domReference:E}),()=>{W.setFocusManagerState(null)}}),[o,W,p,g,y,v,E]),dt((()=>{if(o)return;if(!Z)return;if("function"!=typeof MutationObserver)return;if(O)return;const e=()=>{const e=Z.getAttribute("tabindex"),t=G(),n=I(q(R)),r=t.indexOf(n);-1!==r&&($.current=r),P.current.includes("floating")||n!==E&&0===t.length?"0"!==e&&Z.setAttribute("tabindex","0"):"-1"!==e&&Z.setAttribute("tabindex","-1")};e();const t=new MutationObserver(e);return t.observe(Z,{childList:!0,subtree:!0,attributes:!0}),()=>{t.disconnect()}}),[o,R,Z,E,P,G,O]);const oe=!o&&k&&(!p||!L)&&(z||p);return c(a,{children:[oe&&s(Yt,{"data-type":"inside",ref:te,onFocus:e=>{if(p){const e=Q();At("reference"===i[0]?e[0]:e[e.length-1])}else if(null!=W&&W.preserveTabOrder&&W.portalNode)if(_.current=!1,_t(e,W.portalNode)){const e=Ht()||E;null==e||e.focus()}else{var t;null==(t=W.beforeOutsideRef.current)||t.focus()}}}),!L&&re("start"),r,re("end"),oe&&s(Yt,{"data-type":"inside",ref:ne,onFocus:e=>{if(p)At(Q()[0]);else if(null!=W&&W.preserveTabOrder&&W.portalNode)if(v&&(_.current=!0),_t(e,W.portalNode)){const e=Vt()||E;null==e||e.focus()}else{var t;null==(t=W.afterOutsideRef.current)||t.focus()}}})]})},useFloating:function(t){void 0===t&&(t={});const{nodeId:n}=t,r=fn({...t,elements:{reference:null,floating:null,...t.elements}}),o=t.rootContext||r,i=o.elements,[l,u]=e.useState(null),[c,s]=e.useState(null),a=(null==i?void 0:i.domReference)||l,d=e.useRef(null),p=Et();dt((()=>{a&&(d.current=a)}),[a]);const m=function(t){void 0===t&&(t={});const{placement:n="bottom",strategy:r="absolute",middleware:o=[],platform:i,elements:{reference:l,floating:u}={},transform:c=!0,whileElementsMounted:s,open:a}=t,[d,p]=e.useState({x:0,y:0,strategy:r,placement:n,middlewareData:{},isPositioned:!1}),[m,v]=e.useState(o);rt(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!==O.current&&(O.current=e,w(e))}),[]),E=l||h,R=u||y,C=e.useRef(null),O=e.useRef(null),L=e.useRef(d),S=null!=s,A=lt(s),k=lt(i),T=lt(a),P=e.useCallback((()=>{if(!C.current||!O.current)return;const e={placement:n,strategy:r,middleware:m};k.current&&(e.platform=k.current),tt(C.current,O.current,e).then((e=>{const t={...e,isPositioned:!1!==T.current};M.current&&!rt(L.current,t)&&(L.current=t,f.flushSync((()=>{p(t)})))}))}),[m,n,r,k,T]);nt((()=>{!1===a&&L.current.isPositioned&&(L.current.isPositioned=!1,p((e=>({...e,isPositioned:!1}))))}),[a]);const M=e.useRef(!1);nt((()=>(M.current=!0,()=>{M.current=!1})),[]),nt((()=>{if(E&&(C.current=E),R&&(O.current=R),E&&R){if(A.current)return A.current(E,R,P);P()}}),[E,R,P,A,S]);const N=e.useMemo((()=>({reference:C,floating:O,setReference:b,setFloating:x})),[b,x]),D=e.useMemo((()=>({reference:E,floating:R})),[E,R]),I=e.useMemo((()=>{const e={position:r,left:0,top:0};if(!D.floating)return e;const t=it(D.floating,d.x),n=it(D.floating,d.y);return c?{...e,transform:"translate("+t+"px, "+n+"px)",...ot(D.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:t,top:n}}),[r,c,D.floating,d.x,d.y]);return e.useMemo((()=>({...d,update:P,refs:N,elements:D,floatingStyles:I})),[d,P,N,D,I])}({...t,elements:{...i,...c&&{reference:c}}}),v=e.useCallback((e=>{const t=b(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),contextElement:e}:e;s(t),m.refs.setReference(t)}),[m.refs]),h=e.useCallback((e=>{(b(e)||null===e)&&(d.current=e,u(e)),(b(m.refs.reference.current)||null===m.refs.reference.current||null!==e&&!b(e))&&m.refs.setReference(e)}),[m.refs]),g=e.useMemo((()=>({...m.refs,setReference:h,setPositionReference:v,domReference:d})),[m.refs,h,v]),y=e.useMemo((()=>({...m.elements,domReference:a})),[m.elements,a]),w=e.useMemo((()=>({...m,...o,refs:g,elements:y,nodeId:n})),[m,g,y,n,o]);return dt((()=>{o.dataRef.current.floatingContext=w;const e=null==p?void 0:p.nodesRef.current.find((e=>e.id===n));e&&(e.context=w)})),e.useMemo((()=>({...m,context:w,refs:g,elements:y})),[m,g,y,w])},Arrow:yt,arrow:(e,t)=>({...ut(e),options:[e,t]}),useRole:function(t,n){var r;void 0===n&&(n={});const{open:o,floatingId:i}=t,{enabled:l=!0,role:u="dialog"}=n,c=null!=(r=vn.get(u))?r:u,s=ht(),a=null!=xt(),f=e.useMemo((()=>"tooltip"===c||"label"===u?{["aria-"+("label"===u?"labelledby":"describedby")]:o?i:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":"alertdialog"===c?"dialog":c,"aria-controls":o?i:void 0,..."listbox"===c&&{role:"combobox"},..."menu"===c&&{id:s},..."menu"===c&&a&&{role:"menuitem"},..."select"===u&&{"aria-autocomplete":"none"},..."combobox"===u&&{"aria-autocomplete":"list"}}),[c,i,a,o,s,u]),d=e.useMemo((()=>{const e={id:i,...c&&{role:c}};return"tooltip"===c||"label"===u?e:{...e,..."menu"===c&&{"aria-labelledby":s}}}),[c,i,s,u]),p=e.useCallback((e=>{let{active:t,selected:n}=e;const r={role:"option",...t&&{id:i+"-option"}};switch(u){case"select":return{...r,"aria-selected":t&&n};case"combobox":return{...r,...t&&{"aria-selected":!0}}}return{}}),[i,u]);return e.useMemo((()=>l?{reference:f,floating:d,item:p}:{}),[l,f,d,p])},useFocus:function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,events:i,dataRef:l,elements:u}=t,{enabled:c=!0,visibleOnly:s=!0}=n,a=e.useRef(!1),f=e.useRef(),d=e.useRef(!0);e.useEffect((()=>{if(!c)return;const e=g(u.domReference);function t(){!r&&x(u.domReference)&&u.domReference===I(q(u.domReference))&&(a.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)}}),[u.domReference,r,c]),e.useEffect((()=>{if(c)return i.on("openchange",e),()=>{i.off("openchange",e)};function e(e){let{reason:t}=e;"reference-press"!==t&&"escape-key"!==t||(a.current=!0)}}),[i,c]),e.useEffect((()=>()=>{clearTimeout(f.current)}),[]);const p=e.useMemo((()=>({onPointerDown(e){B(e.nativeEvent)||(d.current=!1)},onMouseLeave(){a.current=!1},onFocus(e){if(a.current)return;const t=X(e.nativeEvent);if(s&&b(t))try{if(H()&&W().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints)throw Error();if(!t.matches(":focus-visible"))return}catch(e){if(!d.current&&!U(t))return}o(!0,e.nativeEvent,"focus")},onBlur(e){a.current=!1;const t=e.relatedTarget,n=e.nativeEvent,r=b(t)&&t.hasAttribute(Rt("focus-guard"))&&"outside"===t.getAttribute("data-type");f.current=window.setTimeout((()=>{var e;const i=I(u.domReference?u.domReference.ownerDocument:document);(t||i!==u.domReference)&&(F(null==(e=l.current.floatingContext)?void 0:e.refs.floating.current,i)||F(u.domReference,i)||r||o(!1,n,"focus"))}))}})),[l,u.domReference,o,s]);return e.useMemo((()=>c?{reference:p}:{}),[c,p])},useInteractions:function(t){void 0===t&&(t=[]);const n=t.map((e=>null==e?void 0:e.reference)),r=t.map((e=>null==e?void 0:e.floating)),o=t.map((e=>null==e?void 0:e.item)),i=e.useCallback((e=>mn(e,t,"reference")),n),l=e.useCallback((e=>mn(e,t,"floating")),r),u=e.useCallback((e=>mn(e,t,"item")),o);return e.useMemo((()=>({getReferenceProps:i,getFloatingProps:l,getItemProps:u})),[i,l,u])},useDismiss:function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,elements:i,dataRef:l}=t,{enabled:u=!0,escapeKey:c=!0,outsidePress:s=!0,outsidePressEvent:a="pointerdown",referencePress:f=!1,referencePressEvent:d="pointerdown",ancestorScroll:p=!1,bubbles:m,capture:v}=n,h=Et(),g=ft("function"==typeof s?s:()=>!1),y="function"==typeof s?g:s,w=e.useRef(!1),E=e.useRef(!1),{escapeKey:R,outsidePress:C}=an(m),{escapeKey:O,outsidePress:L}=an(v),T=e.useRef(!1),M=ft((e=>{var t;if(!r||!u||!c||"Escape"!==e.key)return;if(T.current)return;const n=null==(t=l.current.floatingContext)?void 0:t.nodeId,i=h?Tt(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")})),D=ft((e=>{var t;const n=()=>{var t;M(e),null==(t=X(e))||t.removeEventListener("keydown",n)};null==(t=X(e))||t.addEventListener("keydown",n)})),I=ft((e=>{var t;const n=w.current;w.current=!1;const r=E.current;if(E.current=!1,"click"===a&&r)return;if(n)return;if("function"==typeof y&&!y(e))return;const u=X(e),c="["+Rt("inert")+"]",s=q(i.floating).querySelectorAll(c);let f=b(u)?u:null;for(;f&&!A(f);){const e=P(f);if(A(e)||!b(e))break;f=e}if(s.length&&b(u)&&!u.matches("html,body")&&!F(u,i.floating)&&Array.from(s).every((e=>!F(f,e))))return;if(x(u)&&B){const t=A(u),n=k(u),r=/auto|scroll/,o=t||r.test(n.overflowX),i=t||r.test(n.overflowY),l=o&&u.clientWidth>0&&u.scrollWidth>u.clientWidth,c=i&&u.clientHeight>0&&u.scrollHeight>u.clientHeight,s="rtl"===n.direction,a=c&&(s?e.offsetX<=u.offsetWidth-u.clientWidth:e.offsetX>u.clientWidth),f=l&&e.offsetY>u.clientHeight;if(a||f)return}const d=null==(t=l.current.floatingContext)?void 0:t.nodeId,p=h&&Tt(h.nodesRef.current,d).some((t=>{var n;return K(e,null==(n=t.context)?void 0:n.elements.floating)}));if(K(e,i.floating)||K(e,i.domReference)||p)return;const m=h?Tt(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")})),W=ft((e=>{var t;const n=()=>{var t;I(e),null==(t=X(e))||t.removeEventListener(a,n)};null==(t=X(e))||t.addEventListener(a,n)}));e.useEffect((()=>{if(!r||!u)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),T.current=!0}function s(){e=window.setTimeout((()=>{T.current=!1}),S()?5:0)}const f=q(i.floating);c&&(f.addEventListener("keydown",O?D:M,O),f.addEventListener("compositionstart",n),f.addEventListener("compositionend",s)),y&&f.addEventListener(a,L?W:I,L);let d=[];return p&&(b(i.domReference)&&(d=N(i.domReference)),b(i.floating)&&(d=d.concat(N(i.floating))),!b(i.reference)&&i.reference&&i.reference.contextElement&&(d=d.concat(N(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})})),()=>{c&&(f.removeEventListener("keydown",O?D:M,O),f.removeEventListener("compositionstart",n),f.removeEventListener("compositionend",s)),y&&f.removeEventListener(a,L?W:I,L),d.forEach((e=>{e.removeEventListener("scroll",t)})),window.clearTimeout(e)}}),[l,i,c,y,a,r,o,p,u,R,C,M,O,D,I,L,W]),e.useEffect((()=>{w.current=!1}),[y,a]);const j=e.useMemo((()=>({onKeyDown:M,...f&&{[cn[d]]:e=>{o(!1,e.nativeEvent,"reference-press")},..."click"!==d&&{onClick(e){o(!1,e.nativeEvent,"reference-press")}}}})),[M,o,f,d]),B=e.useMemo((()=>({onKeyDown:M,onMouseDown(){E.current=!0},onMouseUp(){E.current=!0},[sn[a]]:()=>{w.current=!0}})),[M,a]);return e.useMemo((()=>u?{reference:j,floating:B}:{}),[u,j,B])},useHover:function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:o,dataRef:i,events:l,elements:u}=t,{enabled:c=!0,delay:s=0,handleClose:a=null,mouseOnly:f=!1,restMs:d=0,move:p=!0}=n,m=Et(),v=xt(),h=Ct(a),g=Ct(s),y=Ct(r),w=e.useRef(),x=e.useRef(-1),E=e.useRef(),R=e.useRef(-1),C=e.useRef(!0),O=e.useRef(!1),L=e.useRef((()=>{})),S=e.useRef(!1),A=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(c)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,S.current=!1)}}),[c,l]),e.useEffect((()=>{if(!c)return;if(!h.current)return;if(!r)return;function e(e){A()&&o(!1,e,"hover")}const t=q(u.floating).documentElement;return t.addEventListener("mouseleave",e),()=>{t.removeEventListener("mouseleave",e)}}),[u.floating,r,o,c,h,A]);const k=e.useCallback((function(e,t,n){void 0===t&&(t=!0),void 0===n&&(n="hover");const r=Lt(g.current,"close",w.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]),T=ft((()=>{L.current(),E.current=void 0})),P=ft((()=>{if(O.current){const e=q(u.floating).body;e.style.pointerEvents="",e.removeAttribute(Ot),O.current=!1}})),M=ft((()=>!!i.current.openEvent&&["click","mousedown"].includes(i.current.openEvent.type)));e.useEffect((()=>{if(c&&b(u.domReference)){var e;const o=u.domReference;return r&&o.addEventListener("mouseleave",l),null==(e=u.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=u.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&&!_(w.current)||d>0&&!Lt(g.current,"open"))return;const t=Lt(g.current,"open",w.current);t?x.current=window.setTimeout((()=>{y.current||o(!0,e,"hover")}),t):r||o(!0,e,"hover")}function n(e){if(M())return;L.current();const t=q(u.floating);if(clearTimeout(R.current),S.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(){P(),T(),M()||k(e,!0,"safe-polygon")}});const n=E.current;return t.addEventListener("mousemove",n),void(L.current=()=>{t.removeEventListener("mousemove",n)})}("touch"!==w.current||!F(u.floating,e.relatedTarget))&&k(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(){P(),T(),M()||k(e)}})(e))}}),[u,c,t,f,d,p,k,T,P,o,r,y,m,g,h,i,M]),dt((()=>{var e;if(c&&r&&null!=(e=h.current)&&e.__options.blockPointerEvents&&A()){O.current=!0;const e=u.floating;if(b(u.domReference)&&e){var t;const n=q(u.floating).body;n.setAttribute(Ot,"");const r=u.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=""}}}}),[c,r,v,u,m,h,A]),dt((()=>{r||(w.current=void 0,S.current=!1,T(),P())}),[r,T,P]),e.useEffect((()=>()=>{T(),clearTimeout(x.current),clearTimeout(R.current),P()}),[c,u.domReference,T,P]);const N=e.useMemo((()=>{function e(e){w.current=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){const{nativeEvent:t}=e;function n(){C.current||y.current||o(!0,t,"hover")}f&&!_(w.current)||r||0===d||S.current&&e.movementX**2+e.movementY**2<2||(clearTimeout(R.current),"touch"===w.current?n():(S.current=!0,R.current=window.setTimeout(n,d)))}}}),[f,o,r,y,d]),D=e.useMemo((()=>({onMouseEnter(){clearTimeout(x.current)},onMouseLeave(e){M()||k(e.nativeEvent,!1)}})),[k,M]);return e.useMemo((()=>c?{reference:N,floating:D}:{}),[c,N,D])},flip:(e,t)=>({...Qe(e),options:[e,t]}),shift:(e,t)=>({...Ge(e),options:[e,t]}),hide:(e,t)=>({...Je(e),options:[e,t]}),offset:(e,t)=>({...Ze(e),options:[e,t]}),useMergeRefs:ct},gn="AlertDialog",yn=function(e){var n=e.children,r=e.customRootClass,o=void 0===r?"":r,i=e.open,u=e.onOpenChange,c=e.onClickOutside,s=void 0===c?function(){}:c,a=hn.useFloating().context,f=function(e,t){if(void 0===e&&(e=""),e)return e;var n=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return"".concat("rad-ui","-").concat(n)}(o,gn),p=l(i),v=p[0],h=p[1],g={isOpen:v,handleOpenChange:function(e){h(e),u(e)},floaterContext:a,rootClass:f,handleOverlayClick:function(){s()}};return t.createElement(d.Provider,{value:g},t.createElement("div",{className:m(f)},n))};yn.displayName=gn;var wn=function(e){var n=e.children,r=u(d),o=r.isOpen,i=r.rootClass;return t.createElement(t.Fragment,null,o&&t.createElement("div",{className:m("".concat(i,"-content"))},n))},bn=function(){return bn=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},bn.apply(this,arguments)};function xn(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 En=["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,u=xn(n,["asChild","children"]);if(i){var c=t.Children.toArray(l);if(1!==c.length||!t.isValidElement(c[0]))return console.warn("Primitive.".concat(e,": asChild prop requires exactly one valid child element.")),t.createElement(e,bn(bn({},u),{ref:r}),l);var s=c[0];return t.cloneElement(s,bn(bn(bn({},u),s.props),r?{ref:function(e){"function"==typeof r?r(e):r&&(r.current=e);var t=s.ref;"function"==typeof t?t(e):t&&(t.current=e)}}:{}))}return t.createElement(e,bn(bn({},u),{ref:r}),l)}));return n.displayName="Primitive.".concat(e),n}(n),e}),{}),Rn=function(e){var n=e.role,r=void 0===n?"button":n,o=e.label,i=void 0===o?"":o,l=e.description,u=void 0===l?"":l,c=e.disabled,s=void 0!==c&&c,a=e.children,f=xn(e,["role","label","description","disabled","children"]);return i&&(f["aria-label"]=i),u&&(f["aria-description"]=u),s&&(f["aria-disabled"]="true",u||(f["aria-description"]="Disabled Button")),t.createElement(En.button,bn({role:r,disabled:s},f),a)},Cn=function(e){var n=e.children,r=xn(e,["children"]),o=u(d),i=o.rootClass,l=o.handleOpenChange;return t.createElement(Rn,bn({onClick:function(){return l(!0)}},r,{className:m("".concat(i,"-trigger"))}),n)},On=function(e){var n=e.children,r=u(d).rootClass,o=document.getElementsByClassName(r)[0];return t.createElement(hn.Portal,{root:o||document.body},n)},Ln=function(){var e=u(d),n=e.isOpen,r=e.rootClass,o=e.handleOverlayClick;return t.createElement(t.Fragment,null,n&&t.createElement(hn.Overlay,{className:m("".concat(r,"-overlay")),onClick:o}))},Sn=function(e){var n=e.children,r=u(d),o=r.rootClass,i=r.handleOpenChange;return t.createElement(Rn,{onClick:function(){return i(!1)},className:m("".concat(o,"-cancel"))},n)},An=function(e){var n=e.children,r=u(d),o=r.rootClass,i=r.handleOpenChange;return t.createElement(Rn,{onClick:function(){return i(!1)},className:m("".concat(o,"-action"))},n)},kn=function(e){var n=e.children,r=e.open,o=void 0!==r&&r,i=e.onOpenChange,u=void 0===i?function(){}:i,c=e.content,s=l(o),a=s[0],f=s[1];return t.createElement(yn,{open:a,onOpenChange:function(e){f(e),u(e)}},t.createElement(Cn,null,n),t.createElement(On,null,t.createElement(Ln,null),t.createElement(wn,null,c,t.createElement(Sn,null,"Cancel"),t.createElement(An,null,"Continue"))))};kn.Root=yn,kn.Content=wn,kn.Trigger=Cn,kn.Portal=On,kn.Overlay=Ln,kn.Cancel=Sn,kn.Action=An;export{kn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import
|
|
1
|
+
'use client';import n,{createContext as e,useContext as t,useState as r,useRef as o,useEffect as i,useCallback as a,useId as c}from"react";function l(n){var e,t,r="";if("string"==typeof n||"number"==typeof n)r+=n;else if("object"==typeof n)if(Array.isArray(n)){var o=n.length;for(e=0;e<o;e++)n[e]&&(t=l(n[e]))&&(r&&(r+=" "),r+=t)}else for(t in n)n[t]&&(r&&(r+=" "),r+=t);return r}function u(){for(var n,e,t=0,r="",o=arguments.length;t<o;t++)(n=arguments[t])&&(e=l(n))&&(r&&(r+=" "),r+=e);return r}var s=e({rootClass:"",open:!1,onOpenChange:function(){},disabled:!1,defaultOpen:!1}),d=function(){return d=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},d.apply(this,arguments)};function f(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(null!=n&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(n);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(n,r[o])&&(t[r[o]]=n[r[o]])}return t}"function"==typeof SuppressedError&&SuppressedError;var p=["div","span","button","input"].reduce((function(e,t){return e[t]=function(e){var t=n.forwardRef((function(t,r){var o=t.asChild,i=void 0!==o&&o,a=t.children,c=f(t,["asChild","children"]);if(i){var l=n.Children.toArray(a);if(1!==l.length||!n.isValidElement(l[0]))return console.warn("Primitive.".concat(e,": asChild prop requires exactly one valid child element.")),n.createElement(e,d(d({},c),{ref:r}),a);var u=l[0];return n.cloneElement(u,d(d(d({},c),u.props),r?{ref:function(n){"function"==typeof r?r(n):r&&(r.current=n);var e=u.ref;"function"==typeof e?e(n):e&&(e.current=n)}}:{}))}return n.createElement(e,d(d({},c),{ref:r}),a)}));return t.displayName="Primitive.".concat(e),t}(t),e}),{}),v=e(void 0),m=function(){var n=t(v);if(!n)throw new Error("Collapsible compound components must be used within a CollapsiblePrimitive.Root component");return n};var h=n.forwardRef((function(e,t){var a=e.children,c=e.className;e.asChild;var l=f(e,["children","className","asChild"]),u=m(),s=u.open,v=u.contentId,h=u.transitionDuration,g=u.transitionTimingFunction,C=o(null),b=t||C,y=r(s?void 0:0),O=y[0],E=y[1],w=r(s),N=w[0],T=w[1],P=o(),A=o();return i((function(){s&&T(!0)}),[s]),i((function(){if(P.current&&clearTimeout(P.current),A.current&&cancelAnimationFrame(A.current),C.current){if(0===h)return E(s?void 0:0),void(s||setTimeout((function(){return T(!1)}),0));if(s)E(0),A.current=requestAnimationFrame((function(){var n;null===(n=C.current)||void 0===n||n.offsetHeight,A.current=requestAnimationFrame((function(){if(C.current){var n=C.current.scrollHeight;E(n)}}))})),P.current=setTimeout((function(){E(void 0)}),h);else{var n=C.current.scrollHeight;E(n),A.current=requestAnimationFrame((function(){var n;null===(n=C.current)||void 0===n||n.offsetHeight,A.current=requestAnimationFrame((function(){E(0)}))})),P.current=setTimeout((function(){T(!1)}),h)}return function(){P.current&&clearTimeout(P.current),A.current&&cancelAnimationFrame(A.current)}}}),[s,h]),N||s?n.createElement(p.div,d({id:v,ref:b,"aria-hidden":!s,"data-state":s?"open":"closed",className:c,style:d({height:void 0!==O?"".concat(O,"px"):void 0,overflow:"hidden"},h>0?{transition:"height ".concat(h,"ms ").concat(g)}:{})},l),a):null}));h.displayName="CollapsiblePrimitiveContent";var g=n.forwardRef((function(e,t){var r=e.children,o=e.asChild,i=void 0!==o&&o,a=f(e,["children","asChild"]),c=m(),l=c.open,u=c.onOpenChange,s=c.disabled,v=c.contentId;return n.createElement(p.button,d({"aria-controls":v,"aria-expanded":l,"data-state":l?"open":"closed","data-disabled":s?"true":void 0,ref:t,onClick:function(n){var e;null===(e=a.onClick)||void 0===e||e.call(a,n),s||u(!l)},asChild:i},a),r)}));g.displayName="CollapsiblePrimitiveTrigger";var C=function(){return console.warn("Direct usage of CollapsiblePrimitive is not supported. Please use CollapsiblePrimitive.Root, CollapsiblePrimitive.Content, etc. instead."),null};C.Root=function(e){var t=e.children,l=e.defaultOpen,u=void 0!==l&&l,s=e.open,m=e.onOpenChange,h=e.disabled,g=void 0!==h&&h,C=e.transitionDuration,b=void 0===C?300:C,y=e.transitionTimingFunction,O=void 0===y?"linear":y,E=f(e,["children","defaultOpen","open","onOpenChange","disabled","transitionDuration","transitionTimingFunction"]),w=c(),N=function(n,e,t){var c=r(e),l=c[0],u=c[1],s=void 0!==n,d=s?n:l,f=o(s),p=o(n);i((function(){"production"!==process.env.NODE_ENV&&(f.current!==s&&console.warn("Component changed from ".concat(f.current?"controlled":"uncontrolled"," to ").concat(s?"controlled":"uncontrolled",".")),f.current=s)}),[s]),i((function(){"production"!==process.env.NODE_ENV&&s&&!t&&n!==p.current&&console.warn("A component is changing a controlled value without an onChange handler. This will render a controlled component as uncontrolled."),p.current=n}),[n,s,t]);var v=a((function(n){var e="function"==typeof n?n(d):n;s||u(e),t&&t(e)}),[s,t,d]);return[d,v]}(s,u,m),T=N[0],P=N[1];return n.createElement(v.Provider,{value:{open:T,onOpenChange:function(n){g||P(n)},disabled:g,contentId:w,transitionDuration:b,transitionTimingFunction:O}},n.createElement(p.div,d({},E,{"data-state":T?"open":"closed","data-disabled":g?"":void 0}),t))},C.Content=h,C.Trigger=g;var b=function(){return console.warn("Direct usage of Tabs is not supported. Please use Tabs.Root, Tabs.List, etc. instead."),null};b.Root=function(e){var t=e.children,r=e.className,o=void 0===r?"":r,i=e.transitionDuration,a=void 0===i?0:i,c=e.disabled,l=e.customRootClass,d=e.open,f=e.defaultOpen,p=e.onOpenChange,v=function(n,e){if(void 0===n&&(n=""),n)return n;var t=e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return"".concat("rad-ui","-").concat(t)}(l,"Collapsible");return n.createElement(s.Provider,{value:{rootClass:v}},n.createElement(C.Root,{className:u(v,o),defaultOpen:f,open:d,onOpenChange:p,disabled:c,transitionDuration:a},t))},b.Trigger=function(e){var r=e.children,o=e.className,i=f(e,["children","className"]),a=t(s).rootClass,c=a?"".concat(a,"-trigger"):"";return n.createElement(C.Trigger,d({className:u(c,o)},i),r)},b.Content=function(e){var r=e.children,o=e.className,i=void 0===o?"":o,a=t(s).rootClass,c=a?"".concat(a,"-content"):"";return n.createElement(C.Content,{className:u(c,i)},r)};export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use client';import e,{createContext as t,useRef as n,useState as r,useContext as a,useEffect as o,useId as l}from"react";function u(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(n=u(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function c(){for(var e,t,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(t=u(e))&&(r&&(r+=" "),r+=t);return r}var i=t({}),s=function(e){return e.querySelectorAll("[data-rad-ui-batch-element]")},d=function(e){var t=null;return e.forEach((function(e){e.hasAttribute("data-rad-ui-focus-element")&&(t=e)})),t},f=function(t){var a=t.children,o=t.customRootClass,l=t["aria-label"],u=n(null),f=function(e,t){if(void 0===e&&(e=""),e)return e;var n=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return"".concat("rad-ui","-").concat(n)}(o,"Disclosure"),v=r(null),m=v[0],p=v[1],h=r(null),E=h[0],b=h[1];return e.createElement(i.Provider,{value:{rootClass:f,activeItem:m,setActiveItem:p,disclosureRef:u,focusNextItem:function(){var e=function(e,t){void 0===t&&(t=!1);var n=d(e),r=null==n?void 0:n.nextElementSibling;return r||(t?e[0]:e[e.length-1])}(s(u.current));if(b(e),e){var t=e.querySelector("button");null==t||t.focus()}},focusPrevItem:function(){var e=function(e,t){void 0===t&&(t=!1);var n=d(e),r=null==n?void 0:n.previousElementSibling;return r||(t?e[e.length-1]:e[0])}(s(null==u?void 0:u.current));if(b(e),e){var t=e.querySelector("button");null==t||t.focus()}},focusItem:E,setFocusItem:b}},e.createElement("div",{className:c("".concat(f,"-root")),ref:u,role:"region","aria-label":l,"data-testid":"disclosure-root"},a))},v=function(){return v=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var a in t=arguments[n])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},v.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var m=t({}),p=function(t){var u=t.children,s=t.className,d=void 0===s?"":s,f=t.value,p=n(null),h=a(i),E=h.activeItem,b=h.rootClass,g=h.focusItem,y=r(f),I=y[0],A=y[1],C=r(!1),N=C[0],S=C[1];o((function(){S(E===I)}),[E,I]);var k=l(),w=!1;(null==g?void 0:g.id)==="disclosure-data-item-".concat(k)&&(w=!0);var x=function(){var e=null==p?void 0:p.current;e&&e.setAttribute("data-rad-ui-focus-element","")};return e.createElement(m.Provider,{value:{itemValue:I,setItemValue:A,handleBlurEvent:function(){var e=null==p?void 0:p.current;e&&e.removeAttribute("data-rad-ui-focus-element")},handleClickEvent:function(){x()},handleFocusEvent:function(){x()}}},e.createElement("div",v({className:c("".concat(b,"-item"),d),ref:p,"data-state":N?"open":"closed",id:"disclosure-data-item-".concat(k),role:"region","aria-labelledby":"disclosure-trigger-".concat(k),"data-expanded":N,"data-rad-ui-batch-element":!0},w?{"data-rad-ui-focus-element":""}:{}),u))},h=function(t){var n=t.children,r=t.className,o=a(i),l=o.activeItem,u=o.setActiveItem,s=o.rootClass,d=o.focusNextItem,f=o.focusPrevItem,v=a(m),p=v.itemValue,h=v.handleBlurEvent,E=v.handleClickEvent,b=v.handleFocusEvent;return e.createElement("button",{type:"button",className:c("".concat(s,"-trigger"),r),onClick:function(){u(l===p?null:p),E()},onBlur:h,onFocus:function(){b()},onKeyDown:function(e){"ArrowDown"===e.key&&(e.preventDefault(),d()),"ArrowUp"===e.key&&(e.preventDefault(),f())},"aria-expanded":l===p,"aria-haspopup":"true"},n)},E=function(t){var n=t.children,r=t.className,o=void 0===r?"":r,l=a(i),u=l.activeItem,s=l.rootClass,d=a(m).itemValue;return e.createElement("div",{className:c("".concat(s,"-content"),o),hidden:u!==d,role:"region","aria-hidden":u!==d},n)},b=function(t){var n=t.items;return e.createElement(f,null,n.map((function(t,n){return e.createElement(p,{key:n,value:n},e.createElement(h,null,t.title),e.createElement(E,null,t.content))})))};b.Root=f,b.Item=p,b.Trigger=h,b.Content=E;export{b as default};
|
|
1
|
+
'use client';import e,{createContext as t,useRef as n,useState as r,useId as o,useEffect as a,forwardRef as i,useContext as l,useCallback as c}from"react";function u(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=u(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function d(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=u(e))&&(r&&(r+=" "),r+=t);return r}var s=t({}),f=function(){return f=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},f.apply(this,arguments)};function v(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 m(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o<a;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var p=["div","span","button","input"].reduce((function(t,n){return t[n]=function(t){var n=e.forwardRef((function(n,r){var o=n.asChild,a=void 0!==o&&o,i=n.children,l=v(n,["asChild","children"]);if(a){var c=e.Children.toArray(i);if(1!==c.length||!e.isValidElement(c[0]))return console.warn("Primitive.".concat(t,": asChild prop requires exactly one valid child element.")),e.createElement(t,f(f({},l),{ref:r}),i);var u=c[0];return e.cloneElement(u,f(f(f({},l),u.props),r?{ref:function(e){"function"==typeof r?r(e):r&&(r.current=e);var t=u.ref;"function"==typeof t?t(e):t&&(t.current=e)}}:{}))}return e.createElement(t,f(f({},l),{ref:r}),i)}));return n.displayName="Primitive.".concat(t),n}(n),t}),{}),h=t({orientation:"horizontal",loop:!0}),b=t({focusedItemId:null,setFocusedItemId:function(){},focusItems:[],setFocusItems:function(){},addFocusItem:function(){},groupRef:null}),g=i((function(t,n){var r,i=t.children,c=t["aria-label"],u=t["aria-labelledby"],d=v(t,["children","aria-label","aria-labelledby"]),s=o(),m=l(b),g=m.focusedItemId,y=m.setFocusedItemId,C=m.addFocusItem,E=m.focusItems,I=m.groupRef,w=l(h),O=w.orientation,A=w.loop,F=e.Children.toArray(i)[0],N=!0===(null===(r=null==F?void 0:F.props)||void 0===r?void 0:r.disabled),P=g===s;a((function(){E.includes(s)||C(s)}),[E,g,s,C]);var D=function(e){if(I&&I.current){y(e);var t=CSS.escape(e),n=I.current.querySelector("#".concat(t));n&&n.focus()}},R=function(e,t){for(var n,r=e,o=0;o<E.length;o++){if(r+=t,A)r<0&&(r=E.length-1),r>=E.length&&(r=0);else if(r<0||r>=E.length)return-1;var a=E[r],i=null===(n=null==I?void 0:I.current)||void 0===n?void 0:n.querySelector("#".concat(CSS.escape(a)));if(i)if(!("true"===i.getAttribute("data-child-disabled")))return r}return-1},T=function(){var e=E.indexOf(s),t=R(e,-1);-1!==t&&D(E[t])},x=function(){var e=E.indexOf(s),t=R(e,1);-1!==t&&D(E[t])};return e.createElement(p.button,f({asChild:!0,onFocus:function(e){e.preventDefault(),N||y(s)},tabIndex:!N&&P?0:-1,ref:n,id:s,onKeyDown:function(e){if(!N)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&&x();break;case"ArrowRight":e.preventDefault(),"horizontal"===O&&x();break;case"Home":e.preventDefault(),function(){if(E.length>0){var e=R(-1,1);-1!==e&&D(E[e])}}();break;case"End":e.preventDefault(),function(){if(E.length>0){var e=R(E.length,-1);-1!==e&&D(E[e])}}()}},"data-child-disabled":N,role:"option","aria-selected":P,"aria-disabled":N,"aria-label":c,"aria-labelledby":u},d),i)}));g.displayName="RovingFocusItem";var y={Root:function(t){var n=t.children,r=t.orientation,o=void 0===r?"horizontal":r,a=t.loop,i=void 0===a||a,l=t["aria-label"],c=t["aria-labelledby"],u=v(t,["children","orientation","loop","aria-label","aria-labelledby"]),d={orientation:o,loop:i};return e.createElement(h.Provider,{value:d},e.createElement(p.div,f({role:"listbox","aria-orientation":o,"aria-label":l,"aria-labelledby":c},u),n))},Group:function(t){var i=t.children,l=t["aria-label"],c=t["aria-labelledby"],u=v(t,["children","aria-label","aria-labelledby"]),d=n(null),s=r([]),h=s[0],g=s[1],y=r(null),C=y[0],E=y[1],I=o();a((function(){!C&&h.length>0&&E(h[0])}),[h,C]);var w={focusedItemId:C,setFocusedItemId:E,focusItems:h,setFocusItems:g,addFocusItem:function(e){g((function(t){return m(m([],t,!0),[e],!1)}))},groupRef:d};return e.createElement(b.Provider,{value:w},e.createElement(p.div,f({id:I,ref:d,role:"group","aria-label":l,"aria-labelledby":c},u),i))},Item:g},C=function(t){var o=t.children,a=t.customRootClass,i=t["aria-label"],l=n(null),c=function(e,t){if(void 0===e&&(e=""),e)return e;var n=t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();return"".concat("rad-ui","-").concat(n)}(a,"Disclosure"),u=r(null),f=u[0],v=u[1];return e.createElement(s.Provider,{value:{rootClass:c,activeItem:f,setActiveItem:v,disclosureRef:l}},e.createElement(y.Root,null,e.createElement(y.Group,{className:d("".concat(c,"-root"))},e.createElement("div",{className:d("".concat(c,"-root")),ref:l,role:"region","aria-label":i,"data-testid":"disclosure-root"},o))))},E=t({}),I=t(void 0),w=function(){var e=l(I);if(!e)throw new Error("Collapsible compound components must be used within a CollapsiblePrimitive.Root component");return e};var O=e.forwardRef((function(t,o){var i=t.children,l=t.className;t.asChild;var c=v(t,["children","className","asChild"]),u=w(),d=u.open,s=u.contentId,m=u.transitionDuration,h=u.transitionTimingFunction,b=n(null),g=o||b,y=r(d?void 0:0),C=y[0],E=y[1],I=r(d),O=I[0],A=I[1],F=n(),N=n();return a((function(){d&&A(!0)}),[d]),a((function(){if(F.current&&clearTimeout(F.current),N.current&&cancelAnimationFrame(N.current),b.current){if(0===m)return E(d?void 0:0),void(d||setTimeout((function(){return A(!1)}),0));if(d)E(0),N.current=requestAnimationFrame((function(){var e;null===(e=b.current)||void 0===e||e.offsetHeight,N.current=requestAnimationFrame((function(){if(b.current){var e=b.current.scrollHeight;E(e)}}))})),F.current=setTimeout((function(){E(void 0)}),m);else{var e=b.current.scrollHeight;E(e),N.current=requestAnimationFrame((function(){var e;null===(e=b.current)||void 0===e||e.offsetHeight,N.current=requestAnimationFrame((function(){E(0)}))})),F.current=setTimeout((function(){A(!1)}),m)}return function(){F.current&&clearTimeout(F.current),N.current&&cancelAnimationFrame(N.current)}}}),[d,m]),O||d?e.createElement(p.div,f({id:s,ref:g,"aria-hidden":!d,"data-state":d?"open":"closed",className:l,style:f({height:void 0!==C?"".concat(C,"px"):void 0,overflow:"hidden"},m>0?{transition:"height ".concat(m,"ms ").concat(h)}:{})},c),i):null}));O.displayName="CollapsiblePrimitiveContent";var A=e.forwardRef((function(t,n){var r=t.children,o=t.asChild,a=void 0!==o&&o,i=v(t,["children","asChild"]),l=w(),c=l.open,u=l.onOpenChange,d=l.disabled,s=l.contentId;return e.createElement(p.button,f({"aria-controls":s,"aria-expanded":c,"data-state":c?"open":"closed","data-disabled":d?"true":void 0,ref:n,onClick:function(e){var t;null===(t=i.onClick)||void 0===t||t.call(i,e),d||u(!c)},asChild:a},i),r)}));A.displayName="CollapsiblePrimitiveTrigger";var F=function(){return console.warn("Direct usage of CollapsiblePrimitive is not supported. Please use CollapsiblePrimitive.Root, CollapsiblePrimitive.Content, etc. instead."),null};F.Root=function(t){var i=t.children,l=t.defaultOpen,u=void 0!==l&&l,d=t.open,s=t.onOpenChange,m=t.disabled,h=void 0!==m&&m,b=t.transitionDuration,g=void 0===b?300:b,y=t.transitionTimingFunction,C=void 0===y?"linear":y,E=v(t,["children","defaultOpen","open","onOpenChange","disabled","transitionDuration","transitionTimingFunction"]),w=o(),O=function(e,t,o){var i=r(t),l=i[0],u=i[1],d=void 0!==e,s=d?e:l,f=n(d),v=n(e);a((function(){"production"!==process.env.NODE_ENV&&(f.current!==d&&console.warn("Component changed from ".concat(f.current?"controlled":"uncontrolled"," to ").concat(d?"controlled":"uncontrolled",".")),f.current=d)}),[d]),a((function(){"production"!==process.env.NODE_ENV&&d&&!o&&e!==v.current&&console.warn("A component is changing a controlled value without an onChange handler. This will render a controlled component as uncontrolled."),v.current=e}),[e,d,o]);var m=c((function(e){var t="function"==typeof e?e(s):e;d||u(t),o&&o(t)}),[d,o,s]);return[s,m]}(d,u,s),A=O[0],F=O[1];return e.createElement(I.Provider,{value:{open:A,onOpenChange:function(e){h||F(e)},disabled:h,contentId:w,transitionDuration:g,transitionTimingFunction:C}},e.createElement(p.div,f({},E,{"data-state":A?"open":"closed","data-disabled":h?"":void 0}),i))},F.Content=O,F.Trigger=A;var N=function(t){var i=t.children,c=t.className,u=void 0===c?"":c,f=t.value,v=n(null),m=l(s),p=m.activeItem,h=m.rootClass,b=r(f),g=b[0],y=b[1],C=r(!1),I=C[0],w=C[1];a((function(){w(p===g)}),[p,g]);var O=o();return e.createElement(E.Provider,{value:{itemValue:g,setItemValue:y}},e.createElement(F.Root,{open:I,asChild:!0},e.createElement("div",{className:d("".concat(h,"-item"),u),ref:v,"data-state":I?"open":"closed",id:"disclosure-data-item-".concat(O),role:"region","aria-labelledby":"disclosure-trigger-".concat(O)},i)))},P=function(t){var n=t.children,r=t.className,o=l(s),a=o.activeItem,i=o.setActiveItem,c=o.rootClass,u=l(E).itemValue;return e.createElement(y.Item,null,e.createElement(F.Trigger,{asChild:!0},e.createElement("button",{type:"button",className:d("".concat(c,"-trigger"),r),onClick:function(e){a===u?i(null):a!==u&&i(u)},"aria-expanded":a===u,"aria-haspopup":"true"},n)))},D=function(t){var n=t.children,r=t.className,o=void 0===r?"":r,a=l(s),i=a.activeItem,c=a.rootClass,u=l(E).itemValue;return u!==i?null:e.createElement(F.Content,{className:d("".concat(c,"-content"),o),role:"region","aria-hidden":i!==u},n)},R=function(t){var n=t.items;return e.createElement(C,null,n.map((function(t,n){return e.createElement(N,{key:n,value:n},e.createElement(P,null,t.title),e.createElement(D,null,t.content))})))};R.Root=C,R.Item=N,R.Trigger=P,R.Content=D;export{R as default};
|