@stanfordspezi/spezi-web-design-system
Version:
Stanford Biodesign Digital Health Spezi Web Design System
2 lines (1 loc) • 27.1 kB
JavaScript
;const vt=require("react"),Ce=require("react-dom"),Ot=require("./index-14SsMENa.js"),Y=require("react/jsx-runtime"),Zt=require("./index-UhBwhhTY.js"),at=require("./index-CLdeiAAB.js"),Se=require("./index-DZvjbfOs.js");function Kt(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const O=Kt(vt),Ee=Kt(Ce),De=["top","right","bottom","left"],U=Math.min,F=Math.max,ut=Math.round,lt=Math.floor,V=t=>({x:t,y:t}),Me={left:"right",right:"left",bottom:"top",top:"bottom"},Te={start:"end",end:"start"};function bt(t,e,n){return F(t,U(e,n))}function q(t,e){return typeof t=="function"?t(e):t}function X(t){return t.split("-")[0]}function tt(t){return t.split("-")[1]}function Pt(t){return t==="x"?"y":"x"}function Ct(t){return t==="y"?"height":"width"}function Z(t){return["top","bottom"].includes(X(t))?"y":"x"}function St(t){return Pt(Z(t))}function Le(t,e,n){n===void 0&&(n=!1);const o=tt(t),i=St(t),r=Ct(i);let s=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(s=dt(s)),[s,dt(s)]}function $e(t){const e=dt(t);return[At(t),e,At(e)]}function At(t){return t.replace(/start|end/g,e=>Te[e])}function ke(t,e,n){const o=["left","right"],i=["right","left"],r=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:o:e?o:i;case"left":case"right":return e?r:s;default:return[]}}function Ne(t,e,n,o){const i=tt(t);let r=ke(X(t),n==="start",o);return i&&(r=r.map(s=>s+"-"+i),e&&(r=r.concat(r.map(At)))),r}function dt(t){return t.replace(/left|right|bottom|top/g,e=>Me[e])}function Fe(t){return{top:0,right:0,bottom:0,left:0,...t}}function Gt(t){return typeof t!="number"?Fe(t):{top:t,right:t,bottom:t,left:t}}function pt(t){const{x:e,y:n,width:o,height:i}=t;return{width:o,height:i,top:n,left:e,right:e+o,bottom:n+i,x:e,y:n}}function jt(t,e,n){let{reference:o,floating:i}=t;const r=Z(e),s=St(e),c=Ct(s),a=X(e),l=r==="y",f=o.x+o.width/2-i.width/2,u=o.y+o.height/2-i.height/2,m=o[c]/2-i[c]/2;let d;switch(a){case"top":d={x:f,y:o.y-i.height};break;case"bottom":d={x:f,y:o.y+o.height};break;case"right":d={x:o.x+o.width,y:u};break;case"left":d={x:o.x-i.width,y:u};break;default:d={x:o.x,y:o.y}}switch(tt(e)){case"start":d[s]-=m*(n&&l?-1:1);break;case"end":d[s]+=m*(n&&l?-1:1);break}return d}const _e=async(t,e,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:s}=n,c=r.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(e));let l=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:u}=jt(l,o,a),m=o,d={},p=0;for(let h=0;h<c.length;h++){const{name:w,fn:g}=c[h],{x,y:b,data:y,reset:v}=await g({x:f,y:u,initialPlacement:o,placement:m,strategy:i,middlewareData:d,rects:l,platform:s,elements:{reference:t,floating:e}});f=x??f,u=b??u,d={...d,[w]:{...d[w],...y}},v&&p<=50&&(p++,typeof v=="object"&&(v.placement&&(m=v.placement),v.rects&&(l=v.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):v.rects),{x:f,y:u}=jt(l,m,a)),h=-1)}return{x:f,y:u,placement:m,strategy:i,middlewareData:d}};async function ot(t,e){var n;e===void 0&&(e={});const{x:o,y:i,platform:r,rects:s,elements:c,strategy:a}=t,{boundary:l="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:m=!1,padding:d=0}=q(e,t),p=Gt(d),w=c[m?u==="floating"?"reference":"floating":u],g=pt(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(w)))==null||n?w:w.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(c.floating)),boundary:l,rootBoundary:f,strategy:a})),x=u==="floating"?{x:o,y:i,width:s.floating.width,height:s.floating.height}:s.reference,b=await(r.getOffsetParent==null?void 0:r.getOffsetParent(c.floating)),y=await(r.isElement==null?void 0:r.isElement(b))?await(r.getScale==null?void 0:r.getScale(b))||{x:1,y:1}:{x:1,y:1},v=pt(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:x,offsetParent:b,strategy:a}):x);return{top:(g.top-v.top+p.top)/y.y,bottom:(v.bottom-g.bottom+p.bottom)/y.y,left:(g.left-v.left+p.left)/y.x,right:(v.right-g.right+p.right)/y.x}}const He=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:i,rects:r,platform:s,elements:c,middlewareData:a}=e,{element:l,padding:f=0}=q(t,e)||{};if(l==null)return{};const u=Gt(f),m={x:n,y:o},d=St(i),p=Ct(d),h=await s.getDimensions(l),w=d==="y",g=w?"top":"left",x=w?"bottom":"right",b=w?"clientHeight":"clientWidth",y=r.reference[p]+r.reference[d]-m[d]-r.floating[p],v=m[d]-r.reference[d],R=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l));let P=R?R[b]:0;(!P||!await(s.isElement==null?void 0:s.isElement(R)))&&(P=c.floating[b]||r.floating[p]);const M=y/2-v/2,N=P/2-h[p]/2-1,T=U(u[g],N),$=U(u[x],N),k=T,S=P-h[p]-$,C=P/2-h[p]/2+M,H=bt(k,C,S),E=!a.arrow&&tt(i)!=null&&C!==H&&r.reference[p]/2-(C<k?T:$)-h[p]/2<0,D=E?C<k?C-k:C-S:0;return{[d]:m[d]+D,data:{[d]:H,centerOffset:C-H-D,...E&&{alignmentOffset:D}},reset:E}}}),We=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:i,middlewareData:r,rects:s,initialPlacement:c,platform:a,elements:l}=e,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:m,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:h=!0,...w}=q(t,e);if((n=r.arrow)!=null&&n.alignmentOffset)return{};const g=X(i),x=Z(c),b=X(c)===c,y=await(a.isRTL==null?void 0:a.isRTL(l.floating)),v=m||(b||!h?[dt(c)]:$e(c)),R=p!=="none";!m&&R&&v.push(...Ne(c,h,p,y));const P=[c,...v],M=await ot(e,w),N=[];let T=((o=r.flip)==null?void 0:o.overflows)||[];if(f&&N.push(M[g]),u){const C=Le(i,s,y);N.push(M[C[0]],M[C[1]])}if(T=[...T,{placement:i,overflows:N}],!N.every(C=>C<=0)){var $,k;const C=((($=r.flip)==null?void 0:$.index)||0)+1,H=P[C];if(H)return{data:{index:C,overflows:T},reset:{placement:H}};let E=(k=T.filter(D=>D.overflows[0]<=0).sort((D,A)=>D.overflows[1]-A.overflows[1])[0])==null?void 0:k.placement;if(!E)switch(d){case"bestFit":{var S;const D=(S=T.filter(A=>{if(R){const L=Z(A.placement);return L===x||L==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(L=>L>0).reduce((L,j)=>L+j,0)]).sort((A,L)=>A[1]-L[1])[0])==null?void 0:S[0];D&&(E=D);break}case"initialPlacement":E=c;break}if(i!==E)return{reset:{placement:E}}}return{}}}};function Vt(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function zt(t){return De.some(e=>t[e]>=0)}const Be=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:o="referenceHidden",...i}=q(t,e);switch(o){case"referenceHidden":{const r=await ot(e,{...i,elementContext:"reference"}),s=Vt(r,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:zt(s)}}}case"escaped":{const r=await ot(e,{...i,altBoundary:!0}),s=Vt(r,n.floating);return{data:{escapedOffsets:s,escaped:zt(s)}}}default:return{}}}}};async function je(t,e){const{placement:n,platform:o,elements:i}=t,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),s=X(n),c=tt(n),a=Z(n)==="y",l=["left","top"].includes(s)?-1:1,f=r&&a?-1:1,u=q(e,t);let{mainAxis:m,crossAxis:d,alignmentAxis:p}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return c&&typeof p=="number"&&(d=c==="end"?p*-1:p),a?{x:d*f,y:m*l}:{x:m*l,y:d*f}}const Ve=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:i,y:r,placement:s,middlewareData:c}=e,a=await je(e,t);return s===((n=c.offset)==null?void 0:n.placement)&&(o=c.arrow)!=null&&o.alignmentOffset?{}:{x:i+a.x,y:r+a.y,data:{...a,placement:s}}}}},ze=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:i}=e,{mainAxis:r=!0,crossAxis:s=!1,limiter:c={fn:w=>{let{x:g,y:x}=w;return{x:g,y:x}}},...a}=q(t,e),l={x:n,y:o},f=await ot(e,a),u=Z(X(i)),m=Pt(u);let d=l[m],p=l[u];if(r){const w=m==="y"?"top":"left",g=m==="y"?"bottom":"right",x=d+f[w],b=d-f[g];d=bt(x,d,b)}if(s){const w=u==="y"?"top":"left",g=u==="y"?"bottom":"right",x=p+f[w],b=p-f[g];p=bt(x,p,b)}const h=c.fn({...e,[m]:d,[u]:p});return{...h,data:{x:h.x-n,y:h.y-o,enabled:{[m]:r,[u]:s}}}}}},Ie=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:i,rects:r,middlewareData:s}=e,{offset:c=0,mainAxis:a=!0,crossAxis:l=!0}=q(t,e),f={x:n,y:o},u=Z(i),m=Pt(u);let d=f[m],p=f[u];const h=q(c,e),w=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(a){const b=m==="y"?"height":"width",y=r.reference[m]-r.floating[b]+w.mainAxis,v=r.reference[m]+r.reference[b]-w.mainAxis;d<y?d=y:d>v&&(d=v)}if(l){var g,x;const b=m==="y"?"width":"height",y=["top","left"].includes(X(i)),v=r.reference[u]-r.floating[b]+(y&&((g=s.offset)==null?void 0:g[u])||0)+(y?0:w.crossAxis),R=r.reference[u]+r.reference[b]+(y?0:((x=s.offset)==null?void 0:x[u])||0)-(y?w.crossAxis:0);p<v?p=v:p>R&&(p=R)}return{[m]:d,[u]:p}}}},Ye=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:i,rects:r,platform:s,elements:c}=e,{apply:a=()=>{},...l}=q(t,e),f=await ot(e,l),u=X(i),m=tt(i),d=Z(i)==="y",{width:p,height:h}=r.floating;let w,g;u==="top"||u==="bottom"?(w=u,g=m===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(g=u,w=m==="end"?"top":"bottom");const x=h-f.top-f.bottom,b=p-f.left-f.right,y=U(h-f[w],x),v=U(p-f[g],b),R=!e.middlewareData.shift;let P=y,M=v;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(M=b),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(P=x),R&&!m){const T=F(f.left,0),$=F(f.right,0),k=F(f.top,0),S=F(f.bottom,0);d?M=p-2*(T!==0||$!==0?T+$:F(f.left,f.right)):P=h-2*(k!==0||S!==0?k+S:F(f.top,f.bottom))}await a({...e,availableWidth:M,availableHeight:P});const N=await s.getDimensions(c.floating);return p!==N.width||h!==N.height?{reset:{rects:!0}}:{}}}};function ht(){return typeof window<"u"}function et(t){return Jt(t)?(t.nodeName||"").toLowerCase():"#document"}function _(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function I(t){var e;return(e=(Jt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Jt(t){return ht()?t instanceof Node||t instanceof _(t).Node:!1}function W(t){return ht()?t instanceof Element||t instanceof _(t).Element:!1}function z(t){return ht()?t instanceof HTMLElement||t instanceof _(t).HTMLElement:!1}function It(t){return!ht()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof _(t).ShadowRoot}function rt(t){const{overflow:e,overflowX:n,overflowY:o,display:i}=B(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!["inline","contents"].includes(i)}function qe(t){return["table","td","th"].includes(et(t))}function gt(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Et(t){const e=Dt(),n=W(t)?B(t):t;return["transform","translate","scale","rotate","perspective"].some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(o=>(n.willChange||"").includes(o))||["paint","layout","strict","content"].some(o=>(n.contain||"").includes(o))}function Xe(t){let e=K(t);for(;z(e)&&!Q(e);){if(Et(e))return e;if(gt(e))return null;e=K(e)}return null}function Dt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Q(t){return["html","body","#document"].includes(et(t))}function B(t){return _(t).getComputedStyle(t)}function wt(t){return W(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function K(t){if(et(t)==="html")return t;const e=t.assignedSlot||t.parentNode||It(t)&&t.host||I(t);return It(e)?e.host:e}function Qt(t){const e=K(t);return Q(e)?t.ownerDocument?t.ownerDocument.body:t.body:z(e)&&rt(e)?e:Qt(e)}function it(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=Qt(t),r=i===((o=t.ownerDocument)==null?void 0:o.body),s=_(i);if(r){const c=Rt(s);return e.concat(s,s.visualViewport||[],rt(i)?i:[],c&&n?it(c):[])}return e.concat(i,it(i,[],n))}function Rt(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function te(t){const e=B(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const i=z(t),r=i?t.offsetWidth:n,s=i?t.offsetHeight:o,c=ut(n)!==r||ut(o)!==s;return c&&(n=r,o=s),{width:n,height:o,$:c}}function Mt(t){return W(t)?t:t.contextElement}function J(t){const e=Mt(t);if(!z(e))return V(1);const n=e.getBoundingClientRect(),{width:o,height:i,$:r}=te(e);let s=(r?ut(n.width):n.width)/o,c=(r?ut(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const Ue=V(0);function ee(t){const e=_(t);return!Dt()||!e.visualViewport?Ue:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Ze(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==_(t)?!1:e}function G(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),r=Mt(t);let s=V(1);e&&(o?W(o)&&(s=J(o)):s=J(t));const c=Ze(r,n,o)?ee(r):V(0);let a=(i.left+c.x)/s.x,l=(i.top+c.y)/s.y,f=i.width/s.x,u=i.height/s.y;if(r){const m=_(r),d=o&&W(o)?_(o):o;let p=m,h=Rt(p);for(;h&&o&&d!==p;){const w=J(h),g=h.getBoundingClientRect(),x=B(h),b=g.left+(h.clientLeft+parseFloat(x.paddingLeft))*w.x,y=g.top+(h.clientTop+parseFloat(x.paddingTop))*w.y;a*=w.x,l*=w.y,f*=w.x,u*=w.y,a+=b,l+=y,p=_(h),h=Rt(p)}}return pt({width:f,height:u,x:a,y:l})}function Tt(t,e){const n=wt(t).scrollLeft;return e?e.left+n:G(I(t)).left+n}function ne(t,e,n){n===void 0&&(n=!1);const o=t.getBoundingClientRect(),i=o.left+e.scrollLeft-(n?0:Tt(t,o)),r=o.top+e.scrollTop;return{x:i,y:r}}function Ke(t){let{elements:e,rect:n,offsetParent:o,strategy:i}=t;const r=i==="fixed",s=I(o),c=e?gt(e.floating):!1;if(o===s||c&&r)return n;let a={scrollLeft:0,scrollTop:0},l=V(1);const f=V(0),u=z(o);if((u||!u&&!r)&&((et(o)!=="body"||rt(s))&&(a=wt(o)),z(o))){const d=G(o);l=J(o),f.x=d.x+o.clientLeft,f.y=d.y+o.clientTop}const m=s&&!u&&!r?ne(s,a,!0):V(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-a.scrollLeft*l.x+f.x+m.x,y:n.y*l.y-a.scrollTop*l.y+f.y+m.y}}function Ge(t){return Array.from(t.getClientRects())}function Je(t){const e=I(t),n=wt(t),o=t.ownerDocument.body,i=F(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),r=F(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-n.scrollLeft+Tt(t);const c=-n.scrollTop;return B(o).direction==="rtl"&&(s+=F(e.clientWidth,o.clientWidth)-i),{width:i,height:r,x:s,y:c}}function Qe(t,e){const n=_(t),o=I(t),i=n.visualViewport;let r=o.clientWidth,s=o.clientHeight,c=0,a=0;if(i){r=i.width,s=i.height;const l=Dt();(!l||l&&e==="fixed")&&(c=i.offsetLeft,a=i.offsetTop)}return{width:r,height:s,x:c,y:a}}function tn(t,e){const n=G(t,!0,e==="fixed"),o=n.top+t.clientTop,i=n.left+t.clientLeft,r=z(t)?J(t):V(1),s=t.clientWidth*r.x,c=t.clientHeight*r.y,a=i*r.x,l=o*r.y;return{width:s,height:c,x:a,y:l}}function Yt(t,e,n){let o;if(e==="viewport")o=Qe(t,n);else if(e==="document")o=Je(I(t));else if(W(e))o=tn(e,n);else{const i=ee(t);o={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return pt(o)}function oe(t,e){const n=K(t);return n===e||!W(n)||Q(n)?!1:B(n).position==="fixed"||oe(n,e)}function en(t,e){const n=e.get(t);if(n)return n;let o=it(t,[],!1).filter(c=>W(c)&&et(c)!=="body"),i=null;const r=B(t).position==="fixed";let s=r?K(t):t;for(;W(s)&&!Q(s);){const c=B(s),a=Et(s);!a&&c.position==="fixed"&&(i=null),(r?!a&&!i:!a&&c.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||rt(s)&&!a&&oe(t,s))?o=o.filter(f=>f!==s):i=c,s=K(s)}return e.set(t,o),o}function nn(t){let{element:e,boundary:n,rootBoundary:o,strategy:i}=t;const s=[...n==="clippingAncestors"?gt(e)?[]:en(e,this._c):[].concat(n),o],c=s[0],a=s.reduce((l,f)=>{const u=Yt(e,f,i);return l.top=F(u.top,l.top),l.right=U(u.right,l.right),l.bottom=U(u.bottom,l.bottom),l.left=F(u.left,l.left),l},Yt(e,c,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function on(t){const{width:e,height:n}=te(t);return{width:e,height:n}}function rn(t,e,n){const o=z(e),i=I(e),r=n==="fixed",s=G(t,!0,r,e);let c={scrollLeft:0,scrollTop:0};const a=V(0);if(o||!o&&!r)if((et(e)!=="body"||rt(i))&&(c=wt(e)),o){const m=G(e,!0,r,e);a.x=m.x+e.clientLeft,a.y=m.y+e.clientTop}else i&&(a.x=Tt(i));const l=i&&!o&&!r?ne(i,c):V(0),f=s.left+c.scrollLeft-a.x-l.x,u=s.top+c.scrollTop-a.y-l.y;return{x:f,y:u,width:s.width,height:s.height}}function xt(t){return B(t).position==="static"}function qt(t,e){if(!z(t)||B(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return I(t)===n&&(n=n.ownerDocument.body),n}function ie(t,e){const n=_(t);if(gt(t))return n;if(!z(t)){let i=K(t);for(;i&&!Q(i);){if(W(i)&&!xt(i))return i;i=K(i)}return n}let o=qt(t,e);for(;o&&qe(o)&&xt(o);)o=qt(o,e);return o&&Q(o)&&xt(o)&&!Et(o)?n:o||Xe(t)||n}const sn=async function(t){const e=this.getOffsetParent||ie,n=this.getDimensions,o=await n(t.floating);return{reference:rn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function cn(t){return B(t).direction==="rtl"}const ln={convertOffsetParentRelativeRectToViewportRelativeRect:Ke,getDocumentElement:I,getClippingRect:nn,getOffsetParent:ie,getElementRects:sn,getClientRects:Ge,getDimensions:on,getScale:J,isElement:W,isRTL:cn};function re(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function an(t,e){let n=null,o;const i=I(t);function r(){var c;clearTimeout(o),(c=n)==null||c.disconnect(),n=null}function s(c,a){c===void 0&&(c=!1),a===void 0&&(a=1),r();const l=t.getBoundingClientRect(),{left:f,top:u,width:m,height:d}=l;if(c||e(),!m||!d)return;const p=lt(u),h=lt(i.clientWidth-(f+m)),w=lt(i.clientHeight-(u+d)),g=lt(f),b={rootMargin:-p+"px "+-h+"px "+-w+"px "+-g+"px",threshold:F(0,U(1,a))||1};let y=!0;function v(R){const P=R[0].intersectionRatio;if(P!==a){if(!y)return s();P?s(!1,P):o=setTimeout(()=>{s(!1,1e-7)},1e3)}P===1&&!re(l,t.getBoundingClientRect())&&s(),y=!1}try{n=new IntersectionObserver(v,{...b,root:i.ownerDocument})}catch{n=new IntersectionObserver(v,b)}n.observe(t)}return s(!0),r}function fn(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,l=Mt(t),f=i||r?[...l?it(l):[],...it(e)]:[];f.forEach(g=>{i&&g.addEventListener("scroll",n,{passive:!0}),r&&g.addEventListener("resize",n)});const u=l&&c?an(l,n):null;let m=-1,d=null;s&&(d=new ResizeObserver(g=>{let[x]=g;x&&x.target===l&&d&&(d.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=d)==null||b.observe(e)})),n()}),l&&!a&&d.observe(l),d.observe(e));let p,h=a?G(t):null;a&&w();function w(){const g=G(t);h&&!re(h,g)&&n(),h=g,p=requestAnimationFrame(w)}return n(),()=>{var g;f.forEach(x=>{i&&x.removeEventListener("scroll",n),r&&x.removeEventListener("resize",n)}),u==null||u(),(g=d)==null||g.disconnect(),d=null,a&&cancelAnimationFrame(p)}}const un=Ve,dn=ze,pn=We,mn=Ye,hn=Be,Xt=He,gn=Ie,wn=(t,e,n)=>{const o=new Map,i={platform:ln,...n},r={...i.platform,_c:o};return _e(t,e,{...i,platform:r})};var ft=typeof document<"u"?vt.useLayoutEffect:vt.useEffect;function mt(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,o,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;o--!==0;)if(!mt(t[o],e[o]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(e,i[o]))return!1;for(o=n;o--!==0;){const r=i[o];if(!(r==="_owner"&&t.$$typeof)&&!mt(t[r],e[r]))return!1}return!0}return t!==t&&e!==e}function se(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Ut(t,e){const n=se(t);return Math.round(e*n)/n}function yt(t){const e=O.useRef(t);return ft(()=>{e.current=t}),e}function xn(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:o=[],platform:i,elements:{reference:r,floating:s}={},transform:c=!0,whileElementsMounted:a,open:l}=t,[f,u]=O.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[m,d]=O.useState(o);mt(m,o)||d(o);const[p,h]=O.useState(null),[w,g]=O.useState(null),x=O.useCallback(A=>{A!==R.current&&(R.current=A,h(A))},[]),b=O.useCallback(A=>{A!==P.current&&(P.current=A,g(A))},[]),y=r||p,v=s||w,R=O.useRef(null),P=O.useRef(null),M=O.useRef(f),N=a!=null,T=yt(a),$=yt(i),k=yt(l),S=O.useCallback(()=>{if(!R.current||!P.current)return;const A={placement:e,strategy:n,middleware:m};$.current&&(A.platform=$.current),wn(R.current,P.current,A).then(L=>{const j={...L,isPositioned:k.current!==!1};C.current&&!mt(M.current,j)&&(M.current=j,Ee.flushSync(()=>{u(j)}))})},[m,e,n,$,k]);ft(()=>{l===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,u(A=>({...A,isPositioned:!1})))},[l]);const C=O.useRef(!1);ft(()=>(C.current=!0,()=>{C.current=!1}),[]),ft(()=>{if(y&&(R.current=y),v&&(P.current=v),y&&v){if(T.current)return T.current(y,v,S);S()}},[y,v,S,T,N]);const H=O.useMemo(()=>({reference:R,floating:P,setReference:x,setFloating:b}),[x,b]),E=O.useMemo(()=>({reference:y,floating:v}),[y,v]),D=O.useMemo(()=>{const A={position:n,left:0,top:0};if(!E.floating)return A;const L=Ut(E.floating,f.x),j=Ut(E.floating,f.y);return c?{...A,transform:"translate("+L+"px, "+j+"px)",...se(E.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:L,top:j}},[n,c,E.floating,f.x,f.y]);return O.useMemo(()=>({...f,update:S,refs:H,elements:E,floatingStyles:D}),[f,S,H,E,D])}const yn=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:o,padding:i}=typeof t=="function"?t(n):t;return o&&e(o)?o.current!=null?Xt({element:o.current,padding:i}).fn(n):{}:o?Xt({element:o,padding:i}).fn(n):{}}}},vn=(t,e)=>({...un(t),options:[t,e]}),bn=(t,e)=>({...dn(t),options:[t,e]}),An=(t,e)=>({...gn(t),options:[t,e]}),Rn=(t,e)=>({...pn(t),options:[t,e]}),On=(t,e)=>({...mn(t),options:[t,e]}),Pn=(t,e)=>({...hn(t),options:[t,e]}),Cn=(t,e)=>({...yn(t),options:[t,e]});var Sn="Arrow",ce=O.forwardRef((t,e)=>{const{children:n,width:o=10,height:i=5,...r}=t;return Y.jsx(Ot.Primitive.svg,{...r,ref:e,width:o,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:Y.jsx("polygon",{points:"0,0 30,0 15,10"})})});ce.displayName=Sn;var En=ce,Lt="Popper",[le,Dn]=at.createContextScope(Lt),[Mn,ae]=le(Lt),fe=t=>{const{__scopePopper:e,children:n}=t,[o,i]=O.useState(null);return Y.jsx(Mn,{scope:e,anchor:o,onAnchorChange:i,children:n})};fe.displayName=Lt;var ue="PopperAnchor",de=O.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:o,...i}=t,r=ae(ue,n),s=O.useRef(null),c=Zt.useComposedRefs(e,s);return O.useEffect(()=>{r.onAnchorChange((o==null?void 0:o.current)||s.current)}),o?null:Y.jsx(Ot.Primitive.div,{...i,ref:c})});de.displayName=ue;var $t="PopperContent",[Tn,Ln]=le($t),pe=O.forwardRef((t,e)=>{var kt,Nt,Ft,_t,Ht,Wt;const{__scopePopper:n,side:o="bottom",sideOffset:i=0,align:r="center",alignOffset:s=0,arrowPadding:c=0,avoidCollisions:a=!0,collisionBoundary:l=[],collisionPadding:f=0,sticky:u="partial",hideWhenDetached:m=!1,updatePositionStrategy:d="optimized",onPlaced:p,...h}=t,w=ae($t,n),[g,x]=O.useState(null),b=Zt.useComposedRefs(e,nt=>x(nt)),[y,v]=O.useState(null),R=Se.useSize(y),P=(R==null?void 0:R.width)??0,M=(R==null?void 0:R.height)??0,N=o+(r!=="center"?"-"+r:""),T=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},$=Array.isArray(l)?l:[l],k=$.length>0,S={padding:T,boundary:$.filter(kn),altBoundary:k},{refs:C,floatingStyles:H,placement:E,isPositioned:D,middlewareData:A}=xn({strategy:"fixed",placement:N,whileElementsMounted:(...nt)=>fn(...nt,{animationFrame:d==="always"}),elements:{reference:w.anchor},middleware:[vn({mainAxis:i+M,alignmentAxis:s}),a&&bn({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?An():void 0,...S}),a&&Rn({...S}),On({...S,apply:({elements:nt,rects:Bt,availableWidth:Ae,availableHeight:Re})=>{const{width:Oe,height:Pe}=Bt.reference,ct=nt.floating.style;ct.setProperty("--radix-popper-available-width",`${Ae}px`),ct.setProperty("--radix-popper-available-height",`${Re}px`),ct.setProperty("--radix-popper-anchor-width",`${Oe}px`),ct.setProperty("--radix-popper-anchor-height",`${Pe}px`)}}),y&&Cn({element:y,padding:c}),Nn({arrowWidth:P,arrowHeight:M}),m&&Pn({strategy:"referenceHidden",...S})]}),[L,j]=ge(E),st=at.useCallbackRef(p);at.useLayoutEffect2(()=>{D&&(st==null||st())},[D,st]);const we=(kt=A.arrow)==null?void 0:kt.x,xe=(Nt=A.arrow)==null?void 0:Nt.y,ye=((Ft=A.arrow)==null?void 0:Ft.centerOffset)!==0,[ve,be]=O.useState();return at.useLayoutEffect2(()=>{g&&be(window.getComputedStyle(g).zIndex)},[g]),Y.jsx("div",{ref:C.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:D?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ve,"--radix-popper-transform-origin":[(_t=A.transformOrigin)==null?void 0:_t.x,(Ht=A.transformOrigin)==null?void 0:Ht.y].join(" "),...((Wt=A.hide)==null?void 0:Wt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:Y.jsx(Tn,{scope:n,placedSide:L,onArrowChange:v,arrowX:we,arrowY:xe,shouldHideArrow:ye,children:Y.jsx(Ot.Primitive.div,{"data-side":L,"data-align":j,...h,ref:b,style:{...h.style,animation:D?void 0:"none"}})})})});pe.displayName=$t;var me="PopperArrow",$n={top:"bottom",right:"left",bottom:"top",left:"right"},he=O.forwardRef(function(e,n){const{__scopePopper:o,...i}=e,r=Ln(me,o),s=$n[r.placedSide];return Y.jsx("span",{ref:r.onArrowChange,style:{position:"absolute",left:r.arrowX,top:r.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[r.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[r.placedSide],visibility:r.shouldHideArrow?"hidden":void 0},children:Y.jsx(En,{...i,ref:n,style:{...i.style,display:"block"}})})});he.displayName=me;function kn(t){return t!==null}var Nn=t=>({name:"transformOrigin",options:t,fn(e){var w,g,x;const{placement:n,rects:o,middlewareData:i}=e,s=((w=i.arrow)==null?void 0:w.centerOffset)!==0,c=s?0:t.arrowWidth,a=s?0:t.arrowHeight,[l,f]=ge(n),u={start:"0%",center:"50%",end:"100%"}[f],m=(((g=i.arrow)==null?void 0:g.x)??0)+c/2,d=(((x=i.arrow)==null?void 0:x.y)??0)+a/2;let p="",h="";return l==="bottom"?(p=s?u:`${m}px`,h=`${-a}px`):l==="top"?(p=s?u:`${m}px`,h=`${o.floating.height+a}px`):l==="right"?(p=`${-a}px`,h=s?u:`${d}px`):l==="left"&&(p=`${o.floating.width+a}px`,h=s?u:`${d}px`),{data:{x:p,y:h}}}});function ge(t){const[e,n="center"]=t.split("-");return[e,n]}var Fn=fe,_n=de,Hn=pe,Wn=he;exports.Anchor=_n;exports.Arrow=Wn;exports.Content=Hn;exports.Root2=Fn;exports.createPopperScope=Dn;