web-interface.assets.2f25a4dc442bc9aebc58cae30c50c3e2.js.map Maven / Gradle / Ivy
{"version":3,"sources":["webpack://graylog-web-interface/2f25a4dc442bc9aebc58cae30c50c3e2.js"],"sourcesContent":["ace.define(\"ace/ext/whitespace\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\"], function(require, exports, module){\"use strict\";\nvar lang = require(\"../lib/lang\");\nexports.$detectIndentation = function (lines, fallback) {\n var stats = [];\n var changes = [];\n var tabIndents = 0;\n var prevSpaces = 0;\n var max = Math.min(lines.length, 1000);\n for (var i = 0; i < max; i++) {\n var line = lines[i];\n if (!/^\\s*[^*+\\-\\s]/.test(line))\n continue;\n if (line[0] == \"\\t\") {\n tabIndents++;\n prevSpaces = -Number.MAX_VALUE;\n }\n else {\n var spaces = line.match(/^ */)[0].length;\n if (spaces && line[spaces] != \"\\t\") {\n var diff = spaces - prevSpaces;\n if (diff > 0 && !(prevSpaces % diff) && !(spaces % diff))\n changes[diff] = (changes[diff] || 0) + 1;\n stats[spaces] = (stats[spaces] || 0) + 1;\n }\n prevSpaces = spaces;\n }\n while (i < max && line[line.length - 1] == \"\\\\\")\n line = lines[i++];\n }\n function getScore(indent) {\n var score = 0;\n for (var i = indent; i < stats.length; i += indent)\n score += stats[i] || 0;\n return score;\n }\n var changesTotal = changes.reduce(function (a, b) { return a + b; }, 0);\n var first = { score: 0, length: 0 };\n var spaceIndents = 0;\n for (var i = 1; i < 12; i++) {\n var score = getScore(i);\n if (i == 1) {\n spaceIndents = score;\n score = stats[1] ? 0.9 : 0.8;\n if (!stats.length)\n score = 0;\n }\n else\n score /= spaceIndents;\n if (changes[i])\n score += changes[i] / changesTotal;\n if (score > first.score)\n first = { score: score, length: i };\n }\n if (first.score && first.score > 1.4)\n var tabLength = first.length;\n if (tabIndents > spaceIndents + 1) {\n if (tabLength == 1 || spaceIndents < tabIndents / 4 || first.score < 1.8)\n tabLength = undefined;\n return { ch: \"\\t\", length: tabLength };\n }\n if (spaceIndents > tabIndents + 1)\n return { ch: \" \", length: tabLength };\n};\nexports.detectIndentation = function (session) {\n var lines = session.getLines(0, 1000);\n var indent = exports.$detectIndentation(lines) || {};\n if (indent.ch)\n session.setUseSoftTabs(indent.ch == \" \");\n if (indent.length)\n session.setTabSize(indent.length);\n return indent;\n};\nexports.trimTrailingSpace = function (session, options) {\n var doc = session.getDocument();\n var lines = doc.getAllLines();\n var min = options && options.trimEmpty ? -1 : 0;\n var cursors = [], ci = -1;\n if (options && options.keepCursorPosition) {\n if (session.selection.rangeCount) {\n session.selection.rangeList.ranges.forEach(function (x, i, ranges) {\n var next = ranges[i + 1];\n if (next && next.cursor.row == x.cursor.row)\n return;\n cursors.push(x.cursor);\n });\n }\n else {\n cursors.push(session.selection.getCursor());\n }\n ci = 0;\n }\n var cursorRow = cursors[ci] && cursors[ci].row;\n for (var i = 0, l = lines.length; i < l; i++) {\n var line = lines[i];\n var index = line.search(/\\s+$/);\n if (i == cursorRow) {\n if (index < cursors[ci].column && index > min)\n index = cursors[ci].column;\n ci++;\n cursorRow = cursors[ci] ? cursors[ci].row : -1;\n }\n if (index > min)\n doc.removeInLine(i, index, line.length);\n }\n};\nexports.convertIndentation = function (session, ch, len) {\n var oldCh = session.getTabString()[0];\n var oldLen = session.getTabSize();\n if (!len)\n len = oldLen;\n if (!ch)\n ch = oldCh;\n var tab = ch == \"\\t\" ? ch : lang.stringRepeat(ch, len);\n var doc = session.doc;\n var lines = doc.getAllLines();\n var cache = {};\n var spaceCache = {};\n for (var i = 0, l = lines.length; i < l; i++) {\n var line = lines[i];\n var match = line.match(/^\\s*/)[0];\n if (match) {\n var w = session.$getStringScreenWidth(match)[0];\n var tabCount = Math.floor(w / oldLen);\n var reminder = w % oldLen;\n var toInsert = cache[tabCount] || (cache[tabCount] = lang.stringRepeat(tab, tabCount));\n toInsert += spaceCache[reminder] || (spaceCache[reminder] = lang.stringRepeat(\" \", reminder));\n if (toInsert != match) {\n doc.removeInLine(i, 0, match.length);\n doc.insertInLine({ row: i, column: 0 }, toInsert);\n }\n }\n }\n session.setTabSize(len);\n session.setUseSoftTabs(ch == \" \");\n};\nexports.$parseStringArg = function (text) {\n var indent = {};\n if (/t/.test(text))\n indent.ch = \"\\t\";\n else if (/s/.test(text))\n indent.ch = \" \";\n var m = text.match(/\\d+/);\n if (m)\n indent.length = parseInt(m[0], 10);\n return indent;\n};\nexports.$parseArg = function (arg) {\n if (!arg)\n return {};\n if (typeof arg == \"string\")\n return exports.$parseStringArg(arg);\n if (typeof arg.text == \"string\")\n return exports.$parseStringArg(arg.text);\n return arg;\n};\nexports.commands = [{\n name: \"detectIndentation\",\n description: \"Detect indentation from content\",\n exec: function (editor) {\n exports.detectIndentation(editor.session);\n }\n }, {\n name: \"trimTrailingSpace\",\n description: \"Trim trailing whitespace\",\n exec: function (editor, args) {\n exports.trimTrailingSpace(editor.session, args);\n }\n }, {\n name: \"convertIndentation\",\n description: \"Convert indentation to ...\",\n exec: function (editor, arg) {\n var indent = exports.$parseArg(arg);\n exports.convertIndentation(editor.session, indent.ch, indent.length);\n }\n }, {\n name: \"setIndentation\",\n description: \"Set indentation\",\n exec: function (editor, arg) {\n var indent = exports.$parseArg(arg);\n indent.length && editor.session.setTabSize(indent.length);\n indent.ch && editor.session.setUseSoftTabs(indent.ch == \" \");\n }\n }];\n\n}); (function() {\n ace.require([\"ace/ext/whitespace\"], 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,qBAAqB,CAAC,UAAU,UAAU,SAAS,cAAc,EAAG,SAASC,EAASF,EAASC,EAAO,CAAC,aAClH,IAAIE,EAAOD,EAAQ,aAAa,EAChCF,EAAQ,mBAAqB,SAAUI,EAAOC,EAAU,CAMpD,QALIC,EAAQ,CAAC,EACTC,EAAU,CAAC,EACXC,EAAa,EACbC,EAAa,EACbC,EAAM,KAAK,IAAIN,EAAM,OAAQ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GAAG","names":["require_f25a4dc442bc9aebc58cae30c50c3e2","__commonJSMin","exports","module","require","lang","lines","fallback","stats","changes","tabIndents","prevSpaces","max","i","line","spaces","diff","getScore","indent","score","changesTotal","a","b","first","spaceIndents","tabLength","session","options","doc","min","cursors","ci","x","ranges","next","cursorRow","l","index","ch","len","oldCh","oldLen","tab","cache","spaceCache","match","w","tabCount","reminder","toInsert","text","m","arg","editor","args"],"sourceRoot":"","file":"2f25a4dc442bc9aebc58cae30c50c3e2.js"}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy