6 lines
11 KiB
JavaScript
6 lines
11 KiB
JavaScript
|
/*
|
||
|
Copyright (C) Federico Zivolo 2017
|
||
|
Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
|
||
|
*/function getStyleComputedProperty(a,b){if(1!==a.nodeType)return[];const c=window.getComputedStyle(a,null);return b?c[b]:c}function getParentNode(a){return'HTML'===a.nodeName?a:a.parentNode||a.host}function getScrollParent(a){if(!a||-1!==['HTML','BODY','#document'].indexOf(a.nodeName))return window.document.body;const{overflow:b,overflowX:c,overflowY:d}=getStyleComputedProperty(a);return /(auto|scroll)/.test(b+d+c)?a:getScrollParent(getParentNode(a))}function getOffsetParent(a){const b=a&&a.offsetParent,c=b&&b.nodeName;return c&&'BODY'!==c&&'HTML'!==c?-1!==['TD','TABLE'].indexOf(b.nodeName)&&'static'===getStyleComputedProperty(b,'position')?getOffsetParent(b):b:window.document.documentElement}function isOffsetContainer(a){const{nodeName:b}=a;return'BODY'!==b&&('HTML'===b||getOffsetParent(a.firstElementChild)===a)}function getRoot(a){return null===a.parentNode?a:getRoot(a.parentNode)}function findCommonOffsetParent(a,b){if(!a||!a.nodeType||!b||!b.nodeType)return window.document.documentElement;const c=a.compareDocumentPosition(b)&Node.DOCUMENT_POSITION_FOLLOWING,d=c?a:b,e=c?b:a,f=document.createRange();f.setStart(d,0),f.setEnd(e,0);const{commonAncestorContainer:g}=f;if(a!==g&&b!==g||d.contains(e))return isOffsetContainer(g)?g:getOffsetParent(g);const h=getRoot(a);return h.host?findCommonOffsetParent(h.host,b):findCommonOffsetParent(a,getRoot(b).host)}function getScroll(a,b='top'){const c='top'===b?'scrollTop':'scrollLeft',d=a.nodeName;if('BODY'===d||'HTML'===d){const a=window.document.documentElement,b=window.document.scrollingElement||a;return b[c]}return a[c]}function includeScroll(a,b,c=!1){const d=getScroll(b,'top'),e=getScroll(b,'left'),f=c?-1:1;return a.top+=d*f,a.bottom+=d*f,a.left+=e*f,a.right+=e*f,a}function getBordersSize(a,b){const c='x'===b?'Left':'Top',d='Left'==c?'Right':'Bottom';return+a[`border${c}Width`].split('px')[0]+ +a[`border${d}Width`].split('px')[0]}let isIE10;var isIE10$1=function(){return void 0==isIE10&&(isIE10=-1!==navigator.appVersion.indexOf('MSIE 10')),isIE10};function getSize(a,b,c,d){return Math.max(b[`offset${a}`],c[`client${a}`],c[`offset${a}`],isIE10$1()?c[`offset${a}`]+d[`margin${'Height'===a?'Top':'Left'}`]+d[`margin${'Height'===a?'Bottom':'Right'}`]:0)}function getWindowSizes(){const a=window.document.body,b=window.document.documentElement,c=isIE10$1()&&window.getComputedStyle(b);return{height:getSize('Height',a,b,c),width:getSize('Width',a,b,c)}}var _extends=Object.assign||function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a};function getClientRect(a){return _extends({},a,{right:a.left+a.width,bottom:a.top+a.height})}function getBoundingClientRect(a){let b={};if(isIE10$1())try{b=a.getBoundingClientRect();const c=getScroll(a,'top'),d=getScroll(a,'left');b.top+=c,b.left+=d,b.bottom+=c,b.right+=d}catch(a){}else b=a.getBoundingClientRect();const c={left:b.left,top:b.top,width:b.right-b.left,height:b.bottom-b.top},d='HTML'===a.nodeName?getWindowSizes():{},e=d.width||a.clientWidth||c.right-c.left,f=d.height||a.clientHeight||c.bottom-c.top;let g=a.offsetWidth-e,h=a.offsetHeight-f;if(g||h){const b=getStyleComputedProperty(a);g-=getBordersSize(b,'x'),h-=getBordersSize(b,'y'),c.width-=g,c.height-=h}return getClientRect(c)}function getOffsetRectRelativeToArbitraryNode(a,b){const c=isIE10$1(),d='HTML'===b.nodeName,e=getBoundingClientRect(a),f=getBoundingClientRect(b),g=getScrollParent(a),h=getStyleComputedProperty(b),i=+h.borderTopWidth.split('px')[0],j=+h.borderLeftWidth.split('px')[0];let k=getClientRect({top:e.top-f.top-i,left:e.left-f.left-j,width:e.width,height:e.height});if(k.marginTop=0,k.marginLeft=0,!c&&d){const a=+h.marginTop.split('px')[0],b=+h.marginLeft.split('px')[0];k.top-=i-a,k.bottom-=i-a,k.left-=j-b,k.right-=j-b,k.marginTop=a,k.marginLeft=b}return(c?b.contains(g):b===g&&'BODY'!==g.nodeName)&&(k=includeScroll(k,b)),k}function getViewportOffsetRectRelativeToArtbitraryNode(a){var b=Math.max;const c=window.document.documentElement,d=getOffsetRectRelativeToArbitraryNode(a,c),e=b(c.clientWid
|
||
|
//# sourceMappingURL=popper-utils.min.js.map
|