UNPKG

dgz-ui

Version:

Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript

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