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