!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.Popper=t()}(this,function(){"use strict";function e(e){return e&&"[object Function]"==={}.toString.call(e)}function t(e,t){if(1!==e.nodeType)return[];var n=window.getComputedStyle(e,null);return t?n[t]:n}function n(e){return"HTML"===e.nodeName?e:e.parentNode||e.host}function o(e){if(!e||-1!==["HTML","BODY","#document"].indexOf(e.nodeName))return window.document.body;var r=t(e),i=r.overflow,f=r.overflowX,a=r.overflowY;return/(auto|scroll)/.test(i+a+f)?e:o(n(e))}function r(e){var n=e&&e.offsetParent,o=n&&n.nodeName;return o&&"BODY"!==o&&"HTML"!==o?-1!==["TD","TABLE"].indexOf(n.nodeName)&&"static"===t(n,"position")?r(n):n:window.document.documentElement}function i(e){return null!==e.parentNode?i(e.parentNode):e}function f(e,t){if(!(e&&e.nodeType&&t&&t.nodeType))return window.document.documentElement;var n=e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING,o=n?e:t,a=n?t:e,s=document.createRange();s.setStart(o,0),s.setEnd(a,0);var p=s.commonAncestorContainer;if(e!==p&&t!==p||o.contains(a))return function(e){var t=e.nodeName;return"BODY"!==t&&("HTML"===t||r(e.firstElementChild)===e)}(p)?p:r(p);var l=i(e);return l.host?f(l.host,t):f(e,i(t).host)}function a(e){var t="top"===(arguments.length>1&&void 0!==arguments[1]?arguments[1]:"top")?"scrollTop":"scrollLeft",n=e.nodeName;if("BODY"===n||"HTML"===n){var o=window.document.documentElement;return(window.document.scrollingElement||o)[t]}return e[t]}function s(e,t){var n="x"===t?"Left":"Top",o="Left"===n?"Right":"Bottom";return+e["border"+n+"Width"].split("px")[0]+ +e["border"+o+"Width"].split("px")[0]}function p(e,t,n,o){return Math.max(t["offset"+e],t["scroll"+e],n["client"+e],n["offset"+e],n["scroll"+e],U()?n["offset"+e]+o["margin"+("Height"===e?"Top":"Left")]+o["margin"+("Height"===e?"Bottom":"Right")]:0)}function l(){var e=window.document.body,t=window.document.documentElement,n=U()&&window.getComputedStyle(t);return{height:p("Height",e,t,n),width:p("Width",e,t,n)}}function d(e){return z({},e,{right:e.left+e.width,bottom:e.top+e.height})}function u(e){var n={};if(U())try{n=e.getBoundingClientRect();var o=a(e,"top"),r=a(e,"left");n.top+=o,n.left+=r,n.bottom+=o,n.right+=r}catch(e){}else n=e.getBoundingClientRect();var i={left:n.left,top:n.top,width:n.right-n.left,height:n.bottom-n.top},f="HTML"===e.nodeName?l():{},p=f.width||e.clientWidth||i.right-i.left,u=f.height||e.clientHeight||i.bottom-i.top,c=e.offsetWidth-p,h=e.offsetHeight-u;if(c||h){var m=t(e);c-=s(m,"x"),h-=s(m,"y"),i.width-=c,i.height-=h}return d(i)}function c(e,n){var r=U(),i="HTML"===n.nodeName,f=u(e),s=u(n),p=o(e),l=t(n),c=+l.borderTopWidth.split("px")[0],h=+l.borderLeftWidth.split("px")[0],m=d({top:f.top-s.top-c,left:f.left-s.left-h,width:f.width,height:f.height});if(m.marginTop=0,m.marginLeft=0,!r&&i){var g=+l.marginTop.split("px")[0],v=+l.marginLeft.split("px")[0];m.top-=c-g,m.bottom-=c-g,m.left-=h-v,m.right-=h-v,m.marginTop=g,m.marginLeft=v}return(r?n.contains(p):n===p&&"BODY"!==p.nodeName)&&(m=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=a(t,"top"),r=a(t,"left"),i=n?-1:1;return e.top+=o*i,e.bottom+=o*i,e.left+=r*i,e.right+=r*i,e}(m,n)),m}function h(e){var o=e.nodeName;return"BODY"!==o&&"HTML"!==o&&("fixed"===t(e,"position")||h(n(e)))}function m(e,t,r,i){var s={top:0,left:0},p=f(e,t);if("viewport"===i)s=function(e){var t=window.document.documentElement,n=c(e,t),o=Math.max(t.clientWidth,window.innerWidth||0),r=Math.max(t.clientHeight,window.innerHeight||0),i=a(t),f=a(t,"left");return d({top:i-n.top+n.marginTop,left:f-n.left+n.marginLeft,width:o,height:r})}(p);else{var u=void 0;"scrollParent"===i?"BODY"===(u=o(n(e))).nodeName&&(u=window.document.documentElement):u="window"===i?window.document.documentElement:i;var m=c(u,p);if("HTML"!==u.nodeName||h(p))s=m;else{var g=l(),v=g.height,b=g.width;s.top+=m.top-m.marginTop,s.bottom=v+m.top,s.left+=m.left-m.marginLeft,s.right=b+m.left}}return s.left+=r,s.top+=r,s.right-=r,s.bottom-=r,s}function g(e,t,n,o,r){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;if(-1===e.indexOf("auto"))return e;var f=m(n,o,i,r),a={top:{width:f.width,height:t.top-f.top},right:{width:f.right-t.right,height:f.height},bottom:{width:f.width,height:f.bottom-t.bottom},left:{width:t.left-f.left,height:f.height}},s=Object.keys(a).map(function(e){return z({key:e},a[e],{area:function(e){return e.width*e.height}(a[e])})}).sort(function(e,t){return t.area-e.area}),p=s.filter(function(e){var t=e.width,o=e.height;return t>=n.clientWidth&&o>=n.clientHeight}),l=p.length>0?p[0].key:s[0].key,d=e.split("-")[1];return l+(d?"-"+d:"")}function v(e,t,n){return c(n,f(t,n))}function b(e){var t=window.getComputedStyle(e),n=parseFloat(t.marginTop)+parseFloat(t.marginBottom),o=parseFloat(t.marginLeft)+parseFloat(t.marginRight);return{width:e.offsetWidth+o,height:e.offsetHeight+n}}function w(e){var t={left:"right",right:"left",bottom:"top",top:"bottom"};return e.replace(/left|right|bottom|top/g,function(e){return t[e]})}function y(e,t,n){n=n.split("-")[0];var o=b(e),r={width:o.width,height:o.height},i=-1!==["right","left"].indexOf(n),f=i?"top":"left",a=i?"left":"top",s=i?"height":"width",p=i?"width":"height";return r[f]=t[f]+t[s]/2-o[s]/2,r[a]=n===a?t[a]-o[p]:t[w(a)],r}function O(e,t){return Array.prototype.find?e.find(t):e.filter(t)[0]}function E(t,n,o){return(void 0===o?t:t.slice(0,function(e,t,n){if(Array.prototype.findIndex)return e.findIndex(function(e){return e[t]===n});var o=O(e,function(e){return e[t]===n});return e.indexOf(o)}(t,"name",o))).forEach(function(t){t.function&&console.warn("`modifier.function` is deprecated, use `modifier.fn`!");var o=t.function||t.fn;t.enabled&&e(o)&&(n.offsets.popper=d(n.offsets.popper),n.offsets.reference=d(n.offsets.reference),n=o(n,t))}),n}function x(e,t){return e.some(function(e){var n=e.name;return e.enabled&&n===t})}function L(e){for(var t=[!1,"ms","Webkit","Moz","O"],n=e.charAt(0).toUpperCase()+e.slice(1),o=0;o1&&void 0!==arguments[1]&&arguments[1],n=V.indexOf(e),o=V.slice(n+1).concat(V.slice(0,n));return t?o.reverse():o}function B(e,t,n,o){var r=[0,0],i=-1!==["right","left"].indexOf(o),f=e.split(/(\+|\-)/).map(function(e){return e.trim()}),a=f.indexOf(O(f,function(e){return-1!==e.search(/,|\s/)}));f[a]&&-1===f[a].indexOf(",")&&console.warn("Offsets separated by white space(s) are deprecated, use a comma (,) instead.");var s=/\s*,\s*|\s+/,p=-1!==a?[f.slice(0,a).concat([f[a].split(s)[0]]),[f[a].split(s)[1]].concat(f.slice(a+1))]:[f];return(p=p.map(function(e,o){var r=(1===o?!i:i)?"height":"width",f=!1;return e.reduce(function(e,t){return""===e[e.length-1]&&-1!==["+","-"].indexOf(t)?(e[e.length-1]=t,f=!0,e):f?(e[e.length-1]+=t,f=!1,e):e.concat(t)},[]).map(function(e){return function(e,t,n,o){var r=e.match(/((?:\-|\+)?\d*\.?\d*)(.*)/),i=+r[1],f=r[2];if(!i)return e;if(0===f.indexOf("%")){var a=void 0;switch(f){case"%p":a=n;break;case"%":case"%r":default:a=o}return d(a)[t]/100*i}if("vh"===f||"vw"===f)return("vh"===f?Math.max(document.documentElement.clientHeight,window.innerHeight||0):Math.max(document.documentElement.clientWidth,window.innerWidth||0))/100*i;return i}(e,r,t,n)})})).forEach(function(e,t){e.forEach(function(n,o){N(n)&&(r[t]+=n*("-"===e[o-1]?-1:1))})}),r}for(var D=["native code","[object MutationObserverConstructor]"],H="undefined"!=typeof window,P=["Edge","Trident","Firefox"],j=0,I=0;I=0){j=1;break}var F=H&&function(e){return D.some(function(t){return(e||"").toString().indexOf(t)>-1})}(window.MutationObserver)?function(e){var t=!1,n=0,o=document.createElement("span");return new MutationObserver(function(){e(),t=!1}).observe(o,{attributes:!0}),function(){t||(t=!0,o.setAttribute("x-index",n),n+=1)}}:function(e){var t=!1;return function(){t||(t=!0,setTimeout(function(){t=!1,e()},j))}},R=void 0,U=function(){return void 0===R&&(R=-1!==navigator.appVersion.indexOf("MSIE 10")),R},Y=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},q=function(){function e(e,t){for(var n=0;no[e]&&!t.escapeWithReference&&(r=Math.min(f[n],o[e]-("right"===e?f.width:f.height))),K({},n,r)}};return i.forEach(function(e){var t=-1!==["left","top"].indexOf(e)?"primary":"secondary";f=z({},f,a[t](e))}),e.offsets.popper=f,e},priority:["left","right","top","bottom"],padding:5,boundariesElement:"scrollParent"},keepTogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,n=t.popper,o=t.reference,r=e.placement.split("-")[0],i=Math.floor,f=-1!==["top","bottom"].indexOf(r),a=f?"right":"bottom",s=f?"left":"top",p=f?"width":"height";return n[a]i(o[a])&&(e.offsets.popper[s]=i(o[a])),e}},arrow:{order:500,enabled:!0,fn:function(e,n){if(!W(e.instance.modifiers,"arrow","keepTogether"))return e;var o=n.element;if("string"==typeof o){if(!(o=e.instance.popper.querySelector(o)))return e}else if(!e.instance.popper.contains(o))return console.warn("WARNING: `arrow.element` must be child of its popper element!"),e;var r=e.placement.split("-")[0],i=e.offsets,f=i.popper,a=i.reference,s=-1!==["left","right"].indexOf(r),p=s?"height":"width",l=s?"Top":"Left",u=l.toLowerCase(),c=s?"left":"top",h=s?"bottom":"right",m=b(o)[p];a[h]-mf[h]&&(e.offsets.popper[u]+=a[u]+m-f[h]);var g=a[u]+a[p]/2-m/2,v=t(e.instance.popper,"margin"+l).replace("px",""),w=g-d(e.offsets.popper)[u]-v;return w=Math.max(Math.min(f[p]-m,w),0),e.arrowElement=o,e.offsets.arrow={},e.offsets.arrow[u]=Math.round(w),e.offsets.arrow[c]="",e},element:"[x-arrow]"},flip:{order:600,enabled:!0,fn:function(e,t){if(x(e.instance.modifiers,"inner"))return e;if(e.flipped&&e.placement===e.originalPlacement)return e;var n=m(e.instance.popper,e.instance.reference,t.padding,t.boundariesElement),o=e.placement.split("-")[0],r=w(o),i=e.placement.split("-")[1]||"",f=[];switch(t.behavior){case _.FLIP:f=[o,r];break;case _.CLOCKWISE:f=A(o);break;case _.COUNTERCLOCKWISE:f=A(o,!0);break;default:f=t.behavior}return f.forEach(function(a,s){if(o!==a||f.length===s+1)return e;o=e.placement.split("-")[0],r=w(o);var p=e.offsets.popper,l=e.offsets.reference,d=Math.floor,u="left"===o&&d(p.right)>d(l.left)||"right"===o&&d(p.left)d(l.top)||"bottom"===o&&d(p.top)d(n.right),m=d(p.top)d(n.bottom),v="left"===o&&c||"right"===o&&h||"top"===o&&m||"bottom"===o&&g,b=-1!==["top","bottom"].indexOf(o),O=!!t.flipVariations&&(b&&"start"===i&&c||b&&"end"===i&&h||!b&&"start"===i&&m||!b&&"end"===i&&g);(u||v||O)&&(e.flipped=!0,(u||v)&&(o=f[s+1]),O&&(i=function(e){return"end"===e?"start":"start"===e?"end":e}(i)),e.placement=o+(i?"-"+i:""),e.offsets.popper=z({},e.offsets.popper,y(e.instance.popper,e.offsets.reference,e.placement)),e=E(e.instance.modifiers,e,"flip"))}),e},behavior:"flip",padding:5,boundariesElement:"viewport"},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,n=t.split("-")[0],o=e.offsets,r=o.popper,i=o.reference,f=-1!==["left","right"].indexOf(n),a=-1===["top","left"].indexOf(n);return r[f?"left":"top"]=i[n]-(a?r[f?"width":"height"]:0),e.placement=w(t),e.offsets.popper=d(r),e}},hide:{order:800,enabled:!0,fn:function(e){if(!W(e.instance.modifiers,"hide","preventOverflow"))return e;var t=e.offsets.reference,n=O(e.instance.modifiers,function(e){return"preventOverflow"===e.name}).boundaries;if(t.bottomn.right||t.top>n.bottom||t.right2&&void 0!==arguments[2]?arguments[2]:{};Y(this,t),this.scheduleUpdate=function(){return requestAnimationFrame(r.update)},this.update=F(this.update.bind(this)),this.options=z({},t.Defaults,i),this.state={isDestroyed:!1,isCreated:!1,scrollParents:[]},this.reference=n.jquery?n[0]:n,this.popper=o.jquery?o[0]:o,this.options.modifiers={},Object.keys(z({},t.Defaults.modifiers,i.modifiers)).forEach(function(e){r.options.modifiers[e]=z({},t.Defaults.modifiers[e]||{},i.modifiers?i.modifiers[e]:{})}),this.modifiers=Object.keys(this.options.modifiers).map(function(e){return z({name:e},r.options.modifiers[e])}).sort(function(e,t){return e.order-t.order}),this.modifiers.forEach(function(t){t.enabled&&e(t.onLoad)&&t.onLoad(r.reference,r.popper,r.options,t,r.state)}),this.update();var f=this.options.eventsEnabled;f&&this.enableEventListeners(),this.state.eventsEnabled=f}return q(t,[{key:"update",value:function(){return function(){if(!this.state.isDestroyed){var e={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:!1,offsets:{}};e.offsets.reference=v(this.state,this.popper,this.reference),e.placement=g(this.options.placement,e.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding),e.originalPlacement=e.placement,e.offsets.popper=y(this.popper,e.offsets.reference,e.placement),e.offsets.popper.position="absolute",e=E(this.modifiers,e),this.state.isCreated?this.options.onUpdate(e):(this.state.isCreated=!0,this.options.onCreate(e))}}.call(this)}},{key:"destroy",value:function(){return function(){return this.state.isDestroyed=!0,x(this.modifiers,"applyStyle")&&(this.popper.removeAttribute("x-placement"),this.popper.style.left="",this.popper.style.position="",this.popper.style.top="",this.popper.style[L("transform")]=""),this.disableEventListeners(),this.options.removeOnDestroy&&this.popper.parentNode.removeChild(this.popper),this}.call(this)}},{key:"enableEventListeners",value:function(){return M.call(this)}},{key:"disableEventListeners",value:function(){return C.call(this)}}]),t}();return J.Utils=("undefined"!=typeof window?window:global).PopperUtils,J.placements=G,J.Defaults=X,J});