//>>built define("xace/views/AceDiff",["dojo/_base/declare","dojo/_base/lang"],function(K,Q){function v(a,b){var d=a.options.mode;b===h.EDITOR_LEFT&&null!==a.options.left.mode&&(d=a.options.left.mode);b===h.EDITOR_RIGHT&&null!==a.options.right.mode&&(d=a.options.right.mode);return d}function L(a){var b=(new Date).getTime(),d=(new Date).getTime(),c;a.editors.left.ace.getSession().on("changeScrollTop",function(b){c=(new Date).getTime();d+50d?"lines":"targetOnly");c--;b.markers.push(b.ace.session.addMarker(new B(d,0,c,1),a,"fullLine"))}function q(a){a.editors.left.markers.forEach(function(a){this.editors.left.ace.getSession().removeMarker(a)}, a);a.editors.right.markers.forEach(function(a){this.editors.right.ace.getSession().removeMarker(a)},a)}function w(a){var b=a.editors.left.ace.getSession().getScrollTop(),d=a.editors.right.ace.getSession().getScrollTop();a.copyRightContainer.style.cssText="top: "+-b+"px";a.copyLeftContainer.style.cssText="top: "+-d+"px"}function C(a,b,d,c,e){var f={},g=/^\n/.test(e);if(b===h.DIFF_INSERT){b=D(a.editors.left,d,e);var k=E(a.editors.right,c),f=l(a.editors.right,k).length;d=l(a.editors.left,b.startLine).length; var n=l(a.editors.left,b.startLine).length,m=k;0===n&&g&&(g=!1);0===b.startChar&&F(a.editors.right,c,g)&&(m=k+1);a=b.startLine===b.endLine;g=0;(0b:1>=b}var c=[];b.forEach(function(a,b){if(0===b)c.push(a);else{for(var f=!1,e=0;ea.leftStartLine&&this.options.left.copyLinkEnabled&&(b=G({className:this.options.classes.newCodeConnectorLink,topOffset:a.leftStartLine*this.lineHeight,tooltip:"Copy to right",diffIndex:d,arrowContent:this.options.classes.newCodeConnectorLinkContent}),this.copyRightContainer.appendChild(b));a.rightEndLine>a.rightStartLine&&this.options.right.copyLinkEnabled&&(b=G({className:this.options.classes.deletedCodeConnectorLink,topOffset:a.rightStartLine*this.lineHeight, tooltip:"Copy to left",diffIndex:d,arrowContent:this.options.classes.deletedCodeConnectorLinkContent}),this.copyLeftContainer.appendChild(b))}},a)}function u(){var a,b,d,c,e,f=arguments[0]||{},g=1,k=arguments.length,h=!1,m=Object.prototype.toString,r=Object.prototype.hasOwnProperty,l={"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object"}, p={isFunction:function(a){return"function"===p.type(a)},isArray:Array.isArray||function(a){return"array"===p.type(a)},isWindow:function(a){return null!==a&&a===a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return null===a?String(a):l[m.call(a)]||"object"},isPlainObject:function(a){if(!a||"object"!==p.type(a)||a.nodeType)return!1;try{if(a.constructor&&!r.call(a,"constructor")&&!r.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(R){return!1}for(var b in a); return void 0===b||r.call(a,b)}};"boolean"===typeof f&&(h=f,f=arguments[1]||{},g=2);"object"===typeof f||p.isFunction(f)||(f={});k===g&&(f=this,--g);for(g;gthis.options.maxDiffs||(q(this),t(this))},destroy:function(){var a=this.editors.left.ace.getValue();this.editors.left.ace.destroy(); var b=this.editors.left.ace.container,d=b.cloneNode(!1);d.textContent=a;b.parentNode.replaceChild(d,b);a=this.editors.right.ace.getValue();this.editors.right.ace.destroy();b=this.editors.right.ace.container;d=b.cloneNode(!1);d.textContent=a;b.parentNode.replaceChild(d,b);document.getElementById(this.options.classes.gutterID).innerHTML=""},create:function(a){B=ace.require("ace/range").Range;this.options={};u(!0,this.options,{mode:null,theme:null,diffGranularity:h.DIFF_GRANULARITY_BROAD,lockScrolling:!1, showDiffs:!0,showConnectors:!0,maxDiffs:5E3,left:{id:"acediff-left-editor",content:null,mode:null,theme:null,editable:!0,copyLinkEnabled:!0},right:{id:"acediff-right-editor",content:null,mode:null,theme:null,editable:!0,copyLinkEnabled:!0},classes:{gutterID:"acediff-gutter",diff:"acediff-diff",connector:"acediff-connector",newCodeConnectorLink:"acediff-new-code-connector-copy",newCodeConnectorLinkContent:"\x26#8594;",deletedCodeConnectorLink:"acediff-deleted-code-connector-copy",deletedCodeConnectorLinkContent:"\x26#8592;", copyRightContainer:"acediff-copy-right",copyLeftContainer:"acediff-copy-left"},connectorYOffset:0},a);this.editors={left:{ace:a.leftAce||ace.edit(this.options.left.id),markers:[],lineLengths:[]},right:{ace:a.rightAce||ace.edit(this.options.right.id),markers:[],lineLengths:[]},editorHeight:null};L(this);this.lineHeight=this.editors.left.ace.renderer.lineHeight;this.editors.left.ace.getSession().setMode(v(this,h.EDITOR_LEFT));this.editors.right.ace.getSession().setMode(v(this,h.EDITOR_RIGHT));this.editors.left.ace.setReadOnly(!this.options.left.editable); this.editors.right.ace.setReadOnly(!this.options.right.editable);this.copyRightContainer=document.createElement("div");this.copyRightContainer.setAttribute("class",this.options.classes.copyRightContainer);this.copyLeftContainer=document.createElement("div");this.copyLeftContainer.setAttribute("class",this.options.classes.copyLeftContainer);document.getElementById(this.options.classes.gutterID).appendChild(this.copyRightContainer);document.getElementById(this.options.classes.gutterID).appendChild(this.copyLeftContainer); H(this);this.options.left.content&&this.editors.left.ace.setValue(this.options.left.content,-1);this.options.right.content&&this.editors.right.ace.setValue(this.options.right.content,-1);this.editors.editorHeight=this.options.leftAce.container.offsetHeight;this.diff()}})}); //# sourceMappingURL=AceDiff.js.map