text: (function(m){"object"==typeof exports&&"object"==typeof module?m(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","diff_match_patch"],m):m(CodeMirror)})(function(m){function D(a,b){this.mv=a;this.type=b;this.classes="left"==b?{chunk:"CodeMirror-merge-l-chunk",start:"CodeMirror-merge-l-chunk-start",end:"CodeMirror-merge-l-chunk-end",insert:"CodeMirror-merge-l-inserted",del:"CodeMirror-merge-l-deleted",connect:"CodeMirror-merge-l-connect"}:{chunk:"CodeMirror-merge-r-chunk",start:"CodeMirror-merge-r-chunk-start",end:"CodeMirror-merge-r-chunk-end",insert:"CodeMirror-merge-r-inserted",del:"CodeMirror-merge-r-deleted",connect:"CodeMirror-merge-r-connect"}}function B(a){a.diffOutOfDate&&(a.diff=S(a.orig.getValue(),a.edit.getValue(),a.mv.options.ignoreWhitespace),a.chunks=T(a.diff),a.diffOutOfDate=!1,m.signal(a.edit,"updateDiff",a.diff))}function ja(a){function b(b){E=!0;l=!1;"full"==b&&(a.svg&&F(a.svg),a.copyButtons&&F(a.copyButtons),J(a.edit,h.marked,a.classes),J(a.orig,g.marked,a.classes),h.from=h.to=g.from=g.to=0);B(a);a.showDifferences&&(U(a.edit,a.diff,h,DIFF_INSERT,a.classes),U(a.orig,a.diff,g,DIFF_DELETE,a.classes));"align"==a.mv.options.connect&&K(a);y(a);null!=a.needsScrollSync&&C(a,a.needsScrollSync);E=!1}function c(b){E||(a.dealigned=!0,d(b))}function d(a){E||l||(clearTimeout(k),!0===a&&(l=!0),k=setTimeout(b,!0===a?20:250))}function f(b,d){a.diffOutOfDate||(a.diffOutOfDate=!0,h.from=h.to=g.from=g.to=0);c(d.text.length-1!=d.to.line-d.from.line)}function e(){a.diffOutOfDate=!0;a.dealigned=!0;b("full")}var h={from:0,to:0,marked:[]},g={from:0,to:0,marked:[]},k,l=!1;a.edit.on("change",f);a.orig.on("change",f);a.edit.on("swapDoc",e);a.orig.on("swapDoc",e);"align"==a.mv.options.connect&&(m.on(a.edit.state.trackAlignable,"realign",c),m.on(a.orig.state.trackAlignable,"realign",c));a.edit.on("viewportChange",function(){d(!1)});a.orig.on("viewportChange",function(){d(!1)});b();return b}function ka(a,b){a.edit.on("scroll",function(){C(a,!0)&&y(a)});a.orig.on("scroll",function(){C(a,!1)&&y(a);b&&C(b,!0)&&y(b)})}function C(a,b){if(a.diffOutOfDate)return a.lockScroll&&null==a.needsScrollSync&&(a.needsScrollSync=b),!1;a.needsScrollSync=null;if(!a.lockScroll)return!0;var c=+new Date;if(b){var d=a.edit;var f=a.orig}else d=a.orig,f=a.edit;if(d.state.scrollSetBy==a&&(d.state.scrollSetAt||0)+250>c)return!1;var e=d.getScrollInfo();if("align"==a.mv.options.connect)v=e.top;else{var h=.5*e.clientHeight;v=e.top+h;var g=d.lineAtHeight(v,"local");for(var k=a.chunks,l,p,L,m=0;m<k.length;m++){var r=k[m],u=b?r.editFrom:r.origFrom,t=b?r.editTo:r.origTo;null==p&&(u>g?(p=r.editFrom,L=r.origFrom):t>g&&(p=r.editTo,L=r.origTo));if(t<=g){l=r.editTo;var q=r.origTo}else u<=g&&(l=r.editFrom,q=r.origFrom)}g={before:l,after:p};q={before:q,after:L};d=V(d,b?g:q);q=V(f,b?q:g);var v=q.top-h+(v-d.top)/(d.bot-d.top)*(q.bot-q.top),A;v>e.top&&1>(A=e.top/h)?v=v*A+e.top*(1-A):(d=e.height-e.clientHeight-e.top)<h&&(q=f.getScrollInfo(),q.height-q.clientHeight-v>d&&1>(A=d/h)&&(v=v*A+(q.height-q.clientHeight-d)*(1-A)))}f.scrollTo(e.left,v);f.state.scrollSetAt=c;f.state.scrollSetBy=a;return!0}function V(a,b){var c=b.after;null==c&&(c=a.lastLine()+1);return{top:a.heightAtLine(b.before||0,"local"),bot:a.heightAtLine(c,"local")}}function W(a,b,c){(a.lockScroll=b)&&0!=c&&C(a,DIFF_INSERT)&&y(a);(b?m.addClass:m.rmClass)(a.lockButton,"CodeMirror-merge-scrolllock-enabled")}function J(a,b,c){for(var d=0;d<b.length;++d){var f=b[d];if(f instanceof m.TextMarker)f.clear();else if(f.parent)for(var e=a,h=c,g=h.classLocation,k=0;k<g.length;k++)e.removeLineClass(f,g[k],h.chunk),e.removeLineClass(f,g[k],h.start),e.removeLineClass(f,g[k],h.end)}b.length=0}function U(a,b,c,d,f){var e=a.getViewport();a.operation(function(){c.from==c.to||20<e.from-c.to||20<c.from-e.to?(J(a,c.marked,f),M(a,b,d,c.marked,e.from,e.to,f),c.from=e.from,c.to=e.to):(e.from<c.from&&(M(a,b,d,c.marked,e.from,c.from,f),c.from=e.from),e.to>c.to&&(M(a,b,d,c.marked,c.to,e.to,f),c.to=e.to))})}function N(a,b,c,d,f,e){var h=c.classLocation;b=a.getLineHandle(b);for(var g=0;g<h.length;g++)d&&a.addLineClass(b,h[g],c.chunk),f&&a.addLineClass(b,h[g],c.start),e&&a.addLineClass(b,h[g],c.end);return b}function M(a,b,c,d,f,e,h){function g(b,c){for(var g=Math.max(f,b),k=Math.min(e,c),l=g;l<k;++l)d.push(N(a,l,h,!0,l==b,l==c-1));b==c&&g==c&&k==c&&(g?d.push(N(a,g-1,h,!1,!1,!0)):d.push(N(a,g,h,!1,!0,!1)))}for(var k=n(0,0),l=n(f,0),p=a.clipPos(n(e-1)),m=c==DIFF_DELETE?h.del:h.insert,x=0,r=!1,u=0;u<b.length;++u){var t=b[u],q=t[0];t=t[1];q==DIFF_EQUAL?(q=k.line+(X(b,u)?0:1),G(k,t),t=k.line+(Y(b,u)?1:0),t>q&&(r&&(g(x,q),r=!1),x=t)):(r=!0,q==c&&(q=G(k,t,!0),k=0<(l.line-k.line||l.ch-k.ch)?l:k,t=0>(p.line-q.line||p.ch-q.ch)?p:q,k.line==t.line&&k.ch==t.ch||d.push(a.markText(k,t,{className:m})),k=q))}r&&g(x,k.line+1)}function y(a){if(a.showDifferences){if(a.svg){F(a.svg);var b=a.gap.offsetWidth;Z(a.svg,"width",b,"height",a.gap.offsetHeight)}a.copyButtons&&F(a.copyButtons);var c=a.edit.getViewport(),d=a.orig.getViewport(),f=a.mv.wrap.getBoundingClientRect().top,e=f-a.edit.getScrollerElement().getBoundingClientRect().top+a.edit.getScrollInfo().top;f=f-a.orig.getScrollerElement().getBoundingClientRect().top+a.orig.getScrollInfo().top;for(var h=0;h<a.chunks.length;h++){var g=a.chunks[h];if(g.editFrom<=c.to&&g.editTo>=c.from&&g.origFrom<=d.to&&g.origTo>=d.from){var k=a,l=f,p=e,m=b,n="left"==k.type,r=k.orig.heightAtLine(g.origFrom,"local",!0)-l;if(k.svg){var u=r,t=k.edit.heightAtLine(g.editFrom,"local",!0)-p;if(n){var q=u;u=t;t=q}l=k.orig.heightAtLine(g.origTo,"local",!0)-l;var v=k.edit.heightAtLine(g.editTo,"local",!0)-p;n&&(q=l,l=v,v=q);n=" C "+m/2+" "+t+" "+m/2+" "+u+" "+(m+2)+" "+u;u=" C "+m/2+" "+l+" "+m/2+" "+v+" -1 "+v;Z(k.svg.appendChild(document.createElementNS("http://www.w3.org/2000/svg","path")),"d","M -1 "+t+n+" L "+(m+2)+" "+l+u+" z","class",k.classes.connect)}k.copyButtons&&(m=k.copyButtons.appendChild(w("div","left"==k.type?"\u21dd":"\u21dc","CodeMirror-merge-copy")),t=k.mv.options.allowEditingOriginals,m.title=k.edit.phrase(t?"Push to left":"Revert chunk"),m.chunk=g,m.style.top=(g.origTo>g.origFrom?r:k.edit.heightAtLine(g.editFrom,"local")-p)+"px",t&&(p=k.edit.heightAtLine(g.editFrom,"local")-p,r=k.copyButtons.appendChild(w("div","right"==k.type?"\u21dd":"\u21dc","CodeMirror-merge-copy-reverse")),r.title="Push to right",r.chunk={editFrom:g.origFrom,editTo:g.origTo,origFrom:g.editFrom,origTo:g.editTo},r.style.top=p+"px","right"==k.type?r.style.left="2px":r.style.right="2px"))}}}}function aa(a,b){for(var c=0,d=0,f=0;f<b.length;f++){var e=b[f];if(e.editTo>a&&e.editFrom<=a)return null;if(e.editFrom>a)break;c=e.editTo;d=e.origTo}return d+(a-c)}function O(a,b,c){var d=a.state.trackAlignable;a=a.firstLine();for(var f=0,e=[],h=0;;h++){for(var g=b[h],k=g?c?g.origFrom:g.editFrom:1E9;f<d.alignable.length;f+=2){var l=d.alignable[f]+1;if(!(l<=a))if(l<=k)e.push(l);else break}if(!g)break;e.push(a=c?g.origTo:g.editTo)}return e}function ba(a,b,c,d){var f=0,e=0,h=0,g=0;a:for(;;f++){var k=a[f],l=b[e];if(!k&&null==l)break;var m=k?k[0]:1E9;for(l=null==l?1E9:l;h<c.length;){var n=c[h];if(n.origFrom<=l&&n.origTo>l){e++;f--;continue a}if(n.editTo>m){if(n.editFrom<=m)continue a;break}g+=n.origTo-n.origFrom-(n.editTo-n.editFrom);h++}m==l-g?(k[d]=l,e++):m<l-g?k[d]=m+g:(k=[l-g,null,null],k[d]=l,a.splice(f,0,k),e++)}}function la(a,b){var c=O(a.edit,a.chunks,!1),d=[];if(b)for(var f=0,e=0;f<b.chunks.length;f++){for(var h=b.chunks[f].editTo;e<c.length&&c[e]<h;)e++;e!=c.length&&c[e]==h||c.splice(e++,0,h)}for(f=0;f<c.length;f++)d.push([c[f],null,null]);ba(d,O(a.orig,a.chunks,!0),a.chunks,1);b&&ba(d,O(b.orig,b.chunks,!0),b.chunks,2);return d}function K(a,b){if(a.dealigned||b){if(!a.orig.curOp)return a.orig.operation(function(){K(a,b)});a.dealigned=!1;var c=a.mv.left==a?a.mv.right:a.mv.left;c&&(B(c),c.dealigned=!1);for(var d=la(a,c),f=a.mv.aligners,e=0;e<f.length;e++)f[e].clear();f.length=0;var h=[a.edit,a.orig],g=[];c&&h.push(c.orig);for(e=0;e<h.length;e++)g.push(h[e].getScrollInfo().top);for(c=0;c<d.length;c++)ma(h,d[c],f);for(e=0;e<h.length;e++)h[e].scrollTo(null,g[e])}}function ma(a,b,c){for(var d=0,f=[],e=0;e<a.length;e++)if(null!=b[e]){var h=a[e].heightAtLine(b[e],"local");f[e]=h;d=Math.max(d,h)}for(e=0;e<a.length;e++)null!=b[e]&&(h=d-f[e],1<h&&c.push(na(a[e],b[e],h)))}function na(a,b,c){var d=!0;b>a.lastLine()&&(b--,d=!1);var f=document.createElement("div");f.className="CodeMirror-merge-spacer";f.style.height=c+"px";f.style.minWidth="1px";return a.addLineWidget(b,f,{height:c,above:d,mergeSpacer:!0,handleMouseEvents:!0})}function ca(a,b,c,d){if(!a.diffOutOfDate){var f=d.origTo>c.lastLine()?n(d.origFrom-1):n(d.origFrom,0),e=n(d.origTo,0),h=d.editTo>b.lastLine()?n(d.editFrom-1):n(d.editFrom,0);d=n(d.editTo,0);var g=a.mv.options.revertChunk;g?g(a.mv,c,f,e,b,h,d):b.replaceRange(c.getRange(f,e),h,d)}}function da(a){var b=a.lockButton=w("div",null,"CodeMirror-merge-scrolllock"),c=w("div",[b],"CodeMirror-merge-scrolllock-wrap");m.on(b,"click",function(){W(a,!a.lockScroll)});b=[c];!1!==a.mv.options.revertButtons&&(a.copyButtons=w("div",null,"CodeMirror-merge-copybuttons-"+a.type),m.on(a.copyButtons,"click",function(b){b=b.target||b.srcElement;b.chunk&&("CodeMirror-merge-copy-reverse"==b.className?ca(a,a.orig,a.edit,b.chunk):ca(a,a.edit,a.orig,b.chunk))}),b.unshift(a.copyButtons));"align"!=a.mv.options.connect&&((c=document.createElementNS&&document.createElementNS("http://www.w3.org/2000/svg","svg"))&&!c.createSVGRect&&(c=null),(a.svg=c)&&b.push(c));return a.gap=w("div",b,"CodeMirror-merge-gap")}function ea(a){return"string"==typeof a?a:a.getValue()}function S(a,b,c){P||(P=new diff_match_patch);a=P.diff_main(a,b);for(b=0;b<a.length;++b){var d=a[b];(c?/[^ \t]/.test(d[1]):d[1])?b&&a[b-1][0]==d[0]&&(a.splice(b--,1),a[b][1]+=d[1]):a.splice(b--,1)}return a}function T(a){var b=[];if(!a.length)return b;for(var c=0,d=0,f=n(0,0),e=n(0,0),h=0;h<a.length;++h){var g=a[h],k=g[0];if(k==DIFF_EQUAL){var l=!X(a,h)||f.line<c||e.line<d?1:0;k=f.line+l;l=e.line+l;G(f,g[1],null,e);var m=Y(a,h)?1:0;g=f.line+m;m=e.line+m;g>k&&(h&&b.push({origFrom:d,origTo:l,editFrom:c,editTo:k}),c=g,d=m)}else G(k==DIFF_INSERT?f:e,g[1])}(c<=f.line||d<=e.line)&&b.push({origFrom:d,origTo:e.line+1,editFrom:c,editTo:f.line+1});return b}function Y(a,b){if(b==a.length-1)return!0;var c=a[b+1][1];if(1==c.length&&b<a.length-2||10!=c.charCodeAt(0))return!1;if(b==a.length-2)return!0;c=a[b+2][1];return(1<c.length||b==a.length-3)&&10==c.charCodeAt(0)}function X(a,b){if(0==b)return!0;var c=a[b-1][1];if(10!=c.charCodeAt(c.length-1))return!1;if(1==b)return!0;c=a[b-2][1];return 10==c.charCodeAt(c.length-1)}function oa(a,b,c){function d(){e.clear();a.removeLineClass(b,"wrap","CodeMirror-merge-collapsed-line")}a.addLineClass(b,"wrap","CodeMirror-merge-collapsed-line");var f=document.createElement("span");f.className="CodeMirror-merge-collapsed-widget";f.title=a.phrase("Identical text collapsed. Click to expand.");var e=a.markText(n(b,0),n(c-1),{inclusiveLeft:!0,inclusiveRight:!0,replacedWith:f,clearOnEnter:!0});e.explicitlyCleared&&d();m.on(f,"click",d);e.on("clear",d);m.on(f,"click",d);return{mark:e,clear:d}}function pa(a,b){function c(){for(var a=0;a<d.length;a++)d[a].clear()}for(var d=[],f=0;f<b.length;f++){var e=b[f];e=oa(e.cm,e.line,e.line+a);d.push(e);e.mark.on("clear",c)}return d[0].mark}function fa(a,b,c,d){for(var f=0;f<a.chunks.length;f++)for(var e=a.chunks[f],h=e.editFrom-b;h<e.editTo+b;h++){var g=h+c;0<=g&&g<d.length&&(d[g]=!1)}}function w(a,b,c,d){a=document.createElement(a);c&&(a.className=c);d&&(a.style.cssText=d);if("string"==typeof b)a.appendChild(document.createTextNode(b));else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);return a}function F(a){for(var b=a.childNodes.length;0<b;--b)a.removeChild(a.firstChild)}function Z(a){for(var b=1;b<arguments.length;b+=2)a.setAttribute(arguments[b],arguments[b+1])}function Q(a,b){b||(b={});for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b}function G(a,b,c,d){a=c?n(a.line,a.ch):a;for(c=0;;){var f=b.indexOf("\n",c);if(-1==f)break;++a.line;d&&++d.line;c=f+1}a.ch=(c?0:a.ch)+(b.length-c);d&&(d.ch=(c?0:d.ch)+(b.length-c));return a}function R(a){this.cm=a;this.alignable=[];this.height=a.doc.height;var b=this;a.on("markerAdded",function(a,d){if(d.collapsed){var c=d.find(1);null!=c&&b.set(c.line,H)}});a.on("markerCleared",function(a,d,f,e){null!=e&&d.collapsed&&b.check(e,H,b.hasMarker)});a.on("markerChanged",this.signal.bind(this));a.on("lineWidgetAdded",function(a,d,f){d.mergeSpacer||(d.above?b.set(f-1,z):b.set(f,ha))});a.on("lineWidgetCleared",function(a,d,f){d.mergeSpacer||(d.above?b.check(f-1,z,b.hasWidgetBelow):b.check(f,ha,b.hasWidget))});a.on("lineWidgetChanged",this.signal.bind(this));a.on("change",function(a,d){var c=d.from.line,e=d.to.line-d.from.line,h=d.text.length-1,g=c+h;(e||h)&&b.map(c,e,h);b.check(g,H,b.hasMarker);(e||h)&&b.check(d.from.line,H,b.hasMarker)});a.on("viewportChange",function(){b.cm.doc.height!=b.height&&b.signal()})}function ia(a,b){var c=null,d=a.state.diffViews,f=a.getCursor().line;if(d)for(var e=0;e<d.length;e++){var h=d[e],g=a==h.orig;B(h);if(0>b)a:{h=h.chunks;for(var k=h.length-1;0<=k;k--){var l=h[k];l=(g?l.origTo:l.editTo)-1;if(l<f){g=l;break a}}g=void 0}else a:{h=h.chunks;for(k=0;k<h.length;k++)if(l=h[k],l=g?l.origFrom:l.editFrom,l>f){g=l;break a}g=void 0}null!=g&&(null==c||(0>b?g>c:g<c))&&(c=g)}if(null!=c)a.setCursor(c,0);else return m.Pass}var n=m.Pos;D.prototype={constructor:D,init:function(a,b,c){this.edit=this.mv.edit;(this.edit.state.diffViews||(this.edit.state.diffViews=[])).push(this);this.orig=m(a,Q({value:b,readOnly:!this.mv.options.allowEditingOriginals},Q(c)));"align"==this.mv.options.connect&&(this.edit.state.trackAlignable||(this.edit.state.trackAlignable=new R(this.edit)),this.orig.state.trackAlignable=new R(this.orig));this.lockButton.title=this.edit.phrase("Toggle locked scrolling");this.orig.state.diffViews=[this];a=c.chunkClassLocation||"background";"[object Array]"!=Object.prototype.toString.call(a)&&(a=[a]);this.classes.classLocation=a;this.diff=S(ea(b),ea(c.value),this.mv.options.ignoreWhitespace);this.chunks=T(this.diff);this.diffOutOfDate=this.dealigned=!1;this.needsScrollSync=null;this.showDifferences=!1!==c.showDifferences},registerEvents:function(a){this.forceUpdate=ja(this);W(this,!0,!1);ka(this,a)},setShowDifferences:function(a){a=!1!==a;a!=this.showDifferences&&(this.showDifferences=a,this.forceUpdate("full"))}};var E=!1,I=m.MergeView=function(a,b){if(!(this instanceof I))return new I(a,b);this.options=b;var c=b.origLeft,d=null==b.origRight?b.orig:b.origRight,f=null!=c,e=null!=d,h=1+(f?1:0)+(e?1:0),g=[],k=this.left=null,l=this.right=null,p=this;if(f){k=this.left=new D(this,"left");var n=w("div",null,"CodeMirror-merge-pane CodeMirror-merge-left");g.push(n);g.push(da(k))}f=w("div",null,"CodeMirror-merge-pane CodeMirror-merge-editor");g.push(f);if(e){l=this.right=new D(this,"right");g.push(da(l));var x=w("div",null,"CodeMirror-merge-pane CodeMirror-merge-right");g.push(x)}(e?x:f).className+=" CodeMirror-merge-pane-rightmost";g.push(w("div",null,null,"height: 0; clear: both;"));var r=this.wrap=a.appendChild(w("div",g,"CodeMirror-merge CodeMirror-merge-"+h+"pane"));this.edit=m(f,Q(b));k&&k.init(n,c,b);l&&l.init(x,d,b);b.collapseIdentical&&this.editor().operation(function(){var a=b.collapseIdentical;"number"!=typeof a&&(a=2);for(var c=[],d=p.editor(),e=d.firstLine(),f=e,g=d.lastLine();f<=g;f++)c.push(!0);p.left&&fa(p.left,a,e,c);p.right&&fa(p.right,a,e,c);for(f=0;f<c.length;f++)if(c[f]){g=f+e;for(var h=1;f<c.length-1&&c[f+1];f++,h++);if(h>a){var k=[{line:g,cm:d}];p.left&&k.push({line:aa(g,p.left.chunks),cm:p.left.orig});p.right&&k.push({line:aa(g,p.right.chunks),cm:p.right.orig});k=pa(h,k);if(p.options.onCollapse)p.options.onCollapse(p,g,h,k)}}});"align"==b.connect&&(this.aligners=[],K(this.left||this.right,!0));k&&k.registerEvents(l);l&&l.registerEvents(k);var u=function(){k&&y(k);l&&y(l)};m.on(window,"resize",u);var t=setInterval(function(){for(var a=r.parentNode;a&&a!=document.body;a=a.parentNode);a||(clearInterval(t),m.off(window,"resize",u))},5E3)};I.prototype={constructor:I,editor:function(){return this.edit},rightOriginal:function(){return this.right&&this.right.orig},leftOriginal:function(){return this.left&&this.left.orig},setShowDifferences:function(a){this.right&&this.right.setShowDifferences(a);this.left&&this.left.setShowDifferences(a)},rightChunks:function(){if(this.right)return B(this.right),this.right.chunks},leftChunks:function(){if(this.left)return B(this.left),this.left.chunks}};var P,ha=1,z=2,H=4;R.prototype={signal:function(){m.signal(this,"realign");this.height=this.cm.doc.height},set:function(a,b){for(var c=-1;c<this.alignable.length;c+=2){var d=this.alignable[c]-a;if(0==d){if((this.alignable[c+1]&b)==b)return;this.alignable[c+1]|=b;this.signal();return}if(0<d)break}this.signal();this.alignable.splice(c,0,a,b)},find:function(a){for(var b=0;b<this.alignable.length;b+=2)if(this.alignable[b]==a)return b;return-1},check:function(a,b,c){var d=this.find(a);-1!=d&&this.alignable[d+1]&b&&!c.call(this,a)&&(this.signal(),(a=this.alignable[d+1]&~b)?this.alignable[d+1]=a:this.alignable.splice(d,2))},hasMarker:function(a){a=this.cm.getLineHandle(a);if(a.markedSpans)for(var b=0;b<a.markedSpans.length;b++)if(a.markedSpans[b].mark.collapsed&&null!=a.markedSpans[b].to)return!0;return!1},hasWidget:function(a){a=this.cm.getLineHandle(a);if(a.widgets)for(var b=0;b<a.widgets.length;b++)if(!a.widgets[b].above&&!a.widgets[b].mergeSpacer)return!0;return!1},hasWidgetBelow:function(a){if(a==this.cm.lastLine())return!1;a=this.cm.getLineHandle(a+1);if(a.widgets)for(var b=0;b<a.widgets.length;b++)if(a.widgets[b].above&&!a.widgets[b].mergeSpacer)return!0;return!1},map:function(a,b,c){for(var d=c-b,f=a+b,e=b=-1,h=0;h<this.alignable.length;h+=2){var g=this.alignable[h];g==a&&this.alignable[h+1]&z&&(b=h);g==f&&this.alignable[h+1]&z&&(e=h);g<=a||(g<f?this.alignable.splice(h--,2):this.alignable[h]+=d)}-1<b&&(d=this.alignable[b+1],d==z?this.alignable.splice(b,2):this.alignable[b+1]=d&~z);-1<e&&c&&this.set(a+c,z)}};m.commands.goNextDiff=function(a){return ia(a,1)};m.commands.goPrevDiff=function(a){return ia(a,-1)}});