Liferay.Loader.define("liferay!object-js-components-web$codemirror@5.65.12/addon/scroll/simplescrollbars",["module","exports","require","../../lib/codemirror"],(function(t,e,o){var i,n=void 0;window;i=function(t){"use strict";function Bar(e,o,i){this.orientation=o,this.scroll=i,this.screen=this.total=this.size=1,this.pos=0,this.node=document.createElement("div"),this.node.className=e+"-"+o,this.inner=this.node.appendChild(document.createElement("div"));var n=this;function onWheel(e){var o=t.wheelEventPixels(e)["horizontal"==n.orientation?"x":"y"],i=n.pos;n.moveTo(n.pos+o),n.pos!=i&&t.e_preventDefault(e)}t.on(this.inner,"mousedown",(function(e){if(1==e.which){t.e_preventDefault(e);var o="horizontal"==n.orientation?"pageX":"pageY",i=e[o],r=n.pos;t.on(document,"mousemove",move),t.on(document,"mouseup",done)}function done(){t.off(document,"mousemove",move),t.off(document,"mouseup",done)}function move(t){if(1!=t.which)return done();n.moveTo(r+(t[o]-i)*(n.total/n.size))}})),t.on(this.node,"click",(function(e){t.e_preventDefault(e);var o,i=n.inner.getBoundingClientRect();o="horizontal"==n.orientation?e.clientX<i.left?-1:e.clientX>i.right?1:0:e.clientY<i.top?-1:e.clientY>i.bottom?1:0,n.moveTo(n.pos+o*n.screen)})),t.on(this.node,"mousewheel",onWheel),t.on(this.node,"DOMMouseScroll",onWheel)}function SimpleScrollbars(t,e,o){this.addClass=t,this.horiz=new Bar(t,"horizontal",o),e(this.horiz.node),this.vert=new Bar(t,"vertical",o),e(this.vert.node),this.width=null}Bar.prototype.setPos=function(t,e){return t<0&&(t=0),t>this.total-this.screen&&(t=this.total-this.screen),!(!e&&t==this.pos||(this.pos=t,this.inner.style["horizontal"==this.orientation?"left":"top"]=t*(this.size/this.total)+"px",0))},Bar.prototype.moveTo=function(t){this.setPos(t)&&this.scroll(t,this.orientation)},Bar.prototype.update=function(t,e,o){var i=this.screen!=e||this.total!=t||this.size!=o;i&&(this.screen=e,this.total=t,this.size=o);var n=this.screen*(this.size/this.total);n<10&&(this.size-=10-n,n=10),this.inner.style["horizontal"==this.orientation?"width":"height"]=n+"px",this.setPos(this.pos,i)},SimpleScrollbars.prototype.update=function(t){if(null==this.width){var e=window.getComputedStyle?window.getComputedStyle(this.horiz.node):this.horiz.node.currentStyle;e&&(this.width=parseInt(e.height))}var o=this.width||0,i=t.scrollWidth>t.clientWidth+1,n=t.scrollHeight>t.clientHeight+1;return this.vert.node.style.display=n?"block":"none",this.horiz.node.style.display=i?"block":"none",n&&(this.vert.update(t.scrollHeight,t.clientHeight,t.viewHeight-(i?o:0)),this.vert.node.style.bottom=i?o+"px":"0"),i&&(this.horiz.update(t.scrollWidth,t.clientWidth,t.viewWidth-(n?o:0)-t.barLeft),this.horiz.node.style.right=n?o+"px":"0",this.horiz.node.style.left=t.barLeft+"px"),{right:n?o:0,bottom:i?o:0}},SimpleScrollbars.prototype.setScrollTop=function(t){this.vert.setPos(t)},SimpleScrollbars.prototype.setScrollLeft=function(t){this.horiz.setPos(t)},SimpleScrollbars.prototype.clear=function(){var t=this.horiz.node.parentNode;t.removeChild(this.horiz.node),t.removeChild(this.vert.node)},t.scrollbarModel.simple=function(t,e){return new SimpleScrollbars("CodeMirror-simplescroll",t,e)},t.scrollbarModel.overlay=function(t,e){return new SimpleScrollbars("CodeMirror-overlayscroll",t,e)}},"object"==typeof e&&"object"==typeof t?i(o("../../lib/codemirror")):"function"==typeof n&&n.amd?n(["../../lib/codemirror"],i):i(CodeMirror)}));
//# sourceMappingURL=simplescrollbars.js.map