All Downloads are FREE. Search and download functionalities are using the official Maven repository.

web-interface.assets.8b8336037f074d9dcbd20eab535b803f.js.map Maven / Gradle / Ivy

There is a newer version: 6.1.4
Show newest version
{"version":3,"sources":["webpack://graylog-web-interface/8b8336037f074d9dcbd20eab535b803f.js"],"sourcesContent":["ace.define(\"ace/ext/elastic_tabstops_lite\",[\"require\",\"exports\",\"module\",\"ace/editor\",\"ace/config\"], function(require, exports, module){\"use strict\";\nvar ElasticTabstopsLite = /** @class */ (function () {\n    function ElasticTabstopsLite(editor) {\n        this.$editor = editor;\n        var self = this;\n        var changedRows = [];\n        var recordChanges = false;\n        this.onAfterExec = function () {\n            recordChanges = false;\n            self.processRows(changedRows);\n            changedRows = [];\n        };\n        this.onExec = function () {\n            recordChanges = true;\n        };\n        this.onChange = function (delta) {\n            if (recordChanges) {\n                if (changedRows.indexOf(delta.start.row) == -1)\n                    changedRows.push(delta.start.row);\n                if (delta.end.row != delta.start.row)\n                    changedRows.push(delta.end.row);\n            }\n        };\n    }\n    ElasticTabstopsLite.prototype.processRows = function (rows) {\n        this.$inChange = true;\n        var checkedRows = [];\n        for (var r = 0, rowCount = rows.length; r < rowCount; r++) {\n            var row = rows[r];\n            if (checkedRows.indexOf(row) > -1)\n                continue;\n            var cellWidthObj = this.$findCellWidthsForBlock(row);\n            var cellWidths = this.$setBlockCellWidthsToMax(cellWidthObj.cellWidths);\n            var rowIndex = cellWidthObj.firstRow;\n            for (var w = 0, l = cellWidths.length; w < l; w++) {\n                var widths = cellWidths[w];\n                checkedRows.push(rowIndex);\n                this.$adjustRow(rowIndex, widths);\n                rowIndex++;\n            }\n        }\n        this.$inChange = false;\n    };\n    ElasticTabstopsLite.prototype.$findCellWidthsForBlock = function (row) {\n        var cellWidths = [], widths;\n        var rowIter = row;\n        while (rowIter >= 0) {\n            widths = this.$cellWidthsForRow(rowIter);\n            if (widths.length == 0)\n                break;\n            cellWidths.unshift(widths);\n            rowIter--;\n        }\n        var firstRow = rowIter + 1;\n        rowIter = row;\n        var numRows = this.$editor.session.getLength();\n        while (rowIter < numRows - 1) {\n            rowIter++;\n            widths = this.$cellWidthsForRow(rowIter);\n            if (widths.length == 0)\n                break;\n            cellWidths.push(widths);\n        }\n        return { cellWidths: cellWidths, firstRow: firstRow };\n    };\n    ElasticTabstopsLite.prototype.$cellWidthsForRow = function (row) {\n        var selectionColumns = this.$selectionColumnsForRow(row);\n        var tabs = [-1].concat(this.$tabsForRow(row));\n        var widths = tabs.map(function (el) { return 0; }).slice(1);\n        var line = this.$editor.session.getLine(row);\n        for (var i = 0, len = tabs.length - 1; i < len; i++) {\n            var leftEdge = tabs[i] + 1;\n            var rightEdge = tabs[i + 1];\n            var rightmostSelection = this.$rightmostSelectionInCell(selectionColumns, rightEdge);\n            var cell = line.substring(leftEdge, rightEdge);\n            widths[i] = Math.max(cell.replace(/\\s+$/g, '').length, rightmostSelection - leftEdge);\n        }\n        return widths;\n    };\n    ElasticTabstopsLite.prototype.$selectionColumnsForRow = function (row) {\n        var selections = [], cursor = this.$editor.getCursorPosition();\n        if (this.$editor.session.getSelection().isEmpty()) {\n            if (row == cursor.row)\n                selections.push(cursor.column);\n        }\n        return selections;\n    };\n    ElasticTabstopsLite.prototype.$setBlockCellWidthsToMax = function (cellWidths) {\n        var startingNewBlock = true, blockStartRow, blockEndRow, maxWidth;\n        var columnInfo = this.$izip_longest(cellWidths);\n        for (var c = 0, l = columnInfo.length; c < l; c++) {\n            var column = columnInfo[c];\n            if (!column.push) {\n                console.error(column);\n                continue;\n            }\n            column.push(NaN);\n            for (var r = 0, s = column.length; r < s; r++) {\n                var width = column[r];\n                if (startingNewBlock) {\n                    blockStartRow = r;\n                    maxWidth = 0;\n                    startingNewBlock = false;\n                }\n                if (isNaN(width)) {\n                    blockEndRow = r;\n                    for (var j = blockStartRow; j < blockEndRow; j++) {\n                        cellWidths[j][c] = maxWidth;\n                    }\n                    startingNewBlock = true;\n                }\n                maxWidth = Math.max(maxWidth, width);\n            }\n        }\n        return cellWidths;\n    };\n    ElasticTabstopsLite.prototype.$rightmostSelectionInCell = function (selectionColumns, cellRightEdge) {\n        var rightmost = 0;\n        if (selectionColumns.length) {\n            var lengths = [];\n            for (var s = 0, length = selectionColumns.length; s < length; s++) {\n                if (selectionColumns[s] <= cellRightEdge)\n                    lengths.push(s);\n                else\n                    lengths.push(0);\n            }\n            rightmost = Math.max.apply(Math, lengths);\n        }\n        return rightmost;\n    };\n    ElasticTabstopsLite.prototype.$tabsForRow = function (row) {\n        var rowTabs = [], line = this.$editor.session.getLine(row), re = /\\t/g, match;\n        while ((match = re.exec(line)) != null) {\n            rowTabs.push(match.index);\n        }\n        return rowTabs;\n    };\n    ElasticTabstopsLite.prototype.$adjustRow = function (row, widths) {\n        var rowTabs = this.$tabsForRow(row);\n        if (rowTabs.length == 0)\n            return;\n        var bias = 0, location = -1;\n        var expandedSet = this.$izip(widths, rowTabs);\n        for (var i = 0, l = expandedSet.length; i < l; i++) {\n            var w = expandedSet[i][0], it = expandedSet[i][1];\n            location += 1 + w;\n            it += bias;\n            var difference = location - it;\n            if (difference == 0)\n                continue;\n            var partialLine = this.$editor.session.getLine(row).substr(0, it);\n            var strippedPartialLine = partialLine.replace(/\\s*$/g, \"\");\n            var ispaces = partialLine.length - strippedPartialLine.length;\n            if (difference > 0) {\n                this.$editor.session.getDocument().insertInLine({ row: row, column: it + 1 }, Array(difference + 1).join(\" \") + \"\\t\");\n                this.$editor.session.getDocument().removeInLine(row, it, it + 1);\n                bias += difference;\n            }\n            if (difference < 0 && ispaces >= -difference) {\n                this.$editor.session.getDocument().removeInLine(row, it + difference, it);\n                bias += difference;\n            }\n        }\n    };\n    ElasticTabstopsLite.prototype.$izip_longest = function (iterables) {\n        if (!iterables[0])\n            return [];\n        var longest = iterables[0].length;\n        var iterablesLength = iterables.length;\n        for (var i = 1; i < iterablesLength; i++) {\n            var iLength = iterables[i].length;\n            if (iLength > longest)\n                longest = iLength;\n        }\n        var expandedSet = [];\n        for (var l = 0; l < longest; l++) {\n            var set = [];\n            for (var i = 0; i < iterablesLength; i++) {\n                if (iterables[i][l] === \"\")\n                    set.push(NaN);\n                else\n                    set.push(iterables[i][l]);\n            }\n            expandedSet.push(set);\n        }\n        return expandedSet;\n    };\n    ElasticTabstopsLite.prototype.$izip = function (widths, tabs) {\n        var size = widths.length >= tabs.length ? tabs.length : widths.length;\n        var expandedSet = [];\n        for (var i = 0; i < size; i++) {\n            var set = [widths[i], tabs[i]];\n            expandedSet.push(set);\n        }\n        return expandedSet;\n    };\n    return ElasticTabstopsLite;\n}());\nexports.ElasticTabstopsLite = ElasticTabstopsLite;\nvar Editor = require(\"../editor\").Editor;\nrequire(\"../config\").defineOptions(Editor.prototype, \"editor\", {\n    useElasticTabstops: {\n        set: function (val) {\n            if (val) {\n                if (!this.elasticTabstops)\n                    this.elasticTabstops = new ElasticTabstopsLite(this);\n                this.commands.on(\"afterExec\", this.elasticTabstops.onAfterExec);\n                this.commands.on(\"exec\", this.elasticTabstops.onExec);\n                this.on(\"change\", this.elasticTabstops.onChange);\n            }\n            else if (this.elasticTabstops) {\n                this.commands.removeListener(\"afterExec\", this.elasticTabstops.onAfterExec);\n                this.commands.removeListener(\"exec\", this.elasticTabstops.onExec);\n                this.removeListener(\"change\", this.elasticTabstops.onChange);\n            }\n        }\n    }\n});\n\n});                (function() {\n                    ace.require([\"ace/ext/elastic_tabstops_lite\"], function(m) {\n                        if (typeof module == \"object\" && typeof exports == \"object\" && module) {\n                            module.exports = m;\n                        }\n                    });\n                })();\n            "],"mappings":"oEAAA,IAAAA,EAAAC,EAAA,CAAAC,EAAAC,IAAA,KAAI,OAAO,gCAAgC,CAAC,UAAU,UAAU,SAAS,aAAa,YAAY,EAAG,SAASC,EAASF,EAASC,EAAO,CAAC,aACxI,IAAIE,EAAqC,UAAY,CACjD,SAASA,EAAoBC,EAAQ,CACjC,KAAK,QAAUA,EACf,IAAIC,EAAO,KACPC,EAAc,CAAC,EACfC,EAAgB,GACpB,KAAK,YAAc,UAAY,C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G,CACxB,CACA,OAAOV,CACX,EACAnD,EAAoB,UAAU,MAAQ,SAAUgB,EAAQK,EAAM,CAG1D,QAFIyC,EAAO9C,EAAO,QAAUK,EAAK,OAASA,EAAK,OAASL,EAAO,OAC3DmC,EAAc,CAAC,EACV3B,EAAI,EAAGA,EAAIsC,EAAMtC,IAAK,CAC3B,IAAIqC,EAAM,CAAC7C,EAAOQ,CAAC,EAAGH,EAAKG,CAAC,CAAC,EAC7B2B,EAAY,KAAKU,CAAG,CACxB,CACA,OAAOV,CACX,EACOnD,CACX,EAAE,EACFH,EAAQ,oBAAsBG,EAC9B,IAAI+D,EAAShE,EAAQ,WAAW,EAAE,OAClCA,EAAQ,WAAW,EAAE,cAAcgE,EAAO,UAAW,SAAU,CAC3D,mBAAoB,CAChB,IAAK,SAAUC,EAAK,CACZA,GACK,KAAK,kBACN,KAAK,gBAAkB,IAAIhE,EAAoB,IAAI,GACvD,KAAK,SAAS,GAAG,YAAa,KAAK,gBAAgB,WAAW,EAC9D,KAAK,SAAS,GAAG,OAAQ,KAAK,gBAAgB,MAAM,EACpD,KAAK,GAAG,SAAU,KAAK,gBAAgB,QAAQ,GAE1C,KAAK,kBACV,KAAK,SAAS,eAAe,YAAa,KAAK,gBAAgB,WAAW,EAC1E,KAAK,SAAS,eAAe,OAAQ,KAAK,gBAAgB,MAAM,EAChE,KAAK,eAAe,SAAU,KAAK,gBAAgB,QAAQ,EAEnE,CACJ,CACJ,CAAC,CAED,CAAC,GAAmB,UAAW,CACX,IAAI,QAAQ,CAAC,+BAA+B,EAAG,SAASiE,EAAG,CACnD,OAAOnE,GAAU,UAAY,OAAOD,GAAW,UAAYC,IAC3DA,EAAO,QAAUmE,EAEzB,CAAC,CACL,GAAG","names":["require_b8336037f074d9dcbd20eab535b803f","__commonJSMin","exports","module","require","ElasticTabstopsLite","editor","self","changedRows","recordChanges","delta","rows","checkedRows","r","rowCount","row","cellWidthObj","cellWidths","rowIndex","w","l","widths","rowIter","firstRow","numRows","selectionColumns","tabs","el","line","i","len","leftEdge","rightEdge","rightmostSelection","cell","selections","cursor","startingNewBlock","blockStartRow","blockEndRow","maxWidth","columnInfo","c","column","s","width","j","cellRightEdge","rightmost","lengths","length","rowTabs","re","match","bias","location","expandedSet","it","difference","partialLine","strippedPartialLine","ispaces","iterables","longest","iterablesLength","iLength","set","size","Editor","val","m"],"sourceRoot":"","file":"8b8336037f074d9dcbd20eab535b803f.js"}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy