Liferay.Loader.define("liferay!template-web$codemirror@5.65.2/addon/scroll/simplescrollbars",["module","exports","require","../../lib/codemirror"],(function(t,e,o){var i,r=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 r=this;function onWheel(e){var o=t.wheelEventPixels(e)["horizontal"==r.orientation?"x":"y"],i=r.pos;r.moveTo(r.pos+o),r.pos!=i&&t.e_preventDefault(e)}t.on(this.inner,"mousedown",(function(e){if(1==e.which){t.e_preventDefault(e);var o="horizontal"==r.orientation?"pageX":"pageY",i=e[o],n=r.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();r.moveTo(n+(t[o]-i)*(r.total/r.size))}})),t.on(this.node,"click",(function(e){t.e_preventDefault(e);var o,i=r.inner.getBoundingClientRect();o="horizontal"==r.orientation?e.clientX<i.left?-1:e.clientX>i.right?1:0:e.clientY<i.top?-1:e.clientY>i.bottom?1:0,r.moveTo(r.pos+o*r.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 r=this.screen*(this.size/this.total);r<10&&(this.size-=10-r,r=10),this.inner.style["horizontal"==this.orientation?"width":"height"]=r+"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,r=t.scrollHeight>t.clientHeight+1;return this.vert.node.style.display=r?"block":"none",this.horiz.node.style.display=i?"block":"none",r&&(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-(r?o:0)-t.barLeft),this.horiz.node.style.right=r?o+"px":"0",this.horiz.node.style.left=t.barLeft+"px"),{right:r?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 r&&r.amd?r(["../../lib/codemirror"],i):i(CodeMirror)}));
//# sourceMappingURL=simplescrollbars.js.map