From 8bf516263c6582771e7576e8484ca8cfaa8cb9cb Mon Sep 17 00:00:00 2001 From: "Cheng-Han, Wu" Date: Wed, 20 Apr 2016 18:11:40 +0800 Subject: [PATCH] Update CodeMirror to 5.13.5 --- .../codemirror/addon/comment/comment.js | 11 +- .../vendor/codemirror/addon/dialog/dialog.js | 4 +- .../codemirror/addon/display/placeholder.js | 2 + .../vendor/codemirror/addon/hint/show-hint.js | 11 +- .../vendor/codemirror/addon/hint/sql-hint.js | 59 ++- public/vendor/codemirror/addon/lint/lint.js | 15 +- .../vendor/codemirror/addon/merge/merge.css | 1 + public/vendor/codemirror/addon/merge/merge.js | 5 +- .../addon/scroll/simplescrollbars.js | 18 +- .../addon/search/match-highlighter.js | 2 +- .../vendor/codemirror/addon/search/search.js | 7 +- .../codemirror/addon/selection/active-line.js | 3 + public/vendor/codemirror/addon/tern/tern.js | 4 +- public/vendor/codemirror/codemirror.min.js | 32 +- public/vendor/codemirror/keymap/sublime.js | 4 +- public/vendor/codemirror/keymap/vim.js | 53 ++- public/vendor/codemirror/lib/codemirror.css | 4 + public/vendor/codemirror/lib/codemirror.js | 55 +-- public/vendor/codemirror/mode/clike/clike.js | 87 ++-- .../vendor/codemirror/mode/clojure/clojure.js | 9 +- .../vendor/codemirror/mode/crystal/crystal.js | 2 +- public/vendor/codemirror/mode/dart/dart.js | 27 ++ .../vendor/codemirror/mode/django/django.js | 23 +- public/vendor/codemirror/mode/dtd/dtd.js | 12 +- public/vendor/codemirror/mode/dylan/dylan.js | 89 +++- public/vendor/codemirror/mode/dylan/test.js | 88 ++++ public/vendor/codemirror/mode/fcl/fcl.js | 173 ++++++++ public/vendor/codemirror/mode/fcl/index.html | 108 +++++ public/vendor/codemirror/mode/gfm/index.html | 2 +- public/vendor/codemirror/mode/gfm/test.js | 6 + public/vendor/codemirror/mode/haml/haml.js | 2 +- .../codemirror/mode/handlebars/index.html | 7 +- .../mode/haskell-literate/haskell-literate.js | 2 +- .../codemirror/mode/htmlembedded/index.html | 2 +- .../codemirror/mode/htmlmixed/htmlmixed.js | 42 +- public/vendor/codemirror/mode/index.html | 6 + public/vendor/codemirror/mode/jsx/jsx.js | 6 +- public/vendor/codemirror/mode/julia/julia.js | 150 ++++--- .../codemirror/mode/markdown/markdown.js | 4 +- .../vendor/codemirror/mode/markdown/test.js | 18 +- .../mode/mathematica/mathematica.js | 1 + public/vendor/codemirror/mode/meta.js | 21 +- .../vendor/codemirror/mode/octave/index.html | 2 +- public/vendor/codemirror/mode/pegjs/pegjs.js | 10 +- public/vendor/codemirror/mode/perl/perl.js | 2 +- .../codemirror/mode/powershell/index.html | 204 +++++++++ .../codemirror/mode/powershell/powershell.js | 396 ++++++++++++++++++ .../vendor/codemirror/mode/powershell/test.js | 72 ++++ .../codemirror/mode/properties/properties.js | 2 +- .../codemirror/mode/protobuf/index.html | 64 +++ .../codemirror/mode/protobuf/protobuf.js | 68 +++ .../vendor/codemirror/mode/puppet/puppet.js | 2 +- .../vendor/codemirror/mode/python/index.html | 2 +- .../vendor/codemirror/mode/python/python.js | 63 +-- public/vendor/codemirror/mode/r/r.js | 2 + public/vendor/codemirror/mode/sas/index.html | 81 ++++ public/vendor/codemirror/mode/sas/sas.js | 315 ++++++++++++++ .../vendor/codemirror/mode/sparql/sparql.js | 8 +- .../mode/spreadsheet/spreadsheet.js | 5 +- public/vendor/codemirror/mode/sql/index.html | 4 +- public/vendor/codemirror/mode/sql/sql.js | 28 +- public/vendor/codemirror/mode/swift/swift.js | 47 ++- public/vendor/codemirror/mode/tcl/tcl.js | 32 +- .../codemirror/mode/tiddlywiki/tiddlywiki.js | 206 ++++----- public/vendor/codemirror/mode/troff/troff.js | 4 +- public/vendor/codemirror/mode/twig/twig.js | 15 +- .../codemirror/mode/velocity/index.html | 2 + .../codemirror/mode/velocity/velocity.js | 2 +- .../vendor/codemirror/mode/verilog/index.html | 2 +- public/vendor/codemirror/mode/verilog/test.js | 2 +- .../vendor/codemirror/mode/verilog/verilog.js | 2 +- public/vendor/codemirror/mode/vhdl/vhdl.js | 2 +- .../vendor/codemirror/mode/webidl/index.html | 71 ++++ .../vendor/codemirror/mode/webidl/webidl.js | 195 +++++++++ public/vendor/codemirror/mode/xml/index.html | 6 +- public/vendor/codemirror/mode/xml/xml.js | 2 +- .../vendor/codemirror/mode/xquery/xquery.js | 2 +- .../vendor/codemirror/mode/yacas/index.html | 87 ++++ public/vendor/codemirror/mode/yacas/yacas.js | 138 ++++++ .../mode/yaml-frontmatter/index.html | 2 +- .../mode/yaml-frontmatter/yaml-frontmatter.js | 2 +- public/vendor/codemirror/theme/icecoder.css | 8 +- public/vendor/codemirror/theme/mbo.css | 2 +- public/vendor/codemirror/theme/night.css | 3 +- 84 files changed, 2837 insertions(+), 504 deletions(-) create mode 100644 public/vendor/codemirror/mode/dylan/test.js create mode 100644 public/vendor/codemirror/mode/fcl/fcl.js create mode 100644 public/vendor/codemirror/mode/fcl/index.html create mode 100644 public/vendor/codemirror/mode/powershell/index.html create mode 100644 public/vendor/codemirror/mode/powershell/powershell.js create mode 100644 public/vendor/codemirror/mode/powershell/test.js create mode 100644 public/vendor/codemirror/mode/protobuf/index.html create mode 100644 public/vendor/codemirror/mode/protobuf/protobuf.js create mode 100644 public/vendor/codemirror/mode/sas/index.html create mode 100755 public/vendor/codemirror/mode/sas/sas.js create mode 100644 public/vendor/codemirror/mode/webidl/index.html create mode 100644 public/vendor/codemirror/mode/webidl/webidl.js create mode 100644 public/vendor/codemirror/mode/yacas/index.html create mode 100644 public/vendor/codemirror/mode/yacas/yacas.js diff --git a/public/vendor/codemirror/addon/comment/comment.js b/public/vendor/codemirror/addon/comment/comment.js index 3aa4680..2c4f975 100644 --- a/public/vendor/codemirror/addon/comment/comment.js +++ b/public/vendor/codemirror/addon/comment/comment.js @@ -44,9 +44,17 @@ } }); + // Rough heuristic to try and detect lines that are part of multi-line string + function probablyInsideString(cm, pos, line) { + return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"`]/.test(line) + } + CodeMirror.defineExtension("lineComment", function(from, to, options) { if (!options) options = noOptions; var self = this, mode = self.getModeAt(from); + var firstLine = self.getLine(from.line); + if (firstLine == null || probablyInsideString(self, from, firstLine)) return; + var commentString = options.lineComment || mode.lineComment; if (!commentString) { if (options.blockCommentStart || mode.blockCommentStart) { @@ -55,8 +63,7 @@ } return; } - var firstLine = self.getLine(from.line); - if (firstLine == null) return; + var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1); var pad = options.padding == null ? " " : options.padding; var blankLines = options.commentBlankLines || from.line == to.line; diff --git a/public/vendor/codemirror/addon/dialog/dialog.js b/public/vendor/codemirror/addon/dialog/dialog.js index 323b200..f10bb5b 100644 --- a/public/vendor/codemirror/addon/dialog/dialog.js +++ b/public/vendor/codemirror/addon/dialog/dialog.js @@ -56,6 +56,8 @@ var inp = dialog.getElementsByTagName("input")[0], button; if (inp) { + inp.focus(); + if (options.value) { inp.value = options.value; if (options.selectValueOnOpen !== false) { @@ -79,8 +81,6 @@ }); if (options.closeOnBlur !== false) CodeMirror.on(inp, "blur", close); - - inp.focus(); } else if (button = dialog.getElementsByTagName("button")[0]) { CodeMirror.on(button, "click", function() { close(); diff --git a/public/vendor/codemirror/addon/display/placeholder.js b/public/vendor/codemirror/addon/display/placeholder.js index babddfb..2f8b1f8 100644 --- a/public/vendor/codemirror/addon/display/placeholder.js +++ b/public/vendor/codemirror/addon/display/placeholder.js @@ -14,10 +14,12 @@ if (val && !prev) { cm.on("blur", onBlur); cm.on("change", onChange); + cm.on("swapDoc", onChange); onChange(cm); } else if (!val && prev) { cm.off("blur", onBlur); cm.off("change", onChange); + cm.off("swapDoc", onChange); clearPlaceholder(cm); var wrapper = cm.getWrapperElement(); wrapper.className = wrapper.className.replace(" CodeMirror-empty", ""); diff --git a/public/vendor/codemirror/addon/hint/show-hint.js b/public/vendor/codemirror/addon/hint/show-hint.js index cbe3b39..7661f6c 100644 --- a/public/vendor/codemirror/addon/hint/show-hint.js +++ b/public/vendor/codemirror/addon/hint/show-hint.js @@ -121,11 +121,13 @@ finishUpdate: function(data, first) { if (this.data) CodeMirror.signal(this.data, "update"); - if (data && this.data && CodeMirror.cmpPos(data.from, this.data.from)) data = null; - this.data = data; var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle); if (this.widget) this.widget.close(); + + if (data && this.data && isNewCompletion(this.data, data)) return; + this.data = data; + if (data && data.list.length) { if (picked && data.list.length == 1) { this.pick(data, 0); @@ -137,6 +139,11 @@ } }; + function isNewCompletion(old, nw) { + var moved = CodeMirror.cmpPos(nw.from, old.from) + return moved > 0 && old.to.ch - old.from.ch != nw.to.ch - nw.from.ch + } + function parseOptions(cm, pos, options) { var editor = cm.options.hintOptions; var out = {}; diff --git a/public/vendor/codemirror/addon/hint/sql-hint.js b/public/vendor/codemirror/addon/hint/sql-hint.js index 22124b5..62c4f68 100644 --- a/public/vendor/codemirror/addon/hint/sql-hint.js +++ b/public/vendor/codemirror/addon/hint/sql-hint.js @@ -20,6 +20,8 @@ }; var Pos = CodeMirror.Pos; + function isArray(val) { return Object.prototype.toString.call(val) == "[object Array]" } + function getKeywords(editor) { var mode = editor.doc.modeOption; if (mode === "sql") mode = "text/x-sql"; @@ -30,10 +32,28 @@ return typeof item == "string" ? item : item.text; } - function getItem(list, item) { - if (!list.slice) return list[item]; - for (var i = list.length - 1; i >= 0; i--) if (getText(list[i]) == item) - return list[i]; + function wrapTable(name, value) { + if (isArray(value)) value = {columns: value} + if (!value.text) value.text = name + return value + } + + function parseTables(input) { + var result = {} + if (isArray(input)) { + for (var i = input.length - 1; i >= 0; i--) { + var item = input[i] + result[getText(item).toUpperCase()] = wrapTable(getText(item), item) + } + } else if (input) { + for (var name in input) + result[name.toUpperCase()] = wrapTable(name, input[name]) + } + return result + } + + function getTable(name) { + return tables[name.toUpperCase()] } function shallowClone(object) { @@ -50,11 +70,18 @@ } function addMatches(result, search, wordlist, formatter) { - for (var word in wordlist) { - if (!wordlist.hasOwnProperty(word)) continue; - if (wordlist.slice) word = wordlist[word]; - - if (match(search, word)) result.push(formatter(word)); + if (isArray(wordlist)) { + for (var i = 0; i < wordlist.length; i++) + if (match(search, wordlist[i])) result.push(formatter(wordlist[i])) + } else { + for (var word in wordlist) if (wordlist.hasOwnProperty(word)) { + var val = wordlist[word] + if (!val || val === true) + val = word + else + val = val.displayText ? {text: val.text, displayText: val.displayText} : val.text + if (match(search, val)) result.push(formatter(val)) + } } } @@ -78,7 +105,7 @@ } function nameCompletion(cur, token, result, editor) { - // Try to complete table, colunm names and return start position of completion + // Try to complete table, column names and return start position of completion var useBacktick = false; var nameParts = []; var start = token.start; @@ -115,13 +142,13 @@ var alias = false; var aliasTable = table; // Check if table is available. If not, find table by Alias - if (!getItem(tables, table)) { + if (!getTable(table)) { var oldTable = table; table = findTableByAlias(table, editor); if (table !== oldTable) alias = true; } - var columns = getItem(tables, table); + var columns = getTable(table); if (columns && columns.columns) columns = columns.columns; @@ -184,7 +211,7 @@ //find valid range var prevItem = 0; var current = convertCurToNumber(editor.getCursor()); - for (var i=0; i< separator.length; i++) { + for (var i = 0; i < separator.length; i++) { var _v = convertCurToNumber(separator[i]); if (current > prevItem && current <= _v) { validRange = { start: convertNumberToCur(prevItem), end: convertNumberToCur(_v) }; @@ -199,7 +226,7 @@ var lineText = query[i]; eachWord(lineText, function(word) { var wordUpperCase = word.toUpperCase(); - if (wordUpperCase === aliasUpperCase && getItem(tables, previousWord)) + if (wordUpperCase === aliasUpperCase && getTable(previousWord)) table = previousWord; if (wordUpperCase !== CONS.ALIAS_KEYWORD) previousWord = word; @@ -210,10 +237,10 @@ } CodeMirror.registerHelper("hint", "sql", function(editor, options) { - tables = (options && options.tables) || {}; + tables = parseTables(options && options.tables) var defaultTableName = options && options.defaultTable; var disableKeywords = options && options.disableKeywords; - defaultTable = defaultTableName && getItem(tables, defaultTableName); + defaultTable = defaultTableName && getTable(defaultTableName); keywords = keywords || getKeywords(editor); if (defaultTableName && !defaultTable) diff --git a/public/vendor/codemirror/addon/lint/lint.js b/public/vendor/codemirror/addon/lint/lint.js index 5afe49d..01f322b 100644 --- a/public/vendor/codemirror/addon/lint/lint.js +++ b/public/vendor/codemirror/addon/lint/lint.js @@ -186,9 +186,14 @@ state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500); } - function popupSpanTooltip(ann, e) { + function popupTooltips(annotations, e) { var target = e.target || e.srcElement; - showTooltipFor(e, annotationTooltip(ann), target); + var tooltip = document.createDocumentFragment(); + for (var i = 0; i < annotations.length; i++) { + var ann = annotations[i]; + tooltip.appendChild(annotationTooltip(ann)); + } + showTooltipFor(e, tooltip, target); } function onMouseOver(cm, e) { @@ -196,10 +201,12 @@ if (!/\bCodeMirror-lint-mark-/.test(target.className)) return; var box = target.getBoundingClientRect(), x = (box.left + box.right) / 2, y = (box.top + box.bottom) / 2; var spans = cm.findMarksAt(cm.coordsChar({left: x, top: y}, "client")); + + var annotations = []; for (var i = 0; i < spans.length; ++i) { - var ann = spans[i].__annotation; - if (ann) return popupSpanTooltip(ann, e); + annotations.push(spans[i].__annotation); } + if (annotations.length) popupTooltips(annotations, e); } CodeMirror.defineOption("lint", false, function(cm, val, old) { diff --git a/public/vendor/codemirror/addon/merge/merge.css b/public/vendor/codemirror/addon/merge/merge.css index a6a80e4..bda3d9f 100644 --- a/public/vendor/codemirror/addon/merge/merge.css +++ b/public/vendor/codemirror/addon/merge/merge.css @@ -60,6 +60,7 @@ position: absolute; cursor: pointer; color: #44c; + z-index: 3; } .CodeMirror-merge-copy-reverse { diff --git a/public/vendor/codemirror/addon/merge/merge.js b/public/vendor/codemirror/addon/merge/merge.js index 830a5f0..d67b760 100644 --- a/public/vendor/codemirror/addon/merge/merge.js +++ b/public/vendor/codemirror/addon/merge/merge.js @@ -427,8 +427,9 @@ function copyChunk(dv, to, from, chunk) { if (dv.diffOutOfDate) return; - to.replaceRange(from.getRange(Pos(chunk.origFrom, 0), Pos(chunk.origTo, 0)), - Pos(chunk.editFrom, 0), Pos(chunk.editTo, 0)); + var editStart = chunk.editTo > to.lastLine() ? Pos(chunk.editFrom - 1) : Pos(chunk.editFrom, 0) + var origStart = chunk.origTo > from.lastLine() ? Pos(chunk.origFrom - 1) : Pos(chunk.origFrom, 0) + to.replaceRange(from.getRange(origStart, Pos(chunk.origTo, 0)), editStart, Pos(chunk.editTo, 0)) } // Merge view, containing 0, 1, or 2 diff views. diff --git a/public/vendor/codemirror/addon/scroll/simplescrollbars.js b/public/vendor/codemirror/addon/scroll/simplescrollbars.js index f78353a..32ba2f3 100644 --- a/public/vendor/codemirror/addon/scroll/simplescrollbars.js +++ b/public/vendor/codemirror/addon/scroll/simplescrollbars.js @@ -59,16 +59,20 @@ CodeMirror.on(this.node, "DOMMouseScroll", onWheel); } - Bar.prototype.moveTo = function(pos, update) { + Bar.prototype.setPos = function(pos) { if (pos < 0) pos = 0; if (pos > this.total - this.screen) pos = this.total - this.screen; - if (pos == this.pos) return; + if (pos == this.pos) return false; this.pos = pos; this.inner.style[this.orientation == "horizontal" ? "left" : "top"] = (pos * (this.size / this.total)) + "px"; - if (update !== false) this.scroll(pos, this.orientation); + return true }; + Bar.prototype.moveTo = function(pos) { + if (this.setPos(pos)) this.scroll(pos, this.orientation); + } + var minButtonSize = 10; Bar.prototype.update = function(scrollSize, clientSize, barSize) { @@ -83,8 +87,7 @@ } this.inner.style[this.orientation == "horizontal" ? "width" : "height"] = buttonSize + "px"; - this.inner.style[this.orientation == "horizontal" ? "left" : "top"] = - this.pos * (this.size / this.total) + "px"; + this.setPos(this.pos); }; function SimpleScrollbars(cls, place, scroll) { @@ -111,7 +114,6 @@ if (needsV) { this.vert.update(measure.scrollHeight, measure.clientHeight, measure.viewHeight - (needsH ? width : 0)); - this.vert.node.style.display = "block"; this.vert.node.style.bottom = needsH ? width + "px" : "0"; } if (needsH) { @@ -125,11 +127,11 @@ }; SimpleScrollbars.prototype.setScrollTop = function(pos) { - this.vert.moveTo(pos, false); + this.vert.setPos(pos); }; SimpleScrollbars.prototype.setScrollLeft = function(pos) { - this.horiz.moveTo(pos, false); + this.horiz.setPos(pos); }; SimpleScrollbars.prototype.clear = function() { diff --git a/public/vendor/codemirror/addon/search/match-highlighter.js b/public/vendor/codemirror/addon/search/match-highlighter.js index 8f02f01..79218c3 100644 --- a/public/vendor/codemirror/addon/search/match-highlighter.js +++ b/public/vendor/codemirror/addon/search/match-highlighter.js @@ -16,7 +16,7 @@ // highlighted only if the selected text is a word. showToken, when enabled, // will cause the current token to be highlighted when nothing is selected. // delay is used to specify how much time to wait, in milliseconds, before -// highlighting the matches. If annotateScrollbar is enabled, the occurances +// highlighting the matches. If annotateScrollbar is enabled, the occurences // will be highlighted on the scrollbar via the matchesonscrollbar addon. (function(mod) { diff --git a/public/vendor/codemirror/addon/search/search.js b/public/vendor/codemirror/addon/search/search.js index 93e90b3..e6b4f85 100644 --- a/public/vendor/codemirror/addon/search/search.js +++ b/public/vendor/codemirror/addon/search/search.js @@ -121,7 +121,10 @@ persistentDialog(cm, queryDialog, q, function(query, event) { CodeMirror.e_stop(event); if (!query) return; - if (query != state.queryText) startSearch(cm, state, query); + if (query != state.queryText) { + startSearch(cm, state, query); + state.posFrom = state.posTo = cm.getCursor(); + } if (hiding) hiding.style.opacity = 1 findNext(cm, event.shiftKey, function(_, to) { var dialog @@ -193,7 +196,7 @@ replaceAll(cm, query, text) } else { clearSearch(cm); - var cursor = getSearchCursor(cm, query, cm.getCursor()); + var cursor = getSearchCursor(cm, query, cm.getCursor("from")); var advance = function() { var start = cursor.from(), match; if (!(match = cursor.findNext())) { diff --git a/public/vendor/codemirror/addon/selection/active-line.js b/public/vendor/codemirror/addon/selection/active-line.js index 22da2e0..b0b3f61 100644 --- a/public/vendor/codemirror/addon/selection/active-line.js +++ b/public/vendor/codemirror/addon/selection/active-line.js @@ -18,6 +18,7 @@ "use strict"; var WRAP_CLASS = "CodeMirror-activeline"; var BACK_CLASS = "CodeMirror-activeline-background"; + var GUTT_CLASS = "CodeMirror-activeline-gutter"; CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) { var prev = old && old != CodeMirror.Init; @@ -36,6 +37,7 @@ for (var i = 0; i < cm.state.activeLines.length; i++) { cm.removeLineClass(cm.state.activeLines[i], "wrap", WRAP_CLASS); cm.removeLineClass(cm.state.activeLines[i], "background", BACK_CLASS); + cm.removeLineClass(cm.state.activeLines[i], "gutter", GUTT_CLASS); } } @@ -60,6 +62,7 @@ for (var i = 0; i < active.length; i++) { cm.addLineClass(active[i], "wrap", WRAP_CLASS); cm.addLineClass(active[i], "background", BACK_CLASS); + cm.addLineClass(active[i], "gutter", GUTT_CLASS); } cm.state.activeLines = active; }); diff --git a/public/vendor/codemirror/addon/tern/tern.js b/public/vendor/codemirror/addon/tern/tern.js index c345c49..efdf2ed 100644 --- a/public/vendor/codemirror/addon/tern/tern.js +++ b/public/vendor/codemirror/addon/tern/tern.js @@ -179,7 +179,7 @@ var data = findDoc(ts, doc); var argHints = ts.cachedArgHints; - if (argHints && argHints.doc == doc && cmpPos(argHints.start, change.to) <= 0) + if (argHints && argHints.doc == doc && cmpPos(argHints.start, change.to) >= 0) ts.cachedArgHints = null; var changed = data.changed; @@ -306,7 +306,7 @@ ts.request(cm, {type: "type", preferFunction: true, end: start}, function(error, data) { if (error || !data.type || !(/^fn\(/).test(data.type)) return; ts.cachedArgHints = { - start: pos, + start: start, type: parseFnType(data.type), name: data.exprName || data.name || "fn", guess: data.guess, diff --git a/public/vendor/codemirror/codemirror.min.js b/public/vendor/codemirror/codemirror.min.js index 7b734af..7a2861a 100644 --- a/public/vendor/codemirror/codemirror.min.js +++ b/public/vendor/codemirror/codemirror.min.js @@ -1,21 +1,21 @@ -!function(e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else{if("function"==typeof define&&define.amd)return define([],e);(this||window).CodeMirror=e()}}(function(){"use strict";function e(r,n){if(!(this instanceof e))return new e(r,n);this.options=n=n?ji(n):{},ji(ea,n,!1),p(n);var i=n.value;"string"==typeof i&&(i=new Ca(i,n.mode,null,n.lineSeparator)),this.doc=i;var o=new e.inputStyles[n.inputStyle](this),a=this.display=new t(r,i,o);a.wrapper.CodeMirror=this,c(this),s(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),n.autofocus&&!Eo&&a.input.focus(),v(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Oi,keySeq:null,specialChars:null};var l=this;ko&&11>xo&&setTimeout(function(){l.display.input.reset(!0)},20),Ht(this),Zi(),xt(this),this.curOp.forceUpdate=!0,Yn(this,i),n.autofocus&&!Eo||l.hasFocus()?setTimeout(Di(vr,this),20):yr(this);for(var u in ta)ta.hasOwnProperty(u)&&ta[u](this,n[u],ra);w(this),n.finishInit&&n.finishInit(this);for(var f=0;fxo&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),wo||vo&&Eo||(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,r.init(n)}function r(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),n(t)}function n(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,Be(e,100),e.state.modeGen++,e.curOp&&Pt(e)}function i(e){e.options.lineWrapping?(Qa(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Ya(e.display.wrapper,"CodeMirror-wrap"),d(e)),a(e),Pt(e),lt(e),setTimeout(function(){y(e)},100)}function o(e){var t=bt(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/kt(e.display)-3);return function(i){if(_n(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;at.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function p(e){var t=Ni(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function h(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Ue(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Ve(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}function m(e,t,r){this.cm=r;var n=this.vert=Hi("div",[Hi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=Hi("div",[Hi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(i),Ea(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Ea(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,ko&&8>xo&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function g(){}function v(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Ya(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),Ea(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,r){"horizontal"==r?or(t,e):ir(t,e)},t),t.display.scrollbars.addClass&&Qa(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=h(e));var r=e.display.barWidth,n=e.display.barHeight;b(e,t);for(var i=0;4>i&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&O(e),b(e,h(e)),r=e.display.barWidth,n=e.display.barHeight}function b(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}function k(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-$e(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=ni(t,n),a=ni(t,i);if(r&&r.ensure){var s=r.ensure.from.line,l=r.ensure.to.line;o>s?(o=s,a=ni(t,ii(Qn(t,s))+e.wrapper.clientHeight)):Math.min(l,t.lastLine())>=a&&(o=ni(t,ii(Qn(t,l))-e.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function x(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=C(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Ft(e))return!1;w(e)&&(jt(e),t.dims=I(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFroma&&r.viewTo-a<20&&(a=Math.min(i,r.viewTo)),Ro&&(o=xn(e.doc,o),a=wn(e.doc,a));var s=o!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Wt(e,o,a),r.viewOffset=ii(Qn(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var l=Ft(e);if(!s&&0==l&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=Ki();return l>4&&(r.lineDiv.style.display="none"),N(e,r.updateLineNumbers,t.dims),l>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,c&&Ki()!=c&&c.offsetHeight&&c.focus(),$i(r.cursorDiv),$i(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,s&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Be(e,400)),r.updateLineNumbers=null,!0}function T(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Ge(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+Ue(e.display)-Xe(e),r.top)}),t.visible=k(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&L(e,t);n=!1){O(e);var i=h(e);qe(e),E(e,i),y(e,i)}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function A(e,t){var r=new S(e,t);if(L(e,r)){O(e),T(e,r);var n=h(e);qe(e),E(e,n),y(e,n),r.finish()}}function E(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";var r=t.docHeight+e.display.barHeight;e.display.heightForcer.style.top=r+"px",e.display.gutters.style.height=Math.max(r+Ve(e),t.clientHeight)+"px"}function O(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;nxo){var a=o.node.offsetTop+o.node.offsetHeight;i=a-r,r=a}else{var s=o.node.getBoundingClientRect();i=s.bottom-s.top}var l=o.line.height-i;if(2>i&&(i=bt(t)),(l>.001||-.001>l)&&(ti(o.line,i),z(o.line),o.rest))for(var c=0;c=t&&f.lineNumber;f.changes&&(Ni(f.changes,"gutter")>-1&&(d=!1),q(e,f,c,r)),d&&($i(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(_(e.options,c)))),s=f.node.nextSibling}else{var p=H(e,f,c,r);a.insertBefore(p,s)}c+=f.size}for(;s;)s=n(s)}function q(e,t,r,n){for(var i=0;ixo&&(e.node.style.zIndex=2)),e.node}function R(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var r=P(e);e.background=r.insertBefore(Hi("div",null,t),r.firstChild)}}function j(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Dn(e,t)}function D(e,t){var r=t.text.className,n=j(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,B(t)):r&&(t.text.className=r)}function B(e){R(e),e.line.wrapClass?P(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function W(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=P(t);t.gutterBackground=Hi("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var i=P(t),a=t.gutter=Hi("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(a),i.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(Hi("div",_(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s1)if(Bo&&Bo.join("\n")==t){if(n.ranges.length%Bo.length==0){l=[];for(var c=0;c=0;c--){var u=n.ranges[c],f=u.from(),d=u.to();u.empty()&&(r&&r>0?f=jo(f.line,f.ch-r):e.state.overwrite&&!a&&(d=jo(d.line,Math.min(Qn(o,d.line).text.length,d.ch+Ii(s).length))));var p=e.curOp.updateInput,h={from:f,to:d,text:l?l[c%l.length]:s,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};Mr(e.doc,h),Si(e,"inputRead",e,h)}t&&!a&&ee(e,t),jr(e),e.curOp.updateInput=p,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function J(e,t){var r=e.clipboardData&&e.clipboardData.getData("text/plain");return r?(e.preventDefault(),t.isReadOnly()||t.options.disableInput||Et(t,function(){Q(t,r,0,null,"paste")}),!0):void 0}function ee(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var s=0;s-1){a=Br(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Qn(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Br(e,i.head.line,"smart"));a&&Si(e,"electricInput",e,i.head.line)}}}function te(e){for(var t=[],r=[],n=0;ni?c.map:u[i],a=0;ai?e.line:e.rest[i]),f=o[a]+n;return(0>n||s!=t)&&(f=o[a+(n?1:0)]),jo(l,f)}}}var i=e.text.firstChild,o=!1;if(!t||!Ga(i,t))return se(jo(ri(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[r],r=0,!t)){var a=e.rest?Ii(e.rest):e.line;return se(jo(ri(a),a.text.length),o)}var s=3==t.nodeType?t:null,l=t;for(s||1!=t.childNodes.length||3!=t.firstChild.nodeType||(s=t.firstChild,r&&(r=s.nodeValue.length));l.parentNode!=i;)l=l.parentNode;var c=e.measure,u=c.maps,f=n(s,l,r);if(f)return se(f,o);for(var d=l.nextSibling,p=s?s.nodeValue.length-r:0;d;d=d.nextSibling){if(f=n(d,d.firstChild,0))return se(jo(f.line,f.ch-p),o);p+=d.textContent.length}for(var h=l.previousSibling,p=r;h;h=h.previousSibling){if(f=n(h,h.firstChild,-1))return se(jo(f.line,f.ch+p),o);p+=d.textContent.length}}function ue(e,t,r,n,i){function o(e){return function(t){return t.id==e}}function a(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return""==r&&(r=t.textContent.replace(/\u200b/g,"")),void(s+=r);var u,f=t.getAttribute("cm-marker");if(f){var d=e.findMarks(jo(n,0),jo(i+1,0),o(+f));return void(d.length&&(u=d[0].find())&&(s+=Jn(e.doc,u.from,u.to).join(c)))}if("false"==t.getAttribute("contenteditable"))return;for(var p=0;p=0){var a=Z(o.from(),i.from()),s=X(o.to(),i.to()),l=o.empty()?i.from()==i.head:o.from()==o.head;t>=n&&--t,e.splice(--n,2,new de(l?s:a,l?a:s))}}return new fe(e,t)}function he(e,t){return new fe([new de(e,t||e)],0)}function me(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ge(e,t){if(t.liner?jo(r,Qn(e,r).text.length):ve(t,Qn(e,t.line).text.length)}function ve(e,t){var r=e.ch;return null==r||r>t?jo(e.line,t):0>r?jo(e.line,0):e}function ye(e,t){return t>=e.first&&t=t.ch:s.to>t.ch))){if(i&&(Ia(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!l.atomic)continue;if(r){var c,u=l.find(0>n?1:-1);if((0>n?l.inclusiveRight:l.inclusiveLeft)&&(u=Ne(e,u,-n,o)),u&&u.line==t.line&&(c=Do(u,r))&&(0>n?0>c:c>0))return ze(e,u,t,n,i)}var f=l.find(0>n?-1:1);return(0>n?l.inclusiveLeft:l.inclusiveRight)&&(f=Ne(e,f,n,o)),f?ze(e,f,t,n,i):null}}return t}function Ie(e,t,r,n,i){var o=n||1,a=ze(e,t,r,o,i)||!i&&ze(e,t,r,o,!0)||ze(e,t,r,-o,i)||!i&&ze(e,t,r,-o,!0);return a?a:(e.cantEdit=!0,jo(e.first,0))}function Ne(e,t,r,n){return 0>r&&0==t.ch?t.line>e.first?ge(e,jo(t.line-1)):null:r>0&&t.ch==(n||Qn(e,t.line)).text.length?t.linet&&(t=0),t=Math.round(t),n=Math.round(n),s.appendChild(Hi("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?u-e:r)+"px; height: "+(n-t)+"px"))}function i(t,r,i){function o(r,n){return pt(e,jo(t,r),"div",f,n)}var s,l,f=Qn(a,t),d=f.text.length;return to(oi(f),r||0,null==i?d:i,function(e,t,a){var f,p,h,m=o(e,"left");if(e==t)f=m,p=h=m.left;else{if(f=o(t-1,"right"),"rtl"==a){var g=m;m=f,f=g}p=m.left,h=f.right}null==r&&0==e&&(p=c),f.top-m.top>3&&(n(p,m.top,null,m.bottom),p=c,m.bottoml.bottom||f.bottom==l.bottom&&f.right>l.right)&&(l=f),c+1>p&&(p=c),n(p,f.top,h-p,f.bottom)}),{start:s,end:l}}var o=e.display,a=e.doc,s=document.createDocumentFragment(),l=Ke(e.display),c=l.left,u=Math.max(o.sizerWidth,Ge(e)-o.sizer.offsetLeft)-l.right,f=t.from(),d=t.to();if(f.line==d.line)i(f.line,f.ch,d.ch);else{var p=Qn(a,f.line),h=Qn(a,d.line),m=bn(p)==bn(h),g=i(f.line,f.ch,m?p.text.length+1:null).end,v=i(d.line,m?0:null,d.ch).start;m&&(g.top0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Be(e,t){e.doc.mode.startState&&e.doc.frontier=e.display.viewTo)){var r=+new Date+e.options.workTime,n=la(t.mode,He(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var a=o.styles,s=o.text.length>e.options.maxHighlightLength,l=qn(e,o,s?la(t.mode,n):n,!0);o.styles=l.styles;var c=o.styleClasses,u=l.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var f=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),d=0;!f&&dr?(Be(e,e.options.workDelay),!0):void 0}),i.length&&Et(e,function(){for(var t=0;ta;--s){if(s<=o.first)return o.first;var l=Qn(o,s-1);if(l.stateAfter&&(!r||s<=o.frontier))return s;var c=Ba(l.text,null,e.options.tabSize);(null==i||n>c)&&(i=s-1,n=c)}return i}function He(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=Fe(e,t,r),a=o>n.first&&Qn(n,o-1).stateAfter;return a=a?la(n.mode,a):ca(n.mode),n.iter(o,t,function(r){Rn(e,r.text,a);var s=o==t-1||o%5==0||o>=i.viewFrom&&o2&&o.push((l.bottom+c.top)/2-r.top)}}o.push(r.bottom-r.top)}}function Ye(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;nr)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Qe(e,t){t=bn(t);var r=ri(t),n=e.display.externalMeasured=new Nt(e.doc,t,r);n.lineN=r;var i=n.built=Dn(e,n);return n.text=i.pre,Ui(e.display.lineMeasure,i.pre),n}function Je(e,t,r,n){return rt(e,tt(e,t),r,n)}function et(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&tt?(i=0,o=1,a="left"):c>t?(i=t-l,o=i+1):(s==e.length-3||t==c&&e[s+3]>t)&&(o=c-l,i=o-1,t>=c&&(a="right")),null!=i){if(n=e[s+2],l==c&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==i)for(;s&&e[s-2]==e[s-3]&&e[s-1].insertLeft;)n=e[(s-=3)+2],a="left";if("right"==r&&i==c-l)for(;su;u++){for(;s&&Fi(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+lxo&&0==s&&l==o.coverEnd-o.coverStart)i=a.parentNode.getBoundingClientRect();else if(ko&&e.options.lineWrapping){var f=$a(a,s,l).getClientRects();i=f.length?f["right"==n?f.length-1:0]:$o}else i=$a(a,s,l).getBoundingClientRect()||$o;if(i.left||i.right||0==s)break;l=s,s-=1,c="right"}ko&&11>xo&&(i=ot(e.display.measure,i))}else{s>0&&(c=n="right");var f;i=e.options.lineWrapping&&(f=a.getClientRects()).length>1?f["right"==n?f.length-1:0]:a.getBoundingClientRect()}if(ko&&9>xo&&!s&&(!i||!i.left&&!i.right)){var d=a.parentNode.getClientRects()[0];i=d?{left:d.left,right:d.left+kt(e.display),top:d.top,bottom:d.bottom}:$o}for(var p=i.top-t.rect.top,h=i.bottom-t.rect.top,m=(p+h)/2,g=t.view.measure.heights,u=0;ur.from?a(e-1):a(e,n)}n=n||Qn(e.doc,t.line),i||(i=tt(e,n));var l=oi(n),c=t.ch;if(!l)return a(c);var u=uo(l,c),f=s(c,u);return null!=as&&(f.other=s(c,as)),f}function mt(e,t){var r=0,t=ge(e.doc,t);e.options.lineWrapping||(r=kt(e.display)*t.ch);var n=Qn(e.doc,t.line),i=ii(n)+$e(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function gt(e,t,r,n){var i=jo(e,t);return i.xRel=n,r&&(i.outside=!0),i}function vt(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,0>r)return gt(n.first,0,!0,-1);var i=ni(n,r),o=n.first+n.size-1;if(i>o)return gt(n.first+n.size-1,Qn(n,o).text.length,!0,1);0>t&&(t=0);for(var a=Qn(n,i);;){var s=yt(e,a,i,t,r),l=vn(a),c=l&&l.find(0,!0);if(!l||!(s.ch>c.from.ch||s.ch==c.from.ch&&s.xRel>0))return s;i=ri(a=c.to.line)}}function yt(e,t,r,n,i){function o(n){var i=ht(e,jo(r,n),"line",t,c);return s=!0,a>i.bottom?i.left-l:ag)return gt(r,p,v,1);for(;;){if(u?p==d||p==po(t,d,1):1>=p-d){for(var y=h>n||g-n>=n-h?d:p,b=n-(y==d?h:g);Fi(t.text.charAt(y));)++y;var k=gt(r,y,y==d?m:v,-1>b?-1:b>1?1:0);return k}var x=Math.ceil(f/2),w=d+x;if(u){w=d;for(var _=0;x>_;++_)w=po(t,w,1)}var C=o(w);C>n?(p=w,g=C,(v=s)&&(g+=1e3),f=x):(d=w,h=C,m=s,f-=x)}}function bt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Wo){Wo=Hi("pre");for(var t=0;49>t;++t)Wo.appendChild(document.createTextNode("x")),Wo.appendChild(Hi("br"));Wo.appendChild(document.createTextNode("x"))}Ui(e.measure,Wo);var r=Wo.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),$i(e.measure),r||1}function kt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Hi("span","xxxxxxxxxx"),r=Hi("pre",[t]);Ui(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function xt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ko},Uo?Uo.ops.push(e.curOp):e.curOp.ownsGroup=Uo={ops:[e.curOp],delayedCallbacks:[]}}function wt(e){var t=e.delayedCallbacks,r=0;do{for(;r=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new S(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Mt(e){e.updatedDisplay=e.mustUpdate&&L(e.cm,e.update)}function Lt(e){var t=e.cm,r=t.display;e.updatedDisplay&&O(t),e.barMeasure=h(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Je(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Ve(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Ge(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Tt(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLefto;o=n){var a=new Nt(e.doc,Qn(e.doc,o),o);n=o+a.size,i.push(a)}return i}function Pt(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ro&&xn(e.doc,t)i.viewFrom?jt(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)jt(e);else if(t<=i.viewFrom){var o=Bt(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):jt(e)}else if(r>=i.viewTo){var o=Bt(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):jt(e)}else{var a=Bt(e,t,t,-1),s=Bt(e,r,r+n,1);a&&s?(i.view=i.view.slice(0,a.index).concat(qt(e,a.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=n):jt(e)}var l=i.externalMeasured;l&&(r=i.lineN&&t=n.viewTo)){var o=n.view[Dt(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==Ni(a,r)&&a.push(r)}}}function jt(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Dt(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var r=e.display.view,n=0;nt)return n}function Bt(e,t,r,n){var i,o=Dt(e,t),a=e.display.view;if(!Ro||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=0,l=e.display.viewFrom;o>s;s++)l+=a[s].size;if(l!=t){if(n>0){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,r+=i}for(;xn(e.doc,r)!=r;){if(o==(0>n?0:a.length-1))return null;r+=n*a[o-(0>n?1:0)].size,o+=n}return{index:o,lineN:r}}function Wt(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=qt(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=qt(e,t,n.viewFrom).concat(n.view):n.viewFromr&&(n.view=n.view.slice(0,Dt(e,r)))),n.viewTo=r}function Ft(e){for(var t=e.display.view,r=0,n=0;n400}var i=e.display;Ea(i.scroller,"mousedown",Ot(e,Gt)),ko&&11>xo?Ea(i.scroller,"dblclick",Ot(e,function(t){if(!Li(e,t)){var r=Vt(e,t);if(r&&!Jt(e,t)&&!Kt(e.display,t)){La(t);var n=e.findWordAt(r);xe(e.doc,n.anchor,n.head)}}})):Ea(i.scroller,"dblclick",function(t){Li(e,t)||La(t)}),qo||Ea(i.scroller,"contextmenu",function(t){br(e,t)});var o,a={end:0};Ea(i.scroller,"touchstart",function(t){if(!Li(e,t)&&!r(t)){clearTimeout(o);var n=+new Date;i.activeTouch={start:n,moved:!1,prev:n-a.end<=300?a:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),Ea(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Ea(i.scroller,"touchend",function(r){var o=i.activeTouch;if(o&&!Kt(i,r)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,s=e.coordsChar(i.activeTouch,"page");a=!o.prev||n(o,o.prev)?new de(s,s):!o.prev.prev||n(o,o.prev.prev)?e.findWordAt(s):new de(jo(s.line,0),ge(e.doc,jo(s.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),La(r)}t()}),Ea(i.scroller,"touchcancel",t),Ea(i.scroller,"scroll",function(){i.scroller.clientHeight&&(ir(e,i.scroller.scrollTop),or(e,i.scroller.scrollLeft,!0),Ia(e,"scroll",e))}),Ea(i.scroller,"mousewheel",function(t){ar(e,t)}),Ea(i.scroller,"DOMMouseScroll",function(t){ar(e,t)}),Ea(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Li(e,t)||Aa(t)},over:function(t){Li(e,t)||(rr(e,t),Aa(t))},start:function(t){tr(e,t)},drop:Ot(e,er),leave:function(){nr(e)}};var s=i.input.getField();Ea(s,"keyup",function(t){hr.call(e,t)}),Ea(s,"keydown",Ot(e,dr)),Ea(s,"keypress",Ot(e,mr)),Ea(s,"focus",Di(vr,e)),Ea(s,"blur",Di(yr,e))}function $t(t,r,n){var i=n&&n!=e.Init;if(!r!=!i){var o=t.display.dragFunctions,a=r?Ea:za;a(t.display.scroller,"dragstart",o.start),a(t.display.scroller,"dragenter",o.enter),a(t.display.scroller,"dragover",o.over),a(t.display.scroller,"dragleave",o.leave),a(t.display.scroller,"drop",o.drop)}}function Ut(e){var t=e.display;(t.lastWrapHeight!=t.wrapper.clientHeight||t.lastWrapWidth!=t.wrapper.clientWidth)&&(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Kt(e,t){for(var r=wi(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function Vt(e,t,r,n){var i=e.display;if(!r&&"true"==wi(t).getAttribute("cm-not-content"))return null;var o,a,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,a=t.clientY-s.top}catch(t){return null}var l,c=vt(e,o,a);if(n&&1==c.xRel&&(l=Qn(e.doc,c.line).text).length==c.ch){var u=Ba(l,l.length,e.options.tabSize)-l.length;c=jo(c.line,Math.max(0,Math.round((o-Ke(e.display).left)/kt(e.display))-u))}return c}function Gt(e){var t=this,r=t.display;if(!(Li(t,e)||r.activeTouch&&r.input.supportsTouch())){if(r.shift=e.shiftKey,Kt(r,e))return void(wo||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!Jt(t,e)){var n=Vt(t,e);switch(window.focus(),_i(e)){case 1:t.state.selectingText?t.state.selectingText(e):n?Xt(t,e,n):wi(e)==r.scroller&&La(e);break;case 2:wo&&(t.state.lastMiddleDown=+new Date),n&&xe(t.doc,n),setTimeout(function(){r.input.focus()},20),La(e);break;case 3:qo?br(t,e):gr(t)}}}}function Xt(e,t,r){ko?setTimeout(Di(Y,e),0):e.curOp.focus=Ki();var n,i=+new Date;Ho&&Ho.time>i-400&&0==Do(Ho.pos,r)?n="triple":Fo&&Fo.time>i-400&&0==Do(Fo.pos,r)?(n="double",Ho={time:i,pos:r}):(n="single",Fo={time:i,pos:r});var o,a=e.doc.sel,s=Oo?t.metaKey:t.ctrlKey;e.options.dragDrop&&es&&!e.isReadOnly()&&"single"==n&&(o=a.contains(r))>-1&&(Do((o=a.ranges[o]).from(),r)<0||r.xRel>0)&&(Do(o.to(),r)>0||r.xRel<0)?Zt(e,t,r,s):Yt(e,t,r,n,s)}function Zt(e,t,r,n){var i=e.display,o=+new Date,a=Ot(e,function(s){wo&&(i.scroller.draggable=!1),e.state.draggingText=!1,za(document,"mouseup",a),za(i.scroller,"drop",a),Math.abs(t.clientX-s.clientX)+Math.abs(t.clientY-s.clientY)<10&&(La(s),!n&&+new Date-200=h;h++){var v=Qn(c,h).text,y=Wa(v,l,o);l==p?i.push(new de(jo(h,y),jo(h,y))):v.length>y&&i.push(new de(jo(h,y),jo(h,Wa(v,p,o))))}i.length||i.push(new de(r,r)),Le(c,pe(d.ranges.slice(0,f).concat(i),f),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,k=b.anchor,x=t;if("single"!=n){if("double"==n)var w=e.findWordAt(t);else var w=new de(jo(t.line,0),ge(c,jo(t.line+1,0)));Do(w.anchor,k)>0?(x=w.head,k=Z(b.from(),w.anchor)):(x=w.anchor,k=X(b.to(),w.head))}var i=d.ranges.slice(0);i[f]=new de(ge(c,k),x),Le(c,pe(i,f),ja)}}function a(t){var r=++y,i=Vt(e,t,!0,"rect"==n);if(i)if(0!=Do(i,g)){e.curOp.focus=Ki(),o(i);var s=k(l,c);(i.line>=s.to||i.linev.bottom?20:0;u&&setTimeout(Ot(e,function(){y==r&&(l.scroller.scrollTop+=u,a(t))}),50)}}function s(t){e.state.selectingText=!1,y=1/0,La(t),l.input.focus(),za(document,"mousemove",b),za(document,"mouseup",x),c.history.lastSelOrigin=null}var l=e.display,c=e.doc;La(t);var u,f,d=c.sel,p=d.ranges;if(i&&!t.shiftKey?(f=c.sel.contains(r),u=f>-1?p[f]:new de(r,r)):(u=c.sel.primary(),f=c.sel.primIndex),t.altKey)n="rect",i||(u=new de(r,r)),r=Vt(e,t,!0,!0),f=-1;else if("double"==n){var h=e.findWordAt(r);u=e.display.shift||c.extend?ke(c,u,h.anchor,h.head):h}else if("triple"==n){var m=new de(jo(r.line,0),ge(c,jo(r.line+1,0)));u=e.display.shift||c.extend?ke(c,u,m.anchor,m.head):m}else u=ke(c,u,r);i?-1==f?(f=p.length,Le(c,pe(p.concat([u]),f),{scroll:!1,origin:"*mouse"})):p.length>1&&p[f].empty()&&"single"==n&&!t.shiftKey?(Le(c,pe(p.slice(0,f).concat(p.slice(f+1)),0),{scroll:!1,origin:"*mouse"}),d=c.sel):_e(c,f,u,ja):(f=0,Le(c,new fe([u],0),ja),d=c.sel);var g=r,v=l.wrapper.getBoundingClientRect(),y=0,b=Ot(e,function(e){_i(e)?a(e):s(e)}),x=Ot(e,s);e.state.selectingText=x,Ea(document,"mousemove",b),Ea(document,"mouseup",x)}function Qt(e,t,r,n){try{var i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&La(t);var a=e.display,s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!Ai(e,r))return xi(t);o-=s.top-a.viewOffset;for(var l=0;l=i){var u=ni(e.doc,o),f=e.options.gutters[l];return Ia(e,r,e,u,f,t),xi(t)}}}function Jt(e,t){return Qt(e,t,"gutterClick",!0)}function er(e){var t=this;if(nr(t),!Li(t,e)&&!Kt(t.display,e)){La(e),ko&&(Vo=+new Date);var r=Vt(t,e,!0),n=e.dataTransfer.files;if(r&&!t.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),a=0,s=function(e,n){if(!t.options.allowDropFileTypes||-1!=Ni(t.options.allowDropFileTypes,e.type)){var s=new FileReader;s.onload=Ot(t,function(){var e=s.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[n]=e,++a==i){r=ge(t.doc,r);var l={from:r,to:r,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};Mr(t.doc,l),Me(t.doc,he(r,Jo(l)))}}),s.readAsText(e)}},l=0;i>l;++l)s(n[l],l);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!(Oo?e.altKey:e.ctrlKey))var c=t.listSelections();if(Te(t.doc,he(r,r)),c)for(var l=0;la.clientWidth,l=a.scrollHeight>a.clientHeight;if(n&&s||i&&l){if(i&&Oo&&wo)e:for(var c=t.target,u=o.view;c!=a;c=c.parentNode)for(var f=0;fd?p=Math.max(0,p+d-50):h=Math.min(e.doc.height,h+d+50),A(e,{top:p,bottom:h})}20>Go&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&(Xo=(Xo*Go+r)/(Go+1),++Go)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}function sr(e,t,r){if("string"==typeof t&&(t=ua[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=Pa}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function lr(e,t,r){for(var n=0;nxo&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=ur(t,e);So&&(Qo=n?r:null,!n&&88==r&&!ns&&(Oo?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||pr(t)}}function pr(e){function t(e){18!=e.keyCode&&e.altKey||(Ya(r,"CodeMirror-crosshair"),za(document,"keyup",t),za(document,"mouseover",t))}var r=e.display.lineDiv;Qa(r,"CodeMirror-crosshair"),Ea(document,"keyup",t),Ea(document,"mouseover",t)}function hr(e){16==e.keyCode&&(this.doc.sel.shift=!1),Li(this,e)}function mr(e){var t=this;if(!(Kt(t.display,e)||Li(t,e)||e.ctrlKey&&!e.altKey||Oo&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(So&&r==Qo)return Qo=null,void La(e);if(!So||e.which&&!(e.which<10)||!ur(t,e)){var i=String.fromCharCode(null==n?r:n);fr(t,e,i)||t.display.input.onKeyPress(e)}}}function gr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,yr(e))},100)}function vr(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Ia(e,"focus",e),e.state.focused=!0,Qa(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),wo&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),De(e))}function yr(e){e.state.delayingBlurEvent||(e.state.focused&&(Ia(e,"blur",e),e.state.focused=!1,Ya(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function br(e,t){Kt(e.display,t)||kr(e,t)||Li(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function kr(e,t){return Ai(e,"gutterContextMenu")?Qt(e,t,"gutterContextMenu",!1):!1}function xr(e,t){if(Do(e,t.from)<0)return e;if(Do(e,t.to)<=0)return Jo(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=Jo(t).ch-t.to.ch),jo(r,n)}function wr(e,t){for(var r=[],n=0;n=0;--i)Lr(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else Lr(e,t)}}function Lr(e,t){if(1!=t.text.length||""!=t.text[0]||0!=Do(t.from,t.to)){var r=wr(e,t);ui(e,t,r,e.cm?e.cm.curOp.id:0/0),Er(e,t,r,an(e,t));var n=[];Zn(e,function(e,r){r||-1!=Ni(n,e.history)||(ki(e.history,t),n.push(e.history)),Er(e,t,null,an(e,t))})}}function Tr(e,t,r){if(!e.cm||!e.cm.state.suppressEdits){for(var n,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,s="undo"==t?i.undone:i.done,l=0;l=0;--l){var f=n.changes[l];if(f.origin=t,u&&!Sr(e,f,!1))return void(a.length=0);c.push(si(e,f));var d=l?wr(e,f):Ii(a);Er(e,f,d,ln(e,f)),!l&&e.cm&&e.cm.scrollIntoView({from:f.from,to:Jo(f)});var p=[];Zn(e,function(e,t){t||-1!=Ni(p,e.history)||(ki(e.history,f),p.push(e.history)),Er(e,f,null,ln(e,f))})}}}}function Ar(e,t){if(0!=t&&(e.first+=t,e.sel=new fe(qi(e.sel.ranges,function(e){return new de(jo(e.anchor.line+t,e.anchor.ch),jo(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Pt(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;ne.lastLine())){if(t.from.lineo&&(t={from:t.from,to:jo(o,Qn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Jn(e,t.from,t.to),r||(r=wr(e,t)),e.cm?Or(e.cm,t,n):Vn(e,t,n),Te(e,r,Ra)}}function Or(e,t,r){var n=e.doc,i=e.display,a=t.from,s=t.to,l=!1,c=a.line;e.options.lineWrapping||(c=ri(bn(Qn(n,a.line))),n.iter(c,s.line+1,function(e){return e==i.maxLine?(l=!0,!0):void 0})),n.sel.contains(t.from,t.to)>-1&&Ti(e),Vn(n,t,r,o(e)),e.options.lineWrapping||(n.iter(c,a.line+t.text.length,function(e){var t=f(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,a.line),Be(e,400);var u=t.text.length-(s.line-a.line)-1;t.full?Pt(e):a.line!=s.line||1!=t.text.length||Kn(e.doc,t)?Pt(e,a.line,s.line+1,u):Rt(e,a.line,"text");var d=Ai(e,"changes"),p=Ai(e,"change");if(p||d){var h={from:a,to:s,text:t.text,removed:t.removed,origin:t.origin};p&&Si(e,"change",e,h),d&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function zr(e,t,r,n,i){if(n||(n=r),Do(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=e.splitLines(t)),Mr(e,{from:r,to:n,text:t,origin:i})}function Ir(e,t){if(!Li(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!To){var o=Hi("div","​",null,"position: absolute; top: "+(t.top-r.viewOffset-$e(e.display))+"px; height: "+(t.bottom-t.top+Ve(e)+r.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function Nr(e,t,r,n){null==n&&(n=0);for(var i=0;5>i;i++){var o=!1,a=ht(e,t),s=r&&r!=t?ht(e,r):a,l=Pr(e,Math.min(a.left,s.left),Math.min(a.top,s.top)-n,Math.max(a.left,s.left),Math.max(a.bottom,s.bottom)+n),c=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=l.scrollTop&&(ir(e,l.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(o=!0)),null!=l.scrollLeft&&(or(e,l.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return a}function qr(e,t,r,n,i){var o=Pr(e,t,r,n,i);null!=o.scrollTop&&ir(e,o.scrollTop),null!=o.scrollLeft&&or(e,o.scrollLeft)}function Pr(e,t,r,n,i){var o=e.display,a=bt(e.display);0>r&&(r=0);var s=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,l=Xe(e),c={};i-r>l&&(i=r+l);var u=e.doc.height+Ue(o),f=a>r,d=i>u-a;if(s>r)c.scrollTop=f?0:r;else if(i>s+l){var p=Math.min(r,(d?u:i)-l);p!=s&&(c.scrollTop=p)}var h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,m=Ge(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),g=n-t>m;return g&&(n=t+m),10>t?c.scrollLeft=0:h>t?c.scrollLeft=Math.max(0,t-(g?0:10)):n>m+h-3&&(c.scrollLeft=n+(g?0:10)-m),c}function Rr(e,t,r){(null!=t||null!=r)&&Dr(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=r&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+r)}function jr(e){Dr(e); +!function(e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else{if("function"==typeof define&&define.amd)return define([],e);(this||window).CodeMirror=e()}}(function(){"use strict";function e(r,n){if(!(this instanceof e))return new e(r,n);this.options=n=n?ji(n):{},ji(ta,n,!1),p(n);var i=n.value;"string"==typeof i&&(i=new Sa(i,n.mode,null,n.lineSeparator)),this.doc=i;var o=new e.inputStyles[n.inputStyle](this),a=this.display=new t(r,i,o);a.wrapper.CodeMirror=this,c(this),s(this),n.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),n.autofocus&&!Eo&&a.input.focus(),v(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Oi,keySeq:null,specialChars:null};var l=this;ko&&11>xo&&setTimeout(function(){l.display.input.reset(!0)},20),Ht(this),Zi(),xt(this),this.curOp.forceUpdate=!0,Yn(this,i),n.autofocus&&!Eo||l.hasFocus()?setTimeout(Di(vr,this),20):yr(this);for(var u in ra)ra.hasOwnProperty(u)&&ra[u](this,n[u],na);w(this),n.finishInit&&n.finishInit(this);for(var d=0;dxo&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),wo||vo&&Eo||(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,r.init(n)}function r(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),n(t)}function n(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,Be(e,100),e.state.modeGen++,e.curOp&&Pt(e)}function i(e){e.options.lineWrapping?(Ja(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Qa(e.display.wrapper,"CodeMirror-wrap"),f(e)),a(e),Pt(e),lt(e),setTimeout(function(){y(e)},100)}function o(e){var t=bt(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/kt(e.display)-3);return function(i){if(_n(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;at.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}function p(e){var t=Ni(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function h(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Ue(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Ve(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}function m(e,t,r){this.cm=r;var n=this.vert=Hi("div",[Hi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=Hi("div",[Hi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(i),Oa(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Oa(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,ko&&8>xo&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function g(){}function v(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Qa(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),Oa(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,r){"horizontal"==r?or(t,e):ir(t,e)},t),t.display.scrollbars.addClass&&Ja(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=h(e));var r=e.display.barWidth,n=e.display.barHeight;b(e,t);for(var i=0;4>i&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&O(e),b(e,h(e)),r=e.display.barWidth,n=e.display.barHeight}function b(e,t){var r=e.display,n=r.scrollbars.update(t);r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}function k(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-$e(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=ni(t,n),a=ni(t,i);if(r&&r.ensure){var s=r.ensure.from.line,l=r.ensure.to.line;o>s?(o=s,a=ni(t,ii(Qn(t,s))+e.wrapper.clientHeight)):Math.min(l,t.lastLine())>=a&&(o=ni(t,ii(Qn(t,l))-e.wrapper.clientHeight),a=l)}return{from:o,to:Math.max(a,o+1)}}function x(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=C(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Wt(e))return!1;w(e)&&(jt(e),t.dims=I(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFroma&&r.viewTo-a<20&&(a=Math.min(i,r.viewTo)),jo&&(o=xn(e.doc,o),a=wn(e.doc,a));var s=o!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;Ft(e,o,a),r.viewOffset=ii(Qn(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var l=Wt(e);if(!s&&0==l&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var c=Ki();return l>4&&(r.lineDiv.style.display="none"),N(e,r.updateLineNumbers,t.dims),l>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,c&&Ki()!=c&&c.offsetHeight&&c.focus(),$i(r.cursorDiv),$i(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,s&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Be(e,400)),r.updateLineNumbers=null,!0}function T(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Ge(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+Ue(e.display)-Xe(e),r.top)}),t.visible=k(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&L(e,t);n=!1){O(e);var i=h(e);qe(e),y(e,i),E(e,i)}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function A(e,t){var r=new S(e,t);if(L(e,r)){O(e),T(e,r);var n=h(e);qe(e),y(e,n),E(e,n),r.finish()}}function E(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Ve(e)+"px"}function O(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;nxo){var a=o.node.offsetTop+o.node.offsetHeight;i=a-r,r=a}else{var s=o.node.getBoundingClientRect();i=s.bottom-s.top}var l=o.line.height-i;if(2>i&&(i=bt(t)),(l>.001||-.001>l)&&(ti(o.line,i),z(o.line),o.rest))for(var c=0;c=t&&d.lineNumber;d.changes&&(Ni(d.changes,"gutter")>-1&&(f=!1),q(e,d,c,r)),f&&($i(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(_(e.options,c)))),s=d.node.nextSibling}else{var p=H(e,d,c,r);a.insertBefore(p,s)}c+=d.size}for(;s;)s=n(s)}function q(e,t,r,n){for(var i=0;ixo&&(e.node.style.zIndex=2)),e.node}function R(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var r=P(e);e.background=r.insertBefore(Hi("div",null,t),r.firstChild)}}function j(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Dn(e,t)}function D(e,t){var r=t.text.className,n=j(e,t);t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,B(t)):r&&(t.text.className=r)}function B(e){R(e),e.line.wrapClass?P(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function F(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=P(t);t.gutterBackground=Hi("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var i=P(t),a=t.gutter=Hi("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(a),i.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(Hi("div",_(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s1)if(Fo&&Fo.join("\n")==t){if(n.ranges.length%Fo.length==0){l=[];for(var c=0;c=0;c--){var u=n.ranges[c],d=u.from(),f=u.to();u.empty()&&(r&&r>0?d=Do(d.line,d.ch-r):e.state.overwrite&&!a&&(f=Do(f.line,Math.min(Qn(o,f.line).text.length,f.ch+Ii(s).length))));var p=e.curOp.updateInput,h={from:d,to:f,text:l?l[c%l.length]:s,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};Mr(e.doc,h),Si(e,"inputRead",e,h)}t&&!a&&ee(e,t),jr(e),e.curOp.updateInput=p,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function J(e,t){var r=e.clipboardData&&e.clipboardData.getData("text/plain");return r?(e.preventDefault(),t.isReadOnly()||t.options.disableInput||Et(t,function(){Q(t,r,0,null,"paste")}),!0):void 0}function ee(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n];if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var s=0;s-1){a=Br(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Qn(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Br(e,i.head.line,"smart"));a&&Si(e,"electricInput",e,i.head.line)}}}function te(e){for(var t=[],r=[],n=0;ni?c.map:u[i],a=0;ai?e.line:e.rest[i]),d=o[a]+n;return(0>n||s!=t)&&(d=o[a+(n?1:0)]),Do(l,d)}}}var i=e.text.firstChild,o=!1;if(!t||!Xa(i,t))return se(Do(ri(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[r],r=0,!t)){var a=e.rest?Ii(e.rest):e.line;return se(Do(ri(a),a.text.length),o)}var s=3==t.nodeType?t:null,l=t;for(s||1!=t.childNodes.length||3!=t.firstChild.nodeType||(s=t.firstChild,r&&(r=s.nodeValue.length));l.parentNode!=i;)l=l.parentNode;var c=e.measure,u=c.maps,d=n(s,l,r);if(d)return se(d,o);for(var f=l.nextSibling,p=s?s.nodeValue.length-r:0;f;f=f.nextSibling){if(d=n(f,f.firstChild,0))return se(Do(d.line,d.ch-p),o);p+=f.textContent.length}for(var h=l.previousSibling,p=r;h;h=h.previousSibling){if(d=n(h,h.firstChild,-1))return se(Do(d.line,d.ch+p),o);p+=f.textContent.length}}function ue(e,t,r,n,i){function o(e){return function(t){return t.id==e}}function a(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return""==r&&(r=t.textContent.replace(/\u200b/g,"")),void(s+=r);var u,d=t.getAttribute("cm-marker");if(d){var f=e.findMarks(Do(n,0),Do(i+1,0),o(+d));return void(f.length&&(u=f[0].find())&&(s+=Jn(e.doc,u.from,u.to).join(c)))}if("false"==t.getAttribute("contenteditable"))return;for(var p=0;p=0){var a=Z(o.from(),i.from()),s=X(o.to(),i.to()),l=o.empty()?i.from()==i.head:o.from()==o.head;t>=n&&--t,e.splice(--n,2,new fe(l?s:a,l?a:s))}}return new de(e,t)}function he(e,t){return new de([new fe(e,t||e)],0)}function me(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ge(e,t){if(t.liner?Do(r,Qn(e,r).text.length):ve(t,Qn(e,t.line).text.length)}function ve(e,t){var r=e.ch;return null==r||r>t?Do(e.line,t):0>r?Do(e.line,0):e}function ye(e,t){return t>=e.first&&t=t.ch:s.to>t.ch))){if(i&&(Na(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!l.atomic)continue;if(r){var c,u=l.find(0>n?1:-1);if((0>n?l.inclusiveRight:l.inclusiveLeft)&&(u=Ne(e,u,-n,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=Bo(u,r))&&(0>n?0>c:c>0))return ze(e,u,t,n,i)}var d=l.find(0>n?-1:1);return(0>n?l.inclusiveLeft:l.inclusiveRight)&&(d=Ne(e,d,n,d.line==t.line?o:null)),d?ze(e,d,t,n,i):null}}return t}function Ie(e,t,r,n,i){var o=n||1,a=ze(e,t,r,o,i)||!i&&ze(e,t,r,o,!0)||ze(e,t,r,-o,i)||!i&&ze(e,t,r,-o,!0);return a?a:(e.cantEdit=!0,Do(e.first,0))}function Ne(e,t,r,n){return 0>r&&0==t.ch?t.line>e.first?ge(e,Do(t.line-1)):null:r>0&&t.ch==(n||Qn(e,t.line)).text.length?t.line=e.display.viewTo||s.to().linet&&(t=0),t=Math.round(t),n=Math.round(n),s.appendChild(Hi("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==r?u-e:r)+"px; height: "+(n-t)+"px"))}function i(t,r,i){function o(r,n){return pt(e,Do(t,r),"div",d,n)}var s,l,d=Qn(a,t),f=d.text.length;return to(oi(d),r||0,null==i?f:i,function(e,t,a){var d,p,h,m=o(e,"left");if(e==t)d=m,p=h=m.left;else{if(d=o(t-1,"right"),"rtl"==a){var g=m;m=d,d=g}p=m.left,h=d.right}null==r&&0==e&&(p=c),d.top-m.top>3&&(n(p,m.top,null,m.bottom),p=c,m.bottoml.bottom||d.bottom==l.bottom&&d.right>l.right)&&(l=d),c+1>p&&(p=c),n(p,d.top,h-p,d.bottom)}),{start:s,end:l}}var o=e.display,a=e.doc,s=document.createDocumentFragment(),l=Ke(e.display),c=l.left,u=Math.max(o.sizerWidth,Ge(e)-o.sizer.offsetLeft)-l.right,d=t.from(),f=t.to();if(d.line==f.line)i(d.line,d.ch,f.ch);else{var p=Qn(a,d.line),h=Qn(a,f.line),m=bn(p)==bn(h),g=i(d.line,d.ch,m?p.text.length+1:null).end,v=i(f.line,m?0:null,f.ch).start;m&&(g.top0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Be(e,t){e.doc.mode.startState&&e.doc.frontier=e.display.viewTo)){var r=+new Date+e.options.workTime,n=ca(t.mode,He(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var a=o.styles,s=o.text.length>e.options.maxHighlightLength,l=qn(e,o,s?ca(t.mode,n):n,!0);o.styles=l.styles;var c=o.styleClasses,u=l.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),f=0;!d&&fr?(Be(e,e.options.workDelay),!0):void 0}),i.length&&Et(e,function(){for(var t=0;ta;--s){if(s<=o.first)return o.first;var l=Qn(o,s-1);if(l.stateAfter&&(!r||s<=o.frontier))return s;var c=Fa(l.text,null,e.options.tabSize);(null==i||n>c)&&(i=s-1,n=c)}return i}function He(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return!0;var o=We(e,t,r),a=o>n.first&&Qn(n,o-1).stateAfter;return a=a?ca(n.mode,a):ua(n.mode),n.iter(o,t,function(r){Rn(e,r.text,a);var s=o==t-1||o%5==0||o>=i.viewFrom&&o2&&o.push((l.bottom+c.top)/2-r.top)}}o.push(r.bottom-r.top)}}function Ye(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;nr)return{map:e.measure.maps[n],cache:e.measure.caches[n],before:!0}}function Qe(e,t){t=bn(t);var r=ri(t),n=e.display.externalMeasured=new Nt(e.doc,t,r);n.lineN=r;var i=n.built=Dn(e,n);return n.text=i.pre,Ui(e.display.lineMeasure,i.pre),n}function Je(e,t,r,n){return rt(e,tt(e,t),r,n)}function et(e,t){if(t>=e.display.viewFrom&&t=r.lineN&&tt?(i=0,o=1,a="left"):c>t?(i=t-l,o=i+1):(s==e.length-3||t==c&&e[s+3]>t)&&(o=c-l,i=o-1,t>=c&&(a="right")),null!=i){if(n=e[s+2],l==c&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==i)for(;s&&e[s-2]==e[s-3]&&e[s-1].insertLeft;)n=e[(s-=3)+2],a="left";if("right"==r&&i==c-l)for(;su;u++){for(;s&&Wi(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+lxo&&0==s&&l==o.coverEnd-o.coverStart)i=a.parentNode.getBoundingClientRect();else if(ko&&e.options.lineWrapping){var d=Ua(a,s,l).getClientRects();i=d.length?d["right"==n?d.length-1:0]:Uo}else i=Ua(a,s,l).getBoundingClientRect()||Uo;if(i.left||i.right||0==s)break;l=s,s-=1,c="right"}ko&&11>xo&&(i=ot(e.display.measure,i))}else{s>0&&(c=n="right");var d;i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==n?d.length-1:0]:a.getBoundingClientRect()}if(ko&&9>xo&&!s&&(!i||!i.left&&!i.right)){var f=a.parentNode.getClientRects()[0];i=f?{left:f.left,right:f.left+kt(e.display),top:f.top,bottom:f.bottom}:Uo}for(var p=i.top-t.rect.top,h=i.bottom-t.rect.top,m=(p+h)/2,g=t.view.measure.heights,u=0;ur.from?a(e-1):a(e,n)}n=n||Qn(e.doc,t.line),i||(i=tt(e,n));var l=oi(n),c=t.ch;if(!l)return a(c);var u=uo(l,c),d=s(c,u);return null!=ss&&(d.other=s(c,ss)),d}function mt(e,t){var r=0,t=ge(e.doc,t);e.options.lineWrapping||(r=kt(e.display)*t.ch);var n=Qn(e.doc,t.line),i=ii(n)+$e(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function gt(e,t,r,n){var i=Do(e,t);return i.xRel=n,r&&(i.outside=!0),i}function vt(e,t,r){var n=e.doc;if(r+=e.display.viewOffset,0>r)return gt(n.first,0,!0,-1);var i=ni(n,r),o=n.first+n.size-1;if(i>o)return gt(n.first+n.size-1,Qn(n,o).text.length,!0,1);0>t&&(t=0);for(var a=Qn(n,i);;){var s=yt(e,a,i,t,r),l=vn(a),c=l&&l.find(0,!0);if(!l||!(s.ch>c.from.ch||s.ch==c.from.ch&&s.xRel>0))return s;i=ri(a=c.to.line)}}function yt(e,t,r,n,i){function o(n){var i=ht(e,Do(r,n),"line",t,c);return s=!0,a>i.bottom?i.left-l:ag)return gt(r,p,v,1);for(;;){if(u?p==f||p==po(t,f,1):1>=p-f){for(var y=h>n||g-n>=n-h?f:p,b=n-(y==f?h:g);Wi(t.text.charAt(y));)++y;var k=gt(r,y,y==f?m:v,-1>b?-1:b>1?1:0);return k}var x=Math.ceil(d/2),w=f+x;if(u){w=f;for(var _=0;x>_;++_)w=po(t,w,1)}var C=o(w);C>n?(p=w,g=C,(v=s)&&(g+=1e3),d=x):(f=w,h=C,m=s,d-=x)}}function bt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Wo){Wo=Hi("pre");for(var t=0;49>t;++t)Wo.appendChild(document.createTextNode("x")),Wo.appendChild(Hi("br"));Wo.appendChild(document.createTextNode("x"))}Ui(e.measure,Wo);var r=Wo.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),$i(e.measure),r||1}function kt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Hi("span","xxxxxxxxxx"),r=Hi("pre",[t]);Ui(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function xt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Vo},Ko?Ko.ops.push(e.curOp):e.curOp.ownsGroup=Ko={ops:[e.curOp],delayedCallbacks:[]}}function wt(e){var t=e.delayedCallbacks,r=0;do{for(;r=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new S(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Mt(e){e.updatedDisplay=e.mustUpdate&&L(e.cm,e.update)}function Lt(e){var t=e.cm,r=t.display;e.updatedDisplay&&O(t),e.barMeasure=h(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Je(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Ve(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Ge(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Tt(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLefto;o=n){var a=new Nt(e.doc,Qn(e.doc,o),o);n=o+a.size,i.push(a)}return i}function Pt(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0);var i=e.display;if(n&&rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)jo&&xn(e.doc,t)i.viewFrom?jt(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)jt(e);else if(t<=i.viewFrom){var o=Bt(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):jt(e)}else if(r>=i.viewTo){var o=Bt(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):jt(e)}else{var a=Bt(e,t,t,-1),s=Bt(e,r,r+n,1);a&&s?(i.view=i.view.slice(0,a.index).concat(qt(e,a.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=n):jt(e)}var l=i.externalMeasured;l&&(r=i.lineN&&t=n.viewTo)){var o=n.view[Dt(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==Ni(a,r)&&a.push(r)}}}function jt(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Dt(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var r=e.display.view,n=0;nt)return n}function Bt(e,t,r,n){var i,o=Dt(e,t),a=e.display.view;if(!jo||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=0,l=e.display.viewFrom;o>s;s++)l+=a[s].size;if(l!=t){if(n>0){if(o==a.length-1)return null;i=l+a[o].size-t,o++}else i=l-t;t+=i,r+=i}for(;xn(e.doc,r)!=r;){if(o==(0>n?0:a.length-1))return null;r+=n*a[o-(0>n?1:0)].size,o+=n}return{index:o,lineN:r}}function Ft(e,t,r){var n=e.display,i=n.view;0==i.length||t>=n.viewTo||r<=n.viewFrom?(n.view=qt(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=qt(e,t,n.viewFrom).concat(n.view):n.viewFromr&&(n.view=n.view.slice(0,Dt(e,r)))),n.viewTo=r}function Wt(e){for(var t=e.display.view,r=0,n=0;n400}var i=e.display;Oa(i.scroller,"mousedown",Ot(e,Gt)),ko&&11>xo?Oa(i.scroller,"dblclick",Ot(e,function(t){if(!Li(e,t)){var r=Vt(e,t);if(r&&!Jt(e,t)&&!Kt(e.display,t)){Ta(t);var n=e.findWordAt(r);xe(e.doc,n.anchor,n.head)}}})):Oa(i.scroller,"dblclick",function(t){Li(e,t)||Ta(t)}),Po||Oa(i.scroller,"contextmenu",function(t){br(e,t)});var o,a={end:0};Oa(i.scroller,"touchstart",function(t){if(!Li(e,t)&&!r(t)){clearTimeout(o);var n=+new Date;i.activeTouch={start:n,moved:!1,prev:n-a.end<=300?a:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),Oa(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Oa(i.scroller,"touchend",function(r){var o=i.activeTouch;if(o&&!Kt(i,r)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,s=e.coordsChar(i.activeTouch,"page");a=!o.prev||n(o,o.prev)?new fe(s,s):!o.prev.prev||n(o,o.prev.prev)?e.findWordAt(s):new fe(Do(s.line,0),ge(e.doc,Do(s.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),Ta(r)}t()}),Oa(i.scroller,"touchcancel",t),Oa(i.scroller,"scroll",function(){i.scroller.clientHeight&&(ir(e,i.scroller.scrollTop),or(e,i.scroller.scrollLeft,!0),Na(e,"scroll",e))}),Oa(i.scroller,"mousewheel",function(t){ar(e,t)}),Oa(i.scroller,"DOMMouseScroll",function(t){ar(e,t)}),Oa(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Li(e,t)||Ea(t)},over:function(t){Li(e,t)||(rr(e,t),Ea(t))},start:function(t){tr(e,t)},drop:Ot(e,er),leave:function(t){Li(e,t)||nr(e)}};var s=i.input.getField();Oa(s,"keyup",function(t){hr.call(e,t)}),Oa(s,"keydown",Ot(e,fr)),Oa(s,"keypress",Ot(e,mr)),Oa(s,"focus",Di(vr,e)),Oa(s,"blur",Di(yr,e))}function $t(t,r,n){var i=n&&n!=e.Init;if(!r!=!i){var o=t.display.dragFunctions,a=r?Oa:Ia;a(t.display.scroller,"dragstart",o.start),a(t.display.scroller,"dragenter",o.enter),a(t.display.scroller,"dragover",o.over),a(t.display.scroller,"dragleave",o.leave),a(t.display.scroller,"drop",o.drop)}}function Ut(e){var t=e.display;(t.lastWrapHeight!=t.wrapper.clientHeight||t.lastWrapWidth!=t.wrapper.clientWidth)&&(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Kt(e,t){for(var r=wi(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function Vt(e,t,r,n){var i=e.display;if(!r&&"true"==wi(t).getAttribute("cm-not-content"))return null;var o,a,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,a=t.clientY-s.top}catch(t){return null}var l,c=vt(e,o,a);if(n&&1==c.xRel&&(l=Qn(e.doc,c.line).text).length==c.ch){var u=Fa(l,l.length,e.options.tabSize)-l.length;c=Do(c.line,Math.max(0,Math.round((o-Ke(e.display).left)/kt(e.display))-u))}return c}function Gt(e){var t=this,r=t.display;if(!(Li(t,e)||r.activeTouch&&r.input.supportsTouch())){if(r.shift=e.shiftKey,Kt(r,e))return void(wo||(r.scroller.draggable=!1,setTimeout(function(){r.scroller.draggable=!0},100)));if(!Jt(t,e)){var n=Vt(t,e);switch(window.focus(),_i(e)){case 1:t.state.selectingText?t.state.selectingText(e):n?Xt(t,e,n):wi(e)==r.scroller&&Ta(e);break;case 2:wo&&(t.state.lastMiddleDown=+new Date),n&&xe(t.doc,n),setTimeout(function(){r.input.focus()},20),Ta(e);break;case 3:Po?br(t,e):gr(t)}}}}function Xt(e,t,r){ko?setTimeout(Di(Y,e),0):e.curOp.focus=Ki();var n,i=+new Date;$o&&$o.time>i-400&&0==Bo($o.pos,r)?n="triple":Ho&&Ho.time>i-400&&0==Bo(Ho.pos,r)?(n="double",$o={time:i,pos:r}):(n="single",Ho={time:i,pos:r});var o,a=e.doc.sel,s=Oo?t.metaKey:t.ctrlKey;e.options.dragDrop&&ts&&!e.isReadOnly()&&"single"==n&&(o=a.contains(r))>-1&&(Bo((o=a.ranges[o]).from(),r)<0||r.xRel>0)&&(Bo(o.to(),r)>0||r.xRel<0)?Zt(e,t,r,s):Yt(e,t,r,n,s)}function Zt(e,t,r,n){var i=e.display,o=+new Date,a=Ot(e,function(s){wo&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ia(document,"mouseup",a),Ia(i.scroller,"drop",a),Math.abs(t.clientX-s.clientX)+Math.abs(t.clientY-s.clientY)<10&&(Ta(s),!n&&+new Date-200=h;h++){var v=Qn(c,h).text,y=Wa(v,l,o);l==p?i.push(new fe(Do(h,y),Do(h,y))):v.length>y&&i.push(new fe(Do(h,y),Do(h,Wa(v,p,o))))}i.length||i.push(new fe(r,r)),Le(c,pe(f.ranges.slice(0,d).concat(i),d),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,k=b.anchor,x=t;if("single"!=n){if("double"==n)var w=e.findWordAt(t);else var w=new fe(Do(t.line,0),ge(c,Do(t.line+1,0)));Bo(w.anchor,k)>0?(x=w.head,k=Z(b.from(),w.anchor)):(x=w.anchor,k=X(b.to(),w.head))}var i=f.ranges.slice(0);i[d]=new fe(ge(c,k),x),Le(c,pe(i,d),Da)}}function a(t){var r=++y,i=Vt(e,t,!0,"rect"==n);if(i)if(0!=Bo(i,g)){e.curOp.focus=Ki(),o(i);var s=k(l,c);(i.line>=s.to||i.linev.bottom?20:0;u&&setTimeout(Ot(e,function(){y==r&&(l.scroller.scrollTop+=u,a(t))}),50)}}function s(t){e.state.selectingText=!1,y=1/0,Ta(t),l.input.focus(),Ia(document,"mousemove",b),Ia(document,"mouseup",x),c.history.lastSelOrigin=null}var l=e.display,c=e.doc;Ta(t);var u,d,f=c.sel,p=f.ranges;if(i&&!t.shiftKey?(d=c.sel.contains(r),u=d>-1?p[d]:new fe(r,r)):(u=c.sel.primary(),d=c.sel.primIndex),zo?t.shiftKey&&t.metaKey:t.altKey)n="rect",i||(u=new fe(r,r)),r=Vt(e,t,!0,!0),d=-1;else if("double"==n){var h=e.findWordAt(r);u=e.display.shift||c.extend?ke(c,u,h.anchor,h.head):h}else if("triple"==n){var m=new fe(Do(r.line,0),ge(c,Do(r.line+1,0)));u=e.display.shift||c.extend?ke(c,u,m.anchor,m.head):m}else u=ke(c,u,r);i?-1==d?(d=p.length,Le(c,pe(p.concat([u]),d),{scroll:!1,origin:"*mouse"})):p.length>1&&p[d].empty()&&"single"==n&&!t.shiftKey?(Le(c,pe(p.slice(0,d).concat(p.slice(d+1)),0),{scroll:!1,origin:"*mouse"}),f=c.sel):_e(c,d,u,Da):(d=0,Le(c,new de([u],0),Da),f=c.sel);var g=r,v=l.wrapper.getBoundingClientRect(),y=0,b=Ot(e,function(e){_i(e)?a(e):s(e)}),x=Ot(e,s);e.state.selectingText=x,Oa(document,"mousemove",b),Oa(document,"mouseup",x)}function Qt(e,t,r,n){try{var i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&Ta(t);var a=e.display,s=a.lineDiv.getBoundingClientRect();if(o>s.bottom||!Ai(e,r))return xi(t);o-=s.top-a.viewOffset;for(var l=0;l=i){var u=ni(e.doc,o),d=e.options.gutters[l];return Na(e,r,e,u,d,t),xi(t)}}}function Jt(e,t){return Qt(e,t,"gutterClick",!0)}function er(e){var t=this;if(nr(t),!Li(t,e)&&!Kt(t.display,e)){Ta(e),ko&&(Go=+new Date);var r=Vt(t,e,!0),n=e.dataTransfer.files;if(r&&!t.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),a=0,s=function(e,n){if(!t.options.allowDropFileTypes||-1!=Ni(t.options.allowDropFileTypes,e.type)){var s=new FileReader;s.onload=Ot(t,function(){var e=s.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[n]=e,++a==i){r=ge(t.doc,r);var l={from:r,to:r,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};Mr(t.doc,l),Me(t.doc,he(r,ea(l)))}}),s.readAsText(e)}},l=0;i>l;++l)s(n[l],l);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!(Oo?e.altKey:e.ctrlKey))var c=t.listSelections();if(Te(t.doc,he(r,r)),c)for(var l=0;la.clientWidth,l=a.scrollHeight>a.clientHeight;if(n&&s||i&&l){if(i&&Oo&&wo)e:for(var c=t.target,u=o.view;c!=a;c=c.parentNode)for(var d=0;df?p=Math.max(0,p+f-50):h=Math.min(e.doc.height,h+f+50),A(e,{top:p,bottom:h})}20>Xo&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&(Zo=(Zo*Xo+r)/(Xo+1),++Xo)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}function sr(e,t,r){if("string"==typeof t&&(t=da[t],!t))return!1;e.display.input.ensurePolled();var n=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=Ra}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}function lr(e,t,r){for(var n=0;nxo&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=ur(t,e);So&&(Jo=n?r:null,!n&&88==r&&!is&&(Oo?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||pr(t)}}function pr(e){function t(e){18!=e.keyCode&&e.altKey||(Qa(r,"CodeMirror-crosshair"),Ia(document,"keyup",t),Ia(document,"mouseover",t))}var r=e.display.lineDiv;Ja(r,"CodeMirror-crosshair"),Oa(document,"keyup",t),Oa(document,"mouseover",t)}function hr(e){16==e.keyCode&&(this.doc.sel.shift=!1),Li(this,e)}function mr(e){var t=this;if(!(Kt(t.display,e)||Li(t,e)||e.ctrlKey&&!e.altKey||Oo&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(So&&r==Jo)return Jo=null,void Ta(e);if(!So||e.which&&!(e.which<10)||!ur(t,e)){var i=String.fromCharCode(null==n?r:n);dr(t,e,i)||t.display.input.onKeyPress(e)}}}function gr(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,yr(e))},100)}function vr(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(Na(e,"focus",e),e.state.focused=!0,Ja(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),wo&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),De(e))}function yr(e){e.state.delayingBlurEvent||(e.state.focused&&(Na(e,"blur",e),e.state.focused=!1,Qa(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function br(e,t){Kt(e.display,t)||kr(e,t)||Li(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function kr(e,t){return Ai(e,"gutterContextMenu")?Qt(e,t,"gutterContextMenu",!1):!1}function xr(e,t){if(Bo(e,t.from)<0)return e;if(Bo(e,t.to)<=0)return ea(t);var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch;return e.line==t.to.line&&(n+=ea(t).ch-t.to.ch),Do(r,n)}function wr(e,t){for(var r=[],n=0;n=0;--i)Lr(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text});else Lr(e,t)}}function Lr(e,t){if(1!=t.text.length||""!=t.text[0]||0!=Bo(t.from,t.to)){var r=wr(e,t);ui(e,t,r,e.cm?e.cm.curOp.id:0/0),Er(e,t,r,an(e,t));var n=[];Zn(e,function(e,r){r||-1!=Ni(n,e.history)||(ki(e.history,t),n.push(e.history)),Er(e,t,null,an(e,t))})}}function Tr(e,t,r){if(!e.cm||!e.cm.state.suppressEdits){for(var n,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,s="undo"==t?i.undone:i.done,l=0;l=0;--l){var d=n.changes[l];if(d.origin=t,u&&!Sr(e,d,!1))return void(a.length=0);c.push(si(e,d));var f=l?wr(e,d):Ii(a);Er(e,d,f,ln(e,d)),!l&&e.cm&&e.cm.scrollIntoView({from:d.from,to:ea(d)});var p=[];Zn(e,function(e,t){t||-1!=Ni(p,e.history)||(ki(e.history,d),p.push(e.history)),Er(e,d,null,ln(e,d))})}}}}function Ar(e,t){if(0!=t&&(e.first+=t,e.sel=new de(qi(e.sel.ranges,function(e){return new fe(Do(e.anchor.line+t,e.anchor.ch),Do(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Pt(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;ne.lastLine())){if(t.from.lineo&&(t={from:t.from,to:Do(o,Qn(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Jn(e,t.from,t.to),r||(r=wr(e,t)),e.cm?Or(e.cm,t,n):Vn(e,t,n),Te(e,r,ja)}}function Or(e,t,r){var n=e.doc,i=e.display,a=t.from,s=t.to,l=!1,c=a.line;e.options.lineWrapping||(c=ri(bn(Qn(n,a.line))),n.iter(c,s.line+1,function(e){return e==i.maxLine?(l=!0,!0):void 0})),n.sel.contains(t.from,t.to)>-1&&Ti(e),Vn(n,t,r,o(e)),e.options.lineWrapping||(n.iter(c,a.line+t.text.length,function(e){var t=d(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)}),l&&(e.curOp.updateMaxLine=!0)),n.frontier=Math.min(n.frontier,a.line),Be(e,400);var u=t.text.length-(s.line-a.line)-1;t.full?Pt(e):a.line!=s.line||1!=t.text.length||Kn(e.doc,t)?Pt(e,a.line,s.line+1,u):Rt(e,a.line,"text");var f=Ai(e,"changes"),p=Ai(e,"change");if(p||f){var h={from:a,to:s,text:t.text,removed:t.removed,origin:t.origin};p&&Si(e,"change",e,h),f&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function zr(e,t,r,n,i){if(n||(n=r),Bo(n,r)<0){var o=n;n=r,r=o}"string"==typeof t&&(t=e.splitLines(t)),Mr(e,{from:r,to:n,text:t,origin:i})}function Ir(e,t){if(!Li(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null;if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!To){var o=Hi("div","​",null,"position: absolute; top: "+(t.top-r.viewOffset-$e(e.display))+"px; height: "+(t.bottom-t.top+Ve(e)+r.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function Nr(e,t,r,n){null==n&&(n=0);for(var i=0;5>i;i++){var o=!1,a=ht(e,t),s=r&&r!=t?ht(e,r):a,l=Pr(e,Math.min(a.left,s.left),Math.min(a.top,s.top)-n,Math.max(a.left,s.left),Math.max(a.bottom,s.bottom)+n),c=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=l.scrollTop&&(ir(e,l.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(o=!0)),null!=l.scrollLeft&&(or(e,l.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return a}function qr(e,t,r,n,i){var o=Pr(e,t,r,n,i);null!=o.scrollTop&&ir(e,o.scrollTop),null!=o.scrollLeft&&or(e,o.scrollLeft)}function Pr(e,t,r,n,i){var o=e.display,a=bt(e.display);0>r&&(r=0);var s=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,l=Xe(e),c={};i-r>l&&(i=r+l);var u=e.doc.height+Ue(o),d=a>r,f=i>u-a;if(s>r)c.scrollTop=d?0:r;else if(i>s+l){var p=Math.min(r,(f?u:i)-l);p!=s&&(c.scrollTop=p)}var h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,m=Ge(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),g=n-t>m;return g&&(n=t+m),10>t?c.scrollLeft=0:h>t?c.scrollLeft=Math.max(0,t-(g?0:10)):n>m+h-3&&(c.scrollLeft=n+(g?0:10)-m),c}function Rr(e,t,r){(null!=t||null!=r)&&Dr(e), +null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=r&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+r)}function jr(e){Dr(e);var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?Do(t.line,t.ch-1):t,n=Do(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function Dr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=mt(e,t.from),n=mt(e,t.to),i=Pr(e,Math.min(r.left,n.left),Math.min(r.top,n.top)-t.margin,Math.max(r.right,n.right),Math.max(r.bottom,n.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function Br(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=He(e,t):r="prev");var a=e.options.tabSize,s=Qn(o,t),l=Fa(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var c,u=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&(c=o.mode.indent(i,s.text.slice(u.length),s.text),c==Ra||c>150)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?Fa(Qn(o,t-1).text,null,a):0:"add"==r?c=l+e.options.indentUnit:"subtract"==r?c=l-e.options.indentUnit:"number"==typeof r&&(c=l+r),c=Math.max(0,c);var d="",f=0;if(e.options.indentWithTabs)for(var p=Math.floor(c/a);p;--p)f+=a,d+=" ";if(c>f&&(d+=zi(c-f)),d!=u)return zr(o,d,Do(t,0),Do(t,u.length),"+input"),s.stateAfter=null,!0;for(var p=0;p=0;t--)zr(e.doc,"",n[t].from,n[t].to,"+delete");jr(e)})}function Hr(e,t,r,n,i){function o(){var t=s+r;return t=e.first+e.size?!1:(s=t,u=Qn(e,t))}function a(e){var t=(i?po:ho)(u,l,r,!0);if(null==t){if(e||!o())return!1;l=i?(0>r?oo:io)(u):0>r?u.text.length:0}else l=t;return!0}var s=t.line,l=t.ch,c=r,u=Qn(e,s);if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var d=null,f="group"==n,p=e.cm&&e.cm.getHelper(t,"wordChars"),h=!0;!(0>r)||a(!h);h=!1){var m=u.text.charAt(l)||"\n",g=Bi(m,p)?"w":f&&"\n"==m?"n":!f||/\s/.test(m)?null:"p";if(!f||h||g||(g="s"),d&&d!=g){0>r&&(r=1,a());break}if(g&&(d=g),r>0&&!a(!h))break}var v=Ie(e,Do(s,l),t,c,!0);return Bo(t,v)||(v.hitSide=!0),v}function $r(e,t,r,n){var i,o=e.doc,a=t.left;if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+r*(s-(0>r?1.5:.5)*bt(e.display))}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;;){var l=vt(e,a,i);if(!l.outside)break;if(0>r?0>=i:i>=o.height){l.hitSide=!0;break}i+=5*r}return l}function Ur(t,r,n,i){e.defaults[t]=r,n&&(ra[t]=i?function(e,t,r){r!=na&&n(e,t,r)}:n)}function Kr(e){for(var t,r,n,i,o=e.split(/-(?!$)/),e=o[o.length-1],a=0;a0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Hi("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(yn(e,t.line,t,r,o)||t.line!=r.line&&yn(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");jo=!0}o.addToHistory&&ui(e,{from:t,to:r,origin:"markText"},e.sel,0/0);var s,l=t.line,c=e.cm;if(e.iter(l,r.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&bn(e)==c.display.maxLine&&(s=!0),o.collapsed&&l!=t.line&&ti(e,0),rn(e,new Jr(o,l==t.line?t.ch:null,l==r.line?r.ch:null)),++l}),o.collapsed&&e.iter(t.line,r.line+1,function(t){_n(e,t)&&ti(t,0)}),o.clearOnEnter&&Oa(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Ro=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++va,o.atomic=!0),c){if(s&&(c.curOp.updateMaxLine=!0),o.collapsed)Pt(c,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=t.line;u<=r.line;u++)Rt(c,u,"text");o.atomic&&Ee(c.doc),Si(c,"markerAdded",c,o)}return o}function Xr(e,t,r,n,i){n=ji(n),n.shared=!1;var o=[Gr(e,t,r,n,i)],a=o[0],s=n.widgetNode;return Zn(e,function(e){s&&(n.widgetNode=s.cloneNode(!0)),o.push(Gr(e,ge(e,t),ge(e,r),n,i));for(var l=0;l=t:o.to>t);(n||(n=[])).push(new Jr(a,o.from,l?null:o.to))}}return n}function on(e,t,r){if(e)for(var n,i=0;i=t:o.to>t);if(s||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from0&&s)for(var d=0;dd;++d)h.push(m);h.push(l)}return h}function sn(e){for(var t=0;t0)){var u=[l,1],d=Bo(c.from,s.from),f=Bo(c.to,s.to);(0>d||!a.inclusiveLeft&&!d)&&u.push({from:c.from,to:s.from}),(f>0||!a.inclusiveRight&&!f)&&u.push({from:s.to,to:c.to}),i.splice.apply(i,u),l+=u.length-1}}return i}function un(e){var t=e.markedSpans;if(t){for(var r=0;r=0&&0>=d||0>=u&&d>=0)&&(0>=u&&(Bo(c.to,r)>0||l.marker.inclusiveRight&&i.inclusiveLeft)||u>=0&&(Bo(c.from,n)<0||l.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function bn(e){for(var t;t=gn(e);)e=t.find(-1,!0).line;return e}function kn(e){for(var t,r;t=vn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function xn(e,t){var r=Qn(e,t),n=bn(r);return r==n?t:ri(n)}function wn(e,t){if(t>e.lastLine())return t;var r,n=Qn(e,t);if(!_n(e,n))return t;for(;r=vn(n);)n=r.find(1,!0).line;return ri(n)+1}function _n(e,t){var r=jo&&t.markedSpans;if(r)for(var n,i=0;io;o++){i&&(i[0]=e.innerMode(t,n).mode);var a=t.token(r,n);if(r.pos>r.start)return a}throw new Error("Mode "+t.name+" failed to advance stream.")}function In(e,t,r,n){function i(e){return{start:d.start,end:d.pos,string:d.current(),type:o||null,state:e?ca(a.mode,u):u}}var o,a=e.doc,s=a.mode;t=ge(a,t);var l,c=Qn(a,t.line),u=He(e,t.line,r),d=new ga(c.text,e.options.tabSize);for(n&&(l=[]);(n||d.pose.options.maxHighlightLength?(s=!1,a&&Rn(e,t,n,d.pos),d.pos=t.length,l=null):l=En(zn(r,d,n,f),o),f){var p=f[0].name;p&&(l="m-"+(l?p+" "+l:p))}if(!s||u!=l){for(;cc;){var n=i[l];n>e&&i.splice(l,1,e,i[l+1],n),l+=2,c=Math.min(e,n)}if(t)if(s.opaque)i.splice(r,l-r,e,"cm-overlay "+t),l=r+2;else for(;l>r;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Pn(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=He(e,ri(t)),i=qn(e,t,t.text.length>e.options.maxHighlightLength?ca(e.doc.mode,n):n);t.stateAfter=n,t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.frontier&&e.doc.frontier++}return t.styles}function Rn(e,t,r,n){var i=e.doc.mode,o=new ga(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&On(i,r);!o.eol();)zn(i,o,r),o.start=o.pos}function jn(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?_a:wa;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Dn(e,t){var r=Hi("span",null,null,wo?"padding-right: .1px":null),n={pre:Hi("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,splitSpaces:(ko||wo)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,a=i?t.rest[i-1]:t.line;n.pos=0,n.addToken=Fn,Ji(e.display.measure)&&(o=oi(a))&&(n.addToken=Hn(n.addToken,o)),n.map=[];var s=t!=e.display.externalMeasured&&ri(a);Un(a,n,Pn(e,a,s)),a.styleClasses&&(a.styleClasses.bgClass&&(n.bgClass=Gi(a.styleClasses.bgClass,n.bgClass||"")),a.styleClasses.textClass&&(n.textClass=Gi(a.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Qi(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return wo&&/\bcm-tab\b/.test(n.content.lastChild.className)&&(n.content.className="cm-tab-wrap-hack"),Na(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=Gi(n.pre.className,n.textClass||"")),n}function Bn(e){var t=Hi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Fn(e,t,r,n,i,o,a){if(t){var s=e.splitSpaces?t.replace(/ {3,}/g,Wn):t,l=e.cm.state.specialChars,c=!1;if(l.test(t))for(var u=document.createDocumentFragment(),d=0;;){l.lastIndex=d;var f=l.exec(t),p=f?f.index-d:t.length-d;if(p){var h=document.createTextNode(s.slice(d,d+p));u.appendChild(ko&&9>xo?Hi("span",[h]):h),e.map.push(e.pos,e.pos+p,h),e.col+=p,e.pos+=p}if(!f)break;if(d+=p+1," "==f[0]){var m=e.cm.options.tabSize,g=m-e.col%m,h=u.appendChild(Hi("span",zi(g),"cm-tab"));h.setAttribute("role","presentation"),h.setAttribute("cm-text"," "),e.col+=g}else if("\r"==f[0]||"\n"==f[0]){var h=u.appendChild(Hi("span","\r"==f[0]?"␍":"␤","cm-invalidchar"));h.setAttribute("cm-text",f[0]),e.col+=1}else{var h=e.cm.options.specialCharPlaceholder(f[0]);h.setAttribute("cm-text",f[0]),u.appendChild(ko&&9>xo?Hi("span",[h]):h),e.col+=1}e.map.push(e.pos,e.pos+1,h),e.pos++}else{e.col+=t.length;var u=document.createTextNode(s);e.map.push(e.pos,e.pos+t.length,u),ko&&9>xo&&(c=!0),e.pos+=t.length}if(r||n||i||c||a){var v=r||"";n&&(v+=n),i&&(v+=i);var y=Hi("span",[u],v,a);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(u)}}function Wn(e){for(var t=" ",r=0;rc&&f.from<=c)break}if(f.to>=u)return e(r,n,i,o,a,s,l);e(r,n.slice(0,f.to-c),i,o,null,s,l),o=null,n=n.slice(f.to-c),c=f.to}}}function $n(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t}function Un(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a,s,l,c,u,d,f,p=i.length,h=0,m=1,g="",v=0;;){if(v==h){l=c=u=d=s="",f=null,v=1/0;for(var y,b=[],k=0;kh||w.collapsed&&x.to==h&&x.from==h)?(null!=x.to&&x.to!=h&&v>x.to&&(v=x.to,c=""),w.className&&(l+=" "+w.className),w.css&&(s=(s?s+";":"")+w.css),w.startStyle&&x.from==h&&(u+=" "+w.startStyle),w.endStyle&&x.to==v&&(y||(y=[])).push(w.endStyle,x.to),w.title&&!d&&(d=w.title),w.collapsed&&(!f||hn(f.marker,w)<0)&&(f=x)):x.from>h&&v>x.from&&(v=x.from)}if(y)for(var k=0;k=p)break;for(var _=Math.min(p,v);;){if(g){var C=h+g.length;if(!f){var S=C>_?g.slice(0,_-h):g;t.addToken(t,S,a?a+l:l,u,h+S.length==v?c:"",d,s)}if(C>=_){g=g.slice(_-h),h=_;break}h=C,u=""}g=i.slice(o,o=r[m++]),a=jn(r[m++],t.cm.options)}}else for(var m=1;mr;++r)o.push(new xa(c[r],i(r),n));return o}var s=t.from,l=t.to,c=t.text,u=Qn(e,s.line),d=Qn(e,l.line),f=Ii(c),p=i(c.length-1),h=l.line-s.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(Kn(e,t)){var m=a(0,c.length-1);o(d,d.text,p),h&&e.remove(s.line,h),m.length&&e.insert(s.line,m)}else if(u==d)if(1==c.length)o(u,u.text.slice(0,s.ch)+f+u.text.slice(l.ch),p);else{var m=a(1,c.length-1);m.push(new xa(f+u.text.slice(l.ch),p,n)),o(u,u.text.slice(0,s.ch)+c[0],i(0)),e.insert(s.line+1,m)}else if(1==c.length)o(u,u.text.slice(0,s.ch)+c[0]+d.text.slice(l.ch),i(0)),e.remove(s.line+1,h);else{o(u,u.text.slice(0,s.ch)+c[0],i(0)),o(d,f+d.text.slice(l.ch),p);var m=a(1,c.length-1);h>1&&e.remove(s.line+1,h-1),e.insert(s.line+1,m)}Si(e,"change",e,t)}function Gn(e){this.lines=e,this.parent=null;for(var t=0,r=0;tt||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(o>t){r=i;break}t-=o}return r.lines[t]}function Jn(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function ei(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function ti(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function ri(e){if(null==e.parent)return null;for(var t=e.parent,r=Ni(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function ni(e,t){var r=e.first;e:do{for(var n=0;nt){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var n=0;nt)break;t-=s}return r+n}function ii(e){e=bn(e);for(var t=0,r=e.parent,n=0;n1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Ii(e.done)):void 0}function ui(e,t,r,n){if("ignoreHistory"!=t.origin){var i=e.history;i.undone.length=0;var o,a=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>a-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=ci(i,i.lastOp==n))){var s=Ii(o.changes);0==Bo(t.from,t.to)&&0==Bo(t.from,s.to)?s.to=ea(t):o.changes.push(si(e,t))}else{var l=Ii(i.done);for(l&&l.ranges||pi(e.sel,i.done),o={changes:[si(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,s||Na(e,"historyAdded")}}function di(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function fi(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||di(e,o,Ii(i.done),t))?i.done[i.done.length-1]=t:pi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&n.clearRedo!==!1&&li(i.undone)}function pi(e,t){var r=Ii(t);r&&r.ranges&&r.equals(e)||t.push(e)}function hi(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function mi(e){if(!e)return null;for(var t,r=0;r-1&&(Ii(s)[d]=u[d],delete u[d])}}}return i}function yi(e,t,r,n){r0?n.slice():za:n||za}function Si(e,t){function r(e){return function(){e.apply(null,o)}}var n=Ci(e,t,!1);if(n.length){var i,o=Array.prototype.slice.call(arguments,2);Ko?i=Ko.delayedCallbacks:qa?i=qa:(i=qa=[],setTimeout(Mi,0));for(var a=0;a0}function Ei(e){e.prototype.on=function(e,t){Oa(this,e,t)},e.prototype.off=function(e,t){Ia(this,e,t)}}function Oi(){this.id=null}function zi(e){for(;Ha.length<=e;)Ha.push(Ii(Ha)+" ");return Ha[e]}function Ii(e){return e[e.length-1]}function Ni(e,t){for(var r=0;r-1&&Va(e)?!0:t.test(e):Va(e)}function Fi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Wi(e){return e.charCodeAt(0)>=768&&Ga.test(e)}function Hi(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o0;--t)e.removeChild(e.firstChild);return e}function Ui(e,t){return $i(e).appendChild(t)}function Ki(){for(var e=document.activeElement;e&&e.root&&e.root.activeElement;)e=e.root.activeElement;return e}function Vi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function Gi(e,t){for(var r=e.split(" "),n=0;n2&&!(ko&&8>xo))}var r=Za?Hi("span","​"):Hi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Ji(e){if(null!=Ya)return Ya;var t=Ui(e,document.createTextNode("AخA")),r=Ua(t,0,1).getBoundingClientRect();if(!r||r.left==r.right)return!1;var n=Ua(t,1,2).getBoundingClientRect();return Ya=n.right-r.right<3}function eo(e){if(null!=os)return os;var t=Ui(e,Hi("span","x")),r=t.getBoundingClientRect(),n=Ua(t,0,1).getBoundingClientRect();return os=Math.abs(r.left-n.left)>1}function to(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;ot||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function ro(e){return e.level%2?e.to:e.from}function no(e){return e.level%2?e.from:e.to}function io(e){var t=oi(e);return t?ro(t[0]):0}function oo(e){var t=oi(e);return t?no(Ii(t)):e.text.length}function ao(e,t){var r=Qn(e.doc,t),n=bn(r);n!=r&&(t=ri(n));var i=oi(n),o=i?i[0].level%2?oo(n):io(n):0;return Do(t,o)}function so(e,t){for(var r,n=Qn(e.doc,t);r=vn(n);)n=r.find(1,!0).line,t=null;var i=oi(n),o=i?i[0].level%2?io(n):oo(n):n.text.length;return Do(null==t?ri(n):t,o)}function lo(e,t){var r=ao(e,t.line),n=Qn(e.doc,r.line),i=oi(n);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),a=t.line==r.line&&t.ch<=o&&t.ch;return Do(r.line,a?0:o)}return r}function co(e,t,r){var n=e[0].level;return t==n?!0:r==n?!1:r>t}function uo(e,t){ss=null;for(var r,n=0;nt)return n;if(i.from==t||i.to==t){if(null!=r)return co(e,i.level,e[r].level)?(i.from!=i.to&&(ss=r),n):(i.from!=i.to&&(ss=n),r);r=n}}return r}function fo(e,t,r,n){if(!n)return t+r;do t+=r;while(t>0&&Wi(e.text.charAt(t)));return t}function po(e,t,r,n){var i=oi(e);if(!i)return ho(e,t,r,n);for(var o=uo(i,t),a=i[o],s=fo(e,t,a.level%2?-r:r,n);;){if(s>a.from&&s0==a.level%2?a.to:a.from);if(a=i[o+=r],!a)return null;s=r>0==a.level%2?fo(e,a.to,-1,n):fo(e,a.from,1,n)}}function ho(e,t,r,n){var i=t+r;if(n)for(;i>0&&Wi(e.text.charAt(i));)i+=r;return 0>i||i>e.text.length?null:i}var mo=navigator.userAgent,go=navigator.platform,vo=/gecko\/\d/i.test(mo),yo=/MSIE \d/.test(mo),bo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(mo),ko=yo||bo,xo=ko&&(yo?document.documentMode||6:bo[1]),wo=/WebKit\//.test(mo),_o=wo&&/Qt\/\d+\.\d+/.test(mo),Co=/Chrome\//.test(mo),So=/Opera\//.test(mo),Mo=/Apple Computer/.test(navigator.vendor),Lo=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(mo),To=/PhantomJS/.test(mo),Ao=/AppleWebKit/.test(mo)&&/Mobile\/\w+/.test(mo),Eo=Ao||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(mo),Oo=Ao||/Mac/.test(go),zo=/\bCrOS\b/.test(mo),Io=/win/i.test(go),No=So&&mo.match(/Version\/(\d*\.\d*)/);No&&(No=Number(No[1])),No&&No>=15&&(So=!1,wo=!0);var qo=Oo&&(_o||So&&(null==No||12.11>No)),Po=vo||ko&&xo>=9,Ro=!1,jo=!1;m.prototype=ji({update:function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+o+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},zeroWidthHack:function(){var e=Oo&&!Lo?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Oi,this.disableVert=new Oi},enableZeroWidthBar:function(e,t){function r(){var n=e.getBoundingClientRect(),i=document.elementFromPoint(n.left+1,n.bottom-1);i!=e?e.style.pointerEvents="none":t.set(1e3,r)}e.style.pointerEvents="auto",t.set(1e3,r)},clear:function(){var e=this.horiz.parentNode; -var t=e.getCursor(),r=t,n=t;e.options.lineWrapping||(r=t.ch?jo(t.line,t.ch-1):t,n=jo(t.line,t.ch+1)),e.curOp.scrollToPos={from:r,to:n,margin:e.options.cursorScrollMargin,isCursor:!0}}function Dr(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var r=mt(e,t.from),n=mt(e,t.to),i=Pr(e,Math.min(r.left,n.left),Math.min(r.top,n.top)-t.margin,Math.max(r.right,n.right),Math.max(r.bottom,n.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function Br(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=He(e,t):r="prev");var a=e.options.tabSize,s=Qn(o,t),l=Ba(s.text,null,a);s.stateAfter&&(s.stateAfter=null);var c,u=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&(c=o.mode.indent(i,s.text.slice(u.length),s.text),c==Pa||c>150)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?Ba(Qn(o,t-1).text,null,a):0:"add"==r?c=l+e.options.indentUnit:"subtract"==r?c=l-e.options.indentUnit:"number"==typeof r&&(c=l+r),c=Math.max(0,c);var f="",d=0;if(e.options.indentWithTabs)for(var p=Math.floor(c/a);p;--p)d+=a,f+=" ";if(c>d&&(f+=zi(c-d)),f!=u)return zr(o,f,jo(t,0),jo(t,u.length),"+input"),s.stateAfter=null,!0;for(var p=0;p=0;t--)zr(e.doc,"",n[t].from,n[t].to,"+delete");jr(e)})}function Hr(e,t,r,n,i){function o(){var t=s+r;return t=e.first+e.size?!1:(s=t,u=Qn(e,t))}function a(e){var t=(i?po:ho)(u,l,r,!0);if(null==t){if(e||!o())return!1;l=i?(0>r?oo:io)(u):0>r?u.text.length:0}else l=t;return!0}var s=t.line,l=t.ch,c=r,u=Qn(e,s);if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var f=null,d="group"==n,p=e.cm&&e.cm.getHelper(t,"wordChars"),h=!0;!(0>r)||a(!h);h=!1){var m=u.text.charAt(l)||"\n",g=Bi(m,p)?"w":d&&"\n"==m?"n":!d||/\s/.test(m)?null:"p";if(!d||h||g||(g="s"),f&&f!=g){0>r&&(r=1,a());break}if(g&&(f=g),r>0&&!a(!h))break}var v=Ie(e,jo(s,l),t,c,!0);return Do(t,v)||(v.hitSide=!0),v}function $r(e,t,r,n){var i,o=e.doc,a=t.left;if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+r*(s-(0>r?1.5:.5)*bt(e.display))}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;;){var l=vt(e,a,i);if(!l.outside)break;if(0>r?0>=i:i>=o.height){l.hitSide=!0;break}i+=5*r}return l}function Ur(t,r,n,i){e.defaults[t]=r,n&&(ta[t]=i?function(e,t,r){r!=ra&&n(e,t,r)}:n)}function Kr(e){for(var t,r,n,i,o=e.split(/-(?!$)/),e=o[o.length-1],a=0;a0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Hi("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(yn(e,t.line,t,r,o)||t.line!=r.line&&yn(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Ro=!0}o.addToHistory&&ui(e,{from:t,to:r,origin:"markText"},e.sel,0/0);var s,l=t.line,c=e.cm;if(e.iter(l,r.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&bn(e)==c.display.maxLine&&(s=!0),o.collapsed&&l!=t.line&&ti(e,0),rn(e,new Jr(o,l==t.line?t.ch:null,l==r.line?r.ch:null)),++l}),o.collapsed&&e.iter(t.line,r.line+1,function(t){_n(e,t)&&ti(t,0)}),o.clearOnEnter&&Ea(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Po=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ga,o.atomic=!0),c){if(s&&(c.curOp.updateMaxLine=!0),o.collapsed)Pt(c,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=t.line;u<=r.line;u++)Rt(c,u,"text");o.atomic&&Ee(c.doc),Si(c,"markerAdded",c,o)}return o}function Xr(e,t,r,n,i){n=ji(n),n.shared=!1;var o=[Gr(e,t,r,n,i)],a=o[0],s=n.widgetNode;return Zn(e,function(e){s&&(n.widgetNode=s.cloneNode(!0)),o.push(Gr(e,ge(e,t),ge(e,r),n,i));for(var l=0;l=t:o.to>t);(n||(n=[])).push(new Jr(a,o.from,l?null:o.to))}}return n}function on(e,t,r){if(e)for(var n,i=0;i=t:o.to>t);if(s||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from0&&s)for(var f=0;ff;++f)h.push(m);h.push(l)}return h}function sn(e){for(var t=0;t0)){var u=[l,1],f=Do(c.from,s.from),d=Do(c.to,s.to);(0>f||!a.inclusiveLeft&&!f)&&u.push({from:c.from,to:s.from}),(d>0||!a.inclusiveRight&&!d)&&u.push({from:s.to,to:c.to}),i.splice.apply(i,u),l+=u.length-1}}return i}function un(e){var t=e.markedSpans;if(t){for(var r=0;r=0&&0>=f||0>=u&&f>=0)&&(0>=u&&(Do(c.to,r)>0||l.marker.inclusiveRight&&i.inclusiveLeft)||u>=0&&(Do(c.from,n)<0||l.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function bn(e){for(var t;t=gn(e);)e=t.find(-1,!0).line;return e}function kn(e){for(var t,r;t=vn(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}function xn(e,t){var r=Qn(e,t),n=bn(r);return r==n?t:ri(n)}function wn(e,t){if(t>e.lastLine())return t;var r,n=Qn(e,t);if(!_n(e,n))return t;for(;r=vn(n);)n=r.find(1,!0).line;return ri(n)+1}function _n(e,t){var r=Ro&&t.markedSpans;if(r)for(var n,i=0;io;o++){i&&(i[0]=e.innerMode(t,n).mode);var a=t.token(r,n);if(r.pos>r.start)return a}throw new Error("Mode "+t.name+" failed to advance stream.")}function In(e,t,r,n){function i(e){return{start:f.start,end:f.pos,string:f.current(),type:o||null,state:e?la(a.mode,u):u}}var o,a=e.doc,s=a.mode;t=ge(a,t);var l,c=Qn(a,t.line),u=He(e,t.line,r),f=new ma(c.text,e.options.tabSize);for(n&&(l=[]);(n||f.pose.options.maxHighlightLength?(s=!1,a&&Rn(e,t,n,f.pos),f.pos=t.length,l=null):l=En(zn(r,f,n,d),o),d){var p=d[0].name;p&&(l="m-"+(l?p+" "+l:p))}if(!s||u!=l){for(;cc;){var n=i[l];n>e&&i.splice(l,1,e,i[l+1],n),l+=2,c=Math.min(e,n)}if(t)if(s.opaque)i.splice(r,l-r,e,"cm-overlay "+t),l=r+2;else for(;l>r;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Pn(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=He(e,ri(t)),i=qn(e,t,t.text.length>e.options.maxHighlightLength?la(e.doc.mode,n):n);t.stateAfter=n,t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.frontier&&e.doc.frontier++}return t.styles}function Rn(e,t,r,n){var i=e.doc.mode,o=new ma(t,e.options.tabSize);for(o.start=o.pos=n||0,""==t&&On(i,r);!o.eol();)zn(i,o,r),o.start=o.pos}function jn(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?wa:xa;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Dn(e,t){var r=Hi("span",null,null,wo?"padding-right: .1px":null),n={pre:Hi("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,splitSpaces:(ko||wo)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,a=i?t.rest[i-1]:t.line;n.pos=0,n.addToken=Wn,Ji(e.display.measure)&&(o=oi(a))&&(n.addToken=Hn(n.addToken,o)),n.map=[];var s=t!=e.display.externalMeasured&&ri(a);Un(a,n,Pn(e,a,s)),a.styleClasses&&(a.styleClasses.bgClass&&(n.bgClass=Gi(a.styleClasses.bgClass,n.bgClass||"")),a.styleClasses.textClass&&(n.textClass=Gi(a.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Qi(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return wo&&/\bcm-tab\b/.test(n.content.lastChild.className)&&(n.content.className="cm-tab-wrap-hack"),Ia(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=Gi(n.pre.className,n.textClass||"")),n}function Bn(e){var t=Hi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Wn(e,t,r,n,i,o,a){if(t){var s=e.splitSpaces?t.replace(/ {3,}/g,Fn):t,l=e.cm.state.specialChars,c=!1;if(l.test(t))for(var u=document.createDocumentFragment(),f=0;;){l.lastIndex=f;var d=l.exec(t),p=d?d.index-f:t.length-f;if(p){var h=document.createTextNode(s.slice(f,f+p));u.appendChild(ko&&9>xo?Hi("span",[h]):h),e.map.push(e.pos,e.pos+p,h),e.col+=p,e.pos+=p}if(!d)break;if(f+=p+1," "==d[0]){var m=e.cm.options.tabSize,g=m-e.col%m,h=u.appendChild(Hi("span",zi(g),"cm-tab"));h.setAttribute("role","presentation"),h.setAttribute("cm-text"," "),e.col+=g}else if("\r"==d[0]||"\n"==d[0]){var h=u.appendChild(Hi("span","\r"==d[0]?"␍":"␤","cm-invalidchar"));h.setAttribute("cm-text",d[0]),e.col+=1}else{var h=e.cm.options.specialCharPlaceholder(d[0]);h.setAttribute("cm-text",d[0]),u.appendChild(ko&&9>xo?Hi("span",[h]):h),e.col+=1}e.map.push(e.pos,e.pos+1,h),e.pos++}else{e.col+=t.length;var u=document.createTextNode(s);e.map.push(e.pos,e.pos+t.length,u),ko&&9>xo&&(c=!0),e.pos+=t.length}if(r||n||i||c||a){var v=r||"";n&&(v+=n),i&&(v+=i);var y=Hi("span",[u],v,a);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(u)}}function Fn(e){for(var t=" ",r=0;rc&&d.from<=c)break}if(d.to>=u)return e(r,n,i,o,a,s,l);e(r,n.slice(0,d.to-c),i,o,null,s,l),o=null,n=n.slice(d.to-c),c=d.to}}}function $n(e,t,r,n){var i=!n&&r.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t}function Un(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var a,s,l,c,u,f,d,p=i.length,h=0,m=1,g="",v=0;;){if(v==h){l=c=u=f=s="",d=null,v=1/0;for(var y,b=[],k=0;kh||w.collapsed&&x.to==h&&x.from==h)?(null!=x.to&&x.to!=h&&v>x.to&&(v=x.to,c=""),w.className&&(l+=" "+w.className),w.css&&(s=(s?s+";":"")+w.css),w.startStyle&&x.from==h&&(u+=" "+w.startStyle),w.endStyle&&x.to==v&&(y||(y=[])).push(w.endStyle,x.to),w.title&&!f&&(f=w.title),w.collapsed&&(!d||hn(d.marker,w)<0)&&(d=x)):x.from>h&&v>x.from&&(v=x.from)}if(y)for(var k=0;k=p)break;for(var _=Math.min(p,v);;){if(g){var C=h+g.length;if(!d){var S=C>_?g.slice(0,_-h):g;t.addToken(t,S,a?a+l:l,u,h+S.length==v?c:"",f,s)}if(C>=_){g=g.slice(_-h),h=_;break}h=C,u=""}g=i.slice(o,o=r[m++]),a=jn(r[m++],t.cm.options)}}else for(var m=1;mr;++r)o.push(new ka(c[r],i(r),n));return o}var s=t.from,l=t.to,c=t.text,u=Qn(e,s.line),f=Qn(e,l.line),d=Ii(c),p=i(c.length-1),h=l.line-s.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(Kn(e,t)){var m=a(0,c.length-1);o(f,f.text,p),h&&e.remove(s.line,h),m.length&&e.insert(s.line,m)}else if(u==f)if(1==c.length)o(u,u.text.slice(0,s.ch)+d+u.text.slice(l.ch),p);else{var m=a(1,c.length-1);m.push(new ka(d+u.text.slice(l.ch),p,n)),o(u,u.text.slice(0,s.ch)+c[0],i(0)),e.insert(s.line+1,m)}else if(1==c.length)o(u,u.text.slice(0,s.ch)+c[0]+f.text.slice(l.ch),i(0)),e.remove(s.line+1,h);else{o(u,u.text.slice(0,s.ch)+c[0],i(0)),o(f,d+f.text.slice(l.ch),p);var m=a(1,c.length-1);h>1&&e.remove(s.line+1,h-1),e.insert(s.line+1,m)}Si(e,"change",e,t)}function Gn(e){this.lines=e,this.parent=null;for(var t=0,r=0;tt||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize();if(o>t){r=i;break}t-=o}return r.lines[t]}function Jn(e,t,r){var n=[],i=t.line;return e.iter(t.line,r.line+1,function(e){var o=e.text;i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i}),n}function ei(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function ti(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function ri(e){if(null==e.parent)return null;for(var t=e.parent,r=Ni(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function ni(e,t){var r=e.first;e:do{for(var n=0;nt){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var n=0;nt)break;t-=s}return r+n}function ii(e){e=bn(e);for(var t=0,r=e.parent,n=0;n1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Ii(e.done)):void 0}function ui(e,t,r,n){if("ignoreHistory"!=t.origin){var i=e.history;i.undone.length=0;var o,a=+new Date;if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>a-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=ci(i,i.lastOp==n))){var s=Ii(o.changes);0==Do(t.from,t.to)&&0==Do(t.from,s.to)?s.to=Jo(t):o.changes.push(si(e,t))}else{var l=Ii(i.done);for(l&&l.ranges||pi(e.sel,i.done),o={changes:[si(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,s||Ia(e,"historyAdded")}}function fi(e,t,r,n){var i=t.charAt(0);return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function di(e,t,r,n){var i=e.history,o=n&&n.origin;r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||fi(e,o,Ii(i.done),t))?i.done[i.done.length-1]=t:pi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&n.clearRedo!==!1&&li(i.undone)}function pi(e,t){var r=Ii(t);r&&r.ranges&&r.equals(e)||t.push(e)}function hi(e,t,r,n){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o})}function mi(e){if(!e)return null;for(var t,r=0;r-1&&(Ii(s)[f]=u[f],delete u[f])}}}return i}function yi(e,t,r,n){r0?n.slice():Oa:n||Oa}function Si(e,t){function r(e){return function(){e.apply(null,o)}}var n=Ci(e,t,!1);if(n.length){var i,o=Array.prototype.slice.call(arguments,2);Uo?i=Uo.delayedCallbacks:Na?i=Na:(i=Na=[],setTimeout(Mi,0));for(var a=0;a0}function Ei(e){e.prototype.on=function(e,t){Ea(this,e,t)},e.prototype.off=function(e,t){za(this,e,t)}}function Oi(){this.id=null}function zi(e){for(;Fa.length<=e;)Fa.push(Ii(Fa)+" ");return Fa[e]}function Ii(e){return e[e.length-1]}function Ni(e,t){for(var r=0;r-1&&Ka(e)?!0:t.test(e):Ka(e)}function Wi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Fi(e){return e.charCodeAt(0)>=768&&Va.test(e)}function Hi(e,t,r,n){var i=document.createElement(e);if(r&&(i.className=r),n&&(i.style.cssText=n),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o0;--t)e.removeChild(e.firstChild);return e}function Ui(e,t){return $i(e).appendChild(t)}function Ki(){for(var e=document.activeElement;e&&e.root&&e.root.activeElement;)e=e.root.activeElement;return e}function Vi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function Gi(e,t){for(var r=e.split(" "),n=0;n2&&!(ko&&8>xo))}var r=Xa?Hi("span","​"):Hi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function Ji(e){if(null!=Za)return Za;var t=Ui(e,document.createTextNode("AخA")),r=$a(t,0,1).getBoundingClientRect();if(!r||r.left==r.right)return!1;var n=$a(t,1,2).getBoundingClientRect();return Za=n.right-r.right<3}function eo(e){if(null!=is)return is;var t=Ui(e,Hi("span","x")),r=t.getBoundingClientRect(),n=$a(t,0,1).getBoundingClientRect();return is=Math.abs(r.left-n.left)>1}function to(e,t,r,n){if(!e)return n(t,r,"ltr");for(var i=!1,o=0;ot||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr"),i=!0)}i||n(t,r,"ltr")}function ro(e){return e.level%2?e.to:e.from}function no(e){return e.level%2?e.from:e.to}function io(e){var t=oi(e);return t?ro(t[0]):0}function oo(e){var t=oi(e);return t?no(Ii(t)):e.text.length}function ao(e,t){var r=Qn(e.doc,t),n=bn(r);n!=r&&(t=ri(n));var i=oi(n),o=i?i[0].level%2?oo(n):io(n):0;return jo(t,o)}function so(e,t){for(var r,n=Qn(e.doc,t);r=vn(n);)n=r.find(1,!0).line,t=null;var i=oi(n),o=i?i[0].level%2?io(n):oo(n):n.text.length;return jo(null==t?ri(n):t,o)}function lo(e,t){var r=ao(e,t.line),n=Qn(e.doc,r.line),i=oi(n);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),a=t.line==r.line&&t.ch<=o&&t.ch;return jo(r.line,a?0:o)}return r}function co(e,t,r){var n=e[0].level;return t==n?!0:r==n?!1:r>t}function uo(e,t){as=null;for(var r,n=0;nt)return n;if(i.from==t||i.to==t){if(null!=r)return co(e,i.level,e[r].level)?(i.from!=i.to&&(as=r),n):(i.from!=i.to&&(as=n),r);r=n}}return r}function fo(e,t,r,n){if(!n)return t+r;do t+=r;while(t>0&&Fi(e.text.charAt(t)));return t}function po(e,t,r,n){var i=oi(e);if(!i)return ho(e,t,r,n);for(var o=uo(i,t),a=i[o],s=fo(e,t,a.level%2?-r:r,n);;){if(s>a.from&&s0==a.level%2?a.to:a.from);if(a=i[o+=r],!a)return null;s=r>0==a.level%2?fo(e,a.to,-1,n):fo(e,a.from,1,n)}}function ho(e,t,r,n){var i=t+r;if(n)for(;i>0&&Fi(e.text.charAt(i));)i+=r;return 0>i||i>e.text.length?null:i}var mo=navigator.userAgent,go=navigator.platform,vo=/gecko\/\d/i.test(mo),yo=/MSIE \d/.test(mo),bo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(mo),ko=yo||bo,xo=ko&&(yo?document.documentMode||6:bo[1]),wo=/WebKit\//.test(mo),_o=wo&&/Qt\/\d+\.\d+/.test(mo),Co=/Chrome\//.test(mo),So=/Opera\//.test(mo),Mo=/Apple Computer/.test(navigator.vendor),Lo=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(mo),To=/PhantomJS/.test(mo),Ao=/AppleWebKit/.test(mo)&&/Mobile\/\w+/.test(mo),Eo=Ao||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(mo),Oo=Ao||/Mac/.test(go),zo=/win/i.test(go),Io=So&&mo.match(/Version\/(\d*\.\d*)/);Io&&(Io=Number(Io[1])),Io&&Io>=15&&(So=!1,wo=!0);var No=Oo&&(_o||So&&(null==Io||12.11>Io)),qo=vo||ko&&xo>=9,Po=!1,Ro=!1;m.prototype=ji({update:function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth;if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0";var i=e.viewHeight-(t?n:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(r?n:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+o+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},zeroWidthHack:function(){var e=Oo&&!Lo?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Oi,this.disableVert=new Oi},enableZeroWidthBar:function(e,t){function r(){var n=e.getBoundingClientRect(),i=document.elementFromPoint(n.left+1,n.bottom-1);i!=e?e.style.pointerEvents="none":t.set(1e3,r)}e.style.pointerEvents="auto",t.set(1e3,r)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},m.prototype),g.prototype=ji({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},g.prototype),e.scrollbarModel={ -"native":m,"null":g},S.prototype.signal=function(e,t){Ai(e,t)&&this.events.push(arguments)},S.prototype.finish=function(){for(var e=0;e=9&&r.hasSelection&&(r.hasSelection=null),r.poll()}),Ea(o,"paste",function(e){Li(n,e)||J(e,n)||(n.state.pasteIncoming=!0,r.fastPoll())}),Ea(o,"cut",t),Ea(o,"copy",t),Ea(e.scroller,"paste",function(t){Kt(e,t)||Li(n,t)||(n.state.pasteIncoming=!0,r.focus())}),Ea(e.lineSpace,"selectstart",function(t){Kt(e,t)||La(t)}),Ea(o,"compositionstart",function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Ea(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,r=e.doc,n=Pe(e);if(e.options.moveInputWithCursor){var i=ht(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return n},showSelection:function(e){var t=this.cm,r=t.display;Ui(r.cursorDiv,e.cursors),Ui(r.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t,r,n=this.cm,i=n.doc;if(n.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=ns&&(o.to().line-o.from().line>100||(r=n.getSelection()).length>1e3);var a=t?"-":r||n.getSelection();this.composing||(this.textarea.value=a),n.state.focused&&Ha(this.textarea),ko&&xo>=9&&(this.hasSelection=a)}else e||(this.composing||(this.prevInput=this.textarea.value=""),ko&&xo>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!Eo||Ki()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var n=r.poll();n||t?(r.pollingFast=!1,r.slowPoll()):(t=!0,r.polling.set(60,e))}var t=!1,r=this;r.pollingFast=!0,r.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,r=this.prevInput;if(this.contextMenuPending||!e.state.focused||rs(t)&&!r&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var n=t.value;if(n==r&&!e.somethingSelected())return!1;if(ko&&xo>=9&&this.hasSelection===n||Oo&&/[\uf700-\uf7ff]/.test(n))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var i=n.charCodeAt(0);if(8203!=i||r||(r="​"),8666==i)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(r.length,n.length);a>o&&r.charCodeAt(o)==n.charCodeAt(o);)++o;var s=this;return Et(e,function(){Q(e,n.slice(o),r.length-o,null,s.composing?"*compose":null),n.length>1e3||n.indexOf("\n")>-1?t.value=s.prevInput="":s.prevInput=n,s.composing&&(s.composing.range.clear(),s.composing.range=e.markText(s.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){ko&&xo>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=a.selectionStart){var e=i.somethingSelected(),t="​"+(e?a.value:"");a.value="⇚",a.value=t,n.prevInput=e?"":"​",a.selectionStart=1,a.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function r(){if(n.contextMenuPending=!1,n.wrapper.style.position="relative",a.style.cssText=u,ko&&9>xo&&o.scrollbars.setScrollTop(o.scroller.scrollTop=l),null!=a.selectionStart){(!ko||ko&&9>xo)&&t();var e=0,r=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&"​"==n.prevInput?Ot(i,ua.selectAll)(i):e++<10?o.detectingSelectAll=setTimeout(r,500):o.input.reset()};o.detectingSelectAll=setTimeout(r,200)}}var n=this,i=n.cm,o=i.display,a=n.textarea,s=Vt(i,e),l=o.scroller.scrollTop;if(s&&!So){var c=i.options.resetSelectionOnContextMenu;c&&-1==i.doc.sel.contains(s)&&Ot(i,Le)(i.doc,he(s),Ra);var u=a.style.cssText;if(n.wrapper.style.position="absolute",a.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(ko?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",wo)var f=window.scrollY;if(o.input.focus(),wo&&window.scrollTo(null,f),o.input.reset(),i.somethingSelected()||(a.value=n.prevInput=" "),n.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),ko&&xo>=9&&t(),qo){Aa(e);var d=function(){za(window,"mouseup",d),setTimeout(r,20)};Ea(window,"mouseup",d)}else setTimeout(r,50)}},readOnlyChanged:function(e){e||this.reset()},setUneditable:Pi,needsContentAttribute:!1},ne.prototype),oe.prototype=ji({init:function(e){function t(e){if(!Li(n,e)){if(n.somethingSelected())Bo=n.getSelections(),"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=te(n);Bo=t.text,"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,Ra),n.replaceSelection("",null,"cut")})}if(e.clipboardData&&!Ao)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Bo.join("\n"));else{var r=ie(),i=r.firstChild;n.display.lineSpace.insertBefore(r,n.display.lineSpace.firstChild),i.value=Bo.join("\n");var o=document.activeElement;Ha(i),setTimeout(function(){n.display.lineSpace.removeChild(r),o.focus()},50)}}}var r=this,n=r.cm,i=r.div=e.lineDiv;re(i),Ea(i,"paste",function(e){Li(n,e)||J(e,n)}),Ea(i,"compositionstart",function(e){var t=e.data;if(r.composing={sel:n.doc.sel,data:t,startData:t},t){var i=n.doc.sel.primary(),o=n.getLine(i.head.line),a=o.indexOf(t,Math.max(0,i.head.ch-t.length));a>-1&&a<=i.head.ch&&(r.composing.sel=he(jo(i.head.line,a),jo(i.head.line,a+t.length)))}}),Ea(i,"compositionupdate",function(e){r.composing.data=e.data}),Ea(i,"compositionend",function(e){var t=r.composing;t&&(e.data==t.startData||/\u200b/.test(e.data)||(t.data=e.data),setTimeout(function(){t.handled||r.applyComposition(t),r.composing==t&&(r.composing=null)},50))}),Ea(i,"touchstart",function(){r.forceCompositionEnd()}),Ea(i,"input",function(){r.composing||(n.isReadOnly()||!r.pollContent())&&Et(r.cm,function(){Pt(n)})}),Ea(i,"copy",t),Ea(i,"cut",t)},prepareSelection:function(){var e=Pe(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e){e&&this.cm.display.view.length&&(e.focus&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),r=le(this.cm,e.anchorNode,e.anchorOffset),n=le(this.cm,e.focusNode,e.focusOffset);if(!r||r.bad||!n||n.bad||0!=Do(Z(r,n),t.from())||0!=Do(X(r,n),t.to())){var i=ae(this.cm,t.from()),o=ae(this.cm,t.to());if(i||o){var a=this.cm.display.view,s=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var l=a[a.length-1].measure,c=l.maps?l.maps[l.maps.length-1]:l.map;o={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]}}}else i={node:a[0].measure.map[2],offset:0};try{var u=$a(i.node,i.offset,o.offset,o.node)}catch(f){}u&&(!vo&&this.cm.state.focused?(e.collapse(i.node,i.offset),u.collapsed||e.addRange(u)):(e.removeAllRanges(),e.addRange(u)),s&&null==e.anchorNode?e.addRange(s):vo&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){Ui(this.cm.display.cursorDiv,e.cursors),Ui(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return Ga(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():Et(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var r=le(t,e.anchorNode,e.anchorOffset),n=le(t,e.focusNode,e.focusOffset);r&&n&&Et(t,function(){Le(t.doc,he(r,n),Ra),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}},pollContent:function(){var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),i=r.to();if(n.linet.viewTo-1)return!1;var o;if(n.line==t.viewFrom||0==(o=Dt(e,n.line)))var a=ri(t.view[0].line),s=t.view[0].node;else var a=ri(t.view[o].line),s=t.view[o-1].node.nextSibling;var l=Dt(e,i.line);if(l==t.view.length-1)var c=t.viewTo-1,u=t.lineDiv.lastChild;else var c=ri(t.view[l+1].line)-1,u=t.view[l+1].node.previousSibling;for(var f=e.doc.splitLines(ue(e,s,u,a,c)),d=Jn(e.doc,jo(a,0),jo(c,Qn(e.doc,c).text.length));f.length>1&&d.length>1;)if(Ii(f)==Ii(d))f.pop(),d.pop(),c--;else{if(f[0]!=d[0])break;f.shift(),d.shift(),a++}for(var p=0,h=0,m=f[0],g=d[0],v=Math.min(m.length,g.length);v>p&&m.charCodeAt(p)==g.charCodeAt(p);)++p;for(var y=Ii(f),b=Ii(d),k=Math.min(y.length-(1==f.length?p:0),b.length-(1==d.length?p:0));k>h&&y.charCodeAt(y.length-h-1)==b.charCodeAt(b.length-h-1);)++h;f[f.length-1]=y.slice(0,y.length-h),f[0]=f[0].slice(p);var x=jo(a,p),w=jo(c,d.length?Ii(d).length-h:0);return f.length>1||f[0]||Do(x,w)?(zr(e.doc,f,x,w,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){this.cm.isReadOnly()?Ot(this.cm,Pt)(this.cm):e.data&&e.data!=e.startData&&Ot(this.cm,Q)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.contentEditable="false"},onKeyPress:function(e){e.preventDefault(),this.cm.isReadOnly()||Ot(this.cm,Q)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},readOnlyChanged:function(e){this.div.contentEditable=String("nocursor"!=e)},onContextMenu:Pi,resetPosition:Pi,needsContentAttribute:!0},oe.prototype),e.inputStyles={textarea:ne,contenteditable:oe},fe.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t=0&&Do(e,n.to())<=0)return r}return-1}},de.prototype={from:function(){return Z(this.anchor,this.head)},to:function(){return X(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Wo,Fo,Ho,$o={left:0,right:0,top:0,bottom:0},Uo=null,Ko=0,Vo=0,Go=0,Xo=null;ko?Xo=-.53:vo?Xo=15:Co?Xo=-.7:Mo&&(Xo=-1/3);var Zo=function(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}};e.wheelEventPixels=function(e){var t=Zo(e);return t.x*=Xo,t.y*=Xo,t};var Yo=new Oi,Qo=null,Jo=e.changeEnd=function(e){return e.text?jo(e.from.line+e.text.length-1,Ii(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var r=this.options,n=r[e];(r[e]!=t||"mode"==e)&&(r[e]=t,ta.hasOwnProperty(e)&&Ot(this,ta[e])(this,t,n))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Vr(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;rr&&(Br(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&jr(this));else{var o=i.from(),a=i.to(),s=Math.max(r,o.line);r=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;r>l;++l)Br(this,l,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[n].from().ch>0&&_e(this.doc,n,new de(o,c[n].to()),Ra)}}}),getTokenAt:function(e,t){return In(this,e,t)},getLineTokens:function(e,t){return In(this,jo(e),t,!0)},getTokenTypeAt:function(e){e=ge(this.doc,e);var t,r=Pn(this,Qn(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var a=n+i>>1;if((a?r[2*a-1]:0)>=o)i=a;else{if(!(r[2*a+1]s?t:0==s?null:t.slice(0,s-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!sa.hasOwnProperty(t))return r;var n=sa[t],i=this.getModeAt(e);if("string"==typeof i[t])n[i[t]]&&r.push(n[i[t]]);else if(i[t])for(var o=0;oi&&(e=i,n=!0),r=Qn(this.doc,e)}else r=e;return ft(this,r,{top:0,left:0},t||"page").top+(n?this.doc.height-ii(r):0)},defaultTextHeight:function(){return bt(this.display)},defaultCharWidth:function(){return kt(this.display)},setGutterMarker:zt(function(e,t,r){return Wr(this.doc,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&Wi(n)&&(e.gutterMarkers=null),!0})}),clearGutter:zt(function(e){var t=this,r=t.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,Rt(t,n,"gutter"),Wi(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),lineInfo:function(e){if("number"==typeof e){if(!ye(this.doc,e))return null;var t=e;if(e=Qn(this.doc,e),!e)return null}else{var t=ri(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display;e=ht(this,ge(this.doc,e));var a=e.bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)a=e.top;else if("above"==n||"near"==n){var l=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>l)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=l&&(a=e.bottom),s+t.offsetWidth>c&&(s=c-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),r&&qr(this,s,a,s+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:zt(dr),triggerOnKeyPress:zt(mr),triggerOnKeyUp:hr,execCommand:function(e){return ua.hasOwnProperty(e)?ua[e].call(null,this):void 0},triggerElectric:zt(function(e){ee(this,e)}),findPosH:function(e,t,r,n){var i=1;0>t&&(i=-1,t=-t);for(var o=0,a=ge(this.doc,e);t>o&&(a=Hr(this.doc,a,i,r,n),!a.hitSide);++o);return a},moveH:zt(function(e,t){var r=this;r.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?Hr(r.doc,n.head,e,t,r.options.rtlMoveVisually):0>e?n.from():n.to()},Da)}),deleteH:zt(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Fr(this,function(r){var i=Hr(n,r.head,e,t,!1);return 0>e?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=1,o=n;0>t&&(i=-1,t=-t);for(var a=0,s=ge(this.doc,e);t>a;++a){var l=ht(this,s,"div");if(null==o?o=l.left:l.left=o,s=$r(this,l,i,r),s.hitSide)break}return s},moveV:zt(function(e,t){var r=this,n=this.doc,i=[],o=!r.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(a){if(o)return 0>e?a.from():a.to();var s=ht(r,a.head,"div");null!=a.goalColumn&&(s.left=a.goalColumn),i.push(s.left);var l=$r(r,s,e,t);return"page"==t&&a==n.sel.primary()&&Rr(r,null,pt(r,l,"div").top-s.top),l},Da),i.length)for(var a=0;a0&&s(r.charAt(n-1));)--n;for(;i.5)&&a(this),Ia(this,"refresh",this)}),swapDoc:zt(function(e){var t=this.doc;return t.cm=null,Yn(this,e),lt(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,Si(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ei(e);var ea=e.defaults={},ta=e.optionHandlers={},ra=e.Init={toString:function(){return"CodeMirror.Init"}};Ur("value","",function(e,t){e.setValue(t)},!0),Ur("mode",null,function(e,t){e.doc.modeOption=t,r(e)},!0),Ur("indentUnit",2,r,!0),Ur("indentWithTabs",!1),Ur("smartIndent",!0),Ur("tabSize",4,function(e){n(e),lt(e),Pt(e)},!0),Ur("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,r.push(jo(n,o))}n++});for(var i=r.length-1;i>=0;i--)zr(e.doc,t,r[i],jo(r[i].line,r[i].ch+t.length))}}),Ur("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,r,n){t.state.specialChars=new RegExp(r.source+(r.test(" ")?"":"| "),"g"),n!=e.Init&&t.refresh()}),Ur("specialCharPlaceholder",Bn,function(e){e.refresh()},!0),Ur("electricChars",!0),Ur("inputStyle",Eo?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Ur("rtlMoveVisually",!zo),Ur("wholeLineUpdateBefore",!0),Ur("theme","default",function(e){s(e),l(e)},!0),Ur("keyMap","default",function(t,r,n){var i=Vr(r),o=n!=e.Init&&Vr(n);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),Ur("extraKeys",null),Ur("lineWrapping",!1,i,!0),Ur("gutters",[],function(e){p(e.options),l(e)},!0),Ur("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?C(e.display)+"px":"0",e.refresh()},!0),Ur("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),Ur("scrollbarStyle","native",function(e){v(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Ur("lineNumbers",!1,function(e){p(e.options),l(e)},!0),Ur("firstLineNumber",1,l,!0),Ur("lineNumberFormatter",function(e){return e},l,!0),Ur("showCursorWhenSelecting",!1,qe,!0),Ur("resetSelectionOnContextMenu",!0),Ur("lineWiseCopyCut",!0),Ur("readOnly",!1,function(e,t){"nocursor"==t?(yr(e),e.display.input.blur(),e.display.disabled=!0):e.display.disabled=!1,e.display.input.readOnlyChanged(t)}),Ur("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Ur("dragDrop",!0,$t),Ur("allowDropFileTypes",null),Ur("cursorBlinkRate",530),Ur("cursorScrollMargin",0),Ur("cursorHeight",1,qe,!0),Ur("singleCursorHeightPerLine",!0,qe,!0),Ur("workTime",100),Ur("workDelay",100),Ur("flattenSpans",!0,n,!0),Ur("addModeClass",!1,n,!0),Ur("pollInterval",100),Ur("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),Ur("historyEventDelay",1250),Ur("viewportMargin",10,function(e){e.refresh()},!0),Ur("maxHighlightLength",1e4,n,!0),Ur("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Ur("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),Ur("autofocus",null);var na=e.modes={},ia=e.mimeModes={};e.defineMode=function(t,r){e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2&&(r.dependencies=Array.prototype.slice.call(arguments,2)),na[t]=r},e.defineMIME=function(e,t){ia[e]=t},e.resolveMode=function(t){if("string"==typeof t&&ia.hasOwnProperty(t))t=ia[t];else if(t&&"string"==typeof t.name&&ia.hasOwnProperty(t.name)){var r=ia[t.name];"string"==typeof r&&(r={name:r}),t=Ri(r,t),t.name=r.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,r){var r=e.resolveMode(r),n=na[r.name];if(!n)return e.getMode(t,"text/plain");var i=n(t,r);if(oa.hasOwnProperty(r.name)){var o=oa[r.name];for(var a in o)o.hasOwnProperty(a)&&(i.hasOwnProperty(a)&&(i["_"+a]=i[a]),i[a]=o[a])}if(i.name=r.name,r.helperType&&(i.helperType=r.helperType),r.modeProps)for(var a in r.modeProps)i[a]=r.modeProps[a];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var oa=e.modeExtensions={};e.extendMode=function(e,t){var r=oa.hasOwnProperty(e)?oa[e]:oa[e]={};ji(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){Ca.prototype[e]=t},e.defineOption=Ur;var aa=[];e.defineInitHook=function(e){aa.push(e)};var sa=e.helpers={};e.registerHelper=function(t,r,n){sa.hasOwnProperty(t)||(sa[t]=e[t]={_global:[]}),sa[t][r]=n},e.registerGlobalHelper=function(t,r,n,i){e.registerHelper(t,r,i),sa[t]._global.push({pred:n,val:i})};var la=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r},ca=e.startState=function(e,t,r){return e.startState?e.startState(t,r):!0};e.innerMode=function(e,t){for(;e.innerMode;){var r=e.innerMode(t);if(!r||r.mode==e)break;t=r.state,e=r.mode}return r||{mode:e,state:t}};var ua=e.commands={selectAll:function(e){e.setSelection(jo(e.firstLine(),0),jo(e.lastLine()),Ra)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ra)},killLine:function(e){Fr(e,function(t){if(t.empty()){var r=Qn(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)i=new jo(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),jo(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Qn(e.doc,i.line-1).text;a&&e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),jo(i.line-1,a.length-1),jo(i.line,1),"+transpose")}r.push(new de(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){Et(e,function(){for(var t=e.listSelections().length,r=0;t>r;r++){var n=e.listSelections()[r];e.replaceRange(e.doc.lineSeparator(),n.anchor,n.head,"+input"),e.indentLine(n.from().line+1,null,!0)}jr(e)})},toggleOverwrite:function(e){e.toggleOverwrite()}},fa=e.keyMap={};fa.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto", -Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},fa.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},fa.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},fa.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},fa["default"]=Oo?fa.macDefault:fa.pcDefault,e.normalizeKeyMap=function(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=qi(r.split(" "),Kr),o=0;o=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.post},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var ga=0,va=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ga};Ei(va),va.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&xt(e),Ai(this,"clear")){var r=this.find();r&&Si(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=l,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&Pt(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ee(e.doc)),e&&Si(e,"markerCleared",e,this),t&&_t(e),this.parent&&this.parent.clear()}},va.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var r,n,i=0;ir;++r){var i=this.lines[r];this.height-=i.height,An(i),Si(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;ne;++e)if(r(this.lines[e]))return!0}},Xn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;re){var o=Math.min(t,i-e),a=n.height;if(n.removeInner(e,o),this.height-=a-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Gn))){var s=[];this.collapse(s),this.children=[new Gn(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t=e){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(;i.lines.length>50;){var a=i.lines.splice(i.lines.length-25,25),s=new Gn(a);i.height-=s.height,this.children.splice(n+1,0,s),s.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Xn(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=Ni(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new Xn(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;ne){var a=Math.min(t,o-e);if(i.iterN(e,a,r))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var _a=0,Ca=e.Doc=function(e,t,r,n){if(!(this instanceof Ca))return new Ca(e,t,r,n);null==r&&(r=0),Xn.call(this,[new Gn([new ka("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=r;var i=jo(r,0);this.sel=he(i),this.history=new ai(null),this.id=++_a,this.modeOption=t,this.lineSep=n,this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Vn(this,{from:i,to:i,text:e}),Le(this,he(i),Ra)};Ca.prototype=Ri(Xn.prototype,{constructor:Ca,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n=0;o--)Mr(this,n[o]);s?Me(this,s):this.cm&&jr(this.cm)}),undo:It(function(){Tr(this,"undo")}),redo:It(function(){Tr(this,"redo")}),undoSelection:It(function(){Tr(this,"undo",!0)}),redoSelection:It(function(){Tr(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=ge(this,e),t=ge(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var s=0;sl.to||null==l.from&&i!=e.line||i==t.line&&l.from>t.ch||r&&!r(l.marker)||n.push(l.marker.parent||l.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;ne?(t=e,!0):(e-=i,void++r)}),ge(this,jo(r,t))},indexFromPos:function(e){e=ge(this,e);var t=e.ch;return e.linet&&(t=e.from),null!=e.to&&e.tos||s>=t)return a+(t-o);a+=s-o,a+=r-a%r,o=s+1}},Wa=e.findColumn=function(e,t,r){for(var n=0,i=0;;){var o=e.indexOf(" ",n);-1==o&&(o=e.length);var a=o-n;if(o==e.length||i+a>=t)return n+Math.min(a,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}},Fa=[""],Ha=function(e){e.select()};Ao?Ha=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:ko&&(Ha=function(e){try{e.select()}catch(t){}});var $a,Ua=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ka=e.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Ua.test(e))},Va=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;$a=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(i){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var Ga=e.contains=function(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do if(11==t.nodeType&&(t=t.host),t==e)return!0;while(t=t.parentNode)};ko&&11>xo&&(Ki=function(){try{return document.activeElement}catch(e){return document.body}});var Xa,Za,Ya=e.rmClass=function(e,t){var r=e.className,n=Vi(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}},Qa=e.addClass=function(e,t){var r=e.className;Vi(t).test(r)||(e.className+=(r?" ":"")+t)},Ja=!1,es=function(){if(ko&&9>xo)return!1;var e=Hi("div");return"draggable"in e||"dragDrop"in e}(),ts=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;n>=t;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},rs=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(r){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},ns=function(){var e=Hi("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),is=null,os=e.keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};!function(){for(var e=0;10>e;e++)os[e+48]=os[e+96]=String(e);for(var e=65;90>=e;e++)os[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)os[e+111]=os[e+63235]="F"+e}();var as,ss=function(){function e(e){return 247>=e?r.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?n.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,r){this.level=e,this.from=t,this.to=r}var r="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,s=/[Lb1n]/,l=/[1n]/,c="L";return function(r){if(!i.test(r))return!1;for(var n,u=r.length,f=[],d=0;u>d;++d)f.push(n=e(r.charCodeAt(d)));for(var d=0,p=c;u>d;++d){var n=f[d];"m"==n?f[d]=p:p=n}for(var d=0,h=c;u>d;++d){var n=f[d];"1"==n&&"r"==h?f[d]="n":a.test(n)&&(h=n,"r"==n&&(f[d]="R"))}for(var d=1,p=f[0];u-1>d;++d){var n=f[d];"+"==n&&"1"==p&&"1"==f[d+1]?f[d]="1":","!=n||p!=f[d+1]||"1"!=p&&"n"!=p||(f[d]=p),p=n}for(var d=0;u>d;++d){var n=f[d];if(","==n)f[d]="N";else if("%"==n){for(var m=d+1;u>m&&"%"==f[m];++m);for(var g=d&&"!"==f[d-1]||u>m&&"1"==f[m]?"1":"N",v=d;m>v;++v)f[v]=g;d=m-1}}for(var d=0,h=c;u>d;++d){var n=f[d];"L"==h&&"1"==n?f[d]="L":a.test(n)&&(h=n)}for(var d=0;u>d;++d)if(o.test(f[d])){for(var m=d+1;u>m&&o.test(f[m]);++m);for(var y="L"==(d?f[d-1]:c),b="L"==(u>m?f[m]:c),g=y||b?"L":"R",v=d;m>v;++v)f[v]=g;d=m-1}for(var k,x=[],d=0;u>d;)if(s.test(f[d])){var w=d;for(++d;u>d&&s.test(f[d]);++d);x.push(new t(0,w,d))}else{var _=d,C=x.length;for(++d;u>d&&"L"!=f[d];++d);for(var v=_;d>v;)if(l.test(f[v])){v>_&&x.splice(C,0,new t(1,_,v));var S=v;for(++v;d>v&&l.test(f[v]);++v);x.splice(C,0,new t(2,S,v)),_=v}else++v;d>_&&x.splice(C,0,new t(1,_,d))}return 1==x[0].level&&(k=r.match(/^\s+/))&&(x[0].from=k[0].length,x.unshift(new t(0,0,k[0].length))),1==Ii(x).level&&(k=r.match(/\s+$/))&&(Ii(x).to-=k[0].length,x.push(new t(0,u-k[0].length,u))),2==x[0].level&&x.unshift(new t(1,x[0].to,x[0].to)),x[0].level!=Ii(x).level&&x.push(new t(x[0].level,u,u)),x}}();return e.version="5.10.1",e}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.overlayMode=function(t,r,n){return{startState:function(){return{base:e.startState(t),overlay:e.startState(r),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(n){return{base:e.copyState(t,n.base),overlay:e.copyState(r,n.overlay),basePos:n.basePos,baseCur:null,overlayPos:n.overlayPos,overlayCur:null}},token:function(e,i){return(e!=i.streamSeen||Math.min(i.basePos,i.overlayPos)2){n.pending=[];for(var d=2;d-1)return e.Pass;var a=n.indent.length-1,s=t[n.state];e:for(;;){for(var c=0;ca?0:n.indent[a]}}e.defineSimpleMode=function(t,r){e.defineMode(t,function(t){return e.simpleMode(t,r)})},e.simpleMode=function(r,n){t(n,"start");var a={},s=n.meta||{},l=!1;for(var u in n)if(u!=s&&n.hasOwnProperty(u))for(var f=a[u]=[],d=n[u],p=0;p-1?i+t.length:i}var o=t.exec(r?e.slice(r):e);return o?o.index+r+(n?o[0].length:0):-1}var n=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:e.startState(t),innerActive:null,inner:null}},copyState:function(r){return{outer:e.copyState(t,r.outer),innerActive:r.innerActive,inner:r.innerActive&&e.copyState(r.innerActive.mode,r.inner)}},token:function(i,o){if(o.innerActive){var a=o.innerActive,s=i.string;if(!a.close&&i.sol())return o.innerActive=o.inner=null,this.token(i,o);var l=a.close?r(s,a.close,i.pos,a.parseDelimiters):-1;if(l==i.pos&&!a.parseDelimiters)return i.match(a.close),o.innerActive=o.inner=null,a.delimStyle&&a.delimStyle+" "+a.delimStyle+"-close";l>-1&&(i.string=s.slice(0,l));var c=a.mode.token(i,o.inner);return l>-1&&(i.string=s),l==i.pos&&a.parseDelimiters&&(o.innerActive=o.inner=null),a.innerStyle&&(c=c?c+" "+a.innerStyle:a.innerStyle),c}for(var u=1/0,s=i.string,f=0;fl&&(u=l)}u!=1/0&&(i.string=s.slice(0,u));var p=t.token(i,o.outer);return u!=1/0&&(i.string=s),p},indent:function(r,n){var i=r.innerActive?r.innerActive.mode:t;return i.indent?i.indent(r.innerActive?r.inner:r.outer,n):e.Pass},blankLine:function(r){var i=r.innerActive?r.innerActive.mode:t;if(i.blankLine&&i.blankLine(r.innerActive?r.inner:r.outer),r.innerActive)"\n"===r.innerActive.close&&(r.innerActive=r.inner=null);else for(var o=0;o-1)return u=r(l,c,u),{from:n(o.line,u),to:n(o.line,u+a.length)}}else{var l=e.getLine(o.line).slice(o.ch),c=s(l),u=c.indexOf(t);if(u>-1)return u=r(l,c,u)+o.ch,{from:n(o.line,u),to:n(o.line,u+a.length)}}}:function(){};else{var c=a.split("\n");this.matches=function(t,r){var i=l.length-1;if(t){if(r.line-(l.length-1)=1;--u,--a)if(l[u]!=s(e.getLine(a)))return;var f=e.getLine(a),d=f.length-c[0].length;if(s(f.slice(d))!=l[0])return;return{from:n(a,d),to:o}}if(!(r.line+(l.length-1)>e.lastLine())){var f=e.getLine(r.line),d=f.length-c[0].length;if(s(f.slice(d))==l[0]){for(var p=n(r.line,d),a=r.line+1,u=1;i>u;++u,++a)if(l[u]!=s(e.getLine(a)))return;if(s(e.getLine(a).slice(0,c[i].length))==l[i])return{from:p,to:n(a,c[i].length)}}}}}}}function r(e,t,r){if(e.length==t.length)return r;for(var n=Math.min(r,e.length);;){var i=e.slice(0,n).toLowerCase().length;if(r>i)++n;else{if(!(i>r))return n;--n}}}var n=e.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){function t(e){var t=n(e,0);return r.pos={from:t,to:t},r.atOccurrence=!1,!1}for(var r=this,i=this.doc.clipPos(e?this.pos.from:this.pos.to);;){if(this.pos=this.matches(e,i))return this.atOccurrence=!0,this.pos.match||!0;if(e){if(!i.line)return t(0);i=n(i.line-1,this.doc.getLine(i.line-1).length)}else{var o=this.doc.lineCount();if(i.line==o-1)return t(o);i=n(i.line+1,0)}}},from:function(){return this.atOccurrence?this.pos.from:void 0},to:function(){return this.atOccurrence?this.pos.to:void 0},replace:function(t,r){if(this.atOccurrence){var i=e.splitLines(t);this.doc.replaceRange(i,this.pos.from,this.pos.to,r),this.pos.to=n(this.pos.from.line+i.length-1,i[i.length-1].length+(1==i.length?this.pos.from.ch:0))}}},e.defineExtension("getSearchCursor",function(e,r,n){return new t(this.doc,e,r,n)}),e.defineDocExtension("getSearchCursor",function(e,r,n){return new t(this,e,r,n)}),e.defineExtension("selectMatches",function(t,r){for(var n=[],i=this.getSearchCursor(t,this.getCursor("from"),r);i.findNext()&&!(e.cmpPos(i.to(),this.getCursor("to"))>0);)n.push({anchor:i.from(),head:i.to()});n.length&&this.setSelections(n,0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return"string"==typeof e?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t?"gi":"g"):e.global||(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(t){e.lastIndex=t.pos;var r=e.exec(t.string);return r&&r.index==t.pos?(t.pos+=r[0].length||1,"searching"):void(r?t.pos=r.index:t.skipToEnd())}}}function r(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function n(e){return e.state.search||(e.state.search=new r)}function i(e){return"string"==typeof e&&e==e.toLowerCase()}function o(e,t,r){return e.getSearchCursor(t,r,i(t))}function a(e,t,r,n){e.openDialog(t,n,{value:r,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){h(e)}})}function s(e,t,r,n,i){e.openDialog?e.openDialog(t,i,{value:n,selectValueOnOpen:!0}):i(prompt(r,n))}function l(e,t,r,n){e.openConfirm?e.openConfirm(t,n):confirm(r)&&n[0]()}function c(e){return e.replace(/\\(.)/g,function(e,t){return"n"==t?"\n":"r"==t?"\r":t})}function u(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t)try{e=new RegExp(t[1],-1==t[2].indexOf("i")?"":"i")}catch(r){}else e=c(e);return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function f(e,r,n){r.queryText=n,r.query=u(n),e.removeOverlay(r.overlay,i(r.query)),r.overlay=t(r.query,i(r.query)),e.addOverlay(r.overlay),e.showMatchesOnScrollbar&&(r.annotate&&(r.annotate.clear(),r.annotate=null),r.annotate=e.showMatchesOnScrollbar(r.query,i(r.query)))}function d(t,r,i){var o=n(t);if(o.query)return p(t,r);var l=t.getSelection()||o.lastQuery;if(i&&t.openDialog){var c=null;a(t,v,l,function(r,n){e.e_stop(n),r&&(r!=o.queryText&&f(t,o,r),c&&(c.style.opacity=1),p(t,n.shiftKey,function(e,r){var n;r.line<3&&document.querySelector&&(n=t.display.wrapper.querySelector(".CodeMirror-dialog"))&&n.getBoundingClientRect().bottom-4>t.cursorCoords(r,"window").top&&((c=n).style.opacity=.4)}))})}else s(t,v,"Search for:",l,function(e){e&&!o.query&&t.operation(function(){f(t,o,e),o.posFrom=o.posTo=t.getCursor(),p(t,r)})})}function p(t,r,i){t.operation(function(){var a=n(t),s=o(t,a.query,r?a.posFrom:a.posTo);(s.find(r)||(s=o(t,a.query,r?e.Pos(t.lastLine()):e.Pos(t.firstLine(),0)),s.find(r)))&&(t.setSelection(s.from(),s.to()),t.scrollIntoView({from:s.from(),to:s.to()},20),a.posFrom=s.from(),a.posTo=s.to(),i&&i(s.from(),s.to()))})}function h(e){e.operation(function(){var t=n(e);t.lastQuery=t.query,t.query&&(t.query=t.queryText=null,e.removeOverlay(t.overlay),t.annotate&&(t.annotate.clear(),t.annotate=null))})}function m(e,t,r){e.operation(function(){for(var n=o(e,t);n.findNext();)if("string"!=typeof t){var i=e.getRange(n.from(),n.to()).match(t);n.replace(r.replace(/\$(\d)/g,function(e,t){return i[t]}))}else n.replace(r)})}function g(e,t){if(!e.getOption("readOnly")){var r=e.getSelection()||n(e).lastQuery,i=t?"Replace all:":"Replace:";s(e,i+y,i,r,function(r){r&&(r=u(r),s(e,b,"Replace with:","",function(n){if(n=c(n),t)m(e,r,n);else{h(e);var i=o(e,r,e.getCursor()),a=function(){var t,c=i.from();!(t=i.findNext())&&(i=o(e,r),!(t=i.findNext())||c&&i.from().line==c.line&&i.from().ch==c.ch)||(e.setSelection(i.from(),i.to()),e.scrollIntoView({from:i.from(),to:i.to()}),l(e,k,"Replace?",[function(){s(t)},a,function(){m(e,r,n)}]))},s=function(e){i.replace("string"==typeof r?n:n.replace(/\$(\d)/g,function(t,r){return e[r]})),a()};a()}}))})}}var v='Search: (Use /re/ syntax for regexp search)',y=' (Use /re/ syntax for regexp search)',b='With: ',k="Replace? ";e.commands.find=function(e){h(e),d(e)},e.commands.findPersistent=function(e){h(e),d(e,!1,!0)},e.commands.findNext=d,e.commands.findPrev=function(e){d(e,!0)},e.commands.clearSearch=h,e.commands.replace=g,e.commands.replaceAll=function(e){g(e,!0)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r,n,i){e.openDialog?e.openDialog(t,i,{value:n,selectValueOnOpen:!0}):i(prompt(r,n))}function r(e,t){var r=Number(t);return/^[-+]/.test(t)?e.getCursor().line+r:r-1}var n='Jump to line: (Use line:column or scroll% syntax)';e.commands.jumpToLine=function(e){var i=e.getCursor();t(e,n,"Jump to line:",i.line+1+":"+i.ch,function(t){if(t){var n;if(n=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(t))e.setCursor(r(e,n[1]),Number(n[2]));else if(n=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(t)){var o=Math.round(e.lineCount()*Number(n[1])/100);/^[-+]/.test(n[1])&&(o=i.line+o+1),e.setCursor(o-1,i.ch)}else(n=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(t))&&e.setCursor(r(e,n[1]),i.ch)}})},e.keyMap["default"]["Alt-G"]="jumpToLine"}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r,n){this.cm=e,this.options=n;var i={listenForChanges:!1};for(var o in n)i[o]=n[o];i.className||(i.className="CodeMirror-search-match"),this.annotation=e.annotateScrollbar(i),this.query=t,this.caseFold=r,this.gap={from:e.firstLine(),to:e.lastLine()+1},this.matches=[],this.update=null,this.findMatches(),this.annotation.update(this.matches);var a=this;e.on("change",this.changeHandler=function(e,t){a.onChange(t)})}function r(e,t,r){return t>=e?e:Math.max(t,e+r)}e.defineExtension("showMatchesOnScrollbar",function(e,r,n){return"string"==typeof n&&(n={className:n}),n||(n={}),new t(this,e,r,n)});var n=1e3;t.prototype.findMatches=function(){if(this.gap){for(var t=0;t=this.gap.to)break;r.to.line>=this.gap.from&&this.matches.splice(t--,1)}for(var i=this.cm.getSearchCursor(this.query,e.Pos(this.gap.from,0),this.caseFold),o=this.options&&this.options.maxMatches||n;i.findNext();){var r={from:i.from(),to:i.to()};if(r.from.line>=this.gap.to)break;if(this.matches.splice(t++,0,r),this.matches.length>o)break}this.gap=null}},t.prototype.onChange=function(t){var n=t.from.line,i=e.changeEnd(t).line,o=i-t.to.line;if(this.gap?(this.gap.from=Math.min(r(this.gap.from,n,o),t.from.line),this.gap.to=Math.max(r(this.gap.to,n,o),t.from.line)):this.gap={from:t.from.line,to:i+1},o)for(var a=0;al&&n(e,s.slice(l,c),r,t.style))}var u=e.getCursor("from"),f=e.getCursor("to");if(u.line==f.line&&(!t.wordsOnly||a(e,u,f))){var d=e.getRange(u,f).replace(/^\s+|\s+$/g,"");d.length>=t.minChars&&n(e,d,!1,t.style)}})}function a(e,t,r){var n=e.getRange(t,r);if(null!==n.match(/^\w+$/)){if(t.ch>0){var i={line:t.line,ch:t.ch-1},o=e.getRange(i,t);if(null===o.match(/\W/))return!1}if(r.chn.right?1:0:t.clientYn.bottom?1:0,o.moveTo(o.pos+r*o.screen)}),e.on(this.node,"mousewheel",i),e.on(this.node,"DOMMouseScroll",i)}function r(e,r,n){this.addClass=e,this.horiz=new t(e,"horizontal",n),r(this.horiz.node),this.vert=new t(e,"vertical",n),r(this.vert.node),this.width=null}t.prototype.moveTo=function(e,t){0>e&&(e=0),e>this.total-this.screen&&(e=this.total-this.screen),e!=this.pos&&(this.pos=e,this.inner.style["horizontal"==this.orientation?"left":"top"]=e*(this.size/this.total)+"px",t!==!1&&this.scroll(e,this.orientation))};var n=10;t.prototype.update=function(e,t,r){this.screen=t,this.total=e,this.size=r;var i=this.screen*(this.size/this.total);n>i&&(this.size-=n-i,i=n),this.inner.style["horizontal"==this.orientation?"width":"height"]=i+"px",this.inner.style["horizontal"==this.orientation?"left":"top"]=this.pos*(this.size/this.total)+"px"},r.prototype.update=function(e){if(null==this.width){var t=window.getComputedStyle?window.getComputedStyle(this.horiz.node):this.horiz.node.currentStyle;t&&(this.width=parseInt(t.height))}var r=this.width||0,n=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1;return this.vert.node.style.display=i?"block":"none",this.horiz.node.style.display=n?"block":"none",i&&(this.vert.update(e.scrollHeight,e.clientHeight,e.viewHeight-(n?r:0)),this.vert.node.style.display="block",this.vert.node.style.bottom=n?r+"px":"0"),n&&(this.horiz.update(e.scrollWidth,e.clientWidth,e.viewWidth-(i?r:0)-e.barLeft),this.horiz.node.style.right=i?r+"px":"0",this.horiz.node.style.left=e.barLeft+"px"),{right:i?r:0,bottom:n?r:0}},r.prototype.setScrollTop=function(e){this.vert.moveTo(e,!1)},r.prototype.setScrollLeft=function(e){this.horiz.moveTo(e,!1)},r.prototype.clear=function(){var e=this.horiz.node.parentNode;e.removeChild(this.horiz.node),e.removeChild(this.vert.node)},e.scrollbarModel.simple=function(e,t){return new r("CodeMirror-simplescroll",e,t)},e.scrollbarModel.overlay=function(e,t){return new r("CodeMirror-overlayscroll",e,t)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){function r(e){clearTimeout(n.doRedraw),n.doRedraw=setTimeout(function(){n.redraw()},e)}this.cm=e,this.options=t,this.buttonHeight=t.scrollButtonHeight||e.getOption("scrollButtonHeight"),this.annotations=[],this.doRedraw=this.doUpdate=null,this.div=e.getWrapperElement().appendChild(document.createElement("div")),this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none",this.computeScale();var n=this;e.on("refresh",this.resizeHandler=function(){clearTimeout(n.doUpdate),n.doUpdate=setTimeout(function(){n.computeScale()&&r(20)},100)}),e.on("markerAdded",this.resizeHandler),e.on("markerCleared",this.resizeHandler),t.listenForChanges!==!1&&e.on("change",this.changeHandler=function(){r(250)})}e.defineExtension("annotateScrollbar",function(e){return"string"==typeof e&&(e={className:e}),new t(this,e)}),e.defineOption("scrollButtonHeight",0),t.prototype.computeScale=function(){var e=this.cm,t=(e.getWrapperElement().clientHeight-e.display.barHeight-2*this.buttonHeight)/e.getScrollerElement().scrollHeight;return t!=this.hScale?(this.hScale=t,!0):void 0},t.prototype.update=function(e){this.annotations=e,this.redraw()},t.prototype.redraw=function(e){function t(e,t){if(l!=e.line&&(l=e.line,c=r.getLineHandle(l)),a&&c.height>s)return r.charCoords(e,"local")[t?"top":"bottom"];var n=r.heightAtLine(c,"local");return n+(t?0:c.height)}e!==!1&&this.computeScale();var r=this.cm,n=this.hScale,i=document.createDocumentFragment(),o=this.annotations,a=r.getOption("lineWrapping"),s=a&&1.5*r.defaultTextHeight(),l=null,c=null;if(r.display.barWidth)for(var u,f=0;fh+.9));)d=o[++f],h=t(d.to,!1)*n;if(h!=p){var m=Math.max(h-p,3),g=i.appendChild(document.createElement("div"));g.style.cssText="position: absolute; right: 0px; width: "+Math.max(1.5*r.display.barWidth,2)+"px; top: "+(p+this.buttonHeight)+"px; height: "+m+"px",g.className=this.options.className,d.id&&g.setAttribute("annotation-id",d.id)}}this.div.textContent="",this.div.appendChild(i)},t.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("change",this.changeHandler),this.div.parentNode.removeChild(this.div)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,r,n){this.cm=e,this.node=t,this.options=r,this.height=n,this.cleared=!1}function r(e){var t=e.getWrapperElement(),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n=parseInt(r.height),i=e.state.panels={setHeight:t.style.height,heightLeft:n,panels:0,wrapper:document.createElement("div")};t.parentNode.insertBefore(i.wrapper,t);var o=e.hasFocus();i.wrapper.appendChild(t),o&&e.focus(),e._setSize=e.setSize,null!=n&&(e.setSize=function(t,r){if(null==r)return this._setSize(t,r);if(i.setHeight=r,"number"!=typeof r){var o=/^(\d+\.?\d*)px$/.exec(r);o?r=Number(o[1]):(i.wrapper.style.height=r,r=i.wrapper.offsetHeight,i.wrapper.style.height="")}e._setSize(t,i.heightLeft+=r-n),n=r})}function n(e){var t=e.state.panels;e.state.panels=null;var r=e.getWrapperElement();t.wrapper.parentNode.replaceChild(r,t.wrapper),r.style.height=t.setHeight,e.setSize=e._setSize,e.setSize()}e.defineExtension("addPanel",function(e,n){n=n||{},this.state.panels||r(this);var i=this.state.panels,o=i.wrapper,a=this.getWrapperElement();n.after instanceof t&&!n.after.cleared?o.insertBefore(e,n.before.node.nextSibling):n.before instanceof t&&!n.before.cleared?o.insertBefore(e,n.before.node):n.replace instanceof t&&!n.replace.cleared?(o.insertBefore(e,n.replace.node),n.replace.clear()):"bottom"==n.position?o.appendChild(e):"before-bottom"==n.position?o.insertBefore(e,a.nextSibling):"after-top"==n.position?o.insertBefore(e,a):o.insertBefore(e,o.firstChild);var s=n&&n.height||e.offsetHeight;return this._setSize(null,i.heightLeft-=s),i.panels++,new t(this,e,n,s)}),t.prototype.clear=function(){if(!this.cleared){this.cleared=!0;var e=this.cm.state.panels;this.cm._setSize(null,e.heightLeft+=this.height),e.wrapper.removeChild(this.node),0==--e.panels&&n(this.cm)}},t.prototype.changed=function(e){var t=null==e?this.node.offsetHeight:e,r=this.cm.state.panels;this.cm._setSize(null,r.height+=t-this.height),this.height=t}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e){e.state.placeholder&&(e.state.placeholder.parentNode.removeChild(e.state.placeholder),e.state.placeholder=null)}function r(e){t(e);var r=e.state.placeholder=document.createElement("pre");r.style.cssText="height: 0; overflow: visible",r.className="CodeMirror-placeholder";var n=e.getOption("placeholder");"string"==typeof n&&(n=document.createTextNode(n)),r.appendChild(n),e.display.lineSpace.insertBefore(r,e.display.lineSpace.firstChild)}function n(e){o(e)&&r(e)}function i(e){var n=e.getWrapperElement(),i=o(e);n.className=n.className.replace(" CodeMirror-empty","")+(i?" CodeMirror-empty":""),i?r(e):t(e)}function o(e){return 1===e.lineCount()&&""===e.getLine(0)}e.defineOption("placeholder","",function(r,o,a){var s=a&&a!=e.Init;if(o&&!s)r.on("blur",n),r.on("change",i),i(r);else if(!o&&s){r.off("blur",n),r.off("change",i),t(r);var l=r.getWrapperElement();l.className=l.className.replace(" CodeMirror-empty","")}o&&!r.hasFocus()&&n(r)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){var t=e.getWrapperElement();e.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:t.style.width,height:t.style.height},t.style.width="",t.style.height="auto",t.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",e.refresh()}function r(e){var t=e.getWrapperElement();t.className=t.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var r=e.state.fullScreenRestore;t.style.width=r.width,t.style.height=r.height,window.scrollTo(r.scrollLeft,r.scrollTop),e.refresh()}e.defineOption("fullScreen",!1,function(n,i,o){o==e.Init&&(o=!1),!o!=!i&&(i?t(n):r(n))})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t,n){function i(){t.display.wrapper.offsetHeight?(r(t,n),t.display.lastWrapHeight!=t.display.wrapper.clientHeight&&t.refresh()):n.timeout=setTimeout(i,n.delay)}n.timeout=setTimeout(i,n.delay),n.hurry=function(){clearTimeout(n.timeout),n.timeout=setTimeout(i,50)},e.on(window,"mouseup",n.hurry),e.on(window,"keyup",n.hurry)}function r(t,r){clearTimeout(r.timeout),e.off(window,"mouseup",r.hurry),e.off(window,"keyup",r.hurry)}e.defineOption("autoRefresh",!1,function(e,n){e.state.autoRefresh&&(r(e,e.state.autoRefresh),e.state.autoRefresh=null),n&&0==e.display.wrapper.offsetHeight&&t(e,e.state.autoRefresh={delay:n.delay||250})})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,r){var n,i=e.getWrapperElement();return n=i.appendChild(document.createElement("div")),n.className=r?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof t?n.innerHTML=t:n.appendChild(t),n}function r(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}e.defineExtension("openDialog",function(n,i,o){function a(e){if("string"==typeof e)f.value=e;else{if(c)return;c=!0,l.parentNode.removeChild(l),u.focus(),o.onClose&&o.onClose(l)}}o||(o={}),r(this,null);var s,l=t(this,n,o.bottom),c=!1,u=this,f=l.getElementsByTagName("input")[0];return f?(o.value&&(f.value=o.value,o.selectValueOnOpen!==!1&&f.select()),o.onInput&&e.on(f,"input",function(e){o.onInput(e,f.value,a)}),o.onKeyUp&&e.on(f,"keyup",function(e){o.onKeyUp(e,f.value,a)}),e.on(f,"keydown",function(t){o&&o.onKeyDown&&o.onKeyDown(t,f.value,a)||((27==t.keyCode||o.closeOnEnter!==!1&&13==t.keyCode)&&(f.blur(),e.e_stop(t),a()),13==t.keyCode&&i(f.value,t))}),o.closeOnBlur!==!1&&e.on(f,"blur",a),f.focus()):(s=l.getElementsByTagName("button")[0])&&(e.on(s,"click",function(){a(),u.focus()}),o.closeOnBlur!==!1&&e.on(s,"blur",a),s.focus()),a}),e.defineExtension("openConfirm",function(n,i,o){function a(){c||(c=!0,s.parentNode.removeChild(s),u.focus())}r(this,null);var s=t(this,n,o&&o.bottom),l=s.getElementsByTagName("button"),c=!1,u=this,f=1;l[0].focus();for(var d=0;d=f&&a()},200)}),e.on(p,"focus",function(){++f})}}),e.defineExtension("openNotification",function(n,i){function o(){l||(l=!0,clearTimeout(a),s.parentNode.removeChild(s))}r(this,o);var a,s=t(this,n,i&&i.bottom),l=!1,c=i&&"undefined"!=typeof i.duration?i.duration:5e3;return e.on(s,"click",function(t){e.e_preventDefault(t),o()}),c&&(a=setTimeout(o,c)),o})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,n,i){var o=e.getLineHandle(t.line),l=t.ch-1,c=l>=0&&s[o.text.charAt(l)]||s[o.text.charAt(++l)];if(!c)return null;var u=">"==c.charAt(1)?1:-1;if(n&&u>0!=(l==t.ch))return null;var f=e.getTokenTypeAt(a(t.line,l+1)),d=r(e,a(t.line,l+(u>0?1:0)),u,f||null,i);return null==d?null:{from:a(t.line,l),to:d&&d.pos,match:d&&d.ch==c.charAt(0),forward:u>0}}function r(e,t,r,n,i){for(var o=i&&i.maxScanLineLength||1e4,l=i&&i.maxScanLines||1e3,c=[],u=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,f=r>0?Math.min(t.line+l,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-l),d=t.line;d!=f;d+=r){var p=e.getLine(d);if(p){var h=r>0?0:p.length-1,m=r>0?p.length:-1;if(!(p.length>o))for(d==t.line&&(h=t.ch-(0>r?1:0));h!=m;h+=r){var g=p.charAt(h);if(u.test(g)&&(void 0===n||e.getTokenTypeAt(a(d,h+1))==n)){var v=s[g];if(">"==v.charAt(1)==r>0)c.push(g);else{if(!c.length)return{pos:a(d,h),ch:g};c.pop()}}}}}return d-r==(r>0?e.lastLine():e.firstLine())?!1:null}function n(e,r,n){for(var i=e.state.matchBrackets.maxHighlightLineLength||1e3,s=[],l=e.listSelections(),c=0;c=9&&r.hasSelection&&(r.hasSelection=null),r.poll()}),Oa(o,"paste",function(e){Li(n,e)||J(e,n)||(n.state.pasteIncoming=!0,r.fastPoll())}),Oa(o,"cut",t),Oa(o,"copy",t),Oa(e.scroller,"paste",function(t){Kt(e,t)||Li(n,t)||(n.state.pasteIncoming=!0,r.focus())}),Oa(e.lineSpace,"selectstart",function(t){Kt(e,t)||Ta(t)}),Oa(o,"compositionstart",function(){var e=n.getCursor("from");r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}}),Oa(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,r=e.doc,n=Pe(e);if(e.options.moveInputWithCursor){var i=ht(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return n},showSelection:function(e){var t=this.cm,r=t.display;Ui(r.cursorDiv,e.cursors),Ui(r.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t,r,n=this.cm,i=n.doc;if(n.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=is&&(o.to().line-o.from().line>100||(r=n.getSelection()).length>1e3);var a=t?"-":r||n.getSelection();this.composing||(this.textarea.value=a),n.state.focused&&$a(this.textarea),ko&&xo>=9&&(this.hasSelection=a)}else e||(this.composing||(this.prevInput=this.textarea.value=""),ko&&xo>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!Eo||Ki()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var n=r.poll();n||t?(r.pollingFast=!1,r.slowPoll()):(t=!0,r.polling.set(60,e))}var t=!1,r=this;r.pollingFast=!0,r.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,r=this.prevInput;if(this.contextMenuPending||!e.state.focused||ns(t)&&!r&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var n=t.value;if(n==r&&!e.somethingSelected())return!1;if(ko&&xo>=9&&this.hasSelection===n||Oo&&/[\uf700-\uf7ff]/.test(n))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var i=n.charCodeAt(0);if(8203!=i||r||(r="​"),8666==i)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(r.length,n.length);a>o&&r.charCodeAt(o)==n.charCodeAt(o);)++o;var s=this;return Et(e,function(){Q(e,n.slice(o),r.length-o,null,s.composing?"*compose":null),n.length>1e3||n.indexOf("\n")>-1?t.value=s.prevInput="":s.prevInput=n,s.composing&&(s.composing.range.clear(),s.composing.range=e.markText(s.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){ko&&xo>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=a.selectionStart){var e=i.somethingSelected(),t="​"+(e?a.value:"");a.value="⇚",a.value=t,n.prevInput=e?"":"​",a.selectionStart=1,a.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function r(){if(n.contextMenuPending=!1,n.wrapper.style.cssText=d,a.style.cssText=u,ko&&9>xo&&o.scrollbars.setScrollTop(o.scroller.scrollTop=l),null!=a.selectionStart){(!ko||ko&&9>xo)&&t();var e=0,r=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&"​"==n.prevInput?Ot(i,da.selectAll)(i):e++<10?o.detectingSelectAll=setTimeout(r,500):o.input.reset()};o.detectingSelectAll=setTimeout(r,200)}}var n=this,i=n.cm,o=i.display,a=n.textarea,s=Vt(i,e),l=o.scroller.scrollTop;if(s&&!So){var c=i.options.resetSelectionOnContextMenu;c&&-1==i.doc.sel.contains(s)&&Ot(i,Le)(i.doc,he(s),ja);var u=a.style.cssText,d=n.wrapper.style.cssText;n.wrapper.style.cssText="position: absolute";var f=n.wrapper.getBoundingClientRect();if(a.style.cssText="position: absolute; width: 30px; height: 30px; top: "+(e.clientY-f.top-5)+"px; left: "+(e.clientX-f.left-5)+"px; z-index: 1000; background: "+(ko?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",wo)var p=window.scrollY;if(o.input.focus(),wo&&window.scrollTo(null,p),o.input.reset(),i.somethingSelected()||(a.value=n.prevInput=" "),n.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),ko&&xo>=9&&t(),Po){Ea(e);var h=function(){Ia(window,"mouseup",h),setTimeout(r,20)};Oa(window,"mouseup",h)}else setTimeout(r,50)}},readOnlyChanged:function(e){e||this.reset()},setUneditable:Pi,needsContentAttribute:!1},ne.prototype),oe.prototype=ji({init:function(e){function t(e){if(!Li(n,e)){if(n.somethingSelected())Fo=n.getSelections(),"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=te(n);Fo=t.text,"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,ja),n.replaceSelection("",null,"cut")})}if(e.clipboardData&&!Ao)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Fo.join("\n"));else{var r=ie(),i=r.firstChild;n.display.lineSpace.insertBefore(r,n.display.lineSpace.firstChild),i.value=Fo.join("\n");var o=document.activeElement;$a(i),setTimeout(function(){n.display.lineSpace.removeChild(r),o.focus()},50)}}}var r=this,n=r.cm,i=r.div=e.lineDiv;re(i),Oa(i,"paste",function(e){Li(n,e)||J(e,n)}),Oa(i,"compositionstart",function(e){var t=e.data;if(r.composing={sel:n.doc.sel,data:t,startData:t},t){var i=n.doc.sel.primary(),o=n.getLine(i.head.line),a=o.indexOf(t,Math.max(0,i.head.ch-t.length));a>-1&&a<=i.head.ch&&(r.composing.sel=he(Do(i.head.line,a),Do(i.head.line,a+t.length)))}}),Oa(i,"compositionupdate",function(e){r.composing.data=e.data}),Oa(i,"compositionend",function(e){var t=r.composing;t&&(e.data==t.startData||/\u200b/.test(e.data)||(t.data=e.data),setTimeout(function(){t.handled||r.applyComposition(t),r.composing==t&&(r.composing=null)},50))}),Oa(i,"touchstart",function(){r.forceCompositionEnd()}),Oa(i,"input",function(){r.composing||(n.isReadOnly()||!r.pollContent())&&Et(r.cm,function(){Pt(n)})}),Oa(i,"copy",t),Oa(i,"cut",t)},prepareSelection:function(){var e=Pe(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e){e&&this.cm.display.view.length&&(e.focus&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),r=le(this.cm,e.anchorNode,e.anchorOffset),n=le(this.cm,e.focusNode,e.focusOffset);if(!r||r.bad||!n||n.bad||0!=Bo(Z(r,n),t.from())||0!=Bo(X(r,n),t.to())){var i=ae(this.cm,t.from()),o=ae(this.cm,t.to());if(i||o){var a=this.cm.display.view,s=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var l=a[a.length-1].measure,c=l.maps?l.maps[l.maps.length-1]:l.map;o={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]}}}else i={node:a[0].measure.map[2],offset:0};try{var u=Ua(i.node,i.offset,o.offset,o.node)}catch(d){}u&&(!vo&&this.cm.state.focused?(e.collapse(i.node,i.offset),u.collapsed||e.addRange(u)):(e.removeAllRanges(),e.addRange(u)),s&&null==e.anchorNode?e.addRange(s):vo&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){Ui(this.cm.display.cursorDiv,e.cursors),Ui(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return Xa(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():Et(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var r=le(t,e.anchorNode,e.anchorOffset),n=le(t,e.focusNode,e.focusOffset);r&&n&&Et(t,function(){Le(t.doc,he(r,n),ja),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}},pollContent:function(){var e=this.cm,t=e.display,r=e.doc.sel.primary(),n=r.from(),i=r.to();if(n.linet.viewTo-1)return!1;var o;if(n.line==t.viewFrom||0==(o=Dt(e,n.line)))var a=ri(t.view[0].line),s=t.view[0].node;else var a=ri(t.view[o].line),s=t.view[o-1].node.nextSibling;var l=Dt(e,i.line);if(l==t.view.length-1)var c=t.viewTo-1,u=t.lineDiv.lastChild;else var c=ri(t.view[l+1].line)-1,u=t.view[l+1].node.previousSibling;for(var d=e.doc.splitLines(ue(e,s,u,a,c)),f=Jn(e.doc,Do(a,0),Do(c,Qn(e.doc,c).text.length));d.length>1&&f.length>1;)if(Ii(d)==Ii(f))d.pop(),f.pop(),c--;else{if(d[0]!=f[0])break;d.shift(),f.shift(),a++}for(var p=0,h=0,m=d[0],g=f[0],v=Math.min(m.length,g.length);v>p&&m.charCodeAt(p)==g.charCodeAt(p);)++p;for(var y=Ii(d),b=Ii(f),k=Math.min(y.length-(1==d.length?p:0),b.length-(1==f.length?p:0));k>h&&y.charCodeAt(y.length-h-1)==b.charCodeAt(b.length-h-1);)++h;d[d.length-1]=y.slice(0,y.length-h),d[0]=d[0].slice(p);var x=Do(a,p),w=Do(c,f.length?Ii(f).length-h:0);return d.length>1||d[0]||Bo(x,w)?(zr(e.doc,d,x,w,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){this.cm.isReadOnly()?Ot(this.cm,Pt)(this.cm):e.data&&e.data!=e.startData&&Ot(this.cm,Q)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.contentEditable="false"},onKeyPress:function(e){e.preventDefault(),this.cm.isReadOnly()||Ot(this.cm,Q)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},readOnlyChanged:function(e){this.div.contentEditable=String("nocursor"!=e)},onContextMenu:Pi,resetPosition:Pi,needsContentAttribute:!0},oe.prototype),e.inputStyles={textarea:ne,contenteditable:oe},de.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t=0&&Bo(e,n.to())<=0)return r}return-1}},fe.prototype={from:function(){return Z(this.anchor,this.head)},to:function(){return X(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Wo,Ho,$o,Uo={left:0,right:0,top:0,bottom:0},Ko=null,Vo=0,Go=0,Xo=0,Zo=null;ko?Zo=-.53:vo?Zo=15:Co?Zo=-.7:Mo&&(Zo=-1/3);var Yo=function(e){var t=e.wheelDeltaX,r=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}};e.wheelEventPixels=function(e){var t=Yo(e);return t.x*=Zo,t.y*=Zo,t};var Qo=new Oi,Jo=null,ea=e.changeEnd=function(e){return e.text?Do(e.from.line+e.text.length-1,Ii(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var r=this.options,n=r[e];(r[e]!=t||"mode"==e)&&(r[e]=t,ra.hasOwnProperty(e)&&Ot(this,ra[e])(this,t,n))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Vr(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;rr&&(Br(this,i.head.line,e,!0),r=i.head.line,n==this.doc.sel.primIndex&&jr(this));else{var o=i.from(),a=i.to(),s=Math.max(r,o.line);r=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var l=s;r>l;++l)Br(this,l,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[n].from().ch>0&&_e(this.doc,n,new fe(o,c[n].to()),ja)}}}),getTokenAt:function(e,t){return In(this,e,t)},getLineTokens:function(e,t){return In(this,Do(e),t,!0)},getTokenTypeAt:function(e){e=ge(this.doc,e);var t,r=Pn(this,Qn(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var a=n+i>>1;if((a?r[2*a-1]:0)>=o)i=a;else{if(!(r[2*a+1]s?t:0==s?null:t.slice(0,s-1)},getModeAt:function(t){var r=this.doc.mode;return r.innerMode?e.innerMode(r,this.getTokenAt(t).state).mode:r},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!la.hasOwnProperty(t))return r;var n=la[t],i=this.getModeAt(e);if("string"==typeof i[t])n[i[t]]&&r.push(n[i[t]]);else if(i[t])for(var o=0;oi&&(e=i,n=!0),r=Qn(this.doc,e)}else r=e;return dt(this,r,{top:0,left:0},t||"page").top+(n?this.doc.height-ii(r):0)},defaultTextHeight:function(){return bt(this.display)},defaultCharWidth:function(){return kt(this.display)},setGutterMarker:zt(function(e,t,r){return Fr(this.doc,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&Fi(n)&&(e.gutterMarkers=null),!0})}),clearGutter:zt(function(e){var t=this,r=t.doc,n=r.first;r.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&(r.gutterMarkers[e]=null,Rt(t,n,"gutter"),Fi(r.gutterMarkers)&&(r.gutterMarkers=null)),++n})}),lineInfo:function(e){if("number"==typeof e){if(!ye(this.doc,e))return null;var t=e;if(e=Qn(this.doc,e),!e)return null}else{var t=ri(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o=this.display;e=ht(this,ge(this.doc,e));var a=e.bottom,s=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==n)a=e.top;else if("above"==n||"near"==n){var l=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>l)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=l&&(a=e.bottom),s+t.offsetWidth>c&&(s=c-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(s=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?s=0:"middle"==i&&(s=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=s+"px"),r&&qr(this,s,a,s+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:zt(fr),triggerOnKeyPress:zt(mr),triggerOnKeyUp:hr,execCommand:function(e){return da.hasOwnProperty(e)?da[e].call(null,this):void 0},triggerElectric:zt(function(e){ee(this,e)}),findPosH:function(e,t,r,n){var i=1;0>t&&(i=-1,t=-t);for(var o=0,a=ge(this.doc,e);t>o&&(a=Hr(this.doc,a,i,r,n),!a.hitSide);++o);return a},moveH:zt(function(e,t){var r=this;r.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?Hr(r.doc,n.head,e,t,r.options.rtlMoveVisually):0>e?n.from():n.to()},Ba)}),deleteH:zt(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Wr(this,function(r){var i=Hr(n,r.head,e,t,!1);return 0>e?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=1,o=n;0>t&&(i=-1,t=-t);for(var a=0,s=ge(this.doc,e);t>a;++a){var l=ht(this,s,"div");if(null==o?o=l.left:l.left=o,s=$r(this,l,i,r),s.hitSide)break}return s},moveV:zt(function(e,t){var r=this,n=this.doc,i=[],o=!r.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(a){if(o)return 0>e?a.from():a.to();var s=ht(r,a.head,"div");null!=a.goalColumn&&(s.left=a.goalColumn),i.push(s.left);var l=$r(r,s,e,t);return"page"==t&&a==n.sel.primary()&&Rr(r,null,pt(r,l,"div").top-s.top),l},Ba),i.length)for(var a=0;a0&&s(r.charAt(n-1));)--n;for(;i.5)&&a(this),Na(this,"refresh",this)}),swapDoc:zt(function(e){var t=this.doc;return t.cm=null,Yn(this,e),lt(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,Si(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Ei(e);var ta=e.defaults={},ra=e.optionHandlers={},na=e.Init={toString:function(){return"CodeMirror.Init"}};Ur("value","",function(e,t){e.setValue(t)},!0),Ur("mode",null,function(e,t){e.doc.modeOption=t,r(e)},!0),Ur("indentUnit",2,r,!0),Ur("indentWithTabs",!1),Ur("smartIndent",!0),Ur("tabSize",4,function(e){n(e),lt(e),Pt(e)},!0),Ur("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,r.push(Do(n,o))}n++});for(var i=r.length-1;i>=0;i--)zr(e.doc,t,r[i],Do(r[i].line,r[i].ch+t.length))}}),Ur("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,r,n){t.state.specialChars=new RegExp(r.source+(r.test(" ")?"":"| "),"g"),n!=e.Init&&t.refresh()}),Ur("specialCharPlaceholder",Bn,function(e){e.refresh()},!0),Ur("electricChars",!0),Ur("inputStyle",Eo?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Ur("rtlMoveVisually",!Io),Ur("wholeLineUpdateBefore",!0),Ur("theme","default",function(e){s(e),l(e)},!0),Ur("keyMap","default",function(t,r,n){var i=Vr(r),o=n!=e.Init&&Vr(n);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),Ur("extraKeys",null),Ur("lineWrapping",!1,i,!0),Ur("gutters",[],function(e){p(e.options),l(e)},!0),Ur("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?C(e.display)+"px":"0",e.refresh()},!0),Ur("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),Ur("scrollbarStyle","native",function(e){v(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Ur("lineNumbers",!1,function(e){p(e.options),l(e)},!0),Ur("firstLineNumber",1,l,!0),Ur("lineNumberFormatter",function(e){return e},l,!0),Ur("showCursorWhenSelecting",!1,qe,!0),Ur("resetSelectionOnContextMenu",!0),Ur("lineWiseCopyCut",!0),Ur("readOnly",!1,function(e,t){"nocursor"==t?(yr(e),e.display.input.blur(),e.display.disabled=!0):e.display.disabled=!1,e.display.input.readOnlyChanged(t)}),Ur("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Ur("dragDrop",!0,$t),Ur("allowDropFileTypes",null),Ur("cursorBlinkRate",530),Ur("cursorScrollMargin",0),Ur("cursorHeight",1,qe,!0),Ur("singleCursorHeightPerLine",!0,qe,!0),Ur("workTime",100),Ur("workDelay",100),Ur("flattenSpans",!0,n,!0),Ur("addModeClass",!1,n,!0),Ur("pollInterval",100),Ur("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),Ur("historyEventDelay",1250),Ur("viewportMargin",10,function(e){e.refresh()},!0),Ur("maxHighlightLength",1e4,n,!0),Ur("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Ur("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),Ur("autofocus",null);var ia=e.modes={},oa=e.mimeModes={};e.defineMode=function(t,r){e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2&&(r.dependencies=Array.prototype.slice.call(arguments,2)),ia[t]=r},e.defineMIME=function(e,t){oa[e]=t},e.resolveMode=function(t){if("string"==typeof t&&oa.hasOwnProperty(t))t=oa[t];else if(t&&"string"==typeof t.name&&oa.hasOwnProperty(t.name)){var r=oa[t.name];"string"==typeof r&&(r={name:r}),t=Ri(r,t),t.name=r.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,r){var r=e.resolveMode(r),n=ia[r.name];if(!n)return e.getMode(t,"text/plain");var i=n(t,r);if(aa.hasOwnProperty(r.name)){var o=aa[r.name];for(var a in o)o.hasOwnProperty(a)&&(i.hasOwnProperty(a)&&(i["_"+a]=i[a]),i[a]=o[a])}if(i.name=r.name,r.helperType&&(i.helperType=r.helperType),r.modeProps)for(var a in r.modeProps)i[a]=r.modeProps[a];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var aa=e.modeExtensions={};e.extendMode=function(e,t){var r=aa.hasOwnProperty(e)?aa[e]:aa[e]={};ji(t,r)},e.defineExtension=function(t,r){e.prototype[t]=r},e.defineDocExtension=function(e,t){Sa.prototype[e]=t},e.defineOption=Ur;var sa=[];e.defineInitHook=function(e){sa.push(e)};var la=e.helpers={};e.registerHelper=function(t,r,n){la.hasOwnProperty(t)||(la[t]=e[t]={_global:[]}),la[t][r]=n},e.registerGlobalHelper=function(t,r,n,i){e.registerHelper(t,r,i),la[t]._global.push({pred:n,val:i})};var ca=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var r={};for(var n in t){var i=t[n];i instanceof Array&&(i=i.concat([])),r[n]=i}return r},ua=e.startState=function(e,t,r){return e.startState?e.startState(t,r):!0};e.innerMode=function(e,t){for(;e.innerMode;){var r=e.innerMode(t);if(!r||r.mode==e)break;t=r.state,e=r.mode}return r||{mode:e,state:t}};var da=e.commands={selectAll:function(e){e.setSelection(Do(e.firstLine(),0),Do(e.lastLine()),ja)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),ja)},killLine:function(e){Wr(e,function(t){if(t.empty()){var r=Qn(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line0)i=new Do(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),Do(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Qn(e.doc,i.line-1).text;a&&e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),Do(i.line-1,a.length-1),Do(i.line,1),"+transpose")}r.push(new fe(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){Et(e,function(){for(var t=e.listSelections().length,r=0;t>r;r++){var n=e.listSelections()[r];e.replaceRange(e.doc.lineSeparator(),n.anchor,n.head,"+input"),e.indentLine(n.from().line+1,null,!0)}jr(e)})},toggleOverwrite:function(e){ +e.toggleOverwrite()}},fa=e.keyMap={};fa.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},fa.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},fa.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},fa.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},fa["default"]=Oo?fa.macDefault:fa.pcDefault,e.normalizeKeyMap=function(e){var t={};for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue;if("..."==n){delete e[r];continue}for(var i=qi(r.split(" "),Kr),o=0;o=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.post},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var va=0,ya=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++va};Ei(ya),ya.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&xt(e),Ai(this,"clear")){var r=this.find();r&&Si(this,"clear",r.from,r.to)}for(var n=null,i=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=l,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=n&&e&&this.collapsed&&Pt(e,n,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ee(e.doc)),e&&Si(e,"markerCleared",e,this),t&&_t(e),this.parent&&this.parent.clear()}},ya.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var r,n,i=0;ir;++r){var i=this.lines[r];this.height-=i.height,An(i),Si(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var n=0;ne;++e)if(r(this.lines[e]))return!0}},Xn.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;re){var o=Math.min(t,i-e),a=n.height;if(n.removeInner(e,o),this.height-=a-n.height,i==o&&(this.children.splice(r--,1),n.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Gn))){var s=[];this.collapse(s),this.children=[new Gn(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t=e){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(;i.lines.length>50;){var a=i.lines.splice(i.lines.length-25,25),s=new Gn(a);i.height-=s.height,this.children.splice(n+1,0,s),s.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),r=new Xn(t);if(e.parent){e.size-=r.size,e.height-=r.height;var n=Ni(e.parent.children,e);e.parent.children.splice(n+1,0,r)}else{var i=new Xn(e.children);i.parent=e,e.children=[i,r],e=i}r.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;ne){var a=Math.min(t,o-e);if(i.iterN(e,a,r))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var Ca=0,Sa=e.Doc=function(e,t,r,n){if(!(this instanceof Sa))return new Sa(e,t,r,n);null==r&&(r=0),Xn.call(this,[new Gn([new xa("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=r;var i=Do(r,0);this.sel=he(i),this.history=new ai(null),this.id=++Ca,this.modeOption=t,this.lineSep=n,this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Vn(this,{from:i,to:i,text:e}),Le(this,he(i),ja)};Sa.prototype=Ri(Xn.prototype,{constructor:Sa,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n=0;o--)Mr(this,n[o]);s?Me(this,s):this.cm&&jr(this.cm)}),undo:It(function(){Tr(this,"undo")}),redo:It(function(){Tr(this,"redo")}),undoSelection:It(function(){Tr(this,"undo",!0)}),redoSelection:It(function(){Tr(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=ge(this,e),t=ge(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var s=0;sl.to||null==l.from&&i!=e.line||null!=l.from&&i==t.line&&l.from>t.ch||r&&!r(l.marker)||n.push(l.marker.parent||l.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;ne?(t=e,!0):(e-=o,void++r)}),ge(this,Do(r,t))},indexFromPos:function(e){e=ge(this,e);var t=e.ch;if(e.linet&&(t=e.from),null!=e.to&&e.tos||s>=t)return a+(t-o);a+=s-o,a+=r-a%r,o=s+1}},Wa=e.findColumn=function(e,t,r){for(var n=0,i=0;;){var o=e.indexOf(" ",n);-1==o&&(o=e.length);var a=o-n;if(o==e.length||i+a>=t)return n+Math.min(a,t-i);if(i+=o-n,i+=r-i%r,n=o+1,i>=t)return n}},Ha=[""],$a=function(e){e.select()};Ao?$a=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:ko&&($a=function(e){try{e.select()}catch(t){}});var Ua,Ka=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Va=e.isWordChar=function(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||Ka.test(e))},Ga=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;Ua=document.createRange?function(e,t,r,n){var i=document.createRange();return i.setEnd(n||e,r),i.setStart(e,t),i}:function(e,t,r){var n=document.body.createTextRange();try{n.moveToElementText(e.parentNode)}catch(i){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var Xa=e.contains=function(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do if(11==t.nodeType&&(t=t.host),t==e)return!0;while(t=t.parentNode)};ko&&11>xo&&(Ki=function(){try{return document.activeElement}catch(e){return document.body}});var Za,Ya,Qa=e.rmClass=function(e,t){var r=e.className,n=Vi(t).exec(r);if(n){var i=r.slice(n.index+n[0].length);e.className=r.slice(0,n.index)+(i?n[1]+i:"")}},Ja=e.addClass=function(e,t){var r=e.className;Vi(t).test(r)||(e.className+=(r?" ":"")+t)},es=!1,ts=function(){if(ko&&9>xo)return!1;var e=Hi("div");return"draggable"in e||"dragDrop"in e}(),rs=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;n>=t;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},ns=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(r){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},is=function(){var e=Hi("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),os=null,as=e.keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};!function(){for(var e=0;10>e;e++)as[e+48]=as[e+96]=String(e);for(var e=65;90>=e;e++)as[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)as[e+111]=as[e+63235]="F"+e}();var ss,ls=function(){function e(e){return 247>=e?r.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?n.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,r){this.level=e,this.from=t,this.to=r}var r="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",n="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,s=/[Lb1n]/,l=/[1n]/,c="L";return function(r){if(!i.test(r))return!1;for(var n,u=r.length,d=[],f=0;u>f;++f)d.push(n=e(r.charCodeAt(f)));for(var f=0,p=c;u>f;++f){var n=d[f];"m"==n?d[f]=p:p=n}for(var f=0,h=c;u>f;++f){var n=d[f];"1"==n&&"r"==h?d[f]="n":a.test(n)&&(h=n,"r"==n&&(d[f]="R"))}for(var f=1,p=d[0];u-1>f;++f){var n=d[f];"+"==n&&"1"==p&&"1"==d[f+1]?d[f]="1":","!=n||p!=d[f+1]||"1"!=p&&"n"!=p||(d[f]=p),p=n}for(var f=0;u>f;++f){var n=d[f];if(","==n)d[f]="N";else if("%"==n){for(var m=f+1;u>m&&"%"==d[m];++m);for(var g=f&&"!"==d[f-1]||u>m&&"1"==d[m]?"1":"N",v=f;m>v;++v)d[v]=g;f=m-1}}for(var f=0,h=c;u>f;++f){var n=d[f];"L"==h&&"1"==n?d[f]="L":a.test(n)&&(h=n)}for(var f=0;u>f;++f)if(o.test(d[f])){for(var m=f+1;u>m&&o.test(d[m]);++m);for(var y="L"==(f?d[f-1]:c),b="L"==(u>m?d[m]:c),g=y||b?"L":"R",v=f;m>v;++v)d[v]=g;f=m-1}for(var k,x=[],f=0;u>f;)if(s.test(d[f])){var w=f;for(++f;u>f&&s.test(d[f]);++f);x.push(new t(0,w,f))}else{var _=f,C=x.length;for(++f;u>f&&"L"!=d[f];++f);for(var v=_;f>v;)if(l.test(d[v])){v>_&&x.splice(C,0,new t(1,_,v));var S=v;for(++v;f>v&&l.test(d[v]);++v);x.splice(C,0,new t(2,S,v)),_=v}else++v;f>_&&x.splice(C,0,new t(1,_,f))}return 1==x[0].level&&(k=r.match(/^\s+/))&&(x[0].from=k[0].length,x.unshift(new t(0,0,k[0].length))),1==Ii(x).level&&(k=r.match(/\s+$/))&&(Ii(x).to-=k[0].length,x.push(new t(0,u-k[0].length,u))),2==x[0].level&&x.unshift(new t(1,x[0].to,x[0].to)),x[0].level!=Ii(x).level&&x.push(new t(x[0].level,u,u)),x}}();return e.version="5.13.5",e}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.overlayMode=function(t,r,n){return{startState:function(){return{base:e.startState(t),overlay:e.startState(r),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(n){return{base:e.copyState(t,n.base),overlay:e.copyState(r,n.overlay),basePos:n.basePos,baseCur:null,overlayPos:n.overlayPos,overlayCur:null}},token:function(e,i){return(e!=i.streamSeen||Math.min(i.basePos,i.overlayPos)2){n.pending=[];for(var f=2;f-1)return e.Pass;var a=n.indent.length-1,s=t[n.state];e:for(;;){for(var c=0;ca?0:n.indent[a]}}e.defineSimpleMode=function(t,r){ +e.defineMode(t,function(t){return e.simpleMode(t,r)})},e.simpleMode=function(r,n){t(n,"start");var a={},s=n.meta||{},l=!1;for(var u in n)if(u!=s&&n.hasOwnProperty(u))for(var d=a[u]=[],f=n[u],p=0;p-1?i+t.length:i}var o=t.exec(r?e.slice(r):e);return o?o.index+r+(n?o[0].length:0):-1}var n=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:e.startState(t),innerActive:null,inner:null}},copyState:function(r){return{outer:e.copyState(t,r.outer),innerActive:r.innerActive,inner:r.innerActive&&e.copyState(r.innerActive.mode,r.inner)}},token:function(i,o){if(o.innerActive){var a=o.innerActive,s=i.string;if(!a.close&&i.sol())return o.innerActive=o.inner=null,this.token(i,o);var l=a.close?r(s,a.close,i.pos,a.parseDelimiters):-1;if(l==i.pos&&!a.parseDelimiters)return i.match(a.close),o.innerActive=o.inner=null,a.delimStyle&&a.delimStyle+" "+a.delimStyle+"-close";l>-1&&(i.string=s.slice(0,l));var c=a.mode.token(i,o.inner);return l>-1&&(i.string=s),l==i.pos&&a.parseDelimiters&&(o.innerActive=o.inner=null),a.innerStyle&&(c=c?c+" "+a.innerStyle:a.innerStyle),c}for(var u=1/0,s=i.string,d=0;dl&&(u=l)}u!=1/0&&(i.string=s.slice(0,u));var p=t.token(i,o.outer);return u!=1/0&&(i.string=s),p},indent:function(r,n){var i=r.innerActive?r.innerActive.mode:t;return i.indent?i.indent(r.innerActive?r.inner:r.outer,n):e.Pass},blankLine:function(r){var i=r.innerActive?r.innerActive.mode:t;if(i.blankLine&&i.blankLine(r.innerActive?r.inner:r.outer),r.innerActive)"\n"===r.innerActive.close&&(r.innerActive=r.inner=null);else for(var o=0;o-1)return u=r(l,c,u),{from:n(o.line,u),to:n(o.line,u+a.length)}}else{var l=e.getLine(o.line).slice(o.ch),c=s(l),u=c.indexOf(t);if(u>-1)return u=r(l,c,u)+o.ch,{from:n(o.line,u),to:n(o.line,u+a.length)}}}:function(){};else{var c=a.split("\n");this.matches=function(t,r){var i=l.length-1;if(t){if(r.line-(l.length-1)=1;--u,--a)if(l[u]!=s(e.getLine(a)))return;var d=e.getLine(a),f=d.length-c[0].length;if(s(d.slice(f))!=l[0])return;return{from:n(a,f),to:o}}if(!(r.line+(l.length-1)>e.lastLine())){var d=e.getLine(r.line),f=d.length-c[0].length;if(s(d.slice(f))==l[0]){for(var p=n(r.line,f),a=r.line+1,u=1;i>u;++u,++a)if(l[u]!=s(e.getLine(a)))return;if(s(e.getLine(a).slice(0,c[i].length))==l[i])return{from:p,to:n(a,c[i].length)}}}}}}}function r(e,t,r){if(e.length==t.length)return r;for(var n=Math.min(r,e.length);;){var i=e.slice(0,n).toLowerCase().length;if(r>i)++n;else{if(!(i>r))return n;--n}}}var n=e.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){function t(e){var t=n(e,0);return r.pos={from:t,to:t},r.atOccurrence=!1,!1}for(var r=this,i=this.doc.clipPos(e?this.pos.from:this.pos.to);;){if(this.pos=this.matches(e,i))return this.atOccurrence=!0,this.pos.match||!0;if(e){if(!i.line)return t(0);i=n(i.line-1,this.doc.getLine(i.line-1).length)}else{var o=this.doc.lineCount();if(i.line==o-1)return t(o);i=n(i.line+1,0)}}},from:function(){return this.atOccurrence?this.pos.from:void 0},to:function(){return this.atOccurrence?this.pos.to:void 0},replace:function(t,r){if(this.atOccurrence){var i=e.splitLines(t);this.doc.replaceRange(i,this.pos.from,this.pos.to,r),this.pos.to=n(this.pos.from.line+i.length-1,i[i.length-1].length+(1==i.length?this.pos.from.ch:0))}}},e.defineExtension("getSearchCursor",function(e,r,n){return new t(this.doc,e,r,n)}),e.defineDocExtension("getSearchCursor",function(e,r,n){return new t(this,e,r,n)}),e.defineExtension("selectMatches",function(t,r){for(var n=[],i=this.getSearchCursor(t,this.getCursor("from"),r);i.findNext()&&!(e.cmpPos(i.to(),this.getCursor("to"))>0);)n.push({anchor:i.from(),head:i.to()});n.length&&this.setSelections(n,0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return"string"==typeof e?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t?"gi":"g"):e.global||(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(t){e.lastIndex=t.pos;var r=e.exec(t.string);return r&&r.index==t.pos?(t.pos+=r[0].length||1,"searching"):void(r?t.pos=r.index:t.skipToEnd())}}}function r(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function n(e){return e.state.search||(e.state.search=new r)}function i(e){return"string"==typeof e&&e==e.toLowerCase()}function o(e,t,r){return e.getSearchCursor(t,r,i(t))}function a(e,t,r,n){e.openDialog(t,n,{value:r,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){h(e)}})}function s(e,t,r,n,i){e.openDialog?e.openDialog(t,i,{value:n,selectValueOnOpen:!0}):i(prompt(r,n))}function l(e,t,r,n){e.openConfirm?e.openConfirm(t,n):confirm(r)&&n[0]()}function c(e){return e.replace(/\\(.)/g,function(e,t){return"n"==t?"\n":"r"==t?"\r":t})}function u(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t)try{e=new RegExp(t[1],-1==t[2].indexOf("i")?"":"i")}catch(r){}else e=c(e);return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function d(e,r,n){r.queryText=n,r.query=u(n),e.removeOverlay(r.overlay,i(r.query)),r.overlay=t(r.query,i(r.query)),e.addOverlay(r.overlay),e.showMatchesOnScrollbar&&(r.annotate&&(r.annotate.clear(),r.annotate=null),r.annotate=e.showMatchesOnScrollbar(r.query,i(r.query)))}function f(t,r,i){var o=n(t);if(o.query)return p(t,r);var l=t.getSelection()||o.lastQuery;if(i&&t.openDialog){var c=null;a(t,v,l,function(r,n){e.e_stop(n),r&&(r!=o.queryText&&(d(t,o,r),o.posFrom=o.posTo=t.getCursor()),c&&(c.style.opacity=1),p(t,n.shiftKey,function(e,r){var n;r.line<3&&document.querySelector&&(n=t.display.wrapper.querySelector(".CodeMirror-dialog"))&&n.getBoundingClientRect().bottom-4>t.cursorCoords(r,"window").top&&((c=n).style.opacity=.4)}))})}else s(t,v,"Search for:",l,function(e){e&&!o.query&&t.operation(function(){d(t,o,e),o.posFrom=o.posTo=t.getCursor(),p(t,r)})})}function p(t,r,i){t.operation(function(){var a=n(t),s=o(t,a.query,r?a.posFrom:a.posTo);(s.find(r)||(s=o(t,a.query,r?e.Pos(t.lastLine()):e.Pos(t.firstLine(),0)),s.find(r)))&&(t.setSelection(s.from(),s.to()),t.scrollIntoView({from:s.from(),to:s.to()},20),a.posFrom=s.from(),a.posTo=s.to(),i&&i(s.from(),s.to()))})}function h(e){e.operation(function(){var t=n(e);t.lastQuery=t.query,t.query&&(t.query=t.queryText=null,e.removeOverlay(t.overlay),t.annotate&&(t.annotate.clear(),t.annotate=null))})}function m(e,t,r){e.operation(function(){for(var n=o(e,t);n.findNext();)if("string"!=typeof t){var i=e.getRange(n.from(),n.to()).match(t);n.replace(r.replace(/\$(\d)/g,function(e,t){return i[t]}))}else n.replace(r)})}function g(e,t){if(!e.getOption("readOnly")){var r=e.getSelection()||n(e).lastQuery,i=t?"Replace all:":"Replace:";s(e,i+y,i,r,function(r){r&&(r=u(r),s(e,b,"Replace with:","",function(n){if(n=c(n),t)m(e,r,n);else{h(e);var i=o(e,r,e.getCursor("from")),a=function(){var t,c=i.from();!(t=i.findNext())&&(i=o(e,r),!(t=i.findNext())||c&&i.from().line==c.line&&i.from().ch==c.ch)||(e.setSelection(i.from(),i.to()),e.scrollIntoView({from:i.from(),to:i.to()}),l(e,k,"Replace?",[function(){s(t)},a,function(){m(e,r,n)}]))},s=function(e){i.replace("string"==typeof r?n:n.replace(/\$(\d)/g,function(t,r){return e[r]})),a()};a()}}))})}}var v='Search: (Use /re/ syntax for regexp search)',y=' (Use /re/ syntax for regexp search)',b='With: ',k="Replace? ";e.commands.find=function(e){h(e),f(e)},e.commands.findPersistent=function(e){h(e),f(e,!1,!0)},e.commands.findNext=f,e.commands.findPrev=function(e){f(e,!0)},e.commands.clearSearch=h,e.commands.replace=g,e.commands.replaceAll=function(e){g(e,!0)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r,n,i){e.openDialog?e.openDialog(t,i,{value:n,selectValueOnOpen:!0}):i(prompt(r,n))}function r(e,t){var r=Number(t);return/^[-+]/.test(t)?e.getCursor().line+r:r-1}var n='Jump to line: (Use line:column or scroll% syntax)';e.commands.jumpToLine=function(e){var i=e.getCursor();t(e,n,"Jump to line:",i.line+1+":"+i.ch,function(t){if(t){var n;if(n=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(t))e.setCursor(r(e,n[1]),Number(n[2]));else if(n=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(t)){var o=Math.round(e.lineCount()*Number(n[1])/100);/^[-+]/.test(n[1])&&(o=i.line+o+1),e.setCursor(o-1,i.ch)}else(n=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(t))&&e.setCursor(r(e,n[1]),i.ch)}})},e.keyMap["default"]["Alt-G"]="jumpToLine"}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r,n){this.cm=e,this.options=n;var i={listenForChanges:!1};for(var o in n)i[o]=n[o];i.className||(i.className="CodeMirror-search-match"),this.annotation=e.annotateScrollbar(i),this.query=t,this.caseFold=r,this.gap={from:e.firstLine(),to:e.lastLine()+1},this.matches=[],this.update=null,this.findMatches(),this.annotation.update(this.matches);var a=this;e.on("change",this.changeHandler=function(e,t){a.onChange(t)})}function r(e,t,r){return t>=e?e:Math.max(t,e+r)}e.defineExtension("showMatchesOnScrollbar",function(e,r,n){return"string"==typeof n&&(n={className:n}),n||(n={}),new t(this,e,r,n)});var n=1e3;t.prototype.findMatches=function(){if(this.gap){for(var t=0;t=this.gap.to)break;r.to.line>=this.gap.from&&this.matches.splice(t--,1)}for(var i=this.cm.getSearchCursor(this.query,e.Pos(this.gap.from,0),this.caseFold),o=this.options&&this.options.maxMatches||n;i.findNext();){var r={from:i.from(),to:i.to()};if(r.from.line>=this.gap.to)break;if(this.matches.splice(t++,0,r),this.matches.length>o)break}this.gap=null}},t.prototype.onChange=function(t){var n=t.from.line,i=e.changeEnd(t).line,o=i-t.to.line;if(this.gap?(this.gap.from=Math.min(r(this.gap.from,n,o),t.from.line),this.gap.to=Math.max(r(this.gap.to,n,o),t.from.line)):this.gap={from:t.from.line,to:i+1},o)for(var a=0;al&&n(e,s.slice(l,c),r,t.style))}var u=e.getCursor("from"),d=e.getCursor("to");if(u.line==d.line&&(!t.wordsOnly||a(e,u,d))){var f=e.getRange(u,d).replace(/^\s+|\s+$/g,"");f.length>=t.minChars&&n(e,f,!1,t.style)}})}function a(e,t,r){var n=e.getRange(t,r);if(null!==n.match(/^\w+$/)){if(t.ch>0){var i={line:t.line,ch:t.ch-1},o=e.getRange(i,t);if(null===o.match(/\W/))return!1}if(r.chn.right?1:0:t.clientYn.bottom?1:0,o.moveTo(o.pos+r*o.screen)}),e.on(this.node,"mousewheel",i),e.on(this.node,"DOMMouseScroll",i)}function r(e,r,n){this.addClass=e,this.horiz=new t(e,"horizontal",n),r(this.horiz.node),this.vert=new t(e,"vertical",n),r(this.vert.node),this.width=null}t.prototype.setPos=function(e){return 0>e&&(e=0),e>this.total-this.screen&&(e=this.total-this.screen),e==this.pos?!1:(this.pos=e,this.inner.style["horizontal"==this.orientation?"left":"top"]=e*(this.size/this.total)+"px",!0)},t.prototype.moveTo=function(e){this.setPos(e)&&this.scroll(e,this.orientation)};var n=10;t.prototype.update=function(e,t,r){this.screen=t,this.total=e,this.size=r;var i=this.screen*(this.size/this.total);n>i&&(this.size-=n-i,i=n),this.inner.style["horizontal"==this.orientation?"width":"height"]=i+"px",this.setPos(this.pos)},r.prototype.update=function(e){if(null==this.width){var t=window.getComputedStyle?window.getComputedStyle(this.horiz.node):this.horiz.node.currentStyle;t&&(this.width=parseInt(t.height))}var r=this.width||0,n=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1;return this.vert.node.style.display=i?"block":"none",this.horiz.node.style.display=n?"block":"none",i&&(this.vert.update(e.scrollHeight,e.clientHeight,e.viewHeight-(n?r:0)),this.vert.node.style.bottom=n?r+"px":"0"),n&&(this.horiz.update(e.scrollWidth,e.clientWidth,e.viewWidth-(i?r:0)-e.barLeft),this.horiz.node.style.right=i?r+"px":"0",this.horiz.node.style.left=e.barLeft+"px"),{right:i?r:0,bottom:n?r:0}},r.prototype.setScrollTop=function(e){this.vert.setPos(e)},r.prototype.setScrollLeft=function(e){this.horiz.setPos(e)},r.prototype.clear=function(){var e=this.horiz.node.parentNode;e.removeChild(this.horiz.node),e.removeChild(this.vert.node)},e.scrollbarModel.simple=function(e,t){return new r("CodeMirror-simplescroll",e,t)},e.scrollbarModel.overlay=function(e,t){return new r("CodeMirror-overlayscroll",e,t)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){function r(e){clearTimeout(n.doRedraw),n.doRedraw=setTimeout(function(){n.redraw()},e)}this.cm=e,this.options=t,this.buttonHeight=t.scrollButtonHeight||e.getOption("scrollButtonHeight"),this.annotations=[],this.doRedraw=this.doUpdate=null,this.div=e.getWrapperElement().appendChild(document.createElement("div")),this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none",this.computeScale();var n=this;e.on("refresh",this.resizeHandler=function(){clearTimeout(n.doUpdate),n.doUpdate=setTimeout(function(){n.computeScale()&&r(20)},100)}),e.on("markerAdded",this.resizeHandler),e.on("markerCleared",this.resizeHandler),t.listenForChanges!==!1&&e.on("change",this.changeHandler=function(){r(250)})}e.defineExtension("annotateScrollbar",function(e){return"string"==typeof e&&(e={className:e}),new t(this,e)}),e.defineOption("scrollButtonHeight",0),t.prototype.computeScale=function(){var e=this.cm,t=(e.getWrapperElement().clientHeight-e.display.barHeight-2*this.buttonHeight)/e.getScrollerElement().scrollHeight;return t!=this.hScale?(this.hScale=t,!0):void 0},t.prototype.update=function(e){this.annotations=e,this.redraw()},t.prototype.redraw=function(e){function t(e,t){if(l!=e.line&&(l=e.line,c=r.getLineHandle(l)),a&&c.height>s)return r.charCoords(e,"local")[t?"top":"bottom"];var n=r.heightAtLine(c,"local");return n+(t?0:c.height)}e!==!1&&this.computeScale();var r=this.cm,n=this.hScale,i=document.createDocumentFragment(),o=this.annotations,a=r.getOption("lineWrapping"),s=a&&1.5*r.defaultTextHeight(),l=null,c=null;if(r.display.barWidth)for(var u,d=0;dh+.9));)f=o[++d],h=t(f.to,!1)*n;if(h!=p){var m=Math.max(h-p,3),g=i.appendChild(document.createElement("div"));g.style.cssText="position: absolute; right: 0px; width: "+Math.max(1.5*r.display.barWidth,2)+"px; top: "+(p+this.buttonHeight)+"px; height: "+m+"px",g.className=this.options.className,f.id&&g.setAttribute("annotation-id",f.id)}}this.div.textContent="",this.div.appendChild(i)},t.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("change",this.changeHandler),this.div.parentNode.removeChild(this.div)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,r,n){this.cm=e,this.node=t,this.options=r,this.height=n,this.cleared=!1}function r(e){var t=e.getWrapperElement(),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n=parseInt(r.height),i=e.state.panels={setHeight:t.style.height,heightLeft:n,panels:0,wrapper:document.createElement("div")};t.parentNode.insertBefore(i.wrapper,t);var o=e.hasFocus();i.wrapper.appendChild(t),o&&e.focus(),e._setSize=e.setSize,null!=n&&(e.setSize=function(t,r){if(null==r)return this._setSize(t,r);if(i.setHeight=r,"number"!=typeof r){var o=/^(\d+\.?\d*)px$/.exec(r);o?r=Number(o[1]):(i.wrapper.style.height=r,r=i.wrapper.offsetHeight,i.wrapper.style.height="")}e._setSize(t,i.heightLeft+=r-n),n=r})}function n(e){var t=e.state.panels;e.state.panels=null;var r=e.getWrapperElement();t.wrapper.parentNode.replaceChild(r,t.wrapper),r.style.height=t.setHeight,e.setSize=e._setSize,e.setSize()}e.defineExtension("addPanel",function(e,n){n=n||{},this.state.panels||r(this);var i=this.state.panels,o=i.wrapper,a=this.getWrapperElement();n.after instanceof t&&!n.after.cleared?o.insertBefore(e,n.before.node.nextSibling):n.before instanceof t&&!n.before.cleared?o.insertBefore(e,n.before.node):n.replace instanceof t&&!n.replace.cleared?(o.insertBefore(e,n.replace.node),n.replace.clear()):"bottom"==n.position?o.appendChild(e):"before-bottom"==n.position?o.insertBefore(e,a.nextSibling):"after-top"==n.position?o.insertBefore(e,a):o.insertBefore(e,o.firstChild);var s=n&&n.height||e.offsetHeight;return this._setSize(null,i.heightLeft-=s),i.panels++,new t(this,e,n,s)}),t.prototype.clear=function(){if(!this.cleared){this.cleared=!0;var e=this.cm.state.panels;this.cm._setSize(null,e.heightLeft+=this.height),e.wrapper.removeChild(this.node),0==--e.panels&&n(this.cm)}},t.prototype.changed=function(e){var t=null==e?this.node.offsetHeight:e,r=this.cm.state.panels;this.cm._setSize(null,r.height+=t-this.height),this.height=t}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e){e.state.placeholder&&(e.state.placeholder.parentNode.removeChild(e.state.placeholder),e.state.placeholder=null)}function r(e){t(e);var r=e.state.placeholder=document.createElement("pre");r.style.cssText="height: 0; overflow: visible",r.className="CodeMirror-placeholder";var n=e.getOption("placeholder");"string"==typeof n&&(n=document.createTextNode(n)),r.appendChild(n),e.display.lineSpace.insertBefore(r,e.display.lineSpace.firstChild)}function n(e){o(e)&&r(e)}function i(e){var n=e.getWrapperElement(),i=o(e);n.className=n.className.replace(" CodeMirror-empty","")+(i?" CodeMirror-empty":""),i?r(e):t(e)}function o(e){return 1===e.lineCount()&&""===e.getLine(0)}e.defineOption("placeholder","",function(r,o,a){var s=a&&a!=e.Init;if(o&&!s)r.on("blur",n),r.on("change",i),r.on("swapDoc",i),i(r);else if(!o&&s){r.off("blur",n),r.off("change",i),r.off("swapDoc",i),t(r);var l=r.getWrapperElement();l.className=l.className.replace(" CodeMirror-empty","")}o&&!r.hasFocus()&&n(r)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){var t=e.getWrapperElement();e.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:t.style.width,height:t.style.height},t.style.width="",t.style.height="auto",t.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",e.refresh()}function r(e){var t=e.getWrapperElement();t.className=t.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var r=e.state.fullScreenRestore;t.style.width=r.width,t.style.height=r.height,window.scrollTo(r.scrollLeft,r.scrollTop),e.refresh()}e.defineOption("fullScreen",!1,function(n,i,o){o==e.Init&&(o=!1),!o!=!i&&(i?t(n):r(n))})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t,n){function i(){t.display.wrapper.offsetHeight?(r(t,n),t.display.lastWrapHeight!=t.display.wrapper.clientHeight&&t.refresh()):n.timeout=setTimeout(i,n.delay)}n.timeout=setTimeout(i,n.delay),n.hurry=function(){clearTimeout(n.timeout),n.timeout=setTimeout(i,50)},e.on(window,"mouseup",n.hurry),e.on(window,"keyup",n.hurry)}function r(t,r){clearTimeout(r.timeout),e.off(window,"mouseup",r.hurry),e.off(window,"keyup",r.hurry)}e.defineOption("autoRefresh",!1,function(e,n){e.state.autoRefresh&&(r(e,e.state.autoRefresh),e.state.autoRefresh=null),n&&0==e.display.wrapper.offsetHeight&&t(e,e.state.autoRefresh={delay:n.delay||250})})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,r){var n,i=e.getWrapperElement();return n=i.appendChild(document.createElement("div")),n.className=r?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof t?n.innerHTML=t:n.appendChild(t),n}function r(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}e.defineExtension("openDialog",function(n,i,o){function a(e){if("string"==typeof e)d.value=e;else{if(c)return;c=!0,l.parentNode.removeChild(l),u.focus(),o.onClose&&o.onClose(l)}}o||(o={}),r(this,null);var s,l=t(this,n,o.bottom),c=!1,u=this,d=l.getElementsByTagName("input")[0];return d?(d.focus(),o.value&&(d.value=o.value,o.selectValueOnOpen!==!1&&d.select()),o.onInput&&e.on(d,"input",function(e){o.onInput(e,d.value,a)}),o.onKeyUp&&e.on(d,"keyup",function(e){o.onKeyUp(e,d.value,a)}),e.on(d,"keydown",function(t){o&&o.onKeyDown&&o.onKeyDown(t,d.value,a)||((27==t.keyCode||o.closeOnEnter!==!1&&13==t.keyCode)&&(d.blur(),e.e_stop(t),a()),13==t.keyCode&&i(d.value,t))}),o.closeOnBlur!==!1&&e.on(d,"blur",a)):(s=l.getElementsByTagName("button")[0])&&(e.on(s,"click",function(){a(),u.focus()}),o.closeOnBlur!==!1&&e.on(s,"blur",a),s.focus()),a}),e.defineExtension("openConfirm",function(n,i,o){function a(){c||(c=!0,s.parentNode.removeChild(s),u.focus())}r(this,null);var s=t(this,n,o&&o.bottom),l=s.getElementsByTagName("button"),c=!1,u=this,d=1;l[0].focus();for(var f=0;f=d&&a()},200)}),e.on(p,"focus",function(){++d})}}),e.defineExtension("openNotification",function(n,i){function o(){l||(l=!0,clearTimeout(a),s.parentNode.removeChild(s))}r(this,o);var a,s=t(this,n,i&&i.bottom),l=!1,c=i&&"undefined"!=typeof i.duration?i.duration:5e3;return e.on(s,"click",function(t){e.e_preventDefault(t),o()}),c&&(a=setTimeout(o,c)),o})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,n,i){var o=e.getLineHandle(t.line),l=t.ch-1,c=l>=0&&s[o.text.charAt(l)]||s[o.text.charAt(++l)];if(!c)return null;var u=">"==c.charAt(1)?1:-1;if(n&&u>0!=(l==t.ch))return null;var d=e.getTokenTypeAt(a(t.line,l+1)),f=r(e,a(t.line,l+(u>0?1:0)),u,d||null,i);return null==f?null:{from:a(t.line,l),to:f&&f.pos,match:f&&f.ch==c.charAt(0),forward:u>0}}function r(e,t,r,n,i){for(var o=i&&i.maxScanLineLength||1e4,l=i&&i.maxScanLines||1e3,c=[],u=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,d=r>0?Math.min(t.line+l,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-l),f=t.line;f!=d;f+=r){var p=e.getLine(f);if(p){var h=r>0?0:p.length-1,m=r>0?p.length:-1;if(!(p.length>o))for(f==t.line&&(h=t.ch-(0>r?1:0));h!=m;h+=r){var g=p.charAt(h);if(u.test(g)&&(void 0===n||e.getTokenTypeAt(a(f,h+1))==n)){var v=s[g];if(">"==v.charAt(1)==r>0)c.push(g);else{if(!c.length)return{ +pos:a(f,h),ch:g};c.pop()}}}}}return f-r==(r>0?e.lastLine():e.firstLine())?!1:null}function n(e,r,n){for(var i=e.state.matchBrackets.maxHighlightLineLength||1e3,s=[],l=e.listSelections(),c=0;c",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},l=null;e.defineOption("matchBrackets",!1,function(t,r,n){n&&n!=e.Init&&t.off("cursorActivity",i),r&&(t.state.matchBrackets="object"==typeof r?r:{},t.on("cursorActivity",i))}),e.defineExtension("matchBrackets",function(){n(this,!0)}),e.defineExtension("findMatchingBracket",function(e,r,n){return t(this,e,r,n)}),e.defineExtension("scanForBracket",function(e,t,n,i){return r(this,e,t,n,i)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t){return"pairs"==t&&"string"==typeof e?e:"object"==typeof e&&null!=e[t]?e[t]:d[t]}function r(e){return function(t){return s(t,e)}}function n(e){var t=e.state.closeBrackets;if(!t)return null;var r=e.getModeAt(e.getCursor());return r.closeBrackets||t}function i(r){var i=n(r);if(!i||r.getOption("disableInput"))return e.Pass;for(var o=t(i,"pairs"),a=r.listSelections(),s=0;s=0;s--){var u=a[s].head;r.replaceRange("",f(u.line,u.ch-1),f(u.line,u.ch+1),"+delete")}}function o(r){var i=n(r),o=i&&t(i,"explode");if(!o||r.getOption("disableInput"))return e.Pass;for(var a=r.listSelections(),s=0;s0;return{anchor:new f(t.anchor.line,t.anchor.ch+(r?-1:1)),head:new f(t.head.line,t.head.ch+(r?1:-1))}}function s(r,i){var o=n(r);if(!o||r.getOption("disableInput"))return e.Pass;var s=t(o,"pairs"),c=s.indexOf(i);if(-1==c)return e.Pass;for(var d,p,h=t(o,"triples"),m=s.charAt(c+1)==i,g=r.listSelections(),v=c%2==0,y=0;y1&&h.indexOf(i)>=0&&r.getRange(f(x.line,x.ch-2),x)==i+i&&(x.ch<=2||r.getRange(f(x.line,x.ch-3),f(x.line,x.ch-2))!=i))b="addFour";else if(m){if(e.isWordChar(p)||!u(r,x,i))return e.Pass;b="both"}else{if(!v||r.getLine(x.line).length!=x.ch&&!l(p,s)&&!/\s/.test(p))return e.Pass;b="both"}else b=h.indexOf(i)>=0&&r.getRange(x,f(x.line,x.ch+3))==i+i+i?"skipThree":"skip";if(d){if(d!=b)return e.Pass}else d=b}var w=c%2?s.charAt(c-1):i,_=c%2?i:s.charAt(c+1);r.operation(function(){if("skip"==d)r.execCommand("goCharRight");else if("skipThree"==d)for(var e=0;3>e;e++)r.execCommand("goCharRight");else if("surround"==d){for(var t=r.getSelections(),e=0;e-1&&r%2==1}function c(e,t){var r=e.getRange(f(t.line,t.ch-1),f(t.line,t.ch+1));return 2==r.length?r:null}function u(t,r,n){var i=t.getLine(r.line),o=t.getTokenAt(r);if(/\bstring2?\b/.test(o.type))return!1;var a=new e.StringStream(i.slice(0,r.ch)+n+i.slice(r.ch),4);for(a.pos=a.start=o.start;;){var s=t.getMode().token(a,o.state);if(a.pos>=r.ch+1)return/\bstring2?\b/.test(s);a.start=a.pos}}var d={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},f=e.Pos;e.defineOption("autoCloseBrackets",!1,function(t,r,n){n&&n!=e.Init&&(t.removeKeyMap(h),t.state.closeBrackets=null),r&&(t.state.closeBrackets=r,t.addKeyMap(h))});for(var p=d.pairs+"`",h={Backspace:i,Enter:o},m=0;mc.ch&&(v=v.slice(0,v.length-u.end+c.ch));var y=v.toLowerCase();if(!v||"string"==u.type&&(u.end!=c.ch||!/[\"\']/.test(u.string.charAt(u.string.length-1))||1==u.string.length)||"tag"==u.type&&"closeTag"==f.type||u.string.indexOf("/")==u.string.length-1||m&&i(m,y)>-1||o(t,v,c,f,!0))return e.Pass;var b=g&&i(g,y)>-1;n[l]={indent:b,text:">"+(b?"\n\n":"")+"",newPos:b?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var l=r.length-1;l>=0;l--){var k=n[l];t.replaceRange(k.text,r[l].head,r[l].anchor,"+insert");var x=t.listSelections().slice(0);x[l]={head:k.newPos,anchor:k.newPos},t.setSelections(x),k.indent&&(t.indentLine(k.newPos.line,null,!0),t.indentLine(k.newPos.line+1,null,!0))}}function r(t,r){for(var n=t.listSelections(),i=[],a=r?"/":""!=t.getLine(l.line).charAt(c.end)&&(f+=">"),i[s]=f}t.replaceSelections(i),n=t.listSelections();for(var s=0;sr;++r)if(e[r]==t)return r;return-1}function o(t,r,n,i,o){if(!e.scanForClosingTag)return!1;var a=Math.min(t.lastLine()+1,n.line+500),s=e.scanForClosingTag(t,n,null,a);if(!s||s.tag!=r)return!1;for(var l=i.context,c=o?1:0;l&&l.tagName==r;l=l.prev)++c;n=s.to;for(var u=1;c>u;u++){var d=e.scanForClosingTag(t,n,null,a);if(!d||d.tag!=r)return!1;n=d.to}return!0}e.defineOption("autoCloseTags",!1,function(r,i,o){if(o!=e.Init&&o&&r.removeKeyMap("autoCloseTags"),i){var a={name:"autoCloseTags"};("object"!=typeof i||i.whenClosing)&&(a["'/'"]=function(e){return n(e)}),("object"!=typeof i||i.whenOpening)&&(a["'>'"]=function(e){return t(e)}),r.addKeyMap(a)}});var a=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],s=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];e.commands.closeTag=function(e){return r(e)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t=/^(\s*)(>[> ]*|[*+-]\s|(\d+)([.)]))(\[\s\]\s|\[x\]\s|\s*)/,r=/^(\s*)(>[> ]*|[*+-]\s|(\d+)[.)])(\[\s\]\s*|\[x\]\s|\s*)$/,n=/[*+-]\s/;e.commands.newlineAndIndentContinueMarkdownList=function(i){if(i.getOption("disableInput"))return e.Pass;for(var o=i.listSelections(),a=[],s=0;s")>=0?p[2]:parseInt(p[3],10)+1+p[4];m=m.replace("[x]","[ ]"),a[s]="\n"+h+g+m}}i.replaceSelections(a)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){var t=e.search(i);return-1==t?0:t}function r(e,t,r){return/\bstring\b/.test(e.getTokenTypeAt(o(t.line,0)))&&!/^[\'\"`]/.test(r)}var n={},i=/[^\s\u00a0]/,o=e.Pos;e.commands.toggleComment=function(e){e.toggleComment()},e.defineExtension("toggleComment",function(e){e||(e=n);for(var t=this,r=1/0,i=this.listSelections(),a=null,s=i.length-1;s>=0;s--){var l=i[s].from(),c=i[s].to();l.line>=r||(c.line>=r&&(c=o(r,0)),r=l.line,null==a?t.uncomment(l,c,e)?a="un":(t.lineComment(l,c,e),a="line"):"un"==a?t.uncomment(l,c,e):t.lineComment(l,c,e))}}),e.defineExtension("lineComment",function(e,a,s){s||(s=n);var l=this,c=l.getModeAt(e),u=l.getLine(e.line);if(null!=u&&!r(l,e,u)){var d=s.lineComment||c.lineComment;if(!d)return void((s.blockCommentStart||c.blockCommentStart)&&(s.fullLines=!0,l.blockComment(e,a,s)));var f=Math.min(0!=a.ch||a.line==e.line?a.line+1:a.line,l.lastLine()+1),p=null==s.padding?" ":s.padding,h=s.commentBlankLines||e.line==a.line;l.operation(function(){if(s.indent){for(var r=null,n=e.line;f>n;++n){var a=l.getLine(n),c=a.slice(0,t(a));(null==r||r.length>c.length)&&(r=c)}for(var n=e.line;f>n;++n){var a=l.getLine(n),u=r.length;(h||i.test(a))&&(a.slice(0,u)!=r&&(u=t(a)),l.replaceRange(r+d+p,o(n,0),o(n,u)))}}else for(var n=e.line;f>n;++n)(h||i.test(l.getLine(n)))&&l.replaceRange(d+p,o(n,0))})}}),e.defineExtension("blockComment",function(e,t,r){r||(r=n);var a=this,s=a.getModeAt(e),l=r.blockCommentStart||s.blockCommentStart,c=r.blockCommentEnd||s.blockCommentEnd;if(!l||!c)return void((r.lineComment||s.lineComment)&&0!=r.fullLines&&a.lineComment(e,t,r));var u=Math.min(t.line,a.lastLine());u!=e.line&&0==t.ch&&i.test(a.getLine(u))&&--u;var d=null==r.padding?" ":r.padding;e.line>u||a.operation(function(){if(0!=r.fullLines){var n=i.test(a.getLine(u));a.replaceRange(d+c,o(u)),a.replaceRange(l+d,o(e.line,0));var f=r.blockCommentLead||s.blockCommentLead;if(null!=f)for(var p=e.line+1;u>=p;++p)(p!=u||n)&&a.replaceRange(f+d,o(p,0))}else a.replaceRange(c,t),a.replaceRange(l,e)})}),e.defineExtension("uncomment",function(e,t,r){r||(r=n);var a,s=this,l=s.getModeAt(e),c=Math.min(0!=t.ch||t.line==e.line?t.line:t.line-1,s.lastLine()),u=Math.min(e.line,c),d=r.lineComment||l.lineComment,f=[],p=null==r.padding?" ":r.padding;e:if(d){for(var h=u;c>=h;++h){var m=s.getLine(h),g=m.indexOf(d);if(g>-1&&!/comment/.test(s.getTokenTypeAt(o(h,g+1)))&&(g=-1),-1==g&&(h!=c||h==u)&&i.test(m))break e;if(g>-1&&i.test(m.slice(0,g)))break e;f.push(m)}if(s.operation(function(){for(var e=u;c>=e;++e){var t=f[e-u],r=t.indexOf(d),n=r+d.length;0>r||(t.slice(n,n+p.length)==p&&(n+=p.length),a=!0,s.replaceRange("",o(e,r),o(e,n)))}}),a)return!0}var v=r.blockCommentStart||l.blockCommentStart,y=r.blockCommentEnd||l.blockCommentEnd;if(!v||!y)return!1;var b=r.blockCommentLead||l.blockCommentLead,k=s.getLine(u),x=c==u?k:s.getLine(c),w=k.indexOf(v),_=x.lastIndexOf(y);if(-1==_&&u!=c&&(x=s.getLine(--c),_=x.lastIndexOf(y)),-1==w||-1==_||!/comment/.test(s.getTokenTypeAt(o(u,w+1)))||!/comment/.test(s.getTokenTypeAt(o(c,_+1))))return!1;var C=k.lastIndexOf(v,e.ch),S=-1==C?-1:k.slice(0,e.ch).indexOf(y,C+v.length);if(-1!=C&&-1!=S&&S+y.length!=e.ch)return!1;S=x.indexOf(y,t.ch);var M=x.slice(t.ch).lastIndexOf(v,S-t.ch);return C=-1==S||-1==M?-1:t.ch+M,-1!=S&&-1!=C&&C!=t.ch?!1:(s.operation(function(){s.replaceRange("",o(c,_-(p&&x.slice(_-p.length,_)==p?p.length:0)),o(c,_+y.length));var e=w+v.length;if(p&&k.slice(e,e+p.length)==p&&(e+=p.length),s.replaceRange("",o(u,w),o(u,e)),b)for(var t=u+1;c>=t;++t){var r=s.getLine(t),n=r.indexOf(b);if(-1!=n&&!i.test(r.slice(0,n))){var a=n+b.length;p&&r.slice(a,a+p.length)==p&&(a+=p.length),s.replaceRange("",o(t,n),o(t,a))}}}),!0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var n,i=t.listSelections(),o=[],a=0;a=f);else if(0==l.string.indexOf(n.blockCommentStart)){if(u=p.slice(0,l.start),!/^\s*$/.test(u)){u="";for(var h=0;hl.start&&/^\s*$/.test(p.slice(0,d))&&(u=p.slice(0,d));null!=u&&(u+=n.blockCommentContinue)}if(null==u&&n.lineComment&&r(t)){var m=t.getLine(s.line),d=m.indexOf(n.lineComment);d>-1&&(u=m.slice(0,d),/\S/.test(u)?u=null:u+=n.lineComment+m.slice(d+n.lineComment.length).match(/^\s*/)[0])}if(null==u)return e.Pass;o[a]="\n"+u}t.operation(function(){for(var e=i.length-1;e>=0;e--)t.replaceRange(o[e],i[e].from(),i[e].to(),"+insert")})}function r(e){var t=e.getOption("continueComments");return t&&"object"==typeof t?t.continueLineComment!==!1:!0}for(var n=["clike","css","javascript"],i=0;io;--i){var a=e.getLine(i);if(n&&n.test(a))break;if(!/\S/.test(a)){++i;break}}for(var s=r.paragraphEnd||e.getHelper(t,"paragraphEnd"),l=t.line+1,c=e.lastLine();c>=l;++l){var a=e.getLine(l);if(s&&s.test(a)){++l;break}if(!/\S/.test(a))break}return{from:i,to:l}}function r(e,t,r,n){for(var i=t;i>0&&!r.test(e.slice(i-1,i+1));--i);for(var o=!0;;o=!1){var a=i;if(n)for(;" "==e.charAt(a-1);)--a;if(0!=a||!o)return{from:a,to:i};i=t}}function n(t,n,o,a){n=t.clipPos(n),o=t.clipPos(o);var s=a.column||80,l=a.wrapOn||/\s\S|-[^\.\d]/,c=a.killTrailingSpace!==!1,u=[],d="",f=n.line,p=t.getRange(n,o,!1);if(!p.length)return null;for(var h=p[0].match(/^[ \t]*/)[0],m=0;ms&&h==b&&r(d,s,l,c);k&&k.from==v&&k.to==v+y?(d=h+g,++f):u.push({text:[y?" ":""],from:i(f,v),to:i(f+1,b.length)})}for(;d.length>s;){var x=r(d,s,l,c);u.push({text:["",h],from:i(f,x.from),to:i(f,x.to)}),d=h+d.slice(x.to),++f}}return u.length&&t.operation(function(){for(var r=0;r=0;a--){var s,l=r[a];if(l.empty()){var c=t(e,l.head,{});s={from:i(c.from,0),to:i(c.to-1)}}else s={from:l.from(),to:l.to()};s.to.line>=o||(o=s.from.line,n(e,s.from,s.to,{}))}})},e.defineExtension("wrapRange",function(e,t,r){return n(this,e,t,r||{})}),e.defineExtension("wrapParagraphsInRange",function(e,r,o){o=o||{};for(var a=this,s=[],l=e.line;l<=r.line;){var c=t(a,i(l,0),o);s.push(c),l=c.to}var u=!1;return s.length&&a.operation(function(){for(var e=s.length-1;e>=0;--e)u=u||n(a,i(s[e].from,0),i(s[e].to-1),o)}),u})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t,i,o,a){function s(e){var r=l(t,i);if(!r||r.to.line-r.from.linet.firstLine();)i=e.Pos(i.line-1,0),u=s(!1);if(u&&!u.cleared&&"unfold"!==a){var d=r(t,o);e.on(d,"mousedown",function(t){f.clear(),e.e_preventDefault(t)});var f=t.markText(u.from,u.to,{replacedWith:d,clearOnEnter:!0,__isFold:!0});f.on("clear",function(r,n){e.signal(t,"unfold",t,r,n)}),e.signal(t,"fold",t,u.from,u.to)}}function r(e,t){var r=n(e,t,"widget");if("string"==typeof r){var i=document.createTextNode(r);r=document.createElement("span"),r.appendChild(i),r.className="CodeMirror-foldmarker"}return r}function n(e,t,r){if(t&&void 0!==t[r])return t[r];var n=e.options.foldOptions;return n&&void 0!==n[r]?n[r]:i[r]}e.newFoldFunction=function(e,r){return function(n,i){t(n,i,{rangeFinder:e,widget:r})}},e.defineExtension("foldCode",function(e,r,n){t(this,e,r,n)}),e.defineExtension("isFolded",function(e){for(var t=this.findMarksAt(e),r=0;r=r;r++)t.foldCode(e.Pos(r,0),null,"fold")})},e.commands.unfoldAll=function(t){t.operation(function(){for(var r=t.firstLine(),n=t.lastLine();n>=r;r++)t.foldCode(e.Pos(r,0),null,"unfold")})},e.registerHelper("fold","combine",function(){var e=Array.prototype.slice.call(arguments,0);return function(t,r){for(var n=0;n=i?-1:s.lastIndexOf(n,i-1);if(-1!=c){if(1==l&&c=h;++h)for(var m=t.getLine(h),g=h==a?i:0;;){var v=m.indexOf(l,g),y=m.indexOf(c,g);if(0>v&&(v=m.length),0>y&&(y=m.length),g=Math.min(v,y),g==m.length)break;if(t.getTokenTypeAt(e.Pos(h,g+1))==o)if(g==v)++f;else if(!--f){u=h,d=g;break e}++g}if(null!=u&&(a!=u||d!=i))return{from:e.Pos(a,i),to:e.Pos(u,d)}}}),e.registerHelper("fold","import",function(t,r){function n(r){if(rt.lastLine())return null;var n=t.getTokenAt(e.Pos(r,1));if(/\S/.test(n.string)||(n=t.getTokenAt(e.Pos(r,n.end+1))),"keyword"!=n.type||"import"!=n.string)return null;for(var i=r,o=Math.min(t.lastLine(),r+10);o>=i;++i){var a=t.getLine(i),s=a.indexOf(";");if(-1!=s)return{startCh:n.end,end:e.Pos(i,s)}}}var i,r=r.line,o=n(r);if(!o||n(r-1)||(i=n(r-2))&&i.end.line==r-1)return null;for(var a=o.end;;){var s=n(a.line+1);if(null==s)break;a=s.end}return{from:t.clipPos(e.Pos(r,o.startCh+1)),to:a}}),e.registerHelper("fold","include",function(t,r){function n(r){if(rt.lastLine())return null;var n=t.getTokenAt(e.Pos(r,1));return/\S/.test(n.string)||(n=t.getTokenAt(e.Pos(r,n.end+1))),"meta"==n.type&&"#include"==n.string.slice(0,8)?n.start+8:void 0}var r=r.line,i=n(r);if(null==i||null!=n(r-1))return null;for(var o=r;;){var a=n(o+1);if(null==a)break;++o}return{from:e.Pos(r,i+1),to:t.clipPos(e.Pos(o))}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],e):e(CodeMirror)}(function(e){"use strict";function t(e){this.options=e,this.from=this.to=0}function r(e){return e===!0&&(e={}),null==e.gutter&&(e.gutter="CodeMirror-foldgutter"),null==e.indicatorOpen&&(e.indicatorOpen="CodeMirror-foldgutter-open"),null==e.indicatorFolded&&(e.indicatorFolded="CodeMirror-foldgutter-folded"),e}function n(e,t){for(var r=e.findMarksAt(d(t)),n=0;n=s&&(r=i(o.indicatorOpen))}e.setGutterMarker(t,o.gutter,r),++a})}function a(e){var t=e.getViewport(),r=e.state.foldGutter;r&&(e.operation(function(){o(e,t.from,t.to)}),r.from=t.from,r.to=t.to)}function s(e,t,r){var i=e.state.foldGutter;if(i){var o=i.options;if(r==o.gutter){var a=n(e,t);a?a.clear():e.foldCode(d(t,0),o.rangeFinder)}}}function l(e){var t=e.state.foldGutter;if(t){var r=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){a(e)},r.foldOnChangeTimeSpan||600)}}function c(e){var t=e.state.foldGutter;if(t){var r=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var r=e.getViewport();t.from==t.to||r.from-t.to>20||t.from-r.to>20?a(e):e.operation(function(){r.fromt.to&&(o(e,t.to,r.to),t.to=r.to)})},r.updateViewportTimeSpan||400)}}function u(e,t){var r=e.state.foldGutter;if(r){var n=t.line;n>=r.from&&nu&&!(i(u+1,s,d)<=l);)++u,s=d,d=t.getLine(u+2);return{from:e.Pos(r.line,a.length),to:e.Pos(u,t.getLine(u).length)}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return e.line-t.line||e.ch-t.ch}function r(e,t,r,n){this.line=t,this.ch=r,this.cm=e,this.text=e.getLine(t),this.min=n?n.from:e.firstLine(),this.max=n?n.to-1:e.lastLine()}function n(e,t){var r=e.cm.getTokenTypeAt(f(e.line,t));return r&&/\btag\b/.test(r)}function i(e){return e.line>=e.max?void 0:(e.ch=0,e.text=e.cm.getLine(++e.line),!0)}function o(e){return e.line<=e.min?void 0:(e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0)}function a(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(i(e))continue;return}{if(n(e,t+1)){var r=e.text.lastIndexOf("/",t),o=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,o?"selfClose":"regular"}e.ch=t+1}}}function s(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(o(e))continue;return}if(n(e,t+1)){m.lastIndex=t,e.ch=t;var r=m.exec(e.text);if(r&&r.index==t)return r}else e.ch=t}}function l(e){for(;;){m.lastIndex=e.ch;var t=m.exec(e.text);if(!t){if(i(e))continue;return}{if(n(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}}function c(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(o(e))continue;return}{if(n(e,t+1)){var r=e.text.lastIndexOf("/",t),i=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,i?"selfClose":"regular"}e.ch=t}}}function u(e,t){for(var r=[];;){var n,i=l(e),o=e.line,s=e.ch-(i?i[0].length:0);if(!i||!(n=a(e)))return;if("selfClose"!=n)if(i[1]){for(var c=r.length-1;c>=0;--c)if(r[c]==i[2]){r.length=c;break}if(0>c&&(!t||t==i[2]))return{tag:i[2],from:f(o,s),to:f(e.line,e.ch)}}else r.push(i[2])}}function d(e,t){for(var r=[];;){var n=c(e);if(!n)return;if("selfClose"!=n){var i=e.line,o=e.ch,a=s(e);if(!a)return;if(a[1])r.push(a[2]);else{for(var l=r.length-1;l>=0;--l)if(r[l]==a[2]){r.length=l;break}if(0>l&&(!t||t==a[2]))return{tag:a[2],from:f(e.line,e.ch),to:f(i,o)}}}else s(e)}}var f=e.Pos,p="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",h=p+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",m=new RegExp("<(/?)(["+p+"]["+h+"]*)","g");e.registerHelper("fold","xml",function(e,t){for(var n=new r(e,t.line,0);;){var i,o=l(n);if(!o||n.line!=t.line||!(i=a(n)))return;if(!o[1]&&"selfClose"!=i){var t=f(n.line,n.ch),s=u(n,o[2]);return s&&{from:t,to:s.from}}}}),e.findMatchingTag=function(e,n,i){var o=new r(e,n.line,n.ch,i);if(-1!=o.text.indexOf(">")||-1!=o.text.indexOf("<")){var l=a(o),c=l&&f(o.line,o.ch),p=l&&s(o);if(l&&p&&!(t(o,n)>0)){var h={from:f(o.line,o.ch),to:c,tag:p[2]};return"selfClose"==l?{open:h,close:null,at:"open"}:p[1]?{open:d(o,p[2]),close:h,at:"close"}:(o=new r(e,c.line,c.ch,i),{open:h,close:u(o,p[2]),at:"open"})}}},e.findEnclosingTag=function(e,t,n){for(var i=new r(e,t.line,t.ch,n);;){var o=d(i);if(!o)break;var a=new r(e,t.line,t.ch,n),s=u(a,o.tag);if(s)return{open:o,close:s}}},e.scanForClosingTag=function(e,t,n,i){var o=new r(e,t.line,t.ch,i?{from:0,to:i}:null);return u(o,n)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},r={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1};e.defineMode("xml",function(n,i){function o(e,t){function r(r){return t.tokenize=r,r(e,t)}var n=e.next();if("<"==n)return e.eat("!")?e.eat("[")?e.match("CDATA[")?r(l("atom","]]>")):null:e.match("--")?r(l("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),r(c(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=l("meta","?>"),"meta"):(M=e.eat("/")?"closeTag":"openTag",t.tokenize=a,"tag bracket");if("&"==n){var i;return i=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),i?"atom":"error"}return e.eatWhile(/[^&<]/),null}function a(e,t){var r=e.next();if(">"==r||"/"==r&&e.eat(">"))return t.tokenize=o,M=">"==r?"endTag":"selfcloseTag","tag bracket";if("="==r)return M="equals",null;if("<"==r){t.tokenize=o,t.state=p,t.tagName=t.tagStart=null;var n=t.tokenize(e,t);return n?n+" tag error":"tag error"}return/[\'\"]/.test(r)?(t.tokenize=s(r),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function s(e){var t=function(t,r){for(;!t.eol();)if(t.next()==e){r.tokenize=a;break}return"string"};return t.isInAttribute=!0,t}function l(e,t){return function(r,n){for(;!r.eol();){if(r.match(t)){n.tokenize=o;break}r.next()}return e}}function c(e){return function(t,r){for(var n;null!=(n=t.next());){if("<"==n)return r.tokenize=c(e+1),r.tokenize(t,r);if(">"==n){if(1==e){r.tokenize=o;break}return r.tokenize=c(e-1),r.tokenize(t,r)}}return"meta"}}function u(e,t,r){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=r,(_.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function d(e){e.context&&(e.context=e.context.prev)}function f(e,t){ +for(var r;;){if(!e.context)return;if(r=e.context.tagName,!_.contextGrabbers.hasOwnProperty(r)||!_.contextGrabbers[r].hasOwnProperty(t))return;d(e)}}function p(e,t,r){return"openTag"==e?(r.tagStart=t.column(),h):"closeTag"==e?m:p}function h(e,t,r){return"word"==e?(r.tagName=t.current(),L="tag",y):(L="error",h)}function m(e,t,r){if("word"==e){var n=t.current();return r.context&&r.context.tagName!=n&&_.implicitlyClosed.hasOwnProperty(r.context.tagName)&&d(r),r.context&&r.context.tagName==n||_.matchClosing===!1?(L="tag",g):(L="tag error",v)}return L="error",v}function g(e,t,r){return"endTag"!=e?(L="error",g):(d(r),p)}function v(e,t,r){return L="error",g(e,t,r)}function y(e,t,r){if("word"==e)return L="attribute",b;if("endTag"==e||"selfcloseTag"==e){var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,"selfcloseTag"==e||_.autoSelfClosers.hasOwnProperty(n)?f(r,n):(f(r,n),r.context=new u(r,n,i==r.indented)),p}return L="error",y}function b(e,t,r){return"equals"==e?k:(_.allowMissing||(L="error"),y(e,t,r))}function k(e,t,r){return"string"==e?x:"word"==e&&_.allowUnquoted?(L="string",y):(L="error",y(e,t,r))}function x(e,t,r){return"string"==e?x:y(e,t,r)}var w=n.indentUnit,_={},C=i.htmlMode?t:r;for(var S in C)_[S]=C[S];for(var S in i)_[S]=i[S];var M,L;return o.isInText=!0,{startState:function(e){var t={tokenize:o,state:p,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;M=null;var r=t.tokenize(e,t);return(r||M)&&"comment"!=r&&(L=null,t.state=t.state(M||r,e,t),L&&(r="error"==L?r+" error":L)),r},indent:function(t,r,n){var i=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+w;if(i&&i.noIndent)return e.Pass;if(t.tokenize!=a&&t.tokenize!=o)return n?n.match(/^(\s*)/)[0].length:0;if(t.tagName)return _.multilineTagIndentPastTag!==!1?t.tagStart+t.tagName.length+2:t.tagStart+w*(_.multilineTagIndentFactor||1);if(_.alignCDATA&&/$/,blockCommentStart:"",configuration:_.htmlMode?"html":"xml",helperType:_.htmlMode?"html":"xml",skipAttribute:function(e){e.state==k&&(e.state=y)}}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../meta")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("markdown",function(t,r){function n(r){if(e.findModeByName){var n=e.findModeByName(r);n&&(r=n.mime||n.mimes[0])}var i=e.getMode(t,r);return"null"==i.name?null:i}function i(e,t,r){return t.f=t.inline=r,r(e,t)}function o(e,t,r){return t.f=t.block=r,r(e,t)}function a(e){return!e||!/\S/.test(e.string)}function s(e){return e.linkTitle=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,_&&e.f==c&&(e.f=h,e.block=l),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine=null,null}function l(e,t){var o=e.sol(),s=t.list!==!1,l=t.indentedCode;t.indentedCode=!1,s&&(t.indentationDiff>=0?(t.indentationDiff<4&&(t.indentation-=t.indentationDiff),t.list=null):t.list=t.indentation>0?null:!1);var c=null;if(t.indentationDiff>=4)return e.skipToEnd(),l||a(t.prevLine)?(t.indentation-=4,t.indentedCode=!0,C.code):null;if(e.eatSpace())return null;if((c=e.match(E))&&c[1].length<=6)return t.header=c[1].length,r.highlightFormatting&&(t.formatting="header"),t.f=t.inline,f(t);if(!(a(t.prevLine)||t.quote||s||l)&&(c=e.match(O)))return t.header="="==c[0].charAt(0)?1:2,r.highlightFormatting&&(t.formatting="header"),t.f=t.inline,f(t);if(e.eat(">"))return t.quote=o?1:t.quote+1,r.highlightFormatting&&(t.formatting="quote"),e.eatSpace(),f(t);if("["===e.peek())return i(e,t,y);if(e.match(M,!0))return t.hr=!0,C.hr;if((a(t.prevLine)||s)&&(e.match(L,!1)||e.match(T,!1))){var d=null;for(e.match(L,!0)?d="ul":(e.match(T,!0),d="ol"),t.indentation=e.column()+e.current().length,t.list=!0;t.listStack&&e.column()")>-1)&&(r.f=h,r.block=l,r.htmlState=null)}return n}function u(e,t){return t.fencedChars&&e.match(t.fencedChars,!1)?(t.localMode=t.localState=null,t.f=t.block=d,null):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),C.code)}function d(e,t){e.match(t.fencedChars),t.block=l,t.f=h,t.fencedChars=null,r.highlightFormatting&&(t.formatting="code-block"),t.code=1;var n=f(t);return t.code=0,n}function f(e){var t=[];if(e.formatting){t.push(C.formatting),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var n=0;n=e.quote?C.formatting+"-"+e.formatting[n]+"-"+e.quote:"error")}if(e.taskOpen)return t.push("meta"),t.length?t.join(" "):null;if(e.taskClosed)return t.push("property"),t.length?t.join(" "):null;if(e.linkHref?t.push(C.linkHref,"url"):(e.strong&&t.push(C.strong),e.em&&t.push(C.em),e.strikethrough&&t.push(C.strikethrough),e.linkText&&t.push(C.linkText),e.code&&t.push(C.code)),e.header&&t.push(C.header,C.header+"-"+e.header),e.quote&&(t.push(C.quote),t.push(!r.maxBlockquoteDepth||r.maxBlockquoteDepth>=e.quote?C.quote+"-"+e.quote:C.quote+"-"+r.maxBlockquoteDepth)),e.list!==!1){var i=(e.listStack.length-1)%3;t.push(i?1===i?C.list2:C.list3:C.list1)}return e.trailingSpaceNewLine?t.push("trailing-space-new-line"):e.trailingSpace&&t.push("trailing-space-"+(e.trailingSpace%2?"a":"b")),t.length?t.join(" "):null}function p(e,t){return e.match(z,!0)?f(t):void 0}function h(t,n){var i=n.text(t,n);if("undefined"!=typeof i)return i;if(n.list)return n.list=null,f(n);if(n.taskList){var a="x"!==t.match(A,!0)[1];return a?n.taskOpen=!0:n.taskClosed=!0,r.highlightFormatting&&(n.formatting="task"),n.taskList=!1,f(n)}if(n.taskOpen=!1,n.taskClosed=!1,n.header&&t.match(/^#+$/,!0))return r.highlightFormatting&&(n.formatting="header"),f(n);var s=t.sol(),l=t.next();if(n.linkTitle){n.linkTitle=!1;var u=l;"("===l&&(u=")"),u=(u+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var d="^\\s*(?:[^"+u+"\\\\]+|\\\\\\\\|\\\\.)"+u;if(t.match(new RegExp(d),!0))return C.linkHref}if("`"===l){var p=n.formatting;r.highlightFormatting&&(n.formatting="code"),t.eatWhile("`");var h=t.current().length;if(0==n.code)return n.code=h,f(n);if(h==n.code){var v=f(n);return n.code=0,v}return n.formatting=p,f(n)}if(n.code)return f(n);if("\\"===l&&(t.next(),r.highlightFormatting)){var y=f(n),b=C.formatting+"-escape";return y?y+" "+b:b}if("!"===l&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return t.match(/\[[^\]]*\]/),n.inline=n.f=g,C.image;if("["===l&&t.match(/.*\](\(.*\)| ?\[.*\])/,!1))return n.linkText=!0,r.highlightFormatting&&(n.formatting="link"),f(n);if("]"===l&&n.linkText&&t.match(/\(.*\)| ?\[.*\]/,!1)){r.highlightFormatting&&(n.formatting="link");var y=f(n);return n.linkText=!1,n.inline=n.f=g,y}if("<"===l&&t.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=m,r.highlightFormatting&&(n.formatting="link");var y=f(n);return y?y+=" ":y="",y+C.linkInline}if("<"===l&&t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=m,r.highlightFormatting&&(n.formatting="link");var y=f(n);return y?y+=" ":y="",y+C.linkEmail}if("<"===l&&t.match(/^(!--|\w)/,!1)){var k=t.string.indexOf(">",t.pos);if(-1!=k){var x=t.string.substring(t.start,k);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(x)&&(n.md_inside=!0)}return t.backUp(1),n.htmlState=e.startState(w),o(t,n,c)}if("<"===l&&t.match(/^\/\w*?>/))return n.md_inside=!1,"tag";var _=!1;if(!r.underscoresBreakWords&&"_"===l&&"_"!==t.peek()&&t.match(/(\w)/,!1)){var S=t.pos-2;if(S>=0){var M=t.string.charAt(S);"_"!==M&&M.match(/(\w)/,!1)&&(_=!0)}}if("*"===l||"_"===l&&!_)if(s&&" "===t.peek());else{if(n.strong===l&&t.eat(l)){r.highlightFormatting&&(n.formatting="strong");var v=f(n);return n.strong=!1,v}if(!n.strong&&t.eat(l))return n.strong=l,r.highlightFormatting&&(n.formatting="strong"),f(n);if(n.em===l){r.highlightFormatting&&(n.formatting="em");var v=f(n);return n.em=!1,v}if(!n.em)return n.em=l,r.highlightFormatting&&(n.formatting="em"),f(n)}else if(" "===l&&(t.eat("*")||t.eat("_"))){if(" "===t.peek())return f(n);t.backUp(1)}if(r.strikethrough)if("~"===l&&t.eatWhile(l)){if(n.strikethrough){r.highlightFormatting&&(n.formatting="strikethrough");var v=f(n);return n.strikethrough=!1,v}if(t.match(/^[^\s]/,!1))return n.strikethrough=!0,r.highlightFormatting&&(n.formatting="strikethrough"),f(n)}else if(" "===l&&t.match(/^~~/,!0)){if(" "===t.peek())return f(n);t.backUp(2)}return" "===l&&(t.match(/ +$/,!1)?n.trailingSpace++:n.trailingSpace&&(n.trailingSpaceNewLine=!0)),f(n)}function m(e,t){var n=e.next();if(">"===n){t.f=t.inline=h,r.highlightFormatting&&(t.formatting="link");var i=f(t);return i?i+=" ":i="",i+C.linkInline}return e.match(/^[^>]+/,!0),C.linkInline}function g(e,t){if(e.eatSpace())return null;var n=e.next();return"("===n||"["===n?(t.f=t.inline=v("("===n?")":"]"),r.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,f(t)):"error"}function v(e){return function(t,n){var i=t.next();if(i===e){n.f=n.inline=h,r.highlightFormatting&&(n.formatting="link-string");var o=f(n);return n.linkHref=!1,o}return t.match(x(e),!0)&&t.backUp(1),n.linkHref=!0,f(n)}}function y(e,t){return e.match(/^([^\]\\]|\\.)*\]:/,!1)?(t.f=b,e.next(),r.highlightFormatting&&(t.formatting="link"),t.linkText=!0,f(t)):i(e,t,h)}function b(e,t){if(e.match(/^\]:/,!0)){t.f=t.inline=k,r.highlightFormatting&&(t.formatting="link");var n=f(t);return t.linkText=!1,n}return e.match(/^([^\]\\]|\\.)+/,!0),C.linkText}function k(e,t){return e.eatSpace()?null:(e.match(/^[^\s]+/,!0),void 0===e.peek()?t.linkTitle=!0:e.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),t.f=t.inline=h,C.linkHref+" url")}function x(e){return N[e]||(e=(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),N[e]=new RegExp("^(?:[^\\\\]|\\\\.)*?("+e+")")),N[e]}var w=e.getMode(t,"text/html"),_="null"==w.name;void 0===r.highlightFormatting&&(r.highlightFormatting=!1),void 0===r.maxBlockquoteDepth&&(r.maxBlockquoteDepth=0),void 0===r.underscoresBreakWords&&(r.underscoresBreakWords=!0),void 0===r.taskLists&&(r.taskLists=!1),void 0===r.strikethrough&&(r.strikethrough=!1),void 0===r.tokenTypeOverrides&&(r.tokenTypeOverrides={});var C={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"tag",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough"};for(var S in C)C.hasOwnProperty(S)&&r.tokenTypeOverrides[S]&&(C[S]=r.tokenTypeOverrides[S]);var M=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^[*\-+]\s+/,T=/^[0-9]+([.)])\s+/,A=/^\[(x| )\](?=\s)/,E=r.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,O=/^ *(?:\={1,}|-{1,})\s*$/,z=/^[^#!\[\]*_\\<>` "'(~]+/,I=new RegExp("^("+(r.fencedCodeBlocks===!0?"~~~+|```+":r.fencedCodeBlocks)+")[ \\t]*([\\w+#-]*)"),N=[],q={startState:function(){return{f:l,prevLine:null,thisLine:null,block:l,htmlState:null,indentation:0,inline:h,text:p,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,fencedChars:null}},copyState:function(t){return{f:t.f,prevLine:t.prevLine,thisLine:t.thisLine,block:t.block,htmlState:t.htmlState&&e.copyState(w,t.htmlState),indentation:t.indentation,localMode:t.localMode,localState:t.localMode?e.copyState(t.localMode,t.localState):null,inline:t.inline,text:t.text,formatting:!1,linkTitle:t.linkTitle,code:t.code,em:t.em,strong:t.strong,strikethrough:t.strikethrough,header:t.header,hr:t.hr,taskList:t.taskList,list:t.list,listStack:t.listStack.slice(0),quote:t.quote,indentedCode:t.indentedCode,trailingSpace:t.trailingSpace,trailingSpaceNewLine:t.trailingSpaceNewLine,md_inside:t.md_inside,fencedChars:t.fencedChars}},token:function(e,t){if(t.formatting=!1,e!=t.thisLine){var r=t.header||t.hr;if(t.header=0,t.hr=!1,e.match(/^\s*$/,!0)||r){if(s(t),!r)return null;t.prevLine=null}t.prevLine=t.thisLine,t.thisLine=e,t.taskList=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.f=t.block;var n=e.match(/^\s*/,!0)[0].replace(/\t/g," ").length;if(t.indentationDiff=Math.min(n-t.indentation,4),t.indentation=t.indentation+t.indentationDiff,n>0)return null}return t.f(e,t)},innerMode:function(e){return e.block==c?{state:e.htmlState,mode:w}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:q}},blankLine:s,getType:f,fold:"markdown"};return q},"xml"),e.defineMIME("text/x-markdown","markdown")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../markdown/markdown"),require("../../addon/mode/overlay")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],e):e(CodeMirror)}(function(e){"use strict";var t=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;e.defineMode("gfm",function(r,n){function i(e){return e.code=!1,null}var o=0,a={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(e){return{code:e.code,codeBlock:e.codeBlock,ateSpace:e.ateSpace}},token:function(e,r){if(r.combineTokens=null,r.codeBlock)return e.match(/^```+/)?(r.codeBlock=!1,null):(e.skipToEnd(),null);if(e.sol()&&(r.code=!1),e.sol()&&e.match(/^```+/))return e.skipToEnd(),r.codeBlock=!0,null;if("`"===e.peek()){e.next();var i=e.pos;e.eatWhile("`");var a=1+e.pos-i;return r.code?a===o&&(r.code=!1):(o=a,r.code=!0),null}if(r.code)return e.next(),null;if(e.eatSpace())return r.ateSpace=!0,null;if((e.sol()||r.ateSpace)&&(r.ateSpace=!1,n.gitHubSpice!==!1)){if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/))return r.combineTokens=!0,"link";if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return r.combineTokens=!0,"link"}return e.match(t)&&"]("!=e.string.slice(e.start-2,e.start)&&(0==e.start||/\W/.test(e.string.charAt(e.start-1)))?(r.combineTokens=!0,"link"):(e.next(),null)},blankLine:i},s={underscoresBreakWords:!1,taskLists:!0,fencedCodeBlocks:"```",strikethrough:!0};for(var l in n)s[l]=n[l];return s.name="markdown",e.overlayMode(e.getMode(r,s),a)},"markdown"),e.defineMIME("text/x-gfm","gfm")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r){return/^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}e.defineMode("javascript",function(r,n){function i(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}function o(e,t,r){return ke=e,xe=r,t}function a(e,r){var n=e.next();if('"'==n||"'"==n)return r.tokenize=s(n),r.tokenize(e,r);if("."==n&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return o("number","number");if("."==n&&e.match(".."))return o("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return o(n);if("="==n&&e.eat(">"))return o("=>","operator");if("0"==n&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),o("number","number");if("0"==n&&e.eat(/o/i))return e.eatWhile(/[0-7]/i),o("number","number");if("0"==n&&e.eat(/b/i))return e.eatWhile(/[01]/i),o("number","number");if(/\d/.test(n))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),o("number","number");if("/"==n)return e.eat("*")?(r.tokenize=l,l(e,r)):e.eat("/")?(e.skipToEnd(),o("comment","comment")):t(e,r,1)?(i(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),o("regexp","string-2")):(e.eatWhile(Ae),o("operator","operator",e.current()));if("`"==n)return r.tokenize=c,c(e,r);if("#"==n)return e.skipToEnd(),o("error","error");if(Ae.test(n))return e.eatWhile(Ae),o("operator","operator",e.current());if(Le.test(n)){e.eatWhile(Le);var a=e.current(),u=Te.propertyIsEnumerable(a)&&Te[a];return u&&"."!=r.lastType?o(u.type,u.style,a):o("variable","variable",a)}}function s(e){return function(t,r){var n,i=!1;if(Ce&&"@"==t.peek()&&t.match(Ee))return r.tokenize=a,o("jsonld-keyword","meta");for(;null!=(n=t.next())&&(n!=e||i);)i=!i&&"\\"==n;return i||(r.tokenize=a),o("string","string")}}function l(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=a;break}n="*"==r}return o("comment","comment")}function c(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=a;break}n=!n&&"\\"==r}return o("quasi","string-2",e.current())}function u(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(0>r)){for(var n=0,i=!1,o=r-1;o>=0;--o){var a=e.string.charAt(o),s=Oe.indexOf(a);if(s>=0&&3>s){if(!n){++o;break}if(0==--n)break}else if(s>=3&&6>s)++n;else if(Le.test(a))i=!0;else{if(/["'\/]/.test(a))return;if(i&&!n){++o;break}}}i&&!n&&(t.fatArrowAt=o)}}function d(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function f(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function p(e,t,r,n,i){var o=e.cc;for(Ie.state=e,Ie.stream=i,Ie.marked=null,Ie.cc=o,Ie.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var a=o.length?o.pop():Se?_:w;if(a(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return Ie.marked?Ie.marked:"variable"==r&&f(e,n)?"variable-2":t}}}function h(){for(var e=arguments.length-1;e>=0;e--)Ie.cc.push(arguments[e])}function m(){return h.apply(null,arguments),!0}function g(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var r=Ie.state;if(Ie.marked="def",r.context){if(t(r.localVars))return;r.localVars={name:e,next:r.localVars}}else{if(t(r.globalVars))return;n.globalVars&&(r.globalVars={name:e,next:r.globalVars})}}function v(){Ie.state.context={prev:Ie.state.context,vars:Ie.state.localVars},Ie.state.localVars=Ne}function y(){Ie.state.localVars=Ie.state.context.vars,Ie.state.context=Ie.state.context.prev}function b(e,t){var r=function(){var r=Ie.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var i=r.lexical;i&&")"==i.type&&i.align;i=i.prev)n=i.indented;r.lexical=new d(n,Ie.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function k(){var e=Ie.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function x(e){function t(r){return r==e?m():";"==e?h():m(t)}return t}function w(e,t){return"var"==e?m(b("vardef",t.length),G,x(";"),k):"keyword a"==e?m(b("form"),_,w,k):"keyword b"==e?m(b("form"),w,k):"{"==e?m(b("}"),$,k):";"==e?m():"if"==e?("else"==Ie.state.lexical.info&&Ie.state.cc[Ie.state.cc.length-1]==k&&Ie.state.cc.pop()(),m(b("form"),_,w,k,J)):"function"==e?m(oe):"for"==e?m(b("form"),ee,w,k):"variable"==e?m(b("stat"),R):"switch"==e?m(b("form"),_,b("}","switch"),x("{"),$,k,k):"case"==e?m(_,x(":")):"default"==e?m(x(":")):"catch"==e?m(b("form"),v,x("("),ae,x(")"),w,k,y):"class"==e?m(b("form"),se,k):"export"==e?m(b("stat"),de,k):"import"==e?m(b("stat"),fe,k):"module"==e?m(b("form"),X,b("}"),x("{"),$,k,k):h(b("stat"),_,x(";"),k)}function _(e){return S(e,!1)}function C(e){return S(e,!0)}function S(e,t){if(Ie.state.fatArrowAt==Ie.stream.start){var r=t?I:z;if("("==e)return m(v,b(")"),W(X,")"),k,x("=>"),r,y);if("variable"==e)return h(v,X,x("=>"),r,y)}var n=t?A:T;return ze.hasOwnProperty(e)?m(n):"function"==e?m(oe,n):"keyword c"==e?m(t?L:M):"("==e?m(b(")"),M,ye,x(")"),k,n):"operator"==e||"spread"==e?m(t?C:_):"["==e?m(b("]"),ge,k,n):"{"==e?H(D,"}",null,n):"quasi"==e?h(E,n):"new"==e?m(N(t)):m()}function M(e){return e.match(/[;\}\)\],]/)?h():h(_)}function L(e){return e.match(/[;\}\)\],]/)?h():h(C)}function T(e,t){return","==e?m(_):A(e,t,!1)}function A(e,t,r){var n=0==r?T:A,i=0==r?_:C;return"=>"==e?m(v,r?I:z,y):"operator"==e?/\+\+|--/.test(t)?m(n):"?"==t?m(_,x(":"),i):m(i):"quasi"==e?h(E,n):";"!=e?"("==e?H(C,")","call",n):"."==e?m(j,n):"["==e?m(b("]"),M,x("]"),k,n):void 0:void 0}function E(e,t){return"quasi"!=e?h():"${"!=t.slice(t.length-2)?m(E):m(_,O)}function O(e){return"}"==e?(Ie.marked="string-2",Ie.state.tokenize=c,m(E)):void 0}function z(e){return u(Ie.stream,Ie.state),h("{"==e?w:_)}function I(e){return u(Ie.stream,Ie.state),h("{"==e?w:C)}function N(e){return function(t){return"."==t?m(e?P:q):h(e?C:_)}}function q(e,t){return"target"==t?(Ie.marked="keyword",m(T)):void 0}function P(e,t){return"target"==t?(Ie.marked="keyword",m(A)):void 0}function R(e){return":"==e?m(k,w):h(T,x(";"),k)}function j(e){return"variable"==e?(Ie.marked="property",m()):void 0}function D(e,t){return"variable"==e||"keyword"==Ie.style?(Ie.marked="property",m("get"==t||"set"==t?B:F)):"number"==e||"string"==e?(Ie.marked=Ce?"property":Ie.style+" property",m(F)):"jsonld-keyword"==e?m(F):"modifier"==e?m(D):"["==e?m(_,x("]"),F):"spread"==e?m(_):void 0}function B(e){return"variable"!=e?h(F):(Ie.marked="property",m(oe))}function F(e){return":"==e?m(C):"("==e?h(oe):void 0}function W(e,t){function r(n){if(","==n){var i=Ie.state.lexical;return"call"==i.info&&(i.pos=(i.pos||0)+1),m(e,r)}return n==t?m():m(x(t))}return function(n){return n==t?m():h(e,r)}}function H(e,t,r){for(var n=3;n!?|~^]/,Ee=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Oe="([{}])",ze={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Ie={state:null,column:null,marked:null,cc:null},Ne={name:"this",next:{name:"arguments"}};return k.lex=!0,{startState:function(e){var t={tokenize:a,lastType:"sof",cc:[],lexical:new d((e||0)-we,0,"block",!1),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented:e||0};return n.globalVars&&"object"==typeof n.globalVars&&(t.globalVars=n.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),u(e,t)),t.tokenize!=l&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==ke?r:(t.lastType="operator"!=ke||"++"!=xe&&"--"!=xe?ke:"incdec",p(t,r,ke,xe,e))},indent:function(t,r){if(t.tokenize==l)return e.Pass;if(t.tokenize!=a)return 0;var i=r&&r.charAt(0),o=t.lexical;if(!/^\s*else\b/.test(r))for(var s=t.cc.length-1;s>=0;--s){var c=t.cc[s];if(c==k)o=o.prev;else if(c!=J)break}"stat"==o.type&&"}"==i&&(o=o.prev),_e&&")"==o.type&&"stat"==o.prev.type&&(o=o.prev);var u=o.type,d=i==u;return"vardef"==u?o.indented+("operator"==t.lastType||","==t.lastType?o.info+1:0):"form"==u&&"{"==i?o.indented:"form"==u?o.indented+we:"stat"==u?o.indented+(be(t,r)?_e||we:0):"switch"!=o.info||d||0==n.doubleIndentSwitch?o.align?o.column+(d?0:1):o.indented+(d?0:we):o.indented+(/^(?:case|default)\b/.test(r)?we:2*we)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Se?null:"/*",blockCommentEnd:Se?null:"*/",lineComment:Se?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Se?"json":"javascript",jsonldMode:Ce,jsonMode:Se,expressionAllowed:t,skipExpression:function(e){var t=e.cc[e.cc.length-1];(t==_||t==C)&&e.cc.pop()}}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=0;r*\/]/.test(r)?n(null,"select-op"):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?n("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?n(null,r):"u"==r&&e.match(/rl(-prefix)?\(/)||"d"==r&&e.match("omain(")||"r"==r&&e.match("egexp(")?(e.backUp(1),t.tokenize=a,n("property","word")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),n("property","word")):n(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),n("number","unit")):e.match(/^-[\w\\\-]+/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?n("variable-2","variable-definition"):n("variable-2","variable")):e.match(/^\w+-/)?n("meta","meta"):void 0}function o(e){return function(t,r){for(var i,o=!1;null!=(i=t.next());){if(i==e&&!o){")"==e&&t.backUp(1);break}o=!o&&"\\"==i}return(i==e||!o&&")"!=e)&&(r.tokenize=null),n("string","string")}}function a(e,t){return e.next(),t.tokenize=e.match(/\s*[\"\')]/,!1)?null:o(")"),n(null,"(")}function s(e,t,r){this.type=e,this.indent=t,this.prev=r}function l(e,t,r,n){return e.context=new s(r,t.indentation()+(n===!1?0:g),e.context),r}function c(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function u(e,t,r){return E[r.context.type](e,t,r)}function d(e,t,r,n){for(var i=n||1;i>0;i--)r.context=r.context.prev;return u(e,t,r)}function f(e){var t=e.current().toLowerCase();m=L.hasOwnProperty(t)?"atom":M.hasOwnProperty(t)?"keyword":"variable"}var p=r.inline;r.propertyKeywords||(r=e.resolveMode("text/css"));var h,m,g=t.indentUnit,v=r.tokenHooks,y=r.documentTypes||{},b=r.mediaTypes||{},k=r.mediaFeatures||{},x=r.mediaValueKeywords||{},w=r.propertyKeywords||{},_=r.nonStandardPropertyKeywords||{},C=r.fontProperties||{},S=r.counterDescriptors||{},M=r.colorKeywords||{},L=r.valueKeywords||{},T=r.allowNested,A=r.supportsAtComponent===!0,E={}; -}}if(s.length){o&&e.state.focused&&e.focus();var d=function(){e.operation(function(){for(var e=0;e",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},l=null;e.defineOption("matchBrackets",!1,function(t,r,n){n&&n!=e.Init&&t.off("cursorActivity",i),r&&(t.state.matchBrackets="object"==typeof r?r:{},t.on("cursorActivity",i))}),e.defineExtension("matchBrackets",function(){n(this,!0)}),e.defineExtension("findMatchingBracket",function(e,r,n){return t(this,e,r,n)}),e.defineExtension("scanForBracket",function(e,t,n,i){return r(this,e,t,n,i)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t){return"pairs"==t&&"string"==typeof e?e:"object"==typeof e&&null!=e[t]?e[t]:f[t]}function r(e){return function(t){return s(t,e)}}function n(e){var t=e.state.closeBrackets;if(!t)return null;var r=e.getModeAt(e.getCursor());return r.closeBrackets||t}function i(r){var i=n(r);if(!i||r.getOption("disableInput"))return e.Pass;for(var o=t(i,"pairs"),a=r.listSelections(),s=0;s=0;s--){var u=a[s].head;r.replaceRange("",d(u.line,u.ch-1),d(u.line,u.ch+1),"+delete")}}function o(r){var i=n(r),o=i&&t(i,"explode");if(!o||r.getOption("disableInput"))return e.Pass;for(var a=r.listSelections(),s=0;s0;return{anchor:new d(t.anchor.line,t.anchor.ch+(r?-1:1)),head:new d(t.head.line,t.head.ch+(r?1:-1))}}function s(r,i){var o=n(r);if(!o||r.getOption("disableInput"))return e.Pass;var s=t(o,"pairs"),c=s.indexOf(i);if(-1==c)return e.Pass;for(var f,p,h=t(o,"triples"),m=s.charAt(c+1)==i,g=r.listSelections(),v=c%2==0,y=0;y1&&h.indexOf(i)>=0&&r.getRange(d(x.line,x.ch-2),x)==i+i&&(x.ch<=2||r.getRange(d(x.line,x.ch-3),d(x.line,x.ch-2))!=i))b="addFour";else if(m){if(e.isWordChar(p)||!u(r,x,i))return e.Pass;b="both"}else{if(!v||r.getLine(x.line).length!=x.ch&&!l(p,s)&&!/\s/.test(p))return e.Pass;b="both"}else b=h.indexOf(i)>=0&&r.getRange(x,d(x.line,x.ch+3))==i+i+i?"skipThree":"skip";if(f){if(f!=b)return e.Pass}else f=b}var w=c%2?s.charAt(c-1):i,_=c%2?i:s.charAt(c+1);r.operation(function(){if("skip"==f)r.execCommand("goCharRight");else if("skipThree"==f)for(var e=0;3>e;e++)r.execCommand("goCharRight");else if("surround"==f){for(var t=r.getSelections(),e=0;e-1&&r%2==1}function c(e,t){var r=e.getRange(d(t.line,t.ch-1),d(t.line,t.ch+1));return 2==r.length?r:null}function u(t,r,n){var i=t.getLine(r.line),o=t.getTokenAt(r);if(/\bstring2?\b/.test(o.type))return!1;var a=new e.StringStream(i.slice(0,r.ch)+n+i.slice(r.ch),4);for(a.pos=a.start=o.start;;){var s=t.getMode().token(a,o.state);if(a.pos>=r.ch+1)return/\bstring2?\b/.test(s);a.start=a.pos}}var f={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},d=e.Pos;e.defineOption("autoCloseBrackets",!1,function(t,r,n){n&&n!=e.Init&&(t.removeKeyMap(h),t.state.closeBrackets=null),r&&(t.state.closeBrackets=r,t.addKeyMap(h))});for(var p=f.pairs+"`",h={Backspace:i,Enter:o},m=0;mc.ch&&(v=v.slice(0,v.length-u.end+c.ch));var y=v.toLowerCase();if(!v||"string"==u.type&&(u.end!=c.ch||!/[\"\']/.test(u.string.charAt(u.string.length-1))||1==u.string.length)||"tag"==u.type&&"closeTag"==d.type||u.string.indexOf("/")==u.string.length-1||m&&i(m,y)>-1||o(t,v,c,d,!0))return e.Pass;var b=g&&i(g,y)>-1;n[l]={indent:b,text:">"+(b?"\n\n":"")+"",newPos:b?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var l=r.length-1;l>=0;l--){var k=n[l];t.replaceRange(k.text,r[l].head,r[l].anchor,"+insert");var x=t.listSelections().slice(0);x[l]={head:k.newPos,anchor:k.newPos},t.setSelections(x),k.indent&&(t.indentLine(k.newPos.line,null,!0),t.indentLine(k.newPos.line+1,null,!0))}}function r(t,r){for(var n=t.listSelections(),i=[],a=r?"/":""!=t.getLine(l.line).charAt(c.end)&&(d+=">"),i[s]=d}t.replaceSelections(i),n=t.listSelections();for(var s=0;sr;++r)if(e[r]==t)return r;return-1}function o(t,r,n,i,o){if(!e.scanForClosingTag)return!1;var a=Math.min(t.lastLine()+1,n.line+500),s=e.scanForClosingTag(t,n,null,a);if(!s||s.tag!=r)return!1;for(var l=i.context,c=o?1:0;l&&l.tagName==r;l=l.prev)++c;n=s.to;for(var u=1;c>u;u++){var f=e.scanForClosingTag(t,n,null,a);if(!f||f.tag!=r)return!1;n=f.to}return!0}e.defineOption("autoCloseTags",!1,function(r,i,o){if(o!=e.Init&&o&&r.removeKeyMap("autoCloseTags"),i){var a={name:"autoCloseTags"};("object"!=typeof i||i.whenClosing)&&(a["'/'"]=function(e){return n(e)}),("object"!=typeof i||i.whenOpening)&&(a["'>'"]=function(e){return t(e)}),r.addKeyMap(a)}});var a=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],s=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];e.commands.closeTag=function(e){return r(e)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t=/^(\s*)(>[> ]*|[*+-]\s|(\d+)([.)]))(\[\s\]\s|\[x\]\s|\s*)/,r=/^(\s*)(>[> ]*|[*+-]\s|(\d+)[.)])(\[\s\]\s*|\[x\]\s|\s*)$/,n=/[*+-]\s/;e.commands.newlineAndIndentContinueMarkdownList=function(i){if(i.getOption("disableInput"))return e.Pass;for(var o=i.listSelections(),a=[],s=0;s")>=0?p[2]:parseInt(p[3],10)+1+p[4];m=m.replace("[x]","[ ]"),a[s]="\n"+h+g+m}}i.replaceSelections(a)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){var t=e.search(n);return-1==t?0:t}var r={},n=/[^\s\u00a0]/,i=e.Pos;e.commands.toggleComment=function(e){e.toggleComment()},e.defineExtension("toggleComment",function(e){e||(e=r);for(var t=this,n=1/0,o=this.listSelections(),a=null,s=o.length-1;s>=0;s--){var l=o[s].from(),c=o[s].to();l.line>=n||(c.line>=n&&(c=i(n,0)),n=l.line,null==a?t.uncomment(l,c,e)?a="un":(t.lineComment(l,c,e),a="line"):"un"==a?t.uncomment(l,c,e):t.lineComment(l,c,e))}}),e.defineExtension("lineComment",function(e,o,a){a||(a=r);var s=this,l=s.getModeAt(e),c=a.lineComment||l.lineComment;if(!c)return void((a.blockCommentStart||l.blockCommentStart)&&(a.fullLines=!0,s.blockComment(e,o,a)));var u=s.getLine(e.line);if(null!=u){var f=Math.min(0!=o.ch||o.line==e.line?o.line+1:o.line,s.lastLine()+1),d=null==a.padding?" ":a.padding,p=a.commentBlankLines||e.line==o.line;s.operation(function(){if(a.indent){for(var r=null,o=e.line;f>o;++o){var l=s.getLine(o),u=l.slice(0,t(l));(null==r||r.length>u.length)&&(r=u)}for(var o=e.line;f>o;++o){var l=s.getLine(o),h=r.length;(p||n.test(l))&&(l.slice(0,h)!=r&&(h=t(l)),s.replaceRange(r+c+d,i(o,0),i(o,h)))}}else for(var o=e.line;f>o;++o)(p||n.test(s.getLine(o)))&&s.replaceRange(c+d,i(o,0))})}}),e.defineExtension("blockComment",function(e,t,o){o||(o=r);var a=this,s=a.getModeAt(e),l=o.blockCommentStart||s.blockCommentStart,c=o.blockCommentEnd||s.blockCommentEnd;if(!l||!c)return void((o.lineComment||s.lineComment)&&0!=o.fullLines&&a.lineComment(e,t,o));var u=Math.min(t.line,a.lastLine());u!=e.line&&0==t.ch&&n.test(a.getLine(u))&&--u;var f=null==o.padding?" ":o.padding;e.line>u||a.operation(function(){if(0!=o.fullLines){var r=n.test(a.getLine(u));a.replaceRange(f+c,i(u)),a.replaceRange(l+f,i(e.line,0));var d=o.blockCommentLead||s.blockCommentLead;if(null!=d)for(var p=e.line+1;u>=p;++p)(p!=u||r)&&a.replaceRange(d+f,i(p,0))}else a.replaceRange(c,t),a.replaceRange(l,e)})}),e.defineExtension("uncomment",function(e,t,o){o||(o=r);var a,s=this,l=s.getModeAt(e),c=Math.min(0!=t.ch||t.line==e.line?t.line:t.line-1,s.lastLine()),u=Math.min(e.line,c),f=o.lineComment||l.lineComment,d=[],p=null==o.padding?" ":o.padding;e:if(f){for(var h=u;c>=h;++h){var m=s.getLine(h),g=m.indexOf(f);if(g>-1&&!/comment/.test(s.getTokenTypeAt(i(h,g+1)))&&(g=-1),-1==g&&(h!=c||h==u)&&n.test(m))break e;if(g>-1&&n.test(m.slice(0,g)))break e;d.push(m)}if(s.operation(function(){for(var e=u;c>=e;++e){var t=d[e-u],r=t.indexOf(f),n=r+f.length;0>r||(t.slice(n,n+p.length)==p&&(n+=p.length),a=!0,s.replaceRange("",i(e,r),i(e,n)))}}),a)return!0}var v=o.blockCommentStart||l.blockCommentStart,y=o.blockCommentEnd||l.blockCommentEnd;if(!v||!y)return!1;var b=o.blockCommentLead||l.blockCommentLead,k=s.getLine(u),x=c==u?k:s.getLine(c),w=k.indexOf(v),_=x.lastIndexOf(y);if(-1==_&&u!=c&&(x=s.getLine(--c),_=x.lastIndexOf(y)),-1==w||-1==_||!/comment/.test(s.getTokenTypeAt(i(u,w+1)))||!/comment/.test(s.getTokenTypeAt(i(c,_+1))))return!1;var C=k.lastIndexOf(v,e.ch),S=-1==C?-1:k.slice(0,e.ch).indexOf(y,C+v.length);if(-1!=C&&-1!=S&&S+y.length!=e.ch)return!1;S=x.indexOf(y,t.ch);var M=x.slice(t.ch).lastIndexOf(v,S-t.ch);return C=-1==S||-1==M?-1:t.ch+M,-1!=S&&-1!=C&&C!=t.ch?!1:(s.operation(function(){s.replaceRange("",i(c,_-(p&&x.slice(_-p.length,_)==p?p.length:0)),i(c,_+y.length));var e=w+v.length;if(p&&k.slice(e,e+p.length)==p&&(e+=p.length),s.replaceRange("",i(u,w),i(u,e)),b)for(var t=u+1;c>=t;++t){var r=s.getLine(t),o=r.indexOf(b);if(-1!=o&&!n.test(r.slice(0,o))){var a=o+b.length;p&&r.slice(a,a+p.length)==p&&(a+=p.length),s.replaceRange("",i(t,o),i(t,a))}}}),!0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var n,i=t.listSelections(),o=[],a=0;a=d);else if(0==l.string.indexOf(n.blockCommentStart)){if(u=p.slice(0,l.start),!/^\s*$/.test(u)){u="";for(var h=0;hl.start&&/^\s*$/.test(p.slice(0,f))&&(u=p.slice(0,f));null!=u&&(u+=n.blockCommentContinue)}if(null==u&&n.lineComment&&r(t)){var m=t.getLine(s.line),f=m.indexOf(n.lineComment);f>-1&&(u=m.slice(0,f),/\S/.test(u)?u=null:u+=n.lineComment+m.slice(f+n.lineComment.length).match(/^\s*/)[0])}if(null==u)return e.Pass;o[a]="\n"+u}t.operation(function(){for(var e=i.length-1;e>=0;e--)t.replaceRange(o[e],i[e].from(),i[e].to(),"+insert")})}function r(e){var t=e.getOption("continueComments");return t&&"object"==typeof t?t.continueLineComment!==!1:!0}for(var n=["clike","css","javascript"],i=0;io;--i){var a=e.getLine(i);if(n&&n.test(a))break;if(!/\S/.test(a)){++i;break}}for(var s=r.paragraphEnd||e.getHelper(t,"paragraphEnd"),l=t.line+1,c=e.lastLine();c>=l;++l){var a=e.getLine(l);if(s&&s.test(a)){++l;break}if(!/\S/.test(a))break}return{from:i,to:l}}function r(e,t,r,n){for(var i=t;i>0&&!r.test(e.slice(i-1,i+1));--i);for(var o=!0;;o=!1){var a=i;if(n)for(;" "==e.charAt(a-1);)--a;if(0!=a||!o)return{from:a,to:i};i=t}}function n(t,n,o,a){n=t.clipPos(n),o=t.clipPos(o);var s=a.column||80,l=a.wrapOn||/\s\S|-[^\.\d]/,c=a.killTrailingSpace!==!1,u=[],f="",d=n.line,p=t.getRange(n,o,!1);if(!p.length)return null;for(var h=p[0].match(/^[ \t]*/)[0],m=0;ms&&h==b&&r(f,s,l,c);k&&k.from==v&&k.to==v+y?(f=h+g,++d):u.push({text:[y?" ":""],from:i(d,v),to:i(d+1,b.length)})}for(;f.length>s;){var x=r(f,s,l,c);u.push({text:["",h],from:i(d,x.from),to:i(d,x.to)}),f=h+f.slice(x.to),++d}}return u.length&&t.operation(function(){for(var r=0;r=0;a--){var s,l=r[a];if(l.empty()){var c=t(e,l.head,{});s={from:i(c.from,0),to:i(c.to-1)}}else s={from:l.from(),to:l.to()};s.to.line>=o||(o=s.from.line,n(e,s.from,s.to,{}))}})},e.defineExtension("wrapRange",function(e,t,r){return n(this,e,t,r||{})}),e.defineExtension("wrapParagraphsInRange",function(e,r,o){o=o||{};for(var a=this,s=[],l=e.line;l<=r.line;){var c=t(a,i(l,0),o);s.push(c),l=c.to}var u=!1;return s.length&&a.operation(function(){for(var e=s.length-1;e>=0;--e)u=u||n(a,i(s[e].from,0),i(s[e].to-1),o)}),u})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t,i,o,a){function s(e){var r=l(t,i);if(!r||r.to.line-r.from.linet.firstLine();)i=e.Pos(i.line-1,0),u=s(!1);if(u&&!u.cleared&&"unfold"!==a){var f=r(t,o);e.on(f,"mousedown",function(t){d.clear(),e.e_preventDefault(t)});var d=t.markText(u.from,u.to,{replacedWith:f,clearOnEnter:!0,__isFold:!0});d.on("clear",function(r,n){e.signal(t,"unfold",t,r,n)}),e.signal(t,"fold",t,u.from,u.to)}}function r(e,t){var r=n(e,t,"widget");if("string"==typeof r){var i=document.createTextNode(r);r=document.createElement("span"),r.appendChild(i),r.className="CodeMirror-foldmarker"}return r}function n(e,t,r){if(t&&void 0!==t[r])return t[r];var n=e.options.foldOptions;return n&&void 0!==n[r]?n[r]:i[r]}e.newFoldFunction=function(e,r){return function(n,i){t(n,i,{rangeFinder:e,widget:r})}},e.defineExtension("foldCode",function(e,r,n){t(this,e,r,n)}),e.defineExtension("isFolded",function(e){for(var t=this.findMarksAt(e),r=0;r=r;r++)t.foldCode(e.Pos(r,0),null,"fold")})},e.commands.unfoldAll=function(t){t.operation(function(){for(var r=t.firstLine(),n=t.lastLine();n>=r;r++)t.foldCode(e.Pos(r,0),null,"unfold")})},e.registerHelper("fold","combine",function(){var e=Array.prototype.slice.call(arguments,0);return function(t,r){for(var n=0;n=i?-1:s.lastIndexOf(n,i-1);if(-1!=c){if(1==l&&c=h;++h)for(var m=t.getLine(h),g=h==a?i:0;;){var v=m.indexOf(l,g),y=m.indexOf(c,g);if(0>v&&(v=m.length),0>y&&(y=m.length),g=Math.min(v,y),g==m.length)break;if(t.getTokenTypeAt(e.Pos(h,g+1))==o)if(g==v)++d;else if(!--d){u=h,f=g;break e}++g}if(null!=u&&(a!=u||f!=i))return{from:e.Pos(a,i),to:e.Pos(u,f)}}}),e.registerHelper("fold","import",function(t,r){function n(r){if(rt.lastLine())return null;var n=t.getTokenAt(e.Pos(r,1));if(/\S/.test(n.string)||(n=t.getTokenAt(e.Pos(r,n.end+1))),"keyword"!=n.type||"import"!=n.string)return null;for(var i=r,o=Math.min(t.lastLine(),r+10);o>=i;++i){var a=t.getLine(i),s=a.indexOf(";");if(-1!=s)return{startCh:n.end,end:e.Pos(i,s)}}}var i,r=r.line,o=n(r);if(!o||n(r-1)||(i=n(r-2))&&i.end.line==r-1)return null;for(var a=o.end;;){var s=n(a.line+1);if(null==s)break;a=s.end}return{from:t.clipPos(e.Pos(r,o.startCh+1)),to:a}}),e.registerHelper("fold","include",function(t,r){function n(r){if(rt.lastLine())return null;var n=t.getTokenAt(e.Pos(r,1));return/\S/.test(n.string)||(n=t.getTokenAt(e.Pos(r,n.end+1))),"meta"==n.type&&"#include"==n.string.slice(0,8)?n.start+8:void 0}var r=r.line,i=n(r);if(null==i||null!=n(r-1))return null;for(var o=r;;){var a=n(o+1);if(null==a)break;++o}return{from:e.Pos(r,i+1),to:t.clipPos(e.Pos(o))}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],e):e(CodeMirror)}(function(e){"use strict";function t(e){this.options=e,this.from=this.to=0}function r(e){return e===!0&&(e={}),null==e.gutter&&(e.gutter="CodeMirror-foldgutter"),null==e.indicatorOpen&&(e.indicatorOpen="CodeMirror-foldgutter-open"),null==e.indicatorFolded&&(e.indicatorFolded="CodeMirror-foldgutter-folded"),e}function n(e,t){for(var r=e.findMarksAt(f(t)),n=0;n=s&&(r=i(o.indicatorOpen))}e.setGutterMarker(t,o.gutter,r),++a})}function a(e){var t=e.getViewport(),r=e.state.foldGutter;r&&(e.operation(function(){o(e,t.from,t.to)}),r.from=t.from,r.to=t.to)}function s(e,t,r){var i=e.state.foldGutter;if(i){var o=i.options;if(r==o.gutter){var a=n(e,t);a?a.clear():e.foldCode(f(t,0),o.rangeFinder)}}}function l(e){var t=e.state.foldGutter;if(t){var r=t.options;t.from=t.to=0,clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){a(e)},r.foldOnChangeTimeSpan||600)}}function c(e){var t=e.state.foldGutter;if(t){var r=t.options;clearTimeout(t.changeUpdate),t.changeUpdate=setTimeout(function(){var r=e.getViewport();t.from==t.to||r.from-t.to>20||t.from-r.to>20?a(e):e.operation(function(){r.fromt.to&&(o(e,t.to,r.to),t.to=r.to)})},r.updateViewportTimeSpan||400)}}function u(e,t){var r=e.state.foldGutter;if(r){var n=t.line;n>=r.from&&nu&&!(i(u+1,s,f)<=l);)++u,s=f,f=t.getLine(u+2);return{from:e.Pos(r.line,a.length),to:e.Pos(u,t.getLine(u).length)}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return e.line-t.line||e.ch-t.ch}function r(e,t,r,n){this.line=t,this.ch=r,this.cm=e,this.text=e.getLine(t),this.min=n?n.from:e.firstLine(),this.max=n?n.to-1:e.lastLine()}function n(e,t){var r=e.cm.getTokenTypeAt(d(e.line,t));return r&&/\btag\b/.test(r)}function i(e){return e.line>=e.max?void 0:(e.ch=0,e.text=e.cm.getLine(++e.line),!0)}function o(e){return e.line<=e.min?void 0:(e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0)}function a(e){for(;;){var t=e.text.indexOf(">",e.ch);if(-1==t){if(i(e))continue;return}{if(n(e,t+1)){var r=e.text.lastIndexOf("/",t),o=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,o?"selfClose":"regular"}e.ch=t+1}}}function s(e){for(;;){var t=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==t){if(o(e))continue;return}if(n(e,t+1)){m.lastIndex=t,e.ch=t;var r=m.exec(e.text);if(r&&r.index==t)return r}else e.ch=t}}function l(e){for(;;){m.lastIndex=e.ch;var t=m.exec(e.text);if(!t){if(i(e))continue;return}{if(n(e,t.index+1))return e.ch=t.index+t[0].length,t;e.ch=t.index+1}}}function c(e){for(;;){var t=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==t){if(o(e))continue;return}{if(n(e,t+1)){var r=e.text.lastIndexOf("/",t),i=r>-1&&!/\S/.test(e.text.slice(r+1,t));return e.ch=t+1,i?"selfClose":"regular"}e.ch=t}}}function u(e,t){for(var r=[];;){var n,i=l(e),o=e.line,s=e.ch-(i?i[0].length:0);if(!i||!(n=a(e)))return;if("selfClose"!=n)if(i[1]){for(var c=r.length-1;c>=0;--c)if(r[c]==i[2]){r.length=c;break}if(0>c&&(!t||t==i[2]))return{tag:i[2],from:d(o,s),to:d(e.line,e.ch)}}else r.push(i[2])}}function f(e,t){for(var r=[];;){var n=c(e);if(!n)return;if("selfClose"!=n){var i=e.line,o=e.ch,a=s(e);if(!a)return;if(a[1])r.push(a[2]);else{for(var l=r.length-1;l>=0;--l)if(r[l]==a[2]){r.length=l;break}if(0>l&&(!t||t==a[2]))return{tag:a[2],from:d(e.line,e.ch),to:d(i,o)}}}else s(e)}}var d=e.Pos,p="A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",h=p+"-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040",m=new RegExp("<(/?)(["+p+"]["+h+"]*)","g");e.registerHelper("fold","xml",function(e,t){for(var n=new r(e,t.line,0);;){var i,o=l(n);if(!o||n.line!=t.line||!(i=a(n)))return;if(!o[1]&&"selfClose"!=i){var t=d(n.line,n.ch),s=u(n,o[2]);return s&&{from:t,to:s.from}}}}),e.findMatchingTag=function(e,n,i){var o=new r(e,n.line,n.ch,i);if(-1!=o.text.indexOf(">")||-1!=o.text.indexOf("<")){var l=a(o),c=l&&d(o.line,o.ch),p=l&&s(o);if(l&&p&&!(t(o,n)>0)){var h={from:d(o.line,o.ch),to:c,tag:p[2]};return"selfClose"==l?{open:h,close:null,at:"open"}:p[1]?{open:f(o,p[2]),close:h,at:"close"}:(o=new r(e,c.line,c.ch,i),{open:h,close:u(o,p[2]),at:"open"})}}},e.findEnclosingTag=function(e,t,n){for(var i=new r(e,t.line,t.ch,n);;){var o=f(i);if(!o)break;var a=new r(e,t.line,t.ch,n),s=u(a,o.tag);if(s)return{open:o,close:s}}},e.scanForClosingTag=function(e,t,n,i){var o=new r(e,t.line,t.ch,i?{from:0,to:i}:null);return u(o,n)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},r={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1};e.defineMode("xml",function(n,i){function o(e,t){function r(r){return t.tokenize=r,r(e,t)}var n=e.next();if("<"==n)return e.eat("!")?e.eat("[")?e.match("CDATA[")?r(l("atom","]]>")):null:e.match("--")?r(l("comment","-->")):e.match("DOCTYPE",!0,!0)?(e.eatWhile(/[\w\._\-]/),r(c(1))):null:e.eat("?")?(e.eatWhile(/[\w\._\-]/),t.tokenize=l("meta","?>"),"meta"):(M=e.eat("/")?"closeTag":"openTag",t.tokenize=a,"tag bracket");if("&"==n){var i;return i=e.eat("#")?e.eat("x")?e.eatWhile(/[a-fA-F\d]/)&&e.eat(";"):e.eatWhile(/[\d]/)&&e.eat(";"):e.eatWhile(/[\w\.\-:]/)&&e.eat(";"),i?"atom":"error"}return e.eatWhile(/[^&<]/),null}function a(e,t){var r=e.next();if(">"==r||"/"==r&&e.eat(">"))return t.tokenize=o,M=">"==r?"endTag":"selfcloseTag","tag bracket";if("="==r)return M="equals",null;if("<"==r){t.tokenize=o,t.state=p,t.tagName=t.tagStart=null;var n=t.tokenize(e,t);return n?n+" tag error":"tag error"}return/[\'\"]/.test(r)?(t.tokenize=s(r),t.stringStartCol=e.column(),t.tokenize(e,t)):(e.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function s(e){var t=function(t,r){for(;!t.eol();)if(t.next()==e){r.tokenize=a;break}return"string"};return t.isInAttribute=!0,t}function l(e,t){return function(r,n){for(;!r.eol();){if(r.match(t)){n.tokenize=o;break}r.next()}return e}}function c(e){return function(t,r){for(var n;null!=(n=t.next());){if("<"==n)return r.tokenize=c(e+1),r.tokenize(t,r);if(">"==n){if(1==e){r.tokenize=o;break}return r.tokenize=c(e-1),r.tokenize(t,r)}}return"meta"}}function u(e,t,r){this.prev=e.context,this.tagName=t,this.indent=e.indented,this.startOfLine=r,(_.doNotIndent.hasOwnProperty(t)||e.context&&e.context.noIndent)&&(this.noIndent=!0)}function f(e){e.context&&(e.context=e.context.prev)}function d(e,t){for(var r;;){if(!e.context)return;if(r=e.context.tagName,!_.contextGrabbers.hasOwnProperty(r)||!_.contextGrabbers[r].hasOwnProperty(t))return;f(e)}}function p(e,t,r){return"openTag"==e?(r.tagStart=t.column(),h):"closeTag"==e?m:p}function h(e,t,r){return"word"==e?(r.tagName=t.current(),L="tag",y):(L="error",h)}function m(e,t,r){if("word"==e){var n=t.current();return r.context&&r.context.tagName!=n&&_.implicitlyClosed.hasOwnProperty(r.context.tagName)&&f(r),r.context&&r.context.tagName==n?(L="tag",g):(L="tag error",v)}return L="error",v}function g(e,t,r){return"endTag"!=e?(L="error",g):(f(r),p)}function v(e,t,r){return L="error", -g(e,t,r)}function y(e,t,r){if("word"==e)return L="attribute",b;if("endTag"==e||"selfcloseTag"==e){var n=r.tagName,i=r.tagStart;return r.tagName=r.tagStart=null,"selfcloseTag"==e||_.autoSelfClosers.hasOwnProperty(n)?d(r,n):(d(r,n),r.context=new u(r,n,i==r.indented)),p}return L="error",y}function b(e,t,r){return"equals"==e?k:(_.allowMissing||(L="error"),y(e,t,r))}function k(e,t,r){return"string"==e?x:"word"==e&&_.allowUnquoted?(L="string",y):(L="error",y(e,t,r))}function x(e,t,r){return"string"==e?x:y(e,t,r)}var w=n.indentUnit,_={},C=i.htmlMode?t:r;for(var S in C)_[S]=C[S];for(var S in i)_[S]=i[S];var M,L;return o.isInText=!0,{startState:function(e){var t={tokenize:o,state:p,indented:e||0,tagName:null,tagStart:null,context:null};return null!=e&&(t.baseIndent=e),t},token:function(e,t){if(!t.tagName&&e.sol()&&(t.indented=e.indentation()),e.eatSpace())return null;M=null;var r=t.tokenize(e,t);return(r||M)&&"comment"!=r&&(L=null,t.state=t.state(M||r,e,t),L&&(r="error"==L?r+" error":L)),r},indent:function(t,r,n){var i=t.context;if(t.tokenize.isInAttribute)return t.tagStart==t.indented?t.stringStartCol+1:t.indented+w;if(i&&i.noIndent)return e.Pass;if(t.tokenize!=a&&t.tokenize!=o)return n?n.match(/^(\s*)/)[0].length:0;if(t.tagName)return _.multilineTagIndentPastTag!==!1?t.tagStart+t.tagName.length+2:t.tagStart+w*(_.multilineTagIndentFactor||1);if(_.alignCDATA&&/$/,blockCommentStart:"",configuration:_.htmlMode?"html":"xml",helperType:_.htmlMode?"html":"xml",skipAttribute:function(e){e.state==k&&(e.state=y)}}}),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../meta")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../meta"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("markdown",function(t,r){function n(r){if(e.findModeByName){var n=e.findModeByName(r);n&&(r=n.mime||n.mimes[0])}var i=e.getMode(t,r);return"null"==i.name?null:i}function i(e,t,r){return t.f=t.inline=r,r(e,t)}function o(e,t,r){return t.f=t.block=r,r(e,t)}function a(e){return!e||!/\S/.test(e.string)}function s(e){return e.linkTitle=!1,e.em=!1,e.strong=!1,e.strikethrough=!1,e.quote=0,e.indentedCode=!1,_&&e.f==c&&(e.f=h,e.block=l),e.trailingSpace=0,e.trailingSpaceNewLine=!1,e.prevLine=e.thisLine,e.thisLine=null,null}function l(e,t){var o=e.sol(),s=t.list!==!1,l=t.indentedCode;t.indentedCode=!1,s&&(t.indentationDiff>=0?(t.indentationDiff<4&&(t.indentation-=t.indentationDiff),t.list=null):t.list=t.indentation>0?null:!1);var c=null;if(t.indentationDiff>=4)return e.skipToEnd(),l||a(t.prevLine)?(t.indentation-=4,t.indentedCode=!0,C.code):null;if(e.eatSpace())return null;if((c=e.match(E))&&c[1].length<=6)return t.header=c[1].length,r.highlightFormatting&&(t.formatting="header"),t.f=t.inline,d(t);if(!(a(t.prevLine)||t.quote||s||l)&&(c=e.match(O)))return t.header="="==c[0].charAt(0)?1:2,r.highlightFormatting&&(t.formatting="header"),t.f=t.inline,d(t);if(e.eat(">"))return t.quote=o?1:t.quote+1,r.highlightFormatting&&(t.formatting="quote"),e.eatSpace(),d(t);if("["===e.peek())return i(e,t,y);if(e.match(M,!0))return t.hr=!0,C.hr;if((a(t.prevLine)||s)&&(e.match(L,!1)||e.match(T,!1))){var f=null;for(e.match(L,!0)?f="ul":(e.match(T,!0),f="ol"),t.indentation=e.column()+e.current().length,t.list=!0;t.listStack&&e.column()")>-1)&&(r.f=h,r.block=l,r.htmlState=null)}return n}function u(e,t){return t.fencedChars&&e.match(t.fencedChars,!1)?(t.localMode=t.localState=null,t.f=t.block=f,null):t.localMode?t.localMode.token(e,t.localState):(e.skipToEnd(),C.code)}function f(e,t){e.match(t.fencedChars),t.block=l,t.f=h,t.fencedChars=null,r.highlightFormatting&&(t.formatting="code-block"),t.code=1;var n=d(t);return t.code=0,n}function d(e){var t=[];if(e.formatting){t.push(C.formatting),"string"==typeof e.formatting&&(e.formatting=[e.formatting]);for(var n=0;n=e.quote?C.formatting+"-"+e.formatting[n]+"-"+e.quote:"error")}if(e.taskOpen)return t.push("meta"),t.length?t.join(" "):null;if(e.taskClosed)return t.push("property"),t.length?t.join(" "):null;if(e.linkHref?t.push(C.linkHref,"url"):(e.strong&&t.push(C.strong),e.em&&t.push(C.em),e.strikethrough&&t.push(C.strikethrough),e.linkText&&t.push(C.linkText),e.code&&t.push(C.code)),e.header&&t.push(C.header,C.header+"-"+e.header),e.quote&&(t.push(C.quote),t.push(!r.maxBlockquoteDepth||r.maxBlockquoteDepth>=e.quote?C.quote+"-"+e.quote:C.quote+"-"+r.maxBlockquoteDepth)),e.list!==!1){var i=(e.listStack.length-1)%3;t.push(i?1===i?C.list2:C.list3:C.list1)}return e.trailingSpaceNewLine?t.push("trailing-space-new-line"):e.trailingSpace&&t.push("trailing-space-"+(e.trailingSpace%2?"a":"b")),t.length?t.join(" "):null}function p(e,t){return e.match(z,!0)?d(t):void 0}function h(t,n){var i=n.text(t,n);if("undefined"!=typeof i)return i;if(n.list)return n.list=null,d(n);if(n.taskList){var a="x"!==t.match(A,!0)[1];return a?n.taskOpen=!0:n.taskClosed=!0,r.highlightFormatting&&(n.formatting="task"),n.taskList=!1,d(n)}if(n.taskOpen=!1,n.taskClosed=!1,n.header&&t.match(/^#+$/,!0))return r.highlightFormatting&&(n.formatting="header"),d(n);var s=t.sol(),l=t.next();if(n.linkTitle){n.linkTitle=!1;var u=l;"("===l&&(u=")"),u=(u+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1");var f="^\\s*(?:[^"+u+"\\\\]+|\\\\\\\\|\\\\.)"+u;if(t.match(new RegExp(f),!0))return C.linkHref}if("`"===l){var p=n.formatting;r.highlightFormatting&&(n.formatting="code"),t.eatWhile("`");var h=t.current().length;if(0==n.code)return n.code=h,d(n);if(h==n.code){var v=d(n);return n.code=0,v}return n.formatting=p,d(n)}if(n.code)return d(n);if("\\"===l&&(t.next(),r.highlightFormatting)){var y=d(n),b=C.formatting+"-escape";return y?y+" "+b:b}if("!"===l&&t.match(/\[[^\]]*\] ?(?:\(|\[)/,!1))return t.match(/\[[^\]]*\]/),n.inline=n.f=g,C.image;if("["===l&&t.match(/.*\](\(.*\)| ?\[.*\])/,!1))return n.linkText=!0,r.highlightFormatting&&(n.formatting="link"),d(n);if("]"===l&&n.linkText&&t.match(/\(.*\)| ?\[.*\]/,!1)){r.highlightFormatting&&(n.formatting="link");var y=d(n);return n.linkText=!1,n.inline=n.f=g,y}if("<"===l&&t.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=m,r.highlightFormatting&&(n.formatting="link");var y=d(n);return y?y+=" ":y="",y+C.linkInline}if("<"===l&&t.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/,!1)){n.f=n.inline=m,r.highlightFormatting&&(n.formatting="link");var y=d(n);return y?y+=" ":y="",y+C.linkEmail}if("<"===l&&t.match(/^(!--|\w)/,!1)){var k=t.string.indexOf(">",t.pos);if(-1!=k){var x=t.string.substring(t.start,k);/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(x)&&(n.md_inside=!0)}return t.backUp(1),n.htmlState=e.startState(w),o(t,n,c)}if("<"===l&&t.match(/^\/\w*?>/))return n.md_inside=!1,"tag";var _=!1;if(!r.underscoresBreakWords&&"_"===l&&"_"!==t.peek()&&t.match(/(\w)/,!1)){var S=t.pos-2;if(S>=0){var M=t.string.charAt(S);"_"!==M&&M.match(/(\w)/,!1)&&(_=!0)}}if("*"===l||"_"===l&&!_)if(s&&" "===t.peek());else{if(n.strong===l&&t.eat(l)){r.highlightFormatting&&(n.formatting="strong");var v=d(n);return n.strong=!1,v}if(!n.strong&&t.eat(l))return n.strong=l,r.highlightFormatting&&(n.formatting="strong"),d(n);if(n.em===l){r.highlightFormatting&&(n.formatting="em");var v=d(n);return n.em=!1,v}if(!n.em)return n.em=l,r.highlightFormatting&&(n.formatting="em"),d(n)}else if(" "===l&&(t.eat("*")||t.eat("_"))){if(" "===t.peek())return d(n);t.backUp(1)}if(r.strikethrough)if("~"===l&&t.eatWhile(l)){if(n.strikethrough){r.highlightFormatting&&(n.formatting="strikethrough");var v=d(n);return n.strikethrough=!1,v}if(t.match(/^[^\s]/,!1))return n.strikethrough=!0,r.highlightFormatting&&(n.formatting="strikethrough"),d(n)}else if(" "===l&&t.match(/^~~/,!0)){if(" "===t.peek())return d(n);t.backUp(2)}return" "===l&&(t.match(/ +$/,!1)?n.trailingSpace++:n.trailingSpace&&(n.trailingSpaceNewLine=!0)),d(n)}function m(e,t){var n=e.next();if(">"===n){t.f=t.inline=h,r.highlightFormatting&&(t.formatting="link");var i=d(t);return i?i+=" ":i="",i+C.linkInline}return e.match(/^[^>]+/,!0),C.linkInline}function g(e,t){if(e.eatSpace())return null;var n=e.next();return"("===n||"["===n?(t.f=t.inline=v("("===n?")":"]"),r.highlightFormatting&&(t.formatting="link-string"),t.linkHref=!0,d(t)):"error"}function v(e){return function(t,n){var i=t.next();if(i===e){n.f=n.inline=h,r.highlightFormatting&&(n.formatting="link-string");var o=d(n);return n.linkHref=!1,o}return t.match(x(e),!0)&&t.backUp(1),n.linkHref=!0,d(n)}}function y(e,t){return e.match(/^([^\]\\]|\\.)*\]:/,!1)?(t.f=b,e.next(),r.highlightFormatting&&(t.formatting="link"),t.linkText=!0,d(t)):i(e,t,h)}function b(e,t){if(e.match(/^\]:/,!0)){t.f=t.inline=k,r.highlightFormatting&&(t.formatting="link");var n=d(t);return t.linkText=!1,n}return e.match(/^([^\]\\]|\\.)+/,!0),C.linkText}function k(e,t){return e.eatSpace()?null:(e.match(/^[^\s]+/,!0),void 0===e.peek()?t.linkTitle=!0:e.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/,!0),t.f=t.inline=h,C.linkHref+" url")}function x(e){return N[e]||(e=(e+"").replace(/([.?*+^$[\]\\(){}|-])/g,"\\$1"),N[e]=new RegExp("^(?:[^\\\\]|\\\\.)*?("+e+")")),N[e]}var w=e.getMode(t,"text/html"),_="null"==w.name;void 0===r.highlightFormatting&&(r.highlightFormatting=!1),void 0===r.maxBlockquoteDepth&&(r.maxBlockquoteDepth=0),void 0===r.underscoresBreakWords&&(r.underscoresBreakWords=!0),void 0===r.taskLists&&(r.taskLists=!1),void 0===r.strikethrough&&(r.strikethrough=!1),void 0===r.tokenTypeOverrides&&(r.tokenTypeOverrides={});var C={header:"header",code:"comment",quote:"quote",list1:"variable-2",list2:"variable-3",list3:"keyword",hr:"hr",image:"tag",formatting:"formatting",linkInline:"link",linkEmail:"link",linkText:"link",linkHref:"string",em:"em",strong:"strong",strikethrough:"strikethrough"};for(var S in C)C.hasOwnProperty(S)&&r.tokenTypeOverrides[S]&&(C[S]=r.tokenTypeOverrides[S]);var M=/^([*\-_])(?:\s*\1){2,}\s*$/,L=/^[*\-+]\s+/,T=/^[0-9]+([.)])\s+/,A=/^\[(x| )\](?=\s)/,E=r.allowAtxHeaderWithoutSpace?/^(#+)/:/^(#+)(?: |$)/,O=/^ *(?:\={1,}|-{1,})\s*$/,z=/^[^#!\[\]*_\\<>` "'(~]+/,I=new RegExp("^("+(r.fencedCodeBlocks===!0?"~~~+|```+":r.fencedCodeBlocks)+")[ \\t]*([\\w+#]*)"),N=[],q={startState:function(){return{f:l,prevLine:null,thisLine:null,block:l,htmlState:null,indentation:0,inline:h,text:p,formatting:!1,linkText:!1,linkHref:!1,linkTitle:!1,code:0,em:!1,strong:!1,header:0,hr:!1,taskList:!1,list:!1,listStack:[],quote:0,trailingSpace:0,trailingSpaceNewLine:!1,strikethrough:!1,fencedChars:null}},copyState:function(t){return{f:t.f,prevLine:t.prevLine,thisLine:t.thisLine,block:t.block,htmlState:t.htmlState&&e.copyState(w,t.htmlState),indentation:t.indentation,localMode:t.localMode,localState:t.localMode?e.copyState(t.localMode,t.localState):null,inline:t.inline,text:t.text,formatting:!1,linkTitle:t.linkTitle,code:t.code,em:t.em,strong:t.strong,strikethrough:t.strikethrough,header:t.header,hr:t.hr,taskList:t.taskList,list:t.list,listStack:t.listStack.slice(0),quote:t.quote,indentedCode:t.indentedCode,trailingSpace:t.trailingSpace,trailingSpaceNewLine:t.trailingSpaceNewLine,md_inside:t.md_inside,fencedChars:t.fencedChars}},token:function(e,t){if(t.formatting=!1,e!=t.thisLine){var r=t.header||t.hr;if(t.header=0,t.hr=!1,e.match(/^\s*$/,!0)||r){if(s(t),!r)return null;t.prevLine=null}t.prevLine=t.thisLine,t.thisLine=e,t.taskList=!1,t.trailingSpace=0,t.trailingSpaceNewLine=!1,t.f=t.block;var n=e.match(/^\s*/,!0)[0].replace(/\t/g," ").length;if(t.indentationDiff=Math.min(n-t.indentation,4),t.indentation=t.indentation+t.indentationDiff,n>0)return null}return t.f(e,t)},innerMode:function(e){return e.block==c?{state:e.htmlState,mode:w}:e.localState?{state:e.localState,mode:e.localMode}:{state:e,mode:q}},blankLine:s,getType:d,fold:"markdown"};return q},"xml"),e.defineMIME("text/x-markdown","markdown")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../markdown/markdown"),require("../../addon/mode/overlay")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../markdown/markdown","../../addon/mode/overlay"],e):e(CodeMirror)}(function(e){"use strict";var t=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i;e.defineMode("gfm",function(r,n){function i(e){return e.code=!1,null}var o=0,a={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(e){return{code:e.code,codeBlock:e.codeBlock,ateSpace:e.ateSpace}},token:function(e,r){if(r.combineTokens=null,r.codeBlock)return e.match(/^```+/)?(r.codeBlock=!1,null):(e.skipToEnd(),null);if(e.sol()&&(r.code=!1),e.sol()&&e.match(/^```+/))return e.skipToEnd(),r.codeBlock=!0,null;if("`"===e.peek()){e.next();var i=e.pos;e.eatWhile("`");var a=1+e.pos-i;return r.code?a===o&&(r.code=!1):(o=a,r.code=!0),null}if(r.code)return e.next(),null;if(e.eatSpace())return r.ateSpace=!0,null;if((e.sol()||r.ateSpace)&&(r.ateSpace=!1,n.gitHubSpice!==!1)){if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?:[a-f0-9]{7,40}\b)/))return r.combineTokens=!0,"link";if(e.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/))return r.combineTokens=!0,"link"}return e.match(t)&&"]("!=e.string.slice(e.start-2,e.start)&&(0==e.start||/\W/.test(e.string.charAt(e.start-1)))?(r.combineTokens=!0,"link"):(e.next(),null)},blankLine:i},s={underscoresBreakWords:!1,taskLists:!0,fencedCodeBlocks:"```",strikethrough:!0};for(var l in n)s[l]=n[l];return s.name="markdown",e.overlayMode(e.getMode(r,s),a)},"markdown"),e.defineMIME("text/x-gfm","gfm")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r){return/^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}e.defineMode("javascript",function(r,n){function i(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}function o(e,t,r){return ke=e,xe=r,t}function a(e,r){var n=e.next();if('"'==n||"'"==n)return r.tokenize=s(n),r.tokenize(e,r);if("."==n&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return o("number","number");if("."==n&&e.match(".."))return o("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(n))return o(n);if("="==n&&e.eat(">"))return o("=>","operator");if("0"==n&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),o("number","number");if("0"==n&&e.eat(/o/i))return e.eatWhile(/[0-7]/i),o("number","number");if("0"==n&&e.eat(/b/i))return e.eatWhile(/[01]/i),o("number","number");if(/\d/.test(n))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),o("number","number");if("/"==n)return e.eat("*")?(r.tokenize=l,l(e,r)):e.eat("/")?(e.skipToEnd(),o("comment","comment")):t(e,r,1)?(i(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),o("regexp","string-2")):(e.eatWhile(Ae),o("operator","operator",e.current()));if("`"==n)return r.tokenize=c,c(e,r);if("#"==n)return e.skipToEnd(),o("error","error");if(Ae.test(n))return e.eatWhile(Ae),o("operator","operator",e.current());if(Le.test(n)){e.eatWhile(Le);var a=e.current(),u=Te.propertyIsEnumerable(a)&&Te[a];return u&&"."!=r.lastType?o(u.type,u.style,a):o("variable","variable",a)}}function s(e){return function(t,r){var n,i=!1;if(Ce&&"@"==t.peek()&&t.match(Ee))return r.tokenize=a,o("jsonld-keyword","meta");for(;null!=(n=t.next())&&(n!=e||i);)i=!i&&"\\"==n;return i||(r.tokenize=a),o("string","string")}}function l(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=a;break}n="*"==r}return o("comment","comment")}function c(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=a;break}n=!n&&"\\"==r}return o("quasi","string-2",e.current())}function u(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(0>r)){for(var n=0,i=!1,o=r-1;o>=0;--o){var a=e.string.charAt(o),s=Oe.indexOf(a);if(s>=0&&3>s){if(!n){++o;break}if(0==--n)break}else if(s>=3&&6>s)++n;else if(Le.test(a))i=!0;else{if(/["'\/]/.test(a))return;if(i&&!n){++o;break}}}i&&!n&&(t.fatArrowAt=o)}}function f(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function d(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function p(e,t,r,n,i){var o=e.cc;for(Ie.state=e,Ie.stream=i,Ie.marked=null,Ie.cc=o,Ie.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){var a=o.length?o.pop():Se?_:w;if(a(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()();return Ie.marked?Ie.marked:"variable"==r&&d(e,n)?"variable-2":t}}}function h(){for(var e=arguments.length-1;e>=0;e--)Ie.cc.push(arguments[e])}function m(){return h.apply(null,arguments),!0}function g(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}var r=Ie.state;if(Ie.marked="def",r.context){if(t(r.localVars))return;r.localVars={name:e,next:r.localVars}}else{if(t(r.globalVars))return;n.globalVars&&(r.globalVars={name:e,next:r.globalVars})}}function v(){Ie.state.context={prev:Ie.state.context,vars:Ie.state.localVars},Ie.state.localVars=Ne}function y(){Ie.state.localVars=Ie.state.context.vars,Ie.state.context=Ie.state.context.prev}function b(e,t){var r=function(){var r=Ie.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var i=r.lexical;i&&")"==i.type&&i.align;i=i.prev)n=i.indented;r.lexical=new f(n,Ie.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function k(){var e=Ie.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function x(e){function t(r){return r==e?m():";"==e?h():m(t)}return t}function w(e,t){return"var"==e?m(b("vardef",t.length),G,x(";"),k):"keyword a"==e?m(b("form"),_,w,k):"keyword b"==e?m(b("form"),w,k):"{"==e?m(b("}"),$,k):";"==e?m():"if"==e?("else"==Ie.state.lexical.info&&Ie.state.cc[Ie.state.cc.length-1]==k&&Ie.state.cc.pop()(),m(b("form"),_,w,k,J)):"function"==e?m(oe):"for"==e?m(b("form"),ee,w,k):"variable"==e?m(b("stat"),R):"switch"==e?m(b("form"),_,b("}","switch"),x("{"),$,k,k):"case"==e?m(_,x(":")):"default"==e?m(x(":")):"catch"==e?m(b("form"),v,x("("),ae,x(")"),w,k,y):"class"==e?m(b("form"),se,k):"export"==e?m(b("stat"),fe,k):"import"==e?m(b("stat"),de,k):"module"==e?m(b("form"),X,b("}"),x("{"),$,k,k):h(b("stat"),_,x(";"),k)}function _(e){return S(e,!1)}function C(e){return S(e,!0)}function S(e,t){if(Ie.state.fatArrowAt==Ie.stream.start){var r=t?I:z;if("("==e)return m(v,b(")"),F(X,")"),k,x("=>"),r,y);if("variable"==e)return h(v,X,x("=>"),r,y)}var n=t?A:T;return ze.hasOwnProperty(e)?m(n):"function"==e?m(oe,n):"keyword c"==e?m(t?L:M):"("==e?m(b(")"),M,ye,x(")"),k,n):"operator"==e||"spread"==e?m(t?C:_):"["==e?m(b("]"),ge,k,n):"{"==e?H(D,"}",null,n):"quasi"==e?h(E,n):"new"==e?m(N(t)):m()}function M(e){return e.match(/[;\}\)\],]/)?h():h(_)}function L(e){return e.match(/[;\}\)\],]/)?h():h(C)}function T(e,t){return","==e?m(_):A(e,t,!1)}function A(e,t,r){var n=0==r?T:A,i=0==r?_:C;return"=>"==e?m(v,r?I:z,y):"operator"==e?/\+\+|--/.test(t)?m(n):"?"==t?m(_,x(":"),i):m(i):"quasi"==e?h(E,n):";"!=e?"("==e?H(C,")","call",n):"."==e?m(j,n):"["==e?m(b("]"),M,x("]"),k,n):void 0:void 0}function E(e,t){return"quasi"!=e?h():"${"!=t.slice(t.length-2)?m(E):m(_,O)}function O(e){return"}"==e?(Ie.marked="string-2",Ie.state.tokenize=c,m(E)):void 0}function z(e){return u(Ie.stream,Ie.state),h("{"==e?w:_)}function I(e){return u(Ie.stream,Ie.state),h("{"==e?w:C)}function N(e){return function(t){return"."==t?m(e?P:q):h(e?C:_)}}function q(e,t){return"target"==t?(Ie.marked="keyword",m(T)):void 0}function P(e,t){return"target"==t?(Ie.marked="keyword",m(A)):void 0}function R(e){return":"==e?m(k,w):h(T,x(";"),k)}function j(e){return"variable"==e?(Ie.marked="property",m()):void 0}function D(e,t){return"variable"==e||"keyword"==Ie.style?(Ie.marked="property",m("get"==t||"set"==t?B:W)):"number"==e||"string"==e?(Ie.marked=Ce?"property":Ie.style+" property",m(W)):"jsonld-keyword"==e?m(W):"modifier"==e?m(D):"["==e?m(_,x("]"),W):"spread"==e?m(_):void 0}function B(e){return"variable"!=e?h(W):(Ie.marked="property",m(oe))}function W(e){return":"==e?m(C):"("==e?h(oe):void 0}function F(e,t){function r(n){if(","==n){var i=Ie.state.lexical;return"call"==i.info&&(i.pos=(i.pos||0)+1),m(e,r)}return n==t?m():m(x(t))}return function(n){return n==t?m():h(e,r)}}function H(e,t,r){for(var n=3;n!?|~^]/,Ee=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Oe="([{}])",ze={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},Ie={state:null,column:null,marked:null,cc:null},Ne={name:"this",next:{name:"arguments"}};return k.lex=!0,{startState:function(e){var t={tokenize:a,lastType:"sof",cc:[],lexical:new f((e||0)-we,0,"block",!1),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented:e||0};return n.globalVars&&"object"==typeof n.globalVars&&(t.globalVars=n.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),u(e,t)),t.tokenize!=l&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==ke?r:(t.lastType="operator"!=ke||"++"!=xe&&"--"!=xe?ke:"incdec",p(t,r,ke,xe,e))},indent:function(t,r){if(t.tokenize==l)return e.Pass;if(t.tokenize!=a)return 0;var i=r&&r.charAt(0),o=t.lexical;if(!/^\s*else\b/.test(r))for(var s=t.cc.length-1;s>=0;--s){var c=t.cc[s];if(c==k)o=o.prev;else if(c!=J)break}"stat"==o.type&&"}"==i&&(o=o.prev),_e&&")"==o.type&&"stat"==o.prev.type&&(o=o.prev);var u=o.type,f=i==u;return"vardef"==u?o.indented+("operator"==t.lastType||","==t.lastType?o.info+1:0):"form"==u&&"{"==i?o.indented:"form"==u?o.indented+we:"stat"==u?o.indented+(be(t,r)?_e||we:0):"switch"!=o.info||f||0==n.doubleIndentSwitch?o.align?o.column+(f?0:1):o.indented+(f?0:we):o.indented+(/^(?:case|default)\b/.test(r)?we:2*we)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:Se?null:"/*",blockCommentEnd:Se?null:"*/",lineComment:Se?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:Se?"json":"javascript",jsonldMode:Ce,jsonMode:Se,expressionAllowed:t,skipExpression:function(e){var t=e.cc[e.cc.length-1];(t==_||t==C)&&e.cc.pop()}}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=0;r*\/]/.test(r)?n(null,"select-op"):"."==r&&e.match(/^-?[_a-z][_a-z0-9-]*/i)?n("qualifier","qualifier"):/[:;{}\[\]\(\)]/.test(r)?n(null,r):"u"==r&&e.match(/rl(-prefix)?\(/)||"d"==r&&e.match("omain(")||"r"==r&&e.match("egexp(")?(e.backUp(1),t.tokenize=a,n("property","word")):/[\w\\\-]/.test(r)?(e.eatWhile(/[\w\\\-]/),n("property","word")):n(null,null):/[\d.]/.test(e.peek())?(e.eatWhile(/[\w.%]/),n("number","unit")):e.match(/^-[\w\\\-]+/)?(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?n("variable-2","variable-definition"):n("variable-2","variable")):e.match(/^\w+-/)?n("meta","meta"):void 0}function o(e){return function(t,r){for(var i,o=!1;null!=(i=t.next());){if(i==e&&!o){")"==e&&t.backUp(1);break}o=!o&&"\\"==i}return(i==e||!o&&")"!=e)&&(r.tokenize=null),n("string","string")}}function a(e,t){return e.next(),t.tokenize=e.match(/\s*[\"\')]/,!1)?null:o(")"),n(null,"(")}function s(e,t,r){this.type=e,this.indent=t,this.prev=r}function l(e,t,r,n){return e.context=new s(r,t.indentation()+(n===!1?0:g),e.context),r}function c(e){return e.context.prev&&(e.context=e.context.prev),e.context.type}function u(e,t,r){return E[r.context.type](e,t,r)}function f(e,t,r,n){for(var i=n||1;i>0;i--)r.context=r.context.prev;return u(e,t,r)}function d(e){var t=e.current().toLowerCase();m=L.hasOwnProperty(t)?"atom":M.hasOwnProperty(t)?"keyword":"variable"}var p=r.inline;r.propertyKeywords||(r=e.resolveMode("text/css"));var h,m,g=t.indentUnit,v=r.tokenHooks,y=r.documentTypes||{},b=r.mediaTypes||{},k=r.mediaFeatures||{},x=r.mediaValueKeywords||{},w=r.propertyKeywords||{},_=r.nonStandardPropertyKeywords||{},C=r.fontProperties||{},S=r.counterDescriptors||{},M=r.colorKeywords||{},L=r.valueKeywords||{},T=r.allowNested,A=r.supportsAtComponent===!0,E={};return E.top=function(e,t,r){if("{"==e)return l(r,t,"block");if("}"==e&&r.context.prev)return c(r);if(A&&/@component/.test(e))return l(r,t,"atComponentBlock");if(/^@(-moz-)?document$/.test(e))return l(r,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/.test(e))return l(r,t,"atBlock");if(/^@(font-face|counter-style)/.test(e))return r.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return l(r,t,"at"); +return E.top=function(e,t,r){if("{"==e)return l(r,t,"block");if("}"==e&&r.context.prev)return c(r);if(A&&/@component/.test(e))return l(r,t,"atComponentBlock");if(/^@(-moz-)?document$/.test(e))return l(r,t,"documentTypes");if(/^@(media|supports|(-moz-)?document|import)$/.test(e))return l(r,t,"atBlock");if(/^@(font-face|counter-style)/.test(e))return r.stateArg=e,"restricted_atBlock_before";if(/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(e))return"keyframes";if(e&&"@"==e.charAt(0))return l(r,t,"at");if("hash"==e)m="builtin";else if("word"==e)m="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return l(r,t,"interpolation");if(":"==e)return"pseudo";if(T&&"("==e)return l(r,t,"parens")}return r.context.type},E.block=function(e,t,r){if("word"==e){var n=t.current().toLowerCase();return w.hasOwnProperty(n)?(m="property","maybeprop"):_.hasOwnProperty(n)?(m="string-2","maybeprop"):T?(m=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(m+=" error","maybeprop")}return"meta"==e?"block":T||"hash"!=e&&"qualifier"!=e?E.top(e,t,r):(m="error","block")},E.maybeprop=function(e,t,r){return":"==e?l(r,t,"prop"):u(e,t,r)},E.prop=function(e,t,r){if(";"==e)return c(r);if("{"==e&&T)return l(r,t,"propBlock");if("}"==e||"{"==e)return d(e,t,r);if("("==e)return l(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current())){if("word"==e)f(t);else if("interpolation"==e)return l(r,t,"interpolation")}else m+=" error";return"prop"},E.propBlock=function(e,t,r){return"}"==e?c(r):"word"==e?(m="property","maybeprop"):r.context.type},E.parens=function(e,t,r){return"{"==e||"}"==e?d(e,t,r):")"==e?c(r):"("==e?l(r,t,"parens"):"interpolation"==e?l(r,t,"interpolation"):("word"==e&&f(t),"parens")},E.pseudo=function(e,t,r){return"word"==e?(m="variable-3",r.context.type):u(e,t,r)},E.documentTypes=function(e,t,r){return"word"==e&&y.hasOwnProperty(t.current())?(m="tag",r.context.type):E.atBlock(e,t,r)},E.atBlock=function(e,t,r){if("("==e)return l(r,t,"atBlock_parens");if("}"==e||";"==e)return d(e,t,r);if("{"==e)return c(r)&&l(r,t,T?"block":"top");if("interpolation"==e)return l(r,t,"interpolation");if("word"==e){var n=t.current().toLowerCase();m="only"==n||"not"==n||"and"==n||"or"==n?"keyword":b.hasOwnProperty(n)?"attribute":k.hasOwnProperty(n)?"property":x.hasOwnProperty(n)?"keyword":w.hasOwnProperty(n)?"property":_.hasOwnProperty(n)?"string-2":L.hasOwnProperty(n)?"atom":M.hasOwnProperty(n)?"keyword":"error"}return r.context.type},E.atComponentBlock=function(e,t,r){return"}"==e?d(e,t,r):"{"==e?c(r)&&l(r,t,T?"block":"top",!1):("word"==e&&(m="error"),r.context.type)},E.atBlock_parens=function(e,t,r){return")"==e?c(r):"{"==e||"}"==e?d(e,t,r,2):E.atBlock(e,t,r)},E.restricted_atBlock_before=function(e,t,r){return"{"==e?l(r,t,"restricted_atBlock"):"word"==e&&"@counter-style"==r.stateArg?(m="variable","restricted_atBlock_before"):u(e,t,r)},E.restricted_atBlock=function(e,t,r){return"}"==e?(r.stateArg=null,c(r)):"word"==e?(m="@font-face"==r.stateArg&&!C.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==r.stateArg&&!S.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},E.keyframes=function(e,t,r){return"word"==e?(m="variable","keyframes"):"{"==e?l(r,t,"top"):u(e,t,r)},E.at=function(e,t,r){return";"==e?c(r):"{"==e||"}"==e?d(e,t,r):("word"==e?m="tag":"hash"==e&&(m="builtin"),"at")},E.interpolation=function(e,t,r){return"}"==e?c(r):"{"==e||";"==e?d(e,t,r):("word"==e?m="variable":"variable"!=e&&"("!=e&&")"!=e&&(m="error"),"interpolation")},{startState:function(e){return{tokenize:null,state:p?"block":"top",stateArg:null,context:new s(p?"block":"top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var r=(t.tokenize||i)(e,t);return r&&"object"==typeof r&&(h=r[1],r=r[0]),m=r,t.state=E[t.state](h,e,t),m},indent:function(e,t){var r=e.context,n=t&&t.charAt(0),i=r.indent;return"prop"!=r.type||"}"!=n&&")"!=n||(r=r.prev),r.prev&&("}"!=n||"block"!=r.type&&"top"!=r.type&&"interpolation"!=r.type&&"restricted_atBlock"!=r.type?(")"==n&&("parens"==r.type||"atBlock_parens"==r.type)||"{"==n&&("at"==r.type||"atBlock"==r.type))&&(i=Math.max(0,r.indent-g),r=r.prev):(r=r.prev,i=r.indent)),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var n=["domain","regexp","url","url-prefix"],i=t(n),o=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],a=t(o),s=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],l=t(s),c=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],u=t(c),d=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],f=t(d),p=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],h=t(p),m=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],g=t(m),v=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],y=t(v),b=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],k=t(b),x=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],w=t(x),_=n.concat(o).concat(s).concat(c).concat(d).concat(p).concat(b).concat(x);e.registerHelper("hintWords","css",_),e.defineMIME("text/css",{documentTypes:i,mediaTypes:a,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:f,nonStandardPropertyKeywords:h,fontProperties:g,counterDescriptors:y,colorKeywords:k,valueKeywords:w,tokenHooks:{"/":function(e,t){return e.eat("*")?(t.tokenize=r,r(e,t)):!1}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:a,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:f,nonStandardPropertyKeywords:h,colorKeywords:k,valueKeywords:w,fontProperties:g,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},":":function(e){return e.match(/\s*\{/)?[null,"{"]:!1},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return e.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:a,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:f,nonStandardPropertyKeywords:h,colorKeywords:k,valueKeywords:w,fontProperties:g,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)?!1:(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),e.defineMIME("text/x-gss",{documentTypes:i,mediaTypes:a,mediaFeatures:l,propertyKeywords:f,nonStandardPropertyKeywords:h,fontProperties:g,counterDescriptors:y,colorKeywords:k,valueKeywords:w,supportsAtComponent:!0,tokenHooks:{"/":function(e,t){return e.eat("*")?(t.tokenize=r,r(e,t)):!1}},name:"css",helperType:"gss"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r){var n=e.current(),i=n.search(t);return i>-1?e.backUp(n.length-i):n.match(/<\/?$/)&&(e.backUp(n.length),e.match(t,!1)||e.match(n)),r}function r(e){var t=l[e];return t?t:l[e]=new RegExp("\\s+"+e+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")}function n(e,t){var n=e.match(r(t));return n?n[2]:""}function i(e,t){return new RegExp((t?"^":"")+"","i")}function o(e,t){for(var r in e)for(var n=t[r]||(t[r]=[]),i=e[r],o=i.length-1;o>=0;o--)n.unshift(i[o])}function a(e,t){for(var r=0;r\s\/]/.test(n.current())&&(s=o.htmlState.tagName&&o.htmlState.tagName.toLowerCase())&&u.hasOwnProperty(s))o.inTag=s+" ";else if(o.inTag&&f&&/>$/.test(n.current())){var p=/^([\S]+) (.*)/.exec(o.inTag);o.inTag=null;var h=">"==n.current()&&a(u[p[1]],p[2]),m=e.getMode(r,h),g=i(p[1],!0),v=i(p[1],!1);o.token=function(e,r){return e.match(g,!1)?(r.token=l,r.localState=r.localMode=null,null):t(e,v,r.localMode.token(e,r.localState))},o.localMode=m,o.localState=e.startState(m,c.indent(o.htmlState,""))}else o.inTag&&(o.inTag+=n.current(),n.eol()&&(o.inTag+=" "));return d}var c=e.getMode(r,{name:"xml",htmlMode:!0,multilineTagIndentFactor:n.multilineTagIndentFactor,multilineTagIndentPastTag:n.multilineTagIndentPastTag}),u={},d=n&&n.tags,f=n&&n.scriptTypes;if(o(s,u),d&&o(d,u),f)for(var p=f.length-1;p>=0;p--)u.script.unshift(["type",f[p].matches,f[p].mode]);return{startState:function(){var e=c.startState();return{token:l,inTag:null,localMode:null,localState:null,htmlState:e}},copyState:function(t){var r;return t.localState&&(r=e.copyState(t.localMode,t.localState)),{token:t.token,inTag:t.inTag,localMode:t.localMode,localState:r,htmlState:e.copyState(c,t.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(t,r){return!t.localMode||/^\s*<\//.test(r)?c.indent(t.htmlState,r):t.localMode.indent?t.localMode.indent(t.localState,r):e.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||c}}}},"xml","javascript","css"),e.defineMIME("text/html","htmlmixed")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../../addon/mode/multiplex")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../../addon/mode/multiplex"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("htmlembedded",function(t,r){return e.multiplexingMode(e.getMode(t,"htmlmixed"),{open:r.open||r.scriptStartRegex||"<%",close:r.close||r.scriptEndRegex||"%>",mode:e.getMode(t,r.scriptingModeSpec)})},"htmlmixed"),e.defineMIME("application/x-ejs",{name:"htmlembedded",scriptingModeSpec:"javascript"}),e.defineMIME("application/x-aspx",{name:"htmlembedded",scriptingModeSpec:"text/x-csharp"}),e.defineMIME("application/x-jsp",{name:"htmlembedded",scriptingModeSpec:"text/x-java"}),e.defineMIME("application/x-erb",{name:"htmlembedded",scriptingModeSpec:"ruby"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r,n,i){this.indented=e,this.column=t,this.type=r,this.align=n,this.prev=i}function r(e){return"statement"==e||"switchstatement"==e||"namespace"==e}function n(e,n,i){var o=e.indented;return e.context&&r(e.context.type)&&!r(i)&&(o=e.context.indented),e.context=new t(o,n,i,null,e.context)}function i(e){var t=e.context.type;return(")"==t||"]"==t||"}"==t)&&(e.indented=e.context.indented),e.context=e.context.prev}function o(e,t){return"variable"==t.prevToken||"variable-3"==t.prevToken?!0:/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,e.start))?!0:void 0}function a(e){for(;;){if(!e||"top"==e.type)return!0;if("}"==e.type&&"namespace"!=e.prev.type)return!1;e=e.prev}}function s(e){for(var t={},r=e.split(" "),n=0;n!?|\/]/,I=c.endStatement||/^[;:,]$/;return{startState:function(e){return{tokenize:null,context:new t((e||0)-m,0,"top",!1),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var s=t.context;if(e.sol()&&(null==s.align&&(s.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return null;p=h=null;var l=(t.tokenize||u)(e,t);if("comment"==l||"meta"==l)return l;if(null==s.align&&(s.align=!0),I.test(p))for(;r(t.context.type);)i(t);else if("{"==p)n(t,e.column(),"}");else if("["==p)n(t,e.column(),"]");else if("("==p)n(t,e.column(),")");else if("}"==p){for(;r(s.type);)s=i(t);for("}"==s.type&&(s=i(t));r(s.type);)s=i(t)}else if(p==s.type)i(t);else if(M&&(("}"==s.type||"top"==s.type)&&";"!=p||r(s.type)&&"newstatement"==p)){var d="statement";"newstatement"==p&&L&&"switch"==e.current()?d="switchstatement":"keyword"==l&&"namespace"==e.current()&&(d="namespace"),n(t,e.column(),d)}if("variable"==l&&("def"==t.prevToken||c.typeFirstDefinitions&&o(e,t)&&a(t.context)&&e.match(/^\s*\(/,!1))&&(l="def"),C.token){var f=C.token(e,t,l);void 0!==f&&(l=f)}return"def"==l&&c.styleDefs===!1&&(l="variable"),t.startOfLine=!1,t.prevToken=h?"def":l||p,l},indent:function(t,n){if(t.tokenize!=u&&null!=t.tokenize)return e.Pass;var i=t.context,o=n&&n.charAt(0);if(r(i.type)&&"}"==o&&(i=i.prev),C.indent){var a=C.indent(t,i,n);if("number"==typeof a)return a}var s=o==i.type,l=i.prev&&"switchstatement"==i.prev.type;if(c.allmanIndentation&&/[{(]/.test(o)){for(;"top"!=i.type&&"}"!=i.type;)i=i.prev;return i.indented}return r(i.type)?i.indented+("{"==o?0:g):!i.align||v&&")"==i.type?")"!=i.type||s?i.indented+(s?0:m)+(s||!l||/^(?:case|default)\b/.test(n)?0:m):i.indented+g:i.column+(s?0:1)},electricInput:L?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}});var k="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile",x="int long char short double float unsigned signed void size_t ptrdiff_t";g(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:s(k),types:s(x+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"), +blockKeywords:s("case do else for if switch while struct"),defKeywords:s("struct"),typeFirstDefinitions:!0,atoms:s("null true false"),hooks:{"#":c,"*":u},modeProps:{fold:["brace","include"]}}),g(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:s(k+" asm dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:s(x+" bool wchar_t"),blockKeywords:s("catch class do else finally for if struct switch try while"),defKeywords:s("class namespace struct enum union"),typeFirstDefinitions:!0,atoms:s("true false null"),hooks:{"#":c,"*":u,u:f,U:f,L:f,R:f,0:d,1:d,2:d,3:d,4:d,5:d,6:d,7:d,8:d,9:d,token:function(e,t,r){return"variable"!=r||"("!=e.peek()||";"!=t.prevToken&&null!=t.prevToken&&"}"!=t.prevToken||!p(e.current())?void 0:"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),g("text/x-java",{name:"clike",keywords:s("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while"),types:s("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:s("catch class do else finally for if switch try while"),defKeywords:s("class interface package enum"),typeFirstDefinitions:!0,atoms:s("true false null"),endStatement:/^[;:]$/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"}},modeProps:{fold:["brace","import"]}}),g("text/x-csharp",{name:"clike",keywords:s("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:s("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:s("catch class do else finally for foreach if struct switch try while"),defKeywords:s("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:s("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=h,h(e,t)):(e.eatWhile(/[\w\$_]/),"meta")}}}),g("text/x-scala",{name:"clike",keywords:s("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ : = => <- <: <% >: # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble :: #:: "),types:s("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:s("catch class do else finally for forSome if match switch try while"),defKeywords:s("class def object package trait type val var"),atoms:s("true false null"),indentStatements:!1,indentSwitch:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return e.match('""')?(t.tokenize=v,t.tokenize(e,t)):!1},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(e,r){var n=r.context;return"}"==n.type&&n.align&&e.eat(">")?(r.context=new t(n.indented,n.column,n.type,null,n.prev),"operator"):!1}},modeProps:{closeBrackets:{triples:'"'}}}),g("text/x-kotlin",{name:"clike",keywords:s("package as typealias class interface this super val var fun for is in This throw return break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix"),types:s("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,blockKeywords:s("catch class do else finally for if where try while enum"),defKeywords:s("class val var object package interface fun"),atoms:s("true false null this"),hooks:{'"':function(e,t){return t.tokenize=y(e.match('""')),t.tokenize(e,t)}},modeProps:{closeBrackets:{triples:'"'}}}),g(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:s("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:s("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:s("for while do if else struct"),builtin:s("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:s("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":c},modeProps:{fold:["brace","include"]}}),g("text/x-nesc",{name:"clike",keywords:s(k+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:s(x),blockKeywords:s("case do else for if switch while struct"),atoms:s("null true false"),hooks:{"#":c},modeProps:{fold:["brace","include"]}}),g("text/x-objectivec",{name:"clike",keywords:s(k+"inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),types:s(x),atoms:s("YES NO NULL NILL ON OFF true false"),hooks:{"@":function(e){return e.eatWhile(/[\w\$]/),"keyword"},"#":c,indent:function(e,t,r){return"statement"==t.type&&/^@\w/.test(r)?t.indented:void 0}},modeProps:{fold:"brace"}}),g("text/x-squirrel",{name:"clike",keywords:s("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:s(x),blockKeywords:s("case catch class else for foreach if switch try while"),defKeywords:s("function local class"),typeFirstDefinitions:!0,atoms:s("true false null"),hooks:{"#":c},modeProps:{fold:["brace","include"]}});var w=null;g("text/x-ceylon",{name:"clike",keywords:s("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){var t=e.charAt(0);return t===t.toUpperCase()&&t!==t.toLowerCase()},blockKeywords:s("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:s("class dynamic function interface module object package value"),builtin:s("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:s("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return t.tokenize=b(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return w&&e.match("`")?(t.tokenize=w,w=null,t.tokenize(e,t)):!1},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(e,t,r){return"variable"!=r&&"variable-3"!=r||"."!=t.prevToken?void 0:"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("clojure",function(e){function t(e){for(var t={},r=e.split(" "),n=0;n ->> doto and or dosync doseq dotimes dorun doall load import unimport ns in-ns refer try catch finally throw with-open with-local-vars binding gen-class gen-and-load-class gen-and-save-class handler-case handle"),k=t("* *' *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* *command-line-args* *compile-files* *compile-path* *compiler-options* *data-readers* *e *err* *file* *flush-on-newline* *fn-loader* *in* *math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* *source-path* *unchecked-math* *use-context-classloader* *verbose-defrecords* *warn-on-reflection* + +' - -' -> ->> ->ArrayChunk ->Vec ->VecNode ->VecSeq -cache-protocol-fn -reset-methods .. / < <= = == > >= EMPTY-NODE accessor aclone add-classpath add-watch agent agent-error agent-errors aget alength alias all-ns alter alter-meta! alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint biginteger binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* bound? butlast byte byte-array bytes case cast char char-array char-escape-string char-name-string char? chars chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors clojure-version coll? comment commute comp comparator compare compare-and-set! compile complement concat cond condp conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec dec' decimal? declare default-data-readers definline definterface defmacro defmethod defmulti defn defn- defonce defprotocol defrecord defstruct deftype delay delay? deliver denominator deref derive descendants destructure disj disj! dissoc dissoc! distinct distinct? doall dorun doseq dosync dotimes doto double double-array doubles drop drop-last drop-while empty empty? ensure enumeration-seq error-handler error-mode eval even? every-pred every? ex-data ex-info extend extend-protocol extend-type extenders extends? false? ffirst file-seq filter filterv find find-keyword find-ns find-protocol-impl find-protocol-method find-var first flatten float float-array float? floats flush fn fn? fnext fnil for force format frequencies future future-call future-cancel future-cancelled? future-done? future? gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator group-by hash hash-combine hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc inc' init-proxy instance? int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt keep keep-indexed key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array make-hierarchy map map-indexed map? mapcat mapv max max-key memfn memoize merge merge-with meta method-sig methods min min-key mod munge name namespace namespace-munge neg? newline next nfirst nil? nnext not not-any? not-empty not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias ns-unmap nth nthnext nthrest num number? numerator object-array odd? or parents partial partition partition-all partition-by pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers primitives-classnames print print-ctor print-dup print-method print-simple print-str printf println println-str prn prn-str promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot rand rand-int rand-nth range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern re-seq read read-line read-string realized? reduce reduce-kv reductions ref ref-history-count ref-max-history ref-min-history ref-set refer refer-clojure reify release-pending-sends rem remove remove-all-methods remove-method remove-ns remove-watch repeat repeatedly replace replicate require reset! reset-meta! resolve rest restart-agent resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off seq seq? seque sequence sequential? set set-error-handler! set-error-mode! set-validator! set? short short-array shorts shuffle shutdown-agents slurp some some-fn sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? special-symbol? spit split-at split-with str string? struct struct-map subs subseq subvec supers swap! symbol symbol? sync take take-last take-nth take-while test the-ns thread-bound? time to-array to-array-2d trampoline transient tree-seq true? type unchecked-add unchecked-add-int unchecked-byte unchecked-char unchecked-dec unchecked-dec-int unchecked-divide-int unchecked-double unchecked-float unchecked-inc unchecked-inc-int unchecked-int unchecked-long unchecked-multiply unchecked-multiply-int unchecked-negate unchecked-negate-int unchecked-remainder-int unchecked-short unchecked-subtract unchecked-subtract-int underive unquote unquote-splicing update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector-of vector? when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context with-local-vars with-meta with-open with-out-str with-precision with-redefs with-redefs-fn xml-seq zero? zipmap *default-data-reader-fn* as-> cond-> cond->> reduced reduced? send-via set-agent-send-executor! set-agent-send-off-executor! some-> some->>"),x=t("ns fn def defn defmethod bound-fn if if-not case condp when while when-not when-first do future comment doto locking proxy with-open with-precision reify deftype defrecord defprotocol extend extend-protocol extend-type try catch let letfn binding loop for doseq dotimes when-let if-let defstruct struct-map assoc testing deftest handler-case handle dotrace deftrace"),w={digit:/\d/,digit_or_colon:/[\d:]/,hex:/[0-9a-f]/i,sign:/[+-]/,exponent:/e/i,keyword_char:/[^\s\(\[\;\)\]]/,symbol:/[\w*+!\-\._?:<>\/\xa1-\uffff]/,block_indent:/^(?:def|with)[^\/]+$|\/(?:def|with)/};return{startState:function(){return{indentStack:null,indentation:0,mode:!1}},token:function(e,t){if(null==t.indentStack&&e.sol()&&(t.indentation=e.indentation()),"string"!=t.mode&&e.eatSpace())return null;var r=null;switch(t.mode){case"string":for(var _,C=!1;null!=(_=e.next());){if('"'==_&&!C){t.mode=!1;break}C=!C&&"\\"==_}r=c;break;default:var S=e.next();if('"'==S)t.mode="string",r=c;else if("\\"==S)a(e),r=u;else if("'"!=S||w.digit_or_colon.test(e.peek()))if(";"==S)e.skipToEnd(),r=l;else if(o(S,e))r=f;else if("("==S||"["==S||"{"==S){var M,L="",T=e.column();if("("==S)for(;null!=(M=e.eat(w.keyword_char));)L+=M;L.length>0&&(x.propertyIsEnumerable(L)||w.block_indent.test(L))?n(t,T+g,S):(e.eatSpace(),e.eol()||";"==e.peek()?n(t,T+v,S):n(t,T+e.current().length,S)),e.backUp(e.current().length-1),r=p}else if(")"==S||"]"==S||"}"==S)r=p,null!=t.indentStack&&t.indentStack.type==(")"==S?"(":"]"==S?"[":"{")&&i(t);else{if(":"==S)return e.eatWhile(w.symbol),d;e.eatWhile(w.symbol),r=b&&b.propertyIsEnumerable(e.current())?h:k&&k.propertyIsEnumerable(e.current())?s:y&&y.propertyIsEnumerable(e.current())?d:m}else r=d}return r},indent:function(e){return null==e.indentStack?e.indentation:e.indentStack.indent},closeBrackets:{pairs:'()[]{}""'},lineComment:";;"}}),e.defineMIME("text/x-clojure","clojure"),e.defineMIME("text/x-clojurescript","clojure"),e.defineMIME("application/edn","clojure")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("ruby",function(e){function t(e){for(var t={},r=0,n=e.length;n>r;++r)t[e[r]]=!0;return t}function r(e,t,r){return r.tokenize.push(e),e(t,r)}function n(e,t){if(e.sol()&&e.match("=begin")&&e.eol())return t.tokenize.push(l),"comment";if(e.eatSpace())return null;var n,i=e.next();if("`"==i||"'"==i||'"'==i)return r(a(i,"string",'"'==i||"`"==i),e,t);if("/"==i){var o=e.current().length;if(e.skipTo("/")){var u=e.current().length;e.backUp(e.current().length-o);for(var d=0;e.current().lengthd)break}if(e.backUp(e.current().length-o),0==d)return r(a(i,"string-2",!0),e,t)}return"operator"}if("%"==i){var h="string",m=!0;e.eat("s")?h="atom":e.eat(/[WQ]/)?h="string":e.eat(/[r]/)?h="string-2":e.eat(/[wxq]/)&&(h="string",m=!1);var g=e.eat(/[^\w\s=]/);return g?(p.propertyIsEnumerable(g)&&(g=p[g]),r(a(g,h,m,!0),e,t)):"operator"}if("#"==i)return e.skipToEnd(),"comment";if("<"==i&&(n=e.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/)))return r(s(n[1]),e,t);if("0"==i)return e.eatWhile(e.eat("x")?/[\da-fA-F]/:e.eat("b")?/[01]/:/[0-7]/),"number";if(/\d/.test(i))return e.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/),"number";if("?"==i){for(;e.match(/^\\[CM]-/););return e.eat("\\")?e.eatWhile(/\w/):e.next(),"string"}if(":"==i)return e.eat("'")?r(a("'","atom",!1),e,t):e.eat('"')?r(a('"',"atom",!0),e,t):e.eat(/[\<\>]/)?(e.eat(/[\<\>]/),"atom"):e.eat(/[\+\-\*\/\&\|\:\!]/)?"atom":e.eat(/[a-zA-Z$@_\xa1-\uffff]/)?(e.eatWhile(/[\w$\xa1-\uffff]/),e.eat(/[\?\!\=]/),"atom"):"operator";if("@"==i&&e.match(/^@?[a-zA-Z_\xa1-\uffff]/))return e.eat("@"),e.eatWhile(/[\w\xa1-\uffff]/),"variable-2";if("$"==i)return e.eat(/[a-zA-Z_]/)?e.eatWhile(/[\w]/):e.eat(/\d/)?e.eat(/\d/):e.next(),"variable-3";if(/[a-zA-Z_\xa1-\uffff]/.test(i))return e.eatWhile(/[\w\xa1-\uffff]/),e.eat(/[\?\!]/),e.eat(":")?"atom":"ident";if("|"!=i||!t.varList&&"{"!=t.lastTok&&"do"!=t.lastTok){if(/[\(\)\[\]{}\\;]/.test(i))return c=i,null;if("-"==i&&e.eat(">"))return"arrow";if(/[=+\-\/*:\.^%<>~|]/.test(i)){var v=e.eatWhile(/[=+\-\/*:\.^%<>~|]/);return"."!=i||v||(c="."),"operator"}return null}return c="|",null}function i(e){return e||(e=1),function(t,r){if("}"==t.peek()){if(1==e)return r.tokenize.pop(),r.tokenize[r.tokenize.length-1](t,r);r.tokenize[r.tokenize.length-1]=i(e-1)}else"{"==t.peek()&&(r.tokenize[r.tokenize.length-1]=i(e+1));return n(t,r)}}function o(){var e=!1;return function(t,r){return e?(r.tokenize.pop(),r.tokenize[r.tokenize.length-1](t,r)):(e=!0,n(t,r))}}function a(e,t,r,n){return function(a,s){var l,c=!1;for("read-quoted-paused"===s.context.type&&(s.context=s.context.prev,a.eat("}"));null!=(l=a.next());){if(l==e&&(n||!c)){s.tokenize.pop();break}if(r&&"#"==l&&!c){if(a.eat("{")){"}"==e&&(s.context={prev:s.context,type:"read-quoted-paused"}),s.tokenize.push(i());break}if(/[@\$]/.test(a.peek())){s.tokenize.push(o());break}}c=!c&&"\\"==l}return t}}function s(e){return function(t,r){return t.match(e)?r.tokenize.pop():t.skipToEnd(),"string"}}function l(e,t){return e.sol()&&e.match("=end")&&e.eol()&&t.tokenize.pop(),e.skipToEnd(),"comment"}var c,u=t(["alias","and","BEGIN","begin","break","case","class","def","defined?","do","else","elsif","END","end","ensure","false","for","if","in","module","next","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","nil","raise","throw","catch","fail","loop","callcc","caller","lambda","proc","public","protected","private","require","load","require_relative","extend","autoload","__END__","__FILE__","__LINE__","__dir__"]),d=t(["def","class","case","for","while","until","module","then","catch","loop","proc","begin"]),f=t(["end","until"]),p={"[":"]","{":"}","(":")"};return{startState:function(){return{tokenize:[n],indented:0,context:{type:"top",indented:-e.indentUnit},continuedLine:!1,lastTok:null,varList:!1}},token:function(e,t){c=null,e.sol()&&(t.indented=e.indentation());var r,n=t.tokenize[t.tokenize.length-1](e,t),i=c;if("ident"==n){var o=e.current();n="."==t.lastTok?"property":u.propertyIsEnumerable(e.current())?"keyword":/^[A-Z]/.test(o)?"tag":"def"==t.lastTok||"class"==t.lastTok||t.varList?"def":"variable","keyword"==n&&(i=o,d.propertyIsEnumerable(o)?r="indent":f.propertyIsEnumerable(o)?r="dedent":"if"!=o&&"unless"!=o||e.column()!=e.indentation()?"do"==o&&t.context.indentedn?p(t):n>i&&m(e,t)&&(t.errorToken=!0),null}var o=d(e,t);return n>0&&m(e,t)&&(o+=" "+v),o}return d(e,t)}function d(e,t){if(e.eatSpace())return null;var r=e.peek();if("#"==r)return e.skipToEnd(),"comment";if(e.match(/^[0-9\.]/,!1)){var i=!1;if(e.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)&&(i=!0),e.match(/^\d+\.\d*/)&&(i=!0),e.match(/^\.\d+/)&&(i=!0),i)return e.eat(/J/i),"number";var o=!1;if(e.match(/^0x[0-9a-f]+/i)&&(o=!0),e.match(/^0b[01]+/i)&&(o=!0),e.match(/^0o[0-7]+/i)&&(o=!0),e.match(/^[1-9]\d*(e[\+\-]?\d+)?/)&&(e.eat(/J/i),o=!0),e.match(/^0(?![\dx])/i)&&(o=!0),o)return e.eat(/L/i),"number"}return e.match(L)?(t.tokenize=f(e.current()),t.tokenize(e,t)):e.match(x)||e.match(k)?"punctuation":e.match(b)||e.match(w)?"operator":e.match(y)?"punctuation":"."==t.lastToken&&e.match(_)?"property":e.match(T)||e.match(n)?"keyword":e.match(A)?"builtin":e.match(/^(self|cls)\b/)?"variable-2":e.match(_)?"def"==t.lastToken||"class"==t.lastToken?"def":"variable":(e.next(),v)}function f(e){function t(t,i){for(;!t.eol();)if(t.eatWhile(/[^'"\\]/),t.eat("\\")){if(t.next(),r&&t.eol())return n}else{if(t.match(e))return i.tokenize=u,n;t.eat(/['"]/)}if(r){if(c.singleLineStringErrors)return v;i.tokenize=u}return n}for(;"rub".indexOf(e.charAt(0).toLowerCase())>=0;)e=e.substr(1);var r=1==e.length,n="string";return t.isString=!0,t}function p(e){for(;"py"!=r(e).type;)e.scopes.pop();e.scopes.push({offset:r(e).offset+l.indentUnit,type:"py",align:null})}function h(e,t,r){var n=e.match(/^([\s\[\{\(]|#.*)*$/,!1)?null:e.column()+1;t.scopes.push({offset:t.indent+C,type:r,align:n})}function m(e,t){for(var n=e.indentation();r(t).offset>n;){if("py"!=r(t).type)return!0;t.scopes.pop()}return r(t).offset!=n}function g(e,t){var n=t.tokenize(e,t),i=e.current();if("@"==i)return c.version&&3==parseInt(c.version,10)?e.match(_,!1)?"meta":"operator":e.match(_,!1)?"meta":v;"variable"!=n&&"builtin"!=n||"meta"!=t.lastToken||(n="meta"),("pass"==i||"return"==i)&&(t.dedent+=1),"lambda"==i&&(t.lambda=!0),":"!=i||t.lambda||"py"!=r(t).type||p(t);var o=1==i.length?"[({".indexOf(i):-1;if(-1!=o&&h(e,t,"])}".slice(o,o+1)),o="])}".indexOf(i),-1!=o){if(r(t).type!=i)return v;t.indent=t.scopes.pop().offset-C}return t.dedent>0&&e.eol()&&"py"==r(t).type&&(t.scopes.length>1&&t.scopes.pop(),t.dedent-=1),n}var v="error",y=c.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.]/,b=c.doubleOperators||/^([!<>]==|<>|<<|>>|\/\/|\*\*)/,k=c.doubleDelimiters||/^(\+=|\-=|\*=|%=|\/=|&=|\|=|\^=)/,x=c.tripleDelimiters||/^(\/\/=|>>=|<<=|\*\*=)/;if(c.version&&3==parseInt(c.version,10))var w=c.singleOperators||/^[\+\-\*\/%&|\^~<>!@]/,_=c.identifiers||/^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;else var w=c.singleOperators||/^[\+\-\*\/%&|\^~<>!]/,_=c.identifiers||/^[_A-Za-z][_A-Za-z0-9]*/;var C=c.hangingIndent||l.indentUnit,S=i,M=o;if(void 0!=c.extra_keywords&&(S=S.concat(c.extra_keywords)),void 0!=c.extra_builtins&&(M=M.concat(c.extra_builtins)),c.version&&3==parseInt(c.version,10)){S=S.concat(s.keywords),M=M.concat(s.builtins);var L=new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))","i")}else{S=S.concat(a.keywords),M=M.concat(a.builtins);var L=new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}var T=t(S),A=t(M),E={startState:function(e){return{tokenize:u,scopes:[{offset:e||0,type:"py",align:null}],indent:e||0,lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var r=t.errorToken;r&&(t.errorToken=!1);var n=g(e,t);return n&&"comment"!=n&&(t.lastToken="keyword"==n||"punctuation"==n?e.current():n),"punctuation"==n&&(n=null),e.eol()&&t.lambda&&(t.lambda=!1),r?n+" "+v:n},indent:function(t,n){if(t.tokenize!=u)return t.tokenize.isString?e.Pass:0;var i=r(t),o=i.type==n.charAt(0);return null!=i.align?i.align-(o?1:0):i.offset-(o?C:0)},electricInput:/^\s*[\}\]\)]$/,closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"};return E}),e.defineMIME("text/x-python","python");var l=function(e){return e.split(" ")};e.defineMIME("text/x-cython",{name:"python",extra_keywords:l("by cdef cimport cpdef ctypedef enum exceptextern gil include nogil property publicreadonly struct union DEF IF ELIF ELSE")})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("shell",function(){function e(e,t){for(var r=t.split(" "),n=0;n1&&e.eat("$");var i=e.next(),o=/\w/;return"{"===i&&(o=/[^}]/),"("===i?(t.tokens[0]=r(")"),n(e,t)):(/\d/.test(i)||(e.eatWhile(o),e.eat("}")),t.tokens.shift(),"def")};return{startState:function(){return{tokens:[]}},token:function(e,t){return n(e,t)},lineComment:"#",fold:"brace"}}),e.defineMIME("text/x-sh","shell")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../clike/clike")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=e.split(" "),n=0;n\w/,!1)&&(t.tokenize=r([[["->",null]],[[/[\w]+/,"variable"]]],n,i)),"variable-2";for(var o=!1;!e.eol()&&(o||i===!1||!e.match("{$",!1)&&!e.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!o&&e.match(n)){t.tokenize=null,t.tokStack.pop(),t.tokStack.pop();break}o="\\"==e.next()&&!o}return"string"}var o="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally",a="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",s="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";e.registerHelper("hintWords","php",[o,a,s].join(" ").split(" ")),e.registerHelper("wordChars","php",/[\w$]/);var l={name:"clike",helperType:"php",keywords:t(o),blockKeywords:t("catch do else elseif for foreach if switch try while finally"),defKeywords:t("class function interface namespace trait"),atoms:t(a),builtin:t(s),multiLineStrings:!0,hooks:{$:function(e){return e.eatWhile(/[\w\$_]/),"variable-2"},"<":function(e,t){var r;if(r=e.match(/<<\s*/)){var i=e.eat(/['"]/);e.eatWhile(/[\w\.]/);var o=e.current().slice(r[0].length+(i?2:1));if(i&&e.eat(i),o)return(t.tokStack||(t.tokStack=[])).push(o,0),t.tokenize=n(o,"'"!=i),"string"}return!1},"#":function(e){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"},"/":function(e){if(e.eat("/")){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"}return!1},'"':function(e,t){return(t.tokStack||(t.tokStack=[])).push('"',0),t.tokenize=n('"'),"string"},"{":function(e,t){return t.tokStack&&t.tokStack.length&&t.tokStack[t.tokStack.length-1]++,!1},"}":function(e,t){return t.tokStack&&t.tokStack.length>0&&!--t.tokStack[t.tokStack.length-1]&&(t.tokenize=n(t.tokStack[t.tokStack.length-2])),!1}}};e.defineMode("php",function(t,r){function n(t,r){var n=r.curMode==o;if(t.sol()&&r.pending&&'"'!=r.pending&&"'"!=r.pending&&(r.pending=null),n)return n&&null==r.php.tokenize&&t.match("?>")?(r.curMode=i,r.curState=r.html,r.php.context.prev||(r.php=null),"meta"):o.token(t,r.curState);if(t.match(/^<\?\w*/))return r.curMode=o,r.php||(r.php=e.startState(o,i.indent(r.html,""))),r.curState=r.php,"meta";if('"'==r.pending||"'"==r.pending){for(;!t.eol()&&t.next()!=r.pending;);var a="string"}else if(r.pending&&t.pos/.test(l)?s[0]:{end:t.pos,style:a},t.backUp(l.length-c)),a}var i=e.getMode(t,"text/html"),o=e.getMode(t,l);return{startState:function(){var t=e.startState(i),n=r.startOpen?e.startState(o):null;return{html:t,php:n,curMode:r.startOpen?o:i,curState:r.startOpen?n:t,pending:null}},copyState:function(t){var r,n=t.html,a=e.copyState(i,n),s=t.php,l=s&&e.copyState(o,s);return r=t.curMode==i?a:l,{html:a,php:l,curMode:t.curMode,curState:r,pending:t.pending}},token:n,indent:function(e,t){return e.curMode!=o&&/^\s*<\//.test(t)||e.curMode==o&&/^\?>/.test(t)?i.indent(e.html,t):e.curMode.indent(e.curState,t)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(e){return{state:e.curState,mode:e.curMode}}}},"htmlmixed","clike"),e.defineMIME("application/x-httpd-php","php"),e.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),e.defineMIME("text/x-php",l)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("sql",function(t,r){function n(e,t){var r=e.next();if(h[r]){var n=h[r](e,t);if(n!==!1)return n}if(1==p.hexNumber&&("0"==r&&e.match(/^[xX][0-9a-fA-F]+/)||("x"==r||"X"==r)&&e.match(/^'[0-9a-fA-F]+'/)))return"number";if(1==p.binaryNumber&&(("b"==r||"B"==r)&&e.match(/^'[01]+'/)||"0"==r&&e.match(/^b[01]+/)))return"number";if(r.charCodeAt(0)>47&&r.charCodeAt(0)<58)return e.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/),1==p.decimallessFloat&&e.eat("."),"number";if("?"==r&&(e.eatSpace()||e.eol()||e.eat(";")))return"variable-3";if("'"==r||'"'==r&&p.doubleQuote)return t.tokenize=i(r),t.tokenize(e,t);if((1==p.nCharCast&&("n"==r||"N"==r)||1==p.charsetCast&&"_"==r&&e.match(/[a-z][a-z0-9]*/i))&&("'"==e.peek()||'"'==e.peek()))return"keyword";if(/^[\(\),\;\[\]]/.test(r))return null;if(p.commentSlashSlash&&"/"==r&&e.eat("/"))return e.skipToEnd(),"comment";if(p.commentHash&&"#"==r||"-"==r&&e.eat("-")&&(!p.commentSpaceRequired||e.eat(" ")))return e.skipToEnd(),"comment";if("/"==r&&e.eat("*"))return t.tokenize=o,t.tokenize(e,t);if("."!=r){if(f.test(r))return e.eatWhile(f),null;if("{"==r&&(e.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||e.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";e.eatWhile(/^[_\w\d]/);var a=e.current().toLowerCase();return m.hasOwnProperty(a)&&(e.match(/^( )+'[^']*'/)||e.match(/^( )+"[^"]*"/))?"number":c.hasOwnProperty(a)?"atom":u.hasOwnProperty(a)?"builtin":d.hasOwnProperty(a)?"keyword":l.hasOwnProperty(a)?"string-2":null}return 1==p.zerolessFloat&&e.match(/^(?:\d+(?:e[+-]?\d+)?)/i)?"number":1==p.ODBCdotTable&&e.match(/^[a-zA-Z_]+/)?"variable-2":void 0}function i(e){return function(t,r){for(var i,o=!1;null!=(i=t.next());){if(i==e&&!o){r.tokenize=n;break}o=!o&&"\\"==i}return"string"}}function o(e,t){for(;;){if(!e.skipTo("*")){e.skipToEnd();break}if(e.next(),e.eat("/")){t.tokenize=n;break}}return"comment"}function a(e,t,r){t.context={prev:t.context,indent:e.indentation(),col:e.column(),type:r}}function s(e){e.indent=e.context.indent,e.context=e.context.prev}var l=r.client||{},c=r.atoms||{"false":!0,"true":!0,"null":!0},u=r.builtin||{},d=r.keywords||{},f=r.operatorChars||/^[*+\-%<>!=&|~^]/,p=r.support||{},h=r.hooks||{},m=r.dateSQL||{date:!0,time:!0,timestamp:!0};return{startState:function(){return{tokenize:n,context:null}},token:function(e,t){if(e.sol()&&t.context&&null==t.context.align&&(t.context.align=!1),e.eatSpace())return null;var r=t.tokenize(e,t);if("comment"==r)return r;t.context&&null==t.context.align&&(t.context.align=!0);var n=e.current();return"("==n?a(e,t,")"):"["==n?a(e,t,"]"):t.context&&t.context.type==n&&s(t),r},indent:function(r,n){var i=r.context;if(!i)return e.Pass;var o=n.charAt(0)==i.type;return i.align?i.col+(o?0:1):i.indent+(o?0:t.indentUnit)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:p.commentSlashSlash?"//":p.commentHash?"#":null}}),function(){function t(e){for(var t;null!=(t=e.next());)if("`"==t&&!e.eat("`"))return"variable-2";return e.backUp(e.current().length-1),e.eatWhile(/\w/)?"variable-2":null}function r(e){return e.eat("@")&&(e.match(/^session\./),e.match(/^local\./),e.match(/^global\./)),e.eat("'")?(e.match(/^.*'/),"variable-2"):e.eat('"')?(e.match(/^.*"/),"variable-2"):e.eat("`")?(e.match(/^.*`/),"variable-2"):e.match(/^[0-9a-zA-Z$\.\_]+/)?"variable-2":null}function n(e){return e.eat("N")?"atom":e.match(/^[a-zA-Z.#!?]/)?"variable-2":null}function i(e){for(var t={},r=e.split(" "),n=0;n!=]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable doubleQuote binaryNumber hexNumber")}),e.defineMIME("text/x-mssql",{name:"sql",client:i("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:i(o+"begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare"),builtin:i("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:i("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":r}}),e.defineMIME("text/x-mysql",{name:"sql",client:i("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:i(o+"accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group group_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:i("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":r,"`":t,"\\":n}}),e.defineMIME("text/x-mariadb",{name:"sql",client:i("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:i(o+"accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:i("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":r,"`":t,"\\":n}}),e.defineMIME("text/x-cassandra",{name:"sql",client:{},keywords:i("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"),builtin:i("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"),atoms:i("false true infinity NaN"),operatorChars:/^[<>=]/,dateSQL:{},support:i("commentSlashSlash decimallessFloat"),hooks:{}}),e.defineMIME("text/x-plsql",{name:"sql",client:i("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),keywords:i("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),builtin:i("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least length lengthb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"), +operatorChars:/^[*+\-%<>!=~]/,dateSQL:i("date time timestamp"),support:i("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")}),e.defineMIME("text/x-hive",{name:"sql",keywords:i("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"),builtin:i("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:i("date timestamp"),support:i("ODBCdotTable doubleQuote binaryNumber hexNumber")}),e.defineMIME("text/x-pgsql",{name:"sql",client:i("source"),keywords:i(o+"a abort abs absent absolute access according action ada add admin after aggregate all allocate also always analyse analyze any are array array_agg array_max_cardinality asensitive assertion assignment asymmetric at atomic attribute attributes authorization avg backward base64 before begin begin_frame begin_partition bernoulli binary bit_length blob blocked bom both breadth c cache call called cardinality cascade cascaded case cast catalog catalog_name ceil ceiling chain characteristics characters character_length character_set_catalog character_set_name character_set_schema char_length check checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema collect column columns column_name command_function command_function_code comment comments commit committed concurrently condition condition_number configuration conflict connect connection connection_name constraint constraints constraint_catalog constraint_name constraint_schema constructor contains content continue control conversion convert copy corr corresponding cost covar_pop covar_samp cross csv cube cume_dist current current_catalog current_date current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cursor_name cycle data database datalink datetime_interval_code datetime_interval_precision day db deallocate dec declare default defaults deferrable deferred defined definer degree delimiter delimiters dense_rank depth deref derived describe descriptor deterministic diagnostics dictionary disable discard disconnect dispatch dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue do document domain dynamic dynamic_function dynamic_function_code each element else empty enable encoding encrypted end end-exec end_frame end_partition enforced enum equals escape event every except exception exclude excluding exclusive exec execute exists exp explain expression extension external extract false family fetch file filter final first first_value flag float floor following for force foreign fortran forward found frame_row free freeze fs full function functions fusion g general generated get global go goto grant granted greatest grouping groups handler header hex hierarchy hold hour id identity if ignore ilike immediate immediately immutable implementation implicit import including increment indent index indexes indicator inherit inherits initially inline inner inout input insensitive instance instantiable instead integrity intersect intersection invoker isnull isolation k key key_member key_type label lag language large last last_value lateral lead leading leakproof least left length level library like_regex link listen ln load local localtime localtimestamp location locator lock locked logged lower m map mapping match matched materialized max maxvalue max_cardinality member merge message_length message_octet_length message_text method min minute minvalue mod mode modifies module month more move multiset mumps name names namespace national natural nchar nclob nesting new next nfc nfd nfkc nfkd nil no none normalize normalized nothing notify notnull nowait nth_value ntile null nullable nullif nulls number object occurrences_regex octets octet_length of off offset oids old only open operator option options ordering ordinality others out outer output over overlaps overlay overriding owned owner p pad parameter parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partial partition pascal passing passthrough password percent percentile_cont percentile_disc percent_rank period permission placing plans pli policy portion position position_regex power precedes preceding prepare prepared preserve primary prior privileges procedural procedure program public quote range rank read reads reassign recheck recovery recursive ref references referencing refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release rename repeatable replace replica requiring reset respect restart restore restrict result return returned_cardinality returned_length returned_octet_length returned_sqlstate returning returns revoke right role rollback rollup routine routine_catalog routine_name routine_schema row rows row_count row_number rule savepoint scale schema schema_name scope scope_catalog scope_name scope_schema scroll search second section security selective self sensitive sequence sequences serializable server server_name session session_user setof sets share show similar simple size skip snapshot some source space specific specifictype specific_name sql sqlcode sqlerror sqlexception sqlstate sqlwarning sqrt stable standalone start state statement static statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset substring substring_regex succeeds sum symmetric sysid system system_time system_user t tables tablesample tablespace table_name temp template temporary then ties timezone_hour timezone_minute to token top_level_count trailing transaction transactions_committed transactions_rolled_back transaction_active transform transforms translate translate_regex translation treat trigger trigger_catalog trigger_name trigger_schema trim trim_array true truncate trusted type types uescape unbounded uncommitted under unencrypted unique unknown unlink unlisten unlogged unnamed unnest until untyped upper uri usage user user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema using vacuum valid validate validator value value_of varbinary variadic var_pop var_samp verbose version versioning view views volatile when whenever whitespace width_bucket window within work wrapper write xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate year yes loop repeat"),builtin:i("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast commentHash commentSpaceRequired")}),e.defineMIME("text/x-gql",{name:"sql",keywords:i("ancestor and asc by contains desc descendant distinct from group has in is limit offset on order select superset where"),atoms:i("false true"),builtin:i("blob datetime first key __key__ string integer double boolean null"),operatorChars:/^[*+\-%<>!=]/})}()}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("coffeescript",function(e,t){function r(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}function n(e,t){if(e.sol()){null===t.scope.align&&(t.scope.align=!1);var r=t.scope.offset;if(e.eatSpace()){var n=e.indentation();return n>r&&"coffee"==t.scope.type?"indent":r>n?"dedent":null}r>0&&s(e,t)}if(e.eatSpace())return null;var a=e.peek();if(e.match("####"))return e.skipToEnd(),"comment";if(e.match("###"))return t.tokenize=o,t.tokenize(e,t);if("#"===a)return e.skipToEnd(),"comment";if(e.match(/^-?[0-9\.]/,!1)){var l=!1;if(e.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)&&(l=!0),e.match(/^-?\d+\.\d*/)&&(l=!0),e.match(/^-?\.\d+/)&&(l=!0),l)return"."==e.peek()&&e.backUp(1),"number";var m=!1;if(e.match(/^-?0x[0-9a-f]+/i)&&(m=!0),e.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)&&(m=!0),e.match(/^-?0(?![\dx])/i)&&(m=!0),m)return"number"}if(e.match(y))return t.tokenize=i(e.current(),!1,"string"),t.tokenize(e,t);if(e.match(b)){if("/"!=e.current()||e.match(/^.*\//,!1))return t.tokenize=i(e.current(),!0,"string-2"),t.tokenize(e,t);e.backUp(1)}return e.match(u)||e.match(h)?"operator":e.match(d)?"punctuation":e.match(x)?"atom":e.match(p)||t.prop&&e.match(f)?"property":e.match(v)?"keyword":e.match(f)?"variable":(e.next(),c)}function i(e,r,i){return function(o,a){for(;!o.eol();)if(o.eatWhile(/[^'"\/\\]/),o.eat("\\")){if(o.next(),r&&o.eol())return i}else{if(o.match(e))return a.tokenize=n,i;o.eat(/['"\/]/)}return r&&(t.singleLineStringErrors?i=c:a.tokenize=n),i}}function o(e,t){for(;!e.eol();){if(e.eatWhile(/[^#]/),e.match("###")){t.tokenize=n;break}e.eatWhile("#")}return"comment"}function a(t,r,n){n=n||"coffee";for(var i=0,o=!1,a=null,s=r.scope;s;s=s.prev)if("coffee"===s.type||"}"==s.type){i=s.offset+e.indentUnit;break}"coffee"!==n?(o=null,a=t.column()+t.current().length):r.scope.align&&(r.scope.align=!1),r.scope={offset:i,type:n,prev:r.scope,align:o,alignOffset:a}}function s(e,t){if(t.scope.prev){if("coffee"===t.scope.type){for(var r=e.indentation(),n=!1,i=t.scope;i;i=i.prev)if(r===i.offset){n=!0;break}if(!n)return!0;for(;t.scope.prev&&t.scope.offset!==r;)t.scope=t.scope.prev;return!1}return t.scope=t.scope.prev,!1}}function l(e,t){var r=t.tokenize(e,t),n=e.current();"return"===n&&(t.dedent=!0),(("->"===n||"=>"===n)&&e.eol()||"indent"===r)&&a(e,t);var i="[({".indexOf(n);if(-1!==i&&a(e,t,"])}".slice(i,i+1)),m.exec(n)&&a(e,t),"then"==n&&s(e,t),"dedent"===r&&s(e,t))return c;if(i="])}".indexOf(n),-1!==i){for(;"coffee"==t.scope.type&&t.scope.prev;)t.scope=t.scope.prev;t.scope.type==n&&(t.scope=t.scope.prev)}return t.dedent&&e.eol()&&("coffee"==t.scope.type&&t.scope.prev&&(t.scope=t.scope.prev),t.dedent=!1),r}var c="error",u=/^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/,d=/^(?:[()\[\]{},:`=;]|\.\.?\.?)/,f=/^[_A-Za-z$][_A-Za-z$0-9]*/,p=/^@[_A-Za-z$][_A-Za-z$0-9]*/,h=r(["and","or","not","is","isnt","in","instanceof","typeof"]),m=["for","while","loop","if","unless","else","switch","try","catch","finally","class"],g=["break","by","continue","debugger","delete","do","in","of","new","return","then","this","@","throw","when","until","extends"],v=r(m.concat(g));m=r(m);var y=/^('{3}|\"{3}|['\"])/,b=/^(\/{3}|\/)/,k=["Infinity","NaN","undefined","null","true","false","on","off","yes","no"],x=r(k),w={startState:function(e){return{tokenize:n,scope:{offset:e||0,type:"coffee",prev:null,align:!1},prop:!1,dedent:0}},token:function(e,t){var r=null===t.scope.align&&t.scope;r&&e.sol()&&(r.align=!1);var n=l(e,t);return n&&"comment"!=n&&(r&&(r.align=!0),t.prop="punctuation"==n&&"."==e.current()),n},indent:function(e,t){if(e.tokenize!=n)return 0;var r=e.scope,i=t&&"])}".indexOf(t.charAt(0))>-1;if(i)for(;"coffee"==r.type&&r.prev;)r=r.prev;var o=i&&r.type===t.charAt(0);return r.align?r.alignOffset-(o?1:0):(o?r.prev:r).offset},lineComment:"#",fold:"indent"};return w}),e.defineMIME("text/x-coffeescript","coffeescript"),e.defineMIME("text/coffeescript","coffeescript")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("yaml",function(){var e=["true","false","on","off","yes","no"],t=new RegExp("\\b(("+e.join(")|(")+"))$","i");return{token:function(e,r){var n=e.peek(),i=r.escaped;if(r.escaped=!1,"#"==n&&(0==e.pos||/\s/.test(e.string.charAt(e.pos-1))))return e.skipToEnd(),"comment";if(e.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(r.literal&&e.indentation()>r.keyCol)return e.skipToEnd(),"string";if(r.literal&&(r.literal=!1),e.sol()){if(r.keyCol=0,r.pair=!1,r.pairStart=!1,e.match(/---/))return"def";if(e.match(/\.\.\./))return"def";if(e.match(/\s*-\s+/))return"meta"}if(e.match(/^(\{|\}|\[|\])/))return"{"==n?r.inlinePairs++:"}"==n?r.inlinePairs--:"["==n?r.inlineList++:r.inlineList--,"meta";if(r.inlineList>0&&!i&&","==n)return e.next(),"meta";if(r.inlinePairs>0&&!i&&","==n)return r.keyCol=0,r.pair=!1,r.pairStart=!1,e.next(),"meta";if(r.pairStart){if(e.match(/^\s*(\||\>)\s*/))return r.literal=!0,"meta";if(e.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable-2";if(0==r.inlinePairs&&e.match(/^\s*-?[0-9\.\,]+\s?$/))return"number";if(r.inlinePairs>0&&e.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(e.match(t))return"keyword"}return!r.pair&&e.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(r.pair=!0,r.keyCol=e.indentation(),"atom"):r.pair&&e.match(/^:\s*/)?(r.pairStart=!0,"meta"):(r.pairStart=!1,r.escaped="\\"==n,e.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}}}}),e.defineMIME("text/x-yaml","yaml")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../javascript/javascript"),require("../css/css"),require("../htmlmixed/htmlmixed")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../javascript/javascript","../css/css","../htmlmixed/htmlmixed"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("jade",function(t){function r(){this.javaScriptLine=!1,this.javaScriptLineExcludesColon=!1,this.javaScriptArguments=!1,this.javaScriptArgumentsDepth=0,this.isInterpolating=!1,this.interpolationNesting=0,this.jsState=Y.startState(),this.restOfLine="",this.isIncludeFiltered=!1,this.isEach=!1,this.lastTag="",this.scriptType="",this.isAttrs=!1,this.attrsNest=[],this.inAttributeName=!0,this.attributeIsType=!1,this.attrValue="",this.indentOf=1/0,this.indentToken="",this.innerMode=null,this.innerState=null,this.innerModeForLine=!1}function n(e,t){if(e.sol()&&(t.javaScriptLine=!1,t.javaScriptLineExcludesColon=!1),t.javaScriptLine){if(t.javaScriptLineExcludesColon&&":"===e.peek())return t.javaScriptLine=!1,void(t.javaScriptLineExcludesColon=!1);var r=Y.token(e,t.jsState);return e.eol()&&(t.javaScriptLine=!1),r||!0}}function i(e,t){if(t.javaScriptArguments){if(0===t.javaScriptArgumentsDepth&&"("!==e.peek())return void(t.javaScriptArguments=!1);if("("===e.peek()?t.javaScriptArgumentsDepth++:")"===e.peek()&&t.javaScriptArgumentsDepth--,0===t.javaScriptArgumentsDepth)return void(t.javaScriptArguments=!1);var r=Y.token(e,t.jsState);return r||!0}}function o(e){return e.match(/^yield\b/)?"keyword":void 0}function a(e){return e.match(/^(?:doctype) *([^\n]+)?/)?V:void 0}function s(e,t){return e.match("#{")?(t.isInterpolating=!0,t.interpolationNesting=0,"punctuation"):void 0}function l(e,t){if(t.isInterpolating){if("}"===e.peek()){if(t.interpolationNesting--,t.interpolationNesting<0)return e.next(),t.isInterpolating=!1,"punctuation"}else"{"===e.peek()&&t.interpolationNesting++;return Y.token(e,t.jsState)||!0}}function c(e,t){return e.match(/^case\b/)?(t.javaScriptLine=!0,K):void 0}function u(e,t){return e.match(/^when\b/)?(t.javaScriptLine=!0,t.javaScriptLineExcludesColon=!0,K):void 0}function d(e){return e.match(/^default\b/)?K:void 0}function f(e,t){return e.match(/^extends?\b/)?(t.restOfLine="string",K):void 0}function p(e,t){return e.match(/^append\b/)?(t.restOfLine="variable",K):void 0}function h(e,t){return e.match(/^prepend\b/)?(t.restOfLine="variable",K):void 0}function m(e,t){return e.match(/^block\b *(?:(prepend|append)\b)?/)?(t.restOfLine="variable",K):void 0}function g(e,t){return e.match(/^include\b/)?(t.restOfLine="string",K):void 0}function v(e,t){return e.match(/^include:([a-zA-Z0-9\-]+)/,!1)&&e.match("include")?(t.isIncludeFiltered=!0,K):void 0}function y(e,t){if(t.isIncludeFiltered){var r=L(e,t);return t.isIncludeFiltered=!1,t.restOfLine="string",r}}function b(e,t){return e.match(/^mixin\b/)?(t.javaScriptLine=!0,K):void 0}function k(e,t){return e.match(/^\+([-\w]+)/)?(e.match(/^\( *[-\w]+ *=/,!1)||(t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0),"variable"):e.match(/^\+#{/,!1)?(e.next(),t.mixinCallAfter=!0,s(e,t)):void 0}function x(e,t){return t.mixinCallAfter?(t.mixinCallAfter=!1,e.match(/^\( *[-\w]+ *=/,!1)||(t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0),!0):void 0}function w(e,t){return e.match(/^(if|unless|else if|else)\b/)?(t.javaScriptLine=!0,K):void 0}function _(e,t){return e.match(/^(- *)?(each|for)\b/)?(t.isEach=!0,K):void 0}function C(e,t){if(t.isEach){if(e.match(/^ in\b/))return t.javaScriptLine=!0,t.isEach=!1,K;if(e.sol()||e.eol())t.isEach=!1;else if(e.next()){for(;!e.match(/^ in\b/,!1)&&e.next(););return"variable"}}}function S(e,t){return e.match(/^while\b/)?(t.javaScriptLine=!0,K):void 0}function M(e,t){var r;return(r=e.match(/^(\w(?:[-:\w]*\w)?)\/?/))?(t.lastTag=r[1].toLowerCase(),"script"===t.lastTag&&(t.scriptType="application/javascript"),"tag"):void 0}function L(r,n){if(r.match(/^:([\w\-]+)/)){var i;return t&&t.innerModes&&(i=t.innerModes(r.current().substring(1))),i||(i=r.current().substring(1)),"string"==typeof i&&(i=e.getMode(t,i)),B(r,n,i),"atom"}}function T(e,t){return e.match(/^(!?=|-)/)?(t.javaScriptLine=!0,"punctuation"):void 0}function A(e){return e.match(/^#([\w-]+)/)?G:void 0}function E(e){return e.match(/^\.([\w-]+)/)?X:void 0}function O(e,t){return"("==e.peek()?(e.next(),t.isAttrs=!0,t.attrsNest=[],t.inAttributeName=!0,t.attrValue="",t.attributeIsType=!1,"punctuation"):void 0}function z(e,t){if(t.isAttrs){if(Z[e.peek()]&&t.attrsNest.push(Z[e.peek()]),t.attrsNest[t.attrsNest.length-1]===e.peek())t.attrsNest.pop();else if(e.eat(")"))return t.isAttrs=!1,"punctuation";if(t.inAttributeName&&e.match(/^[^=,\)!]+/))return("="===e.peek()||"!"===e.peek())&&(t.inAttributeName=!1,t.jsState=Y.startState(),t.attributeIsType="script"===t.lastTag&&"type"===e.current().trim().toLowerCase()?!0:!1),"attribute";var r=Y.token(e,t.jsState);if(t.attributeIsType&&"string"===r&&(t.scriptType=e.current().toString()),0===t.attrsNest.length&&("string"===r||"variable"===r||"keyword"===r))try{return Function("","var x "+t.attrValue.replace(/,\s*$/,"").replace(/^!/,"")),t.inAttributeName=!0,t.attrValue="",e.backUp(e.current().length),z(e,t)}catch(n){}return t.attrValue+=e.current(),r||!0}}function I(e,t){return e.match(/^&attributes\b/)?(t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0,"keyword"):void 0}function N(e){return e.sol()&&e.eatSpace()?"indent":void 0}function q(e,t){return e.match(/^ *\/\/(-)?([^\n]*)/)?(t.indentOf=e.indentation(),t.indentToken="comment","comment"):void 0}function P(e){return e.match(/^: */)?"colon":void 0}function R(e,t){return e.match(/^(?:\| ?| )([^\n]+)/)?"string":e.match(/^(<[^\n]*)/,!1)?(B(e,t,"htmlmixed"),t.innerModeForLine=!0,F(e,t,!0)):void 0}function j(e,t){if(e.eat(".")){var r=null;return"script"===t.lastTag&&-1!=t.scriptType.toLowerCase().indexOf("javascript")?r=t.scriptType.toLowerCase().replace(/"|'/g,""):"style"===t.lastTag&&(r="css"),B(e,t,r),"dot"}}function D(e){return e.next(),null}function B(r,n,i){i=e.mimeModes[i]||i,i=t.innerModes?t.innerModes(i)||i:i,i=e.mimeModes[i]||i,i=e.getMode(t,i),n.indentOf=r.indentation(),i&&"null"!==i.name?n.innerMode=i:n.indentToken="string"}function F(e,t,r){return e.indentation()>t.indentOf||t.innerModeForLine&&!e.sol()||r?t.innerMode?(t.innerState||(t.innerState=t.innerMode.startState?t.innerMode.startState(e.indentation()):{}),e.hideFirstChars(t.indentOf+2,function(){return t.innerMode.token(e,t.innerState)||!0})):(e.skipToEnd(),t.indentToken):void(e.sol()&&(t.indentOf=1/0,t.indentToken=null,t.innerMode=null,t.innerState=null))}function W(e,t){if(e.sol()&&(t.restOfLine=""),t.restOfLine){e.skipToEnd();var r=t.restOfLine;return t.restOfLine="",r}}function H(){return new r}function $(e){return e.copy()}function U(e,t){var r=F(e,t)||W(e,t)||l(e,t)||y(e,t)||C(e,t)||z(e,t)||n(e,t)||i(e,t)||x(e,t)||o(e,t)||a(e,t)||s(e,t)||c(e,t)||u(e,t)||d(e,t)||f(e,t)||p(e,t)||h(e,t)||m(e,t)||g(e,t)||v(e,t)||b(e,t)||k(e,t)||w(e,t)||_(e,t)||S(e,t)||M(e,t)||L(e,t)||T(e,t)||A(e,t)||E(e,t)||O(e,t)||I(e,t)||N(e,t)||R(e,t)||q(e,t)||P(e,t)||j(e,t)||D(e,t);return r===!0?null:r}var K="keyword",V="meta",G="builtin",X="qualifier",Z={"{":"}","(":")","[":"]"},Y=e.getMode(t,"javascript");return r.prototype.copy=function(){var t=new r;return t.javaScriptLine=this.javaScriptLine,t.javaScriptLineExcludesColon=this.javaScriptLineExcludesColon,t.javaScriptArguments=this.javaScriptArguments,t.javaScriptArgumentsDepth=this.javaScriptArgumentsDepth,t.isInterpolating=this.isInterpolating,t.interpolationNesting=this.interpolationNesting,t.jsState=e.copyState(Y,this.jsState),t.innerMode=this.innerMode,this.innerMode&&this.innerState&&(t.innerState=e.copyState(this.innerMode,this.innerState)),t.restOfLine=this.restOfLine,t.isIncludeFiltered=this.isIncludeFiltered,t.isEach=this.isEach,t.lastTag=this.lastTag,t.scriptType=this.scriptType,t.isAttrs=this.isAttrs,t.attrsNest=this.attrsNest.slice(),t.inAttributeName=this.inAttributeName,t.attributeIsType=this.attributeIsType,t.attrValue=this.attrValue,t.indentOf=this.indentOf,t.indentToken=this.indentToken,t.innerModeForLine=this.innerModeForLine,t},{startState:H,copyState:$,token:U}},"javascript","css","htmlmixed"),e.defineMIME("text/x-jade","jade")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("lua",function(e,t){function r(e){return new RegExp("^(?:"+e.join("|")+")","i")}function n(e){return new RegExp("^(?:"+e.join("|")+")$","i")}function i(e){for(var t=0;e.eat("=");)++t;return e.eat("["),t}function o(e,t){var r=e.next();return"-"==r&&e.eat("-")?e.eat("[")&&e.eat("[")?(t.cur=a(i(e),"comment"))(e,t):(e.skipToEnd(),"comment"):'"'==r||"'"==r?(t.cur=s(r))(e,t):"["==r&&/[\[=]/.test(e.peek())?(t.cur=a(i(e),"string"))(e,t):/\d/.test(r)?(e.eatWhile(/[\w.%]/),"number"):/[\w_]/.test(r)?(e.eatWhile(/[\w\\\-_.]/),"variable"):null}function a(e,t){return function(r,n){for(var i,a=null;null!=(i=r.next());)if(null==a)"]"==i&&(a=0);else if("="==i)++a;else{if("]"==i&&a==e){n.cur=o;break}a=null}return t}}function s(e){return function(t,r){for(var n,i=!1;null!=(n=t.next())&&(n!=e||i);)i=!i&&"\\"==n;return i||(r.cur=o),"string"}}var l=e.indentUnit,c=n(t.specials||[]),u=n(["_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load","loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require","select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall","coroutine.create","coroutine.resume","coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield","debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable","debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable","debug.setupvalue","debug.traceback","close","flush","lines","read","seek","setvbuf","write","io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin","io.stdout","io.tmpfile","io.type","io.write","math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg","math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max","math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh","math.sqrt","math.tan","math.tanh","os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale","os.time","os.tmpname","package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload","package.seeall","string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub","string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper","table.concat","table.insert","table.maxn","table.remove","table.sort"]),d=n(["and","break","elseif","false","nil","not","or","return","true","function","end","if","then","else","do","while","repeat","until","for","in","local"]),f=n(["function","if","repeat","do","\\(","{"]),p=n(["end","until","\\)","}"]),h=r(["end","until","\\)","}","else","elseif"]);return{startState:function(e){return{basecol:e||0,indentDepth:0,cur:o}},token:function(e,t){if(e.eatSpace())return null;var r=t.cur(e,t),n=e.current();return"variable"==r&&(d.test(n)?r="keyword":u.test(n)?r="builtin":c.test(n)&&(r="variable-2")),"comment"!=r&&"string"!=r&&(f.test(n)?++t.indentDepth:p.test(n)&&--t.indentDepth),r},indent:function(e,t){var r=h.test(t);return e.basecol+l*(e.indentDepth-(r?1:0))},lineComment:"--",blockCommentStart:"--[[",blockCommentEnd:"]]"}}),e.defineMIME("text/x-lua","lua")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("cmake",function(){function e(e,t){for(var r,n,i=!1;!e.eol()&&(r=e.next())!=t.pending;){if("$"===r&&"\\"!=n&&'"'==t.pending){i=!0;break}n=r}return i&&e.backUp(1),t.continueString=r==t.pending?!1:!0,"string"}function t(t,n){var i=t.next();return"$"===i?t.match(r)?"variable-2":"variable":n.continueString?(t.backUp(1),e(t,n)):t.match(/(\s+)?\w+\(/)||t.match(/(\s+)?\w+\ \(/)?(t.backUp(1),"def"):"#"==i?(t.skipToEnd(),"comment"):"'"==i||'"'==i?(n.pending=i,e(t,n)):"("==i||")"==i?"bracket":i.match(/[0-9]/)?"number":(t.eatWhile(/[\w-]/),null)}var r=/({)?[a-zA-Z0-9_]+(})?/;return{startState:function(){var e={};return e.inDefinition=!1,e.inInclude=!1,e.continueString=!1,e.pending=!1,e},token:function(e,r){return e.eatSpace()?null:t(e,r)}}}),e.defineMIME("text/x-cmake","cmake")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("nginx",function(e){function t(e){for(var t={},r=e.split(" "),n=0;n*\/]/.test(s)?r(null,"select-op"):/[;{}:\[\]]/.test(s)?r(null,s):(e.eatWhile(/[\w\\\-]/),r("variable","variable")):r(null,"compare"):void r(null,"compare")}function i(e,t){for(var i,o=!1;null!=(i=e.next());){if(o&&"/"==i){t.tokenize=n;break}o="*"==i}return r("comment","comment")}function o(e,t){for(var i,o=0;null!=(i=e.next());){if(o>=2&&">"==i){t.tokenize=n;break}o="-"==i?o+1:0}return r("comment","comment")}function a(e){return function(t,i){for(var o,a=!1;null!=(o=t.next())&&(o!=e||a);)a=!a&&"\\"==o;return a||(i.tokenize=n),r("string","string")}}var s,l=t("break return rewrite set accept_mutex accept_mutex_delay access_log add_after_body add_before_body add_header addition_types aio alias allow ancient_browser ancient_browser_value auth_basic auth_basic_user_file auth_http auth_http_header auth_http_timeout autoindex autoindex_exact_size autoindex_localtime charset charset_types client_body_buffer_size client_body_in_file_only client_body_in_single_buffer client_body_temp_path client_body_timeout client_header_buffer_size client_header_timeout client_max_body_size connection_pool_size create_full_put_path daemon dav_access dav_methods debug_connection debug_points default_type degradation degrade deny devpoll_changes devpoll_events directio directio_alignment empty_gif env epoll_events error_log eventport_events expires fastcgi_bind fastcgi_buffer_size fastcgi_buffers fastcgi_busy_buffers_size fastcgi_cache fastcgi_cache_key fastcgi_cache_methods fastcgi_cache_min_uses fastcgi_cache_path fastcgi_cache_use_stale fastcgi_cache_valid fastcgi_catch_stderr fastcgi_connect_timeout fastcgi_hide_header fastcgi_ignore_client_abort fastcgi_ignore_headers fastcgi_index fastcgi_intercept_errors fastcgi_max_temp_file_size fastcgi_next_upstream fastcgi_param fastcgi_pass_header fastcgi_pass_request_body fastcgi_pass_request_headers fastcgi_read_timeout fastcgi_send_lowat fastcgi_send_timeout fastcgi_split_path_info fastcgi_store fastcgi_store_access fastcgi_temp_file_write_size fastcgi_temp_path fastcgi_upstream_fail_timeout fastcgi_upstream_max_fails flv geoip_city geoip_country google_perftools_profiles gzip gzip_buffers gzip_comp_level gzip_disable gzip_hash gzip_http_version gzip_min_length gzip_no_buffer gzip_proxied gzip_static gzip_types gzip_vary gzip_window if_modified_since ignore_invalid_headers image_filter image_filter_buffer image_filter_jpeg_quality image_filter_transparency imap_auth imap_capabilities imap_client_buffer index ip_hash keepalive_requests keepalive_timeout kqueue_changes kqueue_events large_client_header_buffers limit_conn limit_conn_log_level limit_rate limit_rate_after limit_req limit_req_log_level limit_req_zone limit_zone lingering_time lingering_timeout lock_file log_format log_not_found log_subrequest map_hash_bucket_size map_hash_max_size master_process memcached_bind memcached_buffer_size memcached_connect_timeout memcached_next_upstream memcached_read_timeout memcached_send_timeout memcached_upstream_fail_timeout memcached_upstream_max_fails merge_slashes min_delete_depth modern_browser modern_browser_value msie_padding msie_refresh multi_accept open_file_cache open_file_cache_errors open_file_cache_events open_file_cache_min_uses open_file_cache_valid open_log_file_cache output_buffers override_charset perl perl_modules perl_require perl_set pid pop3_auth pop3_capabilities port_in_redirect postpone_gzipping postpone_output protocol proxy proxy_bind proxy_buffer proxy_buffer_size proxy_buffering proxy_buffers proxy_busy_buffers_size proxy_cache proxy_cache_key proxy_cache_methods proxy_cache_min_uses proxy_cache_path proxy_cache_use_stale proxy_cache_valid proxy_connect_timeout proxy_headers_hash_bucket_size proxy_headers_hash_max_size proxy_hide_header proxy_ignore_client_abort proxy_ignore_headers proxy_intercept_errors proxy_max_temp_file_size proxy_method proxy_next_upstream proxy_pass_error_message proxy_pass_header proxy_pass_request_body proxy_pass_request_headers proxy_read_timeout proxy_redirect proxy_send_lowat proxy_send_timeout proxy_set_body proxy_set_header proxy_ssl_session_reuse proxy_store proxy_store_access proxy_temp_file_write_size proxy_temp_path proxy_timeout proxy_upstream_fail_timeout proxy_upstream_max_fails random_index read_ahead real_ip_header recursive_error_pages request_pool_size reset_timedout_connection resolver resolver_timeout rewrite_log rtsig_overflow_events rtsig_overflow_test rtsig_overflow_threshold rtsig_signo satisfy secure_link_secret send_lowat send_timeout sendfile sendfile_max_chunk server_name_in_redirect server_names_hash_bucket_size server_names_hash_max_size server_tokens set_real_ip_from smtp_auth smtp_capabilities smtp_client_buffer smtp_greeting_delay so_keepalive source_charset ssi ssi_ignore_recycled_buffers ssi_min_file_chunk ssi_silent_errors ssi_types ssi_value_length ssl ssl_certificate ssl_certificate_key ssl_ciphers ssl_client_certificate ssl_crl ssl_dhparam ssl_engine ssl_prefer_server_ciphers ssl_protocols ssl_session_cache ssl_session_timeout ssl_verify_client ssl_verify_depth starttls stub_status sub_filter sub_filter_once sub_filter_types tcp_nodelay tcp_nopush thread_stack_size timeout timer_resolution types_hash_bucket_size types_hash_max_size underscores_in_headers uninitialized_variable_warn use user userid userid_domain userid_expires userid_mark userid_name userid_p3p userid_path userid_service valid_referers variables_hash_bucket_size variables_hash_max_size worker_connections worker_cpu_affinity worker_priority worker_processes worker_rlimit_core worker_rlimit_nofile worker_rlimit_sigpending worker_threads working_directory xclient xml_entities xslt_stylesheet xslt_typesdrew@li229-23"),c=t("http mail events server types location upstream charset_map limit_except if geo map"),u=t("include root server server_name listen internal proxy_pass memcached_pass fastcgi_pass try_files"),d=e.indentUnit; -if("hash"==e)m="builtin";else if("word"==e)m="tag";else{if("variable-definition"==e)return"maybeprop";if("interpolation"==e)return l(r,t,"interpolation");if(":"==e)return"pseudo";if(T&&"("==e)return l(r,t,"parens")}return r.context.type},E.block=function(e,t,r){if("word"==e){var n=t.current().toLowerCase();return w.hasOwnProperty(n)?(m="property","maybeprop"):_.hasOwnProperty(n)?(m="string-2","maybeprop"):T?(m=t.match(/^\s*:(?:\s|$)/,!1)?"property":"tag","block"):(m+=" error","maybeprop")}return"meta"==e?"block":T||"hash"!=e&&"qualifier"!=e?E.top(e,t,r):(m="error","block")},E.maybeprop=function(e,t,r){return":"==e?l(r,t,"prop"):u(e,t,r)},E.prop=function(e,t,r){if(";"==e)return c(r);if("{"==e&&T)return l(r,t,"propBlock");if("}"==e||"{"==e)return f(e,t,r);if("("==e)return l(r,t,"parens");if("hash"!=e||/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(t.current())){if("word"==e)d(t);else if("interpolation"==e)return l(r,t,"interpolation")}else m+=" error";return"prop"},E.propBlock=function(e,t,r){return"}"==e?c(r):"word"==e?(m="property","maybeprop"):r.context.type},E.parens=function(e,t,r){return"{"==e||"}"==e?f(e,t,r):")"==e?c(r):"("==e?l(r,t,"parens"):"interpolation"==e?l(r,t,"interpolation"):("word"==e&&d(t),"parens")},E.pseudo=function(e,t,r){return"word"==e?(m="variable-3",r.context.type):u(e,t,r)},E.documentTypes=function(e,t,r){return"word"==e&&y.hasOwnProperty(t.current())?(m="tag",r.context.type):E.atBlock(e,t,r)},E.atBlock=function(e,t,r){if("("==e)return l(r,t,"atBlock_parens");if("}"==e||";"==e)return f(e,t,r);if("{"==e)return c(r)&&l(r,t,T?"block":"top");if("interpolation"==e)return l(r,t,"interpolation");if("word"==e){var n=t.current().toLowerCase();m="only"==n||"not"==n||"and"==n||"or"==n?"keyword":b.hasOwnProperty(n)?"attribute":k.hasOwnProperty(n)?"property":x.hasOwnProperty(n)?"keyword":w.hasOwnProperty(n)?"property":_.hasOwnProperty(n)?"string-2":L.hasOwnProperty(n)?"atom":M.hasOwnProperty(n)?"keyword":"error"}return r.context.type},E.atComponentBlock=function(e,t,r){return"}"==e?f(e,t,r):"{"==e?c(r)&&l(r,t,T?"block":"top",!1):("word"==e&&(m="error"),r.context.type)},E.atBlock_parens=function(e,t,r){return")"==e?c(r):"{"==e||"}"==e?f(e,t,r,2):E.atBlock(e,t,r)},E.restricted_atBlock_before=function(e,t,r){return"{"==e?l(r,t,"restricted_atBlock"):"word"==e&&"@counter-style"==r.stateArg?(m="variable","restricted_atBlock_before"):u(e,t,r)},E.restricted_atBlock=function(e,t,r){return"}"==e?(r.stateArg=null,c(r)):"word"==e?(m="@font-face"==r.stateArg&&!C.hasOwnProperty(t.current().toLowerCase())||"@counter-style"==r.stateArg&&!S.hasOwnProperty(t.current().toLowerCase())?"error":"property","maybeprop"):"restricted_atBlock"},E.keyframes=function(e,t,r){return"word"==e?(m="variable","keyframes"):"{"==e?l(r,t,"top"):u(e,t,r)},E.at=function(e,t,r){return";"==e?c(r):"{"==e||"}"==e?f(e,t,r):("word"==e?m="tag":"hash"==e&&(m="builtin"),"at")},E.interpolation=function(e,t,r){return"}"==e?c(r):"{"==e||";"==e?f(e,t,r):("word"==e?m="variable":"variable"!=e&&"("!=e&&")"!=e&&(m="error"),"interpolation")},{startState:function(e){return{tokenize:null,state:p?"block":"top",stateArg:null,context:new s(p?"block":"top",e||0,null)}},token:function(e,t){if(!t.tokenize&&e.eatSpace())return null;var r=(t.tokenize||i)(e,t);return r&&"object"==typeof r&&(h=r[1],r=r[0]),m=r,t.state=E[t.state](h,e,t),m},indent:function(e,t){var r=e.context,n=t&&t.charAt(0),i=r.indent;return"prop"!=r.type||"}"!=n&&")"!=n||(r=r.prev),r.prev&&("}"!=n||"block"!=r.type&&"top"!=r.type&&"interpolation"!=r.type&&"restricted_atBlock"!=r.type?(")"==n&&("parens"==r.type||"atBlock_parens"==r.type)||"{"==n&&("at"==r.type||"atBlock"==r.type))&&(i=Math.max(0,r.indent-g),r=r.prev):(r=r.prev,i=r.indent)),i},electricChars:"}",blockCommentStart:"/*",blockCommentEnd:"*/",fold:"brace"}});var n=["domain","regexp","url","url-prefix"],i=t(n),o=["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"],a=t(o),s=["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","orientation","device-pixel-ratio","min-device-pixel-ratio","max-device-pixel-ratio","pointer","any-pointer","hover","any-hover"],l=t(s),c=["landscape","portrait","none","coarse","fine","on-demand","hover","interlace","progressive"],u=t(c),f=["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode"],d=t(f),p=["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"],h=t(p),m=["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"],g=t(m),v=["additive-symbols","fallback","negative","pad","prefix","range","speak-as","suffix","symbols","system"],y=t(v),b=["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"],k=t(b),x=["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hard-light","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","luminosity","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","multiply","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","somali","source-atop","source-in","source-out","source-over","space","space-around","space-between","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"],w=t(x),_=n.concat(o).concat(s).concat(c).concat(f).concat(p).concat(b).concat(x);e.registerHelper("hintWords","css",_),e.defineMIME("text/css",{documentTypes:i,mediaTypes:a,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:d,nonStandardPropertyKeywords:h,fontProperties:g,counterDescriptors:y,colorKeywords:k,valueKeywords:w,tokenHooks:{"/":function(e,t){return e.eat("*")?(t.tokenize=r,r(e,t)):!1}},name:"css"}),e.defineMIME("text/x-scss",{mediaTypes:a,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:d,nonStandardPropertyKeywords:h,colorKeywords:k,valueKeywords:w,fontProperties:g,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},":":function(e){return e.match(/\s*\{/)?[null,"{"]:!1},$:function(e){return e.match(/^[\w-]+/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"]},"#":function(e){return e.eat("{")?[null,"interpolation"]:!1}},name:"css",helperType:"scss"}),e.defineMIME("text/x-less",{mediaTypes:a,mediaFeatures:l,mediaValueKeywords:u,propertyKeywords:d,nonStandardPropertyKeywords:h,colorKeywords:k,valueKeywords:w,fontProperties:g,allowNested:!0,tokenHooks:{"/":function(e,t){return e.eat("/")?(e.skipToEnd(),["comment","comment"]):e.eat("*")?(t.tokenize=r,r(e,t)):["operator","operator"]},"@":function(e){return e.eat("{")?[null,"interpolation"]:e.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/,!1)?!1:(e.eatWhile(/[\w\\\-]/),e.match(/^\s*:/,!1)?["variable-2","variable-definition"]:["variable-2","variable"])},"&":function(){return["atom","atom"]}},name:"css",helperType:"less"}),e.defineMIME("text/x-gss",{documentTypes:i,mediaTypes:a,mediaFeatures:l,propertyKeywords:d,nonStandardPropertyKeywords:h,fontProperties:g,counterDescriptors:y,colorKeywords:k,valueKeywords:w,supportsAtComponent:!0,tokenHooks:{"/":function(e,t){return e.eat("*")?(t.tokenize=r,r(e,t)):!1}},name:"css",helperType:"gss"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../xml/xml"),require("../javascript/javascript"),require("../css/css")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../xml/xml","../javascript/javascript","../css/css"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,r){var n=e.current(),i=n.search(t);return i>-1?e.backUp(n.length-i):n.match(/<\/?$/)&&(e.backUp(n.length),e.match(t,!1)||e.match(n)),r}function r(e){var t=l[e];return t?t:l[e]=new RegExp("\\s+"+e+"\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*")}function n(e,t){for(var n,i=e.pos;i>=0&&"<"!==e.string.charAt(i);)i--;return 0>i?i:(n=e.string.slice(i,e.pos).match(r(t)))?n[2]:""}function i(e,t){return new RegExp((t?"^":"")+"","i")}function o(e,t){for(var r in e)for(var n=t[r]||(t[r]=[]),i=e[r],o=i.length-1;o>=0;o--)n.unshift(i[o])}function a(e,t){for(var r=0;r"===n.current()&&(s=a(d,n))){var h=e.getMode(r,s),m=i(f,!0),g=i(f,!1);o.token=function(e,r){return e.match(m,!1)?(r.token=l,r.localState=r.localMode=null,null):t(e,g,r.localMode.token(e,r.localState))},o.localMode=h,o.localState=e.startState(h,c.indent(o.htmlState,""))}return p}var c=e.getMode(r,{name:"xml",htmlMode:!0,multilineTagIndentFactor:n.multilineTagIndentFactor,multilineTagIndentPastTag:n.multilineTagIndentPastTag}),u={},f=n&&n.tags,d=n&&n.scriptTypes;if(o(s,u),f&&o(f,u),d)for(var p=d.length-1;p>=0;p--)u.script.unshift(["type",d[p].matches,d[p].mode]);return{startState:function(){var e=c.startState();return{token:l,localMode:null,localState:null,htmlState:e}},copyState:function(t){var r;return t.localState&&(r=e.copyState(t.localMode,t.localState)),{token:t.token,localMode:t.localMode,localState:r,htmlState:e.copyState(c,t.htmlState)}},token:function(e,t){return t.token(e,t)},indent:function(t,r){return!t.localMode||/^\s*<\//.test(r)?c.indent(t.htmlState,r):t.localMode.indent?t.localMode.indent(t.localState,r):e.Pass},innerMode:function(e){return{state:e.localState||e.htmlState,mode:e.localMode||c}}}},"xml","javascript","css"),e.defineMIME("text/html","htmlmixed")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../../addon/mode/multiplex")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../../addon/mode/multiplex"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("htmlembedded",function(t,r){return e.multiplexingMode(e.getMode(t,"htmlmixed"),{open:r.open||r.scriptStartRegex||"<%",close:r.close||r.scriptEndRegex||"%>",mode:e.getMode(t,r.scriptingModeSpec)})},"htmlmixed"),e.defineMIME("application/x-ejs",{name:"htmlembedded",scriptingModeSpec:"javascript"}),e.defineMIME("application/x-aspx",{name:"htmlembedded",scriptingModeSpec:"text/x-csharp"}),e.defineMIME("application/x-jsp",{name:"htmlembedded",scriptingModeSpec:"text/x-java"}),e.defineMIME("application/x-erb",{name:"htmlembedded",scriptingModeSpec:"ruby"})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=e.split(" "),n=0;n|[*\]])\s*$|\*$/.test(e.string.slice(0,e.start))?!0:void 0}function d(e){for(;;){if(!e||"top"==e.type)return!0;if("}"==e.type&&"namespace"!=e.prev.type)return!1;e=e.prev}}var p,h,m=t.indentUnit,g=n.statementIndentUnit||m,v=n.dontAlignCalls,y=n.keywords||{},b=n.types||{},k=n.builtin||{},x=n.blockKeywords||{},w=n.defKeywords||{},_=n.atoms||{},C=n.hooks||{},S=n.multiLineStrings,M=n.indentStatements!==!1,L=n.indentSwitch!==!1,T=n.namespaceSeparator,A=n.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,E=n.numberStart||/[\d\.]/,O=n.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,z=n.isOperatorChar||/[+\-*&%=<>!?|\/]/,I=n.endStatement||/^[;:,]$/;return{startState:function(e){return{tokenize:null,context:new s((e||0)-m,0,"top",!1),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var r=t.context;if(e.sol()&&(null==r.align&&(r.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return null;p=h=null;var o=(t.tokenize||i)(e,t);if("comment"==o||"meta"==o)return o;if(null==r.align&&(r.align=!0),I.test(p))for(;l(t.context.type);)u(t);else if("{"==p)c(t,e.column(),"}");else if("["==p)c(t,e.column(),"]");else if("("==p)c(t,e.column(),")");else if("}"==p){for(;l(r.type);)r=u(t);for("}"==r.type&&(r=u(t));l(r.type);)r=u(t)}else if(p==r.type)u(t);else if(M&&(("}"==r.type||"top"==r.type)&&";"!=p||l(r.type)&&"newstatement"==p)){var a="statement";"newstatement"==p&&L&&"switch"==e.current()?a="switchstatement":"keyword"==o&&"namespace"==e.current()&&(a="namespace"),c(t,e.column(),a)}if("variable"==o&&("def"==t.prevToken||n.typeFirstDefinitions&&f(e,t)&&d(t.context)&&e.match(/^\s*\(/,!1))&&(o="def"),C.token){var s=C.token(e,t,o);void 0!==s&&(o=s)}return"def"==o&&n.styleDefs===!1&&(o="variable"),t.startOfLine=!1,t.prevToken=h?"def":o||p,o},indent:function(t,r){if(t.tokenize!=i&&null!=t.tokenize)return e.Pass;var o=t.context,a=r&&r.charAt(0);if(l(o.type)&&"}"==a&&(o=o.prev),C.indent){var s=C.indent(t,o,r);if("number"==typeof s)return s}var c=a==o.type,u=o.prev&&"switchstatement"==o.prev.type;if(n.allmanIndentation&&/[{(]/.test(a)){for(;"top"!=o.type&&"}"!=o.type;)o=o.prev;return o.indented}return l(o.type)?o.indented+("{"==a?0:g):!o.align||v&&")"==o.type?")"!=o.type||c?o.indented+(c?0:m)+(c||!u||/^(?:case|default)\b/.test(r)?0:m):o.indented+g:o.column+(c?0:1)},electricInput:L?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",fold:"brace"}});var h="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile",m="int long char short double float unsigned signed void size_t ptrdiff_t";u(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:t(h),types:t(m+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"),blockKeywords:t("case do else for if switch while struct"),defKeywords:t("struct"),typeFirstDefinitions:!0,atoms:t("null true false"),hooks:{"#":n,"*":i},modeProps:{fold:["brace","include"]}}),u(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:t(h+" asm dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:t(m+" bool wchar_t"),blockKeywords:t("catch class do else finally for if struct switch try while"), -defKeywords:t("class namespace struct enum union"),typeFirstDefinitions:!0,atoms:t("true false null"),hooks:{"#":n,"*":i,u:a,U:a,L:a,R:a,0:o,1:o,2:o,3:o,4:o,5:o,6:o,7:o,8:o,9:o,token:function(e,t,r){return"variable"!=r||"("!=e.peek()||";"!=t.prevToken&&null!=t.prevToken&&"}"!=t.prevToken||!s(e.current())?void 0:"def"}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),u("text/x-java",{name:"clike",keywords:t("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while"),types:t("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:t("catch class do else finally for if switch try while"),defKeywords:t("class interface package enum"),typeFirstDefinitions:!0,atoms:t("true false null"),endStatement:/^[;:]$/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"}},modeProps:{fold:["brace","import"]}}),u("text/x-csharp",{name:"clike",keywords:t("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:t("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:t("catch class do else finally for foreach if struct switch try while"),defKeywords:t("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:t("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=l,l(e,t)):(e.eatWhile(/[\w\$_]/),"meta")}}}),u("text/x-scala",{name:"clike",keywords:t("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ : = => <- <: <% >: # @ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble :: #:: "),types:t("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:t("catch class do else finally for forSome if match switch try while"),defKeywords:t("class def object package trait type val var"),atoms:t("true false null"),indentStatements:!1,indentSwitch:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return e.match('""')?(t.tokenize=f,t.tokenize(e,t)):!1},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"}},modeProps:{closeBrackets:{triples:'"'}}}),u("text/x-kotlin",{name:"clike",keywords:t("package as typealias class interface this super val var fun for is in This throw return break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix"),types:t("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,blockKeywords:t("catch class do else finally for if where try while enum"),defKeywords:t("class val var object package interface fun"),atoms:t("true false null this"),hooks:{'"':function(e,t){return t.tokenize=d(e.match('""')),t.tokenize(e,t)}},modeProps:{closeBrackets:{triples:'"'}}}),u(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:t("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:t("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:t("for while do if else struct"),builtin:t("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:t("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":n},modeProps:{fold:["brace","include"]}}),u("text/x-nesc",{name:"clike",keywords:t(h+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:t(m),blockKeywords:t("case do else for if switch while struct"),atoms:t("null true false"),hooks:{"#":n},modeProps:{fold:["brace","include"]}}),u("text/x-objectivec",{name:"clike",keywords:t(h+"inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),types:t(m),atoms:t("YES NO NULL NILL ON OFF true false"),hooks:{"@":function(e){return e.eatWhile(/[\w\$]/),"keyword"},"#":n,indent:function(e,t,r){return"statement"==t.type&&/^@\w/.test(r)?t.indented:void 0}},modeProps:{fold:"brace"}}),u("text/x-squirrel",{name:"clike",keywords:t("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:t(m),blockKeywords:t("case catch class else for foreach if switch try while"),defKeywords:t("function local class"),typeFirstDefinitions:!0,atoms:t("true false null"),hooks:{"#":n},modeProps:{fold:["brace","include"]}});var g=null;u("text/x-ceylon",{name:"clike",keywords:t("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){var t=e.charAt(0);return t===t.toUpperCase()&&t!==t.toLowerCase()},blockKeywords:t("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:t("class dynamic function interface module object package value"),builtin:t("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:t("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return t.tokenize=p(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return g&&e.match("`")?(t.tokenize=g,g=null,t.tokenize(e,t)):!1},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(e,t,r){return"variable"!=r&&"variable-3"!=r||"."!=t.prevToken?void 0:"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("clojure",function(e){function t(e){for(var t={},r=e.split(" "),n=0;n ->> doto and or dosync doseq dotimes dorun doall load import unimport ns in-ns refer try catch finally throw with-open with-local-vars binding gen-class gen-and-load-class gen-and-save-class handler-case handle"),k=t("* *' *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* *command-line-args* *compile-files* *compile-path* *compiler-options* *data-readers* *e *err* *file* *flush-on-newline* *fn-loader* *in* *math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* *source-path* *unchecked-math* *use-context-classloader* *verbose-defrecords* *warn-on-reflection* + +' - -' -> ->> ->ArrayChunk ->Vec ->VecNode ->VecSeq -cache-protocol-fn -reset-methods .. / < <= = == > >= EMPTY-NODE accessor aclone add-classpath add-watch agent agent-error agent-errors aget alength alias all-ns alter alter-meta! alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint biginteger binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* bound? butlast byte byte-array bytes case cast char char-array char-escape-string char-name-string char? chars chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors clojure-version coll? comment commute comp comparator compare compare-and-set! compile complement concat cond condp conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec dec' decimal? declare default-data-readers definline definterface defmacro defmethod defmulti defn defn- defonce defprotocol defrecord defstruct deftype delay delay? deliver denominator deref derive descendants destructure disj disj! dissoc dissoc! distinct distinct? doall dorun doseq dosync dotimes doto double double-array doubles drop drop-last drop-while empty empty? ensure enumeration-seq error-handler error-mode eval even? every-pred every? ex-data ex-info extend extend-protocol extend-type extenders extends? false? ffirst file-seq filter filterv find find-keyword find-ns find-protocol-impl find-protocol-method find-var first flatten float float-array float? floats flush fn fn? fnext fnil for force format frequencies future future-call future-cancel future-cancelled? future-done? future? gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator group-by hash hash-combine hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc inc' init-proxy instance? int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt keep keep-indexed key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array make-hierarchy map map-indexed map? mapcat mapv max max-key memfn memoize merge merge-with meta method-sig methods min min-key mod munge name namespace namespace-munge neg? newline next nfirst nil? nnext not not-any? not-empty not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias ns-unmap nth nthnext nthrest num number? numerator object-array odd? or parents partial partition partition-all partition-by pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers primitives-classnames print print-ctor print-dup print-method print-simple print-str printf println println-str prn prn-str promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot rand rand-int rand-nth range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern re-seq read read-line read-string realized? reduce reduce-kv reductions ref ref-history-count ref-max-history ref-min-history ref-set refer refer-clojure reify release-pending-sends rem remove remove-all-methods remove-method remove-ns remove-watch repeat repeatedly replace replicate require reset! reset-meta! resolve rest restart-agent resultset-seq reverse reversible? rseq rsubseq satisfies? second select-keys send send-off seq seq? seque sequence sequential? set set-error-handler! set-error-mode! set-validator! set? short short-array shorts shuffle shutdown-agents slurp some some-fn sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? special-symbol? spit split-at split-with str string? struct struct-map subs subseq subvec supers swap! symbol symbol? sync take take-last take-nth take-while test the-ns thread-bound? time to-array to-array-2d trampoline transient tree-seq true? type unchecked-add unchecked-add-int unchecked-byte unchecked-char unchecked-dec unchecked-dec-int unchecked-divide-int unchecked-double unchecked-float unchecked-inc unchecked-inc-int unchecked-int unchecked-long unchecked-multiply unchecked-multiply-int unchecked-negate unchecked-negate-int unchecked-remainder-int unchecked-short unchecked-subtract unchecked-subtract-int underive unquote unquote-splicing update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector-of vector? when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context with-local-vars with-meta with-open with-out-str with-precision with-redefs with-redefs-fn xml-seq zero? zipmap *default-data-reader-fn* as-> cond-> cond->> reduced reduced? send-via set-agent-send-executor! set-agent-send-off-executor! some-> some->>"),x=t("ns fn def defn defmethod bound-fn if if-not case condp when while when-not when-first do future comment doto locking proxy with-open with-precision reify deftype defrecord defprotocol extend extend-protocol extend-type try catch let letfn binding loop for doseq dotimes when-let if-let defstruct struct-map assoc testing deftest handler-case handle dotrace deftrace"),w={digit:/\d/,digit_or_colon:/[\d:]/,hex:/[0-9a-f]/i,sign:/[+-]/,exponent:/e/i,keyword_char:/[^\s\(\[\;\)\]]/,symbol:/[\w*+!\-\._?:<>\/\xa1-\uffff]/};return{startState:function(){return{indentStack:null,indentation:0,mode:!1}},token:function(e,t){if(null==t.indentStack&&e.sol()&&(t.indentation=e.indentation()),e.eatSpace())return null;var r=null;switch(t.mode){case"string":for(var _,C=!1;null!=(_=e.next());){if('"'==_&&!C){t.mode=!1;break}C=!C&&"\\"==_}r=c;break;default:var S=e.next();if('"'==S)t.mode="string",r=c;else if("\\"==S)a(e),r=u;else if("'"!=S||w.digit_or_colon.test(e.peek()))if(";"==S)e.skipToEnd(),r=l;else if(o(S,e))r=d;else if("("==S||"["==S||"{"==S){var M,L="",T=e.column();if("("==S)for(;null!=(M=e.eat(w.keyword_char));)L+=M;L.length>0&&(x.propertyIsEnumerable(L)||/^(?:def|with)/.test(L))?n(t,T+g,S):(e.eatSpace(),e.eol()||";"==e.peek()?n(t,T+v,S):n(t,T+e.current().length,S)),e.backUp(e.current().length-1),r=p}else if(")"==S||"]"==S||"}"==S)r=p,null!=t.indentStack&&t.indentStack.type==(")"==S?"(":"]"==S?"[":"{")&&i(t);else{if(":"==S)return e.eatWhile(w.symbol),f;e.eatWhile(w.symbol),r=b&&b.propertyIsEnumerable(e.current())?h:k&&k.propertyIsEnumerable(e.current())?s:y&&y.propertyIsEnumerable(e.current())?f:m}else r=f}return r},indent:function(e){return null==e.indentStack?e.indentation:e.indentStack.indent},closeBrackets:{pairs:'()[]{}""'},lineComment:";;"}}),e.defineMIME("text/x-clojure","clojure")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("ruby",function(e){function t(e){for(var t={},r=0,n=e.length;n>r;++r)t[e[r]]=!0;return t}function r(e,t,r){return r.tokenize.push(e),e(t,r)}function n(e,t){if(e.sol()&&e.match("=begin")&&e.eol())return t.tokenize.push(l),"comment";if(e.eatSpace())return null;var n,i=e.next();if("`"==i||"'"==i||'"'==i)return r(a(i,"string",'"'==i||"`"==i),e,t);if("/"==i){var o=e.current().length;if(e.skipTo("/")){var u=e.current().length;e.backUp(e.current().length-o);for(var f=0;e.current().lengthf)break}if(e.backUp(e.current().length-o),0==f)return r(a(i,"string-2",!0),e,t)}return"operator"}if("%"==i){var h="string",m=!0;e.eat("s")?h="atom":e.eat(/[WQ]/)?h="string":e.eat(/[r]/)?h="string-2":e.eat(/[wxq]/)&&(h="string",m=!1);var g=e.eat(/[^\w\s=]/);return g?(p.propertyIsEnumerable(g)&&(g=p[g]),r(a(g,h,m,!0),e,t)):"operator"}if("#"==i)return e.skipToEnd(),"comment";if("<"==i&&(n=e.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/)))return r(s(n[1]),e,t);if("0"==i)return e.eatWhile(e.eat("x")?/[\da-fA-F]/:e.eat("b")?/[01]/:/[0-7]/),"number";if(/\d/.test(i))return e.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/),"number";if("?"==i){for(;e.match(/^\\[CM]-/););return e.eat("\\")?e.eatWhile(/\w/):e.next(),"string"}if(":"==i)return e.eat("'")?r(a("'","atom",!1),e,t):e.eat('"')?r(a('"',"atom",!0),e,t):e.eat(/[\<\>]/)?(e.eat(/[\<\>]/),"atom"):e.eat(/[\+\-\*\/\&\|\:\!]/)?"atom":e.eat(/[a-zA-Z$@_\xa1-\uffff]/)?(e.eatWhile(/[\w$\xa1-\uffff]/),e.eat(/[\?\!\=]/),"atom"):"operator";if("@"==i&&e.match(/^@?[a-zA-Z_\xa1-\uffff]/))return e.eat("@"),e.eatWhile(/[\w\xa1-\uffff]/),"variable-2";if("$"==i)return e.eat(/[a-zA-Z_]/)?e.eatWhile(/[\w]/):e.eat(/\d/)?e.eat(/\d/):e.next(),"variable-3";if(/[a-zA-Z_\xa1-\uffff]/.test(i))return e.eatWhile(/[\w\xa1-\uffff]/),e.eat(/[\?\!]/),e.eat(":")?"atom":"ident";if("|"!=i||!t.varList&&"{"!=t.lastTok&&"do"!=t.lastTok){if(/[\(\)\[\]{}\\;]/.test(i))return c=i,null;if("-"==i&&e.eat(">"))return"arrow";if(/[=+\-\/*:\.^%<>~|]/.test(i)){var v=e.eatWhile(/[=+\-\/*:\.^%<>~|]/);return"."!=i||v||(c="."),"operator"}return null}return c="|",null}function i(e){return e||(e=1),function(t,r){if("}"==t.peek()){if(1==e)return r.tokenize.pop(),r.tokenize[r.tokenize.length-1](t,r);r.tokenize[r.tokenize.length-1]=i(e-1)}else"{"==t.peek()&&(r.tokenize[r.tokenize.length-1]=i(e+1));return n(t,r)}}function o(){var e=!1;return function(t,r){return e?(r.tokenize.pop(),r.tokenize[r.tokenize.length-1](t,r)):(e=!0,n(t,r))}}function a(e,t,r,n){return function(a,s){var l,c=!1;for("read-quoted-paused"===s.context.type&&(s.context=s.context.prev,a.eat("}"));null!=(l=a.next());){if(l==e&&(n||!c)){s.tokenize.pop();break}if(r&&"#"==l&&!c){if(a.eat("{")){"}"==e&&(s.context={prev:s.context,type:"read-quoted-paused"}),s.tokenize.push(i());break}if(/[@\$]/.test(a.peek())){s.tokenize.push(o());break}}c=!c&&"\\"==l}return t}}function s(e){return function(t,r){return t.match(e)?r.tokenize.pop():t.skipToEnd(),"string"}}function l(e,t){return e.sol()&&e.match("=end")&&e.eol()&&t.tokenize.pop(),e.skipToEnd(),"comment"}var c,u=t(["alias","and","BEGIN","begin","break","case","class","def","defined?","do","else","elsif","END","end","ensure","false","for","if","in","module","next","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","nil","raise","throw","catch","fail","loop","callcc","caller","lambda","proc","public","protected","private","require","load","require_relative","extend","autoload","__END__","__FILE__","__LINE__","__dir__"]),f=t(["def","class","case","for","while","until","module","then","catch","loop","proc","begin"]),d=t(["end","until"]),p={"[":"]","{":"}","(":")"};return{startState:function(){return{tokenize:[n],indented:0,context:{type:"top",indented:-e.indentUnit},continuedLine:!1,lastTok:null,varList:!1}},token:function(e,t){c=null,e.sol()&&(t.indented=e.indentation());var r,n=t.tokenize[t.tokenize.length-1](e,t),i=c;if("ident"==n){var o=e.current();n="."==t.lastTok?"property":u.propertyIsEnumerable(e.current())?"keyword":/^[A-Z]/.test(o)?"tag":"def"==t.lastTok||"class"==t.lastTok||t.varList?"def":"variable","keyword"==n&&(i=o,f.propertyIsEnumerable(o)?r="indent":d.propertyIsEnumerable(o)?r="dedent":"if"!=o&&"unless"!=o||e.column()!=e.indentation()?"do"==o&&t.context.indentedn?p(e,t,"py"):n>i&&h(e,t)&&(t.errorToken=!0),null}var o=f(e,t);return n>0&&h(e,t)&&(o+=" "+g),o}return f(e,t)}function f(e,t){if(e.eatSpace())return null;var r=e.peek();if("#"==r)return e.skipToEnd(),"comment";if(e.match(/^[0-9\.]/,!1)){var i=!1;if(e.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)&&(i=!0),e.match(/^\d+\.\d*/)&&(i=!0),e.match(/^\.\d+/)&&(i=!0),i)return e.eat(/J/i),"number";var o=!1;if(e.match(/^0x[0-9a-f]+/i)&&(o=!0),e.match(/^0b[01]+/i)&&(o=!0),e.match(/^0o[0-7]+/i)&&(o=!0),e.match(/^[1-9]\d*(e[\+\-]?\d+)?/)&&(e.eat(/J/i),o=!0),e.match(/^0(?![\dx])/i)&&(o=!0),o)return e.eat(/L/i),"number"}return e.match(M)?(t.tokenize=d(e.current()),t.tokenize(e,t)):e.match(k)||e.match(b)?"punctuation":e.match(y)||e.match(x)?"operator":e.match(v)?"punctuation":"."==t.lastToken&&e.match(w)?"property":e.match(L)||e.match(n)?"keyword":e.match(T)?"builtin":e.match(/^(self|cls)\b/)?"variable-2":e.match(w)?"def"==t.lastToken||"class"==t.lastToken?"def":"variable":(e.next(),g)}function d(e){function t(t,i){for(;!t.eol();)if(t.eatWhile(/[^'"\\]/),t.eat("\\")){if(t.next(),r&&t.eol())return n}else{if(t.match(e))return i.tokenize=u,n;t.eat(/['"]/)}if(r){if(c.singleLineStringErrors)return g;i.tokenize=u}return n}for(;"rub".indexOf(e.charAt(0).toLowerCase())>=0;)e=e.substr(1);var r=1==e.length,n="string";return t.isString=!0,t}function p(e,t,n){var i=0,o=null;if("py"==n)for(;"py"!=r(t).type;)t.scopes.pop();i=r(t).offset+("py"==n?l.indentUnit:_),"py"==n||e.match(/^(\s|#.*)*$/,!1)||(o=e.column()+1),t.scopes.push({offset:i,type:n,align:o})}function h(e,t){for(var n=e.indentation();r(t).offset>n;){if("py"!=r(t).type)return!0;t.scopes.pop()}return r(t).offset!=n}function m(e,t){var n=t.tokenize(e,t),i=e.current();if("@"==i)return c.version&&3==parseInt(c.version,10)?e.match(w,!1)?"meta":"operator":e.match(w,!1)?"meta":g;"variable"!=n&&"builtin"!=n||"meta"!=t.lastToken||(n="meta"),("pass"==i||"return"==i)&&(t.dedent+=1),"lambda"==i&&(t.lambda=!0),":"!=i||t.lambda||"py"!=r(t).type||p(e,t,"py");var o=1==i.length?"[({".indexOf(i):-1;if(-1!=o&&p(e,t,"])}".slice(o,o+1)),o="])}".indexOf(i),-1!=o){if(r(t).type!=i)return g;t.scopes.pop()}return t.dedent>0&&e.eol()&&"py"==r(t).type&&(t.scopes.length>1&&t.scopes.pop(),t.dedent-=1),n}var g="error",v=c.singleDelimiters||/^[\(\)\[\]\{\}@,:`=;\.]/,y=c.doubleOperators||/^([!<>]==|<>|<<|>>|\/\/|\*\*)/,b=c.doubleDelimiters||/^(\+=|\-=|\*=|%=|\/=|&=|\|=|\^=)/,k=c.tripleDelimiters||/^(\/\/=|>>=|<<=|\*\*=)/;if(c.version&&3==parseInt(c.version,10))var x=c.singleOperators||/^[\+\-\*\/%&|\^~<>!@]/,w=c.identifiers||/^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;else var x=c.singleOperators||/^[\+\-\*\/%&|\^~<>!]/,w=c.identifiers||/^[_A-Za-z][_A-Za-z0-9]*/;var _=c.hangingIndent||l.indentUnit,C=i,S=o;if(void 0!=c.extra_keywords&&(C=C.concat(c.extra_keywords)),void 0!=c.extra_builtins&&(S=S.concat(c.extra_builtins)),c.version&&3==parseInt(c.version,10)){C=C.concat(s.keywords),S=S.concat(s.builtins);var M=new RegExp("^(([rb]|(br))?('{3}|\"{3}|['\"]))","i")}else{C=C.concat(a.keywords),S=S.concat(a.builtins);var M=new RegExp("^(([rub]|(ur)|(br))?('{3}|\"{3}|['\"]))","i")}var L=t(C),T=t(S),A={startState:function(e){return{tokenize:u,scopes:[{offset:e||0,type:"py",align:null}],lastToken:null,lambda:!1,dedent:0}},token:function(e,t){var r=t.errorToken;r&&(t.errorToken=!1);var n=m(e,t);return n&&"comment"!=n&&(t.lastToken="keyword"==n||"punctuation"==n?e.current():n),"punctuation"==n&&(n=null),e.eol()&&t.lambda&&(t.lambda=!1),r?n+" "+g:n},indent:function(t,n){if(t.tokenize!=u)return t.tokenize.isString?e.Pass:0;var i=r(t),o=n&&n.charAt(0)==i.type;return null!=i.align?i.align-(o?1:0):o&&t.scopes.length>1?t.scopes[t.scopes.length-2].offset:i.offset},closeBrackets:{triples:"'\""},lineComment:"#",fold:"indent"};return A}),e.defineMIME("text/x-python","python");var l=function(e){return e.split(" ")};e.defineMIME("text/x-cython",{name:"python",extra_keywords:l("by cdef cimport cpdef ctypedef enum exceptextern gil include nogil property publicreadonly struct union DEF IF ELIF ELSE")})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("shell",function(){function e(e,t){for(var r=t.split(" "),n=0;n=0?r:0,t)}return e.string.substr(0,e.pos-1)}function n(e,t){var r=e.string.length,n=r-e.pos+1;return e.string.substr(e.pos,t&&r>t?t:n)}function i(e,t){var r,n=e.pos+t;e.pos=0>=n?0:n>=(r=e.string.length-1)?r:n}e.defineMode("perl",function(){function e(e,t,r,n,i){return t.chain=null,t.style=null,t.tail=null,t.tokenize=function(e,t){for(var o,s=!1,l=0;o=e.next();){if(o===r[l]&&!s)return void 0!==r[++l]?(t.chain=r[l],t.style=n,t.tail=i):i&&e.eatWhile(i),t.tokenize=a,n;s=!s&&"\\"==o}return n},t.tokenize(e,t)}function o(e,t,r){return t.tokenize=function(e,t){return e.string==r&&(t.tokenize=a),e.skipToEnd(),"string"},t.tokenize(e,t)}function a(a,u){if(a.eatSpace())return null;if(u.chain)return e(a,u,u.chain,u.style,u.tail);if(a.match(/^\-?[\d\.]/,!1)&&a.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/))return"number";if(a.match(/^<<(?=\w)/))return a.eatWhile(/\w/),o(a,u,a.current().substr(2));if(a.sol()&&a.match(/^\=item(?!\w)/))return o(a,u,"=cut");var d=a.next();if('"'==d||"'"==d){if(r(a,3)=="<<"+d){var f=a.pos;a.eatWhile(/\w/);var p=a.current().substr(1);if(p&&a.eat(d))return o(a,u,p);a.pos=f}return e(a,u,[d],"string")}if("q"==d){var h=t(a,-2);if(!h||!/\w/.test(h))if(h=t(a,0),"x"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],l,c);if("["==h)return i(a,2),e(a,u,["]"],l,c);if("{"==h)return i(a,2),e(a,u,["}"],l,c);if("<"==h)return i(a,2),e(a,u,[">"],l,c);if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],l,c)}else if("q"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],"string");if("["==h)return i(a,2),e(a,u,["]"],"string");if("{"==h)return i(a,2),e(a,u,["}"],"string");if("<"==h)return i(a,2),e(a,u,[">"],"string");if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],"string")}else if("w"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],"bracket");if("["==h)return i(a,2),e(a,u,["]"],"bracket");if("{"==h)return i(a,2),e(a,u,["}"],"bracket");if("<"==h)return i(a,2),e(a,u,[">"],"bracket");if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],"bracket")}else if("r"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],l,c);if("["==h)return i(a,2),e(a,u,["]"],l,c);if("{"==h)return i(a,2),e(a,u,["}"],l,c);if("<"==h)return i(a,2),e(a,u,[">"],l,c);if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],l,c)}else if(/[\^'"!~\/(\[{<]/.test(h)){if("("==h)return i(a,1),e(a,u,[")"],"string");if("["==h)return i(a,1),e(a,u,["]"],"string");if("{"==h)return i(a,1),e(a,u,["}"],"string");if("<"==h)return i(a,1),e(a,u,[">"],"string");if(/[\^'"!~\/]/.test(h))return e(a,u,[a.eat(h)],"string")}}if("m"==d){var h=t(a,-2);if((!h||!/\w/.test(h))&&(h=a.eat(/[(\[{<\^'"!~\/]/))){if(/[\^'"!~\/]/.test(h))return e(a,u,[h],l,c);if("("==h)return e(a,u,[")"],l,c);if("["==h)return e(a,u,["]"],l,c);if("{"==h)return e(a,u,["}"],l,c);if("<"==h)return e(a,u,[">"],l,c)}}if("s"==d){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat(/[(\[{<\^'"!~\/]/)))return"["==h?e(a,u,["]","]"],l,c):"{"==h?e(a,u,["}","}"],l,c):"<"==h?e(a,u,[">",">"],l,c):"("==h?e(a,u,[")",")"],l,c):e(a,u,[h,h],l,c)}if("y"==d){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat(/[(\[{<\^'"!~\/]/)))return"["==h?e(a,u,["]","]"],l,c):"{"==h?e(a,u,["}","}"],l,c):"<"==h?e(a,u,[">",">"],l,c):"("==h?e(a,u,[")",")"],l,c):e(a,u,[h,h],l,c)}if("t"==d){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat("r"),h&&(h=a.eat(/[(\[{<\^'"!~\/]/))))return"["==h?e(a,u,["]","]"],l,c):"{"==h?e(a,u,["}","}"],l,c):"<"==h?e(a,u,[">",">"],l,c):"("==h?e(a,u,[")",")"],l,c):e(a,u,[h,h],l,c)}if("`"==d)return e(a,u,[d],"variable-2");if("/"==d)return/~\s*$/.test(r(a))?e(a,u,[d],l,c):"operator";if("$"==d){var f=a.pos;if(a.eatWhile(/\d/)||a.eat("{")&&a.eatWhile(/\d/)&&a.eat("}"))return"variable-2";a.pos=f}if(/[$@%]/.test(d)){var f=a.pos;if(a.eat("^")&&a.eat(/[A-Z]/)||!/[@$%&]/.test(t(a,-2))&&a.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){var h=a.current();if(s[h])return"variable-2"}a.pos=f}if(/[$@%&]/.test(d)&&(a.eatWhile(/[\w$\[\]]/)||a.eat("{")&&a.eatWhile(/[\w$\[\]]/)&&a.eat("}"))){var h=a.current();return s[h]?"variable-2":"variable"}if("#"==d&&"$"!=t(a,-2))return a.skipToEnd(),"comment";if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(d)){var f=a.pos;if(a.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/),s[a.current()])return"operator";a.pos=f}if("_"==d&&1==a.pos){if("_END__"==n(a,6))return e(a,u,["\x00"],"comment");if("_DATA__"==n(a,7))return e(a,u,["\x00"],"variable-2");if("_C__"==n(a,7))return e(a,u,["\x00"],"string")}if(/\w/.test(d)){var f=a.pos;if("{"==t(a,-2)&&("}"==t(a,0)||a.eatWhile(/\w/)&&"}"==t(a,0)))return"string";a.pos=f}if(/[A-Z]/.test(d)){var m=t(a,-2),f=a.pos;if(a.eatWhile(/[A-Z_]/),!/[\da-z]/.test(t(a,0))){var h=s[a.current()];return h?(h[1]&&(h=h[0]),":"!=m?1==h?"keyword":2==h?"def":3==h?"atom":4==h?"operator":5==h?"variable-2":"meta":"meta"):"meta"}a.pos=f}if(/[a-zA-Z_]/.test(d)){var m=t(a,-2);a.eatWhile(/\w/);var h=s[a.current()];return h?(h[1]&&(h=h[0]),":"!=m?1==h?"keyword":2==h?"def":3==h?"atom":4==h?"operator":5==h?"variable-2":"meta":"meta"):"meta"}return null}var s={"->":4,"++":4,"--":4,"**":4,"=~":4,"!~":4,"*":4,"/":4,"%":4,x:4,"+":4,"-":4,".":4,"<<":4,">>":4,"<":4,">":4,"<=":4,">=":4,lt:4,gt:4,le:4,ge:4,"==":4,"!=":4,"<=>":4,eq:4,ne:4,cmp:4,"~~":4,"&":4,"|":4,"^":4,"&&":4,"||":4,"//":4,"..":4,"...":4,"?":4,":":4,"=":4,"+=":4,"-=":4,"*=":4,",":4,"=>":4,"::":4,not:4,and:4,or:4,xor:4,BEGIN:[5,1],END:[5,1],PRINT:[5,1],PRINTF:[5,1],GETC:[5,1],READ:[5,1],READLINE:[5,1],DESTROY:[5,1],TIE:[5,1],TIEHANDLE:[5,1],UNTIE:[5,1],STDIN:5,STDIN_TOP:5,STDOUT:5,STDOUT_TOP:5,STDERR:5,STDERR_TOP:5,$ARG:5,$_:5,"@ARG":5,"@_":5,$LIST_SEPARATOR:5,'$"':5,$PROCESS_ID:5,$PID:5,$$:5,$REAL_GROUP_ID:5,$GID:5,"$(":5,$EFFECTIVE_GROUP_ID:5,$EGID:5,"$)":5,$PROGRAM_NAME:5,$0:5,$SUBSCRIPT_SEPARATOR:5,$SUBSEP:5,"$;":5,$REAL_USER_ID:5,$UID:5,"$<":5,$EFFECTIVE_USER_ID:5,$EUID:5,"$>":5,$a:5,$b:5,$COMPILING:5,"$^C":5,$DEBUGGING:5,"$^D":5,"${^ENCODING}":5,$ENV:5,"%ENV":5,$SYSTEM_FD_MAX:5,"$^F":5,"@F":5,"${^GLOBAL_PHASE}":5,"$^H":5,"%^H":5,"@INC":5,"%INC":5,$INPLACE_EDIT:5,"$^I":5,"$^M":5,$OSNAME:5,"$^O":5,"${^OPEN}":5,$PERLDB:5,"$^P":5,$SIG:5,"%SIG":5,$BASETIME:5,"$^T":5,"${^TAINT}":5,"${^UNICODE}":5,"${^UTF8CACHE}":5,"${^UTF8LOCALE}":5,$PERL_VERSION:5,"$^V":5,"${^WIN32_SLOPPY_STAT}":5,$EXECUTABLE_NAME:5,"$^X":5,$1:5,$MATCH:5,"$&":5,"${^MATCH}":5,$PREMATCH:5,"$`":5,"${^PREMATCH}":5,$POSTMATCH:5,"$'":5,"${^POSTMATCH}":5,$LAST_PAREN_MATCH:5,"$+":5,$LAST_SUBMATCH_RESULT:5,"$^N":5,"@LAST_MATCH_END":5,"@+":5,"%LAST_PAREN_MATCH":5,"%+":5,"@LAST_MATCH_START":5,"@-":5,"%LAST_MATCH_START":5,"%-":5,$LAST_REGEXP_CODE_RESULT:5,"$^R":5,"${^RE_DEBUG_FLAGS}":5,"${^RE_TRIE_MAXBUF}":5,$ARGV:5,"@ARGV":5,ARGV:5,ARGVOUT:5,$OUTPUT_FIELD_SEPARATOR:5,$OFS:5,"$,":5,$INPUT_LINE_NUMBER:5,$NR:5,"$.":5,$INPUT_RECORD_SEPARATOR:5,$RS:5,"$/":5,$OUTPUT_RECORD_SEPARATOR:5,$ORS:5,"$\\":5,$OUTPUT_AUTOFLUSH:5,"$|":5,$ACCUMULATOR:5,"$^A":5,$FORMAT_FORMFEED:5,"$^L":5,$FORMAT_PAGE_NUMBER:5,"$%":5,$FORMAT_LINES_LEFT:5,"$-":5,$FORMAT_LINE_BREAK_CHARACTERS:5,"$:":5,$FORMAT_LINES_PER_PAGE:5,"$=":5,$FORMAT_TOP_NAME:5,"$^":5,$FORMAT_NAME:5,"$~":5,"${^CHILD_ERROR_NATIVE}":5,$EXTENDED_OS_ERROR:5,"$^E":5,$EXCEPTIONS_BEING_CAUGHT:5,"$^S":5,$WARNING:5,"$^W":5,"${^WARNING_BITS}":5,$OS_ERROR:5,$ERRNO:5,"$!":5,"%OS_ERROR":5,"%ERRNO":5,"%!":5,$CHILD_ERROR:5,"$?":5,$EVAL_ERROR:5,"$@":5,$OFMT:5,"$#":5,"$*":5,$ARRAY_BASE:5,"$[":5,$OLD_PERL_VERSION:5,"$]":5,"if":[1,1],elsif:[1,1],"else":[1,1],"while":[1,1],unless:[1,1],"for":[1,1],foreach:[1,1],abs:1,accept:1,alarm:1,atan2:1,bind:1,binmode:1,bless:1,bootstrap:1,"break":1,caller:1,chdir:1,chmod:1,chomp:1,chop:1,chown:1,chr:1,chroot:1,close:1,closedir:1,connect:1,"continue":[1,1],cos:1,crypt:1,dbmclose:1,dbmopen:1,"default":1,defined:1,"delete":1,die:1,"do":1,dump:1,each:1,endgrent:1,endhostent:1,endnetent:1,endprotoent:1,endpwent:1,endservent:1,eof:1,eval:1,exec:1,exists:1,exit:1,exp:1,fcntl:1,fileno:1,flock:1,fork:1,format:1,formline:1,getc:1,getgrent:1,getgrgid:1,getgrnam:1,gethostbyaddr:1,gethostbyname:1,gethostent:1,getlogin:1,getnetbyaddr:1,getnetbyname:1,getnetent:1,getpeername:1,getpgrp:1,getppid:1,getpriority:1,getprotobyname:1,getprotobynumber:1,getprotoent:1,getpwent:1,getpwnam:1,getpwuid:1,getservbyname:1,getservbyport:1,getservent:1,getsockname:1,getsockopt:1,given:1,glob:1,gmtime:1,"goto":1,grep:1,hex:1,"import":1,index:1,"int":1,ioctl:1,join:1,keys:1,kill:1,last:1,lc:1,lcfirst:1,length:1,link:1,listen:1,local:2,localtime:1,lock:1,log:1,lstat:1,m:null,map:1,mkdir:1,msgctl:1,msgget:1,msgrcv:1,msgsnd:1,my:2,"new":1,next:1,no:1,oct:1,open:1,opendir:1,ord:1,our:2,pack:1,"package":1,pipe:1,pop:1,pos:1,print:1,printf:1,prototype:1,push:1,q:null,qq:null,qr:null,quotemeta:null,qw:null,qx:null,rand:1,read:1,readdir:1,readline:1,readlink:1,readpipe:1,recv:1,redo:1,ref:1,rename:1,require:1,reset:1,"return":1,reverse:1,rewinddir:1,rindex:1,rmdir:1,s:null,say:1,scalar:1,seek:1,seekdir:1,select:1,semctl:1,semget:1,semop:1,send:1,setgrent:1,sethostent:1,setnetent:1,setpgrp:1,setpriority:1,setprotoent:1,setpwent:1,setservent:1,setsockopt:1,shift:1,shmctl:1,shmget:1,shmread:1,shmwrite:1,shutdown:1,sin:1,sleep:1,socket:1,socketpair:1,sort:1,splice:1,split:1,sprintf:1,sqrt:1,srand:1,stat:1,state:1,study:1,sub:1,substr:1,symlink:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,tell:1,telldir:1,tie:1,tied:1,time:1,times:1,tr:null,truncate:1,uc:1,ucfirst:1,umask:1,undef:1,unlink:1,unpack:1,unshift:1,untie:1,use:1,utime:1,values:1,vec:1,wait:1,waitpid:1,wantarray:1,warn:1,when:1,write:1,y:null},l="string-2",c=/[goseximacplud]/;return{startState:function(){return{tokenize:a,chain:null,style:null,tail:null}},token:function(e,t){return(t.tokenize||a)(e,t)},lineComment:"#"}}),e.registerHelper("wordChars","perl",/[\w$]/),e.defineMIME("text/x-perl","perl")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("sass",function(e){function t(e){return new RegExp("^"+e.join("|"))}function r(e,t){var r=e.peek();return")"===r?(e.next(),t.tokenizer=l,"operator"):"("===r?(e.next(),e.eatSpace(),"operator"):"'"===r||'"'===r?(t.tokenizer=i(e.next()),"string"):(t.tokenizer=i(")",!1),"string")}function n(e,t){return function(r,n){return r.sol()&&r.indentation()<=e?(n.tokenizer=l,l(r,n)):(t&&r.skipTo("*/")?(r.next(),r.next(),n.tokenizer=l):r.skipToEnd(),"comment")}}function i(e,t){function r(n,i){var a=n.next(),s=n.peek(),c=n.string.charAt(n.pos-2),u="\\"!==a&&s===e||a===e&&"\\"!==c;return u?(a!==e&&t&&n.next(),i.tokenizer=l,"string"):"#"===a&&"{"===s?(i.tokenizer=o(r),n.next(),"operator"):"string"}return null==t&&(t=!0),r}function o(e){return function(t,r){return"}"===t.peek()?(t.next(),r.tokenizer=e,"operator"):l(t,r)}}function a(t){if(0==t.indentCount){t.indentCount++;var r=t.scopes[0].offset,n=r+e.indentUnit;t.scopes.unshift({offset:n})}}function s(e){1!=e.scopes.length&&e.scopes.shift()}function l(e,t){var c=e.peek();if(e.match("/*"))return t.tokenizer=n(e.indentation(),!0),t.tokenizer(e,t);if(e.match("//"))return t.tokenizer=n(e.indentation(),!1),t.tokenizer(e,t);if(e.match("#{"))return t.tokenizer=o(l),"operator";if('"'===c||"'"===c)return e.next(),t.tokenizer=i(c),"string";if(t.cursorHalf){if("#"===c&&(e.next(),e.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)))return e.peek()||(t.cursorHalf=0),"number";if(e.match(/^-?[0-9\.]+/))return e.peek()||(t.cursorHalf=0),"number";if(e.match(/^(px|em|in)\b/))return e.peek()||(t.cursorHalf=0),"unit";if(e.match(d))return e.peek()||(t.cursorHalf=0),"keyword";if(e.match(/^url/)&&"("===e.peek())return t.tokenizer=r,e.peek()||(t.cursorHalf=0),"atom";if("$"===c)return e.next(),e.eatWhile(/[\w-]/),e.peek()||(t.cursorHalf=0),"variable-3";if("!"===c)return e.next(),e.peek()||(t.cursorHalf=0),e.match(/^[\w]+/)?"keyword":"operator";if(e.match(p))return e.peek()||(t.cursorHalf=0),"operator";if(e.eatWhile(/[\w-]/))return e.peek()||(t.cursorHalf=0),"attribute";if(!e.peek())return t.cursorHalf=0,null}else{if("."===c){if(e.next(),e.match(/^[\w-]+/))return a(t),"atom";if("#"===e.peek())return a(t),"atom"}if("#"===c){if(e.next(),e.match(/^[\w-]+/))return a(t),"atom";if("#"===e.peek())return a(t),"atom"}if("$"===c)return e.next(),e.eatWhile(/[\w-]/),"variable-2";if(e.match(/^-?[0-9\.]+/))return"number";if(e.match(/^(px|em|in)\b/))return"unit";if(e.match(d))return"keyword";if(e.match(/^url/)&&"("===e.peek())return t.tokenizer=r,"atom";if("="===c&&e.match(/^=[\w-]+/))return a(t),"meta";if("+"===c&&e.match(/^\+[\w-]+/))return"variable-3";if("@"===c&&e.match(/@extend/)&&(e.match(/\s*[\w]/)||s(t)),e.match(/^@(else if|if|media|else|for|each|while|mixin|function)/))return a(t),"meta";if("@"===c)return e.next(),e.eatWhile(/[\w-]/),"meta";if(e.eatWhile(/[\w-]/))return e.match(/ *: *[\w-\+\$#!\("']/,!1)?"property":e.match(/ *:/,!1)?(a(t),t.cursorHalf=1,"atom"):e.match(/ *,/,!1)?"atom":(a(t),"atom");if(":"===c)return e.match(h)?"keyword":(e.next(),t.cursorHalf=1,"operator")}return e.match(p)?"operator":(e.next(),null)}function c(t,r){t.sol()&&(r.indentCount=0);var n=r.tokenizer(t,r),i=t.current();if(("@return"===i||"}"===i)&&s(r),null!==n){for(var o=t.pos-i.length,a=o+e.indentUnit*r.indentCount,l=[],c=0;c","<","==",">=","<=","\\+","-","\\!=","/","\\*","%","and","or","not",";","\\{","\\}",":"],p=t(f),h=/^::?[a-zA-Z_][\w\-]*/;return{startState:function(){return{tokenizer:l,scopes:[{offset:0,type:"sass"}],indentCount:0,cursorHalf:0,definedVars:[],definedMixins:[]}},token:function(e,t){var r=c(e,t);return t.lastToken={style:r,content:e.current()},r},indent:function(e){return e.scopes[0].offset}}}),e.defineMIME("text/x-sass","sass")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.registerHelper("wordChars","r",/[\w.]/),e.defineMode("r",function(e){function t(e){for(var t=e.split(" "),r={},n=0;n=!&|~$:]/;return{startState:function(){return{tokenize:r,ctx:{type:"top",indent:-e.indentUnit,align:!1},indent:0,afterIdent:!1}},token:function(e,t){if(e.sol()&&(null==t.ctx.align&&(t.ctx.align=!1),t.indent=e.indentation()),e.eatSpace())return null;var r=t.tokenize(e,t);"comment"!=r&&null==t.ctx.align&&(t.ctx.align=!0);var n=t.ctx.type;return";"!=a&&"{"!=a&&"}"!=a||"block"!=n||o(t),"{"==a?i(t,"}",e):"("==a?(i(t,")",e),t.afterIdent&&(t.ctx.argList=!0)):"["==a?i(t,"]",e):"block"==a?i(t,"block",e):a==n&&o(t),t.afterIdent="variable"==r||"keyword"==r,r},indent:function(t,n){if(t.tokenize!=r)return 0;var i=n&&n.charAt(0),o=t.ctx,a=i==o.type;return"block"==o.type?o.indent+("{"==i?0:e.indentUnit):o.align?o.column+(a?0:1):o.indent+(a?0:e.indentUnit)},lineComment:"#"}}),e.defineMIME("text/x-rsrc","r")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../../addon/mode/simple")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../addon/mode/simple"],e):e(CodeMirror)}(function(e){"use strict";var t=["from","maintainer","run","cmd","expose","env","add","copy","entrypoint","volume","user","workdir","onbuild"],r="("+t.join("|")+")",n=new RegExp(r+"\\s*$","i"),i=new RegExp(r+"(\\s+)","i");e.defineSimpleMode("dockerfile",{start:[{regex:/#.*$/,token:"comment"},{regex:n,token:"variable-2"},{regex:i,token:["variable-2",null],next:"arguments"},{regex:/./,token:null}],arguments:[{regex:/#.*$/,token:"error",next:"start"},{regex:/[^#]+\\$/,token:null},{regex:/[^#]+/,token:null,next:"start"},{regex:/$/,token:null,next:"start"},{token:null,next:"start"}],meta:{lineComment:"#"}}),e.defineMIME("text/x-dockerfile","dockerfile")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror")):"function"==typeof define&&define.amd?define(["../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return e.line==t.line&&e.ch==t.ch}function r(e){N.push(e),N.length>50&&N.shift()}function n(e){return N.length?void(N[N.length-1]+=e):r(e)}function i(e){return N[N.length-(e?Math.min(e,1):1)]||""}function o(){return N.length>1&&N.pop(),i()}function a(e,i,o,a,s){null==s&&(s=e.getRange(i,o)),a&&q&&q.cm==e&&t(i,q.pos)&&e.isClean(q.gen)?n(s):r(s),e.replaceRange("",i,o,"+delete"),q=a?{cm:e,pos:i,gen:e.changeGeneration()}:null}function s(e,t,r){return e.findPosH(t,r,"char",!0)}function l(e,t,r){return e.findPosH(t,r,"word",!0)}function c(e,t,r){return e.findPosV(t,r,"line",e.doc.sel.goalColumn)}function u(e,t,r){return e.findPosV(t,r,"page",e.doc.sel.goalColumn)}function d(e,t,r){for(var n=t.line,i=e.getLine(n),o=/\S/.test(0>r?i.slice(0,t.ch):i.slice(t.ch)),a=e.firstLine(),s=e.lastLine();;){if(n+=r,a>n||n>s)return e.clipPos(I(n-r,0>r?0:null));i=e.getLine(n);var l=/\S/.test(i);if(l)o=!0;else if(o)return I(n,0)}}function f(e,t,r){for(var n=t.line,i=t.ch,o=e.getLine(t.line),a=!1;;){var s=o.charAt(i+(0>r?-1:0));if(s){if(a&&/[!?.]/.test(s))return I(n,i+(r>0?1:0));a||(a=/\w/.test(s)),i+=r}else{if(n==(0>r?e.firstLine():e.lastLine()))return I(n,i);if(o=e.getLine(n+r),!/\S/.test(o))return I(n,i);n+=r,i=0>r?o.length:0}}}function p(e,r,n){var i;if(e.findMatchingBracket&&(i=e.findMatchingBracket(r,!0))&&i.match&&(i.forward?1:-1)==n)return n>0?I(i.to.line,i.to.ch+1):i.to;for(var o=!0;;o=!1){var a=e.getTokenAt(r),s=I(r.line,0>n?a.start:a.end);if(!(o&&n>0&&a.end==r.ch)&&/\w/.test(a.string))return s;var l=e.findPosH(s,n,"char");if(t(s,l))return r;r=l}}function h(e,t){var r=e.state.emacsPrefix;return r?(w(e),"-"==r?-1:Number(r)):t?null:1}function m(e){var t="string"==typeof e?function(t){t.execCommand(e)}:e;return function(e){var r=h(e);t(e);for(var n=1;r>n;++n)t(e)}}function g(e,r,n,i){var o=h(e);0>o&&(i=-i,o=-o);for(var a=0;o>a;++a){var s=n(e,r,i);if(t(s,r))break;r=s}return r}function v(e,t){var r=function(r){r.extendSelection(g(r,r.getCursor(),e,t))};return r.motion=!0,r}function y(e,t,r){for(var n,i=e.listSelections(),o=i.length;o--;)n=i[o].head,a(e,n,g(e,n,t,r),!0)}function b(e){if(e.somethingSelected()){for(var t,r=e.listSelections(),n=r.length;n--;)t=r[n],a(e,t.anchor,t.head);return!0}}function k(e,t){return e.state.emacsPrefix?void("-"!=t&&(e.state.emacsPrefix+=t)):(e.state.emacsPrefix=t,e.on("keyHandled",x),void e.on("inputRead",_))}function x(e,t){e.state.emacsPrefixMap||P.hasOwnProperty(t)||w(e)}function w(e){e.state.emacsPrefix=null,e.off("keyHandled",x),e.off("inputRead",_)}function _(e,t){var r=h(e);if(r>1&&"+input"==t.origin){for(var n=t.text.join("\n"),i="",o=1;r>o;++o)i+=n;e.replaceSelection(i)}}function C(e){e.state.emacsPrefixMap=!0,e.addKeyMap(j),e.on("keyHandled",S),e.on("inputRead",S)}function S(e,t){("string"!=typeof t||!/^\d$/.test(t)&&"Ctrl-U"!=t)&&(e.removeKeyMap(j),e.state.emacsPrefixMap=!1,e.off("keyHandled",S),e.off("inputRead",S))}function M(e){e.setCursor(e.getCursor()),e.setExtending(!e.getExtending()),e.on("change",function(){e.setExtending(!1)})}function L(e){e.setExtending(!1),e.setCursor(e.getCursor())}function T(e,t,r){e.openDialog?e.openDialog(t+': ',r,{bottom:!0}):r(prompt(t,""))}function A(e,t){var r=e.getCursor(),n=e.findPosH(r,1,"word");e.replaceRange(t(e.getRange(r,n)),r,n),e.setCursor(n)}function E(e){for(var t=e.getCursor(),r=t.line,n=t.ch,i=[];r>=e.firstLine();){for(var o=e.getLine(r),a=null==n?o.length:n;a>0;){var n=o.charAt(--a);if(")"==n)i.push("(");else if("]"==n)i.push("[");else if("}"==n)i.push("{");else if(/[\(\{\[]/.test(n)&&(!i.length||i.pop()!=n))return e.extendSelection(I(r,a))}--r,n=null}}function O(e){e.execCommand("clearSearch"),L(e)}function z(e){j[e]=function(t){k(t,e)},R["Ctrl-"+e]=function(t){k(t,e)},P["Ctrl-"+e]=!0}for(var I=e.Pos,N=[],q=null,P={"Alt-G":!0,"Ctrl-X":!0,"Ctrl-Q":!0,"Ctrl-U":!0},R=e.keyMap.emacs=e.normalizeKeyMap({"Ctrl-W":function(e){a(e,e.getCursor("start"),e.getCursor("end"))},"Ctrl-K":m(function(e){var t=e.getCursor(),r=e.clipPos(I(t.line)),n=e.getRange(t,r);/\S/.test(n)||(n+="\n",r=I(t.line+1,0)),a(e,t,r,!0,n)}),"Alt-W":function(e){r(e.getSelection()),L(e)},"Ctrl-Y":function(e){var t=e.getCursor();e.replaceRange(i(h(e)),t,t,"paste"),e.setSelection(t,e.getCursor())},"Alt-Y":function(e){e.replaceSelection(o(),"around","paste")},"Ctrl-Space":M,"Ctrl-Shift-2":M,"Ctrl-F":v(s,1),"Ctrl-B":v(s,-1),Right:v(s,1),Left:v(s,-1),"Ctrl-D":function(e){y(e,s,1)},Delete:function(e){b(e)||y(e,s,1)},"Ctrl-H":function(e){y(e,s,-1)},Backspace:function(e){b(e)||y(e,s,-1)},"Alt-F":v(l,1),"Alt-B":v(l,-1),"Alt-D":function(e){y(e,l,1)},"Alt-Backspace":function(e){y(e,l,-1)},"Ctrl-N":v(c,1),"Ctrl-P":v(c,-1),Down:v(c,1),Up:v(c,-1),"Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd",End:"goLineEnd",Home:"goLineStart","Alt-V":v(u,-1),"Ctrl-V":v(u,1),PageUp:v(u,-1),PageDown:v(u,1),"Ctrl-Up":v(d,-1),"Ctrl-Down":v(d,1),"Alt-A":v(f,-1),"Alt-E":v(f,1),"Alt-K":function(e){y(e,f,1)},"Ctrl-Alt-K":function(e){y(e,p,1)},"Ctrl-Alt-Backspace":function(e){y(e,p,-1)},"Ctrl-Alt-F":v(p,1),"Ctrl-Alt-B":v(p,-1),"Shift-Ctrl-Alt-2":function(e){var t=e.getCursor();e.setSelection(g(e,t,p,1),t)},"Ctrl-Alt-T":function(e){var t=p(e,e.getCursor(),-1),r=p(e,t,1),n=p(e,r,1),i=p(e,n,-1);e.replaceRange(e.getRange(i,n)+e.getRange(r,i)+e.getRange(t,r),t,n)},"Ctrl-Alt-U":m(E),"Alt-Space":function(e){for(var t=e.getCursor(),r=t.ch,n=t.ch,i=e.getLine(t.line);r&&/\s/.test(i.charAt(r-1));)--r;for(;n0?e.setCursor(t-1):void T(e,"Goto line",function(t){var r;t&&!isNaN(r=Number(t))&&r==(0|r)&&r>0&&e.setCursor(r-1)})},"Ctrl-X Tab":function(e){e.indentSelection(h(e,!0)||e.getOption("indentUnit"))},"Ctrl-X Ctrl-X":function(e){e.setSelection(e.getCursor("head"),e.getCursor("anchor"))},"Ctrl-X Ctrl-S":"save","Ctrl-X Ctrl-W":"save","Ctrl-X S":"saveAll","Ctrl-X F":"open","Ctrl-X U":m("undo"),"Ctrl-X K":"close","Ctrl-X Delete":function(e){a(e,e.getCursor(),f(e,e.getCursor(),1),!0)},"Ctrl-X H":"selectAll","Ctrl-Q Tab":m("insertTab"),"Ctrl-U":C}),j={"Ctrl-G":w},D=0;10>D;++D)z(String(D));z("-")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/edit/matchbrackets")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(e){"use strict";function t(t,r,n){if(0>n&&0==r.ch)return t.clipPos(f(r.line-1));var i=t.getLine(r.line);if(n>0&&r.ch>=i.length)return t.clipPos(f(r.line+1,0));for(var o,a="start",s=r.ch,l=0>n?0:i.length,c=0;s!=l;s+=n,c++){var u=i.charAt(0>n?s-1:s),d="_"!=u&&e.isWordChar(u)?"w":"o";if("w"==d&&u.toUpperCase()==u&&(d="W"),"start"==a)"o"!=d&&(a="in",o=d);else if("in"==a&&o!=d){if("w"==o&&"W"==d&&0>n&&s--,"W"==o&&"w"==d&&n>0){o="w";continue}break}}return f(r.line,s)}function r(e,r){e.extendSelectionsBy(function(n){return e.display.shift||e.doc.extend||n.empty()?t(e.doc,n.head,r):0>r?n.from():n.to()})}function n(t,r){return t.isReadOnly()?e.Pass:void t.operation(function(){for(var e=t.listSelections().length,n=[],i=-1,o=0;e>o;o++){var a=t.listSelections()[o].head;if(!(a.line<=i)){var s=f(a.line+(r?0:1),0);t.replaceRange("\n",s,null,"+insertLine"),t.indentLine(s.line,null,!0),n.push({head:s,anchor:s}),i=a.line+1}}t.setSelections(n)})}function i(t,r){for(var n=r.ch,i=n,o=t.getLine(r.line);n&&e.isWordChar(o.charAt(n-1));)--n;for(;ie?-1:e==t?0:1}),t.replaceRange(u,l,c),n&&e.push({anchor:l,head:c})}n&&t.setSelections(e,0)})}function s(t,r){t.operation(function(){for(var n=t.listSelections(),o=[],a=[],s=0;s=0;s--){var l=n[o[s]];if(!(c&&e.cmpPos(l.head,c)>0)){var u=i(t,l.head);c=u.from,t.replaceRange(r(u.word),u.from,u.to)}}})}function l(t){var r=t.getCursor("from"),n=t.getCursor("to");if(0==e.cmpPos(r,n)){var o=i(t,r);if(!o.word)return;r=o.from,n=o.to}return{from:r,to:n,query:t.getRange(r,n),word:o}}function c(e,t){var r=l(e);if(r){var n=r.query,i=e.getSearchCursor(n,t?r.to:r.from);(t?i.findNext():i.findPrevious())?e.setSelection(i.from(),i.to()):(i=e.getSearchCursor(n,t?f(e.firstLine(),0):e.clipPos(f(e.lastLine()))),(t?i.findNext():i.findPrevious())?e.setSelection(i.from(),i.to()):r.word&&e.setSelection(r.from,r.to))}}var u=e.keyMap.sublime={fallthrough:"default"},d=e.commands,f=e.Pos,p=e.keyMap["default"]==e.keyMap.macDefault,h=p?"Cmd-":"Ctrl-";d[u["Alt-Left"]="goSubwordLeft"]=function(e){r(e,-1)},d[u["Alt-Right"]="goSubwordRight"]=function(e){r(e,1)},p&&(u["Cmd-Left"]="goLineStartSmart");var m=p?"Ctrl-Alt-":"Ctrl-";d[u[m+"Up"]="scrollLineUp"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var r=e.lineAtHeight(t.top+t.clientHeight,"local");e.getCursor().line>=r&&e.execCommand("goLineUp")}e.scrollTo(null,t.top-e.defaultTextHeight())},d[u[m+"Down"]="scrollLineDown"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var r=e.lineAtHeight(t.top,"local")+1;e.getCursor().line<=r&&e.execCommand("goLineDown")}e.scrollTo(null,t.top+e.defaultTextHeight())},d[u["Shift-"+h+"L"]="splitSelectionByLine"]=function(e){for(var t=e.listSelections(),r=[],n=0;ni.line&&a==o.line&&0==o.ch||r.push({anchor:a==i.line?i:f(a,0),head:a==o.line?o:f(a)});e.setSelections(r,0)},u["Shift-Tab"]="indentLess",d[u.Esc="singleSelectionTop"]=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},d[u[h+"L"]="selectLine"]=function(e){for(var t=e.listSelections(),r=[],n=0;ni?n.push(l,c):n.length&&(n[n.length-1]=c),i=c}t.operation(function(){for(var e=0;et.lastLine()?t.replaceRange("\n"+a,f(t.lastLine()),null,"+swapLine"):t.replaceRange(a+"\n",f(i,0),null,"+swapLine")}t.setSelections(o),t.scrollIntoView()})},d[u[v+"Down"]="swapLineDown"]=function(t){if(t.isReadOnly())return e.Pass;for(var r=t.listSelections(),n=[],i=t.lastLine()+1,o=r.length-1;o>=0;o--){var a=r[o],s=a.to().line+1,l=a.from().line; -var o=function(e,t){t.tokens.length>1&&e.eat("$");var i=e.next(),o=/\w/;return"{"===i&&(o=/[^}]/),"("===i?(t.tokens[0]=r(")"),n(e,t)):(/\d/.test(i)||(e.eatWhile(o),e.eat("}")),t.tokens.shift(),"def")};return{startState:function(){return{tokens:[]}},token:function(e,t){return n(e,t)},lineComment:"#",fold:"brace"}}),e.defineMIME("text/x-sh","shell")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../clike/clike")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],e):e(CodeMirror)}(function(e){"use strict";function t(e){for(var t={},r=e.split(" "),n=0;n\w/,!1)&&(t.tokenize=r([[["->",null]],[[/[\w]+/,"variable"]]],n,i)),"variable-2";for(var o=!1;!e.eol()&&(o||i===!1||!e.match("{$",!1)&&!e.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!o&&e.match(n)){t.tokenize=null,t.tokStack.pop(),t.tokStack.pop();break}o="\\"==e.next()&&!o}return"string"}var o="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally",a="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",s="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";e.registerHelper("hintWords","php",[o,a,s].join(" ").split(" ")),e.registerHelper("wordChars","php",/[\w$]/);var l={name:"clike",helperType:"php",keywords:t(o),blockKeywords:t("catch do else elseif for foreach if switch try while finally"),defKeywords:t("class function interface namespace trait"),atoms:t(a),builtin:t(s),multiLineStrings:!0,hooks:{$:function(e){return e.eatWhile(/[\w\$_]/),"variable-2"},"<":function(e,t){var r;if(r=e.match(/<<\s*/)){var i=e.eat(/['"]/);e.eatWhile(/[\w\.]/);var o=e.current().slice(r[0].length+(i?2:1));if(i&&e.eat(i),o)return(t.tokStack||(t.tokStack=[])).push(o,0),t.tokenize=n(o,"'"!=i),"string"}return!1},"#":function(e){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"},"/":function(e){if(e.eat("/")){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"}return!1},'"':function(e,t){return(t.tokStack||(t.tokStack=[])).push('"',0),t.tokenize=n('"'),"string"},"{":function(e,t){return t.tokStack&&t.tokStack.length&&t.tokStack[t.tokStack.length-1]++,!1},"}":function(e,t){return t.tokStack&&t.tokStack.length>0&&!--t.tokStack[t.tokStack.length-1]&&(t.tokenize=n(t.tokStack[t.tokStack.length-2])),!1}}};e.defineMode("php",function(t,r){function n(t,r){var n=r.curMode==o;if(t.sol()&&r.pending&&'"'!=r.pending&&"'"!=r.pending&&(r.pending=null),n)return n&&null==r.php.tokenize&&t.match("?>")?(r.curMode=i,r.curState=r.html,r.php.context.prev||(r.php=null),"meta"):o.token(t,r.curState);if(t.match(/^<\?\w*/))return r.curMode=o,r.php||(r.php=e.startState(o,i.indent(r.html,""))),r.curState=r.php,"meta";if('"'==r.pending||"'"==r.pending){for(;!t.eol()&&t.next()!=r.pending;);var a="string"}else if(r.pending&&t.pos/.test(l)?s[0]:{end:t.pos,style:a},t.backUp(l.length-c)),a}var i=e.getMode(t,"text/html"),o=e.getMode(t,l);return{startState:function(){var t=e.startState(i),n=r.startOpen?e.startState(o):null;return{html:t,php:n,curMode:r.startOpen?o:i,curState:r.startOpen?n:t,pending:null}},copyState:function(t){var r,n=t.html,a=e.copyState(i,n),s=t.php,l=s&&e.copyState(o,s);return r=t.curMode==i?a:l,{html:a,php:l,curMode:t.curMode,curState:r,pending:t.pending}},token:n,indent:function(e,t){return e.curMode!=o&&/^\s*<\//.test(t)||e.curMode==o&&/^\?>/.test(t)?i.indent(e.html,t):e.curMode.indent(e.curState,t)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(e){return{state:e.curState,mode:e.curMode}}}},"htmlmixed","clike"),e.defineMIME("application/x-httpd-php","php"),e.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),e.defineMIME("text/x-php",l)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("sql",function(t,r){function n(e,t){var r=e.next();if(h[r]){var n=h[r](e,t);if(n!==!1)return n}if(1==p.hexNumber&&("0"==r&&e.match(/^[xX][0-9a-fA-F]+/)||("x"==r||"X"==r)&&e.match(/^'[0-9a-fA-F]+'/)))return"number";if(1==p.binaryNumber&&(("b"==r||"B"==r)&&e.match(/^'[01]+'/)||"0"==r&&e.match(/^b[01]+/)))return"number";if(r.charCodeAt(0)>47&&r.charCodeAt(0)<58)return e.match(/^[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?/),1==p.decimallessFloat&&e.eat("."),"number";if("?"==r&&(e.eatSpace()||e.eol()||e.eat(";")))return"variable-3";if("'"==r||'"'==r&&p.doubleQuote)return t.tokenize=i(r),t.tokenize(e,t);if((1==p.nCharCast&&("n"==r||"N"==r)||1==p.charsetCast&&"_"==r&&e.match(/[a-z][a-z0-9]*/i))&&("'"==e.peek()||'"'==e.peek()))return"keyword";if(/^[\(\),\;\[\]]/.test(r))return null;if(p.commentSlashSlash&&"/"==r&&e.eat("/"))return e.skipToEnd(),"comment";if(p.commentHash&&"#"==r||"-"==r&&e.eat("-")&&(!p.commentSpaceRequired||e.eat(" ")))return e.skipToEnd(),"comment";if("/"==r&&e.eat("*"))return t.tokenize=o,t.tokenize(e,t);if("."!=r){if(d.test(r))return e.eatWhile(d),null;if("{"==r&&(e.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/)||e.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/)))return"number";e.eatWhile(/^[_\w\d]/);var a=e.current().toLowerCase();return m.hasOwnProperty(a)&&(e.match(/^( )+'[^']*'/)||e.match(/^( )+"[^"]*"/))?"number":c.hasOwnProperty(a)?"atom":u.hasOwnProperty(a)?"builtin":f.hasOwnProperty(a)?"keyword":l.hasOwnProperty(a)?"string-2":null}return 1==p.zerolessFloat&&e.match(/^(?:\d+(?:e[+-]?\d+)?)/i)?"number":1==p.ODBCdotTable&&e.match(/^[a-zA-Z_]+/)?"variable-2":void 0}function i(e){return function(t,r){for(var i,o=!1;null!=(i=t.next());){if(i==e&&!o){r.tokenize=n;break}o=!o&&"\\"==i}return"string"}}function o(e,t){for(;;){if(!e.skipTo("*")){e.skipToEnd();break}if(e.next(),e.eat("/")){t.tokenize=n;break}}return"comment"}function a(e,t,r){t.context={prev:t.context,indent:e.indentation(),col:e.column(),type:r}}function s(e){e.indent=e.context.indent,e.context=e.context.prev}var l=r.client||{},c=r.atoms||{"false":!0,"true":!0,"null":!0},u=r.builtin||{},f=r.keywords||{},d=r.operatorChars||/^[*+\-%<>!=&|~^]/,p=r.support||{},h=r.hooks||{},m=r.dateSQL||{date:!0,time:!0,timestamp:!0};return{startState:function(){return{tokenize:n,context:null}},token:function(e,t){if(e.sol()&&t.context&&null==t.context.align&&(t.context.align=!1),e.eatSpace())return null;var r=t.tokenize(e,t);if("comment"==r)return r;t.context&&null==t.context.align&&(t.context.align=!0);var n=e.current();return"("==n?a(e,t,")"):"["==n?a(e,t,"]"):t.context&&t.context.type==n&&s(t),r},indent:function(r,n){var i=r.context;if(!i)return e.Pass;var o=n.charAt(0)==i.type;return i.align?i.col+(o?0:1):i.indent+(o?0:t.indentUnit)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:p.commentSlashSlash?"//":p.commentHash?"#":null}}),function(){function t(e){for(var t;null!=(t=e.next());)if("`"==t&&!e.eat("`"))return"variable-2";return e.backUp(e.current().length-1),e.eatWhile(/\w/)?"variable-2":null}function r(e){return e.eat("@")&&(e.match(/^session\./),e.match(/^local\./),e.match(/^global\./)),e.eat("'")?(e.match(/^.*'/),"variable-2"):e.eat('"')?(e.match(/^.*"/),"variable-2"):e.eat("`")?(e.match(/^.*`/),"variable-2"):e.match(/^[0-9a-zA-Z$\.\_]+/)?"variable-2":null}function n(e){return e.eat("N")?"atom":e.match(/^[a-zA-Z.#!?]/)?"variable-2":null}function i(e){for(var t={},r=e.split(" "),n=0;n!=]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable doubleQuote binaryNumber hexNumber")}),e.defineMIME("text/x-mssql",{name:"sql",client:i("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:i(o+"begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare"),builtin:i("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:i("date datetimeoffset datetime2 smalldatetime datetime time"),hooks:{"@":r}}),e.defineMIME("text/x-mysql",{name:"sql",client:i("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:i(o+"accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group group_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:i("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":r,"`":t,"\\":n}}),e.defineMIME("text/x-mariadb",{name:"sql",client:i("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),keywords:i(o+"accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group groupby_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),builtin:i("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=&|^]/,dateSQL:i("date time timestamp"),support:i("ODBCdotTable decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),hooks:{"@":r,"`":t,"\\":n}}),e.defineMIME("text/x-cassandra",{name:"sql",client:{},keywords:i("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"),builtin:i("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"),atoms:i("false true infinity NaN"),operatorChars:/^[<>=]/,dateSQL:{},support:i("commentSlashSlash decimallessFloat"),hooks:{}}),e.defineMIME("text/x-plsql",{name:"sql",client:i("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),keywords:i("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),builtin:i("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least lenght lenghtb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),operatorChars:/^[*+\-%<>!=~]/,dateSQL:i("date time timestamp"),support:i("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")}),e.defineMIME("text/x-hive",{name:"sql",keywords:i("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external false fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger true unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with"), -builtin:i("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype"),atoms:i("false true null unknown"),operatorChars:/^[*+\-%<>!=]/,dateSQL:i("date timestamp"),support:i("ODBCdotTable doubleQuote binaryNumber hexNumber")})}()}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("coffeescript",function(e,t){function r(e){return new RegExp("^(("+e.join(")|(")+"))\\b")}function n(e,t){if(e.sol()){null===t.scope.align&&(t.scope.align=!1);var r=t.scope.offset;if(e.eatSpace()){var n=e.indentation();return n>r&&"coffee"==t.scope.type?"indent":r>n?"dedent":null}r>0&&s(e,t)}if(e.eatSpace())return null;var a=e.peek();if(e.match("####"))return e.skipToEnd(),"comment";if(e.match("###"))return t.tokenize=o,t.tokenize(e,t);if("#"===a)return e.skipToEnd(),"comment";if(e.match(/^-?[0-9\.]/,!1)){var l=!1;if(e.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)&&(l=!0),e.match(/^-?\d+\.\d*/)&&(l=!0),e.match(/^-?\.\d+/)&&(l=!0),l)return"."==e.peek()&&e.backUp(1),"number";var m=!1;if(e.match(/^-?0x[0-9a-f]+/i)&&(m=!0),e.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)&&(m=!0),e.match(/^-?0(?![\dx])/i)&&(m=!0),m)return"number"}if(e.match(y))return t.tokenize=i(e.current(),!1,"string"),t.tokenize(e,t);if(e.match(b)){if("/"!=e.current()||e.match(/^.*\//,!1))return t.tokenize=i(e.current(),!0,"string-2"),t.tokenize(e,t);e.backUp(1)}return e.match(u)||e.match(h)?"operator":e.match(f)?"punctuation":e.match(x)?"atom":e.match(p)||t.prop&&e.match(d)?"property":e.match(v)?"keyword":e.match(d)?"variable":(e.next(),c)}function i(e,r,i){return function(o,a){for(;!o.eol();)if(o.eatWhile(/[^'"\/\\]/),o.eat("\\")){if(o.next(),r&&o.eol())return i}else{if(o.match(e))return a.tokenize=n,i;o.eat(/['"\/]/)}return r&&(t.singleLineStringErrors?i=c:a.tokenize=n),i}}function o(e,t){for(;!e.eol();){if(e.eatWhile(/[^#]/),e.match("###")){t.tokenize=n;break}e.eatWhile("#")}return"comment"}function a(t,r,n){n=n||"coffee";for(var i=0,o=!1,a=null,s=r.scope;s;s=s.prev)if("coffee"===s.type||"}"==s.type){i=s.offset+e.indentUnit;break}"coffee"!==n?(o=null,a=t.column()+t.current().length):r.scope.align&&(r.scope.align=!1),r.scope={offset:i,type:n,prev:r.scope,align:o,alignOffset:a}}function s(e,t){if(t.scope.prev){if("coffee"===t.scope.type){for(var r=e.indentation(),n=!1,i=t.scope;i;i=i.prev)if(r===i.offset){n=!0;break}if(!n)return!0;for(;t.scope.prev&&t.scope.offset!==r;)t.scope=t.scope.prev;return!1}return t.scope=t.scope.prev,!1}}function l(e,t){var r=t.tokenize(e,t),n=e.current();"return"===n&&(t.dedent=!0),(("->"===n||"=>"===n)&&e.eol()||"indent"===r)&&a(e,t);var i="[({".indexOf(n);if(-1!==i&&a(e,t,"])}".slice(i,i+1)),m.exec(n)&&a(e,t),"then"==n&&s(e,t),"dedent"===r&&s(e,t))return c;if(i="])}".indexOf(n),-1!==i){for(;"coffee"==t.scope.type&&t.scope.prev;)t.scope=t.scope.prev;t.scope.type==n&&(t.scope=t.scope.prev)}return t.dedent&&e.eol()&&("coffee"==t.scope.type&&t.scope.prev&&(t.scope=t.scope.prev),t.dedent=!1),r}var c="error",u=/^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/,f=/^(?:[()\[\]{},:`=;]|\.\.?\.?)/,d=/^[_A-Za-z$][_A-Za-z$0-9]*/,p=/^@[_A-Za-z$][_A-Za-z$0-9]*/,h=r(["and","or","not","is","isnt","in","instanceof","typeof"]),m=["for","while","loop","if","unless","else","switch","try","catch","finally","class"],g=["break","by","continue","debugger","delete","do","in","of","new","return","then","this","@","throw","when","until","extends"],v=r(m.concat(g));m=r(m);var y=/^('{3}|\"{3}|['\"])/,b=/^(\/{3}|\/)/,k=["Infinity","NaN","undefined","null","true","false","on","off","yes","no"],x=r(k),w={startState:function(e){return{tokenize:n,scope:{offset:e||0,type:"coffee",prev:null,align:!1},prop:!1,dedent:0}},token:function(e,t){var r=null===t.scope.align&&t.scope;r&&e.sol()&&(r.align=!1);var n=l(e,t);return n&&"comment"!=n&&(r&&(r.align=!0),t.prop="punctuation"==n&&"."==e.current()),n},indent:function(e,t){if(e.tokenize!=n)return 0;var r=e.scope,i=t&&"])}".indexOf(t.charAt(0))>-1;if(i)for(;"coffee"==r.type&&r.prev;)r=r.prev;var o=i&&r.type===t.charAt(0);return r.align?r.alignOffset-(o?1:0):(o?r.prev:r).offset},lineComment:"#",fold:"indent"};return w}),e.defineMIME("text/x-coffeescript","coffeescript"),e.defineMIME("text/coffeescript","coffeescript")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("yaml",function(){var e=["true","false","on","off","yes","no"],t=new RegExp("\\b(("+e.join(")|(")+"))$","i");return{token:function(e,r){var n=e.peek(),i=r.escaped;if(r.escaped=!1,"#"==n&&(0==e.pos||/\s/.test(e.string.charAt(e.pos-1))))return e.skipToEnd(),"comment";if(e.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string";if(r.literal&&e.indentation()>r.keyCol)return e.skipToEnd(),"string";if(r.literal&&(r.literal=!1),e.sol()){if(r.keyCol=0,r.pair=!1,r.pairStart=!1,e.match(/---/))return"def";if(e.match(/\.\.\./))return"def";if(e.match(/\s*-\s+/))return"meta"}if(e.match(/^(\{|\}|\[|\])/))return"{"==n?r.inlinePairs++:"}"==n?r.inlinePairs--:"["==n?r.inlineList++:r.inlineList--,"meta";if(r.inlineList>0&&!i&&","==n)return e.next(),"meta";if(r.inlinePairs>0&&!i&&","==n)return r.keyCol=0,r.pair=!1,r.pairStart=!1,e.next(),"meta";if(r.pairStart){if(e.match(/^\s*(\||\>)\s*/))return r.literal=!0,"meta";if(e.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable-2";if(0==r.inlinePairs&&e.match(/^\s*-?[0-9\.\,]+\s?$/))return"number";if(r.inlinePairs>0&&e.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number";if(e.match(t))return"keyword"}return!r.pair&&e.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(r.pair=!0,r.keyCol=e.indentation(),"atom"):r.pair&&e.match(/^:\s*/)?(r.pairStart=!0,"meta"):(r.pairStart=!1,r.escaped="\\"==n,e.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}}}}),e.defineMIME("text/x-yaml","yaml")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../javascript/javascript"),require("../css/css"),require("../htmlmixed/htmlmixed")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../javascript/javascript","../css/css","../htmlmixed/htmlmixed"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("jade",function(t){function r(){this.javaScriptLine=!1,this.javaScriptLineExcludesColon=!1,this.javaScriptArguments=!1,this.javaScriptArgumentsDepth=0,this.isInterpolating=!1,this.interpolationNesting=0,this.jsState=Y.startState(),this.restOfLine="",this.isIncludeFiltered=!1,this.isEach=!1,this.lastTag="",this.scriptType="",this.isAttrs=!1,this.attrsNest=[],this.inAttributeName=!0,this.attributeIsType=!1,this.attrValue="",this.indentOf=1/0,this.indentToken="",this.innerMode=null,this.innerState=null,this.innerModeForLine=!1}function n(e,t){if(e.sol()&&(t.javaScriptLine=!1,t.javaScriptLineExcludesColon=!1),t.javaScriptLine){if(t.javaScriptLineExcludesColon&&":"===e.peek())return t.javaScriptLine=!1,void(t.javaScriptLineExcludesColon=!1);var r=Y.token(e,t.jsState);return e.eol()&&(t.javaScriptLine=!1),r||!0}}function i(e,t){if(t.javaScriptArguments){if(0===t.javaScriptArgumentsDepth&&"("!==e.peek())return void(t.javaScriptArguments=!1);if("("===e.peek()?t.javaScriptArgumentsDepth++:")"===e.peek()&&t.javaScriptArgumentsDepth--,0===t.javaScriptArgumentsDepth)return void(t.javaScriptArguments=!1);var r=Y.token(e,t.jsState);return r||!0}}function o(e){return e.match(/^yield\b/)?"keyword":void 0}function a(e){return e.match(/^(?:doctype) *([^\n]+)?/)?V:void 0}function s(e,t){return e.match("#{")?(t.isInterpolating=!0,t.interpolationNesting=0,"punctuation"):void 0}function l(e,t){if(t.isInterpolating){if("}"===e.peek()){if(t.interpolationNesting--,t.interpolationNesting<0)return e.next(),t.isInterpolating=!1,"punctuation"}else"{"===e.peek()&&t.interpolationNesting++;return Y.token(e,t.jsState)||!0}}function c(e,t){return e.match(/^case\b/)?(t.javaScriptLine=!0,K):void 0}function u(e,t){return e.match(/^when\b/)?(t.javaScriptLine=!0,t.javaScriptLineExcludesColon=!0,K):void 0}function f(e){return e.match(/^default\b/)?K:void 0}function d(e,t){return e.match(/^extends?\b/)?(t.restOfLine="string",K):void 0}function p(e,t){return e.match(/^append\b/)?(t.restOfLine="variable",K):void 0}function h(e,t){return e.match(/^prepend\b/)?(t.restOfLine="variable",K):void 0}function m(e,t){return e.match(/^block\b *(?:(prepend|append)\b)?/)?(t.restOfLine="variable",K):void 0}function g(e,t){return e.match(/^include\b/)?(t.restOfLine="string",K):void 0}function v(e,t){return e.match(/^include:([a-zA-Z0-9\-]+)/,!1)&&e.match("include")?(t.isIncludeFiltered=!0,K):void 0}function y(e,t){if(t.isIncludeFiltered){var r=L(e,t);return t.isIncludeFiltered=!1,t.restOfLine="string",r}}function b(e,t){return e.match(/^mixin\b/)?(t.javaScriptLine=!0,K):void 0}function k(e,t){return e.match(/^\+([-\w]+)/)?(e.match(/^\( *[-\w]+ *=/,!1)||(t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0),"variable"):e.match(/^\+#{/,!1)?(e.next(),t.mixinCallAfter=!0,s(e,t)):void 0}function x(e,t){return t.mixinCallAfter?(t.mixinCallAfter=!1,e.match(/^\( *[-\w]+ *=/,!1)||(t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0),!0):void 0}function w(e,t){return e.match(/^(if|unless|else if|else)\b/)?(t.javaScriptLine=!0,K):void 0}function _(e,t){return e.match(/^(- *)?(each|for)\b/)?(t.isEach=!0,K):void 0}function C(e,t){if(t.isEach){if(e.match(/^ in\b/))return t.javaScriptLine=!0,t.isEach=!1,K;if(e.sol()||e.eol())t.isEach=!1;else if(e.next()){for(;!e.match(/^ in\b/,!1)&&e.next(););return"variable"}}}function S(e,t){return e.match(/^while\b/)?(t.javaScriptLine=!0,K):void 0}function M(e,t){var r;return(r=e.match(/^(\w(?:[-:\w]*\w)?)\/?/))?(t.lastTag=r[1].toLowerCase(),"script"===t.lastTag&&(t.scriptType="application/javascript"),"tag"):void 0}function L(r,n){if(r.match(/^:([\w\-]+)/)){var i;return t&&t.innerModes&&(i=t.innerModes(r.current().substring(1))),i||(i=r.current().substring(1)),"string"==typeof i&&(i=e.getMode(t,i)),B(r,n,i),"atom"}}function T(e,t){return e.match(/^(!?=|-)/)?(t.javaScriptLine=!0,"punctuation"):void 0}function A(e){return e.match(/^#([\w-]+)/)?G:void 0}function E(e){return e.match(/^\.([\w-]+)/)?X:void 0}function O(e,t){return"("==e.peek()?(e.next(),t.isAttrs=!0,t.attrsNest=[],t.inAttributeName=!0,t.attrValue="",t.attributeIsType=!1,"punctuation"):void 0}function z(e,t){if(t.isAttrs){if(Z[e.peek()]&&t.attrsNest.push(Z[e.peek()]),t.attrsNest[t.attrsNest.length-1]===e.peek())t.attrsNest.pop();else if(e.eat(")"))return t.isAttrs=!1,"punctuation";if(t.inAttributeName&&e.match(/^[^=,\)!]+/))return("="===e.peek()||"!"===e.peek())&&(t.inAttributeName=!1,t.jsState=Y.startState(),t.attributeIsType="script"===t.lastTag&&"type"===e.current().trim().toLowerCase()?!0:!1),"attribute";var r=Y.token(e,t.jsState);if(t.attributeIsType&&"string"===r&&(t.scriptType=e.current().toString()),0===t.attrsNest.length&&("string"===r||"variable"===r||"keyword"===r))try{return Function("","var x "+t.attrValue.replace(/,\s*$/,"").replace(/^!/,"")),t.inAttributeName=!0,t.attrValue="",e.backUp(e.current().length),z(e,t)}catch(n){}return t.attrValue+=e.current(),r||!0}}function I(e,t){return e.match(/^&attributes\b/)?(t.javaScriptArguments=!0,t.javaScriptArgumentsDepth=0,"keyword"):void 0}function N(e){return e.sol()&&e.eatSpace()?"indent":void 0}function q(e,t){return e.match(/^ *\/\/(-)?([^\n]*)/)?(t.indentOf=e.indentation(),t.indentToken="comment","comment"):void 0}function P(e){return e.match(/^: */)?"colon":void 0}function R(e,t){return e.match(/^(?:\| ?| )([^\n]+)/)?"string":e.match(/^(<[^\n]*)/,!1)?(B(e,t,"htmlmixed"),t.innerModeForLine=!0,W(e,t,!0)):void 0}function j(e,t){if(e.eat(".")){var r=null;return"script"===t.lastTag&&-1!=t.scriptType.toLowerCase().indexOf("javascript")?r=t.scriptType.toLowerCase().replace(/"|'/g,""):"style"===t.lastTag&&(r="css"),B(e,t,r),"dot"}}function D(e){return e.next(),null}function B(r,n,i){i=e.mimeModes[i]||i,i=t.innerModes?t.innerModes(i)||i:i,i=e.mimeModes[i]||i,i=e.getMode(t,i),n.indentOf=r.indentation(),i&&"null"!==i.name?n.innerMode=i:n.indentToken="string"}function W(e,t,r){return e.indentation()>t.indentOf||t.innerModeForLine&&!e.sol()||r?t.innerMode?(t.innerState||(t.innerState=t.innerMode.startState?t.innerMode.startState(e.indentation()):{}),e.hideFirstChars(t.indentOf+2,function(){return t.innerMode.token(e,t.innerState)||!0})):(e.skipToEnd(),t.indentToken):void(e.sol()&&(t.indentOf=1/0,t.indentToken=null,t.innerMode=null,t.innerState=null))}function F(e,t){if(e.sol()&&(t.restOfLine=""),t.restOfLine){e.skipToEnd();var r=t.restOfLine;return t.restOfLine="",r}}function H(){return new r}function $(e){return e.copy()}function U(e,t){var r=W(e,t)||F(e,t)||l(e,t)||y(e,t)||C(e,t)||z(e,t)||n(e,t)||i(e,t)||x(e,t)||o(e,t)||a(e,t)||s(e,t)||c(e,t)||u(e,t)||f(e,t)||d(e,t)||p(e,t)||h(e,t)||m(e,t)||g(e,t)||v(e,t)||b(e,t)||k(e,t)||w(e,t)||_(e,t)||S(e,t)||M(e,t)||L(e,t)||T(e,t)||A(e,t)||E(e,t)||O(e,t)||I(e,t)||N(e,t)||R(e,t)||q(e,t)||P(e,t)||j(e,t)||D(e,t);return r===!0?null:r}var K="keyword",V="meta",G="builtin",X="qualifier",Z={"{":"}","(":")","[":"]"},Y=e.getMode(t,"javascript");return r.prototype.copy=function(){var t=new r;return t.javaScriptLine=this.javaScriptLine,t.javaScriptLineExcludesColon=this.javaScriptLineExcludesColon,t.javaScriptArguments=this.javaScriptArguments,t.javaScriptArgumentsDepth=this.javaScriptArgumentsDepth,t.isInterpolating=this.isInterpolating,t.interpolationNesting=this.interpolationNesting,t.jsState=e.copyState(Y,this.jsState),t.innerMode=this.innerMode,this.innerMode&&this.innerState&&(t.innerState=e.copyState(this.innerMode,this.innerState)),t.restOfLine=this.restOfLine,t.isIncludeFiltered=this.isIncludeFiltered,t.isEach=this.isEach,t.lastTag=this.lastTag,t.scriptType=this.scriptType,t.isAttrs=this.isAttrs,t.attrsNest=this.attrsNest.slice(),t.inAttributeName=this.inAttributeName,t.attributeIsType=this.attributeIsType,t.attrValue=this.attrValue,t.indentOf=this.indentOf,t.indentToken=this.indentToken,t.innerModeForLine=this.innerModeForLine,t},{startState:H,copyState:$,token:U}},"javascript","css","htmlmixed"),e.defineMIME("text/x-jade","jade")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("lua",function(e,t){function r(e){return new RegExp("^(?:"+e.join("|")+")","i")}function n(e){return new RegExp("^(?:"+e.join("|")+")$","i")}function i(e){for(var t=0;e.eat("=");)++t;return e.eat("["),t}function o(e,t){var r=e.next();return"-"==r&&e.eat("-")?e.eat("[")&&e.eat("[")?(t.cur=a(i(e),"comment"))(e,t):(e.skipToEnd(),"comment"):'"'==r||"'"==r?(t.cur=s(r))(e,t):"["==r&&/[\[=]/.test(e.peek())?(t.cur=a(i(e),"string"))(e,t):/\d/.test(r)?(e.eatWhile(/[\w.%]/),"number"):/[\w_]/.test(r)?(e.eatWhile(/[\w\\\-_.]/),"variable"):null}function a(e,t){return function(r,n){for(var i,a=null;null!=(i=r.next());)if(null==a)"]"==i&&(a=0);else if("="==i)++a;else{if("]"==i&&a==e){n.cur=o;break}a=null}return t}}function s(e){return function(t,r){for(var n,i=!1;null!=(n=t.next())&&(n!=e||i);)i=!i&&"\\"==n;return i||(r.cur=o),"string"}}var l=e.indentUnit,c=n(t.specials||[]),u=n(["_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load","loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require","select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall","coroutine.create","coroutine.resume","coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield","debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable","debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable","debug.setupvalue","debug.traceback","close","flush","lines","read","seek","setvbuf","write","io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin","io.stdout","io.tmpfile","io.type","io.write","math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg","math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max","math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh","math.sqrt","math.tan","math.tanh","os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale","os.time","os.tmpname","package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload","package.seeall","string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub","string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper","table.concat","table.insert","table.maxn","table.remove","table.sort"]),f=n(["and","break","elseif","false","nil","not","or","return","true","function","end","if","then","else","do","while","repeat","until","for","in","local"]),d=n(["function","if","repeat","do","\\(","{"]),p=n(["end","until","\\)","}"]),h=r(["end","until","\\)","}","else","elseif"]);return{startState:function(e){return{basecol:e||0,indentDepth:0,cur:o}},token:function(e,t){if(e.eatSpace())return null;var r=t.cur(e,t),n=e.current();return"variable"==r&&(f.test(n)?r="keyword":u.test(n)?r="builtin":c.test(n)&&(r="variable-2")),"comment"!=r&&"string"!=r&&(d.test(n)?++t.indentDepth:p.test(n)&&--t.indentDepth),r},indent:function(e,t){var r=h.test(t);return e.basecol+l*(e.indentDepth-(r?1:0))},lineComment:"--",blockCommentStart:"--[[",blockCommentEnd:"]]"}}),e.defineMIME("text/x-lua","lua")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("cmake",function(){function e(e,t){for(var r,n,i=!1;!e.eol()&&(r=e.next())!=t.pending;){if("$"===r&&"\\"!=n&&'"'==t.pending){i=!0;break}n=r}return i&&e.backUp(1),t.continueString=r==t.pending?!1:!0,"string"}function t(t,n){var i=t.next();return"$"===i?t.match(r)?"variable-2":"variable":n.continueString?(t.backUp(1),e(t,n)):t.match(/(\s+)?\w+\(/)||t.match(/(\s+)?\w+\ \(/)?(t.backUp(1),"def"):"#"==i?(t.skipToEnd(),"comment"):"'"==i||'"'==i?(n.pending=i,e(t,n)):"("==i||")"==i?"bracket":i.match(/[0-9]/)?"number":(t.eatWhile(/[\w-]/),null)}var r=/({)?[a-zA-Z0-9_]+(})?/;return{startState:function(){var e={};return e.inDefinition=!1,e.inInclude=!1,e.continueString=!1,e.pending=!1,e},token:function(e,r){return e.eatSpace()?null:t(e,r)}}}),e.defineMIME("text/x-cmake","cmake")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("nginx",function(e){function t(e){for(var t={},r=e.split(" "),n=0;n*\/]/.test(s)?r(null,"select-op"):/[;{}:\[\]]/.test(s)?r(null,s):(e.eatWhile(/[\w\\\-]/),r("variable","variable")):r(null,"compare"):void r(null,"compare")}function i(e,t){for(var i,o=!1;null!=(i=e.next());){if(o&&"/"==i){t.tokenize=n;break}o="*"==i}return r("comment","comment")}function o(e,t){for(var i,o=0;null!=(i=e.next());){if(o>=2&&">"==i){t.tokenize=n;break}o="-"==i?o+1:0}return r("comment","comment")}function a(e){return function(t,i){for(var o,a=!1;null!=(o=t.next())&&(o!=e||a);)a=!a&&"\\"==o;return a||(i.tokenize=n),r("string","string")}}var s,l=t("break return rewrite set accept_mutex accept_mutex_delay access_log add_after_body add_before_body add_header addition_types aio alias allow ancient_browser ancient_browser_value auth_basic auth_basic_user_file auth_http auth_http_header auth_http_timeout autoindex autoindex_exact_size autoindex_localtime charset charset_types client_body_buffer_size client_body_in_file_only client_body_in_single_buffer client_body_temp_path client_body_timeout client_header_buffer_size client_header_timeout client_max_body_size connection_pool_size create_full_put_path daemon dav_access dav_methods debug_connection debug_points default_type degradation degrade deny devpoll_changes devpoll_events directio directio_alignment empty_gif env epoll_events error_log eventport_events expires fastcgi_bind fastcgi_buffer_size fastcgi_buffers fastcgi_busy_buffers_size fastcgi_cache fastcgi_cache_key fastcgi_cache_methods fastcgi_cache_min_uses fastcgi_cache_path fastcgi_cache_use_stale fastcgi_cache_valid fastcgi_catch_stderr fastcgi_connect_timeout fastcgi_hide_header fastcgi_ignore_client_abort fastcgi_ignore_headers fastcgi_index fastcgi_intercept_errors fastcgi_max_temp_file_size fastcgi_next_upstream fastcgi_param fastcgi_pass_header fastcgi_pass_request_body fastcgi_pass_request_headers fastcgi_read_timeout fastcgi_send_lowat fastcgi_send_timeout fastcgi_split_path_info fastcgi_store fastcgi_store_access fastcgi_temp_file_write_size fastcgi_temp_path fastcgi_upstream_fail_timeout fastcgi_upstream_max_fails flv geoip_city geoip_country google_perftools_profiles gzip gzip_buffers gzip_comp_level gzip_disable gzip_hash gzip_http_version gzip_min_length gzip_no_buffer gzip_proxied gzip_static gzip_types gzip_vary gzip_window if_modified_since ignore_invalid_headers image_filter image_filter_buffer image_filter_jpeg_quality image_filter_transparency imap_auth imap_capabilities imap_client_buffer index ip_hash keepalive_requests keepalive_timeout kqueue_changes kqueue_events large_client_header_buffers limit_conn limit_conn_log_level limit_rate limit_rate_after limit_req limit_req_log_level limit_req_zone limit_zone lingering_time lingering_timeout lock_file log_format log_not_found log_subrequest map_hash_bucket_size map_hash_max_size master_process memcached_bind memcached_buffer_size memcached_connect_timeout memcached_next_upstream memcached_read_timeout memcached_send_timeout memcached_upstream_fail_timeout memcached_upstream_max_fails merge_slashes min_delete_depth modern_browser modern_browser_value msie_padding msie_refresh multi_accept open_file_cache open_file_cache_errors open_file_cache_events open_file_cache_min_uses open_file_cache_valid open_log_file_cache output_buffers override_charset perl perl_modules perl_require perl_set pid pop3_auth pop3_capabilities port_in_redirect postpone_gzipping postpone_output protocol proxy proxy_bind proxy_buffer proxy_buffer_size proxy_buffering proxy_buffers proxy_busy_buffers_size proxy_cache proxy_cache_key proxy_cache_methods proxy_cache_min_uses proxy_cache_path proxy_cache_use_stale proxy_cache_valid proxy_connect_timeout proxy_headers_hash_bucket_size proxy_headers_hash_max_size proxy_hide_header proxy_ignore_client_abort proxy_ignore_headers proxy_intercept_errors proxy_max_temp_file_size proxy_method proxy_next_upstream proxy_pass_error_message proxy_pass_header proxy_pass_request_body proxy_pass_request_headers proxy_read_timeout proxy_redirect proxy_send_lowat proxy_send_timeout proxy_set_body proxy_set_header proxy_ssl_session_reuse proxy_store proxy_store_access proxy_temp_file_write_size proxy_temp_path proxy_timeout proxy_upstream_fail_timeout proxy_upstream_max_fails random_index read_ahead real_ip_header recursive_error_pages request_pool_size reset_timedout_connection resolver resolver_timeout rewrite_log rtsig_overflow_events rtsig_overflow_test rtsig_overflow_threshold rtsig_signo satisfy secure_link_secret send_lowat send_timeout sendfile sendfile_max_chunk server_name_in_redirect server_names_hash_bucket_size server_names_hash_max_size server_tokens set_real_ip_from smtp_auth smtp_capabilities smtp_client_buffer smtp_greeting_delay so_keepalive source_charset ssi ssi_ignore_recycled_buffers ssi_min_file_chunk ssi_silent_errors ssi_types ssi_value_length ssl ssl_certificate ssl_certificate_key ssl_ciphers ssl_client_certificate ssl_crl ssl_dhparam ssl_engine ssl_prefer_server_ciphers ssl_protocols ssl_session_cache ssl_session_timeout ssl_verify_client ssl_verify_depth starttls stub_status sub_filter sub_filter_once sub_filter_types tcp_nodelay tcp_nopush thread_stack_size timeout timer_resolution types_hash_bucket_size types_hash_max_size underscores_in_headers uninitialized_variable_warn use user userid userid_domain userid_expires userid_mark userid_name userid_p3p userid_path userid_service valid_referers variables_hash_bucket_size variables_hash_max_size worker_connections worker_cpu_affinity worker_priority worker_processes worker_rlimit_core worker_rlimit_nofile worker_rlimit_sigpending worker_threads working_directory xclient xml_entities xslt_stylesheet xslt_typesdrew@li229-23"),c=t("http mail events server types location upstream charset_map limit_except if geo map"),u=t("include root server server_name listen internal proxy_pass memcached_pass fastcgi_pass try_files"),f=e.indentUnit;return{startState:function(e){return{tokenize:n,baseIndent:e||0,stack:[]}},token:function(e,t){if(e.eatSpace())return null;s=null;var r=t.tokenize(e,t),n=t.stack[t.stack.length-1];return"hash"==s&&"rule"==n?r="atom":"variable"==r&&("rule"==n?r="number":n&&"@media{"!=n||(r="tag")),"rule"==n&&/^[\{\};]$/.test(s)&&t.stack.pop(),"{"==s?"@media"==n?t.stack[t.stack.length-1]="@media{":t.stack.push("{"):"}"==s?t.stack.pop():"@media"==s?t.stack.push("@media"):"{"==n&&"comment"!=s&&t.stack.push("rule"),r},indent:function(e,t){var r=e.stack.length;return/^\}/.test(t)&&(r-="rule"==e.stack[e.stack.length-1]?2:1),e.baseIndent+r*f},electricChars:"}"}}),e.defineMIME("text/x-nginx-conf","nginx")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return e.string.charAt(e.pos+(t||0))}function r(e,t){if(t){var r=e.pos-t;return e.string.substr(r>=0?r:0,t)}return e.string.substr(0,e.pos-1)}function n(e,t){var r=e.string.length,n=r-e.pos+1;return e.string.substr(e.pos,t&&r>t?t:n)}function i(e,t){var r,n=e.pos+t;e.pos=0>=n?0:n>=(r=e.string.length-1)?r:n}e.defineMode("perl",function(){function e(e,t,r,n,i){return t.chain=null,t.style=null,t.tail=null,t.tokenize=function(e,t){for(var o,s=!1,l=0;o=e.next();){if(o===r[l]&&!s)return void 0!==r[++l]?(t.chain=r[l],t.style=n,t.tail=i):i&&e.eatWhile(i),t.tokenize=a,n;s=!s&&"\\"==o}return n},t.tokenize(e,t)}function o(e,t,r){return t.tokenize=function(e,t){return e.string==r&&(t.tokenize=a),e.skipToEnd(),"string"},t.tokenize(e,t)}function a(a,u){if(a.eatSpace())return null;if(u.chain)return e(a,u,u.chain,u.style,u.tail);if(a.match(/^\-?[\d\.]/,!1)&&a.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/))return"number";if(a.match(/^<<(?=\w)/))return a.eatWhile(/\w/),o(a,u,a.current().substr(2));if(a.sol()&&a.match(/^\=item(?!\w)/))return o(a,u,"=cut");var f=a.next();if('"'==f||"'"==f){if(r(a,3)=="<<"+f){var d=a.pos;a.eatWhile(/\w/);var p=a.current().substr(1);if(p&&a.eat(f))return o(a,u,p);a.pos=d}return e(a,u,[f],"string")}if("q"==f){var h=t(a,-2);if(!h||!/\w/.test(h))if(h=t(a,0),"x"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],l,c);if("["==h)return i(a,2),e(a,u,["]"],l,c);if("{"==h)return i(a,2),e(a,u,["}"],l,c);if("<"==h)return i(a,2),e(a,u,[">"],l,c);if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],l,c)}else if("q"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],"string");if("["==h)return i(a,2),e(a,u,["]"],"string");if("{"==h)return i(a,2),e(a,u,["}"],"string");if("<"==h)return i(a,2),e(a,u,[">"],"string");if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],"string")}else if("w"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],"bracket");if("["==h)return i(a,2),e(a,u,["]"],"bracket");if("{"==h)return i(a,2),e(a,u,["}"],"bracket");if("<"==h)return i(a,2),e(a,u,[">"],"bracket");if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],"bracket")}else if("r"==h){if(h=t(a,1),"("==h)return i(a,2),e(a,u,[")"],l,c);if("["==h)return i(a,2),e(a,u,["]"],l,c);if("{"==h)return i(a,2),e(a,u,["}"],l,c);if("<"==h)return i(a,2),e(a,u,[">"],l,c);if(/[\^'"!~\/]/.test(h))return i(a,1),e(a,u,[a.eat(h)],l,c)}else if(/[\^'"!~\/(\[{<]/.test(h)){if("("==h)return i(a,1),e(a,u,[")"],"string");if("["==h)return i(a,1),e(a,u,["]"],"string");if("{"==h)return i(a,1),e(a,u,["}"],"string");if("<"==h)return i(a,1),e(a,u,[">"],"string");if(/[\^'"!~\/]/.test(h))return e(a,u,[a.eat(h)],"string")}}if("m"==f){var h=t(a,-2);if((!h||!/\w/.test(h))&&(h=a.eat(/[(\[{<\^'"!~\/]/))){if(/[\^'"!~\/]/.test(h))return e(a,u,[h],l,c);if("("==h)return e(a,u,[")"],l,c);if("["==h)return e(a,u,["]"],l,c);if("{"==h)return e(a,u,["}"],l,c);if("<"==h)return e(a,u,[">"],l,c)}}if("s"==f){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat(/[(\[{<\^'"!~\/]/)))return"["==h?e(a,u,["]","]"],l,c):"{"==h?e(a,u,["}","}"],l,c):"<"==h?e(a,u,[">",">"],l,c):"("==h?e(a,u,[")",")"],l,c):e(a,u,[h,h],l,c)}if("y"==f){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat(/[(\[{<\^'"!~\/]/)))return"["==h?e(a,u,["]","]"],l,c):"{"==h?e(a,u,["}","}"],l,c):"<"==h?e(a,u,[">",">"],l,c):"("==h?e(a,u,[")",")"],l,c):e(a,u,[h,h],l,c)}if("t"==f){var h=/[\/>\]})\w]/.test(t(a,-2));if(!h&&(h=a.eat("r"),h&&(h=a.eat(/[(\[{<\^'"!~\/]/))))return"["==h?e(a,u,["]","]"],l,c):"{"==h?e(a,u,["}","}"],l,c):"<"==h?e(a,u,[">",">"],l,c):"("==h?e(a,u,[")",")"],l,c):e(a,u,[h,h],l,c)}if("`"==f)return e(a,u,[f],"variable-2");if("/"==f)return/~\s*$/.test(r(a))?e(a,u,[f],l,c):"operator";if("$"==f){var d=a.pos;if(a.eatWhile(/\d/)||a.eat("{")&&a.eatWhile(/\d/)&&a.eat("}"))return"variable-2";a.pos=d}if(/[$@%]/.test(f)){var d=a.pos;if(a.eat("^")&&a.eat(/[A-Z]/)||!/[@$%&]/.test(t(a,-2))&&a.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){var h=a.current();if(s[h])return"variable-2"}a.pos=d}if(/[$@%&]/.test(f)&&(a.eatWhile(/[\w$\[\]]/)||a.eat("{")&&a.eatWhile(/[\w$\[\]]/)&&a.eat("}"))){var h=a.current();return s[h]?"variable-2":"variable"}if("#"==f&&"$"!=t(a,-2))return a.skipToEnd(),"comment";if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(f)){var d=a.pos;if(a.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/),s[a.current()])return"operator";a.pos=d}if("_"==f&&1==a.pos){if("_END__"==n(a,6))return e(a,u,["\x00"],"comment");if("_DATA__"==n(a,7))return e(a,u,["\x00"],"variable-2");if("_C__"==n(a,7))return e(a,u,["\x00"],"string")}if(/\w/.test(f)){var d=a.pos;if("{"==t(a,-2)&&("}"==t(a,0)||a.eatWhile(/\w/)&&"}"==t(a,0)))return"string";a.pos=d}if(/[A-Z]/.test(f)){var m=t(a,-2),d=a.pos;if(a.eatWhile(/[A-Z_]/),!/[\da-z]/.test(t(a,0))){var h=s[a.current()];return h?(h[1]&&(h=h[0]),":"!=m?1==h?"keyword":2==h?"def":3==h?"atom":4==h?"operator":5==h?"variable-2":"meta":"meta"):"meta"}a.pos=d}if(/[a-zA-Z_]/.test(f)){var m=t(a,-2);a.eatWhile(/\w/);var h=s[a.current()];return h?(h[1]&&(h=h[0]),":"!=m?1==h?"keyword":2==h?"def":3==h?"atom":4==h?"operator":5==h?"variable-2":"meta":"meta"):"meta"}return null}var s={"->":4,"++":4,"--":4, -"**":4,"=~":4,"!~":4,"*":4,"/":4,"%":4,x:4,"+":4,"-":4,".":4,"<<":4,">>":4,"<":4,">":4,"<=":4,">=":4,lt:4,gt:4,le:4,ge:4,"==":4,"!=":4,"<=>":4,eq:4,ne:4,cmp:4,"~~":4,"&":4,"|":4,"^":4,"&&":4,"||":4,"//":4,"..":4,"...":4,"?":4,":":4,"=":4,"+=":4,"-=":4,"*=":4,",":4,"=>":4,"::":4,not:4,and:4,or:4,xor:4,BEGIN:[5,1],END:[5,1],PRINT:[5,1],PRINTF:[5,1],GETC:[5,1],READ:[5,1],READLINE:[5,1],DESTROY:[5,1],TIE:[5,1],TIEHANDLE:[5,1],UNTIE:[5,1],STDIN:5,STDIN_TOP:5,STDOUT:5,STDOUT_TOP:5,STDERR:5,STDERR_TOP:5,$ARG:5,$_:5,"@ARG":5,"@_":5,$LIST_SEPARATOR:5,'$"':5,$PROCESS_ID:5,$PID:5,$$:5,$REAL_GROUP_ID:5,$GID:5,"$(":5,$EFFECTIVE_GROUP_ID:5,$EGID:5,"$)":5,$PROGRAM_NAME:5,$0:5,$SUBSCRIPT_SEPARATOR:5,$SUBSEP:5,"$;":5,$REAL_USER_ID:5,$UID:5,"$<":5,$EFFECTIVE_USER_ID:5,$EUID:5,"$>":5,$a:5,$b:5,$COMPILING:5,"$^C":5,$DEBUGGING:5,"$^D":5,"${^ENCODING}":5,$ENV:5,"%ENV":5,$SYSTEM_FD_MAX:5,"$^F":5,"@F":5,"${^GLOBAL_PHASE}":5,"$^H":5,"%^H":5,"@INC":5,"%INC":5,$INPLACE_EDIT:5,"$^I":5,"$^M":5,$OSNAME:5,"$^O":5,"${^OPEN}":5,$PERLDB:5,"$^P":5,$SIG:5,"%SIG":5,$BASETIME:5,"$^T":5,"${^TAINT}":5,"${^UNICODE}":5,"${^UTF8CACHE}":5,"${^UTF8LOCALE}":5,$PERL_VERSION:5,"$^V":5,"${^WIN32_SLOPPY_STAT}":5,$EXECUTABLE_NAME:5,"$^X":5,$1:5,$MATCH:5,"$&":5,"${^MATCH}":5,$PREMATCH:5,"$`":5,"${^PREMATCH}":5,$POSTMATCH:5,"$'":5,"${^POSTMATCH}":5,$LAST_PAREN_MATCH:5,"$+":5,$LAST_SUBMATCH_RESULT:5,"$^N":5,"@LAST_MATCH_END":5,"@+":5,"%LAST_PAREN_MATCH":5,"%+":5,"@LAST_MATCH_START":5,"@-":5,"%LAST_MATCH_START":5,"%-":5,$LAST_REGEXP_CODE_RESULT:5,"$^R":5,"${^RE_DEBUG_FLAGS}":5,"${^RE_TRIE_MAXBUF}":5,$ARGV:5,"@ARGV":5,ARGV:5,ARGVOUT:5,$OUTPUT_FIELD_SEPARATOR:5,$OFS:5,"$,":5,$INPUT_LINE_NUMBER:5,$NR:5,"$.":5,$INPUT_RECORD_SEPARATOR:5,$RS:5,"$/":5,$OUTPUT_RECORD_SEPARATOR:5,$ORS:5,"$\\":5,$OUTPUT_AUTOFLUSH:5,"$|":5,$ACCUMULATOR:5,"$^A":5,$FORMAT_FORMFEED:5,"$^L":5,$FORMAT_PAGE_NUMBER:5,"$%":5,$FORMAT_LINES_LEFT:5,"$-":5,$FORMAT_LINE_BREAK_CHARACTERS:5,"$:":5,$FORMAT_LINES_PER_PAGE:5,"$=":5,$FORMAT_TOP_NAME:5,"$^":5,$FORMAT_NAME:5,"$~":5,"${^CHILD_ERROR_NATIVE}":5,$EXTENDED_OS_ERROR:5,"$^E":5,$EXCEPTIONS_BEING_CAUGHT:5,"$^S":5,$WARNING:5,"$^W":5,"${^WARNING_BITS}":5,$OS_ERROR:5,$ERRNO:5,"$!":5,"%OS_ERROR":5,"%ERRNO":5,"%!":5,$CHILD_ERROR:5,"$?":5,$EVAL_ERROR:5,"$@":5,$OFMT:5,"$#":5,"$*":5,$ARRAY_BASE:5,"$[":5,$OLD_PERL_VERSION:5,"$]":5,"if":[1,1],elsif:[1,1],"else":[1,1],"while":[1,1],unless:[1,1],"for":[1,1],foreach:[1,1],abs:1,accept:1,alarm:1,atan2:1,bind:1,binmode:1,bless:1,bootstrap:1,"break":1,caller:1,chdir:1,chmod:1,chomp:1,chop:1,chown:1,chr:1,chroot:1,close:1,closedir:1,connect:1,"continue":[1,1],cos:1,crypt:1,dbmclose:1,dbmopen:1,"default":1,defined:1,"delete":1,die:1,"do":1,dump:1,each:1,endgrent:1,endhostent:1,endnetent:1,endprotoent:1,endpwent:1,endservent:1,eof:1,eval:1,exec:1,exists:1,exit:1,exp:1,fcntl:1,fileno:1,flock:1,fork:1,format:1,formline:1,getc:1,getgrent:1,getgrgid:1,getgrnam:1,gethostbyaddr:1,gethostbyname:1,gethostent:1,getlogin:1,getnetbyaddr:1,getnetbyname:1,getnetent:1,getpeername:1,getpgrp:1,getppid:1,getpriority:1,getprotobyname:1,getprotobynumber:1,getprotoent:1,getpwent:1,getpwnam:1,getpwuid:1,getservbyname:1,getservbyport:1,getservent:1,getsockname:1,getsockopt:1,given:1,glob:1,gmtime:1,"goto":1,grep:1,hex:1,"import":1,index:1,"int":1,ioctl:1,join:1,keys:1,kill:1,last:1,lc:1,lcfirst:1,length:1,link:1,listen:1,local:2,localtime:1,lock:1,log:1,lstat:1,m:null,map:1,mkdir:1,msgctl:1,msgget:1,msgrcv:1,msgsnd:1,my:2,"new":1,next:1,no:1,oct:1,open:1,opendir:1,ord:1,our:2,pack:1,"package":1,pipe:1,pop:1,pos:1,print:1,printf:1,prototype:1,push:1,q:null,qq:null,qr:null,quotemeta:null,qw:null,qx:null,rand:1,read:1,readdir:1,readline:1,readlink:1,readpipe:1,recv:1,redo:1,ref:1,rename:1,require:1,reset:1,"return":1,reverse:1,rewinddir:1,rindex:1,rmdir:1,s:null,say:1,scalar:1,seek:1,seekdir:1,select:1,semctl:1,semget:1,semop:1,send:1,setgrent:1,sethostent:1,setnetent:1,setpgrp:1,setpriority:1,setprotoent:1,setpwent:1,setservent:1,setsockopt:1,shift:1,shmctl:1,shmget:1,shmread:1,shmwrite:1,shutdown:1,sin:1,sleep:1,socket:1,socketpair:1,sort:1,splice:1,split:1,sprintf:1,sqrt:1,srand:1,stat:1,state:1,study:1,sub:1,substr:1,symlink:1,syscall:1,sysopen:1,sysread:1,sysseek:1,system:1,syswrite:1,tell:1,telldir:1,tie:1,tied:1,time:1,times:1,tr:null,truncate:1,uc:1,ucfirst:1,umask:1,undef:1,unlink:1,unpack:1,unshift:1,untie:1,use:1,utime:1,values:1,vec:1,wait:1,waitpid:1,wantarray:1,warn:1,when:1,write:1,y:null},l="string-2",c=/[goseximacplud]/;return{startState:function(){return{tokenize:a,chain:null,style:null,tail:null}},token:function(e,t){return(t.tokenize||a)(e,t)},lineComment:"#"}}),e.registerHelper("wordChars","perl",/[\w$]/),e.defineMIME("text/x-perl","perl")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("sass",function(e){function t(e){return new RegExp("^"+e.join("|"))}function r(e,t){var r=e.peek();return")"===r?(e.next(),t.tokenizer=l,"operator"):"("===r?(e.next(),e.eatSpace(),"operator"):"'"===r||'"'===r?(t.tokenizer=i(e.next()),"string"):(t.tokenizer=i(")",!1),"string")}function n(e,t){return function(r,n){return r.sol()&&r.indentation()<=e?(n.tokenizer=l,l(r,n)):(t&&r.skipTo("*/")?(r.next(),r.next(),n.tokenizer=l):r.skipToEnd(),"comment")}}function i(e,t){function r(n,i){var a=n.next(),s=n.peek(),c=n.string.charAt(n.pos-2),u="\\"!==a&&s===e||a===e&&"\\"!==c;return u?(a!==e&&t&&n.next(),i.tokenizer=l,"string"):"#"===a&&"{"===s?(i.tokenizer=o(r),n.next(),"operator"):"string"}return null==t&&(t=!0),r}function o(e){return function(t,r){return"}"===t.peek()?(t.next(),r.tokenizer=e,"operator"):l(t,r)}}function a(t){if(0==t.indentCount){t.indentCount++;var r=t.scopes[0].offset,n=r+e.indentUnit;t.scopes.unshift({offset:n})}}function s(e){1!=e.scopes.length&&e.scopes.shift()}function l(e,t){var c=e.peek();if(e.match("/*"))return t.tokenizer=n(e.indentation(),!0),t.tokenizer(e,t);if(e.match("//"))return t.tokenizer=n(e.indentation(),!1),t.tokenizer(e,t);if(e.match("#{"))return t.tokenizer=o(l),"operator";if('"'===c||"'"===c)return e.next(),t.tokenizer=i(c),"string";if(t.cursorHalf){if("#"===c&&(e.next(),e.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)))return e.peek()||(t.cursorHalf=0),"number";if(e.match(/^-?[0-9\.]+/))return e.peek()||(t.cursorHalf=0),"number";if(e.match(/^(px|em|in)\b/))return e.peek()||(t.cursorHalf=0),"unit";if(e.match(f))return e.peek()||(t.cursorHalf=0),"keyword";if(e.match(/^url/)&&"("===e.peek())return t.tokenizer=r,e.peek()||(t.cursorHalf=0),"atom";if("$"===c)return e.next(),e.eatWhile(/[\w-]/),e.peek()||(t.cursorHalf=0),"variable-3";if("!"===c)return e.next(),e.peek()||(t.cursorHalf=0),e.match(/^[\w]+/)?"keyword":"operator";if(e.match(p))return e.peek()||(t.cursorHalf=0),"operator";if(e.eatWhile(/[\w-]/))return e.peek()||(t.cursorHalf=0),"attribute";if(!e.peek())return t.cursorHalf=0,null}else{if("."===c){if(e.next(),e.match(/^[\w-]+/))return a(t),"atom";if("#"===e.peek())return a(t),"atom"}if("#"===c){if(e.next(),e.match(/^[\w-]+/))return a(t),"atom";if("#"===e.peek())return a(t),"atom"}if("$"===c)return e.next(),e.eatWhile(/[\w-]/),"variable-2";if(e.match(/^-?[0-9\.]+/))return"number";if(e.match(/^(px|em|in)\b/))return"unit";if(e.match(f))return"keyword";if(e.match(/^url/)&&"("===e.peek())return t.tokenizer=r,"atom";if("="===c&&e.match(/^=[\w-]+/))return a(t),"meta";if("+"===c&&e.match(/^\+[\w-]+/))return"variable-3";if("@"===c&&e.match(/@extend/)&&(e.match(/\s*[\w]/)||s(t)),e.match(/^@(else if|if|media|else|for|each|while|mixin|function)/))return a(t),"meta";if("@"===c)return e.next(),e.eatWhile(/[\w-]/),"meta";if(e.eatWhile(/[\w-]/))return e.match(/ *: *[\w-\+\$#!\("']/,!1)?"property":e.match(/ *:/,!1)?(a(t),t.cursorHalf=1,"atom"):e.match(/ *,/,!1)?"atom":(a(t),"atom");if(":"===c)return e.match(h)?"keyword":(e.next(),t.cursorHalf=1,"operator")}return e.match(p)?"operator":(e.next(),null)}function c(t,r){t.sol()&&(r.indentCount=0);var n=r.tokenizer(t,r),i=t.current();if(("@return"===i||"}"===i)&&s(r),null!==n){for(var o=t.pos-i.length,a=o+e.indentUnit*r.indentCount,l=[],c=0;c","<","==",">=","<=","\\+","-","\\!=","/","\\*","%","and","or","not",";","\\{","\\}",":"],p=t(d),h=/^::?[a-zA-Z_][\w\-]*/;return{startState:function(){return{tokenizer:l,scopes:[{offset:0,type:"sass"}],indentCount:0,cursorHalf:0,definedVars:[],definedMixins:[]}},token:function(e,t){var r=c(e,t);return t.lastToken={style:r,content:e.current()},r},indent:function(e){return e.scopes[0].offset}}}),e.defineMIME("text/x-sass","sass")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("r",function(e){function t(e){for(var t=e.split(" "),r={},n=0;n=!&|~$:]/;return{startState:function(){return{tokenize:r,ctx:{type:"top",indent:-e.indentUnit,align:!1},indent:0,afterIdent:!1}},token:function(e,t){if(e.sol()&&(null==t.ctx.align&&(t.ctx.align=!1),t.indent=e.indentation()),e.eatSpace())return null;var r=t.tokenize(e,t);"comment"!=r&&null==t.ctx.align&&(t.ctx.align=!0);var n=t.ctx.type;return";"!=a&&"{"!=a&&"}"!=a||"block"!=n||o(t),"{"==a?i(t,"}",e):"("==a?(i(t,")",e),t.afterIdent&&(t.ctx.argList=!0)):"["==a?i(t,"]",e):"block"==a?i(t,"block",e):a==n&&o(t),t.afterIdent="variable"==r||"keyword"==r,r},indent:function(t,n){if(t.tokenize!=r)return 0;var i=n&&n.charAt(0),o=t.ctx,a=i==o.type;return"block"==o.type?o.indent+("{"==i?0:e.indentUnit):o.align?o.column+(a?0:1):o.indent+(a?0:e.indentUnit)},lineComment:"#"}}),e.defineMIME("text/x-rsrc","r")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../../addon/mode/simple")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../addon/mode/simple"],e):e(CodeMirror)}(function(e){"use strict";var t=["from","maintainer","run","cmd","expose","env","add","copy","entrypoint","volume","user","workdir","onbuild"],r="("+t.join("|")+")",n=new RegExp(r+"\\s*$","i"),i=new RegExp(r+"(\\s+)","i");e.defineSimpleMode("dockerfile",{start:[{regex:/#.*$/,token:"comment"},{regex:n,token:"variable-2"},{regex:i,token:["variable-2",null],next:"arguments"},{regex:/./,token:null}],arguments:[{regex:/#.*$/,token:"error",next:"start"},{regex:/[^#]+\\$/,token:null},{regex:/[^#]+/,token:null,next:"start"},{regex:/$/,token:null,next:"start"},{token:null,next:"start"}],meta:{lineComment:"#"}}),e.defineMIME("text/x-dockerfile","dockerfile")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror")):"function"==typeof define&&define.amd?define(["../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return e.line==t.line&&e.ch==t.ch}function r(e){N.push(e),N.length>50&&N.shift()}function n(e){return N.length?void(N[N.length-1]+=e):r(e)}function i(e){return N[N.length-(e?Math.min(e,1):1)]||""}function o(){return N.length>1&&N.pop(),i()}function a(e,i,o,a,s){null==s&&(s=e.getRange(i,o)),a&&q&&q.cm==e&&t(i,q.pos)&&e.isClean(q.gen)?n(s):r(s),e.replaceRange("",i,o,"+delete"),q=a?{cm:e,pos:i,gen:e.changeGeneration()}:null}function s(e,t,r){return e.findPosH(t,r,"char",!0)}function l(e,t,r){return e.findPosH(t,r,"word",!0)}function c(e,t,r){return e.findPosV(t,r,"line",e.doc.sel.goalColumn)}function u(e,t,r){return e.findPosV(t,r,"page",e.doc.sel.goalColumn)}function f(e,t,r){for(var n=t.line,i=e.getLine(n),o=/\S/.test(0>r?i.slice(0,t.ch):i.slice(t.ch)),a=e.firstLine(),s=e.lastLine();;){if(n+=r,a>n||n>s)return e.clipPos(I(n-r,0>r?0:null));i=e.getLine(n);var l=/\S/.test(i);if(l)o=!0;else if(o)return I(n,0)}}function d(e,t,r){for(var n=t.line,i=t.ch,o=e.getLine(t.line),a=!1;;){var s=o.charAt(i+(0>r?-1:0));if(s){if(a&&/[!?.]/.test(s))return I(n,i+(r>0?1:0));a||(a=/\w/.test(s)),i+=r}else{if(n==(0>r?e.firstLine():e.lastLine()))return I(n,i);if(o=e.getLine(n+r),!/\S/.test(o))return I(n,i);n+=r,i=0>r?o.length:0}}}function p(e,r,n){var i;if(e.findMatchingBracket&&(i=e.findMatchingBracket(r,!0))&&i.match&&(i.forward?1:-1)==n)return n>0?I(i.to.line,i.to.ch+1):i.to;for(var o=!0;;o=!1){var a=e.getTokenAt(r),s=I(r.line,0>n?a.start:a.end);if(!(o&&n>0&&a.end==r.ch)&&/\w/.test(a.string))return s;var l=e.findPosH(s,n,"char");if(t(s,l))return r;r=l}}function h(e,t){var r=e.state.emacsPrefix;return r?(w(e),"-"==r?-1:Number(r)):t?null:1}function m(e){var t="string"==typeof e?function(t){t.execCommand(e)}:e;return function(e){var r=h(e);t(e);for(var n=1;r>n;++n)t(e)}}function g(e,r,n,i){var o=h(e);0>o&&(i=-i,o=-o);for(var a=0;o>a;++a){var s=n(e,r,i);if(t(s,r))break;r=s}return r}function v(e,t){var r=function(r){r.extendSelection(g(r,r.getCursor(),e,t))};return r.motion=!0,r}function y(e,t,r){for(var n,i=e.listSelections(),o=i.length;o--;)n=i[o].head,a(e,n,g(e,n,t,r),!0)}function b(e){if(e.somethingSelected()){for(var t,r=e.listSelections(),n=r.length;n--;)t=r[n],a(e,t.anchor,t.head);return!0}}function k(e,t){return e.state.emacsPrefix?void("-"!=t&&(e.state.emacsPrefix+=t)):(e.state.emacsPrefix=t,e.on("keyHandled",x),void e.on("inputRead",_))}function x(e,t){e.state.emacsPrefixMap||P.hasOwnProperty(t)||w(e)}function w(e){e.state.emacsPrefix=null,e.off("keyHandled",x),e.off("inputRead",_)}function _(e,t){var r=h(e);if(r>1&&"+input"==t.origin){for(var n=t.text.join("\n"),i="",o=1;r>o;++o)i+=n;e.replaceSelection(i)}}function C(e){e.state.emacsPrefixMap=!0,e.addKeyMap(j),e.on("keyHandled",S),e.on("inputRead",S)}function S(e,t){("string"!=typeof t||!/^\d$/.test(t)&&"Ctrl-U"!=t)&&(e.removeKeyMap(j),e.state.emacsPrefixMap=!1,e.off("keyHandled",S),e.off("inputRead",S))}function M(e){e.setCursor(e.getCursor()),e.setExtending(!e.getExtending()),e.on("change",function(){e.setExtending(!1)})}function L(e){e.setExtending(!1),e.setCursor(e.getCursor())}function T(e,t,r){e.openDialog?e.openDialog(t+': ',r,{bottom:!0}):r(prompt(t,""))}function A(e,t){var r=e.getCursor(),n=e.findPosH(r,1,"word");e.replaceRange(t(e.getRange(r,n)),r,n),e.setCursor(n)}function E(e){for(var t=e.getCursor(),r=t.line,n=t.ch,i=[];r>=e.firstLine();){for(var o=e.getLine(r),a=null==n?o.length:n;a>0;){var n=o.charAt(--a);if(")"==n)i.push("(");else if("]"==n)i.push("[");else if("}"==n)i.push("{");else if(/[\(\{\[]/.test(n)&&(!i.length||i.pop()!=n))return e.extendSelection(I(r,a))}--r,n=null}}function O(e){e.execCommand("clearSearch"),L(e)}function z(e){j[e]=function(t){k(t,e)},R["Ctrl-"+e]=function(t){k(t,e)},P["Ctrl-"+e]=!0}for(var I=e.Pos,N=[],q=null,P={"Alt-G":!0,"Ctrl-X":!0,"Ctrl-Q":!0,"Ctrl-U":!0},R=e.keyMap.emacs=e.normalizeKeyMap({"Ctrl-W":function(e){a(e,e.getCursor("start"),e.getCursor("end"))},"Ctrl-K":m(function(e){var t=e.getCursor(),r=e.clipPos(I(t.line)),n=e.getRange(t,r);/\S/.test(n)||(n+="\n",r=I(t.line+1,0)),a(e,t,r,!0,n)}),"Alt-W":function(e){r(e.getSelection()),L(e)},"Ctrl-Y":function(e){var t=e.getCursor();e.replaceRange(i(h(e)),t,t,"paste"),e.setSelection(t,e.getCursor())},"Alt-Y":function(e){e.replaceSelection(o(),"around","paste")},"Ctrl-Space":M,"Ctrl-Shift-2":M,"Ctrl-F":v(s,1),"Ctrl-B":v(s,-1),Right:v(s,1),Left:v(s,-1),"Ctrl-D":function(e){y(e,s,1)},Delete:function(e){b(e)||y(e,s,1)},"Ctrl-H":function(e){y(e,s,-1)},Backspace:function(e){b(e)||y(e,s,-1)},"Alt-F":v(l,1),"Alt-B":v(l,-1),"Alt-D":function(e){y(e,l,1)},"Alt-Backspace":function(e){y(e,l,-1)},"Ctrl-N":v(c,1),"Ctrl-P":v(c,-1),Down:v(c,1),Up:v(c,-1),"Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd",End:"goLineEnd",Home:"goLineStart","Alt-V":v(u,-1),"Ctrl-V":v(u,1),PageUp:v(u,-1),PageDown:v(u,1),"Ctrl-Up":v(f,-1),"Ctrl-Down":v(f,1),"Alt-A":v(d,-1),"Alt-E":v(d,1),"Alt-K":function(e){y(e,d,1)},"Ctrl-Alt-K":function(e){y(e,p,1)},"Ctrl-Alt-Backspace":function(e){y(e,p,-1)},"Ctrl-Alt-F":v(p,1),"Ctrl-Alt-B":v(p,-1),"Shift-Ctrl-Alt-2":function(e){var t=e.getCursor();e.setSelection(g(e,t,p,1),t)},"Ctrl-Alt-T":function(e){var t=p(e,e.getCursor(),-1),r=p(e,t,1),n=p(e,r,1),i=p(e,n,-1);e.replaceRange(e.getRange(i,n)+e.getRange(r,i)+e.getRange(t,r),t,n)},"Ctrl-Alt-U":m(E),"Alt-Space":function(e){for(var t=e.getCursor(),r=t.ch,n=t.ch,i=e.getLine(t.line);r&&/\s/.test(i.charAt(r-1));)--r;for(;n0?e.setCursor(t-1):void T(e,"Goto line",function(t){var r;t&&!isNaN(r=Number(t))&&r==(0|r)&&r>0&&e.setCursor(r-1)})},"Ctrl-X Tab":function(e){e.indentSelection(h(e,!0)||e.getOption("indentUnit"))},"Ctrl-X Ctrl-X":function(e){e.setSelection(e.getCursor("head"),e.getCursor("anchor"))},"Ctrl-X Ctrl-S":"save","Ctrl-X Ctrl-W":"save","Ctrl-X S":"saveAll","Ctrl-X F":"open","Ctrl-X U":m("undo"),"Ctrl-X K":"close","Ctrl-X Delete":function(e){a(e,e.getCursor(),d(e,e.getCursor(),1),!0)},"Ctrl-X H":"selectAll","Ctrl-Q Tab":m("insertTab"),"Ctrl-U":C}),j={"Ctrl-G":w},D=0;10>D;++D)z(String(D));z("-")}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/edit/matchbrackets")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(e){"use strict";function t(t,r,n){if(0>n&&0==r.ch)return t.clipPos(d(r.line-1));var i=t.getLine(r.line);if(n>0&&r.ch>=i.length)return t.clipPos(d(r.line+1,0));for(var o,a="start",s=r.ch,l=0>n?0:i.length,c=0;s!=l;s+=n,c++){var u=i.charAt(0>n?s-1:s),f="_"!=u&&e.isWordChar(u)?"w":"o";if("w"==f&&u.toUpperCase()==u&&(f="W"),"start"==a)"o"!=f&&(a="in",o=f);else if("in"==a&&o!=f){if("w"==o&&"W"==f&&0>n&&s--,"W"==o&&"w"==f&&n>0){o="w";continue}break}}return d(r.line,s)}function r(e,r){e.extendSelectionsBy(function(n){return e.display.shift||e.doc.extend||n.empty()?t(e.doc,n.head,r):0>r?n.from():n.to()})}function n(t,r){return t.isReadOnly()?e.Pass:void t.operation(function(){for(var e=t.listSelections().length,n=[],i=-1,o=0;e>o;o++){var a=t.listSelections()[o].head;if(!(a.line<=i)){var s=d(a.line+(r?0:1),0);t.replaceRange("\n",s,null,"+insertLine"),t.indentLine(s.line,null,!0),n.push({head:s,anchor:s}),i=a.line+1}}t.setSelections(n)})}function i(t,r){for(var n=r.ch,i=n,o=t.getLine(r.line);n&&e.isWordChar(o.charAt(n-1));)--n;for(;ie?-1:e==t?0:1}),t.replaceRange(u,l,c),n&&e.push({anchor:l,head:c})}n&&t.setSelections(e,0)})}function s(t,r){t.operation(function(){for(var n=t.listSelections(),o=[],a=[],s=0;s=0;s--){var l=n[o[s]];if(!(c&&e.cmpPos(l.head,c)>0)){var u=i(t,l.head);c=u.from,t.replaceRange(r(u.word),u.from,u.to)}}})}function l(t){var r=t.getCursor("from"),n=t.getCursor("to");if(0==e.cmpPos(r,n)){var o=i(t,r);if(!o.word)return;r=o.from,n=o.to}return{from:r,to:n,query:t.getRange(r,n),word:o}}function c(e,t){var r=l(e);if(r){var n=r.query,i=e.getSearchCursor(n,t?r.to:r.from);(t?i.findNext():i.findPrevious())?e.setSelection(i.from(),i.to()):(i=e.getSearchCursor(n,t?d(e.firstLine(),0):e.clipPos(d(e.lastLine()))),(t?i.findNext():i.findPrevious())?e.setSelection(i.from(),i.to()):r.word&&e.setSelection(r.from,r.to))}}var u=e.keyMap.sublime={fallthrough:"default"},f=e.commands,d=e.Pos,p=e.keyMap["default"]==e.keyMap.macDefault,h=p?"Cmd-":"Ctrl-";f[u["Alt-Left"]="goSubwordLeft"]=function(e){r(e,-1)},f[u["Alt-Right"]="goSubwordRight"]=function(e){r(e,1)};var m=p?"Ctrl-Alt-":"Ctrl-";f[u[m+"Up"]="scrollLineUp"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var r=e.lineAtHeight(t.top+t.clientHeight,"local");e.getCursor().line>=r&&e.execCommand("goLineUp")}e.scrollTo(null,t.top-e.defaultTextHeight())},f[u[m+"Down"]="scrollLineDown"]=function(e){var t=e.getScrollInfo();if(!e.somethingSelected()){var r=e.lineAtHeight(t.top,"local")+1;e.getCursor().line<=r&&e.execCommand("goLineDown")}e.scrollTo(null,t.top+e.defaultTextHeight())},f[u["Shift-"+h+"L"]="splitSelectionByLine"]=function(e){for(var t=e.listSelections(),r=[],n=0;ni.line&&a==o.line&&0==o.ch||r.push({anchor:a==i.line?i:d(a,0),head:a==o.line?o:d(a)});e.setSelections(r,0)},u["Shift-Tab"]="indentLess",f[u.Esc="singleSelectionTop"]=function(e){var t=e.listSelections()[0];e.setSelection(t.anchor,t.head,{scroll:!1})},f[u[h+"L"]="selectLine"]=function(e){for(var t=e.listSelections(),r=[],n=0;ni?n.push(l,c):n.length&&(n[n.length-1]=c),i=c}t.operation(function(){for(var e=0;et.lastLine()?t.replaceRange("\n"+a,d(t.lastLine()),null,"+swapLine"):t.replaceRange(a+"\n",d(i,0),null,"+swapLine")}t.setSelections(o),t.scrollIntoView()})},f[u[v+"Down"]="swapLineDown"]=function(t){if(t.isReadOnly())return e.Pass;for(var r=t.listSelections(),n=[],i=t.lastLine()+1,o=r.length-1;o>=0;o--){var a=r[o],s=a.to().line+1,l=a.from().line;0!=a.to().ch||a.empty()||s--,i>s?n.push(s,l):n.length&&(n[n.length-1]=l),i=l}t.operation(function(){for(var e=n.length-2;e>=0;e-=2){var r=n[e],i=n[e+1],o=t.getLine(r);r==t.lastLine()?t.replaceRange("",d(r-1),d(r),"+swapLine"):t.replaceRange("",d(r,0),d(r+1,0),"+swapLine"),t.replaceRange(o+"\n",d(i,0),null,"+swapLine")}t.scrollIntoView()})},f[u[h+"/"]="toggleCommentIndented"]=function(e){e.toggleComment({indent:!0})},f[u[h+"J"]="joinLines"]=function(e){for(var t=e.listSelections(),r=[],n=0;nr;r++){var n=e.listSelections()[r];n.empty()?e.replaceRange(e.getLine(n.head.line)+"\n",d(n.head.line,0)):e.replaceRange(e.getRange(n.from(),n.to()),n.from())}e.scrollIntoView()})},u[h+"T"]="transposeChars",f[u.F9="sortLines"]=function(e){a(e,!0)},f[u[h+"F9"]="sortLinesInsensitive"]=function(e){a(e,!1)},f[u.F2="nextBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){var r=t.shift(),n=r.find();if(n)return t.push(r),e.setSelection(n.from,n.to)}},f[u["Shift-F2"]="prevBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){t.unshift(t.pop());var r=t[t.length-1].find();if(r)return e.setSelection(r.from,r.to);t.pop()}},f[u[h+"F2"]="toggleBookmark"]=function(e){for(var t=e.listSelections(),r=e.state.sublimeBookmarks||(e.state.sublimeBookmarks=[]),n=0;n=0;r--)e.replaceRange("",t[r].anchor,d(t[r].to().line),"+delete");e.scrollIntoView()})},f[u[y+h+"U"]="upcaseAtCursor"]=function(e){s(e,function(e){return e.toUpperCase()})},f[u[y+h+"L"]="downcaseAtCursor"]=function(e){s(e,function(e){return e.toLowerCase()})},f[u[y+h+"Space"]="setSublimeMark"]=function(e){e.state.sublimeMark&&e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor())},f[u[y+h+"A"]="selectToSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&e.setSelection(e.getCursor(),t)},f[u[y+h+"W"]="deleteToSublimeMark"]=function(t){var r=t.state.sublimeMark&&t.state.sublimeMark.find();if(r){var n=t.getCursor(),i=r;if(e.cmpPos(n,i)>0){var o=i;i=n,n=o}t.state.sublimeKilled=t.getRange(n,i),t.replaceRange("",n,i)}},f[u[y+h+"X"]="swapWithSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&(e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor()),e.setCursor(t))},f[u[y+h+"Y"]="sublimeYank"]=function(e){null!=e.state.sublimeKilled&&e.replaceSelection(e.state.sublimeKilled,null,"paste")},u[y+h+"G"]="clearBookmarks",f[u[y+h+"C"]="showInCenter"]=function(e){var t=e.cursorCoords(null,"local");e.scrollTo(null,(t.top+t.bottom)/2-e.getScrollInfo().clientHeight/2)},f[u["Shift-Alt-Up"]="selectLinesUpward"]=function(e){e.operation(function(){for(var t=e.listSelections(),r=0;re.firstLine()&&e.addSelection(d(n.head.line-1,n.head.ch))}})},f[u["Shift-Alt-Down"]="selectLinesDownward"]=function(e){e.operation(function(){for(var t=e.listSelections(),r=0;r",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"",type:"keyToKey", -toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"xi",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"dcc",context:"visual"},{keys:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0}},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"",type:"action",action:"redo"},{keys:"m",type:"action",action:"setMark"},{keys:'"',type:"action",action:"setRegister"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],r=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"global",shortName:"g"}],n=e.Pos,i=function(){function i(t){t.setOption("disableInput",!0),t.setOption("showCursorWhenSelecting",!1),e.signal(t,"vim-mode-change",{mode:"normal"}),t.on("cursorActivity",et),_(t),e.on(t.getInputField(),"paste",u(t))}function o(t){t.setOption("disableInput",!1),t.off("cursorActivity",et),e.off(t.getInputField(),"paste",u(t)),t.state.vim=null}function a(t,r){this==e.keyMap.vim&&e.rmClass(t.getWrapperElement(),"cm-fat-cursor"),r&&r.attach==s||o(t,!1)}function s(t,r){this==e.keyMap.vim&&e.addClass(t.getWrapperElement(),"cm-fat-cursor"),r&&r.attach==s||i(t)}function l(t,r){if(!r)return void 0;var n=c(t);if(!n)return!1;var i=e.Vim.findKey(r,n);return"function"==typeof i&&e.signal(r,"vim-keypress",n),i}function c(e){if("'"==e.charAt(0))return e.charAt(1);var t=e.split(/-(?!$)/),r=t[t.length-1];if(1==t.length&&1==t[0].length)return!1;if(2==t.length&&"Shift"==t[0]&&1==r.length)return!1;for(var n=!1,i=0;i"):!1}function u(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(R(e.getCursor(),0,1)),Mt.enterInsertMode(e,{},t))}),t.onPasteFn}function f(e,t){for(var r=[],n=e;e+t>n;n++)r.push(String.fromCharCode(n));return r}function d(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function p(e){return/^[a-z]$/.test(e)}function h(e){return-1!="()[]{}".indexOf(e)}function m(e){return ct.test(e)}function g(e){return/^[A-Z]$/.test(e)}function v(e){return/^\s*$/.test(e)}function y(e,t){for(var r=0;rn;n++)r.push(e);return r}function I(e,t){St[e]=t}function N(e,t){Mt[e]=t}function q(e,t,r){var i=Math.min(Math.max(e.firstLine(),t.line),e.lastLine()),o=X(e,i)-1;o=r?o+1:o;var a=Math.min(Math.max(0,t.ch),o);return n(i,a)}function P(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}function R(e,t,r){return"object"==typeof t&&(r=t.ch,t=t.line),n(e.line+t,e.ch+r)}function j(e,t){return{line:t.line-e.line,ch:t.line-e.line}}function D(e,t,r,n){for(var i,o=[],a=[],s=0;s"==t.slice(-11)){var r=t.length-11,n=e.slice(0,r),i=t.slice(0,r);return n==i&&e.length>r?"full":0==i.indexOf(n)?"partial":!1}return e==t?"full":0==t.indexOf(e)?"partial":!1}function W(e){var t=/^.*(<[\w\-]+>)$/.exec(e),r=t?t[1]:e.slice(-1);if(r.length>1)switch(r){case"":r="\n";break;case"":r=" "}return r}function F(e,t,r){return function(){for(var n=0;r>n;n++)t(e)}}function H(e){return n(e.line,e.ch)}function $(e,t){return e.ch==t.ch&&e.line==t.line}function U(e,t){return e.line2&&(t=K.apply(void 0,Array.prototype.slice.call(arguments,1))),U(e,t)?e:t}function V(e,t){return arguments.length>2&&(t=V.apply(void 0,Array.prototype.slice.call(arguments,1))),U(e,t)?t:e}function G(e,t,r){var n=U(e,t),i=U(t,r);return n&&i}function X(e,t){return e.getLine(t).length}function Z(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function Y(e){return e.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function Q(e,t,r){var i=X(e,t),o=new Array(r-i+1).join(" ");e.setCursor(n(t,i)),e.replaceRange(o,e.getCursor())}function J(e,t){var r=[],i=e.listSelections(),o=H(e.clipPos(t)),a=!$(t,o),s=e.getCursor("head"),l=te(i,s),c=$(i[l].head,i[l].anchor),u=i.length-1,f=u-l>l?u:0,d=i[f].anchor,p=Math.min(d.line,o.line),h=Math.max(d.line,o.line),m=d.ch,g=o.ch,v=i[f].head.ch-m,y=g-m;v>0&&0>=y?(m++,a||g--):0>v&&y>=0?(m--,c||g++):0>v&&-1==y&&(m--,g++);for(var b=p;h>=b;b++){var k={anchor:new n(b,m),head:new n(b,g)};r.push(k)}return l=o.line==h?r.length-1:0,e.setSelections(r),t.ch=g,d.ch=m,d}function ee(e,t,r){for(var n=[],i=0;r>i;i++){var o=R(t,i,0);n.push({anchor:o,head:o})}e.setSelections(n,0)}function te(e,t,r){for(var n=0;nc&&(o.line=c),o.ch=X(e,o.line)}return{ranges:[{anchor:a,head:o}],primary:0}}if("block"==r){for(var u=Math.min(a.line,o.line),f=Math.min(a.ch,o.ch),d=Math.max(a.line,o.line),p=Math.max(a.ch,o.ch)+1,h=d-u+1,m=o.line==u?0:h-1,g=[],v=0;h>v;v++)g.push({anchor:n(u+v,f),head:n(u+v,p)});return{ranges:g,primary:m}}}function se(e){var t=e.getCursor("head");return 1==e.getSelection().length&&(t=K(t,e.getCursor("anchor"))),t}function le(t,r){var n=t.state.vim;r!==!1&&t.setCursor(q(t,n.sel.head)),ne(t,n),n.visualMode=!1,n.visualLine=!1,n.visualBlock=!1,e.signal(t,"vim-mode-change",{mode:"normal"}),n.fakeCursor&&n.fakeCursor.clear()}function ce(e,t,r){var n=e.getRange(t,r);if(/\n\s*$/.test(n)){var i=n.split("\n");i.pop();for(var o,o=i.pop();i.length>0&&o&&v(o);o=i.pop())r.line--,r.ch=0;o?(r.line--,r.ch=X(e,r.line)):r.ch=0}}function ue(e,t,r){t.ch=0,r.ch=0,r.line++}function fe(e){if(!e)return 0;var t=e.search(/\S/);return-1==t?e.length:t}function de(e,t,r,i,o){for(var a=se(e),s=e.getLine(a.line),l=a.ch,c=o?ut[0]:ft[0];!c(s.charAt(l));)if(l++,l>=s.length)return null;i?c=ft[0]:(c=ut[0],c(s.charAt(l))||(c=ut[1]));for(var u=l,f=l;c(s.charAt(u))&&u=0;)f--;if(f++,t){for(var d=u;/\s/.test(s.charAt(u))&&u0;)f--;f||(f=p)}}return{start:n(a.line,f),end:n(a.line,u)}}function pe(e,t,r){$(t,r)||kt.jumpList.add(e,t,r)}function he(e,t){kt.lastChararacterSearch.increment=e,kt.lastChararacterSearch.forward=t.forward,kt.lastChararacterSearch.selectedCharacter=t.selectedCharacter}function me(e,t,r,i){var o=H(e.getCursor()),a=r?1:-1,s=r?e.lineCount():-1,l=o.ch,c=o.line,u=e.getLine(c),f={lineText:u,nextCh:u.charAt(l),lastCh:null,index:l,symb:i,reverseSymb:(r?{")":"(","}":"{"}:{"(":")","{":"}"})[i],forward:r,depth:0,curMoveThrough:!1},d=Lt[i];if(!d)return o;var p=Tt[d].init,h=Tt[d].isComplete;for(p&&p(f);c!==s&&t;){if(f.index+=a,f.nextCh=f.lineText.charAt(f.index),!f.nextCh){if(c+=a,f.lineText=e.getLine(c)||"",a>0)f.index=0;else{var m=f.lineText.length;f.index=m>0?m-1:0}f.nextCh=f.lineText.charAt(f.index)}h(f)&&(o.line=c,o.ch=f.index,t--)}return f.nextCh||f.curMoveThrough?n(c,f.index):o}function ge(e,t,r,n,i){var o=t.line,a=t.ch,s=e.getLine(o),l=r?1:-1,c=n?ft:ut;if(i&&""==s){if(o+=l,s=e.getLine(o),!d(e,o))return null;a=r?0:s.length}for(;;){if(i&&""==s)return{from:0,to:0,line:o};for(var u=l>0?s.length:-1,f=u,p=u;a!=u;){for(var h=!1,m=0;m0?0:s.length}throw new Error("The impossible happened.")}function ve(e,t,r,i,o,a){var s=H(t),l=[];(i&&!o||!i&&o)&&r++;for(var c=!(i&&o),u=0;r>u;u++){var f=ge(e,t,i,a,c);if(!f){var d=X(e,e.lastLine());l.push(i?{line:e.lastLine(),from:d,to:d}:{line:0,from:0,to:0});break}l.push(f),t=n(f.line,i?f.to-1:f.from)}var p=l.length!=r,h=l[0],m=l.pop();return i&&!o?(p||h.from==s.ch&&h.line==s.line||(m=l.pop()),n(m.line,m.from)):i&&o?n(m.line,m.to-1):!i&&o?(p||h.to==s.ch&&h.line==s.line||(m=l.pop()),n(m.line,m.to)):n(m.line,m.from)}function ye(e,t,r,i){for(var o,a=e.getCursor(),s=a.ch,l=0;t>l;l++){var c=e.getLine(a.line);if(o=xe(s,c,i,r,!0),-1==o)return null;s=o}return n(e.getCursor().line,o)}function be(e,t){var r=e.getCursor().line;return q(e,n(r,t-1))}function ke(e,t,r,n){y(r,mt)&&(t.marks[r]&&t.marks[r].clear(),t.marks[r]=e.setBookmark(n))}function xe(e,t,r,n,i){var o;return n?(o=t.indexOf(r,e+1),-1==o||i||(o-=1)):(o=t.lastIndexOf(r,e-1),-1==o||i||(o+=1)),o}function we(e,t,r,i,o){function a(t){return!e.getLine(t)}function s(e,t,r){return r?a(e)!=a(e+t):!a(e)&&a(e+t)}var l,c,u=t.line,f=e.firstLine(),d=e.lastLine(),p=u;if(i){for(;p>=f&&d>=p&&r>0;)s(p,i)&&r--,p+=i;return new n(p,0)}var h=e.state.vim;if(h.visualLine&&s(u,1,!0)){var m=h.sel.anchor;s(m.line,-1,!0)&&(o&&m.line==u||(u+=1))}var g=a(u);for(p=u;d>=p&&r;p++)s(p,1,!0)&&(o&&a(p)==g||r--);for(c=new n(p,0),p>d&&!g?g=!0:o=!1,p=u;p>f&&(o&&a(p)!=g&&p!=u||!s(p,-1,!0));p--);return l=new n(p,0),{start:l,end:c}}function _e(e,t,r,i){var o,a,s=t,l={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/}[r],c={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{"}[r],u=e.getLine(s.line).charAt(s.ch),f=u===c?1:0;if(o=e.scanForBracket(n(s.line,s.ch+f),-1,null,{bracketRegex:l}),a=e.scanForBracket(n(s.line,s.ch+f),1,null,{bracketRegex:l}),!o||!a)return{start:s,end:s};if(o=o.pos,a=a.pos,o.line==a.line&&o.ch>a.ch||o.line>a.line){var d=o;o=a,a=d}return i?a.ch+=1:o.ch+=1,{start:o,end:a}}function Ce(e,t,r,i){var o,a,s,l,c=H(t),u=e.getLine(c.line),f=u.split(""),d=f.indexOf(r);if(c.ch-1&&!o;s--)f[s]==r&&(o=s+1);else o=c.ch+1;if(o&&!a)for(s=o,l=f.length;l>s&&!a;s++)f[s]==r&&(a=s);return o&&a?(i&&(--o,++a),{start:n(c.line,o),end:n(c.line,a)}):{start:c,end:c}}function Se(){}function Me(e){var t=e.state.vim;return t.searchState_||(t.searchState_=new Se)}function Le(e,t,r,n,i){e.openDialog?e.openDialog(t,n,{bottom:!0,value:i.value,onKeyDown:i.onKeyDown,onKeyUp:i.onKeyUp,selectValueOnOpen:!1}):n(prompt(r,""))}function Te(e){var t=Ae(e)||[];if(!t.length)return[];var r=[];if(0===t[0]){for(var n=0;n'+t+"",{bottom:!0,duration:5e3}):alert(t)}function qe(e,t){var r="";return e&&(r+=''+e+""),r+=' ',t&&(r+='',r+=t,r+=""),r}function Pe(e,t){var r=(t.prefix||"")+" "+(t.desc||""),n=qe(t.prefix,t.desc);Le(e,n,r,t.onClose,t)}function Re(e,t){if(e instanceof RegExp&&t instanceof RegExp){for(var r=["global","multiline","ignoreCase","source"],n=0;ns;s++){var l=a.find(t);if(0==s&&l&&$(a.from(),o)&&(l=a.find(t)),!l&&(a=e.getSearchCursor(r,t?n(e.lastLine()):n(e.firstLine(),0)),!a.find(t)))return}return a.from()})}function Fe(e){var t=Me(e);e.removeOverlay(Me(e).getOverlay()),t.setOverlay(null),t.getScrollbarAnnotate()&&(t.getScrollbarAnnotate().clear(),t.setScrollbarAnnotate(null))}function He(e,t,r){return"number"!=typeof e&&(e=e.line),t instanceof Array?y(e,t):r?e>=t&&r>=e:e==t}function $e(e){var t=e.getScrollInfo(),r=6,n=10,i=e.coordsChar({left:0,top:r+t.top},"local"),o=t.clientHeight-n+t.top,a=e.coordsChar({left:0,top:o},"local");return{top:i.line,bottom:a.line}}function Ue(t,r,n,i,o,a,s,l,c){function u(){t.operation(function(){for(;!m;)f(),d();p()})}function f(){var e=t.getRange(a.from(),a.to()),r=e.replace(s,l);a.replace(r)}function d(){for(;a.findNext()&&He(a.from(),i,o);)if(n||!g||a.from().line!=g.line)return t.scrollIntoView(a.from(),30),t.setSelection(a.from(),a.to()),g=a.from(),void(m=!1);m=!0}function p(e){if(e&&e(),t.focus(),g){t.setCursor(g);var r=t.state.vim;r.exMode=!1,r.lastHPos=r.lastHSPos=g.ch}c&&c()}function h(r,n,i){e.e_stop(r);var o=e.keyName(r);switch(o){case"Y":f(),d();break;case"N":d();break;case"A":var a=c;c=void 0,t.operation(u),c=a;break;case"L":f();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":p(i)}return m&&p(i),!0}t.state.vim.exMode=!0;var m=!1,g=a.from();return d(),m?void Ne(t,"No matches for "+s.source):r?void Pe(t,{prefix:"replace with "+l+" (y/n/a/q/l)",onKeyDown:h}):(u(),void(c&&c()))}function Ke(t){var r=t.state.vim,n=kt.macroModeState,i=kt.registerController.getRegister("."),o=n.isPlaying,a=n.lastInsertModeChanges,s=[];if(!o){for(var l=a.inVisualBlock?r.lastSelection.visualBlock.height:1,c=a.changes,s=[],u=0;u1&&(ot(t,r,r.insertModeRepeat-1,!0),r.lastEditInputState.repeatOverride=r.insertModeRepeat),delete r.insertModeRepeat,r.insertMode=!1,t.setCursor(t.getCursor().line,t.getCursor().ch-1),t.setOption("keyMap","vim"),t.setOption("disableInput",!0),t.toggleOverwrite(!1),i.setText(a.changes.join("")),e.signal(t,"vim-mode-change",{mode:"normal"}),n.isRecording&&Ye(n)}function Ve(e){t.unshift(e)}function Ge(e,t,r,n,i){var o={keys:e,type:t};o[t]=r,o[t+"Args"]=n;for(var a in i)o[a]=i[a];Ve(o)}function Xe(t,r,n,i){var o=kt.registerController.getRegister(i);if(":"==i)return o.keyBuffer[0]&&Nt.processCommand(t,o.keyBuffer[0]),void(n.isPlaying=!1);var a=o.keyBuffer,s=0;n.isPlaying=!0,n.replaySearchQueries=o.searchQueries.slice(0);for(var l=0;l|<\w+>|./.exec(f),u=c[0],f=f.substring(c.index+u.length),e.Vim.handleKey(t,u,"macro"),r.insertMode){var d=o.insertModeChanges[s++].changes;kt.macroModeState.lastInsertModeChanges.changes=d,at(t,d,1),Ke(t)}n.isPlaying=!1}function Ze(e,t){if(!e.isPlaying){var r=e.latestRegister,n=kt.registerController.getRegister(r);n&&n.pushText(t)}}function Ye(e){if(!e.isPlaying){var t=e.latestRegister,r=kt.registerController.getRegister(t);r&&r.pushInsertModeChanges&&r.pushInsertModeChanges(e.lastInsertModeChanges)}}function Qe(e,t){if(!e.isPlaying){var r=e.latestRegister,n=kt.registerController.getRegister(r);n&&n.pushSearchQuery&&n.pushSearchQuery(t)}}function Je(e,t){var r=kt.macroModeState,n=r.lastInsertModeChanges;if(!r.isPlaying)for(;t;){if(n.expectCursorActivityForChange=!0,"+input"==t.origin||"paste"==t.origin||void 0===t.origin){var i=t.text.join("\n");n.changes.push(i)}t=t.next}}function et(e){var t=e.state.vim; +0!=a.to().ch||a.empty()||s--,i>s?n.push(s,l):n.length&&(n[n.length-1]=l),i=l}t.operation(function(){for(var e=n.length-2;e>=0;e-=2){var r=n[e],i=n[e+1],o=t.getLine(r);r==t.lastLine()?t.replaceRange("",f(r-1),f(r),"+swapLine"):t.replaceRange("",f(r,0),f(r+1,0),"+swapLine"),t.replaceRange(o+"\n",f(i,0),null,"+swapLine")}t.scrollIntoView()})},d[u[h+"/"]="toggleCommentIndented"]=function(e){e.toggleComment({indent:!0})},d[u[h+"J"]="joinLines"]=function(e){for(var t=e.listSelections(),r=[],n=0;nr;r++){var n=e.listSelections()[r];n.empty()?e.replaceRange(e.getLine(n.head.line)+"\n",f(n.head.line,0)):e.replaceRange(e.getRange(n.from(),n.to()),n.from())}e.scrollIntoView()})},u[h+"T"]="transposeChars",d[u.F9="sortLines"]=function(e){a(e,!0)},d[u[h+"F9"]="sortLinesInsensitive"]=function(e){a(e,!1)},d[u.F2="nextBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){var r=t.shift(),n=r.find();if(n)return t.push(r),e.setSelection(n.from,n.to)}},d[u["Shift-F2"]="prevBookmark"]=function(e){var t=e.state.sublimeBookmarks;if(t)for(;t.length;){t.unshift(t.pop());var r=t[t.length-1].find();if(r)return e.setSelection(r.from,r.to);t.pop()}},d[u[h+"F2"]="toggleBookmark"]=function(e){for(var t=e.listSelections(),r=e.state.sublimeBookmarks||(e.state.sublimeBookmarks=[]),n=0;n=0;r--)e.replaceRange("",t[r].anchor,f(t[r].to().line),"+delete");e.scrollIntoView()})},d[u[y+h+"U"]="upcaseAtCursor"]=function(e){s(e,function(e){return e.toUpperCase()})},d[u[y+h+"L"]="downcaseAtCursor"]=function(e){s(e,function(e){return e.toLowerCase()})},d[u[y+h+"Space"]="setSublimeMark"]=function(e){e.state.sublimeMark&&e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor())},d[u[y+h+"A"]="selectToSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&e.setSelection(e.getCursor(),t)},d[u[y+h+"W"]="deleteToSublimeMark"]=function(t){var r=t.state.sublimeMark&&t.state.sublimeMark.find();if(r){var n=t.getCursor(),i=r;if(e.cmpPos(n,i)>0){var o=i;i=n,n=o}t.state.sublimeKilled=t.getRange(n,i),t.replaceRange("",n,i)}},d[u[y+h+"X"]="swapWithSublimeMark"]=function(e){var t=e.state.sublimeMark&&e.state.sublimeMark.find();t&&(e.state.sublimeMark.clear(),e.state.sublimeMark=e.setBookmark(e.getCursor()),e.setCursor(t))},d[u[y+h+"Y"]="sublimeYank"]=function(e){null!=e.state.sublimeKilled&&e.replaceSelection(e.state.sublimeKilled,null,"paste")},u[y+h+"G"]="clearBookmarks",d[u[y+h+"C"]="showInCenter"]=function(e){var t=e.cursorCoords(null,"local");e.scrollTo(null,(t.top+t.bottom)/2-e.getScrollInfo().clientHeight/2)},d[u["Shift-Alt-Up"]="selectLinesUpward"]=function(e){e.operation(function(){for(var t=e.listSelections(),r=0;re.firstLine()&&e.addSelection(f(n.head.line-1,n.head.ch))}})},d[u["Shift-Alt-Down"]="selectLinesDownward"]=function(e){e.operation(function(){for(var t=e.listSelections(),r=0;r",type:"keyToKey",toKeys:"h"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"l"},{keys:"",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"",type:"keyToKey",toKeys:"W"},{keys:"",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"",type:"keyToKey",toKeys:"w"},{keys:"",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"",type:"keyToKey",toKeys:"j"},{keys:"",type:"keyToKey",toKeys:"k"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"",type:"keyToKey",toKeys:"",context:"insert"},{keys:"s",type:"keyToKey",toKeys:"cl",context:"normal"},{keys:"s",type:"keyToKey",toKeys:"c",context:"visual"},{keys:"S",type:"keyToKey",toKeys:"cc",context:"normal"},{keys:"S",type:"keyToKey",toKeys:"VdO",context:"visual"},{keys:"",type:"keyToKey",toKeys:"0"},{keys:"",type:"keyToKey",toKeys:"$"},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:""},{keys:"",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"H",type:"motion",motion:"moveToTopLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"M",type:"motion",motion:"moveToMiddleLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"L",type:"motion",motion:"moveToBottomLine",motionArgs:{linewise:!0,toJumplist:!0}},{keys:"h",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!1}},{keys:"l",type:"motion",motion:"moveByCharacters",motionArgs:{forward:!0}},{keys:"j",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,linewise:!0}},{keys:"k",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,linewise:!0}},{keys:"gj",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!0}},{keys:"gk",type:"motion",motion:"moveByDisplayLines",motionArgs:{forward:!1}},{keys:"w",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1}},{keys:"W",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:"e",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:"E",type:"motion",motion:"moveByWords",motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"b",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1}},{keys:"B",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:"ge",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:"gE",type:"motion",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:"{",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!1,toJumplist:!0}},{keys:"}",type:"motion",motion:"moveByParagraph",motionArgs:{forward:!0,toJumplist:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"",type:"motion",motion:"moveByScroll",motionArgs:{forward:!1,explicitRepeat:!0}},{keys:"gg",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"G",type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:"0",type:"motion",motion:"moveToStartOfLine"},{keys:"^",type:"motion",motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"+",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0}},{keys:"-",type:"motion",motion:"moveByLines",motionArgs:{forward:!1,toFirstChar:!0}},{keys:"_",type:"motion",motion:"moveByLines",motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:"$",type:"motion",motion:"moveToEol",motionArgs:{inclusive:!0}},{keys:"%",type:"motion",motion:"moveToMatchedSymbol",motionArgs:{inclusive:!0,toJumplist:!0}},{keys:"f",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0}},{keys:"]`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0}},{keys:"[`",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1}},{keys:"]'",type:"motion",motion:"jumpToMark",motionArgs:{forward:!0,linewise:!0}},{keys:"['",type:"motion",motion:"jumpToMark",motionArgs:{forward:!1,linewise:!0}},{keys:"]p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:"[p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:"]",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!1,toJumplist:!0}},{keys:"|",type:"motion",motion:"moveToColumn"},{keys:"o",type:"motion",motion:"moveToOtherHighlightedEnd",context:"visual"},{keys:"O",type:"motion",motion:"moveToOtherHighlightedEnd",motionArgs:{sameLine:!0},context:"visual"},{keys:"d",type:"operator",operator:"delete"},{keys:"y",type:"operator",operator:"yank"},{keys:"c",type:"operator",operator:"change"},{keys:">",type:"operator",operator:"indent",operatorArgs:{indentRight:!0}},{keys:"<",type:"operator",operator:"indent",operatorArgs:{indentRight:!1}},{keys:"g~",type:"operator",operator:"changeCase"},{keys:"gu",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},isEdit:!0},{keys:"gU",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},isEdit:!0},{keys:"n",type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:!0}},{keys:"N",type:"motion",motion:"findNext",motionArgs:{forward:!1,toJumplist:!0}},{keys:"x",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:"X",type:"operatorMotion",operator:"delete",motion:"moveByCharacters",motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:"D",type:"operatorMotion",operator:"delete",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"D",type:"operator",operator:"delete",operatorArgs:{linewise:!0},context:"visual"},{keys:"Y",type:"operatorMotion",operator:"yank",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"Y",type:"operator",operator:"yank",operatorArgs:{linewise:!0},context:"visual"},{keys:"C",type:"operatorMotion",operator:"change",motion:"moveToEol",motionArgs:{inclusive:!0},context:"normal"},{keys:"C",type:"operator",operator:"change",operatorArgs:{linewise:!0},context:"visual"},{keys:"~",type:"operatorMotion",operator:"changeCase",motion:"moveByCharacters",motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:"normal"},{keys:"~",type:"operator",operator:"changeCase",context:"visual"},{keys:"",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"",type:"action",action:"scroll",actionArgs:{forward:!1,linewise:!0}},{keys:"a",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"charAfter"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"eol"},context:"normal"},{keys:"A",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"endOfSelectedArea"},context:"visual"},{keys:"i",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"inplace"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"firstNonBlank"},context:"normal"},{keys:"I",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{insertAt:"startOfSelectedArea"},context:"visual"},{keys:"o",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:"normal"},{keys:"O",type:"action",action:"newLineAndEnterInsertMode",isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:"normal"},{keys:"v",type:"action",action:"toggleVisualMode"},{keys:"V",type:"action",action:"toggleVisualMode",actionArgs:{linewise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"gv",type:"action",action:"reselectLastSelection"},{keys:"J",type:"action",action:"joinLines",isEdit:!0},{keys:"p",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:"P",type:"action",action:"paste",isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:"r",type:"action",action:"replace",isEdit:!0},{keys:"@",type:"action",action:"replayMacro"},{keys:"q",type:"action",action:"enterMacroRecordMode"},{keys:"R",type:"action",action:"enterInsertMode",isEdit:!0,actionArgs:{replace:!0}},{keys:"u",type:"action",action:"undo",context:"normal"},{keys:"u",type:"operator",operator:"changeCase",operatorArgs:{toLower:!0},context:"visual",isEdit:!0},{keys:"U",type:"operator",operator:"changeCase",operatorArgs:{toLower:!1},context:"visual",isEdit:!0},{keys:"",type:"action",action:"redo"},{keys:"m",type:"action",action:"setMark"},{keys:'"',type:"action",action:"setRegister"},{keys:"zz",type:"action",action:"scrollToCursor",actionArgs:{position:"center"}},{keys:"z.",type:"action",action:"scrollToCursor",actionArgs:{position:"center"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"zt",type:"action",action:"scrollToCursor",actionArgs:{position:"top"}},{keys:"z",type:"action",action:"scrollToCursor",actionArgs:{position:"top"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:"z-",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"}},{keys:"zb",type:"action",action:"scrollToCursor",actionArgs:{position:"bottom"},motion:"moveToFirstNonWhiteSpaceCharacter"},{keys:".",type:"action",action:"repeatLastEdit"},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"a",type:"motion",motion:"textObjectManipulation"},{keys:"i",type:"motion",motion:"textObjectManipulation",motionArgs:{textObjectInner:!0}},{keys:"/",type:"search",searchArgs:{forward:!0,querySrc:"prompt",toJumplist:!0}},{keys:"?",type:"search",searchArgs:{forward:!1,querySrc:"prompt",toJumplist:!0}},{keys:"*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",wholeWordOnly:!0,toJumplist:!0}},{keys:"g*",type:"search",searchArgs:{forward:!0,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:"g#",type:"search",searchArgs:{forward:!1,querySrc:"wordUnderCursor",toJumplist:!0}},{keys:":",type:"ex"}],r=[{name:"colorscheme",shortName:"colo"},{name:"map"},{name:"imap",shortName:"im"},{name:"nmap",shortName:"nm"},{name:"vmap",shortName:"vm"},{name:"unmap"},{name:"write",shortName:"w"},{name:"undo",shortName:"u"},{name:"redo",shortName:"red"},{name:"set",shortName:"se"},{name:"set",shortName:"se"},{name:"setlocal",shortName:"setl"},{name:"setglobal",shortName:"setg"},{name:"sort",shortName:"sor"},{name:"substitute",shortName:"s",possiblyAsync:!0},{name:"nohlsearch",shortName:"noh"},{name:"yank",shortName:"y"},{name:"delmarks",shortName:"delm"},{name:"registers",shortName:"reg",excludeFromCommandHistory:!0},{name:"global",shortName:"g"}],n=e.Pos,i=function(){function i(t){t.setOption("disableInput",!0),t.setOption("showCursorWhenSelecting",!1),e.signal(t,"vim-mode-change",{mode:"normal"}),t.on("cursorActivity",et),_(t),e.on(t.getInputField(),"paste",u(t))}function o(t){t.setOption("disableInput",!1),t.off("cursorActivity",et),e.off(t.getInputField(),"paste",u(t)),t.state.vim=null}function a(t,r){this==e.keyMap.vim&&e.rmClass(t.getWrapperElement(),"cm-fat-cursor"),r&&r.attach==s||o(t,!1)}function s(t,r){this==e.keyMap.vim&&e.addClass(t.getWrapperElement(),"cm-fat-cursor"),r&&r.attach==s||i(t)}function l(t,r){if(!r)return void 0;var n=c(t);if(!n)return!1;var i=e.Vim.findKey(r,n);return"function"==typeof i&&e.signal(r,"vim-keypress",n),i}function c(e){if("'"==e.charAt(0))return e.charAt(1);var t=e.split(/-(?!$)/),r=t[t.length-1];if(1==t.length&&1==t[0].length)return!1;if(2==t.length&&"Shift"==t[0]&&1==r.length)return!1;for(var n=!1,i=0;i"):!1}function u(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(R(e.getCursor(),0,1)),Mt.enterInsertMode(e,{},t))}),t.onPasteFn}function d(e,t){for(var r=[],n=e;e+t>n;n++)r.push(String.fromCharCode(n));return r}function f(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function p(e){return/^[a-z]$/.test(e)}function h(e){return-1!="()[]{}".indexOf(e)}function m(e){return ct.test(e)}function g(e){return/^[A-Z]$/.test(e)}function v(e){return/^\s*$/.test(e)}function y(e,t){for(var r=0;rn;n++)r.push(e);return r}function I(e,t){St[e]=t}function N(e,t){Mt[e]=t}function q(e,t,r){var i=Math.min(Math.max(e.firstLine(),t.line),e.lastLine()),o=X(e,i)-1;o=r?o+1:o;var a=Math.min(Math.max(0,t.ch),o);return n(i,a)}function P(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}function R(e,t,r){return"object"==typeof t&&(r=t.ch,t=t.line),n(e.line+t,e.ch+r)}function j(e,t){return{line:t.line-e.line,ch:t.line-e.line}}function D(e,t,r,n){for(var i,o=[],a=[],s=0;s"==t.slice(-11)){var r=t.length-11,n=e.slice(0,r),i=t.slice(0,r);return n==i&&e.length>r?"full":0==i.indexOf(n)?"partial":!1}return e==t?"full":0==t.indexOf(e)?"partial":!1}function F(e){var t=/^.*(<[\w\-]+>)$/.exec(e),r=t?t[1]:e.slice(-1);if(r.length>1)switch(r){case"":r="\n";break;case"":r=" "}return r}function W(e,t,r){return function(){for(var n=0;r>n;n++)t(e)}}function H(e){return n(e.line,e.ch)}function $(e,t){return e.ch==t.ch&&e.line==t.line}function U(e,t){return e.line2&&(t=K.apply(void 0,Array.prototype.slice.call(arguments,1))),U(e,t)?e:t}function V(e,t){return arguments.length>2&&(t=V.apply(void 0,Array.prototype.slice.call(arguments,1))),U(e,t)?t:e}function G(e,t,r){var n=U(e,t),i=U(t,r);return n&&i}function X(e,t){return e.getLine(t).length}function Z(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function Y(e){return e.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1")}function Q(e,t,r){var i=X(e,t),o=new Array(r-i+1).join(" ");e.setCursor(n(t,i)),e.replaceRange(o,e.getCursor())}function J(e,t){var r=[],i=e.listSelections(),o=H(e.clipPos(t)),a=!$(t,o),s=e.getCursor("head"),l=te(i,s),c=$(i[l].head,i[l].anchor),u=i.length-1,d=u-l>l?u:0,f=i[d].anchor,p=Math.min(f.line,o.line),h=Math.max(f.line,o.line),m=f.ch,g=o.ch,v=i[d].head.ch-m,y=g-m;v>0&&0>=y?(m++,a||g--):0>v&&y>=0?(m--,c||g++):0>v&&-1==y&&(m--,g++);for(var b=p;h>=b;b++){var k={anchor:new n(b,m),head:new n(b,g)};r.push(k)}return l=o.line==h?r.length-1:0,e.setSelections(r),t.ch=g,f.ch=m,f}function ee(e,t,r){for(var n=[],i=0;r>i;i++){var o=R(t,i,0);n.push({anchor:o,head:o})}e.setSelections(n,0)}function te(e,t,r){for(var n=0;nc&&(o.line=c),o.ch=X(e,o.line)}return{ranges:[{anchor:a,head:o}],primary:0}}if("block"==r){for(var u=Math.min(a.line,o.line),d=Math.min(a.ch,o.ch),f=Math.max(a.line,o.line),p=Math.max(a.ch,o.ch)+1,h=f-u+1,m=o.line==u?0:h-1,g=[],v=0;h>v;v++)g.push({anchor:n(u+v,d),head:n(u+v,p)});return{ranges:g,primary:m}}}function se(e){var t=e.getCursor("head");return 1==e.getSelection().length&&(t=K(t,e.getCursor("anchor"))),t}function le(t,r){var n=t.state.vim;r!==!1&&t.setCursor(q(t,n.sel.head)),ne(t,n),n.visualMode=!1,n.visualLine=!1,n.visualBlock=!1,e.signal(t,"vim-mode-change",{mode:"normal"}),n.fakeCursor&&n.fakeCursor.clear()}function ce(e,t,r){var n=e.getRange(t,r);if(/\n\s*$/.test(n)){var i=n.split("\n");i.pop();for(var o,o=i.pop();i.length>0&&o&&v(o);o=i.pop())r.line--,r.ch=0;o?(r.line--,r.ch=X(e,r.line)):r.ch=0}}function ue(e,t,r){t.ch=0,r.ch=0,r.line++}function de(e){if(!e)return 0;var t=e.search(/\S/);return-1==t?e.length:t}function fe(e,t,r,i,o){for(var a=se(e),s=e.getLine(a.line),l=a.ch,c=o?ut[0]:dt[0];!c(s.charAt(l));)if(l++,l>=s.length)return null;i?c=dt[0]:(c=ut[0],c(s.charAt(l))||(c=ut[1]));for(var u=l,d=l;c(s.charAt(u))&&u=0;)d--;if(d++,t){for(var f=u;/\s/.test(s.charAt(u))&&u0;)d--;d||(d=p)}}return{start:n(a.line,d),end:n(a.line,u)}}function pe(e,t,r){$(t,r)||kt.jumpList.add(e,t,r)}function he(e,t){kt.lastCharacterSearch.increment=e,kt.lastCharacterSearch.forward=t.forward,kt.lastCharacterSearch.selectedCharacter=t.selectedCharacter}function me(e,t,r,i){var o=H(e.getCursor()),a=r?1:-1,s=r?e.lineCount():-1,l=o.ch,c=o.line,u=e.getLine(c),d={lineText:u,nextCh:u.charAt(l),lastCh:null,index:l,symb:i,reverseSymb:(r?{")":"(","}":"{"}:{"(":")","{":"}"})[i],forward:r,depth:0,curMoveThrough:!1},f=Lt[i];if(!f)return o;var p=Tt[f].init,h=Tt[f].isComplete;for(p&&p(d);c!==s&&t;){if(d.index+=a,d.nextCh=d.lineText.charAt(d.index),!d.nextCh){if(c+=a,d.lineText=e.getLine(c)||"",a>0)d.index=0;else{var m=d.lineText.length;d.index=m>0?m-1:0}d.nextCh=d.lineText.charAt(d.index)}h(d)&&(o.line=c,o.ch=d.index,t--)}return d.nextCh||d.curMoveThrough?n(c,d.index):o}function ge(e,t,r,n,i){var o=t.line,a=t.ch,s=e.getLine(o),l=r?1:-1,c=n?dt:ut;if(i&&""==s){if(o+=l,s=e.getLine(o),!f(e,o))return null;a=r?0:s.length}for(;;){if(i&&""==s)return{from:0,to:0,line:o};for(var u=l>0?s.length:-1,d=u,p=u;a!=u;){for(var h=!1,m=0;m0?0:s.length}}function ve(e,t,r,i,o,a){var s=H(t),l=[];(i&&!o||!i&&o)&&r++;for(var c=!(i&&o),u=0;r>u;u++){var d=ge(e,t,i,a,c);if(!d){var f=X(e,e.lastLine());l.push(i?{line:e.lastLine(),from:f,to:f}:{line:0,from:0,to:0});break}l.push(d),t=n(d.line,i?d.to-1:d.from)}var p=l.length!=r,h=l[0],m=l.pop();return i&&!o?(p||h.from==s.ch&&h.line==s.line||(m=l.pop()),n(m.line,m.from)):i&&o?n(m.line,m.to-1):!i&&o?(p||h.to==s.ch&&h.line==s.line||(m=l.pop()),n(m.line,m.to)):n(m.line,m.from)}function ye(e,t,r,i){for(var o,a=e.getCursor(),s=a.ch,l=0;t>l;l++){var c=e.getLine(a.line);if(o=xe(s,c,i,r,!0),-1==o)return null;s=o}return n(e.getCursor().line,o)}function be(e,t){var r=e.getCursor().line;return q(e,n(r,t-1))}function ke(e,t,r,n){y(r,mt)&&(t.marks[r]&&t.marks[r].clear(),t.marks[r]=e.setBookmark(n))}function xe(e,t,r,n,i){var o;return n?(o=t.indexOf(r,e+1),-1==o||i||(o-=1)):(o=t.lastIndexOf(r,e-1),-1==o||i||(o+=1)),o}function we(e,t,r,i,o){function a(t){return!e.getLine(t)}function s(e,t,r){return r?a(e)!=a(e+t):!a(e)&&a(e+t)}var l,c,u=t.line,d=e.firstLine(),f=e.lastLine(),p=u;if(i){for(;p>=d&&f>=p&&r>0;)s(p,i)&&r--,p+=i;return new n(p,0)}var h=e.state.vim;if(h.visualLine&&s(u,1,!0)){var m=h.sel.anchor;s(m.line,-1,!0)&&(o&&m.line==u||(u+=1))}var g=a(u);for(p=u;f>=p&&r;p++)s(p,1,!0)&&(o&&a(p)==g||r--);for(c=new n(p,0),p>f&&!g?g=!0:o=!1,p=u;p>d&&(o&&a(p)!=g&&p!=u||!s(p,-1,!0));p--);return l=new n(p,0),{start:l,end:c}}function _e(e,t,r,i){var o,a,s=t,l={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/}[r],c={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{"}[r],u=e.getLine(s.line).charAt(s.ch),d=u===c?1:0;if(o=e.scanForBracket(n(s.line,s.ch+d),-1,null,{bracketRegex:l}),a=e.scanForBracket(n(s.line,s.ch+d),1,null,{bracketRegex:l}),!o||!a)return{start:s,end:s};if(o=o.pos,a=a.pos,o.line==a.line&&o.ch>a.ch||o.line>a.line){var f=o;o=a,a=f}return i?a.ch+=1:o.ch+=1,{start:o,end:a}}function Ce(e,t,r,i){var o,a,s,l,c=H(t),u=e.getLine(c.line),d=u.split(""),f=d.indexOf(r);if(c.ch-1&&!o;s--)d[s]==r&&(o=s+1);else o=c.ch+1;if(o&&!a)for(s=o,l=d.length;l>s&&!a;s++)d[s]==r&&(a=s);return o&&a?(i&&(--o,++a),{start:n(c.line,o),end:n(c.line,a)}):{start:c,end:c}}function Se(){}function Me(e){var t=e.state.vim;return t.searchState_||(t.searchState_=new Se)}function Le(e,t,r,n,i){e.openDialog?e.openDialog(t,n,{bottom:!0,value:i.value,onKeyDown:i.onKeyDown,onKeyUp:i.onKeyUp,selectValueOnOpen:!1}):n(prompt(r,""))}function Te(e){var t=Ae(e)||[];if(!t.length)return[];var r=[];if(0===t[0]){for(var n=0;n'+t+"",{bottom:!0,duration:5e3}):alert(t)}function qe(e,t){var r="";return e&&(r+=''+e+""),r+=' ',t&&(r+='',r+=t,r+=""),r}function Pe(e,t){var r=(t.prefix||"")+" "+(t.desc||""),n=qe(t.prefix,t.desc);Le(e,n,r,t.onClose,t)}function Re(e,t){if(e instanceof RegExp&&t instanceof RegExp){for(var r=["global","multiline","ignoreCase","source"],n=0;ns;s++){var l=a.find(t);if(0==s&&l&&$(a.from(),o)&&(l=a.find(t)),!l&&(a=e.getSearchCursor(r,t?n(e.lastLine()):n(e.firstLine(),0)),!a.find(t)))return}return a.from()})}function We(e){var t=Me(e);e.removeOverlay(Me(e).getOverlay()),t.setOverlay(null),t.getScrollbarAnnotate()&&(t.getScrollbarAnnotate().clear(),t.setScrollbarAnnotate(null))}function He(e,t,r){return"number"!=typeof e&&(e=e.line),t instanceof Array?y(e,t):r?e>=t&&r>=e:e==t}function $e(e){var t=e.getScrollInfo(),r=6,n=10,i=e.coordsChar({left:0,top:r+t.top},"local"),o=t.clientHeight-n+t.top,a=e.coordsChar({left:0,top:o},"local");return{top:i.line,bottom:a.line}}function Ue(t,r,n,i,o,a,s,l,c){function u(){t.operation(function(){for(;!m;)d(),f();p()})}function d(){var e=t.getRange(a.from(),a.to()),r=e.replace(s,l);a.replace(r)}function f(){for(;a.findNext()&&He(a.from(),i,o);)if(n||!g||a.from().line!=g.line)return t.scrollIntoView(a.from(),30),t.setSelection(a.from(),a.to()),g=a.from(),void(m=!1);m=!0}function p(e){if(e&&e(),t.focus(),g){t.setCursor(g);var r=t.state.vim;r.exMode=!1,r.lastHPos=r.lastHSPos=g.ch}c&&c()}function h(r,n,i){e.e_stop(r);var o=e.keyName(r);switch(o){case"Y":d(),f();break;case"N":f();break;case"A":var a=c;c=void 0,t.operation(u),c=a;break;case"L":d();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":p(i)}return m&&p(i),!0}t.state.vim.exMode=!0;var m=!1,g=a.from();return f(),m?void Ne(t,"No matches for "+s.source):r?void Pe(t,{prefix:"replace with "+l+" (y/n/a/q/l)",onKeyDown:h}):(u(),void(c&&c()))}function Ke(t){var r=t.state.vim,n=kt.macroModeState,i=kt.registerController.getRegister("."),o=n.isPlaying,a=n.lastInsertModeChanges,s=[];if(!o){for(var l=a.inVisualBlock?r.lastSelection.visualBlock.height:1,c=a.changes,s=[],u=0;u1&&(ot(t,r,r.insertModeRepeat-1,!0),r.lastEditInputState.repeatOverride=r.insertModeRepeat),delete r.insertModeRepeat,r.insertMode=!1,t.setCursor(t.getCursor().line,t.getCursor().ch-1),t.setOption("keyMap","vim"),t.setOption("disableInput",!0),t.toggleOverwrite(!1),i.setText(a.changes.join("")),e.signal(t,"vim-mode-change",{mode:"normal"}),n.isRecording&&Ye(n)}function Ve(e){t.unshift(e)}function Ge(e,t,r,n,i){var o={keys:e,type:t};o[t]=r,o[t+"Args"]=n;for(var a in i)o[a]=i[a];Ve(o)}function Xe(t,r,n,i){var o=kt.registerController.getRegister(i);if(":"==i)return o.keyBuffer[0]&&Nt.processCommand(t,o.keyBuffer[0]),void(n.isPlaying=!1);var a=o.keyBuffer,s=0;n.isPlaying=!0,n.replaySearchQueries=o.searchQueries.slice(0);for(var l=0;l|<\w+>|./.exec(d),u=c[0],d=d.substring(c.index+u.length),e.Vim.handleKey(t,u,"macro"),r.insertMode){var f=o.insertModeChanges[s++].changes;kt.macroModeState.lastInsertModeChanges.changes=f,at(t,f,1),Ke(t)}n.isPlaying=!1}function Ze(e,t){if(!e.isPlaying){var r=e.latestRegister,n=kt.registerController.getRegister(r);n&&n.pushText(t)}}function Ye(e){if(!e.isPlaying){var t=e.latestRegister,r=kt.registerController.getRegister(t);r&&r.pushInsertModeChanges&&r.pushInsertModeChanges(e.lastInsertModeChanges)}}function Qe(e,t){if(!e.isPlaying){var r=e.latestRegister,n=kt.registerController.getRegister(r);n&&n.pushSearchQuery&&n.pushSearchQuery(t)}}function Je(e,t){var r=kt.macroModeState,n=r.lastInsertModeChanges;if(!r.isPlaying)for(;t;){if(n.expectCursorActivityForChange=!0,"+input"==t.origin||"paste"==t.origin||void 0===t.origin){var i=t.text.join("\n");n.changes.push(i)}t=t.next}}function et(e){var t=e.state.vim;if(t.insertMode){var r=kt.macroModeState;if(r.isPlaying)return;var n=r.lastInsertModeChanges;n.expectCursorActivityForChange?n.expectCursorActivityForChange=!1:n.changes=[]}else e.curOp.isVimOp||rt(e,t);t.visualMode&&tt(e)}function tt(e){var t=e.state.vim,r=q(e,H(t.sel.head)),n=R(r,0,1);t.fakeCursor&&t.fakeCursor.clear(),t.fakeCursor=e.markText(r,n,{className:"cm-animate-fat-cursor"})}function rt(t,r){var n=t.getCursor("anchor"),i=t.getCursor("head");if(r.visualMode&&!t.somethingSelected()?le(t,!1):r.visualMode||r.insertMode||!t.somethingSelected()||(r.visualMode=!0,r.visualLine=!1,e.signal(t,"vim-mode-change",{mode:"visual"})),r.visualMode){var o=U(i,n)?0:-1,a=U(i,n)?-1:0;i=R(i,0,o),n=R(n,0,a),r.sel={anchor:n,head:i},ke(t,r,"<",K(i,n)),ke(t,r,">",V(i,n))}else r.insertMode||(r.lastHPos=t.getCursor().ch)}function nt(e){this.keyName=e}function it(t){function r(){return i.changes.push(new nt(o)),!0}var n=kt.macroModeState,i=n.lastInsertModeChanges,o=e.keyName(t);o&&(-1!=o.indexOf("Delete")||-1!=o.indexOf("Backspace"))&&e.lookupKey(o,"vim-insert",r)}function ot(e,t,r,n){function i(){s?_t.processAction(e,t,t.lastEditActionCommand):_t.evalInput(e,t)}function o(r){if(a.lastInsertModeChanges.changes.length>0){r=t.lastEditActionCommand?r:1;var n=a.lastInsertModeChanges;at(e,n.changes,r)}}var a=kt.macroModeState;a.isPlaying=!0;var s=!!t.lastEditActionCommand,l=t.inputState;if(t.inputState=t.lastEditInputState,s&&t.lastEditActionCommand.interlaceInsertRepeat)for(var c=0;r>c;c++)i(),o(1);else n||i(),o(r);t.inputState=l,t.insertMode&&!n&&Ke(e),a.isPlaying=!1}function at(t,r,n){function i(r){return"string"==typeof r?e.commands[r](t):r(t),!0}var o=t.getCursor("head"),a=kt.macroModeState.lastInsertModeChanges.inVisualBlock;if(a){var s=t.state.vim,l=s.lastSelection,c=j(l.anchor,l.head);ee(t,o,c.line+1),n=t.listSelections().length,t.setCursor(o)}for(var u=0;n>u;u++){a&&t.setCursor(R(o,u,0));for(var d=0;d"]),gt=[].concat(ft,pt,ht,["-",'"',".",":","/"]),vt={};b("filetype",void 0,"string",["ft"],function(e,t){if(void 0!==t){if(void 0===e){var r=t.getOption("mode");return"null"==r?"":r}var r=""==e?"null":e;t.setOption("mode",r)}});var yt=function(){function e(e,t,s){function l(t){var i=++n%r,o=a[i];o&&o.clear(),a[i]=e.setBookmark(t)}var c=n%r,u=a[c];if(u){var d=u.find();d&&!$(d,t)&&l(t)}else l(t);l(s),i=n,o=n-r+1,0>o&&(o=0)}function t(e,t){n+=t,n>i?n=i:o>n&&(n=o);var s=a[(r+n)%r];if(s&&!s.find()){var l,c=t>0?1:-1,u=e.getCursor();do if(n+=c,s=a[(r+n)%r],s&&(l=s.find())&&!$(u,l))break;while(i>n&&n>o)}return s}var r=100,n=-1,i=0,o=0,a=new Array(r);return{cachedCursor:void 0,add:e,move:t}},bt=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};w.prototype={exitMacroRecordMode:function(){var e=kt.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1},enterMacroRecordMode:function(e,t){var r=kt.registerController.getRegister(t);r&&(r.clear(),this.latestRegister=t,e.openDialog&&(this.onRecordingDone=e.openDialog("(recording)["+t+"]",null,{bottom:!0})),this.isRecording=!0)}};var kt,xt,wt={buildKeyMap:function(){},getRegisterController:function(){return kt.registerController},resetVimGlobalState_:C,getVimGlobalState_:function(){return kt},maybeInitVimState_:_,suppressErrorLogging:!1,InsertModeKey:nt,map:function(e,t,r){Nt.map(e,t,r)},unmap:function(e,t){Nt.unmap(e,t)},setOption:k,getOption:x,defineOption:b,defineEx:function(e,t,r){if(t){if(0!==e.indexOf(t))throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered')}else t=e;It[e]=r,Nt.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,r){var n=this.findKey(e,t,r);return"function"==typeof n?n():void 0},findKey:function(r,n,i){function o(){var e=kt.macroModeState;if(e.isRecording){if("q"==n)return e.exitMacroRecordMode(),M(r),!0;"mapping"!=i&&Ze(e,n)}}function a(){return""==n?(M(r),d.visualMode?le(r):d.insertMode&&Ke(r),!0):void 0}function s(t){for(var i;t;)i=/<\w+-.+?>|<\w+>|./.exec(t),n=i[0],t=t.substring(i.index+n.length),e.Vim.handleKey(r,n,"mapping")}function l(){if(a())return!0;for(var e=d.inputState.keyBuffer=d.inputState.keyBuffer+n,i=1==n.length,o=_t.matchCommand(e,t,d.inputState,"insert");e.length>1&&"full"!=o.type;){var e=d.inputState.keyBuffer=e.slice(1),s=_t.matchCommand(e,t,d.inputState,"insert");"none"!=s.type&&(o=s)}if("none"==o.type)return M(r),!1;if("partial"==o.type)return xt&&window.clearTimeout(xt),xt=window.setTimeout(function(){d.insertMode&&d.inputState.keyBuffer&&M(r)},x("insertModeEscKeysTimeout")),!i;if(xt&&window.clearTimeout(xt),i){var l=r.getCursor();r.replaceRange("",R(l,0,-(e.length-1)),l,"+input")}return M(r),o.command}function c(){if(o()||a())return!0;var e=d.inputState.keyBuffer=d.inputState.keyBuffer+n;if(/^[1-9]\d*$/.test(e))return!0;var i=/^(\d*)(.*)$/.exec(e);if(!i)return M(r),!1;var s=d.visualMode?"visual":"normal",l=_t.matchCommand(i[2]||i[1],t,d.inputState,s);if("none"==l.type)return M(r),!1;if("partial"==l.type)return!0;d.inputState.keyBuffer="";var i=/^(\d*)(.*)$/.exec(e);return i[1]&&"0"!=i[1]&&d.inputState.pushRepeatDigit(i[1]),l.command}var u,d=_(r);return u=d.insertMode?l():c(),u===!1?void 0:u===!0?function(){}:function(){return r.operation(function(){r.curOp.isVimOp=!0;try{"keyToKey"==u.type?s(u.toKeys):_t.processCommand(r,d,u)}catch(t){throw r.state.vim=void 0,_(r),e.Vim.suppressErrorLogging||console.log(t),t}return!0})}},handleEx:function(e,t){Nt.processCommand(e,t)},defineMotion:O,defineAction:N,defineOperator:I,mapCommand:Ge,_mapCommand:Ve,defineRegister:T,exitVisualMode:le,exitInsertMode:Ke};S.prototype.pushRepeatDigit=function(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)},S.prototype.getRepeat=function(){var e=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(e=1,this.prefixRepeat.length>0&&(e*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(e*=parseInt(this.motionRepeat.join(""),10))),e},L.prototype={setText:function(e,t,r){this.keyBuffer=[e||""],this.linewise=!!t,this.blockwise=!!r},pushText:function(e,t){t&&(this.linewise||this.keyBuffer.push("\n"),this.linewise=!0),this.keyBuffer.push(e)},pushInsertModeChanges:function(e){this.insertModeChanges.push(bt(e))},pushSearchQuery:function(e){this.searchQueries.push(e)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}},A.prototype={pushText:function(e,t,r,n,i){n&&"\n"==r.charAt(0)&&(r=r.slice(1)+"\n"),n&&"\n"!==r.charAt(r.length-1)&&(r+="\n");var o=this.isValidRegister(e)?this.getRegister(e):null;if(!o){switch(t){case"yank":this.registers[0]=new L(r,n,i);break;case"delete":case"change":-1==r.indexOf("\n")?this.registers["-"]=new L(r,n):(this.shiftNumericRegisters_(),this.registers[1]=new L(r,n))}return void this.unnamedRegister.setText(r,n,i)}var a=g(e);a?o.pushText(r,n):o.setText(r,n,i),this.unnamedRegister.setText(o.toString(),n)},getRegister:function(e){return this.isValidRegister(e)?(e=e.toLowerCase(),this.registers[e]||(this.registers[e]=new L),this.registers[e]):this.unnamedRegister},isValidRegister:function(e){return e&&y(e,gt)},shiftNumericRegisters_:function(){for(var e=9;e>=2;e--)this.registers[e]=this.getRegister(""+(e-1))}},E.prototype={nextMatch:function(e,t){var r=this.historyBuffer,n=t?-1:1;null===this.initialPrefix&&(this.initialPrefix=e);for(var i=this.iterator+n;t?i>=0:i=r.length?(this.iterator=r.length,this.initialPrefix):0>i?e:void 0},pushInput:function(e){var t=this.historyBuffer.indexOf(e);t>-1&&this.historyBuffer.splice(t,1),e.length&&this.historyBuffer.push(e)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var _t={matchCommand:function(e,t,r,n){var i=D(e,t,n,r);if(!i.full&&!i.partial)return{type:"none"};if(!i.full&&i.partial)return{type:"partial"};for(var o,a=0;a"==o.keys.slice(-11)&&(r.selectedCharacter=F(e)),{type:"full",command:o}},processCommand:function(e,t,r){switch(t.inputState.repeatOverride=r.repeatOverride,r.type){case"motion":this.processMotion(e,t,r);break;case"operator":this.processOperator(e,t,r);break;case"operatorMotion":this.processOperatorMotion(e,t,r);break;case"action":this.processAction(e,t,r);break;case"search":this.processSearch(e,t,r);break;case"ex":case"keyToEx":this.processEx(e,t,r)}},processMotion:function(e,t,r){t.inputState.motion=r.motion,t.inputState.motionArgs=P(r.motionArgs),this.evalInput(e,t)},processOperator:function(e,t,r){var n=t.inputState;if(n.operator){if(n.operator==r.operator)return n.motion="expandToLine",n.motionArgs={linewise:!0},void this.evalInput(e,t);M(e)}n.operator=r.operator,n.operatorArgs=P(r.operatorArgs),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,r){var n=t.visualMode,i=P(r.operatorMotionArgs);i&&n&&i.visualLine&&(t.visualLine=!0),this.processOperator(e,t,r),n||this.processMotion(e,t,r)},processAction:function(e,t,r){var n=t.inputState,i=n.getRepeat(),o=!!i,a=P(r.actionArgs)||{};n.selectedCharacter&&(a.selectedCharacter=n.selectedCharacter),r.operator&&this.processOperator(e,t,r),r.motion&&this.processMotion(e,t,r),(r.motion||r.operator)&&this.evalInput(e,t),a.repeat=i||1,a.repeatIsExplicit=o,a.registerName=n.registerName,M(e),t.lastMotion=null,r.isEdit&&this.recordLastEdit(t,n,r),Mt[r.action](e,a,t)},processSearch:function(t,r,n){function i(e,i,o){kt.searchHistoryController.pushInput(e),kt.searchHistoryController.reset();try{je(t,e,i,o)}catch(a){return Ne(t,"Invalid regex: "+e),void M(t)}_t.processMotion(t,r,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:n.searchArgs.toJumplist}})}function o(e){t.scrollTo(f.left,f.top),i(e,!0,!0);var r=kt.macroModeState;r.isRecording&&Qe(r,e)}function a(r,n,i){var o,a=e.keyName(r);"Up"==a||"Down"==a?(o="Up"==a?!0:!1,n=kt.searchHistoryController.nextMatch(n,o)||"",i(n)):"Left"!=a&&"Right"!=a&&"Ctrl"!=a&&"Alt"!=a&&"Shift"!=a&&kt.searchHistoryController.reset();var s;try{s=je(t,n,!0,!0)}catch(r){}s?t.scrollIntoView(Fe(t,!l,s),30):(We(t),t.scrollTo(f.left,f.top))}function s(r,n,i){var o=e.keyName(r);"Esc"==o||"Ctrl-C"==o||"Ctrl-["==o||"Backspace"==o&&""==n?(kt.searchHistoryController.pushInput(n),kt.searchHistoryController.reset(),je(t,d),We(t),t.scrollTo(f.left,f.top),e.e_stop(r),M(t),i(),t.focus()):"Ctrl-U"==o&&(e.e_stop(r),i(""))}if(t.getSearchCursor){var l=n.searchArgs.forward,c=n.searchArgs.wholeWordOnly;Me(t).setReversed(!l);var u=l?"/":"?",d=Me(t).getQuery(),f=t.getScrollInfo();switch(n.searchArgs.querySrc){case"prompt":var p=kt.macroModeState;if(p.isPlaying){var h=p.replaySearchQueries.shift();i(h,!0,!1)}else Pe(t,{onClose:o,prefix:u,desc:Ot,onKeyUp:a,onKeyDown:s});break;case"wordUnderCursor":var m=fe(t,!1,!0,!1,!0),g=!0;if(m||(m=fe(t,!1,!0,!1,!1),g=!1),!m)return;var h=t.getLine(m.start.line).substring(m.start.ch,m.end.ch);h=g&&c?"\\b"+h+"\\b":Y(h),kt.jumpList.cachedCursor=t.getCursor(),t.setCursor(m.start),i(h,!0,!1)}}},processEx:function(t,r,n){function i(e){kt.exCommandHistoryController.pushInput(e),kt.exCommandHistoryController.reset(),Nt.processCommand(t,e)}function o(r,n,i){var o,a=e.keyName(r);("Esc"==a||"Ctrl-C"==a||"Ctrl-["==a||"Backspace"==a&&""==n)&&(kt.exCommandHistoryController.pushInput(n),kt.exCommandHistoryController.reset(),e.e_stop(r),M(t),i(),t.focus()),"Up"==a||"Down"==a?(o="Up"==a?!0:!1,n=kt.exCommandHistoryController.nextMatch(n,o)||"",i(n)):"Ctrl-U"==a?(e.e_stop(r),i("")):"Left"!=a&&"Right"!=a&&"Ctrl"!=a&&"Alt"!=a&&"Shift"!=a&&kt.exCommandHistoryController.reset()}"keyToEx"==n.type?Nt.processCommand(t,n.exArgs.input):r.visualMode?Pe(t,{onClose:i,prefix:":",value:"'<,'>",onKeyDown:o}):Pe(t,{onClose:i,prefix:":",onKeyDown:o})},evalInput:function(e,t){var r,i,o,a=t.inputState,s=a.motion,l=a.motionArgs||{},c=a.operator,u=a.operatorArgs||{},d=a.registerName,f=t.sel,p=H(t.visualMode?q(e,f.head):e.getCursor("head")),h=H(t.visualMode?q(e,f.anchor):e.getCursor("anchor")),m=H(p),g=H(h);if(c&&this.recordLastEdit(t,a),o=void 0!==a.repeatOverride?a.repeatOverride:a.getRepeat(),o>0&&l.explicitRepeat?l.repeatIsExplicit=!0:(l.noRepeat||!l.explicitRepeat&&0===o)&&(o=1,l.repeatIsExplicit=!1),a.selectedCharacter&&(l.selectedCharacter=u.selectedCharacter=a.selectedCharacter),l.repeat=o,M(e),s){var v=Ct[s](e,p,l,t);if(t.lastMotion=Ct[s],!v)return;if(l.toJumplist){var y=kt.jumpList,b=y.cachedCursor;b?(pe(e,b,v),delete y.cachedCursor):pe(e,p,v)}v instanceof Array?(i=v[0],r=v[1]):r=v,r||(r=H(p)),t.visualMode?(t.visualBlock&&r.ch===1/0||(r=q(e,r,t.visualBlock)),i&&(i=q(e,i,!0)),i=i||g,f.anchor=i,f.head=r,oe(e),ke(e,t,"<",U(i,r)?i:r),ke(e,t,">",U(i,r)?r:i)):c||(r=q(e,r),e.setCursor(r.line,r.ch))}if(c){if(u.lastSel){i=g;var k=u.lastSel,x=Math.abs(k.head.line-k.anchor.line),w=Math.abs(k.head.ch-k.anchor.ch);r=k.visualLine?n(g.line+x,g.ch):k.visualBlock?n(g.line+x,g.ch+w):k.head.line==k.anchor.line?n(g.line,g.ch+w):n(g.line+x,g.ch),t.visualMode=!0,t.visualLine=k.visualLine,t.visualBlock=k.visualBlock,f=t.sel={anchor:i,head:r},oe(e)}else t.visualMode&&(u.lastSel={anchor:H(f.anchor),head:H(f.head),visualBlock:t.visualBlock,visualLine:t.visualLine});var _,C,S,L,T;if(t.visualMode){if(_=K(f.head,f.anchor),C=V(f.head,f.anchor),S=t.visualLine||u.linewise,L=t.visualBlock?"block":S?"line":"char",T=ae(e,{anchor:_,head:C},L),S){var A=T.ranges;if("block"==L)for(var E=0;El&&o.line==c?this.moveToStartOfLine(e,t,r,i):l>u&&o.line==u?this.moveToEol(e,t,r,i):(r.toFirstChar&&(a=de(e.getLine(l)),i.lastHPos=a),i.lastHSPos=e.charCoords(n(l,a),"div").left,n(l,a))},moveByDisplayLines:function(e,t,r,i){var o=t;switch(i.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:i.lastHSPos=e.charCoords(o,"div").left}var a=r.repeat,s=e.findPosV(o,r.forward?a:-a,"line",i.lastHSPos);if(s.hitSide)if(r.forward)var l=e.charCoords(s,"div"),c={top:l.top+8,left:i.lastHSPos},s=e.coordsChar(c,"div");else{var u=e.charCoords(n(e.firstLine(),0),"div");u.left=i.lastHSPos,s=e.coordsChar(u,"div")}return i.lastHPos=s.ch,s},moveByPage:function(e,t,r){var n=t,i=r.repeat;return e.findPosV(n,r.forward?i:-i,"page")},moveByParagraph:function(e,t,r){var n=r.forward?1:-1;return we(e,t,r.repeat,n)},moveByScroll:function(e,t,r,n){var i=e.getScrollInfo(),o=null,a=r.repeat;a||(a=i.clientHeight/(2*e.defaultTextHeight()));var s=e.charCoords(t,"local");r.repeat=a;var o=Ct.moveByDisplayLines(e,t,r,n);if(!o)return null;var l=e.charCoords(o,"local");return e.scrollTo(null,i.top+l.top-s.top),o},moveByWords:function(e,t,r){return ve(e,t,r.repeat,!!r.forward,!!r.wordEnd,!!r.bigWord)},moveTillCharacter:function(e,t,r){var n=r.repeat,i=ye(e,n,r.forward,r.selectedCharacter),o=r.forward?-1:1;return he(o,r),i?(i.ch+=o,i):null},moveToCharacter:function(e,t,r){var n=r.repeat;return he(0,r),ye(e,n,r.forward,r.selectedCharacter)||t},moveToSymbol:function(e,t,r){var n=r.repeat;return me(e,n,r.forward,r.selectedCharacter)||t},moveToColumn:function(e,t,r,n){var i=r.repeat;return n.lastHPos=i-1,n.lastHSPos=e.charCoords(t,"div").left,be(e,i)},moveToEol:function(e,t,r,i){var o=t;i.lastHPos=1/0;var a=n(o.line+r.repeat-1,1/0),s=e.clipPos(a);return s.ch--,i.lastHSPos=e.charCoords(s,"div").left,a},moveToFirstNonWhiteSpaceCharacter:function(e,t){var r=t;return n(r.line,de(e.getLine(r.line)))},moveToMatchedSymbol:function(e,t){var r,i=t,o=i.line,a=i.ch,s=e.getLine(o);do if(r=s.charAt(a++),r&&h(r)){var l=e.getTokenTypeAt(n(o,a));if("string"!==l&&"comment"!==l)break}while(r);if(r){var c=e.findMatchingBracket(n(o,a));return c.to}return i},moveToStartOfLine:function(e,t){return n(t.line,0)},moveToLineOrEdgeOfDocument:function(e,t,r){var i=r.forward?e.lastLine():e.firstLine();return r.repeatIsExplicit&&(i=r.repeat-e.getOption("firstLineNumber")),n(i,de(e.getLine(i)))},textObjectManipulation:function(e,t,r,n){var i={"(":")",")":"(","{":"}","}":"{","[":"]","]":"["},o={"'":!0,'"':!0},a=r.selectedCharacter;"b"==a?a="(":"B"==a&&(a="{");var s,l=!r.textObjectInner;if(i[a])s=_e(e,t,a,l);else if(o[a])s=Ce(e,t,a,l);else if("W"===a)s=fe(e,l,!0,!0);else if("w"===a)s=fe(e,l,!0,!1);else{if("p"!==a)return null;if(s=we(e,t,r.repeat,0,l),r.linewise=!0,n.visualMode)n.visualLine||(n.visualLine=!0);else{var c=n.inputState.operatorArgs;c&&(c.linewise=!0),s.end.line--}}return e.state.vim.visualMode?ie(e,s.start,s.end):[s.start,s.end]},repeatLastCharacterSearch:function(e,t,r){var n=kt.lastCharacterSearch,i=r.repeat,o=r.forward===n.forward,a=(n.increment?1:0)*(o?-1:1);e.moveH(-a,"char"),r.inclusive=o?!0:!1;var s=ye(e,i,o,n.selectedCharacter);return s?(s.ch+=a,s):(e.moveH(a,"char"),t)}},St={change:function(t,r,i){var o,a,s=t.state.vim;if(kt.macroModeState.lastInsertModeChanges.inVisualBlock=s.visualBlock,s.visualMode){a=t.getSelection();var l=z("",i.length);t.replaceSelections(l),o=K(i[0].head,i[0].anchor)}else{var c=i[0].anchor,u=i[0].head;a=t.getRange(c,u);var d=s.lastEditInputState||{};if("moveByWords"==d.motion&&!v(a)){var f=/\s+$/.exec(a);f&&d.motionArgs&&d.motionArgs.forward&&(u=R(u,0,-f[0].length),a=a.slice(0,-f[0].length))}var p=new n(c.line-1,Number.MAX_VALUE),h=t.firstLine()==t.lastLine();u.line>t.lastLine()&&r.linewise&&!h?t.replaceRange("",p,u):t.replaceRange("",c,u),r.linewise&&(h||(t.setCursor(p),e.commands.newlineAndIndent(t)),c.ch=Number.MAX_VALUE),o=c}kt.registerController.pushText(r.registerName,"change",a,r.linewise,i.length>1),Mt.enterInsertMode(t,{head:o},t.state.vim)},"delete":function(e,t,r){var i,o,a=e.state.vim;if(a.visualBlock){o=e.getSelection();var s=z("",r.length);e.replaceSelections(s),i=r[0].anchor}else{var l=r[0].anchor,c=r[0].head;t.linewise&&c.line!=e.firstLine()&&l.line==e.lastLine()&&l.line==c.line-1&&(l.line==e.firstLine()?l.ch=0:l=n(l.line-1,X(e,l.line-1))),o=e.getRange(l,c),e.replaceRange("",l,c),i=l,t.linewise&&(i=Ct.moveToFirstNonWhiteSpaceCharacter(e,l))}return kt.registerController.pushText(t.registerName,"delete",o,t.linewise,a.visualBlock),q(e,i)},indent:function(e,t,r){var n=e.state.vim,i=r[0].anchor.line,o=n.visualBlock?r[r.length-1].anchor.line:r[0].head.line,a=n.visualMode?t.repeat:1;t.linewise&&o--;for(var s=i;o>=s;s++)for(var l=0;a>l;l++)e.indentLine(s,t.indentRight);return Ct.moveToFirstNonWhiteSpaceCharacter(e,r[0].anchor)},changeCase:function(e,t,r,n,i){for(var o=e.getSelections(),a=[],s=t.toLower,l=0;lc.top?(l.line+=(s-c.top)/i,l.line=Math.ceil(l.line),e.setCursor(l),c=e.charCoords(l,"local"),e.scrollTo(null,c.top)):e.scrollTo(null,s);else{var u=s+e.getScrollInfo().clientHeight;u=a.anchor.line?R(a.head,0,1):n(a.anchor.line,0);else if("inplace"==o&&i.visualMode)return;t.setOption("keyMap","vim-insert"),t.setOption("disableInput",!1),r&&r.replace?(t.toggleOverwrite(!0),t.setOption("keyMap","vim-replace"),e.signal(t,"vim-mode-change",{mode:"replace"})):(t.setOption("keyMap","vim-insert"),e.signal(t,"vim-mode-change",{mode:"insert"})),kt.macroModeState.isPlaying||(t.on("change",Je),e.on(t.getInputField(),"keydown",it)),i.visualMode&&le(t),ee(t,s,l)}},toggleVisualMode:function(t,r,i){var o,a=r.repeat,s=t.getCursor();i.visualMode?i.visualLine^r.linewise||i.visualBlock^r.blockwise?(i.visualLine=!!r.linewise,i.visualBlock=!!r.blockwise,e.signal(t,"vim-mode-change",{mode:"visual",subMode:i.visualLine?"linewise":i.visualBlock?"blockwise":""}),oe(t)):le(t):(i.visualMode=!0,i.visualLine=!!r.linewise,i.visualBlock=!!r.blockwise,o=q(t,n(s.line,s.ch+a-1),!0),i.sel={anchor:s,head:o},e.signal(t,"vim-mode-change",{mode:"visual",subMode:i.visualLine?"linewise":i.visualBlock?"blockwise":""}),oe(t),ke(t,i,"<",K(s,o)),ke(t,i,">",V(s,o)))},reselectLastSelection:function(t,r,n){var i=n.lastSelection;if(n.visualMode&&ne(t,n),i){var o=i.anchorMark.find(),a=i.headMark.find();if(!o||!a)return;n.sel={anchor:o,head:a},n.visualMode=!0,n.visualLine=i.visualLine,n.visualBlock=i.visualBlock,oe(t),ke(t,n,"<",K(o,a)),ke(t,n,">",V(o,a)),e.signal(t,"vim-mode-change",{mode:"visual",subMode:n.visualLine?"linewise":n.visualBlock?"blockwise":""})}},joinLines:function(e,t,r){var i,o;if(r.visualMode){if(i=e.getCursor("anchor"),o=e.getCursor("head"),U(o,i)){var a=o;o=i,i=a}o.ch=X(e,o.line)-1}else{var s=Math.max(t.repeat,2);i=e.getCursor(),o=q(e,n(i.line+s-1,1/0))}for(var l=0,c=i.line;c",V(i,n))}else r.insertMode||(r.lastHPos=t.getCursor().ch)}function nt(e){this.keyName=e}function it(t){function r(){return i.changes.push(new nt(o)),!0}var n=kt.macroModeState,i=n.lastInsertModeChanges,o=e.keyName(t);o&&(-1!=o.indexOf("Delete")||-1!=o.indexOf("Backspace"))&&e.lookupKey(o,"vim-insert",r)}function ot(e,t,r,n){function i(){s?_t.processAction(e,t,t.lastEditActionCommand):_t.evalInput(e,t)}function o(r){if(a.lastInsertModeChanges.changes.length>0){r=t.lastEditActionCommand?r:1;var n=a.lastInsertModeChanges;at(e,n.changes,r)}}var a=kt.macroModeState;a.isPlaying=!0;var s=!!t.lastEditActionCommand,l=t.inputState;if(t.inputState=t.lastEditInputState,s&&t.lastEditActionCommand.interlaceInsertRepeat)for(var c=0;r>c;c++)i(),o(1);else n||i(),o(r);t.inputState=l,t.insertMode&&!n&&Ke(e),a.isPlaying=!1}function at(t,r,n){function i(r){return"string"==typeof r?e.commands[r](t):r(t),!0}var o=t.getCursor("head"),a=kt.macroModeState.lastInsertModeChanges.inVisualBlock;if(a){var s=t.state.vim,l=s.lastSelection,c=j(l.anchor,l.head);ee(t,o,c.line+1),n=t.listSelections().length,t.setCursor(o)}for(var u=0;n>u;u++){a&&t.setCursor(R(o,u,0));for(var f=0;f"]),gt=[].concat(dt,pt,ht,["-",'"',".",":","/"]),vt={};b("filetype",void 0,"string",["ft"],function(e,t){if(void 0!==t){if(void 0===e){var r=t.getOption("mode");return"null"==r?"":r}var r=""==e?"null":e;t.setOption("mode",r)}});var yt=function(){function e(e,t,s){function l(t){var i=++n%r,o=a[i];o&&o.clear(),a[i]=e.setBookmark(t)}var c=n%r,u=a[c];if(u){var f=u.find();f&&!$(f,t)&&l(t)}else l(t);l(s),i=n,o=n-r+1,0>o&&(o=0)}function t(e,t){n+=t,n>i?n=i:o>n&&(n=o);var s=a[(r+n)%r];if(s&&!s.find()){var l,c=t>0?1:-1,u=e.getCursor();do if(n+=c,s=a[(r+n)%r],s&&(l=s.find())&&!$(u,l))break;while(i>n&&n>o)}return s}var r=100,n=-1,i=0,o=0,a=new Array(r);return{cachedCursor:void 0,add:e,move:t}},bt=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};w.prototype={exitMacroRecordMode:function(){var e=kt.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1},enterMacroRecordMode:function(e,t){var r=kt.registerController.getRegister(t);r&&(r.clear(),this.latestRegister=t,e.openDialog&&(this.onRecordingDone=e.openDialog("(recording)["+t+"]",null,{bottom:!0})),this.isRecording=!0)}};var kt,xt,wt={buildKeyMap:function(){},getRegisterController:function(){return kt.registerController},resetVimGlobalState_:C,getVimGlobalState_:function(){return kt},maybeInitVimState_:_,suppressErrorLogging:!1,InsertModeKey:nt,map:function(e,t,r){Nt.map(e,t,r)},setOption:k,getOption:x,defineOption:b,defineEx:function(e,t,r){if(t){if(0!==e.indexOf(t))throw new Error('(Vim.defineEx) "'+t+'" is not a prefix of "'+e+'", command not registered')}else t=e;It[e]=r,Nt.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,r){var n=this.findKey(e,t,r);return"function"==typeof n?n():void 0},findKey:function(r,n,i){function o(){var e=kt.macroModeState;if(e.isRecording){if("q"==n)return e.exitMacroRecordMode(),M(r),!0;"mapping"!=i&&Ze(e,n)}}function a(){return""==n?(M(r),f.visualMode?le(r):f.insertMode&&Ke(r),!0):void 0}function s(t){for(var i;t;)i=/<\w+-.+?>|<\w+>|./.exec(t),n=i[0],t=t.substring(i.index+n.length),e.Vim.handleKey(r,n,"mapping")}function l(){if(a())return!0;for(var e=f.inputState.keyBuffer=f.inputState.keyBuffer+n,i=1==n.length,o=_t.matchCommand(e,t,f.inputState,"insert");e.length>1&&"full"!=o.type;){var e=f.inputState.keyBuffer=e.slice(1),s=_t.matchCommand(e,t,f.inputState,"insert");"none"!=s.type&&(o=s)}if("none"==o.type)return M(r),!1;if("partial"==o.type)return xt&&window.clearTimeout(xt),xt=window.setTimeout(function(){f.insertMode&&f.inputState.keyBuffer&&M(r)},x("insertModeEscKeysTimeout")),!i;if(xt&&window.clearTimeout(xt),i){var l=r.getCursor();r.replaceRange("",R(l,0,-(e.length-1)),l,"+input")}return M(r),o.command}function c(){if(o()||a())return!0;var e=f.inputState.keyBuffer=f.inputState.keyBuffer+n;if(/^[1-9]\d*$/.test(e))return!0;var i=/^(\d*)(.*)$/.exec(e);if(!i)return M(r),!1;var s=f.visualMode?"visual":"normal",l=_t.matchCommand(i[2]||i[1],t,f.inputState,s);if("none"==l.type)return M(r),!1;if("partial"==l.type)return!0;f.inputState.keyBuffer="";var i=/^(\d*)(.*)$/.exec(e);return i[1]&&"0"!=i[1]&&f.inputState.pushRepeatDigit(i[1]),l.command}var u,f=_(r);return u=f.insertMode?l():c(),u===!1?void 0:u===!0?function(){}:function(){return r.operation(function(){r.curOp.isVimOp=!0;try{"keyToKey"==u.type?s(u.toKeys):_t.processCommand(r,f,u)}catch(t){throw r.state.vim=void 0,_(r),e.Vim.suppressErrorLogging||console.log(t),t}return!0})}},handleEx:function(e,t){Nt.processCommand(e,t)},defineMotion:O,defineAction:N,defineOperator:I,mapCommand:Ge,_mapCommand:Ve,defineRegister:T,exitVisualMode:le,exitInsertMode:Ke};S.prototype.pushRepeatDigit=function(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)},S.prototype.getRepeat=function(){var e=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(e=1,this.prefixRepeat.length>0&&(e*=parseInt(this.prefixRepeat.join(""),10)),this.motionRepeat.length>0&&(e*=parseInt(this.motionRepeat.join(""),10))),e},L.prototype={setText:function(e,t,r){this.keyBuffer=[e||""],this.linewise=!!t,this.blockwise=!!r},pushText:function(e,t){t&&(this.linewise||this.keyBuffer.push("\n"),this.linewise=!0),this.keyBuffer.push(e)},pushInsertModeChanges:function(e){this.insertModeChanges.push(bt(e))},pushSearchQuery:function(e){this.searchQueries.push(e)},clear:function(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1},toString:function(){return this.keyBuffer.join("")}},A.prototype={pushText:function(e,t,r,n,i){n&&"\n"==r.charAt(0)&&(r=r.slice(1)+"\n"),n&&"\n"!==r.charAt(r.length-1)&&(r+="\n");var o=this.isValidRegister(e)?this.getRegister(e):null;if(!o){switch(t){case"yank":this.registers[0]=new L(r,n,i);break;case"delete":case"change":-1==r.indexOf("\n")?this.registers["-"]=new L(r,n):(this.shiftNumericRegisters_(),this.registers[1]=new L(r,n))}return void this.unnamedRegister.setText(r,n,i)}var a=g(e);a?o.pushText(r,n):o.setText(r,n,i),this.unnamedRegister.setText(o.toString(),n)},getRegister:function(e){return this.isValidRegister(e)?(e=e.toLowerCase(),this.registers[e]||(this.registers[e]=new L),this.registers[e]):this.unnamedRegister},isValidRegister:function(e){return e&&y(e,gt)},shiftNumericRegisters_:function(){for(var e=9;e>=2;e--)this.registers[e]=this.getRegister(""+(e-1))}},E.prototype={nextMatch:function(e,t){var r=this.historyBuffer,n=t?-1:1;null===this.initialPrefix&&(this.initialPrefix=e);for(var i=this.iterator+n;t?i>=0:i=r.length?(this.iterator=r.length,this.initialPrefix):0>i?e:void 0},pushInput:function(e){var t=this.historyBuffer.indexOf(e);t>-1&&this.historyBuffer.splice(t,1),e.length&&this.historyBuffer.push(e)},reset:function(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}};var _t={matchCommand:function(e,t,r,n){var i=D(e,t,n,r);if(!i.full&&!i.partial)return{type:"none"};if(!i.full&&i.partial)return{type:"partial"};for(var o,a=0;a"==o.keys.slice(-11)&&(r.selectedCharacter=W(e)),{type:"full",command:o}},processCommand:function(e,t,r){switch(t.inputState.repeatOverride=r.repeatOverride,r.type){case"motion":this.processMotion(e,t,r);break;case"operator":this.processOperator(e,t,r);break;case"operatorMotion":this.processOperatorMotion(e,t,r);break;case"action":this.processAction(e,t,r);break;case"search":this.processSearch(e,t,r);break;case"ex":case"keyToEx":this.processEx(e,t,r)}},processMotion:function(e,t,r){t.inputState.motion=r.motion,t.inputState.motionArgs=P(r.motionArgs),this.evalInput(e,t)},processOperator:function(e,t,r){var n=t.inputState;if(n.operator){if(n.operator==r.operator)return n.motion="expandToLine",n.motionArgs={linewise:!0},void this.evalInput(e,t);M(e)}n.operator=r.operator,n.operatorArgs=P(r.operatorArgs),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,r){var n=t.visualMode,i=P(r.operatorMotionArgs);i&&n&&i.visualLine&&(t.visualLine=!0),this.processOperator(e,t,r),n||this.processMotion(e,t,r)},processAction:function(e,t,r){var n=t.inputState,i=n.getRepeat(),o=!!i,a=P(r.actionArgs)||{};n.selectedCharacter&&(a.selectedCharacter=n.selectedCharacter),r.operator&&this.processOperator(e,t,r),r.motion&&this.processMotion(e,t,r),(r.motion||r.operator)&&this.evalInput(e,t),a.repeat=i||1,a.repeatIsExplicit=o,a.registerName=n.registerName,M(e),t.lastMotion=null,r.isEdit&&this.recordLastEdit(t,n,r),Mt[r.action](e,a,t)},processSearch:function(t,r,n){function i(e,i,o){kt.searchHistoryController.pushInput(e),kt.searchHistoryController.reset();try{je(t,e,i,o)}catch(a){return Ne(t,"Invalid regex: "+e),void M(t)}_t.processMotion(t,r,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:n.searchArgs.toJumplist}})}function o(e){t.scrollTo(d.left,d.top),i(e,!0,!0);var r=kt.macroModeState;r.isRecording&&Qe(r,e)}function a(r,n,i){var o,a=e.keyName(r);"Up"==a||"Down"==a?(o="Up"==a?!0:!1,n=kt.searchHistoryController.nextMatch(n,o)||"",i(n)):"Left"!=a&&"Right"!=a&&"Ctrl"!=a&&"Alt"!=a&&"Shift"!=a&&kt.searchHistoryController.reset();var s;try{s=je(t,n,!0,!0)}catch(r){}s?t.scrollIntoView(We(t,!l,s),30):(Fe(t),t.scrollTo(d.left,d.top))}function s(r,n,i){var o=e.keyName(r);"Esc"==o||"Ctrl-C"==o||"Ctrl-["==o||"Backspace"==o&&""==n?(kt.searchHistoryController.pushInput(n),kt.searchHistoryController.reset(),je(t,f),Fe(t),t.scrollTo(d.left,d.top),e.e_stop(r),M(t),i(),t.focus()):"Ctrl-U"==o&&(e.e_stop(r),i(""))}if(t.getSearchCursor){var l=n.searchArgs.forward,c=n.searchArgs.wholeWordOnly;Me(t).setReversed(!l);var u=l?"/":"?",f=Me(t).getQuery(),d=t.getScrollInfo();switch(n.searchArgs.querySrc){case"prompt":var p=kt.macroModeState;if(p.isPlaying){var h=p.replaySearchQueries.shift();i(h,!0,!1)}else Pe(t,{onClose:o,prefix:u,desc:Ot,onKeyUp:a,onKeyDown:s});break;case"wordUnderCursor":var m=de(t,!1,!0,!1,!0),g=!0;if(m||(m=de(t,!1,!0,!1,!1),g=!1),!m)return;var h=t.getLine(m.start.line).substring(m.start.ch,m.end.ch);h=g&&c?"\\b"+h+"\\b":Y(h),kt.jumpList.cachedCursor=t.getCursor(),t.setCursor(m.start),i(h,!0,!1)}}},processEx:function(t,r,n){function i(e){kt.exCommandHistoryController.pushInput(e),kt.exCommandHistoryController.reset(),Nt.processCommand(t,e)}function o(r,n,i){var o,a=e.keyName(r);("Esc"==a||"Ctrl-C"==a||"Ctrl-["==a||"Backspace"==a&&""==n)&&(kt.exCommandHistoryController.pushInput(n),kt.exCommandHistoryController.reset(),e.e_stop(r),M(t),i(),t.focus()),"Up"==a||"Down"==a?(o="Up"==a?!0:!1,n=kt.exCommandHistoryController.nextMatch(n,o)||"",i(n)):"Ctrl-U"==a?(e.e_stop(r),i("")):"Left"!=a&&"Right"!=a&&"Ctrl"!=a&&"Alt"!=a&&"Shift"!=a&&kt.exCommandHistoryController.reset()}"keyToEx"==n.type?Nt.processCommand(t,n.exArgs.input):r.visualMode?Pe(t,{onClose:i,prefix:":",value:"'<,'>",onKeyDown:o}):Pe(t,{onClose:i,prefix:":",onKeyDown:o})},evalInput:function(e,t){var r,i,o,a=t.inputState,s=a.motion,l=a.motionArgs||{},c=a.operator,u=a.operatorArgs||{},f=a.registerName,d=t.sel,p=H(t.visualMode?q(e,d.head):e.getCursor("head")),h=H(t.visualMode?q(e,d.anchor):e.getCursor("anchor")),m=H(p),g=H(h);if(c&&this.recordLastEdit(t,a),o=void 0!==a.repeatOverride?a.repeatOverride:a.getRepeat(),o>0&&l.explicitRepeat?l.repeatIsExplicit=!0:(l.noRepeat||!l.explicitRepeat&&0===o)&&(o=1,l.repeatIsExplicit=!1),a.selectedCharacter&&(l.selectedCharacter=u.selectedCharacter=a.selectedCharacter),l.repeat=o,M(e),s){var v=Ct[s](e,p,l,t);if(t.lastMotion=Ct[s],!v)return;if(l.toJumplist){var y=kt.jumpList,b=y.cachedCursor;b?(pe(e,b,v),delete y.cachedCursor):pe(e,p,v)}v instanceof Array?(i=v[0],r=v[1]):r=v,r||(r=H(p)),t.visualMode?(t.visualBlock&&r.ch===1/0||(r=q(e,r,t.visualBlock)),i&&(i=q(e,i,!0)),i=i||g,d.anchor=i,d.head=r,oe(e),ke(e,t,"<",U(i,r)?i:r),ke(e,t,">",U(i,r)?r:i)):c||(r=q(e,r),e.setCursor(r.line,r.ch))}if(c){if(u.lastSel){i=g;var k=u.lastSel,x=Math.abs(k.head.line-k.anchor.line),w=Math.abs(k.head.ch-k.anchor.ch);r=k.visualLine?n(g.line+x,g.ch):k.visualBlock?n(g.line+x,g.ch+w):k.head.line==k.anchor.line?n(g.line,g.ch+w):n(g.line+x,g.ch),t.visualMode=!0,t.visualLine=k.visualLine,t.visualBlock=k.visualBlock,d=t.sel={anchor:i,head:r},oe(e)}else t.visualMode&&(u.lastSel={anchor:H(d.anchor),head:H(d.head),visualBlock:t.visualBlock,visualLine:t.visualLine});var _,C,S,L,T;if(t.visualMode){if(_=K(d.head,d.anchor),C=V(d.head,d.anchor),S=t.visualLine||u.linewise,L=t.visualBlock?"block":S?"line":"char",T=ae(e,{anchor:_,head:C},L),S){var A=T.ranges;if("block"==L)for(var E=0;El&&o.line==c||l>u&&o.line==u?void 0:(r.toFirstChar&&(a=fe(e.getLine(l)),i.lastHPos=a),i.lastHSPos=e.charCoords(n(l,a),"div").left,n(l,a))},moveByDisplayLines:function(e,t,r,i){var o=t;switch(i.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:i.lastHSPos=e.charCoords(o,"div").left}var a=r.repeat,s=e.findPosV(o,r.forward?a:-a,"line",i.lastHSPos);if(s.hitSide)if(r.forward)var l=e.charCoords(s,"div"),c={top:l.top+8,left:i.lastHSPos},s=e.coordsChar(c,"div");else{var u=e.charCoords(n(e.firstLine(),0),"div");u.left=i.lastHSPos,s=e.coordsChar(u,"div")}return i.lastHPos=s.ch,s},moveByPage:function(e,t,r){var n=t,i=r.repeat;return e.findPosV(n,r.forward?i:-i,"page")},moveByParagraph:function(e,t,r){var n=r.forward?1:-1;return we(e,t,r.repeat,n)},moveByScroll:function(e,t,r,n){var i=e.getScrollInfo(),o=null,a=r.repeat;a||(a=i.clientHeight/(2*e.defaultTextHeight()));var s=e.charCoords(t,"local");r.repeat=a;var o=Ct.moveByDisplayLines(e,t,r,n);if(!o)return null;var l=e.charCoords(o,"local");return e.scrollTo(null,i.top+l.top-s.top),o},moveByWords:function(e,t,r){return ve(e,t,r.repeat,!!r.forward,!!r.wordEnd,!!r.bigWord)},moveTillCharacter:function(e,t,r){var n=r.repeat,i=ye(e,n,r.forward,r.selectedCharacter),o=r.forward?-1:1;return he(o,r),i?(i.ch+=o,i):null},moveToCharacter:function(e,t,r){var n=r.repeat;return he(0,r),ye(e,n,r.forward,r.selectedCharacter)||t},moveToSymbol:function(e,t,r){var n=r.repeat;return me(e,n,r.forward,r.selectedCharacter)||t},moveToColumn:function(e,t,r,n){var i=r.repeat;return n.lastHPos=i-1,n.lastHSPos=e.charCoords(t,"div").left,be(e,i)},moveToEol:function(e,t,r,i){var o=t;i.lastHPos=1/0;var a=n(o.line+r.repeat-1,1/0),s=e.clipPos(a);return s.ch--,i.lastHSPos=e.charCoords(s,"div").left,a},moveToFirstNonWhiteSpaceCharacter:function(e,t){var r=t;return n(r.line,fe(e.getLine(r.line)))},moveToMatchedSymbol:function(e,t){var r,i=t,o=i.line,a=i.ch,s=e.getLine(o);do if(r=s.charAt(a++),r&&h(r)){var l=e.getTokenTypeAt(n(o,a));if("string"!==l&&"comment"!==l)break}while(r);if(r){var c=e.findMatchingBracket(n(o,a));return c.to}return i},moveToStartOfLine:function(e,t){return n(t.line,0)},moveToLineOrEdgeOfDocument:function(e,t,r){var i=r.forward?e.lastLine():e.firstLine();return r.repeatIsExplicit&&(i=r.repeat-e.getOption("firstLineNumber")),n(i,fe(e.getLine(i)))},textObjectManipulation:function(e,t,r,n){var i={"(":")",")":"(","{":"}","}":"{","[":"]","]":"["},o={"'":!0,'"':!0},a=r.selectedCharacter;"b"==a?a="(":"B"==a&&(a="{");var s,l=!r.textObjectInner;if(i[a])s=_e(e,t,a,l);else if(o[a])s=Ce(e,t,a,l);else if("W"===a)s=de(e,l,!0,!0);else if("w"===a)s=de(e,l,!0,!1);else{if("p"!==a)return null;if(s=we(e,t,r.repeat,0,l),r.linewise=!0,n.visualMode)n.visualLine||(n.visualLine=!0);else{var c=n.inputState.operatorArgs;c&&(c.linewise=!0),s.end.line--}}return e.state.vim.visualMode?ie(e,s.start,s.end):[s.start,s.end]},repeatLastCharacterSearch:function(e,t,r){var n=kt.lastChararacterSearch,i=r.repeat,o=r.forward===n.forward,a=(n.increment?1:0)*(o?-1:1);e.moveH(-a,"char"),r.inclusive=o?!0:!1;var s=ye(e,i,o,n.selectedCharacter);return s?(s.ch+=a,s):(e.moveH(a,"char"),t)}},St={change:function(t,r,i){var o,a,s=t.state.vim;if(kt.macroModeState.lastInsertModeChanges.inVisualBlock=s.visualBlock,s.visualMode){a=t.getSelection();var l=z("",i.length);t.replaceSelections(l),o=K(i[0].head,i[0].anchor)}else{var c=i[0].anchor,u=i[0].head;a=t.getRange(c,u);var f=s.lastEditInputState||{};if("moveByWords"==f.motion&&!v(a)){var d=/\s+$/.exec(a);d&&f.motionArgs&&f.motionArgs.forward&&(u=R(u,0,-d[0].length),a=a.slice(0,-d[0].length))}var p=new n(c.line-1,Number.MAX_VALUE),h=t.firstLine()==t.lastLine();u.line>t.lastLine()&&r.linewise&&!h?t.replaceRange("",p,u):t.replaceRange("",c,u),r.linewise&&(h||(t.setCursor(p),e.commands.newlineAndIndent(t)),c.ch=Number.MAX_VALUE),o=c}kt.registerController.pushText(r.registerName,"change",a,r.linewise,i.length>1),Mt.enterInsertMode(t,{head:o},t.state.vim)},"delete":function(e,t,r){var i,o,a=e.state.vim;if(a.visualBlock){o=e.getSelection();var s=z("",r.length);e.replaceSelections(s),i=r[0].anchor}else{var l=r[0].anchor,c=r[0].head;t.linewise&&c.line!=e.firstLine()&&l.line==e.lastLine()&&l.line==c.line-1&&(l.line==e.firstLine()?l.ch=0:l=n(l.line-1,X(e,l.line-1))),o=e.getRange(l,c),e.replaceRange("",l,c),i=l,t.linewise&&(i=Ct.moveToFirstNonWhiteSpaceCharacter(e,l))}return kt.registerController.pushText(t.registerName,"delete",o,t.linewise,a.visualBlock),q(e,i)},indent:function(e,t,r){var n=e.state.vim,i=r[0].anchor.line,o=n.visualBlock?r[r.length-1].anchor.line:r[0].head.line,a=n.visualMode?t.repeat:1;t.linewise&&o--;for(var s=i;o>=s;s++)for(var l=0;a>l;l++)e.indentLine(s,t.indentRight);return Ct.moveToFirstNonWhiteSpaceCharacter(e,r[0].anchor)},changeCase:function(e,t,r,n,i){for(var o=e.getSelections(),a=[],s=t.toLower,l=0;lc.top?(l.line+=(s-c.top)/i,l.line=Math.ceil(l.line),e.setCursor(l),c=e.charCoords(l,"local"),e.scrollTo(null,c.top)):e.scrollTo(null,s);else{var u=s+e.getScrollInfo().clientHeight;u=a.anchor.line?R(a.head,0,1):n(a.anchor.line,0);else if("inplace"==o&&i.visualMode)return;t.setOption("keyMap","vim-insert"),t.setOption("disableInput",!1),r&&r.replace?(t.toggleOverwrite(!0),t.setOption("keyMap","vim-replace"),e.signal(t,"vim-mode-change",{mode:"replace"})):(t.setOption("keyMap","vim-insert"),e.signal(t,"vim-mode-change",{mode:"insert"})),kt.macroModeState.isPlaying||(t.on("change",Je),e.on(t.getInputField(),"keydown",it)),i.visualMode&&le(t),ee(t,s,l)}},toggleVisualMode:function(t,r,i){var o,a=r.repeat,s=t.getCursor();i.visualMode?i.visualLine^r.linewise||i.visualBlock^r.blockwise?(i.visualLine=!!r.linewise,i.visualBlock=!!r.blockwise,e.signal(t,"vim-mode-change",{mode:"visual",subMode:i.visualLine?"linewise":i.visualBlock?"blockwise":""}),oe(t)):le(t):(i.visualMode=!0,i.visualLine=!!r.linewise,i.visualBlock=!!r.blockwise,o=q(t,n(s.line,s.ch+a-1),!0),i.sel={anchor:s,head:o},e.signal(t,"vim-mode-change",{mode:"visual",subMode:i.visualLine?"linewise":i.visualBlock?"blockwise":""}),oe(t),ke(t,i,"<",K(s,o)),ke(t,i,">",V(s,o)))},reselectLastSelection:function(t,r,n){var i=n.lastSelection;if(n.visualMode&&ne(t,n),i){var o=i.anchorMark.find(),a=i.headMark.find();if(!o||!a)return;n.sel={anchor:o,head:a},n.visualMode=!0,n.visualLine=i.visualLine,n.visualBlock=i.visualBlock,oe(t),ke(t,n,"<",K(o,a)),ke(t,n,">",V(o,a)),e.signal(t,"vim-mode-change",{mode:"visual",subMode:n.visualLine?"linewise":n.visualBlock?"blockwise":""})}},joinLines:function(e,t,r){var i,o;if(r.visualMode){if(i=e.getCursor("anchor"),o=e.getCursor("head"),U(o,i)){var a=o;o=i,i=a}o.ch=X(e,o.line)-1}else{var s=Math.max(t.repeat,2);i=e.getCursor(),o=q(e,n(i.line+s-1,1/0))}for(var l=0,c=i.line;cr)return"";if(e.getOption("indentWithTabs")){var n=Math.floor(r/s);return Array(n+1).join(" ")}return Array(r+1).join(" ")});a+=d?"\n":""}if(t.repeat>1)var a=Array(t.repeat+1).join(a);var h=o.linewise,m=o.blockwise;if(h)r.visualMode?a=r.visualLine?a.slice(0,-1):"\n"+a.slice(0,a.length-1)+"\n":t.after?(a="\n"+a.slice(0,a.length-1),i.ch=X(e,i.line)):i.ch=0;else{if(m){a=a.split("\n");for(var g=0;ge.lastLine()&&e.replaceRange("\n",n(M,0));var L=X(e,M);Lu.length&&(o=u.length),a=n(l.line,o)}if("\n"==s)i.visualMode||t.replaceRange("",l,a),(e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent)(t);else{var f=t.getRange(l,a);if(f=f.replace(/[^\n]/g,s),i.visualBlock){var d=new Array(t.getOption("tabSize")+1).join(" ");f=t.getSelection(),f=f.replace(/\t/g,d).replace(/[^\n]/g,s).split("\n"),t.replaceSelections(f)}else t.replaceRange(f,l,a);i.visualMode?(l=U(c[0].anchor,c[0].head)?c[0].anchor:c[0].head,t.setCursor(l),le(t,!1)):t.setCursor(R(a,0,-1))}},incrementNumberToken:function(e,t){for(var r,i,o,a,s,l=e.getCursor(),c=e.getLine(l.line),u=/-?\d+/g;null!==(r=u.exec(c))&&(s=r[0],i=r.index,o=i+s.length,!(l.ch=1)return!0}else e.nextCh===e.reverseSymb&&e.depth--;return!1}},section:{init:function(e){e.curMoveThrough=!0,e.symb=(e.forward?"]":"[")===e.symb?"{":"}"},isComplete:function(e){return 0===e.index&&e.nextCh===e.symb}},comment:{isComplete:function(e){var t="*"===e.lastCh&&"/"===e.nextCh;return e.lastCh=e.nextCh,t}},method:{init:function(e){e.symb="m"===e.symb?"{":"}",e.reverseSymb="{"===e.symb?"}":"{"},isComplete:function(e){return e.nextCh===e.symb?!0:!1}},preprocess:{init:function(e){e.index=0},isComplete:function(e){if("#"===e.nextCh){var t=e.lineText.match(/#(\w+)/)[1];if("endif"===t){if(e.forward&&0===e.depth)return!0;e.depth++}else if("if"===t){if(!e.forward&&0===e.depth)return!0;e.depth--}if("else"===t&&0===e.depth)return!0}return!1}}};b("pcre",!0,"boolean"),Se.prototype={getQuery:function(){return kt.query},setQuery:function(e){kt.query=e},getOverlay:function(){return this.searchOverlay},setOverlay:function(e){this.searchOverlay=e},isReversed:function(){return kt.isReversed},setReversed:function(e){kt.isReversed=e},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(e){this.annotate=e}};var At={"\\n":"\n","\\r":"\r","\\t":" "},Et={"\\/":"/","\\\\":"\\","\\n":"\n","\\r":"\r","\\t":" "},Ot="(Javascript regexp)",zt=function(){this.buildCommandMap_()};zt.prototype={processCommand:function(e,t,r){var n=this;e.operation(function(){e.curOp.isVimOp=!0,n._processCommand(e,t,r)})},_processCommand:function(t,r,n){var i=t.state.vim,o=kt.registerController.getRegister(":"),a=o.toString();i.visualMode&&le(t);var s=new e.StringStream(r);o.setText(r);var l=n||{};l.input=r;try{this.parseInput_(t,s,l)}catch(c){throw Ne(t,c),c}var u,f;if(l.commandName){if(u=this.matchCommand_(l.commandName)){if(f=u.name,u.excludeFromCommandHistory&&o.setText(a),this.parseCommandArgs_(s,l,u),"exToKey"==u.type){for(var d=0;d0;t--){var r=e.substring(0,t);if(this.commandMap_[r]){var n=this.commandMap_[r];if(0===n.name.indexOf(e))return n}}return null},buildCommandMap_:function(){this.commandMap_={};for(var e=0;e
";if(r){var o;r=r.join("");for(var a=0;a"}}else for(var o in n){var l=n[o].toString();l.length&&(i+='"'+o+" "+l+"
")}Ne(e,i)},sort:function(t,r){function i(){if(r.argString){var t=new e.StringStream(r.argString);if(t.eat("!")&&(a=!0),t.eol())return;if(!t.eatSpace())return"Invalid arguments";var n=t.match(/[a-z]+/);if(n){n=n[0],s=-1!=n.indexOf("i"),l=-1!=n.indexOf("u");var i=-1!=n.indexOf("d")&&1,o=-1!=n.indexOf("x")&&1,u=-1!=n.indexOf("o")&&1;if(i+o+u>1)return"Invalid arguments";c=i&&"decimal"||o&&"hex"||u&&"octal"}if(t.match(/\/.*\//))return"patterns not supported"}}function o(e,t){if(a){var r;r=e,e=t,t=r}s&&(e=e.toLowerCase(),t=t.toLowerCase());var n=c&&g.exec(e),i=c&&g.exec(t);return n?(n=parseInt((n[1]+n[2]).toLowerCase(),v),i=parseInt((i[1]+i[2]).toLowerCase(),v),n-i):t>e?-1:1}var a,s,l,c,u=i();if(u)return void Ne(t,u+": "+r.argString);var f=r.line||t.firstLine(),d=r.lineEnd||r.line||t.lastLine();if(f!=d){var p=n(f,0),h=n(d,X(t,d)),m=t.getRange(p,h).split("\n"),g="decimal"==c?/(-?)([\d]+)/:"hex"==c?/(-?)(?:0x)?([0-9a-f]+)/i:"octal"==c?/([0-7]+)/:null,v="decimal"==c?10:"hex"==c?16:"octal"==c?8:null,y=[],b=[];if(c)for(var k=0;k=d;d++){var p=c.test(e.getLine(d));p&&(u.push(d+1),f+=e.getLine(d)+"
")}if(!n)return void Ne(e,f);var h=0,m=function(){if(h=u)return void Ne(t,"Invalid argument: "+r.argString.substring(o));for(var f=0;u-c>=f;f++){var d=String.fromCharCode(c+f);delete n.marks[d]}}else delete n.marks[a]}}},Nt=new zt;return e.keyMap.vim={attach:s,detach:a,call:l},b("insertModeEscKeysTimeout",200,"number"),e.keyMap["vim-insert"]={"Ctrl-N":"autocomplete","Ctrl-P":"autocomplete",Enter:function(t){var r=e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent;r(t)},fallthrough:["default"],attach:s,detach:a,call:l},e.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:s,detach:a,call:l},C(),wt};e.Vim=i()}); \ No newline at end of file +var o=H(t.getCursor());if(o.line!==t.firstLine()||r.after){o.line=r.after?o.line:o.line-1,o.ch=X(t,o.line),t.setCursor(o);var a=e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent;a(t)}else t.replaceRange("\n",n(t.firstLine(),0)),t.setCursor(t.firstLine(),0);this.enterInsertMode(t,{repeat:r.repeat},i)},paste:function(e,t,r){var i=H(e.getCursor()),o=kt.registerController.getRegister(t.registerName),a=o.toString();if(a){if(t.matchIndent){var s=e.getOption("tabSize"),l=function(e){var t=e.split(" ").length-1,r=e.split(" ").length-1;return t*s+1*r},c=e.getLine(e.getCursor().line),u=l(c.match(/^\s*/)[0]),d=a.replace(/\n$/,""),f=a!==d,p=l(a.match(/^\s*/)[0]),a=d.replace(/^\s*/gm,function(t){var r=u+(l(t)-p);if(0>r)return"";if(e.getOption("indentWithTabs")){var n=Math.floor(r/s);return Array(n+1).join(" ")}return Array(r+1).join(" ")});a+=f?"\n":""}if(t.repeat>1)var a=Array(t.repeat+1).join(a);var h=o.linewise,m=o.blockwise;if(h)r.visualMode?a=r.visualLine?a.slice(0,-1):"\n"+a.slice(0,a.length-1)+"\n":t.after?(a="\n"+a.slice(0,a.length-1),i.ch=X(e,i.line)):i.ch=0;else{if(m){a=a.split("\n");for(var g=0;ge.lastLine()&&e.replaceRange("\n",n(M,0));var L=X(e,M);Lu.length&&(o=u.length),a=n(l.line,o)}if("\n"==s)i.visualMode||t.replaceRange("",l,a),(e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent)(t);else{var d=t.getRange(l,a);if(d=d.replace(/[^\n]/g,s),i.visualBlock){var f=new Array(t.getOption("tabSize")+1).join(" ");d=t.getSelection(),d=d.replace(/\t/g,f).replace(/[^\n]/g,s).split("\n"),t.replaceSelections(d)}else t.replaceRange(d,l,a);i.visualMode?(l=U(c[0].anchor,c[0].head)?c[0].anchor:c[0].head,t.setCursor(l),le(t,!1)):t.setCursor(R(a,0,-1))}},incrementNumberToken:function(e,t){for(var r,i,o,a,s,l=e.getCursor(),c=e.getLine(l.line),u=/-?\d+/g;null!==(r=u.exec(c))&&(s=r[0],i=r.index,o=i+s.length,!(l.ch=1)return!0}else e.nextCh===e.reverseSymb&&e.depth--;return!1}},section:{init:function(e){e.curMoveThrough=!0,e.symb=(e.forward?"]":"[")===e.symb?"{":"}"},isComplete:function(e){return 0===e.index&&e.nextCh===e.symb}},comment:{isComplete:function(e){var t="*"===e.lastCh&&"/"===e.nextCh;return e.lastCh=e.nextCh,t}},method:{init:function(e){e.symb="m"===e.symb?"{":"}",e.reverseSymb="{"===e.symb?"}":"{"},isComplete:function(e){return e.nextCh===e.symb?!0:!1}},preprocess:{init:function(e){e.index=0},isComplete:function(e){if("#"===e.nextCh){var t=e.lineText.match(/#(\w+)/)[1];if("endif"===t){if(e.forward&&0===e.depth)return!0;e.depth++}else if("if"===t){if(!e.forward&&0===e.depth)return!0;e.depth--}if("else"===t&&0===e.depth)return!0}return!1}}};b("pcre",!0,"boolean"),Se.prototype={getQuery:function(){return kt.query},setQuery:function(e){kt.query=e},getOverlay:function(){return this.searchOverlay},setOverlay:function(e){this.searchOverlay=e},isReversed:function(){return kt.isReversed},setReversed:function(e){kt.isReversed=e},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(e){this.annotate=e}};var At={"\\n":"\n","\\r":"\r","\\t":" "},Et={"\\/":"/","\\\\":"\\","\\n":"\n","\\r":"\r","\\t":" "},Ot="(Javascript regexp)",zt=function(){this.buildCommandMap_()};zt.prototype={processCommand:function(e,t,r){var n=this;e.operation(function(){e.curOp.isVimOp=!0,n._processCommand(e,t,r)})},_processCommand:function(t,r,n){var i=t.state.vim,o=kt.registerController.getRegister(":"),a=o.toString();i.visualMode&&le(t);var s=new e.StringStream(r);o.setText(r);var l=n||{};l.input=r;try{this.parseInput_(t,s,l)}catch(c){throw Ne(t,c),c}var u,d;if(l.commandName){if(u=this.matchCommand_(l.commandName)){if(d=u.name,u.excludeFromCommandHistory&&o.setText(a),this.parseCommandArgs_(s,l,u),"exToKey"==u.type){for(var f=0;f0;t--){var r=e.substring(0,t);if(this.commandMap_[r]){var n=this.commandMap_[r];if(0===n.name.indexOf(e))return n}}return null},buildCommandMap_:function(){this.commandMap_={};for(var e=0;e
";if(r){var o;r=r.join("");for(var a=0;a"}}else for(var o in n){var l=n[o].toString();l.length&&(i+='"'+o+" "+l+"
")}Ne(e,i)},sort:function(t,r){function i(){if(r.argString){var t=new e.StringStream(r.argString);if(t.eat("!")&&(a=!0),t.eol())return;if(!t.eatSpace())return"Invalid arguments";var n=t.match(/[a-z]+/);if(n){n=n[0],s=-1!=n.indexOf("i"),l=-1!=n.indexOf("u");var i=-1!=n.indexOf("d")&&1,o=-1!=n.indexOf("x")&&1,u=-1!=n.indexOf("o")&&1;if(i+o+u>1)return"Invalid arguments";c=i&&"decimal"||o&&"hex"||u&&"octal"}if(t.match(/\/.*\//))return"patterns not supported"}}function o(e,t){if(a){var r;r=e,e=t,t=r}s&&(e=e.toLowerCase(),t=t.toLowerCase());var n=c&&g.exec(e),i=c&&g.exec(t);return n?(n=parseInt((n[1]+n[2]).toLowerCase(),v),i=parseInt((i[1]+i[2]).toLowerCase(),v),n-i):t>e?-1:1}var a,s,l,c,u=i();if(u)return void Ne(t,u+": "+r.argString);var d=r.line||t.firstLine(),f=r.lineEnd||r.line||t.lastLine();if(d!=f){var p=n(d,0),h=n(f,X(t,f)),m=t.getRange(p,h).split("\n"),g="decimal"==c?/(-?)([\d]+)/:"hex"==c?/(-?)(?:0x)?([0-9a-f]+)/i:"octal"==c?/([0-7]+)/:null,v="decimal"==c?10:"hex"==c?16:"octal"==c?8:null,y=[],b=[];if(c)for(var k=0;k=f;f++){var p=c.test(e.getLine(f));p&&(u.push(f+1),d+=e.getLine(f)+"
")}if(!n)return void Ne(e,d);var h=0,m=function(){if(h=u)return void Ne(t,"Invalid argument: "+r.argString.substring(o));for(var d=0;u-c>=d;d++){var f=String.fromCharCode(c+d);delete n.marks[f]}}else delete n.marks[a]}}},Nt=new zt;return e.keyMap.vim={attach:s,detach:a,call:l},b("insertModeEscKeysTimeout",200,"number"),e.keyMap["vim-insert"]={"Ctrl-N":"autocomplete","Ctrl-P":"autocomplete",Enter:function(t){var r=e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent;r(t)},fallthrough:["default"],attach:s,detach:a,call:l},e.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:s,detach:a,call:l},C(),wt};e.Vim=i()}); \ No newline at end of file diff --git a/public/vendor/codemirror/keymap/sublime.js b/public/vendor/codemirror/keymap/sublime.js index e0d0e92..3cf6741 100644 --- a/public/vendor/codemirror/keymap/sublime.js +++ b/public/vendor/codemirror/keymap/sublime.js @@ -55,6 +55,8 @@ cmds[map["Alt-Left"] = "goSubwordLeft"] = function(cm) { moveSubword(cm, -1); }; cmds[map["Alt-Right"] = "goSubwordRight"] = function(cm) { moveSubword(cm, 1); }; + if (mac) map["Cmd-Left"] = "goLineStartSmart"; + var scrollLineCombo = mac ? "Ctrl-Alt-" : "Ctrl-"; cmds[map[scrollLineCombo + "Up"] = "scrollLineUp"] = function(cm) { @@ -105,7 +107,7 @@ cm.setSelections(extended); }; - map["Shift-" + ctrl + "K"] = "deleteLine"; + map["Shift-Ctrl-K"] = "deleteLine"; function insertLine(cm, above) { if (cm.isReadOnly()) return CodeMirror.Pass diff --git a/public/vendor/codemirror/keymap/vim.js b/public/vendor/codemirror/keymap/vim.js index 0548b75..b2bee5a 100644 --- a/public/vendor/codemirror/keymap/vim.js +++ b/public/vendor/codemirror/keymap/vim.js @@ -26,7 +26,7 @@ * 2. Variable declarations and short basic helpers * 3. Instance (External API) implementation * 4. Internal state tracking objects (input state, counter) implementation - * and instanstiation + * and instantiation * 5. Key handler (the main command dispatcher) implementation * 6. Motion, operator, and action implementations * 7. Helper functions for the key handler, motions, operators, and actions @@ -64,9 +64,9 @@ { keys: '', type: 'keyToKey', toKeys: '', context: 'insert' }, { keys: '', type: 'keyToKey', toKeys: '', context: 'insert' }, { keys: 's', type: 'keyToKey', toKeys: 'cl', context: 'normal' }, - { keys: 's', type: 'keyToKey', toKeys: 'xi', context: 'visual'}, + { keys: 's', type: 'keyToKey', toKeys: 'c', context: 'visual'}, { keys: 'S', type: 'keyToKey', toKeys: 'cc', context: 'normal' }, - { keys: 'S', type: 'keyToKey', toKeys: 'dcc', context: 'visual' }, + { keys: 'S', type: 'keyToKey', toKeys: 'VdO', context: 'visual' }, { keys: '', type: 'keyToKey', toKeys: '0' }, { keys: '', type: 'keyToKey', toKeys: '$' }, { keys: '', type: 'keyToKey', toKeys: '' }, @@ -164,6 +164,7 @@ { keys: 'v', type: 'action', action: 'toggleVisualMode' }, { keys: 'V', type: 'action', action: 'toggleVisualMode', actionArgs: { linewise: true }}, { keys: '', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }}, + { keys: '', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }}, { keys: 'gv', type: 'action', action: 'reselectLastSelection' }, { keys: 'J', type: 'action', action: 'joinLines', isEdit: true }, { keys: 'p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true }}, @@ -225,6 +226,7 @@ { name: 'sort', shortName: 'sor' }, { name: 'substitute', shortName: 's', possiblyAsync: true }, { name: 'nohlsearch', shortName: 'noh' }, + { name: 'yank', shortName: 'y' }, { name: 'delmarks', shortName: 'delm' }, { name: 'registers', shortName: 'reg', excludeFromCommandHistory: true }, { name: 'global', shortName: 'g' } @@ -640,7 +642,7 @@ jumpList: createCircularJumpList(), macroModeState: new MacroModeState, // Recording latest f, t, F or T motion command. - lastChararacterSearch: {increment:0, forward:true, selectedCharacter:''}, + lastCharacterSearch: {increment:0, forward:true, selectedCharacter:''}, registerController: new RegisterController({}), // search history buffer searchHistoryController: new HistoryController({}), @@ -681,6 +683,9 @@ // Add user defined key bindings. exCommandDispatcher.map(lhs, rhs, ctx); }, + unmap: function(lhs, ctx) { + exCommandDispatcher.unmap(lhs, ctx); + }, // TODO: Expose setOption and getOption as instance methods. Need to decide how to namespace // them, or somehow make them work with the existing CodeMirror setOption/getOption API. setOption: setOption, @@ -1043,7 +1048,7 @@ }; function HistoryController() { this.historyBuffer = []; - this.iterator; + this.iterator = 0; this.initialPrefix = null; } HistoryController.prototype = { @@ -1368,7 +1373,7 @@ } }, evalInput: function(cm, vim) { - // If the motion comand is set, execute both the operator and motion. + // If the motion command is set, execute both the operator and motion. // Otherwise return. var inputState = vim.inputState; var motion = inputState.motion; @@ -1692,11 +1697,12 @@ var line = motionArgs.forward ? cur.line + repeat : cur.line - repeat; var first = cm.firstLine(); var last = cm.lastLine(); - // Vim cancels linewise motions that start on an edge and move beyond - // that edge. It does not cancel motions that do not start on an edge. - if ((line < first && cur.line == first) || - (line > last && cur.line == last)) { - return; + // Vim go to line begin or line end when cursor at first/last line and + // move to previous/next line is triggered. + if (line < first && cur.line == first){ + return this.moveToStartOfLine(cm, head, motionArgs, vim); + }else if (line > last && cur.line == last){ + return this.moveToEol(cm, head, motionArgs, vim); } if (motionArgs.toFirstChar){ endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line)); @@ -1904,7 +1910,7 @@ }, repeatLastCharacterSearch: function(cm, head, motionArgs) { - var lastSearch = vimGlobalState.lastChararacterSearch; + var lastSearch = vimGlobalState.lastCharacterSearch; var repeat = motionArgs.repeat; var forward = motionArgs.forward === lastSearch.forward; var increment = (lastSearch.increment ? 1 : 0) * (forward ? -1 : 1); @@ -2997,7 +3003,7 @@ // Only clip if the selection ends with trailing newline + whitespace if (/\n\s*$/.test(selection)) { var lines = selection.split('\n'); - // We know this is all whitepsace. + // We know this is all whitespace. lines.pop(); // Cases: @@ -3083,9 +3089,9 @@ } function recordLastCharacterSearch(increment, args) { - vimGlobalState.lastChararacterSearch.increment = increment; - vimGlobalState.lastChararacterSearch.forward = args.forward; - vimGlobalState.lastChararacterSearch.selectedCharacter = args.selectedCharacter; + vimGlobalState.lastCharacterSearch.increment = increment; + vimGlobalState.lastCharacterSearch.forward = args.forward; + vimGlobalState.lastCharacterSearch.selectedCharacter = args.selectedCharacter; } var symbolToMode = { @@ -3284,8 +3290,6 @@ line = cm.getLine(lineNum); pos = (dir > 0) ? 0 : line.length; } - // Should never get here. - throw new Error('The impossible happened.'); } /** @@ -3447,7 +3451,7 @@ } // TODO: perhaps this finagling of start and end positions belonds - // in codmirror/replaceRange? + // in codemirror/replaceRange? function selectCompanionObject(cm, head, symb, inclusive) { var cur = head, start, end; @@ -4509,14 +4513,21 @@ if (CodeMirror.commands.save) { // If a save command is defined, call it. CodeMirror.commands.save(cm); - } else { - // Saves to text area if no save command is defined. + } else if (cm.save) { + // Saves to text area if no save command is defined and cm.save() is available. cm.save(); } }, nohlsearch: function(cm) { clearSearchHighlight(cm); }, + yank: function (cm) { + var cur = copyCursor(cm.getCursor()); + var line = cur.line; + var lineText = cm.getLine(line); + vimGlobalState.registerController.pushText( + '0', 'yank', lineText, true, true); + }, delmarks: function(cm, params) { if (!params.argString || !trim(params.argString)) { showConfirm(cm, 'Argument required'); diff --git a/public/vendor/codemirror/lib/codemirror.css b/public/vendor/codemirror/lib/codemirror.css index 1067b3e..1cf66a9 100644 --- a/public/vendor/codemirror/lib/codemirror.css +++ b/public/vendor/codemirror/lib/codemirror.css @@ -191,12 +191,14 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} .CodeMirror-gutters { position: absolute; left: 0; top: 0; + min-height: 100%; z-index: 3; } .CodeMirror-gutter { white-space: normal; height: 100%; display: inline-block; + vertical-align: top; margin-bottom: -30px; /* Hack to make IE7 behave */ *zoom:1; @@ -244,6 +246,8 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} position: relative; overflow: visible; -webkit-tap-highlight-color: transparent; + -webkit-font-variant-ligatures: none; + font-variant-ligatures: none; } .CodeMirror-wrap pre { word-wrap: break-word; diff --git a/public/vendor/codemirror/lib/codemirror.js b/public/vendor/codemirror/lib/codemirror.js index 95a7dc7..a925a1f 100644 --- a/public/vendor/codemirror/lib/codemirror.js +++ b/public/vendor/codemirror/lib/codemirror.js @@ -41,6 +41,7 @@ // This is woefully incomplete. Suggestions for alternative methods welcome. var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent); var mac = ios || /Mac/.test(platform); + var chromeOS = /\bCrOS\b/.test(userAgent); var windows = /win/i.test(platform); var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/); @@ -543,6 +544,7 @@ d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px"; d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px"; + d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent" if (sizes.right && sizes.bottom) { d.scrollbarFiller.style.display = "block"; @@ -746,6 +748,7 @@ function postUpdateDisplay(cm, update) { var viewport = update.viewport; + for (var first = true;; first = false) { if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) { // Clip forced viewport to actual scrollable area. @@ -761,8 +764,8 @@ updateHeightsInViewport(cm); var barMeasure = measureForScrollbars(cm); updateSelection(cm); - setDocumentHeight(cm, barMeasure); updateScrollbars(cm, barMeasure); + setDocumentHeight(cm, barMeasure); } update.signal(cm, "update", cm); @@ -779,17 +782,16 @@ postUpdateDisplay(cm, update); var barMeasure = measureForScrollbars(cm); updateSelection(cm); - setDocumentHeight(cm, barMeasure); updateScrollbars(cm, barMeasure); + setDocumentHeight(cm, barMeasure); update.finish(); } } function setDocumentHeight(cm, measure) { cm.display.sizer.style.minHeight = measure.docHeight + "px"; - var total = measure.docHeight + cm.display.barHeight; - cm.display.heightForcer.style.top = total + "px"; - cm.display.gutters.style.height = Math.max(total + scrollGap(cm), measure.clientHeight) + "px"; + cm.display.heightForcer.style.top = measure.docHeight + "px"; + cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px"; } // Read the actual heights of the rendered lines, and update their @@ -1484,10 +1486,11 @@ if (reset && cm.doc.sel.contains(pos) == -1) operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); - var oldCSS = te.style.cssText; - input.wrapper.style.position = "absolute"; - te.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) + - "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: " + + var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText; + input.wrapper.style.cssText = "position: absolute" + var wrapperBox = input.wrapper.getBoundingClientRect() + te.style.cssText = "position: absolute; width: 30px; height: 30px; top: " + (e.clientY - wrapperBox.top - 5) + + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px; z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + "; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);"; if (webkit) var oldScrollY = window.scrollY; // Work around Chrome issue (#2712) @@ -1518,7 +1521,7 @@ } function rehide() { input.contextMenuPending = false; - input.wrapper.style.position = "relative"; + input.wrapper.style.cssText = oldWrapperCSS te.style.cssText = oldCSS; if (ie && ie_version < 9) display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); @@ -2258,13 +2261,15 @@ if (oldPos) { var near = m.find(dir < 0 ? 1 : -1), diff; - if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft) near = movePos(doc, near, -dir, line); + if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft) + near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0)) return skipAtomicInner(doc, near, pos, dir, mayClear); } var far = m.find(dir < 0 ? -1 : 1); - if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight) far = movePos(doc, far, dir, line); + if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight) + far = movePos(doc, far, dir, far.line == pos.line ? line : null); return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null; } } @@ -2311,6 +2316,7 @@ for (var i = 0; i < doc.sel.ranges.length; i++) { if (primary === false && i == doc.sel.primIndex) continue; var range = doc.sel.ranges[i]; + if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) continue; var collapsed = range.empty(); if (collapsed || cm.options.showCursorWhenSelecting) drawSelectionCursor(cm, range.head, curFragment); @@ -3122,10 +3128,10 @@ if (op.preparedSelection) cm.display.input.showSelection(op.preparedSelection); - if (op.updatedDisplay) - setDocumentHeight(cm, op.barMeasure); if (op.updatedDisplay || op.startHeight != cm.doc.height) updateScrollbars(cm, op.barMeasure); + if (op.updatedDisplay) + setDocumentHeight(cm, op.barMeasure); if (op.selectionChanged) restartBlink(cm); @@ -3151,7 +3157,7 @@ display.scroller.scrollTop = doc.scrollTop; } if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) { - doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - displayWidth(cm), op.scrollLeft)); + doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft)); display.scrollbars.setScrollLeft(doc.scrollLeft); display.scroller.scrollLeft = doc.scrollLeft; alignHorizontally(cm); @@ -3502,7 +3508,7 @@ over: function(e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }}, start: function(e){onDragStart(cm, e);}, drop: operation(cm, onDrop), - leave: function() {clearDragCursor(cm);} + leave: function(e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }} }; var inp = d.input.getField(); @@ -3687,7 +3693,7 @@ ourIndex = doc.sel.primIndex; } - if (e.altKey) { + if (chromeOS ? e.shiftKey && e.metaKey : e.altKey) { type = "rect"; if (!addNew) ourRange = new Range(start, start); start = posFromMouse(cm, e, true, true); @@ -7632,9 +7638,9 @@ var spans = line.markedSpans; if (spans) for (var i = 0; i < spans.length; i++) { var span = spans[i]; - if (!(lineNo == from.line && from.ch > span.to || - span.from == null && lineNo != from.line|| - lineNo == to.line && span.from > to.ch) && + if (!(span.to != null && lineNo == from.line && from.ch > span.to || + span.from == null && lineNo != from.line || + span.from != null && lineNo == to.line && span.from > to.ch) && (!filter || filter(span.marker))) found.push(span.marker.parent || span.marker); } @@ -7653,9 +7659,9 @@ }, posFromIndex: function(off) { - var ch, lineNo = this.first; + var ch, lineNo = this.first, sepSize = this.lineSeparator().length; this.iter(function(line) { - var sz = line.text.length + 1; + var sz = line.text.length + sepSize; if (sz > off) { ch = off; return true; } off -= sz; ++lineNo; @@ -7666,8 +7672,9 @@ coords = clipPos(this, coords); var index = coords.ch; if (coords.line < this.first || coords.ch < 0) return 0; + var sepSize = this.lineSeparator().length; this.iter(this.first, coords.line, function (line) { - index += line.text.length + 1; + index += line.text.length + sepSize; }); return index; }, @@ -8897,7 +8904,7 @@ // THE END - CodeMirror.version = "5.10.1"; + CodeMirror.version = "5.13.5"; return CodeMirror; }); diff --git a/public/vendor/codemirror/mode/clike/clike.js b/public/vendor/codemirror/mode/clike/clike.js index 4f5c0cf..695d5ce 100644 --- a/public/vendor/codemirror/mode/clike/clike.js +++ b/public/vendor/codemirror/mode/clike/clike.js @@ -11,6 +11,42 @@ })(function(CodeMirror) { "use strict"; +function Context(indented, column, type, align, prev) { + this.indented = indented; + this.column = column; + this.type = type; + this.align = align; + this.prev = prev; +} +function isStatement(type) { + return type == "statement" || type == "switchstatement" || type == "namespace"; +} +function pushContext(state, col, type) { + var indent = state.indented; + if (state.context && isStatement(state.context.type) && !isStatement(type)) + indent = state.context.indented; + return state.context = new Context(indent, col, type, null, state.context); +} +function popContext(state) { + var t = state.context.type; + if (t == ")" || t == "]" || t == "}") + state.indented = state.context.indented; + return state.context = state.context.prev; +} + +function typeBefore(stream, state) { + if (state.prevToken == "variable" || state.prevToken == "variable-3") return true; + if (/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(stream.string.slice(0, stream.start))) return true; +} + +function isTopScope(context) { + for (;;) { + if (!context || context.type == "top") return true; + if (context.type == "}" && context.prev.type != "namespace") return false; + context = context.prev; + } +} + CodeMirror.defineMode("clike", function(config, parserConfig) { var indentUnit = config.indentUnit, statementIndentUnit = parserConfig.statementIndentUnit || indentUnit, @@ -64,7 +100,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { } } if (isOperatorChar.test(ch)) { - stream.eatWhile(isOperatorChar); + while (!stream.match(/^\/[\/*]/, false) && stream.eat(isOperatorChar)) {} return "operator"; } stream.eatWhile(/[\w\$_\xa1-\uffff]/); @@ -111,42 +147,6 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { return "comment"; } - function Context(indented, column, type, align, prev) { - this.indented = indented; - this.column = column; - this.type = type; - this.align = align; - this.prev = prev; - } - function isStatement(type) { - return type == "statement" || type == "switchstatement" || type == "namespace"; - } - function pushContext(state, col, type) { - var indent = state.indented; - if (state.context && isStatement(state.context.type) && !isStatement(type)) - indent = state.context.indented; - return state.context = new Context(indent, col, type, null, state.context); - } - function popContext(state) { - var t = state.context.type; - if (t == ")" || t == "]" || t == "}") - state.indented = state.context.indented; - return state.context = state.context.prev; - } - - function typeBefore(stream, state) { - if (state.prevToken == "variable" || state.prevToken == "variable-3") return true; - if (/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(stream.string.slice(0, stream.start))) return true; - } - - function isTopScope(context) { - for (;;) { - if (!context || context.type == "top") return true; - if (context.type == "}" && context.prev.type != "namespace") return false; - context = context.prev; - } - } - // Interface return { @@ -497,7 +497,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { ), types: words( "AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " + - "Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable " + + "Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable " + "Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering " + "Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder " + "StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector " + @@ -527,6 +527,15 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { "'": function(stream) { stream.eatWhile(/[\w\$_\xa1-\uffff]/); return "atom"; + }, + "=": function(stream, state) { + var cx = state.context + if (cx.type == "}" && cx.align && stream.eat(">")) { + state.context = new Context(cx.indented, cx.column, cx.type, null, cx.prev) + return "operator" + } else { + return false + } } }, modeProps: {closeBrackets: {triples: '"'}} @@ -658,7 +667,7 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { def("text/x-objectivec", { name: "clike", - keywords: words(cKeywords + "inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in " + + keywords: words(cKeywords + "inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in " + "inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"), types: words(cTypes), atoms: words("YES NO NULL NILL ON OFF true false"), diff --git a/public/vendor/codemirror/mode/clojure/clojure.js b/public/vendor/codemirror/mode/clojure/clojure.js index 44948d0..cd8129f 100644 --- a/public/vendor/codemirror/mode/clojure/clojure.js +++ b/public/vendor/codemirror/mode/clojure/clojure.js @@ -59,7 +59,8 @@ CodeMirror.defineMode("clojure", function (options) { sign: /[+-]/, exponent: /e/i, keyword_char: /[^\s\(\[\;\)\]]/, - symbol: /[\w*+!\-\._?:<>\/\xa1-\uffff]/ + symbol: /[\w*+!\-\._?:<>\/\xa1-\uffff]/, + block_indent: /^(?:def|with)[^\/]+$|\/(?:def|with)/ }; function stateStack(indent, type, prev) { // represents a state stack object @@ -142,7 +143,7 @@ CodeMirror.defineMode("clojure", function (options) { } // skip spaces - if (stream.eatSpace()) { + if (state.mode != "string" && stream.eatSpace()) { return null; } var returnType = null; @@ -190,7 +191,7 @@ CodeMirror.defineMode("clojure", function (options) { } if (keyWord.length > 0 && (indentKeys.propertyIsEnumerable(keyWord) || - /^(?:def|with)/.test(keyWord))) { // indent-word + tests.block_indent.test(keyWord))) { // indent-word pushStack(state, indentTemp + INDENT_WORD_SKIP, ch); } else { // non-indent word // we continue eating the spaces @@ -243,5 +244,7 @@ CodeMirror.defineMode("clojure", function (options) { }); CodeMirror.defineMIME("text/x-clojure", "clojure"); +CodeMirror.defineMIME("text/x-clojurescript", "clojure"); +CodeMirror.defineMIME("application/edn", "clojure"); }); diff --git a/public/vendor/codemirror/mode/crystal/crystal.js b/public/vendor/codemirror/mode/crystal/crystal.js index 2e74bee..e63627c 100644 --- a/public/vendor/codemirror/mode/crystal/crystal.js +++ b/public/vendor/codemirror/mode/crystal/crystal.js @@ -209,7 +209,7 @@ // Operators if (stream.match(operators)) { - stream.eat("="); // Operators can follow assigin symbol. + stream.eat("="); // Operators can follow assign symbol. return "operator"; } diff --git a/public/vendor/codemirror/mode/dart/dart.js b/public/vendor/codemirror/mode/dart/dart.js index d92eb51..8d383a9 100644 --- a/public/vendor/codemirror/mode/dart/dart.js +++ b/public/vendor/codemirror/mode/dart/dart.js @@ -72,6 +72,12 @@ return null; } return false; + }, + + "/": function(stream, state) { + if (!stream.eat("*")) return false + state.tokenize = tokenNestedComment(1) + return state.tokenize(stream, state) } } }); @@ -121,6 +127,27 @@ return "variable"; } + function tokenNestedComment(depth) { + return function (stream, state) { + var ch + while (ch = stream.next()) { + if (ch == "*" && stream.eat("/")) { + if (depth == 1) { + state.tokenize = null + break + } else { + state.tokenize = tokenNestedComment(depth - 1) + return state.tokenize(stream, state) + } + } else if (ch == "/" && stream.eat("*")) { + state.tokenize = tokenNestedComment(depth + 1) + return state.tokenize(stream, state) + } + } + return "comment" + } + } + CodeMirror.registerHelper("hintWords", "application/dart", keywords.concat(atoms).concat(builtins)); // This is needed to make loading through meta.js work. diff --git a/public/vendor/codemirror/mode/django/django.js b/public/vendor/codemirror/mode/django/django.js index eb8d659..7b4ef3b 100644 --- a/public/vendor/codemirror/mode/django/django.js +++ b/public/vendor/codemirror/mode/django/django.js @@ -61,16 +61,16 @@ // Ignore completely any stream series that do not match the // Django template opening tags. - while (stream.next() != null && !stream.match("{{", false) && !stream.match("{%", false)) {} + while (stream.next() != null && !stream.match(/\{[{%#]/, false)) {} return null; } // A string can be included in either single or double quotes (this is - // the delimeter). Mark everything as a string until the start delimeter + // the delimiter). Mark everything as a string until the start delimiter // occurs again. - function inString (delimeter, previousTokenizer) { + function inString (delimiter, previousTokenizer) { return function (stream, state) { - if (!state.escapeNext && stream.eat(delimeter)) { + if (!state.escapeNext && stream.eat(delimiter)) { state.tokenize = previousTokenizer; } else { if (state.escapeNext) { @@ -80,7 +80,7 @@ var ch = stream.next(); // Take into account the backslash for escaping characters, such as - // the string delimeter. + // the string delimiter. if (ch == "\\") { state.escapeNext = true; } @@ -100,7 +100,7 @@ return "null"; } - // Dot folowed by a non-word character should be considered an error. + // Dot followed by a non-word character should be considered an error. if (stream.match(/\.\W+/)) { return "error"; } else if (stream.eat(".")) { @@ -119,7 +119,7 @@ return "null"; } - // Pipe folowed by a non-word character should be considered an error. + // Pipe followed by a non-word character should be considered an error. if (stream.match(/\.\W+/)) { return "error"; } else if (stream.eat("|")) { @@ -199,7 +199,7 @@ return "null"; } - // Dot folowed by a non-word character should be considered an error. + // Dot followed by a non-word character should be considered an error. if (stream.match(/\.\W+/)) { return "error"; } else if (stream.eat(".")) { @@ -218,7 +218,7 @@ return "null"; } - // Pipe folowed by a non-word character should be considered an error. + // Pipe followed by a non-word character should be considered an error. if (stream.match(/\.\W+/)) { return "error"; } else if (stream.eat("|")) { @@ -317,9 +317,8 @@ // Mark everything as comment inside the tag and the tag itself. function inComment (stream, state) { - if (stream.match("#}")) { - state.tokenize = tokenBase; - } + if (stream.match(/^.*?#\}/)) state.tokenize = tokenBase + else stream.skipToEnd() return "comment"; } diff --git a/public/vendor/codemirror/mode/dtd/dtd.js b/public/vendor/codemirror/mode/dtd/dtd.js index f37029a..52d76ee 100644 --- a/public/vendor/codemirror/mode/dtd/dtd.js +++ b/public/vendor/codemirror/mode/dtd/dtd.js @@ -114,17 +114,17 @@ CodeMirror.defineMode("dtd", function(config) { if( textAfter.match(/\]\s+|\]/) )n=n-1; else if(textAfter.substr(textAfter.length-1, textAfter.length) === ">"){ - if(textAfter.substr(0,1) === "<")n; - else if( type == "doindent" && textAfter.length > 1 )n; + if(textAfter.substr(0,1) === "<") {} + else if( type == "doindent" && textAfter.length > 1 ) {} else if( type == "doindent")n--; - else if( type == ">" && textAfter.length > 1)n; - else if( type == "tag" && textAfter !== ">")n; + else if( type == ">" && textAfter.length > 1) {} + else if( type == "tag" && textAfter !== ">") {} else if( type == "tag" && state.stack[state.stack.length-1] == "rule")n--; else if( type == "tag")n++; else if( textAfter === ">" && state.stack[state.stack.length-1] == "rule" && type === ">")n--; - else if( textAfter === ">" && state.stack[state.stack.length-1] == "rule")n; + else if( textAfter === ">" && state.stack[state.stack.length-1] == "rule") {} else if( textAfter.substr(0,1) !== "<" && textAfter.substr(0,1) === ">" )n=n-1; - else if( textAfter === ">")n; + else if( textAfter === ">") {} else n=n-1; //over rule them all if(type == null || type == "]")n--; diff --git a/public/vendor/codemirror/mode/dylan/dylan.js b/public/vendor/codemirror/mode/dylan/dylan.js index 85f0166..1b46bc8 100644 --- a/public/vendor/codemirror/mode/dylan/dylan.js +++ b/public/vendor/codemirror/mode/dylan/dylan.js @@ -169,15 +169,16 @@ CodeMirror.defineMode("dylan", function(_config) { } else if (stream.eat("/")) { stream.skipToEnd(); return "comment"; - } else { - stream.skipTo(" "); - return "operator"; } + stream.backUp(1); } // Decimal - else if (/\d/.test(ch)) { - stream.match(/^\d*(?:\.\d*)?(?:e[+\-]?\d+)?/); - return "number"; + else if (/[+\-\d\.]/.test(ch)) { + if (stream.match(/^[+-]?[0-9]*\.[0-9]*([esdx][+-]?[0-9]+)?/i) || + stream.match(/^[+-]?[0-9]+([esdx][+-]?[0-9]+)/i) || + stream.match(/^[+-]?\d+/)) { + return "number"; + } } // Hash else if (ch == "#") { @@ -186,7 +187,7 @@ CodeMirror.defineMode("dylan", function(_config) { ch = stream.peek(); if (ch == '"') { stream.next(); - return chain(stream, state, tokenString('"', "string-2")); + return chain(stream, state, tokenString('"', "string")); } // Binary number else if (ch == "b") { @@ -206,11 +207,51 @@ CodeMirror.defineMode("dylan", function(_config) { stream.eatWhile(/[0-7]/); return "number"; } - // Hash symbol - else { - stream.eatWhile(/[-a-zA-Z]/); - return "keyword"; + // Token concatenation in macros + else if (ch == '#') { + stream.next(); + return "punctuation"; } + // Sequence literals + else if ((ch == '[') || (ch == '(')) { + stream.next(); + return "bracket"; + // Hash symbol + } else if (stream.match(/f|t|all-keys|include|key|next|rest/i)) { + return "atom"; + } else { + stream.eatWhile(/[-a-zA-Z]/); + return "error"; + } + } else if (ch == "~") { + stream.next(); + ch = stream.peek(); + if (ch == "=") { + stream.next(); + ch = stream.peek(); + if (ch == "=") { + stream.next(); + return "operator"; + } + return "operator"; + } + return "operator"; + } else if (ch == ":") { + stream.next(); + ch = stream.peek(); + if (ch == "=") { + stream.next(); + return "operator"; + } else if (ch == ":") { + stream.next(); + return "punctuation"; + } + } else if ("[](){}".indexOf(ch) != -1) { + stream.next(); + return "bracket"; + } else if (".,".indexOf(ch) != -1) { + stream.next(); + return "punctuation"; } else if (stream.match("end")) { return "keyword"; } @@ -223,6 +264,10 @@ CodeMirror.defineMode("dylan", function(_config) { return patternStyles[name]; } } + if (/[+\-*\/^=<>&|]/.test(ch)) { + stream.next(); + return "operator"; + } if (stream.match("define")) { return "def"; } else { @@ -240,29 +285,37 @@ CodeMirror.defineMode("dylan", function(_config) { } function tokenComment(stream, state) { - var maybeEnd = false, - ch; + var maybeEnd = false, maybeNested = false, nestedCount = 0, ch; while ((ch = stream.next())) { if (ch == "/" && maybeEnd) { - state.tokenize = tokenBase; - break; + if (nestedCount > 0) { + nestedCount--; + } else { + state.tokenize = tokenBase; + break; + } + } else if (ch == "*" && maybeNested) { + nestedCount++; } maybeEnd = (ch == "*"); + maybeNested = (ch == "/"); } return "comment"; } function tokenString(quote, style) { return function(stream, state) { - var next, end = false; + var escaped = false, next, end = false; while ((next = stream.next()) != null) { - if (next == quote) { + if (next == quote && !escaped) { end = true; break; } + escaped = !escaped && next == "\\"; } - if (end) + if (end || !escaped) { state.tokenize = tokenBase; + } return style; }; } diff --git a/public/vendor/codemirror/mode/dylan/test.js b/public/vendor/codemirror/mode/dylan/test.js new file mode 100644 index 0000000..bf25be2 --- /dev/null +++ b/public/vendor/codemirror/mode/dylan/test.js @@ -0,0 +1,88 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function() { + var mode = CodeMirror.getMode({indentUnit: 2}, "dylan"); + function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } + + MT('comments', + '[comment // This is a line comment]', + '[comment /* This is a block comment */]', + '[comment /* This is a multi]', + '[comment line comment]', + '[comment */]', + '[comment /* And this is a /*]', + '[comment /* nested */ comment */]'); + + MT('unary_operators', + '[operator -][variable a]', + '[operator -] [variable a]', + '[operator ~][variable a]', + '[operator ~] [variable a]'); + + MT('binary_operators', + '[variable a] [operator +] [variable b]', + '[variable a] [operator -] [variable b]', + '[variable a] [operator *] [variable b]', + '[variable a] [operator /] [variable b]', + '[variable a] [operator ^] [variable b]', + '[variable a] [operator =] [variable b]', + '[variable a] [operator ==] [variable b]', + '[variable a] [operator ~=] [variable b]', + '[variable a] [operator ~==] [variable b]', + '[variable a] [operator <] [variable b]', + '[variable a] [operator <=] [variable b]', + '[variable a] [operator >] [variable b]', + '[variable a] [operator >=] [variable b]', + '[variable a] [operator &] [variable b]', + '[variable a] [operator |] [variable b]', + '[variable a] [operator :=] [variable b]'); + + MT('integers', + '[number 1]', + '[number 123]', + '[number -123]', + '[number +456]', + '[number #b010]', + '[number #o073]', + '[number #xabcDEF123]'); + + MT('floats', + '[number .3]', + '[number -1.]', + '[number -2.335]', + '[number +3.78d1]', + '[number 3.78s-1]', + '[number -3.32e+5]'); + + MT('characters_and_strings', + "[string 'a']", + "[string '\\\\'']", + '[string ""]', + '[string "a"]', + '[string "abc def"]', + '[string "More escaped characters: \\\\\\\\ \\\\a \\\\b \\\\e \\\\f \\\\n \\\\r \\\\t \\\\0 ..."]'); + + MT('brackets', + '[bracket #[[]]]', + '[bracket #()]', + '[bracket #(][number 1][bracket )]', + '[bracket [[][number 1][punctuation ,] [number 3][bracket ]]]', + '[bracket ()]', + '[bracket {}]', + '[keyword if] [bracket (][variable foo][bracket )]', + '[bracket (][number 1][bracket )]', + '[bracket [[][number 1][bracket ]]]'); + + MT('hash_words', + '[punctuation ##]', + '[atom #f]', '[atom #F]', + '[atom #t]', '[atom #T]', + '[atom #all-keys]', + '[atom #include]', + '[atom #key]', + '[atom #next]', + '[atom #rest]', + '[string #"foo"]', + '[error #invalid]'); +})(); diff --git a/public/vendor/codemirror/mode/fcl/fcl.js b/public/vendor/codemirror/mode/fcl/fcl.js new file mode 100644 index 0000000..5181169 --- /dev/null +++ b/public/vendor/codemirror/mode/fcl/fcl.js @@ -0,0 +1,173 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode("fcl", function(config) { + var indentUnit = config.indentUnit; + + var keywords = { + "term": true, + "method": true, "accu": true, + "rule": true, "then": true, "is": true, "and": true, "or": true, + "if": true, "default": true + }; + + var start_blocks = { + "var_input": true, + "var_output": true, + "fuzzify": true, + "defuzzify": true, + "function_block": true, + "ruleblock": true + }; + + var end_blocks = { + "end_ruleblock": true, + "end_defuzzify": true, + "end_function_block": true, + "end_fuzzify": true, + "end_var": true + }; + + var atoms = { + "true": true, "false": true, "nan": true, + "real": true, "min": true, "max": true, "cog": true, "cogs": true + }; + + var isOperatorChar = /[+\-*&^%:=<>!|\/]/; + + function tokenBase(stream, state) { + var ch = stream.next(); + + if (/[\d\.]/.test(ch)) { + if (ch == ".") { + stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/); + } else if (ch == "0") { + stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/); + } else { + stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/); + } + return "number"; + } + + if (ch == "/" || ch == "(") { + if (stream.eat("*")) { + state.tokenize = tokenComment; + return tokenComment(stream, state); + } + if (stream.eat("/")) { + stream.skipToEnd(); + return "comment"; + } + } + if (isOperatorChar.test(ch)) { + stream.eatWhile(isOperatorChar); + return "operator"; + } + stream.eatWhile(/[\w\$_\xa1-\uffff]/); + + var cur = stream.current().toLowerCase(); + if (keywords.propertyIsEnumerable(cur) || + start_blocks.propertyIsEnumerable(cur) || + end_blocks.propertyIsEnumerable(cur)) { + return "keyword"; + } + if (atoms.propertyIsEnumerable(cur)) return "atom"; + return "variable"; + } + + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while (ch = stream.next()) { + if ((ch == "/" || ch == ")") && maybeEnd) { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch == "*"); + } + return "comment"; + } + + function Context(indented, column, type, align, prev) { + this.indented = indented; + this.column = column; + this.type = type; + this.align = align; + this.prev = prev; + } + + function pushContext(state, col, type) { + return state.context = new Context(state.indented, col, type, null, state.context); + } + + function popContext(state) { + if (!state.context.prev) return; + var t = state.context.type; + if (t == "end_block") + state.indented = state.context.indented; + return state.context = state.context.prev; + } + + // Interface + + return { + startState: function(basecolumn) { + return { + tokenize: null, + context: new Context((basecolumn || 0) - indentUnit, 0, "top", false), + indented: 0, + startOfLine: true + }; + }, + + token: function(stream, state) { + var ctx = state.context; + if (stream.sol()) { + if (ctx.align == null) ctx.align = false; + state.indented = stream.indentation(); + state.startOfLine = true; + } + if (stream.eatSpace()) return null; + + var style = (state.tokenize || tokenBase)(stream, state); + if (style == "comment") return style; + if (ctx.align == null) ctx.align = true; + + var cur = stream.current().toLowerCase(); + + if (start_blocks.propertyIsEnumerable(cur)) pushContext(state, stream.column(), "end_block"); + else if (end_blocks.propertyIsEnumerable(cur)) popContext(state); + + state.startOfLine = false; + return style; + }, + + indent: function(state, textAfter) { + if (state.tokenize != tokenBase && state.tokenize != null) return 0; + var ctx = state.context; + + var closing = end_blocks.propertyIsEnumerable(textAfter); + if (ctx.align) return ctx.column + (closing ? 0 : 1); + else return ctx.indented + (closing ? 0 : indentUnit); + }, + + electricChars: "ryk", + fold: "brace", + blockCommentStart: "(*", + blockCommentEnd: "*)", + lineComment: "//" + }; +}); + +CodeMirror.defineMIME("text/x-fcl", "fcl"); +}); diff --git a/public/vendor/codemirror/mode/fcl/index.html b/public/vendor/codemirror/mode/fcl/index.html new file mode 100644 index 0000000..3c18d0b --- /dev/null +++ b/public/vendor/codemirror/mode/fcl/index.html @@ -0,0 +1,108 @@ + + +CodeMirror: FCL mode + + + + + + + + + + + +
+

FCL mode

+
+ + + +

MIME type: text/x-fcl

+
diff --git a/public/vendor/codemirror/mode/gfm/index.html b/public/vendor/codemirror/mode/gfm/index.html index 7e38c52..24c90c0 100644 --- a/public/vendor/codemirror/mode/gfm/index.html +++ b/public/vendor/codemirror/mode/gfm/index.html @@ -47,7 +47,7 @@ Underscores_are_allowed_between_words. GFM adds syntax to strikethrough text, which is missing from standard Markdown. ~~Mistaken text.~~ -~~**works with other fomatting**~~ +~~**works with other formatting**~~ ~~spans across lines~~ diff --git a/public/vendor/codemirror/mode/gfm/test.js b/public/vendor/codemirror/mode/gfm/test.js index 0dcd361..7a1a4cc 100644 --- a/public/vendor/codemirror/mode/gfm/test.js +++ b/public/vendor/codemirror/mode/gfm/test.js @@ -51,6 +51,12 @@ "[comment ```]", "bar"); + MT("fencedCodeBlockModeSwitchingObjc", + "[comment ```objective-c]", + "[keyword @property] [variable NSString] [operator *] [variable foo];", + "[comment ```]", + "bar"); + MT("fencedCodeBlocksNoTildes", "~~~", "foo", diff --git a/public/vendor/codemirror/mode/haml/haml.js b/public/vendor/codemirror/mode/haml/haml.js index 03ce833..86def73 100644 --- a/public/vendor/codemirror/mode/haml/haml.js +++ b/public/vendor/codemirror/mode/haml/haml.js @@ -11,7 +11,7 @@ })(function(CodeMirror) { "use strict"; - // full haml mode. This handled embeded ruby and html fragments too + // full haml mode. This handled embedded ruby and html fragments too CodeMirror.defineMode("haml", function(config) { var htmlMode = CodeMirror.getMode(config, {name: "htmlmixed"}); var rubyMode = CodeMirror.getMode(config, "ruby"); diff --git a/public/vendor/codemirror/mode/handlebars/index.html b/public/vendor/codemirror/mode/handlebars/index.html index 4f82d60..b1bfad1 100644 --- a/public/vendor/codemirror/mode/handlebars/index.html +++ b/public/vendor/codemirror/mode/handlebars/index.html @@ -1,4 +1,4 @@ - + CodeMirror: Handlebars mode @@ -71,4 +71,9 @@

Handlebars syntax highlighting for CodeMirror.

MIME types defined: text/x-handlebars-template

+ +

Supported options: base to set the mode to + wrap. For example, use

+
mode: {name: "handlebars", base: "text/html"}
+

to highlight an HTML template.

diff --git a/public/vendor/codemirror/mode/haskell-literate/haskell-literate.js b/public/vendor/codemirror/mode/haskell-literate/haskell-literate.js index 9358994..906415b 100644 --- a/public/vendor/codemirror/mode/haskell-literate/haskell-literate.js +++ b/public/vendor/codemirror/mode/haskell-literate/haskell-literate.js @@ -40,4 +40,4 @@ }, "haskell") CodeMirror.defineMIME("text/x-literate-haskell", "haskell-literate") -}) +}); diff --git a/public/vendor/codemirror/mode/htmlembedded/index.html b/public/vendor/codemirror/mode/htmlembedded/index.html index 365ef8f..f27582e 100644 --- a/public/vendor/codemirror/mode/htmlembedded/index.html +++ b/public/vendor/codemirror/mode/htmlembedded/index.html @@ -52,7 +52,7 @@ This is an example of EJS (embedded javascript)

Mode for html embedded scripts like JSP and ASP.NET. Depends on HtmlMixed which in turn depends on - JavaScript, CSS and XML.
Other dependancies include those of the scriping language chosen.

+ JavaScript, CSS and XML.
Other dependencies include those of the scripting language chosen.

MIME types defined: application/x-aspx (ASP.NET), application/x-ejs (Embedded Javascript), application/x-jsp (JavaServer Pages)

diff --git a/public/vendor/codemirror/mode/htmlmixed/htmlmixed.js b/public/vendor/codemirror/mode/htmlmixed/htmlmixed.js index 21e74f1..6574fbd 100644 --- a/public/vendor/codemirror/mode/htmlmixed/htmlmixed.js +++ b/public/vendor/codemirror/mode/htmlmixed/htmlmixed.js @@ -44,13 +44,9 @@ return attrRegexpCache[attr] = new RegExp("\\s+" + attr + "\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*"); } - function getAttrValue(stream, attr) { - var pos = stream.pos, match; - while (pos >= 0 && stream.string.charAt(pos) !== "<") pos--; - if (pos < 0) return pos; - if (match = stream.string.slice(pos, stream.pos).match(getAttrRegexp(attr))) - return match[2]; - return ""; + function getAttrValue(text, attr) { + var match = text.match(getAttrRegexp(attr)) + return match ? match[2] : "" } function getTagRegexp(tagName, anchored) { @@ -66,10 +62,10 @@ } } - function findMatchingMode(tagInfo, stream) { + function findMatchingMode(tagInfo, tagText) { for (var i = 0; i < tagInfo.length; i++) { var spec = tagInfo[i]; - if (!spec[0] || spec[1].test(getAttrValue(stream, spec[0]))) return spec[2]; + if (!spec[0] || spec[1].test(getAttrValue(tagText, spec[0]))) return spec[2]; } } @@ -89,15 +85,17 @@ tags.script.unshift(["type", configScript[i].matches, configScript[i].mode]) function html(stream, state) { - var tagName = state.htmlState.tagName && state.htmlState.tagName.toLowerCase(); - var tagInfo = tagName && tags.hasOwnProperty(tagName) && tags[tagName]; - - var style = htmlMode.token(stream, state.htmlState), modeSpec; - - if (tagInfo && /\btag\b/.test(style) && stream.current() === ">" && - (modeSpec = findMatchingMode(tagInfo, stream))) { - var mode = CodeMirror.getMode(config, modeSpec); - var endTagA = getTagRegexp(tagName, true), endTag = getTagRegexp(tagName, false); + var style = htmlMode.token(stream, state.htmlState), tag = /\btag\b/.test(style), tagName + if (tag && !/[<>\s\/]/.test(stream.current()) && + (tagName = state.htmlState.tagName && state.htmlState.tagName.toLowerCase()) && + tags.hasOwnProperty(tagName)) { + state.inTag = tagName + " " + } else if (state.inTag && tag && />$/.test(stream.current())) { + var inTag = /^([\S]+) (.*)/.exec(state.inTag) + state.inTag = null + var modeSpec = stream.current() == ">" && findMatchingMode(tags[inTag[1]], inTag[2]) + var mode = CodeMirror.getMode(config, modeSpec) + var endTagA = getTagRegexp(inTag[1], true), endTag = getTagRegexp(inTag[1], false); state.token = function (stream, state) { if (stream.match(endTagA, false)) { state.token = html; @@ -108,6 +106,9 @@ }; state.localMode = mode; state.localState = CodeMirror.startState(mode, htmlMode.indent(state.htmlState, "")); + } else if (state.inTag) { + state.inTag += stream.current() + if (stream.eol()) state.inTag += " " } return style; }; @@ -115,7 +116,7 @@ return { startState: function () { var state = htmlMode.startState(); - return {token: html, localMode: null, localState: null, htmlState: state}; + return {token: html, inTag: null, localMode: null, localState: null, htmlState: state}; }, copyState: function (state) { @@ -123,7 +124,8 @@ if (state.localState) { local = CodeMirror.copyState(state.localMode, state.localState); } - return {token: state.token, localMode: state.localMode, localState: local, + return {token: state.token, inTag: state.inTag, + localMode: state.localMode, localState: local, htmlState: CodeMirror.copyState(htmlMode, state.htmlState)}; }, diff --git a/public/vendor/codemirror/mode/index.html b/public/vendor/codemirror/mode/index.html index a6c293e..be58315 100644 --- a/public/vendor/codemirror/mode/index.html +++ b/public/vendor/codemirror/mode/index.html @@ -59,6 +59,7 @@ option.

  • Elm
  • Erlang
  • Factor
  • +
  • FCL
  • Forth
  • Fortran
  • F#
  • @@ -102,7 +103,9 @@ option.

  • PGP (ASCII armor)
  • PHP
  • Pig Latin
  • +
  • PowerShell
  • Properties files
  • +
  • ProtoBuf
  • Puppet
  • Python
  • Q
  • @@ -111,6 +114,7 @@ option.

  • reStructuredText
  • Ruby
  • Rust
  • +
  • SAS
  • Sass
  • Spreadsheet
  • Scala
  • @@ -146,8 +150,10 @@ option.

  • Verilog/SystemVerilog
  • VHDL
  • Vue.js app
  • +
  • Web IDL
  • XML/HTML
  • XQuery
  • +
  • Yacas
  • YAML
  • YAML frontmatter
  • Z80
  • diff --git a/public/vendor/codemirror/mode/jsx/jsx.js b/public/vendor/codemirror/mode/jsx/jsx.js index bc2ea79..aff01b8 100644 --- a/public/vendor/codemirror/mode/jsx/jsx.js +++ b/public/vendor/codemirror/mode/jsx/jsx.js @@ -25,9 +25,9 @@ context.prev && copyContext(context.prev)) } - CodeMirror.defineMode("jsx", function(config) { + CodeMirror.defineMode("jsx", function(config, modeConfig) { var xmlMode = CodeMirror.getMode(config, {name: "xml", allowMissing: true, multilineTagIndentPastTag: false}) - var jsMode = CodeMirror.getMode(config, "javascript") + var jsMode = CodeMirror.getMode(config, modeConfig && modeConfig.base || "javascript") function flatXMLIndent(state) { var tagName = state.tagName @@ -144,4 +144,4 @@ }, "xml", "javascript") CodeMirror.defineMIME("text/jsx", "jsx") -}) +}); diff --git a/public/vendor/codemirror/mode/julia/julia.js b/public/vendor/codemirror/mode/julia/julia.js index 4471896..004de44 100644 --- a/public/vendor/codemirror/mode/julia/julia.js +++ b/public/vendor/codemirror/mode/julia/julia.js @@ -14,27 +14,34 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) { var ERRORCLASS = 'error'; - function wordRegexp(words) { - return new RegExp("^((" + words.join(")|(") + "))\\b"); + function wordRegexp(words, end) { + if (typeof end === 'undefined') { end = "\\b"; } + return new RegExp("^((" + words.join(")|(") + "))" + end); } + var octChar = "\\\\[0-7]{1,3}"; + var hexChar = "\\\\x[A-Fa-f0-9]{1,2}"; + var specialChar = "\\\\[abfnrtv0%?'\"\\\\]"; + var singleChar = "([^\\u0027\\u005C\\uD800-\\uDFFF]|[\\uD800-\\uDFFF][\\uDC00-\\uDFFF])"; var operators = parserConf.operators || /^\.?[|&^\\%*+\-<>!=\/]=?|\?|~|:|\$|\.[<>]|<<=?|>>>?=?|\.[<>=]=|->?|\/\/|\bin\b(?!\()|[\u2208\u2209](?!\()/; var delimiters = parserConf.delimiters || /^[;,()[\]{}]/; - var identifiers = parserConf.identifiers || /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*!*/; + var identifiers = parserConf.identifiers || /^[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/; + var charsList = [octChar, hexChar, specialChar, singleChar]; var blockOpeners = ["begin", "function", "type", "immutable", "let", "macro", "for", "while", "quote", "if", "else", "elseif", "try", "finally", "catch", "do"]; var blockClosers = ["end", "else", "elseif", "catch", "finally"]; var keywordList = ['if', 'else', 'elseif', 'while', 'for', 'begin', 'let', 'end', 'do', 'try', 'catch', 'finally', 'return', 'break', 'continue', 'global', 'local', 'const', 'export', 'import', 'importall', 'using', 'function', 'macro', 'module', 'baremodule', 'type', 'immutable', 'quote', 'typealias', 'abstract', 'bitstype']; var builtinList = ['true', 'false', 'nothing', 'NaN', 'Inf']; //var stringPrefixes = new RegExp("^[br]?('|\")") - var stringPrefixes = /^(`|'|"{3}|([brv]?"))/; + var stringPrefixes = /^(`|"{3}|([brv]?"))/; + var chars = wordRegexp(charsList, "'"); var keywords = wordRegexp(keywordList); var builtins = wordRegexp(builtinList); var openers = wordRegexp(blockOpeners); var closers = wordRegexp(blockClosers); - var macro = /^@[_A-Za-z][_A-Za-z0-9]*/; - var symbol = /^:[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*!*/; - var typeAnnotation = /^::[^.,;"{()=$\s]+({[^}]*}+)*/; + var macro = /^@[_A-Za-z][\w]*/; + var symbol = /^:[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/; + var typeAnnotation = /^::[^,;"{()=$\s]+({[^}]*}+)*/; function inArray(state) { var ch = currentScope(state); @@ -53,19 +60,10 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) { // tokenizers function tokenBase(stream, state) { - //Handle multiline comments - if (stream.match(/^#=\s*/)) { - state.scopes.push('#='); - } - if (currentScope(state) == '#=' && stream.match(/^=#/)) { - state.scopes.pop(); - return 'comment'; - } - if (state.scopes.indexOf('#=') >= 0) { - if (!stream.match(/.*?(?=(#=|=#))/)) { - stream.skipToEnd(); - } - return 'comment'; + // Handle multiline comments + if (stream.match(/^#=/, false)) { + state.tokenize = tokenComment; + return state.tokenize(stream, state); } // Handle scope changes @@ -100,6 +98,10 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) { state.scopes.push('['); } + if (ch === '(') { + state.scopes.push('('); + } + var scope = currentScope(state); if (scope == '[' && ch === ']') { @@ -137,33 +139,20 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) { // Handle Number Literals if (stream.match(/^[0-9\.]/, false)) { var imMatcher = RegExp(/^im\b/); - var floatLiteral = false; + var numberLiteral = false; // Floats - if (stream.match(/^\d*\.(?!\.)\d+([ef][\+\-]?\d+)?/i)) { floatLiteral = true; } - if (stream.match(/^\d+\.(?!\.)\d*/)) { floatLiteral = true; } - if (stream.match(/^\.\d+/)) { floatLiteral = true; } - if (stream.match(/^0x\.[0-9a-f]+p[\+\-]?\d+/i)) { floatLiteral = true; } - if (floatLiteral) { - // Float literals may be "imaginary" - stream.match(imMatcher); - state.leavingExpr = true; - return 'number'; - } + if (stream.match(/^\d*\.(?!\.)\d*([Eef][\+\-]?\d+)?/i)) { numberLiteral = true; } + if (stream.match(/^\d+\.(?!\.)\d*/)) { numberLiteral = true; } + if (stream.match(/^\.\d+/)) { numberLiteral = true; } + if (stream.match(/^0x\.[0-9a-f]+p[\+\-]?\d+/i)) { numberLiteral = true; } // Integers - var intLiteral = false; - // Hex - if (stream.match(/^0x[0-9a-f]+/i)) { intLiteral = true; } - // Binary - if (stream.match(/^0b[01]+/i)) { intLiteral = true; } - // Octal - if (stream.match(/^0o[0-7]+/i)) { intLiteral = true; } - // Decimal - if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) { - intLiteral = true; - } + if (stream.match(/^0x[0-9a-f]+/i)) { numberLiteral = true; } // Hex + if (stream.match(/^0b[01]+/i)) { numberLiteral = true; } // Binary + if (stream.match(/^0o[0-7]+/i)) { numberLiteral = true; } // Octal + if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) { numberLiteral = true; } // Decimal // Zero by itself with no other piece of number. - if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; } - if (intLiteral) { + if (stream.match(/^0(?![\dx])/i)) { numberLiteral = true; } + if (numberLiteral) { // Integer literals may be "long" stream.match(imMatcher); state.leavingExpr = true; @@ -194,6 +183,12 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) { return 'operator'; } + // Handle Chars + if (stream.match(/^'/)) { + state.tokenize = tokenChar; + return state.tokenize(stream, state); + } + // Handle Strings if (stream.match(stringPrefixes)) { state.tokenize = tokenStringFactory(stream.current()); @@ -269,7 +264,7 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) { // over two or more lines. if (stream.match(/^$/g, false)) { stream.backUp(state.charsAdvanced); - while (state.scopes.length > state.firstParenPos + 1) + while (state.scopes.length > state.firstParenPos) state.scopes.pop(); state.firstParenPos = -1; state.charsAdvanced = 0; @@ -279,33 +274,65 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) { return callOrDef(stream, state); } + function tokenComment(stream, state) { + if (stream.match(/^#=/)) { + state.weakScopes++; + } + if (!stream.match(/.*?(?=(#=|=#))/)) { + stream.skipToEnd(); + } + if (stream.match(/^=#/)) { + state.weakScopes--; + if (state.weakScopes == 0) + state.tokenize = tokenBase; + } + return 'comment'; + } + + function tokenChar(stream, state) { + var isChar = false, match; + if (stream.match(chars)) { + isChar = true; + } else if (match = stream.match(/\\u([a-f0-9]{1,4})(?=')/i)) { + var value = parseInt(match[1], 16); + if (value <= 55295 || value >= 57344) { // (U+0,U+D7FF), (U+E000,U+FFFF) + isChar = true; + stream.next(); + } + } else if (match = stream.match(/\\U([A-Fa-f0-9]{5,8})(?=')/)) { + var value = parseInt(match[1], 16); + if (value <= 1114111) { // U+10FFFF + isChar = true; + stream.next(); + } + } + if (isChar) { + state.leavingExpr = true; + state.tokenize = tokenBase; + return 'string'; + } + if (!stream.match(/^[^']+(?=')/)) { stream.skipToEnd(); } + if (stream.match(/^'/)) { state.tokenize = tokenBase; } + return ERRORCLASS; + } + function tokenStringFactory(delimiter) { while ('bruv'.indexOf(delimiter.charAt(0).toLowerCase()) >= 0) { delimiter = delimiter.substr(1); } - var singleline = delimiter == "'"; var OUTCLASS = 'string'; function tokenString(stream, state) { while (!stream.eol()) { - stream.eatWhile(/[^'"\\]/); + stream.eatWhile(/[^"\\]/); if (stream.eat('\\')) { stream.next(); - if (singleline && stream.eol()) { - return OUTCLASS; - } } else if (stream.match(delimiter)) { state.tokenize = tokenBase; + state.leavingExpr = true; return OUTCLASS; } else { - stream.eat(/['"]/); - } - } - if (singleline) { - if (parserConf.singleLineStringErrors) { - return ERRORCLASS; - } else { - state.tokenize = tokenBase; + stream.eat(/["]/); } } return OUTCLASS; @@ -319,6 +346,7 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) { return { tokenize: tokenBase, scopes: [], + weakScopes: 0, lastToken: null, leavingExpr: false, isDefinition: false, @@ -345,15 +373,15 @@ CodeMirror.defineMode("julia", function(_conf, parserConf) { indent: function(state, textAfter) { var delta = 0; - if (textAfter == "end" || textAfter == "]" || textAfter == "}" || textAfter == "else" || textAfter == "elseif" || textAfter == "catch" || textAfter == "finally") { + if (textAfter == "]" || textAfter == ")" || textAfter == "end" || textAfter == "else" || textAfter == "elseif" || textAfter == "catch" || textAfter == "finally") { delta = -1; } return (state.scopes.length + delta) * _conf.indentUnit; }, + electricInput: /(end|else(if)?|catch|finally)$/, lineComment: "#", - fold: "indent", - electricChars: "edlsifyh]}" + fold: "indent" }; return external; }); diff --git a/public/vendor/codemirror/mode/markdown/markdown.js b/public/vendor/codemirror/mode/markdown/markdown.js index 415a6c7..8bd3cc7 100644 --- a/public/vendor/codemirror/mode/markdown/markdown.js +++ b/public/vendor/codemirror/mode/markdown/markdown.js @@ -88,7 +88,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { , setextHeaderRE = /^ *(?:\={1,}|-{1,})\s*$/ , textRE = /^[^#!\[\]*_\\<>` "'(~]+/ , fencedCodeRE = new RegExp("^(" + (modeCfg.fencedCodeBlocks === true ? "~~~+|```+" : modeCfg.fencedCodeBlocks) + - ")[ \\t]*([\\w+#]*)"); + ")[ \\t]*([\\w+#\-]*)"); function switchInline(stream, state, f) { state.f = state.inline = f; @@ -804,4 +804,4 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { CodeMirror.defineMIME("text/x-markdown", "markdown"); -}); \ No newline at end of file +}); diff --git a/public/vendor/codemirror/mode/markdown/test.js b/public/vendor/codemirror/mode/markdown/test.js index 6d7829f..e2b3a81 100644 --- a/public/vendor/codemirror/mode/markdown/test.js +++ b/public/vendor/codemirror/mode/markdown/test.js @@ -452,6 +452,18 @@ "", "hello"); + MT("listCommonMarkIndentationCode", + "[variable-2 * Code blocks also affect]", + " [variable-3 * The next level starts where the contents start.]", + " [variable-3 * Anything less than that will keep the item on the same level.]", + " [variable-3 * Each list item can indent the first level further and further.]", + " [variable-3 * For the most part, this makes sense while writing a list.]", + " [keyword * This means two items with same indentation can be different levels.]", + " [keyword * Each level has an indent requirement that can change between items.]", + " [keyword * A list item that meets this will be part of the next level.]", + " [variable-3 * Otherwise, it will be part of the level where it does meet this.]", + " [variable-2 * World]"); + // Blockquote MT("blockquote", "[variable-2 * foo]", @@ -635,7 +647,7 @@ MT("linkReferenceEmStrong", "[link [[][link&strong **][link&em&strong *foo**][link&em *][link ]]][string&url [[bar]]] hello"); - // Reference-style links with optional space separator (per docuentation) + // Reference-style links with optional space separator (per documentation) // "You can optionally use a space to separate the sets of brackets" MT("linkReferenceSpace", "[link [[foo]]] [string&url [[bar]]] hello"); @@ -671,7 +683,7 @@ MT("labelTitleSingleQuotes", "[link [[foo]]:] [string&url http://example.com/ 'bar']"); - MT("labelTitleParenthese", + MT("labelTitleParentheses", "[link [[foo]]:] [string&url http://example.com/ (bar)]"); MT("labelTitleInvalid", @@ -688,7 +700,7 @@ "[link [[foo]]:] [string&url http://example.com/]", "[string 'bar'] hello"); - MT("labelTitleNextParenthese", + MT("labelTitleNextParentheses", "[link [[foo]]:] [string&url http://example.com/]", "[string (bar)] hello"); diff --git a/public/vendor/codemirror/mode/mathematica/mathematica.js b/public/vendor/codemirror/mode/mathematica/mathematica.js index 5ae6f55..d697708 100644 --- a/public/vendor/codemirror/mode/mathematica/mathematica.js +++ b/public/vendor/codemirror/mode/mathematica/mathematica.js @@ -126,6 +126,7 @@ CodeMirror.defineMode('mathematica', function(_config, _parserConfig) { } // everything else is an error + stream.next(); // advance the stream. return 'error'; } diff --git a/public/vendor/codemirror/mode/meta.js b/public/vendor/codemirror/mode/meta.js index 4952071..6980593 100644 --- a/public/vendor/codemirror/mode/meta.js +++ b/public/vendor/codemirror/mode/meta.js @@ -21,7 +21,8 @@ {name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], alias: ["cpp"]}, {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy"]}, {name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp"]}, - {name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj"]}, + {name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj", "cljc", "cljx"]}, + {name: "ClojureScript", mime: "text/x-clojurescript", mode: "clojure", ext: ["cljs"]}, {name: "Closure Stylesheets (GSS)", mime: "text/x-gss", mode: "css", ext: ["gss"]}, {name: "CMake", mime: "text/x-cmake", mode: "cmake", ext: ["cmake", "cmake.in"], file: /^CMakeLists.txt$/}, {name: "CoffeeScript", mime: "text/x-coffeescript", mode: "coffeescript", ext: ["coffee"], alias: ["coffee", "coffee-script"]}, @@ -40,12 +41,14 @@ {name: "Dylan", mime: "text/x-dylan", mode: "dylan", ext: ["dylan", "dyl", "intr"]}, {name: "EBNF", mime: "text/x-ebnf", mode: "ebnf"}, {name: "ECL", mime: "text/x-ecl", mode: "ecl", ext: ["ecl"]}, + {name: "edn", mime: "application/edn", mode: "clojure", ext: ["edn"]}, {name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel", ext: ["e"]}, {name: "Elm", mime: "text/x-elm", mode: "elm", ext: ["elm"]}, {name: "Embedded Javascript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]}, {name: "Embedded Ruby", mime: "application/x-erb", mode: "htmlembedded", ext: ["erb"]}, {name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]}, {name: "Factor", mime: "text/x-factor", mode: "factor", ext: ["factor"]}, + {name: "FCL", mime: "text/x-fcl", mode: "fcl"}, {name: "Forth", mime: "text/x-forth", mode: "forth", ext: ["forth", "fth", "4th"]}, {name: "Fortran", mime: "text/x-fortran", mode: "fortran", ext: ["f", "for", "f77", "f90"]}, {name: "F#", mime: "text/x-fsharp", mode: "mllike", ext: ["fs"], alias: ["fsharp"]}, @@ -53,7 +56,7 @@ {name: "Gherkin", mime: "text/x-feature", mode: "gherkin", ext: ["feature"]}, {name: "GitHub Flavored Markdown", mime: "text/x-gfm", mode: "gfm", file: /^(readme|contributing|history).md$/i}, {name: "Go", mime: "text/x-go", mode: "go", ext: ["go"]}, - {name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy"]}, + {name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy", "gradle"]}, {name: "HAML", mime: "text/x-haml", mode: "haml", ext: ["haml"]}, {name: "Haskell", mime: "text/x-haskell", mode: "haskell", ext: ["hs"]}, {name: "Haskell (Literate)", mime: "text/x-literate-haskell", mode: "haskell-literate", ext: ["lhs"]}, @@ -82,13 +85,13 @@ {name: "MariaDB SQL", mime: "text/x-mariadb", mode: "sql"}, {name: "Mathematica", mime: "text/x-mathematica", mode: "mathematica", ext: ["m", "nb"]}, {name: "Modelica", mime: "text/x-modelica", mode: "modelica", ext: ["mo"]}, - {name: "MUMPS", mime: "text/x-mumps", mode: "mumps"}, + {name: "MUMPS", mime: "text/x-mumps", mode: "mumps", ext: ["mps"]}, {name: "MS SQL", mime: "text/x-mssql", mode: "sql"}, {name: "MySQL", mime: "text/x-mysql", mode: "sql"}, {name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx", file: /nginx.*\.conf$/i}, {name: "NSIS", mime: "text/x-nsis", mode: "nsis", ext: ["nsh", "nsi"]}, {name: "NTriples", mime: "text/n-triples", mode: "ntriples", ext: ["nt"]}, - {name: "Objective C", mime: "text/x-objectivec", mode: "clike", ext: ["m", "mm"]}, + {name: "Objective C", mime: "text/x-objectivec", mode: "clike", ext: ["m", "mm"], alias: ["objective-c", "objc"]}, {name: "OCaml", mime: "text/x-ocaml", mode: "mllike", ext: ["ml", "mli", "mll", "mly"]}, {name: "Octave", mime: "text/x-octave", mode: "octave", ext: ["m"]}, {name: "Oz", mime: "text/x-oz", mode: "oz", ext: ["oz"]}, @@ -99,8 +102,10 @@ {name: "Pig", mime: "text/x-pig", mode: "pig", ext: ["pig"]}, {name: "Plain Text", mime: "text/plain", mode: "null", ext: ["txt", "text", "conf", "def", "list", "log"]}, {name: "PLSQL", mime: "text/x-plsql", mode: "sql", ext: ["pls"]}, + {name: "PowerShell", mime: "application/x-powershell", mode: "powershell", ext: ["ps1", "psd1", "psm1"]}, {name: "Properties files", mime: "text/x-properties", mode: "properties", ext: ["properties", "ini", "in"], alias: ["ini", "properties"]}, - {name: "Python", mime: "text/x-python", mode: "python", ext: ["py", "pyw"]}, + {name: "ProtoBuf", mime: "text/x-protobuf", mode: "protobuf", ext: ["proto"]}, + {name: "Python", mime: "text/x-python", mode: "python", ext: ["BUILD", "bzl", "py", "pyw"], file: /^(BUCK|BUILD)$/}, {name: "Puppet", mime: "text/x-puppet", mode: "puppet", ext: ["pp"]}, {name: "Q", mime: "text/x-q", mode: "q", ext: ["q"]}, {name: "R", mime: "text/x-rsrc", mode: "r", ext: ["r"], alias: ["rscript"]}, @@ -109,6 +114,7 @@ {name: "RPM Spec", mime: "text/x-rpm-spec", mode: "rpm", ext: ["spec"]}, {name: "Ruby", mime: "text/x-ruby", mode: "ruby", ext: ["rb"], alias: ["jruby", "macruby", "rake", "rb", "rbx"]}, {name: "Rust", mime: "text/x-rustsrc", mode: "rust", ext: ["rs"]}, + {name: "SAS", mime: "text/x-sas", mode: "sas", ext: ["sas"]}, {name: "Sass", mime: "text/x-sass", mode: "sass", ext: ["sass"]}, {name: "Scala", mime: "text/x-scala", mode: "clike", ext: ["scala"]}, {name: "Scheme", mime: "text/x-scheme", mode: "scheme", ext: ["scm", "ss"]}, @@ -125,7 +131,6 @@ {name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]}, {name: "Squirrel", mime: "text/x-squirrel", mode: "clike", ext: ["nut"]}, {name: "Swift", mime: "text/x-swift", mode: "swift", ext: ["swift"]}, - {name: "MariaDB", mime: "text/x-mariadb", mode: "sql"}, {name: "sTeX", mime: "text/x-stex", mode: "stex"}, {name: "LaTeX", mime: "text/x-latex", mode: "stex", ext: ["text", "ltx"], alias: ["tex"]}, {name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog", ext: ["v"]}, @@ -135,12 +140,13 @@ {name: "Tiki wiki", mime: "text/tiki", mode: "tiki"}, {name: "TOML", mime: "text/x-toml", mode: "toml", ext: ["toml"]}, {name: "Tornado", mime: "text/x-tornado", mode: "tornado"}, - {name: "troff", mime: "troff", mode: "troff", ext: ["1", "2", "3", "4", "5", "6", "7", "8", "9"]}, + {name: "troff", mime: "text/troff", mode: "troff", ext: ["1", "2", "3", "4", "5", "6", "7", "8", "9"]}, {name: "TTCN", mime: "text/x-ttcn", mode: "ttcn", ext: ["ttcn", "ttcn3", "ttcnpp"]}, {name: "TTCN_CFG", mime: "text/x-ttcn-cfg", mode: "ttcn-cfg", ext: ["cfg"]}, {name: "Turtle", mime: "text/turtle", mode: "turtle", ext: ["ttl"]}, {name: "TypeScript", mime: "application/typescript", mode: "javascript", ext: ["ts"], alias: ["ts"]}, {name: "Twig", mime: "text/x-twig", mode: "twig"}, + {name: "Web IDL", mime: "text/x-webidl", mode: "webidl", ext: ["webidl"]}, {name: "VB.NET", mime: "text/x-vb", mode: "vb", ext: ["vb"]}, {name: "VBScript", mime: "text/vbscript", mode: "vbscript", ext: ["vbs"]}, {name: "Velocity", mime: "text/velocity", mode: "velocity", ext: ["vtl"]}, @@ -148,6 +154,7 @@ {name: "VHDL", mime: "text/x-vhdl", mode: "vhdl", ext: ["vhd", "vhdl"]}, {name: "XML", mimes: ["application/xml", "text/xml"], mode: "xml", ext: ["xml", "xsl", "xsd"], alias: ["rss", "wsdl", "xsd"]}, {name: "XQuery", mime: "application/xquery", mode: "xquery", ext: ["xy", "xquery"]}, + {name: "Yacas", mime: "text/x-yacas", mode: "yacas", ext: ["ys"]}, {name: "YAML", mime: "text/x-yaml", mode: "yaml", ext: ["yaml", "yml"], alias: ["yml"]}, {name: "Z80", mime: "text/x-z80", mode: "z80", ext: ["z80"]}, {name: "mscgen", mime: "text/x-mscgen", mode: "mscgen", ext: ["mscgen", "mscin", "msc"]}, diff --git a/public/vendor/codemirror/mode/octave/index.html b/public/vendor/codemirror/mode/octave/index.html index 79df581..3490ee6 100644 --- a/public/vendor/codemirror/mode/octave/index.html +++ b/public/vendor/codemirror/mode/octave/index.html @@ -65,7 +65,7 @@ global persistent %one line comment %{ multi -line commment %} +line comment %} + + + + + +
    +

    PowerShell mode

    + +
    + + +

    MIME types defined: application/x-powershell.

    +
    + + diff --git a/public/vendor/codemirror/mode/powershell/powershell.js b/public/vendor/codemirror/mode/powershell/powershell.js new file mode 100644 index 0000000..c443e72 --- /dev/null +++ b/public/vendor/codemirror/mode/powershell/powershell.js @@ -0,0 +1,396 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + 'use strict'; + if (typeof exports == 'object' && typeof module == 'object') // CommonJS + mod(require('codemirror')); + else if (typeof define == 'function' && define.amd) // AMD + define(['codemirror'], mod); + else // Plain browser env + mod(window.CodeMirror); +})(function(CodeMirror) { +'use strict'; + +CodeMirror.defineMode('powershell', function() { + function buildRegexp(patterns, options) { + options = options || {}; + var prefix = options.prefix !== undefined ? options.prefix : '^'; + var suffix = options.suffix !== undefined ? options.suffix : '\\b'; + + for (var i = 0; i < patterns.length; i++) { + if (patterns[i] instanceof RegExp) { + patterns[i] = patterns[i].source; + } + else { + patterns[i] = patterns[i].replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); + } + } + + return new RegExp(prefix + '(' + patterns.join('|') + ')' + suffix, 'i'); + } + + var notCharacterOrDash = '(?=[^A-Za-z\\d\\-_]|$)'; + var varNames = /[\w\-:]/ + var keywords = buildRegexp([ + /begin|break|catch|continue|data|default|do|dynamicparam/, + /else|elseif|end|exit|filter|finally|for|foreach|from|function|if|in/, + /param|process|return|switch|throw|trap|try|until|where|while/ + ], { suffix: notCharacterOrDash }); + + var punctuation = /[\[\]{},;`\.]|@[({]/; + var wordOperators = buildRegexp([ + 'f', + /b?not/, + /[ic]?split/, 'join', + /is(not)?/, 'as', + /[ic]?(eq|ne|[gl][te])/, + /[ic]?(not)?(like|match|contains)/, + /[ic]?replace/, + /b?(and|or|xor)/ + ], { prefix: '-' }); + var symbolOperators = /[+\-*\/%]=|\+\+|--|\.\.|[+\-*&^%:=!|\/]|<(?!#)|(?!#)>/; + var operators = buildRegexp([wordOperators, symbolOperators], { suffix: '' }); + + var numbers = /^((0x[\da-f]+)|((\d+\.\d+|\d\.|\.\d+|\d+)(e[\+\-]?\d+)?))[ld]?([kmgtp]b)?/i; + + var identifiers = /^[A-Za-z\_][A-Za-z\-\_\d]*\b/; + + var symbolBuiltins = /[A-Z]:|%|\?/i; + var namedBuiltins = buildRegexp([ + /Add-(Computer|Content|History|Member|PSSnapin|Type)/, + /Checkpoint-Computer/, + /Clear-(Content|EventLog|History|Host|Item(Property)?|Variable)/, + /Compare-Object/, + /Complete-Transaction/, + /Connect-PSSession/, + /ConvertFrom-(Csv|Json|SecureString|StringData)/, + /Convert-Path/, + /ConvertTo-(Csv|Html|Json|SecureString|Xml)/, + /Copy-Item(Property)?/, + /Debug-Process/, + /Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)/, + /Disconnect-PSSession/, + /Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)/, + /(Enter|Exit)-PSSession/, + /Export-(Alias|Clixml|Console|Counter|Csv|FormatData|ModuleMember|PSSession)/, + /ForEach-Object/, + /Format-(Custom|List|Table|Wide)/, + new RegExp('Get-(Acl|Alias|AuthenticodeSignature|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Counter|Credential' + + '|Culture|Date|Event|EventLog|EventSubscriber|ExecutionPolicy|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job' + + '|Location|Member|Module|PfxCertificate|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration' + + '|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|Verb|WinEvent|WmiObject)'), + /Group-Object/, + /Import-(Alias|Clixml|Counter|Csv|LocalizedData|Module|PSSession)/, + /ImportSystemModules/, + /Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)/, + /Join-Path/, + /Limit-EventLog/, + /Measure-(Command|Object)/, + /Move-Item(Property)?/, + new RegExp('New-(Alias|Event|EventLog|Item(Property)?|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile' + + '|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy|WinEvent)'), + /Out-(Default|File|GridView|Host|Null|Printer|String)/, + /Pause/, + /(Pop|Push)-Location/, + /Read-Host/, + /Receive-(Job|PSSession)/, + /Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)/, + /Remove-(Computer|Event|EventLog|Item(Property)?|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)/, + /Rename-(Computer|Item(Property)?)/, + /Reset-ComputerMachinePassword/, + /Resolve-Path/, + /Restart-(Computer|Service)/, + /Restore-Computer/, + /Resume-(Job|Service)/, + /Save-Help/, + /Select-(Object|String|Xml)/, + /Send-MailMessage/, + new RegExp('Set-(Acl|Alias|AuthenticodeSignature|Content|Date|ExecutionPolicy|Item(Property)?|Location|PSBreakpoint|PSDebug' + + '|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)'), + /Show-(Command|ControlPanelItem|EventLog)/, + /Sort-Object/, + /Split-Path/, + /Start-(Job|Process|Service|Sleep|Transaction|Transcript)/, + /Stop-(Computer|Job|Process|Service|Transcript)/, + /Suspend-(Job|Service)/, + /TabExpansion2/, + /Tee-Object/, + /Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)/, + /Trace-Command/, + /Unblock-File/, + /Undo-Transaction/, + /Unregister-(Event|PSSessionConfiguration)/, + /Update-(FormatData|Help|List|TypeData)/, + /Use-Transaction/, + /Wait-(Event|Job|Process)/, + /Where-Object/, + /Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning)/, + /cd|help|mkdir|more|oss|prompt/, + /ac|asnp|cat|cd|chdir|clc|clear|clhy|cli|clp|cls|clv|cnsn|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|dnsn|ebp/, + /echo|epal|epcsv|epsn|erase|etsn|exsn|fc|fl|foreach|ft|fw|gal|gbp|gc|gci|gcm|gcs|gdr|ghy|gi|gjb|gl|gm|gmo|gp|gps/, + /group|gsn|gsnp|gsv|gu|gv|gwmi|h|history|icm|iex|ihy|ii|ipal|ipcsv|ipmo|ipsn|irm|ise|iwmi|iwr|kill|lp|ls|man|md/, + /measure|mi|mount|move|mp|mv|nal|ndr|ni|nmo|npssc|nsn|nv|ogv|oh|popd|ps|pushd|pwd|r|rbp|rcjb|rcsn|rd|rdr|ren|ri/, + /rjb|rm|rmdir|rmo|rni|rnp|rp|rsn|rsnp|rujb|rv|rvpa|rwmi|sajb|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls/, + /sort|sp|spjb|spps|spsv|start|sujb|sv|swmi|tee|trcm|type|where|wjb|write/ + ], { prefix: '', suffix: '' }); + var variableBuiltins = buildRegexp([ + /[$?^_]|Args|ConfirmPreference|ConsoleFileName|DebugPreference|Error|ErrorActionPreference|ErrorView|ExecutionContext/, + /FormatEnumerationLimit|Home|Host|Input|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount/, + /MaximumHistoryCount|MaximumVariableCount|MyInvocation|NestedPromptLevel|OutputEncoding|Pid|Profile|ProgressPreference/, + /PSBoundParameters|PSCommandPath|PSCulture|PSDefaultParameterValues|PSEmailServer|PSHome|PSScriptRoot|PSSessionApplicationName/, + /PSSessionConfigurationName|PSSessionOption|PSUICulture|PSVersionTable|Pwd|ShellId|StackTrace|VerbosePreference/, + /WarningPreference|WhatIfPreference/, + + /Event|EventArgs|EventSubscriber|Sender/, + /Matches|Ofs|ForEach|LastExitCode|PSCmdlet|PSItem|PSSenderInfo|This/, + /true|false|null/ + ], { prefix: '\\$', suffix: '' }); + + var builtins = buildRegexp([symbolBuiltins, namedBuiltins, variableBuiltins], { suffix: notCharacterOrDash }); + + var grammar = { + keyword: keywords, + number: numbers, + operator: operators, + builtin: builtins, + punctuation: punctuation, + identifier: identifiers + }; + + // tokenizers + function tokenBase(stream, state) { + // Handle Comments + //var ch = stream.peek(); + + var parent = state.returnStack[state.returnStack.length - 1]; + if (parent && parent.shouldReturnFrom(state)) { + state.tokenize = parent.tokenize; + state.returnStack.pop(); + return state.tokenize(stream, state); + } + + if (stream.eatSpace()) { + return null; + } + + if (stream.eat('(')) { + state.bracketNesting += 1; + return 'punctuation'; + } + + if (stream.eat(')')) { + state.bracketNesting -= 1; + return 'punctuation'; + } + + for (var key in grammar) { + if (stream.match(grammar[key])) { + return key; + } + } + + var ch = stream.next(); + + // single-quote string + if (ch === "'") { + return tokenSingleQuoteString(stream, state); + } + + if (ch === '$') { + return tokenVariable(stream, state); + } + + // double-quote string + if (ch === '"') { + return tokenDoubleQuoteString(stream, state); + } + + if (ch === '<' && stream.eat('#')) { + state.tokenize = tokenComment; + return tokenComment(stream, state); + } + + if (ch === '#') { + stream.skipToEnd(); + return 'comment'; + } + + if (ch === '@') { + var quoteMatch = stream.eat(/["']/); + if (quoteMatch && stream.eol()) { + state.tokenize = tokenMultiString; + state.startQuote = quoteMatch[0]; + return tokenMultiString(stream, state); + } else if (stream.peek().match(/[({]/)) { + return 'punctuation'; + } else if (stream.peek().match(varNames)) { + // splatted variable + return tokenVariable(stream, state); + } + } + return 'error'; + } + + function tokenSingleQuoteString(stream, state) { + var ch; + while ((ch = stream.peek()) != null) { + stream.next(); + + if (ch === "'" && !stream.eat("'")) { + state.tokenize = tokenBase; + return 'string'; + } + } + + return 'error'; + } + + function tokenDoubleQuoteString(stream, state) { + var ch; + while ((ch = stream.peek()) != null) { + if (ch === '$') { + state.tokenize = tokenStringInterpolation; + return 'string'; + } + + stream.next(); + if (ch === '`') { + stream.next(); + continue; + } + + if (ch === '"' && !stream.eat('"')) { + state.tokenize = tokenBase; + return 'string'; + } + } + + return 'error'; + } + + function tokenStringInterpolation(stream, state) { + return tokenInterpolation(stream, state, tokenDoubleQuoteString); + } + + function tokenMultiStringReturn(stream, state) { + state.tokenize = tokenMultiString; + state.startQuote = '"' + return tokenMultiString(stream, state); + } + + function tokenHereStringInterpolation(stream, state) { + return tokenInterpolation(stream, state, tokenMultiStringReturn); + } + + function tokenInterpolation(stream, state, parentTokenize) { + if (stream.match('$(')) { + var savedBracketNesting = state.bracketNesting; + state.returnStack.push({ + /*jshint loopfunc:true */ + shouldReturnFrom: function(state) { + return state.bracketNesting === savedBracketNesting; + }, + tokenize: parentTokenize + }); + state.tokenize = tokenBase; + state.bracketNesting += 1; + return 'punctuation'; + } else { + stream.next(); + state.returnStack.push({ + shouldReturnFrom: function() { return true; }, + tokenize: parentTokenize + }); + state.tokenize = tokenVariable; + return state.tokenize(stream, state); + } + } + + function tokenComment(stream, state) { + var maybeEnd = false, ch; + while ((ch = stream.next()) != null) { + if (maybeEnd && ch == '>') { + state.tokenize = tokenBase; + break; + } + maybeEnd = (ch === '#'); + } + return 'comment'; + } + + function tokenVariable(stream, state) { + var ch = stream.peek(); + if (stream.eat('{')) { + state.tokenize = tokenVariableWithBraces; + return tokenVariableWithBraces(stream, state); + } else if (ch != undefined && ch.match(varNames)) { + stream.eatWhile(varNames); + state.tokenize = tokenBase; + return 'variable-2'; + } else { + state.tokenize = tokenBase; + return 'error'; + } + } + + function tokenVariableWithBraces(stream, state) { + var ch; + while ((ch = stream.next()) != null) { + if (ch === '}') { + state.tokenize = tokenBase; + break; + } + } + return 'variable-2'; + } + + function tokenMultiString(stream, state) { + var quote = state.startQuote; + if (stream.sol() && stream.match(new RegExp(quote + '@'))) { + state.tokenize = tokenBase; + } + else if (quote === '"') { + while (!stream.eol()) { + var ch = stream.peek(); + if (ch === '$') { + state.tokenize = tokenHereStringInterpolation; + return 'string'; + } + + stream.next(); + if (ch === '`') { + stream.next(); + } + } + } + else { + stream.skipToEnd(); + } + + return 'string'; + } + + var external = { + startState: function() { + return { + returnStack: [], + bracketNesting: 0, + tokenize: tokenBase + }; + }, + + token: function(stream, state) { + return state.tokenize(stream, state); + }, + + blockCommentStart: '<#', + blockCommentEnd: '#>', + lineComment: '#', + fold: 'brace' + }; + return external; +}); + +CodeMirror.defineMIME('application/x-powershell', 'powershell'); +}); diff --git a/public/vendor/codemirror/mode/powershell/test.js b/public/vendor/codemirror/mode/powershell/test.js new file mode 100644 index 0000000..59b8e6f --- /dev/null +++ b/public/vendor/codemirror/mode/powershell/test.js @@ -0,0 +1,72 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function() { + var mode = CodeMirror.getMode({indentUnit: 2}, "powershell"); + function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } + + MT('comment', '[number 1][comment # A]'); + MT('comment_multiline', '[number 1][comment <#]', + '[comment ABC]', + '[comment #>][number 2]'); + + [ + '0', '1234', + '12kb', '12mb', '12Gb', '12Tb', '12PB', '12L', '12D', '12lkb', '12dtb', + '1.234', '1.234e56', '1.', '1.e2', '.2', '.2e34', + '1.2MB', '1.kb', '.1dTB', '1.e1gb', '.2', '.2e34', + '0x1', '0xabcdef', '0x3tb', '0xelmb' + ].forEach(function(number) { + MT("number_" + number, "[number " + number + "]"); + }); + + MT('string_literal_escaping', "[string 'a''']"); + MT('string_literal_variable', "[string 'a $x']"); + MT('string_escaping_1', '[string "a `""]'); + MT('string_escaping_2', '[string "a """]'); + MT('string_variable_escaping', '[string "a `$x"]'); + MT('string_variable', '[string "a ][variable-2 $x][string b"]'); + MT('string_variable_spaces', '[string "a ][variable-2 ${x y}][string b"]'); + MT('string_expression', '[string "a ][punctuation $(][variable-2 $x][operator +][number 3][punctuation )][string b"]'); + MT('string_expression_nested', '[string "A][punctuation $(][string "a][punctuation $(][string "w"][punctuation )][string b"][punctuation )][string B"]'); + + MT('string_heredoc', '[string @"]', + '[string abc]', + '[string "@]'); + MT('string_heredoc_quotes', '[string @"]', + '[string abc "\']', + '[string "@]'); + MT('string_heredoc_variable', '[string @"]', + '[string a ][variable-2 $x][string b]', + '[string "@]'); + MT('string_heredoc_nested_string', '[string @"]', + '[string a][punctuation $(][string "w"][punctuation )][string b]', + '[string "@]'); + MT('string_heredoc_literal_quotes', "[string @']", + '[string abc "\']', + "[string '@]"); + + MT('array', "[punctuation @(][string 'a'][punctuation ,][string 'b'][punctuation )]"); + MT('hash', "[punctuation @{][string 'key'][operator :][string 'value'][punctuation }]"); + + MT('variable', "[variable-2 $test]"); + MT('variable_global', "[variable-2 $global:test]"); + MT('variable_spaces', "[variable-2 ${test test}]"); + MT('operator_splat', "[variable-2 @x]"); + MT('variable_builtin', "[builtin $ErrorActionPreference]"); + MT('variable_builtin_symbols', "[builtin $$]"); + + MT('operator', "[operator +]"); + MT('operator_unary', "[operator +][number 3]"); + MT('operator_long', "[operator -match]"); + + [ + '(', ')', '[[', ']]', '{', '}', ',', '`', ';', '.' + ].forEach(function(punctuation) { + MT("punctuation_" + punctuation.replace(/^[\[\]]/,''), "[punctuation " + punctuation + "]"); + }); + + MT('keyword', "[keyword if]"); + + MT('call_builtin', "[builtin Get-ChildItem]"); +})(); diff --git a/public/vendor/codemirror/mode/properties/properties.js b/public/vendor/codemirror/mode/properties/properties.js index 9da5baf..ef8bf37 100644 --- a/public/vendor/codemirror/mode/properties/properties.js +++ b/public/vendor/codemirror/mode/properties/properties.js @@ -34,7 +34,7 @@ CodeMirror.defineMode("properties", function() { } if (sol) { - while(stream.eatSpace()); + while(stream.eatSpace()) {} } var ch = stream.next(); diff --git a/public/vendor/codemirror/mode/protobuf/index.html b/public/vendor/codemirror/mode/protobuf/index.html new file mode 100644 index 0000000..cfe7b9d --- /dev/null +++ b/public/vendor/codemirror/mode/protobuf/index.html @@ -0,0 +1,64 @@ + + +CodeMirror: ProtoBuf mode + + + + + + + + + +
    +

    ProtoBuf mode

    +
    + + +

    MIME types defined: text/x-protobuf.

    + +
    diff --git a/public/vendor/codemirror/mode/protobuf/protobuf.js b/public/vendor/codemirror/mode/protobuf/protobuf.js new file mode 100644 index 0000000..bcae276 --- /dev/null +++ b/public/vendor/codemirror/mode/protobuf/protobuf.js @@ -0,0 +1,68 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + function wordRegexp(words) { + return new RegExp("^((" + words.join(")|(") + "))\\b", "i"); + }; + + var keywordArray = [ + "package", "message", "import", "syntax", + "required", "optional", "repeated", "reserved", "default", "extensions", "packed", + "bool", "bytes", "double", "enum", "float", "string", + "int32", "int64", "uint32", "uint64", "sint32", "sint64", "fixed32", "fixed64", "sfixed32", "sfixed64" + ]; + var keywords = wordRegexp(keywordArray); + + CodeMirror.registerHelper("hintWords", "protobuf", keywordArray); + + var identifiers = new RegExp("^[_A-Za-z\xa1-\uffff][_A-Za-z0-9\xa1-\uffff]*"); + + function tokenBase(stream) { + // whitespaces + if (stream.eatSpace()) return null; + + // Handle one line Comments + if (stream.match("//")) { + stream.skipToEnd(); + return "comment"; + } + + // Handle Number Literals + if (stream.match(/^[0-9\.+-]/, false)) { + if (stream.match(/^[+-]?0x[0-9a-fA-F]+/)) + return "number"; + if (stream.match(/^[+-]?\d*\.\d+([EeDd][+-]?\d+)?/)) + return "number"; + if (stream.match(/^[+-]?\d+([EeDd][+-]?\d+)?/)) + return "number"; + } + + // Handle Strings + if (stream.match(/^"([^"]|(""))*"/)) { return "string"; } + if (stream.match(/^'([^']|(''))*'/)) { return "string"; } + + // Handle words + if (stream.match(keywords)) { return "keyword"; } + if (stream.match(identifiers)) { return "variable"; } ; + + // Handle non-detected items + stream.next(); + return null; + }; + + CodeMirror.defineMode("protobuf", function() { + return {token: tokenBase}; + }); + + CodeMirror.defineMIME("text/x-protobuf", "protobuf"); +}); diff --git a/public/vendor/codemirror/mode/puppet/puppet.js b/public/vendor/codemirror/mode/puppet/puppet.js index e7f799f..5704130 100644 --- a/public/vendor/codemirror/mode/puppet/puppet.js +++ b/public/vendor/codemirror/mode/puppet/puppet.js @@ -126,7 +126,7 @@ CodeMirror.defineMode("puppet", function () { if (word && words.hasOwnProperty(word)) { // Negates the initial next() stream.backUp(1); - // Acutally move the stream + // rs move the stream stream.match(/[\w]+/); // We want to process these words differently // do to the importance they have in Puppet diff --git a/public/vendor/codemirror/mode/python/index.html b/public/vendor/codemirror/mode/python/index.html index 86eb3d5..6116a13 100644 --- a/public/vendor/codemirror/mode/python/index.html +++ b/public/vendor/codemirror/mode/python/index.html @@ -186,7 +186,7 @@ def pairwise_cython(double[:, ::1] X):
  • singleOperators - RegEx - Regular Expression for single operator matching, default :
    ^[\\+\\-\\*/%&|\\^~<>!]
    including
    @
    on Python 3
  • singleDelimiters - RegEx - Regular Expression for single delimiter matching, default :
    ^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]
  • doubleOperators - RegEx - Regular Expression for double operators matching, default :
    ^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))
  • -
  • doubleDelimiters - RegEx - Regular Expressoin for double delimiters matching, default :
    ^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))
  • +
  • doubleDelimiters - RegEx - Regular Expression for double delimiters matching, default :
    ^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))
  • tripleDelimiters - RegEx - Regular Expression for triple delimiters matching, default :
    ^((//=)|(>>=)|(<<=)|(\\*\\*=))
  • identifiers - RegEx - Regular Expression for identifier, default :
    ^[_A-Za-z][_A-Za-z0-9]*
    on Python 2 and
    ^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*
    on Python 3.
  • extra_keywords - list of string - List of extra words ton consider as keywords
  • diff --git a/public/vendor/codemirror/mode/python/python.js b/public/vendor/codemirror/mode/python/python.js index 553f2d6..196b026 100644 --- a/public/vendor/codemirror/mode/python/python.js +++ b/public/vendor/codemirror/mode/python/python.js @@ -53,7 +53,7 @@ var doubleDelimiters = parserConf.doubleDelimiters || /^(\+=|\-=|\*=|%=|\/=|&=|\|=|\^=)/; var tripleDelimiters = parserConf.tripleDelimiters || /^(\/\/=|>>=|<<=|\*\*=)/; - if (parserConf.version && parseInt(parserConf.version, 10) == 3){ + if (parserConf.version && parseInt(parserConf.version, 10) == 3) { // since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator var singleOperators = parserConf.singleOperators || /^[\+\-\*\/%&|\^~<>!@]/; var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/; @@ -65,12 +65,12 @@ var hangingIndent = parserConf.hangingIndent || conf.indentUnit; var myKeywords = commonKeywords, myBuiltins = commonBuiltins; - if(parserConf.extra_keywords != undefined){ + if (parserConf.extra_keywords != undefined) myKeywords = myKeywords.concat(parserConf.extra_keywords); - } - if(parserConf.extra_builtins != undefined){ + + if (parserConf.extra_builtins != undefined) myBuiltins = myBuiltins.concat(parserConf.extra_builtins); - } + if (parserConf.version && parseInt(parserConf.version, 10) == 3) { myKeywords = myKeywords.concat(py3.keywords); myBuiltins = myBuiltins.concat(py3.builtins); @@ -85,13 +85,14 @@ // tokenizers function tokenBase(stream, state) { + if (stream.sol()) state.indent = stream.indentation() // Handle scope changes if (stream.sol() && top(state).type == "py") { var scopeOffset = top(state).offset; if (stream.eatSpace()) { var lineOffset = stream.indentation(); if (lineOffset > scopeOffset) - pushScope(stream, state, "py"); + pushPyScope(state); else if (lineOffset < scopeOffset && dedent(stream, state)) state.errorToken = true; return null; @@ -224,16 +225,18 @@ return tokenString; } - function pushScope(stream, state, type) { - var offset = 0, align = null; - if (type == "py") { - while (top(state).type != "py") - state.scopes.pop(); - } - offset = top(state).offset + (type == "py" ? conf.indentUnit : hangingIndent); - if (type != "py" && !stream.match(/^(\s|#.*)*$/, false)) - align = stream.column() + 1; - state.scopes.push({offset: offset, type: type, align: align}); + function pushPyScope(state) { + while (top(state).type != "py") state.scopes.pop() + state.scopes.push({offset: top(state).offset + conf.indentUnit, + type: "py", + align: null}) + } + + function pushBracketScope(stream, state, type) { + var align = stream.match(/^([\s\[\{\(]|#.*)*$/, false) ? null : stream.column() + 1 + state.scopes.push({offset: state.indent + hangingIndent, + type: type, + align: align}) } function dedent(stream, state) { @@ -250,12 +253,11 @@ var current = stream.current(); // Handle decorators - if (current == "@"){ - if(parserConf.version && parseInt(parserConf.version, 10) == 3){ - return stream.match(identifiers, false) ? "meta" : "operator"; - } else { - return stream.match(identifiers, false) ? "meta" : ERRORCLASS; - } + if (current == "@") { + if (parserConf.version && parseInt(parserConf.version, 10) == 3) + return stream.match(identifiers, false) ? "meta" : "operator"; + else + return stream.match(identifiers, false) ? "meta" : ERRORCLASS; } if ((style == "variable" || style == "builtin") @@ -268,15 +270,15 @@ if (current == "lambda") state.lambda = true; if (current == ":" && !state.lambda && top(state).type == "py") - pushScope(stream, state, "py"); + pushPyScope(state); var delimiter_index = current.length == 1 ? "[({".indexOf(current) : -1; if (delimiter_index != -1) - pushScope(stream, state, "])}".slice(delimiter_index, delimiter_index+1)); + pushBracketScope(stream, state, "])}".slice(delimiter_index, delimiter_index+1)); delimiter_index = "])}".indexOf(current); if (delimiter_index != -1) { - if (top(state).type == current) state.scopes.pop(); + if (top(state).type == current) state.indent = state.scopes.pop().offset - hangingIndent else return ERRORCLASS; } if (state.dedent > 0 && stream.eol() && top(state).type == "py") { @@ -292,6 +294,7 @@ return { tokenize: tokenBase, scopes: [{offset: basecolumn || 0, type: "py", align: null}], + indent: basecolumn || 0, lastToken: null, lambda: false, dedent: 0 @@ -316,16 +319,14 @@ if (state.tokenize != tokenBase) return state.tokenize.isString ? CodeMirror.Pass : 0; - var scope = top(state); - var closing = textAfter && textAfter.charAt(0) == scope.type; + var scope = top(state), closing = scope.type == textAfter.charAt(0) if (scope.align != null) - return scope.align - (closing ? 1 : 0); - else if (closing && state.scopes.length > 1) - return state.scopes[state.scopes.length - 2].offset; + return scope.align - (closing ? 1 : 0) else - return scope.offset; + return scope.offset - (closing ? hangingIndent : 0) }, + electricInput: /^\s*[\}\]\)]$/, closeBrackets: {triples: "'\""}, lineComment: "#", fold: "indent" diff --git a/public/vendor/codemirror/mode/r/r.js b/public/vendor/codemirror/mode/r/r.js index 1ab4a95..d41d1c5 100644 --- a/public/vendor/codemirror/mode/r/r.js +++ b/public/vendor/codemirror/mode/r/r.js @@ -11,6 +11,8 @@ })(function(CodeMirror) { "use strict"; +CodeMirror.registerHelper("wordChars", "r", /[\w.]/); + CodeMirror.defineMode("r", function(config) { function wordObj(str) { var words = str.split(" "), res = {}; diff --git a/public/vendor/codemirror/mode/sas/index.html b/public/vendor/codemirror/mode/sas/index.html new file mode 100644 index 0000000..636e065 --- /dev/null +++ b/public/vendor/codemirror/mode/sas/index.html @@ -0,0 +1,81 @@ + + +CodeMirror: SAS mode + + + + + + + + + + +
    +

    SAS mode

    +
    + + + +

    MIME types defined: text/x-sas.

    + +
    diff --git a/public/vendor/codemirror/mode/sas/sas.js b/public/vendor/codemirror/mode/sas/sas.js new file mode 100755 index 0000000..fe11482 --- /dev/null +++ b/public/vendor/codemirror/mode/sas/sas.js @@ -0,0 +1,315 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + + +// SAS mode copyright (c) 2016 Jared Dean, SAS Institute +// Created by Jared Dean + +// TODO +// indent and de-indent +// identify macro variables + + +//Definitions +// comment -- text withing * ; or /* */ +// keyword -- SAS language variable +// variable -- macro variables starts with '&' or variable formats +// variable-2 -- DATA Step, proc, or macro names +// string -- text within ' ' or " " +// operator -- numeric operator + / - * ** le eq ge ... and so on +// builtin -- proc %macro data run mend +// atom +// def + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { + "use strict"; + + CodeMirror.defineMode("sas", function () { + var words = {}; + var isDoubleOperatorSym = { + eq: 'operator', + lt: 'operator', + le: 'operator', + gt: 'operator', + ge: 'operator', + "in": 'operator', + ne: 'operator', + or: 'operator' + }; + var isDoubleOperatorChar = /(<=|>=|!=|<>)/; + var isSingleOperatorChar = /[=\(:\),{}.*<>+\-\/^\[\]]/; + + // Takes a string of words separated by spaces and adds them as + // keys with the value of the first argument 'style' + function define(style, string, context) { + if (context) { + var split = string.split(' '); + for (var i = 0; i < split.length; i++) { + words[split[i]] = {style: style, state: context}; + } + } + } + //datastep + define('def', 'stack pgm view source debug nesting nolist', ['inDataStep']); + define('def', 'if while until for do do; end end; then else cancel', ['inDataStep']); + define('def', 'label format _n_ _error_', ['inDataStep']); + define('def', 'ALTER BUFNO BUFSIZE CNTLLEV COMPRESS DLDMGACTION ENCRYPT ENCRYPTKEY EXTENDOBSCOUNTER GENMAX GENNUM INDEX LABEL OBSBUF OUTREP PW PWREQ READ REPEMPTY REPLACE REUSE ROLE SORTEDBY SPILL TOBSNO TYPE WRITE FILECLOSE FIRSTOBS IN OBS POINTOBS WHERE WHEREUP IDXNAME IDXWHERE DROP KEEP RENAME', ['inDataStep']); + define('def', 'filevar finfo finv fipname fipnamel fipstate first firstobs floor', ['inDataStep']); + define('def', 'varfmt varinfmt varlabel varlen varname varnum varray varrayx vartype verify vformat vformatd vformatdx vformatn vformatnx vformatw vformatwx vformatx vinarray vinarrayx vinformat vinformatd vinformatdx vinformatn vinformatnx vinformatw vinformatwx vinformatx vlabel vlabelx vlength vlengthx vname vnamex vnferr vtype vtypex weekday', ['inDataStep']); + define('def', 'zipfips zipname zipnamel zipstate', ['inDataStep']); + define('def', 'put putc putn', ['inDataStep']); + define('builtin', 'data run', ['inDataStep']); + + + //proc + define('def', 'data', ['inProc']); + + // flow control for macros + define('def', '%if %end %end; %else %else; %do %do; %then', ['inMacro']); + + //everywhere + define('builtin', 'proc run; quit; libname filename %macro %mend option options', ['ALL']); + + define('def', 'footnote title libname ods', ['ALL']); + define('def', '%let %put %global %sysfunc %eval ', ['ALL']); + // automatic macro variables http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a003167023.htm + define('variable', '&sysbuffr &syscc &syscharwidth &syscmd &sysdate &sysdate9 &sysday &sysdevic &sysdmg &sysdsn &sysencoding &sysenv &syserr &syserrortext &sysfilrc &syshostname &sysindex &sysinfo &sysjobid &syslast &syslckrc &syslibrc &syslogapplname &sysmacroname &sysmenv &sysmsg &sysncpu &sysodspath &sysparm &syspbuff &sysprocessid &sysprocessname &sysprocname &sysrc &sysscp &sysscpl &sysscpl &syssite &sysstartid &sysstartname &systcpiphostname &systime &sysuserid &sysver &sysvlong &sysvlong4 &syswarningtext', ['ALL']); + + //footnote[1-9]? title[1-9]? + + //options statement + define('def', 'source2 nosource2 page pageno pagesize', ['ALL']); + + //proc and datastep + define('def', '_all_ _character_ _cmd_ _freq_ _i_ _infile_ _last_ _msg_ _null_ _numeric_ _temporary_ _type_ abort abs addr adjrsq airy alpha alter altlog altprint and arcos array arsin as atan attrc attrib attrn authserver autoexec awscontrol awsdef awsmenu awsmenumerge awstitle backward band base betainv between blocksize blshift bnot bor brshift bufno bufsize bxor by byerr byline byte calculated call cards cards4 catcache cbufno cdf ceil center cexist change chisq cinv class cleanup close cnonct cntllev coalesce codegen col collate collin column comamid comaux1 comaux2 comdef compbl compound compress config continue convert cos cosh cpuid create cross crosstab css curobs cv daccdb daccdbsl daccsl daccsyd dacctab dairy datalines datalines4 datejul datepart datetime day dbcslang dbcstype dclose ddm delete delimiter depdb depdbsl depsl depsyd deptab dequote descending descript design= device dflang dhms dif digamma dim dinfo display distinct dkricond dkrocond dlm dnum do dopen doptname doptnum dread drop dropnote dsname dsnferr echo else emaildlg emailid emailpw emailserver emailsys encrypt end endsas engine eof eov erf erfc error errorcheck errors exist exp fappend fclose fcol fdelete feedback fetch fetchobs fexist fget file fileclose fileexist filefmt filename fileref fmterr fmtsearch fnonct fnote font fontalias fopen foptname foptnum force formatted formchar formdelim formdlim forward fpoint fpos fput fread frewind frlen from fsep fuzz fwrite gaminv gamma getoption getvarc getvarn go goto group gwindow hbar hbound helpenv helploc hms honorappearance hosthelp hostprint hour hpct html hvar ibessel ibr id if index indexc indexw initcmd initstmt inner input inputc inputn inr insert int intck intnx into intrr invaliddata irr is jbessel join juldate keep kentb kurtosis label lag last lbound leave left length levels lgamma lib library libref line linesize link list log log10 log2 logpdf logpmf logsdf lostcard lowcase lrecl ls macro macrogen maps mautosource max maxdec maxr mdy mean measures median memtype merge merror min minute missing missover mlogic mod mode model modify month mopen mort mprint mrecall msglevel msymtabmax mvarsize myy n nest netpv new news nmiss no nobatch nobs nocaps nocardimage nocenter nocharcode nocmdmac nocol nocum nodate nodbcs nodetails nodmr nodms nodmsbatch nodup nodupkey noduplicates noechoauto noequals noerrorabend noexitwindows nofullstimer noicon noimplmac noint nolist noloadlist nomiss nomlogic nomprint nomrecall nomsgcase nomstored nomultenvappl nonotes nonumber noobs noovp nopad nopercent noprint noprintinit normal norow norsasuser nosetinit nosplash nosymbolgen note notes notitle notitles notsorted noverbose noxsync noxwait npv null number numkeys nummousekeys nway obs on open order ordinal otherwise out outer outp= output over ovp p(1 5 10 25 50 75 90 95 99) pad pad2 paired parm parmcards path pathdll pathname pdf peek peekc pfkey pmf point poisson poke position printer probbeta probbnml probchi probf probgam probhypr probit probnegb probnorm probsig probt procleave prt ps pw pwreq qtr quote r ranbin rancau ranexp rangam range ranks rannor ranpoi rantbl rantri ranuni read recfm register regr remote remove rename repeat replace resolve retain return reuse reverse rewind right round rsquare rtf rtrace rtraceloc s s2 samploc sasautos sascontrol sasfrscr sasmsg sasmstore sasscript sasuser saving scan sdf second select selection separated seq serror set setcomm setot sign simple sin sinh siteinfo skewness skip sle sls sortedby sortpgm sortseq sortsize soundex spedis splashlocation split spool sqrt start std stderr stdin stfips stimer stname stnamel stop stopover subgroup subpopn substr sum sumwgt symbol symbolgen symget symput sysget sysin sysleave sysmsg sysparm sysprint sysprintfont sysprod sysrc system t table tables tan tanh tapeclose tbufsize terminal test then timepart tinv tnonct to today tol tooldef totper transformout translate trantab tranwrd trigamma trim trimn trunc truncover type unformatted uniform union until upcase update user usericon uss validate value var weight when where while wincharset window work workinit workterm write wsum xsync xwait yearcutoff yes yyq min max', ['inDataStep', 'inProc']); + define('operator', 'and not ', ['inDataStep', 'inProc']); + + // Main function + function tokenize(stream, state) { + // Finally advance the stream + var ch = stream.next(); + + // BLOCKCOMMENT + if (ch === '/' && stream.eat('*')) { + state.continueComment = true; + return "comment"; + } else if (state.continueComment === true) { // in comment block + //comment ends at the beginning of the line + if (ch === '*' && stream.peek() === '/') { + stream.next(); + state.continueComment = false; + } else if (stream.skipTo('*')) { //comment is potentially later in line + stream.skipTo('*'); + stream.next(); + if (stream.eat('/')) + state.continueComment = false; + } else { + stream.skipToEnd(); + } + return "comment"; + } + + // DoubleOperator match + var doubleOperator = ch + stream.peek(); + + // Match all line comments. + var myString = stream.string; + var myRegexp = /(?:^\s*|[;]\s*)(\*.*?);/ig; + var match = myRegexp.exec(myString); + if (match !== null) { + if (match.index === 0 && (stream.column() !== (match.index + match[0].length - 1))) { + stream.backUp(stream.column()); + stream.skipTo(';'); + stream.next(); + return 'comment'; + } else if (match.index + 1 < stream.column() && stream.column() < match.index + match[0].length - 1) { + // the ';' triggers the match so move one past it to start + // the comment block that is why match.index+1 + stream.backUp(stream.column() - match.index - 1); + stream.skipTo(';'); + stream.next(); + return 'comment'; + } + } else if (!state.continueString && (ch === '"' || ch === "'")) { + // Have we found a string? + state.continueString = ch; //save the matching quote in the state + return "string"; + } else if (state.continueString !== null) { + if (stream.skipTo(state.continueString)) { + // quote found on this line + stream.next(); + state.continueString = null; + } else { + stream.skipToEnd(); + } + return "string"; + } else if (state.continueString !== null && stream.eol()) { + stream.skipTo(state.continueString) || stream.skipToEnd(); + return "string"; + } else if (/[\d\.]/.test(ch)) { //find numbers + if (ch === ".") + stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/); + else if (ch === "0") + stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/); + else + stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/); + return "number"; + } else if (isDoubleOperatorChar.test(ch + stream.peek())) { // TWO SYMBOL TOKENS + stream.next(); + return "operator"; + } else if (isDoubleOperatorSym.hasOwnProperty(doubleOperator)) { + stream.next(); + if (stream.peek() === ' ') + return isDoubleOperatorSym[doubleOperator.toLowerCase()]; + } else if (isSingleOperatorChar.test(ch)) { // SINGLE SYMBOL TOKENS + return "operator"; + } + + // Matches one whole word -- even if the word is a character + var word; + if (stream.match(/[%&;\w]+/, false) != null) { + word = ch + stream.match(/[%&;\w]+/, true); + if (/&/.test(word)) return 'variable' + } else { + word = ch; + } + // the word after DATA PROC or MACRO + if (state.nextword) { + stream.match(/[\w]+/); + // match memname.libname + if (stream.peek() === '.') stream.skipTo(' '); + state.nextword = false; + return 'variable-2'; + + } + + // Are we in a DATA Step? + if (state.inDataStep) { + if (word.toLowerCase() === 'run;' || stream.match(/run\s;/)) { + state.inDataStep = false; + return 'builtin'; + } + // variable formats + if ((word) && stream.next() === '.') { + //either a format or libname.memname + if (/\w/.test(stream.peek())) return 'variable-2'; + else return 'variable'; + } + // do we have a DATA Step keyword + if (word && words.hasOwnProperty(word.toLowerCase()) && + (words[word.toLowerCase()].state.indexOf("inDataStep") !== -1 || + words[word.toLowerCase()].state.indexOf("ALL") !== -1)) { + //backup to the start of the word + if (stream.start < stream.pos) + stream.backUp(stream.pos - stream.start); + //advance the length of the word and return + for (var i = 0; i < word.length; ++i) stream.next(); + return words[word.toLowerCase()].style; + } + } + // Are we in an Proc statement? + if (state.inProc) { + if (word.toLowerCase() === 'run;' || word.toLowerCase() === 'quit;') { + state.inProc = false; + return 'builtin'; + } + // do we have a proc keyword + if (word && words.hasOwnProperty(word.toLowerCase()) && + (words[word.toLowerCase()].state.indexOf("inProc") !== -1 || + words[word.toLowerCase()].state.indexOf("ALL") !== -1)) { + stream.match(/[\w]+/); + return words[word].style; + } + } + // Are we in a Macro statement? + if (state.inMacro) { + if (word.toLowerCase() === '%mend') { + if (stream.peek() === ';') stream.next(); + state.inMacro = false; + return 'builtin'; + } + if (word && words.hasOwnProperty(word.toLowerCase()) && + (words[word.toLowerCase()].state.indexOf("inMacro") !== -1 || + words[word.toLowerCase()].state.indexOf("ALL") !== -1)) { + stream.match(/[\w]+/); + return words[word.toLowerCase()].style; + } + + return 'atom'; + } + // Do we have Keywords specific words? + if (word && words.hasOwnProperty(word.toLowerCase())) { + // Negates the initial next() + stream.backUp(1); + // Actually move the stream + stream.match(/[\w]+/); + if (word.toLowerCase() === 'data' && /=/.test(stream.peek()) === false) { + state.inDataStep = true; + state.nextword = true; + return 'builtin'; + } + if (word.toLowerCase() === 'proc') { + state.inProc = true; + state.nextword = true; + return 'builtin'; + } + if (word.toLowerCase() === '%macro') { + state.inMacro = true; + state.nextword = true; + return 'builtin'; + } + if (/title[1-9]/i.test(word)) return 'def'; + + if (word.toLowerCase() === 'footnote') { + stream.eat(/[1-9]/); + return 'def'; + } + + // Returns their value as state in the prior define methods + if (state.inDataStep === true && words[word.toLowerCase()].state.indexOf("inDataStep") !== -1) + return words[word.toLowerCase()].style; + if (state.inProc === true && words[word.toLowerCase()].state.indexOf("inProc") !== -1) + return words[word.toLowerCase()].style; + if (state.inMacro === true && words[word.toLowerCase()].state.indexOf("inMacro") !== -1) + return words[word.toLowerCase()].style; + if (words[word.toLowerCase()].state.indexOf("ALL") !== -1) + return words[word.toLowerCase()].style; + return null; + } + // Unrecognized syntax + return null; + } + + return { + startState: function () { + return { + inDataStep: false, + inProc: false, + inMacro: false, + nextword: false, + continueString: null, + continueComment: false + }; + }, + token: function (stream, state) { + // Strip the spaces, but regex will account for them either way + if (stream.eatSpace()) return null; + // Go through the main process + return tokenize(stream, state); + }, + + blockCommentStart: "/*", + blockCommentEnd: "*/" + }; + + }); + + CodeMirror.defineMIME("text/x-sas", "sas"); +}); diff --git a/public/vendor/codemirror/mode/sparql/sparql.js b/public/vendor/codemirror/mode/sparql/sparql.js index 0cf40f5..095dcca 100644 --- a/public/vendor/codemirror/mode/sparql/sparql.js +++ b/public/vendor/codemirror/mode/sparql/sparql.js @@ -25,7 +25,7 @@ CodeMirror.defineMode("sparql", function(config) { "strbefore", "strafter", "year", "month", "day", "hours", "minutes", "seconds", "timezone", "tz", "now", "uuid", "struuid", "md5", "sha1", "sha256", "sha384", "sha512", "coalesce", "if", "strlang", "strdt", "isnumeric", "regex", "exists", - "isblank", "isliteral", "a"]); + "isblank", "isliteral", "a", "bind"]); var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe", "ask", "from", "named", "where", "order", "limit", "offset", "filter", "optional", "graph", "by", "asc", "desc", "as", "having", "undef", "values", "group", @@ -135,7 +135,11 @@ CodeMirror.defineMode("sparql", function(config) { else if (curPunc == "{") pushContext(state, "}", stream.column()); else if (/[\]\}\)]/.test(curPunc)) { while (state.context && state.context.type == "pattern") popContext(state); - if (state.context && curPunc == state.context.type) popContext(state); + if (state.context && curPunc == state.context.type) { + popContext(state); + if (curPunc == "}" && state.context && state.context.type == "pattern") + popContext(state); + } } else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state); else if (/atom|string|variable/.test(style) && state.context) { diff --git a/public/vendor/codemirror/mode/spreadsheet/spreadsheet.js b/public/vendor/codemirror/mode/spreadsheet/spreadsheet.js index 6fab00f..222f297 100644 --- a/public/vendor/codemirror/mode/spreadsheet/spreadsheet.js +++ b/public/vendor/codemirror/mode/spreadsheet/spreadsheet.js @@ -70,7 +70,10 @@ return "operator"; case "\\": if (stream.match(/\\[a-z]+/)) return "string-2"; - else return null; + else { + stream.next(); + return "atom"; + } case ".": case ",": case ";": diff --git a/public/vendor/codemirror/mode/sql/index.html b/public/vendor/codemirror/mode/sql/index.html index a0d8d9e..dba069d 100644 --- a/public/vendor/codemirror/mode/sql/index.html +++ b/public/vendor/codemirror/mode/sql/index.html @@ -56,7 +56,9 @@ SELECT SQL_NO_CACHE DISTINCT text/x-cassandra, text/x-plsql, text/x-mssql, - text/x-hive. + text/x-hive, + text/x-pgsql, + text/x-gql.

    + + + + + + +
    +

    Web IDL mode

    + +
    + +
    + + + +

    MIME type defined: text/x-webidl.

    +
    diff --git a/public/vendor/codemirror/mode/webidl/webidl.js b/public/vendor/codemirror/mode/webidl/webidl.js new file mode 100644 index 0000000..6f024c6 --- /dev/null +++ b/public/vendor/codemirror/mode/webidl/webidl.js @@ -0,0 +1,195 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +function wordRegexp(words) { + return new RegExp("^((" + words.join(")|(") + "))\\b"); +}; + +var builtinArray = [ + "Clamp", + "Constructor", + "EnforceRange", + "Exposed", + "ImplicitThis", + "Global", "PrimaryGlobal", + "LegacyArrayClass", + "LegacyUnenumerableNamedProperties", + "LenientThis", + "NamedConstructor", + "NewObject", + "NoInterfaceObject", + "OverrideBuiltins", + "PutForwards", + "Replaceable", + "SameObject", + "TreatNonObjectAsNull", + "TreatNullAs", + "EmptyString", + "Unforgeable", + "Unscopeable" +]; +var builtins = wordRegexp(builtinArray); + +var typeArray = [ + "unsigned", "short", "long", // UnsignedIntegerType + "unrestricted", "float", "double", // UnrestrictedFloatType + "boolean", "byte", "octet", // Rest of PrimitiveType + "Promise", // PromiseType + "ArrayBuffer", "DataView", "Int8Array", "Int16Array", "Int32Array", + "Uint8Array", "Uint16Array", "Uint32Array", "Uint8ClampedArray", + "Float32Array", "Float64Array", // BufferRelatedType + "ByteString", "DOMString", "USVString", "sequence", "object", "RegExp", + "Error", "DOMException", "FrozenArray", // Rest of NonAnyType + "any", // Rest of SingleType + "void" // Rest of ReturnType +]; +var types = wordRegexp(typeArray); + +var keywordArray = [ + "attribute", "callback", "const", "deleter", "dictionary", "enum", "getter", + "implements", "inherit", "interface", "iterable", "legacycaller", "maplike", + "partial", "required", "serializer", "setlike", "setter", "static", + "stringifier", "typedef", // ArgumentNameKeyword except + // "unrestricted" + "optional", "readonly", "or" +]; +var keywords = wordRegexp(keywordArray); + +var atomArray = [ + "true", "false", // BooleanLiteral + "Infinity", "NaN", // FloatLiteral + "null" // Rest of ConstValue +]; +var atoms = wordRegexp(atomArray); + +CodeMirror.registerHelper("hintWords", "webidl", + builtinArray.concat(typeArray).concat(keywordArray).concat(atomArray)); + +var startDefArray = ["callback", "dictionary", "enum", "interface"]; +var startDefs = wordRegexp(startDefArray); + +var endDefArray = ["typedef"]; +var endDefs = wordRegexp(endDefArray); + +var singleOperators = /^[:<=>?]/; +var integers = /^-?([1-9][0-9]*|0[Xx][0-9A-Fa-f]+|0[0-7]*)/; +var floats = /^-?(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+)/; +var identifiers = /^_?[A-Za-z][0-9A-Z_a-z-]*/; +var strings = /^"[^"]*"/; +var multilineComments = /^\/\*.*?\*\//; +var multilineCommentsStart = /^\/\*.*/; +var multilineCommentsEnd = /^.*?\*\//; + +function readToken(stream, state) { + // whitespace + if (stream.eatSpace()) return null; + + // comment + if (state.inComment) { + if (stream.match(multilineCommentsEnd)) { + state.inComment = false; + return "comment"; + } + stream.skipToEnd(); + return "comment"; + } + if (stream.match("//")) { + stream.skipToEnd(); + return "comment"; + } + if (stream.match(multilineComments)) return "comment"; + if (stream.match(multilineCommentsStart)) { + state.inComment = true; + return "comment"; + } + + // integer and float + if (stream.match(/^-?[0-9\.]/, false)) { + if (stream.match(integers) || stream.match(floats)) return "number"; + } + + // string + if (stream.match(strings)) return "string"; + + // identifier + if (stream.match(identifiers)) { + if (state.startDef) return "def"; + if (state.endDef && stream.match(/^\s*;/, false)) { + state.endDef = false; + return "def"; + } + } + + if (stream.match(keywords)) return "keyword"; + + if (stream.match(types)) { + var lastToken = state.lastToken; + var nextToken = (stream.match(/^\s*(.+?)\b/, false) || [])[1]; + + if (lastToken === ":" || lastToken === "implements" || + nextToken === "implements" || nextToken === "=") { + // Used as identifier + return "builtin"; + } else { + // Used as type + return "variable-3"; + } + } + + if (stream.match(builtins)) return "builtin"; + if (stream.match(atoms)) return "atom"; + if (stream.match(identifiers)) return "variable"; + + // other + if (stream.match(singleOperators)) return "operator"; + + // unrecognized + stream.next(); + return null; +}; + +CodeMirror.defineMode("webidl", function() { + return { + startState: function() { + return { + // Is in multiline comment + inComment: false, + // Last non-whitespace, matched token + lastToken: "", + // Next token is a definition + startDef: false, + // Last token of the statement is a definition + endDef: false + }; + }, + token: function(stream, state) { + var style = readToken(stream, state); + + if (style) { + var cur = stream.current(); + state.lastToken = cur; + if (style === "keyword") { + state.startDef = startDefs.test(cur); + state.endDef = state.endDef || endDefs.test(cur); + } else { + state.startDef = false; + } + } + + return style; + } + }; +}); + +CodeMirror.defineMIME("text/x-webidl", "webidl"); +}); diff --git a/public/vendor/codemirror/mode/xml/index.html b/public/vendor/codemirror/mode/xml/index.html index 7149f06..c56b8b6 100644 --- a/public/vendor/codemirror/mode/xml/index.html +++ b/public/vendor/codemirror/mode/xml/index.html @@ -42,12 +42,16 @@ lineNumbers: true }); -

    The XML mode supports two configuration parameters:

    +

    The XML mode supports these configuration parameters:

    htmlMode (boolean)
    This switches the mode to parse HTML instead of XML. This means attributes do not have to be quoted, and some elements (such as br) do not require a closing tag.
    +
    matchClosing (boolean)
    +
    Controls whether the mode checks that close tags match the + corresponding opening tag, and highlights mismatches as errors. + Defaults to true.
    alignCDATA (boolean)
    Setting this to true will force the opening tag of CDATA blocks to not be indented.
    diff --git a/public/vendor/codemirror/mode/xml/xml.js b/public/vendor/codemirror/mode/xml/xml.js index 014f7d8..f987a3a 100644 --- a/public/vendor/codemirror/mode/xml/xml.js +++ b/public/vendor/codemirror/mode/xml/xml.js @@ -237,7 +237,7 @@ CodeMirror.defineMode("xml", function(editorConf, config_) { if (state.context && state.context.tagName != tagName && config.implicitlyClosed.hasOwnProperty(state.context.tagName)) popContext(state); - if (state.context && state.context.tagName == tagName) { + if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) { setStyle = "tag"; return closeState; } else { diff --git a/public/vendor/codemirror/mode/xquery/xquery.js b/public/vendor/codemirror/mode/xquery/xquery.js index c642ee5..75dcbee 100644 --- a/public/vendor/codemirror/mode/xquery/xquery.js +++ b/public/vendor/codemirror/mode/xquery/xquery.js @@ -17,7 +17,7 @@ CodeMirror.defineMode("xquery", function() { // function. Each keyword is a property of the keywords object whose // value is {type: atype, style: astyle} var keywords = function(){ - // conveinence functions used to build keywords object + // convenience functions used to build keywords object function kw(type) {return {type: type, style: "keyword"};} var A = kw("keyword a") , B = kw("keyword b") diff --git a/public/vendor/codemirror/mode/yacas/index.html b/public/vendor/codemirror/mode/yacas/index.html new file mode 100644 index 0000000..8e52caf --- /dev/null +++ b/public/vendor/codemirror/mode/yacas/index.html @@ -0,0 +1,87 @@ + + +CodeMirror: yacas mode + + + + + + + + + + +
    +

    yacas mode

    + + + + + + +

    MIME types defined: text/x-yacas (yacas).

    +
    diff --git a/public/vendor/codemirror/mode/yacas/yacas.js b/public/vendor/codemirror/mode/yacas/yacas.js new file mode 100644 index 0000000..2967382 --- /dev/null +++ b/public/vendor/codemirror/mode/yacas/yacas.js @@ -0,0 +1,138 @@ +// CodeMirror, copyright (c) by Marijn Haverbeke and others +// Distributed under an MIT license: http://codemirror.net/LICENSE + +// Yacas mode copyright (c) 2015 by Grzegorz Mazur +// Loosely based on mathematica mode by Calin Barbat + +(function(mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + mod(require("../../lib/codemirror")); + else if (typeof define == "function" && define.amd) // AMD + define(["../../lib/codemirror"], mod); + else // Plain browser env + mod(CodeMirror); +})(function(CodeMirror) { +"use strict"; + +CodeMirror.defineMode('yacas', function(_config, _parserConfig) { + + // patterns + var pFloatForm = "(?:(?:\\.\\d+|\\d+\\.\\d*|\\d+)(?:[eE][+-]?\\d+)?)"; + var pIdentifier = "(?:[a-zA-Z\\$'][a-zA-Z0-9\\$']*)"; + + // regular expressions + var reFloatForm = new RegExp(pFloatForm); + var reIdentifier = new RegExp(pIdentifier); + var rePattern = new RegExp(pIdentifier + "?_" + pIdentifier); + var reFunctionLike = new RegExp(pIdentifier + "\\s*\\("); + + function tokenBase(stream, state) { + var ch; + + // get next character + ch = stream.next(); + + // string + if (ch === '"') { + state.tokenize = tokenString; + return state.tokenize(stream, state); + } + + // comment + if (ch === '/') { + if (stream.eat('*')) { + state.tokenize = tokenComment; + return state.tokenize(stream, state); + } + if (stream.eat("/")) { + stream.skipToEnd(); + return "comment"; + } + } + + // go back one character + stream.backUp(1); + + // look for ordered rules + if (stream.match(/\d+ *#/, true, false)) { + return 'qualifier'; + } + + // look for numbers + if (stream.match(reFloatForm, true, false)) { + return 'number'; + } + + // look for placeholders + if (stream.match(rePattern, true, false)) { + return 'variable-3'; + } + + // match all braces separately + if (stream.match(/(?:\[|\]|{|}|\(|\))/, true, false)) { + return 'bracket'; + } + + // literals looking like function calls + if (stream.match(reFunctionLike, true, false)) { + stream.backUp(1); + return 'variable'; + } + + // all other identifiers + if (stream.match(reIdentifier, true, false)) { + return 'variable-2'; + } + + // operators; note that operators like @@ or /; are matched separately for each symbol. + if (stream.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/, true, false)) { + return 'operator'; + } + + // everything else is an error + return 'error'; + } + + function tokenString(stream, state) { + var next, end = false, escaped = false; + while ((next = stream.next()) != null) { + if (next === '"' && !escaped) { + end = true; + break; + } + escaped = !escaped && next === '\\'; + } + if (end && !escaped) { + state.tokenize = tokenBase; + } + return 'string'; + }; + + function tokenComment(stream, state) { + var prev, next; + while((next = stream.next()) != null) { + if (prev === '*' && next === '/') + break; + prev = next; + } + state.tokenize = tokenBase; + return 'comment'; + } + + return { + startState: function() {return {tokenize: tokenBase, commentLevel: 0};}, + token: function(stream, state) { + if (stream.eatSpace()) return null; + return state.tokenize(stream, state); + }, + blockCommentStart: "/*", + blockCommentEnd: "*/", + lineComment: "//" + }; +}); + +CodeMirror.defineMIME('text/x-yacas', { + name: 'yacas' +}); + +}); diff --git a/public/vendor/codemirror/mode/yaml-frontmatter/index.html b/public/vendor/codemirror/mode/yaml-frontmatter/index.html index 30bed2f..30cb294 100644 --- a/public/vendor/codemirror/mode/yaml-frontmatter/index.html +++ b/public/vendor/codemirror/mode/yaml-frontmatter/index.html @@ -78,7 +78,7 @@ Underscores_are_allowed_between_words. GFM adds syntax to strikethrough text, which is missing from standard Markdown. ~~Mistaken text.~~ -~~**works with other fomatting**~~ +~~**works with other formatting**~~ ~~spans across lines~~ diff --git a/public/vendor/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js b/public/vendor/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js index 9f081b0..5f49772 100644 --- a/public/vendor/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js +++ b/public/vendor/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js @@ -65,4 +65,4 @@ } } }) -}) +}); diff --git a/public/vendor/codemirror/theme/icecoder.css b/public/vendor/codemirror/theme/icecoder.css index d70d26e..ffebaf2 100644 --- a/public/vendor/codemirror/theme/icecoder.css +++ b/public/vendor/codemirror/theme/icecoder.css @@ -2,7 +2,7 @@ ICEcoder default theme by Matt Pass, used in code editor available at https://icecoder.net */ -.cm-s-icecoder { color: #666; background: #141612; } +.cm-s-icecoder { color: #666; background: #1d1d1b; } .cm-s-icecoder span.cm-keyword { color: #eee; font-weight:bold; } /* off-white 1 */ .cm-s-icecoder span.cm-atom { color: #e1c76e; } /* yellow */ @@ -37,7 +37,7 @@ ICEcoder default theme by Matt Pass, used in code editor available at https://ic .cm-s-icecoder .CodeMirror-cursor { border-left: 1px solid white; } .cm-s-icecoder div.CodeMirror-selected { color: #fff; background: #037; } -.cm-s-icecoder .CodeMirror-gutters { background: #141612; min-width: 41px; border-right: 0; } +.cm-s-icecoder .CodeMirror-gutters { background: #1d1d1b; min-width: 41px; border-right: 0; } .cm-s-icecoder .CodeMirror-linenumber { color: #555; cursor: default; } -.cm-s-icecoder .CodeMirror-matchingbracket { border: 1px solid grey; color: black !important; } -.cm-s-icecoder .CodeMirror-activeline-background { background: #000; } \ No newline at end of file +.cm-s-icecoder .CodeMirror-matchingbracket { color: #fff !important; background: #555 !important; } +.cm-s-icecoder .CodeMirror-activeline-background { background: #000; } diff --git a/public/vendor/codemirror/theme/mbo.css b/public/vendor/codemirror/theme/mbo.css index 59ff5da..e164fcf 100644 --- a/public/vendor/codemirror/theme/mbo.css +++ b/public/vendor/codemirror/theme/mbo.css @@ -33,5 +33,5 @@ .cm-s-mbo span.cm-qualifier { color: #ffffec; } .cm-s-mbo .CodeMirror-activeline-background { background: #494b41; } -.cm-s-mbo .CodeMirror-matchingbracket { color: #222 !important; } +.cm-s-mbo .CodeMirror-matchingbracket { color: #ffb928 !important; } .cm-s-mbo .CodeMirror-matchingtag { background: rgba(255, 255, 255, .37); } diff --git a/public/vendor/codemirror/theme/night.css b/public/vendor/codemirror/theme/night.css index 4dbb866..fd4e561 100644 --- a/public/vendor/codemirror/theme/night.css +++ b/public/vendor/codemirror/theme/night.css @@ -10,7 +10,7 @@ .cm-s-night .CodeMirror-linenumber { color: #f8f8f8; } .cm-s-night .CodeMirror-cursor { border-left: 1px solid white; } -.cm-s-night span.cm-comment { color: #6900a1; } +.cm-s-night span.cm-comment { color: #8900d1; } .cm-s-night span.cm-atom { color: #845dc4; } .cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; } .cm-s-night span.cm-keyword { color: #599eff; } @@ -19,7 +19,6 @@ .cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; } .cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; } .cm-s-night span.cm-bracket { color: #8da6ce; } -.cm-s-night span.cm-comment { color: #6900a1; } .cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; } .cm-s-night span.cm-link { color: #845dc4; } .cm-s-night span.cm-error { color: #9d1e15; }