mirotone-react
Version:
Mirotone React is a component library for the Mirotone Design System, offering a range of components and utilities to speed up development for Miro. It draws inspiration from Mirotone CSS and Miro UI Components.
1 lines • 109 kB
JavaScript
import{jsx as e,Fragment as n,jsxs as t}from"react/jsx-runtime";import*as r from"react";import o,{useLayoutEffect as a,useEffect as i,useState as c,forwardRef as l}from"react";import*as s from"react-dom";import u from"react-dom";function d(e,n){void 0===n&&(n={});var t=n.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===t&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}function f(e,n,{checkForDefaultPrevented:t=!0}={}){return function(r){if(e?.(r),!1===t||!r.defaultPrevented)return n?.(r)}}function p(e,n){if("function"==typeof e)return e(n);null!=e&&(e.current=n)}function m(...e){return n=>{let t=!1;const r=e.map((e=>{const r=p(e,n);return t||"function"!=typeof r||(t=!0),r}));if(t)return()=>{for(let n=0;n<r.length;n++){const t=r[n];"function"==typeof t?t():p(e[n],null)}}}}function h(...e){return r.useCallback(m(...e),e)}function g(n,t=[]){let o=[];const a=()=>{const e=o.map((e=>r.createContext(e)));return function(t){const o=t?.[n]||e;return r.useMemo((()=>({[`__scope${n}`]:{...t,[n]:o}})),[t,o])}};return a.scopeName=n,[function(t,a){const i=r.createContext(a),c=o.length;o=[...o,a];const l=t=>{const{scope:o,children:a,...l}=t,s=o?.[n]?.[c]||i,u=r.useMemo((()=>l),Object.values(l));return e(s.Provider,{value:u,children:a})};return l.displayName=t+"Provider",[l,function(e,o){const l=o?.[n]?.[c]||i,s=r.useContext(l);if(s)return s;if(void 0!==a)return a;throw new Error(`\`${e}\` must be used within \`${t}\``)}]},v(a,...t)]}function v(...e){const n=e[0];if(1===e.length)return n;const t=()=>{const t=e.map((e=>({useScope:e(),scopeName:e.scopeName})));return function(e){const o=t.reduce(((n,{useScope:t,scopeName:r})=>({...n,...t(e)[`__scope${r}`]})),{});return r.useMemo((()=>({[`__scope${n.scopeName}`]:o})),[o])}};return t.scopeName=n.scopeName,t}function y(e){const n=r.useRef(e);return r.useEffect((()=>{n.current=e})),r.useMemo((()=>(...e)=>n.current?.(...e)),[])}function w({prop:e,defaultProp:n,onChange:t=()=>{}}){const[o,a]=function({defaultProp:e,onChange:n}){const t=r.useState(e),[o]=t,a=r.useRef(o),i=y(n);return r.useEffect((()=>{a.current!==o&&(i(o),a.current=o)}),[o,a,i]),t}({defaultProp:n,onChange:t}),i=void 0!==e,c=i?e:o,l=y(t);return[c,r.useCallback((n=>{if(i){const t="function"==typeof n?n(e):n;t!==e&&l(t)}else a(n)}),[i,e,a,l])]}d("@import url('https://unpkg.com/mirotone@5.3.0/dist/styles.css');\n");var b=r.forwardRef(((n,t)=>{const{children:o,...a}=n,i=r.Children.toArray(o),c=i.find(N);if(c){const n=c.props.children,o=i.map((e=>e===c?r.Children.count(n)>1?r.Children.only(null):r.isValidElement(n)?n.props.children:null:e));return e(x,{...a,ref:t,children:r.isValidElement(n)?r.cloneElement(n,void 0,o):null})}return e(x,{...a,ref:t,children:o})}));b.displayName="Slot";var x=r.forwardRef(((e,n)=>{const{children:t,...o}=e;if(r.isValidElement(t)){const e=function(e){let n=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,t=n&&"isReactWarning"in n&&n.isReactWarning;if(t)return e.ref;if(n=Object.getOwnPropertyDescriptor(e,"ref")?.get,t=n&&"isReactWarning"in n&&n.isReactWarning,t)return e.props.ref;return e.props.ref||e.ref}(t),a=function(e,n){const t={...n};for(const r in n){const o=e[r],a=n[r];/^on[A-Z]/.test(r)?o&&a?t[r]=(...e)=>{a(...e),o(...e)}:o&&(t[r]=o):"style"===r?t[r]={...o,...a}:"className"===r&&(t[r]=[o,a].filter(Boolean).join(" "))}return{...e,...t}}(o,t.props);return t.type!==r.Fragment&&(a.ref=n?m(n,e):e),r.cloneElement(t,a)}return r.Children.count(t)>1?r.Children.only(null):null}));x.displayName="SlotClone";var _=({children:t})=>e(n,{children:t});function N(e){return r.isValidElement(e)&&e.type===_}var C=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"].reduce(((n,t)=>{const o=r.forwardRef(((n,r)=>{const{asChild:o,...a}=n,i=o?b:t;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),e(i,{...a,ref:r})}));return o.displayName=`Primitive.${t}`,{...n,[t]:o}}),{});function E(e,n){e&&s.flushSync((()=>e.dispatchEvent(n)))}function k(n){const t=n+"CollectionProvider",[r,a]=g(t),[i,c]=r(t,{collectionRef:{current:null},itemMap:new Map}),l=n=>{const{scope:t,children:r}=n,a=o.useRef(null),c=o.useRef(new Map).current;return e(i,{scope:t,itemMap:c,collectionRef:a,children:r})};l.displayName=t;const s=n+"CollectionSlot",u=o.forwardRef(((n,t)=>{const{scope:r,children:o}=n,a=h(t,c(s,r).collectionRef);return e(b,{ref:a,children:o})}));u.displayName=s;const d=n+"CollectionItemSlot",f="data-radix-collection-item",p=o.forwardRef(((n,t)=>{const{scope:r,children:a,...i}=n,l=o.useRef(null),s=h(t,l),u=c(d,r);return o.useEffect((()=>(u.itemMap.set(l,{ref:l,...i}),()=>{u.itemMap.delete(l)}))),e(b,{[f]:"",ref:s,children:a})}));return p.displayName=d,[{Provider:l,Slot:u,ItemSlot:p},function(e){const t=c(n+"CollectionConsumer",e);return o.useCallback((()=>{const e=t.collectionRef.current;if(!e)return[];const n=Array.from(e.querySelectorAll(`[${f}]`));return Array.from(t.itemMap.values()).sort(((e,t)=>n.indexOf(e.ref.current)-n.indexOf(t.ref.current)))}),[t.collectionRef,t.itemMap])},a]}var R=r.createContext(void 0);function D(e){const n=r.useContext(R);return e||n||"ltr"}var T,S="dismissableLayer.update",M="dismissableLayer.pointerDownOutside",A="dismissableLayer.focusOutside",O=r.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),P=r.forwardRef(((n,t)=>{const{disableOutsidePointerEvents:o=!1,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:c,onInteractOutside:l,onDismiss:s,...u}=n,d=r.useContext(O),[p,m]=r.useState(null),g=p?.ownerDocument??globalThis?.document,[,v]=r.useState({}),w=h(t,(e=>m(e))),b=Array.from(d.layers),[x]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),_=b.indexOf(x),N=p?b.indexOf(p):-1,E=d.layersWithOutsidePointerEventsDisabled.size>0,k=N>=_,R=function(e,n=globalThis?.document){const t=y(e),o=r.useRef(!1),a=r.useRef((()=>{}));return r.useEffect((()=>{const e=e=>{if(e.target&&!o.current){let r=function(){L(M,t,o,{discrete:!0})};const o={originalEvent:e};"touch"===e.pointerType?(n.removeEventListener("click",a.current),a.current=r,n.addEventListener("click",a.current,{once:!0})):r()}else n.removeEventListener("click",a.current);o.current=!1},r=window.setTimeout((()=>{n.addEventListener("pointerdown",e)}),0);return()=>{window.clearTimeout(r),n.removeEventListener("pointerdown",e),n.removeEventListener("click",a.current)}}),[n,t]),{onPointerDownCapture:()=>o.current=!0}}((e=>{const n=e.target,t=[...d.branches].some((e=>e.contains(n)));k&&!t&&(i?.(e),l?.(e),e.defaultPrevented||s?.())}),g),D=function(e,n=globalThis?.document){const t=y(e),o=r.useRef(!1);return r.useEffect((()=>{const e=e=>{if(e.target&&!o.current){L(A,t,{originalEvent:e},{discrete:!1})}};return n.addEventListener("focusin",e),()=>n.removeEventListener("focusin",e)}),[n,t]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}((e=>{const n=e.target;[...d.branches].some((e=>e.contains(n)))||(c?.(e),l?.(e),e.defaultPrevented||s?.())}),g);return function(e,n=globalThis?.document){const t=y(e);r.useEffect((()=>{const e=e=>{"Escape"===e.key&&t(e)};return n.addEventListener("keydown",e,{capture:!0}),()=>n.removeEventListener("keydown",e,{capture:!0})}),[t,n])}((e=>{N===d.layers.size-1&&(a?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))}),g),r.useEffect((()=>{if(p)return o&&(0===d.layersWithOutsidePointerEventsDisabled.size&&(T=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),I(),()=>{o&&1===d.layersWithOutsidePointerEventsDisabled.size&&(g.body.style.pointerEvents=T)}}),[p,g,o,d]),r.useEffect((()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),I())}),[p,d]),r.useEffect((()=>{const e=()=>v({});return document.addEventListener(S,e),()=>document.removeEventListener(S,e)}),[]),e(C.div,{...u,ref:w,style:{pointerEvents:E?k?"auto":"none":void 0,...n.style},onFocusCapture:f(n.onFocusCapture,D.onFocusCapture),onBlurCapture:f(n.onBlurCapture,D.onBlurCapture),onPointerDownCapture:f(n.onPointerDownCapture,R.onPointerDownCapture)})}));P.displayName="DismissableLayer";function I(){const e=new CustomEvent(S);document.dispatchEvent(e)}function L(e,n,t,{discrete:r}){const o=t.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:t});n&&o.addEventListener(e,n,{once:!0}),r?E(o,a):o.dispatchEvent(a)}r.forwardRef(((n,t)=>{const o=r.useContext(O),a=r.useRef(null),i=h(t,a);return r.useEffect((()=>{const e=a.current;if(e)return o.branches.add(e),()=>{o.branches.delete(e)}}),[o.branches]),e(C.div,{...n,ref:i})})).displayName="DismissableLayerBranch";var F=0;function z(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var j="focusScope.autoFocusOnMount",B="focusScope.autoFocusOnUnmount",W={bubbles:!1,cancelable:!0},H=r.forwardRef(((n,t)=>{const{loop:o=!1,trapped:a=!1,onMountAutoFocus:i,onUnmountAutoFocus:c,...l}=n,[s,u]=r.useState(null),d=y(i),f=y(c),p=r.useRef(null),m=h(t,(e=>u(e))),g=r.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;r.useEffect((()=>{if(a){let e=function(e){if(g.paused||!s)return;const n=e.target;s.contains(n)?p.current=n:G(p.current,{select:!0})},n=function(e){if(g.paused||!s)return;const n=e.relatedTarget;null!==n&&(s.contains(n)||G(p.current,{select:!0}))},t=function(e){if(document.activeElement===document.body)for(const n of e)n.removedNodes.length>0&&G(s)};document.addEventListener("focusin",e),document.addEventListener("focusout",n);const r=new MutationObserver(t);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",e),document.removeEventListener("focusout",n),r.disconnect()}}}),[a,s,g.paused]),r.useEffect((()=>{if(s){V.add(g);const n=document.activeElement;if(!s.contains(n)){const t=new CustomEvent(j,W);s.addEventListener(j,d),s.dispatchEvent(t),t.defaultPrevented||(!function(e,{select:n=!1}={}){const t=document.activeElement;for(const r of e)if(G(r,{select:n}),document.activeElement!==t)return}((e=K(s),e.filter((e=>"A"!==e.tagName))),{select:!0}),document.activeElement===n&&G(s))}return()=>{s.removeEventListener(j,d),setTimeout((()=>{const e=new CustomEvent(B,W);s.addEventListener(B,f),s.dispatchEvent(e),e.defaultPrevented||G(n??document.body,{select:!0}),s.removeEventListener(B,f),V.remove(g)}),0)}}var e}),[s,d,f,g]);const v=r.useCallback((e=>{if(!o&&!a)return;if(g.paused)return;const n="Tab"===e.key&&!e.altKey&&!e.ctrlKey&&!e.metaKey,t=document.activeElement;if(n&&t){const n=e.currentTarget,[r,a]=function(e){const n=K(e),t=$(n,e),r=$(n.reverse(),e);return[t,r]}(n);r&&a?e.shiftKey||t!==a?e.shiftKey&&t===r&&(e.preventDefault(),o&&G(a,{select:!0})):(e.preventDefault(),o&&G(r,{select:!0})):t===n&&e.preventDefault()}}),[o,a,g.paused]);return e(C.div,{tabIndex:-1,...l,ref:m,onKeyDown:v})}));function K(e){const n=[],t=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{const n="INPUT"===e.tagName&&"hidden"===e.type;return e.disabled||e.hidden||n?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;t.nextNode();)n.push(t.currentNode);return n}function $(e,n){for(const t of e)if(!U(t,{upTo:n}))return t}function U(e,{upTo:n}){if("hidden"===getComputedStyle(e).visibility)return!0;for(;e;){if(void 0!==n&&e===n)return!1;if("none"===getComputedStyle(e).display)return!0;e=e.parentElement}return!1}function G(e,{select:n=!1}={}){if(e&&e.focus){const t=document.activeElement;e.focus({preventScroll:!0}),e!==t&&function(e){return e instanceof HTMLInputElement&&"select"in e}(e)&&n&&e.select()}}H.displayName="FocusScope";var V=function(){let e=[];return{add(n){const t=e[0];n!==t&&t?.pause(),e=X(e,n),e.unshift(n)},remove(n){e=X(e,n),e[0]?.resume()}}}();function X(e,n){const t=[...e],r=t.indexOf(n);return-1!==r&&t.splice(r,1),t}var Y=Boolean(globalThis?.document)?r.useLayoutEffect:()=>{},Z=r["useId".toString()]||(()=>{}),q=0;function Q(e){const[n,t]=r.useState(Z());return Y((()=>{t((e=>e??String(q++)))}),[e]),e||(n?`radix-${n}`:"")}const J=["top","right","bottom","left"],ee=Math.min,ne=Math.max,te=Math.round,re=Math.floor,oe=e=>({x:e,y:e}),ae={left:"right",right:"left",bottom:"top",top:"bottom"},ie={start:"end",end:"start"};function ce(e,n,t){return ne(e,ee(n,t))}function le(e,n){return"function"==typeof e?e(n):e}function se(e){return e.split("-")[0]}function ue(e){return e.split("-")[1]}function de(e){return"x"===e?"y":"x"}function fe(e){return"y"===e?"height":"width"}function pe(e){return["top","bottom"].includes(se(e))?"y":"x"}function me(e){return de(pe(e))}function he(e){return e.replace(/start|end/g,(e=>ie[e]))}function ge(e){return e.replace(/left|right|bottom|top/g,(e=>ae[e]))}function ve(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 ye(e){const{x:n,y:t,width:r,height:o}=e;return{width:r,height:o,top:t,left:n,right:n+r,bottom:t+o,x:n,y:t}}function we(e,n,t){let{reference:r,floating:o}=e;const a=pe(n),i=me(n),c=fe(i),l=se(n),s="y"===a,u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[c]/2-o[c]/2;let p;switch(l){case"top":p={x:u,y:r.y-o.height};break;case"bottom":p={x:u,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:d};break;case"left":p={x:r.x-o.width,y:d};break;default:p={x:r.x,y:r.y}}switch(ue(n)){case"start":p[i]-=f*(t&&s?-1:1);break;case"end":p[i]+=f*(t&&s?-1:1)}return p}async function be(e,n){var t;void 0===n&&(n={});const{x:r,y:o,platform:a,rects:i,elements:c,strategy:l}=e,{boundary:s="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=le(n,e),m=ve(p),h=c[f?"floating"===d?"reference":"floating":d],g=ye(await a.getClippingRect({element:null==(t=await(null==a.isElement?void 0:a.isElement(h)))||t?h:h.contextElement||await(null==a.getDocumentElement?void 0:a.getDocumentElement(c.floating)),boundary:s,rootBoundary:u,strategy:l})),v="floating"===d?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,y=await(null==a.getOffsetParent?void 0:a.getOffsetParent(c.floating)),w=await(null==a.isElement?void 0:a.isElement(y))&&await(null==a.getScale?void 0:a.getScale(y))||{x:1,y:1},b=ye(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:v,offsetParent:y,strategy:l}):v);return{top:(g.top-b.top+m.top)/w.y,bottom:(b.bottom-g.bottom+m.bottom)/w.y,left:(g.left-b.left+m.left)/w.x,right:(b.right-g.right+m.right)/w.x}}function xe(e,n){return{top:e.top-n.height,right:e.right-n.width,bottom:e.bottom-n.height,left:e.left-n.width}}function _e(e){return J.some((n=>e[n]>=0))}function Ne(){return"undefined"!=typeof window}function Ce(e){return Re(e)?(e.nodeName||"").toLowerCase():"#document"}function Ee(e){var n;return(null==e||null==(n=e.ownerDocument)?void 0:n.defaultView)||window}function ke(e){var n;return null==(n=(Re(e)?e.ownerDocument:e.document)||window.document)?void 0:n.documentElement}function Re(e){return!!Ne()&&(e instanceof Node||e instanceof Ee(e).Node)}function De(e){return!!Ne()&&(e instanceof Element||e instanceof Ee(e).Element)}function Te(e){return!!Ne()&&(e instanceof HTMLElement||e instanceof Ee(e).HTMLElement)}function Se(e){return!(!Ne()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof Ee(e).ShadowRoot)}function Me(e){const{overflow:n,overflowX:t,overflowY:r,display:o}=Fe(e);return/auto|scroll|overlay|hidden|clip/.test(n+r+t)&&!["inline","contents"].includes(o)}function Ae(e){return["table","td","th"].includes(Ce(e))}function Oe(e){return[":popover-open",":modal"].some((n=>{try{return e.matches(n)}catch(e){return!1}}))}function Pe(e){const n=Ie(),t=De(e)?Fe(e):e;return["transform","translate","scale","rotate","perspective"].some((e=>!!t[e]&&"none"!==t[e]))||!!t.containerType&&"normal"!==t.containerType||!n&&!!t.backdropFilter&&"none"!==t.backdropFilter||!n&&!!t.filter&&"none"!==t.filter||["transform","translate","scale","rotate","perspective","filter"].some((e=>(t.willChange||"").includes(e)))||["paint","layout","strict","content"].some((e=>(t.contain||"").includes(e)))}function Ie(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Le(e){return["html","body","#document"].includes(Ce(e))}function Fe(e){return Ee(e).getComputedStyle(e)}function ze(e){return De(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function je(e){if("html"===Ce(e))return e;const n=e.assignedSlot||e.parentNode||Se(e)&&e.host||ke(e);return Se(n)?n.host:n}function Be(e){const n=je(e);return Le(n)?e.ownerDocument?e.ownerDocument.body:e.body:Te(n)&&Me(n)?n:Be(n)}function We(e,n,t){var r;void 0===n&&(n=[]),void 0===t&&(t=!0);const o=Be(e),a=o===(null==(r=e.ownerDocument)?void 0:r.body),i=Ee(o);if(a){const e=He(i);return n.concat(i,i.visualViewport||[],Me(o)?o:[],e&&t?We(e):[])}return n.concat(o,We(o,[],t))}function He(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ke(e){const n=Fe(e);let t=parseFloat(n.width)||0,r=parseFloat(n.height)||0;const o=Te(e),a=o?e.offsetWidth:t,i=o?e.offsetHeight:r,c=te(t)!==a||te(r)!==i;return c&&(t=a,r=i),{width:t,height:r,$:c}}function $e(e){return De(e)?e:e.contextElement}function Ue(e){const n=$e(e);if(!Te(n))return oe(1);const t=n.getBoundingClientRect(),{width:r,height:o,$:a}=Ke(n);let i=(a?te(t.width):t.width)/r,c=(a?te(t.height):t.height)/o;return i&&Number.isFinite(i)||(i=1),c&&Number.isFinite(c)||(c=1),{x:i,y:c}}const Ge=oe(0);function Ve(e){const n=Ee(e);return Ie()&&n.visualViewport?{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}:Ge}function Xe(e,n,t,r){void 0===n&&(n=!1),void 0===t&&(t=!1);const o=e.getBoundingClientRect(),a=$e(e);let i=oe(1);n&&(r?De(r)&&(i=Ue(r)):i=Ue(e));const c=function(e,n,t){return void 0===n&&(n=!1),!(!t||n&&t!==Ee(e))&&n}(a,t,r)?Ve(a):oe(0);let l=(o.left+c.x)/i.x,s=(o.top+c.y)/i.y,u=o.width/i.x,d=o.height/i.y;if(a){const e=Ee(a),n=r&&De(r)?Ee(r):r;let t=e,o=He(t);for(;o&&r&&n!==t;){const e=Ue(o),n=o.getBoundingClientRect(),r=Fe(o),a=n.left+(o.clientLeft+parseFloat(r.paddingLeft))*e.x,i=n.top+(o.clientTop+parseFloat(r.paddingTop))*e.y;l*=e.x,s*=e.y,u*=e.x,d*=e.y,l+=a,s+=i,t=Ee(o),o=He(t)}}return ye({width:u,height:d,x:l,y:s})}function Ye(e,n){const t=ze(e).scrollLeft;return n?n.left+t:Xe(ke(e)).left+t}function Ze(e,n,t){void 0===t&&(t=!1);const r=e.getBoundingClientRect();return{x:r.left+n.scrollLeft-(t?0:Ye(e,r)),y:r.top+n.scrollTop}}function qe(e,n,t){let r;if("viewport"===n)r=function(e,n){const t=Ee(e),r=ke(e),o=t.visualViewport;let a=r.clientWidth,i=r.clientHeight,c=0,l=0;if(o){a=o.width,i=o.height;const e=Ie();(!e||e&&"fixed"===n)&&(c=o.offsetLeft,l=o.offsetTop)}return{width:a,height:i,x:c,y:l}}(e,t);else if("document"===n)r=function(e){const n=ke(e),t=ze(e),r=e.ownerDocument.body,o=ne(n.scrollWidth,n.clientWidth,r.scrollWidth,r.clientWidth),a=ne(n.scrollHeight,n.clientHeight,r.scrollHeight,r.clientHeight);let i=-t.scrollLeft+Ye(e);const c=-t.scrollTop;return"rtl"===Fe(r).direction&&(i+=ne(n.clientWidth,r.clientWidth)-o),{width:o,height:a,x:i,y:c}}(ke(e));else if(De(n))r=function(e,n){const t=Xe(e,!0,"fixed"===n),r=t.top+e.clientTop,o=t.left+e.clientLeft,a=Te(e)?Ue(e):oe(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:o*a.x,y:r*a.y}}(n,t);else{const t=Ve(e);r={x:n.x-t.x,y:n.y-t.y,width:n.width,height:n.height}}return ye(r)}function Qe(e,n){const t=je(e);return!(t===n||!De(t)||Le(t))&&("fixed"===Fe(t).position||Qe(t,n))}function Je(e,n,t){const r=Te(n),o=ke(n),a="fixed"===t,i=Xe(e,!0,a,n);let c={scrollLeft:0,scrollTop:0};const l=oe(0);if(r||!r&&!a)if(("body"!==Ce(n)||Me(o))&&(c=ze(n)),r){const e=Xe(n,!0,a,n);l.x=e.x+n.clientLeft,l.y=e.y+n.clientTop}else o&&(l.x=Ye(o));const s=!o||r||a?oe(0):Ze(o,c);return{x:i.left+c.scrollLeft-l.x-s.x,y:i.top+c.scrollTop-l.y-s.y,width:i.width,height:i.height}}function en(e){return"static"===Fe(e).position}function nn(e,n){if(!Te(e)||"fixed"===Fe(e).position)return null;if(n)return n(e);let t=e.offsetParent;return ke(e)===t&&(t=t.ownerDocument.body),t}function tn(e,n){const t=Ee(e);if(Oe(e))return t;if(!Te(e)){let n=je(e);for(;n&&!Le(n);){if(De(n)&&!en(n))return n;n=je(n)}return t}let r=nn(e,n);for(;r&&Ae(r)&&en(r);)r=nn(r,n);return r&&Le(r)&&en(r)&&!Pe(r)?t:r||function(e){let n=je(e);for(;Te(n)&&!Le(n);){if(Pe(n))return n;if(Oe(n))return null;n=je(n)}return null}(e)||t}const rn={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:n,rect:t,offsetParent:r,strategy:o}=e;const a="fixed"===o,i=ke(r),c=!!n&&Oe(n.floating);if(r===i||c&&a)return t;let l={scrollLeft:0,scrollTop:0},s=oe(1);const u=oe(0),d=Te(r);if((d||!d&&!a)&&(("body"!==Ce(r)||Me(i))&&(l=ze(r)),Te(r))){const e=Xe(r);s=Ue(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}const f=!i||d||a?oe(0):Ze(i,l,!0);return{width:t.width*s.x,height:t.height*s.y,x:t.x*s.x-l.scrollLeft*s.x+u.x+f.x,y:t.y*s.y-l.scrollTop*s.y+u.y+f.y}},getDocumentElement:ke,getClippingRect:function(e){let{element:n,boundary:t,rootBoundary:r,strategy:o}=e;const a=[..."clippingAncestors"===t?Oe(n)?[]:function(e,n){const t=n.get(e);if(t)return t;let r=We(e,[],!1).filter((e=>De(e)&&"body"!==Ce(e))),o=null;const a="fixed"===Fe(e).position;let i=a?je(e):e;for(;De(i)&&!Le(i);){const n=Fe(i),t=Pe(i);t||"fixed"!==n.position||(o=null),(a?!t&&!o:!t&&"static"===n.position&&o&&["absolute","fixed"].includes(o.position)||Me(i)&&!t&&Qe(e,i))?r=r.filter((e=>e!==i)):o=n,i=je(i)}return n.set(e,r),r}(n,this._c):[].concat(t),r],i=a[0],c=a.reduce(((e,t)=>{const r=qe(n,t,o);return e.top=ne(r.top,e.top),e.right=ee(r.right,e.right),e.bottom=ee(r.bottom,e.bottom),e.left=ne(r.left,e.left),e}),qe(n,i,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},getOffsetParent:tn,getElementRects:async function(e){const n=this.getOffsetParent||tn,t=this.getDimensions,r=await t(e.floating);return{reference:Je(e.reference,await n(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:n,height:t}=Ke(e);return{width:n,height:t}},getScale:Ue,isElement:De,isRTL:function(e){return"rtl"===Fe(e).direction}};function on(e,n){return e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height}function an(e,n,t,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:i="function"==typeof ResizeObserver,layoutShift:c="function"==typeof IntersectionObserver,animationFrame:l=!1}=r,s=$e(e),u=o||a?[...s?We(s):[],...We(n)]:[];u.forEach((e=>{o&&e.addEventListener("scroll",t,{passive:!0}),a&&e.addEventListener("resize",t)}));const d=s&&c?function(e,n){let t,r=null;const o=ke(e);function a(){var e;clearTimeout(t),null==(e=r)||e.disconnect(),r=null}return function i(c,l){void 0===c&&(c=!1),void 0===l&&(l=1),a();const s=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=s;if(c||n(),!f||!p)return;const m={rootMargin:-re(d)+"px "+-re(o.clientWidth-(u+f))+"px "+-re(o.clientHeight-(d+p))+"px "+-re(u)+"px",threshold:ne(0,ee(1,l))||1};let h=!0;function g(n){const r=n[0].intersectionRatio;if(r!==l){if(!h)return i();r?i(!1,r):t=setTimeout((()=>{i(!1,1e-7)}),1e3)}1!==r||on(s,e.getBoundingClientRect())||i(),h=!1}try{r=new IntersectionObserver(g,{...m,root:o.ownerDocument})}catch(e){r=new IntersectionObserver(g,m)}r.observe(e)}(!0),a}(s,t):null;let f,p=-1,m=null;i&&(m=new ResizeObserver((e=>{let[r]=e;r&&r.target===s&&m&&(m.unobserve(n),cancelAnimationFrame(p),p=requestAnimationFrame((()=>{var e;null==(e=m)||e.observe(n)}))),t()})),s&&!l&&m.observe(s),m.observe(n));let h=l?Xe(e):null;return l&&function n(){const r=Xe(e);h&&!on(h,r)&&t();h=r,f=requestAnimationFrame(n)}(),t(),()=>{var e;u.forEach((e=>{o&&e.removeEventListener("scroll",t),a&&e.removeEventListener("resize",t)})),null==d||d(),null==(e=m)||e.disconnect(),m=null,l&&cancelAnimationFrame(f)}}const cn=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(n){var t,r;const{x:o,y:a,placement:i,middlewareData:c}=n,l=await async function(e,n){const{placement:t,platform:r,elements:o}=e,a=await(null==r.isRTL?void 0:r.isRTL(o.floating)),i=se(t),c=ue(t),l="y"===pe(t),s=["left","top"].includes(i)?-1:1,u=a&&l?-1:1,d=le(n,e);let{mainAxis:f,crossAxis:p,alignmentAxis:m}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&"number"==typeof m&&(p="end"===c?-1*m:m),l?{x:p*u,y:f*s}:{x:f*s,y:p*u}}(n,e);return i===(null==(t=c.offset)?void 0:t.placement)&&null!=(r=c.arrow)&&r.alignmentOffset?{}:{x:o+l.x,y:a+l.y,data:{...l,placement:i}}}}},ln=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(n){const{x:t,y:r,placement:o}=n,{mainAxis:a=!0,crossAxis:i=!1,limiter:c={fn:e=>{let{x:n,y:t}=e;return{x:n,y:t}}},...l}=le(e,n),s={x:t,y:r},u=await be(n,l),d=pe(se(o)),f=de(d);let p=s[f],m=s[d];if(a){const e="y"===f?"bottom":"right";p=ce(p+u["y"===f?"top":"left"],p,p-u[e])}if(i){const e="y"===d?"bottom":"right";m=ce(m+u["y"===d?"top":"left"],m,m-u[e])}const h=c.fn({...n,[f]:p,[d]:m});return{...h,data:{x:h.x-t,y:h.y-r,enabled:{[f]:a,[d]:i}}}}}},sn=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(n){var t,r;const{placement:o,middlewareData:a,rects:i,initialPlacement:c,platform:l,elements:s}=n,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:h=!0,...g}=le(e,n);if(null!=(t=a.arrow)&&t.alignmentOffset)return{};const v=se(o),y=pe(c),w=se(c)===c,b=await(null==l.isRTL?void 0:l.isRTL(s.floating)),x=f||(w||!h?[ge(c)]:function(e){const n=ge(e);return[he(e),n,he(n)]}(c)),_="none"!==m;!f&&_&&x.push(...function(e,n,t,r){const o=ue(e);let a=function(e,n,t){const r=["left","right"],o=["right","left"],a=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return t?n?o:r:n?r:o;case"left":case"right":return n?a:i;default:return[]}}(se(e),"start"===t,r);return o&&(a=a.map((e=>e+"-"+o)),n&&(a=a.concat(a.map(he)))),a}(c,h,m,b));const N=[c,...x],C=await be(n,g),E=[];let k=(null==(r=a.flip)?void 0:r.overflows)||[];if(u&&E.push(C[v]),d){const e=function(e,n,t){void 0===t&&(t=!1);const r=ue(e),o=me(e),a=fe(o);let i="x"===o?r===(t?"end":"start")?"right":"left":"start"===r?"bottom":"top";return n.reference[a]>n.floating[a]&&(i=ge(i)),[i,ge(i)]}(o,i,b);E.push(C[e[0]],C[e[1]])}if(k=[...k,{placement:o,overflows:E}],!E.every((e=>e<=0))){var R,D;const e=((null==(R=a.flip)?void 0:R.index)||0)+1,n=N[e];if(n)return{data:{index:e,overflows:k},reset:{placement:n}};let t=null==(D=k.filter((e=>e.overflows[0]<=0)).sort(((e,n)=>e.overflows[1]-n.overflows[1]))[0])?void 0:D.placement;if(!t)switch(p){case"bestFit":{var T;const e=null==(T=k.filter((e=>{if(_){const n=pe(e.placement);return n===y||"y"===n}return!0})).map((e=>[e.placement,e.overflows.filter((e=>e>0)).reduce(((e,n)=>e+n),0)])).sort(((e,n)=>e[1]-n[1]))[0])?void 0:T[0];e&&(t=e);break}case"initialPlacement":t=c}if(o!==t)return{reset:{placement:t}}}return{}}}},un=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(n){var t,r;const{placement:o,rects:a,platform:i,elements:c}=n,{apply:l=()=>{},...s}=le(e,n),u=await be(n,s),d=se(o),f=ue(o),p="y"===pe(o),{width:m,height:h}=a.floating;let g,v;"top"===d||"bottom"===d?(g=d,v=f===(await(null==i.isRTL?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(v=d,g="end"===f?"top":"bottom");const y=h-u.top-u.bottom,w=m-u.left-u.right,b=ee(h-u[g],y),x=ee(m-u[v],w),_=!n.middlewareData.shift;let N=b,C=x;if(null!=(t=n.middlewareData.shift)&&t.enabled.x&&(C=w),null!=(r=n.middlewareData.shift)&&r.enabled.y&&(N=y),_&&!f){const e=ne(u.left,0),n=ne(u.right,0),t=ne(u.top,0),r=ne(u.bottom,0);p?C=m-2*(0!==e||0!==n?e+n:ne(u.left,u.right)):N=h-2*(0!==t||0!==r?t+r:ne(u.top,u.bottom))}await l({...n,availableWidth:C,availableHeight:N});const E=await i.getDimensions(c.floating);return m!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}},dn=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(n){const{rects:t}=n,{strategy:r="referenceHidden",...o}=le(e,n);switch(r){case"referenceHidden":{const e=xe(await be(n,{...o,elementContext:"reference"}),t.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:_e(e)}}}case"escaped":{const e=xe(await be(n,{...o,altBoundary:!0}),t.floating);return{data:{escapedOffsets:e,escaped:_e(e)}}}default:return{}}}}},fn=e=>({name:"arrow",options:e,async fn(n){const{x:t,y:r,placement:o,rects:a,platform:i,elements:c,middlewareData:l}=n,{element:s,padding:u=0}=le(e,n)||{};if(null==s)return{};const d=ve(u),f={x:t,y:r},p=me(o),m=fe(p),h=await i.getDimensions(s),g="y"===p,v=g?"top":"left",y=g?"bottom":"right",w=g?"clientHeight":"clientWidth",b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],_=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s));let N=_?_[w]:0;N&&await(null==i.isElement?void 0:i.isElement(_))||(N=c.floating[w]||a.floating[m]);const C=b/2-x/2,E=N/2-h[m]/2-1,k=ee(d[v],E),R=ee(d[y],E),D=k,T=N-h[m]-R,S=N/2-h[m]/2+C,M=ce(D,S,T),A=!l.arrow&&null!=ue(o)&&S!==M&&a.reference[m]/2-(S<D?k:R)-h[m]/2<0,O=A?S<D?S-D:S-T:0;return{[p]:f[p]+O,data:{[p]:M,centerOffset:S-M-O,...A&&{alignmentOffset:O}},reset:A}}}),pn=function(e){return void 0===e&&(e={}),{options:e,fn(n){const{x:t,y:r,placement:o,rects:a,middlewareData:i}=n,{offset:c=0,mainAxis:l=!0,crossAxis:s=!0}=le(e,n),u={x:t,y:r},d=pe(o),f=de(d);let p=u[f],m=u[d];const h=le(c,n),g="number"==typeof h?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(l){const e="y"===f?"height":"width",n=a.reference[f]-a.floating[e]+g.mainAxis,t=a.reference[f]+a.reference[e]-g.mainAxis;p<n?p=n:p>t&&(p=t)}if(s){var v,y;const e="y"===f?"width":"height",n=["top","left"].includes(se(o)),t=a.reference[d]-a.floating[e]+(n&&(null==(v=i.offset)?void 0:v[d])||0)+(n?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(n?0:(null==(y=i.offset)?void 0:y[d])||0)-(n?g.crossAxis:0);m<t?m=t:m>r&&(m=r)}return{[f]:p,[d]:m}}}},mn=(e,n,t)=>{const r=new Map,o={platform:rn,...t},a={...o.platform,_c:r};return(async(e,n,t)=>{const{placement:r="bottom",strategy:o="absolute",middleware:a=[],platform:i}=t,c=a.filter(Boolean),l=await(null==i.isRTL?void 0:i.isRTL(n));let s=await i.getElementRects({reference:e,floating:n,strategy:o}),{x:u,y:d}=we(s,r,l),f=r,p={},m=0;for(let t=0;t<c.length;t++){const{name:a,fn:h}=c[t],{x:g,y:v,data:y,reset:w}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:s,platform:i,elements:{reference:e,floating:n}});u=null!=g?g:u,d=null!=v?v:d,p={...p,[a]:{...p[a],...y}},w&&m<=50&&(m++,"object"==typeof w&&(w.placement&&(f=w.placement),w.rects&&(s=!0===w.rects?await i.getElementRects({reference:e,floating:n,strategy:o}):w.rects),({x:u,y:d}=we(s,f,l))),t=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:p}})(e,n,{...o,platform:a})};var hn="undefined"!=typeof document?a:i;function gn(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if("function"==typeof e&&e.toString()===n.toString())return!0;let t,r,o;if(e&&n&&"object"==typeof e){if(Array.isArray(e)){if(t=e.length,t!==n.length)return!1;for(r=t;0!=r--;)if(!gn(e[r],n[r]))return!1;return!0}if(o=Object.keys(e),t=o.length,t!==Object.keys(n).length)return!1;for(r=t;0!=r--;)if(!{}.hasOwnProperty.call(n,o[r]))return!1;for(r=t;0!=r--;){const t=o[r];if(("_owner"!==t||!e.$$typeof)&&!gn(e[t],n[t]))return!1}return!0}return e!=e&&n!=n}function vn(e){if("undefined"==typeof window)return 1;return(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yn(e,n){const t=vn(e);return Math.round(n*t)/t}function wn(e){const n=r.useRef(e);return hn((()=>{n.current=e})),n}const bn=e=>({name:"arrow",options:e,fn(n){const{element:t,padding:r}="function"==typeof e?e(n):e;return t&&(o=t,{}.hasOwnProperty.call(o,"current"))?null!=t.current?fn({element:t.current,padding:r}).fn(n):{}:t?fn({element:t,padding:r}).fn(n):{};var o}}),xn=(e,n)=>({...cn(e),options:[e,n]}),_n=(e,n)=>({...ln(e),options:[e,n]}),Nn=(e,n)=>({...pn(e),options:[e,n]}),Cn=(e,n)=>({...sn(e),options:[e,n]}),En=(e,n)=>({...un(e),options:[e,n]}),kn=(e,n)=>({...dn(e),options:[e,n]}),Rn=(e,n)=>({...bn(e),options:[e,n]});var Dn=r.forwardRef(((n,t)=>{const{children:r,width:o=10,height:a=5,...i}=n;return e(C.svg,{...i,ref:t,width:o,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?r:e("polygon",{points:"0,0 30,0 15,10"})})}));Dn.displayName="Arrow";var Tn=Dn;var Sn="Popper",[Mn,An]=g(Sn),[On,Pn]=Mn(Sn),In=n=>{const{__scopePopper:t,children:o}=n,[a,i]=r.useState(null);return e(On,{scope:t,anchor:a,onAnchorChange:i,children:o})};In.displayName=Sn;var Ln="PopperAnchor",Fn=r.forwardRef(((n,t)=>{const{__scopePopper:o,virtualRef:a,...i}=n,c=Pn(Ln,o),l=r.useRef(null),s=h(t,l);return r.useEffect((()=>{c.onAnchorChange(a?.current||l.current)})),a?null:e(C.div,{...i,ref:s})}));Fn.displayName=Ln;var zn="PopperContent",[jn,Bn]=Mn(zn),Wn=r.forwardRef(((n,t)=>{const{__scopePopper:o,side:a="bottom",sideOffset:i=0,align:c="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:g=!1,updatePositionStrategy:v="optimized",onPlaced:w,...b}=n,x=Pn(zn,o),[_,N]=r.useState(null),E=h(t,(e=>N(e))),[k,R]=r.useState(null),D=function(e){const[n,t]=r.useState(void 0);return Y((()=>{if(e){t({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver((n=>{if(!Array.isArray(n))return;if(!n.length)return;const r=n[0];let o,a;if("borderBoxSize"in r){const e=r.borderBoxSize,n=Array.isArray(e)?e[0]:e;o=n.inlineSize,a=n.blockSize}else o=e.offsetWidth,a=e.offsetHeight;t({width:o,height:a})}));return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}t(void 0)}),[e]),n}(k),T=D?.width??0,S=D?.height??0,M=a+("center"!==c?"-"+c:""),A="number"==typeof p?p:{top:0,right:0,bottom:0,left:0,...p},O=Array.isArray(f)?f:[f],P=O.length>0,I={padding:A,boundary:O.filter(Un),altBoundary:P},{refs:L,floatingStyles:F,placement:z,isPositioned:j,middlewareData:B}=function(e){void 0===e&&(e={});const{placement:n="bottom",strategy:t="absolute",middleware:o=[],platform:a,elements:{reference:i,floating:c}={},transform:l=!0,whileElementsMounted:u,open:d}=e,[f,p]=r.useState({x:0,y:0,strategy:t,placement:n,middlewareData:{},isPositioned:!1}),[m,h]=r.useState(o);gn(m,o)||h(o);const[g,v]=r.useState(null),[y,w]=r.useState(null),b=r.useCallback((e=>{e!==C.current&&(C.current=e,v(e))}),[]),x=r.useCallback((e=>{e!==E.current&&(E.current=e,w(e))}),[]),_=i||g,N=c||y,C=r.useRef(null),E=r.useRef(null),k=r.useRef(f),R=null!=u,D=wn(u),T=wn(a),S=wn(d),M=r.useCallback((()=>{if(!C.current||!E.current)return;const e={placement:n,strategy:t,middleware:m};T.current&&(e.platform=T.current),mn(C.current,E.current,e).then((e=>{const n={...e,isPositioned:!1!==S.current};A.current&&!gn(k.current,n)&&(k.current=n,s.flushSync((()=>{p(n)})))}))}),[m,n,t,T,S]);hn((()=>{!1===d&&k.current.isPositioned&&(k.current.isPositioned=!1,p((e=>({...e,isPositioned:!1}))))}),[d]);const A=r.useRef(!1);hn((()=>(A.current=!0,()=>{A.current=!1})),[]),hn((()=>{if(_&&(C.current=_),N&&(E.current=N),_&&N){if(D.current)return D.current(_,N,M);M()}}),[_,N,M,D,R]);const O=r.useMemo((()=>({reference:C,floating:E,setReference:b,setFloating:x})),[b,x]),P=r.useMemo((()=>({reference:_,floating:N})),[_,N]),I=r.useMemo((()=>{const e={position:t,left:0,top:0};if(!P.floating)return e;const n=yn(P.floating,f.x),r=yn(P.floating,f.y);return l?{...e,transform:"translate("+n+"px, "+r+"px)",...vn(P.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:n,top:r}}),[t,l,P.floating,f.x,f.y]);return r.useMemo((()=>({...f,update:M,refs:O,elements:P,floatingStyles:I})),[f,M,O,P,I])}({strategy:"fixed",placement:M,whileElementsMounted:(...e)=>an(...e,{animationFrame:"always"===v}),elements:{reference:x.anchor},middleware:[xn({mainAxis:i+S,alignmentAxis:l}),d&&_n({mainAxis:!0,crossAxis:!1,limiter:"partial"===m?Nn():void 0,...I}),d&&Cn({...I}),En({...I,apply:({elements:e,rects:n,availableWidth:t,availableHeight:r})=>{const{width:o,height:a}=n.reference,i=e.floating.style;i.setProperty("--radix-popper-available-width",`${t}px`),i.setProperty("--radix-popper-available-height",`${r}px`),i.setProperty("--radix-popper-anchor-width",`${o}px`),i.setProperty("--radix-popper-anchor-height",`${a}px`)}}),k&&Rn({element:k,padding:u}),Gn({arrowWidth:T,arrowHeight:S}),g&&kn({strategy:"referenceHidden",...I})]}),[W,H]=Vn(z),K=y(w);Y((()=>{j&&K?.()}),[j,K]);const $=B.arrow?.x,U=B.arrow?.y,G=0!==B.arrow?.centerOffset,[V,X]=r.useState();return Y((()=>{_&&X(window.getComputedStyle(_).zIndex)}),[_]),e("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:j?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[B.transformOrigin?.x,B.transformOrigin?.y].join(" "),...B.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:e(jn,{scope:o,placedSide:W,onArrowChange:R,arrowX:$,arrowY:U,shouldHideArrow:G,children:e(C.div,{"data-side":W,"data-align":H,...b,ref:E,style:{...b.style,animation:j?void 0:"none"}})})})}));Wn.displayName=zn;var Hn="PopperArrow",Kn={top:"bottom",right:"left",bottom:"top",left:"right"},$n=r.forwardRef((function(n,t){const{__scopePopper:r,...o}=n,a=Bn(Hn,r),i=Kn[a.placedSide];return e("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:e(Tn,{...o,ref:t,style:{...o.style,display:"block"}})})}));function Un(e){return null!==e}$n.displayName=Hn;var Gn=e=>({name:"transformOrigin",options:e,fn(n){const{placement:t,rects:r,middlewareData:o}=n,a=0!==o.arrow?.centerOffset,i=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[l,s]=Vn(t),u={start:"0%",center:"50%",end:"100%"}[s],d=(o.arrow?.x??0)+i/2,f=(o.arrow?.y??0)+c/2;let p="",m="";return"bottom"===l?(p=a?u:`${d}px`,m=-c+"px"):"top"===l?(p=a?u:`${d}px`,m=`${r.floating.height+c}px`):"right"===l?(p=-c+"px",m=a?u:`${f}px`):"left"===l&&(p=`${r.floating.width+c}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function Vn(e){const[n,t="center"]=e.split("-");return[n,t]}var Xn=In,Yn=Fn,Zn=Wn,qn=$n,Qn=r.forwardRef(((n,t)=>{const{container:o,...a}=n,[i,c]=r.useState(!1);Y((()=>c(!0)),[]);const l=o||i&&globalThis?.document?.body;return l?u.createPortal(e(C.div,{...a,ref:t}),l):null}));Qn.displayName="Portal";var Jn=e=>{const{present:n,children:t}=e,o=function(e){const[n,t]=r.useState(),o=r.useRef({}),a=r.useRef(e),i=r.useRef("none"),c=e?"mounted":"unmounted",[l,s]=function(e,n){return r.useReducer(((e,t)=>n[e][t]??e),e)}(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return r.useEffect((()=>{const e=et(o.current);i.current="mounted"===l?e:"none"}),[l]),Y((()=>{const n=o.current,t=a.current;if(t!==e){const r=i.current,o=et(n);if(e)s("MOUNT");else if("none"===o||"none"===n?.display)s("UNMOUNT");else{s(t&&r!==o?"ANIMATION_OUT":"UNMOUNT")}a.current=e}}),[e,s]),Y((()=>{if(n){let e;const t=n.ownerDocument.defaultView??window,r=r=>{const i=et(o.current).includes(r.animationName);if(r.target===n&&i&&(s("ANIMATION_END"),!a.current)){const r=n.style.animationFillMode;n.style.animationFillMode="forwards",e=t.setTimeout((()=>{"forwards"===n.style.animationFillMode&&(n.style.animationFillMode=r)}))}},c=e=>{e.target===n&&(i.current=et(o.current))};return n.addEventListener("animationstart",c),n.addEventListener("animationcancel",r),n.addEventListener("animationend",r),()=>{t.clearTimeout(e),n.removeEventListener("animationstart",c),n.removeEventListener("animationcancel",r),n.removeEventListener("animationend",r)}}s("ANIMATION_END")}),[n,s]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:r.useCallback((e=>{e&&(o.current=getComputedStyle(e)),t(e)}),[])}}(n),a="function"==typeof t?t({present:o.isPresent}):r.Children.only(t),i=h(o.ref,function(e){let n=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,t=n&&"isReactWarning"in n&&n.isReactWarning;if(t)return e.ref;if(n=Object.getOwnPropertyDescriptor(e,"ref")?.get,t=n&&"isReactWarning"in n&&n.isReactWarning,t)return e.props.ref;return e.props.ref||e.ref}(a));return"function"==typeof t||o.isPresent?r.cloneElement(a,{ref:i}):null};function et(e){return e?.animationName||"none"}Jn.displayName="Presence";var nt="rovingFocusGroup.onEntryFocus",tt={bubbles:!1,cancelable:!0},rt="RovingFocusGroup",[ot,at,it]=k(rt),[ct,lt]=g(rt,[it]),[st,ut]=ct(rt),dt=r.forwardRef(((n,t)=>e(ot.Provider,{scope:n.__scopeRovingFocusGroup,children:e(ot.Slot,{scope:n.__scopeRovingFocusGroup,children:e(ft,{...n,ref:t})})})));dt.displayName=rt;var ft=r.forwardRef(((n,t)=>{const{__scopeRovingFocusGroup:o,orientation:a,loop:i=!1,dir:c,currentTabStopId:l,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:u,onEntryFocus:d,preventScrollOnEntryFocus:p=!1,...m}=n,g=r.useRef(null),v=h(t,g),b=D(c),[x=null,_]=w({prop:l,defaultProp:s,onChange:u}),[N,E]=r.useState(!1),k=y(d),R=at(o),T=r.useRef(!1),[S,M]=r.useState(0);return r.useEffect((()=>{const e=g.current;if(e)return e.addEventListener(nt,k),()=>e.removeEventListener(nt,k)}),[k]),e(st,{scope:o,orientation:a,dir:b,loop:i,currentTabStopId:x,onItemFocus:r.useCallback((e=>_(e)),[_]),onItemShiftTab:r.useCallback((()=>E(!0)),[]),onFocusableItemAdd:r.useCallback((()=>M((e=>e+1))),[]),onFocusableItemRemove:r.useCallback((()=>M((e=>e-1))),[]),children:e(C.div,{tabIndex:N||0===S?-1:0,"data-orientation":a,...m,ref:v,style:{outline:"none",...n.style},onMouseDown:f(n.onMouseDown,(()=>{T.current=!0})),onFocus:f(n.onFocus,(e=>{const n=!T.current;if(e.target===e.currentTarget&&n&&!N){const n=new CustomEvent(nt,tt);if(e.currentTarget.dispatchEvent(n),!n.defaultPrevented){const e=R().filter((e=>e.focusable));gt([e.find((e=>e.active)),e.find((e=>e.id===x)),...e].filter(Boolean).map((e=>e.ref.current)),p)}}T.current=!1})),onBlur:f(n.onBlur,(()=>E(!1)))})})})),pt="RovingFocusGroupItem",mt=r.forwardRef(((n,t)=>{const{__scopeRovingFocusGroup:o,focusable:a=!0,active:i=!1,tabStopId:c,...l}=n,s=Q(),u=c||s,d=ut(pt,o),p=d.currentTabStopId===u,m=at(o),{onFocusableItemAdd:h,onFocusableItemRemove:g}=d;return r.useEffect((()=>{if(a)return h(),()=>g()}),[a,h,g]),e(ot.ItemSlot,{scope:o,id:u,focusable:a,active:i,children:e(C.span,{tabIndex:p?0:-1,"data-orientation":d.orientation,...l,ref:t,onMouseDown:f(n.onMouseDown,(e=>{a?d.onItemFocus(u):e.preventDefault()})),onFocus:f(n.onFocus,(()=>d.onItemFocus(u))),onKeyDown:f(n.onKeyDown,(e=>{if("Tab"===e.key&&e.shiftKey)return void d.onItemShiftTab();if(e.target!==e.currentTarget)return;const n=function(e,n,t){const r=function(e,n){return"rtl"!==n?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}(e.key,t);return"vertical"===n&&["ArrowLeft","ArrowRight"].includes(r)||"horizontal"===n&&["ArrowUp","ArrowDown"].includes(r)?void 0:ht[r]}(e,d.orientation,d.dir);if(void 0!==n){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let o=m().filter((e=>e.focusable)).map((e=>e.ref.current));if("last"===n)o.reverse();else if("prev"===n||"next"===n){"prev"===n&&o.reverse();const a=o.indexOf(e.currentTarget);o=d.loop?(r=a+1,(t=o).map(((e,n)=>t[(r+n)%t.length]))):o.slice(a+1)}setTimeout((()=>gt(o)))}var t,r}))})})}));mt.displayName=pt;var ht={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function gt(e,n=!1){const t=document.activeElement;for(const r of e){if(r===t)return;if(r.focus({preventScroll:n}),document.activeElement!==t)return}}var vt=dt,yt=mt,wt=new WeakMap,bt=new WeakMap,xt={},_t=0,Nt=function(e){return e&&(e.host||Nt(e.parentNode))},Ct=function(e,n,t,r){var o=function(e,n){return n.map((function(n){if(e.contains(n))return n;var t=Nt(n);return t&&e.contains(t)?t:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)})).filter((function(e){return Boolean(e)}))}(n,Array.isArray(e)?e:[e]);xt[t]||(xt[t]=new WeakMap);var a=xt[t],i=[],c=new Set,l=new Set(o),s=function(e){e&&!c.has(e)&&(c.add(e),s(e.parentNode))};o.forEach(s);var u=function(e){e&&!l.has(e)&&Array.prototype.forEach.call(e.children,(function(e){if(c.has(e))u(e);else try{var n=e.getAttribute(r),o=null!==n&&"false"!==n,l=(wt.get(e)||0)+1,s=(a.get(e)||0)+1;wt.set(e,l),a.set(e,s),i.push(e),1===l&&o&&bt.set(e,!0),1===s&&e.setAttribute(t,"true"),o||e.setAttribute(r,"true")}catch(n){console.error("aria-hidden: cannot operate on ",e,n)}}))};return u(n),c.clear(),_t++,function(){i.forEach((function(e){var n=wt.get(e)-1,o=a.get(e)-1;wt.set(e,n),a.set(e,o),n||(bt.has(e)||e.removeAttribute(r),bt.delete(e)),o||e.removeAttribute(t)})),--_t||(wt=new WeakMap,wt=new WeakMap,bt=new WeakMap,xt={})}},Et=function(e,n,t){void 0===t&&(t="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=function(e){return"undefined"==typeof document?null:(Array.isArray(e)?e[0]:e).ownerDocument.body}(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),Ct(r,o,t,"aria-hidden")):function(){return null}},kt=function(){return kt=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},kt.apply(this,arguments)};function Rt(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"==typeof SuppressedError&&SuppressedError;var Dt="right-scroll-bar-position",Tt="width-before-scroll-bar";function St(e,n){return"function"==typeof e?e(n):e&&(e.current=n),e}var Mt="undefined"!=typeof window?r.useLayoutEffect:r.useEffect,At=new WeakMap;function Ot(e,n){var t,r,o,a=(t=null,r=function(n){return e.forEach((function(e){return St(e,n)}))},(o=c((function(){return{value:t,callback:r,facade:{get current(){return o.value},set current(e){var n=o.value;n!==e&&(o.value=e,o.callback(e,n))}}}}))[0]).callback=r,o.facade);return Mt((function(){var n=At.get(a);if(n){var t=new Set(n),r=new Set(e),o=a.current;t.forEach((function(e){r.has(e)||St(e,null)})),r.forEach((function(e){t.has(e)||St(e,o)}))}At.set(a,e)}),[e]),a}function Pt(e){return e}var It=function(e){var n=e.sideCar,t=Rt(e,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=n.read();if(!o)throw new Error("Sidecar medium not found");return r.createElement(o,kt({},t))};It.isSideCarExport=!0;var Lt=function(e){void 0===e&&(e={});var n=function(e,n){void 0===n&&(n=Pt);var t=[],r=!1;return{read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return t.length?t[t.length-1]:e},useMedium:function(e){var o=n(e,r);return t.push(o),function(){t=t.filter((function(e){return e!==o}))}},assignSyncMedium:function(e){for(r=!0;t.length;){var n=t;t=[],n.forEach(e)}t={push:function(n){return e(n)},filter:function(){return t}}},assignMedium:function(e){r=!0;var n=[];if(t.length){var o=t;t=[],o.forEach(e),n=t}var a=function(){var t=n;n=[],t.forEach(e)},i=function(){return Promise.resolve().then(a)};i(),t={push:function(e){n.push(e),i()},filter:function(e){return n=n.filter(e),t}}}}}(null);return n.options=kt({async:!0,ssr:!1},e),n}(),Ft=function(){},zt=r.forwardRef((function(e,n){var t=r.useRef(null),o=r.useState({onScrollCapture:Ft,onWheelCapture:Ft,onTouchMoveCapture:Ft}),a=o[0],i=o[1],c=e.forwardProps,l=e.children,s=e.className,u=e.removeScrollBar,d=e.enabled,f=e.shards,p=e.sideCar,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,v=e.as,y=void 0===v?"div":v,w=e.gapMode,b=Rt(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=p,_=Ot([t,n]),N=kt(kt({},b),a);return r.createElement(r.Fragment,null,d&&r.createElement(x,{sideCar:Lt,removeScrollBar:u,shards:f,noIsolation:m,inert:h,setCallbacks:i,allowPinchZoom:!!g,lockRef:t,gapMode:w}),c?r.cloneElement(r.Children.only(l),kt(kt({},N),{ref:_})):r.createElement(y,kt({},N,{className:s,ref:_}),l))}));zt.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},zt.classNames={fullWidth:Tt,zeroRight:Dt};function jt(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var n=function(){if("undefined"!=typeof __webpack_nonce__)return __webpack_nonce__}();return n&&e.setAttribute("nonce",n),e}var Bt=function(){var e=0,n=null;return{add:function(t){var r,o;0==e&&(n=jt())&&(o=t,(r=n).styleSheet?r.styleSheet.cssText=o:r.appendChild(document.createTextNode(o)),function(e){(document.head||document.getElementsByTagName("head")[0]).appendChild(e)}(n)),e++},remove:function(){! --e&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}},Wt=function(){var e,n=(e=Bt(),function(n,t){r.useEffect((function(){return e.add(n),function(){e.remove()}}),[n&&t])});return function(e){var t=e.styles,r=e.dynamic;return n(t,r),null}},Ht={left:0,top:0,right:0,gap:0},Kt=function(e){return parseInt(e||"",10)||0},$t=function(e){if(void 0===e&&(e="margin"),"undefined"==typeof window)return Ht;var n=function(e){var n=window.getComputedStyle(document.body),t=n["padding"===e?"paddingLeft":"marginLeft"]