UNPKG

dgz-ui

Version:

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

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