ace.define("ace/ext/code_lens",["require","exports","module","ace/line_widgets","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/editor","ace/config"],function(r,L,S){"use strict";var y=r("../line_widgets").LineWidgets,b=r("../lib/event"),_=r("../lib/lang"),$=r("../lib/dom");function E(e,t){if(e&t.CHANGE_LINES||e&t.CHANGE_FULL||e&t.CHANGE_SCROLL||e&t.CHANGE_TEXT){var o=t.session,i=t.session.lineWidgets,u=t.$textLayer,a=u.$lenses;if(!i)return void(a&&function W(e){var t=e.$textLayer,n=t.$lenses;n&&n.forEach(function(o){o.remove()}),t.$lenses=null}(t));var v=t.$textLayer.$lines.cells,c=t.layerConfig,p=t.$padding;a||(a=u.$lenses=[]);for(var l=0,m=0;m<v.length;m++){var d=v[m].row,g=i[d],h=g&&g.lenses;if(h&&h.length){var s=a[l];s||(s=a[l]=$.buildDom(["div",{class:"ace_codeLens"}],t.container)),s.style.height=c.lineHeight+"px",l++;for(var f=0;f<h.length;f++){var w=s.childNodes[2*f];w||(0!=f&&s.appendChild($.createTextNode("\xa0|\xa0")),w=$.buildDom(["a"],s)),w.textContent=h[f].title,w.lensCommand=h[f]}for(;s.childNodes.length>2*f-1;)s.lastChild.remove();var M=t.$cursorLayer.getPixelPosition({row:d,column:0},!0).top-c.lineHeight*g.rowsAbove-c.offset;s.style.top=M+"px";var C=t.gutterWidth,x=o.getLine(d).search(/\S|$/);-1==x&&(x=0),s.style.paddingLeft=p+(C+=x*c.characterWidth)+"px"}}for(;l<a.length;)a.pop().remove()}}L.setLenses=function(e,t){var n=Number.MAX_VALUE;return function H(e){if(e.lineWidgets){var t=e.widgetManager;e.lineWidgets.forEach(function(n){n&&n.lenses&&t.removeLineWidget(n)})}}(e),t&&t.forEach(function(o){var i=o.start.row,a=e.lineWidgets&&e.lineWidgets[i];(!a||!a.lenses)&&(a=e.widgetManager.$registerLineWidget({rowCount:1,rowsAbove:1,row:i,column:o.start.column,lenses:[]})),a.lenses.push(o.command),i<n&&(n=i)}),e._emit("changeFold",{data:{start:{row:n}}}),n},L.registerCodeLensProvider=function(e,t){e.setOption("enableCodeLens",!0),e.codeLensProviders.push(t),e.$updateLensesOnInput()},L.clear=function(e){L.setLenses(e,null)};var N=r("../editor").Editor;r("../config").defineOptions(N.prototype,"editor",{enableCodeLens:{set:function(e){e?function T(e){e.codeLensProviders=[],e.renderer.on("afterRender",E),e.$codeLensClickHandler||(e.$codeLensClickHandler=function(n){var o=n.target.lensCommand;!o||(e.execCommand(o.id,o.arguments),e._emit("codeLensClick",n))},b.addListener(e.container,"click",e.$codeLensClickHandler,e)),e.$updateLenses=function(){var n=e.session;if(n){n.widgetManager||(n.widgetManager=new y(n),n.widgetManager.attach(e));var o=e.codeLensProviders.length,i=[];e.codeLensProviders.forEach(function(a){a.provideCodeLenses(n,function(v,c){v||(c.forEach(function(p){i.push(p)}),0==--o&&function u(){var a=n.selection.cursor,v=n.documentToScreenRow(a),c=n.getScrollTop(),p=L.setLenses(n,i),l=n.$undoManager&&n.$undoManager.$lastDelta;if(!(l&&"remove"==l.action&&l.lines.length>1)){var m=n.documentToScreenRow(a),d=e.renderer.layerConfig.lineHeight,g=n.getScrollTop()+(m-v)*d;0==p&&c<d/4&&c>-d/4&&(g=-d),n.setScrollTop(g)}}())})})}};var t=_.delayedCall(e.$updateLenses);e.$updateLensesOnInput=function(){t.delay(250)},e.on("input",e.$updateLensesOnInput)}(this):function k(e){e.off("input",e.$updateLensesOnInput),e.renderer.off("afterRender",E),e.$codeLensClickHandler&&e.container.removeEventListener("click",e.$codeLensClickHandler)}(this)}}}),$.importCssString("\n.ace_codeLens {\n    position: absolute;\n    color: #aaa;\n    font-size: 88%;\n    background: inherit;\n    width: 100%;\n    display: flex;\n    align-items: flex-end;\n    pointer-events: none;\n}\n.ace_codeLens > a {\n    cursor: pointer;\n    pointer-events: auto;\n}\n.ace_codeLens > a:hover {\n    color: #0000ff;\n    text-decoration: underline;\n}\n.ace_dark > .ace_codeLens > a:hover {\n    color: #4e94ce;\n}\n","codelense.css",!1)}),ace.require(["ace/ext/code_lens"],function(r){"object"==typeof module&&"object"==typeof exports&&module&&(module.exports=r)});