Welcome to mirror list, hosted at ThFree Co, Russian Federation.

tether.min.js « tether « vendor « dist « js « static - github.com/mikeblum/hugo-now.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4c9e13c65df51f4b215035c60626f3239d7e2625 (plain)
1
!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";var i=function(){function t(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)}}return function(e,o,i){return o&&t(e.prototype,o),i&&t(e,i),e}}();function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=void 0;void 0===r&&(r={modules:[]});var s=null;function a(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=a(n);o.top+=r.top,o.bottom+=r.top,o.left+=r.left,o.right+=r.left}}return o}function l(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||["relative","absolute","fixed"].indexOf(n.position)>=0)&&o.push(i)}return o.push(t.ownerDocument.body),t.ownerDocument!==document&&o.push(t.ownerDocument.defaultView),o}var h,f=(h=0,function(){return++h}),d={},p=function(){var t=s;t&&document.body.contains(t)||((t=document.createElement("div")).setAttribute("data-tether-id",f()),b(t.style,{top:0,left:0,position:"absolute"}),document.body.appendChild(t),s=t);var e=t.getAttribute("data-tether-id");return void 0===d[e]&&(d[e]=a(t),T(function(){delete d[e]})),d[e]};function u(){s&&document.body.removeChild(s),s=null}function c(t){var e=void 0;t===document?(e=document,t=document.documentElement):e=t.ownerDocument;var o=e.documentElement,i=a(t),n=p();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 g(t){return t.offsetParent||document.documentElement}var m=null;function v(){if(m)return m;var t=document.createElement("div");t.style.width="100%",t.style.height="200px";var e=document.createElement("div");b(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 m={width:n,height:n}}function b(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],e=[];return Array.prototype.push.apply(e,arguments),e.slice(1).forEach(function(e){if(e)for(var o in e)({}).hasOwnProperty.call(e,o)&&(t[o]=e[o])}),t}function y(t,e){if(void 0!==t.classList)e.split(" ").forEach(function(e){e.trim()&&t.classList.remove(e)});else{var o=new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi"),i=O(t).replace(o," ");E(t,i)}}function w(t,e){if(void 0!==t.classList)e.split(" ").forEach(function(e){e.trim()&&t.classList.add(e)});else{y(t,e);var o=O(t)+" "+e;E(t,o)}}function C(t,e){if(void 0!==t.classList)return t.classList.contains(e);var o=O(t);return new RegExp("(^| )"+e+"( |$)","gi").test(o)}function O(t){return t.className instanceof t.ownerDocument.defaultView.SVGAnimatedString?t.className.baseVal:t.className}function E(t,e){t.setAttribute("class",e)}function x(t,e,o){o.forEach(function(o){-1===e.indexOf(o)&&C(t,o)&&y(t,o)}),e.forEach(function(e){C(t,e)||w(t,e)})}var A=[],T=function(t){A.push(t)},S=function(){for(var t=void 0;t=A.pop();)t()},P=function(){function t(){n(this,t)}return i(t,[{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(o>1?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}}}}]),t}();r.Utils={getActualBoundingClientRect:a,getScrollParents:l,getBounds:c,getOffsetParent:g,extend:b,addClass:w,removeClass:y,hasClass:C,updateClasses:x,defer:T,flush:S,uniqueId:f,Evented:P,getScrollBarSize:v,removeUtilElements:u};var M=function(){return 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")}}(),W=(i=function(){function t(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)}}return function(e,o,i){return o&&t(e.prototype,o),i&&t(e,i),e}}(),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}});function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}if(void 0===r)throw new Error("You must include the utils.js file before tether.js");var l=(J=r.Utils).getScrollParents,g=(c=J.getBounds,J.getOffsetParent),w=(b=J.extend,J.addClass),y=J.removeClass,v=(x=J.updateClasses,T=J.defer,S=J.flush,J.getScrollBarSize),u=J.removeUtilElements;function k(t,e){var o=arguments.length<=2||void 0===arguments[2]?1:arguments[2];return t+o>=e&&e>=t-o}var _,B,z,j,Y=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}}(),L=[],D=function(){L.forEach(function(t){t.position(!1)}),S()};function X(){return"undefined"!=typeof performance&&void 0!==performance.now?performance.now():+new Date}_=null,B=null,z=null,j=function t(){if(void 0!==B&&B>16)return B=Math.min(B-16,250),void(z=setTimeout(t,250));void 0!==_&&X()-_<10||(null!=z&&(clearTimeout(z),z=null),_=X(),D(),B=X()-_)},"undefined"!=typeof window&&void 0!==window.addEventListener&&["resize","scroll","touchmove"].forEach(function(t){window.addEventListener(t,j)});var F={center:"center",left:"right",right:"left"},H={middle:"middle",top:"bottom",bottom:"top"},N={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},U=function(t){var e=t.left,o=t.top;return void 0!==N[t.left]&&(e=N[t.left]),void 0!==N[t.top]&&(o=N[t.top]),{left:e,top:o}};function V(){for(var t={top:0,left:0},e=arguments.length,o=Array(e),i=0;i<e;i++)o[i]=arguments[i];return o.forEach(function(e){var o=e.top,i=e.left;"string"==typeof o&&(o=parseFloat(o,10)),"string"==typeof i&&(i=parseFloat(i,10)),t.top+=o,t.left+=i}),t}function R(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 q=function(t){var e=t.split(" "),o=M(e,2);return{top:o[0],left:o[1]}},I=q,$=function(t){function e(t){var o=this;n(this,e),W(Object.getPrototypeOf(e.prototype),"constructor",this).call(this),this.position=this.position.bind(this),L.push(this),this.history=[],this.setOptions(t,!1),r.modules.forEach(function(t){void 0!==t.initialize&&t.initialize.call(o)}),this.position()}return 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)}(e,P),i(e,[{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=b({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]))}),w(this.element,this.getClass("element")),!1!==this.options.addTargetClasses&&w(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");this.targetAttachment=I(this.options.targetAttachment),this.attachment=I(this.options.attachment),this.offset=q(this.options.offset),this.targetOffset=q(this.options.targetOffset),void 0!==this.scrollParents&&this.disable(),"scroll-handle"===this.targetModifier?this.scrollParents=[this.target]:this.scrollParents=l(this.target),!1!==this.options.enabled&&this.enable(o)}},{key:"getTargetBounds",value:function(){if(void 0===this.targetModifier)return c(this.target);if("visible"===this.targetModifier)return this.target===document.body?{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth}:((r={height:(t=c(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;e===document.body?(e=document.documentElement,t={left:pageXOffset,top:pageYOffset,height:innerHeight,width:innerWidth}):t=c(e);var o=getComputedStyle(e),i=0;(e.scrollWidth>e.clientWidth||[o.overflow,o.overflowX].indexOf("scroll")>=0||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 t=this,e=arguments.length<=0||void 0===arguments[0]||arguments[0];!1!==this.options.addTargetClasses&&w(this.target,this.getClass("enabled")),w(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParents.forEach(function(e){e!==t.target.ownerDocument&&e.addEventListener("scroll",t.position)}),e&&this.position()}},{key:"disable",value:function(){var t=this;y(this.target,this.getClass("enabled")),y(this.element,this.getClass("enabled")),this.enabled=!1,void 0!==this.scrollParents&&this.scrollParents.forEach(function(e){e.removeEventListener("scroll",t.position)})}},{key:"destroy",value:function(){var t=this;this.disable(),L.forEach(function(e,o){e===t&&L.splice(o,1)}),0===L.length&&u()}},{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)}),T(function(){void 0!==o._addAttachClasses&&(x(o.element,o._addAttachClasses,n),!1!==o.options.addTargetClasses&&x(o.target,o._addAttachClasses,n),delete o._addAttachClasses)})}},{key:"position",value:function(){var t=this,e=arguments.length<=0||void 0===arguments[0]||arguments[0];if(this.enabled){this.clearCache();var o=function(t,e){var o=t.left,i=t.top;return"auto"===o&&(o=F[e.left]),"auto"===i&&(i=H[e.top]),{left:o,top:i}}(this.targetAttachment,this.attachment);this.updateAttachClasses(this.attachment,o);var i=this.cache("element-bounds",function(){return c(t.element)}),n=i.width,s=i.height;if(0===n&&0===s&&void 0!==this.lastSize){var a=this.lastSize;n=a.width,s=a.height}else this.lastSize={width:n,height:s};var l=this.cache("target-bounds",function(){return t.getTargetBounds()}),h=l,f=R(U(this.attachment),{width:n,height:s}),d=R(U(o),h),p=R(this.offset,{width:n,height:s}),u=R(this.targetOffset,h);f=V(f,p),d=V(d,u);for(var m=l.left+d.left-f.left,b=l.top+d.top-f.top,y=0;y<r.modules.length;++y){var w=r.modules[y].position.call(this,{left:m,top:b,targetAttachment:o,targetPos:l,elementPos:i,offset:f,targetOffset:d,manualOffset:p,manualTargetOffset:u,scrollbarSize:x,attachment:this.attachment});if(!1===w)return!1;void 0!==w&&"object"==typeof w&&(b=w.top,m=w.left)}var C={page:{top:b,left:m},viewport:{top:b-pageYOffset,bottom:pageYOffset-b-s+innerHeight,left:m-pageXOffset,right:pageXOffset-m-n+innerWidth}},O=this.target.ownerDocument,E=O.defaultView,x=void 0;return E.innerHeight>O.documentElement.clientHeight&&(x=this.cache("scrollbar-size",v),C.viewport.bottom-=x.height),E.innerWidth>O.documentElement.clientWidth&&(x=this.cache("scrollbar-size",v),C.viewport.right-=x.width),-1!==["","static"].indexOf(O.body.style.position)&&-1!==["","static"].indexOf(O.body.parentElement.style.position)||(C.page.bottom=O.body.scrollHeight-b-s,C.page.right=O.body.scrollWidth-m-n),void 0!==this.options.optimizations&&!1!==this.options.optimizations.moveElement&&void 0===this.targetModifier&&function(){var e=t.cache("target-offsetparent",function(){return g(t.target)}),o=t.cache("target-offsetparent-bounds",function(){return c(e)}),i=getComputedStyle(e),n=o,r={};if(["Top","Left","Bottom","Right"].forEach(function(t){r[t.toLowerCase()]=parseFloat(i["border"+t+"Width"])}),o.right=O.body.scrollWidth-o.left-n.width+r.right,o.bottom=O.body.scrollHeight-o.top-n.height+r.bottom,C.page.top>=o.top+r.top&&C.page.bottom>=o.bottom&&C.page.left>=o.left+r.left&&C.page.right>=o.right){var s=e.scrollTop,a=e.scrollLeft;C.offset={top:C.page.top-o.top+s-r.top,left:C.page.left-o.left+a-r.left}}}(),this.move(C),this.history.unshift(C),this.history.length>3&&this.history.pop(),e&&S(),!0}}},{key:"move",value:function(t){var e=this;if(void 0!==this.element.parentNode){var o={};for(var i in t)for(var n in o[i]={},t[i]){for(var r=!1,s=0;s<this.history.length;++s){var a=this.history[s];if(void 0!==a[i]&&!k(a[i][n],t[i][n])){r=!0;break}}r||(o[i][n]=!0)}var l={top:"",left:"",right:"",bottom:""},h=function(t,o){if(!1!==(void 0!==e.options.optimizations?e.options.optimizations.gpu:null)){var i=void 0,n=void 0;if(t.top?(l.top=0,i=o.top):(l.bottom=0,i=-o.bottom),t.left?(l.left=0,n=o.left):(l.right=0,n=-o.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||(n=Math.round(n),i=Math.round(i));l[Y]="translateX("+n+"px) translateY("+i+"px)","msTransform"!==Y&&(l[Y]+=" translateZ(0)")}else t.top?l.top=o.top+"px":l.bottom=o.bottom+"px",t.left?l.left=o.left+"px":l.right=o.right+"px"},f=!1;if((o.page.top||o.page.bottom)&&(o.page.left||o.page.right)?(l.position="absolute",h(o.page,t.page)):(o.viewport.top||o.viewport.bottom)&&(o.viewport.left||o.viewport.right)?(l.position="fixed",h(o.viewport,t.viewport)):void 0!==o.offset&&o.offset.top&&o.offset.left?function(){l.position="absolute";var i=e.cache("target-offsetparent",function(){return g(e.target)});g(e.element)!==i&&T(function(){e.element.parentNode.removeChild(e.element),i.appendChild(e.element)}),h(o.offset,t.offset),f=!0}():(l.position="absolute",h({top:!0,left:!0},t.page)),!f)if(this.options.bodyElement)this.options.bodyElement.appendChild(this.element);else{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 u={},c=!1;for(var n in l){var m=l[n];this.element.style[n]!==m&&(c=!0,u[n]=m)}c&&T(function(){b(e.element.style,u),e.trigger("repositioned")})}}}]),e}();$.modules=[],r.position=D;var G=b($,r),b=(M=function(){return 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")}}(),c=(J=r.Utils).getBounds,J.extend),Z=(x=J.updateClasses,T=J.defer,["left","top","right","bottom"]);r.modules.push({position:function(t){var e=this,o=t.top,i=t.left,n=t.targetAttachment;if(!this.options.constraints)return!0;var r=this.cache("element-bounds",function(){return c(e.element)}),s=r.height,a=r.width;if(0===a&&0===s&&void 0!==this.lastSize){var l=this.lastSize;a=l.width,s=l.height}var h=this.cache("target-bounds",function(){return e.getTargetBounds()}),f=h.height,d=h.width,p=[this.getClass("pinned"),this.getClass("out-of-bounds")];this.options.constraints.forEach(function(t){var e=t.outOfBoundsClass,o=t.pinnedClass;e&&p.push(e),o&&p.push(o)}),p.forEach(function(t){["left","top","right","bottom"].forEach(function(e){p.push(t+"-"+e)})});var u=[],g=b({},n),m=b({},this.attachment);return this.options.constraints.forEach(function(t){var r=t.to,l=t.attachment,h=t.pin;void 0===l&&(l="");var p=void 0,v=void 0;if(l.indexOf(" ")>=0){var b=l.split(" "),y=M(b,2);v=y[0],p=y[1]}else p=v=l;var w=function(t,e){return"scrollParent"===e?e=t.scrollParents[0]:"window"===e&&(e=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),e===document&&(e=e.documentElement),void 0!==e.nodeType&&function(){var t=e,o=c(e),i=o,n=getComputedStyle(e);if(e=[i.left,i.top,o.width+i.left,o.height+i.top],t.ownerDocument!==document){var r=t.ownerDocument.defaultView;e[0]+=r.pageXOffset,e[1]+=r.pageYOffset,e[2]+=r.pageXOffset,e[3]+=r.pageYOffset}Z.forEach(function(t,o){"Top"===(t=t[0].toUpperCase()+t.substr(1))||"Left"===t?e[o]+=parseFloat(n["border"+t+"Width"]):e[o]-=parseFloat(n["border"+t+"Width"])})}(),e}(e,r);"target"!==v&&"both"!==v||(o<w[1]&&"top"===g.top&&(o+=f,g.top="bottom"),o+s>w[3]&&"bottom"===g.top&&(o-=f,g.top="top")),"together"===v&&("top"===g.top&&("bottom"===m.top&&o<w[1]?(o+=f,g.top="bottom",o+=s,m.top="top"):"top"===m.top&&o+s>w[3]&&o-(s-f)>=w[1]&&(o-=s-f,g.top="bottom",m.top="bottom")),"bottom"===g.top&&("top"===m.top&&o+s>w[3]?(o-=f,g.top="top",o-=s,m.top="bottom"):"bottom"===m.top&&o<w[1]&&o+(2*s-f)<=w[3]&&(o+=s-f,g.top="top",m.top="top")),"middle"===g.top&&(o+s>w[3]&&"top"===m.top?(o-=s,m.top="bottom"):o<w[1]&&"bottom"===m.top&&(o+=s,m.top="top"))),"target"!==p&&"both"!==p||(i<w[0]&&"left"===g.left&&(i+=d,g.left="right"),i+a>w[2]&&"right"===g.left&&(i-=d,g.left="left")),"together"===p&&(i<w[0]&&"left"===g.left?"right"===m.left?(i+=d,g.left="right",i+=a,m.left="left"):"left"===m.left&&(i+=d,g.left="right",i-=a,m.left="right"):i+a>w[2]&&"right"===g.left?"left"===m.left?(i-=d,g.left="left",i-=a,m.left="right"):"right"===m.left&&(i-=d,g.left="left",i+=a,m.left="left"):"center"===g.left&&(i+a>w[2]&&"left"===m.left?(i-=a,m.left="right"):i<w[0]&&"right"===m.left&&(i+=a,m.left="left"))),"element"!==v&&"both"!==v||(o<w[1]&&"bottom"===m.top&&(o+=s,m.top="top"),o+s>w[3]&&"top"===m.top&&(o-=s,m.top="bottom")),"element"!==p&&"both"!==p||(i<w[0]&&("right"===m.left?(i+=a,m.left="left"):"center"===m.left&&(i+=a/2,m.left="left")),i+a>w[2]&&("left"===m.left?(i-=a,m.left="right"):"center"===m.left&&(i-=a/2,m.left="right"))),"string"==typeof h?h=h.split(",").map(function(t){return t.trim()}):!0===h&&(h=["top","left","right","bottom"]),h=h||[];var C,O,E=[],x=[];o<w[1]&&(h.indexOf("top")>=0?(o=w[1],E.push("top")):x.push("top")),o+s>w[3]&&(h.indexOf("bottom")>=0?(o=w[3]-s,E.push("bottom")):x.push("bottom")),i<w[0]&&(h.indexOf("left")>=0?(i=w[0],E.push("left")):x.push("left")),i+a>w[2]&&(h.indexOf("right")>=0?(i=w[2]-a,E.push("right")):x.push("right")),E.length&&(C=void 0,C=void 0!==e.options.pinnedClass?e.options.pinnedClass:e.getClass("pinned"),u.push(C),E.forEach(function(t){u.push(C+"-"+t)})),x.length&&(O=void 0,O=void 0!==e.options.outOfBoundsClass?e.options.outOfBoundsClass:e.getClass("out-of-bounds"),u.push(O),x.forEach(function(t){u.push(O+"-"+t)})),(E.indexOf("left")>=0||E.indexOf("right")>=0)&&(m.left=g.left=!1),(E.indexOf("top")>=0||E.indexOf("bottom")>=0)&&(m.top=g.top=!1),g.top===n.top&&g.left===n.left&&m.top===e.attachment.top&&m.left===e.attachment.left||(e.updateAttachClasses(m,g),e.trigger("update",{attachment:m,targetAttachment:g}))}),T(function(){!1!==e.options.addTargetClasses&&x(e.target,u,p),x(e.element,u,p)}),{top:o,left:i}}});var J,c=(J=r.Utils).getBounds,x=J.updateClasses;T=J.defer;r.modules.push({position:function(t){var e=this,o=t.top,i=t.left,n=this.cache("element-bounds",function(){return c(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)}),T(function(){!1!==e.options.addTargetClasses&&x(e.target,p,d),x(e.element,p,d)}),!0}});M=function(){return 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 r.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=M(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}}}}),G});