/*
 * HC-Sticky
 * =========
 * Version: 2.2.6
 * Author: Some Web Media
 * Author URL: https://github.com/somewebmedia
 * Plugin URL: https://github.com/somewebmedia/hc-sticky
 * Description: JavaScript library that makes any element on your page visible while you scroll
 * License: MIT
 * Modified by: evgeniyshay - CMSMasters Team
 */
"use strict";function _instanceof(t,e){return null!=e&&"undefined"!=typeof Symbol&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(t,e){if("object"===("undefined"==typeof module?"undefined":_typeof(module))&&"object"===_typeof(module.exports)){if(!t.document)throw new Error("HC-Sticky requires a browser to run.");module.exports=e(t)}else"function"==typeof define&&define.amd?define("hcSticky",[],e(t)):e(t)}("undefined"!=typeof window?window:void 0,function(U){var n,i,Y=U.document,$={top:0,bottom:0,bottomEnd:0,innerTop:0,innerSticker:null,stickyClass:"sticky",stickTo:null,followScroll:!0,responsive:null,mobileFirst:!1,onStart:null,onStop:null,onBeforeResize:null,onResize:null,resizeDebounce:100,disable:!1},Q=function(t,e,o){console.warn("%cHC Sticky:%c "+o+"%c '"+t+"'%c is now deprecated and will be removed. Use%c '"+e+"'%c instead.","color: #fa253b","color: default","color: #5595c6","color: default","color: #5595c6","color: default")},X=function(i,f){var o=this;if(f=f||{},"string"==typeof i&&(i=Y.querySelector(i)),!i)return!1;f.queries&&Q("queries","responsive","option"),f.queryFlow&&Q("queryFlow","mobileFirst","option");var p={},u=X.Helpers,s=i.parentNode;"static"===u.getStyle(s,"position")&&(s.style.position="relative");function d(t){t=t||{},u.isEmptyObject(t)&&!u.isEmptyObject(p)||(p=Object.assign({},$,p,t))}function t(){return p.disable}function e(){var t,e=p.responsive||p.queries;if(e){var o=U.innerWidth;if(t=f,(p=Object.assign({},$,t||{})).mobileFirst)for(var n in e)n<=o&&!u.isEmptyObject(e[n])&&d(e[n]);else{var i=[];for(var s in e){var r={};r[s]=e[s],i.push(r)}for(var l=i.length-1;0<=l;l--){var a=i[l],c=Object.keys(a)[0];o<=c&&!u.isEmptyObject(a[c])&&d(a[c])}}}}function n(){var t,e,o,n;B.css=(t=i,e=u.getCascadedStyle(t),o=u.getStyle(t),n={height:t.offsetHeight+"px",left:e.left,right:e.right,top:e.top,bottom:e.bottom,position:o.position,display:o.display,verticalAlign:o.verticalAlign,boxSizing:o.boxSizing,marginLeft:e.marginLeft,marginRight:e.marginRight,marginTop:e.marginTop,marginBottom:e.marginBottom,paddingLeft:e.paddingLeft,paddingRight:e.paddingRight},e.float&&(n.float=e.float||"none"),e.cssFloat&&(n.cssFloat=e.cssFloat||"none"),o.MozBoxSizing&&(n.MozBoxSizing=o.MozBoxSizing),n.width="auto"!==e.width?e.width:"border-box"===n.boxSizing||"border-box"===n.MozBoxSizing?t.offsetWidth+"px":o.width,n),F.init(),b=!(!p.stickTo||!("document"===p.stickTo||p.stickTo.nodeType&&9===p.stickTo.nodeType||"object"===_typeof(p.stickTo)&&_instanceof(p.stickTo,"undefined"!=typeof HTMLDocument?HTMLDocument:Document))),v=p.stickTo?b?Y:"string"==typeof p.stickTo?Y.querySelector(p.stickTo):p.stickTo:s,H=(R=function(){var t=i.offsetHeight+(parseInt(B.css.marginTop)||0)+(parseInt(B.css.marginBottom)||0),e=(H||0)-t;return-1<=e&&e<=1?H:t})(),w=(P=function(){return b?Math.max(Y.documentElement.clientHeight,Y.body.scrollHeight,Y.documentElement.scrollHeight,Y.body.offsetHeight,Y.documentElement.offsetHeight):v.offsetHeight})(),k=b?0:u.offset(v).top,L=p.stickTo?b?0:u.offset(s).top:k,T=U.innerHeight,I=i.offsetTop+q()-(parseInt(B.css.marginTop)||0),S=p.innerSticker?"string"==typeof p.innerSticker?Y.querySelector(p.innerSticker):p.innerSticker:null,x=isNaN(p.top)&&-1<p.top.indexOf("%")?parseFloat(p.top)/100*T:p.top,E=isNaN(p.bottom)&&-1<p.bottom.indexOf("%")?parseFloat(p.bottom)/100*T:p.bottom,j=S?S.offsetTop:p.innerTop?p.innerTop:0,O=isNaN(p.bottomEnd)&&-1<p.bottomEnd.indexOf("%")?parseFloat(p.bottomEnd)/100*T:p.bottomEnd,C=k-x+j+I}function r(){H=R(),w=P(),N=k+w-x-O,z=T<H;var t,e=U.pageYOffset||Y.documentElement.scrollTop,o=u.offset(i).top,n=o-e;A=e<M?"up":"down",_=e-M,C<(M=e)?N+x+(z?E:0)-(p.followScroll&&z?0:x)<=e+H-j-(T-(C-j)<H-j&&p.followScroll&&0<(t=H-T-j)?t:0)?B.release({position:"absolute",bottom:L+s.offsetHeight-N-x}):z&&p.followScroll?"down"==A?n+H+E<=T+.9?B.stick({bottom:E}):"fixed"===B.position&&B.release({position:"absolute",top:o-x-C-_+j}):Math.ceil(n+j)<0&&"fixed"===B.position?B.release({position:"absolute",top:o-x-C+j-_}):e+x-j<=o&&B.stick({top:x-j}):B.stick({top:x-j}):B.release({stop:!0})}function l(){D&&(U.removeEventListener("scroll",r,u.supportsPassive),D=!1)}function a(){null!==i.offsetParent&&"none"!==u.getStyle(i,"display")?(n(),w<H?l():(r(),D||(U.addEventListener("scroll",r,u.supportsPassive),D=!0))):l()}function c(){i.style.position="",i.style.left="",i.style.top="",i.style.bottom="",i.style.width="",i.classList?i.classList.remove(p.stickyClass):i.className=i.className.replace(new RegExp("(^|\\b)"+p.stickyClass.split(" ").join("|")+"(\\b|$)","gi")," "),B.css={},!(B.position=null)===F.isAttached&&F.detach()}function y(){c(),e(),(t()?l:a)()}function m(){p.onBeforeResize&&p.onBeforeResize.call(i,Object.assign({},p)),y(),p.onResize&&p.onResize.call(i,Object.assign({},p))}function g(){W&&(U.removeEventListener("resize",V,u.supportsPassive),W=!1),l()}function h(){W||(U.addEventListener("resize",V,u.supportsPassive),W=!0),e(),(t()?l:a)()}var b,v,S,w,k,L,T,x,E,j,O,C,N,z,H,I,P,R,A,B={css:{},position:null,stick:function(t){t=t||{},u.hasClass(i,p.stickyClass)||(!1===F.isAttached&&F.attach(),B.position="fixed",i.style.position="fixed",i.style.left=F.offsetLeft+"px",i.style.width=F.width,void 0===t.bottom?i.style.bottom="auto":i.style.bottom=t.bottom+"px",void 0===t.top?i.style.top="auto":i.style.top=t.top+"px",i.classList?i.classList.add(p.stickyClass):i.className+=" "+p.stickyClass,p.onStart&&p.onStart.call(i,Object.assign({},p)))},release:function(t){var e;(t=t||{}).stop=t.stop||!1,!0!==t.stop&&"fixed"!==B.position&&null!==B.position&&(void 0===t.top&&void 0===t.bottom||void 0!==t.top&&(parseInt(u.getStyle(i,"top"))||0)===t.top||void 0!==t.bottom&&(parseInt(u.getStyle(i,"bottom"))||0)===t.bottom)||(!0===t.stop?!0===F.isAttached&&F.detach():!1===F.isAttached&&F.attach(),e=t.position||B.css.position,B.position=e,i.style.position=e,i.style.left=!0===t.stop?B.css.left:F.positionLeft+"px",i.style.width="absolute"!==e?B.css.width:F.width,void 0===t.bottom?i.style.bottom=!0===t.stop?"":"auto":i.style.bottom=t.bottom+"px",void 0===t.top?i.style.top=!0===t.stop?"":"auto":i.style.top=t.top+"px",i.classList?i.classList.remove(p.stickyClass):i.className=i.className.replace(new RegExp("(^|\\b)"+p.stickyClass.split(" ").join("|")+"(\\b|$)","gi")," "),p.onStop&&p.onStop.call(i,Object.assign({},p)))}},F={el:Y.createElement("div"),offsetLeft:null,positionLeft:null,width:null,isAttached:!1,init:function(){for(var t in F.el.className="sticky-spacer",B.css)F.el.style[t]=B.css[t];F.el.style["z-index"]="-1";var e=u.getStyle(i);F.offsetLeft=u.offset(i).left-(parseInt(e.marginLeft)||0),F.positionLeft=u.position(i).left,F.width=u.getStyle(i,"width")},attach:function(){s.insertBefore(F.el,i),F.isAttached=!0},detach:function(){F.el=s.removeChild(F.el),F.isAttached=!1}},q=function(){for(var t=k-x,e=i.offsetParent,o=0;e&&"body"!==e.tagName.toLowerCase()&&v!==e;){var n=e.offsetTop,e=e.offsetParent;n&&(o+=n,"body"===e.tagName.toLowerCase()&&(o-=t))}return o},M=U.pageYOffset||Y.documentElement.scrollTop,_=0,D=!1,W=!1,V=p.resizeDebounce?u.debounce(m,p.resizeDebounce):m;this.options=function(t){return t?p[t]:Object.assign({},p)},this.refresh=y,this.update=function(t){d(t),f=Object.assign({},f,t||{}),y()},this.attach=h,this.detach=g,this.destroy=function(){g(),c()},this.triggerMethod=function(t,e){"function"==typeof o[t]&&o[t](e)},this.reinit=function(){Q("reinit","refresh","method"),y()},d(f),h(),U.addEventListener("load",y)};return void 0!==U.jQuery&&(n=U.jQuery,i="hcSticky",n.fn.extend({hcSticky:function(e,o){return this.length?"options"===e?n.data(this.get(0),i).options():this.each(function(){var t=n.data(this,i);t?t.triggerMethod(e,o):(t=new X(this,e),n.data(this,i,t))}):this}})),U.hcSticky=U.hcSticky||X,X}),function(c){var t=c.hcSticky,f=c.document;"function"!=typeof Object.assign&&Object.defineProperty(Object,"assign",{value:function(t,e){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var o=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(o[s]=i[s])}return o},writable:!0,configurable:!0}),Array.prototype.forEach||(Array.prototype.forEach=function(t){var e,o;if(null==this)throw new TypeError("this is null or not defined");var n,i=Object(this),s=i.length>>>0;if("function"!=typeof t)throw new TypeError(t+" is not a function");for(1<arguments.length&&(e=arguments[1]),o=0;o<s;){o in i&&(n=i[o],t.call(e,n,o,i)),o++}});var e=!1;try{var o=Object.defineProperty({},"passive",{get:function(){e={passive:!1}}});c.addEventListener("testPassive",null,o),c.removeEventListener("testPassive",null,o)}catch(t){}function r(t,e){return c.getComputedStyle?e?f.defaultView.getComputedStyle(t,null).getPropertyValue(e):f.defaultView.getComputedStyle(t,null):t.currentStyle?e?t.currentStyle[e.replace(/-\w/g,function(t){return t.toUpperCase().replace("-","")})]:t.currentStyle:void 0}function l(t){var e=t.getBoundingClientRect(),o=c.pageYOffset||f.documentElement.scrollTop,n=c.pageXOffset||f.documentElement.scrollLeft;return{top:e.top+o,left:e.left+n}}t.Helpers={supportsPassive:e,isEmptyObject:function(t){for(var e in t)return!1;return!0},debounce:function(n,i,s){var r;return function(){var t=this,e=arguments,o=s&&!r;clearTimeout(r),r=setTimeout(function(){r=null,s||n.apply(t,e)},i),o&&n.apply(t,e)}},hasClass:function(t,e){return t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},offset:l,position:function(t){var e=t.offsetParent,o=l(e),n=l(t),i=r(e),s=r(t);return o.top+=parseInt(i.borderTopWidth)||0,o.left+=parseInt(i.borderLeftWidth)||0,{top:n.top-o.top-(parseInt(s.marginTop)||0),left:n.left-o.left-(parseInt(s.marginLeft)||0)}},getStyle:r,getCascadedStyle:function(t){var e,o=t.cloneNode(!0);o.style.display="none",Array.prototype.slice.call(o.querySelectorAll('input[type="radio"]')).forEach(function(t){t.removeAttribute("name")}),t.parentNode.insertBefore(o,t.nextSibling),o.currentStyle?e=o.currentStyle:c.getComputedStyle&&(e=f.defaultView.getComputedStyle(o,null));var n,i,s,r={};for(var l in e)!isNaN(l)||"string"!=typeof e[l]&&"number"!=typeof e[l]||(r[l]=e[l]);if(Object.keys(r).length<3)for(var a in r={},e)isNaN(a)||(r[e[a].replace(/-\w/g,function(t){return t.toUpperCase().replace("-","")})]=e.getPropertyValue(e[a]));return r.margin||"auto"!==r.marginLeft?r.margin||r.marginLeft!==r.marginRight||r.marginLeft!==r.marginTop||r.marginLeft!==r.marginBottom||(r.margin=r.marginLeft):r.margin="auto",r.margin||"0px"!==r.marginLeft||"0px"!==r.marginRight||(i=(n=t.offsetLeft-t.parentNode.offsetLeft)-(parseInt(r.left)||0)-(parseInt(r.right)||0),0!=(s=t.parentNode.offsetWidth-t.offsetWidth-n-(parseInt(r.right)||0)+(parseInt(r.left)||0)-i)&&1!=s||(r.margin="auto")),o.parentNode.removeChild(o),o=null,r}}}(window);
