import{r as t,j as e}from"./jsx-runtime-BnbLqBWP.js";import{r as n}from"./index-C4j0XBvN.js";import{P as r}from"./index-CE9avnvM.js";import{u as o}from"./index-BYVAcnYn.js";import{c as i}from"./index-DKVgTY5W.js";import{d as l,b as s}from"./index-DWAgyr9F.js";const a=["top","right","bottom","left"],c=Math.min,f=Math.max,u=Math.round,d=Math.floor,p=t=>({x:t,y:t}),h={left:"right",right:"left",bottom:"top",top:"bottom"},m={start:"end",end:"start"};function g(t,e,n){return f(t,c(e,n))}function y(t,e){return"function"==typeof t?t(e):t}function w(t){return t.split("-")[0]}function x(t){return t.split("-")[1]}function v(t){return"x"===t?"y":"x"}function b(t){return"y"===t?"height":"width"}function A(t){return["top","bottom"].includes(w(t))?"y":"x"}function R(t){return v(A(t))}function P(t){return t.replace(/start|end/g,(t=>m[t]))}function S(t){return t.replace(/left|right|bottom|top/g,(t=>h[t]))}function O(t){return"number"!=typeof t?function(t){return{top:0,right:0,bottom:0,left:0,...t}}(t):{top:t,right:t,bottom:t,left:t}}function E(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}function L(t,e,n){let{reference:r,floating:o}=t;const i=A(e),l=R(e),s=b(l),a=w(e),c="y"===i,f=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,d=r[s]/2-o[s]/2;let p;switch(a){case"top":p={x:f,y:r.y-o.height};break;case"bottom":p={x:f,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:u};break;case"left":p={x:r.x-o.width,y:u};break;default:p={x:r.x,y:r.y}}switch(x(e)){case"start":p[l]-=d*(n&&c?-1:1);break;case"end":p[l]+=d*(n&&c?-1:1)}return p}async function T(t,e){var n;void 0===e&&(e={});const{x:r,y:o,platform:i,rects:l,elements:s,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:d=!1,padding:p=0}=y(e,t),h=O(p),m=s[d?"floating"===u?"reference":"floating":u],g=E(await i.getClippingRect({element:null==(n=await(null==i.isElement?void 0:i.isElement(m)))||n?m:m.contextElement||await(null==i.getDocumentElement?void 0:i.getDocumentElement(s.floating)),boundary:c,rootBoundary:f,strategy:a})),w="floating"===u?{x:r,y:o,width:l.floating.width,height:l.floating.height}:l.reference,x=await(null==i.getOffsetParent?void 0:i.getOffsetParent(s.floating)),v=await(null==i.isElement?void 0:i.isElement(x))&&await(null==i.getScale?void 0:i.getScale(x))||{x:1,y:1},b=E(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:w,offsetParent:x,strategy:a}):w);return{top:(g.top-b.top+h.top)/v.y,bottom:(b.bottom-g.bottom+h.bottom)/v.y,left:(g.left-b.left+h.left)/v.x,right:(b.right-g.right+h.right)/v.x}}function C(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function D(t){return a.some((e=>t[e]>=0))}function H(){return"undefined"!=typeof window}function j(t){return F(t)?(t.nodeName||"").toLowerCase():"#document"}function k(t){var e;return(null==t||null==(e=t.ownerDocument)?void 0:e.defaultView)||window}function W(t){var e;return null==(e=(F(t)?t.ownerDocument:t.document)||window.document)?void 0:e.documentElement}function F(t){return!!H()&&(t instanceof Node||t instanceof k(t).Node)}function B(t){return!!H()&&(t instanceof Element||t instanceof k(t).Element)}function z(t){return!!H()&&(t instanceof HTMLElement||t instanceof k(t).HTMLElement)}function M(t){return!(!H()||"undefined"==typeof ShadowRoot)&&(t instanceof ShadowRoot||t instanceof k(t).ShadowRoot)}function $(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=I(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(o)}function N(t){return["table","td","th"].includes(j(t))}function V(t){return[":popover-open",":modal"].some((e=>{try{return t.matches(e)}catch(n){return!1}}))}function _(t){const e=Y(),n=B(t)?I(t):t;return["transform","translate","scale","rotate","perspective"].some((t=>!!n[t]&&"none"!==n[t]))||!!n.containerType&&"normal"!==n.containerType||!e&&!!n.backdropFilter&&"none"!==n.backdropFilter||!e&&!!n.filter&&"none"!==n.filter||["transform","translate","scale","rotate","perspective","filter"].some((t=>(n.willChange||"").includes(t)))||["paint","layout","strict","content"].some((t=>(n.contain||"").includes(t)))}function Y(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function X(t){return["html","body","#document"].includes(j(t))}function I(t){return k(t).getComputedStyle(t)}function q(t){return B(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Z(t){if("html"===j(t))return t;const e=t.assignedSlot||t.parentNode||M(t)&&t.host||W(t);return M(e)?e.host:e}function G(t){const e=Z(t);return X(e)?t.ownerDocument?t.ownerDocument.body:t.body:z(e)&&$(e)?e:G(e)}function J(t,e,n){var r;void 0===e&&(e=[]),void 0===n&&(n=!0);const o=G(t),i=o===(null==(r=t.ownerDocument)?void 0:r.body),l=k(o);if(i){const t=K(l);return e.concat(l,l.visualViewport||[],$(o)?o:[],t&&n?J(t):[])}return e.concat(o,J(o,[],n))}function K(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Q(t){const e=I(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=z(t),i=o?t.offsetWidth:n,l=o?t.offsetHeight:r,s=u(n)!==i||u(r)!==l;return s&&(n=i,r=l),{width:n,height:r,$:s}}function U(t){return B(t)?t:t.contextElement}function tt(t){const e=U(t);if(!z(e))return p(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:i}=Q(e);let l=(i?u(n.width):n.width)/r,s=(i?u(n.height):n.height)/o;return l&&Number.isFinite(l)||(l=1),s&&Number.isFinite(s)||(s=1),{x:l,y:s}}const et=p(0);function nt(t){const e=k(t);return Y()&&e.visualViewport?{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}:et}function rt(t,e,n,r){void 0===e&&(e=!1),void 0===n&&(n=!1);const o=t.getBoundingClientRect(),i=U(t);let l=p(1);e&&(r?B(r)&&(l=tt(r)):l=tt(t));const s=function(t,e,n){return void 0===e&&(e=!1),!(!n||e&&n!==k(t))&&e}(i,n,r)?nt(i):p(0);let a=(o.left+s.x)/l.x,c=(o.top+s.y)/l.y,f=o.width/l.x,u=o.height/l.y;if(i){const t=k(i),e=r&&B(r)?k(r):r;let n=t,o=K(n);for(;o&&r&&e!==n;){const t=tt(o),e=o.getBoundingClientRect(),r=I(o),i=e.left+(o.clientLeft+parseFloat(r.paddingLeft))*t.x,l=e.top+(o.clientTop+parseFloat(r.paddingTop))*t.y;a*=t.x,c*=t.y,f*=t.x,u*=t.y,a+=i,c+=l,n=k(o),o=K(n)}}return E({width:f,height:u,x:a,y:c})}function ot(t,e){const n=q(t).scrollLeft;return e?e.left+n:rt(W(t)).left+n}function it(t,e,n){void 0===n&&(n=!1);const r=t.getBoundingClientRect();return{x:r.left+e.scrollLeft-(n?0:ot(t,r)),y:r.top+e.scrollTop}}function lt(t,e,n){let r;if("viewport"===e)r=function(t,e){const n=k(t),r=W(t),o=n.visualViewport;let i=r.clientWidth,l=r.clientHeight,s=0,a=0;if(o){i=o.width,l=o.height;const t=Y();(!t||t&&"fixed"===e)&&(s=o.offsetLeft,a=o.offsetTop)}return{width:i,height:l,x:s,y:a}}(t,n);else if("document"===e)r=function(t){const e=W(t),n=q(t),r=t.ownerDocument.body,o=f(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=f(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+ot(t);const s=-n.scrollTop;return"rtl"===I(r).direction&&(l+=f(e.clientWidth,r.clientWidth)-o),{width:o,height:i,x:l,y:s}}(W(t));else if(B(e))r=function(t,e){const n=rt(t,!0,"fixed"===e),r=n.top+t.clientTop,o=n.left+t.clientLeft,i=z(t)?tt(t):p(1);return{width:t.clientWidth*i.x,height:t.clientHeight*i.y,x:o*i.x,y:r*i.y}}(e,n);else{const n=nt(t);r={x:e.x-n.x,y:e.y-n.y,width:e.width,height:e.height}}return E(r)}function st(t,e){const n=Z(t);return!(n===e||!B(n)||X(n))&&("fixed"===I(n).position||st(n,e))}function at(t,e,n){const r=z(e),o=W(e),i="fixed"===n,l=rt(t,!0,i,e);let s={scrollLeft:0,scrollTop:0};const a=p(0);if(r||!r&&!i)if(("body"!==j(e)||$(o))&&(s=q(e)),r){const t=rt(e,!0,i,e);a.x=t.x+e.clientLeft,a.y=t.y+e.clientTop}else o&&(a.x=ot(o));const c=!o||r||i?p(0):it(o,s);return{x:l.left+s.scrollLeft-a.x-c.x,y:l.top+s.scrollTop-a.y-c.y,width:l.width,height:l.height}}function ct(t){return"static"===I(t).position}function ft(t,e){if(!z(t)||"fixed"===I(t).position)return null;if(e)return e(t);let n=t.offsetParent;return W(t)===n&&(n=n.ownerDocument.body),n}function ut(t,e){const n=k(t);if(V(t))return n;if(!z(t)){let e=Z(t);for(;e&&!X(e);){if(B(e)&&!ct(e))return e;e=Z(e)}return n}let r=ft(t,e);for(;r&&N(r)&&ct(r);)r=ft(r,e);return r&&X(r)&&ct(r)&&!_(r)?n:r||function(t){let e=Z(t);for(;z(e)&&!X(e);){if(_(e))return e;if(V(e))return null;e=Z(e)}return null}(t)||n}const dt={convertOffsetParentRelativeRectToViewportRelativeRect:function(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const i="fixed"===o,l=W(r),s=!!e&&V(e.floating);if(r===l||s&&i)return n;let a={scrollLeft:0,scrollTop:0},c=p(1);const f=p(0),u=z(r);if((u||!u&&!i)&&(("body"!==j(r)||$(l))&&(a=q(r)),z(r))){const t=rt(r);c=tt(r),f.x=t.x+r.clientLeft,f.y=t.y+r.clientTop}const d=!l||u||i?p(0):it(l,a,!0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+f.x+d.x,y:n.y*c.y-a.scrollTop*c.y+f.y+d.y}},getDocumentElement:W,getClippingRect:function(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const i=[..."clippingAncestors"===n?V(e)?[]:function(t,e){const n=e.get(t);if(n)return n;let r=J(t,[],!1).filter((t=>B(t)&&"body"!==j(t))),o=null;const i="fixed"===I(t).position;let l=i?Z(t):t;for(;B(l)&&!X(l);){const e=I(l),n=_(l);n||"fixed"!==e.position||(o=null),(i?!n&&!o:!n&&"static"===e.position&&o&&["absolute","fixed"].includes(o.position)||$(l)&&!n&&st(t,l))?r=r.filter((t=>t!==l)):o=e,l=Z(l)}return e.set(t,r),r}(e,this._c):[].concat(n),r],l=i[0],s=i.reduce(((t,n)=>{const r=lt(e,n,o);return t.top=f(r.top,t.top),t.right=c(r.right,t.right),t.bottom=c(r.bottom,t.bottom),t.left=f(r.left,t.left),t}),lt(e,l,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}},getOffsetParent:ut,getElementRects:async function(t){const e=this.getOffsetParent||ut,n=this.getDimensions,r=await n(t.floating);return{reference:at(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},getClientRects:function(t){return Array.from(t.getClientRects())},getDimensions:function(t){const{width:e,height:n}=Q(t);return{width:e,height:n}},getScale:tt,isElement:B,isRTL:function(t){return"rtl"===I(t).direction}};function pt(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function ht(t,e,n,r){void 0===r&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:l="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:a=!1}=r,u=U(t),p=o||i?[...u?J(u):[],...J(e)]:[];p.forEach((t=>{o&&t.addEventListener("scroll",n,{passive:!0}),i&&t.addEventListener("resize",n)}));const h=u&&s?function(t,e){let n,r=null;const o=W(t);function i(){var t;clearTimeout(n),null==(t=r)||t.disconnect(),r=null}return function l(s,a){void 0===s&&(s=!1),void 0===a&&(a=1),i();const u=t.getBoundingClientRect(),{left:p,top:h,width:m,height:g}=u;if(s||e(),!m||!g)return;const y={rootMargin:-d(h)+"px "+-d(o.clientWidth-(p+m))+"px "+-d(o.clientHeight-(h+g))+"px "+-d(p)+"px",threshold:f(0,c(1,a))||1};let w=!0;function x(e){const r=e[0].intersectionRatio;if(r!==a){if(!w)return l();r?l(!1,r):n=setTimeout((()=>{l(!1,1e-7)}),1e3)}1!==r||pt(u,t.getBoundingClientRect())||l(),w=!1}try{r=new IntersectionObserver(x,{...y,root:o.ownerDocument})}catch(v){r=new IntersectionObserver(x,y)}r.observe(t)}(!0),i}(u,n):null;let m,g=-1,y=null;l&&(y=new ResizeObserver((t=>{let[r]=t;r&&r.target===u&&y&&(y.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame((()=>{var t;null==(t=y)||t.observe(e)}))),n()})),u&&!a&&y.observe(u),y.observe(e));let w=a?rt(t):null;return a&&function e(){const r=rt(t);w&&!pt(w,r)&&n();w=r,m=requestAnimationFrame(e)}(),n(),()=>{var t;p.forEach((t=>{o&&t.removeEventListener("scroll",n),i&&t.removeEventListener("resize",n)})),null==h||h(),null==(t=y)||t.disconnect(),y=null,a&&cancelAnimationFrame(m)}}const mt=function(t){return void 0===t&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:i,placement:l,middlewareData:s}=e,a=await async function(t,e){const{placement:n,platform:r,elements:o}=t,i=await(null==r.isRTL?void 0:r.isRTL(o.floating)),l=w(n),s=x(n),a="y"===A(n),c=["left","top"].includes(l)?-1:1,f=i&&a?-1:1,u=y(e,t);let{mainAxis:d,crossAxis:p,alignmentAxis:h}="number"==typeof u?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&"number"==typeof h&&(p="end"===s?-1*h:h),a?{x:p*f,y:d*c}:{x:d*c,y:p*f}}(e,t);return l===(null==(n=s.offset)?void 0:n.placement)&&null!=(r=s.arrow)&&r.alignmentOffset?{}:{x:o+a.x,y:i+a.y,data:{...a,placement:l}}}}},gt=function(t){return void 0===t&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o}=e,{mainAxis:i=!0,crossAxis:l=!1,limiter:s={fn:t=>{let{x:e,y:n}=t;return{x:e,y:n}}},...a}=y(t,e),c={x:n,y:r},f=await T(e,a),u=A(w(o)),d=v(u);let p=c[d],h=c[u];if(i){const t="y"===d?"bottom":"right";p=g(p+f["y"===d?"top":"left"],p,p-f[t])}if(l){const t="y"===u?"bottom":"right";h=g(h+f["y"===u?"top":"left"],h,h-f[t])}const m=s.fn({...e,[d]:p,[u]:h});return{...m,data:{x:m.x-n,y:m.y-r,enabled:{[d]:i,[u]:l}}}}}},yt=function(t){return void 0===t&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:i,rects:l,initialPlacement:s,platform:a,elements:c}=e,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...g}=y(t,e);if(null!=(n=i.arrow)&&n.alignmentOffset)return{};const v=w(o),O=A(s),E=w(s)===s,L=await(null==a.isRTL?void 0:a.isRTL(c.floating)),C=d||(E||!m?[S(s)]:function(t){const e=S(t);return[P(t),e,P(e)]}(s)),D="none"!==h;!d&&D&&C.push(...function(t,e,n,r){const o=x(t);let i=function(t,e,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],l=["bottom","top"];switch(t){case"top":case"bottom":return n?e?o:r:e?r:o;case"left":case"right":return e?i:l;default:return[]}}(w(t),"start"===n,r);return o&&(i=i.map((t=>t+"-"+o)),e&&(i=i.concat(i.map(P)))),i}(s,m,h,L));const H=[s,...C],j=await T(e,g),k=[];let W=(null==(r=i.flip)?void 0:r.overflows)||[];if(f&&k.push(j[v]),u){const t=function(t,e,n){void 0===n&&(n=!1);const r=x(t),o=R(t),i=b(o);let l="x"===o?r===(n?"end":"start")?"right":"left":"start"===r?"bottom":"top";return e.reference[i]>e.floating[i]&&(l=S(l)),[l,S(l)]}(o,l,L);k.push(j[t[0]],j[t[1]])}if(W=[...W,{placement:o,overflows:k}],!k.every((t=>t<=0))){var F,B;const t=((null==(F=i.flip)?void 0:F.index)||0)+1,e=H[t];if(e)return{data:{index:t,overflows:W},reset:{placement:e}};let n=null==(B=W.filter((t=>t.overflows[0]<=0)).sort(((t,e)=>t.overflows[1]-e.overflows[1]))[0])?void 0:B.placement;if(!n)switch(p){case"bestFit":{var z;const t=null==(z=W.filter((t=>{if(D){const e=A(t.placement);return e===O||"y"===e}return!0})).map((t=>[t.placement,t.overflows.filter((t=>t>0)).reduce(((t,e)=>t+e),0)])).sort(((t,e)=>t[1]-e[1]))[0])?void 0:z[0];t&&(n=t);break}case"initialPlacement":n=s}if(o!==n)return{reset:{placement:n}}}return{}}}},wt=function(t){return void 0===t&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:o,rects:i,platform:l,elements:s}=e,{apply:a=()=>{},...u}=y(t,e),d=await T(e,u),p=w(o),h=x(o),m="y"===A(o),{width:g,height:v}=i.floating;let b,R;"top"===p||"bottom"===p?(b=p,R=h===(await(null==l.isRTL?void 0:l.isRTL(s.floating))?"start":"end")?"left":"right"):(R=p,b="end"===h?"top":"bottom");const P=v-d.top-d.bottom,S=g-d.left-d.right,O=c(v-d[b],P),E=c(g-d[R],S),L=!e.middlewareData.shift;let C=O,D=E;if(null!=(n=e.middlewareData.shift)&&n.enabled.x&&(D=S),null!=(r=e.middlewareData.shift)&&r.enabled.y&&(C=P),L&&!h){const t=f(d.left,0),e=f(d.right,0),n=f(d.top,0),r=f(d.bottom,0);m?D=g-2*(0!==t||0!==e?t+e:f(d.left,d.right)):C=v-2*(0!==n||0!==r?n+r:f(d.top,d.bottom))}await a({...e,availableWidth:D,availableHeight:C});const H=await l.getDimensions(s.floating);return g!==H.width||v!==H.height?{reset:{rects:!0}}:{}}}},xt=function(t){return void 0===t&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...o}=y(t,e);switch(r){case"referenceHidden":{const t=C(await T(e,{...o,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:t,referenceHidden:D(t)}}}case"escaped":{const t=C(await T(e,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:t,escaped:D(t)}}}default:return{}}}}},vt=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:o,rects:i,platform:l,elements:s,middlewareData:a}=e,{element:f,padding:u=0}=y(t,e)||{};if(null==f)return{};const d=O(u),p={x:n,y:r},h=R(o),m=b(h),w=await l.getDimensions(f),v="y"===h,A=v?"top":"left",P=v?"bottom":"right",S=v?"clientHeight":"clientWidth",E=i.reference[m]+i.reference[h]-p[h]-i.floating[m],L=p[h]-i.reference[h],T=await(null==l.getOffsetParent?void 0:l.getOffsetParent(f));let C=T?T[S]:0;C&&await(null==l.isElement?void 0:l.isElement(T))||(C=s.floating[S]||i.floating[m]);const D=E/2-L/2,H=C/2-w[m]/2-1,j=c(d[A],H),k=c(d[P],H),W=j,F=C-w[m]-k,B=C/2-w[m]/2+D,z=g(W,B,F),M=!a.arrow&&null!=x(o)&&B!==z&&i.reference[m]/2-(Bn&&(p=n)}if(c){var x,b;const t="y"===d?"width":"height",e=["top","left"].includes(w(o)),n=i.reference[u]-i.floating[t]+(e&&(null==(x=l.offset)?void 0:x[u])||0)+(e?0:g.crossAxis),r=i.reference[u]+i.reference[t]+(e?0:(null==(b=l.offset)?void 0:b[u])||0)-(e?g.crossAxis:0);hr&&(h=r)}return{[d]:p,[u]:h}}}},At=(t,e,n)=>{const r=new Map,o={platform:dt,...n},i={...o.platform,_c:r};return(async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l}=n,s=i.filter(Boolean),a=await(null==l.isRTL?void 0:l.isRTL(e));let c=await l.getElementRects({reference:t,floating:e,strategy:o}),{x:f,y:u}=L(c,r,a),d=r,p={},h=0;for(let m=0;m{n.current=e})),n}const Lt=t=>({name:"arrow",options:t,fn(e){const{element:n,padding:r}="function"==typeof t?t(e):t;return n&&(o=n,{}.hasOwnProperty.call(o,"current"))?null!=n.current?vt({element:n.current,padding:r}).fn(e):{}:n?vt({element:n,padding:r}).fn(e):{};var o}}),Tt=(t,e)=>({...gt(t),options:[t,e]}),Ct=(t,e)=>({...bt(t),options:[t,e]}),Dt=(t,e)=>({...yt(t),options:[t,e]}),Ht=(t,e)=>({...wt(t),options:[t,e]}),jt=(t,e)=>({...xt(t),options:[t,e]}),kt=(t,e)=>({...Lt(t),options:[t,e]});var Wt=t.forwardRef(((t,n)=>{const{children:o,width:i=10,height:l=5,...s}=t;return e.jsx(r.svg,{...s,ref:n,width:i,height:l,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?o:e.jsx("polygon",{points:"0,0 30,0 15,10"})})}));Wt.displayName="Arrow";var Ft=Wt;function Bt(e){const[n,r]=t.useState(void 0);return l((()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver((t=>{if(!Array.isArray(t))return;if(!t.length)return;const n=t[0];let o,i;if("borderBoxSize"in n){const t=n.borderBoxSize,e=Array.isArray(t)?t[0]:t;o=e.inlineSize,i=e.blockSize}else o=e.offsetWidth,i=e.offsetHeight;r({width:o,height:i})}));return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}r(void 0)}),[e]),n}var zt="Popper",[Mt,$t]=i(zt),[Nt,Vt]=Mt(zt),_t=n=>{const{__scopePopper:r,children:o}=n,[i,l]=t.useState(null);return e.jsx(Nt,{scope:r,anchor:i,onAnchorChange:l,children:o})};_t.displayName=zt;var Yt="PopperAnchor",Xt=t.forwardRef(((n,i)=>{const{__scopePopper:l,virtualRef:s,...a}=n,c=Vt(Yt,l),f=t.useRef(null),u=o(i,f);return t.useEffect((()=>{c.onAnchorChange(s?.current||f.current)})),s?null:e.jsx(r.div,{...a,ref:u})}));Xt.displayName=Yt;var It="PopperContent",[qt,Zt]=Mt(It),Gt=t.forwardRef(((i,a)=>{const{__scopePopper:c,side:f="bottom",sideOffset:u=0,align:d="center",alignOffset:p=0,arrowPadding:h=0,avoidCollisions:m=!0,collisionBoundary:g=[],collisionPadding:y=0,sticky:w="partial",hideWhenDetached:x=!1,updatePositionStrategy:v="optimized",onPlaced:b,...A}=i,R=Vt(It,c),[P,S]=t.useState(null),O=o(a,(t=>S(t))),[E,L]=t.useState(null),T=Bt(E),C=T?.width??0,D=T?.height??0,H=f+("center"!==d?"-"+d:""),j="number"==typeof y?y:{top:0,right:0,bottom:0,left:0,...y},k=Array.isArray(g)?g:[g],W=k.length>0,F={padding:j,boundary:k.filter(Ut),altBoundary:W},{refs:B,floatingStyles:z,placement:M,isPositioned:$,middlewareData:N}=function(e){void 0===e&&(e={});const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:l,elements:{reference:s,floating:a}={},transform:c=!0,whileElementsMounted:f,open:u}=e,[d,p]=t.useState({x:0,y:0,strategy:o,placement:r,middlewareData:{},isPositioned:!1}),[h,m]=t.useState(i);Pt(h,i)||m(i);const[g,y]=t.useState(null),[w,x]=t.useState(null),v=t.useCallback((t=>{t!==P.current&&(P.current=t,y(t))}),[]),b=t.useCallback((t=>{t!==S.current&&(S.current=t,x(t))}),[]),A=s||g,R=a||w,P=t.useRef(null),S=t.useRef(null),O=t.useRef(d),E=null!=f,L=Et(f),T=Et(l),C=Et(u),D=t.useCallback((()=>{if(!P.current||!S.current)return;const t={placement:r,strategy:o,middleware:h};T.current&&(t.platform=T.current),At(P.current,S.current,t).then((t=>{const e={...t,isPositioned:!1!==C.current};H.current&&!Pt(O.current,e)&&(O.current=e,n.flushSync((()=>{p(e)})))}))}),[h,r,o,T,C]);Rt((()=>{!1===u&&O.current.isPositioned&&(O.current.isPositioned=!1,p((t=>({...t,isPositioned:!1}))))}),[u]);const H=t.useRef(!1);Rt((()=>(H.current=!0,()=>{H.current=!1})),[]),Rt((()=>{if(A&&(P.current=A),R&&(S.current=R),A&&R){if(L.current)return L.current(A,R,D);D()}}),[A,R,D,L,E]);const j=t.useMemo((()=>({reference:P,floating:S,setReference:v,setFloating:b})),[v,b]),k=t.useMemo((()=>({reference:A,floating:R})),[A,R]),W=t.useMemo((()=>{const t={position:o,left:0,top:0};if(!k.floating)return t;const e=Ot(k.floating,d.x),n=Ot(k.floating,d.y);return c?{...t,transform:"translate("+e+"px, "+n+"px)",...St(k.floating)>=1.5&&{willChange:"transform"}}:{position:o,left:e,top:n}}),[o,c,k.floating,d.x,d.y]);return t.useMemo((()=>({...d,update:D,refs:j,elements:k,floatingStyles:W})),[d,D,j,k,W])}({strategy:"fixed",placement:H,whileElementsMounted:(...t)=>ht(...t,{animationFrame:"always"===v}),elements:{reference:R.anchor},middleware:[(V={mainAxis:u+D,alignmentAxis:p},{...mt(V),options:[V,_]}),m&&Tt({mainAxis:!0,crossAxis:!1,limiter:"partial"===w?Ct():void 0,...F}),m&&Dt({...F}),Ht({...F,apply:({elements:t,rects:e,availableWidth:n,availableHeight:r})=>{const{width:o,height:i}=e.reference,l=t.floating.style;l.setProperty("--radix-popper-available-width",`${n}px`),l.setProperty("--radix-popper-available-height",`${r}px`),l.setProperty("--radix-popper-anchor-width",`${o}px`),l.setProperty("--radix-popper-anchor-height",`${i}px`)}}),E&&kt({element:E,padding:h}),te({arrowWidth:C,arrowHeight:D}),x&&jt({strategy:"referenceHidden",...F})]});var V,_;const[Y,X]=ee(M),I=s(b);l((()=>{$&&I?.()}),[$,I]);const q=N.arrow?.x,Z=N.arrow?.y,G=0!==N.arrow?.centerOffset,[J,K]=t.useState();return l((()=>{P&&K(window.getComputedStyle(P).zIndex)}),[P]),e.jsx("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:$?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[N.transformOrigin?.x,N.transformOrigin?.y].join(" "),...N.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:i.dir,children:e.jsx(qt,{scope:c,placedSide:Y,onArrowChange:L,arrowX:q,arrowY:Z,shouldHideArrow:G,children:e.jsx(r.div,{"data-side":Y,"data-align":X,...A,ref:O,style:{...A.style,animation:$?void 0:"none"}})})})}));Gt.displayName=It;var Jt="PopperArrow",Kt={top:"bottom",right:"left",bottom:"top",left:"right"},Qt=t.forwardRef((function(t,n){const{__scopePopper:r,...o}=t,i=Zt(Jt,r),l=Kt[i.placedSide];return e.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:e.jsx(Ft,{...o,ref:n,style:{...o.style,display:"block"}})})}));function Ut(t){return null!==t}Qt.displayName=Jt;var te=t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:r,middlewareData:o}=e,i=0!==o.arrow?.centerOffset,l=i?0:t.arrowWidth,s=i?0:t.arrowHeight,[a,c]=ee(n),f={start:"0%",center:"50%",end:"100%"}[c],u=(o.arrow?.x??0)+l/2,d=(o.arrow?.y??0)+s/2;let p="",h="";return"bottom"===a?(p=i?f:`${u}px`,h=-s+"px"):"top"===a?(p=i?f:`${u}px`,h=`${r.floating.height+s}px`):"right"===a?(p=-s+"px",h=i?f:`${d}px`):"left"===a&&(p=`${r.floating.width+s}px`,h=i?f:`${d}px`),{data:{x:p,y:h}}}});function ee(t){const[e,n="center"]=t.split("-");return[e,n]}var ne=_t,re=Xt,oe=Gt,ie=Qt;export{re as A,oe as C,ne as R,ie as a,$t as c,Bt as u};