var isBrowser=typeof window!=='undefined'&&typeof document!=='undefined'&&typeof navigator!=='undefined';const timeoutDuration=function(){const longerTimeoutBrowsers=['Edge','Trident','Firefox'];for(let i=0;i<longerTimeoutBrowsers.length;i+=1){if(isBrowser&&navigator.userAgent.indexOf(longerTimeoutBrowsers[i])>=0){return 1;}}
return 0;}();function microtaskDebounce(fn){let called=false;return()=>{if(called){return;}
called=true;window.Promise.resolve().then(()=>{called=false;fn();});};}
function taskDebounce(fn){let scheduled=false;return()=>{if(!scheduled){scheduled=true;setTimeout(()=>{scheduled=false;fn();},timeoutDuration);}};}
const supportsMicroTasks=isBrowser&&window.Promise;var debounce=supportsMicroTasks?microtaskDebounce:taskDebounce;function isFunction(functionToCheck){const getType={};return functionToCheck&&getType.toString.call(functionToCheck)==='[object Function]';}
function getStyleComputedProperty(element,property){if(element.nodeType!==1){return[];}
const window=element.ownerDocument.defaultView;const css=window.getComputedStyle(element,null);return property?css[property]:css;}
function getParentNode(element){if(element.nodeName==='HTML'){return element;}
return element.parentNode||element.host;}
function getScrollParent(element){if(!element){return document.body;}
switch(element.nodeName){case 'HTML':case 'BODY':return element.ownerDocument.body;case '#document':return element.body;}
const{overflow,overflowX,overflowY}=getStyleComputedProperty(element);if(/(auto|scroll|overlay)/.test(overflow+overflowY+overflowX)){return element;}
return getScrollParent(getParentNode(element));}
function getReferenceNode(reference){return reference&&reference.referenceNode?reference.referenceNode:reference;}
const isIE11=isBrowser&&!!(window.MSInputMethodContext&&document.documentMode);const isIE10=isBrowser&&/MSIE 10/.test(navigator.userAgent);function isIE(version){if(version===11){return isIE11;}
if(version===10){return isIE10;}
return isIE11||isIE10;}
function getOffsetParent(element){if(!element){return document.documentElement;}
const noOffsetParent=isIE(10)?document.body:null;let offsetParent=element.offsetParent||null;while(offsetParent===noOffsetParent&&element.nextElementSibling){offsetParent=(element=element.nextElementSibling).offsetParent;}
const nodeName=offsetParent&&offsetParent.nodeName;if(!nodeName||nodeName==='BODY'||nodeName==='HTML'){return element?element.ownerDocument.documentElement:document.documentElement;}
if(['TH','TD','TABLE'].indexOf(offsetParent.nodeName)!==-1&&getStyleComputedProperty(offsetParent,'position')==='static'){return getOffsetParent(offsetParent);}
return offsetParent;}
function isOffsetContainer(element){const{nodeName}=element;if(nodeName==='BODY'){return false;}
return nodeName==='HTML'||getOffsetParent(element.firstElementChild)===element;}
function getRoot(node){if(node.parentNode!==null){return getRoot(node.parentNode);}
return node;}
function findCommonOffsetParent(element1,element2){if(!element1||!element1.nodeType||!element2||!element2.nodeType){return document.documentElement;}
const order=element1.compareDocumentPosition(element2)&Node.DOCUMENT_POSITION_FOLLOWING;const start=order?element1:element2;const end=order?element2:element1;const range=document.createRange();range.setStart(start,0);range.setEnd(end,0);const{commonAncestorContainer}=range;if(element1!==commonAncestorContainer&&element2!==commonAncestorContainer||start.contains(end)){if(isOffsetContainer(commonAncestorContainer)){return commonAncestorContainer;}
return getOffsetParent(commonAncestorContainer);}
const element1root=getRoot(element1);if(element1root.host){return findCommonOffsetParent(element1root.host,element2);}else{return findCommonOffsetParent(element1,getRoot(element2).host);}}
function getScroll(element,side='top'){const upperSide=side==='top'?'scrollTop':'scrollLeft';const nodeName=element.nodeName;if(nodeName==='BODY'||nodeName==='HTML'){const html=element.ownerDocument.documentElement;const scrollingElement=element.ownerDocument.scrollingElement||html;return scrollingElement[upperSide];}
return element[upperSide];}
function includeScroll(rect,element,subtract=false){const scrollTop=getScroll(element,'top');const scrollLeft=getScroll(element,'left');const modifier=subtract?-1:1;rect.top+=scrollTop*modifier;rect.bottom+=scrollTop*modifier;rect.left+=scrollLeft*modifier;rect.right+=scrollLeft*modifier;return rect;}
function getBordersSize(styles,axis){const sideA=axis==='x'?'Left':'Top';const sideB=sideA==='Left'?'Right':'Bottom';return parseFloat(styles[`border${sideA}Width`])+parseFloat(styles[`border${sideB}Width`]);}
function getSize(axis,body,html,computedStyle){return Math.max(body[`offset${axis}`],body[`scroll${axis}`],html[`client${axis}`],html[`offset${axis}`],html[`scroll${axis}`],isIE(10)?parseInt(html[`offset${axis}`])+parseInt(computedStyle[`margin${axis==='Height'?'Top':'Left'}`])+parseInt(computedStyle[`margin${axis==='Height'?'Bottom':'Right'}`]):0);}
function getWindowSizes(document){const body=document.body;const html=document.documentElement;const computedStyle=isIE(10)&&getComputedStyle(html);return{height:getSize('Height',body,html,computedStyle),width:getSize('Width',body,html,computedStyle)};}
var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}
return target;};function getClientRect(offsets){return _extends({},offsets,{right:offsets.left+offsets.width,bottom:offsets.top+offsets.height});}
function getBoundingClientRect(element){let rect={};try{if(isIE(10)){rect=element.getBoundingClientRect();const scrollTop=getScroll(element,'top');const scrollLeft=getScroll(element,'left');rect.top+=scrollTop;rect.left+=scrollLeft;rect.bottom+=scrollTop;rect.right+=scrollLeft;}else{rect=element.getBoundingClientRect();}}catch(e){}
const result={left:rect.left,top:rect.top,width:rect.right-rect.left,height:rect.bottom-rect.top};const sizes=element.nodeName==='HTML'?getWindowSizes(element.ownerDocument):{};const width=sizes.width||element.clientWidth||result.width;const height=sizes.height||element.clientHeight||result.height;let horizScrollbar=element.offsetWidth-width;let vertScrollbar=element.offsetHeight-height;if(horizScrollbar||vertScrollbar){const styles=getStyleComputedProperty(element);horizScrollbar-=getBordersSize(styles,'x');vertScrollbar-=getBordersSize(styles,'y');result.width-=horizScrollbar;result.height-=vertScrollbar;}
return getClientRect(result);}
function getOffsetRectRelativeToArbitraryNode(children,parent,fixedPosition=false){const isIE10=isIE(10);const isHTML=parent.nodeName==='HTML';const childrenRect=getBoundingClientRect(children);const parentRect=getBoundingClientRect(parent);const scrollParent=getScrollParent(children);const styles=getStyleComputedProperty(parent);const borderTopWidth=parseFloat(styles.borderTopWidth);const borderLeftWidth=parseFloat(styles.borderLeftWidth);if(fixedPosition&&isHTML){parentRect.top=Math.max(parentRect.top,0);parentRect.left=Math.max(parentRect.left,0);}
let offsets=getClientRect({top:childrenRect.top-parentRect.top-borderTopWidth,left:childrenRect.left-parentRect.left-borderLeftWidth,width:childrenRect.width,height:childrenRect.height});offsets.marginTop=0;offsets.marginLeft=0;if(!isIE10&&isHTML){const marginTop=parseFloat(styles.marginTop);const marginLeft=parseFloat(styles.marginLeft);offsets.top-=borderTopWidth-marginTop;offsets.bottom-=borderTopWidth-marginTop;offsets.left-=borderLeftWidth-marginLeft;offsets.right-=borderLeftWidth-marginLeft;offsets.marginTop=marginTop;offsets.marginLeft=marginLeft;}
if(isIE10&&!fixedPosition?parent.contains(scrollParent):parent===scrollParent&&scrollParent.nodeName!=='BODY'){offsets=includeScroll(offsets,parent);}
return offsets;}
function getViewportOffsetRectRelativeToArtbitraryNode(element,excludeScroll=false){const html=element.ownerDocument.documentElement;const relativeOffset=getOffsetRectRelativeToArbitraryNode(element,html);const width=Math.max(html.clientWidth,window.innerWidth||0);const height=Math.max(html.clientHeight,window.innerHeight||0);const scrollTop=!excludeScroll?getScroll(html):0;const scrollLeft=!excludeScroll?getScroll(html,'left'):0;const offset={top:scrollTop-relativeOffset.top+relativeOffset.marginTop,left:scrollLeft-relativeOffset.left+relativeOffset.marginLeft,width,height};return getClientRect(offset);}
function isFixed(element){const nodeName=element.nodeName;if(nodeName==='BODY'||nodeName==='HTML'){return false;}
if(getStyleComputedProperty(element,'position')==='fixed'){return true;}
const parentNode=getParentNode(element);if(!parentNode){return false;}
return isFixed(parentNode);}
function getFixedPositionOffsetParent(element){if(!element||!element.parentElement||isIE()){return document.documentElement;}
let el=element.parentElement;while(el&&getStyleComputedProperty(el,'transform')==='none'){el=el.parentElement;}
return el||document.documentElement;}
function getBoundaries(popper,reference,padding,boundariesElement,fixedPosition=false){let boundaries={top:0,left:0};const offsetParent=fixedPosition?getFixedPositionOffsetParent(popper):findCommonOffsetParent(popper,getReferenceNode(reference));if(boundariesElement==='viewport'){boundaries=getViewportOffsetRectRelativeToArtbitraryNode(offsetParent,fixedPosition);}else{let boundariesNode;if(boundariesElement==='scrollParent'){boundariesNode=getScrollParent(getParentNode(reference));if(boundariesNode.nodeName==='BODY'){boundariesNode=popper.ownerDocument.documentElement;}}else if(boundariesElement==='window'){boundariesNode=popper.ownerDocument.documentElement;}else{boundariesNode=boundariesElement;}
const offsets=getOffsetRectRelativeToArbitraryNode(boundariesNode,offsetParent,fixedPosition);if(boundariesNode.nodeName==='HTML'&&!isFixed(offsetParent)){const{height,width}=getWindowSizes(popper.ownerDocument);boundaries.top+=offsets.top-offsets.marginTop;boundaries.bottom=height+offsets.top;boundaries.left+=offsets.left-offsets.marginLeft;boundaries.right=width+offsets.left;}else{boundaries=offsets;}}
padding=padding||0;const isPaddingNumber=typeof padding==='number';boundaries.left+=isPaddingNumber?padding:padding.left||0;boundaries.top+=isPaddingNumber?padding:padding.top||0;boundaries.right-=isPaddingNumber?padding:padding.right||0;boundaries.bottom-=isPaddingNumber?padding:padding.bottom||0;return boundaries;}
function getArea({width,height}){return width*height;}
function computeAutoPlacement(placement,refRect,popper,reference,boundariesElement,padding=0){if(placement.indexOf('auto')===-1){return placement;}
const boundaries=getBoundaries(popper,reference,padding,boundariesElement);const rects={top:{width:boundaries.width,height:refRect.top-boundaries.top},right:{width:boundaries.right-refRect.right,height:boundaries.height},bottom:{width:boundaries.width,height:boundaries.bottom-refRect.bottom},left:{width:refRect.left-boundaries.left,height:boundaries.height}};const sortedAreas=Object.keys(rects).map(key=>_extends({key},rects[key],{area:getArea(rects[key])})).sort((a,b)=>b.area-a.area);const filteredAreas=sortedAreas.filter(({width,height})=>width>=popper.clientWidth&&height>=popper.clientHeight);const computedPlacement=filteredAreas.length>0?filteredAreas[0].key:sortedAreas[0].key;const variation=placement.split('-')[1];return computedPlacement+(variation?`-${variation}`:'');}
function getReferenceOffsets(state,popper,reference,fixedPosition=null){const commonOffsetParent=fixedPosition?getFixedPositionOffsetParent(popper):findCommonOffsetParent(popper,getReferenceNode(reference));return getOffsetRectRelativeToArbitraryNode(reference,commonOffsetParent,fixedPosition);}
function getOuterSizes(element){const window=element.ownerDocument.defaultView;const styles=window.getComputedStyle(element);const x=parseFloat(styles.marginTop||0)+parseFloat(styles.marginBottom||0);const y=parseFloat(styles.marginLeft||0)+parseFloat(styles.marginRight||0);const result={width:element.offsetWidth+y,height:element.offsetHeight+x};return result;}
function getOppositePlacement(placement){const hash={left:'right',right:'left',bottom:'top',top:'bottom'};return placement.replace(/left|right|bottom|top/g,matched=>hash[matched]);}
function getPopperOffsets(popper,referenceOffsets,placement){placement=placement.split('-')[0];const popperRect=getOuterSizes(popper);const popperOffsets={width:popperRect.width,height:popperRect.height};const isHoriz=['right','left'].indexOf(placement)!==-1;const mainSide=isHoriz?'top':'left';const secondarySide=isHoriz?'left':'top';const measurement=isHoriz?'height':'width';const secondaryMeasurement=!isHoriz?'height':'width';popperOffsets[mainSide]=referenceOffsets[mainSide]+referenceOffsets[measurement]/2-popperRect[measurement]/2;if(placement===secondarySide){popperOffsets[secondarySide]=referenceOffsets[secondarySide]-popperRect[secondaryMeasurement];}else{popperOffsets[secondarySide]=referenceOffsets[getOppositePlacement(secondarySide)];}
return popperOffsets;}
function find(arr,check){if(Array.prototype.find){return arr.find(check);}
return arr.filter(check)[0];}
function findIndex(arr,prop,value){if(Array.prototype.findIndex){return arr.findIndex(cur=>cur[prop]===value);}
const match=find(arr,obj=>obj[prop]===value);return arr.indexOf(match);}
function runModifiers(modifiers,data,ends){const modifiersToRun=ends===undefined?modifiers:modifiers.slice(0,findIndex(modifiers,'name',ends));modifiersToRun.forEach(modifier=>{if(modifier['function']){console.warn('`modifier.function` is deprecated, use `modifier.fn`!');}
const fn=modifier['function']||modifier.fn;if(modifier.enabled&&isFunction(fn)){data.offsets.popper=getClientRect(data.offsets.popper);data.offsets.reference=getClientRect(data.offsets.reference);data=fn(data,modifier);}});return data;}
function update(){if(this.state.isDestroyed){return;}
let data={instance:this,styles:{},arrowStyles:{},attributes:{},flipped:false,offsets:{}};data.offsets.reference=getReferenceOffsets(this.state,this.popper,this.reference,this.options.positionFixed);data.placement=computeAutoPlacement(this.options.placement,data.offsets.reference,this.popper,this.reference,this.options.modifiers.flip.boundariesElement,this.options.modifiers.flip.padding);data.originalPlacement=data.placement;data.positionFixed=this.options.positionFixed;data.offsets.popper=getPopperOffsets(this.popper,data.offsets.reference,data.placement);data.offsets.popper.position=this.options.positionFixed?'fixed':'absolute';data=runModifiers(this.modifiers,data);if(!this.state.isCreated){this.state.isCreated=true;this.options.onCreate(data);}else{this.options.onUpdate(data);}}
function isModifierEnabled(modifiers,modifierName){return modifiers.some(({name,enabled})=>enabled&&name===modifierName);}
function getSupportedPropertyName(property){const prefixes=[false,'ms','Webkit','Moz','O'];const upperProp=property.charAt(0).toUpperCase()+property.slice(1);for(let i=0;i<prefixes.length;i++){const prefix=prefixes[i];const toCheck=prefix?`${prefix}${upperProp}`:property;if(typeof document.body.style[toCheck]!=='undefined'){return toCheck;}}
return null;}
function destroy(){this.state.isDestroyed=true;if(isModifierEnabled(this.modifiers,'applyStyle')){this.popper.removeAttribute('x-placement');this.popper.style.position='';this.popper.style.top='';this.popper.style.left='';this.popper.style.right='';this.popper.style.bottom='';this.popper.style.willChange='';this.popper.style[getSupportedPropertyName('transform')]='';}
this.disableEventListeners();if(this.options.removeOnDestroy){this.popper.parentNode.removeChild(this.popper);}
return this;}
function getWindow(element){const ownerDocument=element.ownerDocument;return ownerDocument?ownerDocument.defaultView:window;}
function attachToScrollParents(scrollParent,event,callback,scrollParents){const isBody=scrollParent.nodeName==='BODY';const target=isBody?scrollParent.ownerDocument.defaultView:scrollParent;target.addEventListener(event,callback,{passive:true});if(!isBody){attachToScrollParents(getScrollParent(target.parentNode),event,callback,scrollParents);}
scrollParents.push(target);}
function setupEventListeners(reference,options,state,updateBound){state.updateBound=updateBound;getWindow(reference).addEventListener('resize',state.updateBound,{passive:true});const scrollElement=getScrollParent(reference);attachToScrollParents(scrollElement,'scroll',state.updateBound,state.scrollParents);state.scrollElement=scrollElement;state.eventsEnabled=true;return state;}
function enableEventListeners(){if(!this.state.eventsEnabled){this.state=setupEventListeners(this.reference,this.options,this.state,this.scheduleUpdate);}}
function removeEventListeners(reference,state){getWindow(reference).removeEventListener('resize',state.updateBound);state.scrollParents.forEach(target=>{target.removeEventListener('scroll',state.updateBound);});state.updateBound=null;state.scrollParents=[];state.scrollElement=null;state.eventsEnabled=false;return state;}
function disableEventListeners(){if(this.state.eventsEnabled){cancelAnimationFrame(this.scheduleUpdate);this.state=removeEventListeners(this.reference,this.state);}}
function isNumeric(n){return n!==''&&!isNaN(parseFloat(n))&&isFinite(n);}
function setStyles(element,styles){Object.keys(styles).forEach(prop=>{let unit='';if(['width','height','top','right','bottom','left'].indexOf(prop)!==-1&&isNumeric(styles[prop])){unit='px';}
element.style[prop]=styles[prop]+unit;});}
function setAttributes(element,attributes){Object.keys(attributes).forEach(function(prop){const value=attributes[prop];if(value!==false){element.setAttribute(prop,attributes[prop]);}else{element.removeAttribute(prop);}});}
function applyStyle(data){setStyles(data.instance.popper,data.styles);setAttributes(data.instance.popper,data.attributes);if(data.arrowElement&&Object.keys(data.arrowStyles).length){setStyles(data.arrowElement,data.arrowStyles);}
return data;}
function applyStyleOnLoad(reference,popper,options,modifierOptions,state){const referenceOffsets=getReferenceOffsets(state,popper,reference,options.positionFixed);const placement=computeAutoPlacement(options.placement,referenceOffsets,popper,reference,options.modifiers.flip.boundariesElement,options.modifiers.flip.padding);popper.setAttribute('x-placement',placement);setStyles(popper,{position:options.positionFixed?'fixed':'absolute'});return options;}
function getRoundedOffsets(data,shouldRound){const{popper,reference}=data.offsets;const{round,floor}=Math;const noRound=v=>v;const referenceWidth=round(reference.width);const popperWidth=round(popper.width);const isVertical=['left','right'].indexOf(data.placement)!==-1;const isVariation=data.placement.indexOf('-')!==-1;const sameWidthParity=referenceWidth%2===popperWidth%2;const bothOddWidth=referenceWidth%2===1&&popperWidth%2===1;const horizontalToInteger=!shouldRound?noRound:isVertical||isVariation||sameWidthParity?round:floor;const verticalToInteger=!shouldRound?noRound:round;return{left:horizontalToInteger(bothOddWidth&&!isVariation&&shouldRound?popper.left-1:popper.left),top:verticalToInteger(popper.top),bottom:verticalToInteger(popper.bottom),right:horizontalToInteger(popper.right)};}
const isFirefox=isBrowser&&/Firefox/i.test(navigator.userAgent);function computeStyle(data,options){const{x,y}=options;const{popper}=data.offsets;const legacyGpuAccelerationOption=find(data.instance.modifiers,modifier=>modifier.name==='applyStyle').gpuAcceleration;if(legacyGpuAccelerationOption!==undefined){console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');}
const gpuAcceleration=legacyGpuAccelerationOption!==undefined?legacyGpuAccelerationOption:options.gpuAcceleration;const offsetParent=getOffsetParent(data.instance.popper);const offsetParentRect=getBoundingClientRect(offsetParent);const styles={position:popper.position};const offsets=getRoundedOffsets(data,window.devicePixelRatio<2||!isFirefox);const sideA=x==='bottom'?'top':'bottom';const sideB=y==='right'?'left':'right';const prefixedProperty=getSupportedPropertyName('transform');let left,top;if(sideA==='bottom'){if(offsetParent.nodeName==='HTML'){top=-offsetParent.clientHeight+offsets.bottom;}else{top=-offsetParentRect.height+offsets.bottom;}}else{top=offsets.top;}
if(sideB==='right'){if(offsetParent.nodeName==='HTML'){left=-offsetParent.clientWidth+offsets.right;}else{left=-offsetParentRect.width+offsets.right;}}else{left=offsets.left;}
if(gpuAcceleration&&prefixedProperty){styles[prefixedProperty]=`translate3d(${left}px, ${top}px, 0)`;styles[sideA]=0;styles[sideB]=0;styles.willChange='transform';}else{const invertTop=sideA==='bottom'?-1:1;const invertLeft=sideB==='right'?-1:1;styles[sideA]=top*invertTop;styles[sideB]=left*invertLeft;styles.willChange=`${sideA}, ${sideB}`;}
const attributes={'x-placement':data.placement};data.attributes=_extends({},attributes,data.attributes);data.styles=_extends({},styles,data.styles);data.arrowStyles=_extends({},data.offsets.arrow,data.arrowStyles);return data;}
function isModifierRequired(modifiers,requestingName,requestedName){const requesting=find(modifiers,({name})=>name===requestingName);const isRequired=!!requesting&&modifiers.some(modifier=>{return modifier.name===requestedName&&modifier.enabled&&modifier.order<requesting.order;});if(!isRequired){const requesting=`\`${requestingName}\``;const requested=`\`${requestedName}\``;console.warn(`${requested} modifier is required by ${requesting} modifier in order to work, be sure to include it before ${requesting}!`);}
return isRequired;}
function arrow(data,options){if(!isModifierRequired(data.instance.modifiers,'arrow','keepTogether')){return data;}
let arrowElement=options.element;if(typeof arrowElement==='string'){arrowElement=data.instance.popper.querySelector(arrowElement);if(!arrowElement){return data;}}else{if(!data.instance.popper.contains(arrowElement)){console.warn('WARNING: `arrow.element` must be child of its popper element!');return data;}}
const placement=data.placement.split('-')[0];const{popper,reference}=data.offsets;const isVertical=['left','right'].indexOf(placement)!==-1;const len=isVertical?'height':'width';const sideCapitalized=isVertical?'Top':'Left';const side=sideCapitalized.toLowerCase();const altSide=isVertical?'left':'top';const opSide=isVertical?'bottom':'right';const arrowElementSize=getOuterSizes(arrowElement)[len];if(reference[opSide]-arrowElementSize<popper[side]){data.offsets.popper[side]-=popper[side]-(reference[opSide]-arrowElementSize);}
if(reference[side]+arrowElementSize>popper[opSide]){data.offsets.popper[side]+=reference[side]+arrowElementSize-popper[opSide];}
data.offsets.popper=getClientRect(data.offsets.popper);const center=reference[side]+reference[len]/2-arrowElementSize/2;const css=getStyleComputedProperty(data.instance.popper);const popperMarginSide=parseFloat(css[`margin${sideCapitalized}`]);const popperBorderSide=parseFloat(css[`border${sideCapitalized}Width`]);let sideValue=center-data.offsets.popper[side]-popperMarginSide-popperBorderSide;sideValue=Math.max(Math.min(popper[len]-arrowElementSize,sideValue),0);data.arrowElement=arrowElement;data.offsets.arrow={[side]:Math.round(sideValue),[altSide]:''};return data;}
function getOppositeVariation(variation){if(variation==='end'){return 'start';}else if(variation==='start'){return 'end';}
return variation;}
var placements=['auto-start','auto','auto-end','top-start','top','top-end','right-start','right','right-end','bottom-end','bottom','bottom-start','left-end','left','left-start'];const validPlacements=placements.slice(3);function clockwise(placement,counter=false){const index=validPlacements.indexOf(placement);const arr=validPlacements.slice(index+1).concat(validPlacements.slice(0,index));return counter?arr.reverse():arr;}
const BEHAVIORS={FLIP:'flip',CLOCKWISE:'clockwise',COUNTERCLOCKWISE:'counterclockwise'};function flip(data,options){if(isModifierEnabled(data.instance.modifiers,'inner')){return data;}
if(data.flipped&&data.placement===data.originalPlacement){return data;}
const boundaries=getBoundaries(data.instance.popper,data.instance.reference,options.padding,options.boundariesElement,data.positionFixed);let placement=data.placement.split('-')[0];let placementOpposite=getOppositePlacement(placement);let variation=data.placement.split('-')[1]||'';let flipOrder=[];switch(options.behavior){case BEHAVIORS.FLIP:flipOrder=[placement,placementOpposite];break;case BEHAVIORS.CLOCKWISE:flipOrder=clockwise(placement);break;case BEHAVIORS.COUNTERCLOCKWISE:flipOrder=clockwise(placement,true);break;default:flipOrder=options.behavior;}
flipOrder.forEach((step,index)=>{if(placement!==step||flipOrder.length===index+1){return data;}
placement=data.placement.split('-')[0];placementOpposite=getOppositePlacement(placement);const popperOffsets=data.offsets.popper;const refOffsets=data.offsets.reference;const floor=Math.floor;const overlapsRef=placement==='left'&&floor(popperOffsets.right)>floor(refOffsets.left)||placement==='right'&&floor(popperOffsets.left)<floor(refOffsets.right)||placement==='top'&&floor(popperOffsets.bottom)>floor(refOffsets.top)||placement==='bottom'&&floor(popperOffsets.top)<floor(refOffsets.bottom);const overflowsLeft=floor(popperOffsets.left)<floor(boundaries.left);const overflowsRight=floor(popperOffsets.right)>floor(boundaries.right);const overflowsTop=floor(popperOffsets.top)<floor(boundaries.top);const overflowsBottom=floor(popperOffsets.bottom)>floor(boundaries.bottom);const overflowsBoundaries=placement==='left'&&overflowsLeft||placement==='right'&&overflowsRight||placement==='top'&&overflowsTop||placement==='bottom'&&overflowsBottom;const isVertical=['top','bottom'].indexOf(placement)!==-1;const flippedVariationByRef=!!options.flipVariations&&(isVertical&&variation==='start'&&overflowsLeft||isVertical&&variation==='end'&&overflowsRight||!isVertical&&variation==='start'&&overflowsTop||!isVertical&&variation==='end'&&overflowsBottom);const flippedVariationByContent=!!options.flipVariationsByContent&&(isVertical&&variation==='start'&&overflowsRight||isVertical&&variation==='end'&&overflowsLeft||!isVertical&&variation==='start'&&overflowsBottom||!isVertical&&variation==='end'&&overflowsTop);const flippedVariation=flippedVariationByRef||flippedVariationByContent;if(overlapsRef||overflowsBoundaries||flippedVariation){data.flipped=true;if(overlapsRef||overflowsBoundaries){placement=flipOrder[index+1];}
if(flippedVariation){variation=getOppositeVariation(variation);}
data.placement=placement+(variation?'-'+variation:'');data.offsets.popper=_extends({},data.offsets.popper,getPopperOffsets(data.instance.popper,data.offsets.reference,data.placement));data=runModifiers(data.instance.modifiers,data,'flip');}});return data;}
function keepTogether(data){const{popper,reference}=data.offsets;const placement=data.placement.split('-')[0];const floor=Math.floor;const isVertical=['top','bottom'].indexOf(placement)!==-1;const side=isVertical?'right':'bottom';const opSide=isVertical?'left':'top';const measurement=isVertical?'width':'height';if(popper[side]<floor(reference[opSide])){data.offsets.popper[opSide]=floor(reference[opSide])-popper[measurement];}
if(popper[opSide]>floor(reference[side])){data.offsets.popper[opSide]=floor(reference[side]);}
return data;}
function toValue(str,measurement,popperOffsets,referenceOffsets){const split=str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);const value=+split[1];const unit=split[2];if(!value){return str;}
if(unit.indexOf('%')===0){let element;switch(unit){case '%p':element=popperOffsets;break;case '%':case '%r':default:element=referenceOffsets;}
const rect=getClientRect(element);return rect[measurement]/100*value;}else if(unit==='vh'||unit==='vw'){let size;if(unit==='vh'){size=Math.max(document.documentElement.clientHeight,window.innerHeight||0);}else{size=Math.max(document.documentElement.clientWidth,window.innerWidth||0);}
return size/100*value;}else{return value;}}
function parseOffset(offset,popperOffsets,referenceOffsets,basePlacement){const offsets=[0,0];const useHeight=['right','left'].indexOf(basePlacement)!==-1;const fragments=offset.split(/(\+|\-)/).map(frag=>frag.trim());const divider=fragments.indexOf(find(fragments,frag=>frag.search(/,|\s/)!==-1));if(fragments[divider]&&fragments[divider].indexOf(',')===-1){console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');}
const splitRegex=/\s*,\s*|\s+/;let ops=divider!==-1?[fragments.slice(0,divider).concat([fragments[divider].split(splitRegex)[0]]),[fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider+1))]:[fragments];ops=ops.map((op,index)=>{const measurement=(index===1?!useHeight:useHeight)?'height':'width';let mergeWithPrevious=false;return op.reduce((a,b)=>{if(a[a.length-1]===''&&['+','-'].indexOf(b)!==-1){a[a.length-1]=b;mergeWithPrevious=true;return a;}else if(mergeWithPrevious){a[a.length-1]+=b;mergeWithPrevious=false;return a;}else{return a.concat(b);}},[]).map(str=>toValue(str,measurement,popperOffsets,referenceOffsets));});ops.forEach((op,index)=>{op.forEach((frag,index2)=>{if(isNumeric(frag)){offsets[index]+=frag*(op[index2-1]==='-'?-1:1);}});});return offsets;}
function offset(data,{offset}){const{placement,offsets:{popper,reference}}=data;const basePlacement=placement.split('-')[0];let offsets;if(isNumeric(+offset)){offsets=[+offset,0];}else{offsets=parseOffset(offset,popper,reference,basePlacement);}
if(basePlacement==='left'){popper.top+=offsets[0];popper.left-=offsets[1];}else if(basePlacement==='right'){popper.top+=offsets[0];popper.left+=offsets[1];}else if(basePlacement==='top'){popper.left+=offsets[0];popper.top-=offsets[1];}else if(basePlacement==='bottom'){popper.left+=offsets[0];popper.top+=offsets[1];}
data.popper=popper;return data;}
function preventOverflow(data,options){let boundariesElement=options.boundariesElement||getOffsetParent(data.instance.popper);if(data.instance.reference===boundariesElement){boundariesElement=getOffsetParent(boundariesElement);}
const transformProp=getSupportedPropertyName('transform');const popperStyles=data.instance.popper.style;const{top,left,[transformProp]:transform}=popperStyles;popperStyles.top='';popperStyles.left='';popperStyles[transformProp]='';const boundaries=getBoundaries(data.instance.popper,data.instance.reference,options.padding,boundariesElement,data.positionFixed);popperStyles.top=top;popperStyles.left=left;popperStyles[transformProp]=transform;options.boundaries=boundaries;const order=options.priority;let popper=data.offsets.popper;const check={primary(placement){let value=popper[placement];if(popper[placement]<boundaries[placement]&&!options.escapeWithReference){value=Math.max(popper[placement],boundaries[placement]);}
return{[placement]:value};},secondary(placement){const mainSide=placement==='right'?'left':'top';let value=popper[mainSide];if(popper[placement]>boundaries[placement]&&!options.escapeWithReference){value=Math.min(popper[mainSide],boundaries[placement]-(placement==='right'?popper.width:popper.height));}
return{[mainSide]:value};}};order.forEach(placement=>{const side=['left','top'].indexOf(placement)!==-1?'primary':'secondary';popper=_extends({},popper,check[side](placement));});data.offsets.popper=popper;return data;}
function shift(data){const placement=data.placement;const basePlacement=placement.split('-')[0];const shiftvariation=placement.split('-')[1];if(shiftvariation){const{reference,popper}=data.offsets;const isVertical=['bottom','top'].indexOf(basePlacement)!==-1;const side=isVertical?'left':'top';const measurement=isVertical?'width':'height';const shiftOffsets={start:{[side]:reference[side]},end:{[side]:reference[side]+reference[measurement]-popper[measurement]}};data.offsets.popper=_extends({},popper,shiftOffsets[shiftvariation]);}
return data;}
function hide(data){if(!isModifierRequired(data.instance.modifiers,'hide','preventOverflow')){return data;}
const refRect=data.offsets.reference;const bound=find(data.instance.modifiers,modifier=>modifier.name==='preventOverflow').boundaries;if(refRect.bottom<bound.top||refRect.left>bound.right||refRect.top>bound.bottom||refRect.right<bound.left){if(data.hide===true){return data;}
data.hide=true;data.attributes['x-out-of-boundaries']='';}else{if(data.hide===false){return data;}
data.hide=false;data.attributes['x-out-of-boundaries']=false;}
return data;}
function inner(data){const placement=data.placement;const basePlacement=placement.split('-')[0];const{popper,reference}=data.offsets;const isHoriz=['left','right'].indexOf(basePlacement)!==-1;const subtractLength=['top','left'].indexOf(basePlacement)===-1;popper[isHoriz?'left':'top']=reference[basePlacement]-(subtractLength?popper[isHoriz?'width':'height']:0);data.placement=getOppositePlacement(placement);data.offsets.popper=getClientRect(popper);return data;}
var modifiers={shift:{order:100,enabled:true,fn:shift},offset:{order:200,enabled:true,fn:offset,offset:0},preventOverflow:{order:300,enabled:true,fn:preventOverflow,priority:['left','right','top','bottom'],padding:5,boundariesElement:'scrollParent'},keepTogether:{order:400,enabled:true,fn:keepTogether},arrow:{order:500,enabled:true,fn:arrow,element:'[x-arrow]'},flip:{order:600,enabled:true,fn:flip,behavior:'flip',padding:5,boundariesElement:'viewport',flipVariations:false,flipVariationsByContent:false},inner:{order:700,enabled:false,fn:inner},hide:{order:800,enabled:true,fn:hide},computeStyle:{order:850,enabled:true,fn:computeStyle,gpuAcceleration:true,x:'bottom',y:'right'},applyStyle:{order:900,enabled:true,fn:applyStyle,onLoad:applyStyleOnLoad,gpuAcceleration:undefined}};var Defaults={placement:'bottom',positionFixed:false,eventsEnabled:true,removeOnDestroy:false,onCreate:()=>{},onUpdate:()=>{},modifiers};class Popper{constructor(reference,popper,options={}){this.scheduleUpdate=()=>requestAnimationFrame(this.update);this.update=debounce(this.update.bind(this));this.options=_extends({},Popper.Defaults,options);this.state={isDestroyed:false,isCreated:false,scrollParents:[]};this.reference=reference&&reference.jquery?reference[0]:reference;this.popper=popper&&popper.jquery?popper[0]:popper;this.options.modifiers={};Object.keys(_extends({},Popper.Defaults.modifiers,options.modifiers)).forEach(name=>{this.options.modifiers[name]=_extends({},Popper.Defaults.modifiers[name]||{},options.modifiers?options.modifiers[name]:{});});this.modifiers=Object.keys(this.options.modifiers).map(name=>_extends({name},this.options.modifiers[name])).sort((a,b)=>a.order-b.order);this.modifiers.forEach(modifierOptions=>{if(modifierOptions.enabled&&isFunction(modifierOptions.onLoad)){modifierOptions.onLoad(this.reference,this.popper,this.options,modifierOptions,this.state);}});this.update();const eventsEnabled=this.options.eventsEnabled;if(eventsEnabled){this.enableEventListeners();}
this.state.eventsEnabled=eventsEnabled;}
update(){return update.call(this);}
destroy(){return destroy.call(this);}
enableEventListeners(){return enableEventListeners.call(this);}
disableEventListeners(){return disableEventListeners.call(this);}}
Popper.Utils=(typeof window!=='undefined'?window:global).PopperUtils;Popper.placements=placements;Popper.Defaults=Defaults;export default Popper;