Liferay.Loader.define("journal-web$codemirror@5.65.12/addon/scroll/annotatescrollbar",["module","exports","require","../../lib/codemirror"],(function(t,e,i){var n,o=void 0;window;n=function(t){"use strict";function Annotation(t,e){function scheduleRedraw(t){clearTimeout(i.doRedraw),i.doRedraw=setTimeout((function(){i.redraw()}),t)}this.cm=t,this.options=e,this.buttonHeight=e.scrollButtonHeight||t.getOption("scrollButtonHeight"),this.annotations=[],this.doRedraw=this.doUpdate=null,this.div=t.getWrapperElement().appendChild(document.createElement("div")),this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none",this.computeScale();var i=this;t.on("refresh",this.resizeHandler=function(){clearTimeout(i.doUpdate),i.doUpdate=setTimeout((function(){i.computeScale()&&scheduleRedraw(20)}),100)}),t.on("markerAdded",this.resizeHandler),t.on("markerCleared",this.resizeHandler),!1!==e.listenForChanges&&t.on("changes",this.changeHandler=function(){scheduleRedraw(250)})}t.defineExtension("annotateScrollbar",(function(t){return"string"==typeof t&&(t={className:t}),new Annotation(this,t)})),t.defineOption("scrollButtonHeight",0),Annotation.prototype.computeScale=function(){var t=this.cm,e=(t.getWrapperElement().clientHeight-t.display.barHeight-2*this.buttonHeight)/t.getScrollerElement().scrollHeight;if(e!=this.hScale)return this.hScale=e,!0},Annotation.prototype.update=function(t){this.annotations=t,this.redraw()},Annotation.prototype.redraw=function(t){!1!==t&&this.computeScale();var e=this.cm,i=this.hScale,n=document.createDocumentFragment(),o=this.annotations,r=e.getOption("lineWrapping"),a=r&&1.5*e.defaultTextHeight(),s=null,l=null;function getY(t,i){if(s!=t.line){s=t.line,l=e.getLineHandle(t.line);var n=e.getLineHandleVisualStart(l);n!=l&&(s=e.getLineNumber(n),l=n)}return l.widgets&&l.widgets.length||r&&l.height>a?e.charCoords(t,"local")[i?"top":"bottom"]:e.heightAtLine(l,"local")+(i?0:l.height)}var d=e.lastLine();if(e.display.barWidth)for(var h,c=0;c<o.length;c++){var u=o[c];if(!(u.to.line>d)){for(var p=h||getY(u.from,!0)*i,m=getY(u.to,!1)*i;c<o.length-1&&!(o[c+1].to.line>d)&&!((h=getY(o[c+1].from,!0)*i)>m+.9);)m=getY((u=o[++c]).to,!1)*i;if(m!=p){var f=Math.max(m-p,3),g=n.appendChild(document.createElement("div"));g.style.cssText="position: absolute; right: 0px; width: "+Math.max(e.display.barWidth-1,2)+"px; top: "+(p+this.buttonHeight)+"px; height: "+f+"px",g.className=this.options.className,u.id&&g.setAttribute("annotation-id",u.id)}}}this.div.textContent="",this.div.appendChild(n)},Annotation.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("changes",this.changeHandler),this.div.parentNode.removeChild(this.div)}},"object"==typeof e&&"object"==typeof t?n(i("../../lib/codemirror")):"function"==typeof o&&o.amd?o(["../../lib/codemirror"],n):n(CodeMirror)}));
//# sourceMappingURL=annotatescrollbar.js.map