Build 533169stable
Module 764647
8,936 characters · in no known chunkDependencies
Source Raw
function(e,t,n){"use strict";n.d(t,{BN:()=>E,ER:()=>g,Ej:()=>A,RK:()=>l,UU:()=>u,cY:()=>m,jD:()=>_,rD:()=>s});var r=n(56027);function i(e,t,n){let i,{reference:s,floating:a}=e,o=(0,r.TV)(t),l=(0,r.Dz)(t),u=(0,r.sq)(l),c=(0,r.C0)(t),d="y"===o,_=s.x+s.width/2-a.width/2,f=s.y+s.height/2-a.height/2,p=s[u]/2-a[u]/2;switch(c){case"top":i={x:_,y:s.y-a.height};break;case"bottom":i={x:_,y:s.y+s.height};break;case"right":i={x:s.x+s.width,y:f};break;case"left":i={x:s.x-a.width,y:f};break;default:i={x:s.x,y:s.y}}switch((0,r.Sg)(t)){case"start":i[l]-=p*(n&&d?-1:1);break;case"end":i[l]+=p*(n&&d?-1:1)}return i}let s=async(e,t,n)=>{let{placement:r="bottom",strategy:s="absolute",middleware:a=[],platform:o}=n,l=a.filter(Boolean),u=await (null==o.isRTL?void 0:o.isRTL(t)),c=await o.getElementRects({reference:e,floating:t,strategy:s}),{x:d,y:_}=i(c,r,u),f=r,p={},h=0;for(let n=0;n<l.length;n++){let{name:a,fn:m}=l[n],{x:E,y:g,data:A,reset:I}=await m({x:d,y:_,initialPlacement:r,placement:f,strategy:s,middlewareData:p,rects:c,platform:o,elements:{reference:e,floating:t}});d=null!=E?E:d,_=null!=g?g:_,p={...p,[a]:{...p[a],...A}},I&&h<=50&&(h++,"object"==typeof I&&(I.placement&&(f=I.placement),I.rects&&(c=!0===I.rects?await o.getElementRects({reference:e,floating:t,strategy:s}):I.rects),{x:d,y:_}=i(c,f,u)),n=-1)}return{x:d,y:_,placement:f,strategy:s,middlewareData:p}};async function a(e,t){var n;void 0===t&&(t={});let{x:i,y:s,platform:a,rects:o,elements:l,strategy:u}=e,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:_="floating",altBoundary:f=!1,padding:p=0}=(0,r._3)(t,e),h=(0,r.nI)(p),m="floating"===_?"reference":"floating",E=l[f?m:_],g=(0,r.B1)(await a.getClippingRect({element:null==(n=await (null==a.isElement?void 0:a.isElement(E)))||n?E:E.contextElement||await (null==a.getDocumentElement?void 0:a.getDocumentElement(l.floating)),boundary:c,rootBoundary:d,strategy:u})),A="floating"===_?{x:i,y:s,width:o.floating.width,height:o.floating.height}:o.reference,I=await (null==a.getOffsetParent?void 0:a.getOffsetParent(l.floating)),T=await (null==a.isElement?void 0:a.isElement(I))&&await (null==a.getScale?void 0:a.getScale(I))||{x:1,y:1},S=(0,r.B1)(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:A,offsetParent:I,strategy:u}):A);return{top:(g.top-S.top+h.top)/T.y,bottom:(S.bottom-g.bottom+h.bottom)/T.y,left:(g.left-S.left+h.left)/T.x,right:(S.right-g.right+h.right)/T.x}}function o(e,t,n){return(e?[...n.filter(t=>(0,r.Sg)(t)===e),...n.filter(t=>(0,r.Sg)(t)!==e)]:n.filter(e=>(0,r.C0)(e)===e)).filter(n=>!e||(0,r.Sg)(n)===e||!!t&&(0,r.aD)(n)!==n)}let l=function(e){return void 0===e&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,i,s;let{rects:l,middlewareData:u,placement:c,platform:d,elements:_}=t,{crossAxis:f=!1,alignment:p,allowedPlacements:h=r.DD,autoAlignment:m=!0,...E}=(0,r._3)(e,t),g=void 0!==p||h===r.DD?o(p||null,m,h):h,A=await a(t,E),I=(null==(n=u.autoPlacement)?void 0:n.index)||0,T=g[I];if(null==T)return{};let S=(0,r.w7)(T,l,await (null==d.isRTL?void 0:d.isRTL(_.floating)));if(c!==T)return{reset:{placement:g[0]}};let y=[A[(0,r.C0)(T)],A[S[0]],A[S[1]]],v=[...(null==(i=u.autoPlacement)?void 0:i.overflows)||[],{placement:T,overflows:y}],N=g[I+1];if(N)return{data:{index:I+1,overflows:v},reset:{placement:N}};let C=v.map(e=>{let t=(0,r.Sg)(e.placement);return[e.placement,t&&f?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),R=(null==(s=C.filter(e=>e[2].slice(0,(0,r.Sg)(e[0])?2:3).every(e=>e<=0))[0])?void 0:s[0])||C[0][0];return R!==c?{data:{index:I+1,overflows:v},reset:{placement:R}}:{}}}},u=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,i,s,o,l;let{placement:u,middlewareData:c,rects:d,initialPlacement:_,platform:f,elements:p}=t,{mainAxis:h=!0,crossAxis:m=!0,fallbackPlacements:E,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:A="none",flipAlignment:I=!0,...T}=(0,r._3)(e,t);if(null!=(n=c.arrow)&&n.alignmentOffset)return{};let S=(0,r.C0)(u),y=(0,r.TV)(_),v=(0,r.C0)(_)===_,N=await (null==f.isRTL?void 0:f.isRTL(p.floating)),C=E||(v||!I?[(0,r.bV)(_)]:(0,r.WJ)(_)),R="none"!==A;!E&&R&&C.push(...(0,r.lP)(_,I,A,N));let O=[_,...C],b=await a(t,T),D=[],L=(null==(i=c.flip)?void 0:i.overflows)||[];if(h&&D.push(b[S]),m){let e=(0,r.w7)(u,d,N);D.push(b[e[0]],b[e[1]])}if(L=[...L,{placement:u,overflows:D}],!D.every(e=>e<=0)){let e=((null==(s=c.flip)?void 0:s.index)||0)+1,t=O[e];if(t&&("alignment"!==m||y===(0,r.TV)(t)||L.every(e=>(0,r.TV)(e.placement)!==y||e.overflows[0]>0)))return{data:{index:e,overflows:L},reset:{placement:t}};let n=null==(o=L.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:o.placement;if(!n)switch(g){case"bestFit":{let e=null==(l=L.filter(e=>{if(R){let t=(0,r.TV)(e.placement);return t===y||"y"===t}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])?void 0:l[0];e&&(n=e);break}case"initialPlacement":n=_}if(u!==n)return{reset:{placement:n}}}return{}}}};function c(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function d(e){return r.r_.some(t=>e[t]>=0)}let _=function(e){return void 0===e&&(e={}),{name:"hide",options:e,async fn(t){let{rects:n}=t,{strategy:i="referenceHidden",...s}=(0,r._3)(e,t);switch(i){case"referenceHidden":{let e=c(await a(t,{...s,elementContext:"reference"}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:d(e)}}}case"escaped":{let e=c(await a(t,{...s,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:d(e)}}}default:return{}}}}};function f(e){let t=min(...e.map(e=>e.left)),n=min(...e.map(e=>e.top));return{x:t,y:n,width:max(...e.map(e=>e.right))-t,height:max(...e.map(e=>e.bottom))-n}}let p=new Set(["left","top"]);async function h(e,t){let{placement:n,platform:i,elements:s}=e,a=await (null==i.isRTL?void 0:i.isRTL(s.floating)),o=(0,r.C0)(n),l=(0,r.Sg)(n),u="y"===(0,r.TV)(n),c=p.has(o)?-1:1,d=a&&u?-1:1,_=(0,r._3)(t,e),{mainAxis:f,crossAxis:h,alignmentAxis:m}="number"==typeof _?{mainAxis:_,crossAxis:0,alignmentAxis:null}:{mainAxis:_.mainAxis||0,crossAxis:_.crossAxis||0,alignmentAxis:_.alignmentAxis};return l&&"number"==typeof m&&(h="end"===l?-1*m:m),u?{x:h*d,y:f*c}:{x:f*c,y:h*d}}let m=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,r;let{x:i,y:s,placement:a,middlewareData:o}=t,l=await h(t,e);return a===(null==(n=o.offset)?void 0:n.placement)&&null!=(r=o.arrow)&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:a}}}}},E=function(e){return void 0===e&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:i,placement:s}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:u={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=(0,r._3)(e,t),d={x:n,y:i},_=await a(t,c),f=(0,r.TV)((0,r.C0)(s)),p=(0,r.PG)(f),h=d[p],m=d[f];if(o){let e="y"===p?"top":"left",t="y"===p?"bottom":"right",n=h+_[e],i=h-_[t];h=(0,r.qE)(n,h,i)}if(l){let e="y"===f?"top":"left",t="y"===f?"bottom":"right",n=m+_[e],i=m-_[t];m=(0,r.qE)(n,m,i)}let E=u.fn({...t,[p]:h,[f]:m});return{...E,data:{x:E.x-n,y:E.y-i,enabled:{[p]:o,[f]:l}}}}}},g=function(e){return void 0===e&&(e={}),{options:e,fn(t){let{x:n,y:i,placement:s,rects:a,middlewareData:o}=t,{offset:l=0,mainAxis:u=!0,crossAxis:c=!0}=(0,r._3)(e,t),d={x:n,y:i},_=(0,r.TV)(s),f=(0,r.PG)(_),h=d[f],m=d[_],E=(0,r._3)(l,t),g="number"==typeof E?{mainAxis:E,crossAxis:0}:{mainAxis:0,crossAxis:0,...E};if(u){let e="y"===f?"height":"width",t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;h<t?h=t:h>n&&(h=n)}if(c){var A,I;let e="y"===f?"width":"height",t=p.has((0,r.C0)(s)),n=a.reference[_]-a.floating[e]+(t&&(null==(A=o.offset)?void 0:A[_])||0)+(t?0:g.crossAxis),i=a.reference[_]+a.reference[e]+(t?0:(null==(I=o.offset)?void 0:I[_])||0)-(t?g.crossAxis:0);m<n?m=n:m>i&&(m=i)}return{[f]:h,[_]:m}}}},A=function(e){return void 0===e&&(e={}),{name:"size",options:e,async fn(t){var n,i;let s,o,{placement:l,rects:u,platform:c,elements:d}=t,{apply:_=()=>{},...f}=(0,r._3)(e,t),p=await a(t,f),h=(0,r.C0)(l),m=(0,r.Sg)(l),E="y"===(0,r.TV)(l),{width:g,height:A}=u.floating;"top"===h||"bottom"===h?(s=h,o=m===(await (null==c.isRTL?void 0:c.isRTL(d.floating))?"start":"end")?"left":"right"):(o=h,s="end"===m?"top":"bottom");let I=A-p.top-p.bottom,T=g-p.left-p.right,S=(0,r.jk)(A-p[s],I),y=(0,r.jk)(g-p[o],T),v=!t.middlewareData.shift,N=S,C=y;if(null!=(n=t.middlewareData.shift)&&n.enabled.x&&(C=T),null!=(i=t.middlewareData.shift)&&i.enabled.y&&(N=I),v&&!m){let e=(0,r.T9)(p.left,0),t=(0,r.T9)(p.right,0),n=(0,r.T9)(p.top,0),i=(0,r.T9)(p.bottom,0);E?C=g-2*(0!==e||0!==t?e+t:(0,r.T9)(p.left,p.right)):N=A-2*(0!==n||0!==i?n+i:(0,r.T9)(p.top,p.bottom))}await _({...t,availableWidth:C,availableHeight:N});let R=await c.getDimensions(d.floating);return g!==R.width||A!==R.height?{reset:{rects:!0}}:{}}}}}