!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.Popper=b()}(this,function(){"use strict";function a(a){var b=!1;return function(){b||(b=!0,Promise.resolve().then(function(){b=!1,a()}))}}function b(a){var b=!1;return function(){b||(b=!0,setTimeout(function(){b=!1,a()},ha))}}function c(a){var b={};return a&&"[object Function]"===b.toString.call(a)}function d(a,b){if(1!==a.nodeType)return[];var c=window.getComputedStyle(a,null);return b?c[b]:c}function e(a){return"HTML"===a.nodeName?a:a.parentNode||a.host}function f(a){if(!a)return window.document.body;switch(a.nodeName){case"HTML":case"BODY":return a.ownerDocument.body;case"#document":return a.body}var b=d(a),c=b.overflow,g=b.overflowX,h=b.overflowY;return/(auto|scroll)/.test(c+h+g)?a:f(e(a))}function g(a){var b=a&&a.offsetParent,c=b&&b.nodeName;return c&&"BODY"!==c&&"HTML"!==c?["TD","TABLE"].indexOf(b.nodeName)!==-1&&"static"===d(b,"position")?g(b):b:a?a.ownerDocument.documentElement:window.document.documentElement}function h(a){var b=a.nodeName;return"BODY"!==b&&("HTML"===b||g(a.firstElementChild)===a)}function i(a){return null!==a.parentNode?i(a.parentNode):a}function j(a,b){if(!(a&&a.nodeType&&b&&b.nodeType))return window.document.documentElement;var 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);var k=f.commonAncestorContainer;if(a!==k&&b!==k||d.contains(e))return h(k)?k:g(k);var l=i(a);return l.host?j(l.host,b):j(a,i(b).host)}function k(a){var b=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top",c="top"===b?"scrollTop":"scrollLeft",d=a.nodeName;if("BODY"===d||"HTML"===d){var e=a.ownerDocument.documentElement,f=a.ownerDocument.scrollingElement||e;return f[c]}return a[c]}function l(a,b){var c=arguments.length>2&&void 0!==arguments[2]&&arguments[2],d=k(b,"top"),e=k(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 m(a,b){var 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]}function n(a,b,c,d){return Math.max(b["offset"+a],b["scroll"+a],c["client"+a],c["offset"+a],c["scroll"+a],ma()?c["offset"+a]+d["margin"+("Height"===a?"Top":"Left")]+d["margin"+("Height"===a?"Bottom":"Right")]:0)}function o(){var a=window.document.body,b=window.document.documentElement,c=ma()&&window.getComputedStyle(b);return{height:n("Height",a,b,c),width:n("Width",a,b,c)}}function p(a){return qa({},a,{right:a.left+a.width,bottom:a.top+a.height})}function q(a){var b={};if(ma())try{b=a.getBoundingClientRect();var c=k(a,"top"),e=k(a,"left");b.top+=c,b.left+=e,b.bottom+=c,b.right+=e}catch(f){}else b=a.getBoundingClientRect();var g={left:b.left,top:b.top,width:b.right-b.left,height:b.bottom-b.top},h="HTML"===a.nodeName?o():{},i=h.width||a.clientWidth||g.right-g.left,j=h.height||a.clientHeight||g.bottom-g.top,l=a.offsetWidth-i,n=a.offsetHeight-j;if(l||n){var q=d(a);l-=m(q,"x"),n-=m(q,"y"),g.width-=l,g.height-=n}return p(g)}function r(a,b){var c=ma(),e="HTML"===b.nodeName,g=q(a),h=q(b),i=f(a),j=d(b),k=+j.borderTopWidth.split("px")[0],m=+j.borderLeftWidth.split("px")[0],n=p({top:g.top-h.top-k,left:g.left-h.left-m,width:g.width,height:g.height});if(n.marginTop=0,n.marginLeft=0,!c&&e){var o=+j.marginTop.split("px")[0],r=+j.marginLeft.split("px")[0];n.top-=k-o,n.bottom-=k-o,n.left-=m-r,n.right-=m-r,n.marginTop=o,n.marginLeft=r}return(c?b.contains(i):b===i&&"BODY"!==i.nodeName)&&(n=l(n,b)),n}function s(a){var b=a.ownerDocument.documentElement,c=r(a,b),d=Math.max(b.clientWidth,window.innerWidth||0),e=Math.max(b.clientHeight,window.innerHeight||0),f=k(b),g=k(b,"left"),h={top:f-c.top+c.marginTop,left:g-c.left+c.marginLeft,width:d,height:e};return p(h)}function t(a){var b=a.nodeName;return"BODY"!==b&&"HTML"!==b&&("fixed"===d(a,"position")||t(e(a)))}function u(a,b,c,d){var g={top:0,left:0},h=j(a,b);if("viewport"===d)g=s(h);else{var i=void 0;"scrollParent"===d?(i=f(e(a)),"BODY"===i.nodeName&&(i=a.ownerDocument.documentElement)):i="window"===d?a.ownerDocument.documentElement:d;var k=r(i,h);if("HTML"!==i.nodeName||t(h))g=k;else{var l=o(),m=l.height,n=l.width;g.top+=k.top-k.marginTop,g.bottom=m+k.top,g.left+=k.left-k.marginLeft,g.right=n+k.left}}return g.left+=c,g.top+=c,g.right-=c,g.bottom-=c,g}function v(a){var b=a.width,c=a.height;return b*c}function w(a,b,c,d,e){var f=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(a.indexOf("auto")===-1)return a;var g=u(c,d,f,e),h={top:{width:g.width,height:b.top-g.top},right:{width:g.right-b.right,height:g.height},bottom:{width:g.width,height:g.bottom-b.bottom},left:{width:b.left-g.left,height:g.height}},i=Object.keys(h).map(function(a){return qa({key:a},h[a],{area:v(h[a])})}).sort(function(a,b){return b.area-a.area}),j=i.filter(function(a){var b=a.width,d=a.height;return b>=c.clientWidth&&d>=c.clientHeight}),k=j.length>0?j[0].key:i[0].key,l=a.split("-")[1];return k+(l?"-"+l:"")}function x(a,b,c){var d=j(b,c);return r(c,d)}function y(a){var b=window.getComputedStyle(a),c=parseFloat(b.marginTop)+parseFloat(b.marginBottom),d=parseFloat(b.marginLeft)+parseFloat(b.marginRight),e={width:a.offsetWidth+d,height:a.offsetHeight+c};return e}function z(a){var b={left:"right",right:"left",bottom:"top",top:"bottom"};return a.replace(/left|right|bottom|top/g,function(a){return b[a]})}function A(a,b,c){c=c.split("-")[0];var d=y(a),e={width:d.width,height:d.height},f=["right","left"].indexOf(c)!==-1,g=f?"top":"left",h=f?"left":"top",i=f?"height":"width",j=f?"width":"height";return e[g]=b[g]+b[i]/2-d[i]/2,c===h?e[h]=b[h]-d[j]:e[h]=b[z(h)],e}function B(a,b){return Array.prototype.find?a.find(b):a.filter(b)[0]}function C(a,b,c){if(Array.prototype.findIndex)return a.findIndex(function(a){return a[b]===c});var d=B(a,function(a){return a[b]===c});return a.indexOf(d)}function D(a,b,d){var e=void 0===d?a:a.slice(0,C(a,"name",d));return e.forEach(function(a){a["function"]&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var d=a["function"]||a.fn;a.enabled&&c(d)&&(b.offsets.popper=p(b.offsets.popper),b.offsets.reference=p(b.offsets.reference),b=d(b,a))}),b}function E(){if(!this.state.isDestroyed){var a={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};a.offsets.reference=x(this.state,this.popper,this.reference),a.placement=w(this.options.placement,a.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),a.originalPlacement=a.placement,a.offsets.popper=A(this.popper,a.offsets.reference,a.placement),a.offsets.popper.position="absolute",a=D(this.modifiers,a),this.state.isCreated?this.options.onUpdate(a):(this.state.isCreated=!0,this.options.onCreate(a))}}function F(a,b){return a.some(function(a){var c=a.name,d=a.enabled;return d&&c===b})}function G(a){for(var b=[!1,"ms","Webkit","Moz","O"],c=a.charAt(0).toUpperCase()+a.slice(1),d=0;dg[n]&&(a.offsets.popper[l]+=h[l]+o-g[n]);var q=h[l]+h[j]/2-o/2,r=d(a.instance.popper,"margin"+k).replace("px",""),s=q-p(a.offsets.popper)[l]-r;return s=Math.max(Math.min(g[j]-o,s),0),a.arrowElement=c,a.offsets.arrow={},a.offsets.arrow[l]=Math.round(s),a.offsets.arrow[m]="",a}function W(a){return"end"===a?"start":"start"===a?"end":a}function X(a){var b=arguments.length>1&&void 0!==arguments[1]&&arguments[1],c=sa.indexOf(a),d=sa.slice(c+1).concat(sa.slice(0,c));return b?d.reverse():d}function Y(a,b){if(F(a.instance.modifiers,"inner"))return a;if(a.flipped&&a.placement===a.originalPlacement)return a;var c=u(a.instance.popper,a.instance.reference,b.padding,b.boundariesElement),d=a.placement.split("-")[0],e=z(d),f=a.placement.split("-")[1]||"",g=[];switch(b.behavior){case ta.FLIP:g=[d,e];break;case ta.CLOCKWISE:g=X(d);break;case ta.COUNTERCLOCKWISE:g=X(d,!0);break;default:g=b.behavior}return g.forEach(function(h,i){if(d!==h||g.length===i+1)return a;d=a.placement.split("-")[0],e=z(d);var j=a.offsets.popper,k=a.offsets.reference,l=Math.floor,m="left"===d&&l(j.right)>l(k.left)||"right"===d&&l(j.left)l(k.top)||"bottom"===d&&l(j.top)l(c.right),p=l(j.top)l(c.bottom),r="left"===d&&n||"right"===d&&o||"top"===d&&p||"bottom"===d&&q,s=["top","bottom"].indexOf(d)!==-1,t=!!b.flipVariations&&(s&&"start"===f&&n||s&&"end"===f&&o||!s&&"start"===f&&p||!s&&"end"===f&&q);(m||r||t)&&(a.flipped=!0,(m||r)&&(d=g[i+1]),t&&(f=W(f)),a.placement=d+(f?"-"+f:""),a.offsets.popper=qa({},a.offsets.popper,A(a.instance.popper,a.offsets.reference,a.placement)),a=D(a.instance.modifiers,a,"flip"))}),a}function Z(a){var b=a.offsets,c=b.popper,d=b.reference,e=a.placement.split("-")[0],f=Math.floor,g=["top","bottom"].indexOf(e)!==-1,h=g?"right":"bottom",i=g?"left":"top",j=g?"width":"height";return c[h]f(d[h])&&(a.offsets.popper[i]=f(d[h])),a}function $(a,b,c,d){var e=a.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),f=+e[1],g=e[2];if(!f)return a;if(0===g.indexOf("%")){var h=void 0;switch(g){case"%p":h=c;break;case"%":case"%r":default:h=d}var i=p(h);return i[b]/100*f}if("vh"===g||"vw"===g){var j=void 0;return j="vh"===g?Math.max(document.documentElement.clientHeight,window.innerHeight||0):Math.max(document.documentElement.clientWidth,window.innerWidth||0),j/100*f}return f}function _(a,b,c,d){var e=[0,0],f=["right","left"].indexOf(d)!==-1,g=a.split(/(\+|\-)/).map(function(a){return a.trim()}),h=g.indexOf(B(g,function(a){return a.search(/,|\s/)!==-1}));g[h]&&g[h].indexOf(",")===-1&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var i=/\s*,\s*|\s+/,j=h!==-1?[g.slice(0,h).concat([g[h].split(i)[0]]),[g[h].split(i)[1]].concat(g.slice(h+1))]:[g];return j=j.map(function(a,d){var e=(1===d?!f:f)?"height":"width",g=!1;return a.reduce(function(a,b){return""===a[a.length-1]&&["+","-"].indexOf(b)!==-1?(a[a.length-1]=b,g=!0,a):g?(a[a.length-1]+=b,g=!1,a):a.concat(b)},[]).map(function(a){return $(a,e,b,c)})}),j.forEach(function(a,b){a.forEach(function(c,d){O(c)&&(e[b]+=c*("-"===a[d-1]?-1:1))})}),e}function aa(a,b){var c=b.offset,d=a.placement,e=a.offsets,f=e.popper,g=e.reference,h=d.split("-")[0],i=void 0;return i=O(+c)?[+c,0]:_(c,f,g,h),"left"===h?(f.top+=i[0],f.left-=i[1]):"right"===h?(f.top+=i[0],f.left+=i[1]):"top"===h?(f.left+=i[0],f.top-=i[1]):"bottom"===h&&(f.left+=i[0],f.top+=i[1]),a.popper=f,a}function ba(a,b){var c=b.boundariesElement||g(a.instance.popper);a.instance.reference===c&&(c=g(c));var d=u(a.instance.popper,a.instance.reference,b.padding,c);b.boundaries=d;var e=b.priority,f=a.offsets.popper,h={primary:function(a){var c=f[a];return f[a]d[a]&&!b.escapeWithReference&&(e=Math.min(f[c],d[a]-("right"===a?f.width:f.height))),pa({},c,e)}};return e.forEach(function(a){var b=["left","top"].indexOf(a)!==-1?"primary":"secondary";f=qa({},f,h[b](a))}),a.offsets.popper=f,a}function ca(a){var b=a.placement,c=b.split("-")[0],d=b.split("-")[1];if(d){var e=a.offsets,f=e.reference,g=e.popper,h=["bottom","top"].indexOf(c)!==-1,i=h?"left":"top",j=h?"width":"height",k={start:pa({},i,f[i]),end:pa({},i,f[i]+f[j]-g[j])};a.offsets.popper=qa({},g,k[d])}return a}function da(a){if(!U(a.instance.modifiers,"hide","preventOverflow"))return a;var b=a.offsets.reference,c=B(a.instance.modifiers,function(a){return"preventOverflow"===a.name}).boundaries;if(b.bottomc.right||b.top>c.bottom||b.right=0){ha=1;break}var ja=fa&&window.Promise,ka=ja?a:b,la=void 0,ma=function(){return void 0===la&&(la=navigator.appVersion.indexOf("MSIE 10")!==-1),la},na=function(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")},oa=function(){function a(a,b){for(var c=0;c2&&void 0!==arguments[2]?arguments[2]:{};na(this,a),this.scheduleUpdate=function(){return requestAnimationFrame(e.update)},this.update=ka(this.update.bind(this)),this.options=qa({},a.Defaults,f),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=b&&b.jquery?b[0]:b,this.popper=d&&d.jquery?d[0]:d,this.options.modifiers={},Object.keys(qa({},a.Defaults.modifiers,f.modifiers)).forEach(function(b){e.options.modifiers[b]=qa({},a.Defaults.modifiers[b]||{},f.modifiers?f.modifiers[b]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(a){return qa({name:a},e.options.modifiers[a])}).sort(function(a,b){return a.order-b.order}),this.modifiers.forEach(function(a){a.enabled&&c(a.onLoad)&&a.onLoad(e.reference,e.popper,e.options,a,e.state)}),this.update();var g=this.options.eventsEnabled;g&&this.enableEventListeners(),this.state.eventsEnabled=g}return oa(a,[{key:"update",value:function(){return E.call(this)}},{key:"destroy",value:function(){return H.call(this)}},{key:"enableEventListeners",value:function(){return L.call(this)}},{key:"disableEventListeners",value:function(){return N.call(this)}}]),a}();return wa.Utils=("undefined"!=typeof window?window:global).PopperUtils,wa.placements=ra,wa.Defaults=va,wa});