{"version":3,"file":"ext-rtl-eed63845.js","sources":["../../node_modules/ace-builds/src-noconflict/ext-rtl.js"],"sourcesContent":["ace.define(\"ace/ext/rtl\",[\"require\",\"exports\",\"module\",\"ace/editor\",\"ace/config\"], function(require, exports, module){\"use strict\";\nvar commands = [{\n name: \"leftToRight\",\n bindKey: { win: \"Ctrl-Alt-Shift-L\", mac: \"Command-Alt-Shift-L\" },\n exec: function (editor) {\n editor.session.$bidiHandler.setRtlDirection(editor, false);\n },\n readOnly: true\n }, {\n name: \"rightToLeft\",\n bindKey: { win: \"Ctrl-Alt-Shift-R\", mac: \"Command-Alt-Shift-R\" },\n exec: function (editor) {\n editor.session.$bidiHandler.setRtlDirection(editor, true);\n },\n readOnly: true\n }];\nvar Editor = require(\"../editor\").Editor;\nrequire(\"../config\").defineOptions(Editor.prototype, \"editor\", {\n rtlText: {\n set: function (val) {\n if (val) {\n this.on(\"change\", onChange);\n this.on(\"changeSelection\", onChangeSelection);\n this.renderer.on(\"afterRender\", updateLineDirection);\n this.commands.on(\"exec\", onCommandEmitted);\n this.commands.addCommands(commands);\n }\n else {\n this.off(\"change\", onChange);\n this.off(\"changeSelection\", onChangeSelection);\n this.renderer.off(\"afterRender\", updateLineDirection);\n this.commands.off(\"exec\", onCommandEmitted);\n this.commands.removeCommands(commands);\n clearTextLayer(this.renderer);\n }\n this.renderer.updateFull();\n }\n },\n rtl: {\n set: function (val) {\n this.session.$bidiHandler.$isRtl = val;\n if (val) {\n this.setOption(\"rtlText\", false);\n this.renderer.on(\"afterRender\", updateLineDirection);\n this.session.$bidiHandler.seenBidi = true;\n }\n else {\n this.renderer.off(\"afterRender\", updateLineDirection);\n clearTextLayer(this.renderer);\n }\n this.renderer.updateFull();\n }\n }\n});\nfunction onChangeSelection(e, editor) {\n var lead = editor.getSelection().lead;\n if (editor.session.$bidiHandler.isRtlLine(lead.row)) {\n if (lead.column === 0) {\n if (editor.session.$bidiHandler.isMoveLeftOperation && lead.row > 0) {\n editor.getSelection().moveCursorTo(lead.row - 1, editor.session.getLine(lead.row - 1).length);\n }\n else {\n if (editor.getSelection().isEmpty())\n lead.column += 1;\n else\n lead.setPosition(lead.row, lead.column + 1);\n }\n }\n }\n}\nfunction onCommandEmitted(commadEvent) {\n commadEvent.editor.session.$bidiHandler.isMoveLeftOperation = /gotoleft|selectleft|backspace|removewordleft/.test(commadEvent.command.name);\n}\nfunction onChange(delta, editor) {\n var session = editor.session;\n session.$bidiHandler.currentRow = null;\n if (session.$bidiHandler.isRtlLine(delta.start.row) && delta.action === 'insert' && delta.lines.length > 1) {\n for (var row = delta.start.row; row < delta.end.row; row++) {\n if (session.getLine(row + 1).charAt(0) !== session.$bidiHandler.RLE)\n session.doc.$lines[row + 1] = session.$bidiHandler.RLE + session.getLine(row + 1);\n }\n }\n}\nfunction updateLineDirection(e, renderer) {\n var session = renderer.session;\n var $bidiHandler = session.$bidiHandler;\n var cells = renderer.$textLayer.$lines.cells;\n var width = renderer.layerConfig.width - renderer.layerConfig.padding + \"px\";\n cells.forEach(function (cell) {\n var style = cell.element.style;\n if ($bidiHandler && $bidiHandler.isRtlLine(cell.row)) {\n style.direction = \"rtl\";\n style.textAlign = \"right\";\n style.width = width;\n }\n else {\n style.direction = \"\";\n style.textAlign = \"\";\n style.width = \"\";\n }\n });\n}\nfunction clearTextLayer(renderer) {\n var lines = renderer.$textLayer.$lines;\n lines.cells.forEach(clear);\n lines.cellCache.forEach(clear);\n function clear(cell) {\n var style = cell.element.style;\n style.direction = style.textAlign = style.width = \"\";\n }\n}\n\n}); (function() {\n ace.require([\"ace/ext/rtl\"], function(m) {\n if (typeof module == \"object\" && typeof exports == \"object\" && module) {\n module.exports = m;\n }\n });\n })();\n "],"names":["require","exports","module","commands","editor","Editor","val","onChange","onChangeSelection","updateLineDirection","onCommandEmitted","clearTextLayer","lead","commadEvent","delta","session","row","renderer","$bidiHandler","cells","width","cell","style","lines","clear","m"],"mappings":"gaAAA,IAAI,OAAO,cAAc,CAAC,UAAU,UAAU,S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