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