2 lines
22 KiB
JavaScript
2 lines
22 KiB
JavaScript
(()=>{var N=Math.min,k=Math.max,H=Math.round,_=Math.floor,O=e=>({x:e,y:e});function Z(e,t,o){return k(e,N(t,o))}function j(e,t){return typeof e=="function"?e(t):e}function Y(e){return e.split("-")[0]}function ee(e){return e.split("-")[1]}function te(e){return e==="x"?"y":"x"}function re(e){return e==="y"?"height":"width"}function z(e){let t=e[0];return t==="t"||t==="b"?"y":"x"}function le(e){return te(z(e))}function Fe(e){return{top:0,right:0,bottom:0,left:0,...e}}function ce(e){return typeof e!="number"?Fe(e):{top:e,right:e,bottom:e,left:e}}function P(e){let{x:t,y:o,width:n,height:r}=e;return{width:n,height:r,top:o,left:t,right:t+n,bottom:o+r,x:t,y:o}}function ae(e,t,o){let{reference:n,floating:r}=e,l=z(t),i=le(t),s=re(i),c=Y(t),a=l==="y",d=n.x+n.width/2-r.width/2,u=n.y+n.height/2-r.height/2,h=n[s]/2-r[s]/2,f;switch(c){case"top":f={x:d,y:n.y-r.height};break;case"bottom":f={x:d,y:n.y+n.height};break;case"right":f={x:n.x+n.width,y:u};break;case"left":f={x:n.x-r.width,y:u};break;default:f={x:n.x,y:n.y}}switch(ee(t)){case"start":f[i]-=h*(o&&a?-1:1);break;case"end":f[i]+=h*(o&&a?-1:1);break}return f}async function fe(e,t){var o;t===void 0&&(t={});let{x:n,y:r,platform:l,rects:i,elements:s,strategy:c}=e,{boundary:a="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:h=!1,padding:f=0}=j(t,e),m=ce(f),w=s[h?u==="floating"?"reference":"floating":u],g=P(await l.getClippingRect({element:(o=await(l.isElement==null?void 0:l.isElement(w)))==null||o?w:w.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(s.floating)),boundary:a,rootBoundary:d,strategy:c})),x=u==="floating"?{x:n,y:r,width:i.floating.width,height:i.floating.height}:i.reference,y=await(l.getOffsetParent==null?void 0:l.getOffsetParent(s.floating)),b=await(l.isElement==null?void 0:l.isElement(y))?await(l.getScale==null?void 0:l.getScale(y))||{x:1,y:1}:{x:1,y:1},L=P(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:x,offsetParent:y,strategy:c}):x);return{top:(g.top-L.top+m.top)/b.y,bottom:(L.bottom-g.bottom+m.bottom)/b.y,left:(g.left-L.left+m.left)/b.x,right:(L.right-g.right+m.right)/b.x}}var Me=50,de=async(e,t,o)=>{let{placement:n="bottom",strategy:r="absolute",middleware:l=[],platform:i}=o,s=i.detectOverflow?i:{...i,detectOverflow:fe},c=await(i.isRTL==null?void 0:i.isRTL(t)),a=await i.getElementRects({reference:e,floating:t,strategy:r}),{x:d,y:u}=ae(a,n,c),h=n,f=0,m={};for(let p=0;p<l.length;p++){let w=l[p];if(!w)continue;let{name:g,fn:x}=w,{x:y,y:b,data:L,reset:S}=await x({x:d,y:u,initialPlacement:n,placement:h,strategy:r,middlewareData:m,rects:a,platform:s,elements:{reference:e,floating:t}});d=y??d,u=b??u,m[g]={...m[g],...L},S&&f<Me&&(f++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(a=S.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:r}):S.rects),{x:d,y:u}=ae(a,h,c)),p=-1)}return{x:d,y:u,placement:h,strategy:r,middlewareData:m}};var $e=new Set(["left","top"]);async function Ne(e,t){let{placement:o,platform:n,elements:r}=e,l=await(n.isRTL==null?void 0:n.isRTL(r.floating)),i=Y(o),s=ee(o),c=z(o)==="y",a=$e.has(i)?-1:1,d=l&&c?-1:1,u=j(t,e),{mainAxis:h,crossAxis:f,alignmentAxis:m}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&typeof m=="number"&&(f=s==="end"?m*-1:m),c?{x:f*d,y:h*a}:{x:h*a,y:f*d}}var ue=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var o,n;let{x:r,y:l,placement:i,middlewareData:s}=t,c=await Ne(t,e);return i===((o=s.offset)==null?void 0:o.placement)&&(n=s.arrow)!=null&&n.alignmentOffset?{}:{x:r+c.x,y:l+c.y,data:{...c,placement:i}}}}},he=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:o,y:n,placement:r,platform:l}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:c={fn:g=>{let{x,y}=g;return{x,y}}},...a}=j(e,t),d={x:o,y:n},u=await l.detectOverflow(t,a),h=z(Y(r)),f=te(h),m=d[f],p=d[h];if(i){let g=f==="y"?"top":"left",x=f==="y"?"bottom
|