!function(t){var o=function(o,e){var s,i,n=!1,r=!1,a=!1,c={},f={to:"top",offset:0,effectsOffset:0,parent:!1,classes:{sticky:"ekit-sticky",stickyActive:"ekit-sticky-active",stickyEffects:"ekit-sticky-effects",spacer:"ekit-sticky-spacer"}},p=function(t,o,e){var s={},i=t[0].style;e.forEach(function(t){s[t]=void 0!==i[t]?i[t]:""}),t.data("css-backup-"+o,s)},l=function(t,o){return t.data("css-backup-"+o)},m=function(){p(s,"unsticky",["position","width","margin-top","margin-bottom","top","bottom"]);var t={position:"fixed",width:u(s,"width"),marginTop:0,marginBottom:0};t[i.to]=i.offset+"px",t["top"===i.to?"bottom":"top"]="",s.css(t).addClass(i.classes.stickyActive)},d=function(){s.css(l(s,"unsticky")).removeClass(i.classes.stickyActive)},u=function(t,o,e){var s=getComputedStyle(t[0]),i=parseFloat(s[o]),n="height"===o?["top","bottom"]:["left","right"],r=[];return"border-box"!==s.boxSizing&&r.push("border","padding"),e&&r.push("margin"),r.forEach(function(t){n.forEach(function(o){i+=parseFloat(s[t+"-"+o])})}),i},y=function(t){var o=c.$window.scrollTop(),e=u(t,"height"),s=innerHeight,i=t.offset().top-o,n=i-s;return{top:{fromTop:i,fromBottom:n},bottom:{fromTop:i+e,fromBottom:n+e}}},h=function(){c.$spacer=s.clone().addClass(i.classes.spacer).css({visibility:"hidden",transition:"none",animation:"none"}),s.after(c.$spacer),m(),n=!0,s.trigger("sticky:stick")},k=function(){d(),c.$spacer.remove(),n=!1,s[0].style.transform=null,s.trigger("sticky:unstick")},g=function(){var t=y(s),o="top"===i.to;if(r){(o?t.top.fromTop>i.offset:t.bottom.fromBottom<-i.offset)&&(c.$parent.css(l(c.$parent,"childNotFollowing")),s.css(l(s,"notFollowing")),r=!1)}else{var e=y(c.$parent),n=getComputedStyle(c.$parent[0]),a=parseFloat(n[o?"borderBottomWidth":"borderTopWidth"]),f=o?e.bottom.fromTop-a:e.top.fromBottom+a;(o?f<=t.bottom.fromTop:f>=t.top.fromBottom)&&function(){p(c.$parent,"childNotFollowing",["position"]),c.$parent.css("position","relative"),p(s,"notFollowing",["position","top","bottom"]);var t={position:"absolute"};t[i.to]="",t["top"===i.to?"bottom":"top"]=0,s.css(t),r=!0}()}},v=function(){var t,o=i.offset;if(i.stopAt||i.column){var e=s[0],r=i.stopAt||s.parent(),f=r.offset().top,p=r[0].clientHeight-e.clientHeight,l=this.scrollY-f+i.offset,m=l>=p;if("bottom"===i.to&&(p=f-(this.innerHeight-e.clientHeight),m=(l=this.scrollY+i.offset)<=p,l==p-e.clientHeight),m&&i.column&&"widget"===e.dataset.element_type)return n&&k(),void(e.style.transform="translateY("+p+"px)");e.style.transform=null}if(n){var d=y(c.$spacer);t="top"===i.to?d.top.fromTop-o:-d.bottom.fromBottom-o,i.parent&&g(),t>0&&k()}else{var u=y(s);(t="top"===i.to?u.top.fromTop-o:-u.bottom.fromBottom-o)<=0&&(h(),i.parent&&g())}(i.stopAt||i.column)&&m&&i.stopAt&&(l="top"===i.to?-(l-p):p-l,e.style.transform="translateY("+l+"px)"),function(t){a&&-t=i.effectsOffset&&(s.addClass(i.classes.stickyEffects),a=!0)}(t)},b=function(){v()},w=function(){n&&(d(),m())};this.destroy=function(){n&&k(),c.$window.off("scroll",b).off("resize",w),s.removeClass(i.classes.sticky)},i=jQuery.extend(!0,f,e),s=t(o).addClass(i.classes.sticky),c.$window=t(window),i.parent&&("parent"===i.parent?c.$parent=s.parent():c.$parent=s.closest(i.parent)),c.$window.on({scroll:b,resize:w}),v()};t.fn.ekit_sticky=function(e){var s="string"==typeof e;return this.each(function(){var i=t(this);if(s){var n=i.data("ekit_sticky");if(!n)throw Error("Trying to perform the `"+e+"` method prior to initialization");if(!n[e])throw ReferenceError("Method `"+e+"` not found in sticky instance");n[e].apply(n,Array.prototype.slice.call(arguments,1)),"destroy"===e&&i.removeData("ekit_sticky")}else i.data("ekit_sticky",new o(this,e))}),this},window.EkitSticky=o}(jQuery);