2 lines
7.1 KiB
JavaScript
2 lines
7.1 KiB
JavaScript
|
|
import{x as ie,ax as de,z as fe,ej as ue,r as ee,dC as pe}from"./index-CYM97J2V.js";const te=e=>typeof e=="object"&&e!=null&&e.nodeType===1,ne=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",T=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const i=getComputedStyle(e,null);return ne(i.overflowY,t)||ne(i.overflowX,t)||(o=>{const r=(n=>{if(!n.ownerDocument||!n.ownerDocument.defaultView)return null;try{return n.ownerDocument.defaultView.frameElement}catch{return null}})(o);return!!r&&(r.clientHeight<o.scrollHeight||r.clientWidth<o.scrollWidth)})(e)}return!1},L=(e,t,i,o,r,n,l,a)=>n<e&&l>t||n>e&&l<t?0:n<=e&&a<=i||l>=t&&a>=i?n-e-o:l>t&&a<i||n<e&&a>i?l-t+r:0,ge=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},oe=(e,t)=>{var i,o,r,n;if(typeof document>"u")return[];const{scrollMode:l,block:a,inline:c,boundary:k,skipOverflowHiddenElements:ae}=t,ce=typeof k=="function"?k:h=>h!==k;if(!te(e))throw new TypeError("Invalid target");const B=document.scrollingElement||document.documentElement,M=[];let d=e;for(;te(d)&&ce(d);){if(d=ge(d),d===B){M.push(d);break}d!=null&&d===document.body&&T(d)&&!T(document.documentElement)||d!=null&&T(d,ae)&&M.push(d)}const m=(o=(i=window.visualViewport)==null?void 0:i.width)!=null?o:innerWidth,y=(n=(r=window.visualViewport)==null?void 0:r.height)!=null?n:innerHeight,{scrollX:b,scrollY:$}=window,{height:w,width:v,top:x,right:D,bottom:G,left:I}=e.getBoundingClientRect(),{top:J,right:K,bottom:Q,left:U}=(h=>{const s=window.getComputedStyle(h);return{top:parseFloat(s.scrollMarginTop)||0,right:parseFloat(s.scrollMarginRight)||0,bottom:parseFloat(s.scrollMarginBottom)||0,left:parseFloat(s.scrollMarginLeft)||0}})(e);let f=a==="start"||a==="nearest"?x-J:a==="end"?G+Q:x+w/2-J+Q,u=c==="center"?I+v/2-U+K:c==="end"?D+K:I-U;const P=[];for(let h=0;h<M.length;h++){const s=M[h],{height:S,width:j,top:F,right:X,bottom:V,left:O}=s.getBoundingClientRect();if(l==="if-needed"&&x>=0&&I>=0&&G<=y&&D<=m&&(s===B&&!T(s)||x>=F&&G<=V&&I>=O&&D<=X))return P;const W=getComputedStyle(s),_=parseInt(W.borderLeftWidth,10),C=parseInt(W.borderTopWidth,10),R=parseInt(W.borderRightWidth,10),E=parseInt(W.borderBottomWidth,10);let p=0,g=0;const H="offsetWidth"in s?s.offsetWidth-s.clientWidth-_-R:0,N="offsetHeight"in s?s.offsetHeight-s.clientHeight-C-E:0,A="offsetWidth"in s?s.offsetWidth===0?0:j/s.offsetWidth:0,Y="offsetHeight"in s?s.offsetHeight===0?0:S/s.offsetHeight:0;if(B===s)p=a==="start"?f:a==="end"?f-y:a==="nearest"?L($,$+y,y,C,E,$+f,$+f+w,w):f-y/2,g=c==="start"?u:c==="center"?u-m/2:c==="end"?u-m:L(b,b+m,m,_,R,b+u,b+u+v,v),p=Math.max(0,p+$),g=Math.max(0,g+b);else{p=a==="start"?f-F-C:a==="end"?f-V+E+N:a==="nearest"?L(F,V,S,C,E+N,f,f+w,w):f-(F+S/2)+N/2,g=c==="start"?u-O-_:c==="center"?u-(O+j/2)+H/2:c==="end"?u-X+R+H:L(O,X,j,_,R+H,u,u+v,v);const{scrollLeft:Z,scrollTop:z}=s;p=Y===0?0:Math.max(0,Math.min(z+p/Y,s.scrollHeight-S/Y+N)),g=A===0?0:Math.max(0,Math.min(Z+g/A,s.scrollWidth-j/A+H)),f+=z-p,u+=Z-g}P.push({el:s,top:p,left:g})}return P},he=e=>e===!1?{block:"end",inline:"nearest"}:(t=>t===Object(t)&&Object.keys(t).length!==0)(e)?e:{block:"start",inline:"nearest"};function me(e,t){if(!e.isConnected||!(r=>{let n=r;for(;n&&n.parentNode;){if(n.parentNode===document)return!0;n=n.parentNode instanceof ShadowRoot?n.parentNode.host:n.parentNode}return!1})(e))return;const i=(r=>{const n=window.getComputedStyle(r);return{top:parseFloat(n.scrollMarginTop)||0,right:parseFloat(n.scrollMarginRight)||0,bottom:parseFloat(n.scrollMarginBottom)||0,left:parseFloat(n.scrollMarginLeft)||0}})(e);if((r=>typeof r=="object"&&typeof r.behavior=="function")(t))return t.behavior(oe(e,t));const o=typeof t=="boolean"||t==null?void 0:t.behavior;for(const{el:r,top:n,left:l}of oe(e,he(t))){const a=n-i.top+i.bottom,c=l-i.left+i.right;r.scroll({top:a,left:c,behavior:o})}}const ye=e=>{const{componentCls:t}=e;return{[t]:{display:"flex",flexFlow:"row wrap",minWidth:0,"&::before, &::after":{display:"flex"},"&-no-wrap":{flexWrap:"nowrap"},"&-start":{justifyContent:"flex-start"},"&-center":{justifyContent:"center"},"&-end":{justifyContent:
|