summaryrefslogtreecommitdiffstats
path: root/afm-client/bower_components/tether/js/tether.min.js
blob: e8993a1a73bf928af40e4578bffe69fbe413ac26 (plain)
1
2
/*! tether.js 0.2.9 */
(function(){var a,b,c,d,e,f,g,h,i={}.hasOwnProperty,j=[].slice;null==window.Tether&&(window.Tether={}),f=function(a){var b,c,d,e,f;if(c=getComputedStyle(a).position,"fixed"===c)return a;for(d=void 0,b=a;b=b.parentNode;){if(!(e=getComputedStyle(b)))return b;if(/(auto|scroll)/.test(e.overflow+e["overflow-y"]+e["overflow-x"])&&("absolute"!==c||"relative"===(f=e.position)||"absolute"===f||"fixed"===f))return b}return document.body},d=function(a){var b,d,e,f;return d=a.ownerDocument,e=d.documentElement,b=c({},a.getBoundingClientRect()),b.top=b.top+window.pageYOffset-e.clientTop,b.left=b.left+window.pageXOffset-e.clientLeft,b.right=d.body.clientWidth-b.width-b.left,b.bottom=d.body.clientHeight-b.height-b.top,b.height&&b.width||(f=getComputedStyle(a),b.height||(b.height=parseFloat(f.height)),b.width||(b.width=parseFloat(f.width))),b},e=function(a){return a.offsetParent||document.documentElement},c=function(a){var b,c,d,e,f,g,h;for(null==a&&(a={}),b=[],Array.prototype.push.apply(b,arguments),h=b.slice(1),f=0,g=h.length;g>f;f++)if(d=h[f])for(c in d)i.call(d,c)&&(e=d[c],a[c]=e);return a},h=function(a,b){var c,d,e,f,g;if(null!=a.classList){for(f=b.split(" "),g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(a.classList.remove(c));return g}return a.className=a.className.replace(new RegExp("(^| )"+b.split(" ").join("|")+"( |$)","gi")," ")},b=function(a,b){var c,d,e,f,g;if(null!=a.classList){for(f=b.split(" "),g=[],d=0,e=f.length;e>d;d++)c=f[d],g.push(a.classList.add(c));return g}return h(a,b),a.className+=" "+b},g=function(a,b){return null!=a.classList?a.classList.contains(b):new RegExp("(^| )"+b+"( |$)","gi").test(a.className)},a=function(){function a(){}return a.prototype.on=function(a,b,c,d){var e;return null==d&&(d=!1),null==this.bindings&&(this.bindings={}),null==(e=this.bindings)[a]&&(e[a]=[]),this.bindings[a].push({handler:b,ctx:c,once:d})},a.prototype.once=function(a,b,c){return this.on(a,b,c,!0)},a.prototype.off=function(a,b){var c,d,e;if(null!=(null!=(d=this.bindings)?d[a]:void 0)){if(null==b)return delete this.bindings[a];for(c=0,e=[];c<this.bindings[a].length;)this.bindings[a][c].handler===b?e.push(this.bindings[a].splice(c,1)):e.push(c++);return e}},a.prototype.trigger=function(){var a,b,c,d,e,f,g,h,i;if(c=arguments[0],a=2<=arguments.length?j.call(arguments,1):[],null!=(g=this.bindings)?g[c]:void 0){for(e=0,i=[];e<this.bindings[c].length;)h=this.bindings[c][e],d=h.handler,b=h.ctx,f=h.once,d.apply(null!=b?b:this,a),f?i.push(this.bindings[c].splice(e,1)):i.push(e++);return i}},a}(),Tether.Utils={getScrollParent:f,getBounds:d,getOffsetParent:e,extend:c,addClass:b,removeClass:h,hasClass:g,Evented:a}}).call(this),function(){var a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B=[].slice,C=function(a,b){return function(){return a.apply(b,arguments)}};for(z=Tether.Utils,n=z.getScrollParent,o=z.getSize,m=z.getOuterSize,k=z.getBounds,l=z.getOffsetParent,j=z.extend,d=z.addClass,u=z.removeClass,h=function(a,b){var c;return null==b&&(b=16),c=!1,function(){var d,e=this;if(!c)return d=arguments,c=!0,setTimeout(function(){return c=!1,a.apply(e,d)},b)}},v=[],t=function(){var a,b,c,d;for(d=[],b=0,c=v.length;c>b;b++)a=v[b],d.push(a.position());return d},p=null,A=["resize","scroll"],x=0,y=A.length;y>x;x++)i=A[x],window.addEventListener(i,function(){return null==p||new Date-p>16?(p=+new Date,t()):void 0});a={center:"center",left:"right",right:"left"},b={middle:"middle",top:"bottom",bottom:"top"},c={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},g=function(c,d){var e,f;return e=c.left,f=c.top,"auto"===e&&(e=a[d.left]),"auto"===f&&(f=b[d.top]),{left:e,top:f}},f=function(a){var b,d;return{left:null!=(b=c[a.left])?b:a.left,top:null!=(d=c[a.top])?d:a.top}},e=function(){var a,b,c,d,e,f,g;for(b=1<=arguments.length?B.call(arguments,0):[],c={top:0,left:0},e=0,f=b.length;f>e;e++)g=b[e],d=g.top,a=g.left,"string"==typeof d&&(d=parseFloat(d,10)),"string"==typeof a&&(a=parseFloat(a,10)),c.top+=d,c.left+=a;return c},q=function(a,b){return"string"==typeof a.left&&-1!==a.left.indexOf("%")&&(a.left=parseFloat(a.left,10)/100*b.width),"string"==typeof a.top&&-1!==a.top.indexOf("%")&&(a.top=parseFloat(a.top,10)/100*b.height),a},r=s=function(a){var b,c,d;return d=a.split(" "),c=d[0],b=d[1],{top:c,left:b}},w=function(){function a(a){this.position=C(this.position,this);var b,c,d,e,f;for(v.push(this),this.history=[],this.setOptions(a,!1),e=Tether.modules,c=0,d=e.length;d>c;c++)b=e[c],null!=(f=b.initialize)&&f.call(this);this.position()}return a.modules=[],a.prototype.getClass=function(a){var b,c;return(null!=(b=this.options.classes)?b[a]:void 0)?this.options.classes[a]:(null!=(c=this.options.classes)?c[a]:void 0)!==!1?this.options.classPrefix?""+this.options.classPrefix+"-"+a:a:""},a.prototype.setOptions=function(a,b){var c,e,f,g,h,i;for(this.options=a,null==b&&(b=!0),c={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"},this.options=j(c,this.options),h=this.options,this.element=h.element,this.target=h.target,this.targetModifier=h.targetModifier,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),i=["element","target"],f=0,g=i.length;g>f;f++)if(e=i[f],null!=this[e].jquery?this[e]=this[e][0]:"string"==typeof this[e]&&(this[e]=document.querySelector(this[e])),null==this[e])throw new Error("Tether Error: Both element and target must be defined");if(d(this.element,this.getClass("element")),d(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");return this.targetAttachment=r(this.options.targetAttachment),this.attachment=r(this.options.attachment),this.offset=s(this.options.offset),this.targetOffset=s(this.options.targetOffset),null!=this.scrollParent&&this.disable(),this.scrollParent=n(this.target),this.options.enabled!==!1?this.enable(b):void 0},a.prototype.getTargetBounds=function(){if(null==this.targetModifier)return k(this.target);switch(this.targetModifier){case"visible":return{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth};case"scroll-handle":return{top:pageYOffset+innerHeight*(pageYOffset/document.body.scrollHeight),left:innerWidth-15,height:.98*innerHeight*(innerHeight/document.body.scrollHeight),width:15}}},a.prototype.clearCache=function(){return this._cache={}},a.prototype.cache=function(a,b){return null==this._cache&&(this._cache={}),null==this._cache[a]&&(this._cache[a]=b.call(this)),this._cache[a]},a.prototype.enable=function(a){var b=this;return null==a&&(a=!0),this.addClass(this.getClass("enabled")),this.enabled=!0,this.scrollParent.addEventListener("scroll",this.position),a?setTimeout(function(){return b.position()}):void 0},a.prototype.disable=function(){return this.removeClass(this.getClass("enabled")),this.enabled=!1,null!=this.scrollParent?this.scrollParent.removeEventListener("scroll",this.position):void 0},a.prototype.destroy=function(){var a,b,c,d,e;for(this.disable(),e=[],a=c=0,d=v.length;d>c;a=++c){if(b=v[a],b===this){v.splice(a,1);break}e.push(void 0)}return e},a.prototype.updateAttachClasses=function(a,b){var c,d,e,f,g,h;for(null==a&&(a=this.attachment),null==b&&(b=this.targetAttachment),d=["left","top","bottom","right","middle","center"],e=0,g=d.length;g>e;e++)c=d[e],this.removeClass(""+this.getClass("element-attached")+"-"+c);for(a.top&&this.addClass(""+this.getClass("element-attached")+"-"+a.top),a.left&&this.addClass(""+this.getClass("element-attached")+"-"+a.left),f=0,h=d.length;h>f;f++)c=d[f],this.removeClass(""+this.getClass("target-attached")+"-"+c);return b.top&&this.addClass(""+this.getClass("target-attached")+"-"+b.top),b.left?this.addClass(""+this.getClass("target-attached")+"-"+b.left):void 0},a.prototype.addClass=function(a){return d(this.element,a),d(this.target,a)},a.prototype.removeClass=function(a){return u(this.element,a),u(this.target,a)},a.prototype.position=function(){var a,b,c,d,h,i,j,m,n,o,p,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K=this;if(this.enabled){for(this.clearCache(),x=g(this.targetAttachment,this.attachment),this.updateAttachClasses(this.attachment,x),a=this.cache("element-bounds",function(){return k(K.element)}),C=a.width,b=a.height,A=z=this.cache("target-bounds",function(){return K.getTargetBounds()}),m=q(f(this.attachment),{width:C,height:b}),y=q(f(x),A),d=q(this.offset,{width:C,height:b}),h=q(this.targetOffset,A),m=e(m,d),c=z.left+y.left-m.left,B=z.top+y.top-m.top,H=Tether.modules,D=0,F=H.length;F>D;D++)if(i=H[D],t=i.position.call(this,{left:c,top:B,targetAttachment:x,targetPos:z,elementPos:a,offset:m,targetOffset:y,manualOffset:d,manualTargetOffset:h}),null!=t&&"object"==typeof t){if(t===!1)return!1;B=t.top,c=t.left}if(j={page:{top:B,bottom:document.body.scrollHeight-B-b,left:c,right:document.body.scrollWidth-c-C},viewport:{top:B-pageYOffset,bottom:pageYOffset-B-b+innerHeight,left:c-pageXOffset,right:pageXOffset-c-C+innerWidth}},(null!=(I=this.options.optimizations)?I.moveElement:void 0)!==!1&&null==this.targetModifier){for(o=this.cache("target-offsetparent",function(){return l(K.target)}),s=this.cache("target-offsetparent-bounds",function(){return k(o)}),r=getComputedStyle(o),p=s,n={},J=["top","left","bottom","right"],E=0,G=J.length;G>E;E++)w=J[E],n[w]=parseFloat(r["border-"+w+"-width"]);s.left+=n.left,s.top+=n.top,s.right=document.body.scrollWidth-s.left-p.width,s.bottom=document.body.scrollHeight-s.top-p.height,j.page.top>=s.top&&j.page.bottom>=s.bottom&&j.page.left>=s.left&&j.page.right>=s.right&&(v=o.scrollTop,u=o.scrollLeft,j.offset={top:j.page.top-s.top+v+n.top,left:j.page.left-s.left+u+n.left,right:j.page.right-s.right+o.scrollWidth-u+n.right,bottom:j.page.bottom-s.bottom+o.scrollHeight-v+n.bottom})}return this.move(j),this.history.unshift(j),this.history.length>3&&this.history.pop(),!0}},a.prototype.move=function(a){var b,c,d,e,f,g,h,i,k,m,n,o,p,q,r,s,t,u,v,w,x,y=this;if(null!=this.element.parentNode){k={};for(o in a){k[o]={};for(d in a[o]){for(c=!1,v=this.history,r=0,t=v.length;t>r;r++)if(i=v[r],(null!=(w=i[o])?w[d]:void 0)!==a[o][d]){c=!0;break}c||(k[o][d]=!0)}}if(b={top:"",left:"",right:"",bottom:""},n=function(a,c){return a.top?b.top=""+c.top+"px":b.bottom=""+c.bottom+"px",a.left?b.left=""+c.left+"px":b.right=""+c.right+"px"},e=!1,(k.page.top||k.page.bottom)&&(k.page.left||k.page.right))b.position="absolute",n(k.page,a.page);else if((k.viewport.top||k.viewport.bottom)&&(k.viewport.left||k.viewport.right))b.position="fixed",n(k.viewport,a.viewport);else if(null!=k.offset&&(k.offset.top||k.offset.bottom)&&(k.offset.left||k.offset.right)){for(b.position="absolute",g=this.cache("target-offsetparent",function(){return l(y.target)}),l(this.element)!==g&&(this.element.parentNode.removeChild(this.element),g.appendChild(this.element)),h=getComputedStyle(g),f=j({},a.offset),x=["top","left","bottom","right"],s=0,u=x.length;u>s;s++)m=x[s],f[m]-=parseFloat(h["border-"+m+"-width"]);n(k.offset,f),e=!0}else b.position="absolute",b.top=""+a.page.top+"px",b.left=""+a.page.left+"px";e||"BODY"===this.element.parentNode.tagName||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element)),q=!1;for(d in b)if(p=b[d],this.element.style[d]!==p){q=!0;break}return q?j(this.element.style,b):void 0}},a}(),window.Tether=j(w,Tether)}.call(this),function(){var a,b,c,d,e,f,g,h,i=[].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1};h=Tether.Utils,f=h.getOuterSize,e=h.getBounds,g=h.getSize,c=h.extend,b={left:"right",right:"left",top:"bottom",bottom:"top",middle:"middle"},a=["left","top","right","bottom"],d=function(b,c){var d,f,g,h,i,j,k;if("scrollParent"===c?c=b.scrollParent:"window"===c&&(c=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),null!=c.nodeType)for(f=h=e(c),i=getComputedStyle(c),c=[f.left,f.top,h.width+f.left,h.height+f.top],d=j=0,k=a.length;k>j;d=++j)g=a[d],"top"===g||"left"===g?c[d]+=parseFloat(i["border-"+g+"-width"]):c[d]-=parseFloat(i["border-"+g+"-width"]);return c},Tether.modules.push({position:function(b){var f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W=this;if(E=b.top,o=b.left,z=b.targetAttachment,!this.options.constraints)return!0;for(v=function(b){var c,d,e,f;for(W.removeClass(b),f=[],d=0,e=a.length;e>d;d++)c=a[d],f.push(W.removeClass(""+b+"-"+c));return f},Q=this.cache("element-bounds",function(){return e(W.element)}),n=Q.height,F=Q.width,B=this.cache("target-bounds",function(){return W.getTargetBounds()}),A=B.height,C=B.width,y={},m={},w=[this.getClass("pinned"),this.getClass("out-of-bounds")],R=this.options.constraints,G=0,K=R.length;K>G;G++)l=R[G],l.outOfBoundsClass&&w.push(l.outOfBoundsClass),l.pinnedClass&&w.push(l.pinnedClass);for(H=0,L=w.length;L>H;H++)k=w[H],v(k);for(y=c({},z),m=c({},this.attachment),S=this.options.constraints,I=0,M=S.length;M>I;I++){if(l=S[I],D=l.to,f=l.attachment,s=l.pin,null==f&&(f=""),i.call(f," ")>=0?(T=f.split(" "),j=T[0],h=T[1]):h=j=f,g=d(this,D),("target"===j||"both"===j)&&(E<g[1]&&"top"===y.top&&(E+=A,y.top="bottom"),E+n>g[3]&&"bottom"===y.top&&(E-=A,y.top="top")),"together"===j&&(E<g[1]&&"top"===y.top&&("bottom"===m.top?(E+=A,y.top="bottom",E+=n,m.top="top"):"top"===m.top&&(E+=A,y.top="bottom",E-=n,m.top="bottom")),E+n>g[3]&&"bottom"===y.top&&("top"===m.top?(E-=A,y.top="top",E-=n,m.top="bottom"):"bottom"===m.top&&(E-=A,y.top="top",E+=n,m.top="top"))),("target"===h||"both"===h)&&(o<g[0]&&"left"===y.left&&(o+=C,y.left="right"),o+F>g[2]&&"right"===y.left&&(o-=C,y.left="left")),"together"===h&&(o<g[0]&&"left"===y.left?"right"===m.left?(o+=C,y.left="right",o+=F,m.left="left"):"left"===m.left&&(o+=C,y.left="right",o-=F,m.left="right"):o+F>g[2]&&"right"===y.left&&("left"===m.left?(o-=C,y.left="left",o-=F,m.left="right"):"right"===m.left&&(o-=C,y.left="left",o+=F,m.left="left"))),("element"===j||"both"===j)&&(E<g[1]&&"bottom"===m.top&&(E+=n,m.top="top"),E+n>g[3]&&"top"===m.top&&(E-=n,m.top="bottom")),("element"===h||"both"===h)&&(o<g[0]&&"right"===m.left&&(o+=F,m.left="left"),o+F>g[2]&&"left"===m.left&&(o-=F,m.left="right")),"string"==typeof s?s=function(){var a,b,c,d;for(c=s.split(","),d=[],a=0,b=c.length;b>a;a++)r=c[a],d.push(r.trim());return d}():s===!0&&(s=["top","left","right","bottom"]),s||(s=[]),t=[],p=[],E<g[1]&&(i.call(s,"top")>=0?(E=g[1],t.push("top")):p.push("top")),E+n>g[3]&&(i.call(s,"bottom")>=0?(E=g[3]-n,t.push("bottom")):p.push("bottom")),o<g[0]&&(i.call(s,"left")>=0?(o=g[0],t.push("left")):p.push("left")),o+F>g[2]&&(i.call(s,"right")>=0?(o=g[2]-F,t.push("right")):p.push("right")),t.length)for(u=null!=(U=this.options.pinnedClass)?U:this.getClass("pinned"),this.addClass(u),J=0,N=t.length;N>J;J++)x=t[J],this.addClass(""+u+"-"+x);if(p.length)for(q=null!=(V=this.options.outOfBoundsClass)?V:this.getClass("out-of-bounds"),this.addClass(q),P=0,O=p.length;O>P;P++)x=p[P],this.addClass(""+q+"-"+x);(i.call(t,"left")>=0||i.call(t,"right")>=0)&&(m.left=y.left=!1),(i.call(t,"top")>=0||i.call(t,"bottom")>=0)&&(m.top=y.top=!1),(y.top!==z.top||y.left!==z.left||m.top!==this.attachment.top||m.left!==this.attachment.left)&&this.updateAttachClasses(m,y)}return{top:E,left:o}}})}.call(this),function(){var a;a=Tether.Utils.getBounds,Tether.modules.push({position:function(b){var c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z=this;if(k=b.top,f=b.left,u=this.cache("element-bounds",function(){return a(z.element)}),e=u.height,l=u.width,j=this.getTargetBounds(),d=k+e,g=f+l,c=[],k<=j.bottom&&d>=j.top)for(v=["left","right"],m=0,q=v.length;q>m;m++)h=v[m],((w=j[h])===f||w===g)&&c.push(h);if(f<=j.right&&g>=j.left)for(x=["top","bottom"],n=0,r=x.length;r>n;n++)h=x[n],((y=j[h])===k||y===d)&&c.push(h);for(i=["left","top","right","bottom"],this.removeClass(this.getClass("abutted")),o=0,s=i.length;s>o;o++)h=i[o],this.removeClass(""+this.getClass("abutted")+"-"+h);for(c.length&&this.addClass(this.getClass("abutted")),p=0,t=c.length;t>p;p++)h=c[p],this.addClass(""+this.getClass("abutted")+"-"+h);return!0}})}.call(this),function(){Tether.modules.push({position:function(a){var b,c,d,e,f,g,h;return g=a.top,b=a.left,this.options.shift?(c=function(a){return"function"==typeof a?a.call(this,{top:g,left:b}):a},d=c(this.options.shift),"string"==typeof d?(d=d.split(" "),d[1]||(d[1]=d[0]),f=d[0],e=d[1],f=parseFloat(f,10),e=parseFloat(e,10)):(h=[d.top,d.left],f=h[0],e=h[1]),g+=f,b+=e,{top:g,left:b}):void 0}})}.call(this);