text: define("ace/ext/rtl",["require","exports","module","ace/editor","ace/config"],function(e,t,i){"use strict";var n=[{name:"leftToRight",bindKey:{win:"Ctrl-Alt-Shift-L",mac:"Command-Alt-Shift-L"},exec:function(e){e.session.$bidiHandler.setRtlDirection(e,false)},readOnly:true},{name:"rightToLeft",bindKey:{win:"Ctrl-Alt-Shift-R",mac:"Command-Alt-Shift-R"},exec:function(e){e.session.$bidiHandler.setRtlDirection(e,true)},readOnly:true}];var r=e("../editor").Editor;e("../config").defineOptions(r.prototype,"editor",{rtlText:{set:function(e){if(e){this.on("change",l);this.on("changeSelection",o);this.renderer.on("afterRender",d);this.commands.on("exec",s);this.commands.addCommands(n)}else{this.off("change",l);this.off("changeSelection",o);this.renderer.off("afterRender",d);this.commands.off("exec",s);this.commands.removeCommands(n);a(this.renderer)}this.renderer.updateFull()}},rtl:{set:function(e){this.session.$bidiHandler.$isRtl=e;if(e){this.setOption("rtlText",false);this.renderer.on("afterRender",d);this.session.$bidiHandler.seenBidi=true}else{this.renderer.off("afterRender",d);a(this.renderer)}this.renderer.updateFull()}}});function o(e,t){var i=t.getSelection().lead;if(t.session.$bidiHandler.isRtlLine(i.row)){if(i.column===0){if(t.session.$bidiHandler.isMoveLeftOperation&&i.row>0){t.getSelection().moveCursorTo(i.row-1,t.session.getLine(i.row-1).length)}else{if(t.getSelection().isEmpty())i.column+=1;else i.setPosition(i.row,i.column+1)}}}}function s(e){e.editor.session.$bidiHandler.isMoveLeftOperation=/gotoleft|selectleft|backspace|removewordleft/.test(e.command.name)}function l(e,t){var i=t.session;i.$bidiHandler.currentRow=null;if(i.$bidiHandler.isRtlLine(e.start.row)&&e.action==="insert"&&e.lines.length>1){for(var n=e.start.row;n<e.end.row;n++){if(i.getLine(n+1).charAt(0)!==i.$bidiHandler.RLE)i.doc.$lines[n+1]=i.$bidiHandler.RLE+i.getLine(n+1)}}}function d(e,t){var i=t.session;var n=i.$bidiHandler;var r=t.$textLayer.$lines.cells;var o=t.layerConfig.width-t.layerConfig.padding+"px";r.forEach(function(e){var t=e.element.style;if(n&&n.isRtlLine(e.row)){t.direction="rtl";t.textAlign="right";t.width=o}else{t.direction="";t.textAlign="";t.width=""}})}function a(e){var t=e.$textLayer.$lines;t.cells.forEach(i);t.cellCache.forEach(i);function i(e){var t=e.element.style;t.direction=t.textAlign=t.width=""}}});(function(){window.require(["ace/ext/rtl"],function(e){if(typeof module=="object"&&typeof exports=="object"&&module){module.exports=e}})})();