UNPKG

@stanfordspezi/spezi-web-design-system

Version:

Stanford Biodesign Digital Health Spezi Web Design System

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