function _classCallCheck(n,t){if(!(n instanceof t))throw new TypeError("Cannot call a class as a function");}function _possibleConstructorReturn(n,t){if(!n)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t&&(typeof t=="object"||typeof t=="function")?t:n}function _inherits(n,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof t);n.prototype=Object.create(t&&t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}});t&&(Object.setPrototypeOf?Object.setPrototypeOf(n,t):n.__proto__=t)}var _createClass=function(){function n(n,t){for(var i,r=0;r<t.length;r++)i=t[r],i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(n,i.key,i)}return function(t,i,r){return i&&n(t.prototype,i),r&&n(t,r),t}}(),FixedElementTop=function(n){function t(n){_classCallCheck(this,t);var i=_possibleConstructorReturn(this,Object.getPrototypeOf(t).call(this,n));return i.timeout=null,i}return _inherits(t,n),_createClass(t,[{key:"componentDidMount",value:function(){var t=this,n=$(window);n.on("load",function(){(n.width()>n.height()||n.width()<n.height()&&t.props.screenVerticalEnable)&&(t.timeout=setTimeout(function(){var i=$("#"+t.props.elementId);i.length>0&&function(){var r=i.offset().top;n.on("scroll",function(){if(n.width()>n.height()||n.width()<n.height()&&t.props.screenVerticalEnable){var f=i.width(),e=i.height(),u=t.props.topAdElementId?$("#"+t.props.topAdElementId):[],o=u.length>0?u.height():0,s=n.scrollTop(),h=u.length>0?o-u.height():0;s>=r-h?i.css(t._transformMaker(f,e)):i.removeAttr("style")}else i.removeAttr("style")})}()},500))})}},{key:"componentWillUnmount",value:function(){$window.off("scroll");clearTimeout(this.timeout)}},{key:"render",value:function(){return React.createElement("section",null)}},{key:"_transformMaker",value:function(n){return{position:"fixed",zIndex:5,top:0+this.props.topPositionIncrement,width:n}}}]),t}(React.Component);FixedElementTop.defaultProps={screenVerticalEnable:!1,topAdElementId:"",topPositionIncrement:0};FixedElementTop.propTypes={elementId:PropTypes.string.isRequired,screenVerticalEnable:PropTypes.bool,topAdElementId:PropTypes.string,topPositionIncrement:PropTypes.number}