!function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e(require,exports,module):t.Tether=e()}(this,function(t,e,o){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t){var e=t.getBoundingClientRect(),o={};for(var i in e)o[i]=e[i];if(t.ownerDocument!==document){var n=t.ownerDocument.defaultView.frameElement;if(n){var r=s(n);o.top+=r.top,o.bottom+=r.top,o.left+=r.left,o.right+=r.left}}return o}function a(t){var e=(getComputedStyle(t)||{}).position,o=[];if("fixed"===e)return[t];for(var i=t;(i=i.parentNode)&&i&&1===i.nodeType;){var n=void 0;try{n=getComputedStyle(i)}catch(t){}if(null==n)return o.push(i),o;var r=n,s=r.overflow,a=r.overflowX,l=r.overflowY;/(auto|scroll)/.test(s+l+a)&&("absolute"!==e||0<=["relative","absolute","fixed"].indexOf(n.position))&&o.push(i)}return o.push(t.ownerDocument.body),t.ownerDocument!==document&&o.push(t.ownerDocument.defaultView),o}function n(){g&&document.body.removeChild(g),g=null}function x(t){var e=void 0;t===document?(e=document,t=document.documentElement):e=t.ownerDocument;var o=e.documentElement,i=s(t),n=y();return i.top-=n.top,i.left-=n.left,void 0===i.width&&(i.width=document.body.scrollWidth-i.left-i.right),void 0===i.height&&(i.height=document.body.scrollHeight-i.top-i.bottom),i.top=i.top-o.clientTop,i.left=i.left-o.clientLeft,i.right=e.body.clientWidth-i.width-i.left,i.bottom=e.body.clientHeight-i.height-i.top,i}function C(t){return t.offsetParent||document.documentElement}function O(){if(w)return w;var t=document.createElement("div");t.style.width="100%",t.style.height="200px";var e=document.createElement("div");A(e.style,{position:"absolute",top:0,left:0,pointerEvents:"none",visibility:"hidden",width:"200px",height:"150px",overflow:"hidden"}),e.appendChild(t),document.body.appendChild(e);var o=t.offsetWidth;e.style.overflow="scroll";var i=t.offsetWidth;o===i&&(i=e.clientWidth),document.body.removeChild(e);var n=o-i;return w={width:n,height:n}}function A(){var o=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=[];return Array.prototype.push.apply(t,arguments),t.slice(1).forEach(function(t){if(t)for(var e in t)!{}.hasOwnProperty.call(t,e)||(o[e]=t[e])}),o}function r(e,t){if(void 0!==e.classList)t.split(" ").forEach(function(t){t.trim()&&e.classList.remove(t)});else{var o=new RegExp("(^| )"+t.split(" ").join("|")+"( |$)","gi"),i=f(e).replace(o," ");d(e,i)}}function l(e,t){if(void 0!==e.classList)t.split(" ").forEach(function(t){t.trim()&&e.classList.add(t)});else{r(e,t);var o=f(e)+" "+t;d(e,o)}}function h(t,e){if(void 0!==t.classList)return t.classList.contains(e);var o=f(t);return new RegExp("(^| )"+e+"( |$)","gi").test(o)}function f(t){return t.className instanceof t.ownerDocument.defaultView.SVGAnimatedString?t.className.baseVal:t.className}function d(t,e){t.setAttribute("class",e)}function T(e,o,t){t.forEach(function(t){-1===o.indexOf(t)&&h(e,t)&&r(e,t)}),o.forEach(function(t){h(e,t)||l(e,t)})}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m(t,e){var o=arguments.length<=2||void 0===arguments[2]?1:arguments[2];return e<=t+o&&t-o<=e}function p(){return"undefined"!=typeof performance&&void 0!==performance.now?performance.now():+new Date}function E(){for(var i={top:0,left:0},t=arguments.length,e=Array(t),o=0;o<t;o++)e[o]=arguments[o];return e.forEach(function(t){var e=t.top,o=t.left;"string"==typeof e&&(e=parseFloat(e,10)),"string"==typeof o&&(o=parseFloat(o,10)),i.top+=e,i.left+=o}),i}function S(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t}var P=void 0;function c(t,e){for(var o=0;o<e.length;o++){var i=e[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}void 0===P&&(P={modules:[]});var u,g=null,v=(u=0,function(){return++u}),b={},y=function(){var t=g;t||((t=document.createElement("div")).setAttribute("data-tether-id",v()),A(t.style,{top:0,left:0,position:"absolute"}),document.body.appendChild(t),g=t);var e=t.getAttribute("data-tether-id");return void 0===b[e]&&(b[e]=s(t),W(function(){delete b[e]})),b[e]},w=null,M=[],W=function(t){M.push(t)},k=function(){for(var t=void 0;t=M.pop();)t()},_=((j=function(t,e,o){return e&&c(t.prototype,e),o&&c(t,o),t})(B,[{key:"on",value:function(t,e,o){var i=!(arguments.length<=3||void 0===arguments[3])&&arguments[3];void 0===this.bindings&&(this.bindings={}),void 0===this.bindings[t]&&(this.bindings[t]=[]),this.bindings[t].push({handler:e,ctx:o,once:i})}},{key:"once",value:function(t,e,o){this.on(t,e,o,!0)}},{key:"off",value:function(t,e){if(void 0!==this.bindings&&void 0!==this.bindings[t])if(void 0===e)delete this.bindings[t];else for(var o=0;o<this.bindings[t].length;)this.bindings[t][o].handler===e?this.bindings[t].splice(o,1):++o}},{key:"trigger",value:function(t){if(void 0!==this.bindings&&this.bindings[t]){for(var e=0,o=arguments.length,i=Array(1<o?o-1:0),n=1;n<o;n++)i[n-1]=arguments[n];for(;e<this.bindings[t].length;){var r=this.bindings[t][e],s=r.handler,a=r.ctx,l=r.once,h=a;void 0===h&&(h=this),s.apply(h,i),l?this.bindings[t].splice(e,1):++e}}}}]),B);function B(){i(this,B)}P.Utils={getActualBoundingClientRect:s,getScrollParents:a,getBounds:x,getOffsetParent:C,extend:A,addClass:l,removeClass:r,hasClass:h,updateClasses:T,defer:W,flush:k,uniqueId:v,Evented:_,getScrollBarSize:O,removeUtilElements:n};var z=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var o=[],i=!0,n=!1,r=void 0;try{for(var s,a=t[Symbol.iterator]();!(i=(s=a.next()).done)&&(o.push(s.value),!e||o.length!==e);i=!0);}catch(t){n=!0,r=t}finally{try{!i&&a.return&&a.return()}finally{if(n)throw r}}return o}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},j=function(t,e,o){return e&&Y(t.prototype,e),o&&Y(t,o),t};function Y(t,e){for(var o=0;o<e.length;o++){var i=e[o];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}if(void 0===P)throw new Error("You must include the utils.js file before tether.js");function L(){N.forEach(function(t){t.position(!1)}),k()}var D,X,F,a=(tt=P.Utils).getScrollParents,C=(x=tt.getBounds,tt.getOffsetParent),l=(A=tt.extend,tt.addClass),r=tt.removeClass,O=(T=tt.updateClasses,W=tt.defer,k=tt.flush,tt.getScrollBarSize),n=tt.removeUtilElements,H=function(){if("undefined"==typeof document)return"";for(var t=document.createElement("div"),e=["transform","WebkitTransform","OTransform","MozTransform","msTransform"],o=0;o<e.length;++o){var i=e[o];if(void 0!==t.style[i])return i}}(),N=[];function U(){return void 0!==X&&16<X?(X=Math.min(X-16,250),void(F=setTimeout(U,250))):void(void 0!==D&&p()-D<10||(null!=F&&(clearTimeout(F),F=null),D=p(),L(),X=p()-D))}F=X=D=null,"undefined"!=typeof window&&void 0!==window.addEventListener&&["resize","scroll","touchmove"].forEach(function(t){window.addEventListener(t,U)});function V(t){var e=t.left,o=t.top;return void 0!==$[t.left]&&(e=$[t.left]),void 0!==$[t.top]&&(o=$[t.top]),{left:e,top:o}}function R(t){var e=t.split(" "),o=z(e,2);return{top:o[0],left:o[1]}}var q={center:"center",left:"right",right:"left"},I={middle:"middle",top:"bottom",bottom:"top"},$={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},G=R,Z=(function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(J,_),j(J,[{key:"getClass",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"":arguments[0],e=this.options.classes;return void 0!==e&&e[t]?this.options.classes[t]:this.options.classPrefix?this.options.classPrefix+"-"+t:t}},{key:"setOptions",value:function(t){var e=this,o=arguments.length<=1||void 0===arguments[1]||arguments[1];this.options=A({offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},t);var i=this.options,n=i.element,r=i.target,s=i.targetModifier;if(this.element=n,this.target=r,this.targetModifier=s,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),["element","target"].forEach(function(t){if(void 0===e[t])throw new Error("Tether Error: Both element and target must be defined");void 0!==e[t].jquery?e[t]=e[t][0]:"string"==typeof e[t]&&(e[t]=document.querySelector(e[t]))}),l(this.element,this.getClass("element")),!1!==this.options.addTargetClasses&&l(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");this.targetAttachment=G(this.options.targetAttachment),this.attachment=G(this.options.attachment),this.offset=R(this.options.offset),this.targetOffset=R(this.options.targetOffset),void 0!==this.scrollParents&&this.disable(),"scroll-handle"===this.targetModifier?this.scrollParents=[this.target]:this.scrollParents=a(this.target),!1!==this.options.enabled&&this.enable(o)}},{key:"getTargetBounds",value:function(){if(void 0===this.targetModifier)return x(this.target);if("visible"===this.targetModifier)return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:((r={height:(t=x(this.target)).height,width:t.width,top:t.top,left:t.left}).height=Math.min(r.height,t.height-(pageYOffset-t.top)),r.height=Math.min(r.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),r.height=Math.min(innerHeight,r.height),r.height-=2,r.width=Math.min(r.width,t.width-(pageXOffset-t.left)),r.width=Math.min(r.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),r.width=Math.min(innerWidth,r.width),r.width-=2,r.top<pageYOffset&&(r.top=pageYOffset),r.left<pageXOffset&&(r.left=pageXOffset),r);if("scroll-handle"===this.targetModifier){var t=void 0,e=this.target;t=e===document.body?(e=document.documentElement,{left:pageXOffset,top:pageYOffset,height:innerHeight,width:innerWidth}):x(e);var o=getComputedStyle(e),i=0;(e.scrollWidth>e.clientWidth||0<=[o.overflow,o.overflowX].indexOf("scroll")||this.target!==document.body)&&(i=15);var n=t.height-parseFloat(o.borderTopWidth)-parseFloat(o.borderBottomWidth)-i,r={width:15,height:.975*n*(n/e.scrollHeight),left:t.left+t.width-parseFloat(o.borderLeftWidth)-15},s=0;n<408&&this.target===document.body&&(s=-11e-5*Math.pow(n,2)-.00727*n+22.58),this.target!==document.body&&(r.height=Math.max(r.height,24));var a=this.target.scrollTop/(e.scrollHeight-n);return r.top=a*(n-r.height-s)+t.top+parseFloat(o.borderTopWidth),this.target===document.body&&(r.height=Math.max(r.height,24)),r}}},{key:"clearCache",value:function(){this._cache={}}},{key:"cache",value:function(t,e){return void 0===this._cache&&(this._cache={}),void 0===this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]}},{key:"enable",value:function(){var e=this,t=arguments.length<=0||void 0===arguments[0]||arguments[0];!1!==this.options.addTargetClasses&&l(this.target,this.getClass("enabled")),l(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParents.forEach(function(t){t!==e.target.ownerDocument&&t.addEventListener("scroll",e.position)}),t&&this.position()}},{key:"disable",value:function(){var e=this;r(this.target,this.getClass("enabled")),r(this.element,this.getClass("enabled")),this.enabled=!1,void 0!==this.scrollParents&&this.scrollParents.forEach(function(t){t.removeEventListener("scroll",e.position)})}},{key:"destroy",value:function(){var o=this;this.disable(),N.forEach(function(t,e){t===o&&N.splice(e,1)}),0===N.length&&n()}},{key:"updateAttachClasses",value:function(t,e){var o=this;t=t||this.attachment,e=e||this.targetAttachment,void 0!==this._addAttachClasses&&this._addAttachClasses.length&&this._addAttachClasses.splice(0,this._addAttachClasses.length),void 0===this._addAttachClasses&&(this._addAttachClasses=[]);var i=this._addAttachClasses;t.top&&i.push(this.getClass("element-attached")+"-"+t.top),t.left&&i.push(this.getClass("element-attached")+"-"+t.left),e.top&&i.push(this.getClass("target-attached")+"-"+e.top),e.left&&i.push(this.getClass("target-attached")+"-"+e.left);var n=[];["left","top","bottom","right","middle","center"].forEach(function(t){n.push(o.getClass("element-attached")+"-"+t),n.push(o.getClass("target-attached")+"-"+t)}),W(function(){void 0!==o._addAttachClasses&&(T(o.element,o._addAttachClasses,n),!1!==o.options.addTargetClasses&&T(o.target,o._addAttachClasses,n),delete o._addAttachClasses)})}},{key:"position",value:function(){var a=this,t=arguments.length<=0||void 0===arguments[0]||arguments[0];if(this.enabled){this.clearCache();var e=function(t,e){var o=t.left,i=t.top;return"auto"===o&&(o=q[e.left]),"auto"===i&&(i=I[e.top]),{left:o,top:i}}(this.targetAttachment,this.attachment);this.updateAttachClasses(this.attachment,e);var o=this.cache("element-bounds",function(){return x(a.element)}),i=o.width,n=o.height;if(0===i&&0===n&&void 0!==this.lastSize){var r=this.lastSize;i=r.width,n=r.height}else this.lastSize={width:i,height:n};var s=this.cache("target-bounds",function(){return a.getTargetBounds()}),l=s,h=S(V(this.attachment),{width:i,height:n}),f=S(V(e),l),d=S(this.offset,{width:i,height:n}),p=S(this.targetOffset,l);h=E(h,d),f=E(f,p);for(var c=s.left+f.left-h.left,u=s.top+f.top-h.top,g=0;g<P.modules.length;++g){var m=P.modules[g].position.call(this,{left:c,top:u,targetAttachment:e,targetPos:s,elementPos:o,offset:h,targetOffset:f,manualOffset:d,manualTargetOffset:p,scrollbarSize:w,attachment:this.attachment});if(!1===m)return!1;void 0!==m&&"object"==typeof m&&(u=m.top,c=m.left)}var v={page:{top:u,left:c},viewport:{top:u-pageYOffset,bottom:pageYOffset-u-n+innerHeight,left:c-pageXOffset,right:pageXOffset-c-i+innerWidth}},b=this.target.ownerDocument,y=b.defaultView,w=void 0;return y.innerHeight>b.documentElement.clientHeight&&(w=this.cache("scrollbar-size",O),v.viewport.bottom-=w.height),y.innerWidth>b.documentElement.clientWidth&&(w=this.cache("scrollbar-size",O),v.viewport.right-=w.width),-1!==["","static"].indexOf(b.body.style.position)&&-1!==["","static"].indexOf(b.body.parentElement.style.position)||(v.page.bottom=b.body.scrollHeight-u-n,v.page.right=b.body.scrollWidth-c-i),void 0!==this.options.optimizations&&!1!==this.options.optimizations.moveElement&&void 0===this.targetModifier&&function(){var t=a.cache("target-offsetparent",function(){return C(a.target)}),e=a.cache("target-offsetparent-bounds",function(){return x(t)}),o=getComputedStyle(t),i=e,n={};if(["Top","Left","Bottom","Right"].forEach(function(t){n[t.toLowerCase()]=parseFloat(o["border"+t+"Width"])}),e.right=b.body.scrollWidth-e.left-i.width+n.right,e.bottom=b.body.scrollHeight-e.top-i.height+n.bottom,v.page.top>=e.top+n.top&&v.page.bottom>=e.bottom&&v.page.left>=e.left+n.left&&v.page.right>=e.right){var r=t.scrollTop,s=t.scrollLeft;v.offset={top:v.page.top-e.top+r-n.top,left:v.page.left-e.left+s-n.left}}}(),this.move(v),this.history.unshift(v),3<this.history.length&&this.history.pop(),t&&k(),!0}}},{key:"move",value:function(e){var n=this;if(void 0!==this.element.parentNode){var o={};for(var t in e)for(var i in o[t]={},e[t]){for(var r=!1,s=0;s<this.history.length;++s){var a=this.history[s];if(void 0!==a[t]&&!m(a[t][i],e[t][i])){r=!0;break}}r||(o[t][i]=!0)}var l={top:"",left:"",right:"",bottom:""},h=function(t,e){if(!1!==(void 0!==n.options.optimizations?n.options.optimizations.gpu:null)){var o=void 0,i=void 0;o=t.top?(l.top=0,e.top):(l.bottom=0,-e.bottom),i=t.left?(l.left=0,e.left):(l.right=0,-e.right),window.matchMedia&&(window.matchMedia("only screen and (min-resolution: 1.3dppx)").matches||window.matchMedia("only screen and (-webkit-min-device-pixel-ratio: 1.3)").matches||(i=Math.round(i),o=Math.round(o))),l[H]="translateX("+i+"px) translateY("+o+"px)","msTransform"!==H&&(l[H]+=" translateZ(0)")}else t.top?l.top=e.top+"px":l.bottom=e.bottom+"px",t.left?l.left=e.left+"px":l.right=e.right+"px"},f=!1;if((o.page.top||o.page.bottom)&&(o.page.left||o.page.right)?(l.position="absolute",h(o.page,e.page)):(o.viewport.top||o.viewport.bottom)&&(o.viewport.left||o.viewport.right)?(l.position="fixed",h(o.viewport,e.viewport)):void 0!==o.offset&&o.offset.top&&o.offset.left?function(){l.position="absolute";var t=n.cache("target-offsetparent",function(){return C(n.target)});C(n.element)!==t&&W(function(){n.element.parentNode.removeChild(n.element),t.appendChild(n.element)}),h(o.offset,e.offset),f=!0}():(l.position="absolute",h({top:!0,left:!0},e.page)),!f){for(var d=!0,p=this.element.parentNode;p&&1===p.nodeType&&"BODY"!==p.tagName;){if("static"!==getComputedStyle(p).position){d=!1;break}p=p.parentNode}d||(this.element.parentNode.removeChild(this.element),this.element.ownerDocument.body.appendChild(this.element))}var c={},u=!1;for(var i in l){var g=l[i];this.element.style[i]!==g&&(u=!0,c[i]=g)}u&&W(function(){A(n.element.style,c),n.trigger("repositioned")})}}}]),J);function J(t){var e=this;i(this,J),function(t,e,o){for(var i=!0;i;){var n=t,r=e,s=o;i=!1,null===n&&(n=Function.prototype);var a=Object.getOwnPropertyDescriptor(n,r);if(void 0!==a){if("value"in a)return a.value;var l=a.get;if(void 0===l)return;return l.call(s)}var h=Object.getPrototypeOf(n);if(null===h)return;t=h,e=r,o=s,i=!0,a=h=void 0}}(Object.getPrototypeOf(J.prototype),"constructor",this).call(this),this.position=this.position.bind(this),N.push(this),this.history=[],this.setOptions(t,!1),P.modules.forEach(function(t){void 0!==t.initialize&&t.initialize.call(e)}),this.position()}Z.modules=[],P.position=L;var K=A(Z,P),A=(z=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var o=[],i=!0,n=!1,r=void 0;try{for(var s,a=t[Symbol.iterator]();!(i=(s=a.next()).done)&&(o.push(s.value),!e||o.length!==e);i=!0);}catch(t){n=!0,r=t}finally{try{!i&&a.return&&a.return()}finally{if(n)throw r}}return o}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},x=(tt=P.Utils).getBounds,tt.extend),Q=(T=tt.updateClasses,W=tt.defer,["left","top","right","bottom"]);P.modules.push({position:function(t){var c=this,u=t.top,g=t.left,m=t.targetAttachment;if(!this.options.constraints)return!0;var e=this.cache("element-bounds",function(){return x(c.element)}),v=e.height,b=e.width;if(0===b&&0===v&&void 0!==this.lastSize){var o=this.lastSize;b=o.width,v=o.height}var i=this.cache("target-bounds",function(){return c.getTargetBounds()}),y=i.height,w=i.width,n=[this.getClass("pinned"),this.getClass("out-of-bounds")];this.options.constraints.forEach(function(t){var e=t.outOfBoundsClass,o=t.pinnedClass;e&&n.push(e),o&&n.push(o)}),n.forEach(function(e){["left","top","right","bottom"].forEach(function(t){n.push(e+"-"+t)})});var C=[],O=A({},m),E=A({},this.attachment);return this.options.constraints.forEach(function(t){var e=t.to,o=t.attachment,i=t.pin;void 0===o&&(o="");var n=void 0,r=void 0;if(0<=o.indexOf(" ")){var s=o.split(" "),a=z(s,2);r=a[0],n=a[1]}else n=r=o;var l=function(t,r){return"scrollParent"===r?r=t.scrollParents[0]:"window"===r&&(r=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),r===document&&(r=r.documentElement),void 0!==r.nodeType&&function(){var t=r,e=x(r),o=e,i=getComputedStyle(r);if(r=[o.left,o.top,e.width+o.left,e.height+o.top],t.ownerDocument!==document){var n=t.ownerDocument.defaultView;r[0]+=n.pageXOffset,r[1]+=n.pageYOffset,r[2]+=n.pageXOffset,r[3]+=n.pageYOffset}Q.forEach(function(t,e){"Top"===(t=t[0].toUpperCase()+t.substr(1))||"Left"===t?r[e]+=parseFloat(i["border"+t+"Width"]):r[e]-=parseFloat(i["border"+t+"Width"])})}(),r}(c,e);"target"!==r&&"both"!==r||(u<l[1]&&"top"===O.top&&(u+=y,O.top="bottom"),u+v>l[3]&&"bottom"===O.top&&(u-=y,O.top="top")),"together"===r&&("top"===O.top&&("bottom"===E.top&&u<l[1]?(u+=y,O.top="bottom",u+=v,E.top="top"):"top"===E.top&&u+v>l[3]&&u-(v-y)>=l[1]&&(u-=v-y,O.top="bottom",E.top="bottom")),"bottom"===O.top&&("top"===E.top&&u+v>l[3]?(u-=y,O.top="top",u-=v,E.top="bottom"):"bottom"===E.top&&u<l[1]&&u+(2*v-y)<=l[3]&&(u+=v-y,O.top="top",E.top="top")),"middle"===O.top&&(u+v>l[3]&&"top"===E.top?(u-=v,E.top="bottom"):u<l[1]&&"bottom"===E.top&&(u+=v,E.top="top"))),"target"!==n&&"both"!==n||(g<l[0]&&"left"===O.left&&(g+=w,O.left="right"),g+b>l[2]&&"right"===O.left&&(g-=w,O.left="left")),"together"===n&&(g<l[0]&&"left"===O.left?"right"===E.left?(g+=w,O.left="right",g+=b,E.left="left"):"left"===E.left&&(g+=w,O.left="right",g-=b,E.left="right"):g+b>l[2]&&"right"===O.left?"left"===E.left?(g-=w,O.left="left",g-=b,E.left="right"):"right"===E.left&&(g-=w,O.left="left",g+=b,E.left="left"):"center"===O.left&&(g+b>l[2]&&"left"===E.left?(g-=b,E.left="right"):g<l[0]&&"right"===E.left&&(g+=b,E.left="left"))),"element"!==r&&"both"!==r||(u<l[1]&&"bottom"===E.top&&(u+=v,E.top="top"),u+v>l[3]&&"top"===E.top&&(u-=v,E.top="bottom")),"element"!==n&&"both"!==n||(g<l[0]&&("right"===E.left?(g+=b,E.left="left"):"center"===E.left&&(g+=b/2,E.left="left")),g+b>l[2]&&("left"===E.left?(g-=b,E.left="right"):"center"===E.left&&(g-=b/2,E.left="right"))),"string"==typeof i?i=i.split(",").map(function(t){return t.trim()}):!0===i&&(i=["top","left","right","bottom"]),i=i||[];var h,f,d=[],p=[];u<l[1]&&(0<=i.indexOf("top")?(u=l[1],d.push("top")):p.push("top")),u+v>l[3]&&(0<=i.indexOf("bottom")?(u=l[3]-v,d.push("bottom")):p.push("bottom")),g<l[0]&&(0<=i.indexOf("left")?(g=l[0],d.push("left")):p.push("left")),g+b>l[2]&&(0<=i.indexOf("right")?(g=l[2]-b,d.push("right")):p.push("right")),d.length&&(f=void 0!==c.options.pinnedClass?c.options.pinnedClass:c.getClass("pinned"),C.push(f),d.forEach(function(t){C.push(f+"-"+t)})),p.length&&(h=void 0!==c.options.outOfBoundsClass?c.options.outOfBoundsClass:c.getClass("out-of-bounds"),C.push(h),p.forEach(function(t){C.push(h+"-"+t)})),(0<=d.indexOf("left")||0<=d.indexOf("right"))&&(E.left=O.left=!1),(0<=d.indexOf("top")||0<=d.indexOf("bottom"))&&(E.top=O.top=!1),O.top===m.top&&O.left===m.left&&E.top===c.attachment.top&&E.left===c.attachment.left||(c.updateAttachClasses(E,O),c.trigger("update",{attachment:E,targetAttachment:O}))}),W(function(){!1!==c.options.addTargetClasses&&T(c.target,C,n),T(c.element,C,n)}),{top:u,left:g}}});var tt,x=(tt=P.Utils).getBounds,T=tt.updateClasses;W=tt.defer;P.modules.push({position:function(t){var e=this,o=t.top,i=t.left,n=this.cache("element-bounds",function(){return x(e.element)}),r=n.height,s=n.width,a=this.getTargetBounds(),l=o+r,h=i+s,f=[];o<=a.bottom&&l>=a.top&&["left","right"].forEach(function(t){var e=a[t];e!==i&&e!==h||f.push(t)}),i<=a.right&&h>=a.left&&["top","bottom"].forEach(function(t){var e=a[t];e!==o&&e!==l||f.push(t)});var d=[],p=[];return d.push(this.getClass("abutted")),["left","top","right","bottom"].forEach(function(t){d.push(e.getClass("abutted")+"-"+t)}),f.length&&p.push(this.getClass("abutted")),f.forEach(function(t){p.push(e.getClass("abutted")+"-"+t)}),W(function(){!1!==e.options.addTargetClasses&&T(e.target,p,d),T(e.element,p,d)}),!0}});z=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var o=[],i=!0,n=!1,r=void 0;try{for(var s,a=t[Symbol.iterator]();!(i=(s=a.next()).done)&&(o.push(s.value),!e||o.length!==e);i=!0);}catch(t){n=!0,r=t}finally{try{!i&&a.return&&a.return()}finally{if(n)throw r}}return o}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")};return P.modules.push({position:function(t){var e=t.top,o=t.left;if(this.options.shift){var i=this.options.shift;"function"==typeof this.options.shift&&(i=this.options.shift.call(this,{top:e,left:o}));var n=void 0,r=void 0;if("string"==typeof i){(i=i.split(" "))[1]=i[1]||i[0];var s=z(i,2);n=s[0],r=s[1],n=parseFloat(n,10),r=parseFloat(r,10)}else n=i.top,r=i.left;return{top:e+=n,left:o+=r}}}}),K});