1// @floating-ui/[email protected] downloaded from https://ga.jspm.io/npm:@floating-ui/[email protected]/dist/floating-ui.core.mjs 2 3import{getSideAxis as e,getAlignmentAxis as t,getAxisLength as n,getSide as r,getAlignment as i,evaluate as a,getPaddingObject as o,rectToClientRect as s,min as c,clamp as l,getOppositeAlignmentPlacement as u,placements as d,getAlignmentSides as f,getOppositePlacement as p,getExpandedPlacements as m,getOppositeAxisPlacements as h,sides as g,max as _,getOppositeAxis as v}from"@floating-ui/utils";export{rectToClientRect}from"@floating-ui/utils";function y(a,o,s){let{reference:c,floating:l}=a,u=e(o),d=t(o),f=n(d),p=r(o),m=u===`y`,h=c.x+c.width/2-l.width/2,g=c.y+c.height/2-l.height/2,_=c[f]/2-l[f]/2,v;switch(p){case`top`:v={x:h,y:c.y-l.height};break;case`bottom`:v={x:h,y:c.y+c.height};break;case`right`:v={x:c.x+c.width,y:g};break;case`left`:v={x:c.x-l.width,y:g};break;default:v={x:c.x,y:c.y}}let y=i(o);return y&&(v[d]+=_*(y===`end`?1:-1)*(s&&m?-1:1)),v}async function b(e,t){var n;t===void 0&&(t={});let{x:r,y:i,platform:c,rects:l,elements:u,strategy:d}=e,{boundary:f=`clippingAncestors`,rootBoundary:p=`viewport`,elementContext:m=`floating`,altBoundary:h=!1,padding:g=0}=a(t,e),_=o(g),v=u[h?m===`floating`?`reference`:`floating`:m],y=s(await c.getClippingRect({element:(n=await(c.isElement==null?void 0:c.isElement(v)))==null||n?v:v.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(u.floating)),boundary:f,rootBoundary:p,strategy:d})),b=m===`floating`?{x:r,y:i,width:l.floating.width,height:l.floating.height}:l.reference,x=await(c.getOffsetParent==null?void 0:c.getOffsetParent(u.floating)),S=await(c.isElement==null?void 0:c.isElement(x))&&await(c.getScale==null?void 0:c.getScale(x))||{x:1,y:1},C=s(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:b,offsetParent:x,strategy:d}):b);return{top:(y.top-C.top+_.top)/S.y,bottom:(C.bottom-y.bottom+_.bottom)/S.y,left:(y.left-C.left+_.left)/S.x,right:(C.right-y.right+_.right)/S.x}}const x=50,S=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:b},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=y(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y:b,data:x,reset:S}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v==null?u:v,d=b==null?d:b,m[g]={...m[g],...x},S&&p<50&&(p++,typeof S==`object`&&(S.placement&&(f=S.placement),S.rects&&(l=S.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):S.rects),{x:u,y:d}=y(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},C=e=>({name:`arrow`,options:e,async fn(r){let{x:s,y:u,placement:d,rects:f,platform:p,elements:m,middlewareData:h}=r,{element:g,padding:_=0}=a(e,r)||{};if(g==null)return{};let v=o(_),y={x:s,y:u},b=t(d),x=n(b),S=await p.getDimensions(g),C=b===`y`,w=C?`top`:`left`,T=C?`bottom`:`right`,E=C?`clientHeight`:`clientWidth`,D=f.reference[x]+f.reference[b]-y[b]-f.floating[x],O=y[b]-f.reference[b],k=await(p.getOffsetParent==null?void 0:p.getOffsetParent(g)),A=k?k[E]:0;(!A||!await(p.isElement==null?void 0:p.isElement(k)))&&(A=m.floating[E]||f.floating[x]);let j=D/2-O/2,M=A/2-S[x]/2-1,N=c(v[w],M),P=c(v[T],M),F=A-S[x]-P,I=A/2-S[x]/2+j,L=l(N,I,F),R=!h.arrow&&i(d)!=null&&I!==L&&f.reference[x]/2-(I<N?N:P)-S[x]/2<0,z=R?I<N?I-N:I-F:0;return{[b]:y[b]+z,data:{[b]:L,centerOffset:I-L-z,...R&&{alignmentOffset:z}},reset:R}}});function w(e,t,n){return(e?[...n.filter(t=>i(t)===e),...n.filter(t=>i(t)!==e)]:n.filter(e=>r(e)===e)).filter(n=>e?i(n)===e||(t?u(n)!==n:!1):!0)}const T=function(e){return e===void 0&&(e={}),{name:`autoPlacement`,options:e,async fn(t){var n,o,s;let{rects:c,middlewareData:l,placement:u,platform:p,elements:m}=t,{crossAxis:h=!1,alignment:g,allowedPlacements:_=d,autoAlignment:v=!0,...y}=a(e,t),b=g!==void 0||_===d?w(g||null,v,_):_,x=((n=l.autoPlacement)==null?void 0:n.index)||0,S=b[x];if(S==null)return{};if(u!==S)return{reset:{placement:b[0]}};
3let C=await p.detectOverflow(t,y),T=f(S,c,await(p.isRTL==null?void 0:p.isRTL(m.floating))),E=[C[r(S)],C[T[0]],C[T[1]]],D=[...((o=l.autoPlacement)==null?void 0:o.overflows)||[],{placement:S,overflows:E}],O=b[x+1];if(O)return{data:{index:x+1,overflows:D},reset:{placement:O}};let k=D.map(e=>{let t=i(e.placement);return[e.placement,t&&h?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),A=((s=k.filter(e=>e[2].slice(0,i(e[0])?2:3).every(e=>e<=0))[0])==null?void 0:s[0])||k[0][0];return A===u?{}:{data:{index:x+1,overflows:D},reset:{placement:A}}}}},E=function(t){return t===void 0&&(t={}),{name:`flip`,options:t,async fn(n){var i,o;let{placement:s,middlewareData:c,rects:l,initialPlacement:u,platform:d,elements:g}=n,{mainAxis:_=!0,crossAxis:v=!0,fallbackPlacements:y,fallbackStrategy:b=`bestFit`,fallbackAxisSideDirection:x=`none`,flipAlignment:S=!0,...C}=a(t,n);if((i=c.arrow)!=null&&i.alignmentOffset)return{};let w=r(s),T=e(u),E=r(u)===u,D=await(d.isRTL==null?void 0:d.isRTL(g.floating)),O=y||(E||!S?[p(u)]:m(u)),k=x!==`none`;!y&&k&&O.push(...h(u,S,x,D));let A=[u,...O],j=await d.detectOverflow(n,C),M=[],N=((o=c.flip)==null?void 0:o.overflows)||[];if(_&&M.push(j[w]),v){let e=f(s,l,D);M.push(j[e[0]],j[e[1]])}if(N=[...N,{placement:s,overflows:M}],!M.every(e=>e<=0)){var P,F;let t=(((P=c.flip)==null?void 0:P.index)||0)+1,n=A[t];if(n&&(!(v===`alignment`&&T!==e(n))||N.every(t=>e(t.placement)===T?t.overflows[0]>0:!0)))return{data:{index:t,overflows:N},reset:{placement:n}};let r=(F=N.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])==null?void 0:F.placement;if(!r)switch(b){case`bestFit`:{var I;let t=(I=N.filter(t=>{if(k){let n=e(t.placement);return n===T||n===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])==null?void 0:I[0];t&&(r=t);break}case`initialPlacement`:r=u;break}if(s!==r)return{reset:{placement:r}}}return{}}}};function D(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function O(e){return g.some(t=>e[t]>=0)}const k=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...o}=a(e,t);switch(i){case`referenceHidden`:{let e=D(await r.detectOverflow(t,{...o,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:O(e)}}}case`escaped`:{let e=D(await r.detectOverflow(t,{...o,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:O(e)}}}default:return{}}}}};function A(e){let t=c(...e.map(e=>e.left)),n=c(...e.map(e=>e.top)),r=_(...e.map(e=>e.right)),i=_(...e.map(e=>e.bottom));return{x:t,y:n,width:r-t,height:i-n}}function j(e){let t=e.slice().sort((e,t)=>e.y-t.y),n=[],r=null;for(let e=0;e<t.length;e++){let i=t[e];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(e=>s(A(e)))}const M=function(t){return t===void 0&&(t={}),{name:`inline`,options:t,async fn(n){let{placement:i,elements:l,rects:u,platform:d,strategy:f}=n,{padding:p=2,x:m,y:h}=a(t,n),g=Array.from(await(d.getClientRects==null?void 0:d.getClientRects(l.reference))||[]);if(!g.length)return{};let v=j(g),y=s(A(g)),b=o(p);function x(){if(v.length===2&&(v[0].left>v[1].right||v[1].left>v[0].right)&&m!=null&&h!=null)return v.find(e=>m>e.left-b.left&&m<e.right+b.right&&h>
3e.top-b.top&&h<e.bottom+b.bottom)||y;if(v.length>=2){if(e(i)===`y`){let e=v[0],t=v[v.length-1],n=r(i)===`top`,a=e.top,o=t.bottom,c=n?e.left:t.left;return s({x:c,y:a,width:(n?e.right:t.right)-c,height:o-a})}let t=r(i)===`left`,n=_(...v.map(e=>e.right)),a=c(...v.map(e=>e.left)),o=v.filter(e=>t?e.left===a:e.right===n),l=o[0].top,u=o[o.length-1].bottom;return s({x:a,y:l,width:n-a,height:u-l})}return y}let S=await d.getElementRects({reference:{getBoundingClientRect:x},floating:l.floating,strategy:f});return u.reference.x!==S.reference.x||u.reference.y!==S.reference.y||u.reference.width!==S.reference.width||u.reference.height!==S.reference.height?{reset:{rects:S}}:{}}}},N=/* @__PURE__ */ new Set([`left`,`top`]);async function P(t,n){let{placement:o,platform:s,elements:c}=t,l=await(s.isRTL==null?void 0:s.isRTL(c.floating)),u=r(o),d=i(o),f=e(o)===`y`,p=N.has(u)?-1:1,m=l&&f?-1:1,h=a(n,t),{mainAxis:g,crossAxis:_,alignmentAxis:v}=typeof h==`number`?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return d&&typeof v==`number`&&(_=d===`end`?v*-1:v),f?{x:_*m,y:g*p}:{x:g*p,y:_*m}}const F=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n,r;let{x:i,y:a,placement:o,middlewareData:s}=t,c=await P(t,e);return o===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:a+c.y,data:{...c,placement:o}}}}},I=function(t){return t===void 0&&(t={}),{name:`shift`,options:t,async fn(n){let{x:r,y:i,placement:o,platform:s}=n,{mainAxis:c=!0,crossAxis:u=!1,limiter:d={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...f}=a(t,n),p={x:r,y:i},m=await s.detectOverflow(n,f),h=e(o),g=v(h),_=p[g],y=p[h],b=(e,t)=>l(t+m[e===`y`?`top`:`left`],t,t-m[e===`y`?`bottom`:`right`]);c&&(_=b(g,_)),u&&(y=b(h,y));let x=d.fn({...n,[g]:_,[h]:y});return{...x,data:{x:x.x-r,y:x.y-i,enabled:{[g]:c,[h]:u}}}}}},L=function(t){return t===void 0&&(t={}),{options:t,fn(n){var i,o;let{x:s,y:c,placement:l,rects:u,middlewareData:d}=n,{offset:f=0,mainAxis:p=!0,crossAxis:m=!0}=a(t,n),h={x:s,y:c},g=e(l),_=v(g),y=h[_],b=h[g],x=a(f,n),S=typeof x==`number`?{mainAxis:x,crossAxis:0}:{mainAxis:(i=x.mainAxis)==null?0:i,crossAxis:(o=x.crossAxis)==null?0:o};if(p){let e=_===`y`?`height`:`width`,t=u.reference[_]-u.floating[e]+S.mainAxis,n=u.reference[_]+u.reference[e]-S.mainAxis;y<t?y=t:y>n&&(y=n)}if(m){var C,w;let e=_===`y`?`width`:`height`,t=N.has(r(l)),n=u.reference[g]-u.floating[e]+(t&&((C=d.offset)==null?void 0:C[g])||0)+(t?0:S.crossAxis),i=u.reference[g]+u.reference[e]+(t?0:((w=d.offset)==null?void 0:w[g])||0)-(t?S.crossAxis:0);b<n?b=n:b>i&&(b=i)}return{[_]:y,[g]:b}}}},R=function(t){return t===void 0&&(t={}),{name:`size`,options:t,async fn(n){let{placement:o,rects:s,platform:l,elements:u}=n,{apply:d=()=>{},...f}=a(t,n),p=await l.detectOverflow(n,f),m=r(o),h=i(o),g=e(o)===`y`,{width:v,height:y}=s.floating,b,x;m===`top`||m===`bottom`?(b=m,x=h===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?`start`:`end`)?`left`:`right`):(x=m,b=h===`end`?`top`:`bottom`);let S=y-p.top-p.bottom,C=v-p.left-p.right,w=c(y-p[b],S),T=c(v-p[x],C),E=n.middlewareData.shift,D=!E,O=w,k=T;E!=null&&E.enabled.x&&(k=C),E!=null&&E.enabled.y&&(O=S),D&&!h&&(g?k=v-2*_(p.left,p.right):O=y-2*_(p.top,p.bottom)),await d({...n,availableWidth:k,availableHeight:O});let A=await l.getDimensions(u.floating);return v!==A.width||y!==A.height?{reset:{rects:!0}}:{}}}};export{C as arrow,T as autoPlacement,S as computePosition,b as detectOverflow,E as flip,k as hide,M as inline,L as limitShift,F as offset,I as shift,R as size}; 4
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.