WokerTask/public/admin/assets/@floating-ui.34a21088.js

2 lines
10 KiB
JavaScript
Raw Normal View History

2023-12-29 18:51:22 +08:00
const W=Math.min,D=Math.max,F=Math.round,T=t=>({x:t,y:t});function xt(t,e,o){return D(t,W(e,o))}function st(t,e){return typeof t=="function"?t(e):t}function I(t){return t.split("-")[0]}function K(t){return t.split("-")[1]}function yt(t){return t==="x"?"y":"x"}function rt(t){return t==="y"?"height":"width"}function q(t){return["top","bottom"].includes(I(t))?"y":"x"}function ct(t){return yt(q(t))}function bt(t){return{top:0,right:0,bottom:0,left:0,...t}}function Ct(t){return typeof t!="number"?bt(t):{top:t,right:t,bottom:t,left:t}}function lt(t){return{...t,top:t.y,left:t.x,right:t.x+t.width,bottom:t.y+t.height}}function et(t,e,o){let{reference:n,floating:i}=t;const r=q(e),s=ct(e),c=rt(s),l=I(e),f=r==="y",h=n.x+n.width/2-i.width/2,d=n.y+n.height/2-i.height/2,g=n[c]/2-i[c]/2;let u;switch(l){case"top":u={x:h,y:n.y-i.height};break;case"bottom":u={x:h,y:n.y+n.height};break;case"right":u={x:n.x+n.width,y:d};break;case"left":u={x:n.x-i.width,y:d};break;default:u={x:n.x,y:n.y}}switch(K(e)){case"start":u[s]-=g*(o&&f?-1:1);break;case"end":u[s]+=g*(o&&f?-1:1);break}return u}const Tt=async(t,e,o)=>{const{placement:n="bottom",strategy:i="absolute",middleware:r=[],platform:s}=o,c=r.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(e));let f=await s.getElementRects({reference:t,floating:e,strategy:i}),{x:h,y:d}=et(f,n,l),g=n,u={},a=0;for(let m=0;m<c.length;m++){const{name:y,fn:E}=c[m],{x:L,y:O,data:$,reset:b}=await E({x:h,y:d,initialPlacement:n,placement:g,strategy:i,middlewareData:u,rects:f,platform:s,elements:{reference:t,floating:e}});if(h=L!=null?L:h,d=O!=null?O:d,u={...u,[y]:{...u[y],...$}},b&&a<=50){a++,typeof b=="object"&&(b.placement&&(g=b.placement),b.rects&&(f=b.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:i}):b.rects),{x:h,y:d}=et(f,g,l)),m=-1;continue}}return{x:h,y:d,placement:g,strategy:i,middlewareData:u}},$t=t=>({name:"arrow",options:t,async fn(e){const{x:o,y:n,placement:i,rects:r,platform:s,elements:c,middlewareData:l}=e,{element:f,padding:h=0}=st(t,e)||{};if(f==null)return{};const d=Ct(h),g={x:o,y:n},u=ct(i),a=rt(u),m=await s.getDimensions(f),y=u==="y",E=y?"top":"left",L=y?"bottom":"right",O=y?"clientHeight":"clientWidth",$=r.reference[a]+r.reference[u]-g[u]-r.floating[a],b=g[u]-r.reference[u],_=await(s.getOffsetParent==null?void 0:s.getOffsetParent(f));let V=_?_[O]:0;(!V||!await(s.isElement==null?void 0:s.isElement(_)))&&(V=c.floating[O]||r.floating[a]);const wt=$/2-b/2,Q=V/2-m[a]/2-1,U=W(d[E],Q),Z=W(d[L],Q),P=U,tt=V-m[a]-Z,R=V/2-m[a]/2+wt,X=xt(P,R,tt),Y=!l.arrow&&K(i)!=null&&R!=X&&r.reference[a]/2-(R<P?U:Z)-m[a]/2<0,j=Y?R<P?R-P:R-tt:0;return{[u]:g[u]+j,data:{[u]:X,centerOffset:R-X-j,...Y&&{alignmentOffset:j}},reset:Y}}});async function vt(t,e){const{placement:o,platform:n,elements:i}=t,r=await(n.isRTL==null?void 0:n.isRTL(i.floating)),s=I(o),c=K(o),l=q(o)==="y",f=["left","top"].includes(s)?-1:1,h=r&&l?-1:1,d=st(e,t);let{mainAxis:g,crossAxis:u,alignmentAxis:a}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return c&&typeof a=="number"&&(u=c==="end"?a*-1:a),l?{x:u*h,y:g*f}:{x:g*f,y:u*h}}const _t=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var o,n;const{x:i,y:r,placement:s,middlewareData:c}=e,l=await vt(e,t);return s===((o=c.offset)==null?void 0:o.placement)&&(n=c.arrow)!=null&&n.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:s}}}}};function v(t){return ft(t)?(t.nodeName||"").toLowerCase():"#document"}function p(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function A(t){var e;return(e=(ft(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function ft(t){return t instanceof Node||t instanceof p(t).Node}function C(t){return t instanceof Element||t instanceof p(t).Element}function x(t){return t instanceof HTMLElement||t instanceof p(t).HTMLElement}function nt(t){return typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof p(t).ShadowRoot}function B(t){const{overflow:e,overflowX:o,overflowY:n,display:i}=w(t);return/auto|sc