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