/* copyright (c) federico zivolo 2017 distributed under the mit license (license terms are at http://opensource.org/licenses/mit). */(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 o=window.getcomputedstyle(e,null);return t?o[t]:o}function o(e){return'html'===e.nodename?e:e.parentnode||e.host}function n(e){if(!e||-1!==['html','body','#document'].indexof(e.nodename))return window.document.body;var i=t(e),r=i.overflow,p=i.overflowx,s=i.overflowy;return /(auto|scroll)/.test(r+s+p)?e:n(o(e))}function r(e){var o=e&&e.offsetparent,i=o&&o.nodename;return i&&'body'!==i&&'html'!==i?-1!==['td','table'].indexof(o.nodename)&&'static'===t(o,'position')?r(o):o:window.document.documentelement}function p(e){var t=e.nodename;return'body'!==t&&('html'===t||r(e.firstelementchild)===e)}function s(e){return null===e.parentnode?e:s(e.parentnode)}function d(e,t){if(!e||!e.nodetype||!t||!t.nodetype)return window.document.documentelement;var o=e.comparedocumentposition(t)&node.document_position_following,i=o?e:t,n=o?t:e,a=document.createrange();a.setstart(i,0),a.setend(n,0);var f=a.commonancestorcontainer;if(e!==f&&t!==f||i.contains(n))return p(f)?f:r(f);var l=s(e);return l.host?d(l.host,t):d(e,s(t).host)}function a(e){var t=1=o.clientwidth&&i>=o.clientheight}),f=0i[e]&&!t.escapewithreference&&(n=z(p[o],i[e]-('right'===e?p.width:p.height))),pe({},o,n)}};return n.foreach(function(e){var t=-1===['left','top'].indexof(e)?'secondary':'primary';p=se({},p,s[t](e))}),e.offsets.popper=p,e},priority:['left','right','top','bottom'],padding:5,boundarieselement:'scrollparent'},keeptogether:{order:400,enabled:!0,fn:function(e){var t=e.offsets,o=t.popper,i=t.reference,n=e.placement.split('-')[0],r=v,p=-1!==['top','bottom'].indexof(n),s=p?'right':'bottom',d=p?'left':'top',a=p?'width':'height';return o[s]r(i[s])&&(e.offsets.popper[d]=r(i[s])),e}},arrow:{order:500,enabled:!0,fn:function(e,t){if(!f(e.instance.modifiers,'arrow','keeptogether'))return e;var o=t.element;if('string'==typeof o){if(o=e.instance.popper.queryselector(o),!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 i=e.placement.split('-')[0],n=e.offsets,r=n.popper,p=n.reference,s=-1!==['left','right'].indexof(i),d=s?'height':'width',a=s?'top':'left',f=s?'left':'top',l=s?'bottom':'right',m=o(o)[d];p[l]-mr[l]&&(e.offsets.popper[a]+=p[a]+m-r[l]);var h=p[a]+p[d]/2-m/2,g=h-c(e.offsets.popper)[a];return g=_(z(r[d]-m,g),0),e.arrowelement=o,e.offsets.arrow={},e.offsets.arrow[a]=math.round(g),e.offsets.arrow[f]='',e},element:'[x-arrow]'},flip:{order:600,enabled:!0,fn:function(e,t){if(w(e.instance.modifiers,'inner'))return e;if(e.flipped&&e.placement===e.originalplacement)return e;var o=w(e.instance.popper,e.instance.reference,t.padding,t.boundarieselement),i=e.placement.split('-')[0],n=l(i),r=e.placement.split('-')[1]||'',p=[];switch(t.behavior){case fe.flip:p=[i,n];break;case fe.clockwise:p=k(i);break;case fe.counterclockwise:p=k(i,!0);break;default:p=t.behavior;}return p.foreach(function(s,d){if(i!==s||p.length===d+1)return e;i=e.placement.split('-')[0],n=l(i);var a=e.offsets.popper,f=e.offsets.reference,l=v,m='left'===i&&l(a.right)>l(f.left)||'right'===i&&l(a.left)l(f.top)||'bottom'===i&&l(a.top)l(o.right),g=l(a.top)l(o.bottom),b='left'===i&&h||'right'===i&&c||'top'===i&&g||'bottom'===i&&u,y=-1!==['top','bottom'].indexof(i),w=!!t.flipvariations&&(y&&'start'===r&&h||y&&'end'===r&&c||!y&&'start'===r&&g||!y&&'end'===r&&u);(m||b||w)&&(e.flipped=!0,(m||b)&&(i=p[d+1]),w&&(r=j(r)),e.placement=i+(r?'-'+r:''),e.offsets.popper=se({},e.offsets.popper,s(e.instance.popper,e.offsets.reference,e.placement)),e=n(e.instance.modifiers,e,'flip'))}),e},behavior:'flip',padding:5,boundarieselement:'viewport'},inner:{order:700,enabled:!1,fn:function(e){var t=e.placement,o=t.split('-')[0],i=e.offsets,n=i.popper,r=i.reference,p=-1!==['left','right'].indexof(o),s=-1===['top','left'].indexof(o);return n[p?'left':'top']=r[t]-(s?n[p?'width':'height']:0),e.placement=l(t),e.offsets.popper=c(n),e}},hide:{order:800,enabled:!0,fn:function(e){if(!f(e.instance.modifiers,'hide','preventoverflow'))return e;var t=e.offsets.reference,o=t(e.instance.modifiers,function(e){return'preventoverflow'===e.name}).boundaries;if(t.bottomo.right||t.top>o.bottom||t.right