[TASK] Update codemirror to 5.40.2 62/58662/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Fri, 19 Oct 2018 10:19:03 +0000 (12:19 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sat, 27 Oct 2018 10:02:51 +0000 (12:02 +0200)
Used commands:
yarn add codemirror@^5.40.0 --dev
grunt build

Resolves: #86700
Releases: master
Change-Id: I07a146e2ca108339092e16d769fef8031e783511
Reviewed-on: https://review.typo3.org/58662
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
54 files changed:
Build/package.json
Build/yarn.lock
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/AUTHORS
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/CHANGELOG.md
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/CONTRIBUTING.md
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/README.md
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/addon/dialog/dialog.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/addon/display/panel.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/addon/edit/closebrackets.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/addon/edit/continuelist.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/addon/fold/xml-fold.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/addon/hint/javascript-hint.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/addon/hint/show-hint.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/addon/hint/sql-hint.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/addon/lint/json-lint.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/addon/merge/merge.css
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/addon/merge/merge.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/addon/mode/multiplex.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/addon/search/jump-to-line.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/addon/search/match-highlighter.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/addon/search/search.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/addon/wrap/hardwrap.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/bin/source-highlight [new file with mode: 0644]
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/keymap/emacs.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/keymap/vim.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/lib/codemirror.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/clike/clike.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/clojure/clojure.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/dart/dart.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/handlebars/handlebars.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/javascript/javascript.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/jinja2/jinja2.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/julia/julia.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/markdown/markdown.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/meta.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/mllike/mllike.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/pascal/pascal.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/python/python.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/r/r.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/rpm/changes/index.html
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/shell/shell.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/soy/soy.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/sql/sql.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/stex/stex.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/velocity/velocity.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/mode/yaml/yaml.js
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/package.json
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/theme/darcula.css [new file with mode: 0644]
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/theme/gruvbox-dark.css [new file with mode: 0644]
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/theme/idea.css [new file with mode: 0644]
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/theme/lesser-dark.css
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/theme/lucario.css [new file with mode: 0644]
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/theme/monokai.css
typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/theme/ssms.css [new file with mode: 0644]

index b50dfa9..04a2dcb 100644 (file)
@@ -26,7 +26,7 @@
     "chosen-js": "^1.7.0",
     "ckeditor": "4.10.1",
     "ckeditor-wordcount-plugin": "^1.17.2",
-    "codemirror": "^5.30.0",
+    "codemirror": "^5.40.0",
     "cropper": "^2.3.4",
     "d3": "^4.10.0",
     "datatables": "^1.10.13",
index b607d39..21f2c3b 100644 (file)
@@ -1115,10 +1115,10 @@ code-point-at@^1.0.0:
   resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
   integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=
 
-codemirror@^5.30.0:
-  version "5.35.0"
-  resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.35.0.tgz#280653d495455bc66aa87e6284292b02775ba878"
-  integrity sha512-8HQICjZlDfe1ai7bvU6m2uHxuZuFgsUCdDRU9OHVB+2RTRd+FftN1ezVCqbquG0Fyq+wETqyadKhUX46DswSUQ==
+codemirror@^5.40.0:
+  version "5.40.2"
+  resolved "https://registry.yarnpkg.com/codemirror/-/codemirror-5.40.2.tgz#f4a41fee2d84e679543591b3680af259d903330b"
+  integrity sha512-yoWuvEiD3v5vTwdoMc/wu/Ld6dh9K/yEiEBTKOPGM+/pN0gTAqFNtrLHv1IJ1UJvzFpNRvMi92XCi3+8/iIaEw==
 
 coffeescript@~1.10.0:
   version "1.10.0"
index b384b8e..0dfead7 100644 (file)
@@ -4,6 +4,7 @@ List of CodeMirror contributors. Updated before every release.
 4r2r
 Aaron Brooks
 Abdelouahab
+Abdussalam Abdurrahman
 Abe Fettig
 Adam Ahmed
 Adam King
@@ -19,6 +20,7 @@ Ahmad M. Zawawi
 ahoward
 Akeksandr Motsjonov
 Alasdair Smith
+AlbertHilb
 Alberto González Palomo
 Alberto Pose
 Albert Xing
@@ -83,7 +85,9 @@ AtomicPages LLC
 Atul Bhouraskar
 Aurelian Oancea
 Axel Lewenhaupt
+Baptiste Augrain
 Barret Rennie
+Bartosz Dziewoński
 Basarat Ali Syed
 Bastian Müller
 belhaj
@@ -101,10 +105,13 @@ Bharad
 BigBlueHat
 Billy Moon
 binny
+Bjorn Hansen
 B Krishna Chaitanya
 Blaine G
 blukat29
+Bo
 boomyjee
+Bo Peng
 borawjm
 Brad Metcalf
 Brandon Frohs
@@ -121,6 +128,7 @@ Calin Barbat
 callodacity
 Camilo Roca
 Casey Klebba
+César González Íñiguez
 Chad Jolly
 Chandra Sekhar Pydi
 Charles Skelton
@@ -131,10 +139,12 @@ Chris Granger
 Chris Houseknecht
 Chris Lohfink
 Chris Morgan
+Chris Reeves
 Chris Smith
 Christian Gruen
 Christian Oyarzun
 Christian Petrov
+christopherblaser
 Christopher Brown
 Christopher Kramer
 Christopher Mitchell
@@ -156,6 +166,7 @@ Dan Heberden
 Daniel, Dao Quang Minh
 Daniele Di Sarli
 Daniel Faust
+Daniel Hanggi
 Daniel Huigens
 Daniel Kesler
 Daniel KJ
@@ -166,12 +177,14 @@ Danila Malyutin
 Danny Yoo
 darealshinji
 Darius Roberts
+databricks-david-lewis
 Dave Brondsema
 Dave Myers
 David Barnett
 David H. Bronke
 David Mignot
 David Pathakjee
+David Santana
 David Vázquez
 David Whittington
 deebugger
@@ -200,6 +213,7 @@ Elisée
 Emmanuel Schanzer
 Enam Mijbah Noor
 Eric Allam
+Eric Bogard
 Erik Welander
 eustas
 Fabien Dubosson
@@ -215,6 +229,7 @@ ficristo
 Filip Noetzel
 Filip Stollár
 Filype Pereira
+finalfantasia
 flack
 Florian Felten
 ForbesLindesay
@@ -241,6 +256,7 @@ Giovanni Calò
 Glebov Boris
 Glenn Jorde
 Glenn Ruehle
+goldsmcb
 Golevka
 Google Inc.
 Gordon Smith
@@ -258,11 +274,13 @@ Hans Engel
 Hardest
 Harshvardhan Gupta
 Hasan Karahan
+Heanes
 Hector Oswaldo Caballero
 Hélio
 Hendrik Wallbaum
 Henrik Haugbølle
 Herculano Campos
+hidaiy
 Hiroyuki Makino
 hitsthings
 Hocdoc
@@ -361,6 +379,7 @@ Justin Hileman
 jwallers@gmail.com
 kaniga
 karevn
+Karol
 Kayur Patel
 Kazuhito Hokamura
 Ken Newman
@@ -371,6 +390,7 @@ Kevin Kwok
 Kevin Muret
 Kevin Sawicki
 Kevin Ushey
+Kier Darby
 Klaus Silveira
 Koh Zi Han, Cliff
 komakino
@@ -384,8 +404,10 @@ Kyle Kelley
 KyleMcNutt
 Lanfei
 Lanny
+laobubu
 Laszlo Vidacs
 leaf corcoran
+Lemmon
 Leonid Khachaturov
 Leon Sorokin
 Leonya Khachaturov
@@ -396,6 +418,7 @@ Lior Shub
 LloydMilligan
 LM
 lochel
+Lorenzo Simionato
 Lorenzo Stoakes
 Louis Mauchet
 Luca Fabbri
@@ -445,6 +468,7 @@ matthewhayes
 Matthew Rathbone
 Matthias Bussonnier
 Matthias BUSSONNIER
+Matt MacPherson
 Matt McDonald
 Matt Pass
 Matt Sacks
@@ -474,23 +498,27 @@ Michal Kapiczynski
 Mighty Guava
 Miguel Castillo
 mihailik
+Mika Andrianarijaona
 Mike
 Mike Brevoort
 Mike Diaz
 Mike Ivanov
 Mike Kadin
 Mike Kobit
+Milan Szekely
 MinRK
 Miraculix87
 misfo
 mkaminsky11
 mloginov
+Moritz Schubotz (physikerwelt)
 Moritz Schwörer
 Moshe Wajnberg
 mps
 ms
 mtaran-google
 Mu-An Chiou
+Mu-An ✌️ Chiou
 mzabuawala
 Narciso Jaramillo
 Nathan Williams
@@ -514,6 +542,7 @@ Niels van Groningen
 nightwing
 Nikita Beloglazov
 Nikita Vasilyev
+Nikolaj Kappler
 Nikolay Kostov
 nilp0inter
 Nisarg Jhaveri
@@ -527,6 +556,7 @@ overdodactyl
 pablo
 pabloferz
 Pablo Zubieta
+paddya
 Page
 paladox
 Panupong Pasupat
@@ -550,6 +580,7 @@ Peter Flynn
 peterkroon
 Peter Kroon
 Philipp A
+Philipp Markovics
 Philip Stadermann
 Pi Delport
 Pierre Gerold
@@ -567,12 +598,16 @@ ramwin1
 Randall Mason
 Randy Burden
 Randy Edmunds
+Randy Luecke
+Raphael Amorim
 Rasmus Erik Voel Jensen
 Rasmus Schultz
+Raymond Hill
 ray ratchup
 Ray Ratchup
 Remi Nyborg
 Renaud Durlin
+Reynold Xin
 Richard Denton
 Richard van der Meer
 Richard Z.H. Wang
@@ -587,6 +622,7 @@ Rrrandom
 Ruslan Osmanov
 Ryan Petrello
 Ryan Prior
+ryu-sato
 sabaca
 Sam Lee
 Sam Rawlins
@@ -632,6 +668,7 @@ Sorab Bisht
 spastorelli
 srajanpaliwal
 Stanislav Oaserele
+stan-z
 Stas Kobzar
 Stefan Borsje
 Steffen Beyer
@@ -679,6 +716,7 @@ Tomas Varaneckas
 Tom Erik Støwer
 Tom Klancer
 Tom MacWright
+Tom McLaughlin
 Tony Jian
 tophf
 totalamd
@@ -686,8 +724,10 @@ Travis Heppe
 Triangle717
 Tristan Tarrant
 TSUYUSATO Kitsune
+Tugrul Elmas
 twifkak
 Tyler Long
+Vadzim Ramanenka
 Vaibhav Sagar
 VapidWorx
 Vestimir Markov
@@ -707,6 +747,7 @@ William Jamieson
 William Stein
 Willy
 Wojtek Ptak
+wonderboyjon
 Wu Cheng-Han
 Xavier Mendez
 Yassin N. Hassan
index 10427a0..715b9fa 100644 (file)
@@ -1,3 +1,121 @@
+## 5.40.2 (2018-09-20)
+
+### Bug fixes
+
+Fix firing of `gutterContextMenu` event on Firefox.
+
+Add `hintWords` (basic completion) helper to [clojure](https://codemirror.net/mode/clojure/index.html), [mllike](https://codemirror.net/mode/mllike/index.html), [julia](https://codemirror.net/mode/julia/), [shell](https://codemirror.net/mode/shell/), and [r](https://codemirror.net/mode/r/) modes.
+
+[clojure mode](https://codemirror.net/mode/clojure/index.html): Clean up and improve.
+
+## 5.40.0 (2018-08-25)
+
+### Bug fixes
+
+[closebrackets addon](https://codemirror.net/doc/manual.html#addon_closebrackets): Fix issue where bracket-closing wouldn't work before punctuation.
+
+[panel addon](https://codemirror.net/doc/manual.html#addon_panel): Fix problem where replacing the last remaining panel dropped the newly added panel.
+
+[hardwrap addon](https://codemirror.net/doc/manual.html#addon_hardwrap): Fix an infinite loop when the indention is greater than the target column.
+
+[jinja2](https://codemirror.net/mode/jinja2/) and [markdown](https://codemirror.net/mode/markdown/) modes: Add comment metadata.
+
+### New features
+
+New method [`phrase`](https://codemirror.net/doc/manual.html#phrase) and option [`phrases`](https://codemirror.net/doc/manual.html#option_phrases) to make translating UI text in addons easier.
+
+## 5.39.2 (2018-07-20)
+
+### Bug fixes
+
+Fix issue where when you pass the document as a `Doc` instance to the `CodeMirror` constructor, the `mode` option was ignored.
+
+Fix bug where line height could be computed wrong with a line widget below a collapsed line.
+
+Fix overeager `.npmignore` dropping the `bin/source-highlight` utility from the distribution.
+
+[show-hint addon](https://codemirror.net/doc/manual.html#addon_show-hint): Fix behavior when backspacing to the start of the line with completions open.
+
+## 5.39.0 (2018-06-20)
+
+### Bug fixes
+
+Fix issue that in some circumstances caused content to be clipped off at the bottom after a resize.
+
+[markdown mode](https://codemirror.net/mode/markdown/): Improve handling of blank lines in HTML tags.
+
+### New features
+
+[stex mode](https://codemirror.net/mode/stex/): Add an `inMathMode` option to start the mode in math mode.
+
+## 5.38.0 (2018-05-21)
+
+### Bug fixes
+
+Improve reliability of noticing a missing mouseup event during dragging.
+
+Make sure `getSelection` is always called on the correct document.
+
+Fix interpretation of line breaks and non-breaking spaces inserted by renderer in contentEditable mode.
+
+Work around some browsers inexplicably making the fake scrollbars focusable.
+
+Make sure `coordsChar` doesn't return positions inside collapsed ranges.
+
+[javascript mode](https://codemirror.net/mode/javascript/): Support block scopes, bindingless catch, bignum suffix, `s` regexp flag.
+
+[markdown mode](https://codemirror.net/mode/markdown/): Adjust a wasteful regexp.
+
+[show-hint addon](https://codemirror.net/doc/manual.html#addon_show-hint): Allow opening the control without any item selected.
+
+### New features
+
+New theme: [darcula](https://codemirror.net/demo/theme.html#darcula).
+
+[dialog addon](https://codemirror.net/doc/manual.html#addon_dialog): Add a CSS class (`dialog-opened`) to the editor when a dialog is open.
+
+## 5.37.0 (2018-04-20)
+
+### Bug fixes
+
+Suppress keypress events during composition, for platforms that don't properly do this themselves.
+
+[xml-fold addon](https://codemirror.net/demo/folding.html): Improve handling of line-wrapped opening tags.
+
+[javascript mode](https://codemirror.net/mode/javascript/): Improve TypeScript support.
+
+[python mode](https://codemirror.net/mode/python/): Highlight expressions inside format strings.
+
+### New features
+
+[vim bindings](https://codemirror.net/demo/vim.html): Add support for '(' and ')' movement.
+
+New themes: [idea](https://codemirror.net/demo/theme.html#idea), [ssms](https://codemirror.net/demo/theme.html#ssms), [gruvbox-dark](https://codemirror.net/demo/theme.html#gruvbox-dark).
+
+## 5.36.0 (2018-03-20)
+
+### Bug fixes
+
+Make sure all document-level event handlers are registered on the document that the editor is part of.
+
+Fix issue that prevented edits whose origin starts with `+` from being combined in history events for an editor-less document.
+
+[multiplex addon](https://codemirror.net/demo/multiplex.html): Improve handling of indentation.
+
+[merge addon](https://codemirror.net/doc/manual.html#addon_merge): Use CSS `:after` element to style the scroll-lock icon.
+
+[javascript-hint addon](https://codemirror.net/doc/manual.html#addon_javascript-hint): Don't provide completions in JSON mode.
+
+[continuelist addon](https://codemirror.net/doc/manual.html#addon_continuelist): Fix numbering error.
+
+[show-hint addon](https://codemirror.net/doc/manual.html#addon_show-hint): Make `fromList` completion strategy act on the current token up to the cursor, rather than the entire token.
+
+[markdown mode](https://codemirror.net/mode/markdown/): Fix a regexp with potentially exponental complexity.
+
+### New features
+
+New theme: [lucario](https://codemirror.net/demo/theme.html#lucario).
+
 ## 5.35.0 (2018-02-20)
 
 ### Bug fixes
@@ -6,69 +124,69 @@ Fix problem where selection undo might change read-only documents.
 
 Fix crash when calling `addLineWidget` on a document that has no attached editor.
 
-[searchcursor addon](http://codemirror.net/doc/manual.html#addon_searchcursor): Fix behavior of `^` in multiline regexp mode.
+[searchcursor addon](https://codemirror.net/doc/manual.html#addon_searchcursor): Fix behavior of `^` in multiline regexp mode.
 
-[match-highlighter addon](http://codemirror.net/doc/manual.html#addon_match-highlighter): Fix problem with matching words that have regexp special syntax in them.
+[match-highlighter addon](https://codemirror.net/doc/manual.html#addon_match-highlighter): Fix problem with matching words that have regexp special syntax in them.
 
-[sublime bindings](http://codemirror.net/demo/sublime.html): Fix `addCursorToSelection` for short lines.
+[sublime bindings](https://codemirror.net/demo/sublime.html): Fix `addCursorToSelection` for short lines.
 
-[javascript mode](http://codemirror.net/mode/javascript/): Support TypeScript intersection types, dynamic `import`.
+[javascript mode](https://codemirror.net/mode/javascript/): Support TypeScript intersection types, dynamic `import`.
 
-[stex mode](http://codemirror.net/mode/stex/): Fix parsing of `\(` `\)` delimiters, recognize more atom arguments.
+[stex mode](https://codemirror.net/mode/stex/): Fix parsing of `\(` `\)` delimiters, recognize more atom arguments.
 
-[haskell mode](http://codemirror.net/mode/haskell/): Highlight more builtins, support `<*` and `*>`.
+[haskell mode](https://codemirror.net/mode/haskell/): Highlight more builtins, support `<*` and `*>`.
 
-[sql mode](http://codemirror.net/mode/sql/): Make it possible to disable backslash escapes in strings for dialects that don't have them, do this for MS SQL.
+[sql mode](https://codemirror.net/mode/sql/): Make it possible to disable backslash escapes in strings for dialects that don't have them, do this for MS SQL.
 
-[dockerfile mode](http://codemirror.net/mode/dockerfile/): Highlight strings and ports, recognize more instructions.
+[dockerfile mode](https://codemirror.net/mode/dockerfile/): Highlight strings and ports, recognize more instructions.
 
 ### New features
 
-[vim bindings](http://codemirror.net/demo/vim.html): Support alternative delimiters in replace command.
+[vim bindings](https://codemirror.net/demo/vim.html): Support alternative delimiters in replace command.
 
 ## 5.34.0 (2018-01-29)
 
 ### Bug fixes
 
-[markdown mode](http://codemirror.net/mode/markdown/): Fix a problem where inline styles would persist across list items.
+[markdown mode](https://codemirror.net/mode/markdown/): Fix a problem where inline styles would persist across list items.
 
-[sublime bindings](http://codemirror.net/demo/sublime.html): Fix the `toggleBookmark` command.
+[sublime bindings](https://codemirror.net/demo/sublime.html): Fix the `toggleBookmark` command.
 
-[closebrackets addon](http://codemirror.net/doc/manual.html#addon_closebrackets): Improve behavior when closing triple quotes.
+[closebrackets addon](https://codemirror.net/doc/manual.html#addon_closebrackets): Improve behavior when closing triple quotes.
 
-[xml-fold addon](http://codemirror.net/demo/folding.html): Fix folding of line-broken XML tags.
+[xml-fold addon](https://codemirror.net/demo/folding.html): Fix folding of line-broken XML tags.
 
-[shell mode](http://codemirror.net/mode/shell/): Better handling of nested quoting.
+[shell mode](https://codemirror.net/mode/shell/): Better handling of nested quoting.
 
-[javascript-lint addon](http://codemirror.net/demo/lint.html): Clean up and simplify.
+[javascript-lint addon](https://codemirror.net/demo/lint.html): Clean up and simplify.
 
-[matchbrackets addon](http://codemirror.net/doc/manual.html#addon_matchbrackets): Fix support for multiple editors at the same time.
+[matchbrackets addon](https://codemirror.net/doc/manual.html#addon_matchbrackets): Fix support for multiple editors at the same time.
 
 ### New features
 
-New themes: [oceanic-next](http://codemirror.net/demo/theme.html#oceanic-next) and [shadowfox](http://codemirror.net/demo/theme.html#shadowfox).
+New themes: [oceanic-next](https://codemirror.net/demo/theme.html#oceanic-next) and [shadowfox](https://codemirror.net/demo/theme.html#shadowfox).
 
 ## 5.33.0 (2017-12-21)
 
 ### Bug fixes
 
-[lint addon](http://codemirror.net/doc/manual.html#addon_lint): Make updates more efficient.
+[lint addon](https://codemirror.net/doc/manual.html#addon_lint): Make updates more efficient.
 
-[css mode](http://codemirror.net/mode/css/): The mode is now properly case-insensitive.
+[css mode](https://codemirror.net/mode/css/): The mode is now properly case-insensitive.
 
-[continuelist addon](http://codemirror.net/doc/manual.html#addon_continuelist): Fix broken handling of unordered lists introduced in previous release.
+[continuelist addon](https://codemirror.net/doc/manual.html#addon_continuelist): Fix broken handling of unordered lists introduced in previous release.
 
-[swift](http://codemirror.net/mode/swift) and [scala](http://codemirror.net/mode/clike/) modes: Support nested block comments.
+[swift](https://codemirror.net/mode/swift) and [scala](https://codemirror.net/mode/clike/) modes: Support nested block comments.
 
-[mllike mode](http://codemirror.net/mode/mllike/index.html): Improve OCaml support.
+[mllike mode](https://codemirror.net/mode/mllike/index.html): Improve OCaml support.
 
-[sublime bindings](http://codemirror.net/demo/sublime.html): Use the proper key bindings for `addCursorToNextLine` and `addCursorToPrevLine`.
+[sublime bindings](https://codemirror.net/demo/sublime.html): Use the proper key bindings for `addCursorToNextLine` and `addCursorToPrevLine`.
 
 ### New features
 
-[jsx mode](http://codemirror.net/mode/jsx/index.html): Support JSX fragments.
+[jsx mode](https://codemirror.net/mode/jsx/index.html): Support JSX fragments.
 
-[closetag addon](http://codemirror.net/demo/closetag.html): Add an option to disable auto-indenting.
+[closetag addon](https://codemirror.net/demo/closetag.html): Add an option to disable auto-indenting.
 
 ## 5.32.0 (2017-11-22)
 
@@ -76,19 +194,19 @@ New themes: [oceanic-next](http://codemirror.net/demo/theme.html#oceanic-next) a
 
 Increase contrast on default bracket-matching colors.
 
-[javascript mode](http://codemirror.net/mode/javascript/): Recognize TypeScript type parameters for calls, type guards, and type parameter defaults. Improve handling of `enum` and `module` keywords.
+[javascript mode](https://codemirror.net/mode/javascript/): Recognize TypeScript type parameters for calls, type guards, and type parameter defaults. Improve handling of `enum` and `module` keywords.
 
-[comment addon](http://codemirror.net/doc/manual.html#addon_comment): Fix bug when uncommenting a comment that spans all but the last selected line.
+[comment addon](https://codemirror.net/doc/manual.html#addon_comment): Fix bug when uncommenting a comment that spans all but the last selected line.
 
-[searchcursor addon](http://codemirror.net/doc/manual.html#addon_searchcursor): Fix bug in case folding.
+[searchcursor addon](https://codemirror.net/doc/manual.html#addon_searchcursor): Fix bug in case folding.
 
-[emacs bindings](http://codemirror.net/demo/emacs.html): Prevent single-character deletions from resetting the kill ring.
+[emacs bindings](https://codemirror.net/demo/emacs.html): Prevent single-character deletions from resetting the kill ring.
 
-[closebrackets addon](http://codemirror.net/doc/manual.html#addon_closebrackets): Tweak quote matching behavior.
+[closebrackets addon](https://codemirror.net/doc/manual.html#addon_closebrackets): Tweak quote matching behavior.
 
 ### New features
 
-[continuelist addon](http://codemirror.net/doc/manual.html#addon_continuelist): Increment ordered list numbers when adding one.
+[continuelist addon](https://codemirror.net/doc/manual.html#addon_continuelist): Increment ordered list numbers when adding one.
 
 ## 5.31.0 (2017-10-20)
 
@@ -96,17 +214,17 @@ Increase contrast on default bracket-matching colors.
 
 Further improve selection drawing and cursor motion in right-to-left documents.
 
-[vim bindings](http://codemirror.net/demo/vim.html): Fix ctrl-w behavior, support quote-dot and backtick-dot marks, make the wide cursor visible in contentEditable [input mode](http://codemirror.net/doc/manual.html#option_contentEditable).
+[vim bindings](https://codemirror.net/demo/vim.html): Fix ctrl-w behavior, support quote-dot and backtick-dot marks, make the wide cursor visible in contentEditable [input mode](https://codemirror.net/doc/manual.html#option_contentEditable).
 
-[continuecomment addon](http://codemirror.net/doc/manual.html#addon_continuecomment): Fix bug when pressing enter after a single-line block comment.
+[continuecomment addon](https://codemirror.net/doc/manual.html#addon_continuecomment): Fix bug when pressing enter after a single-line block comment.
 
-[markdown mode](http://codemirror.net/mode/markdown/): Fix issue with leaving indented fenced code blocks.
+[markdown mode](https://codemirror.net/mode/markdown/): Fix issue with leaving indented fenced code blocks.
 
-[javascript mode](http://codemirror.net/mode/javascript/): Fix bad parsing of operators without spaces between them. Fix some corner cases around semicolon insertion and regexps.
+[javascript mode](https://codemirror.net/mode/javascript/): Fix bad parsing of operators without spaces between them. Fix some corner cases around semicolon insertion and regexps.
 
 ### New features
 
-Modes added with [`addOverlay`](http://codemirror.net/doc/manual.html#addOverlay) now have access to a [`baseToken`](http://codemirror.net/doc/manual.html#baseToken) method on their input stream, giving access to the tokens of the underlying mode.
+Modes added with [`addOverlay`](https://codemirror.net/doc/manual.html#addOverlay) now have access to a [`baseToken`](https://codemirror.net/doc/manual.html#baseToken) method on their input stream, giving access to the tokens of the underlying mode.
 
 ## 5.30.0 (2017-09-20)
 
@@ -114,23 +232,23 @@ Modes added with [`addOverlay`](http://codemirror.net/doc/manual.html#addOverlay
 
 Fixed a number of issues with drawing right-to-left selections and mouse selection in bidirectional text.
 
-[search addon](http://codemirror.net/demo/search/): Fix crash when restarting search after doing empty search.
+[search addon](https://codemirror.net/demo/search/): Fix crash when restarting search after doing empty search.
 
 [mark-selection addon](http://cm/doc/manual.html#addon_mark-selection): Fix off-by-one bug.
 
-[tern addon](http://codemirror.net/demo/tern.html): Fix bad request made when editing at the bottom of a large document.
+[tern addon](https://codemirror.net/demo/tern.html): Fix bad request made when editing at the bottom of a large document.
 
-[javascript mode](http://codemirror.net/mode/javascript/): Improve parsing in a number of corner cases.
+[javascript mode](https://codemirror.net/mode/javascript/): Improve parsing in a number of corner cases.
 
-[markdown mode](http://codemirror.net/mode/markdown/): Fix crash when a sub-mode doesn't support indentation, allow uppercase X in task lists.
+[markdown mode](https://codemirror.net/mode/markdown/): Fix crash when a sub-mode doesn't support indentation, allow uppercase X in task lists.
 
-[gfm mode](http://codemirror.net/mode/gfm/): Don't highlight SHA1 'hashes' without numbers to avoid false positives.
+[gfm mode](https://codemirror.net/mode/gfm/): Don't highlight SHA1 'hashes' without numbers to avoid false positives.
 
-[soy mode](http://codemirror.net/mode/soy/): Support injected data and `@param` in comments.
+[soy mode](https://codemirror.net/mode/soy/): Support injected data and `@param` in comments.
 
 ### New features
 
-[simple mode addon](http://codemirror.net/demo/simplemode.html): Allow groups in regexps when `token` isn't an array.
+[simple mode addon](https://codemirror.net/demo/simplemode.html): Allow groups in regexps when `token` isn't an array.
 
 ## 5.29.0 (2017-08-24)
 
@@ -138,21 +256,21 @@ Fixed a number of issues with drawing right-to-left selections and mouse selecti
 
 Fix crash in contentEditable input style when editing near a bookmark.
 
-Make sure change origins are preserved when splitting changes on [read-only marks](http://codemirror.net/doc/manual.html#mark_readOnly).
+Make sure change origins are preserved when splitting changes on [read-only marks](https://codemirror.net/doc/manual.html#mark_readOnly).
 
-[javascript mode](http://codemirror.net/mode/javascript/): More support for TypeScript syntax.
+[javascript mode](https://codemirror.net/mode/javascript/): More support for TypeScript syntax.
 
-[d mode](http://codemirror.net/mode/d/): Support nested comments.
+[d mode](https://codemirror.net/mode/d/): Support nested comments.
 
-[python mode](http://codemirror.net/mode/python/): Improve tokenizing of operators.
+[python mode](https://codemirror.net/mode/python/): Improve tokenizing of operators.
 
-[markdown mode](http://codemirror.net/mode/markdown/): Further improve CommonMark conformance.
+[markdown mode](https://codemirror.net/mode/markdown/): Further improve CommonMark conformance.
 
-[css mode](http://codemirror.net/mode/css/): Don't run comment tokens through the mode's state machine.
+[css mode](https://codemirror.net/mode/css/): Don't run comment tokens through the mode's state machine.
 
-[shell mode](http://codemirror.net/mode/shell/): Allow strings to span lines.
+[shell mode](https://codemirror.net/mode/shell/): Allow strings to span lines.
 
-[search addon](http://codemirror.net/demo/search/): Fix crash in persistent search when `extraKeys` is null.
+[search addon](https://codemirror.net/demo/search/): Fix crash in persistent search when `extraKeys` is null.
 
 ## 5.28.0 (2017-07-21)
 
@@ -160,21 +278,21 @@ Make sure change origins are preserved when splitting changes on [read-only mark
 
 Fix copying of, or replacing editor content with, a single dash character when copying a big selection in some corner cases.
 
-Make [`"goLineLeft"`](http://codemirror.net/doc/manual.html#command_goLineLeft)/`"goLineRight"` behave better on wrapped lines.
+Make [`"goLineLeft"`](https://codemirror.net/doc/manual.html#command_goLineLeft)/`"goLineRight"` behave better on wrapped lines.
 
-[sql mode](http://codemirror.net/mode/sql/): Fix tokenizing of multi-dot operator and allow digits in subfield names.
+[sql mode](https://codemirror.net/mode/sql/): Fix tokenizing of multi-dot operator and allow digits in subfield names.
 
-[searchcursor addon](http://codemirror.net/doc/manual.html#addon_searchcursor): Fix infinite loop on some composed character inputs.
+[searchcursor addon](https://codemirror.net/doc/manual.html#addon_searchcursor): Fix infinite loop on some composed character inputs.
 
-[markdown mode](http://codemirror.net/mode/markdown/): Make list parsing more CommonMark-compliant.
+[markdown mode](https://codemirror.net/mode/markdown/): Make list parsing more CommonMark-compliant.
 
-[gfm mode](http://codemirror.net/mode/gfm/): Highlight colon syntax for emoji.
+[gfm mode](https://codemirror.net/mode/gfm/): Highlight colon syntax for emoji.
 
 ### New features
 
-Expose [`startOperation`](http://codemirror.net/doc/manual.html#startOperation) and `endOperation` for explicit operation management.
+Expose [`startOperation`](https://codemirror.net/doc/manual.html#startOperation) and `endOperation` for explicit operation management.
 
-[sublime bindings](http://codemirror.net/demo/sublime.html): Add extend-selection (Ctrl-Alt- or Cmd-Shift-Up/Down).
+[sublime bindings](https://codemirror.net/demo/sublime.html): Add extend-selection (Ctrl-Alt- or Cmd-Shift-Up/Down).
 
 ## 5.27.4 (2017-06-29)
 
@@ -182,13 +300,13 @@ Expose [`startOperation`](http://codemirror.net/doc/manual.html#startOperation)
 
 Fix crash when using mode lookahead.
 
-[markdown mode](http://codemirror.net/mode/markdown/): Don't block inner mode's indentation support.
+[markdown mode](https://codemirror.net/mode/markdown/): Don't block inner mode's indentation support.
 
 ## 5.27.2 (2017-06-22)
 
 ### Bug fixes
 
-Fix crash in the [simple mode](http://codemirror.net/demo/simplemode.html)< addon.
+Fix crash in the [simple mode](https://codemirror.net/demo/simplemode.html)< addon.
 
 ## 5.27.0 (2017-06-22)
 
@@ -200,31 +318,31 @@ Properly disable the hidden textarea when `readOnly` is `"nocursor"`.
 
 Calling the `Doc` constructor without `new` works again.
 
-[sql mode](http://codemirror.net/mode/sql/): Handle nested comments.
+[sql mode](https://codemirror.net/mode/sql/): Handle nested comments.
 
-[javascript mode](http://codemirror.net/mode/javascript/): Improve support for TypeScript syntax.
+[javascript mode](https://codemirror.net/mode/javascript/): Improve support for TypeScript syntax.
 
-[markdown mode](http://codemirror.net/mode/markdown/): Fix bug where markup was ignored on indented paragraph lines.
+[markdown mode](https://codemirror.net/mode/markdown/): Fix bug where markup was ignored on indented paragraph lines.
 
-[vim bindings](http://codemirror.net/demo/vim.html): Referencing invalid registers no longer causes an uncaught exception.
+[vim bindings](https://codemirror.net/demo/vim.html): Referencing invalid registers no longer causes an uncaught exception.
 
-[rust mode](http://codemirror.net/mode/rust/): Add the correct MIME type.
+[rust mode](https://codemirror.net/mode/rust/): Add the correct MIME type.
 
-[matchbrackets addon](http://codemirror.net/doc/manual.html#addon_matchbrackets): Document options.
+[matchbrackets addon](https://codemirror.net/doc/manual.html#addon_matchbrackets): Document options.
 
 ### New features
 
 Mouse button clicks can now be bound in keymaps by using names like `"LeftClick"` or `"Ctrl-Alt-MiddleTripleClick"`. When bound to a function, that function will be passed the position of the click as second argument.
 
-The behavior of mouse selection and dragging can now be customized with the [`configureMouse`](http://codemirror.net/doc/manual.html#option_configureMouse) option.
+The behavior of mouse selection and dragging can now be customized with the [`configureMouse`](https://codemirror.net/doc/manual.html#option_configureMouse) option.
 
-Modes can now look ahead across line boundaries with the [`StringStream`](http://codemirror.net/doc/manual.html#StringStream)`.lookahead` method.
+Modes can now look ahead across line boundaries with the [`StringStream`](https://codemirror.net/doc/manual.html#StringStream)`.lookahead` method.
 
 Introduces a `"type"` token type, makes modes that recognize types output it, and add styling for it to the themes.
 
-New [`pasteLinesPerSelection`](http://codemirror.net/doc/manual.html#option_pasteLinesPerSelection) option to control the behavior of pasting multiple lines into multiple selections.
+New [`pasteLinesPerSelection`](https://codemirror.net/doc/manual.html#option_pasteLinesPerSelection) option to control the behavior of pasting multiple lines into multiple selections.
 
-[searchcursor addon](http://codemirror.net/doc/manual.html#addon_searchcursor): Support multi-line regular expression matches, and normalize strings when matching.
+[searchcursor addon](https://codemirror.net/doc/manual.html#addon_searchcursor): Support multi-line regular expression matches, and normalize strings when matching.
 
 ## 5.26.0 (2017-05-22)
 
@@ -234,19 +352,19 @@ In textarea-mode, don't reset the input field during composition.
 
 More careful restoration of selections in widgets, during editor redraw.
 
-[javascript mode](http://codemirror.net/mode/javascript/): More TypeScript parsing fixes.
+[javascript mode](https://codemirror.net/mode/javascript/): More TypeScript parsing fixes.
 
-[julia mode](http://codemirror.net/mode/julia/): Fix issue where the mode gets stuck.
+[julia mode](https://codemirror.net/mode/julia/): Fix issue where the mode gets stuck.
 
-[markdown mode](http://codemirror.net/mode/markdown/): Understand cross-line links, parse all bracketed things as links.
+[markdown mode](https://codemirror.net/mode/markdown/): Understand cross-line links, parse all bracketed things as links.
 
-[soy mode](http://codemirror.net/mode/soy/): Support single-quoted strings.
+[soy mode](https://codemirror.net/mode/soy/): Support single-quoted strings.
 
-[go mode](http://codemirror.net/mode/go/): Don't try to indent inside strings or comments.
+[go mode](https://codemirror.net/mode/go/): Don't try to indent inside strings or comments.
 
 ### New features
 
-[vim bindings](http://codemirror.net/demo/vim.html): Parse line offsets in line or range specs.
+[vim bindings](https://codemirror.net/demo/vim.html): Parse line offsets in line or range specs.
 
 ## 5.25.2 (2017-04-20)
 
@@ -262,11 +380,11 @@ Make sure long-clicking a selection sets a cursor and doesn't show the editor lo
 
 Fix issue where pointer events were incorrectly disabled on Chrome's overlay scrollbars.
 
-[javascript mode](http://codemirror.net/mode/javascript/): Recognize annotations and TypeScript-style type parameters.
+[javascript mode](https://codemirror.net/mode/javascript/): Recognize annotations and TypeScript-style type parameters.
 
-[shell mode](http://codemirror.net/mode/shell/): Handle nested braces.
+[shell mode](https://codemirror.net/mode/shell/): Handle nested braces.
 
-[markdown mode](http://codemirror.net/mode/markdown/): Make parsing of strong/em delimiters CommonMark-compliant.
+[markdown mode](https://codemirror.net/mode/markdown/): Make parsing of strong/em delimiters CommonMark-compliant.
 
 ## 5.25.0 (2017-03-20)
 
@@ -284,37 +402,37 @@ Fix handling of shadow DOM roots when finding the active element.
 
 Add `role=presentation` to more DOM elements to improve screen reader support.
 
-[merge addon](http://codemirror.net/doc/manual.html#addon_merge): Make aligning of unchanged chunks more robust.
+[merge addon](https://codemirror.net/doc/manual.html#addon_merge): Make aligning of unchanged chunks more robust.
 
-[comment addon](http://codemirror.net/doc/manual.html#addon_comment): Fix comment-toggling on a block of text that starts and ends in a (differnet) block comment.
+[comment addon](https://codemirror.net/doc/manual.html#addon_comment): Fix comment-toggling on a block of text that starts and ends in a (differnet) block comment.
 
-[javascript mode](http://codemirror.net/mode/javascript/): Improve support for TypeScript syntax.
+[javascript mode](https://codemirror.net/mode/javascript/): Improve support for TypeScript syntax.
 
-[r mode](http://codemirror.net/mode/r/): Fix indentation after semicolon-less statements.
+[r mode](https://codemirror.net/mode/r/): Fix indentation after semicolon-less statements.
 
-[shell mode](http://codemirror.net/mode/shell/): Properly handle escaped parentheses in parenthesized expressions.
+[shell mode](https://codemirror.net/mode/shell/): Properly handle escaped parentheses in parenthesized expressions.
 
-[markdown mode](http://codemirror.net/mode/markdown/): Fix a few bugs around leaving fenced code blocks.
+[markdown mode](https://codemirror.net/mode/markdown/): Fix a few bugs around leaving fenced code blocks.
 
-[soy mode](http://codemirror.net/mode/soy/): Improve indentation.
+[soy mode](https://codemirror.net/mode/soy/): Improve indentation.
 
 ### New features
 
-[lint addon](http://codemirror.net/doc/manual.html#addon_lint): Support asynchronous linters that return promises.
+[lint addon](https://codemirror.net/doc/manual.html#addon_lint): Support asynchronous linters that return promises.
 
-[continuelist addon](http://codemirror.net/doc/manual.html#addon_continuelist): Support continuing task lists.
+[continuelist addon](https://codemirror.net/doc/manual.html#addon_continuelist): Support continuing task lists.
 
-[vim bindings](http://codemirror.net/demo/vim.html): Make Y behave like yy.
+[vim bindings](https://codemirror.net/demo/vim.html): Make Y behave like yy.
 
-[sql mode](http://codemirror.net/mode/sql/): Support sqlite dialect.
+[sql mode](https://codemirror.net/mode/sql/): Support sqlite dialect.
 
 ## 5.24.2 (2017-02-22)
 
 ### Bug fixes
 
-[javascript mode](http://codemirror.net/mode/javascript/): Support computed class method names.
+[javascript mode](https://codemirror.net/mode/javascript/): Support computed class method names.
 
-[merge addon](http://codemirror.net/doc/manual.html#addon_merge): Improve aligning of unchanged code in the presence of marks and line widgets.
+[merge addon](https://codemirror.net/doc/manual.html#addon_merge): Improve aligning of unchanged code in the presence of marks and line widgets.
 
 ## 5.24.0 (2017-02-20)
 
@@ -326,37 +444,37 @@ Visual cursor motion in line-wrapped right-to-left text should be much more corr
 
 Fix bug in handling of read-only marked text.
 
-[shell mode](http://codemirror.net/mode/shell/): Properly tokenize nested parentheses.
+[shell mode](https://codemirror.net/mode/shell/): Properly tokenize nested parentheses.
 
-[python mode](http://codemirror.net/mode/python/): Support underscores in number literals.
+[python mode](https://codemirror.net/mode/python/): Support underscores in number literals.
 
-[sass mode](http://codemirror.net/mode/sass/): Uses the full list of CSS properties and keywords from the CSS mode, rather than defining its own incomplete subset.
+[sass mode](https://codemirror.net/mode/sass/): Uses the full list of CSS properties and keywords from the CSS mode, rather than defining its own incomplete subset.
 
-[css mode](http://codemirror.net/mode/css/): Expose `lineComment` property for LESS and SCSS dialects. Recognize vendor prefixes on pseudo-elements.
+[css mode](https://codemirror.net/mode/css/): Expose `lineComment` property for LESS and SCSS dialects. Recognize vendor prefixes on pseudo-elements.
 
-[julia mode](http://codemirror.net/mode/julia/): Properly indent `elseif` lines.
+[julia mode](https://codemirror.net/mode/julia/): Properly indent `elseif` lines.
 
-[markdown mode](http://codemirror.net/mode/markdown/): Properly recognize the end of fenced code blocks when inside other markup.
+[markdown mode](https://codemirror.net/mode/markdown/): Properly recognize the end of fenced code blocks when inside other markup.
 
-[scala mode](http://codemirror.net/mode/clike/): Improve handling of operators containing <code>#</code>, <code>@</code>, and <code>:</code> chars.
+[scala mode](https://codemirror.net/mode/clike/): Improve handling of operators containing <code>#</code>, <code>@</code>, and <code>:</code> chars.
 
-[xml mode](http://codemirror.net/mode/xml/): Allow dashes in HTML tag names.
+[xml mode](https://codemirror.net/mode/xml/): Allow dashes in HTML tag names.
 
-[javascript mode](http://codemirror.net/mode/javascript/): Improve parsing of async methods, TypeScript-style comma-separated superclass lists.
+[javascript mode](https://codemirror.net/mode/javascript/): Improve parsing of async methods, TypeScript-style comma-separated superclass lists.
 
-[indent-fold addon](http://codemirror.net/demo/folding.html): Ignore comment lines.
+[indent-fold addon](https://codemirror.net/demo/folding.html): Ignore comment lines.
 
 ### New features
 
 Positions now support a `sticky` property which determines whether they should be associated with the character before (value `"before"`) or after (value `"after"`) them.
 
-[vim bindings](http://codemirror.net/demo/vim.html): Make it possible to remove built-in bindings through the API.
+[vim bindings](https://codemirror.net/demo/vim.html): Make it possible to remove built-in bindings through the API.
 
-[comment addon](http://codemirror.net/doc/manual.html#addon_comment): Support a per-mode <code>useInnerComments</code> option to optionally suppress descending to the inner modes to get comment strings.
+[comment addon](https://codemirror.net/doc/manual.html#addon_comment): Support a per-mode <code>useInnerComments</code> option to optionally suppress descending to the inner modes to get comment strings.
 
 ### Breaking changes
 
-The [sass mode](http://codemirror.net/mode/sass/) now depends on the [css mode](http://codemirror.net/mode/css/).
+The [sass mode](https://codemirror.net/mode/sass/) now depends on the [css mode](https://codemirror.net/mode/css/).
 
 ## 5.23.0 (2017-01-19)
 
@@ -364,15 +482,15 @@ The [sass mode](http://codemirror.net/mode/sass/) now depends on the [css mode](
 
 Presentation-related elements DOM elements are now marked as such to help screen readers.
 
-[markdown mode](http://codemirror.net/mode/markdown/): Be more picky about what HTML tags look like to avoid false positives.
+[markdown mode](https://codemirror.net/mode/markdown/): Be more picky about what HTML tags look like to avoid false positives.
 
 ### New features
 
 `findModeByMIME` now understands `+json` and `+xml` MIME suffixes.
 
-[closebrackets addon](http://codemirror.net/doc/manual.html#addon_closebrackets): Add support for an `override` option to ignore language-specific defaults.
+[closebrackets addon](https://codemirror.net/doc/manual.html#addon_closebrackets): Add support for an `override` option to ignore language-specific defaults.
 
-[panel addon](http://codemirror.net/doc/manual.html#addon_panel): Add a `stable` option that auto-scrolls the content to keep it in the same place when inserting/removing a panel.
+[panel addon](https://codemirror.net/doc/manual.html#addon_panel): Add a `stable` option that auto-scrolls the content to keep it in the same place when inserting/removing a panel.
 
 ## 5.22.2 (2017-01-12)
 
@@ -384,49 +502,49 @@ Include rollup.config.js in NPM package, so that it can be used to build from so
 
 ### Bug fixes
 
-[sublime bindings](http://codemirror.net/demo/sublime.html): Make `selectBetweenBrackets` work with multiple cursors.
+[sublime bindings](https://codemirror.net/demo/sublime.html): Make `selectBetweenBrackets` work with multiple cursors.
 
-[javascript mode](http://codemirror.net/mode/javascript/): Fix issues with parsing complex TypeScript types, imports, and exports.
+[javascript mode](https://codemirror.net/mode/javascript/): Fix issues with parsing complex TypeScript types, imports, and exports.
 
 A contentEditable editor instance with autofocus enabled no longer crashes during initializing.
 
 ### New features
 
-[emacs bindings](http://codemirror.net/demo/emacs.html): Export `CodeMirror.emacs` to allow other addons to hook into Emacs-style functionality.
+[emacs bindings](https://codemirror.net/demo/emacs.html): Export `CodeMirror.emacs` to allow other addons to hook into Emacs-style functionality.
 
-[active-line addon](http://codemirror.net/doc/manual.html#addon_active-line): Add `nonEmpty` option.
+[active-line addon](https://codemirror.net/doc/manual.html#addon_active-line): Add `nonEmpty` option.
 
-New event: [`optionChange`](http://codemirror.net/doc/manual.html#event_optionChange).
+New event: [`optionChange`](https://codemirror.net/doc/manual.html#event_optionChange).
 
 ## 5.21.0 (2016-11-21)
 
 ### Bug fixes
 
-Tapping/clicking the editor in [contentEditable mode](http://codemirror.net/doc/manual.html#option_inputStyle) on Chrome now puts the cursor at the tapped position.
+Tapping/clicking the editor in [contentEditable mode](https://codemirror.net/doc/manual.html#option_inputStyle) on Chrome now puts the cursor at the tapped position.
 
-Fix various crashes and misbehaviors when reading composition events in [contentEditable mode](http://codemirror.net/doc/manual.html#option_inputStyle).
+Fix various crashes and misbehaviors when reading composition events in [contentEditable mode](https://codemirror.net/doc/manual.html#option_inputStyle).
 
 Catches and ignores an IE 'Unspecified Error' when creating an editor in an iframe before there is a `<body>`.
 
-[merge addon](http://codemirror.net/doc/manual.html#addon_merge): Fix several issues in the chunk-aligning feature.
+[merge addon](https://codemirror.net/doc/manual.html#addon_merge): Fix several issues in the chunk-aligning feature.
 
-[verilog mode](http://codemirror.net/mode/verilog): Rewritten to address various issues.
+[verilog mode](https://codemirror.net/mode/verilog): Rewritten to address various issues.
 
-[julia mode](http://codemirror.net/mode/julia): Recognize Julia 0.5 syntax.
+[julia mode](https://codemirror.net/mode/julia): Recognize Julia 0.5 syntax.
 
-[swift mode](http://codemirror.net/mode/swift): Various fixes and adjustments to current syntax.
+[swift mode](https://codemirror.net/mode/swift): Various fixes and adjustments to current syntax.
 
-[markdown mode](http://codemirror.net/mode/markdown): Allow lists without a blank line above them.
+[markdown mode](https://codemirror.net/mode/markdown): Allow lists without a blank line above them.
 
 ### New features
 
-The [`setGutterMarker`](http://codemirror.net/doc/manual.html#setGutterMarker), [`clearGutter`](http://codemirror.net/doc/manual.html#clearGutter), and [`lineInfo`](http://codemirror.net/doc/manual.html#lineInfo) methods are now available on `Doc` objects.
+The [`setGutterMarker`](https://codemirror.net/doc/manual.html#setGutterMarker), [`clearGutter`](https://codemirror.net/doc/manual.html#clearGutter), and [`lineInfo`](https://codemirror.net/doc/manual.html#lineInfo) methods are now available on `Doc` objects.
 
-The [`heightAtLine`](http://codemirror.net/doc/manual.html#heightAtLine) method now takes an extra argument to allow finding the height at the top of the line's line widgets.
+The [`heightAtLine`](https://codemirror.net/doc/manual.html#heightAtLine) method now takes an extra argument to allow finding the height at the top of the line's line widgets.
 
-[ruby mode](http://codemirror.net/mode/ruby): `else` and `elsif` are now immediately indented.
+[ruby mode](https://codemirror.net/mode/ruby): `else` and `elsif` are now immediately indented.
 
-[vim bindings](http://codemirror.net/demo/vim.html): Bind Ctrl-T and Ctrl-D to in- and dedent in insert mode.
+[vim bindings](https://codemirror.net/demo/vim.html): Bind Ctrl-T and Ctrl-D to in- and dedent in insert mode.
 
 ## 5.20.2 (2016-10-21)
 
@@ -444,27 +562,27 @@ Make sure keypress events for backspace are ignored.
 
 Tokens styled with overlays no longer get a nonsense `cm-cm-overlay` class.
 
-Line endings for pasted content are now normalized to the editor's [preferred ending](http://codemirror.net/doc/manual.html#option_lineSeparator).
+Line endings for pasted content are now normalized to the editor's [preferred ending](https://codemirror.net/doc/manual.html#option_lineSeparator).
 
-[javascript mode](http://codemirror.net/mode/javascript): Improve support for class expressions. Support TypeScript optional class properties, the `abstract` keyword, and return type declarations for arrow functions.
+[javascript mode](https://codemirror.net/mode/javascript): Improve support for class expressions. Support TypeScript optional class properties, the `abstract` keyword, and return type declarations for arrow functions.
 
-[css mode](http://codemirror.net/mode/css): Fix highlighting of mixed-case keywords.
+[css mode](https://codemirror.net/mode/css): Fix highlighting of mixed-case keywords.
 
-[closebrackets addon](http://codemirror.net/doc/manual.html#addon_closebrackets): Improve behavior when typing a quote before a string.
+[closebrackets addon](https://codemirror.net/doc/manual.html#addon_closebrackets): Improve behavior when typing a quote before a string.
 
 ### New features
 
 The core is now maintained as a number of small files, using ES6 syntax and modules, under the `src/` directory. A git checkout no longer contains a working `codemirror.js` until you `npm build` (but when installing from NPM, it is included).
 
-The [`refresh`](http://codemirror.net/doc/manual.html#event_refresh) event is now documented and stable.
+The [`refresh`](https://codemirror.net/doc/manual.html#event_refresh) event is now documented and stable.
 
 ## 5.19.0 (2016-09-20)
 
 ### Bugfixes
 
-[erlang mode](http://codemirror.net/mode/erlang): Fix mode crash when trying to read an empty context.
+[erlang mode](https://codemirror.net/mode/erlang): Fix mode crash when trying to read an empty context.
 
-[comment addon](http://codemirror.net/doc/manual.html#addon_comment): Fix broken behavior when toggling comments inside a comment.
+[comment addon](https://codemirror.net/doc/manual.html#addon_comment): Fix broken behavior when toggling comments inside a comment.
 
 xml-fold addon: Fix a null-dereference bug.
 
@@ -474,43 +592,43 @@ Fix an issue where the cursor position could be off in really long (~8000 charac
 
 ### New features
 
-[javascript mode](http://codemirror.net/mode/javascript): Better indentation when semicolons are missing. Better support for TypeScript classes, optional parameters, and the `type` keyword.
+[javascript mode](https://codemirror.net/mode/javascript): Better indentation when semicolons are missing. Better support for TypeScript classes, optional parameters, and the `type` keyword.
 
-The [`blur`](http://codemirror.net/doc/manual.html#event_blur) and [`focus`](http://codemirror.net/doc/manual.html#event_focus) events now pass the DOM event to their handlers.
+The [`blur`](https://codemirror.net/doc/manual.html#event_blur) and [`focus`](https://codemirror.net/doc/manual.html#event_focus) events now pass the DOM event to their handlers.
 
 ## 5.18.2 (2016-08-23)
 
 ### Bugfixes
 
-[vue mode](http://codemirror.net/mode/vue): Fix outdated references to renamed Pug mode dependency.
+[vue mode](https://codemirror.net/mode/vue): Fix outdated references to renamed Pug mode dependency.
 
 ## 5.18.0 (2016-08-22)
 
 ### Bugfixes
 
-Make sure [gutter backgrounds](http://codemirror.net/doc/manual.html#addLineClass) stick to the rest of the gutter during horizontal scrolling.
+Make sure [gutter backgrounds](https://codemirror.net/doc/manual.html#addLineClass) stick to the rest of the gutter during horizontal scrolling.
 
-The contenteditable [`inputStyle`](http://codemirror.net/doc/manual.html#option_inputStyle) now properly supports pasting on pre-Edge IE versions.
+The contenteditable [`inputStyle`](https://codemirror.net/doc/manual.html#option_inputStyle) now properly supports pasting on pre-Edge IE versions.
 
-[javascript mode](http://codemirror.net/mode/javascript): Fix some small parsing bugs and improve TypeScript support.
+[javascript mode](https://codemirror.net/mode/javascript): Fix some small parsing bugs and improve TypeScript support.
 
-[matchbrackets addon](http://codemirror.net/doc/manual.html#addon_matchbrackets): Fix bug where active highlighting was left in editor when the addon was disabled.
+[matchbrackets addon](https://codemirror.net/doc/manual.html#addon_matchbrackets): Fix bug where active highlighting was left in editor when the addon was disabled.
 
-[match-highlighter addon](http://codemirror.net/doc/manual.html#addon_match-highlighter): Only start highlighting things when the editor gains focus.
+[match-highlighter addon](https://codemirror.net/doc/manual.html#addon_match-highlighter): Only start highlighting things when the editor gains focus.
 
-[javascript-hint addon](http://codemirror.net/doc/manual.html#addon_javascript-hint): Also complete non-enumerable properties.
+[javascript-hint addon](https://codemirror.net/doc/manual.html#addon_javascript-hint): Also complete non-enumerable properties.
 
 ### New features
 
-The [`addOverlay`](http://codemirror.net/doc/manual.html#addOverlay) method now supports a `priority` option to control the order in which overlays are applied.
+The [`addOverlay`](https://codemirror.net/doc/manual.html#addOverlay) method now supports a `priority` option to control the order in which overlays are applied.
 
 MIME types that end in `+json` now default to the JSON mode when the MIME itself is not defined.
 
 ### Breaking changes
 
-The mode formerly known as Jade was renamed to [Pug](http://codemirror.net/mode/pug).
+The mode formerly known as Jade was renamed to [Pug](https://codemirror.net/mode/pug).
 
-The [Python mode](http://codemirror.net/mode/python) now defaults to Python 3 (rather than 2) syntax.
+The [Python mode](https://codemirror.net/mode/python) now defaults to Python 3 (rather than 2) syntax.
 
 ## 5.17.0 (2016-07-19)
 
@@ -522,15 +640,15 @@ Prevent IME dialog from overlapping typed content in Chrome.
 
 Improve measuring of characters near a line wrap.
 
-[javascript mode](http://codemirror.net/mode/javascript): Improve support for `async`, allow trailing commas in `import` lists.
+[javascript mode](https://codemirror.net/mode/javascript): Improve support for `async`, allow trailing commas in `import` lists.
 
-[vim bindings](http://codemirror.net/demo/vim.html): Fix backspace in replace mode.
+[vim bindings](https://codemirror.net/demo/vim.html): Fix backspace in replace mode.
 
-[sublime bindings](http://codemirror.net/demo/sublime.html): Fix some key bindings on OS X to match Sublime Text.
+[sublime bindings](https://codemirror.net/demo/sublime.html): Fix some key bindings on OS X to match Sublime Text.
 
 ### New features
 
-[markdown mode](http://codemirror.net/mode/markdown): Add more classes to image links in highlight-formatting mode.
+[markdown mode](https://codemirror.net/mode/markdown): Add more classes to image links in highlight-formatting mode.
 
 ## 5.16.0 (2016-06-20)
 
@@ -542,15 +660,15 @@ Make Control-drag work on Firefox.
 
 Make clicking or selection-dragging at the end of a wrapped line select the right position.
 
-[show-hint addon](http://codemirror.net/doc/manual.html#addon_show-hint): Prevent widget scrollbar from hiding part of the hint text.
+[show-hint addon](https://codemirror.net/doc/manual.html#addon_show-hint): Prevent widget scrollbar from hiding part of the hint text.
 
-[rulers addon](http://codemirror.net/doc/manual.html#addon_rulers): Prevent rulers from forcing a horizontal editor scrollbar.
+[rulers addon](https://codemirror.net/doc/manual.html#addon_rulers): Prevent rulers from forcing a horizontal editor scrollbar.
 
 ### New features
 
-[search addon](http://codemirror.net/doc/manual.html#addon_search): Automatically bind search-related keys in persistent dialog.
+[search addon](https://codemirror.net/doc/manual.html#addon_search): Automatically bind search-related keys in persistent dialog.
 
-[sublime keymap](http://codemirror.net/demo/sublime.html): Add a multi-cursor aware smart backspace binding.
+[sublime keymap](https://codemirror.net/demo/sublime.html): Add a multi-cursor aware smart backspace binding.
 
 ## 5.15.2 (2016-05-20)
 
@@ -572,17 +690,17 @@ Fix issue where the editor would complain about overlapping collapsed ranges whe
 
 Optimize document tree building when loading or pasting huge chunks of content.
 
-[markdown mode](http://codemirror.net/mode/markdown/): Fix several issues in matching link targets.
+[markdown mode](https://codemirror.net/mode/markdown/): Fix several issues in matching link targets.
 
-[clike mode](http://codemirror.net/mode/clike/): Improve indentation of C++ template declarations.
+[clike mode](https://codemirror.net/mode/clike/): Improve indentation of C++ template declarations.
 
 ### New features
 
 Explicitly bind Ctrl-O on OS X to make that binding (“open line”) act as expected.
 
-Pasting [linewise-copied](http://codemirror.net/doc/manual.html#option_lineWiseCopyCut) content when there is no selection now inserts the lines above the current line.
+Pasting [linewise-copied](https://codemirror.net/doc/manual.html#option_lineWiseCopyCut) content when there is no selection now inserts the lines above the current line.
 
-[javascript mode](http://codemirror.net/mode/javascript/): Support `async`/`await` and improve support for TypeScript type syntax.
+[javascript mode](https://codemirror.net/mode/javascript/): Support `async`/`await` and improve support for TypeScript type syntax.
 
 ## 5.14.2 (2016-04-20)
 
@@ -592,37 +710,37 @@ Push a new package to NPM due to an [NPM bug](https://github.com/npm/npm/issues/
 
 Set `dataTransfer.effectAllowed` in `dragstart` handler to help browsers use the right drag icon.
 
-Add the [mbox mode](http://codemirror.net/mode/mbox/index.html) to `mode/meta.js`.
+Add the [mbox mode](https://codemirror.net/mode/mbox/index.html) to `mode/meta.js`.
 
 ## 5.14.0 (2016-04-20)
 
 ### Bugfixes
 
-[`posFromIndex`](http://codemirror.net/doc/manual.html#posFromIndex) and [`indexFromPos`](http://codemirror.net/doc/manual.html#indexFromPos) now take [`lineSeparator`](http://codemirror.net/doc/manual.html#option_lineSeparator) into account.
+[`posFromIndex`](https://codemirror.net/doc/manual.html#posFromIndex) and [`indexFromPos`](https://codemirror.net/doc/manual.html#indexFromPos) now take [`lineSeparator`](https://codemirror.net/doc/manual.html#option_lineSeparator) into account.
 
-[vim bindings](http://codemirror.net/demo/vim.html): Only call `.save()` when it is actually available.
+[vim bindings](https://codemirror.net/demo/vim.html): Only call `.save()` when it is actually available.
 
-[comment addon](http://codemirror.net/doc/manual.html#addon_comment): Be careful not to mangle multi-line strings.
+[comment addon](https://codemirror.net/doc/manual.html#addon_comment): Be careful not to mangle multi-line strings.
 
-[Python mode](http://codemirror.net/mode/python/index.html): Improve distinguishing of decorators from `@` operators.
+[Python mode](https://codemirror.net/mode/python/index.html): Improve distinguishing of decorators from `@` operators.
 
-[`findMarks`](http://codemirror.net/doc/manual.html#findMarks): No longer return marks that touch but don't overlap given range.
+[`findMarks`](https://codemirror.net/doc/manual.html#findMarks): No longer return marks that touch but don't overlap given range.
 
 ### New features
 
-[vim bindings](http://codemirror.net/demo/vim.html): Add yank command.
+[vim bindings](https://codemirror.net/demo/vim.html): Add yank command.
 
-[match-highlighter addon](http://codemirror.net/doc/manual.html#addon_match-highlighter): Add `trim` option to disable ignoring of whitespace.
+[match-highlighter addon](https://codemirror.net/doc/manual.html#addon_match-highlighter): Add `trim` option to disable ignoring of whitespace.
 
-[PowerShell mode](http://codemirror.net/mode/powershell/index.html): Added.
+[PowerShell mode](https://codemirror.net/mode/powershell/index.html): Added.
 
-[Yacas mode](http://codemirror.net/mode/yacas/index.html): Added.
+[Yacas mode](https://codemirror.net/mode/yacas/index.html): Added.
 
-[Web IDL mode](http://codemirror.net/mode/webidl/index.html): Added.
+[Web IDL mode](https://codemirror.net/mode/webidl/index.html): Added.
 
-[SAS mode](http://codemirror.net/mode/sas/index.html): Added.
+[SAS mode](https://codemirror.net/mode/sas/index.html): Added.
 
-[mbox mode](http://codemirror.net/mode/mbox/index.html): Added.
+[mbox mode](https://codemirror.net/mode/mbox/index.html): Added.
 
 ## 5.13.2 (2016-03-23)
 
@@ -634,43 +752,43 @@ Solves a problem where the gutter would sometimes not extend all the way to the
 
 ### New features
 
-New DOM event forwarded: [`"dragleave"`](http://codemirror.net/doc/manual.html#event_dom).
+New DOM event forwarded: [`"dragleave"`](https://codemirror.net/doc/manual.html#event_dom).
 
-[protobuf mode](http://codemirror.net/mode/protobuf/index.html): Newly added.
+[protobuf mode](https://codemirror.net/mode/protobuf/index.html): Newly added.
 
 ### Bugfixes
 
-Fix problem where [`findMarks`](http://codemirror.net/doc/manual.html#findMarks) sometimes failed to find multi-line marks.
+Fix problem where [`findMarks`](https://codemirror.net/doc/manual.html#findMarks) sometimes failed to find multi-line marks.
 
 Fix crash that showed up when atomic ranges and bidi text were combined.
 
-[show-hint addon](http://codemirror.net/demo/complete.html): Completion widgets no longer close when the line indented or dedented.
+[show-hint addon](https://codemirror.net/demo/complete.html): Completion widgets no longer close when the line indented or dedented.
 
-[merge addon](http://codemirror.net/demo/merge.html): Fix bug when merging chunks at the end of the file.
+[merge addon](https://codemirror.net/demo/merge.html): Fix bug when merging chunks at the end of the file.
 
-[placeholder addon](http://codemirror.net/doc/manual.html#addon_placeholder): No longer gets confused by [`swapDoc`](http://codemirror.net/doc/manual.html#swapDoc).
+[placeholder addon](https://codemirror.net/doc/manual.html#addon_placeholder): No longer gets confused by [`swapDoc`](https://codemirror.net/doc/manual.html#swapDoc).
 
-[simplescrollbars addon](http://codemirror.net/doc/manual.html#addon_simplescrollbars): Fix invalid state when deleting at end of document.
+[simplescrollbars addon](https://codemirror.net/doc/manual.html#addon_simplescrollbars): Fix invalid state when deleting at end of document.
 
-[clike mode](http://codemirror.net/mode/clike/index.html): No longer gets confused when a comment starts after an operator.
+[clike mode](https://codemirror.net/mode/clike/index.html): No longer gets confused when a comment starts after an operator.
 
-[markdown mode](http://codemirror.net/mode/markdown/index.html): Now supports CommonMark-style flexible list indentation.
+[markdown mode](https://codemirror.net/mode/markdown/index.html): Now supports CommonMark-style flexible list indentation.
 
-[dylan mode](http://codemirror.net/mode/dylan/index.html): Several improvements and fixes.
+[dylan mode](https://codemirror.net/mode/dylan/index.html): Several improvements and fixes.
 
 ## 5.12.0 (2016-02-19)
 
 ### New features
 
-[Vim bindings](http://codemirror.net/demo/vim.html): Ctrl-Q is now an alias for Ctrl-V.
+[Vim bindings](https://codemirror.net/demo/vim.html): Ctrl-Q is now an alias for Ctrl-V.
 
-[Vim bindings](http://codemirror.net/demo/vim.html): The Vim API now exposes an `unmap` method to unmap bindings.
+[Vim bindings](https://codemirror.net/demo/vim.html): The Vim API now exposes an `unmap` method to unmap bindings.
 
-[active-line addon](http://codemirror.net/demo/activeline.html): This addon can now style the active line's gutter.
+[active-line addon](https://codemirror.net/demo/activeline.html): This addon can now style the active line's gutter.
 
-[FCL mode](http://codemirror.net/mode/fcl/): Newly added.
+[FCL mode](https://codemirror.net/mode/fcl/): Newly added.
 
-[SQL mode](http://codemirror.net/mode/sql/): Now has a Postgresql dialect.
+[SQL mode](https://codemirror.net/mode/sql/): Now has a Postgresql dialect.
 
 ### Bugfixes
 
@@ -682,147 +800,147 @@ Solve a [problem](https://github.com/codemirror/CodeMirror/issues/3821) where th
 
 Fix a [bug](https://github.com/codemirror/CodeMirror/issues/3834) that caused phantom scroll space under the text in some situations.
 
-[Sublime Text bindings](http://codemirror.net/demo/sublime.html): Bind delete-line to Shift-Ctrl-K on OS X.
+[Sublime Text bindings](https://codemirror.net/demo/sublime.html): Bind delete-line to Shift-Ctrl-K on OS X.
 
-[Markdown mode](http://codemirror.net/mode/markdown/): Fix [issue](https://github.com/codemirror/CodeMirror/issues/3787) where the mode would keep state related to fenced code blocks in an unsafe way, leading to occasional corrupted parses.
+[Markdown mode](https://codemirror.net/mode/markdown/): Fix [issue](https://github.com/codemirror/CodeMirror/issues/3787) where the mode would keep state related to fenced code blocks in an unsafe way, leading to occasional corrupted parses.
 
-[Markdown mode](http://codemirror.net/mode/markdown/): Ignore backslashes in code fragments.
+[Markdown mode](https://codemirror.net/mode/markdown/): Ignore backslashes in code fragments.
 
-[Markdown mode](http://codemirror.net/mode/markdown/): Use whichever mode is registered as `text/html` to parse HTML.
+[Markdown mode](https://codemirror.net/mode/markdown/): Use whichever mode is registered as `text/html` to parse HTML.
 
-[Clike mode](http://codemirror.net/mode/clike/): Improve indentation of Scala `=>` functions.
+[Clike mode](https://codemirror.net/mode/clike/): Improve indentation of Scala `=>` functions.
 
-[Python mode](http://codemirror.net/mode/python/): Improve indentation of bracketed code.
+[Python mode](https://codemirror.net/mode/python/): Improve indentation of bracketed code.
 
-[HTMLMixed mode](http://codemirror.net/mode/htmlmixed/): Support multi-line opening tags for sub-languages (`<script>`, `<style>`, etc).
+[HTMLMixed mode](https://codemirror.net/mode/htmlmixed/): Support multi-line opening tags for sub-languages (`<script>`, `<style>`, etc).
 
-[Spreadsheet mode](http://codemirror.net/mode/spreadsheet/): Fix bug where the mode did not advance the stream when finding a backslash.
+[Spreadsheet mode](https://codemirror.net/mode/spreadsheet/): Fix bug where the mode did not advance the stream when finding a backslash.
 
-[XML mode](http://codemirror.net/mode/xml/): The mode now takes a `matchClosing` option to configure whether mismatched closing tags should be highlighted as errors.
+[XML mode](https://codemirror.net/mode/xml/): The mode now takes a `matchClosing` option to configure whether mismatched closing tags should be highlighted as errors.
 
 ## 5.11.0 (2016-01-20)
 
-* New modes: [JSX](http://codemirror.net/mode/jsx/index.html), [literate Haskell](http://codemirror.net/mode/haskell-literate/index.html)
-* The editor now forwards more [DOM events](http://codemirror.net/doc/manual.html#event_dom): `cut`, `copy`, `paste`, and `touchstart`. It will also forward `mousedown` for drag events
+* New modes: [JSX](https://codemirror.net/mode/jsx/index.html), [literate Haskell](https://codemirror.net/mode/haskell-literate/index.html)
+* The editor now forwards more [DOM events](https://codemirror.net/doc/manual.html#event_dom): `cut`, `copy`, `paste`, and `touchstart`. It will also forward `mousedown` for drag events
 * Fixes a bug where bookmarks next to collapsed spans were not rendered
-* The [Swift](http://codemirror.net/mode/swift/index.html) mode now supports auto-indentation
-* Frontmatters in the [YAML frontmatter](http://codemirror.net/mode/yaml-frontmatter/index.html) mode are now optional as intended
+* The [Swift](https://codemirror.net/mode/swift/index.html) mode now supports auto-indentation
+* Frontmatters in the [YAML frontmatter](https://codemirror.net/mode/yaml-frontmatter/index.html) mode are now optional as intended
 
 ## 5.10.0 (2015-12-21)
 
-* Modify the way [atomic ranges](http://codemirror.net/doc/manual.html#mark_atomic) are skipped by selection to try and make it less surprising.
-* The [Swift mode](http://codemirror.net/mode/swift/index.html) was rewritten.
-* New addon: [jump-to-line](http://codemirror.net/doc/manual.html#addon_jump-to-line).
-* New method: [`isReadOnly`](http://codemirror.net/doc/manual.html#isReadOnly).
-* The [show-hint addon](http://codemirror.net/doc/manual.html#addon_show-hint) now defaults to picking completions on single click.
-* The object passed to [`"beforeSelectionChange"`](http://codemirror.net/doc/manual.html#event_beforeSelectionChange) events now has an `origin` property.
-* New mode: [Crystal](http://codemirror.net/mode/crystal/index.html).
+* Modify the way [atomic ranges](https://codemirror.net/doc/manual.html#mark_atomic) are skipped by selection to try and make it less surprising.
+* The [Swift mode](https://codemirror.net/mode/swift/index.html) was rewritten.
+* New addon: [jump-to-line](https://codemirror.net/doc/manual.html#addon_jump-to-line).
+* New method: [`isReadOnly`](https://codemirror.net/doc/manual.html#isReadOnly).
+* The [show-hint addon](https://codemirror.net/doc/manual.html#addon_show-hint) now defaults to picking completions on single click.
+* The object passed to [`"beforeSelectionChange"`](https://codemirror.net/doc/manual.html#event_beforeSelectionChange) events now has an `origin` property.
+* New mode: [Crystal](https://codemirror.net/mode/crystal/index.html).
 
 ## 5.9.0 (2015-11-23)
 
 * Improve the way overlay (OS X-style) scrollbars are handled
-* Make [annotatescrollbar](http://codemirror.net/doc/manual.html#addon_annotatescrollbar) and scrollpastend addons work properly together
-* Make [show-hint](http://codemirror.net/doc/manual.html#addon_show-hint) addon select options on single click by default, move selection to hovered item
+* Make [annotatescrollbar](https://codemirror.net/doc/manual.html#addon_annotatescrollbar) and scrollpastend addons work properly together
+* Make [show-hint](https://codemirror.net/doc/manual.html#addon_show-hint) addon select options on single click by default, move selection to hovered item
 * Properly fold comments that include block-comment-start markers
 * Many small language mode fixes
 
 ## 5.8.0 (2015-10-20)
 
-* Fixes an infinite loop in the [hardwrap addon](http://codemirror.net/doc/manual.html#addon_hardwrap)
-* New modes: [NSIS](http://codemirror.net/mode/nsis/index.html), [Ceylon](http://codemirror.net/mode/clike/index.html)
-* The Kotlin mode is now a [clike](http://codemirror.net/mode/clike/index.html) dialect, rather than a stand-alone mode
-* New option: [`allowDropFileTypes`](http://codemirror.net/doc/manual.html#option_allowDropFileTypes). Binary files can no longer be dropped into CodeMirror
-* New themes: [bespin](http://codemirror.net/demo/theme.html#bespin), [hopscotch](http://codemirror.net/demo/theme.html#hopscotch), [isotope](http://codemirror.net/demo/theme.html#isotope), [railscasts](http://codemirror.net/demo/theme.html#railscasts)
+* Fixes an infinite loop in the [hardwrap addon](https://codemirror.net/doc/manual.html#addon_hardwrap)
+* New modes: [NSIS](https://codemirror.net/mode/nsis/index.html), [Ceylon](https://codemirror.net/mode/clike/index.html)
+* The Kotlin mode is now a [clike](https://codemirror.net/mode/clike/index.html) dialect, rather than a stand-alone mode
+* New option: [`allowDropFileTypes`](https://codemirror.net/doc/manual.html#option_allowDropFileTypes). Binary files can no longer be dropped into CodeMirror
+* New themes: [bespin](https://codemirror.net/demo/theme.html#bespin), [hopscotch](https://codemirror.net/demo/theme.html#hopscotch), [isotope](https://codemirror.net/demo/theme.html#isotope), [railscasts](https://codemirror.net/demo/theme.html#railscasts)
 
 ## 5.7.0 (2015-09-21)
 
-* New modes: [Vue](http://codemirror.net/mode/vue/index.html), [Oz](http://codemirror.net/mode/oz/index.html), [MscGen](http://codemirror.net/mode/mscgen/index.html) (and dialects), [Closure Stylesheets](http://codemirror.net/mode/css/gss.html)
-* Implement [CommonMark](http://commonmark.org)-style flexible list indent and cross-line code spans in [Markdown](http://codemirror.net/mode/markdown/index.html) mode
-* Add a replace-all button to the [search addon](http://codemirror.net/doc/manual.html#addon_search), and make the persistent search dialog transparent when it obscures the match
-* Handle `acync`/`await` and ocal and binary numbers in [JavaScript mode](http://codemirror.net/mode/javascript/index.html)
-* Fix various issues with the [Haxe mode](http://codemirror.net/mode/haxe/index.html)
-* Make the [closebrackets addon](http://codemirror.net/doc/manual.html#addon_closebrackets) select only the wrapped text when wrapping selection in brackets
-* Tokenize properties as properties in the [CoffeeScript mode](http://codemirror.net/mode/coffeescript/index.html)
-* The [placeholder addon](http://codemirror.net/doc/manual.html#addon_placeholder) now accepts a DOM node as well as a string placeholder
+* New modes: [Vue](https://codemirror.net/mode/vue/index.html), [Oz](https://codemirror.net/mode/oz/index.html), [MscGen](https://codemirror.net/mode/mscgen/index.html) (and dialects), [Closure Stylesheets](https://codemirror.net/mode/css/gss.html)
+* Implement [CommonMark](http://commonmark.org)-style flexible list indent and cross-line code spans in [Markdown](https://codemirror.net/mode/markdown/index.html) mode
+* Add a replace-all button to the [search addon](https://codemirror.net/doc/manual.html#addon_search), and make the persistent search dialog transparent when it obscures the match
+* Handle `acync`/`await` and ocal and binary numbers in [JavaScript mode](https://codemirror.net/mode/javascript/index.html)
+* Fix various issues with the [Haxe mode](https://codemirror.net/mode/haxe/index.html)
+* Make the [closebrackets addon](https://codemirror.net/doc/manual.html#addon_closebrackets) select only the wrapped text when wrapping selection in brackets
+* Tokenize properties as properties in the [CoffeeScript mode](https://codemirror.net/mode/coffeescript/index.html)
+* The [placeholder addon](https://codemirror.net/doc/manual.html#addon_placeholder) now accepts a DOM node as well as a string placeholder
 
 ## 5.6.0 (2015-08-20)
 
 * Fix bug where you could paste into a `readOnly` editor
 * Show a cursor at the drop location when dragging over the editor
-* The [Rust mode](http://codemirror.net/mode/rust/index.html) was rewritten to handle modern Rust
+* The [Rust mode](https://codemirror.net/mode/rust/index.html) was rewritten to handle modern Rust
 * The editor and theme CSS was cleaned up. Some selectors are now less specific than before
-* New theme: [abcdef](http://codemirror.net/demo/theme.html#abcdef)
-* Lines longer than [`maxHighlightLength`](http://codemirror.net/doc/manual.html#option_maxHighlightLength) are now less likely to mess up indentation
-* New addons: [`autorefresh`](http://codemirror.net/doc/manual.html#addon_autorefresh) for refreshing an editor the first time it becomes visible, and `html-lint` for using [HTMLHint](http://htmlhint.com/)
-* The [`search`](http://codemirror.net/doc/manual.html#addon_search) addon now recognizes `\r` and `\n` in pattern and replacement input
+* New theme: [abcdef](https://codemirror.net/demo/theme.html#abcdef)
+* Lines longer than [`maxHighlightLength`](https://codemirror.net/doc/manual.html#option_maxHighlightLength) are now less likely to mess up indentation
+* New addons: [`autorefresh`](https://codemirror.net/doc/manual.html#addon_autorefresh) for refreshing an editor the first time it becomes visible, and `html-lint` for using [HTMLHint](http://htmlhint.com/)
+* The [`search`](https://codemirror.net/doc/manual.html#addon_search) addon now recognizes `\r` and `\n` in pattern and replacement input
 
 ## 5.5.0 (2015-07-20)
 
-*   New option: [`lineSeparator`](http://codemirror.net/doc/manual.html#option_lineSeparator) (with corresponding [method](http://codemirror.net/doc/manual.html#lineSeparator))
-*   New themes: [dracula](http://codemirror.net/demo/theme.html#dracula), [seti](http://codemirror.net/demo/theme.html#seti), [yeti](http://codemirror.net/demo/theme.html#yeti), [material](http://codemirror.net/demo/theme.html#material), and [icecoder](http://codemirror.net/demo/theme.html#icecoder)
-*   New modes: [Brainfuck](http://codemirror.net/mode/brainfuck/index.html), [VHDL](http://codemirror.net/mode/vhdl/index.html), Squirrel ([clike](http://codemirror.net/mode/clike/index.html) dialect)
-*   Define a `findPersistent` command in the [search](http://codemirror.net/demo/search.html) addon, for a dialog that stays open as you cycle through matches
+*   New option: [`lineSeparator`](https://codemirror.net/doc/manual.html#option_lineSeparator) (with corresponding [method](https://codemirror.net/doc/manual.html#lineSeparator))
+*   New themes: [dracula](https://codemirror.net/demo/theme.html#dracula), [seti](https://codemirror.net/demo/theme.html#seti), [yeti](https://codemirror.net/demo/theme.html#yeti), [material](https://codemirror.net/demo/theme.html#material), and [icecoder](https://codemirror.net/demo/theme.html#icecoder)
+*   New modes: [Brainfuck](https://codemirror.net/mode/brainfuck/index.html), [VHDL](https://codemirror.net/mode/vhdl/index.html), Squirrel ([clike](https://codemirror.net/mode/clike/index.html) dialect)
+*   Define a `findPersistent` command in the [search](https://codemirror.net/demo/search.html) addon, for a dialog that stays open as you cycle through matches
 *   From this release on, the NPM module doesn't include documentation and demos
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/5.4.0...5.5.0)
 
 ## 5.4.0 (2015-06-25)
 
-*   New modes: [Twig](http://codemirror.net/mode/twig/index.html), [Elm](http://codemirror.net/mode/elm/index.html), [Factor](http://codemirror.net/mode/factor/index.html), [Swift](http://codemirror.net/mode/swift/index.html)
+*   New modes: [Twig](https://codemirror.net/mode/twig/index.html), [Elm](https://codemirror.net/mode/elm/index.html), [Factor](https://codemirror.net/mode/factor/index.html), [Swift](https://codemirror.net/mode/swift/index.html)
 *   Prefer clipboard API (if available) when pasting
-*   Refined definition highlighting in [clike](http://codemirror.net/mode/clike/index.html) mode
+*   Refined definition highlighting in [clike](https://codemirror.net/mode/clike/index.html) mode
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/5.3.0...5.4.0)
 
 ## 5.3.0 (2015-05-20)
 
-*   Fix several regressions in the [`show-hint`](http://codemirror.net/doc/manual.html#addon_show-hint) addon (`completeSingle` option, `"shown"` and `"close"` events)
-*   The [vim mode](http://codemirror.net/demo/vim.html) API was [documented](http://codemirror.net/doc/manual.html#vimapi)
-*   New modes: [ASN.1](http://codemirror.net/mode/asn.1/index.html), [TTCN](http://codemirror.net/mode/ttcn/index.html), and [TTCN-CFG](http://codemirror.net/mode/ttcn-cfg/index.html)
-*   The [clike](http://codemirror.net/mode/clike/index.html) mode can now deep-indent `switch` statements, and roughly recognizes types and defined identifiers
+*   Fix several regressions in the [`show-hint`](https://codemirror.net/doc/manual.html#addon_show-hint) addon (`completeSingle` option, `"shown"` and `"close"` events)
+*   The [vim mode](https://codemirror.net/demo/vim.html) API was [documented](https://codemirror.net/doc/manual.html#vimapi)
+*   New modes: [ASN.1](https://codemirror.net/mode/asn.1/index.html), [TTCN](https://codemirror.net/mode/ttcn/index.html), and [TTCN-CFG](https://codemirror.net/mode/ttcn-cfg/index.html)
+*   The [clike](https://codemirror.net/mode/clike/index.html) mode can now deep-indent `switch` statements, and roughly recognizes types and defined identifiers
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/5.2.0...5.3.0)
 
 ## 5.2.0 (2015-04-20)
 
-*   Fix several race conditions in [`show-hint`](http://codemirror.net/doc/manual.html#addon_show-hint)'s asynchronous mode
-*   Fix backspace binding in [Sublime bindings](http://codemirror.net/demo/sublime.html)
-*   Change the way IME is handled in the `"textarea"` [input style](http://codemirror.net/doc/manual.html#option_inputStyle)
-*   New modes: [MUMPS](http://codemirror.net/mode/mumps/index.html), [Handlebars](http://codemirror.net/mode/handlebars/index.html)
-*   Rewritten modes: [Django](http://codemirror.net/mode/django/index.html), [Z80](http://codemirror.net/mode/z80/index.html)
-*   New theme: [Liquibyte](http://codemirror.net/demo/theme.html#liquibyte)
-*   New option: [`lineWiseCopyCut`](http://codemirror.net/doc/manual.html#option_lineWiseCopyCut)
-*   The [Vim mode](http://codemirror.net/demo/vim.html) now supports buffer-local options and the `filetype` setting
+*   Fix several race conditions in [`show-hint`](https://codemirror.net/doc/manual.html#addon_show-hint)'s asynchronous mode
+*   Fix backspace binding in [Sublime bindings](https://codemirror.net/demo/sublime.html)
+*   Change the way IME is handled in the `"textarea"` [input style](https://codemirror.net/doc/manual.html#option_inputStyle)
+*   New modes: [MUMPS](https://codemirror.net/mode/mumps/index.html), [Handlebars](https://codemirror.net/mode/handlebars/index.html)
+*   Rewritten modes: [Django](https://codemirror.net/mode/django/index.html), [Z80](https://codemirror.net/mode/z80/index.html)
+*   New theme: [Liquibyte](https://codemirror.net/demo/theme.html#liquibyte)
+*   New option: [`lineWiseCopyCut`](https://codemirror.net/doc/manual.html#option_lineWiseCopyCut)
+*   The [Vim mode](https://codemirror.net/demo/vim.html) now supports buffer-local options and the `filetype` setting
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/5.1.0...5.2.0)
 
 ## 5.1.0 (2015-03-23)
 
-*   New modes: [ASCII armor](http://codemirror.net/mode/asciiarmor/index.html) (PGP data), [Troff](http://codemirror.net/mode/troff/index.html), and [CMake](http://codemirror.net/mode/cmake/index.html).
-*   Remove SmartyMixed mode, rewrite [Smarty](http://codemirror.net/mode/smarty/index.html) mode to supersede it.
-*   New commands in the [merge addon](http://codemirror.net/doc/manual.html#addon_merge): `goNextDiff` and `goPrevDiff`.
-*   The [closebrackets addon](http://codemirror.net/doc/manual.html#addon_closebrackets) can now be configured per mode.
+*   New modes: [ASCII armor](https://codemirror.net/mode/asciiarmor/index.html) (PGP data), [Troff](https://codemirror.net/mode/troff/index.html), and [CMake](https://codemirror.net/mode/cmake/index.html).
+*   Remove SmartyMixed mode, rewrite [Smarty](https://codemirror.net/mode/smarty/index.html) mode to supersede it.
+*   New commands in the [merge addon](https://codemirror.net/doc/manual.html#addon_merge): `goNextDiff` and `goPrevDiff`.
+*   The [closebrackets addon](https://codemirror.net/doc/manual.html#addon_closebrackets) can now be configured per mode.
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/5.0.0...5.1.0).
 
 ## 5.0.0 (2015-02-20)
 
 *   Experimental mobile support (tested on iOS, Android Chrome, stock Android browser)
-*   New option [`inputStyle`](http://codemirror.net/doc/manual.html#option_inputStyle) to switch between hidden textarea and contenteditable input.
-*   The [`getInputField`](http://codemirror.net/doc/manual.html#getInputField) method is no longer guaranteed to return a textarea.
+*   New option [`inputStyle`](https://codemirror.net/doc/manual.html#option_inputStyle) to switch between hidden textarea and contenteditable input.
+*   The [`getInputField`](https://codemirror.net/doc/manual.html#getInputField) method is no longer guaranteed to return a textarea.
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.13.0...5.0.0).
 
 ## 4.13.0 (2015-02-20)
 
-*   Fix the way the [`closetag`](http://codemirror.net/demo/closetag.html) demo handles the slash character.
-*   New modes: [Forth](http://codemirror.net/mode/forth/index.html), [Stylus](http://codemirror.net/mode/stylus/index.html).
-*   Make the [CSS mode](http://codemirror.net/mode/css/index.html) understand some modern CSS extensions.
-*   Have the [Scala mode](http://codemirror.net/mode/clike/index.html) handle symbols and triple-quoted strings.
+*   Fix the way the [`closetag`](https://codemirror.net/demo/closetag.html) demo handles the slash character.
+*   New modes: [Forth](https://codemirror.net/mode/forth/index.html), [Stylus](https://codemirror.net/mode/stylus/index.html).
+*   Make the [CSS mode](https://codemirror.net/mode/css/index.html) understand some modern CSS extensions.
+*   Have the [Scala mode](https://codemirror.net/mode/clike/index.html) handle symbols and triple-quoted strings.
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.12.0...4.13.0).
 
 ## 4.12.0 (2015-01-22)
 
-*   The [`closetag`](http://codemirror.net/doc/manual.html#addon_closetag) addon now defines a `"closeTag"` command.
-*   Adds a `findModeByFileName` to the [mode metadata](http://codemirror.net/doc/manual.html#addon_meta) addon.
-*   [Simple mode](http://codemirror.net/demo/simplemode.html) rules can now contain a `sol` property to only match at the start of a line.
-*   New addon: [`selection-pointer`](http://codemirror.net/doc/manual.html#addon_selection-pointer) to style the mouse cursor over the selection.
-*   Improvements to the [Sass mode](http://codemirror.net/mode/sass/index.html)'s indentation.
-*   The [Vim keymap](http://codemirror.net/demo/vim.html)'s search functionality now supports [scrollbar annotation](http://codemirror.net/doc/manual.html#addon_matchesonscrollbar).
+*   The [`closetag`](https://codemirror.net/doc/manual.html#addon_closetag) addon now defines a `"closeTag"` command.
+*   Adds a `findModeByFileName` to the [mode metadata](https://codemirror.net/doc/manual.html#addon_meta) addon.
+*   [Simple mode](https://codemirror.net/demo/simplemode.html) rules can now contain a `sol` property to only match at the start of a line.
+*   New addon: [`selection-pointer`](https://codemirror.net/doc/manual.html#addon_selection-pointer) to style the mouse cursor over the selection.
+*   Improvements to the [Sass mode](https://codemirror.net/mode/sass/index.html)'s indentation.
+*   The [Vim keymap](https://codemirror.net/demo/vim.html)'s search functionality now supports [scrollbar annotation](https://codemirror.net/doc/manual.html#addon_matchesonscrollbar).
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.11.0...4.12.0).
 
 ## 4.11.0 (2015-01-09)
@@ -835,65 +953,65 @@ Emergency single-patch update to 4.9\. Fixes Firefox-specific problem where the
 
 ## 4.9.0 (2014-12-23)
 
-*   Overhauled scroll bar handling. Add pluggable [scrollbar implementations](http://codemirror.net/demo/simplescrollbars.html).
-*   Tweaked behavior for the [completion addons](http://codemirror.net/doc/manual.html#addon_show-hint) to not take text after cursor into account.
-*   Two new optional features in the [merge addon](http://codemirror.net/doc/manual.html#addon_merge): aligning editors, and folding unchanged text.
-*   New modes: [Dart](http://codemirror.net/mode/dart/index.html), [EBNF](http://codemirror.net/mode/ebnf/index.html), [spreadsheet](http://codemirror.net/mode/spreadsheet/index.html), and [Soy](http://codemirror.net/mode/soy/index.html).
-*   New [addon](http://codemirror.net/demo/panel.html) to show persistent panels below/above an editor.
-*   New themes: [zenburn](http://codemirror.net/demo/theme.html#zenburn) and [tomorrow night bright](http://codemirror.net/demo/theme.html#tomorrow-night-bright).
+*   Overhauled scroll bar handling. Add pluggable [scrollbar implementations](https://codemirror.net/demo/simplescrollbars.html).
+*   Tweaked behavior for the [completion addons](https://codemirror.net/doc/manual.html#addon_show-hint) to not take text after cursor into account.
+*   Two new optional features in the [merge addon](https://codemirror.net/doc/manual.html#addon_merge): aligning editors, and folding unchanged text.
+*   New modes: [Dart](https://codemirror.net/mode/dart/index.html), [EBNF](https://codemirror.net/mode/ebnf/index.html), [spreadsheet](https://codemirror.net/mode/spreadsheet/index.html), and [Soy](https://codemirror.net/mode/soy/index.html).
+*   New [addon](https://codemirror.net/demo/panel.html) to show persistent panels below/above an editor.
+*   New themes: [zenburn](https://codemirror.net/demo/theme.html#zenburn) and [tomorrow night bright](https://codemirror.net/demo/theme.html#tomorrow-night-bright).
 *   Allow ctrl-click to clear existing cursors.
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.8.0...4.9.0).
 
 ## 4.8.0 (2014-11-22)
 
-*   Built-in support for [multi-stroke key bindings](http://codemirror.net/doc/manual.html#normalizeKeyMap).
-*   New method: [`getLineTokens`](http://codemirror.net/doc/manual.html#getLineTokens).
-*   New modes: [dockerfile](http://codemirror.net/mode/dockerfile/index.html), [IDL](http://codemirror.net/mode/idl/index.html), [Objective C](http://codemirror.net/mode/clike/index.html) (crude).
-*   Support styling of gutter backgrounds, allow `"gutter"` styles in [`addLineClass`](http://codemirror.net/doc/manual.html#addLineClass).
-*   Many improvements to the [Vim mode](http://codemirror.net/demo/vim.html), rewritten visual mode.
-*   Improvements to modes: [gfm](http://codemirror.net/mode/gfm/index.html) (strikethrough), [SPARQL](http://codemirror.net/mode/sparql/index.html) (version 1.1 support), and [sTeX](http://codemirror.net/mode/stex/index.html) (no more runaway math mode).
+*   Built-in support for [multi-stroke key bindings](https://codemirror.net/doc/manual.html#normalizeKeyMap).
+*   New method: [`getLineTokens`](https://codemirror.net/doc/manual.html#getLineTokens).
+*   New modes: [dockerfile](https://codemirror.net/mode/dockerfile/index.html), [IDL](https://codemirror.net/mode/idl/index.html), [Objective C](https://codemirror.net/mode/clike/index.html) (crude).
+*   Support styling of gutter backgrounds, allow `"gutter"` styles in [`addLineClass`](https://codemirror.net/doc/manual.html#addLineClass).
+*   Many improvements to the [Vim mode](https://codemirror.net/demo/vim.html), rewritten visual mode.
+*   Improvements to modes: [gfm](https://codemirror.net/mode/gfm/index.html) (strikethrough), [SPARQL](https://codemirror.net/mode/sparql/index.html) (version 1.1 support), and [sTeX](https://codemirror.net/mode/stex/index.html) (no more runaway math mode).
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.7.0...4.8.0).
 
 ## 4.7.0 (2014-10-20)
 
-*   **Incompatible**: The [lint addon](http://codemirror.net/demo/lint.html) now passes the editor's value as first argument to asynchronous lint functions, for consistency. The editor is still passed, as fourth argument.
+*   **Incompatible**: The [lint addon](https://codemirror.net/demo/lint.html) now passes the editor's value as first argument to asynchronous lint functions, for consistency. The editor is still passed, as fourth argument.
 *   Improved handling of unicode identifiers in modes for languages that support them.
-*   More mode improvements: [CoffeeScript](http://codemirror.net/mode/coffeescript/index.html) (indentation), [Verilog](http://codemirror.net/mode/verilog/index.html) (indentation), [Scala](http://codemirror.net/mode/clike/index.html) (indentation, triple-quoted strings), and [PHP](http://codemirror.net/mode/php/index.html) (interpolated variables in heredoc strings).
-*   New modes: [Textile](http://codemirror.net/mode/textile/index.html) and [Tornado templates](http://codemirror.net/mode/tornado/index.html).
-*   Experimental new [way to define modes](http://codemirror.net/demo/simplemode.html).
-*   Improvements to the [Vim bindings](http://codemirror.net/demo/vim.html): Arbitrary insert mode key mappings are now possible, and text objects are supported in visual mode.
-*   The mode [meta-information file](http://codemirror.net/mode/meta.js) now includes information about file extensions, and [helper functions](http://codemirror.net/doc/manual.html#addon_meta) `findModeByMIME` and `findModeByExtension`.
+*   More mode improvements: [CoffeeScript](https://codemirror.net/mode/coffeescript/index.html) (indentation), [Verilog](https://codemirror.net/mode/verilog/index.html) (indentation), [Scala](https://codemirror.net/mode/clike/index.html) (indentation, triple-quoted strings), and [PHP](https://codemirror.net/mode/php/index.html) (interpolated variables in heredoc strings).
+*   New modes: [Textile](https://codemirror.net/mode/textile/index.html) and [Tornado templates](https://codemirror.net/mode/tornado/index.html).
+*   Experimental new [way to define modes](https://codemirror.net/demo/simplemode.html).
+*   Improvements to the [Vim bindings](https://codemirror.net/demo/vim.html): Arbitrary insert mode key mappings are now possible, and text objects are supported in visual mode.
+*   The mode [meta-information file](https://codemirror.net/mode/meta.js) now includes information about file extensions, and [helper functions](https://codemirror.net/doc/manual.html#addon_meta) `findModeByMIME` and `findModeByExtension`.
 *   New logo!
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.6.0...4.7.0).
 
 ## 4.6.0 (2014-09-19)
 
-*   New mode: [Modelica](http://codemirror.net/mode/modelica/index.html)
-*   New method: [`findWordAt`](http://codemirror.net/doc/manual.html#findWordAt)
-*   Make it easier to [use text background styling](http://codemirror.net/demo/markselection.html)
+*   New mode: [Modelica](https://codemirror.net/mode/modelica/index.html)
+*   New method: [`findWordAt`](https://codemirror.net/doc/manual.html#findWordAt)
+*   Make it easier to [use text background styling](https://codemirror.net/demo/markselection.html)
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.5.0...4.6.0).
 
 ## 4.5.0 (2014-08-21)
 
 *   Fix several serious bugs with horizontal scrolling
-*   New mode: [Slim](http://codemirror.net/mode/slim/index.html)
-*   New command: [`goLineLeftSmart`](http://codemirror.net/doc/manual.html#command_goLineLeftSmart)
-*   More fixes and extensions for the [Vim](http://codemirror.net/demo/vim.html) visual block mode
+*   New mode: [Slim](https://codemirror.net/mode/slim/index.html)
+*   New command: [`goLineLeftSmart`](https://codemirror.net/doc/manual.html#command_goLineLeftSmart)
+*   More fixes and extensions for the [Vim](https://codemirror.net/demo/vim.html) visual block mode
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.4.0...4.5.0).
 
 ## 4.4.0 (2014-07-21)
 
 *   **Note:** Some events might now fire in slightly different order (`"change"` is still guaranteed to fire before `"cursorActivity"`)
 *   Nested operations in multiple editors are now synced (complete at same time, reducing DOM reflows)
-*   Visual block mode for [vim](http://codemirror.net/demo/vim.html) (<C-v>) is nearly complete
-*   New mode: [Kotlin](http://codemirror.net/mode/kotlin/index.html)
+*   Visual block mode for [vim](https://codemirror.net/demo/vim.html) (<C-v>) is nearly complete
+*   New mode: [Kotlin](https://codemirror.net/mode/kotlin/index.html)
 *   Better multi-selection paste for text copied from multiple CodeMirror selections
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.3.0...4.4.0).
 
 ## 4.3.0 (2014-06-23)
 
-*   Several [vim bindings](http://codemirror.net/demo/vim.html) improvements: search and exCommand history, global flag for `:substitute`, `:global` command.
-*   Allow hiding the cursor by setting [`cursorBlinkRate`](http://codemirror.net/doc/manual.html#option_cursorBlinkRate) to a negative value.
+*   Several [vim bindings](https://codemirror.net/demo/vim.html) improvements: search and exCommand history, global flag for `:substitute`, `:global` command.
+*   Allow hiding the cursor by setting [`cursorBlinkRate`](https://codemirror.net/doc/manual.html#option_cursorBlinkRate) to a negative value.
 *   Make gutter markers themeable, use this in foldgutter.
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.2.0...4.3.0).
 
@@ -902,22 +1020,22 @@ Emergency single-patch update to 4.9\. Fixes Firefox-specific problem where the
 *   Fix problem where some modes were broken by the fact that empty tokens were forbidden.
 *   Several fixes to context menu handling.
 *   On undo, scroll _change_, not cursor, into view.
-*   Rewritten [Jade](http://codemirror.net/mode/jade/index.html) mode.
-*   Various improvements to [Shell](http://codemirror.net/mode/shell/index.html) (support for more syntax) and [Python](http://codemirror.net/mode/python/index.html) (better indentation) modes.
-*   New mode: [Cypher](http://codemirror.net/mode/cypher/index.html).
-*   New theme: [Neo](http://codemirror.net/demo/theme.html#neo).
-*   Support direct styling options (color, line style, width) in the [rulers](http://codemirror.net/doc/manual.html#addon_rulers) addon.
-*   Recognize per-editor configuration for the [show-hint](http://codemirror.net/doc/manual.html#addon_show-hint) and [foldcode](http://codemirror.net/doc/manual.html#addon_foldcode) addons.
-*   More intelligent scanning for existing close tags in [closetag](http://codemirror.net/doc/manual.html#addon_closetag) addon.
-*   In the [Vim bindings](http://codemirror.net/demo/vim.html): Fix bracket matching, support case conversion in visual mode, visual paste, append action.
+*   Rewritten [Jade](https://codemirror.net/mode/jade/index.html) mode.
+*   Various improvements to [Shell](https://codemirror.net/mode/shell/index.html) (support for more syntax) and [Python](https://codemirror.net/mode/python/index.html) (better indentation) modes.
+*   New mode: [Cypher](https://codemirror.net/mode/cypher/index.html).
+*   New theme: [Neo](https://codemirror.net/demo/theme.html#neo).
+*   Support direct styling options (color, line style, width) in the [rulers](https://codemirror.net/doc/manual.html#addon_rulers) addon.
+*   Recognize per-editor configuration for the [show-hint](https://codemirror.net/doc/manual.html#addon_show-hint) and [foldcode](https://codemirror.net/doc/manual.html#addon_foldcode) addons.
+*   More intelligent scanning for existing close tags in [closetag](https://codemirror.net/doc/manual.html#addon_closetag) addon.
+*   In the [Vim bindings](https://codemirror.net/demo/vim.html): Fix bracket matching, support case conversion in visual mode, visual paste, append action.
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.1.0...4.2.0).
 
 ## 4.1.0 (2014-04-22)
 
-*   _Slightly incompatible_: The [`"cursorActivity"`](http://codemirror.net/doc/manual.html#event_cursorActivity) event now fires after all other events for the operation (and only for handlers that were actually registered at the time the activity happened).
-*   New command: [`insertSoftTab`](http://codemirror.net/doc/manual.html#command_insertSoftTab).
-*   New mode: [Django](http://codemirror.net/mode/django/index.html).
-*   Improved modes: [Verilog](http://codemirror.net/mode/verilog/index.html) (rewritten), [Jinja2](http://codemirror.net/mode/jinja2/index.html), [Haxe](http://codemirror.net/mode/haxe/index.html), [PHP](http://codemirror.net/mode/php/index.html) (string interpolation highlighted), [JavaScript](http://codemirror.net/mode/javascript/index.html) (indentation of trailing else, template strings), [LiveScript](http://codemirror.net/mode/livescript/index.html) (multi-line strings).
+*   _Slightly incompatible_: The [`"cursorActivity"`](https://codemirror.net/doc/manual.html#event_cursorActivity) event now fires after all other events for the operation (and only for handlers that were actually registered at the time the activity happened).
+*   New command: [`insertSoftTab`](https://codemirror.net/doc/manual.html#command_insertSoftTab).
+*   New mode: [Django](https://codemirror.net/mode/django/index.html).
+*   Improved modes: [Verilog](https://codemirror.net/mode/verilog/index.html) (rewritten), [Jinja2](https://codemirror.net/mode/jinja2/index.html), [Haxe](https://codemirror.net/mode/haxe/index.html), [PHP](https://codemirror.net/mode/php/index.html) (string interpolation highlighted), [JavaScript](https://codemirror.net/mode/javascript/index.html) (indentation of trailing else, template strings), [LiveScript](https://codemirror.net/mode/livescript/index.html) (multi-line strings).
 *   Many small issues from the 3.x→4.x transition were found and fixed.
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.0.3...4.1.0).
 
@@ -927,45 +1045,45 @@ Merges the improvements from 4.1 that could easily be applied to the 3.x code. A
 
 ## 3.23.0 (2014-03-20)
 
-*   In the [XML mode](http://codemirror.net/mode/xml/index.html), add `brackets` style to angle brackets, fix case-sensitivity of tags for HTML.
-*   New mode: [Dylan](http://codemirror.net/mode/dylan/index.html).
-*   Many improvements to the [Vim bindings](http://codemirror.net/demo/vim.html).
+*   In the [XML mode](https://codemirror.net/mode/xml/index.html), add `brackets` style to angle brackets, fix case-sensitivity of tags for HTML.
+*   New mode: [Dylan](https://codemirror.net/mode/dylan/index.html).
+*   Many improvements to the [Vim bindings](https://codemirror.net/demo/vim.html).
 
 ## 3.22.0 (2014-02-21)
 
-*   Adds the [`findMarks`](http://codemirror.net/doc/manual.html#findMarks) method.
-*   New addons: [rulers](http://codemirror.net/doc/manual.html#addon_rulers), markdown-fold, yaml-lint.
-*   New theme: [mdn-like](http://codemirror.net/demo/theme.html#mdn-like).
-*   New mode: [Solr](http://codemirror.net/mode/solr/index.html).
+*   Adds the [`findMarks`](https://codemirror.net/doc/manual.html#findMarks) method.
+*   New addons: [rulers](https://codemirror.net/doc/manual.html#addon_rulers), markdown-fold, yaml-lint.
+*   New theme: [mdn-like](https://codemirror.net/demo/theme.html#mdn-like).
+*   New mode: [Solr](https://codemirror.net/mode/solr/index.html).
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.21.0...3.22.0).
 
 ## 3.21.0 (2014-01-16)
 
 *   Auto-indenting a block will no longer add trailing whitespace to blank lines.
-*   Marking text has a new option [`clearWhenEmpty`](http://codemirror.net/doc/manual.html#markText) to control auto-removal.
+*   Marking text has a new option [`clearWhenEmpty`](https://codemirror.net/doc/manual.html#markText) to control auto-removal.
 *   Several bugfixes in the handling of bidirectional text.
-*   The [XML](http://codemirror.net/mode/xml/index.html) and [CSS](http://codemirror.net/mode/css/index.html) modes were largely rewritten. [LESS](http://codemirror.net/mode/css/less.html) support was added to the CSS mode.
-*   The OCaml mode was moved to an [mllike](http://codemirror.net/mode/mllike/index.html) mode, F# support added.
-*   Make it possible to fetch multiple applicable helper values with [`getHelpers`](http://codemirror.net/doc/manual.html#getHelpers), and to register helpers matched on predicates with [`registerGlobalHelper`](http://codemirror.net/doc/manual.html#registerGlobalHelper).
-*   New theme [pastel-on-dark](http://codemirror.net/demo/theme.html#pastel-on-dark).
-*   Better ECMAScript 6 support in [JavaScript](http://codemirror.net/mode/javascript/index.html) mode.
+*   The [XML](https://codemirror.net/mode/xml/index.html) and [CSS](https://codemirror.net/mode/css/index.html) modes were largely rewritten. [LESS](https://codemirror.net/mode/css/less.html) support was added to the CSS mode.
+*   The OCaml mode was moved to an [mllike](https://codemirror.net/mode/mllike/index.html) mode, F# support added.
+*   Make it possible to fetch multiple applicable helper values with [`getHelpers`](https://codemirror.net/doc/manual.html#getHelpers), and to register helpers matched on predicates with [`registerGlobalHelper`](https://codemirror.net/doc/manual.html#registerGlobalHelper).
+*   New theme [pastel-on-dark](https://codemirror.net/demo/theme.html#pastel-on-dark).
+*   Better ECMAScript 6 support in [JavaScript](https://codemirror.net/mode/javascript/index.html) mode.
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.20.0...3.21.0).
 
 ## 3.20.0 (2013-11-21)
 
-*   New modes: [Julia](http://codemirror.net/mode/julia/index.html) and [PEG.js](http://codemirror.net/mode/pegjs/index.html).
-*   Support ECMAScript 6 in the [JavaScript mode](http://codemirror.net/mode/javascript/index.html).
-*   Improved indentation for the [CoffeeScript mode](http://codemirror.net/mode/coffeescript/index.html).
-*   Make non-printable-character representation [configurable](http://codemirror.net/doc/manual.html#option_specialChars).
-*   Add ‘notification’ functionality to [dialog](http://codemirror.net/doc/manual.html#addon_dialog) addon.
+*   New modes: [Julia](https://codemirror.net/mode/julia/index.html) and [PEG.js](https://codemirror.net/mode/pegjs/index.html).
+*   Support ECMAScript 6 in the [JavaScript mode](https://codemirror.net/mode/javascript/index.html).
+*   Improved indentation for the [CoffeeScript mode](https://codemirror.net/mode/coffeescript/index.html).
+*   Make non-printable-character representation [configurable](https://codemirror.net/doc/manual.html#option_specialChars).
+*   Add ‘notification’ functionality to [dialog](https://codemirror.net/doc/manual.html#addon_dialog) addon.
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.19.0...3.20.0).
 
 ## 3.19.0 (2013-10-21)
 
-*   New modes: [Eiffel](http://codemirror.net/mode/eiffel/index.html), [Gherkin](http://codemirror.net/mode/gherkin/index.html), [MSSQL dialect](http://codemirror.net/mode/sql/?mime=text/x-mssql).
-*   New addons: [hardwrap](http://codemirror.net/doc/manual.html#addon_hardwrap), [sql-hint](http://codemirror.net/doc/manual.html#addon_sql-hint).
-*   New theme: [MBO](http://codemirror.net/demo/theme.html#mbo).
-*   Add [support](http://codemirror.net/doc/manual.html#token_style_line) for line-level styling from mode tokenizers.
+*   New modes: [Eiffel](https://codemirror.net/mode/eiffel/index.html), [Gherkin](https://codemirror.net/mode/gherkin/index.html), [MSSQL dialect](https://codemirror.net/mode/sql/?mime=text/x-mssql).
+*   New addons: [hardwrap](https://codemirror.net/doc/manual.html#addon_hardwrap), [sql-hint](https://codemirror.net/doc/manual.html#addon_sql-hint).
+*   New theme: [MBO](https://codemirror.net/demo/theme.html#mbo).
+*   Add [support](https://codemirror.net/doc/manual.html#token_style_line) for line-level styling from mode tokenizers.
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.18.0...3.19.0).
 
 ## 3.18.0 (2013-09-23)
@@ -974,70 +1092,70 @@ Emergency release to fix a problem in 3.17 where `.setOption("lineNumbers", fals
 
 ## 3.17.0 (2013-09-23)
 
-*   New modes: [Fortran](http://codemirror.net/mode/fortran/index.html), [Octave](http://codemirror.net/mode/octave/index.html) (Matlab), [TOML](http://codemirror.net/mode/toml/index.html), and [DTD](http://codemirror.net/mode/dtd/index.html).
-*   New addons: [`css-lint`](http://codemirror.net/addon/lint/css-lint.js), [`css-hint`](http://codemirror.net/doc/manual.html#addon_css-hint).
+*   New modes: [Fortran](https://codemirror.net/mode/fortran/index.html), [Octave](https://codemirror.net/mode/octave/index.html) (Matlab), [TOML](https://codemirror.net/mode/toml/index.html), and [DTD](https://codemirror.net/mode/dtd/index.html).
+*   New addons: [`css-lint`](https://codemirror.net/addon/lint/css-lint.js), [`css-hint`](https://codemirror.net/doc/manual.html#addon_css-hint).
 *   Improve resilience to CSS 'frameworks' that globally mess up `box-sizing`.
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.16.0...3.17.0).
 
 ## 3.16.0 (2013-08-21)
 
-*   The whole codebase is now under a single [license](http://codemirror.net/LICENSE) file.
+*   The whole codebase is now under a single [license](https://codemirror.net/LICENSE) file.
 *   The project page was overhauled and redesigned.
-*   New themes: [Paraiso](http://codemirror.net/demo/theme.html#paraiso-dark) ([light](http://codemirror.net/demo/theme.html#paraiso-light)), [The Matrix](http://codemirror.net/demo/theme.html#the-matrix).
-*   Improved interaction between themes and [active-line](http://codemirror.net/doc/manual.html#addon_active-line)/[matchbrackets](http://codemirror.net/doc/manual.html#addon_matchbrackets) addons.
-*   New [folding](http://codemirror.net/doc/manual.html#addon_foldcode) function `CodeMirror.fold.comment`.
-*   Added [fullscreen](http://codemirror.net/doc/manual.html#addon_fullscreen) addon.
+*   New themes: [Paraiso](https://codemirror.net/demo/theme.html#paraiso-dark) ([light](https://codemirror.net/demo/theme.html#paraiso-light)), [The Matrix](https://codemirror.net/demo/theme.html#the-matrix).
+*   Improved interaction between themes and [active-line](https://codemirror.net/doc/manual.html#addon_active-line)/[matchbrackets](https://codemirror.net/doc/manual.html#addon_matchbrackets) addons.
+*   New [folding](https://codemirror.net/doc/manual.html#addon_foldcode) function `CodeMirror.fold.comment`.
+*   Added [fullscreen](https://codemirror.net/doc/manual.html#addon_fullscreen) addon.
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.15.0...3.16.0).
 
 ## 3.15.0 (2013-07-29)
 
-*   New modes: [Jade](http://codemirror.net/mode/jade/index.html), [Nginx](http://codemirror.net/mode/nginx/index.html).
-*   New addons: [Tern](http://codemirror.net/demo/tern.html), [matchtags](http://codemirror.net/doc/manual.html#addon_matchtags), and [foldgutter](http://codemirror.net/doc/manual.html#addon_foldgutter).
-*   Introduced [_helper_](http://codemirror.net/doc/manual.html#getHelper) concept ([context](https://groups.google.com/forum/#!msg/codemirror/cOc0xvUUEUU/nLrX1-qnidgJ)).
-*   New method: [`getModeAt`](http://codemirror.net/doc/manual.html#getModeAt).
-*   New themes: base16 [dark](http://codemirror.net/demo/theme.html#base16-dark)/[light](http://codemirror.net/demo/theme.html#base16-light), 3024 [dark](http://codemirror.net/demo/theme.html#3024-night)/[light](http://codemirror.net/demo/theme.html#3024-day), [tomorrow-night](http://codemirror.net/demo/theme.html#tomorrow-night-eighties).
+*   New modes: [Jade](https://codemirror.net/mode/jade/index.html), [Nginx](https://codemirror.net/mode/nginx/index.html).
+*   New addons: [Tern](https://codemirror.net/demo/tern.html), [matchtags](https://codemirror.net/doc/manual.html#addon_matchtags), and [foldgutter](https://codemirror.net/doc/manual.html#addon_foldgutter).
+*   Introduced [_helper_](https://codemirror.net/doc/manual.html#getHelper) concept ([context](https://groups.google.com/forum/#!msg/codemirror/cOc0xvUUEUU/nLrX1-qnidgJ)).
+*   New method: [`getModeAt`](https://codemirror.net/doc/manual.html#getModeAt).
+*   New themes: base16 [dark](https://codemirror.net/demo/theme.html#base16-dark)/[light](https://codemirror.net/demo/theme.html#base16-light), 3024 [dark](https://codemirror.net/demo/theme.html#3024-night)/[light](https://codemirror.net/demo/theme.html#3024-day), [tomorrow-night](https://codemirror.net/demo/theme.html#tomorrow-night-eighties).
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.14.0...3.15.0).
 
 ## 3.14.0 (2013-06-20)
 
-*   New addons: [trailing space highlight](http://codemirror.net/doc/manual.html#addon_trailingspace), [XML completion](http://codemirror.net/doc/manual.html#addon_xml-hint) (rewritten), and [diff merging](http://codemirror.net/doc/manual.html#addon_merge).
-*   [`markText`](http://codemirror.net/doc/manual.html#markText) and [`addLineWidget`](http://codemirror.net/doc/manual.html#addLineWidget) now take a `handleMouseEvents` option.
-*   New methods: [`lineAtHeight`](http://codemirror.net/doc/manual.html#lineAtHeight), [`getTokenTypeAt`](http://codemirror.net/doc/manual.html#getTokenTypeAt).
-*   More precise cleanness-tracking using [`changeGeneration`](http://codemirror.net/doc/manual.html#changeGeneration) and [`isClean`](http://codemirror.net/doc/manual.html#isClean).
-*   Many extensions to [Emacs](http://codemirror.net/demo/emacs.html) mode (prefixes, more navigation units, and more).
-*   New events [`"keyHandled"`](http://codemirror.net/doc/manual.html#event_keyHandled) and [`"inputRead"`](http://codemirror.net/doc/manual.html#event_inputRead).
-*   Various improvements to [Ruby](http://codemirror.net/mode/ruby/index.html), [Smarty](http://codemirror.net/mode/smarty/index.html), [SQL](http://codemirror.net/mode/sql/index.html), and [Vim](http://codemirror.net/demo/vim.html) modes.
+*   New addons: [trailing space highlight](https://codemirror.net/doc/manual.html#addon_trailingspace), [XML completion](https://codemirror.net/doc/manual.html#addon_xml-hint) (rewritten), and [diff merging](https://codemirror.net/doc/manual.html#addon_merge).
+*   [`markText`](https://codemirror.net/doc/manual.html#markText) and [`addLineWidget`](https://codemirror.net/doc/manual.html#addLineWidget) now take a `handleMouseEvents` option.
+*   New methods: [`lineAtHeight`](https://codemirror.net/doc/manual.html#lineAtHeight), [`getTokenTypeAt`](https://codemirror.net/doc/manual.html#getTokenTypeAt).
+*   More precise cleanness-tracking using [`changeGeneration`](https://codemirror.net/doc/manual.html#changeGeneration) and [`isClean`](https://codemirror.net/doc/manual.html#isClean).
+*   Many extensions to [Emacs](https://codemirror.net/demo/emacs.html) mode (prefixes, more navigation units, and more).
+*   New events [`"keyHandled"`](https://codemirror.net/doc/manual.html#event_keyHandled) and [`"inputRead"`](https://codemirror.net/doc/manual.html#event_inputRead).
+*   Various improvements to [Ruby](https://codemirror.net/mode/ruby/index.html), [Smarty](https://codemirror.net/mode/smarty/index.html), [SQL](https://codemirror.net/mode/sql/index.html), and [Vim](https://codemirror.net/demo/vim.html) modes.
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.13.0...3.14.0).
 
 ## 3.13.0 (2013-05-20)
 
-*   New modes: [COBOL](http://codemirror.net/mode/cobol/index.html) and [HAML](http://codemirror.net/mode/haml/index.html).
-*   New options: [`cursorScrollMargin`](http://codemirror.net/doc/manual.html#option_cursorScrollMargin) and [`coverGutterNextToScrollbar`](http://codemirror.net/doc/manual.html#option_coverGutterNextToScrollbar).
-*   New addon: [commenting](http://codemirror.net/doc/manual.html#addon_comment).
-*   More features added to the [Vim keymap](http://codemirror.net/demo/vim.html).
+*   New modes: [COBOL](https://codemirror.net/mode/cobol/index.html) and [HAML](https://codemirror.net/mode/haml/index.html).
+*   New options: [`cursorScrollMargin`](https://codemirror.net/doc/manual.html#option_cursorScrollMargin) and [`coverGutterNextToScrollbar`](https://codemirror.net/doc/manual.html#option_coverGutterNextToScrollbar).
+*   New addon: [commenting](https://codemirror.net/doc/manual.html#addon_comment).
+*   More features added to the [Vim keymap](https://codemirror.net/demo/vim.html).
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v3.12...3.13.0).
 
 ## 3.12.0 (2013-04-19)
 
-*   New mode: [GNU assembler](http://codemirror.net/mode/gas/index.html).
-*   New options: [`maxHighlightLength`](http://codemirror.net/doc/manual.html#option_maxHighlightLength) and [`historyEventDelay`](http://codemirror.net/doc/manual.html#option_historyEventDelay).
-*   Added [`addToHistory`](http://codemirror.net/doc/manual.html#mark_addToHistory) option for `markText`.
+*   New mode: [GNU assembler](https://codemirror.net/mode/gas/index.html).
+*   New options: [`maxHighlightLength`](https://codemirror.net/doc/manual.html#option_maxHighlightLength) and [`historyEventDelay`](https://codemirror.net/doc/manual.html#option_historyEventDelay).
+*   Added [`addToHistory`](https://codemirror.net/doc/manual.html#mark_addToHistory) option for `markText`.
 *   Various fixes to JavaScript tokenization and indentation corner cases.
 *   Further improvements to the vim mode.
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v3.11...v3.12).
 
 ## 3.11.0 (2013-03-20)
 
-*   **Removed code:** `collapserange`, `formatting`, and `simple-hint` addons. `plsql` and `mysql` modes (use [`sql`](http://codemirror.net/mode/sql/index.html) mode).
-*   **Moved code:** the range-finding functions for folding now have [their own files](http://codemirror.net/addon/fold/).
-*   **Changed interface:** the [`continuecomment`](http://codemirror.net/doc/manual.html#addon_continuecomment) addon now exposes an option, rather than a command.
-*   New modes: [SCSS](http://codemirror.net/mode/css/scss.html), [Tcl](http://codemirror.net/mode/tcl/index.html), [LiveScript](http://codemirror.net/mode/livescript/index.html), and [mIRC](http://codemirror.net/mode/mirc/index.html).
-*   New addons: [`placeholder`](http://codemirror.net/demo/placeholder.html), [HTML completion](http://codemirror.net/demo/html5complete.html).
-*   New methods: [`hasFocus`](http://codemirror.net/doc/manual.html#hasFocus), [`defaultCharWidth`](http://codemirror.net/doc/manual.html#defaultCharWidth).
-*   New events: [`beforeCursorEnter`](http://codemirror.net/doc/manual.html#event_beforeCursorEnter), [`renderLine`](http://codemirror.net/doc/manual.html#event_renderLine).
-*   Many improvements to the [`show-hint`](http://codemirror.net/doc/manual.html#addon_show-hint) completion dialog addon.
+*   **Removed code:** `collapserange`, `formatting`, and `simple-hint` addons. `plsql` and `mysql` modes (use [`sql`](https://codemirror.net/mode/sql/index.html) mode).
+*   **Moved code:** the range-finding functions for folding now have [their own files](https://codemirror.net/addon/fold/).
+*   **Changed interface:** the [`continuecomment`](https://codemirror.net/doc/manual.html#addon_continuecomment) addon now exposes an option, rather than a command.
+*   New modes: [SCSS](https://codemirror.net/mode/css/scss.html), [Tcl](https://codemirror.net/mode/tcl/index.html), [LiveScript](https://codemirror.net/mode/livescript/index.html), and [mIRC](https://codemirror.net/mode/mirc/index.html).
+*   New addons: [`placeholder`](https://codemirror.net/demo/placeholder.html), [HTML completion](https://codemirror.net/demo/html5complete.html).
+*   New methods: [`hasFocus`](https://codemirror.net/doc/manual.html#hasFocus), [`defaultCharWidth`](https://codemirror.net/doc/manual.html#defaultCharWidth).
+*   New events: [`beforeCursorEnter`](https://codemirror.net/doc/manual.html#event_beforeCursorEnter), [`renderLine`](https://codemirror.net/doc/manual.html#event_renderLine).
+*   Many improvements to the [`show-hint`](https://codemirror.net/doc/manual.html#addon_show-hint) completion dialog addon.
 *   Tweak behavior of by-word cursor motion.
-*   Further improvements to the [vim mode](http://codemirror.net/demo/vim.html).
+*   Further improvements to the [vim mode](https://codemirror.net/demo/vim.html).
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v3.1...v3.11).
 
 ## 3.02.0 (2013-01-25)
@@ -1046,36 +1164,36 @@ Single-bugfix release. Fixes a problem that prevents CodeMirror instances from b
 
 ## 3.01.0 (2013-01-21)
 
-*   Move all add-ons into an organized directory structure under [`/addon`](http://codemirror.net/addon/). **You might have to adjust your paths.**
-*   New modes: [D](http://codemirror.net/mode/d/index.html), [Sass](http://codemirror.net/mode/sass/index.html), [APL](http://codemirror.net/mode/apl/index.html), [SQL](http://codemirror.net/mode/sql/index.html) (configurable), and [Asterisk](http://codemirror.net/mode/asterisk/index.html).
+*   Move all add-ons into an organized directory structure under [`/addon`](https://codemirror.net/addon/). **You might have to adjust your paths.**
+*   New modes: [D](https://codemirror.net/mode/d/index.html), [Sass](https://codemirror.net/mode/sass/index.html), [APL](https://codemirror.net/mode/apl/index.html), [SQL](https://codemirror.net/mode/sql/index.html) (configurable), and [Asterisk](https://codemirror.net/mode/asterisk/index.html).
 *   Several bugfixes in right-to-left text support.
-*   Add [`rtlMoveVisually`](http://codemirror.net/doc/manual.html#option_rtlMoveVisually) option.
+*   Add [`rtlMoveVisually`](https://codemirror.net/doc/manual.html#option_rtlMoveVisually) option.
 *   Improvements to vim keymap.
-*   Add built-in (lightweight) [overlay mode](http://codemirror.net/doc/manual.html#addOverlay) support.
-*   Support `showIfHidden` option for [line widgets](http://codemirror.net/doc/manual.html#addLineWidget).
-*   Add simple [Python hinter](http://codemirror.net/doc/manual.html#addon_python-hint).
-*   Bring back the [`fixedGutter`](http://codemirror.net/doc/manual.html#option_fixedGutter) option.
+*   Add built-in (lightweight) [overlay mode](https://codemirror.net/doc/manual.html#addOverlay) support.
+*   Support `showIfHidden` option for [line widgets](https://codemirror.net/doc/manual.html#addLineWidget).
+*   Add simple [Python hinter](https://codemirror.net/doc/manual.html#addon_python-hint).
+*   Bring back the [`fixedGutter`](https://codemirror.net/doc/manual.html#option_fixedGutter) option.
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v3.0...v3.01).
 
 ## 3.1.0 (2013-02-21)
 
 *   **Incompatible:** key handlers may now _return_, rather than _throw_ `CodeMirror.Pass` to signal they didn't handle the key.
-*   Make documents a [first-class construct](http://codemirror.net/doc/manual.html#api_doc), support split views and subviews.
-*   Add a [new module](http://codemirror.net/doc/manual.html#addon_show-hint) for showing completion hints. Deprecate `simple-hint.js`.
-*   Extend [htmlmixed mode](http://codemirror.net/mode/htmlmixed/index.html) to allow custom handling of script types.
-*   Support an `insertLeft` option to [`setBookmark`](http://codemirror.net/doc/manual.html#setBookmark).
-*   Add an [`eachLine`](http://codemirror.net/doc/manual.html#eachLine) method to iterate over a document.
-*   New addon modules: [selection marking](http://codemirror.net/demo/markselection.html), [linting](http://codemirror.net/demo/lint.html), and [automatic bracket closing](http://codemirror.net/demo/closebrackets.html).
-*   Add [`"beforeChange"`](http://codemirror.net/doc/manual.html#event_beforeChange) and [`"beforeSelectionChange"`](http://codemirror.net/doc/manual.html#event_beforeSelectionChange) events.
-*   Add [`"hide"`](http://codemirror.net/doc/manual.html#event_hide) and [`"unhide"`](http://codemirror.net/doc/manual.html#event_unhide) events to marked ranges.
-*   Fix [`coordsChar`](http://codemirror.net/doc/manual.html#coordsChar)'s interpretation of its argument to match the documentation.
-*   New modes: [Turtle](http://codemirror.net/mode/turtle/index.html) and [Q](http://codemirror.net/mode/q/index.html).
-*   Further improvements to the [vim mode](http://codemirror.net/demo/vim.html).
+*   Make documents a [first-class construct](https://codemirror.net/doc/manual.html#api_doc), support split views and subviews.
+*   Add a [new module](https://codemirror.net/doc/manual.html#addon_show-hint) for showing completion hints. Deprecate `simple-hint.js`.
+*   Extend [htmlmixed mode](https://codemirror.net/mode/htmlmixed/index.html) to allow custom handling of script types.
+*   Support an `insertLeft` option to [`setBookmark`](https://codemirror.net/doc/manual.html#setBookmark).
+*   Add an [`eachLine`](https://codemirror.net/doc/manual.html#eachLine) method to iterate over a document.
+*   New addon modules: [selection marking](https://codemirror.net/demo/markselection.html), [linting](https://codemirror.net/demo/lint.html), and [automatic bracket closing](https://codemirror.net/demo/closebrackets.html).
+*   Add [`"beforeChange"`](https://codemirror.net/doc/manual.html#event_beforeChange) and [`"beforeSelectionChange"`](https://codemirror.net/doc/manual.html#event_beforeSelectionChange) events.
+*   Add [`"hide"`](https://codemirror.net/doc/manual.html#event_hide) and [`"unhide"`](https://codemirror.net/doc/manual.html#event_unhide) events to marked ranges.
+*   Fix [`coordsChar`](https://codemirror.net/doc/manual.html#coordsChar)'s interpretation of its argument to match the documentation.
+*   New modes: [Turtle](https://codemirror.net/mode/turtle/index.html) and [Q](https://codemirror.net/mode/q/index.html).
+*   Further improvements to the [vim mode](https://codemirror.net/demo/vim.html).
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v3.01...v3.1).
 
 ## 3.0.0 (2012-12-10)
 
-**New major version**. Only partially backwards-compatible. See the [upgrading guide](http://codemirror.net/doc/upgrade_v3.html) for more information. Changes since release candidate 2:
+**New major version**. Only partially backwards-compatible. See the [upgrading guide](https://codemirror.net/doc/upgrade_v3.html) for more information. Changes since release candidate 2:
 
 *   Rewritten VIM mode.
 *   Fix a few minor scrolling and sizing issues.
@@ -1084,55 +1202,55 @@ Single-bugfix release. Fixes a problem that prevents CodeMirror instances from b
 
 ## 2.38.0 (2013-01-21)
 
-Integrate some bugfixes, enhancements to the vim keymap, and new modes ([D](http://codemirror.net/mode/d/index.html), [Sass](http://codemirror.net/mode/sass/index.html), [APL](http://codemirror.net/mode/apl/index.html)) from the v3 branch.
+Integrate some bugfixes, enhancements to the vim keymap, and new modes ([D](https://codemirror.net/mode/d/index.html), [Sass](https://codemirror.net/mode/sass/index.html), [APL](https://codemirror.net/mode/apl/index.html)) from the v3 branch.
 
 ## 2.37.0 (2012-12-20)
 
-*   New mode: [SQL](http://codemirror.net/mode/sql/index.html) (will replace [plsql](http://codemirror.net/mode/plsql/index.html) and [mysql](http://codemirror.net/mode/mysql/index.html) modes).
+*   New mode: [SQL](https://codemirror.net/mode/sql/index.html) (will replace [plsql](https://codemirror.net/mode/plsql/index.html) and [mysql](https://codemirror.net/mode/mysql/index.html) modes).
 *   Further work on the new VIM mode.
 *   Fix Cmd/Ctrl keys on recent Operas on OS X.
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v2.36...v2.37).
 
 ## 2.36.0 (2012-11-20)
 
-*   New mode: [Z80 assembly](http://codemirror.net/mode/z80/index.html).
-*   New theme: [Twilight](http://codemirror.net/demo/theme.html#twilight).
+*   New mode: [Z80 assembly](https://codemirror.net/mode/z80/index.html).
+*   New theme: [Twilight](https://codemirror.net/demo/theme.html#twilight).
 *   Add command-line compression helper.
-*   Make [`scrollIntoView`](http://codemirror.net/doc/manual.html#scrollIntoView) public.
-*   Add [`defaultTextHeight`](http://codemirror.net/doc/manual.html#defaultTextHeight) method.
+*   Make [`scrollIntoView`](https://codemirror.net/doc/manual.html#scrollIntoView) public.
+*   Add [`defaultTextHeight`](https://codemirror.net/doc/manual.html#defaultTextHeight) method.
 *   Various extensions to the vim keymap.
-*   Make [PHP mode](http://codemirror.net/mode/php/index.html) build on [mixed HTML mode](http://codemirror.net/mode/htmlmixed/index.html).
-*   Add [comment-continuing](http://codemirror.net/doc/manual.html#addon_continuecomment) add-on.
-*   Full [list of patches](http://codemirror.net/https://github.com/codemirror/CodeMirror/compare/v2.35...v2.36).
+*   Make [PHP mode](https://codemirror.net/mode/php/index.html) build on [mixed HTML mode](https://codemirror.net/mode/htmlmixed/index.html).
+*   Add [comment-continuing](https://codemirror.net/doc/manual.html#addon_continuecomment) add-on.
+*   Full [list of patches](https://codemirror.net/https://github.com/codemirror/CodeMirror/compare/v2.35...v2.36).
 
 ## 2.35.0 (2012-10-22)
 
-*   New (sub) mode: [TypeScript](http://codemirror.net/mode/javascript/typescript.html).
+*   New (sub) mode: [TypeScript](https://codemirror.net/mode/javascript/typescript.html).
 *   Don't overwrite (insert key) when pasting.
-*   Fix several bugs in [`markText`](http://codemirror.net/doc/manual.html#markText)/undo interaction.
+*   Fix several bugs in [`markText`](https://codemirror.net/doc/manual.html#markText)/undo interaction.
 *   Better indentation of JavaScript code without semicolons.
-*   Add [`defineInitHook`](http://codemirror.net/doc/manual.html#defineInitHook) function.
+*   Add [`defineInitHook`](https://codemirror.net/doc/manual.html#defineInitHook) function.
 *   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v2.34...v2.35).
 
 ## 2.34.0 (2012-09-19)
 
-*   New mode: [Common Lisp](http://codemirror.net/mode/commonlisp/index.html).
+*   New mode: [Common Lisp](https://codemirror.net/mode/commonlisp/index.html).
 *   Fix right-click select-all on most browsers.
 *   Change the way highlighting happens:
       Saves memory and CPU cycles.
       `compareStates` is no longer needed.
       `onHighlightComplete` no longer works.
 *   Integrate mode (Markdown, XQuery, CSS, sTex) tests in central testsuite.
-*   Add a [`CodeMirror.version`](http://codemirror.net/doc/manual.html#version) property.
-*   More robust handling of nested modes in [formatting](http://codemirror.net/demo/formatting.html) and [closetag](http://codemirror.net/demo/closetag.html) plug-ins.
-*   Un/redo now preserves [marked text](http://codemirror.net/doc/manual.html#markText) and bookmarks.
+*   Add a [`CodeMirror.version`](https://codemirror.net/doc/manual.html#version) property.
+*   More robust handling of nested modes in [formatting](https://codemirror.net/demo/formatting.html) and [closetag](https://codemirror.net/demo/closetag.html) plug-ins.
+*   Un/redo now preserves [marked text](https://codemirror.net/doc/manual.html#markText) and bookmarks.
 *   [Full list](https://github.com/codemirror/CodeMirror/compare/v2.33...v2.34) of patches.
 
 ## 2.33.0 (2012-08-23)
 
-*   New mode: [Sieve](http://codemirror.net/mode/sieve/index.html).
-*   New [`getViewPort`](http://codemirror.net/doc/manual.html#getViewport) and [`onViewportChange`](http://codemirror.net/doc/manual.html#option_onViewportChange) API.
-*   [Configurable](http://codemirror.net/doc/manual.html#option_cursorBlinkRate) cursor blink rate.
+*   New mode: [Sieve](https://codemirror.net/mode/sieve/index.html).
+*   New [`getViewPort`](https://codemirror.net/doc/manual.html#getViewport) and [`onViewportChange`](https://codemirror.net/doc/manual.html#option_onViewportChange) API.
+*   [Configurable](https://codemirror.net/doc/manual.html#option_cursorBlinkRate) cursor blink rate.
 *   Make binding a key to `false` disabling handling (again).
 *   Show non-printing characters as red dots.
 *   More tweaks to the scrolling model.
@@ -1146,28 +1264,28 @@ Emergency fix for a bug where an editor with line wrapping on IE will break when
 
 ## 2.31.0 (2012-07-20)
 
-*   New modes: [OCaml](http://codemirror.net/mode/ocaml/index.html), [Haxe](http://codemirror.net/mode/haxe/index.html), and [VB.NET](http://codemirror.net/mode/vb/index.html).
+*   New modes: [OCaml](https://codemirror.net/mode/ocaml/index.html), [Haxe](https://codemirror.net/mode/haxe/index.html), and [VB.NET](https://codemirror.net/mode/vb/index.html).
 *   Several fixes to the new scrolling model.
-*   Add a [`setSize`](http://codemirror.net/doc/manual.html#setSize) method for programmatic resizing.
-*   Add [`getHistory`](http://codemirror.net/doc/manual.html#getHistory) and [`setHistory`](http://codemirror.net/doc/manual.html#setHistory) methods.
-*   Allow custom line separator string in [`getValue`](http://codemirror.net/doc/manual.html#getValue) and [`getRange`](http://codemirror.net/doc/manual.html#getRange).
+*   Add a [`setSize`](https://codemirror.net/doc/manual.html#setSize) method for programmatic resizing.
+*   Add [`getHistory`](https://codemirror.net/doc/manual.html#getHistory) and [`setHistory`](https://codemirror.net/doc/manual.html#setHistory) methods.
+*   Allow custom line separator string in [`getValue`](https://codemirror.net/doc/manual.html#getValue) and [`getRange`](https://codemirror.net/doc/manual.html#getRange).
 *   Support double- and triple-click drag, double-clicking whitespace.
 *   And more... [(all patches)](https://github.com/codemirror/CodeMirror/compare/v2.3...v2.31)
 
 ## 2.30.0 (2012-06-22)
 
 *   **New scrollbar implementation**. Should flicker less. Changes DOM structure of the editor.
-*   New theme: [vibrant-ink](http://codemirror.net/demo/theme.html#vibrant-ink).
+*   New theme: [vibrant-ink](https://codemirror.net/demo/theme.html#vibrant-ink).
 *   Many extensions to the VIM keymap (including text objects).
-*   Add [mode-multiplexing](http://codemirror.net/demo/multiplex.html) utility script.
+*   Add [mode-multiplexing](https://codemirror.net/demo/multiplex.html) utility script.
 *   Fix bug where right-click paste works in read-only mode.
-*   Add a [`getScrollInfo`](http://codemirror.net/doc/manual.html#getScrollInfo) method.
+*   Add a [`getScrollInfo`](https://codemirror.net/doc/manual.html#getScrollInfo) method.
 *   Lots of other [fixes](https://github.com/codemirror/CodeMirror/compare/v2.25...v2.3).
 
 ## 2.25.0 (2012-05-23)
 
-*   New mode: [Erlang](http://codemirror.net/mode/erlang/index.html).
-*   **Remove xmlpure mode** (use [xml.js](http://codemirror.net/mode/xml/index.html)).
+*   New mode: [Erlang](https://codemirror.net/mode/erlang/index.html).
+*   **Remove xmlpure mode** (use [xml.js](https://codemirror.net/mode/xml/index.html)).
 *   Fix line-wrapping in Opera.
 *   Fix X Windows middle-click paste in Chrome.
 *   Fix bug that broke pasting of huge documents.
@@ -1176,11 +1294,11 @@ Emergency fix for a bug where an editor with line wrapping on IE will break when
 ## 2.24.0 (2012-04-23)
 
 *   **Drop support for Internet Explorer 6**.
-*   New modes: [Shell](http://codemirror.net/mode/shell/index.html), [Tiki wiki](http://codemirror.net/mode/tiki/index.html), [Pig Latin](http://codemirror.net/mode/pig/index.html).
-*   New themes: [Ambiance](http://codemirror.net/demo/theme.html#ambiance), [Blackboard](http://codemirror.net/demo/theme.html#blackboard).
-*   More control over drag/drop with [`dragDrop`](http://codemirror.net/doc/manual.html#option_dragDrop) and [`onDragEvent`](http://codemirror.net/doc/manual.html#option_onDragEvent) options.
+*   New modes: [Shell](https://codemirror.net/mode/shell/index.html), [Tiki wiki](https://codemirror.net/mode/tiki/index.html), [Pig Latin](https://codemirror.net/mode/pig/index.html).
+*   New themes: [Ambiance](https://codemirror.net/demo/theme.html#ambiance), [Blackboard](https://codemirror.net/demo/theme.html#blackboard).
+*   More control over drag/drop with [`dragDrop`](https://codemirror.net/doc/manual.html#option_dragDrop) and [`onDragEvent`](https://codemirror.net/doc/manual.html#option_onDragEvent) options.
 *   Make HTML mode a bit less pedantic.
-*   Add [`compoundChange`](http://codemirror.net/doc/manual.html#compoundChange) API method.
+*   Add [`compoundChange`](https://codemirror.net/doc/manual.html#compoundChange) API method.
 *   Several fixes in undo history and line hiding.
 *   Remove (broken) support for `catchall` in key maps, add `nofallthrough` boolean field instead.
 
@@ -1191,47 +1309,47 @@ Emergency fix for a bug where an editor with line wrapping on IE will break when
     *   Shift-tab: Reset line indentation to default
     *   Ctrl/Cmd-[: Reduce line indentation (old tab behaviour)
     *   Ctrl/Cmd-]: Increase line indentation (old shift-tab behaviour)
-*   New modes: [XQuery](http://codemirror.net/mode/xquery/index.html) and [VBScript](http://codemirror.net/mode/vbscript/index.html).
-*   Two new themes: [lesser-dark](http://codemirror.net/mode/less/index.html) and [xq-dark](http://codemirror.net/mode/xquery/index.html).
-*   Differentiate between background and text styles in [`setLineClass`](http://codemirror.net/doc/manual.html#setLineClass).
+*   New modes: [XQuery](https://codemirror.net/mode/xquery/index.html) and [VBScript](https://codemirror.net/mode/vbscript/index.html).
+*   Two new themes: [lesser-dark](https://codemirror.net/mode/less/index.html) and [xq-dark](https://codemirror.net/mode/xquery/index.html).
+*   Differentiate between background and text styles in [`setLineClass`](https://codemirror.net/doc/manual.html#setLineClass).
 *   Fix drag-and-drop in IE9+.
-*   Extend [`charCoords`](http://codemirror.net/doc/manual.html#charCoords) and [`cursorCoords`](http://codemirror.net/doc/manual.html#cursorCoords) with a `mode` argument.
-*   Add [`autofocus`](http://codemirror.net/doc/manual.html#option_autofocus) option.
-*   Add [`findMarksAt`](http://codemirror.net/doc/manual.html#findMarksAt) method.
+*   Extend [`charCoords`](https://codemirror.net/doc/manual.html#charCoords) and [`cursorCoords`](https://codemirror.net/doc/manual.html#cursorCoords) with a `mode` argument.
+*   Add [`autofocus`](https://codemirror.net/doc/manual.html#option_autofocus) option.
+*   Add [`findMarksAt`](https://codemirror.net/doc/manual.html#findMarksAt) method.
 
 ## 2.22.0 (2012-02-27)
 
-*   Allow [key handlers](http://codemirror.net/doc/manual.html#keymaps) to pass up events, allow binding characters.
-*   Add [`autoClearEmptyLines`](http://codemirror.net/doc/manual.html#option_autoClearEmptyLines) option.
+*   Allow [key handlers](https://codemirror.net/doc/manual.html#keymaps) to pass up events, allow binding characters.
+*   Add [`autoClearEmptyLines`](https://codemirror.net/doc/manual.html#option_autoClearEmptyLines) option.
 *   Properly use tab stops when rendering tabs.
 *   Make PHP mode more robust.
-*   Support indentation blocks in [code folder](http://codemirror.net/doc/manual.html#addon_foldcode).
-*   Add a script for [highlighting instances of the selection](http://codemirror.net/doc/manual.html#addon_match-highlighter).
-*   New [.properties](http://codemirror.net/mode/properties/index.html) mode.
+*   Support indentation blocks in [code folder](https://codemirror.net/doc/manual.html#addon_foldcode).
+*   Add a script for [highlighting instances of the selection](https://codemirror.net/doc/manual.html#addon_match-highlighter).
+*   New [.properties](https://codemirror.net/mode/properties/index.html) mode.
 *   Fix many bugs.
 
 ## 2.21.0 (2012-01-27)
 
-*   Added [LESS](http://codemirror.net/mode/less/index.html), [MySQL](http://codemirror.net/mode/mysql/index.html), [Go](http://codemirror.net/mode/go/index.html), and [Verilog](http://codemirror.net/mode/verilog/index.html) modes.
-*   Add [`smartIndent`](http://codemirror.net/doc/manual.html#option_smartIndent) option.
-*   Support a cursor in [`readOnly`](http://codemirror.net/doc/manual.html#option_readOnly)-mode.
+*   Added [LESS](https://codemirror.net/mode/less/index.html), [MySQL](https://codemirror.net/mode/mysql/index.html), [Go](https://codemirror.net/mode/go/index.html), and [Verilog](https://codemirror.net/mode/verilog/index.html) modes.
+*   Add [`smartIndent`](https://codemirror.net/doc/manual.html#option_smartIndent) option.
+*   Support a cursor in [`readOnly`](https://codemirror.net/doc/manual.html#option_readOnly)-mode.
 *   Support assigning multiple styles to a token.
 *   Use a new approach to drawing the selection.
-*   Add [`scrollTo`](http://codemirror.net/doc/manual.html#scrollTo) method.
+*   Add [`scrollTo`](https://codemirror.net/doc/manual.html#scrollTo) method.
 *   Allow undo/redo events to span non-adjacent lines.
 *   Lots and lots of bugfixes.
 
 ## 2.20.0 (2011-12-20)
 
-*   Slightly incompatible API changes. Read [this](http://codemirror.net/doc/upgrade_v2.2.html).
-*   New approach to [binding](http://codemirror.net/doc/manual.html#option_extraKeys) keys, support for [custom bindings](http://codemirror.net/doc/manual.html#option_keyMap).
+*   Slightly incompatible API changes. Read [this](https://codemirror.net/doc/upgrade_v2.2.html).
+*   New approach to [binding](https://codemirror.net/doc/manual.html#option_extraKeys) keys, support for [custom bindings](https://codemirror.net/doc/manual.html#option_keyMap).
 *   Support for overwrite (insert).
-*   [Custom-width](http://codemirror.net/doc/manual.html#option_tabSize) and [stylable](http://codemirror.net/demo/visibletabs.html) tabs.
-*   Moved more code into [add-on scripts](http://codemirror.net/doc/manual.html#addons).
+*   [Custom-width](https://codemirror.net/doc/manual.html#option_tabSize) and [stylable](https://codemirror.net/demo/visibletabs.html) tabs.
+*   Moved more code into [add-on scripts](https://codemirror.net/doc/manual.html#addons).
 *   Support for sane vertical cursor movement in wrapped lines.
-*   More reliable handling of editing [marked text](http://codemirror.net/doc/manual.html#markText).
-*   Add minimal [emacs](http://codemirror.net/demo/emacs.html) and [vim](http://codemirror.net/demo/vim.html) bindings.
-*   Rename `coordsFromIndex` to [`posFromIndex`](http://codemirror.net/doc/manual.html#posFromIndex), add [`indexFromPos`](http://codemirror.net/doc/manual.html#indexFromPos) method.
+*   More reliable handling of editing [marked text](https://codemirror.net/doc/manual.html#markText).
+*   Add minimal [emacs](https://codemirror.net/demo/emacs.html) and [vim](https://codemirror.net/demo/vim.html) bindings.
+*   Rename `coordsFromIndex` to [`posFromIndex`](https://codemirror.net/doc/manual.html#posFromIndex), add [`indexFromPos`](https://codemirror.net/doc/manual.html#indexFromPos) method.
 
 ## 2.18.0 (2011-11-21)
 
@@ -1239,11 +1357,11 @@ Fixes `TextMarker.clear`, which is broken in 2.17.
 
 ## 2.17.0 (2011-11-21)
 
-*   Add support for [line wrapping](http://codemirror.net/doc/manual.html#option_lineWrapping) and [code folding](http://codemirror.net/doc/manual.html#hideLine).
-*   Add [Github-style Markdown](http://codemirror.net/mode/gfm/index.html) mode.
-*   Add [Monokai](http://codemirror.net/theme/monokai.css) and [Rubyblue](http://codemirror.net/theme/rubyblue.css) themes.
-*   Add [`setBookmark`](http://codemirror.net/doc/manual.html#setBookmark) method.
-*   Move some of the demo code into reusable components under [`lib/util`](http://codemirror.net/addon/).
+*   Add support for [line wrapping](https://codemirror.net/doc/manual.html#option_lineWrapping) and [code folding](https://codemirror.net/doc/manual.html#hideLine).
+*   Add [Github-style Markdown](https://codemirror.net/mode/gfm/index.html) mode.
+*   Add [Monokai](https://codemirror.net/theme/monokai.css) and [Rubyblue](https://codemirror.net/theme/rubyblue.css) themes.
+*   Add [`setBookmark`](https://codemirror.net/doc/manual.html#setBookmark) method.
+*   Move some of the demo code into reusable components under [`lib/util`](https://codemirror.net/addon/).
 *   Make screen-coord-finding code faster and more reliable.
 *   Fix drag-and-drop in Firefox.
 *   Improve support for IME.
@@ -1254,11 +1372,11 @@ Fixes `TextMarker.clear`, which is broken in 2.17.
 
 ## 2.16.0 (2011-10-27)
 
-*   Add [Perl](http://codemirror.net/mode/perl/index.html), [Rust](http://codemirror.net/mode/rust/index.html), [TiddlyWiki](http://codemirror.net/mode/tiddlywiki/index.html), and [Groovy](http://codemirror.net/mode/groovy/index.html) modes.
+*   Add [Perl](https://codemirror.net/mode/perl/index.html), [Rust](https://codemirror.net/mode/rust/index.html), [TiddlyWiki](https://codemirror.net/mode/tiddlywiki/index.html), and [Groovy](https://codemirror.net/mode/groovy/index.html) modes.
 *   Dragging text inside the editor now moves, rather than copies.
-*   Add a [`coordsFromIndex`](http://codemirror.net/doc/manual.html#coordsFromIndex) method.
-*   **API change**: `setValue` now no longer clears history. Use [`clearHistory`](http://codemirror.net/doc/manual.html#clearHistory) for that.
-*   **API change**: [`markText`](http://codemirror.net/doc/manual.html#markText) now returns an object with `clear` and `find` methods. Marked text is now more robust when edited.
+*   Add a [`coordsFromIndex`](https://codemirror.net/doc/manual.html#coordsFromIndex) method.
+*   **API change**: `setValue` now no longer clears history. Use [`clearHistory`](https://codemirror.net/doc/manual.html#clearHistory) for that.
+*   **API change**: [`markText`](https://codemirror.net/doc/manual.html#markText) now returns an object with `clear` and `find` methods. Marked text is now more robust when edited.
 *   Fix editing code with tabs in Internet Explorer.
 
 ## 2.15.0 (2011-09-26)
@@ -1267,24 +1385,24 @@ Fix bug that snuck into 2.14: Clicking the character that currently has the curs
 
 ## 2.14.0 (2011-09-26)
 
-*   Add [Clojure](http://codemirror.net/mode/clojure/index.html), [Pascal](http://codemirror.net/mode/pascal/index.html), [NTriples](http://codemirror.net/mode/ntriples/index.html), [Jinja2](http://codemirror.net/mode/jinja2/index.html), and [Markdown](http://codemirror.net/mode/markdown/index.html) modes.
-*   Add [Cobalt](http://codemirror.net/theme/cobalt.css) and [Eclipse](http://codemirror.net/theme/eclipse.css) themes.
-*   Add a [`fixedGutter`](http://codemirror.net/doc/manual.html#option_fixedGutter) option.
+*   Add [Clojure](https://codemirror.net/mode/clojure/index.html), [Pascal](https://codemirror.net/mode/pascal/index.html), [NTriples](https://codemirror.net/mode/ntriples/index.html), [Jinja2](https://codemirror.net/mode/jinja2/index.html), and [Markdown](https://codemirror.net/mode/markdown/index.html) modes.
+*   Add [Cobalt](https://codemirror.net/theme/cobalt.css) and [Eclipse](https://codemirror.net/theme/eclipse.css) themes.
+*   Add a [`fixedGutter`](https://codemirror.net/doc/manual.html#option_fixedGutter) option.
 *   Fix bug with `setValue` breaking cursor movement.
 *   Make gutter updates much more efficient.
 *   Allow dragging of text out of the editor (on modern browsers).
 
 ## 2.13.0 (2011-08-23)
 
-*   Add [Ruby](http://codemirror.net/mode/ruby/index.html), [R](http://codemirror.net/mode/r/index.html), [CoffeeScript](http://codemirror.net/mode/coffeescript/index.html), and [Velocity](http://codemirror.net/mode/velocity/index.html) modes.
-*   Add [`getGutterElement`](http://codemirror.net/doc/manual.html#getGutterElement) to API.
+*   Add [Ruby](https://codemirror.net/mode/ruby/index.html), [R](https://codemirror.net/mode/r/index.html), [CoffeeScript](https://codemirror.net/mode/coffeescript/index.html), and [Velocity](https://codemirror.net/mode/velocity/index.html) modes.
+*   Add [`getGutterElement`](https://codemirror.net/doc/manual.html#getGutterElement) to API.
 *   Several fixes to scrolling and positioning.
-*   Add [`smartHome`](http://codemirror.net/doc/manual.html#option_smartHome) option.
-*   Add an experimental [pure XML](http://codemirror.net/mode/xmlpure/index.html) mode.
+*   Add [`smartHome`](https://codemirror.net/doc/manual.html#option_smartHome) option.
+*   Add an experimental [pure XML](https://codemirror.net/mode/xmlpure/index.html) mode.
 
 ## 2.12.0 (2011-07-25)
 
-*   Add a [SPARQL](http://codemirror.net/mode/sparql/index.html) mode.
+*   Add a [SPARQL](https://codemirror.net/mode/sparql/index.html) mode.
 *   Fix bug with cursor jumping around in an unfocused editor in IE.
 *   Allow key and mouse events to bubble out of the editor. Ignore widget clicks.
 *   Solve cursor flakiness after undo/redo.
@@ -1297,37 +1415,37 @@ Fix bug that snuck into 2.14: Clicking the character that currently has the curs
 
 ## 2.11.0 (2011-07-04)
 
-*   Add a [Scheme mode](http://codemirror.net/mode/scheme/index.html).
+*   Add a [Scheme mode](https://codemirror.net/mode/scheme/index.html).
 *   Add a `replace` method to search cursors, for cursor-preserving replacements.
-*   Make the [C-like mode](http://codemirror.net/mode/clike/index.html) mode more customizable.
+*   Make the [C-like mode](https://codemirror.net/mode/clike/index.html) mode more customizable.
 *   Update XML mode to spot mismatched tags.
 *   Add `getStateAfter` API and `compareState` mode API methods for finer-grained mode magic.
 *   Add a `getScrollerElement` API method to manipulate the scrolling DIV.
 *   Fix drag-and-drop for Firefox.
-*   Add a C# configuration for the [C-like mode](http://codemirror.net/mode/clike/index.html).
-*   Add [full-screen editing](http://codemirror.net/demo/fullscreen.html) and [mode-changing](http://codemirror.net/demo/changemode.html) demos.
+*   Add a C# configuration for the [C-like mode](https://codemirror.net/mode/clike/index.html).
+*   Add [full-screen editing](https://codemirror.net/demo/fullscreen.html) and [mode-changing](https://codemirror.net/demo/changemode.html) demos.
 
 ## 2.10.0 (2011-06-07)
 
-Add a [theme](http://codemirror.net/doc/manual.html#option_theme) system ([demo](http://codemirror.net/demo/theme.html)). Note that this is not backwards-compatible—you'll have to update your styles and modes!
+Add a [theme](https://codemirror.net/doc/manual.html#option_theme) system ([demo](https://codemirror.net/demo/theme.html)). Note that this is not backwards-compatible—you'll have to update your styles and modes!
 
 ## 2.2.0 (2011-06-07)
 
-*   Add a [Lua mode](http://codemirror.net/mode/lua/index.html).
+*   Add a [Lua mode](https://codemirror.net/mode/lua/index.html).
 *   Fix reverse-searching for a regexp.
 *   Empty lines can no longer break highlighting.
 *   Rework scrolling model (the outer wrapper no longer does the scrolling).
 *   Solve horizontal jittering on long lines.
-*   Add [runmode.js](http://codemirror.net/demo/runmode.html).
+*   Add [runmode.js](https://codemirror.net/demo/runmode.html).
 *   Immediately re-highlight text when typing.
 *   Fix problem with 'sticking' horizontal scrollbar.
 
 ## 2.1.0 (2011-05-26)
 
-*   Add a [Smalltalk mode](http://codemirror.net/mode/smalltalk/index.html).
-*   Add a [reStructuredText mode](http://codemirror.net/mode/rst/index.html).
-*   Add a [Python mode](http://codemirror.net/mode/python/index.html).
-*   Add a [PL/SQL mode](http://codemirror.net/mode/plsql/index.html).
+*   Add a [Smalltalk mode](https://codemirror.net/mode/smalltalk/index.html).
+*   Add a [reStructuredText mode](https://codemirror.net/mode/rst/index.html).
+*   Add a [Python mode](https://codemirror.net/mode/python/index.html).
+*   Add a [PL/SQL mode](https://codemirror.net/mode/plsql/index.html).
 *   `coordsChar` now works
 *   Fix a problem where `onCursorActivity` interfered with `onChange`.
 *   Fix a number of scrolling and mouse-click-position glitches.
@@ -1341,4 +1459,4 @@ Add a [theme](http://codemirror.net/doc/manual.html#option_theme) system ([demo]
 
 ## 2.0.0 (2011-03-28)
 
-CodeMirror 2 is a complete rewrite that's faster, smaller, simpler to use, and less dependent on browser quirks. See [this](http://codemirror.net/doc/internals.html) and [this](http://groups.google.com/group/codemirror/browse_thread/thread/5a8e894024a9f580) for more information.
+CodeMirror 2 is a complete rewrite that's faster, smaller, simpler to use, and less dependent on browser quirks. See [this](https://codemirror.net/doc/internals.html) and [this](http://groups.google.com/group/codemirror/browse_thread/thread/5a8e894024a9f580) for more information.
index 1b0b104..ebbef2f 100644 (file)
@@ -71,7 +71,7 @@ a separate NPM package.
 By contributing code to CodeMirror you
 
  - agree to license the contributed code under CodeMirror's [MIT
-   license](http://codemirror.net/LICENSE).
+   license](https://codemirror.net/LICENSE).
 
  - confirm that you have the right to contribute and license the code
    in question. (Either you hold all rights on the code, or the rights
index a3a351b..8bc6c93 100644 (file)
@@ -1,4 +1,5 @@
 # CodeMirror
+
 [![Build Status](https://travis-ci.org/codemirror/CodeMirror.svg)](https://travis-ci.org/codemirror/CodeMirror)
 [![NPM version](https://img.shields.io/npm/v/codemirror.svg)](https://www.npmjs.org/package/codemirror)
 [![Join the chat at https://gitter.im/codemirror/CodeMirror](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/codemirror/CodeMirror)  
@@ -15,8 +16,8 @@ customizing CodeMirror to fit your application, and extending it with
 new functionality.
 
 You can find more information (and the
-[manual](http://codemirror.net/doc/manual.html)) on the [project
-page](http://codemirror.net). For questions and discussion, use the
+[manual](https://codemirror.net/doc/manual.html)) on the [project
+page](https://codemirror.net). For questions and discussion, use the
 [discussion forum](https://discuss.codemirror.net/).
 
 See
@@ -28,6 +29,19 @@ The CodeMirror community aims to be welcoming to everybody. We use the
 (1.1)](http://contributor-covenant.org/version/1/1/0/) as our code of
 conduct.
 
+### Installation
+
+Either get the [zip file](https://codemirror.net/codemirror.zip) with
+the latest version, or make sure you have [Node](https://nodejs.org/)
+installed and run:
+
+    npm install codemirror
+
+**NOTE**: This is the source repository for the library, and not the
+distribution channel. Cloning it is not the recommended way to install
+the library, and will in fact not work unless you also run the build
+step.
+
 ### Quickstart
 
 To build the project, make sure you have Node.js installed (at least version 6)
index 99cbb03..69b80f4 100644 (file)
@@ -1 +1 @@
-!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 o(e,o,n){var t;return(t=e.getWrapperElement().appendChild(document.createElement("div"))).className=n?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof o?t.innerHTML=o:t.appendChild(o),t}function n(e,o){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=o}e.defineExtension("openDialog",function(t,i,r){r||(r={}),n(this,null);var u=o(this,t,r.bottom),l=!1,c=this;function a(e){if("string"==typeof e)s.value=e;else{if(l)return;l=!0,u.parentNode.removeChild(u),c.focus(),r.onClose&&r.onClose(u)}}var f,s=u.getElementsByTagName("input")[0];return s?(s.focus(),r.value&&(s.value=r.value,!1!==r.selectValueOnOpen&&s.select()),r.onInput&&e.on(s,"input",function(e){r.onInput(e,s.value,a)}),r.onKeyUp&&e.on(s,"keyup",function(e){r.onKeyUp(e,s.value,a)}),e.on(s,"keydown",function(o){r&&r.onKeyDown&&r.onKeyDown(o,s.value,a)||((27==o.keyCode||!1!==r.closeOnEnter&&13==o.keyCode)&&(s.blur(),e.e_stop(o),a()),13==o.keyCode&&i(s.value,o))}),!1!==r.closeOnBlur&&e.on(s,"blur",a)):(f=u.getElementsByTagName("button")[0])&&(e.on(f,"click",function(){a(),c.focus()}),!1!==r.closeOnBlur&&e.on(f,"blur",a),f.focus()),a}),e.defineExtension("openConfirm",function(t,i,r){n(this,null);var u=o(this,t,r&&r.bottom),l=u.getElementsByTagName("button"),c=!1,a=this,f=1;function s(){c||(c=!0,u.parentNode.removeChild(u),a.focus())}l[0].focus();for(var d=0;d<l.length;++d){var p=l[d];!function(o){e.on(p,"click",function(n){e.e_preventDefault(n),s(),o&&o(a)})}(i[d]),e.on(p,"blur",function(){--f,setTimeout(function(){f<=0&&s()},200)}),e.on(p,"focus",function(){++f})}}),e.defineExtension("openNotification",function(t,i){n(this,a);var r,u=o(this,t,i&&i.bottom),l=!1,c=i&&void 0!==i.duration?i.duration:5e3;function a(){l||(l=!0,clearTimeout(r),u.parentNode.removeChild(u))}return e.on(u,"click",function(o){e.e_preventDefault(o),a()}),c&&(r=setTimeout(a,c)),a})});
\ No newline at end of file
+!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 o(o,n,t){var i,r=o.getWrapperElement();return(i=r.appendChild(document.createElement("div"))).className=t?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof n?i.innerHTML=n:i.appendChild(n),e.addClass(r,"dialog-opened"),i}function n(e,o){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=o}e.defineExtension("openDialog",function(t,i,r){r||(r={}),n(this,null);var u=o(this,t,r.bottom),l=!1,a=this;function c(o){if("string"==typeof o)s.value=o;else{if(l)return;l=!0,e.rmClass(u.parentNode,"dialog-opened"),u.parentNode.removeChild(u),a.focus(),r.onClose&&r.onClose(u)}}var d,s=u.getElementsByTagName("input")[0];return s?(s.focus(),r.value&&(s.value=r.value,!1!==r.selectValueOnOpen&&s.select()),r.onInput&&e.on(s,"input",function(e){r.onInput(e,s.value,c)}),r.onKeyUp&&e.on(s,"keyup",function(e){r.onKeyUp(e,s.value,c)}),e.on(s,"keydown",function(o){r&&r.onKeyDown&&r.onKeyDown(o,s.value,c)||((27==o.keyCode||!1!==r.closeOnEnter&&13==o.keyCode)&&(s.blur(),e.e_stop(o),c()),13==o.keyCode&&i(s.value,o))}),!1!==r.closeOnBlur&&e.on(s,"blur",c)):(d=u.getElementsByTagName("button")[0])&&(e.on(d,"click",function(){c(),a.focus()}),!1!==r.closeOnBlur&&e.on(d,"blur",c),d.focus()),c}),e.defineExtension("openConfirm",function(t,i,r){n(this,null);var u=o(this,t,r&&r.bottom),l=u.getElementsByTagName("button"),a=!1,c=this,d=1;function s(){a||(a=!0,e.rmClass(u.parentNode,"dialog-opened"),u.parentNode.removeChild(u),c.focus())}l[0].focus();for(var f=0;f<l.length;++f){var p=l[f];!function(o){e.on(p,"click",function(n){e.e_preventDefault(n),s(),o&&o(c)})}(i[f]),e.on(p,"blur",function(){--d,setTimeout(function(){d<=0&&s()},200)}),e.on(p,"focus",function(){++d})}}),e.defineExtension("openNotification",function(t,i){n(this,c);var r,u=o(this,t,i&&i.bottom),l=!1,a=i&&void 0!==i.duration?i.duration:5e3;function c(){l||(l=!0,clearTimeout(r),e.rmClass(u.parentNode,"dialog-opened"),u.parentNode.removeChild(u))}return e.on(u,"click",function(o){e.e_preventDefault(o),c()}),a&&(r=setTimeout(c,a)),c})});
\ No newline at end of file
index 22b8727..77f6c5f 100644 (file)
@@ -1 +1 @@
-!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,i,r){this.cm=e,this.node=t,this.options=i,this.height=r,this.cleared=!1}function i(e,t){for(var i=t.nextSibling;i;i=i.nextSibling)if(i==e.getWrapperElement())return!0;return!1}e.defineExtension("addPanel",function(e,r){r=r||{},this.state.panels||function(e){var t=e.getWrapperElement(),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r=parseInt(i.height),n=e.state.panels={setHeight:t.style.height,heightLeft:r,panels:0,wrapper:document.createElement("div")};t.parentNode.insertBefore(n.wrapper,t);var s=e.hasFocus();n.wrapper.appendChild(t),s&&e.focus();e._setSize=e.setSize,null!=r&&(e.setSize=function(t,i){if(null==i)return this._setSize(t,i);if(n.setHeight=i,"number"!=typeof i){var s=/^(\d+\.?\d*)px$/.exec(i);s?i=Number(s[1]):(n.wrapper.style.height=i,i=n.wrapper.offsetHeight,n.wrapper.style.height="")}e._setSize(t,n.heightLeft+=i-r),r=i})}(this);var n=this.state.panels,s=n.wrapper,o=this.getWrapperElement();r.after instanceof t&&!r.after.cleared?s.insertBefore(e,r.before.node.nextSibling):r.before instanceof t&&!r.before.cleared?s.insertBefore(e,r.before.node):r.replace instanceof t&&!r.replace.cleared?(s.insertBefore(e,r.replace.node),r.replace.clear()):"bottom"==r.position?s.appendChild(e):"before-bottom"==r.position?s.insertBefore(e,o.nextSibling):"after-top"==r.position?s.insertBefore(e,o):s.insertBefore(e,s.firstChild);var h=r&&r.height||e.offsetHeight;return this._setSize(null,n.heightLeft-=h),n.panels++,r.stable&&i(this,e)&&this.scrollTo(null,this.getScrollInfo().top+h),new t(this,e,r,h)}),t.prototype.clear=function(){if(!this.cleared){this.cleared=!0;var e=this.cm.state.panels;this.cm._setSize(null,e.heightLeft+=this.height),this.options.stable&&i(this.cm,this.node)&&this.cm.scrollTo(null,this.cm.getScrollInfo().top-this.height),e.wrapper.removeChild(this.node),0==--e.panels&&function(e){var t=e.state.panels;e.state.panels=null;var i=e.getWrapperElement();t.wrapper.parentNode.replaceChild(i,t.wrapper),i.style.height=t.setHeight,e.setSize=e._setSize,e.setSize()}(this.cm)}},t.prototype.changed=function(e){var t=null==e?this.node.offsetHeight:e,i=this.cm.state.panels;this.cm._setSize(null,i.heightLeft-=t-this.height),this.height=t}});
\ No newline at end of file
+!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,i,r){this.cm=e,this.node=t,this.options=i,this.height=r,this.cleared=!1}function i(e,t){for(var i=t.nextSibling;i;i=i.nextSibling)if(i==e.getWrapperElement())return!0;return!1}e.defineExtension("addPanel",function(e,r){r=r||{},this.state.panels||function(e){var t=e.getWrapperElement(),i=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r=parseInt(i.height),n=e.state.panels={setHeight:t.style.height,heightLeft:r,panels:0,wrapper:document.createElement("div")};t.parentNode.insertBefore(n.wrapper,t);var s=e.hasFocus();n.wrapper.appendChild(t),s&&e.focus();e._setSize=e.setSize,null!=r&&(e.setSize=function(t,i){if(null==i)return this._setSize(t,i);if(n.setHeight=i,"number"!=typeof i){var s=/^(\d+\.?\d*)px$/.exec(i);s?i=Number(s[1]):(n.wrapper.style.height=i,i=n.wrapper.offsetHeight,n.wrapper.style.height="")}e._setSize(t,n.heightLeft+=i-r),r=i})}(this);var n=this.state.panels,s=n.wrapper,o=this.getWrapperElement(),h=r.replace instanceof t&&!r.replace.cleared;r.after instanceof t&&!r.after.cleared?s.insertBefore(e,r.before.node.nextSibling):r.before instanceof t&&!r.before.cleared?s.insertBefore(e,r.before.node):h?(s.insertBefore(e,r.replace.node),n.panels++,r.replace.clear()):"bottom"==r.position?s.appendChild(e):"before-bottom"==r.position?s.insertBefore(e,o.nextSibling):"after-top"==r.position?s.insertBefore(e,o):s.insertBefore(e,s.firstChild);var l=r&&r.height||e.offsetHeight;return this._setSize(null,n.heightLeft-=l),h||n.panels++,r.stable&&i(this,e)&&this.scrollTo(null,this.getScrollInfo().top+l),new t(this,e,r,l)}),t.prototype.clear=function(){if(!this.cleared){this.cleared=!0;var e=this.cm.state.panels;this.cm._setSize(null,e.heightLeft+=this.height),this.options.stable&&i(this.cm,this.node)&&this.cm.scrollTo(null,this.cm.getScrollInfo().top-this.height),e.wrapper.removeChild(this.node),0==--e.panels&&function(e){var t=e.state.panels;e.state.panels=null;var i=e.getWrapperElement();t.wrapper.parentNode.replaceChild(i,t.wrapper),i.style.height=t.setHeight,e.setSize=e._setSize,e.setSize()}(this.cm)}},t.prototype.changed=function(e){var t=null==e?this.node.offsetHeight:e,i=this.cm.state.panels;this.cm._setSize(null,i.heightLeft-=t-this.height),this.height=t}});
\ No newline at end of file
index 053df8c..ac63f97 100644 (file)
@@ -1 +1 @@
-!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){var t={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},r=e.Pos;function n(e,r){return"pairs"==r&&"string"==typeof e?e:"object"==typeof e&&null!=e[r]?e[r]:t[r]}e.defineOption("autoCloseBrackets",!1,function(t,r,o){o&&o!=e.Init&&(t.removeKeyMap(i),t.state.closeBrackets=null),r&&(a(n(r,"pairs")),t.state.closeBrackets=r,t.addKeyMap(i))});var i={Backspace:function(t){var i=s(t);if(!i||t.getOption("disableInput"))return e.Pass;for(var a=n(i,"pairs"),o=t.listSelections(),c=0;c<o.length;c++){if(!o[c].empty())return e.Pass;var f=l(t,o[c].head);if(!f||a.indexOf(f)%2!=0)return e.Pass}for(var c=o.length-1;c>=0;c--){var h=o[c].head;t.replaceRange("",r(h.line,h.ch-1),r(h.line,h.ch+1),"+delete")}},Enter:function(t){var r=s(t),i=r&&n(r,"explode");if(!i||t.getOption("disableInput"))return e.Pass;for(var a=t.listSelections(),o=0;o<a.length;o++){if(!a[o].empty())return e.Pass;var c=l(t,a[o].head);if(!c||i.indexOf(c)%2!=0)return e.Pass}t.operation(function(){var e=t.lineSeparator()||"\n";t.replaceSelection(e+e,null),t.execCommand("goCharLeft"),a=t.listSelections();for(var r=0;r<a.length;r++){var n=a[r].head.line;t.indentLine(n,null,!0),t.indentLine(n+1,null,!0)}})}};function a(e){for(var t=0;t<e.length;t++){var r=e.charAt(t),n="'"+r+"'";i[n]||(i[n]=o(r))}}function o(t){return function(i){return function(t,i){var a=s(t);if(!a||t.getOption("disableInput"))return e.Pass;var o=n(a,"pairs"),l=o.indexOf(i);if(-1==l)return e.Pass;for(var c,f=n(a,"triples"),h=o.charAt(l+1)==i,d=t.listSelections(),u=l%2==0,g=0;g<d.length;g++){var p,v=d[g],m=v.head,b=t.getRange(m,r(m.line,m.ch+1));if(u&&!v.empty())p="surround";else if(!h&&u||b!=i)if(h&&m.ch>1&&f.indexOf(i)>=0&&t.getRange(r(m.line,m.ch-2),m)==i+i){if(m.ch>2&&/\bstring/.test(t.getTokenTypeAt(r(m.line,m.ch-2))))return e.Pass;p="addFour"}else if(h){var C=0==m.ch?" ":t.getRange(r(m.line,m.ch-1),m);if(e.isWordChar(b)||C==i||e.isWordChar(C))return e.Pass;p="both"}else{if(!u||!(t.getLine(m.line).length==m.ch||(x=b,void 0,(P=o.lastIndexOf(x))>-1&&P%2==1)||/\s/.test(b)))return e.Pass;p="both"}else p=!h||(y=m,void 0,S=(k=t).getTokenAt(r(y.line,y.ch+1)),!/\bstring/.test(S.type)||S.start!=y.ch||0!=y.ch&&/\bstring/.test(k.getTokenTypeAt(y)))?f.indexOf(i)>=0&&t.getRange(m,r(m.line,m.ch+3))==i+i+i?"skipThree":"skip":"both";if(c){if(c!=p)return e.Pass}else c=p}var x,P;var k,y,S;var O=l%2?o.charAt(l-1):i,R=l%2?i:o.charAt(l+1);t.operation(function(){if("skip"==c)t.execCommand("goCharRight");else if("skipThree"==c)for(var n=0;n<3;n++)t.execCommand("goCharRight");else if("surround"==c){for(var i=t.getSelections(),n=0;n<i.length;n++)i[n]=O+i[n]+R;t.replaceSelections(i,"around"),i=t.listSelections().slice();for(var n=0;n<i.length;n++)i[n]=(a=i[n],void 0,o=e.cmpPos(a.anchor,a.head)>0,{anchor:new r(a.anchor.line,a.anchor.ch+(o?-1:1)),head:new r(a.head.line,a.head.ch+(o?1:-1))});t.setSelections(i)}else"both"==c?(t.replaceSelection(O+R,null),t.triggerElectric(O+R),t.execCommand("goCharLeft")):"addFour"==c&&(t.replaceSelection(O+O+O+O,"before"),t.execCommand("goCharRight"));var a,o})}(i,t)}}function s(e){var t=e.state.closeBrackets;return!t||t.override?t:e.getModeAt(e.getCursor()).closeBrackets||t}function l(e,t){var n=e.getRange(r(t.line,t.ch-1),r(t.line,t.ch+1));return 2==n.length?n:null}a(t.pairs+"`")});
\ No newline at end of file
+!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){var r={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},t=e.Pos;function n(e,t){return"pairs"==t&&"string"==typeof e?e:"object"==typeof e&&null!=e[t]?e[t]:r[t]}e.defineOption("autoCloseBrackets",!1,function(r,t,o){o&&o!=e.Init&&(r.removeKeyMap(i),r.state.closeBrackets=null),t&&(a(n(t,"pairs")),r.state.closeBrackets=t,r.addKeyMap(i))});var i={Backspace:function(r){var i=s(r);if(!i||r.getOption("disableInput"))return e.Pass;for(var a=n(i,"pairs"),o=r.listSelections(),c=0;c<o.length;c++){if(!o[c].empty())return e.Pass;var f=l(r,o[c].head);if(!f||a.indexOf(f)%2!=0)return e.Pass}for(var c=o.length-1;c>=0;c--){var h=o[c].head;r.replaceRange("",t(h.line,h.ch-1),t(h.line,h.ch+1),"+delete")}},Enter:function(r){var t=s(r),i=t&&n(t,"explode");if(!i||r.getOption("disableInput"))return e.Pass;for(var a=r.listSelections(),o=0;o<a.length;o++){if(!a[o].empty())return e.Pass;var c=l(r,a[o].head);if(!c||i.indexOf(c)%2!=0)return e.Pass}r.operation(function(){var e=r.lineSeparator()||"\n";r.replaceSelection(e+e,null),r.execCommand("goCharLeft"),a=r.listSelections();for(var t=0;t<a.length;t++){var n=a[t].head.line;r.indentLine(n,null,!0),r.indentLine(n+1,null,!0)}})}};function a(e){for(var r=0;r<e.length;r++){var t=e.charAt(r),n="'"+t+"'";i[n]||(i[n]=o(t))}}function o(r){return function(i){return function(r,i){var a=s(r);if(!a||r.getOption("disableInput"))return e.Pass;var o=n(a,"pairs"),l=o.indexOf(i);if(-1==l)return e.Pass;for(var c,f=n(a,"triples"),h=o.charAt(l+1)==i,u=r.listSelections(),d=l%2==0,p=0;p<u.length;p++){var g,v=u[p],m=v.head,b=r.getRange(m,t(m.line,m.ch+1));if(d&&!v.empty())g="surround";else if(!h&&d||b!=i)if(h&&m.ch>1&&f.indexOf(i)>=0&&r.getRange(t(m.line,m.ch-2),m)==i+i){if(m.ch>2&&/\bstring/.test(r.getTokenTypeAt(t(m.line,m.ch-2))))return e.Pass;g="addFour"}else if(h){var C=0==m.ch?" ":r.getRange(t(m.line,m.ch-1),m);if(e.isWordChar(b)||C==i||e.isWordChar(C))return e.Pass;g="both"}else{if(!d)return e.Pass;g="both"}else g=!h||(k=m,void 0,x=(P=r).getTokenAt(t(k.line,k.ch+1)),!/\bstring/.test(x.type)||x.start!=k.ch||0!=k.ch&&/\bstring/.test(P.getTokenTypeAt(k)))?f.indexOf(i)>=0&&r.getRange(m,t(m.line,m.ch+3))==i+i+i?"skipThree":"skip":"both";if(c){if(c!=g)return e.Pass}else c=g}var P,k,x;var y=l%2?o.charAt(l-1):i,S=l%2?i:o.charAt(l+1);r.operation(function(){if("skip"==c)r.execCommand("goCharRight");else if("skipThree"==c)for(var n=0;n<3;n++)r.execCommand("goCharRight");else if("surround"==c){for(var i=r.getSelections(),n=0;n<i.length;n++)i[n]=y+i[n]+S;r.replaceSelections(i,"around"),i=r.listSelections().slice();for(var n=0;n<i.length;n++)i[n]=(a=i[n],void 0,o=e.cmpPos(a.anchor,a.head)>0,{anchor:new t(a.anchor.line,a.anchor.ch+(o?-1:1)),head:new t(a.head.line,a.head.ch+(o?1:-1))});r.setSelections(i)}else"both"==c?(r.replaceSelection(y+S,null),r.triggerElectric(y+S),r.execCommand("goCharLeft")):"addFour"==c&&(r.replaceSelection(y+y+y+y,"before"),r.execCommand("goCharRight"));var a,o})}(i,r)}}function s(e){var r=e.state.closeBrackets;return!r||r.override?r:e.getModeAt(e.getCursor()).closeBrackets||r}function l(e,r){var n=e.getRange(t(r.line,r.ch-1),t(r.line,r.ch+1));return 2==n.length?n:null}a(r.pairs+"`")});
\ No newline at end of file
index 6d3d7ab..00c62bf 100644 (file)
@@ -1 +1 @@
-!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 n=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,t=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,i=/[*+-]\s/;function r(e,t){var i=t.line,r=0,l=0,s=n.exec(e.getLine(i)),c=s[1];do{var o=i+(r+=1),a=e.getLine(o),d=n.exec(a);if(d){var f=d[1],p=parseInt(s[3],10)+r-l,u=parseInt(d[3],10),h=u;if(c===f)p===u&&(h=u+1),p>u&&(h=p+1),e.replaceRange(a.replace(n,f+h+d[4]+d[5]),{line:o,ch:0},{line:o,ch:a.length});else{if(c.length>f.length)return;if(c.length<f.length&&1===r)return;l+=1}}}while(d)}e.commands.newlineAndIndentContinueMarkdownList=function(l){if(l.getOption("disableInput"))return e.Pass;for(var s=l.listSelections(),c=[],o=0;o<s.length;o++){var a=s[o].head,d=l.getStateAfter(a.line),f=!1!==d.list,p=0!==d.quote,u=l.getLine(a.line),h=n.exec(u),g=/^\s*$/.test(u.slice(0,a.ch));if(!s[o].empty()||!f&&!p||!h||g)return void l.execCommand("newlineAndIndent");if(t.test(u))/>\s*$/.test(u)||l.replaceRange("",{line:a.line,ch:0},{line:a.line,ch:a.ch+1}),c[o]="\n";else{var m=h[1],x=h[5],v=!(i.test(h[2])||h[2].indexOf(">")>=0),I=v?parseInt(h[3],10)+1+h[4]:h[2].replace("x"," ");c[o]="\n"+m+I+x,v&&r(l,a)}}l.replaceSelections(c)}});
\ No newline at end of file
+!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 n=/^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,t=/^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,i=/[*+-]\s/;function r(e,t){var i=t.line,r=0,l=0,s=n.exec(e.getLine(i)),c=s[1];do{var o=i+(r+=1),a=e.getLine(o),d=n.exec(a);if(d){var f=d[1],p=parseInt(s[3],10)+r-l,u=parseInt(d[3],10),h=u;if(c!==f||isNaN(u)){if(c.length>f.length)return;if(c.length<f.length&&1===r)return;l+=1}else p===u&&(h=u+1),p>u&&(h=p+1),e.replaceRange(a.replace(n,f+h+d[4]+d[5]),{line:o,ch:0},{line:o,ch:a.length})}}while(d)}e.commands.newlineAndIndentContinueMarkdownList=function(l){if(l.getOption("disableInput"))return e.Pass;for(var s=l.listSelections(),c=[],o=0;o<s.length;o++){var a=s[o].head,d=l.getStateAfter(a.line),f=!1!==d.list,p=0!==d.quote,u=l.getLine(a.line),h=n.exec(u),g=/^\s*$/.test(u.slice(0,a.ch));if(!s[o].empty()||!f&&!p||!h||g)return void l.execCommand("newlineAndIndent");if(t.test(u))/>\s*$/.test(u)||l.replaceRange("",{line:a.line,ch:0},{line:a.line,ch:a.ch+1}),c[o]="\n";else{var m=h[1],x=h[5],v=!(i.test(h[2])||h[2].indexOf(">")>=0),I=v?parseInt(h[3],10)+1+h[4]:h[2].replace("x"," ");c[o]="\n"+m+I+x,v&&r(l,a)}}l.replaceSelections(c)}});
\ No newline at end of file
index bbd9e5f..0b6741d 100644 (file)
@@ -1 +1 @@
-!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 n=e.Pos;var t="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",i=new RegExp("<(/?)(["+t+"][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-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");function r(e,n,t,i){this.line=n,this.ch=t,this.cm=e,this.text=e.getLine(n),this.min=i?Math.max(i.from,e.firstLine()):e.firstLine(),this.max=i?Math.min(i.to-1,e.lastLine()):e.lastLine()}function u(e,t){var i=e.cm.getTokenTypeAt(n(e.line,t));return i&&/\btag\b/.test(i)}function f(e){if(!(e.line>=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function o(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function l(e){for(;;){var n=e.text.indexOf(">",e.ch);if(-1==n){if(f(e))continue;return}if(u(e,n+1)){var t=e.text.lastIndexOf("/",n),i=t>-1&&!/\S/.test(e.text.slice(t+1,n));return e.ch=n+1,i?"selfClose":"regular"}e.ch=n+1}}function c(e){for(;;){var n=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==n){if(o(e))continue;return}if(u(e,n+1)){i.lastIndex=n,e.ch=n;var t=i.exec(e.text);if(t&&t.index==n)return t}else e.ch=n}}function a(e){for(;;){i.lastIndex=e.ch;var n=i.exec(e.text);if(!n){if(f(e))continue;return}if(u(e,n.index+1))return e.ch=n.index+n[0].length,n;e.ch=n.index+1}}function s(e){for(;;){var n=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==n){if(o(e))continue;return}if(u(e,n+1)){var t=e.text.lastIndexOf("/",n),i=t>-1&&!/\S/.test(e.text.slice(t+1,n));return e.ch=n+1,i?"selfClose":"regular"}e.ch=n}}function h(e,t){for(var i=[];;){var r,u=a(e),f=e.line,o=e.ch-(u?u[0].length:0);if(!u||!(r=l(e)))return;if("selfClose"!=r)if(u[1]){for(var c=i.length-1;c>=0;--c)if(i[c]==u[2]){i.length=c;break}if(c<0&&(!t||t==u[2]))return{tag:u[2],from:n(f,o),to:n(e.line,e.ch)}}else i.push(u[2])}}function F(e,t){for(var i=[];;){var r=s(e);if(!r)return;if("selfClose"!=r){var u=e.line,f=e.ch,o=c(e);if(!o)return;if(o[1])i.push(o[2]);else{for(var l=i.length-1;l>=0;--l)if(i[l]==o[2]){i.length=l;break}if(l<0&&(!t||t==o[2]))return{tag:o[2],from:n(e.line,e.ch),to:n(u,f)}}}else c(e)}}e.registerHelper("fold","xml",function(e,t){for(var i=new r(e,t.line,0);;){var u,f=a(i);if(!f||!(u=l(i))||i.line!=t.line)return;if(!f[1]&&"selfClose"!=u){var o=n(i.line,i.ch),c=h(i,f[2]);return c&&{from:o,to:c.from}}}}),e.findMatchingTag=function(e,t,i){var u=new r(e,t.line,t.ch,i);if(-1!=u.text.indexOf(">")||-1!=u.text.indexOf("<")){var f=l(u),o=f&&n(u.line,u.ch),a=f&&c(u);if(f&&a&&(x=t,!(((s=u).line-x.line||s.ch-x.ch)>0))){var s,x,g={from:n(u.line,u.ch),to:o,tag:a[2]};return"selfClose"==f?{open:g,close:null,at:"open"}:a[1]?{open:F(u,a[2]),close:g,at:"close"}:{open:g,close:h(u=new r(e,o.line,o.ch,i),a[2]),at:"open"}}}},e.findEnclosingTag=function(e,n,t,i){for(var u=new r(e,n.line,n.ch,t);;){var f=F(u,i);if(!f)break;var o=h(new r(e,n.line,n.ch,t),f.tag);if(o)return{open:f,close:o}}},e.scanForClosingTag=function(e,n,t,i){return h(new r(e,n.line,n.ch,i?{from:0,to:i}:null),t)}});
\ No newline at end of file
+!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 n=e.Pos;function t(e,n){return e.line-n.line||e.ch-n.ch}var i="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",r=new RegExp("<(/?)(["+i+"][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-:.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*)","g");function u(e,n,t,i){this.line=n,this.ch=t,this.cm=e,this.text=e.getLine(n),this.min=i?Math.max(i.from,e.firstLine()):e.firstLine(),this.max=i?Math.min(i.to-1,e.lastLine()):e.lastLine()}function f(e,t){var i=e.cm.getTokenTypeAt(n(e.line,t));return i&&/\btag\b/.test(i)}function o(e){if(!(e.line>=e.max))return e.ch=0,e.text=e.cm.getLine(++e.line),!0}function l(e){if(!(e.line<=e.min))return e.text=e.cm.getLine(--e.line),e.ch=e.text.length,!0}function c(e){for(;;){var n=e.text.indexOf(">",e.ch);if(-1==n){if(o(e))continue;return}if(f(e,n+1)){var t=e.text.lastIndexOf("/",n),i=t>-1&&!/\S/.test(e.text.slice(t+1,n));return e.ch=n+1,i?"selfClose":"regular"}e.ch=n+1}}function a(e){for(;;){var n=e.ch?e.text.lastIndexOf("<",e.ch-1):-1;if(-1==n){if(l(e))continue;return}if(f(e,n+1)){r.lastIndex=n,e.ch=n;var t=r.exec(e.text);if(t&&t.index==n)return t}else e.ch=n}}function s(e){for(;;){r.lastIndex=e.ch;var n=r.exec(e.text);if(!n){if(o(e))continue;return}if(f(e,n.index+1))return e.ch=n.index+n[0].length,n;e.ch=n.index+1}}function h(e){for(;;){var n=e.ch?e.text.lastIndexOf(">",e.ch-1):-1;if(-1==n){if(l(e))continue;return}if(f(e,n+1)){var t=e.text.lastIndexOf("/",n),i=t>-1&&!/\S/.test(e.text.slice(t+1,n));return e.ch=n+1,i?"selfClose":"regular"}e.ch=n}}function F(e,t){for(var i=[];;){var r,u=s(e),f=e.line,o=e.ch-(u?u[0].length:0);if(!u||!(r=c(e)))return;if("selfClose"!=r)if(u[1]){for(var l=i.length-1;l>=0;--l)if(i[l]==u[2]){i.length=l;break}if(l<0&&(!t||t==u[2]))return{tag:u[2],from:n(f,o),to:n(e.line,e.ch)}}else i.push(u[2])}}function x(e,t){for(var i=[];;){var r=h(e);if(!r)return;if("selfClose"!=r){var u=e.line,f=e.ch,o=a(e);if(!o)return;if(o[1])i.push(o[2]);else{for(var l=i.length-1;l>=0;--l)if(i[l]==o[2]){i.length=l;break}if(l<0&&(!t||t==o[2]))return{tag:o[2],from:n(e.line,e.ch),to:n(u,f)}}}else a(e)}}e.registerHelper("fold","xml",function(e,i){for(var r=new u(e,i.line,0);;){var f=s(r);if(!f||r.line!=i.line)return;var o=c(r);if(!o)return;if(!f[1]&&"selfClose"!=o){var l=n(r.line,r.ch),a=F(r,f[2]);return a&&t(a.from,l)>0?{from:l,to:a.from}:null}}}),e.findMatchingTag=function(e,i,r){var f=new u(e,i.line,i.ch,r);if(-1!=f.text.indexOf(">")||-1!=f.text.indexOf("<")){var o=c(f),l=o&&n(f.line,f.ch),s=o&&a(f);if(o&&s&&!(t(f,i)>0)){var h={from:n(f.line,f.ch),to:l,tag:s[2]};return"selfClose"==o?{open:h,close:null,at:"open"}:s[1]?{open:x(f,s[2]),close:h,at:"close"}:{open:h,close:F(f=new u(e,l.line,l.ch,r),s[2]),at:"open"}}}},e.findEnclosingTag=function(e,n,t,i){for(var r=new u(e,n.line,n.ch,t);;){var f=x(r,i);if(!f)break;var o=F(new u(e,n.line,n.ch,t),f.tag);if(o)return{open:f,close:o}}},e.scanForClosingTag=function(e,n,t,i){return F(new u(e,n.line,n.ch,i?{from:0,to:i}:null),t)}});
\ No newline at end of file
index d771aea..a2d6070 100644 (file)
@@ -1 +1 @@
-!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){var e=t.Pos;function r(t,e){for(var r=0,n=t.length;r<n;++r)e(t[r])}function n(n,i,l,f){var c=n.getCursor(),p=l(n,c);if(!/\b(?:string|comment)\b/.test(p.type)){p.state=t.innerMode(n.getMode(),p.state).state,/^[\w$_]*$/.test(p.string)?p.end>c.ch&&(p.end=c.ch,p.string=p.string.slice(0,c.ch-p.start)):p={start:c.ch,end:c.ch,string:"",state:p.state,type:"."==p.string?"property":null};for(var u=p;"property"==u.type;){if("."!=(u=l(n,e(c.line,u.start))).string)return;if(u=l(n,e(c.line,u.start)),!d)var d=[];d.push(u)}return{list:function(t,e,n,i){var l=[],f=t.string,c=i&&i.globalScope||window;function p(t){0!=t.lastIndexOf(f,0)||function(t,e){if(!Array.prototype.indexOf){for(var r=t.length;r--;)if(t[r]===e)return!0;return!1}return-1!=t.indexOf(e)}(l,t)||l.push(t)}function u(t){"string"==typeof t?r(o,p):t instanceof Array?r(s,p):t instanceof Function&&r(a,p),function(t,e){if(Object.getOwnPropertyNames&&Object.getPrototypeOf)for(var r=t;r;r=Object.getPrototypeOf(r))Object.getOwnPropertyNames(r).forEach(e);else for(var n in t)e(n)}(t,p)}if(e&&e.length){var d,g=e.pop();for(g.type&&0===g.type.indexOf("variable")?(i&&i.additionalContext&&(d=i.additionalContext[g.string]),i&&!1===i.useGlobalScope||(d=d||c[g.string])):"string"==g.type?d="":"atom"==g.type?d=1:"function"==g.type&&(null==c.jQuery||"$"!=g.string&&"jQuery"!=g.string||"function"!=typeof c.jQuery?null!=c._&&"_"==g.string&&"function"==typeof c._&&(d=c._()):d=c.jQuery());null!=d&&e.length;)d=d[e.pop().string];null!=d&&u(d)}else{for(var y=t.state.localVars;y;y=y.next)p(y.name);for(var y=t.state.globalVars;y;y=y.next)p(y.name);i&&!1===i.useGlobalScope||u(c),r(n,p)}return l}(p,d,i,f),from:e(c.line,p.start),to:e(c.line,p.end)}}}function i(t,e){var r=t.getTokenAt(e);return e.ch==r.start+1&&"."==r.string.charAt(0)?(r.end=r.start,r.string=".",r.type="property"):/^\.[\w$_]*$/.test(r.string)&&(r.type="property",r.start++,r.string=r.string.replace(/\./,"")),r}t.registerHelper("hint","javascript",function(t,e){return n(t,l,function(t,e){return t.getTokenAt(e)},e)}),t.registerHelper("hint","coffeescript",function(t,e){return n(t,f,i,e)});var o="charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight toUpperCase toLowerCase split concat match replace search".split(" "),s="length concat join splice push pop shift unshift slice reverse sort indexOf lastIndexOf every some filter forEach map reduce reduceRight ".split(" "),a="prototype apply call bind".split(" "),l="break case catch class const continue debugger default delete do else export extends false finally for function if in import instanceof new null return super switch this throw true try typeof var void while with yield".split(" "),f="and break catch class continue delete do else extends false finally for if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes".split(" ")});
\ No newline at end of file
+!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){var e=t.Pos;function r(t,e){for(var r=0,n=t.length;r<n;++r)e(t[r])}function n(n,i,l,f){var c=n.getCursor(),p=l(n,c);if(!/\b(?:string|comment)\b/.test(p.type)){var u=t.innerMode(n.getMode(),p.state);if("json"!==u.mode.helperType){p.state=u.state,/^[\w$_]*$/.test(p.string)?p.end>c.ch&&(p.end=c.ch,p.string=p.string.slice(0,c.ch-p.start)):p={start:c.ch,end:c.ch,string:"",state:p.state,type:"."==p.string?"property":null};for(var d=p;"property"==d.type;){if("."!=(d=l(n,e(c.line,d.start))).string)return;if(d=l(n,e(c.line,d.start)),!g)var g=[];g.push(d)}return{list:function(t,e,n,i){var l=[],f=t.string,c=i&&i.globalScope||window;function p(t){0!=t.lastIndexOf(f,0)||function(t,e){if(!Array.prototype.indexOf){for(var r=t.length;r--;)if(t[r]===e)return!0;return!1}return-1!=t.indexOf(e)}(l,t)||l.push(t)}function u(t){"string"==typeof t?r(o,p):t instanceof Array?r(s,p):t instanceof Function&&r(a,p),function(t,e){if(Object.getOwnPropertyNames&&Object.getPrototypeOf)for(var r=t;r;r=Object.getPrototypeOf(r))Object.getOwnPropertyNames(r).forEach(e);else for(var n in t)e(n)}(t,p)}if(e&&e.length){var d,g=e.pop();for(g.type&&0===g.type.indexOf("variable")?(i&&i.additionalContext&&(d=i.additionalContext[g.string]),i&&!1===i.useGlobalScope||(d=d||c[g.string])):"string"==g.type?d="":"atom"==g.type?d=1:"function"==g.type&&(null==c.jQuery||"$"!=g.string&&"jQuery"!=g.string||"function"!=typeof c.jQuery?null!=c._&&"_"==g.string&&"function"==typeof c._&&(d=c._()):d=c.jQuery());null!=d&&e.length;)d=d[e.pop().string];null!=d&&u(d)}else{for(var y=t.state.localVars;y;y=y.next)p(y.name);for(var y=t.state.globalVars;y;y=y.next)p(y.name);i&&!1===i.useGlobalScope||u(c),r(n,p)}return l}(p,g,i,f),from:e(c.line,p.start),to:e(c.line,p.end)}}}}function i(t,e){var r=t.getTokenAt(e);return e.ch==r.start+1&&"."==r.string.charAt(0)?(r.end=r.start,r.string=".",r.type="property"):/^\.[\w$_]*$/.test(r.string)&&(r.type="property",r.start++,r.string=r.string.replace(/\./,"")),r}t.registerHelper("hint","javascript",function(t,e){return n(t,l,function(t,e){return t.getTokenAt(e)},e)}),t.registerHelper("hint","coffeescript",function(t,e){return n(t,f,i,e)});var o="charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight toUpperCase toLowerCase split concat match replace search".split(" "),s="length concat join splice push pop shift unshift slice reverse sort indexOf lastIndexOf every some filter forEach map reduce reduceRight ".split(" "),a="prototype apply call bind".split(" "),l="break case catch class const continue debugger default delete do else export extends false finally for function if in import instanceof new null return super switch this throw true try typeof var void while with yield".split(" "),f="and break catch class continue delete do else extends false finally for if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes".split(" ")});
\ No newline at end of file
index 83fd373..0389de6 100644 (file)
@@ -1 +1 @@
-!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";var i="CodeMirror-hint",e="CodeMirror-hint-active";function n(t,i){this.cm=t,this.options=i,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length;var e=this;t.on("cursorActivity",this.activityFunc=function(){e.cursorActivity()})}t.showHint=function(t,i,e){if(!i)return t.showHint(e);e&&e.async&&(i.async=!0);var n={hint:i};if(e)for(var o in e)n[o]=e[o];return t.showHint(n)},t.defineExtension("showHint",function(i){i=function(t,i,e){var n=t.options.hintOptions,o={};for(var s in a)o[s]=a[s];if(n)for(var s in n)void 0!==n[s]&&(o[s]=n[s]);if(e)for(var s in e)void 0!==e[s]&&(o[s]=e[s]);o.hint.resolve&&(o.hint=o.hint.resolve(t,i));return o}(this,this.getCursor("start"),i);var e=this.listSelections();if(!(e.length>1)){if(this.somethingSelected()){if(!i.hint.supportsSelection)return;for(var o=0;o<e.length;o++)if(e[o].head.line!=e[o].anchor.line)return}this.state.completionActive&&this.state.completionActive.close();var s=this.state.completionActive=new n(this,i);s.options.hint&&(t.signal(this,"startCompletion",this),s.update(!0))}});var o=window.requestAnimationFrame||function(t){return setTimeout(t,1e3/60)},s=window.cancelAnimationFrame||clearTimeout;function c(t){return"string"==typeof t?t:t.text}function r(t,i){for(;i&&i!=t;){if("LI"===i.nodeName.toUpperCase()&&i.parentNode==t)return i;i=i.parentNode}}function h(n,o){this.completion=n,this.data=o,this.picked=!1;var s=this,h=n.cm,l=this.hints=document.createElement("ul");l.className="CodeMirror-hints",this.selectedHint=o.selectedHint||0;for(var a=o.list,u=0;u<a.length;++u){var f=l.appendChild(document.createElement("li")),d=a[u],p=i+(u!=this.selectedHint?"":" "+e);null!=d.className&&(p=d.className+" "+p),f.className=p,d.render?d.render(f,o,d):f.appendChild(document.createTextNode(d.displayText||c(d))),f.hintId=u}var m=h.cursorCoords(n.options.alignWithWord?o.from:null),g=m.left,v=m.bottom,y=!0;l.style.left=g+"px",l.style.top=v+"px";var w=window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth),H=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(n.options.container||document.body).appendChild(l);var k=l.getBoundingClientRect(),C=k.bottom-H,b=l.scrollHeight>l.clientHeight+1,x=h.getScrollInfo();if(C>0){var A=k.bottom-k.top;if(m.top-(m.bottom-k.top)-A>0)l.style.top=(v=m.top-A)+"px",y=!1;else if(A>H){l.style.height=H-5+"px",l.style.top=(v=m.bottom-k.top)+"px";var S=h.getCursor();o.from.ch!=S.ch&&(m=h.cursorCoords(S),l.style.left=(g=m.left)+"px",k=l.getBoundingClientRect())}}var T,M=k.right-w;if(M>0&&(k.right-k.left>w&&(l.style.width=w-5+"px",M-=k.right-k.left-w),l.style.left=(g=m.left-M)+"px"),b)for(var N=l.firstChild;N;N=N.nextSibling)N.style.paddingRight=h.display.nativeBarWidth+"px";(h.addKeyMap(this.keyMap=function(t,i){var e={Up:function(){i.moveFocus(-1)},Down:function(){i.moveFocus(1)},PageUp:function(){i.moveFocus(1-i.menuSize(),!0)},PageDown:function(){i.moveFocus(i.menuSize()-1,!0)},Home:function(){i.setFocus(0)},End:function(){i.setFocus(i.length-1)},Enter:i.pick,Tab:i.pick,Esc:i.close},n=t.options.customKeys,o=n?{}:e;function s(t,n){var s;s="string"!=typeof n?function(t){return n(t,i)}:e.hasOwnProperty(n)?e[n]:n,o[t]=s}if(n)for(var c in n)n.hasOwnProperty(c)&&s(c,n[c]);var r=t.options.extraKeys;if(r)for(var c in r)r.hasOwnProperty(c)&&s(c,r[c]);return o}(n,{moveFocus:function(t,i){s.changeActive(s.selectedHint+t,i)},setFocus:function(t){s.changeActive(t)},menuSize:function(){return s.screenAmount()},length:a.length,close:function(){n.close()},pick:function(){s.pick()},data:o})),n.options.closeOnUnfocus)&&(h.on("blur",this.onBlur=function(){T=setTimeout(function(){n.close()},100)}),h.on("focus",this.onFocus=function(){clearTimeout(T)}));return h.on("scroll",this.onScroll=function(){var t=h.getScrollInfo(),i=h.getWrapperElement().getBoundingClientRect(),e=v+x.top-t.top,o=e-(window.pageYOffset||(document.documentElement||document.body).scrollTop);if(y||(o+=l.offsetHeight),o<=i.top||o>=i.bottom)return n.close();l.style.top=e+"px",l.style.left=g+x.left-t.left+"px"}),t.on(l,"dblclick",function(t){var i=r(l,t.target||t.srcElement);i&&null!=i.hintId&&(s.changeActive(i.hintId),s.pick())}),t.on(l,"click",function(t){var i=r(l,t.target||t.srcElement);i&&null!=i.hintId&&(s.changeActive(i.hintId),n.options.completeOnSingleClick&&s.pick())}),t.on(l,"mousedown",function(){setTimeout(function(){h.focus()},20)}),t.signal(o,"select",a[this.selectedHint],l.childNodes[this.selectedHint]),!0}function l(t,i,e,n){if(t.async)t(i,n,e);else{var o=t(i,e);o&&o.then?o.then(n):n(o)}}n.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&t.signal(this.data,"close"),this.widget&&this.widget.close(),t.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(i,e){var n=i.list[e];n.hint?n.hint(this.cm,i,n):this.cm.replaceRange(c(n),n.from||i.from,n.to||i.to,"complete"),t.signal(i,"pick",n),this.close()},cursorActivity:function(){this.debounce&&(s(this.debounce),this.debounce=0);var t=this.cm.getCursor(),i=this.cm.getLine(t.line);if(t.line!=this.startPos.line||i.length-t.ch!=this.startLen-this.startPos.ch||t.ch<this.startPos.ch||this.cm.somethingSelected()||t.ch&&this.options.closeCharacters.test(i.charAt(t.ch-1)))this.close();else{var e=this;this.debounce=o(function(){e.update()}),this.widget&&this.widget.disable()}},update:function(t){if(null!=this.tick){var i=this,e=++this.tick;l(this.options.hint,this.cm,this.options,function(n){i.tick==e&&i.finishUpdate(n,t)})}},finishUpdate:function(i,e){this.data&&t.signal(this.data,"update");var n=this.widget&&this.widget.picked||e&&this.options.completeSingle;this.widget&&this.widget.close(),this.data=i,i&&i.list.length&&(n&&1==i.list.length?this.pick(i,0):(this.widget=new h(this,i),t.signal(i,"shown")))}},h.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null,this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var t=this.completion.cm;this.completion.options.closeOnUnfocus&&(t.off("blur",this.onBlur),t.off("focus",this.onFocus)),t.off("scroll",this.onScroll)}},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var t=this;this.keyMap={Enter:function(){t.picked=!0}},this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(i,n){if(i>=this.data.list.length?i=n?this.data.list.length-1:0:i<0&&(i=n?0:this.data.list.length-1),this.selectedHint!=i){var o=this.hints.childNodes[this.selectedHint];o.className=o.className.replace(" "+e,""),(o=this.hints.childNodes[this.selectedHint=i]).className+=" "+e,o.offsetTop<this.hints.scrollTop?this.hints.scrollTop=o.offsetTop-3:o.offsetTop+o.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=o.offsetTop+o.offsetHeight-this.hints.clientHeight+3),t.signal(this.data,"select",this.data.list[this.selectedHint],o)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},t.registerHelper("hint","auto",{resolve:function(i,e){var n,o=i.getHelpers(e,"hint");if(o.length){var s=function(t,i,e){var n=function(t,i){if(!t.somethingSelected())return i;for(var e=[],n=0;n<i.length;n++)i[n].supportsSelection&&e.push(i[n]);return e}(t,o);!function o(s){if(s==n.length)return i(null);l(n[s],t,e,function(t){t&&t.list.length>0?i(t):o(s+1)})}(0)};return s.async=!0,s.supportsSelection=!0,s}return(n=i.getHelper(i.getCursor(),"hintWords"))?function(i){return t.hint.fromList(i,{words:n})}:t.hint.anyword?function(i,e){return t.hint.anyword(i,e)}:function(){}}}),t.registerHelper("hint","fromList",function(i,e){var n=i.getCursor(),o=i.getTokenAt(n),s=t.Pos(n.line,o.end);if(o.string&&/\w/.test(o.string[o.string.length-1]))var c=o.string,r=t.Pos(n.line,o.start);else c="",r=s;for(var h=[],l=0;l<e.words.length;l++){var a=e.words[l];a.slice(0,c.length)==c&&h.push(a)}if(h.length)return{list:h,from:r,to:s}}),t.commands.autocomplete=t.showHint;var a={hint:t.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnUnfocus:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null};t.defineOption("hintOptions",null)});
\ No newline at end of file
+!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";var i="CodeMirror-hint",e="CodeMirror-hint-active";function n(t,i){this.cm=t,this.options=i,this.widget=null,this.debounce=0,this.tick=0,this.startPos=this.cm.getCursor("start"),this.startLen=this.cm.getLine(this.startPos.line).length-this.cm.getSelection().length;var e=this;t.on("cursorActivity",this.activityFunc=function(){e.cursorActivity()})}t.showHint=function(t,i,e){if(!i)return t.showHint(e);e&&e.async&&(i.async=!0);var n={hint:i};if(e)for(var o in e)n[o]=e[o];return t.showHint(n)},t.defineExtension("showHint",function(i){i=function(t,i,e){var n=t.options.hintOptions,o={};for(var s in a)o[s]=a[s];if(n)for(var s in n)void 0!==n[s]&&(o[s]=n[s]);if(e)for(var s in e)void 0!==e[s]&&(o[s]=e[s]);o.hint.resolve&&(o.hint=o.hint.resolve(t,i));return o}(this,this.getCursor("start"),i);var e=this.listSelections();if(!(e.length>1)){if(this.somethingSelected()){if(!i.hint.supportsSelection)return;for(var o=0;o<e.length;o++)if(e[o].head.line!=e[o].anchor.line)return}this.state.completionActive&&this.state.completionActive.close();var s=this.state.completionActive=new n(this,i);s.options.hint&&(t.signal(this,"startCompletion",this),s.update(!0))}});var o=window.requestAnimationFrame||function(t){return setTimeout(t,1e3/60)},s=window.cancelAnimationFrame||clearTimeout;function c(t){return"string"==typeof t?t:t.text}function r(t,i){for(;i&&i!=t;){if("LI"===i.nodeName.toUpperCase()&&i.parentNode==t)return i;i=i.parentNode}}function h(n,o){this.completion=n,this.data=o,this.picked=!1;var s=this,h=n.cm,l=this.hints=document.createElement("ul"),a=n.cm.options.theme;l.className="CodeMirror-hints "+a,this.selectedHint=o.selectedHint||0;for(var u=o.list,f=0;f<u.length;++f){var d=l.appendChild(document.createElement("li")),p=u[f],m=i+(f!=this.selectedHint?"":" "+e);null!=p.className&&(m=p.className+" "+m),d.className=m,p.render?p.render(d,o,p):d.appendChild(document.createTextNode(p.displayText||c(p))),d.hintId=f}var g=h.cursorCoords(n.options.alignWithWord?o.from:null),v=g.left,y=g.bottom,w=!0;l.style.left=v+"px",l.style.top=y+"px";var H=window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth),k=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(n.options.container||document.body).appendChild(l);var C=l.getBoundingClientRect(),b=C.bottom-k,x=l.scrollHeight>l.clientHeight+1,A=h.getScrollInfo();if(b>0){var S=C.bottom-C.top;if(g.top-(g.bottom-C.top)-S>0)l.style.top=(y=g.top-S)+"px",w=!1;else if(S>k){l.style.height=k-5+"px",l.style.top=(y=g.bottom-C.top)+"px";var T=h.getCursor();o.from.ch!=T.ch&&(g=h.cursorCoords(T),l.style.left=(v=g.left)+"px",C=l.getBoundingClientRect())}}var M,N=C.right-H;if(N>0&&(C.right-C.left>H&&(l.style.width=H-5+"px",N-=C.right-C.left-H),l.style.left=(v=g.left-N)+"px"),x)for(var F=l.firstChild;F;F=F.nextSibling)F.style.paddingRight=h.display.nativeBarWidth+"px";(h.addKeyMap(this.keyMap=function(t,i){var e={Up:function(){i.moveFocus(-1)},Down:function(){i.moveFocus(1)},PageUp:function(){i.moveFocus(1-i.menuSize(),!0)},PageDown:function(){i.moveFocus(i.menuSize()-1,!0)},Home:function(){i.setFocus(0)},End:function(){i.setFocus(i.length-1)},Enter:i.pick,Tab:i.pick,Esc:i.close},n=t.options.customKeys,o=n?{}:e;function s(t,n){var s;s="string"!=typeof n?function(t){return n(t,i)}:e.hasOwnProperty(n)?e[n]:n,o[t]=s}if(n)for(var c in n)n.hasOwnProperty(c)&&s(c,n[c]);var r=t.options.extraKeys;if(r)for(var c in r)r.hasOwnProperty(c)&&s(c,r[c]);return o}(n,{moveFocus:function(t,i){s.changeActive(s.selectedHint+t,i)},setFocus:function(t){s.changeActive(t)},menuSize:function(){return s.screenAmount()},length:u.length,close:function(){n.close()},pick:function(){s.pick()},data:o})),n.options.closeOnUnfocus)&&(h.on("blur",this.onBlur=function(){M=setTimeout(function(){n.close()},100)}),h.on("focus",this.onFocus=function(){clearTimeout(M)}));return h.on("scroll",this.onScroll=function(){var t=h.getScrollInfo(),i=h.getWrapperElement().getBoundingClientRect(),e=y+A.top-t.top,o=e-(window.pageYOffset||(document.documentElement||document.body).scrollTop);if(w||(o+=l.offsetHeight),o<=i.top||o>=i.bottom)return n.close();l.style.top=e+"px",l.style.left=v+A.left-t.left+"px"}),t.on(l,"dblclick",function(t){var i=r(l,t.target||t.srcElement);i&&null!=i.hintId&&(s.changeActive(i.hintId),s.pick())}),t.on(l,"click",function(t){var i=r(l,t.target||t.srcElement);i&&null!=i.hintId&&(s.changeActive(i.hintId),n.options.completeOnSingleClick&&s.pick())}),t.on(l,"mousedown",function(){setTimeout(function(){h.focus()},20)}),t.signal(o,"select",u[this.selectedHint],l.childNodes[this.selectedHint]),!0}function l(t,i,e,n){if(t.async)t(i,n,e);else{var o=t(i,e);o&&o.then?o.then(n):n(o)}}n.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&t.signal(this.data,"close"),this.widget&&this.widget.close(),t.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(i,e){var n=i.list[e];n.hint?n.hint(this.cm,i,n):this.cm.replaceRange(c(n),n.from||i.from,n.to||i.to,"complete"),t.signal(i,"pick",n),this.close()},cursorActivity:function(){this.debounce&&(s(this.debounce),this.debounce=0);var t=this.cm.getCursor(),i=this.cm.getLine(t.line);if(t.line!=this.startPos.line||i.length-t.ch!=this.startLen-this.startPos.ch||t.ch<this.startPos.ch||this.cm.somethingSelected()||!t.ch||this.options.closeCharacters.test(i.charAt(t.ch-1)))this.close();else{var e=this;this.debounce=o(function(){e.update()}),this.widget&&this.widget.disable()}},update:function(t){if(null!=this.tick){var i=this,e=++this.tick;l(this.options.hint,this.cm,this.options,function(n){i.tick==e&&i.finishUpdate(n,t)})}},finishUpdate:function(i,e){this.data&&t.signal(this.data,"update");var n=this.widget&&this.widget.picked||e&&this.options.completeSingle;this.widget&&this.widget.close(),this.data=i,i&&i.list.length&&(n&&1==i.list.length?this.pick(i,0):(this.widget=new h(this,i),t.signal(i,"shown")))}},h.prototype={close:function(){if(this.completion.widget==this){this.completion.widget=null,this.hints.parentNode.removeChild(this.hints),this.completion.cm.removeKeyMap(this.keyMap);var t=this.completion.cm;this.completion.options.closeOnUnfocus&&(t.off("blur",this.onBlur),t.off("focus",this.onFocus)),t.off("scroll",this.onScroll)}},disable:function(){this.completion.cm.removeKeyMap(this.keyMap);var t=this;this.keyMap={Enter:function(){t.picked=!0}},this.completion.cm.addKeyMap(this.keyMap)},pick:function(){this.completion.pick(this.data,this.selectedHint)},changeActive:function(i,n){if(i>=this.data.list.length?i=n?this.data.list.length-1:0:i<0&&(i=n?0:this.data.list.length-1),this.selectedHint!=i){var o=this.hints.childNodes[this.selectedHint];o&&(o.className=o.className.replace(" "+e,"")),(o=this.hints.childNodes[this.selectedHint=i]).className+=" "+e,o.offsetTop<this.hints.scrollTop?this.hints.scrollTop=o.offsetTop-3:o.offsetTop+o.offsetHeight>this.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=o.offsetTop+o.offsetHeight-this.hints.clientHeight+3),t.signal(this.data,"select",this.data.list[this.selectedHint],o)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},t.registerHelper("hint","auto",{resolve:function(i,e){var n,o=i.getHelpers(e,"hint");if(o.length){var s=function(t,i,e){var n=function(t,i){if(!t.somethingSelected())return i;for(var e=[],n=0;n<i.length;n++)i[n].supportsSelection&&e.push(i[n]);return e}(t,o);!function o(s){if(s==n.length)return i(null);l(n[s],t,e,function(t){t&&t.list.length>0?i(t):o(s+1)})}(0)};return s.async=!0,s.supportsSelection=!0,s}return(n=i.getHelper(i.getCursor(),"hintWords"))?function(i){return t.hint.fromList(i,{words:n})}:t.hint.anyword?function(i,e){return t.hint.anyword(i,e)}:function(){}}}),t.registerHelper("hint","fromList",function(i,e){var n,o=i.getCursor(),s=i.getTokenAt(o),c=t.Pos(o.line,s.start),r=o;s.start<o.ch&&/\w/.test(s.string.charAt(o.ch-s.start-1))?n=s.string.substr(0,o.ch-s.start):(n="",c=o);for(var h=[],l=0;l<e.words.length;l++){var a=e.words[l];a.slice(0,n.length)==n&&h.push(a)}if(h.length)return{list:h,from:c,to:r}}),t.commands.autocomplete=t.showHint;var a={hint:t.hint.auto,completeSingle:!0,alignWithWord:!0,closeCharacters:/[\s()\[\]{};:>,]/,closeOnUnfocus:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null};t.defineOption("hintOptions",null)});
\ No newline at end of file
index c862786..db85bb9 100644 (file)
@@ -1 +1 @@
-!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("../../mode/sql/sql")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../mode/sql/sql"],t):t(CodeMirror)}(function(t){"use strict";var e,r,n,o,i={QUERY_DIV:";",ALIAS_KEYWORD:"AS"},s=t.Pos,a=t.cmpPos;function u(t){return"[object Array]"==Object.prototype.toString.call(t)}function l(t){return"string"==typeof t?t:t.text}function f(t,e){return u(e)&&(e={columns:e}),e.text||(e.text=t),e}function c(t){return e[t.toUpperCase()]}function p(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function g(t,e){var r=t.length,n=l(e).substr(0,r);return t.toUpperCase()===n.toUpperCase()}function d(t,e,r,n){if(u(r))for(var o=0;o<r.length;o++)g(e,r[o])&&t.push(n(r[o]));else for(var i in r)if(r.hasOwnProperty(i)){var s=r[i];g(e,s=s&&!0!==s?s.displayText?{text:s.text,displayText:s.displayText}:s.text:i)&&t.push(n(s))}}function h(t){"."==t.charAt(0)&&(t=t.substr(1));for(var e=t.split(o+o),r=0;r<e.length;r++)e[r]=e[r].replace(new RegExp(o,"g"),"");return e.join(o)}function v(t){for(var e=l(t).split("."),r=0;r<e.length;r++)e[r]=o+e[r].replace(new RegExp(o,"g"),o+o)+o;var n=e.join(".");return"string"==typeof t?n:((t=p(t)).text=n,t)}function x(t,e){for(var r=t.split(/\s+/),n=0;n<r.length;n++)r[n]&&e(r[n].replace(/[,;]/g,""))}function m(t,e){for(var r=e.doc,n=r.getValue(),o=t.toUpperCase(),u="",l="",f=[],p={start:s(0,0),end:s(e.lastLine(),e.getLineHandle(e.lastLine()).length)},g=n.indexOf(i.QUERY_DIV);-1!=g;)f.push(r.posFromIndex(g)),g=n.indexOf(i.QUERY_DIV,g+1);f.unshift(s(0,0)),f.push(s(e.lastLine(),e.getLineHandle(e.lastLine()).text.length));for(var d=null,h=e.getCursor(),v=0;v<f.length;v++){if((null==d||a(h,d)>0)&&a(h,f[v])<=0){p={start:d,end:f[v]};break}d=f[v]}if(p.start){var m=r.getRange(p.start,p.end,!1);for(v=0;v<m.length;v++){if(x(m[v],function(t){var e=t.toUpperCase();e===o&&c(u)&&(l=u),e!==i.ALIAS_KEYWORD&&(u=t)}),l)break}}return l}t.registerHelper("hint","sql",function(i,a){e=function(t){var e={};if(u(t))for(var r=t.length-1;r>=0;r--){var n=t[r];e[l(n).toUpperCase()]=f(l(n),n)}else if(t)for(var o in t)e[o.toUpperCase()]=f(o,t[o]);return e}(a&&a.tables);var g,x,y=a&&a.defaultTable,A=a&&a.disableKeywords;r=y&&c(y),"sql"===(g=i.doc.modeOption)&&(g="text/x-sql"),n=t.resolveMode(g).keywords,"sql"===(x=i.doc.modeOption)&&(x="text/x-sql"),o=t.resolveMode(x).identifierQuote||"`",y&&!r&&(r=m(y,i)),(r=r||[]).columns&&(r=r.columns);var b,q,C,U=i.getCursor(),O=[],j=i.getTokenAt(U);return j.end>U.ch&&(j.end=U.ch,j.string=j.string.slice(0,U.ch-j.start)),j.string.match(/^[.`"\w@]\w*$/)?(C=j.string,b=j.start,q=j.end):(b=q=U.ch,C=""),"."==C.charAt(0)||C.charAt(0)==o?b=function(t,n,i,a){for(var u=!1,l=[],f=n.start,g=!0;g;)g="."==n.string.charAt(0),u=u||n.string.charAt(0)==o,f=n.start,l.unshift(h(n.string)),"."==(n=a.getTokenAt(s(t.line,n.start))).string&&(g=!0,n=a.getTokenAt(s(t.line,n.start)));var x=l.join(".");d(i,x,e,function(t){return u?v(t):t}),d(i,x,r,function(t){return u?v(t):t}),x=l.pop();var y=l.join("."),A=!1,b=y;if(!c(y)){var q=y;(y=m(y,a))!==q&&(A=!0)}var C=c(y);return C&&C.columns&&(C=C.columns),C&&d(i,x,C,function(t){var e=y;return 1==A&&(e=b),"string"==typeof t?t=e+"."+t:(t=p(t)).text=e+"."+t.text,u?v(t):t}),f}(U,j,O,i):(d(O,C,r,function(t){return t}),d(O,C,e,function(t){return t}),A||d(O,C,n,function(t){return t.toUpperCase()})),{list:O,from:s(U.line,b),to:s(U.line,q)}})});
\ No newline at end of file
+!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("../../mode/sql/sql")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../../mode/sql/sql"],t):t(CodeMirror)}(function(t){"use strict";var e,r,n,o,i={QUERY_DIV:";",ALIAS_KEYWORD:"AS"},s=t.Pos,a=t.cmpPos;function l(t){return"[object Array]"==Object.prototype.toString.call(t)}function u(t){return"string"==typeof t?t:t.text}function f(t,e){return l(e)&&(e={columns:e}),e.text||(e.text=t),e}function c(t){return e[t.toUpperCase()]}function p(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}function d(t,e){var r=t.length,n=u(e).substr(0,r);return t.toUpperCase()===n.toUpperCase()}function g(t,e,r,n){if(l(r))for(var o=0;o<r.length;o++)d(e,r[o])&&t.push(n(r[o]));else for(var i in r)if(r.hasOwnProperty(i)){var s=r[i];d(e,s=s&&!0!==s?s.displayText?{text:s.text,displayText:s.displayText}:s.text:i)&&t.push(n(s))}}function h(t){"."==t.charAt(0)&&(t=t.substr(1));for(var e=t.split(o+o),r=0;r<e.length;r++)e[r]=e[r].replace(new RegExp(o,"g"),"");return e.join(o)}function v(t){for(var e=u(t).split("."),r=0;r<e.length;r++)e[r]=o+e[r].replace(new RegExp(o,"g"),o+o)+o;var n=e.join(".");return"string"==typeof t?n:((t=p(t)).text=n,t)}function x(t,e){for(var r=t.split(/\s+/),n=0;n<r.length;n++)r[n]&&e(r[n].replace(/[,;]/g,""))}function m(t,e){for(var r=e.doc,n=r.getValue(),o=t.toUpperCase(),l="",u="",f=[],p={start:s(0,0),end:s(e.lastLine(),e.getLineHandle(e.lastLine()).length)},d=n.indexOf(i.QUERY_DIV);-1!=d;)f.push(r.posFromIndex(d)),d=n.indexOf(i.QUERY_DIV,d+1);f.unshift(s(0,0)),f.push(s(e.lastLine(),e.getLineHandle(e.lastLine()).text.length));for(var g=null,h=e.getCursor(),v=0;v<f.length;v++){if((null==g||a(h,g)>0)&&a(h,f[v])<=0){p={start:g,end:f[v]};break}g=f[v]}if(p.start){var m=r.getRange(p.start,p.end,!1);for(v=0;v<m.length;v++){if(x(m[v],function(t){var e=t.toUpperCase();e===o&&c(l)&&(u=l),e!==i.ALIAS_KEYWORD&&(l=t)}),u)break}}return u}t.registerHelper("hint","sql",function(i,a){e=function(t){var e={};if(l(t))for(var r=t.length-1;r>=0;r--){var n=t[r];e[u(n).toUpperCase()]=f(u(n),n)}else if(t)for(var o in t)e[o.toUpperCase()]=f(o,t[o]);return e}(a&&a.tables);var d,x,b=a&&a.defaultTable,y=a&&a.disableKeywords;r=b&&c(b),"sql"===(d=i.doc.modeOption)&&(d="text/x-sql"),n=t.resolveMode(d).keywords,"sql"===(x=i.doc.modeOption)&&(x="text/x-sql"),o=t.resolveMode(x).identifierQuote||"`",b&&!r&&(r=m(b,i)),(r=r||[]).columns&&(r=r.columns);var C,A,q,U=i.getCursor(),j=[],w=i.getTokenAt(U);return w.end>U.ch&&(w.end=U.ch,w.string=w.string.slice(0,U.ch-w.start)),w.string.match(/^[.`"\w@]\w*$/)?(q=w.string,C=w.start,A=w.end):(C=A=U.ch,q=""),"."==q.charAt(0)||q.charAt(0)==o?C=function(t,n,i,a){for(var l=!1,u=[],f=n.start,d=!0;d;)d="."==n.string.charAt(0),l=l||n.string.charAt(0)==o,f=n.start,u.unshift(h(n.string)),"."==(n=a.getTokenAt(s(t.line,n.start))).string&&(d=!0,n=a.getTokenAt(s(t.line,n.start)));var x=u.join(".");g(i,x,e,function(t){return l?v(t):t}),g(i,x,r,function(t){return l?v(t):t}),x=u.pop();var b=u.join("."),y=!1,C=b;if(!c(b)){var A=b;(b=m(b,a))!==A&&(y=!0)}var q=c(b);return q&&q.columns&&(q=q.columns),q&&g(i,x,q,function(t){var e=b;return 1==y&&(e=C),"string"==typeof t?t=e+"."+t:(t=p(t)).text=e+"."+t.text,l?v(t):t}),f}(U,w,j,i):(g(j,q,r,function(t){return{text:t,className:"CodeMirror-hint-table CodeMirror-hint-default-table"}}),g(j,q,e,function(t){return"object"==typeof t?t.className="CodeMirror-hint-table":t={text:t,className:"CodeMirror-hint-table"},t}),y||g(j,q,n,function(t){return{text:t.toUpperCase(),className:"CodeMirror-hint-keyword"}})),{list:j,from:s(U.line,C),to:s(U.line,A)}})});
\ No newline at end of file
index 95f8045..6faaeb7 100644 (file)
@@ -1 +1 @@
-!function(o){"object"==typeof exports&&"object"==typeof module?o(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)}(function(o){"use strict";o.registerHelper("lint","json",function(n){var r=[];if(!window.jsonlint)return window.console&&window.console.error("Error: window.jsonlint not defined, CodeMirror JSON linting cannot run."),r;jsonlint.parseError=function(n,e){var i=e.loc;r.push({from:o.Pos(i.first_line-1,i.first_column),to:o.Pos(i.last_line-1,i.last_column),message:n})};try{jsonlint.parse(n)}catch(o){}return r})});
\ No newline at end of file
+!function(o){"object"==typeof exports&&"object"==typeof module?o(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],o):o(CodeMirror)}(function(o){"use strict";o.registerHelper("lint","json",function(n){var r=[];if(!window.jsonlint)return window.console&&window.console.error("Error: window.jsonlint not defined, CodeMirror JSON linting cannot run."),r;var e=window.jsonlint.parser||window.jsonlint;e.parseError=function(n,e){var i=e.loc;r.push({from:o.Pos(i.first_line-1,i.first_column),to:o.Pos(i.last_line-1,i.last_column),message:n})};try{e.parse(n)}catch(o){}return r})});
\ No newline at end of file
index bda3d9f..dadd7f5 100644 (file)
   color: #555;
   line-height: 1;
 }
+.CodeMirror-merge-scrolllock:after {
+  content: "\21db\00a0\00a0\21da";
+}
+.CodeMirror-merge-scrolllock.CodeMirror-merge-scrolllock-enabled:after {
+  content: "\21db\21da";
+}
 
 .CodeMirror-merge-copybuttons-left, .CodeMirror-merge-copybuttons-right {
   position: absolute;
index e5a586a..c75e3d8 100644 (file)
@@ -1 +1 @@
-!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","diff_match_patch"],e):e(CodeMirror)}(function(e){"use strict";var t=e.Pos,i="http://www.w3.org/2000/svg";function r(e,t){this.mv=e,this.type=t,this.classes="left"==t?{chunk:"CodeMirror-merge-l-chunk",start:"CodeMirror-merge-l-chunk-start",end:"CodeMirror-merge-l-chunk-end",insert:"CodeMirror-merge-l-inserted",del:"CodeMirror-merge-l-deleted",connect:"CodeMirror-merge-l-connect"}:{chunk:"CodeMirror-merge-r-chunk",start:"CodeMirror-merge-r-chunk-start",end:"CodeMirror-merge-r-chunk-end",insert:"CodeMirror-merge-r-inserted",del:"CodeMirror-merge-r-deleted",connect:"CodeMirror-merge-r-connect"}}function n(t){t.diffOutOfDate&&(t.diff=L(t.orig.getValue(),t.edit.getValue(),t.mv.options.ignoreWhitespace),t.chunks=D(t.diff),t.diffOutOfDate=!1,e.signal(t.edit,"updateDiff",t.diff))}r.prototype={constructor:r,init:function(t,i,r){this.edit=this.mv.edit,(this.edit.state.diffViews||(this.edit.state.diffViews=[])).push(this),this.orig=e(t,W({value:i,readOnly:!this.mv.options.allowEditingOriginals},W(r))),"align"==this.mv.options.connect&&(this.edit.state.trackAlignable||(this.edit.state.trackAlignable=new j(this.edit)),this.orig.state.trackAlignable=new j(this.orig)),this.orig.state.diffViews=[this];var n=r.chunkClassLocation||"background";"[object Array]"!=Object.prototype.toString.call(n)&&(n=[n]),this.classes.classLocation=n,this.diff=L(M(i),M(r.value),this.mv.options.ignoreWhitespace),this.chunks=D(this.diff),this.diffOutOfDate=this.dealigned=!1,this.needsScrollSync=null,this.showDifferences=!1!==r.showDifferences},registerEvents:function(t){var i,r;this.forceUpdate=function(t){var i,r={from:0,to:0,marked:[]},a={from:0,to:0,marked:[]},s=!1;function c(e){o=!0,s=!1,"full"==e&&(t.svg&&N(t.svg),t.copyButtons&&N(t.copyButtons),h(t.edit,r.marked,t.classes),h(t.orig,a.marked,t.classes),r.from=r.to=a.from=a.to=0),n(t),t.showDifferences&&(f(t.edit,t.diff,r,DIFF_INSERT,t.classes),f(t.orig,t.diff,a,DIFF_DELETE,t.classes)),"align"==t.mv.options.connect&&k(t),u(t),null!=t.needsScrollSync&&l(t,t.needsScrollSync),o=!1}function g(e){o||(t.dealigned=!0,d(e))}function d(e){o||s||(clearTimeout(i),!0===e&&(s=!0),i=setTimeout(c,!0===e?20:250))}function m(e,i){t.diffOutOfDate||(t.diffOutOfDate=!0,r.from=r.to=a.from=a.to=0),g(i.text.length-1!=i.to.line-i.from.line)}function v(){t.diffOutOfDate=!0,t.dealigned=!0,c("full")}t.edit.on("change",m),t.orig.on("change",m),t.edit.on("swapDoc",v),t.orig.on("swapDoc",v),"align"==t.mv.options.connect&&(e.on(t.edit.state.trackAlignable,"realign",g),e.on(t.orig.state.trackAlignable,"realign",g));return t.edit.on("viewportChange",function(){d(!1)}),t.orig.on("viewportChange",function(){d(!1)}),c(),c}(this),s(this,!0,!1),r=t,(i=this).edit.on("scroll",function(){l(i,!0)&&u(i)}),i.orig.on("scroll",function(){l(i,!1)&&u(i),r&&l(r,!0)&&u(r)})},setShowDifferences:function(e){(e=!1!==e)!=this.showDifferences&&(this.showDifferences=e,this.forceUpdate("full"))}};var o=!1;function l(e,t){if(e.diffOutOfDate)return e.lockScroll&&null==e.needsScrollSync&&(e.needsScrollSync=t),!1;if(e.needsScrollSync=null,!e.lockScroll)return!0;var i,r,n=+new Date;if(t?(i=e.edit,r=e.orig):(i=e.orig,r=e.edit),i.state.scrollSetBy==e&&(i.state.scrollSetAt||0)+250>n)return!1;var o=i.getScrollInfo();if("align"==e.mv.options.connect)v=o.top;else{var l,s,c=.5*o.clientHeight,h=o.top+c,f=i.lineAtHeight(h,"local"),g=function(e,t,i){for(var r,n,o,l,a=0;a<e.length;a++){var s=e[a],c=i?s.editFrom:s.origFrom,h=i?s.editTo:s.origTo;null==n&&(c>t?(n=s.editFrom,l=s.origFrom):h>t&&(n=s.editTo,l=s.origTo)),h<=t?(r=s.editTo,o=s.origTo):c<=t&&(r=s.editFrom,o=s.origFrom)}return{edit:{before:r,after:n},orig:{before:o,after:l}}}(e.chunks,f,t),d=a(i,t?g.edit:g.orig),u=a(r,t?g.orig:g.edit),m=(h-d.top)/(d.bot-d.top),v=u.top-c+m*(u.bot-u.top);if(v>o.top&&(s=o.top/c)<1)v=v*s+o.top*(1-s);else if((l=o.height-o.clientHeight-o.top)<c){var p=r.getScrollInfo();p.height-p.clientHeight-v>l&&(s=l/c)<1&&(v=v*s+(p.height-p.clientHeight-l)*(1-s))}}return r.scrollTo(o.left,v),r.state.scrollSetAt=n,r.state.scrollSetBy=e,!0}function a(e,t){var i=t.after;return null==i&&(i=e.lastLine()+1),{top:e.heightAtLine(t.before||0,"local"),bot:e.heightAtLine(i,"local")}}function s(e,t,i){e.lockScroll=t,t&&0!=i&&l(e,DIFF_INSERT)&&u(e),e.lockButton.innerHTML=t?"⇛⇚":"⇛&nbsp;&nbsp;⇚"}function c(e,t,i){for(var r=i.classLocation,n=0;n<r.length;n++)e.removeLineClass(t,r[n],i.chunk),e.removeLineClass(t,r[n],i.start),e.removeLineClass(t,r[n],i.end)}function h(t,i,r){for(var n=0;n<i.length;++n){var o=i[n];o instanceof e.TextMarker?o.clear():o.parent&&c(t,o,r)}i.length=0}function f(e,t,i,r,n){var o=e.getViewport();e.operation(function(){i.from==i.to||o.from-i.to>20||i.from-o.to>20?(h(e,i.marked,n),d(e,t,r,i.marked,o.from,o.to,n),i.from=o.from,i.to=o.to):(o.from<i.from&&(d(e,t,r,i.marked,o.from,i.from,n),i.from=o.from),o.to>i.to&&(d(e,t,r,i.marked,i.to,o.to,n),i.to=o.to))})}function g(e,t,i,r,n,o){for(var l=i.classLocation,a=e.getLineHandle(t),s=0;s<l.length;s++)r&&e.addLineClass(a,l[s],i.chunk),n&&e.addLineClass(a,l[s],i.start),o&&e.addLineClass(a,l[s],i.end);return a}function d(e,i,r,n,o,l,a){var s=t(0,0),c=t(o,0),h=e.clipPos(t(l-1)),f=r==DIFF_DELETE?a.del:a.insert;function d(t,i){for(var r=Math.max(o,t),s=Math.min(l,i),c=r;c<s;++c)n.push(g(e,c,a,!0,c==t,c==i-1));t==i&&r==i&&s==i&&(r?n.push(g(e,r-1,a,!1,!1,!0)):n.push(g(e,r,a,!1,!0,!1)))}for(var u,m,v,p,k,C,b=0,w=!1,T=0;T<i.length;++T){var y=i[T],F=y[0],S=y[1];if(F==DIFF_EQUAL){var M=s.line+(E(i,T)?0:1);V(s,S);var L=s.line+(A(i,T)?1:0);L>M&&(w&&(d(b,M),w=!1),b=L)}else if(w=!0,F==r){var D=V(s,S,!0),O=(C=s,((k=c).line-C.line||k.ch-C.ch)>0?k:C),x=(p=D,((v=h).line-p.line||v.ch-p.ch)<0?v:p);m=x,((u=O).line!=m.line||u.ch!=m.ch)&&n.push(e.markText(O,x,{className:f})),s=D}}w&&d(b,s.line+1)}function u(e){if(e.showDifferences){if(e.svg){N(e.svg);var t=e.gap.offsetWidth;R(e.svg,"width",t,"height",e.gap.offsetHeight)}e.copyButtons&&N(e.copyButtons);for(var i=e.edit.getViewport(),r=e.orig.getViewport(),n=e.mv.wrap.getBoundingClientRect().top,o=n-e.edit.getScrollerElement().getBoundingClientRect().top+e.edit.getScrollInfo().top,l=n-e.orig.getScrollerElement().getBoundingClientRect().top+e.orig.getScrollInfo().top,a=0;a<e.chunks.length;a++){var s=e.chunks[a];s.editFrom<=i.to&&s.editTo>=i.from&&s.origFrom<=r.to&&s.origTo>=r.from&&w(e,s,l,o,t)}}}function m(e,t){for(var i=0,r=0,n=0;n<t.length;n++){var o=t[n];if(o.editTo>e&&o.editFrom<=e)return null;if(o.editFrom>e)break;i=o.editTo,r=o.origTo}return r+(e-i)}function v(e,t,i){for(var r=e.state.trackAlignable,n=e.firstLine(),o=0,l=[],a=0;;a++){for(var s=t[a],c=s?i?s.origFrom:s.editFrom:1e9;o<r.alignable.length;o+=2){var h=r.alignable[o]+1;if(!(h<=n)){if(!(h<=c))break;l.push(h)}}if(!s)break;l.push(n=i?s.origTo:s.editTo)}return l}function p(e,t,i,r){var n=0,o=0,l=0,a=0;e:for(;;n++){var s=e[n],c=t[o];if(!s&&null==c)break;for(var h=s?s[0]:1e9,f=null==c?1e9:c;l<i.length;){var g=i[l];if(g.origFrom<=f&&g.origTo>f){o++,n--;continue e}if(g.editTo>h){if(g.editFrom<=h)continue e;break}a+=g.origTo-g.origFrom-(g.editTo-g.editFrom),l++}if(h==f-a)s[r]=f,o++;else if(h<f-a)s[r]=h+a;else{var d=[f-a,null,null];d[r]=f,e.splice(n,0,d),o++}}}function k(e,t){if(e.dealigned||t){if(!e.orig.curOp)return e.orig.operation(function(){k(e,t)});e.dealigned=!1;var i=e.mv.left==e?e.mv.right:e.mv.left;i&&(n(i),i.dealigned=!1);for(var r=function(e,t){var i=v(e.edit,e.chunks,!1),r=[];if(t)for(var n=0,o=0;n<t.chunks.length;n++){for(var l=t.chunks[n].editTo;o<i.length&&i[o]<l;)o++;o!=i.length&&i[o]==l||i.splice(o++,0,l)}for(n=0;n<i.length;n++)r.push([i[n],null,null]);return p(r,v(e.orig,e.chunks,!0),e.chunks,1),t&&p(r,v(t.orig,t.chunks,!0),t.chunks,2),r}(e,i),o=e.mv.aligners,l=0;l<o.length;l++)o[l].clear();o.length=0;var a=[e.edit,e.orig],s=[];i&&a.push(i.orig);for(l=0;l<a.length;l++)s.push(a[l].getScrollInfo().top);for(var c=0;c<r.length;c++)C(a,r[c],o);for(l=0;l<a.length;l++)a[l].scrollTo(null,s[l])}}function C(e,t,i){for(var r=0,n=[],o=0;o<e.length;o++)if(null!=t[o]){var l=e[o].heightAtLine(t[o],"local");n[o]=l,r=Math.max(r,l)}for(o=0;o<e.length;o++)if(null!=t[o]){var a=r-n[o];a>1&&i.push(b(e[o],t[o],a))}}function b(e,t,i){var r=!0;t>e.lastLine()&&(t--,r=!1);var n=document.createElement("div");return n.className="CodeMirror-merge-spacer",n.style.height=i+"px",n.style.minWidth="1px",e.addLineWidget(t,n,{height:i,above:r,mergeSpacer:!0,handleMouseEvents:!0})}function w(e,t,r,n,o){var l="left"==e.type,a=e.orig.heightAtLine(t.origFrom,"local",!0)-r;if(e.svg){var s=a,c=e.edit.heightAtLine(t.editFrom,"local",!0)-n;if(l){var h=s;s=c,c=h}var f=e.orig.heightAtLine(t.origTo,"local",!0)-r,g=e.edit.heightAtLine(t.editTo,"local",!0)-n;if(l){h=f;f=g,g=h}var d=" C "+o/2+" "+c+" "+o/2+" "+s+" "+(o+2)+" "+s,u=" C "+o/2+" "+f+" "+o/2+" "+g+" -1 "+g;R(e.svg.appendChild(document.createElementNS(i,"path")),"d","M -1 "+c+d+" L "+(o+2)+" "+f+u+" z","class",e.classes.connect)}if(e.copyButtons){var m=e.copyButtons.appendChild(I("div","left"==e.type?"⇝":"⇜","CodeMirror-merge-copy")),v=e.mv.options.allowEditingOriginals;if(m.title=v?"Push to left":"Revert chunk",m.chunk=t,m.style.top=(t.origTo>t.origFrom?a:e.edit.heightAtLine(t.editFrom,"local")-n)+"px",v){var p=e.edit.heightAtLine(t.editFrom,"local")-n,k=e.copyButtons.appendChild(I("div","right"==e.type?"⇝":"⇜","CodeMirror-merge-copy-reverse"));k.title="Push to right",k.chunk={editFrom:t.origFrom,editTo:t.origTo,origFrom:t.editFrom,origTo:t.editTo},k.style.top=p+"px","right"==e.type?k.style.left="2px":k.style.right="2px"}}}function T(e,i,r,n){if(!e.diffOutOfDate){var o=n.origTo>r.lastLine()?t(n.origFrom-1):t(n.origFrom,0),l=t(n.origTo,0),a=n.editTo>i.lastLine()?t(n.editFrom-1):t(n.editFrom,0),s=t(n.editTo,0),c=e.mv.options.revertChunk;c?c(e.mv,r,o,l,i,a,s):i.replaceRange(r.getRange(o,l),a,s)}}var y,F=e.MergeView=function(t,i){if(!(this instanceof F))return new F(t,i);this.options=i;var n=i.origLeft,o=null==i.origRight?i.orig:i.origRight,l=null!=n,a=null!=o,s=1+(l?1:0)+(a?1:0),c=[],h=this.left=null,f=this.right=null,g=this;if(l){h=this.left=new r(this,"left");var d=I("div",null,"CodeMirror-merge-pane CodeMirror-merge-left");c.push(d),c.push(S(h))}var v=I("div",null,"CodeMirror-merge-pane CodeMirror-merge-editor");if(c.push(v),a){f=this.right=new r(this,"right"),c.push(S(f));var p=I("div",null,"CodeMirror-merge-pane CodeMirror-merge-right");c.push(p)}(a?p:v).className+=" CodeMirror-merge-pane-rightmost",c.push(I("div",null,null,"height: 0; clear: both;"));var C=this.wrap=t.appendChild(I("div",c,"CodeMirror-merge CodeMirror-merge-"+s+"pane"));this.edit=e(v,W(i)),h&&h.init(d,n,i),f&&f.init(p,o,i),i.collapseIdentical&&this.editor().operation(function(){!function(e,t){"number"!=typeof t&&(t=2);for(var i=[],r=e.editor(),n=r.firstLine(),o=n,l=r.lastLine();o<=l;o++)i.push(!0);e.left&&B(e.left,t,n,i);e.right&&B(e.right,t,n,i);for(var a=0;a<i.length;a++)if(i[a]){for(var s=a+n,c=1;a<i.length-1&&i[a+1];a++,c++);if(c>t){var h=[{line:s,cm:r}];e.left&&h.push({line:m(s,e.left.chunks),cm:e.left.orig}),e.right&&h.push({line:m(s,e.right.chunks),cm:e.right.orig});var f=x(c,h);e.options.onCollapse&&e.options.onCollapse(e,s,c,f)}}}(g,i.collapseIdentical)}),"align"==i.connect&&(this.aligners=[],k(this.left||this.right,!0)),h&&h.registerEvents(f),f&&f.registerEvents(h);var b=function(){h&&u(h),f&&u(f)};e.on(window,"resize",b);var w=setInterval(function(){for(var t=C.parentNode;t&&t!=document.body;t=t.parentNode);t||(clearInterval(w),e.off(window,"resize",b))},5e3)};function S(t){var r=t.lockButton=I("div",null,"CodeMirror-merge-scrolllock");r.title="Toggle locked scrolling";var n=I("div",[r],"CodeMirror-merge-scrolllock-wrap");e.on(r,"click",function(){s(t,!t.lockScroll)});var o=[n];if(!1!==t.mv.options.revertButtons&&(t.copyButtons=I("div",null,"CodeMirror-merge-copybuttons-"+t.type),e.on(t.copyButtons,"click",function(e){var i=e.target||e.srcElement;i.chunk&&("CodeMirror-merge-copy-reverse"!=i.className?T(t,t.edit,t.orig,i.chunk):T(t,t.orig,t.edit,i.chunk))}),o.unshift(t.copyButtons)),"align"!=t.mv.options.connect){var l=document.createElementNS&&document.createElementNS(i,"svg");l&&!l.createSVGRect&&(l=null),t.svg=l,l&&o.push(l)}return t.gap=I("div",o,"CodeMirror-merge-gap")}function M(e){return"string"==typeof e?e:e.getValue()}function L(e,t,i){y||(y=new diff_match_patch);for(var r=y.diff_main(e,t),n=0;n<r.length;++n){var o=r[n];(i?/[^ \t]/.test(o[1]):o[1])?n&&r[n-1][0]==o[0]&&(r.splice(n--,1),r[n][1]+=o[1]):r.splice(n--,1)}return r}function D(e){for(var i=[],r=0,n=0,o=t(0,0),l=t(0,0),a=0;a<e.length;++a){var s=e[a],c=s[0];if(c==DIFF_EQUAL){var h=!E(e,a)||o.line<r||l.line<n?1:0,f=o.line+h,g=l.line+h;V(o,s[1],null,l);var d=A(e,a)?1:0,u=o.line+d,m=l.line+d;u>f&&(a&&i.push({origFrom:n,origTo:g,editFrom:r,editTo:f}),r=u,n=m)}else V(c==DIFF_INSERT?o:l,s[1])}return(r<=o.line||n<=l.line)&&i.push({origFrom:n,origTo:l.line+1,editFrom:r,editTo:o.line+1}),i}function A(e,t){if(t==e.length-1)return!0;var i=e[t+1][1];return!(1==i.length&&t<e.length-2||10!=i.charCodeAt(0))&&(t==e.length-2||((i=e[t+2][1]).length>1||t==e.length-3)&&10==i.charCodeAt(0))}function E(e,t){if(0==t)return!0;var i=e[t-1][1];return 10==i.charCodeAt(i.length-1)&&(1==t||10==(i=e[t-2][1]).charCodeAt(i.length-1))}function O(i,r,n){i.addLineClass(r,"wrap","CodeMirror-merge-collapsed-line");var o=document.createElement("span");o.className="CodeMirror-merge-collapsed-widget",o.title="Identical text collapsed. Click to expand.";var l=i.markText(t(r,0),t(n-1),{inclusiveLeft:!0,inclusiveRight:!0,replacedWith:o,clearOnEnter:!0});function a(){l.clear(),i.removeLineClass(r,"wrap","CodeMirror-merge-collapsed-line")}return l.explicitlyCleared&&a(),e.on(o,"click",a),l.on("clear",a),e.on(o,"click",a),{mark:l,clear:a}}function x(e,t){var i=[];function r(){for(var e=0;e<i.length;e++)i[e].clear()}for(var n=0;n<t.length;n++){var o=t[n],l=O(o.cm,o.line,o.line+e);i.push(l),l.mark.on("clear",r)}return i[0].mark}function B(e,t,i,r){for(var n=0;n<e.chunks.length;n++)for(var o=e.chunks[n],l=o.editFrom-t;l<o.editTo+t;l++){var a=l+i;a>=0&&a<r.length&&(r[a]=!1)}}function I(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),"string"==typeof t)n.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)n.appendChild(t[o]);return n}function N(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild)}function R(e){for(var t=1;t<arguments.length;t+=2)e.setAttribute(arguments[t],arguments[t+1])}function W(e,t){for(var i in t||(t={}),e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}function V(e,i,r,n){for(var o=r?t(e.line,e.ch):e,l=0;;){var a=i.indexOf("\n",l);if(-1==a)break;++o.line,n&&++n.line,l=a+1}return o.ch=(l?0:o.ch)+(i.length-l),n&&(n.ch=(l?0:n.ch)+(i.length-l)),o}F.prototype={constructor:F,editor:function(){return this.edit},rightOriginal:function(){return this.right&&this.right.orig},leftOriginal:function(){return this.left&&this.left.orig},setShowDifferences:function(e){this.right&&this.right.setShowDifferences(e),this.left&&this.left.setShowDifferences(e)},rightChunks:function(){if(this.right)return n(this.right),this.right.chunks},leftChunks:function(){if(this.left)return n(this.left),this.left.chunks}};var _=1,H=2,P=4;function j(e){this.cm=e,this.alignable=[],this.height=e.doc.height;var t=this;e.on("markerAdded",function(e,i){if(i.collapsed){var r=i.find(1);null!=r&&t.set(r.line,P)}}),e.on("markerCleared",function(e,i,r,n){null!=n&&i.collapsed&&t.check(n,P,t.hasMarker)}),e.on("markerChanged",this.signal.bind(this)),e.on("lineWidgetAdded",function(e,i,r){i.mergeSpacer||(i.above?t.set(r-1,H):t.set(r,_))}),e.on("lineWidgetCleared",function(e,i,r){i.mergeSpacer||(i.above?t.check(r-1,H,t.hasWidgetBelow):t.check(r,_,t.hasWidget))}),e.on("lineWidgetChanged",this.signal.bind(this)),e.on("change",function(e,i){var r=i.from.line,n=i.to.line-i.from.line,o=i.text.length-1,l=r+o;(n||o)&&t.map(r,n,o),t.check(l,P,t.hasMarker),(n||o)&&t.check(i.from.line,P,t.hasMarker)}),e.on("viewportChange",function(){t.cm.doc.height!=t.height&&t.signal()})}function U(e,t,i){for(var r=e.length-1;r>=0;r--){var n=e[r],o=(i?n.origTo:n.editTo)-1;if(o<t)return o}}function z(e,t,i){for(var r=0;r<e.length;r++){var n=e[r],o=i?n.origFrom:n.editFrom;if(o>t)return o}}function Q(t,i){var r=null,o=t.state.diffViews,l=t.getCursor().line;if(o)for(var a=0;a<o.length;a++){var s=o[a],c=t==s.orig;n(s);var h=i<0?U(s.chunks,l,c):z(s.chunks,l,c);null==h||null!=r&&!(i<0?h>r:h<r)||(r=h)}if(null==r)return e.Pass;t.setCursor(r,0)}j.prototype={signal:function(){e.signal(this,"realign"),this.height=this.cm.doc.height},set:function(e,t){for(var i=-1;i<this.alignable.length;i+=2){var r=this.alignable[i]-e;if(0==r){if((this.alignable[i+1]&t)==t)return;return this.alignable[i+1]|=t,void this.signal()}if(r>0)break}this.signal(),this.alignable.splice(i,0,e,t)},find:function(e){for(var t=0;t<this.alignable.length;t+=2)if(this.alignable[t]==e)return t;return-1},check:function(e,t,i){var r=this.find(e);if(-1!=r&&this.alignable[r+1]&t&&!i.call(this,e)){this.signal();var n=this.alignable[r+1]&~t;n?this.alignable[r+1]=n:this.alignable.splice(r,2)}},hasMarker:function(e){var t=this.cm.getLineHandle(e);if(t.markedSpans)for(var i=0;i<t.markedSpans.length;i++)if(t.markedSpans[i].mark.collapsed&&null!=t.markedSpans[i].to)return!0;return!1},hasWidget:function(e){var t=this.cm.getLineHandle(e);if(t.widgets)for(var i=0;i<t.widgets.length;i++)if(!t.widgets[i].above&&!t.widgets[i].mergeSpacer)return!0;return!1},hasWidgetBelow:function(e){if(e==this.cm.lastLine())return!1;var t=this.cm.getLineHandle(e+1);if(t.widgets)for(var i=0;i<t.widgets.length;i++)if(t.widgets[i].above&&!t.widgets[i].mergeSpacer)return!0;return!1},map:function(e,t,i){for(var r=i-t,n=e+t,o=-1,l=-1,a=0;a<this.alignable.length;a+=2){var s=this.alignable[a];s==e&&this.alignable[a+1]&H&&(o=a),s==n&&this.alignable[a+1]&H&&(l=a),s<=e||(s<n?this.alignable.splice(a--,2):this.alignable[a]+=r)}if(o>-1){var c=this.alignable[o+1];c==H?this.alignable.splice(o,2):this.alignable[o+1]=c&~H}l>-1&&i&&this.set(e+i,H)}},e.commands.goNextDiff=function(e){return Q(e,1)},e.commands.goPrevDiff=function(e){return Q(e,-1)}});
\ No newline at end of file
+!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","diff_match_patch"],e):e(CodeMirror)}(function(e){"use strict";var t=e.Pos,i="http://www.w3.org/2000/svg";function r(e,t){this.mv=e,this.type=t,this.classes="left"==t?{chunk:"CodeMirror-merge-l-chunk",start:"CodeMirror-merge-l-chunk-start",end:"CodeMirror-merge-l-chunk-end",insert:"CodeMirror-merge-l-inserted",del:"CodeMirror-merge-l-deleted",connect:"CodeMirror-merge-l-connect"}:{chunk:"CodeMirror-merge-r-chunk",start:"CodeMirror-merge-r-chunk-start",end:"CodeMirror-merge-r-chunk-end",insert:"CodeMirror-merge-r-inserted",del:"CodeMirror-merge-r-deleted",connect:"CodeMirror-merge-r-connect"}}function n(t){t.diffOutOfDate&&(t.diff=L(t.orig.getValue(),t.edit.getValue(),t.mv.options.ignoreWhitespace),t.chunks=D(t.diff),t.diffOutOfDate=!1,e.signal(t.edit,"updateDiff",t.diff))}r.prototype={constructor:r,init:function(t,i,r){this.edit=this.mv.edit,(this.edit.state.diffViews||(this.edit.state.diffViews=[])).push(this),this.orig=e(t,W({value:i,readOnly:!this.mv.options.allowEditingOriginals},W(r))),"align"==this.mv.options.connect&&(this.edit.state.trackAlignable||(this.edit.state.trackAlignable=new j(this.edit)),this.orig.state.trackAlignable=new j(this.orig)),this.lockButton.title=this.edit.phrase("Toggle locked scrolling"),this.orig.state.diffViews=[this];var n=r.chunkClassLocation||"background";"[object Array]"!=Object.prototype.toString.call(n)&&(n=[n]),this.classes.classLocation=n,this.diff=L(M(i),M(r.value),this.mv.options.ignoreWhitespace),this.chunks=D(this.diff),this.diffOutOfDate=this.dealigned=!1,this.needsScrollSync=null,this.showDifferences=!1!==r.showDifferences},registerEvents:function(t){var i,r;this.forceUpdate=function(t){var i,r={from:0,to:0,marked:[]},a={from:0,to:0,marked:[]},s=!1;function c(e){o=!0,s=!1,"full"==e&&(t.svg&&N(t.svg),t.copyButtons&&N(t.copyButtons),h(t.edit,r.marked,t.classes),h(t.orig,a.marked,t.classes),r.from=r.to=a.from=a.to=0),n(t),t.showDifferences&&(f(t.edit,t.diff,r,DIFF_INSERT,t.classes),f(t.orig,t.diff,a,DIFF_DELETE,t.classes)),"align"==t.mv.options.connect&&k(t),u(t),null!=t.needsScrollSync&&l(t,t.needsScrollSync),o=!1}function g(e){o||(t.dealigned=!0,d(e))}function d(e){o||s||(clearTimeout(i),!0===e&&(s=!0),i=setTimeout(c,!0===e?20:250))}function m(e,i){t.diffOutOfDate||(t.diffOutOfDate=!0,r.from=r.to=a.from=a.to=0),g(i.text.length-1!=i.to.line-i.from.line)}function v(){t.diffOutOfDate=!0,t.dealigned=!0,c("full")}t.edit.on("change",m),t.orig.on("change",m),t.edit.on("swapDoc",v),t.orig.on("swapDoc",v),"align"==t.mv.options.connect&&(e.on(t.edit.state.trackAlignable,"realign",g),e.on(t.orig.state.trackAlignable,"realign",g));return t.edit.on("viewportChange",function(){d(!1)}),t.orig.on("viewportChange",function(){d(!1)}),c(),c}(this),s(this,!0,!1),r=t,(i=this).edit.on("scroll",function(){l(i,!0)&&u(i)}),i.orig.on("scroll",function(){l(i,!1)&&u(i),r&&l(r,!0)&&u(r)})},setShowDifferences:function(e){(e=!1!==e)!=this.showDifferences&&(this.showDifferences=e,this.forceUpdate("full"))}};var o=!1;function l(e,t){if(e.diffOutOfDate)return e.lockScroll&&null==e.needsScrollSync&&(e.needsScrollSync=t),!1;if(e.needsScrollSync=null,!e.lockScroll)return!0;var i,r,n=+new Date;if(t?(i=e.edit,r=e.orig):(i=e.orig,r=e.edit),i.state.scrollSetBy==e&&(i.state.scrollSetAt||0)+250>n)return!1;var o=i.getScrollInfo();if("align"==e.mv.options.connect)v=o.top;else{var l,s,c=.5*o.clientHeight,h=o.top+c,f=i.lineAtHeight(h,"local"),g=function(e,t,i){for(var r,n,o,l,a=0;a<e.length;a++){var s=e[a],c=i?s.editFrom:s.origFrom,h=i?s.editTo:s.origTo;null==n&&(c>t?(n=s.editFrom,l=s.origFrom):h>t&&(n=s.editTo,l=s.origTo)),h<=t?(r=s.editTo,o=s.origTo):c<=t&&(r=s.editFrom,o=s.origFrom)}return{edit:{before:r,after:n},orig:{before:o,after:l}}}(e.chunks,f,t),d=a(i,t?g.edit:g.orig),u=a(r,t?g.orig:g.edit),m=(h-d.top)/(d.bot-d.top),v=u.top-c+m*(u.bot-u.top);if(v>o.top&&(s=o.top/c)<1)v=v*s+o.top*(1-s);else if((l=o.height-o.clientHeight-o.top)<c){var p=r.getScrollInfo();p.height-p.clientHeight-v>l&&(s=l/c)<1&&(v=v*s+(p.height-p.clientHeight-l)*(1-s))}}return r.scrollTo(o.left,v),r.state.scrollSetAt=n,r.state.scrollSetBy=e,!0}function a(e,t){var i=t.after;return null==i&&(i=e.lastLine()+1),{top:e.heightAtLine(t.before||0,"local"),bot:e.heightAtLine(i,"local")}}function s(t,i,r){t.lockScroll=i,i&&0!=r&&l(t,DIFF_INSERT)&&u(t),(i?e.addClass:e.rmClass)(t.lockButton,"CodeMirror-merge-scrolllock-enabled")}function c(e,t,i){for(var r=i.classLocation,n=0;n<r.length;n++)e.removeLineClass(t,r[n],i.chunk),e.removeLineClass(t,r[n],i.start),e.removeLineClass(t,r[n],i.end)}function h(t,i,r){for(var n=0;n<i.length;++n){var o=i[n];o instanceof e.TextMarker?o.clear():o.parent&&c(t,o,r)}i.length=0}function f(e,t,i,r,n){var o=e.getViewport();e.operation(function(){i.from==i.to||o.from-i.to>20||i.from-o.to>20?(h(e,i.marked,n),d(e,t,r,i.marked,o.from,o.to,n),i.from=o.from,i.to=o.to):(o.from<i.from&&(d(e,t,r,i.marked,o.from,i.from,n),i.from=o.from),o.to>i.to&&(d(e,t,r,i.marked,i.to,o.to,n),i.to=o.to))})}function g(e,t,i,r,n,o){for(var l=i.classLocation,a=e.getLineHandle(t),s=0;s<l.length;s++)r&&e.addLineClass(a,l[s],i.chunk),n&&e.addLineClass(a,l[s],i.start),o&&e.addLineClass(a,l[s],i.end);return a}function d(e,i,r,n,o,l,a){var s=t(0,0),c=t(o,0),h=e.clipPos(t(l-1)),f=r==DIFF_DELETE?a.del:a.insert;function d(t,i){for(var r=Math.max(o,t),s=Math.min(l,i),c=r;c<s;++c)n.push(g(e,c,a,!0,c==t,c==i-1));t==i&&r==i&&s==i&&(r?n.push(g(e,r-1,a,!1,!1,!0)):n.push(g(e,r,a,!1,!0,!1)))}for(var u,m,v,p,k,C,b=0,w=!1,T=0;T<i.length;++T){var y=i[T],F=y[0],S=y[1];if(F==DIFF_EQUAL){var M=s.line+(E(i,T)?0:1);V(s,S);var L=s.line+(A(i,T)?1:0);L>M&&(w&&(d(b,M),w=!1),b=L)}else if(w=!0,F==r){var D=V(s,S,!0),O=(C=s,((k=c).line-C.line||k.ch-C.ch)>0?k:C),x=(p=D,((v=h).line-p.line||v.ch-p.ch)<0?v:p);m=x,((u=O).line!=m.line||u.ch!=m.ch)&&n.push(e.markText(O,x,{className:f})),s=D}}w&&d(b,s.line+1)}function u(e){if(e.showDifferences){if(e.svg){N(e.svg);var t=e.gap.offsetWidth;R(e.svg,"width",t,"height",e.gap.offsetHeight)}e.copyButtons&&N(e.copyButtons);for(var i=e.edit.getViewport(),r=e.orig.getViewport(),n=e.mv.wrap.getBoundingClientRect().top,o=n-e.edit.getScrollerElement().getBoundingClientRect().top+e.edit.getScrollInfo().top,l=n-e.orig.getScrollerElement().getBoundingClientRect().top+e.orig.getScrollInfo().top,a=0;a<e.chunks.length;a++){var s=e.chunks[a];s.editFrom<=i.to&&s.editTo>=i.from&&s.origFrom<=r.to&&s.origTo>=r.from&&w(e,s,l,o,t)}}}function m(e,t){for(var i=0,r=0,n=0;n<t.length;n++){var o=t[n];if(o.editTo>e&&o.editFrom<=e)return null;if(o.editFrom>e)break;i=o.editTo,r=o.origTo}return r+(e-i)}function v(e,t,i){for(var r=e.state.trackAlignable,n=e.firstLine(),o=0,l=[],a=0;;a++){for(var s=t[a],c=s?i?s.origFrom:s.editFrom:1e9;o<r.alignable.length;o+=2){var h=r.alignable[o]+1;if(!(h<=n)){if(!(h<=c))break;l.push(h)}}if(!s)break;l.push(n=i?s.origTo:s.editTo)}return l}function p(e,t,i,r){var n=0,o=0,l=0,a=0;e:for(;;n++){var s=e[n],c=t[o];if(!s&&null==c)break;for(var h=s?s[0]:1e9,f=null==c?1e9:c;l<i.length;){var g=i[l];if(g.origFrom<=f&&g.origTo>f){o++,n--;continue e}if(g.editTo>h){if(g.editFrom<=h)continue e;break}a+=g.origTo-g.origFrom-(g.editTo-g.editFrom),l++}if(h==f-a)s[r]=f,o++;else if(h<f-a)s[r]=h+a;else{var d=[f-a,null,null];d[r]=f,e.splice(n,0,d),o++}}}function k(e,t){if(e.dealigned||t){if(!e.orig.curOp)return e.orig.operation(function(){k(e,t)});e.dealigned=!1;var i=e.mv.left==e?e.mv.right:e.mv.left;i&&(n(i),i.dealigned=!1);for(var r=function(e,t){var i=v(e.edit,e.chunks,!1),r=[];if(t)for(var n=0,o=0;n<t.chunks.length;n++){for(var l=t.chunks[n].editTo;o<i.length&&i[o]<l;)o++;o!=i.length&&i[o]==l||i.splice(o++,0,l)}for(n=0;n<i.length;n++)r.push([i[n],null,null]);return p(r,v(e.orig,e.chunks,!0),e.chunks,1),t&&p(r,v(t.orig,t.chunks,!0),t.chunks,2),r}(e,i),o=e.mv.aligners,l=0;l<o.length;l++)o[l].clear();o.length=0;var a=[e.edit,e.orig],s=[];i&&a.push(i.orig);for(l=0;l<a.length;l++)s.push(a[l].getScrollInfo().top);for(var c=0;c<r.length;c++)C(a,r[c],o);for(l=0;l<a.length;l++)a[l].scrollTo(null,s[l])}}function C(e,t,i){for(var r=0,n=[],o=0;o<e.length;o++)if(null!=t[o]){var l=e[o].heightAtLine(t[o],"local");n[o]=l,r=Math.max(r,l)}for(o=0;o<e.length;o++)if(null!=t[o]){var a=r-n[o];a>1&&i.push(b(e[o],t[o],a))}}function b(e,t,i){var r=!0;t>e.lastLine()&&(t--,r=!1);var n=document.createElement("div");return n.className="CodeMirror-merge-spacer",n.style.height=i+"px",n.style.minWidth="1px",e.addLineWidget(t,n,{height:i,above:r,mergeSpacer:!0,handleMouseEvents:!0})}function w(e,t,r,n,o){var l="left"==e.type,a=e.orig.heightAtLine(t.origFrom,"local",!0)-r;if(e.svg){var s=a,c=e.edit.heightAtLine(t.editFrom,"local",!0)-n;if(l){var h=s;s=c,c=h}var f=e.orig.heightAtLine(t.origTo,"local",!0)-r,g=e.edit.heightAtLine(t.editTo,"local",!0)-n;if(l){h=f;f=g,g=h}var d=" C "+o/2+" "+c+" "+o/2+" "+s+" "+(o+2)+" "+s,u=" C "+o/2+" "+f+" "+o/2+" "+g+" -1 "+g;R(e.svg.appendChild(document.createElementNS(i,"path")),"d","M -1 "+c+d+" L "+(o+2)+" "+f+u+" z","class",e.classes.connect)}if(e.copyButtons){var m=e.copyButtons.appendChild(I("div","left"==e.type?"⇝":"⇜","CodeMirror-merge-copy")),v=e.mv.options.allowEditingOriginals;if(m.title=e.edit.phrase(v?"Push to left":"Revert chunk"),m.chunk=t,m.style.top=(t.origTo>t.origFrom?a:e.edit.heightAtLine(t.editFrom,"local")-n)+"px",v){var p=e.edit.heightAtLine(t.editFrom,"local")-n,k=e.copyButtons.appendChild(I("div","right"==e.type?"⇝":"⇜","CodeMirror-merge-copy-reverse"));k.title="Push to right",k.chunk={editFrom:t.origFrom,editTo:t.origTo,origFrom:t.editFrom,origTo:t.editTo},k.style.top=p+"px","right"==e.type?k.style.left="2px":k.style.right="2px"}}}function T(e,i,r,n){if(!e.diffOutOfDate){var o=n.origTo>r.lastLine()?t(n.origFrom-1):t(n.origFrom,0),l=t(n.origTo,0),a=n.editTo>i.lastLine()?t(n.editFrom-1):t(n.editFrom,0),s=t(n.editTo,0),c=e.mv.options.revertChunk;c?c(e.mv,r,o,l,i,a,s):i.replaceRange(r.getRange(o,l),a,s)}}var y,F=e.MergeView=function(t,i){if(!(this instanceof F))return new F(t,i);this.options=i;var n=i.origLeft,o=null==i.origRight?i.orig:i.origRight,l=null!=n,a=null!=o,s=1+(l?1:0)+(a?1:0),c=[],h=this.left=null,f=this.right=null,g=this;if(l){h=this.left=new r(this,"left");var d=I("div",null,"CodeMirror-merge-pane CodeMirror-merge-left");c.push(d),c.push(S(h))}var v=I("div",null,"CodeMirror-merge-pane CodeMirror-merge-editor");if(c.push(v),a){f=this.right=new r(this,"right"),c.push(S(f));var p=I("div",null,"CodeMirror-merge-pane CodeMirror-merge-right");c.push(p)}(a?p:v).className+=" CodeMirror-merge-pane-rightmost",c.push(I("div",null,null,"height: 0; clear: both;"));var C=this.wrap=t.appendChild(I("div",c,"CodeMirror-merge CodeMirror-merge-"+s+"pane"));this.edit=e(v,W(i)),h&&h.init(d,n,i),f&&f.init(p,o,i),i.collapseIdentical&&this.editor().operation(function(){!function(e,t){"number"!=typeof t&&(t=2);for(var i=[],r=e.editor(),n=r.firstLine(),o=n,l=r.lastLine();o<=l;o++)i.push(!0);e.left&&B(e.left,t,n,i);e.right&&B(e.right,t,n,i);for(var a=0;a<i.length;a++)if(i[a]){for(var s=a+n,c=1;a<i.length-1&&i[a+1];a++,c++);if(c>t){var h=[{line:s,cm:r}];e.left&&h.push({line:m(s,e.left.chunks),cm:e.left.orig}),e.right&&h.push({line:m(s,e.right.chunks),cm:e.right.orig});var f=x(c,h);e.options.onCollapse&&e.options.onCollapse(e,s,c,f)}}}(g,i.collapseIdentical)}),"align"==i.connect&&(this.aligners=[],k(this.left||this.right,!0)),h&&h.registerEvents(f),f&&f.registerEvents(h);var b=function(){h&&u(h),f&&u(f)};e.on(window,"resize",b);var w=setInterval(function(){for(var t=C.parentNode;t&&t!=document.body;t=t.parentNode);t||(clearInterval(w),e.off(window,"resize",b))},5e3)};function S(t){var r=t.lockButton=I("div",null,"CodeMirror-merge-scrolllock"),n=I("div",[r],"CodeMirror-merge-scrolllock-wrap");e.on(r,"click",function(){s(t,!t.lockScroll)});var o=[n];if(!1!==t.mv.options.revertButtons&&(t.copyButtons=I("div",null,"CodeMirror-merge-copybuttons-"+t.type),e.on(t.copyButtons,"click",function(e){var i=e.target||e.srcElement;i.chunk&&("CodeMirror-merge-copy-reverse"!=i.className?T(t,t.edit,t.orig,i.chunk):T(t,t.orig,t.edit,i.chunk))}),o.unshift(t.copyButtons)),"align"!=t.mv.options.connect){var l=document.createElementNS&&document.createElementNS(i,"svg");l&&!l.createSVGRect&&(l=null),t.svg=l,l&&o.push(l)}return t.gap=I("div",o,"CodeMirror-merge-gap")}function M(e){return"string"==typeof e?e:e.getValue()}function L(e,t,i){y||(y=new diff_match_patch);for(var r=y.diff_main(e,t),n=0;n<r.length;++n){var o=r[n];(i?/[^ \t]/.test(o[1]):o[1])?n&&r[n-1][0]==o[0]&&(r.splice(n--,1),r[n][1]+=o[1]):r.splice(n--,1)}return r}function D(e){var i=[];if(!e.length)return i;for(var r=0,n=0,o=t(0,0),l=t(0,0),a=0;a<e.length;++a){var s=e[a],c=s[0];if(c==DIFF_EQUAL){var h=!E(e,a)||o.line<r||l.line<n?1:0,f=o.line+h,g=l.line+h;V(o,s[1],null,l);var d=A(e,a)?1:0,u=o.line+d,m=l.line+d;u>f&&(a&&i.push({origFrom:n,origTo:g,editFrom:r,editTo:f}),r=u,n=m)}else V(c==DIFF_INSERT?o:l,s[1])}return(r<=o.line||n<=l.line)&&i.push({origFrom:n,origTo:l.line+1,editFrom:r,editTo:o.line+1}),i}function A(e,t){if(t==e.length-1)return!0;var i=e[t+1][1];return!(1==i.length&&t<e.length-2||10!=i.charCodeAt(0))&&(t==e.length-2||((i=e[t+2][1]).length>1||t==e.length-3)&&10==i.charCodeAt(0))}function E(e,t){if(0==t)return!0;var i=e[t-1][1];return 10==i.charCodeAt(i.length-1)&&(1==t||10==(i=e[t-2][1]).charCodeAt(i.length-1))}function O(i,r,n){i.addLineClass(r,"wrap","CodeMirror-merge-collapsed-line");var o=document.createElement("span");o.className="CodeMirror-merge-collapsed-widget",o.title=i.phrase("Identical text collapsed. Click to expand.");var l=i.markText(t(r,0),t(n-1),{inclusiveLeft:!0,inclusiveRight:!0,replacedWith:o,clearOnEnter:!0});function a(){l.clear(),i.removeLineClass(r,"wrap","CodeMirror-merge-collapsed-line")}return l.explicitlyCleared&&a(),e.on(o,"click",a),l.on("clear",a),e.on(o,"click",a),{mark:l,clear:a}}function x(e,t){var i=[];function r(){for(var e=0;e<i.length;e++)i[e].clear()}for(var n=0;n<t.length;n++){var o=t[n],l=O(o.cm,o.line,o.line+e);i.push(l),l.mark.on("clear",r)}return i[0].mark}function B(e,t,i,r){for(var n=0;n<e.chunks.length;n++)for(var o=e.chunks[n],l=o.editFrom-t;l<o.editTo+t;l++){var a=l+i;a>=0&&a<r.length&&(r[a]=!1)}}function I(e,t,i,r){var n=document.createElement(e);if(i&&(n.className=i),r&&(n.style.cssText=r),"string"==typeof t)n.appendChild(document.createTextNode(t));else if(t)for(var o=0;o<t.length;++o)n.appendChild(t[o]);return n}function N(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild)}function R(e){for(var t=1;t<arguments.length;t+=2)e.setAttribute(arguments[t],arguments[t+1])}function W(e,t){for(var i in t||(t={}),e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}function V(e,i,r,n){for(var o=r?t(e.line,e.ch):e,l=0;;){var a=i.indexOf("\n",l);if(-1==a)break;++o.line,n&&++n.line,l=a+1}return o.ch=(l?0:o.ch)+(i.length-l),n&&(n.ch=(l?0:n.ch)+(i.length-l)),o}F.prototype={constructor:F,editor:function(){return this.edit},rightOriginal:function(){return this.right&&this.right.orig},leftOriginal:function(){return this.left&&this.left.orig},setShowDifferences:function(e){this.right&&this.right.setShowDifferences(e),this.left&&this.left.setShowDifferences(e)},rightChunks:function(){if(this.right)return n(this.right),this.right.chunks},leftChunks:function(){if(this.left)return n(this.left),this.left.chunks}};var _=1,H=2,P=4;function j(e){this.cm=e,this.alignable=[],this.height=e.doc.height;var t=this;e.on("markerAdded",function(e,i){if(i.collapsed){var r=i.find(1);null!=r&&t.set(r.line,P)}}),e.on("markerCleared",function(e,i,r,n){null!=n&&i.collapsed&&t.check(n,P,t.hasMarker)}),e.on("markerChanged",this.signal.bind(this)),e.on("lineWidgetAdded",function(e,i,r){i.mergeSpacer||(i.above?t.set(r-1,H):t.set(r,_))}),e.on("lineWidgetCleared",function(e,i,r){i.mergeSpacer||(i.above?t.check(r-1,H,t.hasWidgetBelow):t.check(r,_,t.hasWidget))}),e.on("lineWidgetChanged",this.signal.bind(this)),e.on("change",function(e,i){var r=i.from.line,n=i.to.line-i.from.line,o=i.text.length-1,l=r+o;(n||o)&&t.map(r,n,o),t.check(l,P,t.hasMarker),(n||o)&&t.check(i.from.line,P,t.hasMarker)}),e.on("viewportChange",function(){t.cm.doc.height!=t.height&&t.signal()})}function U(e,t,i){for(var r=e.length-1;r>=0;r--){var n=e[r],o=(i?n.origTo:n.editTo)-1;if(o<t)return o}}function z(e,t,i){for(var r=0;r<e.length;r++){var n=e[r],o=i?n.origFrom:n.editFrom;if(o>t)return o}}function Q(t,i){var r=null,o=t.state.diffViews,l=t.getCursor().line;if(o)for(var a=0;a<o.length;a++){var s=o[a],c=t==s.orig;n(s);var h=i<0?U(s.chunks,l,c):z(s.chunks,l,c);null==h||null!=r&&!(i<0?h>r:h<r)||(r=h)}if(null==r)return e.Pass;t.setCursor(r,0)}j.prototype={signal:function(){e.signal(this,"realign"),this.height=this.cm.doc.height},set:function(e,t){for(var i=-1;i<this.alignable.length;i+=2){var r=this.alignable[i]-e;if(0==r){if((this.alignable[i+1]&t)==t)return;return this.alignable[i+1]|=t,void this.signal()}if(r>0)break}this.signal(),this.alignable.splice(i,0,e,t)},find:function(e){for(var t=0;t<this.alignable.length;t+=2)if(this.alignable[t]==e)return t;return-1},check:function(e,t,i){var r=this.find(e);if(-1!=r&&this.alignable[r+1]&t&&!i.call(this,e)){this.signal();var n=this.alignable[r+1]&~t;n?this.alignable[r+1]=n:this.alignable.splice(r,2)}},hasMarker:function(e){var t=this.cm.getLineHandle(e);if(t.markedSpans)for(var i=0;i<t.markedSpans.length;i++)if(t.markedSpans[i].mark.collapsed&&null!=t.markedSpans[i].to)return!0;return!1},hasWidget:function(e){var t=this.cm.getLineHandle(e);if(t.widgets)for(var i=0;i<t.widgets.length;i++)if(!t.widgets[i].above&&!t.widgets[i].mergeSpacer)return!0;return!1},hasWidgetBelow:function(e){if(e==this.cm.lastLine())return!1;var t=this.cm.getLineHandle(e+1);if(t.widgets)for(var i=0;i<t.widgets.length;i++)if(t.widgets[i].above&&!t.widgets[i].mergeSpacer)return!0;return!1},map:function(e,t,i){for(var r=i-t,n=e+t,o=-1,l=-1,a=0;a<this.alignable.length;a+=2){var s=this.alignable[a];s==e&&this.alignable[a+1]&H&&(o=a),s==n&&this.alignable[a+1]&H&&(l=a),s<=e||(s<n?this.alignable.splice(a--,2):this.alignable[a]+=r)}if(o>-1){var c=this.alignable[o+1];c==H?this.alignable.splice(o,2):this.alignable[o+1]=c&~H}l>-1&&i&&this.set(e+i,H)}},e.commands.goNextDiff=function(e){return Q(e,1)},e.commands.goPrevDiff=function(e){return Q(e,-1)}});
\ No newline at end of file
index 3f097c0..c802e88 100644 (file)
@@ -1 +1 @@
-!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.multiplexingMode=function(n){var t=Array.prototype.slice.call(arguments,1);function i(e,n,t,i){if("string"==typeof n){var r=e.indexOf(n,t);return i&&r>-1?r+n.length:r}var o=n.exec(t?e.slice(t):e);return o?o.index+t+(i?o[0].length:0):-1}return{startState:function(){return{outer:e.startState(n),innerActive:null,inner:null}},copyState:function(t){return{outer:e.copyState(n,t.outer),innerActive:t.innerActive,inner:t.innerActive&&e.copyState(t.innerActive.mode,t.inner)}},token:function(r,o){if(o.innerActive){var c=o.innerActive;u=r.string;if(!c.close&&r.sol())return o.innerActive=o.inner=null,this.token(r,o);if((d=c.close?i(u,c.close,r.pos,c.parseDelimiters):-1)==r.pos&&!c.parseDelimiters)return r.match(c.close),o.innerActive=o.inner=null,c.delimStyle&&c.delimStyle+" "+c.delimStyle+"-close";d>-1&&(r.string=u.slice(0,d));var l=c.mode.token(r,o.inner);return d>-1&&(r.string=u),d==r.pos&&c.parseDelimiters&&(o.innerActive=o.inner=null),c.innerStyle&&(l=l?l+" "+c.innerStyle:c.innerStyle),l}for(var s=1/0,u=r.string,a=0;a<t.length;++a){var d,v=t[a];if((d=i(u,v.open,r.pos))==r.pos)return v.parseDelimiters||r.match(v.open),o.innerActive=v,o.inner=e.startState(v.mode,n.indent?n.indent(o.outer,""):0),v.delimStyle&&v.delimStyle+" "+v.delimStyle+"-open";-1!=d&&d<s&&(s=d)}s!=1/0&&(r.string=u.slice(0,s));var f=n.token(r,o.outer);return s!=1/0&&(r.string=u),f},indent:function(t,i){var r=t.innerActive?t.innerActive.mode:n;return r.indent?r.indent(t.innerActive?t.inner:t.outer,i):e.Pass},blankLine:function(i){var r=i.innerActive?i.innerActive.mode:n;if(r.blankLine&&r.blankLine(i.innerActive?i.inner:i.outer),i.innerActive)"\n"===i.innerActive.close&&(i.innerActive=i.inner=null);else for(var o=0;o<t.length;++o){var c=t[o];"\n"===c.open&&(i.innerActive=c,i.inner=e.startState(c.mode,r.indent?r.indent(i.outer,""):0))}},electricChars:n.electricChars,innerMode:function(e){return e.inner?{state:e.inner,mode:e.innerActive.mode}:{state:e.outer,mode:n}}}}});
\ No newline at end of file
+!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.multiplexingMode=function(n){var i=Array.prototype.slice.call(arguments,1);function t(e,n,i,t){if("string"==typeof n){var r=e.indexOf(n,i);return t&&r>-1?r+n.length:r}var o=n.exec(i?e.slice(i):e);return o?o.index+i+(t?o[0].length:0):-1}return{startState:function(){return{outer:e.startState(n),innerActive:null,inner:null}},copyState:function(i){return{outer:e.copyState(n,i.outer),innerActive:i.innerActive,inner:i.innerActive&&e.copyState(i.innerActive.mode,i.inner)}},token:function(r,o){if(o.innerActive){var c=o.innerActive;a=r.string;if(!c.close&&r.sol())return o.innerActive=o.inner=null,this.token(r,o);if((v=c.close?t(a,c.close,r.pos,c.parseDelimiters):-1)==r.pos&&!c.parseDelimiters)return r.match(c.close),o.innerActive=o.inner=null,c.delimStyle&&c.delimStyle+" "+c.delimStyle+"-close";v>-1&&(r.string=a.slice(0,v));var l=c.mode.token(r,o.inner);return v>-1&&(r.string=a),v==r.pos&&c.parseDelimiters&&(o.innerActive=o.inner=null),c.innerStyle&&(l=l?l+" "+c.innerStyle:c.innerStyle),l}for(var s=1/0,a=r.string,u=0;u<i.length;++u){var v,d=i[u];if((v=t(a,d.open,r.pos))==r.pos){d.parseDelimiters||r.match(d.open),o.innerActive=d;var f=0;if(n.indent){var m=n.indent(o.outer,"");m!==e.Pass&&(f=m)}return o.inner=e.startState(d.mode,f),d.delimStyle&&d.delimStyle+" "+d.delimStyle+"-open"}-1!=v&&v<s&&(s=v)}s!=1/0&&(r.string=a.slice(0,s));var p=n.token(r,o.outer);return s!=1/0&&(r.string=a),p},indent:function(i,t){var r=i.innerActive?i.innerActive.mode:n;return r.indent?r.indent(i.innerActive?i.inner:i.outer,t):e.Pass},blankLine:function(t){var r=t.innerActive?t.innerActive.mode:n;if(r.blankLine&&r.blankLine(t.innerActive?t.inner:t.outer),t.innerActive)"\n"===t.innerActive.close&&(t.innerActive=t.inner=null);else for(var o=0;o<i.length;++o){var c=i[o];"\n"===c.open&&(t.innerActive=c,t.inner=e.startState(c.mode,r.indent?r.indent(t.outer,""):0))}},electricChars:n.electricChars,innerMode:function(e){return e.inner?{state:e.inner,mode:e.innerActive.mode}:{state:e.outer,mode:n}}}}});
\ No newline at end of file
index 40123a8..290bbed 100644 (file)
@@ -1 +1 @@
-!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 o(e,o){var r=Number(o);return/^[-+]/.test(o)?e.getCursor().line+r:r-1}e.commands.jumpToLine=function(e){var r,i,t,s,n,l=e.getCursor();r=e,i='Jump to line: <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use line:column or scroll% syntax)</span>',t="Jump to line:",s=l.line+1+":"+l.ch,n=function(r){var i;if(r)if(i=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(r))e.setCursor(o(e,i[1]),Number(i[2]));else if(i=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(r)){var t=Math.round(e.lineCount()*Number(i[1])/100);/^[-+]/.test(i[1])&&(t=l.line+t+1),e.setCursor(t-1,l.ch)}else(i=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(r))&&e.setCursor(o(e,i[1]),l.ch)},r.openDialog?r.openDialog(i,n,{value:s,selectValueOnOpen:!0}):n(prompt(t,s))},e.keyMap.default["Alt-G"]="jumpToLine"});
\ No newline at end of file
+!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 r(e,r){var o=Number(r);return/^[-+]/.test(r)?e.getCursor().line+o:o-1}e.commands.jumpToLine=function(e){var o,s,i,t,n,l,u=e.getCursor();o=e,s=(l=e).phrase("Jump to line:")+' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">'+l.phrase("(Use line:column or scroll% syntax)")+"</span>",i=e.phrase("Jump to line:"),t=u.line+1+":"+u.ch,n=function(o){var s;if(o)if(s=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(o))e.setCursor(r(e,s[1]),Number(s[2]));else if(s=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(o)){var i=Math.round(e.lineCount()*Number(s[1])/100);/^[-+]/.test(s[1])&&(i=u.line+i+1),e.setCursor(i-1,u.ch)}else(s=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(o))&&e.setCursor(r(e,s[1]),u.ch)},o.openDialog?o.openDialog(s,n,{value:t,selectValueOnOpen:!0}):n(prompt(i,t))},e.keyMap.default["Alt-G"]="jumpToLine"});
\ No newline at end of file
index aed90cd..75eda66 100644 (file)
@@ -1 +1 @@
-!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("./matchesonscrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./matchesonscrollbar"],t):t(CodeMirror)}(function(t){"use strict";var e={style:"matchhighlight",minChars:2,delay:100,wordsOnly:!1,annotateScrollbar:!1,showToken:!1,trim:!0};function o(t){var e=t.state.matchHighlighter;(e.active||t.hasFocus())&&n(t,e)}function i(t){var e=t.state.matchHighlighter;e.active||(e.active=!0,n(t,e))}function n(t,e){clearTimeout(e.timeout),e.timeout=setTimeout(function(){s(t)},e.options.delay)}function r(t,e,o,i){var n,r,a,s=t.state.matchHighlighter;if(t.addOverlay(s.overlay=(n=e,r=o,a=i,{token:function(t){if(t.match(n)&&(!r||(o=r,!((e=t).start&&o.test(e.string.charAt(e.start-1))||e.pos!=e.string.length&&o.test(e.string.charAt(e.pos))))))return a;var e,o;t.next(),t.skipTo(n.charAt(0))||t.skipToEnd()}})),s.options.annotateScrollbar&&t.showMatchesOnScrollbar){var l=o?new RegExp("\\b"+e.replace(/[\\\[+*?(){|^$]/g,"\\$&")+"\\b"):e;s.matchesonscroll=t.showMatchesOnScrollbar(l,!1,{className:"CodeMirror-selection-highlight-scrollbar"})}}function a(t){var e=t.state.matchHighlighter;e.overlay&&(t.removeOverlay(e.overlay),e.overlay=null,e.matchesonscroll&&(e.matchesonscroll.clear(),e.matchesonscroll=null))}function s(t){t.operation(function(){var e=t.state.matchHighlighter;if(a(t),t.somethingSelected()||!e.options.showToken){var o=t.getCursor("from"),i=t.getCursor("to");if(o.line==i.line&&(!e.options.wordsOnly||function(t,e,o){{if(null!==t.getRange(e,o).match(/^\w+$/)){if(e.ch>0){var i={line:e.line,ch:e.ch-1},n=t.getRange(i,e);if(null===n.match(/\W/))return!1}if(o.ch<t.getLine(e.line).length){var i={line:o.line,ch:o.ch+1},n=t.getRange(o,i);if(null===n.match(/\W/))return!1}return!0}return!1}}(t,o,i))){var n=t.getRange(o,i);e.options.trim&&(n=n.replace(/^\s+|\s+$/g,"")),n.length>=e.options.minChars&&r(t,n,!1,e.options.style)}}else{for(var s=!0===e.options.showToken?/[\w$]/:e.options.showToken,l=t.getCursor(),c=t.getLine(l.line),h=l.ch,u=h;h&&s.test(c.charAt(h-1));)--h;for(;u<c.length&&s.test(c.charAt(u));)++u;h<u&&r(t,c.slice(h,u),s,e.options.style)}})}t.defineOption("highlightSelectionMatches",!1,function(n,r,l){if(l&&l!=t.Init&&(a(n),clearTimeout(n.state.matchHighlighter.timeout),n.state.matchHighlighter=null,n.off("cursorActivity",o),n.off("focus",i)),r){var c=n.state.matchHighlighter=new function(t){for(var o in this.options={},e)this.options[o]=(t&&t.hasOwnProperty(o)?t:e)[o];this.overlay=this.timeout=null,this.matchesonscroll=null,this.active=!1}(r);n.hasFocus()?(c.active=!0,s(n)):n.on("focus",i),n.on("cursorActivity",o)}})});
\ No newline at end of file
+!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror"),require("./matchesonscrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./matchesonscrollbar"],t):t(CodeMirror)}(function(t){"use strict";var e={style:"matchhighlight",minChars:2,delay:100,wordsOnly:!1,annotateScrollbar:!1,showToken:!1,trim:!0};function o(t){var e=t.state.matchHighlighter;(e.active||t.hasFocus())&&n(t,e)}function i(t){var e=t.state.matchHighlighter;e.active||(e.active=!0,n(t,e))}function n(t,e){clearTimeout(e.timeout),e.timeout=setTimeout(function(){s(t)},e.options.delay)}function r(t,e,o,i){var n,r,a,s=t.state.matchHighlighter;if(t.addOverlay(s.overlay=(n=e,r=o,a=i,{token:function(t){if(t.match(n)&&(!r||(o=r,!((e=t).start&&o.test(e.string.charAt(e.start-1))||e.pos!=e.string.length&&o.test(e.string.charAt(e.pos))))))return a;var e,o;t.next(),t.skipTo(n.charAt(0))||t.skipToEnd()}})),s.options.annotateScrollbar&&t.showMatchesOnScrollbar){var l=o?new RegExp("\\b"+e.replace(/[\\\[.+*?(){|^$]/g,"\\$&")+"\\b"):e;s.matchesonscroll=t.showMatchesOnScrollbar(l,!1,{className:"CodeMirror-selection-highlight-scrollbar"})}}function a(t){var e=t.state.matchHighlighter;e.overlay&&(t.removeOverlay(e.overlay),e.overlay=null,e.matchesonscroll&&(e.matchesonscroll.clear(),e.matchesonscroll=null))}function s(t){t.operation(function(){var e=t.state.matchHighlighter;if(a(t),t.somethingSelected()||!e.options.showToken){var o=t.getCursor("from"),i=t.getCursor("to");if(o.line==i.line&&(!e.options.wordsOnly||function(t,e,o){{if(null!==t.getRange(e,o).match(/^\w+$/)){if(e.ch>0){var i={line:e.line,ch:e.ch-1},n=t.getRange(i,e);if(null===n.match(/\W/))return!1}if(o.ch<t.getLine(e.line).length){var i={line:o.line,ch:o.ch+1},n=t.getRange(o,i);if(null===n.match(/\W/))return!1}return!0}return!1}}(t,o,i))){var n=t.getRange(o,i);e.options.trim&&(n=n.replace(/^\s+|\s+$/g,"")),n.length>=e.options.minChars&&r(t,n,!1,e.options.style)}}else{for(var s=!0===e.options.showToken?/[\w$]/:e.options.showToken,l=t.getCursor(),c=t.getLine(l.line),h=l.ch,u=h;h&&s.test(c.charAt(h-1));)--h;for(;u<c.length&&s.test(c.charAt(u));)++u;h<u&&r(t,c.slice(h,u),s,e.options.style)}})}t.defineOption("highlightSelectionMatches",!1,function(n,r,l){if(l&&l!=t.Init&&(a(n),clearTimeout(n.state.matchHighlighter.timeout),n.state.matchHighlighter=null,n.off("cursorActivity",o),n.off("focus",i)),r){var c=n.state.matchHighlighter=new function(t){for(var o in this.options={},e)this.options[o]=(t&&t.hasOwnProperty(o)?t:e)[o];this.overlay=this.timeout=null,this.matchesonscroll=null,this.active=!1}(r);n.hasFocus()?(c.active=!0,s(n)):n.on("focus",i),n.on("cursorActivity",o)}})});
\ No newline at end of file
index de51b71..c189546 100644 (file)
@@ -1 +1 @@
-!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 o(e){return e.state.search||(e.state.search=new function(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null})}function n(e){return"string"==typeof e&&e==e.toLowerCase()}function r(e,o,r){return e.getSearchCursor(o,r,{caseFold:n(o),multiline:!0})}function t(e,o,n,r,t){e.openDialog?e.openDialog(o,t,{value:r,selectValueOnOpen:!0}):t(prompt(n,r))}function i(e){return e.replace(/\\(.)/g,function(e,o){return"n"==o?"\n":"r"==o?"\r":o})}function a(e){var o=e.match(/^\/(.*)\/([a-z]*)$/);if(o)try{e=new RegExp(o[1],-1==o[2].indexOf("i")?"":"i")}catch(e){}else e=i(e);return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}var s='<span class="CodeMirror-search-label">Search:</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>';function c(e,o,r){var t,i;o.queryText=r,o.query=a(r),e.removeOverlay(o.overlay,n(o.query)),o.overlay=(t=o.query,i=n(o.query),"string"==typeof t?t=new RegExp(t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),i?"gi":"g"):t.global||(t=new RegExp(t.source,t.ignoreCase?"gi":"g")),{token:function(e){t.lastIndex=e.pos;var o=t.exec(e.string);if(o&&o.index==e.pos)return e.pos+=o[0].length||1,"searching";o?e.pos=o.index:e.skipToEnd()}}),e.addOverlay(o.overlay),e.showMatchesOnScrollbar&&(o.annotate&&(o.annotate.clear(),o.annotate=null),o.annotate=e.showMatchesOnScrollbar(o.query,n(o.query)))}function l(n,r,i,a){var l=o(n);if(l.query)return u(n,r);var p,d,y,m,g,h=n.getSelection()||l.lastQuery;if(h instanceof RegExp&&"x^"==h.source&&(h=null),i&&n.openDialog){var v=null,x=function(o,r){e.e_stop(r),o&&(o!=l.queryText&&(c(n,l,o),l.posFrom=l.posTo=n.getCursor()),v&&(v.style.opacity=1),u(n,r.shiftKey,function(e,o){var r;o.line<3&&document.querySelector&&(r=n.display.wrapper.querySelector(".CodeMirror-dialog"))&&r.getBoundingClientRect().bottom-4>n.cursorCoords(o,"window").top&&((v=r).style.opacity=.4)}))};d=s,y=h,m=x,g=function(r,t){var i=e.keyName(r),a=n.getOption("extraKeys"),s=a&&a[i]||e.keyMap[n.getOption("keyMap")][i];"findNext"==s||"findPrev"==s||"findPersistentNext"==s||"findPersistentPrev"==s?(e.e_stop(r),c(n,o(n),t),n.execCommand(s)):"find"!=s&&"findPersistent"!=s||(e.e_stop(r),x(t,r))},(p=n).openDialog(d,m,{value:y,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){f(p)},onKeyDown:g}),a&&h&&(c(n,l,h),u(n,r))}else t(n,s,"Search for:",h,function(e){e&&!l.query&&n.operation(function(){c(n,l,e),l.posFrom=l.posTo=n.getCursor(),u(n,r)})})}function u(n,t,i){n.operation(function(){var a=o(n),s=r(n,a.query,t?a.posFrom:a.posTo);(s.find(t)||(s=r(n,a.query,t?e.Pos(n.lastLine()):e.Pos(n.firstLine(),0))).find(t))&&(n.setSelection(s.from(),s.to()),n.scrollIntoView({from:s.from(),to:s.to()},20),a.posFrom=s.from(),a.posTo=s.to(),i&&i(s.from(),s.to()))})}function f(e){e.operation(function(){var n=o(e);n.lastQuery=n.query,n.query&&(n.query=n.queryText=null,e.removeOverlay(n.overlay),n.annotate&&(n.annotate.clear(),n.annotate=null))})}var p=' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>',d='<span class="CodeMirror-search-label">With:</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/>',y='<span class="CodeMirror-search-label">Replace?</span> <button>Yes</button> <button>No</button> <button>All</button> <button>Stop</button>';function m(e,o,n){e.operation(function(){for(var t=r(e,o);t.findNext();)if("string"!=typeof o){var i=e.getRange(t.from(),t.to()).match(o);t.replace(n.replace(/\$(\d)/g,function(e,o){return i[o]}))}else t.replace(n)})}function g(e,n){if(!e.getOption("readOnly")){var s=e.getSelection()||o(e).lastQuery,c='<span class="CodeMirror-search-label">'+(n?"Replace all:":"Replace:")+"</span>";t(e,c+p,c,s,function(o){o&&(o=a(o),t(e,d,"Replace with:","",function(t){if(t=i(t),n)m(e,o,t);else{f(e);var a=r(e,o,e.getCursor("from")),s=function(){var n,i,l,u,f,p=a.from();!(n=a.findNext())&&(a=r(e,o),!(n=a.findNext())||p&&a.from().line==p.line&&a.from().ch==p.ch)||(e.setSelection(a.from(),a.to()),e.scrollIntoView({from:a.from(),to:a.to()}),l=y,u="Replace?",f=[function(){c(n)},s,function(){m(e,o,t)}],(i=e).openConfirm?i.openConfirm(l,f):confirm(u)&&f[0]())},c=function(e){a.replace("string"==typeof o?t:t.replace(/\$(\d)/g,function(o,n){return e[n]})),s()};s()}}))})}}e.commands.find=function(e){f(e),l(e)},e.commands.findPersistent=function(e){f(e),l(e,!1,!0)},e.commands.findPersistentNext=function(e){l(e,!1,!0,!0)},e.commands.findPersistentPrev=function(e){l(e,!0,!0,!0)},e.commands.findNext=l,e.commands.findPrev=function(e){l(e,!0)},e.commands.clearSearch=f,e.commands.replace=g,e.commands.replaceAll=function(e){g(e,!0)}});
\ No newline at end of file
+!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 r(e){return e.state.search||(e.state.search=new function(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null})}function o(e){return"string"==typeof e&&e==e.toLowerCase()}function n(e,r,n){return e.getSearchCursor(r,n,{caseFold:o(r),multiline:!0})}function t(e,r,o,n,t){e.openDialog?e.openDialog(r,t,{value:n,selectValueOnOpen:!0}):t(prompt(o,n))}function a(e){return e.replace(/\\(.)/g,function(e,r){return"n"==r?"\n":"r"==r?"\r":r})}function i(e){var r=e.match(/^\/(.*)\/([a-z]*)$/);if(r)try{e=new RegExp(r[1],-1==r[2].indexOf("i")?"":"i")}catch(e){}else e=a(e);return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function s(e,r,n){var t,a;r.queryText=n,r.query=i(n),e.removeOverlay(r.overlay,o(r.query)),r.overlay=(t=r.query,a=o(r.query),"string"==typeof t?t=new RegExp(t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),a?"gi":"g"):t.global||(t=new RegExp(t.source,t.ignoreCase?"gi":"g")),{token:function(e){t.lastIndex=e.pos;var r=t.exec(e.string);if(r&&r.index==e.pos)return e.pos+=r[0].length||1,"searching";r?e.pos=r.index:e.skipToEnd()}}),e.addOverlay(r.overlay),e.showMatchesOnScrollbar&&(r.annotate&&(r.annotate.clear(),r.annotate=null),r.annotate=e.showMatchesOnScrollbar(r.query,o(r.query)))}function c(o,n,a,i){var c=r(o);if(c.query)return l(o,n);var p,d,y,m,h,g=o.getSelection()||c.lastQuery;if(g instanceof RegExp&&"x^"==g.source&&(g=null),a&&o.openDialog){var v=null,x=function(r,n){e.e_stop(n),r&&(r!=c.queryText&&(s(o,c,r),c.posFrom=c.posTo=o.getCursor()),v&&(v.style.opacity=1),l(o,n.shiftKey,function(e,r){var n;r.line<3&&document.querySelector&&(n=o.display.wrapper.querySelector(".CodeMirror-dialog"))&&n.getBoundingClientRect().bottom-4>o.cursorCoords(r,"window").top&&((v=n).style.opacity=.4)}))};p=o,d=f(o),y=g,m=x,h=function(n,t){var a=e.keyName(n),i=o.getOption("extraKeys"),c=i&&i[a]||e.keyMap[o.getOption("keyMap")][a];"findNext"==c||"findPrev"==c||"findPersistentNext"==c||"findPersistentPrev"==c?(e.e_stop(n),s(o,r(o),t),o.execCommand(c)):"find"!=c&&"findPersistent"!=c||(e.e_stop(n),x(t,n))},p.openDialog(d,m,{value:y,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){u(p)},onKeyDown:h}),i&&g&&(s(o,c,g),l(o,n))}else t(o,f(o),"Search for:",g,function(e){e&&!c.query&&o.operation(function(){s(o,c,e),c.posFrom=c.posTo=o.getCursor(),l(o,n)})})}function l(o,t,a){o.operation(function(){var i=r(o),s=n(o,i.query,t?i.posFrom:i.posTo);(s.find(t)||(s=n(o,i.query,t?e.Pos(o.lastLine()):e.Pos(o.firstLine(),0))).find(t))&&(o.setSelection(s.from(),s.to()),o.scrollIntoView({from:s.from(),to:s.to()},20),i.posFrom=s.from(),i.posTo=s.to(),a&&a(s.from(),s.to()))})}function u(e){e.operation(function(){var o=r(e);o.lastQuery=o.query,o.query&&(o.query=o.queryText=null,e.removeOverlay(o.overlay),o.annotate&&(o.annotate.clear(),o.annotate=null))})}function f(e){return'<span class="CodeMirror-search-label">'+e.phrase("Search:")+'</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">'+e.phrase("(Use /re/ syntax for regexp search)")+"</span>"}function p(e,r,o){e.operation(function(){for(var t=n(e,r);t.findNext();)if("string"!=typeof r){var a=e.getRange(t.from(),t.to()).match(r);t.replace(o.replace(/\$(\d)/g,function(e,r){return a[r]}))}else t.replace(o)})}function d(e,o){if(!e.getOption("readOnly")){var s=e.getSelection()||r(e).lastQuery,c='<span class="CodeMirror-search-label">'+(o?e.phrase("Replace all:"):e.phrase("Replace:"))+"</span>";t(e,c+(' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">'+e.phrase("(Use /re/ syntax for regexp search)")+"</span>"),c,s,function(r){r&&(r=i(r),t(e,'<span class="CodeMirror-search-label">'+e.phrase("With:")+'</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/>',e.phrase("Replace with:"),"",function(t){if(t=a(t),o)p(e,r,t);else{u(e);var i=n(e,r,e.getCursor("from")),s=function(){var o,a,l,u,f,d,y=i.from();!(o=i.findNext())&&(i=n(e,r),!(o=i.findNext())||y&&i.from().line==y.line&&i.from().ch==y.ch)||(e.setSelection(i.from(),i.to()),e.scrollIntoView({from:i.from(),to:i.to()}),a=e,l='<span class="CodeMirror-search-label">'+(d=e).phrase("Replace?")+"</span> <button>"+d.phrase("Yes")+"</button> <button>"+d.phrase("No")+"</button> <button>"+d.phrase("All")+"</button> <button>"+d.phrase("Stop")+"</button> ",u=e.phrase("Replace?"),f=[function(){c(o)},s,function(){p(e,r,t)}],a.openConfirm?a.openConfirm(l,f):confirm(u)&&f[0]())},c=function(e){i.replace("string"==typeof r?t:t.replace(/\$(\d)/g,function(r,o){return e[o]})),s()};s()}}))})}}e.commands.find=function(e){u(e),c(e)},e.commands.findPersistent=function(e){u(e),c(e,!1,!0)},e.commands.findPersistentNext=function(e){c(e,!1,!0,!0)},e.commands.findPersistentPrev=function(e){c(e,!0,!0,!0)},e.commands.findNext=c,e.commands.findPrev=function(e){c(e,!0)},e.commands.clearSearch=u,e.commands.replace=d,e.commands.replaceAll=function(e){d(e,!0)}});
\ No newline at end of file
index 52e8418..c4237d1 100644 (file)
@@ -1 +1 @@
-!function(r){"object"==typeof exports&&"object"==typeof module?r(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],r):r(CodeMirror)}(function(r){"use strict";var t=r.Pos;function e(r,t,e){for(var n=e.paragraphStart||r.getHelper(t,"paragraphStart"),o=t.line,a=r.firstLine();o>a;--o){var i=r.getLine(o);if(n&&n.test(i))break;if(!/\S/.test(i)){++o;break}}for(var f=e.paragraphEnd||r.getHelper(t,"paragraphEnd"),l=t.line+1,s=r.lastLine();l<=s;++l){i=r.getLine(l);if(f&&f.test(i)){++l;break}if(!/\S/.test(i))break}return{from:o,to:l}}function n(r,t,e,n){for(var o=t;o<r.length&&" "==r.charAt(o);)o++;for(;o>0&&!e.test(r.slice(o-1,o+1));--o);for(var a=!0;;a=!1){var i=o;if(n)for(;" "==r.charAt(i-1);)--i;if(0!=i||!a)return{from:i,to:o};o=t}}function o(e,o,a,i){o=e.clipPos(o),a=e.clipPos(a);var f=i.column||80,l=i.wrapOn||/\s\S|-[^\.\d]/,s=!1!==i.killTrailingSpace,h=[],c="",g=o.line,p=e.getRange(o,a,!1);if(!p.length)return null;for(var u=p[0].match(/^[ \t]*/)[0],m=0;m<p.length;++m){var v=p[m],d=c.length,b=0;c&&v&&!l.test(c.charAt(c.length-1)+v.charAt(0))&&(c+=" ",b=1);var x="";if(m&&(x=v.match(/^\s*/)[0],v=v.slice(x.length)),c+=v,m){var S=c.length>f&&u==x&&n(c,f,l,s);S&&S.from==d&&S.to==d+b?(c=u+v,++g):h.push({text:[b?" ":""],from:t(g,d),to:t(g+1,x.length)})}for(;c.length>f;){var E=n(c,f,l,s);h.push({text:["",u],from:t(g,E.from),to:t(g,E.to)}),c=u+c.slice(E.to),++g}}return h.length&&e.operation(function(){for(var t=0;t<h.length;++t){var n=h[t];(n.text||r.cmpPos(n.from,n.to))&&e.replaceRange(n.text,n.from,n.to)}}),h.length?{from:h[0].from,to:r.changeEnd(h[h.length-1])}:null}r.defineExtension("wrapParagraph",function(r,n){n=n||{},r||(r=this.getCursor());var a=e(this,r,n);return o(this,t(a.from,0),t(a.to-1),n)}),r.commands.wrapLines=function(r){r.operation(function(){for(var n=r.listSelections(),a=r.lastLine()+1,i=n.length-1;i>=0;i--){var f,l=n[i];if(l.empty()){var s=e(r,l.head,{});f={from:t(s.from,0),to:t(s.to-1)}}else f={from:l.from(),to:l.to()};f.to.line>=a||(a=f.from.line,o(r,f.from,f.to,{}))}})},r.defineExtension("wrapRange",function(r,t,e){return o(this,r,t,e||{})}),r.defineExtension("wrapParagraphsInRange",function(r,n,a){a=a||{};for(var i=this,f=[],l=r.line;l<=n.line;){var s=e(i,t(l,0),a);f.push(s),l=s.to}var h=!1;return f.length&&i.operation(function(){for(var r=f.length-1;r>=0;--r)h=h||o(i,t(f[r].from,0),t(f[r].to-1),a)}),h})});
\ No newline at end of file
+!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";var r=t.Pos;function e(t,r,e){for(var n=e.paragraphStart||t.getHelper(r,"paragraphStart"),o=r.line,a=t.firstLine();o>a;--o){var i=t.getLine(o);if(n&&n.test(i))break;if(!/\S/.test(i)){++o;break}}for(var f=e.paragraphEnd||t.getHelper(r,"paragraphEnd"),l=r.line+1,h=t.lastLine();l<=h;++l){i=t.getLine(l);if(f&&f.test(i)){++l;break}if(!/\S/.test(i))break}return{from:o,to:l}}function n(t,r,e,n){for(var o=r;o<t.length&&" "==t.charAt(o);)o++;for(;o>0&&!e.test(t.slice(o-1,o+1));--o);for(var a=!0;;a=!1){var i=o;if(n)for(;" "==t.charAt(i-1);)--i;if(0!=i||!a)return{from:i,to:o};o=r}}function o(e,o,a,i){o=e.clipPos(o),a=e.clipPos(a);var f=i.column||80,l=i.wrapOn||/\s\S|-[^\.\d]/,h=!1!==i.killTrailingSpace,s=[],c="",g=o.line,p=e.getRange(o,a,!1);if(!p.length)return null;var u=p[0].match(/^[ \t]*/)[0];u.length>=f&&(f=u.length+1);for(var m=0;m<p.length;++m){var v=p[m],d=c.length,b=0;c&&v&&!l.test(c.charAt(c.length-1)+v.charAt(0))&&(c+=" ",b=1);var x="";if(m&&(x=v.match(/^\s*/)[0],v=v.slice(x.length)),c+=v,m){var S=c.length>f&&u==x&&n(c,f,l,h);S&&S.from==d&&S.to==d+b?(c=u+v,++g):s.push({text:[b?" ":""],from:r(g,d),to:r(g+1,x.length)})}for(;c.length>f;){var E=n(c,f,l,h);s.push({text:["",u],from:r(g,E.from),to:r(g,E.to)}),c=u+c.slice(E.to),++g}}return s.length&&e.operation(function(){for(var r=0;r<s.length;++r){var n=s[r];(n.text||t.cmpPos(n.from,n.to))&&e.replaceRange(n.text,n.from,n.to)}}),s.length?{from:s[0].from,to:t.changeEnd(s[s.length-1])}:null}t.defineExtension("wrapParagraph",function(t,n){n=n||{},t||(t=this.getCursor());var a=e(this,t,n);return o(this,r(a.from,0),r(a.to-1),n)}),t.commands.wrapLines=function(t){t.operation(function(){for(var n=t.listSelections(),a=t.lastLine()+1,i=n.length-1;i>=0;i--){var f,l=n[i];if(l.empty()){var h=e(t,l.head,{});f={from:r(h.from,0),to:r(h.to-1)}}else f={from:l.from(),to:l.to()};f.to.line>=a||(a=f.from.line,o(t,f.from,f.to,{}))}})},t.defineExtension("wrapRange",function(t,r,e){return o(this,t,r,e||{})}),t.defineExtension("wrapParagraphsInRange",function(t,n,a){a=a||{};for(var i=this,f=[],l=t.line;l<=n.line;){var h=e(i,r(l,0),a);f.push(h),l=h.to}var s=!1;return f.length&&i.operation(function(){for(var t=f.length-1;t>=0;--t)s=s||o(i,r(f[t].from,0),r(f[t].to-1),a)}),s})});
\ No newline at end of file
diff --git a/typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/bin/source-highlight b/typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/cm/bin/source-highlight
new file mode 100644 (file)
index 0000000..0d6239c
--- /dev/null
@@ -0,0 +1,48 @@
+#!/usr/bin/env node
+
+// Simple command-line code highlighting tool. Reads code from stdin,
+// spits html to stdout. For example:
+//
+//   echo 'function foo(a) { return a; }' | bin/source-highlight -s javascript
+//   bin/source-highlight -s 
+
+var fs = require("fs");
+
+var CodeMirror = require("../addon/runmode/runmode.node.js");
+require("../mode/meta.js");
+
+var sPos = process.argv.indexOf("-s");
+if (sPos == -1 || sPos == process.argv.length - 1) {
+   console.error("Usage: source-highlight -s language");
+   process.exit(1);
+}
+var lang = process.argv[sPos + 1].toLowerCase(), modeName = lang;
+var found = CodeMirror.findModeByMIME(lang) || CodeMirror.findModeByName(lang)
+if (found) {
+  modeName = found.mode
+  lang = found.mime
+}
+
+if (!CodeMirror.modes[modeName])
+  require("../mode/" + modeName + "/" + modeName + ".js");
+
+function esc(str) {
+  return str.replace(/[<&]/g, function(ch) { return ch == "&" ? "&amp;" : "&lt;"; });
+}
+
+var code = fs.readFileSync("/dev/stdin", "utf8");
+var curStyle = null, accum = "";
+function flush() {
+  if (curStyle) process.stdout.write("<span class=\"" + curStyle.replace(/(^|\s+)/g, "$1cm-") + "\">" + esc(accum) + "</span>");
+  else process.stdout.write(esc(accum));
+}
+
+CodeMirror.runMode(code, lang, function(text, style) {
+  if (style != curStyle) {
+    flush();
+    curStyle = style; accum = text;
+  } else {
+    accum += text;
+  }
+});
+flush();
index e7b7937..e81b492 100644 (file)
@@ -1 +1 @@
-!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../lib/codemirror")):"function"==typeof define&&define.amd?define(["../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";var e=t.Pos;function n(t,e){return t.line==e.line&&t.ch==e.ch}var r=[];function o(t){r.push(t),r.length>50&&r.shift()}function i(t){return r[r.length-(t?Math.min(t,1):1)]||""}var l=null;function a(t,e,i,a,c){null==c&&(c=t.getRange(e,i)),"grow"==a&&l&&l.cm==t&&n(e,l.pos)&&t.isClean(l.gen)?function(t){if(!r.length)return o(t);r[r.length-1]+=t}(c):!1!==a&&o(c),t.replaceRange("",e,i,"+delete"),l="grow"==a?{cm:t,pos:e,gen:t.changeGeneration()}:null}function c(t,e,n){return t.findPosH(e,n,"char",!0)}function u(t,e,n){return t.findPosH(e,n,"word",!0)}function f(t,e,n){return t.findPosV(e,n,"line",t.doc.sel.goalColumn)}function s(t,e,n){return t.findPosV(e,n,"page",t.doc.sel.goalColumn)}function g(t,n,r){for(var o=n.line,i=t.getLine(o),l=/\S/.test(r<0?i.slice(0,n.ch):i.slice(n.ch)),a=t.firstLine(),c=t.lastLine();;){if((o+=r)<a||o>c)return t.clipPos(e(o-r,r<0?0:null));if(i=t.getLine(o),/\S/.test(i))l=!0;else if(l)return e(o,0)}}function C(t,n,r){for(var o=n.line,i=n.ch,l=t.getLine(n.line),a=!1;;){var c=l.charAt(i+(r<0?-1:0));if(c){if(a&&/[!?.]/.test(c))return e(o,i+(r>0?1:0));a||(a=/\w/.test(c)),i+=r}else{if(o==(r<0?t.firstLine():t.lastLine()))return e(o,i);if(l=t.getLine(o+r),!/\S/.test(l))return e(o,i);o+=r,i=r<0?l.length:0}}}function d(t,r,o){var i;if(t.findMatchingBracket&&(i=t.findMatchingBracket(r,{strict:!0}))&&i.match&&(i.forward?1:-1)==o)return o>0?e(i.to.line,i.to.ch+1):i.to;for(var l=!0;;l=!1){var a=t.getTokenAt(r),c=e(r.line,o<0?a.start:a.end);if(!(l&&o>0&&a.end==r.ch)&&/\w/.test(a.string))return c;var u=t.findPosH(c,o,"char");if(n(c,u))return r;r=u}}function p(t,e){var n=t.state.emacsPrefix;return n?(L(t),"-"==n?-1:Number(n)):e?null:1}function h(t){var e="string"==typeof t?function(e){e.execCommand(t)}:t;return function(t){var n=p(t);e(t);for(var r=1;r<n;++r)e(t)}}function v(t,e,r,o){var i=p(t);i<0&&(o=-o,i=-i);for(var l=0;l<i;++l){var a=r(t,e,o);if(n(a,e))break;e=a}return e}function m(t,e){var n=function(n){n.extendSelection(v(n,n.getCursor(),t,e))};return n.motion=!0,n}function A(t,e,n,r){for(var o,i=t.listSelections(),l=i.length;l--;)a(t,o=i[l].head,v(t,o,e,n),r)}function S(t,e){if(t.somethingSelected()){for(var n,r=t.listSelections(),o=r.length;o--;)a(t,(n=r[o]).anchor,n.head,e);return!0}}function P(t,e){t.state.emacsPrefix?"-"!=e&&(t.state.emacsPrefix+=e):(t.state.emacsPrefix=e,t.on("keyHandled",x),t.on("inputRead",R))}var w={"Alt-G":!0,"Ctrl-X":!0,"Ctrl-Q":!0,"Ctrl-U":!0};function x(t,e){t.state.emacsPrefixMap||w.hasOwnProperty(e)||L(t)}function L(t){t.state.emacsPrefix=null,t.off("keyHandled",x),t.off("inputRead",R)}function R(t,e){var n=p(t);if(n>1&&"+input"==e.origin){for(var r=e.text.join("\n"),o="",i=1;i<n;++i)o+=r;t.replaceSelection(o)}}function y(t,e){("string"!=typeof e||!/^\d$/.test(e)&&"Ctrl-U"!=e)&&(t.removeKeyMap(D),t.state.emacsPrefixMap=!1,t.off("keyHandled",y),t.off("inputRead",y))}function k(t){t.setCursor(t.getCursor()),t.setExtending(!t.getExtending()),t.on("change",function(){t.setExtending(!1)})}function b(t){t.setExtending(!1),t.setCursor(t.getCursor())}function U(t,e){var n=t.getCursor(),r=t.findPosH(n,1,"word");t.replaceRange(e(t.getRange(n,r)),n,r),t.setCursor(r)}t.emacs={kill:a,killRegion:S,repeated:h};var X=t.keyMap.emacs=t.normalizeKeyMap({"Ctrl-W":function(t){a(t,t.getCursor("start"),t.getCursor("end"),!0)},"Ctrl-K":h(function(t){var n=t.getCursor(),r=t.clipPos(e(n.line)),o=t.getRange(n,r);/\S/.test(o)||(o+="\n",r=e(n.line+1,0)),a(t,n,r,"grow",o)}),"Alt-W":function(t){o(t.getSelection()),b(t)},"Ctrl-Y":function(t){var e=t.getCursor();t.replaceRange(i(p(t)),e,e,"paste"),t.setSelection(e,t.getCursor())},"Alt-Y":function(t){t.replaceSelection((r.length>1&&r.pop(),i()),"around","paste")},"Ctrl-Space":k,"Ctrl-Shift-2":k,"Ctrl-F":m(c,1),"Ctrl-B":m(c,-1),Right:m(c,1),Left:m(c,-1),"Ctrl-D":function(t){A(t,c,1,!1)},Delete:function(t){S(t,!1)||A(t,c,1,!1)},"Ctrl-H":function(t){A(t,c,-1,!1)},Backspace:function(t){S(t,!1)||A(t,c,-1,!1)},"Alt-F":m(u,1),"Alt-B":m(u,-1),"Alt-D":function(t){A(t,u,1,"grow")},"Alt-Backspace":function(t){A(t,u,-1,"grow")},"Ctrl-N":m(f,1),"Ctrl-P":m(f,-1),Down:m(f,1),Up:m(f,-1),"Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd",End:"goLineEnd",Home:"goLineStart","Alt-V":m(s,-1),"Ctrl-V":m(s,1),PageUp:m(s,-1),PageDown:m(s,1),"Ctrl-Up":m(g,-1),"Ctrl-Down":m(g,1),"Alt-A":m(C,-1),"Alt-E":m(C,1),"Alt-K":function(t){A(t,C,1,"grow")},"Ctrl-Alt-K":function(t){A(t,d,1,"grow")},"Ctrl-Alt-Backspace":function(t){A(t,d,-1,"grow")},"Ctrl-Alt-F":m(d,1),"Ctrl-Alt-B":m(d,-1),"Shift-Ctrl-Alt-2":function(t){var e=t.getCursor();t.setSelection(v(t,e,d,1),e)},"Ctrl-Alt-T":function(t){var e=d(t,t.getCursor(),-1),n=d(t,e,1),r=d(t,n,1),o=d(t,r,-1);t.replaceRange(t.getRange(o,r)+t.getRange(n,o)+t.getRange(e,n),e,r)},"Ctrl-Alt-U":h(function(t){for(var n=t.getCursor(),r=n.line,o=n.ch,i=[];r>=t.firstLine();){for(var l=t.getLine(r),a=null==o?l.length:o;a>0;)if(")"==(o=l.charAt(--a)))i.push("(");else if("]"==o)i.push("[");else if("}"==o)i.push("{");else if(/[\(\{\[]/.test(o)&&(!i.length||i.pop()!=o))return t.extendSelection(e(r,a));--r,o=null}}),"Alt-Space":function(t){for(var n=t.getCursor(),r=n.ch,o=n.ch,i=t.getLine(n.line);r&&/\s/.test(i.charAt(r-1));)--r;for(;o<i.length&&/\s/.test(i.charAt(o));)++o;t.replaceRange(" ",e(n.line,r),e(n.line,o))},"Ctrl-O":h(function(t){t.replaceSelection("\n","start")}),"Ctrl-T":h(function(t){t.execCommand("transposeChars")}),"Alt-C":h(function(t){U(t,function(t){var e=t.search(/\w/);return-1==e?t:t.slice(0,e)+t.charAt(e).toUpperCase()+t.slice(e+1).toLowerCase()})}),"Alt-U":h(function(t){U(t,function(t){return t.toUpperCase()})}),"Alt-L":h(function(t){U(t,function(t){return t.toLowerCase()})}),"Alt-;":"toggleComment","Ctrl-/":h("undo"),"Shift-Ctrl--":h("undo"),"Ctrl-Z":h("undo"),"Cmd-Z":h("undo"),"Shift-Alt-,":"goDocStart","Shift-Alt-.":"goDocEnd","Ctrl-S":"findPersistentNext","Ctrl-R":"findPersistentPrev","Ctrl-G":function(t){t.execCommand("clearSearch"),b(t)},"Shift-Alt-5":"replace","Alt-/":"autocomplete",Enter:"newlineAndIndent","Ctrl-J":h(function(t){t.replaceSelection("\n","end")}),Tab:"indentAuto","Alt-G G":function(t){var e,n,r,o=p(t,!0);if(null!=o&&o>0)return t.setCursor(o-1);n="Goto line",r=function(e){var n;e&&!isNaN(n=Number(e))&&n==(0|n)&&n>0&&t.setCursor(n-1)},(e=t).openDialog?e.openDialog(n+': <input type="text" style="width: 10em"/>',r,{bottom:!0}):r(prompt(n,""))},"Ctrl-X Tab":function(t){t.indentSelection(p(t,!0)||t.getOption("indentUnit"))},"Ctrl-X Ctrl-X":function(t){t.setSelection(t.getCursor("head"),t.getCursor("anchor"))},"Ctrl-X Ctrl-S":"save","Ctrl-X Ctrl-W":"save","Ctrl-X S":"saveAll","Ctrl-X F":"open","Ctrl-X U":h("undo"),"Ctrl-X K":"close","Ctrl-X Delete":function(t){a(t,t.getCursor(),C(t,t.getCursor(),1),"grow")},"Ctrl-X H":"selectAll","Ctrl-Q Tab":h("insertTab"),"Ctrl-U":function(t){t.state.emacsPrefixMap=!0,t.addKeyMap(D),t.on("keyHandled",y),t.on("inputRead",y)}}),D={"Ctrl-G":L};function E(t){D[t]=function(e){P(e,t)},X["Ctrl-"+t]=function(e){P(e,t)},w["Ctrl-"+t]=!0}for(var H=0;H<10;++H)E(String(H));E("-")});
\ No newline at end of file
+!function(t){"object"==typeof exports&&"object"==typeof module?t(require("../lib/codemirror")):"function"==typeof define&&define.amd?define(["../lib/codemirror"],t):t(CodeMirror)}(function(t){"use strict";var e=t.Pos;function n(t,e){return t.line==e.line&&t.ch==e.ch}var r=[];function o(t){r.push(t),r.length>50&&r.shift()}function i(t){return r[r.length-(t?Math.min(t,1):1)]||""}var l=null;function a(t,e,i,a,c){null==c&&(c=t.getRange(e,i)),"grow"==a&&l&&l.cm==t&&n(e,l.pos)&&t.isClean(l.gen)?function(t){if(!r.length)return o(t);r[r.length-1]+=t}(c):!1!==a&&o(c),t.replaceRange("",e,i,"+delete"),l="grow"==a?{cm:t,pos:e,gen:t.changeGeneration()}:null}function c(t,e,n){return t.findPosH(e,n,"char",!0)}function u(t,e,n){return t.findPosH(e,n,"word",!0)}function f(t,e,n){return t.findPosV(e,n,"line",t.doc.sel.goalColumn)}function s(t,e,n){return t.findPosV(e,n,"page",t.doc.sel.goalColumn)}function g(t,n,r){for(var o=n.line,i=t.getLine(o),l=/\S/.test(r<0?i.slice(0,n.ch):i.slice(n.ch)),a=t.firstLine(),c=t.lastLine();;){if((o+=r)<a||o>c)return t.clipPos(e(o-r,r<0?0:null));if(i=t.getLine(o),/\S/.test(i))l=!0;else if(l)return e(o,0)}}function C(t,n,r){for(var o=n.line,i=n.ch,l=t.getLine(n.line),a=!1;;){var c=l.charAt(i+(r<0?-1:0));if(c){if(a&&/[!?.]/.test(c))return e(o,i+(r>0?1:0));a||(a=/\w/.test(c)),i+=r}else{if(o==(r<0?t.firstLine():t.lastLine()))return e(o,i);if(l=t.getLine(o+r),!/\S/.test(l))return e(o,i);o+=r,i=r<0?l.length:0}}}function d(t,r,o){var i;if(t.findMatchingBracket&&(i=t.findMatchingBracket(r,{strict:!0}))&&i.match&&(i.forward?1:-1)==o)return o>0?e(i.to.line,i.to.ch+1):i.to;for(var l=!0;;l=!1){var a=t.getTokenAt(r),c=e(r.line,o<0?a.start:a.end);if(!(l&&o>0&&a.end==r.ch)&&/\w/.test(a.string))return c;var u=t.findPosH(c,o,"char");if(n(c,u))return r;r=u}}function p(t,e){var n=t.state.emacsPrefix;return n?(L(t),"-"==n?-1:Number(n)):e?null:1}function h(t){var e="string"==typeof t?function(e){e.execCommand(t)}:t;return function(t){var n=p(t);e(t);for(var r=1;r<n;++r)e(t)}}function A(t,e,r,o){var i=p(t);i<0&&(o=-o,i=-i);for(var l=0;l<i;++l){var a=r(t,e,o);if(n(a,e))break;e=a}return e}function v(t,e){var n=function(n){n.extendSelection(A(n,n.getCursor(),t,e))};return n.motion=!0,n}function m(t,e,n,r){for(var o,i=t.listSelections(),l=i.length;l--;)a(t,o=i[l].head,A(t,o,e,n),r)}function S(t,e){if(t.somethingSelected()){for(var n,r=t.listSelections(),o=r.length;o--;)a(t,(n=r[o]).anchor,n.head,e);return!0}}function P(t,e){t.state.emacsPrefix?"-"!=e&&(t.state.emacsPrefix+=e):(t.state.emacsPrefix=e,t.on("keyHandled",x),t.on("inputRead",R))}var w={"Alt-G":!0,"Ctrl-X":!0,"Ctrl-Q":!0,"Ctrl-U":!0};function x(t,e){t.state.emacsPrefixMap||w.hasOwnProperty(e)||L(t)}function L(t){t.state.emacsPrefix=null,t.off("keyHandled",x),t.off("inputRead",R)}function R(t,e){var n=p(t);if(n>1&&"+input"==e.origin){for(var r=e.text.join("\n"),o="",i=1;i<n;++i)o+=r;t.replaceSelection(o)}}function y(t,e){("string"!=typeof e||!/^\d$/.test(e)&&"Ctrl-U"!=e)&&(t.removeKeyMap(D),t.state.emacsPrefixMap=!1,t.off("keyHandled",y),t.off("inputRead",y))}function k(t){t.setCursor(t.getCursor()),t.setExtending(!t.getExtending()),t.on("change",function(){t.setExtending(!1)})}function b(t){t.setExtending(!1),t.setCursor(t.getCursor())}function U(t,e){var n=t.getCursor(),r=t.findPosH(n,1,"word");t.replaceRange(e(t.getRange(n,r)),n,r),t.setCursor(r)}t.emacs={kill:a,killRegion:S,repeated:h};var X=t.keyMap.emacs=t.normalizeKeyMap({"Ctrl-W":function(t){a(t,t.getCursor("start"),t.getCursor("end"),!0)},"Ctrl-K":h(function(t){var n=t.getCursor(),r=t.clipPos(e(n.line)),o=t.getRange(n,r);/\S/.test(o)||(o+="\n",r=e(n.line+1,0)),a(t,n,r,"grow",o)}),"Alt-W":function(t){o(t.getSelection()),b(t)},"Ctrl-Y":function(t){var e=t.getCursor();t.replaceRange(i(p(t)),e,e,"paste"),t.setSelection(e,t.getCursor())},"Alt-Y":function(t){t.replaceSelection((r.length>1&&r.pop(),i()),"around","paste")},"Ctrl-Space":k,"Ctrl-Shift-2":k,"Ctrl-F":v(c,1),"Ctrl-B":v(c,-1),Right:v(c,1),Left:v(c,-1),"Ctrl-D":function(t){m(t,c,1,!1)},Delete:function(t){S(t,!1)||m(t,c,1,!1)},"Ctrl-H":function(t){m(t,c,-1,!1)},Backspace:function(t){S(t,!1)||m(t,c,-1,!1)},"Alt-F":v(u,1),"Alt-B":v(u,-1),"Alt-Right":v(u,1),"Alt-Left":v(u,-1),"Alt-D":function(t){m(t,u,1,"grow")},"Alt-Backspace":function(t){m(t,u,-1,"grow")},"Ctrl-N":v(f,1),"Ctrl-P":v(f,-1),Down:v(f,1),Up:v(f,-1),"Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd",End:"goLineEnd",Home:"goLineStart","Alt-V":v(s,-1),"Ctrl-V":v(s,1),PageUp:v(s,-1),PageDown:v(s,1),"Ctrl-Up":v(g,-1),"Ctrl-Down":v(g,1),"Alt-A":v(C,-1),"Alt-E":v(C,1),"Alt-K":function(t){m(t,C,1,"grow")},"Ctrl-Alt-K":function(t){m(t,d,1,"grow")},"Ctrl-Alt-Backspace":function(t){m(t,d,-1,"grow")},"Ctrl-Alt-F":v(d,1),"Ctrl-Alt-B":v(d,-1),"Shift-Ctrl-Alt-2":function(t){var e=t.getCursor();t.setSelection(A(t,e,d,1),e)},"Ctrl-Alt-T":function(t){var e=d(t,t.getCursor(),-1),n=d(t,e,1),r=d(t,n,1),o=d(t,r,-1);t.replaceRange(t.getRange(o,r)+t.getRange(n,o)+t.getRange(e,n),e,r)},"Ctrl-Alt-U":h(function(t){for(var n=t.getCursor(),r=n.line,o=n.ch,i=[];r>=t.firstLine();){for(var l=t.getLine(r),a=null==o?l.length:o;a>0;)if(")"==(o=l.charAt(--a)))i.push("(");else if("]"==o)i.push("[");else if("}"==o)i.push("{");else if(/[\(\{\[]/.test(o)&&(!i.length||i.pop()!=o))return t.extendSelection(e(r,a));--r,o=null}}),"Alt-Space":function(t){for(var n=t.getCursor(),r=n.ch,o=n.ch,i=t.getLine(n.line);r&&/\s/.test(i.charAt(r-1));)--r;for(;o<i.length&&/\s/.test(i.charAt(o));)++o;t.replaceRange(" ",e(n.line,r),e(n.line,o))},"Ctrl-O":h(function(t){t.replaceSelection("\n","start")}),"Ctrl-T":h(function(t){t.execCommand("transposeChars")}),"Alt-C":h(function(t){U(t,function(t){var e=t.search(/\w/);return-1==e?t:t.slice(0,e)+t.charAt(e).toUpperCase()+t.slice(e+1).toLowerCase()})}),"Alt-U":h(function(t){U(t,function(t){return t.toUpperCase()})}),"Alt-L":h(function(t){U(t,function(t){return t.toLowerCase()})}),"Alt-;":"toggleComment","Ctrl-/":h("undo"),"Shift-Ctrl--":h("undo"),"Ctrl-Z":h("undo"),"Cmd-Z":h("undo"),"Shift-Alt-,":"goDocStart","Shift-Alt-.":"goDocEnd","Ctrl-S":"findPersistentNext","Ctrl-R":"findPersistentPrev","Ctrl-G":function(t){t.execCommand("clearSearch"),b(t)},"Shift-Alt-5":"replace","Alt-/":"autocomplete",Enter:"newlineAndIndent","Ctrl-J":h(function(t){t.replaceSelection("\n","end")}),Tab:"indentAuto","Alt-G G":function(t){var e,n,r,o=p(t,!0);if(null!=o&&o>0)return t.setCursor(o-1);n="Goto line",r=function(e){var n;e&&!isNaN(n=Number(e))&&n==(0|n)&&n>0&&t.setCursor(n-1)},(e=t).openDialog?e.openDialog(n+': <input type="text" style="width: 10em"/>',r,{bottom:!0}):r(prompt(n,""))},"Ctrl-X Tab":function(t){t.indentSelection(p(t,!0)||t.getOption("indentUnit"))},"Ctrl-X Ctrl-X":function(t){t.setSelection(t.getCursor("head"),t.getCursor("anchor"))},"Ctrl-X Ctrl-S":"save","Ctrl-X Ctrl-W":"save","Ctrl-X S":"saveAll","Ctrl-X F":"open","Ctrl-X U":h("undo"),"Ctrl-X K":"close","Ctrl-X Delete":function(t){a(t,t.getCursor(),C(t,t.getCursor(),1),"grow")},"Ctrl-X H":"selectAll","Ctrl-Q Tab":h("insertTab"),"Ctrl-U":function(t){t.state.emacsPrefixMap=!0,t.addKeyMap(D),t.on("keyHandled",y),t.on("inputRead",y)}}),D={"Ctrl-G":L};function E(t){D[t]=function(e){P(e,t)},X["Ctrl-"+t]=function(e){P(e,t)},w["Ctrl-"+t]=!0}for(var H=0;H<10;++H)E(String(H));E("-")});
\ No newline at end of file
index 3361745..a3ed3ff 100644 (file)
@@ -1 +1 @@
-!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/dialog/dialog"),require("../addon/edit/matchbrackets.js")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/dialog/dialog","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(e){"use strict";var t=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",type:"keyToKey",toKeys:"k"},{keys:"<Down>",type:"keyToKey",toKeys:"j"},{keys:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",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:"<Home>",type:"keyToKey",toKeys:"0"},{keys:"<End>",type:"keyToKey",toKeys:"$"},{keys:"<PageUp>",type:"keyToKey",toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"<Ins>",type:"action",action:"toggleOverwrite",context:"insert"},{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:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",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<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<character>",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:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",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:"expandToLine",motionArgs:{linewise:!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:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",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:"<C-v>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"<C-q>",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<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<character>",type:"action",action:"replayMacro"},{keys:"q<character>",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:"<C-r>",type:"action",action:"redo"},{keys:"m<character>",type:"action",action:"setMark"},{keys:'"<character>',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<CR>",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:"<C-a>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"<C-x>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"<C-t>",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"<C-d>",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a<character>",type:"motion",motion:"textObjectManipulation"},{keys:"i<character>",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;e.Vim=function(){function o(t,r){var n;this==e.keyMap.vim&&(e.rmClass(t.getWrapperElement(),"cm-fat-cursor"),"contenteditable"==t.getOption("inputStyle")&&null!=document.body.style.caretColor&&(function(e){var t=e.state.fatCursorMarks;if(t)for(var r=0;r<t.length;r++)t[r].clear();e.state.fatCursorMarks=null,e.off("cursorActivity",s)}(t),t.getInputField().style.caretColor="")),r&&r.attach==i||((n=t).setOption("disableInput",!1),n.off("cursorActivity",$e),e.off(n.getInputField(),"paste",h(n)),n.state.vim=null)}function i(t,r){var n,o;this==e.keyMap.vim&&(e.addClass(t.getWrapperElement(),"cm-fat-cursor"),"contenteditable"==t.getOption("inputStyle")&&null!=document.body.style.caretColor&&((n=t).state.fatCursorMarks=a(n),n.on("cursorActivity",s),t.getInputField().style.caretColor="transparent")),r&&r.attach==i||((o=t).setOption("disableInput",!0),o.setOption("showCursorWhenSelecting",!1),e.signal(o,"vim-mode-change",{mode:"normal"}),o.on("cursorActivity",$e),N(o),e.on(o.getInputField(),"paste",h(o)))}function a(e){for(var t=e.listSelections(),r=[],o=0;o<t.length;o++){var i=t[o];if(i.empty())if(i.anchor.ch<e.getLine(i.anchor.line).length)r.push(e.markText(i.anchor,n(i.anchor.line,i.anchor.ch+1),{className:"cm-fat-cursor-mark"}));else{var a=document.createElement("span");a.textContent=" ",a.className="cm-fat-cursor-mark",r.push(e.setBookmark(i.anchor,{widget:a}))}}return r}function s(e){var t=e.state.fatCursorMarks;if(t)for(var r=0;r<t.length;r++)t[r].clear();e.state.fatCursorMarks=a(e)}function l(t,r){if(r){if(this[t])return this[t];var n=function(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,o=0;o<t.length;o++){var i=t[o];i in c?t[o]=c[i]:n=!0,i in u&&(t[o]=u[i])}return!!n&&(x(r)&&(t[t.length-1]=r.toLowerCase()),"<"+t.join("-")+">")}(t);if(!n)return!1;var o=e.Vim.findKey(r,n);return"function"==typeof o&&e.signal(r,"vim-keypress",n),o}}e.defineOption("vimMode",!1,function(t,r,n){r&&"vim"!=t.getOption("keyMap")?t.setOption("keyMap","vim"):!r&&n!=e.Init&&/^vim/.test(t.getOption("keyMap"))&&t.setOption("keyMap","default")});var c={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A"},u={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"};function h(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(Z(e.getCursor(),0,1)),q.enterInsertMode(e,{},t))}),t.onPasteFn}var p=/[\d]/,f=[e.isWordChar,function(t){return t&&!e.isWordChar(t)&&!/\s/.test(t)}],d=[function(e){return/\S/.test(e)}];function m(e,t){for(var r=[],n=e;n<e+t;n++)r.push(String.fromCharCode(n));return r}var g=m(65,26),v=m(97,26),y=m(48,10),k=[].concat(g,v,y,["<",">"]),C=[].concat(g,v,y,["-",'"',".",":","/"]);function w(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function M(e){return/^[a-z]$/.test(e)}function x(e){return/^[A-Z]$/.test(e)}function S(e){return/^\s*$/.test(e)}function A(e,t){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}var b={};function L(e,t,r,n,o){if(void 0===t&&!o)throw Error("defaultValue is required unless callback is provided");if(r||(r="string"),b[e]={type:r,defaultValue:t,callback:o},n)for(var i=0;i<n.length;i++)b[n[i]]=b[e];t&&T(e,t)}function T(e,t,r,n){var o=b[e],i=(n=n||{}).scope;if(!o)return new Error("Unknown option: "+e);if("boolean"==o.type){if(t&&!0!==t)return new Error("Invalid argument: "+e+"="+t);!1!==t&&(t=!0)}o.callback?("local"!==i&&o.callback(t,void 0),"global"!==i&&r&&o.callback(t,r)):("local"!==i&&(o.value="boolean"==o.type?!!t:t),"global"!==i&&r&&(r.state.vim.options[e]={value:t}))}function R(e,t,r){var n=b[e],o=(r=r||{}).scope;if(!n)return new Error("Unknown option: "+e);if(n.callback){var i=t&&n.callback(void 0,t);return"global"!==o&&void 0!==i?i:"local"!==o?n.callback():void 0}return((i="global"!==o&&t&&t.state.vim.options[e])||"local"!==o&&n||{}).value}L("filetype",void 0,"string",["ft"],function(e,t){if(void 0!==t){if(void 0===e)return"null"==(r=t.getOption("mode"))?"":r;var r=""==e?"null":e;t.setOption("mode",r)}});var E,O,I=function(){var e=100,t=-1,r=0,n=0,o=new Array(e);return{cachedCursor:void 0,add:function(i,a,s){var l=o[t%e];function c(r){var n=++t%e,a=o[n];a&&a.clear(),o[n]=i.setBookmark(r)}if(l){var u=l.find();u&&!ee(u,a)&&c(a)}else c(a);c(s),r=t,(n=t-e+1)<0&&(n=0)},move:function(i,a){(t+=a)>r?t=r:t<n&&(t=n);var s=o[(e+t)%e];if(s&&!s.find()){var l,c=a>0?1:-1,u=i.getCursor();do{if((s=o[(e+(t+=c))%e])&&(l=s.find())&&!ee(u,l))break}while(t<r&&t>n)}return s}}},B=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};function K(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=B()}function N(e){return e.state.vim||(e.state.vim={inputState:new H,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},fakeCursor:null,insertMode:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}}),e.state.vim}function P(){for(var e in E={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:I(),macroModeState:new K,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new W({}),searchHistoryController:new V,exCommandHistoryController:new V},b){var t=b[e];t.value=t.defaultValue}}K.prototype={exitMacroRecordMode:function(){var e=E.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1},enterMacroRecordMode:function(e,t){var r=E.registerController.getRegister(t);r&&(r.clear(),this.latestRegister=t,e.openDialog&&(this.onRecordingDone=e.openDialog("(recording)["+t+"]",null,{bottom:!0})),this.isRecording=!0)}};var j={buildKeyMap:function(){},getRegisterController:function(){return E.registerController},resetVimGlobalState_:P,getVimGlobalState_:function(){return E},maybeInitVimState_:N,suppressErrorLogging:!1,InsertModeKey:Qe,map:function(e,t,r){We.map(e,t,r)},unmap:function(e,t){We.unmap(e,t)},setOption:T,getOption:R,defineOption:L,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;Fe[e]=r,We.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,r){var n=this.findKey(e,t,r);if("function"==typeof n)return n()},findKey:function(r,n,o){var i,a=N(r);function s(){var e=E.macroModeState;if(e.isRecording){if("q"==n)return e.exitMacroRecordMode(),_(r),!0;"mapping"!=o&&function(e,t){if(!e.isPlaying){var r=e.latestRegister,n=E.registerController.getRegister(r);n&&n.pushText(t)}}(e,n)}}function l(){if("<Esc>"==n)return _(r),a.visualMode?pe(r):a.insertMode&&Ve(r),!0}return!1===(i=a.insertMode?function(){if(l())return!0;for(var e=a.inputState.keyBuffer=a.inputState.keyBuffer+n,o=1==n.length,i=D.matchCommand(e,t,a.inputState,"insert");e.length>1&&"full"!=i.type;){e=a.inputState.keyBuffer=e.slice(1);var s=D.matchCommand(e,t,a.inputState,"insert");"none"!=s.type&&(i=s)}if("none"==i.type)return _(r),!1;if("partial"==i.type)return O&&window.clearTimeout(O),O=window.setTimeout(function(){a.insertMode&&a.inputState.keyBuffer&&_(r)},R("insertModeEscKeysTimeout")),!o;if(O&&window.clearTimeout(O),o){for(var c=r.listSelections(),u=0;u<c.length;u++){var h=c[u].head;r.replaceRange("",Z(h,0,-(e.length-1)),h,"+input")}E.macroModeState.lastInsertModeChanges.changes.pop()}return _(r),i.command}():function(){if(s()||l())return!0;var e=a.inputState.keyBuffer=a.inputState.keyBuffer+n;if(/^[1-9]\d*$/.test(e))return!0;if(!(o=/^(\d*)(.*)$/.exec(e)))return _(r),!1;var o,i=a.visualMode?"visual":"normal",c=D.matchCommand(o[2]||o[1],t,a.inputState,i);return"none"==c.type?(_(r),!1):"partial"==c.type||(a.inputState.keyBuffer="",(o=/^(\d*)(.*)$/.exec(e))[1]&&"0"!=o[1]&&a.inputState.pushRepeatDigit(o[1]),c.command)}())?void 0:!0===i?function(){return!0}:function(){return r.operation(function(){r.curOp.isVimOp=!0;try{"keyToKey"==i.type?function(t){for(var o;t;)o=/<\w+-.+?>|<\w+>|./.exec(t),n=o[0],t=t.substring(o.index+n.length),e.Vim.handleKey(r,n,"mapping")}(i.toKeys):D.processCommand(r,a,i)}catch(t){throw r.state.vim=void 0,N(r),e.Vim.suppressErrorLogging||console.log(t),t}return!0})}},handleEx:function(e,t){We.processCommand(e,t)},defineMotion:function(e,t){U[e]=t},defineAction:function(e,t){q[e]=t},defineOperator:function(e,t){$[e]=t},mapCommand:function(e,t,r,n,o){var i={keys:e,type:t};for(var a in i[t]=r,i[t+"Args"]=n,o)i[a]=o[a];De(i)},_mapCommand:De,defineRegister:function(e,t){var r=E.registerController.registers;if(!e||1!=e.length)throw Error("Register name must be 1 character");if(r[e])throw Error("Register already defined "+e);r[e]=t,C.push(e)},exitVisualMode:pe,exitInsertMode:Ve};function H(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=null}function _(t,r){t.state.vim.inputState=new H,e.signal(t,"vim-command-done",r)}function F(e,t,r){this.clear(),this.keyBuffer=[e||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!t,this.blockwise=!!r}function W(e){this.registers=e,this.unnamedRegister=e['"']=new F,e["."]=new F,e[":"]=new F,e["/"]=new F}function V(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}H.prototype.pushRepeatDigit=function(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)},H.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},F.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(B(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("")}},W.prototype={pushText:function(e,t,r,n,o){n&&"\n"!==r.charAt(r.length-1)&&(r+="\n");var i=this.isValidRegister(e)?this.getRegister(e):null;if(i)x(e)?i.pushText(r,n):i.setText(r,n,o),this.unnamedRegister.setText(i.toString(),n);else{switch(t){case"yank":this.registers[0]=new F(r,n,o);break;case"delete":case"change":-1==r.indexOf("\n")?this.registers["-"]=new F(r,n):(this.shiftNumericRegisters_(),this.registers[1]=new F(r,n))}this.unnamedRegister.setText(r,n,o)}},getRegister:function(e){return this.isValidRegister(e)?(e=e.toLowerCase(),this.registers[e]||(this.registers[e]=new F),this.registers[e]):this.unnamedRegister},isValidRegister:function(e){return e&&A(e,C)},shiftNumericRegisters_:function(){for(var e=9;e>=2;e--)this.registers[e]=this.getRegister(""+(e-1))}},V.prototype={nextMatch:function(e,t){var r=this.historyBuffer,n=t?-1:1;null===this.initialPrefix&&(this.initialPrefix=e);for(var o=this.iterator+n;t?o>=0:o<r.length;o+=n)for(var i=r[o],a=0;a<=i.length;a++)if(this.initialPrefix==i.substring(0,a))return this.iterator=o,i;return o>=r.length?(this.iterator=r.length,this.initialPrefix):o<0?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 D={matchCommand:function(e,t,r,n){var o,i=function(e,t,r,n){for(var o,i=[],a=[],s=0;s<t.length;s++){var l=t[s];"insert"==r&&"insert"!=l.context||l.context&&l.context!=r||n.operator&&"action"==l.type||!(o=G(e,l.keys))||("partial"==o&&i.push(l),"full"==o&&a.push(l))}return{partial:i.length&&i,full:a.length&&a}}(e,t,n,r);if(!i.full&&!i.partial)return{type:"none"};if(!i.full&&i.partial)return{type:"partial"};for(var a=0;a<i.full.length;a++){var s=i.full[a];o||(o=s)}if("<character>"==o.keys.slice(-11)){var l=function(e){var t=/^.*(<[^>]+>)$/.exec(e),r=t?t[1]:e.slice(-1);if(r.length>1)switch(r){case"<CR>":r="\n";break;case"<Space>":r=" ";break;default:r=""}return r}(e);if(!l)return{type:"none"};r.selectedCharacter=l}return{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=z(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);_(e)}n.operator=r.operator,n.operatorArgs=z(r.operatorArgs),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,r){var n=t.visualMode,o=z(r.operatorMotionArgs);o&&n&&o.visualLine&&(t.visualLine=!0),this.processOperator(e,t,r),n||this.processMotion(e,t,r)},processAction:function(e,t,r){var n=t.inputState,o=n.getRepeat(),i=!!o,a=z(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=o||1,a.repeatIsExplicit=i,a.registerName=n.registerName,_(e),t.lastMotion=null,r.isEdit&&this.recordLastEdit(t,n,r),q[r.action](e,a,t)},processSearch:function(t,r,n){if(t.getSearchCursor){var o=n.searchArgs.forward,i=n.searchArgs.wholeWordOnly;Se(t).setReversed(!o);var a=o?"/":"?",s=Se(t).getQuery(),l=t.getScrollInfo();switch(n.searchArgs.querySrc){case"prompt":var c=E.macroModeState;c.isPlaying?f(p=c.replaySearchQueries.shift(),!0,!1):Ie(t,{onClose:function(e){t.scrollTo(l.left,l.top),f(e,!0,!0);var r=E.macroModeState;r.isRecording&&function(e,t){if(!e.isPlaying){var r=e.latestRegister,n=E.registerController.getRegister(r);n&&n.pushSearchQuery&&n.pushSearchQuery(t)}}(r,e)},prefix:a,desc:Oe,onKeyUp:function(r,n,i){var a,s,c,u=e.keyName(r);"Up"==u||"Down"==u?(a="Up"==u,s=r.target?r.target.selectionEnd:0,i(n=E.searchHistoryController.nextMatch(n,a)||""),s&&r.target&&(r.target.selectionEnd=r.target.selectionStart=Math.min(s,r.target.value.length))):"Left"!=u&&"Right"!=u&&"Ctrl"!=u&&"Alt"!=u&&"Shift"!=u&&E.searchHistoryController.reset();try{c=Be(t,n,!0,!0)}catch(r){}c?t.scrollIntoView(Ne(t,!o,c),30):(Pe(t),t.scrollTo(l.left,l.top))},onKeyDown:function(r,n,o){var i=e.keyName(r);"Esc"==i||"Ctrl-C"==i||"Ctrl-["==i||"Backspace"==i&&""==n?(E.searchHistoryController.pushInput(n),E.searchHistoryController.reset(),Be(t,s),Pe(t),t.scrollTo(l.left,l.top),e.e_stop(r),_(t),o(),t.focus()):"Up"==i||"Down"==i?e.e_stop(r):"Ctrl-U"==i&&(e.e_stop(r),o(""))}});break;case"wordUnderCursor":var u=de(t,!1,0,!1,!0),h=!0;if(u||(u=de(t,!1,0,!1,!1),h=!1),!u)return;var p=t.getLine(u.start.line).substring(u.start.ch,u.end.ch);p=h&&i?"\\b"+p+"\\b":p.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1"),E.jumpList.cachedCursor=t.getCursor(),t.setCursor(u.start),f(p,!0,!1)}}function f(e,o,i){E.searchHistoryController.pushInput(e),E.searchHistoryController.reset();try{Be(t,e,o,i)}catch(r){return Ee(t,"Invalid regex: "+e),void _(t)}D.processMotion(t,r,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:n.searchArgs.toJumplist}})}},processEx:function(t,r,n){function o(e){E.exCommandHistoryController.pushInput(e),E.exCommandHistoryController.reset(),We.processCommand(t,e)}function i(r,n,o){var i,a,s=e.keyName(r);("Esc"==s||"Ctrl-C"==s||"Ctrl-["==s||"Backspace"==s&&""==n)&&(E.exCommandHistoryController.pushInput(n),E.exCommandHistoryController.reset(),e.e_stop(r),_(t),o(),t.focus()),"Up"==s||"Down"==s?(e.e_stop(r),i="Up"==s,a=r.target?r.target.selectionEnd:0,o(n=E.exCommandHistoryController.nextMatch(n,i)||""),a&&r.target&&(r.target.selectionEnd=r.target.selectionStart=Math.min(a,r.target.value.length))):"Ctrl-U"==s?(e.e_stop(r),o("")):"Left"!=s&&"Right"!=s&&"Ctrl"!=s&&"Alt"!=s&&"Shift"!=s&&E.exCommandHistoryController.reset()}"keyToEx"==n.type?We.processCommand(t,n.exArgs.input):r.visualMode?Ie(t,{onClose:o,prefix:":",value:"'<,'>",onKeyDown:i,selectValueOnOpen:!1}):Ie(t,{onClose:o,prefix:":",onKeyDown:i})},evalInput:function(e,t){var r,o,i,a,s=t.inputState,l=s.motion,c=s.motionArgs||{},u=s.operator,h=s.operatorArgs||{},p=s.registerName,f=t.sel,d=Y(t.visualMode?Q(e,f.head):e.getCursor("head")),m=Y(t.visualMode?Q(e,f.anchor):e.getCursor("anchor")),g=Y(d),v=Y(m);if(u&&this.recordLastEdit(t,s),(i=void 0!==s.repeatOverride?s.repeatOverride:s.getRepeat())>0&&c.explicitRepeat?c.repeatIsExplicit=!0:(c.noRepeat||!c.explicitRepeat&&0===i)&&(i=1,c.repeatIsExplicit=!1),s.selectedCharacter&&(c.selectedCharacter=h.selectedCharacter=s.selectedCharacter),c.repeat=i,_(e),l){var y=U[l](e,d,c,t);if(t.lastMotion=U[l],!y)return;if(c.toJumplist){var k=E.jumpList,C=k.cachedCursor;C?(me(e,C,y),delete k.cachedCursor):me(e,d,y)}y instanceof Array?(o=y[0],r=y[1]):r=y,r||(r=Y(d)),t.visualMode?(t.visualBlock&&r.ch===1/0||(r=Q(e,r,t.visualBlock)),o&&(o=Q(e,o,!0)),o=o||v,f.anchor=o,f.head=r,ue(e),we(e,t,"<",te(o,r)?o:r),we(e,t,">",te(o,r)?r:o)):u||(r=Q(e,r),e.setCursor(r.line,r.ch))}if(u){if(h.lastSel){o=v;var w=h.lastSel,M=Math.abs(w.head.line-w.anchor.line),x=Math.abs(w.head.ch-w.anchor.ch);r=w.visualLine?n(v.line+M,v.ch):w.visualBlock?n(v.line+M,v.ch+x):w.head.line==w.anchor.line?n(v.line,v.ch+x):n(v.line+M,v.ch),t.visualMode=!0,t.visualLine=w.visualLine,t.visualBlock=w.visualBlock,f=t.sel={anchor:o,head:r},ue(e)}else t.visualMode&&(h.lastSel={anchor:Y(f.anchor),head:Y(f.head),visualBlock:t.visualBlock,visualLine:t.visualLine});var A,b,L,T,R;if(t.visualMode){if(A=re(f.head,f.anchor),b=ne(f.head,f.anchor),L=t.visualLine||h.linewise,R=he(e,{anchor:A,head:b},T=t.visualBlock?"block":L?"line":"char"),L){var O=R.ranges;if("block"==T)for(var I=0;I<O.length;I++)O[I].head.ch=ie(e,O[I].head.line);else"line"==T&&(O[0].head=n(O[0].head.line+1,0))}}else{if(A=Y(o||v),te(b=Y(r||g),A)){var B=A;A=b,b=B}(L=c.linewise||h.linewise)?(a=b,A.ch=0,a.ch=0,a.line++):c.forward&&function(e,t,r){var n=e.getRange(t,r);if(/\n\s*$/.test(n)){var o=n.split("\n");o.pop();for(var i=o.pop();o.length>0&&i&&S(i);i=o.pop())r.line--,r.ch=0;i?(r.line--,r.ch=ie(e,r.line)):r.ch=0}}(e,A,b),R=he(e,{anchor:A,head:b},T="char",!c.inclusive||L)}e.setSelections(R.ranges,R.primary),t.lastMotion=null,h.repeat=i,h.registerName=p,h.linewise=L;var K=$[u](e,h,R.ranges,v,r);t.visualMode&&pe(e,null!=K),K&&e.setCursor(K)}},recordLastEdit:function(e,t,r){var n=E.macroModeState;n.isPlaying||(e.lastEditInputState=t,e.lastEditActionCommand=r,n.lastInsertModeChanges.changes=[],n.lastInsertModeChanges.expectCursorActivityForChange=!1)}},U={moveToTopLine:function(e,t,r){var o=je(e).top+r.repeat-1;return n(o,fe(e.getLine(o)))},moveToMiddleLine:function(e){var t=je(e),r=Math.floor(.5*(t.top+t.bottom));return n(r,fe(e.getLine(r)))},moveToBottomLine:function(e,t,r){var o=je(e).bottom-r.repeat+1;return n(o,fe(e.getLine(o)))},expandToLine:function(e,t,r){return n(t.line+r.repeat-1,1/0)},findNext:function(e,t,r){var n=Se(e),o=n.getQuery();if(o){var i=!r.forward;return i=n.isReversed()?!i:i,Ke(e,o),Ne(e,i,o,r.repeat)}},goToMark:function(e,t,r,n){var o=He(e,n,r.selectedCharacter);return o?r.linewise?{line:o.line,ch:fe(e.getLine(o.line))}:o:null},moveToOtherHighlightedEnd:function(e,t,r,o){if(o.visualBlock&&r.sameLine){var i=o.sel;return[Q(e,n(i.anchor.line,i.head.ch)),Q(e,n(i.head.line,i.anchor.ch))]}return[o.sel.head,o.sel.anchor]},jumpToMark:function(e,t,r,o){for(var i=t,a=0;a<r.repeat;a++){var s=i;for(var l in o.marks)if(M(l)){var c=o.marks[l].find();if(!((r.forward?te(c,s):te(s,c))||r.linewise&&c.line==s.line)){var u=ee(s,i),h=r.forward?oe(s,c,i):oe(i,c,s);(u||h)&&(i=c)}}}return r.linewise&&(i=n(i.line,fe(e.getLine(i.line)))),i},moveByCharacters:function(e,t,r){var o=t,i=r.repeat,a=r.forward?o.ch+i:o.ch-i;return n(o.line,a)},moveByLines:function(e,t,r,o){var i=t,a=i.ch;switch(o.lastMotion){case this.moveByLines:case this.moveByDisplayLines:case this.moveByScroll:case this.moveToColumn:case this.moveToEol:a=o.lastHPos;break;default:o.lastHPos=a}var s=r.repeat+(r.repeatOffset||0),l=r.forward?i.line+s:i.line-s,c=e.firstLine(),u=e.lastLine();return l<c&&i.line==c?this.moveToStartOfLine(e,t,r,o):l>u&&i.line==u?this.moveToEol(e,t,r,o):(r.toFirstChar&&(a=fe(e.getLine(l)),o.lastHPos=a),o.lastHSPos=e.charCoords(n(l,a),"div").left,n(l,a))},moveByDisplayLines:function(e,t,r,o){var i=t;switch(o.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:o.lastHSPos=e.charCoords(i,"div").left}var a=r.repeat;if((l=e.findPosV(i,r.forward?a:-a,"line",o.lastHSPos)).hitSide)if(r.forward)var s={top:e.charCoords(l,"div").top+8,left:o.lastHSPos},l=e.coordsChar(s,"div");else{var c=e.charCoords(n(e.firstLine(),0),"div");c.left=o.lastHSPos,l=e.coordsChar(c,"div")}return o.lastHPos=l.ch,l},moveByPage:function(e,t,r){var n=t,o=r.repeat;return e.findPosV(n,r.forward?o:-o,"page")},moveByParagraph:function(e,t,r){var n=r.forward?1:-1;return Me(e,t,r.repeat,n)},moveByScroll:function(e,t,r,n){var o=e.getScrollInfo(),i=null,a=r.repeat;a||(a=o.clientHeight/(2*e.defaultTextHeight()));var s=e.charCoords(t,"local");if(r.repeat=a,!(i=U.moveByDisplayLines(e,t,r,n)))return null;var l=e.charCoords(i,"local");return e.scrollTo(null,o.top+l.top-s.top),i},moveByWords:function(e,t,r){return function(e,t,r,o,i,a){var s=Y(t),l=[];(o&&!i||!o&&i)&&r++;for(var c=!(o&&i),u=0;u<r;u++){var h=ke(e,t,o,a,c);if(!h){var p=ie(e,e.lastLine());l.push(o?{line:e.lastLine(),from:p,to:p}:{line:0,from:0,to:0});break}l.push(h),t=n(h.line,o?h.to-1:h.from)}var f=l.length!=r,d=l[0],m=l.pop();return o&&!i?(f||d.from==s.ch&&d.line==s.line||(m=l.pop()),n(m.line,m.from)):o&&i?n(m.line,m.to-1):!o&&i?(f||d.to==s.ch&&d.line==s.line||(m=l.pop()),n(m.line,m.to)):n(m.line,m.from)}(e,t,r.repeat,!!r.forward,!!r.wordEnd,!!r.bigWord)},moveTillCharacter:function(e,t,r){var n=Ce(e,r.repeat,r.forward,r.selectedCharacter),o=r.forward?-1:1;return ge(o,r),n?(n.ch+=o,n):null},moveToCharacter:function(e,t,r){var n=r.repeat;return ge(0,r),Ce(e,n,r.forward,r.selectedCharacter)||t},moveToSymbol:function(e,t,r){return function(e,t,r,o){var i=Y(e.getCursor()),a=r?1:-1,s=r?e.lineCount():-1,l=i.ch,c=i.line,u=e.getLine(c),h={lineText:u,nextCh:u.charAt(l),lastCh:null,index:l,symb:o,reverseSymb:(r?{")":"(","}":"{"}:{"(":")","{":"}"})[o],forward:r,depth:0,curMoveThrough:!1},p=ve[o];if(!p)return i;var f=ye[p].init,d=ye[p].isComplete;for(f&&f(h);c!==s&&t;){if(h.index+=a,h.nextCh=h.lineText.charAt(h.index),!h.nextCh){if(c+=a,h.lineText=e.getLine(c)||"",a>0)h.index=0;else{var m=h.lineText.length;h.index=m>0?m-1:0}h.nextCh=h.lineText.charAt(h.index)}d(h)&&(i.line=c,i.ch=h.index,t--)}return h.nextCh||h.curMoveThrough?n(c,h.index):i}(e,r.repeat,r.forward,r.selectedCharacter)||t},moveToColumn:function(e,t,r,o){var i,a,s,l=r.repeat;return o.lastHPos=l-1,o.lastHSPos=e.charCoords(t,"div").left,a=l,s=(i=e).getCursor().line,Q(i,n(s,a-1))},moveToEol:function(e,t,r,o){var i=t;o.lastHPos=1/0;var a=n(i.line+r.repeat-1,1/0),s=e.clipPos(a);return s.ch--,o.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){for(var r,o=t,i=o.line,a=o.ch,s=e.getLine(i);a<s.length;a++)if((r=s.charAt(a))&&-1!="()[]{}".indexOf(r)){var l=e.getTokenTypeAt(n(i,a+1));if("string"!==l&&"comment"!==l)break}return a<s.length?e.findMatchingBracket(n(i,a)).to:o},moveToStartOfLine:function(e,t){return n(t.line,0)},moveToLineOrEdgeOfDocument:function(e,t,r){var o=r.forward?e.lastLine():e.firstLine();return r.repeatIsExplicit&&(o=r.repeat-e.getOption("firstLineNumber")),n(o,fe(e.getLine(o)))},textObjectManipulation:function(e,t,r,o){var i=r.selectedCharacter;"b"==i?i="(":"B"==i&&(i="{");var a,s,l,c,u,h,p,f,d=!r.textObjectInner;if({"(":")",")":"(","{":"}","}":"{","[":"]","]":"["}[i])a=function(e,t,r,o){var i,a,s=t,l={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/}[r],c={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{"}[r],u=e.getLine(s.line).charAt(s.ch)===c?1:0;if(i=e.scanForBracket(n(s.line,s.ch+u),-1,null,{bracketRegex:l}),a=e.scanForBracket(n(s.line,s.ch+u),1,null,{bracketRegex:l}),!i||!a)return{start:s,end:s};if(i=i.pos,a=a.pos,i.line==a.line&&i.ch>a.ch||i.line>a.line){var h=i;i=a,a=h}return o?a.ch+=1:i.ch+=1,{start:i,end:a}}(e,t,i,d);else if({"'":!0,'"':!0}[i])a=function(e,t,r,o){var i,a,s,l,c=Y(t),u=e.getLine(c.line).split(""),h=u.indexOf(r);if(c.ch<h?c.ch=h:h<c.ch&&u[c.ch]==r&&(a=c.ch,--c.ch),u[c.ch]!=r||a)for(s=c.ch;s>-1&&!i;s--)u[s]==r&&(i=s+1);else i=c.ch+1;if(i&&!a)for(s=i,l=u.length;s<l&&!a;s++)u[s]==r&&(a=s);return i&&a?(o&&(--i,++a),{start:n(c.line,i),end:n(c.line,a)}):{start:c,end:c}}(e,t,i,d);else if("W"===i)a=de(e,d,0,!0);else if("w"===i)a=de(e,d,0,!1);else{if("p"!==i)return null;if(a=Me(e,t,r.repeat,0,d),r.linewise=!0,o.visualMode)o.visualLine||(o.visualLine=!0);else{var m=o.inputState.operatorArgs;m&&(m.linewise=!0),a.end.line--}}return e.state.vim.visualMode?(s=e,l=a.start,c=a.end,h=s.state.vim.sel,p=h.head,f=h.anchor,te(c,l)&&(u=c,c=l,l=u),te(p,f)?(p=re(l,p),f=ne(f,c)):(f=re(l,f),-1==(p=Z(p=ne(p,c),0,-1)).ch&&p.line!=s.firstLine()&&(p=n(p.line-1,ie(s,p.line-1)))),[f,p]):[a.start,a.end]},repeatLastCharacterSearch:function(e,t,r){var n=E.lastCharacterSearch,o=r.repeat,i=r.forward===n.forward,a=(n.increment?1:0)*(i?-1:1);e.moveH(-a,"char"),r.inclusive=!!i;var s=Ce(e,o,i,n.selectedCharacter);return s?(s.ch+=a,s):(e.moveH(a,"char"),t)}};function J(e,t){for(var r=[],n=0;n<t;n++)r.push(e);return r}var $={change:function(t,r,o){var i,a,s=t.state.vim;if(E.macroModeState.lastInsertModeChanges.inVisualBlock=s.visualBlock,s.visualMode){a=t.getSelection();var l=J("",o.length);t.replaceSelections(l),i=re(o[0].head,o[0].anchor)}else{var c=o[0].anchor,u=o[0].head;a=t.getRange(c,u);var h=s.lastEditInputState||{};if("moveByWords"==h.motion&&!S(a)){var p=/\s+$/.exec(a);p&&h.motionArgs&&h.motionArgs.forward&&(u=Z(u,0,-p[0].length),a=a.slice(0,-p[0].length))}var f=new n(c.line-1,Number.MAX_VALUE),d=t.firstLine()==t.lastLine();u.line>t.lastLine()&&r.linewise&&!d?t.replaceRange("",f,u):t.replaceRange("",c,u),r.linewise&&(d||(t.setCursor(f),e.commands.newlineAndIndent(t)),c.ch=Number.MAX_VALUE),i=c}E.registerController.pushText(r.registerName,"change",a,r.linewise,o.length>1),q.enterInsertMode(t,{head:i},t.state.vim)},delete:function(e,t,r){var o,i,a=e.state.vim;if(a.visualBlock){i=e.getSelection();var s=J("",r.length);e.replaceSelections(s),o=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,ie(e,l.line-1))),i=e.getRange(l,c),e.replaceRange("",l,c),o=l,t.linewise&&(o=U.moveToFirstNonWhiteSpaceCharacter(e,l))}return E.registerController.pushText(t.registerName,"delete",i,t.linewise,a.visualBlock),Q(e,o,a.insertMode)},indent:function(e,t,r){var n=e.state.vim,o=r[0].anchor.line,i=n.visualBlock?r[r.length-1].anchor.line:r[0].head.line,a=n.visualMode?t.repeat:1;t.linewise&&i--;for(var s=o;s<=i;s++)for(var l=0;l<a;l++)e.indentLine(s,t.indentRight);return U.moveToFirstNonWhiteSpaceCharacter(e,r[0].anchor)},changeCase:function(e,t,r,n,o){for(var i=e.getSelections(),a=[],s=t.toLower,l=0;l<i.length;l++){var c=i[l],u="";if(!0===s)u=c.toLowerCase();else if(!1===s)u=c.toUpperCase();else for(var h=0;h<c.length;h++){var p=c.charAt(h);u+=x(p)?p.toLowerCase():p.toUpperCase()}a.push(u)}return e.replaceSelections(a),t.shouldMoveCursor?o:!e.state.vim.visualMode&&t.linewise&&r[0].anchor.line+1==r[0].head.line?U.moveToFirstNonWhiteSpaceCharacter(e,n):t.linewise?n:re(r[0].anchor,r[0].head)},yank:function(e,t,r,n){var o=e.state.vim,i=e.getSelection(),a=o.visualMode?re(o.sel.anchor,o.sel.head,r[0].head,r[0].anchor):n;return E.registerController.pushText(t.registerName,"yank",i,t.linewise,o.visualBlock),a}};var q={jumpListWalk:function(e,t,r){if(!r.visualMode){var n=t.repeat,o=t.forward,i=E.jumpList.move(e,o?n:-n),a=i?i.find():void 0;a=a||e.getCursor(),e.setCursor(a)}},scroll:function(e,t,r){if(!r.visualMode){var n=t.repeat||1,o=e.defaultTextHeight(),i=e.getScrollInfo().top,a=o*n,s=t.forward?i+a:i-a,l=Y(e.getCursor()),c=e.charCoords(l,"local");if(t.forward)s>c.top?(l.line+=(s-c.top)/o,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<c.bottom?(l.line-=(c.bottom-u)/o,l.line=Math.floor(l.line),e.setCursor(l),c=e.charCoords(l,"local"),e.scrollTo(null,c.bottom-e.getScrollInfo().clientHeight)):e.scrollTo(null,s)}}},scrollToCursor:function(e,t){var r=e.getCursor().line,o=e.charCoords(n(r,0),"local"),i=e.getScrollInfo().clientHeight,a=o.top,s=o.bottom-a;switch(t.position){case"center":a=a-i/2+s;break;case"bottom":a=a-i+s}e.scrollTo(null,a)},replayMacro:function(e,t,r){var n=t.selectedCharacter,o=t.repeat,i=E.macroModeState;for("@"==n&&(n=i.latestRegister);o--;)Ue(e,r,i,n)},enterMacroRecordMode:function(e,t){var r=E.macroModeState,n=t.selectedCharacter;E.registerController.isValidRegister(n)&&r.enterMacroRecordMode(e,n)},toggleOverwrite:function(t){t.state.overwrite?(t.toggleOverwrite(!1),t.setOption("keyMap","vim-insert"),e.signal(t,"vim-mode-change",{mode:"insert"})):(t.toggleOverwrite(!0),t.setOption("keyMap","vim-replace"),e.signal(t,"vim-mode-change",{mode:"replace"}))},enterInsertMode:function(t,r,o){if(!t.getOption("readOnly")){o.insertMode=!0,o.insertModeRepeat=r&&r.repeat||1;var i=r?r.insertAt:null,a=o.sel,s=r.head||t.getCursor("head"),l=t.listSelections().length;if("eol"==i)s=n(s.line,ie(t,s.line));else if("charAfter"==i)s=Z(s,0,1);else if("firstNonBlank"==i)s=U.moveToFirstNonWhiteSpaceCharacter(t,s);else if("startOfSelectedArea"==i)o.visualBlock?(s=n(Math.min(a.head.line,a.anchor.line),Math.min(a.head.ch,a.anchor.ch)),l=Math.abs(a.head.line-a.anchor.line)+1):s=a.head.line<a.anchor.line?a.head:n(a.anchor.line,0);else if("endOfSelectedArea"==i)o.visualBlock?(s=n(Math.min(a.head.line,a.anchor.line),Math.max(a.head.ch+1,a.anchor.ch)),l=Math.abs(a.head.line-a.anchor.line)+1):s=a.head.line>=a.anchor.line?Z(a.head,0,1):n(a.anchor.line,0);else if("inplace"==i&&o.visualMode)return;t.setOption("disableInput",!1),r&&r.replace?(t.toggleOverwrite(!0),t.setOption("keyMap","vim-replace"),e.signal(t,"vim-mode-change",{mode:"replace"})):(t.toggleOverwrite(!1),t.setOption("keyMap","vim-insert"),e.signal(t,"vim-mode-change",{mode:"insert"})),E.macroModeState.isPlaying||(t.on("change",Je),e.on(t.getInputField(),"keydown",ze)),o.visualMode&&pe(t),le(t,s,l)}},toggleVisualMode:function(t,r,o){var i,a=r.repeat,s=t.getCursor();o.visualMode?o.visualLine^r.linewise||o.visualBlock^r.blockwise?(o.visualLine=!!r.linewise,o.visualBlock=!!r.blockwise,e.signal(t,"vim-mode-change",{mode:"visual",subMode:o.visualLine?"linewise":o.visualBlock?"blockwise":""}),ue(t)):pe(t):(o.visualMode=!0,o.visualLine=!!r.linewise,o.visualBlock=!!r.blockwise,i=Q(t,n(s.line,s.ch+a-1),!0),o.sel={anchor:s,head:i},e.signal(t,"vim-mode-change",{mode:"visual",subMode:o.visualLine?"linewise":o.visualBlock?"blockwise":""}),ue(t),we(t,o,"<",re(s,i)),we(t,o,">",ne(s,i)))},reselectLastSelection:function(t,r,n){var o=n.lastSelection;if(n.visualMode&&ce(t,n),o){var i=o.anchorMark.find(),a=o.headMark.find();if(!i||!a)return;n.sel={anchor:i,head:a},n.visualMode=!0,n.visualLine=o.visualLine,n.visualBlock=o.visualBlock,ue(t),we(t,n,"<",re(i,a)),we(t,n,">",ne(i,a)),e.signal(t,"vim-mode-change",{mode:"visual",subMode:n.visualLine?"linewise":n.visualBlock?"blockwise":""})}},joinLines:function(e,t,r){var o,i;if(r.visualMode){if(o=e.getCursor("anchor"),te(i=e.getCursor("head"),o)){var a=i;i=o,o=a}i.ch=ie(e,i.line)-1}else{var s=Math.max(t.repeat,2);o=e.getCursor(),i=Q(e,n(o.line+s-1,1/0))}for(var l=0,c=o.line;c<i.line;c++){l=ie(e,o.line),a=n(o.line+1,ie(e,o.line+1));var u=e.getRange(o,a);u=u.replace(/\n\s*/g," "),e.replaceRange(u,o,a)}var h=n(o.line,l);r.visualMode&&pe(e,!1),e.setCursor(h)},newLineAndEnterInsertMode:function(t,r,o){o.insertMode=!0;var i=Y(t.getCursor());i.line!==t.firstLine()||r.after?(i.line=r.after?i.line:i.line-1,i.ch=ie(t,i.line),t.setCursor(i),(e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent)(t)):(t.replaceRange("\n",n(t.firstLine(),0)),t.setCursor(t.firstLine(),0)),this.enterInsertMode(t,{repeat:r.repeat},o)},paste:function(e,t,r){var o,i,a,s,l,c=Y(e.getCursor()),u=E.registerController.getRegister(t.registerName);if(y=u.toString()){if(t.matchIndent){var h=e.getOption("tabSize"),p=function(e){var t=e.split("\t").length-1,r=e.split(" ").length-1;return t*h+1*r},f=e.getLine(e.getCursor().line),d=p(f.match(/^\s*/)[0]),m=y.replace(/\n$/,""),g=y!==m,v=p(y.match(/^\s*/)[0]),y=m.replace(/^\s*/gm,function(t){var r=d+(p(t)-v);if(r<0)return"";if(e.getOption("indentWithTabs")){var n=Math.floor(r/h);return Array(n+1).join("\t")}return Array(r+1).join(" ")});y+=g?"\n":""}t.repeat>1&&(y=Array(t.repeat+1).join(y));var k,C,w,M,x,S,A,b,L,T,R=u.linewise,O=u.blockwise;if(R)r.visualMode?y=r.visualLine?y.slice(0,-1):"\n"+y.slice(0,y.length-1)+"\n":t.after?(y="\n"+y.slice(0,y.length-1),c.ch=ie(e,c.line)):c.ch=0;else{if(O){y=y.split("\n");for(var I=0;I<y.length;I++)y[I]=""==y[I]?" ":y[I]}c.ch+=t.after?1:0}if(r.visualMode){var B;r.lastPastedText=y;var K=(w=e,x=(M=r).lastSelection,M.visualMode?(S=w.listSelections(),A=S[0],b=S[S.length-1],L=te(A.anchor,A.head)?A.anchor:A.head,T=te(b.anchor,b.head)?b.head:b.anchor,[L,T]):function(){var e=w.getCursor(),t=w.getCursor(),r=x.visualBlock;if(r){var o=r.width,i=r.height;t=n(e.line+i,e.ch+o);for(var a=[],s=e.line;s<t.line;s++){var l=n(s,e.ch),c=n(s,t.ch),u={anchor:l,head:c};a.push(u)}w.setSelections(a)}else{var h=x.anchorMark.find(),p=x.headMark.find(),f=p.line-h.line,d=p.ch-h.ch;t={line:t.line+f,ch:f?t.ch:d+t.ch},x.visualLine&&(e=n(e.line,0),t=n(t.line,ie(w,t.line))),w.setSelection(e,t)}return[e,t]}()),N=K[0],P=K[1],j=e.getSelection(),H=e.listSelections(),_=new Array(H.length).join("1").split("1");r.lastSelection&&(B=r.lastSelection.headMark.find()),E.registerController.unnamedRegister.setText(j),O?(e.replaceSelections(_),P=n(N.line+y.length-1,N.ch),e.setCursor(N),se(e,P),e.replaceSelections(y),k=N):r.visualBlock?(e.replaceSelections(_),e.setCursor(N),e.replaceRange(y,N,N),k=N):(e.replaceRange(y,N,P),k=e.posFromIndex(e.indexFromPos(N)+y.length-1)),B&&(r.lastSelection.headMark=e.setBookmark(B)),R&&(k.ch=0)}else if(O){for(e.setCursor(c),I=0;I<y.length;I++){var F=c.line+I;F>e.lastLine()&&e.replaceRange("\n",n(F,0)),ie(e,F)<c.ch&&(o=e,i=F,a=c.ch,void 0,void 0,s=ie(o,i),l=new Array(a-s+1).join(" "),o.setCursor(n(i,s)),o.replaceRange(l,o.getCursor()))}e.setCursor(c),se(e,n(c.line+y.length-1,c.ch)),e.replaceSelections(y),k=c}else e.replaceRange(y,c),R&&t.after?k=n(c.line+1,fe(e.getLine(c.line+1))):R&&!t.after?k=n(c.line,fe(e.getLine(c.line))):!R&&t.after?(C=e.indexFromPos(c),k=e.posFromIndex(C+y.length-1)):(C=e.indexFromPos(c),k=e.posFromIndex(C+y.length));r.visualMode&&pe(e,!1),e.setCursor(k)}},undo:function(t,r){t.operation(function(){X(t,e.commands.undo,r.repeat)(),t.setCursor(t.getCursor("anchor"))})},redo:function(t,r){X(t,e.commands.redo,r.repeat)()},setRegister:function(e,t,r){r.inputState.registerName=t.selectedCharacter},setMark:function(e,t,r){we(e,r,t.selectedCharacter,e.getCursor())},replace:function(t,r,o){var i,a,s=r.selectedCharacter,l=t.getCursor(),c=t.listSelections();if(o.visualMode)l=t.getCursor("start"),a=t.getCursor("end");else{var u=t.getLine(l.line);(i=l.ch+r.repeat)>u.length&&(i=u.length),a=n(l.line,i)}if("\n"==s)o.visualMode||t.replaceRange("",l,a),(e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent)(t);else{var h=t.getRange(l,a);if(h=h.replace(/[^\n]/g,s),o.visualBlock){var p=new Array(t.getOption("tabSize")+1).join(" ");h=(h=t.getSelection()).replace(/\t/g,p).replace(/[^\n]/g,s).split("\n"),t.replaceSelections(h)}else t.replaceRange(h,l,a);o.visualMode?(l=te(c[0].anchor,c[0].head)?c[0].anchor:c[0].head,t.setCursor(l),pe(t,!1)):t.setCursor(Z(a,0,-1))}},incrementNumberToken:function(e,t){for(var r,o,i,a,s=e.getCursor(),l=e.getLine(s.line),c=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi;null!==(r=c.exec(l))&&(i=(o=r.index)+r[0].length,!(s.ch<i)););if((t.backtrack||!(i<=s.ch))&&r){var u=r[2]||r[4],h=r[3]||r[5],p=t.increase?1:-1,f={"0b":2,0:8,"":10,"0x":16}[u.toLowerCase()];a=(parseInt(r[1]+h,f)+p*t.repeat).toString(f);var d=u?new Array(h.length-a.length+1+r[1].length).join("0"):"";a="-"===a.charAt(0)?"-"+u+d+a.substr(1):u+d+a;var m=n(s.line,o),g=n(s.line,i);e.replaceRange(a,m,g),e.setCursor(n(s.line,o+a.length-1))}},repeatLastEdit:function(e,t,r){if(r.lastEditInputState){var n=t.repeat;n&&t.repeatIsExplicit?r.lastEditInputState.repeatOverride=n:n=r.lastEditInputState.repeatOverride||n,Ze(e,r,n,!1)}},indent:function(e,t){e.indentLine(e.getCursor().line,t.indentRight)},exitInsertMode:Ve};function Q(e,t,r){var o=Math.min(Math.max(e.firstLine(),t.line),e.lastLine()),i=ie(e,o)-1;i=r?i+1:i;var a=Math.min(Math.max(0,t.ch),i);return n(o,a)}function z(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}function Z(e,t,r){return"object"==typeof t&&(r=t.ch,t=t.line),n(e.line+t,e.ch+r)}function G(e,t){if("<character>"==t.slice(-11)){var r=t.length-11,n=e.slice(0,r),o=t.slice(0,r);return n==o&&e.length>r?"full":0==o.indexOf(n)&&"partial"}return e==t?"full":0==t.indexOf(e)&&"partial"}function X(e,t,r){return function(){for(var n=0;n<r;n++)t(e)}}function Y(e){return n(e.line,e.ch)}function ee(e,t){return e.ch==t.ch&&e.line==t.line}function te(e,t){return e.line<t.line||e.line==t.line&&e.ch<t.ch}function re(e,t){return arguments.length>2&&(t=re.apply(void 0,Array.prototype.slice.call(arguments,1))),te(e,t)?e:t}function ne(e,t){return arguments.length>2&&(t=ne.apply(void 0,Array.prototype.slice.call(arguments,1))),te(e,t)?t:e}function oe(e,t,r){var n=te(e,t),o=te(t,r);return n&&o}function ie(e,t){return e.getLine(t).length}function ae(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function se(e,t){var r=[],o=e.listSelections(),i=Y(e.clipPos(t)),a=!ee(t,i),s=function(e,t,r){for(var n=0;n<e.length;n++){var o="head"!=r&&ee(e[n].anchor,t),i="anchor"!=r&&ee(e[n].head,t);if(o||i)return n}return-1}(o,e.getCursor("head")),l=ee(o[s].head,o[s].anchor),c=o.length-1,u=c-s>s?c:0,h=o[u].anchor,p=Math.min(h.line,i.line),f=Math.max(h.line,i.line),d=h.ch,m=i.ch,g=o[u].head.ch-d,v=m-d;g>0&&v<=0?(d++,a||m--):g<0&&v>=0?(d--,l||m++):g<0&&-1==v&&(d--,m++);for(var y=p;y<=f;y++){var k={anchor:new n(y,d),head:new n(y,m)};r.push(k)}return e.setSelections(r),t.ch=m,h.ch=d,h}function le(e,t,r){for(var n=[],o=0;o<r;o++){var i=Z(t,o,0);n.push({anchor:i,head:i})}e.setSelections(n,0)}function ce(e,t){var r=t.sel.anchor,n=t.sel.head;t.lastPastedText&&(n=e.posFromIndex(e.indexFromPos(r)+t.lastPastedText.length),t.lastPastedText=null),t.lastSelection={anchorMark:e.setBookmark(r),headMark:e.setBookmark(n),anchor:Y(r),head:Y(n),visualMode:t.visualMode,visualLine:t.visualLine,visualBlock:t.visualBlock}}function ue(e,t,r){var n=e.state.vim,o=he(e,t=t||n.sel,r=r||n.visualLine?"line":n.visualBlock?"block":"char");e.setSelections(o.ranges,o.primary),qe(e)}function he(e,t,r,o){var i=Y(t.head),a=Y(t.anchor);if("char"==r){var s=o||te(t.head,t.anchor)?0:1,l=te(t.head,t.anchor)?1:0;return i=Z(t.head,0,s),{ranges:[{anchor:a=Z(t.anchor,0,l),head:i}],primary:0}}if("line"==r){if(te(t.head,t.anchor))i.ch=0,a.ch=ie(e,a.line);else{a.ch=0;var c=e.lastLine();i.line>c&&(i.line=c),i.ch=ie(e,i.line)}return{ranges:[{anchor:a,head:i}],primary:0}}if("block"==r){for(var u=Math.min(a.line,i.line),h=Math.min(a.ch,i.ch),p=Math.max(a.line,i.line),f=Math.max(a.ch,i.ch)+1,d=p-u+1,m=i.line==u?0:d-1,g=[],v=0;v<d;v++)g.push({anchor:n(u+v,h),head:n(u+v,f)});return{ranges:g,primary:m}}}function pe(t,r){var n=t.state.vim;!1!==r&&t.setCursor(Q(t,n.sel.head)),ce(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 fe(e){if(!e)return 0;var t=e.search(/\S/);return-1==t?e.length:t}function de(e,t,r,o,i){for(var a,s,l=(s=(a=e).getCursor("head"),1==a.getSelection().length&&(s=re(s,a.getCursor("anchor"))),s),c=e.getLine(l.line),u=l.ch,h=i?f[0]:d[0];!h(c.charAt(u));)if(++u>=c.length)return null;o?h=d[0]:(h=f[0])(c.charAt(u))||(h=f[1]);for(var p=u,m=u;h(c.charAt(p))&&p<c.length;)p++;for(;h(c.charAt(m))&&m>=0;)m--;if(m++,t){for(var g=p;/\s/.test(c.charAt(p))&&p<c.length;)p++;if(g==p){for(var v=m;/\s/.test(c.charAt(m-1))&&m>0;)m--;m||(m=v)}}return{start:n(l.line,m),end:n(l.line,p)}}function me(e,t,r){ee(t,r)||E.jumpList.add(e,t,r)}function ge(e,t){E.lastCharacterSearch.increment=e,E.lastCharacterSearch.forward=t.forward,E.lastCharacterSearch.selectedCharacter=t.selectedCharacter}var ve={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},ye={bracket:{isComplete:function(e){if(e.nextCh===e.symb){if(e.depth++,e.depth>=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}},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}}};function ke(e,t,r,n,o){var i=t.line,a=t.ch,s=e.getLine(i),l=r?1:-1,c=n?d:f;if(o&&""==s){if(i+=l,s=e.getLine(i),!w(e,i))return null;a=r?0:s.length}for(;;){if(o&&""==s)return{from:0,to:0,line:i};for(var u=l>0?s.length:-1,h=u,p=u;a!=u;){for(var m=!1,g=0;g<c.length&&!m;++g)if(c[g](s.charAt(a))){for(h=a;a!=u&&c[g](s.charAt(a));)a+=l;if(m=h!=(p=a),h==t.ch&&i==t.line&&p==h+l)continue;return{from:Math.min(h,p+1),to:Math.max(h,p),line:i}}m||(a+=l)}if(!w(e,i+=l))return null;s=e.getLine(i),a=l>0?0:s.length}}function Ce(e,t,r,o){for(var i,a=e.getCursor(),s=a.ch,l=0;l<t;l++){if(-1==(c=s,u=e.getLine(a.line),h=o,p=!0,f=void 0,r?-1==(f=u.indexOf(h,c+1))||p||(f-=1):-1==(f=u.lastIndexOf(h,c-1))||p||(f+=1),i=f))return null;s=i}var c,u,h,p,f;return n(e.getCursor().line,i)}function we(e,t,r,n){A(r,k)&&(t.marks[r]&&t.marks[r].clear(),t.marks[r]=e.setBookmark(n))}function Me(e,t,r,o,i){var a,s=t.line,l=e.firstLine(),c=e.lastLine(),u=s;function h(t){return!e.getLine(t)}function p(e,t,r){return r?h(e)!=h(e+t):!h(e)&&h(e+t)}if(o){for(;l<=u&&u<=c&&r>0;)p(u,o)&&r--,u+=o;return new n(u,0)}var f=e.state.vim;if(f.visualLine&&p(s,1,!0)){var d=f.sel.anchor;p(d.line,-1,!0)&&(i&&d.line==s||(s+=1))}var m=h(s);for(u=s;u<=c&&r;u++)p(u,1,!0)&&(i&&h(u)==m||r--);for(a=new n(u,0),u>c&&!m?m=!0:i=!1,u=s;u>l&&(i&&h(u)!=m&&u!=s||!p(u,-1,!0));u--);return{start:new n(u,0),end:a}}function xe(){}function Se(e){var t=e.state.vim;return t.searchState_||(t.searchState_=new xe)}function Ae(e,t){var r=be(e,t)||[];if(!r.length)return[];var n=[];if(0===r[0]){for(var o=0;o<r.length;o++)"number"==typeof r[o]&&n.push(e.substring(r[o]+1,r[o+1]));return n}}function be(e,t){t||(t="/");for(var r=!1,n=[],o=0;o<e.length;o++){var i=e.charAt(o);r||i!=t||n.push(o),r=!r&&"\\"==i}return n}L("pcre",!0,"boolean"),xe.prototype={getQuery:function(){return E.query},setQuery:function(e){E.query=e},getOverlay:function(){return this.searchOverlay},setOverlay:function(e){this.searchOverlay=e},isReversed:function(){return E.isReversed},setReversed:function(e){E.isReversed=e},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(e){this.annotate=e}};var Le={"\\n":"\n","\\r":"\r","\\t":"\t"};var Te={"\\/":"/","\\\\":"\\","\\n":"\n","\\r":"\r","\\t":"\t"};function Re(e,t,r){if(E.registerController.getRegister("/").setText(e),e instanceof RegExp)return e;var n,o,i=be(e,"/");return i.length?(n=e.substring(0,i[0]),o=-1!=e.substring(i[0]).indexOf("i")):n=e,n?(R("pcre")||(n=function(e){for(var t=!1,r=[],n=-1;n<e.length;n++){var o=e.charAt(n)||"",i=e.charAt(n+1)||"",a=i&&-1!="|(){".indexOf(i);t?("\\"===o&&a||r.push(o),t=!1):"\\"===o?(t=!0,i&&-1!="}".indexOf(i)&&(a=!0),a&&"\\"!==i||r.push(o)):(r.push(o),a&&"\\"!==i&&r.push("\\"))}return r.join("")}(n)),r&&(t=/^[^A-Z]*$/.test(n)),new RegExp(n,t||o?"i":void 0)):null}function Ee(e,t){e.openNotification?e.openNotification('<span style="color: red">'+t+"</span>",{bottom:!0,duration:5e3}):alert(t)}var Oe="(Javascript regexp)";function Ie(e,t){var r,n,o,i,a,s,l,c,u=(t.prefix||"")+" "+(t.desc||""),h=(r=t.prefix,n=t.desc,o='<span style="font-family: monospace; white-space: pre">'+(r||"")+'<input type="text"></span>',n&&(o+=' <span style="color: #888">'+n+"</span>"),o);i=e,a=h,s=u,l=t.onClose,c=t,i.openDialog?i.openDialog(a,l,{bottom:!0,value:c.value,onKeyDown:c.onKeyDown,onKeyUp:c.onKeyUp,selectValueOnOpen:!1}):l(prompt(s,""))}function Be(e,t,r,n){if(t){var o=Se(e),i=Re(t,!!r,!!n);if(i)return Ke(e,i),function(e,t){if(e instanceof RegExp&&t instanceof RegExp){for(var r=["global","multiline","ignoreCase","source"],n=0;n<r.length;n++){var o=r[n];if(e[o]!==t[o])return!1}return!0}return!1}(i,o.getQuery())?i:(o.setQuery(i),i)}}function Ke(e,t){var r=Se(e),n=r.getOverlay();n&&t==n.query||(n&&e.removeOverlay(n),n=function(e){if("^"==e.source.charAt(0))var t=!0;return{token:function(r){if(!t||r.sol()){var n=r.match(e,!1);if(n)return 0==n[0].length?(r.next(),"searching"):r.sol()||(r.backUp(1),e.exec(r.next()+n[0]))?(r.match(e),"searching"):(r.next(),null);for(;!r.eol()&&(r.next(),!r.match(e,!1)););}else r.skipToEnd()},query:e}}(t),e.addOverlay(n),e.showMatchesOnScrollbar&&(r.getScrollbarAnnotate()&&r.getScrollbarAnnotate().clear(),r.setScrollbarAnnotate(e.showMatchesOnScrollbar(t))),r.setOverlay(n))}function Ne(e,t,r,o){return void 0===o&&(o=1),e.operation(function(){for(var i=e.getCursor(),a=e.getSearchCursor(r,i),s=0;s<o;s++){var l=a.find(t);if(0==s&&l&&ee(a.from(),i)&&(l=a.find(t)),!l&&!(a=e.getSearchCursor(r,t?n(e.lastLine()):n(e.firstLine(),0))).find(t))return}return a.from()})}function Pe(e){var t=Se(e);e.removeOverlay(Se(e).getOverlay()),t.setOverlay(null),t.getScrollbarAnnotate()&&(t.getScrollbarAnnotate().clear(),t.setScrollbarAnnotate(null))}function je(e){var t=e.getScrollInfo(),r=e.coordsChar({left:0,top:6+t.top},"local"),n=t.clientHeight-10+t.top,o=e.coordsChar({left:0,top:n},"local");return{top:r.line,bottom:o.line}}function He(e,t,r){if("'"==r){var n=e.doc.history.done,o=n[n.length-2];return o&&o.ranges&&o.ranges[0].head}if("."==r){if(0==e.doc.history.lastModTime)return;var i=e.doc.history.done.filter(function(e){if(void 0!==e.changes)return e});return i.reverse(),i[0].changes[0].to}var a=t.marks[r];return a&&a.find()}var _e=function(){this.buildCommandMap_()};_e.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 o=t.state.vim,i=E.registerController.getRegister(":"),a=i.toString();o.visualMode&&pe(t);var s=new e.StringStream(r);i.setText(r);var l,c,u=n||{};u.input=r;try{this.parseInput_(t,s,u)}catch(e){throw Ee(t,e),e}if(u.commandName){if(l=this.matchCommand_(u.commandName)){if(c=l.name,l.excludeFromCommandHistory&&i.setText(a),this.parseCommandArgs_(s,u,l),"exToKey"==l.type){for(var h=0;h<l.toKeys.length;h++)e.Vim.handleKey(t,l.toKeys[h],"mapping");return}if("exToEx"==l.type)return void this.processCommand(t,l.toInput)}}else void 0!==u.line&&(c="move");if(c)try{Fe[c](t,u),l&&l.possiblyAsync||!u.callback||u.callback()}catch(e){throw Ee(t,e),e}else Ee(t,'Not an editor command ":'+r+'"')},parseInput_:function(e,t,r){t.eatWhile(":"),t.eat("%")?(r.line=e.firstLine(),r.lineEnd=e.lastLine()):(r.line=this.parseLineSpec_(e,t),void 0!==r.line&&t.eat(",")&&(r.lineEnd=this.parseLineSpec_(e,t)));var n=t.match(/^(\w+)/);return r.commandName=n?n[1]:t.match(/.*/)[0],r},parseLineSpec_:function(e,t){var r=t.match(/^(\d+)/);if(r)return parseInt(r[1],10)-1;switch(t.next()){case".":return this.parseLineSpecOffset_(t,e.getCursor().line);case"$":return this.parseLineSpecOffset_(t,e.lastLine());case"'":var n=t.next(),o=He(e,e.state.vim,n);if(!o)throw new Error("Mark not set");return this.parseLineSpecOffset_(t,o.line);case"-":case"+":return t.backUp(1),this.parseLineSpecOffset_(t,e.getCursor().line);default:return void t.backUp(1)}},parseLineSpecOffset_:function(e,t){var r=e.match(/^([+-])?(\d+)/);if(r){var n=parseInt(r[2],10);"-"==r[1]?t-=n:t+=n}return t},parseCommandArgs_:function(e,t,r){if(!e.eol()){t.argString=e.match(/.*/)[0];var n=r.argDelimiter||/\s+/,o=ae(t.argString).split(n);o.length&&o[0]&&(t.args=o)}},matchCommand_:function(e){for(var t=e.length;t>0;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<r.length;e++){var t=r[e],n=t.shortName||t.name;this.commandMap_[n]=t}},map:function(e,r,n){if(":"!=e&&":"==e.charAt(0)){if(n)throw Error("Mode not supported for ex mappings");var o=e.substring(1);":"!=r&&":"==r.charAt(0)?this.commandMap_[o]={name:o,type:"exToEx",toInput:r.substring(1),user:!0}:this.commandMap_[o]={name:o,type:"exToKey",toKeys:r,user:!0}}else if(":"!=r&&":"==r.charAt(0)){var i={keys:e,type:"keyToEx",exArgs:{input:r.substring(1)}};n&&(i.context=n),t.unshift(i)}else i={keys:e,type:"keyToKey",toKeys:r},n&&(i.context=n),t.unshift(i)},unmap:function(e,r){if(":"!=e&&":"==e.charAt(0)){if(r)throw Error("Mode not supported for ex mappings");var n=e.substring(1);if(this.commandMap_[n]&&this.commandMap_[n].user)return void delete this.commandMap_[n]}else for(var o=e,i=0;i<t.length;i++)if(o==t[i].keys&&t[i].context===r)return void t.splice(i,1);throw Error("No such mapping.")}};var Fe={colorscheme:function(e,t){!t.args||t.args.length<1?Ee(e,e.getOption("theme")):e.setOption("theme",t.args[0])},map:function(e,t,r){var n=t.args;!n||n.length<2?e&&Ee(e,"Invalid mapping: "+t.input):We.map(n[0],n[1],r)},imap:function(e,t){this.map(e,t,"insert")},nmap:function(e,t){this.map(e,t,"normal")},vmap:function(e,t){this.map(e,t,"visual")},unmap:function(e,t,r){var n=t.args;!n||n.length<1?e&&Ee(e,"No such mapping: "+t.input):We.unmap(n[0],r)},move:function(e,t){D.processCommand(e,e.state.vim,{type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:t.line+1})},set:function(e,t){var r=t.args,n=t.setCfg||{};if(!r||r.length<1)e&&Ee(e,"Invalid mapping: "+t.input);else{var o=r[0].split("="),i=o[0],a=o[1],s=!1;if("?"==i.charAt(i.length-1)){if(a)throw Error("Trailing characters: "+t.argString);i=i.substring(0,i.length-1),s=!0}void 0===a&&"no"==i.substring(0,2)&&(i=i.substring(2),a=!1);var l=b[i]&&"boolean"==b[i].type;if(l&&null==a&&(a=!0),!l&&void 0===a||s){var c=R(i,e,n);c instanceof Error?Ee(e,c.message):Ee(e,!0===c||!1===c?" "+(c?"":"no")+i:"  "+i+"="+c)}else{var u=T(i,a,e,n);u instanceof Error&&Ee(e,u.message)}}},setlocal:function(e,t){t.setCfg={scope:"local"},this.set(e,t)},setglobal:function(e,t){t.setCfg={scope:"global"},this.set(e,t)},registers:function(e,t){var r=t.args,n=E.registerController.registers,o="----------Registers----------<br><br>";if(r){r=r.join("");for(var i=0;i<r.length;i++)a=r.charAt(i),E.registerController.isValidRegister(a)&&(o+='"'+a+"    "+(n[a]||new F).toString()+"<br>")}else for(var a in n){var s=n[a].toString();s.length&&(o+='"'+a+"    "+s+"<br>")}Ee(e,o)},sort:function(t,r){var o,i,a,s,l,c=function(){if(r.argString){var t=new e.StringStream(r.argString);if(t.eat("!")&&(o=!0),t.eol())return;if(!t.eatSpace())return"Invalid arguments";var n=t.match(/([dinuox]+)?\s*(\/.+\/)?\s*/);if(!n&&!t.eol())return"Invalid arguments";if(n[1]){i=-1!=n[1].indexOf("i"),a=-1!=n[1].indexOf("u");var c=-1!=n[1].indexOf("d")||-1!=n[1].indexOf("n")&&1,u=-1!=n[1].indexOf("x")&&1,h=-1!=n[1].indexOf("o")&&1;if(c+u+h>1)return"Invalid arguments";s=(c?"decimal":u&&"hex")||h&&"octal"}n[2]&&(l=new RegExp(n[2].substr(1,n[2].length-2),i?"i":""))}}();if(c)Ee(t,c+": "+r.argString);else{var u=r.line||t.firstLine(),h=r.lineEnd||r.line||t.lastLine();if(u!=h){var p=n(u,0),f=n(h,ie(t,h)),d=t.getRange(p,f).split("\n"),m=l||("decimal"==s?/(-?)([\d]+)/:"hex"==s?/(-?)(?:0x)?([0-9a-f]+)/i:"octal"==s?/([0-7]+)/:null),g="decimal"==s?10:"hex"==s?16:"octal"==s?8:null,v=[],y=[];if(s||l)for(var k=0;k<d.length;k++){var C=l?d[k].match(l):null;C&&""!=C[0]?v.push(C):!l&&m.exec(d[k])?v.push(d[k]):y.push(d[k])}else y=d;if(v.sort(l?function(e,t){var r;return o&&(r=e,e=t,t=r),i&&(e[0]=e[0].toLowerCase(),t[0]=t[0].toLowerCase()),e[0]<t[0]?-1:1}:x),l)for(k=0;k<v.length;k++)v[k]=v[k].input;else s||y.sort(x);if(d=o?v.concat(y):y.concat(v),a){var w,M=d;for(d=[],k=0;k<M.length;k++)M[k]!=w&&d.push(M[k]),w=M[k]}t.replaceRange(d.join("\n"),p,f)}}function x(e,t){var r;o&&(r=e,e=t,t=r),i&&(e=e.toLowerCase(),t=t.toLowerCase());var n=s&&m.exec(e),a=s&&m.exec(t);return n?(n=parseInt((n[1]+n[2]).toLowerCase(),g))-(a=parseInt((a[1]+a[2]).toLowerCase(),g)):e<t?-1:1}},global:function(e,t){var r=t.argString;if(r){var n,o=void 0!==t.line?t.line:e.firstLine(),i=t.lineEnd||t.line||e.lastLine(),a=Ae(r,"/"),s=r;if(a.length&&(s=a[0],n=a.slice(1,a.length).join("/")),s)try{Be(e,s,!0,!0)}catch(t){return void Ee(e,"Invalid regex: "+s)}for(var l=Se(e).getQuery(),c=[],u="",h=o;h<=i;h++)l.test(e.getLine(h))&&(c.push(h+1),u+=e.getLine(h)+"<br>");if(n){var p=0,f=function(){if(p<c.length){var t=c[p]+n;We.processCommand(e,t,{callback:f})}p++};f()}else Ee(e,u)}else Ee(e,"Regular Expression missing from global")},substitute:function(t,r){if(!t.getSearchCursor)throw new Error("Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.");var o,i,a,s,l=r.argString,c=l?Ae(l,l[0]):[],u="",h=!1,f=!1;if(c.length)o=c[0],u=c[1],o&&"$"===o[o.length-1]&&(o=o.slice(0,o.length-1)+"\\n",u=u?u+"\n":"\n"),void 0!==u&&(u=R("pcre")?function(t){for(var r=new e.StringStream(t),n=[];!r.eol();){for(;r.peek()&&"\\"!=r.peek();)n.push(r.next());var o=!1;for(var i in Te)if(r.match(i,!0)){o=!0,n.push(Te[i]);break}o||n.push(r.next())}return n.join("")}(u):function(e){for(var t,r=!1,n=[],o=-1;o<e.length;o++){var i=e.charAt(o)||"",a=e.charAt(o+1)||"";Le[i+a]?(n.push(Le[i+a]),o++):r?(n.push(i),r=!1):"\\"===i?(r=!0,t=a,p.test(t)||"$"===a?n.push("$"):"/"!==a&&"\\"!==a&&n.push("\\")):("$"===i&&n.push("$"),n.push(i),"/"===a&&n.push("\\"))}return n.join("")}(u),E.lastSubstituteReplacePart=u),i=c[2]?c[2].split(" "):[];else if(l&&l.length)return void Ee(t,"Substitutions should be of the form :s/pattern/replace/");if(i&&(a=i[0],s=parseInt(i[1]),a&&(-1!=a.indexOf("c")&&(h=!0,a.replace("c","")),-1!=a.indexOf("g")&&(f=!0,a.replace("g","")),o=o.replace(/\//g,"\\/")+"/"+a)),o)try{Be(t,o,!0,!0)}catch(e){return void Ee(t,"Invalid regex: "+o)}if(void 0!==(u=u||E.lastSubstituteReplacePart)){var d=Se(t).getQuery(),m=void 0!==r.line?r.line:t.getCursor().line,g=r.lineEnd||m;m==t.firstLine()&&g==t.lastLine()&&(g=1/0),s&&(g=(m=g)+s-1);var v=Q(t,n(m,0)),y=t.getSearchCursor(d,v);!function(t,r,n,o,i,a,s,l,c){t.state.vim.exMode=!0;var u=!1,h=a.from();function p(){t.operation(function(){for(;!u;)f(),d();m()})}function f(){var e=t.getRange(a.from(),a.to()),r=e.replace(s,l);a.replace(r)}function d(){for(;a.findNext()&&(e=a.from(),r=o,s=i,"number"!=typeof e&&(e=e.line),r instanceof Array?A(e,r):s?e>=r&&e<=s:e==r);)if(n||!h||a.from().line!=h.line)return t.scrollIntoView(a.from(),30),t.setSelection(a.from(),a.to()),h=a.from(),void(u=!1);var e,r,s;u=!0}function m(e){if(e&&e(),t.focus(),h){t.setCursor(h);var r=t.state.vim;r.exMode=!1,r.lastHPos=r.lastHSPos=h.ch}c&&c()}if(d(),!u)return r?void Ie(t,{prefix:"replace with <strong>"+l+"</strong> (y/n/a/q/l)",onKeyDown:function(r,n,o){switch(e.e_stop(r),e.keyName(r)){case"Y":f(),d();break;case"N":d();break;case"A":var i=c;c=void 0,t.operation(p),c=i;break;case"L":f();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":m(o)}return u&&m(o),!0}}):(p(),void(c&&c()));Ee(t,"No matches for "+s.source)}(t,h,f,m,g,y,d,u,r.callback)}else Ee(t,"No previous substitute regular expression")},redo:e.commands.redo,undo:e.commands.undo,write:function(t){e.commands.save?e.commands.save(t):t.save&&t.save()},nohlsearch:function(e){Pe(e)},yank:function(e){var t=Y(e.getCursor()).line,r=e.getLine(t);E.registerController.pushText("0","yank",r,!0,!0)},delmarks:function(t,r){if(r.argString&&ae(r.argString))for(var n=t.state.vim,o=new e.StringStream(ae(r.argString));!o.eol();){o.eatSpace();var i=o.pos;if(!o.match(/[a-zA-Z]/,!1))return void Ee(t,"Invalid argument: "+r.argString.substring(i));var a=o.next();if(o.match("-",!0)){if(!o.match(/[a-zA-Z]/,!1))return void Ee(t,"Invalid argument: "+r.argString.substring(i));var s=a,l=o.next();if(!(M(s)&&M(l)||x(s)&&x(l)))return void Ee(t,"Invalid argument: "+s+"-");var c=s.charCodeAt(0),u=l.charCodeAt(0);if(c>=u)return void Ee(t,"Invalid argument: "+r.argString.substring(i));for(var h=0;h<=u-c;h++){var p=String.fromCharCode(c+h);delete n.marks[p]}}else delete n.marks[a]}else Ee(t,"Argument required")}},We=new _e;function Ve(t){var r=t.state.vim,n=E.macroModeState,o=E.registerController.getRegister("."),i=n.isPlaying,a=n.lastInsertModeChanges,s=[];if(!i){for(var l=a.inVisualBlock&&r.lastSelection?r.lastSelection.visualBlock.height:1,c=a.changes,u=(s=[],0);u<c.length;)s.push(c[u]),c[u]instanceof Qe?u++:u+=l;a.changes=s,t.off("change",Je),e.off(t.getInputField(),"keydown",ze)}!i&&r.insertModeRepeat>1&&(Ze(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),o.setText(a.changes.join("")),e.signal(t,"vim-mode-change",{mode:"normal"}),n.isRecording&&function(e){if(!e.isPlaying){var t=e.latestRegister,r=E.registerController.getRegister(t);r&&r.pushInsertModeChanges&&r.pushInsertModeChanges(e.lastInsertModeChanges)}}(n)}function De(e){t.unshift(e)}function Ue(t,r,n,o){var i=E.registerController.getRegister(o);if(":"==o)return i.keyBuffer[0]&&We.processCommand(t,i.keyBuffer[0]),void(n.isPlaying=!1);var a=i.keyBuffer,s=0;n.isPlaying=!0,n.replaySearchQueries=i.searchQueries.slice(0);for(var l=0;l<a.length;l++)for(var c,u,h=a[l];h;)if(u=(c=/<\w+-.+?>|<\w+>|./.exec(h))[0],h=h.substring(c.index+u.length),e.Vim.handleKey(t,u,"macro"),r.insertMode){var p=i.insertModeChanges[s++].changes;E.macroModeState.lastInsertModeChanges.changes=p,Ge(t,p,1),Ve(t)}n.isPlaying=!1}function Je(e,t){var r=E.macroModeState,n=r.lastInsertModeChanges;if(!r.isPlaying)for(;t;){if(n.expectCursorActivityForChange=!0,"+input"==t.origin||"paste"==t.origin||void 0===t.origin){var o=t.text.join("\n");n.maybeReset&&(n.changes=[],n.maybeReset=!1),e.state.overwrite&&!/\n/.test(o)?n.changes.push([o]):n.changes.push(o)}t=t.next}}function $e(t){var r=t.state.vim;if(r.insertMode){var n=E.macroModeState;if(n.isPlaying)return;var o=n.lastInsertModeChanges;o.expectCursorActivityForChange?o.expectCursorActivityForChange=!1:o.maybeReset=!0}else t.curOp.isVimOp||function(t,r){var n=t.getCursor("anchor"),o=t.getCursor("head");if(r.visualMode&&!t.somethingSelected()?pe(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 i=te(o,n)?0:-1,a=te(o,n)?-1:0;o=Z(o,0,i),n=Z(n,0,a),r.sel={anchor:n,head:o},we(t,r,"<",re(o,n)),we(t,r,">",ne(o,n))}else r.insertMode||(r.lastHPos=t.getCursor().ch)}(t,r);r.visualMode&&qe(t)}function qe(e){var t=e.state.vim,r=Q(e,Y(t.sel.head)),n=Z(r,0,1);t.fakeCursor&&t.fakeCursor.clear(),t.fakeCursor=e.markText(r,n,{className:"cm-animate-fat-cursor"})}function Qe(e){this.keyName=e}function ze(t){var r=E.macroModeState.lastInsertModeChanges,n=e.keyName(t);n&&(-1==n.indexOf("Delete")&&-1==n.indexOf("Backspace")||e.lookupKey(n,"vim-insert",function(){return r.maybeReset&&(r.changes=[],r.maybeReset=!1),r.changes.push(new Qe(n)),!0}))}function Ze(e,t,r,n){var o=E.macroModeState;o.isPlaying=!0;var i=!!t.lastEditActionCommand,a=t.inputState;function s(){i?D.processAction(e,t,t.lastEditActionCommand):D.evalInput(e,t)}function l(r){if(o.lastInsertModeChanges.changes.length>0){r=t.lastEditActionCommand?r:1;var n=o.lastInsertModeChanges;Ge(e,n.changes,r)}}if(t.inputState=t.lastEditInputState,i&&t.lastEditActionCommand.interlaceInsertRepeat)for(var c=0;c<r;c++)s(),l(1);else n||s(),l(r);t.inputState=a,t.insertMode&&!n&&Ve(e),o.isPlaying=!1}function Ge(t,r,n){function o(r){return"string"==typeof r?e.commands[r](t):r(t),!0}var i,a,s=t.getCursor("head"),l=E.macroModeState.lastInsertModeChanges.inVisualBlock;if(l){var c=t.state.vim.lastSelection,u=(i=c.anchor,{line:(a=c.head).line-i.line,ch:a.line-i.line});le(t,s,u.line+1),n=t.listSelections().length,t.setCursor(s)}for(var h=0;h<n;h++){l&&t.setCursor(Z(s,h,0));for(var p=0;p<r.length;p++){var f=r[p];if(f instanceof Qe)e.lookupKey(f.keyName,"vim-insert",o);else if("string"==typeof f){var d=t.getCursor();t.replaceRange(f,d,d)}else{var m=t.getCursor(),g=Z(m,0,f[0].length);t.replaceRange(f[0],m,g)}}}l&&t.setCursor(Z(s,0,1))}return e.keyMap.vim={attach:i,detach:o,call:l},L("insertModeEscKeysTimeout",200,"number"),e.keyMap["vim-insert"]={fallthrough:["default"],attach:i,detach:o,call:l},e.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:i,detach:o,call:l},P(),j}()});
\ No newline at end of file
+!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../lib/codemirror"),require("../addon/search/searchcursor"),require("../addon/dialog/dialog"),require("../addon/edit/matchbrackets.js")):"function"==typeof define&&define.amd?define(["../lib/codemirror","../addon/search/searchcursor","../addon/dialog/dialog","../addon/edit/matchbrackets"],e):e(CodeMirror)}(function(e){"use strict";var t=[{keys:"<Left>",type:"keyToKey",toKeys:"h"},{keys:"<Right>",type:"keyToKey",toKeys:"l"},{keys:"<Up>",type:"keyToKey",toKeys:"k"},{keys:"<Down>",type:"keyToKey",toKeys:"j"},{keys:"<Space>",type:"keyToKey",toKeys:"l"},{keys:"<BS>",type:"keyToKey",toKeys:"h",context:"normal"},{keys:"<C-Space>",type:"keyToKey",toKeys:"W"},{keys:"<C-BS>",type:"keyToKey",toKeys:"B",context:"normal"},{keys:"<S-Space>",type:"keyToKey",toKeys:"w"},{keys:"<S-BS>",type:"keyToKey",toKeys:"b",context:"normal"},{keys:"<C-n>",type:"keyToKey",toKeys:"j"},{keys:"<C-p>",type:"keyToKey",toKeys:"k"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>"},{keys:"<C-[>",type:"keyToKey",toKeys:"<Esc>",context:"insert"},{keys:"<C-c>",type:"keyToKey",toKeys:"<Esc>",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:"<Home>",type:"keyToKey",toKeys:"0"},{keys:"<End>",type:"keyToKey",toKeys:"$"},{keys:"<PageUp>",type:"keyToKey",toKeys:"<C-b>"},{keys:"<PageDown>",type:"keyToKey",toKeys:"<C-f>"},{keys:"<CR>",type:"keyToKey",toKeys:"j^",context:"normal"},{keys:"<Ins>",type:"action",action:"toggleOverwrite",context:"insert"},{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:"moveBySentence",motionArgs:{forward:!1}},{keys:")",type:"motion",motion:"moveBySentence",motionArgs:{forward:!0}},{keys:"<C-f>",type:"motion",motion:"moveByPage",motionArgs:{forward:!0}},{keys:"<C-b>",type:"motion",motion:"moveByPage",motionArgs:{forward:!1}},{keys:"<C-d>",type:"motion",motion:"moveByScroll",motionArgs:{forward:!0,explicitRepeat:!0}},{keys:"<C-u>",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<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"F<character>",type:"motion",motion:"moveToCharacter",motionArgs:{forward:!1}},{keys:"t<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!0,inclusive:!0}},{keys:"T<character>",type:"motion",motion:"moveTillCharacter",motionArgs:{forward:!1}},{keys:";",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!0}},{keys:",",type:"motion",motion:"repeatLastCharacterSearch",motionArgs:{forward:!1}},{keys:"'<character>",type:"motion",motion:"goToMark",motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<character>",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:"]<character>",type:"motion",motion:"moveToSymbol",motionArgs:{forward:!0,toJumplist:!0}},{keys:"[<character>",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:"expandToLine",motionArgs:{linewise:!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:"<C-w>",type:"operatorMotion",operator:"delete",motion:"moveByWords",motionArgs:{forward:!1,wordEnd:!1},context:"insert"},{keys:"<C-i>",type:"action",action:"jumpListWalk",actionArgs:{forward:!0}},{keys:"<C-o>",type:"action",action:"jumpListWalk",actionArgs:{forward:!1}},{keys:"<C-e>",type:"action",action:"scroll",actionArgs:{forward:!0,linewise:!0}},{keys:"<C-y>",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:"<C-v>",type:"action",action:"toggleVisualMode",actionArgs:{blockwise:!0}},{keys:"<C-q>",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<character>",type:"action",action:"replace",isEdit:!0},{keys:"@<character>",type:"action",action:"replayMacro"},{keys:"q<character>",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:"<C-r>",type:"action",action:"redo"},{keys:"m<character>",type:"action",action:"setMark"},{keys:'"<character>',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<CR>",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:"<C-a>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:"<C-x>",type:"action",action:"incrementNumberToken",isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:"<C-t>",type:"action",action:"indent",actionArgs:{indentRight:!0},context:"insert"},{keys:"<C-d>",type:"action",action:"indent",actionArgs:{indentRight:!1},context:"insert"},{keys:"a<character>",type:"motion",motion:"textObjectManipulation"},{keys:"i<character>",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;e.Vim=function(){function o(t,r){var n;this==e.keyMap.vim&&(e.rmClass(t.getWrapperElement(),"cm-fat-cursor"),"contenteditable"==t.getOption("inputStyle")&&null!=document.body.style.caretColor&&(function(e){var t=e.state.fatCursorMarks;if(t)for(var r=0;r<t.length;r++)t[r].clear();e.state.fatCursorMarks=null,e.off("cursorActivity",s)}(t),t.getInputField().style.caretColor="")),r&&r.attach==i||((n=t).setOption("disableInput",!1),n.off("cursorActivity",qe),e.off(n.getInputField(),"paste",h(n)),n.state.vim=null)}function i(t,r){var n,o;this==e.keyMap.vim&&(e.addClass(t.getWrapperElement(),"cm-fat-cursor"),"contenteditable"==t.getOption("inputStyle")&&null!=document.body.style.caretColor&&((n=t).state.fatCursorMarks=a(n),n.on("cursorActivity",s),t.getInputField().style.caretColor="transparent")),r&&r.attach==i||((o=t).setOption("disableInput",!0),o.setOption("showCursorWhenSelecting",!1),e.signal(o,"vim-mode-change",{mode:"normal"}),o.on("cursorActivity",qe),P(o),e.on(o.getInputField(),"paste",h(o)))}function a(e){for(var t=e.listSelections(),r=[],o=0;o<t.length;o++){var i=t[o];if(i.empty())if(i.anchor.ch<e.getLine(i.anchor.line).length)r.push(e.markText(i.anchor,n(i.anchor.line,i.anchor.ch+1),{className:"cm-fat-cursor-mark"}));else{var a=document.createElement("span");a.textContent=" ",a.className="cm-fat-cursor-mark",r.push(e.setBookmark(i.anchor,{widget:a}))}}return r}function s(e){var t=e.state.fatCursorMarks;if(t)for(var r=0;r<t.length;r++)t[r].clear();e.state.fatCursorMarks=a(e)}function l(t,r){if(r){if(this[t])return this[t];var n=function(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,o=0;o<t.length;o++){var i=t[o];i in c?t[o]=c[i]:n=!0,i in u&&(t[o]=u[i])}return!!n&&(x(r)&&(t[t.length-1]=r.toLowerCase()),"<"+t.join("-")+">")}(t);if(!n)return!1;var o=e.Vim.findKey(r,n);return"function"==typeof o&&e.signal(r,"vim-keypress",n),o}}e.defineOption("vimMode",!1,function(t,r,n){r&&"vim"!=t.getOption("keyMap")?t.setOption("keyMap","vim"):!r&&n!=e.Init&&/^vim/.test(t.getOption("keyMap"))&&t.setOption("keyMap","default")});var c={Shift:"S",Ctrl:"C",Alt:"A",Cmd:"D",Mod:"A"},u={Enter:"CR",Backspace:"BS",Delete:"Del",Insert:"Ins"};function h(e){var t=e.state.vim;return t.onPasteFn||(t.onPasteFn=function(){t.insertMode||(e.setCursor(G(e.getCursor(),0,1)),Q.enterInsertMode(e,{},t))}),t.onPasteFn}var p=/[\d]/,f=[e.isWordChar,function(t){return t&&!e.isWordChar(t)&&!/\s/.test(t)}],d=[function(e){return/\S/.test(e)}];function m(e,t){for(var r=[],n=e;n<e+t;n++)r.push(String.fromCharCode(n));return r}var g=m(65,26),v=m(97,26),y=m(48,10),k=[].concat(g,v,y,["<",">"]),C=[].concat(g,v,y,["-",'"',".",":","/"]);function w(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function M(e){return/^[a-z]$/.test(e)}function x(e){return/^[A-Z]$/.test(e)}function S(e){return/^\s*$/.test(e)}function A(e){return-1!=".?!".indexOf(e)}function b(e,t){for(var r=0;r<t.length;r++)if(t[r]==e)return!0;return!1}var L={};function T(e,t,r,n,o){if(void 0===t&&!o)throw Error("defaultValue is required unless callback is provided");if(r||(r="string"),L[e]={type:r,defaultValue:t,callback:o},n)for(var i=0;i<n.length;i++)L[n[i]]=L[e];t&&R(e,t)}function R(e,t,r,n){var o=L[e],i=(n=n||{}).scope;if(!o)return new Error("Unknown option: "+e);if("boolean"==o.type){if(t&&!0!==t)return new Error("Invalid argument: "+e+"="+t);!1!==t&&(t=!0)}o.callback?("local"!==i&&o.callback(t,void 0),"global"!==i&&r&&o.callback(t,r)):("local"!==i&&(o.value="boolean"==o.type?!!t:t),"global"!==i&&r&&(r.state.vim.options[e]={value:t}))}function E(e,t,r){var n=L[e],o=(r=r||{}).scope;if(!n)return new Error("Unknown option: "+e);if(n.callback){var i=t&&n.callback(void 0,t);return"global"!==o&&void 0!==i?i:"local"!==o?n.callback():void 0}return((i="global"!==o&&t&&t.state.vim.options[e])||"local"!==o&&n||{}).value}T("filetype",void 0,"string",["ft"],function(e,t){if(void 0!==t){if(void 0===e)return"null"==(r=t.getOption("mode"))?"":r;var r=""==e?"null":e;t.setOption("mode",r)}});var O,B,I=function(){var e=100,t=-1,r=0,n=0,o=new Array(e);return{cachedCursor:void 0,add:function(i,a,s){var l=o[t%e];function c(r){var n=++t%e,a=o[n];a&&a.clear(),o[n]=i.setBookmark(r)}if(l){var u=l.find();u&&!te(u,a)&&c(a)}else c(a);c(s),r=t,(n=t-e+1)<0&&(n=0)},move:function(i,a){(t+=a)>r?t=r:t<n&&(t=n);var s=o[(e+t)%e];if(s&&!s.find()){var l,c=a>0?1:-1,u=i.getCursor();do{if((s=o[(e+(t+=c))%e])&&(l=s.find())&&!te(u,l))break}while(t<r&&t>n)}return s}}},K=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};function N(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=K()}function P(e){return e.state.vim||(e.state.vim={inputState:new _,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},fakeCursor:null,insertMode:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:null,sel:{},options:{}}),e.state.vim}function j(){for(var e in O={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:I(),macroModeState:new N,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:""},registerController:new V({}),searchHistoryController:new D,exCommandHistoryController:new D},L){var t=L[e];t.value=t.defaultValue}}N.prototype={exitMacroRecordMode:function(){var e=O.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1},enterMacroRecordMode:function(e,t){var r=O.registerController.getRegister(t);r&&(r.clear(),this.latestRegister=t,e.openDialog&&(this.onRecordingDone=e.openDialog("(recording)["+t+"]",null,{bottom:!0})),this.isRecording=!0)}};var H={buildKeyMap:function(){},getRegisterController:function(){return O.registerController},resetVimGlobalState_:j,getVimGlobalState_:function(){return O},maybeInitVimState_:P,suppressErrorLogging:!1,InsertModeKey:ze,map:function(e,t,r){Ve.map(e,t,r)},unmap:function(e,t){Ve.unmap(e,t)},setOption:R,getOption:E,defineOption:T,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;We[e]=r,Ve.commandMap_[t]={name:e,shortName:t,type:"api"}},handleKey:function(e,t,r){var n=this.findKey(e,t,r);if("function"==typeof n)return n()},findKey:function(r,n,o){var i,a=P(r);function s(){var e=O.macroModeState;if(e.isRecording){if("q"==n)return e.exitMacroRecordMode(),F(r),!0;"mapping"!=o&&function(e,t){if(!e.isPlaying){var r=e.latestRegister,n=O.registerController.getRegister(r);n&&n.pushText(t)}}(e,n)}}function l(){if("<Esc>"==n)return F(r),a.visualMode?fe(r):a.insertMode&&De(r),!0}return!1===(i=a.insertMode?function(){if(l())return!0;for(var e=a.inputState.keyBuffer=a.inputState.keyBuffer+n,o=1==n.length,i=U.matchCommand(e,t,a.inputState,"insert");e.length>1&&"full"!=i.type;){e=a.inputState.keyBuffer=e.slice(1);var s=U.matchCommand(e,t,a.inputState,"insert");"none"!=s.type&&(i=s)}if("none"==i.type)return F(r),!1;if("partial"==i.type)return B&&window.clearTimeout(B),B=window.setTimeout(function(){a.insertMode&&a.inputState.keyBuffer&&F(r)},E("insertModeEscKeysTimeout")),!o;if(B&&window.clearTimeout(B),o){for(var c=r.listSelections(),u=0;u<c.length;u++){var h=c[u].head;r.replaceRange("",G(h,0,-(e.length-1)),h,"+input")}O.macroModeState.lastInsertModeChanges.changes.pop()}return F(r),i.command}():function(){if(s()||l())return!0;var e=a.inputState.keyBuffer=a.inputState.keyBuffer+n;if(/^[1-9]\d*$/.test(e))return!0;if(!(o=/^(\d*)(.*)$/.exec(e)))return F(r),!1;var o,i=a.visualMode?"visual":"normal",c=U.matchCommand(o[2]||o[1],t,a.inputState,i);return"none"==c.type?(F(r),!1):"partial"==c.type||(a.inputState.keyBuffer="",(o=/^(\d*)(.*)$/.exec(e))[1]&&"0"!=o[1]&&a.inputState.pushRepeatDigit(o[1]),c.command)}())?a.insertMode||1!==n.length?void 0:function(){return!0}:!0===i?function(){return!0}:function(){return r.operation(function(){r.curOp.isVimOp=!0;try{"keyToKey"==i.type?function(t){for(var o;t;)o=/<\w+-.+?>|<\w+>|./.exec(t),n=o[0],t=t.substring(o.index+n.length),e.Vim.handleKey(r,n,"mapping")}(i.toKeys):U.processCommand(r,a,i)}catch(t){throw r.state.vim=void 0,P(r),e.Vim.suppressErrorLogging||console.log(t),t}return!0})}},handleEx:function(e,t){Ve.processCommand(e,t)},defineMotion:function(e,t){J[e]=t},defineAction:function(e,t){Q[e]=t},defineOperator:function(e,t){q[e]=t},mapCommand:function(e,t,r,n,o){var i={keys:e,type:t};for(var a in i[t]=r,i[t+"Args"]=n,o)i[a]=o[a];Ue(i)},_mapCommand:Ue,defineRegister:function(e,t){var r=O.registerController.registers;if(!e||1!=e.length)throw Error("Register name must be 1 character");if(r[e])throw Error("Register already defined "+e);r[e]=t,C.push(e)},exitVisualMode:fe,exitInsertMode:De};function _(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=null}function F(t,r){t.state.vim.inputState=new _,e.signal(t,"vim-command-done",r)}function W(e,t,r){this.clear(),this.keyBuffer=[e||""],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!t,this.blockwise=!!r}function V(e){this.registers=e,this.unnamedRegister=e['"']=new W,e["."]=new W,e[":"]=new W,e["/"]=new W}function D(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}_.prototype.pushRepeatDigit=function(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)},_.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},W.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(K(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("")}},V.prototype={pushText:function(e,t,r,n,o){n&&"\n"!==r.charAt(r.length-1)&&(r+="\n");var i=this.isValidRegister(e)?this.getRegister(e):null;if(i)x(e)?i.pushText(r,n):i.setText(r,n,o),this.unnamedRegister.setText(i.toString(),n);else{switch(t){case"yank":this.registers[0]=new W(r,n,o);break;case"delete":case"change":-1==r.indexOf("\n")?this.registers["-"]=new W(r,n):(this.shiftNumericRegisters_(),this.registers[1]=new W(r,n))}this.unnamedRegister.setText(r,n,o)}},getRegister:function(e){return this.isValidRegister(e)?(e=e.toLowerCase(),this.registers[e]||(this.registers[e]=new W),this.registers[e]):this.unnamedRegister},isValidRegister:function(e){return e&&b(e,C)},shiftNumericRegisters_:function(){for(var e=9;e>=2;e--)this.registers[e]=this.getRegister(""+(e-1))}},D.prototype={nextMatch:function(e,t){var r=this.historyBuffer,n=t?-1:1;null===this.initialPrefix&&(this.initialPrefix=e);for(var o=this.iterator+n;t?o>=0:o<r.length;o+=n)for(var i=r[o],a=0;a<=i.length;a++)if(this.initialPrefix==i.substring(0,a))return this.iterator=o,i;return o>=r.length?(this.iterator=r.length,this.initialPrefix):o<0?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 U={matchCommand:function(e,t,r,n){var o,i=function(e,t,r,n){for(var o,i=[],a=[],s=0;s<t.length;s++){var l=t[s];"insert"==r&&"insert"!=l.context||l.context&&l.context!=r||n.operator&&"action"==l.type||!(o=X(e,l.keys))||("partial"==o&&i.push(l),"full"==o&&a.push(l))}return{partial:i.length&&i,full:a.length&&a}}(e,t,n,r);if(!i.full&&!i.partial)return{type:"none"};if(!i.full&&i.partial)return{type:"partial"};for(var a=0;a<i.full.length;a++){var s=i.full[a];o||(o=s)}if("<character>"==o.keys.slice(-11)){var l=function(e){var t=/^.*(<[^>]+>)$/.exec(e),r=t?t[1]:e.slice(-1);if(r.length>1)switch(r){case"<CR>":r="\n";break;case"<Space>":r=" ";break;default:r=""}return r}(e);if(!l)return{type:"none"};r.selectedCharacter=l}return{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=Z(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);F(e)}n.operator=r.operator,n.operatorArgs=Z(r.operatorArgs),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,r){var n=t.visualMode,o=Z(r.operatorMotionArgs);o&&n&&o.visualLine&&(t.visualLine=!0),this.processOperator(e,t,r),n||this.processMotion(e,t,r)},processAction:function(e,t,r){var n=t.inputState,o=n.getRepeat(),i=!!o,a=Z(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=o||1,a.repeatIsExplicit=i,a.registerName=n.registerName,F(e),t.lastMotion=null,r.isEdit&&this.recordLastEdit(t,n,r),Q[r.action](e,a,t)},processSearch:function(t,r,n){if(t.getSearchCursor){var o=n.searchArgs.forward,i=n.searchArgs.wholeWordOnly;Ae(t).setReversed(!o);var a=o?"/":"?",s=Ae(t).getQuery(),l=t.getScrollInfo();switch(n.searchArgs.querySrc){case"prompt":var c=O.macroModeState;c.isPlaying?f(p=c.replaySearchQueries.shift(),!0,!1):Ie(t,{onClose:function(e){t.scrollTo(l.left,l.top),f(e,!0,!0);var r=O.macroModeState;r.isRecording&&function(e,t){if(!e.isPlaying){var r=e.latestRegister,n=O.registerController.getRegister(r);n&&n.pushSearchQuery&&n.pushSearchQuery(t)}}(r,e)},prefix:a,desc:Be,onKeyUp:function(r,n,i){var a,s,c,u=e.keyName(r);"Up"==u||"Down"==u?(a="Up"==u,s=r.target?r.target.selectionEnd:0,i(n=O.searchHistoryController.nextMatch(n,a)||""),s&&r.target&&(r.target.selectionEnd=r.target.selectionStart=Math.min(s,r.target.value.length))):"Left"!=u&&"Right"!=u&&"Ctrl"!=u&&"Alt"!=u&&"Shift"!=u&&O.searchHistoryController.reset();try{c=Ke(t,n,!0,!0)}catch(r){}c?t.scrollIntoView(Pe(t,!o,c),30):(je(t),t.scrollTo(l.left,l.top))},onKeyDown:function(r,n,o){var i=e.keyName(r);"Esc"==i||"Ctrl-C"==i||"Ctrl-["==i||"Backspace"==i&&""==n?(O.searchHistoryController.pushInput(n),O.searchHistoryController.reset(),Ke(t,s),je(t),t.scrollTo(l.left,l.top),e.e_stop(r),F(t),o(),t.focus()):"Up"==i||"Down"==i?e.e_stop(r):"Ctrl-U"==i&&(e.e_stop(r),o(""))}});break;case"wordUnderCursor":var u=me(t,!1,0,!1,!0),h=!0;if(u||(u=me(t,!1,0,!1,!1),h=!1),!u)return;var p=t.getLine(u.start.line).substring(u.start.ch,u.end.ch);p=h&&i?"\\b"+p+"\\b":p.replace(/([.?*+$\[\]\/\\(){}|\-])/g,"\\$1"),O.jumpList.cachedCursor=t.getCursor(),t.setCursor(u.start),f(p,!0,!1)}}function f(e,o,i){O.searchHistoryController.pushInput(e),O.searchHistoryController.reset();try{Ke(t,e,o,i)}catch(r){return Oe(t,"Invalid regex: "+e),void F(t)}U.processMotion(t,r,{type:"motion",motion:"findNext",motionArgs:{forward:!0,toJumplist:n.searchArgs.toJumplist}})}},processEx:function(t,r,n){function o(e){O.exCommandHistoryController.pushInput(e),O.exCommandHistoryController.reset(),Ve.processCommand(t,e)}function i(r,n,o){var i,a,s=e.keyName(r);("Esc"==s||"Ctrl-C"==s||"Ctrl-["==s||"Backspace"==s&&""==n)&&(O.exCommandHistoryController.pushInput(n),O.exCommandHistoryController.reset(),e.e_stop(r),F(t),o(),t.focus()),"Up"==s||"Down"==s?(e.e_stop(r),i="Up"==s,a=r.target?r.target.selectionEnd:0,o(n=O.exCommandHistoryController.nextMatch(n,i)||""),a&&r.target&&(r.target.selectionEnd=r.target.selectionStart=Math.min(a,r.target.value.length))):"Ctrl-U"==s?(e.e_stop(r),o("")):"Left"!=s&&"Right"!=s&&"Ctrl"!=s&&"Alt"!=s&&"Shift"!=s&&O.exCommandHistoryController.reset()}"keyToEx"==n.type?Ve.processCommand(t,n.exArgs.input):r.visualMode?Ie(t,{onClose:o,prefix:":",value:"'<,'>",onKeyDown:i,selectValueOnOpen:!1}):Ie(t,{onClose:o,prefix:":",onKeyDown:i})},evalInput:function(e,t){var r,o,i,a,s=t.inputState,l=s.motion,c=s.motionArgs||{},u=s.operator,h=s.operatorArgs||{},p=s.registerName,f=t.sel,d=ee(t.visualMode?z(e,f.head):e.getCursor("head")),m=ee(t.visualMode?z(e,f.anchor):e.getCursor("anchor")),g=ee(d),v=ee(m);if(u&&this.recordLastEdit(t,s),(i=void 0!==s.repeatOverride?s.repeatOverride:s.getRepeat())>0&&c.explicitRepeat?c.repeatIsExplicit=!0:(c.noRepeat||!c.explicitRepeat&&0===i)&&(i=1,c.repeatIsExplicit=!1),s.selectedCharacter&&(c.selectedCharacter=h.selectedCharacter=s.selectedCharacter),c.repeat=i,F(e),l){var y=J[l](e,d,c,t);if(t.lastMotion=J[l],!y)return;if(c.toJumplist){var k=O.jumpList,C=k.cachedCursor;C?(ge(e,C,y),delete k.cachedCursor):ge(e,d,y)}y instanceof Array?(o=y[0],r=y[1]):r=y,r||(r=ee(d)),t.visualMode?(t.visualBlock&&r.ch===1/0||(r=z(e,r,t.visualBlock)),o&&(o=z(e,o,!0)),o=o||v,f.anchor=o,f.head=r,he(e),Me(e,t,"<",re(o,r)?o:r),Me(e,t,">",re(o,r)?r:o)):u||(r=z(e,r),e.setCursor(r.line,r.ch))}if(u){if(h.lastSel){o=v;var w=h.lastSel,M=Math.abs(w.head.line-w.anchor.line),x=Math.abs(w.head.ch-w.anchor.ch);r=w.visualLine?n(v.line+M,v.ch):w.visualBlock?n(v.line+M,v.ch+x):w.head.line==w.anchor.line?n(v.line,v.ch+x):n(v.line+M,v.ch),t.visualMode=!0,t.visualLine=w.visualLine,t.visualBlock=w.visualBlock,f=t.sel={anchor:o,head:r},he(e)}else t.visualMode&&(h.lastSel={anchor:ee(f.anchor),head:ee(f.head),visualBlock:t.visualBlock,visualLine:t.visualLine});var A,b,L,T,R;if(t.visualMode){if(A=ne(f.head,f.anchor),b=oe(f.head,f.anchor),L=t.visualLine||h.linewise,R=pe(e,{anchor:A,head:b},T=t.visualBlock?"block":L?"line":"char"),L){var E=R.ranges;if("block"==T)for(var B=0;B<E.length;B++)E[B].head.ch=ae(e,E[B].head.line);else"line"==T&&(E[0].head=n(E[0].head.line+1,0))}}else{if(A=ee(o||v),re(b=ee(r||g),A)){var I=A;A=b,b=I}(L=c.linewise||h.linewise)?(a=b,A.ch=0,a.ch=0,a.line++):c.forward&&function(e,t,r){var n=e.getRange(t,r);if(/\n\s*$/.test(n)){var o=n.split("\n");o.pop();for(var i=o.pop();o.length>0&&i&&S(i);i=o.pop())r.line--,r.ch=0;i?(r.line--,r.ch=ae(e,r.line)):r.ch=0}}(e,A,b),R=pe(e,{anchor:A,head:b},T="char",!c.inclusive||L)}e.setSelections(R.ranges,R.primary),t.lastMotion=null,h.repeat=i,h.registerName=p,h.linewise=L;var K=q[u](e,h,R.ranges,v,r);t.visualMode&&fe(e,null!=K),K&&e.setCursor(K)}},recordLastEdit:function(e,t,r){var n=O.macroModeState;n.isPlaying||(e.lastEditInputState=t,e.lastEditActionCommand=r,n.lastInsertModeChanges.changes=[],n.lastInsertModeChanges.expectCursorActivityForChange=!1)}},J={moveToTopLine:function(e,t,r){var o=He(e).top+r.repeat-1;return n(o,de(e.getLine(o)))},moveToMiddleLine:function(e){var t=He(e),r=Math.floor(.5*(t.top+t.bottom));return n(r,de(e.getLine(r)))},moveToBottomLine:function(e,t,r){var o=He(e).bottom-r.repeat+1;return n(o,de(e.getLine(o)))},expandToLine:function(e,t,r){return n(t.line+r.repeat-1,1/0)},findNext:function(e,t,r){var n=Ae(e),o=n.getQuery();if(o){var i=!r.forward;return i=n.isReversed()?!i:i,Ne(e,o),Pe(e,i,o,r.repeat)}},goToMark:function(e,t,r,n){var o=_e(e,n,r.selectedCharacter);return o?r.linewise?{line:o.line,ch:de(e.getLine(o.line))}:o:null},moveToOtherHighlightedEnd:function(e,t,r,o){if(o.visualBlock&&r.sameLine){var i=o.sel;return[z(e,n(i.anchor.line,i.head.ch)),z(e,n(i.head.line,i.anchor.ch))]}return[o.sel.head,o.sel.anchor]},jumpToMark:function(e,t,r,o){for(var i=t,a=0;a<r.repeat;a++){var s=i;for(var l in o.marks)if(M(l)){var c=o.marks[l].find();if(!((r.forward?re(c,s):re(s,c))||r.linewise&&c.line==s.line)){var u=te(s,i),h=r.forward?ie(s,c,i):ie(i,c,s);(u||h)&&(i=c)}}}return r.linewise&&(i=n(i.line,de(e.getLine(i.line)))),i},moveByCharacters:function(e,t,r){var o=t,i=r.repeat,a=r.forward?o.ch+i:o.ch-i;return n(o.line,a)},moveByLines:function(e,t,r,o){var i=t,a=i.ch;switch(o.lastMotion){case this.moveByLines:case this.moveByDisplayLines:case this.moveByScroll:case this.moveToColumn:case this.moveToEol:a=o.lastHPos;break;default:o.lastHPos=a}var s=r.repeat+(r.repeatOffset||0),l=r.forward?i.line+s:i.line-s,c=e.firstLine(),u=e.lastLine();return l<c&&i.line==c?this.moveToStartOfLine(e,t,r,o):l>u&&i.line==u?this.moveToEol(e,t,r,o):(r.toFirstChar&&(a=de(e.getLine(l)),o.lastHPos=a),o.lastHSPos=e.charCoords(n(l,a),"div").left,n(l,a))},moveByDisplayLines:function(e,t,r,o){var i=t;switch(o.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:o.lastHSPos=e.charCoords(i,"div").left}var a=r.repeat;if((l=e.findPosV(i,r.forward?a:-a,"line",o.lastHSPos)).hitSide)if(r.forward)var s={top:e.charCoords(l,"div").top+8,left:o.lastHSPos},l=e.coordsChar(s,"div");else{var c=e.charCoords(n(e.firstLine(),0),"div");c.left=o.lastHSPos,l=e.coordsChar(c,"div")}return o.lastHPos=l.ch,l},moveByPage:function(e,t,r){var n=t,o=r.repeat;return e.findPosV(n,r.forward?o:-o,"page")},moveByParagraph:function(e,t,r){var n=r.forward?1:-1;return xe(e,t,r.repeat,n)},moveBySentence:function(e,t,r){var o=r.forward?1:-1;return function(e,t,r,o){function i(e,t){if(t.pos+t.dir<0||t.pos+t.dir>=t.line.length){if(t.ln+=t.dir,!w(e,t.ln))return t.line=null,t.ln=null,void(t.pos=null);t.line=e.getLine(t.ln),t.pos=t.dir>0?0:t.line.length-1}else t.pos+=t.dir}function a(e,t,r,n){var o=e.getLine(t),a=""===o,s={line:o,ln:t,pos:r,dir:n},l={ln:s.ln,pos:s.pos},c=""===s.line;for(i(e,s);null!==s.line;){if(l.ln=s.ln,l.pos=s.pos,""===s.line&&!c)return{ln:s.ln,pos:s.pos};if(a&&""!==s.line&&!S(s.line[s.pos]))return{ln:s.ln,pos:s.pos};!A(s.line[s.pos])||a||s.pos!==s.line.length-1&&!S(s.line[s.pos+1])||(a=!0),i(e,s)}var o=e.getLine(l.ln);l.pos=0;for(var u=o.length-1;u>=0;--u)if(!S(o[u])){l.pos=u;break}return l}function s(e,t,r,n){var o=e.getLine(t),a={line:o,ln:t,pos:r,dir:n},s={ln:a.ln,pos:null},l=""===a.line;for(i(e,a);null!==a.line;){if(""===a.line&&!l)return null!==s.pos?s:{ln:a.ln,pos:a.pos};if(A(a.line[a.pos])&&null!==s.pos&&(a.ln!==s.ln||a.pos+1!==s.pos))return s;""===a.line||S(a.line[a.pos])||(l=!1,s={ln:a.ln,pos:a.pos}),i(e,a)}var o=e.getLine(s.ln);s.pos=0;for(var c=0;c<o.length;++c)if(!S(o[c])){s.pos=c;break}return s}for(var l={ln:t.line,pos:t.ch};r>0;)l=o<0?s(e,l.ln,l.pos,o):a(e,l.ln,l.pos,o),r--;return n(l.ln,l.pos)}(e,t,r.repeat,o)},moveByScroll:function(e,t,r,n){var o=e.getScrollInfo(),i=null,a=r.repeat;a||(a=o.clientHeight/(2*e.defaultTextHeight()));var s=e.charCoords(t,"local");if(r.repeat=a,!(i=J.moveByDisplayLines(e,t,r,n)))return null;var l=e.charCoords(i,"local");return e.scrollTo(null,o.top+l.top-s.top),i},moveByWords:function(e,t,r){return function(e,t,r,o,i,a){var s=ee(t),l=[];(o&&!i||!o&&i)&&r++;for(var c=!(o&&i),u=0;u<r;u++){var h=Ce(e,t,o,a,c);if(!h){var p=ae(e,e.lastLine());l.push(o?{line:e.lastLine(),from:p,to:p}:{line:0,from:0,to:0});break}l.push(h),t=n(h.line,o?h.to-1:h.from)}var f=l.length!=r,d=l[0],m=l.pop();return o&&!i?(f||d.from==s.ch&&d.line==s.line||(m=l.pop()),n(m.line,m.from)):o&&i?n(m.line,m.to-1):!o&&i?(f||d.to==s.ch&&d.line==s.line||(m=l.pop()),n(m.line,m.to)):n(m.line,m.from)}(e,t,r.repeat,!!r.forward,!!r.wordEnd,!!r.bigWord)},moveTillCharacter:function(e,t,r){var n=we(e,r.repeat,r.forward,r.selectedCharacter),o=r.forward?-1:1;return ve(o,r),n?(n.ch+=o,n):null},moveToCharacter:function(e,t,r){var n=r.repeat;return ve(0,r),we(e,n,r.forward,r.selectedCharacter)||t},moveToSymbol:function(e,t,r){return function(e,t,r,o){var i=ee(e.getCursor()),a=r?1:-1,s=r?e.lineCount():-1,l=i.ch,c=i.line,u=e.getLine(c),h={lineText:u,nextCh:u.charAt(l),lastCh:null,index:l,symb:o,reverseSymb:(r?{")":"(","}":"{"}:{"(":")","{":"}"})[o],forward:r,depth:0,curMoveThrough:!1},p=ye[o];if(!p)return i;var f=ke[p].init,d=ke[p].isComplete;for(f&&f(h);c!==s&&t;){if(h.index+=a,h.nextCh=h.lineText.charAt(h.index),!h.nextCh){if(c+=a,h.lineText=e.getLine(c)||"",a>0)h.index=0;else{var m=h.lineText.length;h.index=m>0?m-1:0}h.nextCh=h.lineText.charAt(h.index)}d(h)&&(i.line=c,i.ch=h.index,t--)}return h.nextCh||h.curMoveThrough?n(c,h.index):i}(e,r.repeat,r.forward,r.selectedCharacter)||t},moveToColumn:function(e,t,r,o){var i,a,s,l=r.repeat;return o.lastHPos=l-1,o.lastHSPos=e.charCoords(t,"div").left,a=l,s=(i=e).getCursor().line,z(i,n(s,a-1))},moveToEol:function(e,t,r,o){var i=t;o.lastHPos=1/0;var a=n(i.line+r.repeat-1,1/0),s=e.clipPos(a);return s.ch--,o.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){for(var r,o=t,i=o.line,a=o.ch,s=e.getLine(i);a<s.length;a++)if((r=s.charAt(a))&&-1!="()[]{}".indexOf(r)){var l=e.getTokenTypeAt(n(i,a+1));if("string"!==l&&"comment"!==l)break}return a<s.length?e.findMatchingBracket(n(i,a)).to:o},moveToStartOfLine:function(e,t){return n(t.line,0)},moveToLineOrEdgeOfDocument:function(e,t,r){var o=r.forward?e.lastLine():e.firstLine();return r.repeatIsExplicit&&(o=r.repeat-e.getOption("firstLineNumber")),n(o,de(e.getLine(o)))},textObjectManipulation:function(e,t,r,o){var i=r.selectedCharacter;"b"==i?i="(":"B"==i&&(i="{");var a,s,l,c,u,h,p,f,d=!r.textObjectInner;if({"(":")",")":"(","{":"}","}":"{","[":"]","]":"["}[i])a=function(e,t,r,o){var i,a,s=t,l={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/}[r],c={"(":"(",")":"(","[":"[","]":"[","{":"{","}":"{"}[r],u=e.getLine(s.line).charAt(s.ch)===c?1:0;if(i=e.scanForBracket(n(s.line,s.ch+u),-1,void 0,{bracketRegex:l}),a=e.scanForBracket(n(s.line,s.ch+u),1,void 0,{bracketRegex:l}),!i||!a)return{start:s,end:s};if(i=i.pos,a=a.pos,i.line==a.line&&i.ch>a.ch||i.line>a.line){var h=i;i=a,a=h}return o?a.ch+=1:i.ch+=1,{start:i,end:a}}(e,t,i,d);else if({"'":!0,'"':!0}[i])a=function(e,t,r,o){var i,a,s,l,c=ee(t),u=e.getLine(c.line).split(""),h=u.indexOf(r);if(c.ch<h?c.ch=h:h<c.ch&&u[c.ch]==r&&(a=c.ch,--c.ch),u[c.ch]!=r||a)for(s=c.ch;s>-1&&!i;s--)u[s]==r&&(i=s+1);else i=c.ch+1;if(i&&!a)for(s=i,l=u.length;s<l&&!a;s++)u[s]==r&&(a=s);return i&&a?(o&&(--i,++a),{start:n(c.line,i),end:n(c.line,a)}):{start:c,end:c}}(e,t,i,d);else if("W"===i)a=me(e,d,0,!0);else if("w"===i)a=me(e,d,0,!1);else{if("p"!==i)return null;if(a=xe(e,t,r.repeat,0,d),r.linewise=!0,o.visualMode)o.visualLine||(o.visualLine=!0);else{var m=o.inputState.operatorArgs;m&&(m.linewise=!0),a.end.line--}}return e.state.vim.visualMode?(s=e,l=a.start,c=a.end,h=s.state.vim.sel,p=h.head,f=h.anchor,re(c,l)&&(u=c,c=l,l=u),re(p,f)?(p=ne(l,p),f=oe(f,c)):(f=ne(l,f),-1==(p=G(p=oe(p,c),0,-1)).ch&&p.line!=s.firstLine()&&(p=n(p.line-1,ae(s,p.line-1)))),[f,p]):[a.start,a.end]},repeatLastCharacterSearch:function(e,t,r){var n=O.lastCharacterSearch,o=r.repeat,i=r.forward===n.forward,a=(n.increment?1:0)*(i?-1:1);e.moveH(-a,"char"),r.inclusive=!!i;var s=we(e,o,i,n.selectedCharacter);return s?(s.ch+=a,s):(e.moveH(a,"char"),t)}};function $(e,t){for(var r=[],n=0;n<t;n++)r.push(e);return r}var q={change:function(t,r,o){var i,a,s=t.state.vim;if(O.macroModeState.lastInsertModeChanges.inVisualBlock=s.visualBlock,s.visualMode){a=t.getSelection();var l=$("",o.length);t.replaceSelections(l),i=ne(o[0].head,o[0].anchor)}else{var c=o[0].anchor,u=o[0].head;a=t.getRange(c,u);var h=s.lastEditInputState||{};if("moveByWords"==h.motion&&!S(a)){var p=/\s+$/.exec(a);p&&h.motionArgs&&h.motionArgs.forward&&(u=G(u,0,-p[0].length),a=a.slice(0,-p[0].length))}var f=new n(c.line-1,Number.MAX_VALUE),d=t.firstLine()==t.lastLine();u.line>t.lastLine()&&r.linewise&&!d?t.replaceRange("",f,u):t.replaceRange("",c,u),r.linewise&&(d||(t.setCursor(f),e.commands.newlineAndIndent(t)),c.ch=Number.MAX_VALUE),i=c}O.registerController.pushText(r.registerName,"change",a,r.linewise,o.length>1),Q.enterInsertMode(t,{head:i},t.state.vim)},delete:function(e,t,r){var o,i,a=e.state.vim;if(a.visualBlock){i=e.getSelection();var s=$("",r.length);e.replaceSelections(s),o=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,ae(e,l.line-1))),i=e.getRange(l,c),e.replaceRange("",l,c),o=l,t.linewise&&(o=J.moveToFirstNonWhiteSpaceCharacter(e,l))}return O.registerController.pushText(t.registerName,"delete",i,t.linewise,a.visualBlock),z(e,o,a.insertMode)},indent:function(e,t,r){var n=e.state.vim,o=r[0].anchor.line,i=n.visualBlock?r[r.length-1].anchor.line:r[0].head.line,a=n.visualMode?t.repeat:1;t.linewise&&i--;for(var s=o;s<=i;s++)for(var l=0;l<a;l++)e.indentLine(s,t.indentRight);return J.moveToFirstNonWhiteSpaceCharacter(e,r[0].anchor)},changeCase:function(e,t,r,n,o){for(var i=e.getSelections(),a=[],s=t.toLower,l=0;l<i.length;l++){var c=i[l],u="";if(!0===s)u=c.toLowerCase();else if(!1===s)u=c.toUpperCase();else for(var h=0;h<c.length;h++){var p=c.charAt(h);u+=x(p)?p.toLowerCase():p.toUpperCase()}a.push(u)}return e.replaceSelections(a),t.shouldMoveCursor?o:!e.state.vim.visualMode&&t.linewise&&r[0].anchor.line+1==r[0].head.line?J.moveToFirstNonWhiteSpaceCharacter(e,n):t.linewise?n:ne(r[0].anchor,r[0].head)},yank:function(e,t,r,n){var o=e.state.vim,i=e.getSelection(),a=o.visualMode?ne(o.sel.anchor,o.sel.head,r[0].head,r[0].anchor):n;return O.registerController.pushText(t.registerName,"yank",i,t.linewise,o.visualBlock),a}};var Q={jumpListWalk:function(e,t,r){if(!r.visualMode){var n=t.repeat,o=t.forward,i=O.jumpList.move(e,o?n:-n),a=i?i.find():void 0;a=a||e.getCursor(),e.setCursor(a)}},scroll:function(e,t,r){if(!r.visualMode){var n=t.repeat||1,o=e.defaultTextHeight(),i=e.getScrollInfo().top,a=o*n,s=t.forward?i+a:i-a,l=ee(e.getCursor()),c=e.charCoords(l,"local");if(t.forward)s>c.top?(l.line+=(s-c.top)/o,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<c.bottom?(l.line-=(c.bottom-u)/o,l.line=Math.floor(l.line),e.setCursor(l),c=e.charCoords(l,"local"),e.scrollTo(null,c.bottom-e.getScrollInfo().clientHeight)):e.scrollTo(null,s)}}},scrollToCursor:function(e,t){var r=e.getCursor().line,o=e.charCoords(n(r,0),"local"),i=e.getScrollInfo().clientHeight,a=o.top,s=o.bottom-a;switch(t.position){case"center":a=a-i/2+s;break;case"bottom":a=a-i+s}e.scrollTo(null,a)},replayMacro:function(e,t,r){var n=t.selectedCharacter,o=t.repeat,i=O.macroModeState;for("@"==n&&(n=i.latestRegister);o--;)Je(e,r,i,n)},enterMacroRecordMode:function(e,t){var r=O.macroModeState,n=t.selectedCharacter;O.registerController.isValidRegister(n)&&r.enterMacroRecordMode(e,n)},toggleOverwrite:function(t){t.state.overwrite?(t.toggleOverwrite(!1),t.setOption("keyMap","vim-insert"),e.signal(t,"vim-mode-change",{mode:"insert"})):(t.toggleOverwrite(!0),t.setOption("keyMap","vim-replace"),e.signal(t,"vim-mode-change",{mode:"replace"}))},enterInsertMode:function(t,r,o){if(!t.getOption("readOnly")){o.insertMode=!0,o.insertModeRepeat=r&&r.repeat||1;var i=r?r.insertAt:null,a=o.sel,s=r.head||t.getCursor("head"),l=t.listSelections().length;if("eol"==i)s=n(s.line,ae(t,s.line));else if("charAfter"==i)s=G(s,0,1);else if("firstNonBlank"==i)s=J.moveToFirstNonWhiteSpaceCharacter(t,s);else if("startOfSelectedArea"==i)o.visualBlock?(s=n(Math.min(a.head.line,a.anchor.line),Math.min(a.head.ch,a.anchor.ch)),l=Math.abs(a.head.line-a.anchor.line)+1):s=a.head.line<a.anchor.line?a.head:n(a.anchor.line,0);else if("endOfSelectedArea"==i)o.visualBlock?(s=n(Math.min(a.head.line,a.anchor.line),Math.max(a.head.ch+1,a.anchor.ch)),l=Math.abs(a.head.line-a.anchor.line)+1):s=a.head.line>=a.anchor.line?G(a.head,0,1):n(a.anchor.line,0);else if("inplace"==i&&o.visualMode)return;t.setOption("disableInput",!1),r&&r.replace?(t.toggleOverwrite(!0),t.setOption("keyMap","vim-replace"),e.signal(t,"vim-mode-change",{mode:"replace"})):(t.toggleOverwrite(!1),t.setOption("keyMap","vim-insert"),e.signal(t,"vim-mode-change",{mode:"insert"})),O.macroModeState.isPlaying||(t.on("change",$e),e.on(t.getInputField(),"keydown",Ze)),o.visualMode&&fe(t),ce(t,s,l)}},toggleVisualMode:function(t,r,o){var i,a=r.repeat,s=t.getCursor();o.visualMode?o.visualLine^r.linewise||o.visualBlock^r.blockwise?(o.visualLine=!!r.linewise,o.visualBlock=!!r.blockwise,e.signal(t,"vim-mode-change",{mode:"visual",subMode:o.visualLine?"linewise":o.visualBlock?"blockwise":""}),he(t)):fe(t):(o.visualMode=!0,o.visualLine=!!r.linewise,o.visualBlock=!!r.blockwise,i=z(t,n(s.line,s.ch+a-1),!0),o.sel={anchor:s,head:i},e.signal(t,"vim-mode-change",{mode:"visual",subMode:o.visualLine?"linewise":o.visualBlock?"blockwise":""}),he(t),Me(t,o,"<",ne(s,i)),Me(t,o,">",oe(s,i)))},reselectLastSelection:function(t,r,n){var o=n.lastSelection;if(n.visualMode&&ue(t,n),o){var i=o.anchorMark.find(),a=o.headMark.find();if(!i||!a)return;n.sel={anchor:i,head:a},n.visualMode=!0,n.visualLine=o.visualLine,n.visualBlock=o.visualBlock,he(t),Me(t,n,"<",ne(i,a)),Me(t,n,">",oe(i,a)),e.signal(t,"vim-mode-change",{mode:"visual",subMode:n.visualLine?"linewise":n.visualBlock?"blockwise":""})}},joinLines:function(e,t,r){var o,i;if(r.visualMode){if(o=e.getCursor("anchor"),re(i=e.getCursor("head"),o)){var a=i;i=o,o=a}i.ch=ae(e,i.line)-1}else{var s=Math.max(t.repeat,2);o=e.getCursor(),i=z(e,n(o.line+s-1,1/0))}for(var l=0,c=o.line;c<i.line;c++){l=ae(e,o.line),a=n(o.line+1,ae(e,o.line+1));var u=e.getRange(o,a);u=u.replace(/\n\s*/g," "),e.replaceRange(u,o,a)}var h=n(o.line,l);r.visualMode&&fe(e,!1),e.setCursor(h)},newLineAndEnterInsertMode:function(t,r,o){o.insertMode=!0;var i=ee(t.getCursor());i.line!==t.firstLine()||r.after?(i.line=r.after?i.line:i.line-1,i.ch=ae(t,i.line),t.setCursor(i),(e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent)(t)):(t.replaceRange("\n",n(t.firstLine(),0)),t.setCursor(t.firstLine(),0)),this.enterInsertMode(t,{repeat:r.repeat},o)},paste:function(e,t,r){var o,i,a,s,l,c=ee(e.getCursor()),u=O.registerController.getRegister(t.registerName);if(y=u.toString()){if(t.matchIndent){var h=e.getOption("tabSize"),p=function(e){var t=e.split("\t").length-1,r=e.split(" ").length-1;return t*h+1*r},f=e.getLine(e.getCursor().line),d=p(f.match(/^\s*/)[0]),m=y.replace(/\n$/,""),g=y!==m,v=p(y.match(/^\s*/)[0]),y=m.replace(/^\s*/gm,function(t){var r=d+(p(t)-v);if(r<0)return"";if(e.getOption("indentWithTabs")){var n=Math.floor(r/h);return Array(n+1).join("\t")}return Array(r+1).join(" ")});y+=g?"\n":""}t.repeat>1&&(y=Array(t.repeat+1).join(y));var k,C,w,M,x,S,A,b,L,T,R=u.linewise,E=u.blockwise;if(R)r.visualMode?y=r.visualLine?y.slice(0,-1):"\n"+y.slice(0,y.length-1)+"\n":t.after?(y="\n"+y.slice(0,y.length-1),c.ch=ae(e,c.line)):c.ch=0;else{if(E){y=y.split("\n");for(var B=0;B<y.length;B++)y[B]=""==y[B]?" ":y[B]}c.ch+=t.after?1:0}if(r.visualMode){var I;r.lastPastedText=y;var K=(w=e,x=(M=r).lastSelection,M.visualMode?(S=w.listSelections(),A=S[0],b=S[S.length-1],L=re(A.anchor,A.head)?A.anchor:A.head,T=re(b.anchor,b.head)?b.head:b.anchor,[L,T]):function(){var e=w.getCursor(),t=w.getCursor(),r=x.visualBlock;if(r){var o=r.width,i=r.height;t=n(e.line+i,e.ch+o);for(var a=[],s=e.line;s<t.line;s++){var l=n(s,e.ch),c=n(s,t.ch),u={anchor:l,head:c};a.push(u)}w.setSelections(a)}else{var h=x.anchorMark.find(),p=x.headMark.find(),f=p.line-h.line,d=p.ch-h.ch;t={line:t.line+f,ch:f?t.ch:d+t.ch},x.visualLine&&(e=n(e.line,0),t=n(t.line,ae(w,t.line))),w.setSelection(e,t)}return[e,t]}()),N=K[0],P=K[1],j=e.getSelection(),H=e.listSelections(),_=new Array(H.length).join("1").split("1");r.lastSelection&&(I=r.lastSelection.headMark.find()),O.registerController.unnamedRegister.setText(j),E?(e.replaceSelections(_),P=n(N.line+y.length-1,N.ch),e.setCursor(N),le(e,P),e.replaceSelections(y),k=N):r.visualBlock?(e.replaceSelections(_),e.setCursor(N),e.replaceRange(y,N,N),k=N):(e.replaceRange(y,N,P),k=e.posFromIndex(e.indexFromPos(N)+y.length-1)),I&&(r.lastSelection.headMark=e.setBookmark(I)),R&&(k.ch=0)}else if(E){for(e.setCursor(c),B=0;B<y.length;B++){var F=c.line+B;F>e.lastLine()&&e.replaceRange("\n",n(F,0)),ae(e,F)<c.ch&&(o=e,i=F,a=c.ch,void 0,void 0,s=ae(o,i),l=new Array(a-s+1).join(" "),o.setCursor(n(i,s)),o.replaceRange(l,o.getCursor()))}e.setCursor(c),le(e,n(c.line+y.length-1,c.ch)),e.replaceSelections(y),k=c}else e.replaceRange(y,c),R&&t.after?k=n(c.line+1,de(e.getLine(c.line+1))):R&&!t.after?k=n(c.line,de(e.getLine(c.line))):!R&&t.after?(C=e.indexFromPos(c),k=e.posFromIndex(C+y.length-1)):(C=e.indexFromPos(c),k=e.posFromIndex(C+y.length));r.visualMode&&fe(e,!1),e.setCursor(k)}},undo:function(t,r){t.operation(function(){Y(t,e.commands.undo,r.repeat)(),t.setCursor(t.getCursor("anchor"))})},redo:function(t,r){Y(t,e.commands.redo,r.repeat)()},setRegister:function(e,t,r){r.inputState.registerName=t.selectedCharacter},setMark:function(e,t,r){Me(e,r,t.selectedCharacter,e.getCursor())},replace:function(t,r,o){var i,a,s=r.selectedCharacter,l=t.getCursor(),c=t.listSelections();if(o.visualMode)l=t.getCursor("start"),a=t.getCursor("end");else{var u=t.getLine(l.line);(i=l.ch+r.repeat)>u.length&&(i=u.length),a=n(l.line,i)}if("\n"==s)o.visualMode||t.replaceRange("",l,a),(e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent)(t);else{var h=t.getRange(l,a);if(h=h.replace(/[^\n]/g,s),o.visualBlock){var p=new Array(t.getOption("tabSize")+1).join(" ");h=(h=t.getSelection()).replace(/\t/g,p).replace(/[^\n]/g,s).split("\n"),t.replaceSelections(h)}else t.replaceRange(h,l,a);o.visualMode?(l=re(c[0].anchor,c[0].head)?c[0].anchor:c[0].head,t.setCursor(l),fe(t,!1)):t.setCursor(G(a,0,-1))}},incrementNumberToken:function(e,t){for(var r,o,i,a,s=e.getCursor(),l=e.getLine(s.line),c=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi;null!==(r=c.exec(l))&&(i=(o=r.index)+r[0].length,!(s.ch<i)););if((t.backtrack||!(i<=s.ch))&&r){var u=r[2]||r[4],h=r[3]||r[5],p=t.increase?1:-1,f={"0b":2,0:8,"":10,"0x":16}[u.toLowerCase()];a=(parseInt(r[1]+h,f)+p*t.repeat).toString(f);var d=u?new Array(h.length-a.length+1+r[1].length).join("0"):"";a="-"===a.charAt(0)?"-"+u+d+a.substr(1):u+d+a;var m=n(s.line,o),g=n(s.line,i);e.replaceRange(a,m,g),e.setCursor(n(s.line,o+a.length-1))}},repeatLastEdit:function(e,t,r){if(r.lastEditInputState){var n=t.repeat;n&&t.repeatIsExplicit?r.lastEditInputState.repeatOverride=n:n=r.lastEditInputState.repeatOverride||n,Ge(e,r,n,!1)}},indent:function(e,t){e.indentLine(e.getCursor().line,t.indentRight)},exitInsertMode:De};function z(e,t,r){var o=Math.min(Math.max(e.firstLine(),t.line),e.lastLine()),i=ae(e,o)-1;i=r?i+1:i;var a=Math.min(Math.max(0,t.ch),i);return n(o,a)}function Z(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}function G(e,t,r){return"object"==typeof t&&(r=t.ch,t=t.line),n(e.line+t,e.ch+r)}function X(e,t){if("<character>"==t.slice(-11)){var r=t.length-11,n=e.slice(0,r),o=t.slice(0,r);return n==o&&e.length>r?"full":0==o.indexOf(n)&&"partial"}return e==t?"full":0==t.indexOf(e)&&"partial"}function Y(e,t,r){return function(){for(var n=0;n<r;n++)t(e)}}function ee(e){return n(e.line,e.ch)}function te(e,t){return e.ch==t.ch&&e.line==t.line}function re(e,t){return e.line<t.line||e.line==t.line&&e.ch<t.ch}function ne(e,t){return arguments.length>2&&(t=ne.apply(void 0,Array.prototype.slice.call(arguments,1))),re(e,t)?e:t}function oe(e,t){return arguments.length>2&&(t=oe.apply(void 0,Array.prototype.slice.call(arguments,1))),re(e,t)?t:e}function ie(e,t,r){var n=re(e,t),o=re(t,r);return n&&o}function ae(e,t){return e.getLine(t).length}function se(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function le(e,t){var r=[],o=e.listSelections(),i=ee(e.clipPos(t)),a=!te(t,i),s=function(e,t,r){for(var n=0;n<e.length;n++){var o="head"!=r&&te(e[n].anchor,t),i="anchor"!=r&&te(e[n].head,t);if(o||i)return n}return-1}(o,e.getCursor("head")),l=te(o[s].head,o[s].anchor),c=o.length-1,u=c-s>s?c:0,h=o[u].anchor,p=Math.min(h.line,i.line),f=Math.max(h.line,i.line),d=h.ch,m=i.ch,g=o[u].head.ch-d,v=m-d;g>0&&v<=0?(d++,a||m--):g<0&&v>=0?(d--,l||m++):g<0&&-1==v&&(d--,m++);for(var y=p;y<=f;y++){var k={anchor:new n(y,d),head:new n(y,m)};r.push(k)}return e.setSelections(r),t.ch=m,h.ch=d,h}function ce(e,t,r){for(var n=[],o=0;o<r;o++){var i=G(t,o,0);n.push({anchor:i,head:i})}e.setSelections(n,0)}function ue(e,t){var r=t.sel.anchor,n=t.sel.head;t.lastPastedText&&(n=e.posFromIndex(e.indexFromPos(r)+t.lastPastedText.length),t.lastPastedText=null),t.lastSelection={anchorMark:e.setBookmark(r),headMark:e.setBookmark(n),anchor:ee(r),head:ee(n),visualMode:t.visualMode,visualLine:t.visualLine,visualBlock:t.visualBlock}}function he(e,t,r){var n=e.state.vim,o=pe(e,t=t||n.sel,r=r||n.visualLine?"line":n.visualBlock?"block":"char");e.setSelections(o.ranges,o.primary),Qe(e)}function pe(e,t,r,o){var i=ee(t.head),a=ee(t.anchor);if("char"==r){var s=o||re(t.head,t.anchor)?0:1,l=re(t.head,t.anchor)?1:0;return i=G(t.head,0,s),{ranges:[{anchor:a=G(t.anchor,0,l),head:i}],primary:0}}if("line"==r){if(re(t.head,t.anchor))i.ch=0,a.ch=ae(e,a.line);else{a.ch=0;var c=e.lastLine();i.line>c&&(i.line=c),i.ch=ae(e,i.line)}return{ranges:[{anchor:a,head:i}],primary:0}}if("block"==r){for(var u=Math.min(a.line,i.line),h=Math.min(a.ch,i.ch),p=Math.max(a.line,i.line),f=Math.max(a.ch,i.ch)+1,d=p-u+1,m=i.line==u?0:d-1,g=[],v=0;v<d;v++)g.push({anchor:n(u+v,h),head:n(u+v,f)});return{ranges:g,primary:m}}}function fe(t,r){var n=t.state.vim;!1!==r&&t.setCursor(z(t,n.sel.head)),ue(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 de(e){if(!e)return 0;var t=e.search(/\S/);return-1==t?e.length:t}function me(e,t,r,o,i){for(var a,s,l=(s=(a=e).getCursor("head"),1==a.getSelection().length&&(s=ne(s,a.getCursor("anchor"))),s),c=e.getLine(l.line),u=l.ch,h=i?f[0]:d[0];!h(c.charAt(u));)if(++u>=c.length)return null;o?h=d[0]:(h=f[0])(c.charAt(u))||(h=f[1]);for(var p=u,m=u;h(c.charAt(p))&&p<c.length;)p++;for(;h(c.charAt(m))&&m>=0;)m--;if(m++,t){for(var g=p;/\s/.test(c.charAt(p))&&p<c.length;)p++;if(g==p){for(var v=m;/\s/.test(c.charAt(m-1))&&m>0;)m--;m||(m=v)}}return{start:n(l.line,m),end:n(l.line,p)}}function ge(e,t,r){te(t,r)||O.jumpList.add(e,t,r)}function ve(e,t){O.lastCharacterSearch.increment=e,O.lastCharacterSearch.forward=t.forward,O.lastCharacterSearch.selectedCharacter=t.selectedCharacter}var ye={"(":"bracket",")":"bracket","{":"bracket","}":"bracket","[":"section","]":"section","*":"comment","/":"comment",m:"method",M:"method","#":"preprocess"},ke={bracket:{isComplete:function(e){if(e.nextCh===e.symb){if(e.depth++,e.depth>=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}},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}}};function Ce(e,t,r,n,o){var i=t.line,a=t.ch,s=e.getLine(i),l=r?1:-1,c=n?d:f;if(o&&""==s){if(i+=l,s=e.getLine(i),!w(e,i))return null;a=r?0:s.length}for(;;){if(o&&""==s)return{from:0,to:0,line:i};for(var u=l>0?s.length:-1,h=u,p=u;a!=u;){for(var m=!1,g=0;g<c.length&&!m;++g)if(c[g](s.charAt(a))){for(h=a;a!=u&&c[g](s.charAt(a));)a+=l;if(m=h!=(p=a),h==t.ch&&i==t.line&&p==h+l)continue;return{from:Math.min(h,p+1),to:Math.max(h,p),line:i}}m||(a+=l)}if(!w(e,i+=l))return null;s=e.getLine(i),a=l>0?0:s.length}}function we(e,t,r,o){for(var i,a=e.getCursor(),s=a.ch,l=0;l<t;l++){if(-1==(c=s,u=e.getLine(a.line),h=o,p=!0,f=void 0,r?-1==(f=u.indexOf(h,c+1))||p||(f-=1):-1==(f=u.lastIndexOf(h,c-1))||p||(f+=1),i=f))return null;s=i}var c,u,h,p,f;return n(e.getCursor().line,i)}function Me(e,t,r,n){b(r,k)&&(t.marks[r]&&t.marks[r].clear(),t.marks[r]=e.setBookmark(n))}function xe(e,t,r,o,i){var a,s=t.line,l=e.firstLine(),c=e.lastLine(),u=s;function h(t){return!e.getLine(t)}function p(e,t,r){return r?h(e)!=h(e+t):!h(e)&&h(e+t)}if(o){for(;l<=u&&u<=c&&r>0;)p(u,o)&&r--,u+=o;return new n(u,0)}var f=e.state.vim;if(f.visualLine&&p(s,1,!0)){var d=f.sel.anchor;p(d.line,-1,!0)&&(i&&d.line==s||(s+=1))}var m=h(s);for(u=s;u<=c&&r;u++)p(u,1,!0)&&(i&&h(u)==m||r--);for(a=new n(u,0),u>c&&!m?m=!0:i=!1,u=s;u>l&&(i&&h(u)!=m&&u!=s||!p(u,-1,!0));u--);return{start:new n(u,0),end:a}}function Se(){}function Ae(e){var t=e.state.vim;return t.searchState_||(t.searchState_=new Se)}function be(e,t){var r=Le(e,t)||[];if(!r.length)return[];var n=[];if(0===r[0]){for(var o=0;o<r.length;o++)"number"==typeof r[o]&&n.push(e.substring(r[o]+1,r[o+1]));return n}}function Le(e,t){t||(t="/");for(var r=!1,n=[],o=0;o<e.length;o++){var i=e.charAt(o);r||i!=t||n.push(o),r=!r&&"\\"==i}return n}T("pcre",!0,"boolean"),Se.prototype={getQuery:function(){return O.query},setQuery:function(e){O.query=e},getOverlay:function(){return this.searchOverlay},setOverlay:function(e){this.searchOverlay=e},isReversed:function(){return O.isReversed},setReversed:function(e){O.isReversed=e},getScrollbarAnnotate:function(){return this.annotate},setScrollbarAnnotate:function(e){this.annotate=e}};var Te={"\\n":"\n","\\r":"\r","\\t":"\t"};var Re={"\\/":"/","\\\\":"\\","\\n":"\n","\\r":"\r","\\t":"\t"};function Ee(e,t,r){if(O.registerController.getRegister("/").setText(e),e instanceof RegExp)return e;var n,o,i=Le(e,"/");return i.length?(n=e.substring(0,i[0]),o=-1!=e.substring(i[0]).indexOf("i")):n=e,n?(E("pcre")||(n=function(e){for(var t=!1,r=[],n=-1;n<e.length;n++){var o=e.charAt(n)||"",i=e.charAt(n+1)||"",a=i&&-1!="|(){".indexOf(i);t?("\\"===o&&a||r.push(o),t=!1):"\\"===o?(t=!0,i&&-1!="}".indexOf(i)&&(a=!0),a&&"\\"!==i||r.push(o)):(r.push(o),a&&"\\"!==i&&r.push("\\"))}return r.join("")}(n)),r&&(t=/^[^A-Z]*$/.test(n)),new RegExp(n,t||o?"i":void 0)):null}function Oe(e,t){e.openNotification?e.openNotification('<span style="color: red">'+t+"</span>",{bottom:!0,duration:5e3}):alert(t)}var Be="(Javascript regexp)";function Ie(e,t){var r,n,o,i,a,s,l,c,u=(t.prefix||"")+" "+(t.desc||""),h=(r=t.prefix,n=t.desc,o='<span style="font-family: monospace; white-space: pre">'+(r||"")+'<input type="text"></span>',n&&(o+=' <span style="color: #888">'+n+"</span>"),o);i=e,a=h,s=u,l=t.onClose,c=t,i.openDialog?i.openDialog(a,l,{bottom:!0,value:c.value,onKeyDown:c.onKeyDown,onKeyUp:c.onKeyUp,selectValueOnOpen:!1}):l(prompt(s,""))}function Ke(e,t,r,n){if(t){var o=Ae(e),i=Ee(t,!!r,!!n);if(i)return Ne(e,i),function(e,t){if(e instanceof RegExp&&t instanceof RegExp){for(var r=["global","multiline","ignoreCase","source"],n=0;n<r.length;n++){var o=r[n];if(e[o]!==t[o])return!1}return!0}return!1}(i,o.getQuery())?i:(o.setQuery(i),i)}}function Ne(e,t){var r=Ae(e),n=r.getOverlay();n&&t==n.query||(n&&e.removeOverlay(n),n=function(e){if("^"==e.source.charAt(0))var t=!0;return{token:function(r){if(!t||r.sol()){var n=r.match(e,!1);if(n)return 0==n[0].length?(r.next(),"searching"):r.sol()||(r.backUp(1),e.exec(r.next()+n[0]))?(r.match(e),"searching"):(r.next(),null);for(;!r.eol()&&(r.next(),!r.match(e,!1)););}else r.skipToEnd()},query:e}}(t),e.addOverlay(n),e.showMatchesOnScrollbar&&(r.getScrollbarAnnotate()&&r.getScrollbarAnnotate().clear(),r.setScrollbarAnnotate(e.showMatchesOnScrollbar(t))),r.setOverlay(n))}function Pe(e,t,r,o){return void 0===o&&(o=1),e.operation(function(){for(var i=e.getCursor(),a=e.getSearchCursor(r,i),s=0;s<o;s++){var l=a.find(t);if(0==s&&l&&te(a.from(),i)&&(l=a.find(t)),!l&&!(a=e.getSearchCursor(r,t?n(e.lastLine()):n(e.firstLine(),0))).find(t))return}return a.from()})}function je(e){var t=Ae(e);e.removeOverlay(Ae(e).getOverlay()),t.setOverlay(null),t.getScrollbarAnnotate()&&(t.getScrollbarAnnotate().clear(),t.setScrollbarAnnotate(null))}function He(e){var t=e.getScrollInfo(),r=e.coordsChar({left:0,top:6+t.top},"local"),n=t.clientHeight-10+t.top,o=e.coordsChar({left:0,top:n},"local");return{top:r.line,bottom:o.line}}function _e(e,t,r){if("'"==r){var n=e.doc.history.done,o=n[n.length-2];return o&&o.ranges&&o.ranges[0].head}if("."==r){if(0==e.doc.history.lastModTime)return;var i=e.doc.history.done.filter(function(e){if(void 0!==e.changes)return e});return i.reverse(),i[0].changes[0].to}var a=t.marks[r];return a&&a.find()}var Fe=function(){this.buildCommandMap_()};Fe.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 o=t.state.vim,i=O.registerController.getRegister(":"),a=i.toString();o.visualMode&&fe(t);var s=new e.StringStream(r);i.setText(r);var l,c,u=n||{};u.input=r;try{this.parseInput_(t,s,u)}catch(e){throw Oe(t,e),e}if(u.commandName){if(l=this.matchCommand_(u.commandName)){if(c=l.name,l.excludeFromCommandHistory&&i.setText(a),this.parseCommandArgs_(s,u,l),"exToKey"==l.type){for(var h=0;h<l.toKeys.length;h++)e.Vim.handleKey(t,l.toKeys[h],"mapping");return}if("exToEx"==l.type)return void this.processCommand(t,l.toInput)}}else void 0!==u.line&&(c="move");if(c)try{We[c](t,u),l&&l.possiblyAsync||!u.callback||u.callback()}catch(e){throw Oe(t,e),e}else Oe(t,'Not an editor command ":'+r+'"')},parseInput_:function(e,t,r){t.eatWhile(":"),t.eat("%")?(r.line=e.firstLine(),r.lineEnd=e.lastLine()):(r.line=this.parseLineSpec_(e,t),void 0!==r.line&&t.eat(",")&&(r.lineEnd=this.parseLineSpec_(e,t)));var n=t.match(/^(\w+)/);return r.commandName=n?n[1]:t.match(/.*/)[0],r},parseLineSpec_:function(e,t){var r=t.match(/^(\d+)/);if(r)return parseInt(r[1],10)-1;switch(t.next()){case".":return this.parseLineSpecOffset_(t,e.getCursor().line);case"$":return this.parseLineSpecOffset_(t,e.lastLine());case"'":var n=t.next(),o=_e(e,e.state.vim,n);if(!o)throw new Error("Mark not set");return this.parseLineSpecOffset_(t,o.line);case"-":case"+":return t.backUp(1),this.parseLineSpecOffset_(t,e.getCursor().line);default:return void t.backUp(1)}},parseLineSpecOffset_:function(e,t){var r=e.match(/^([+-])?(\d+)/);if(r){var n=parseInt(r[2],10);"-"==r[1]?t-=n:t+=n}return t},parseCommandArgs_:function(e,t,r){if(!e.eol()){t.argString=e.match(/.*/)[0];var n=r.argDelimiter||/\s+/,o=se(t.argString).split(n);o.length&&o[0]&&(t.args=o)}},matchCommand_:function(e){for(var t=e.length;t>0;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<r.length;e++){var t=r[e],n=t.shortName||t.name;this.commandMap_[n]=t}},map:function(e,r,n){if(":"!=e&&":"==e.charAt(0)){if(n)throw Error("Mode not supported for ex mappings");var o=e.substring(1);":"!=r&&":"==r.charAt(0)?this.commandMap_[o]={name:o,type:"exToEx",toInput:r.substring(1),user:!0}:this.commandMap_[o]={name:o,type:"exToKey",toKeys:r,user:!0}}else if(":"!=r&&":"==r.charAt(0)){var i={keys:e,type:"keyToEx",exArgs:{input:r.substring(1)}};n&&(i.context=n),t.unshift(i)}else i={keys:e,type:"keyToKey",toKeys:r},n&&(i.context=n),t.unshift(i)},unmap:function(e,r){if(":"!=e&&":"==e.charAt(0)){if(r)throw Error("Mode not supported for ex mappings");var n=e.substring(1);if(this.commandMap_[n]&&this.commandMap_[n].user)return void delete this.commandMap_[n]}else for(var o=e,i=0;i<t.length;i++)if(o==t[i].keys&&t[i].context===r)return void t.splice(i,1);throw Error("No such mapping.")}};var We={colorscheme:function(e,t){!t.args||t.args.length<1?Oe(e,e.getOption("theme")):e.setOption("theme",t.args[0])},map:function(e,t,r){var n=t.args;!n||n.length<2?e&&Oe(e,"Invalid mapping: "+t.input):Ve.map(n[0],n[1],r)},imap:function(e,t){this.map(e,t,"insert")},nmap:function(e,t){this.map(e,t,"normal")},vmap:function(e,t){this.map(e,t,"visual")},unmap:function(e,t,r){var n=t.args;!n||n.length<1?e&&Oe(e,"No such mapping: "+t.input):Ve.unmap(n[0],r)},move:function(e,t){U.processCommand(e,e.state.vim,{type:"motion",motion:"moveToLineOrEdgeOfDocument",motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:t.line+1})},set:function(e,t){var r=t.args,n=t.setCfg||{};if(!r||r.length<1)e&&Oe(e,"Invalid mapping: "+t.input);else{var o=r[0].split("="),i=o[0],a=o[1],s=!1;if("?"==i.charAt(i.length-1)){if(a)throw Error("Trailing characters: "+t.argString);i=i.substring(0,i.length-1),s=!0}void 0===a&&"no"==i.substring(0,2)&&(i=i.substring(2),a=!1);var l=L[i]&&"boolean"==L[i].type;if(l&&null==a&&(a=!0),!l&&void 0===a||s){var c=E(i,e,n);c instanceof Error?Oe(e,c.message):Oe(e,!0===c||!1===c?" "+(c?"":"no")+i:"  "+i+"="+c)}else{var u=R(i,a,e,n);u instanceof Error&&Oe(e,u.message)}}},setlocal:function(e,t){t.setCfg={scope:"local"},this.set(e,t)},setglobal:function(e,t){t.setCfg={scope:"global"},this.set(e,t)},registers:function(e,t){var r=t.args,n=O.registerController.registers,o="----------Registers----------<br><br>";if(r){r=r.join("");for(var i=0;i<r.length;i++)a=r.charAt(i),O.registerController.isValidRegister(a)&&(o+='"'+a+"    "+(n[a]||new W).toString()+"<br>")}else for(var a in n){var s=n[a].toString();s.length&&(o+='"'+a+"    "+s+"<br>")}Oe(e,o)},sort:function(t,r){var o,i,a,s,l,c=function(){if(r.argString){var t=new e.StringStream(r.argString);if(t.eat("!")&&(o=!0),t.eol())return;if(!t.eatSpace())return"Invalid arguments";var n=t.match(/([dinuox]+)?\s*(\/.+\/)?\s*/);if(!n&&!t.eol())return"Invalid arguments";if(n[1]){i=-1!=n[1].indexOf("i"),a=-1!=n[1].indexOf("u");var c=-1!=n[1].indexOf("d")||-1!=n[1].indexOf("n")&&1,u=-1!=n[1].indexOf("x")&&1,h=-1!=n[1].indexOf("o")&&1;if(c+u+h>1)return"Invalid arguments";s=(c?"decimal":u&&"hex")||h&&"octal"}n[2]&&(l=new RegExp(n[2].substr(1,n[2].length-2),i?"i":""))}}();if(c)Oe(t,c+": "+r.argString);else{var u=r.line||t.firstLine(),h=r.lineEnd||r.line||t.lastLine();if(u!=h){var p=n(u,0),f=n(h,ae(t,h)),d=t.getRange(p,f).split("\n"),m=l||("decimal"==s?/(-?)([\d]+)/:"hex"==s?/(-?)(?:0x)?([0-9a-f]+)/i:"octal"==s?/([0-7]+)/:null),g="decimal"==s?10:"hex"==s?16:"octal"==s?8:null,v=[],y=[];if(s||l)for(var k=0;k<d.length;k++){var C=l?d[k].match(l):null;C&&""!=C[0]?v.push(C):!l&&m.exec(d[k])?v.push(d[k]):y.push(d[k])}else y=d;if(v.sort(l?function(e,t){var r;return o&&(r=e,e=t,t=r),i&&(e[0]=e[0].toLowerCase(),t[0]=t[0].toLowerCase()),e[0]<t[0]?-1:1}:x),l)for(k=0;k<v.length;k++)v[k]=v[k].input;else s||y.sort(x);if(d=o?v.concat(y):y.concat(v),a){var w,M=d;for(d=[],k=0;k<M.length;k++)M[k]!=w&&d.push(M[k]),w=M[k]}t.replaceRange(d.join("\n"),p,f)}}function x(e,t){var r;o&&(r=e,e=t,t=r),i&&(e=e.toLowerCase(),t=t.toLowerCase());var n=s&&m.exec(e),a=s&&m.exec(t);return n?(n=parseInt((n[1]+n[2]).toLowerCase(),g))-(a=parseInt((a[1]+a[2]).toLowerCase(),g)):e<t?-1:1}},global:function(e,t){var r=t.argString;if(r){var n,o=void 0!==t.line?t.line:e.firstLine(),i=t.lineEnd||t.line||e.lastLine(),a=be(r,"/"),s=r;if(a.length&&(s=a[0],n=a.slice(1,a.length).join("/")),s)try{Ke(e,s,!0,!0)}catch(t){return void Oe(e,"Invalid regex: "+s)}for(var l=Ae(e).getQuery(),c=[],u="",h=o;h<=i;h++)l.test(e.getLine(h))&&(c.push(h+1),u+=e.getLine(h)+"<br>");if(n){var p=0,f=function(){if(p<c.length){var t=c[p]+n;Ve.processCommand(e,t,{callback:f})}p++};f()}else Oe(e,u)}else Oe(e,"Regular Expression missing from global")},substitute:function(t,r){if(!t.getSearchCursor)throw new Error("Search feature not available. Requires searchcursor.js or any other getSearchCursor implementation.");var o,i,a,s,l=r.argString,c=l?be(l,l[0]):[],u="",h=!1,f=!1;if(c.length)o=c[0],u=c[1],o&&"$"===o[o.length-1]&&(o=o.slice(0,o.length-1)+"\\n",u=u?u+"\n":"\n"),void 0!==u&&(u=E("pcre")?function(t){for(var r=new e.StringStream(t),n=[];!r.eol();){for(;r.peek()&&"\\"!=r.peek();)n.push(r.next());var o=!1;for(var i in Re)if(r.match(i,!0)){o=!0,n.push(Re[i]);break}o||n.push(r.next())}return n.join("")}(u):function(e){for(var t,r=!1,n=[],o=-1;o<e.length;o++){var i=e.charAt(o)||"",a=e.charAt(o+1)||"";Te[i+a]?(n.push(Te[i+a]),o++):r?(n.push(i),r=!1):"\\"===i?(r=!0,t=a,p.test(t)||"$"===a?n.push("$"):"/"!==a&&"\\"!==a&&n.push("\\")):("$"===i&&n.push("$"),n.push(i),"/"===a&&n.push("\\"))}return n.join("")}(u),O.lastSubstituteReplacePart=u),i=c[2]?c[2].split(" "):[];else if(l&&l.length)return void Oe(t,"Substitutions should be of the form :s/pattern/replace/");if(i&&(a=i[0],s=parseInt(i[1]),a&&(-1!=a.indexOf("c")&&(h=!0,a.replace("c","")),-1!=a.indexOf("g")&&(f=!0,a.replace("g","")),o=o.replace(/\//g,"\\/")+"/"+a)),o)try{Ke(t,o,!0,!0)}catch(e){return void Oe(t,"Invalid regex: "+o)}if(void 0!==(u=u||O.lastSubstituteReplacePart)){var d=Ae(t).getQuery(),m=void 0!==r.line?r.line:t.getCursor().line,g=r.lineEnd||m;m==t.firstLine()&&g==t.lastLine()&&(g=1/0),s&&(g=(m=g)+s-1);var v=z(t,n(m,0)),y=t.getSearchCursor(d,v);!function(t,r,n,o,i,a,s,l,c){t.state.vim.exMode=!0;var u=!1,h=a.from();function p(){t.operation(function(){for(;!u;)f(),d();m()})}function f(){var e=t.getRange(a.from(),a.to()),r=e.replace(s,l);a.replace(r)}function d(){for(;a.findNext()&&(e=a.from(),r=o,s=i,"number"!=typeof e&&(e=e.line),r instanceof Array?b(e,r):s?e>=r&&e<=s:e==r);)if(n||!h||a.from().line!=h.line)return t.scrollIntoView(a.from(),30),t.setSelection(a.from(),a.to()),h=a.from(),void(u=!1);var e,r,s;u=!0}function m(e){if(e&&e(),t.focus(),h){t.setCursor(h);var r=t.state.vim;r.exMode=!1,r.lastHPos=r.lastHSPos=h.ch}c&&c()}if(d(),!u)return r?void Ie(t,{prefix:"replace with <strong>"+l+"</strong> (y/n/a/q/l)",onKeyDown:function(r,n,o){switch(e.e_stop(r),e.keyName(r)){case"Y":f(),d();break;case"N":d();break;case"A":var i=c;c=void 0,t.operation(p),c=i;break;case"L":f();case"Q":case"Esc":case"Ctrl-C":case"Ctrl-[":m(o)}return u&&m(o),!0}}):(p(),void(c&&c()));Oe(t,"No matches for "+s.source)}(t,h,f,m,g,y,d,u,r.callback)}else Oe(t,"No previous substitute regular expression")},redo:e.commands.redo,undo:e.commands.undo,write:function(t){e.commands.save?e.commands.save(t):t.save&&t.save()},nohlsearch:function(e){je(e)},yank:function(e){var t=ee(e.getCursor()).line,r=e.getLine(t);O.registerController.pushText("0","yank",r,!0,!0)},delmarks:function(t,r){if(r.argString&&se(r.argString))for(var n=t.state.vim,o=new e.StringStream(se(r.argString));!o.eol();){o.eatSpace();var i=o.pos;if(!o.match(/[a-zA-Z]/,!1))return void Oe(t,"Invalid argument: "+r.argString.substring(i));var a=o.next();if(o.match("-",!0)){if(!o.match(/[a-zA-Z]/,!1))return void Oe(t,"Invalid argument: "+r.argString.substring(i));var s=a,l=o.next();if(!(M(s)&&M(l)||x(s)&&x(l)))return void Oe(t,"Invalid argument: "+s+"-");var c=s.charCodeAt(0),u=l.charCodeAt(0);if(c>=u)return void Oe(t,"Invalid argument: "+r.argString.substring(i));for(var h=0;h<=u-c;h++){var p=String.fromCharCode(c+h);delete n.marks[p]}}else delete n.marks[a]}else Oe(t,"Argument required")}},Ve=new Fe;function De(t){var r=t.state.vim,n=O.macroModeState,o=O.registerController.getRegister("."),i=n.isPlaying,a=n.lastInsertModeChanges,s=[];if(!i){for(var l=a.inVisualBlock&&r.lastSelection?r.lastSelection.visualBlock.height:1,c=a.changes,u=(s=[],0);u<c.length;)s.push(c[u]),c[u]instanceof ze?u++:u+=l;a.changes=s,t.off("change",$e),e.off(t.getInputField(),"keydown",Ze)}!i&&r.insertModeRepeat>1&&(Ge(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),o.setText(a.changes.join("")),e.signal(t,"vim-mode-change",{mode:"normal"}),n.isRecording&&function(e){if(!e.isPlaying){var t=e.latestRegister,r=O.registerController.getRegister(t);r&&r.pushInsertModeChanges&&r.pushInsertModeChanges(e.lastInsertModeChanges)}}(n)}function Ue(e){t.unshift(e)}function Je(t,r,n,o){var i=O.registerController.getRegister(o);if(":"==o)return i.keyBuffer[0]&&Ve.processCommand(t,i.keyBuffer[0]),void(n.isPlaying=!1);var a=i.keyBuffer,s=0;n.isPlaying=!0,n.replaySearchQueries=i.searchQueries.slice(0);for(var l=0;l<a.length;l++)for(var c,u,h=a[l];h;)if(u=(c=/<\w+-.+?>|<\w+>|./.exec(h))[0],h=h.substring(c.index+u.length),e.Vim.handleKey(t,u,"macro"),r.insertMode){var p=i.insertModeChanges[s++].changes;O.macroModeState.lastInsertModeChanges.changes=p,Xe(t,p,1),De(t)}n.isPlaying=!1}function $e(e,t){var r=O.macroModeState,n=r.lastInsertModeChanges;if(!r.isPlaying)for(;t;){if(n.expectCursorActivityForChange=!0,"+input"==t.origin||"paste"==t.origin||void 0===t.origin){var o=t.text.join("\n");n.maybeReset&&(n.changes=[],n.maybeReset=!1),e.state.overwrite&&!/\n/.test(o)?n.changes.push([o]):n.changes.push(o)}t=t.next}}function qe(t){var r=t.state.vim;if(r.insertMode){var n=O.macroModeState;if(n.isPlaying)return;var o=n.lastInsertModeChanges;o.expectCursorActivityForChange?o.expectCursorActivityForChange=!1:o.maybeReset=!0}else t.curOp.isVimOp||function(t,r){var n=t.getCursor("anchor"),o=t.getCursor("head");if(r.visualMode&&!t.somethingSelected()?fe(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 i=re(o,n)?0:-1,a=re(o,n)?-1:0;o=G(o,0,i),n=G(n,0,a),r.sel={anchor:n,head:o},Me(t,r,"<",ne(o,n)),Me(t,r,">",oe(o,n))}else r.insertMode||(r.lastHPos=t.getCursor().ch)}(t,r);r.visualMode&&Qe(t)}function Qe(e){var t=e.state.vim,r=z(e,ee(t.sel.head)),n=G(r,0,1);t.fakeCursor&&t.fakeCursor.clear(),t.fakeCursor=e.markText(r,n,{className:"cm-animate-fat-cursor"})}function ze(e){this.keyName=e}function Ze(t){var r=O.macroModeState.lastInsertModeChanges,n=e.keyName(t);n&&(-1==n.indexOf("Delete")&&-1==n.indexOf("Backspace")||e.lookupKey(n,"vim-insert",function(){return r.maybeReset&&(r.changes=[],r.maybeReset=!1),r.changes.push(new ze(n)),!0}))}function Ge(e,t,r,n){var o=O.macroModeState;o.isPlaying=!0;var i=!!t.lastEditActionCommand,a=t.inputState;function s(){i?U.processAction(e,t,t.lastEditActionCommand):U.evalInput(e,t)}function l(r){if(o.lastInsertModeChanges.changes.length>0){r=t.lastEditActionCommand?r:1;var n=o.lastInsertModeChanges;Xe(e,n.changes,r)}}if(t.inputState=t.lastEditInputState,i&&t.lastEditActionCommand.interlaceInsertRepeat)for(var c=0;c<r;c++)s(),l(1);else n||s(),l(r);t.inputState=a,t.insertMode&&!n&&De(e),o.isPlaying=!1}function Xe(t,r,n){function o(r){return"string"==typeof r?e.commands[r](t):r(t),!0}var i,a,s=t.getCursor("head"),l=O.macroModeState.lastInsertModeChanges.inVisualBlock;if(l){var c=t.state.vim.lastSelection,u=(i=c.anchor,{line:(a=c.head).line-i.line,ch:a.line-i.line});ce(t,s,u.line+1),n=t.listSelections().length,t.setCursor(s)}for(var h=0;h<n;h++){l&&t.setCursor(G(s,h,0));for(var p=0;p<r.length;p++){var f=r[p];if(f instanceof ze)e.lookupKey(f.keyName,"vim-insert",o);else if("string"==typeof f){var d=t.getCursor();t.replaceRange(f,d,d)}else{var m=t.getCursor(),g=G(m,0,f[0].length);t.replaceRange(f[0],m,g)}}}l&&t.setCursor(G(s,0,1))}return e.keyMap.vim={attach:i,detach:o,call:l},T("insertModeEscKeysTimeout",200,"number"),e.keyMap["vim-insert"]={fallthrough:["default"],attach:i,detach:o,call:l},e.keyMap["vim-replace"]={Backspace:"goCharLeft",fallthrough:["vim-insert"],attach:i,detach:o,call:l},j(),H}()});
\ No newline at end of file
index 61530e5..75bcc39 100644 (file)
@@ -1 +1 @@
-!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.CodeMirror=t()}(this,function(){"use strict";var e=navigator.userAgent,t=navigator.platform,r=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),l=n||i||o,s=l&&(n?document.documentMode||6:+(o||i)[1]),a=!o&&/WebKit\//.test(e),u=a&&/Qt\/\d+\.\d+/.test(e),c=!o&&/Chrome\//.test(e),h=/Opera\//.test(e),f=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),g=!o&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),v=/Android/.test(e),m=g||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=g||/Mac/.test(t),b=/\bCrOS\b/.test(e),w=/win/i.test(t),x=h&&e.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(h=!1,a=!0);var C=y&&(u||h&&(null==x||x<12.11)),S=r||l&&s>=9;function L(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var k,T=function(e,t){var r=e.className,n=L(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:"")}};function M(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function N(e,t){return M(e).appendChild(t)}function O(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;o<t.length;++o)i.appendChild(t[o]);return i}function A(e,t,r,n){var i=O(e,t,r,n);return i.setAttribute("role","presentation"),i}function W(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)}function D(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function H(e,t){var r=e.className;L(t).test(r)||(e.className+=(r?" ":"")+t)}function F(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!L(r[n]).test(t)&&(t+=" "+r[n]);return t}k=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(e){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var P=function(e){e.select()};function E(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function z(e,t,r){for(var n in t||(t={}),e)!e.hasOwnProperty(n)||!1===r&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function I(e,t,r,n,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=n||0,l=i||0;;){var s=e.indexOf("\t",o);if(s<0||s>=t)return l+(t-o);l+=s-o,l+=r-l%r,o=s+1}}g?P=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:l&&(P=function(e){try{e.select()}catch(e){}});var R=function(){this.id=null};function B(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}R.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var G=30,U={toString:function(){return"CodeMirror.Pass"}},V={scroll:!1},K={origin:"*mouse"},j={origin:"+move"};function X(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);-1==o&&(o=e.length);var l=o-n;if(o==e.length||i+l>=t)return n+Math.min(l,t-i);if(i+=o-n,n=o+1,(i+=r-i%r)>=t)return n}}var Y=[""];function _(e){for(;Y.length<=e;)Y.push(q(Y)+" ");return Y[e]}function q(e){return e[e.length-1]}function $(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Z(){}function Q(e,t){var r;return Object.create?r=Object.create(e):(Z.prototype=e,r=new Z),t&&z(t,r),r}var J=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ee(e){return/\w/.test(e)||e>"\80"&&(e.toUpperCase()!=e.toLowerCase()||J.test(e))}function te(e,t){return t?!!(t.source.indexOf("\\w")>-1&&ee(e))||t.test(e):ee(e)}function re(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ne=/[\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]/;function ie(e){return e.charCodeAt(0)>=768&&ne.test(e)}function oe(e,t,r){for(;(r<0?t>0:t<e.length)&&ie(e.charAt(t));)t+=r;return t}function le(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var i=(t+r)/2,o=n<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+n}}function se(e,t){if((t-=e.first)<0||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(t<o){r=i;break}t-=o}return r.lines[t]}function ae(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 ue(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function ce(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function he(e){if(null==e.parent)return null;for(var t=e.parent,r=B(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 fe(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var l=0;l<e.lines.length;++l){var s=e.lines[l].height;if(t<s)break;t-=s}return r+l}function de(e,t){return t>=e.first&&t<e.first+e.size}function pe(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function ge(e,t,r){if(void 0===r&&(r=null),!(this instanceof ge))return new ge(e,t,r);this.line=e,this.ch=t,this.sticky=r}function ve(e,t){return e.line-t.line||e.ch-t.ch}function me(e,t){return e.sticky==t.sticky&&0==ve(e,t)}function ye(e){return ge(e.line,e.ch)}function be(e,t){return ve(e,t)<0?t:e}function we(e,t){return ve(e,t)<0?e:t}function xe(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Ce(e,t){if(t.line<e.first)return ge(e.first,0);var r,n,i,o=e.first+e.size-1;return t.line>o?ge(o,se(e,o).text.length):(r=t,n=se(e,t.line).text.length,null==(i=r.ch)||i>n?ge(r.line,n):i<0?ge(r.line,0):r)}function Se(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=Ce(e,t[n]);return r}var Le=!1,ke=!1;function Te(e,t,r){this.marker=e,this.from=t,this.to=r}function Me(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Ne(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Oe(e,t){if(t.full)return null;var r=de(e,t.from.line)&&se(e,t.from.line).markedSpans,n=de(e,t.to.line)&&se(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,l=0==ve(t.from,t.to),s=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker;if(null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==l.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new Te(l,o.from,s?null:o.to))}}return n}(r,i,l),a=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker;if(null==o.to||(l.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==l.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new Te(l,s?null:o.from-t,null==o.to?null:o.to-t))}}return n}(n,o,l),u=1==t.text.length,c=q(t.text).length+(u?i:0);if(s)for(var h=0;h<s.length;++h){var f=s[h];if(null==f.to){var d=Me(a,f.marker);d?u&&(f.to=null==d.to?null:d.to+c):f.to=i}}if(a)for(var p=0;p<a.length;++p){var g=a[p];if(null!=g.to&&(g.to+=c),null==g.from)Me(s,g.marker)||(g.from=c,u&&(s||(s=[])).push(g));else g.from+=c,u&&(s||(s=[])).push(g)}s&&(s=Ae(s)),a&&a!=s&&(a=Ae(a));var v=[s];if(!u){var m,y=t.text.length-2;if(y>0&&s)for(var b=0;b<s.length;++b)null==s[b].to&&(m||(m=[])).push(new Te(s[b].marker,null,null));for(var w=0;w<y;++w)v.push(m);v.push(a)}return v}function Ae(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function We(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function De(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function He(e){return e.inclusiveLeft?-1:0}function Fe(e){return e.inclusiveRight?1:0}function Pe(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=ve(n.from,i.from)||He(e)-He(t);if(o)return-o;var l=ve(n.to,i.to)||Fe(e)-Fe(t);return l||t.id-e.id}function Ee(e,t){var r,n=ke&&e.markedSpans;if(n)for(var i=void 0,o=0;o<n.length;++o)(i=n[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!r||Pe(r,i.marker)<0)&&(r=i.marker);return r}function ze(e){return Ee(e,!0)}function Ie(e){return Ee(e,!1)}function Re(e,t,r,n,i){var o=se(e,t),l=ke&&o.markedSpans;if(l)for(var s=0;s<l.length;++s){var a=l[s];if(a.marker.collapsed){var u=a.marker.find(0),c=ve(u.from,r)||He(a.marker)-He(i),h=ve(u.to,n)||Fe(a.marker)-Fe(i);if(!(c>=0&&h<=0||c<=0&&h>=0)&&(c<=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?ve(u.to,r)>=0:ve(u.to,r)>0)||c>=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?ve(u.from,n)<=0:ve(u.from,n)<0)))return!0}}}function Be(e){for(var t;t=ze(e);)e=t.find(-1,!0).line;return e}function Ge(e,t){var r=se(e,t),n=Be(r);return r==n?t:he(n)}function Ue(e,t){if(t>e.lastLine())return t;var r,n=se(e,t);if(!Ve(e,n))return t;for(;r=Ie(n);)n=r.find(1,!0).line;return he(n)+1}function Ve(e,t){var r=ke&&t.markedSpans;if(r)for(var n=void 0,i=0;i<r.length;++i)if((n=r[i]).marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Ke(e,t,n))return!0}}function Ke(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return Ke(e,n.line,Me(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&Ke(e,t,i))return!0}function je(e){for(var t=0,r=(e=Be(e)).parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;o=(r=o).parent)for(var l=0;l<o.children.length;++l){var s=o.children[l];if(s==r)break;t+=s.height}return t}function Xe(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=ze(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=Ie(n);){var o=t.find(0,!0);r-=n.text.length-o.from.ch,r+=(n=o.to.line).text.length-o.to.ch}return r}function Ye(e){var t=e.display,r=e.doc;t.maxLine=se(r,r.first),t.maxLineLength=Xe(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=Xe(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}var _e=null;function qe(e,t,r){var n;_e=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==r?n=i:_e=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:_e=i)}return null!=n?n:_e}var $e=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,i=/[LRr]/,o=/[Lb1n]/,l=/[1n]/;function s(e,t,r){this.level=e,this.from=t,this.to=r}return function(a,u){var c="ltr"==u?"L":"R";if(0==a.length||"ltr"==u&&!r.test(a))return!1;for(var h,f=a.length,d=[],p=0;p<f;++p)d.push((h=a.charCodeAt(p))<=247?e.charAt(h):1424<=h&&h<=1524?"R":1536<=h&&h<=1785?t.charAt(h-1536):1774<=h&&h<=2220?"r":8192<=h&&h<=8203?"w":8204==h?"b":"L");for(var g=0,v=c;g<f;++g){var m=d[g];"m"==m?d[g]=v:v=m}for(var y=0,b=c;y<f;++y){var w=d[y];"1"==w&&"r"==b?d[y]="n":i.test(w)&&(b=w,"r"==w&&(d[y]="R"))}for(var x=1,C=d[0];x<f-1;++x){var S=d[x];"+"==S&&"1"==C&&"1"==d[x+1]?d[x]="1":","!=S||C!=d[x+1]||"1"!=C&&"n"!=C||(d[x]=C),C=S}for(var L=0;L<f;++L){var k=d[L];if(","==k)d[L]="N";else if("%"==k){var T=void 0;for(T=L+1;T<f&&"%"==d[T];++T);for(var M=L&&"!"==d[L-1]||T<f&&"1"==d[T]?"1":"N",N=L;N<T;++N)d[N]=M;L=T-1}}for(var O=0,A=c;O<f;++O){var W=d[O];"L"==A&&"1"==W?d[O]="L":i.test(W)&&(A=W)}for(var D=0;D<f;++D)if(n.test(d[D])){var H=void 0;for(H=D+1;H<f&&n.test(d[H]);++H);for(var F="L"==(D?d[D-1]:c),P=F==("L"==(H<f?d[H]:c))?F?"L":"R":c,E=D;E<H;++E)d[E]=P;D=H-1}for(var z,I=[],R=0;R<f;)if(o.test(d[R])){var B=R;for(++R;R<f&&o.test(d[R]);++R);I.push(new s(0,B,R))}else{var G=R,U=I.length;for(++R;R<f&&"L"!=d[R];++R);for(var V=G;V<R;)if(l.test(d[V])){G<V&&I.splice(U,0,new s(1,G,V));var K=V;for(++V;V<R&&l.test(d[V]);++V);I.splice(U,0,new s(2,K,V)),G=V}else++V;G<R&&I.splice(U,0,new s(1,G,R))}return"ltr"==u&&(1==I[0].level&&(z=a.match(/^\s+/))&&(I[0].from=z[0].length,I.unshift(new s(0,0,z[0].length))),1==q(I).level&&(z=a.match(/\s+$/))&&(q(I).to-=z[0].length,I.push(new s(0,f-z[0].length,f)))),"rtl"==u?I.reverse():I}}();function Ze(e,t){var r=e.order;return null==r&&(r=e.order=$e(e.text,t)),r}var Qe=[],Je=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||Qe).concat(r)}};function et(e,t){return e._handlers&&e._handlers[t]||Qe}function tt(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,i=n&&n[t];if(i){var o=B(i,r);o>-1&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function rt(e,t){var r=et(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function nt(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),rt(e,r||t.type,e,t),ut(t)||t.codemirrorIgnore}function it(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==B(r,t[n])&&r.push(t[n])}function ot(e,t){return et(e,t).length>0}function lt(e){e.prototype.on=function(e,t){Je(this,e,t)},e.prototype.off=function(e,t){tt(this,e,t)}}function st(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function at(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ut(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function ct(e){st(e),at(e)}function ht(e){return e.target||e.srcElement}function ft(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var dt,pt,gt=function(){if(l&&s<9)return!1;var e=O("div");return"draggable"in e||"dragDrop"in e}();function vt(e){if(null==dt){var t=O("span","​");N(e,O("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(dt=t.offsetWidth<=1&&t.offsetHeight>2&&!(l&&s<8))}var r=dt?O("span","​"):O("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function mt(e){if(null!=pt)return pt;var t=N(e,document.createTextNode("AخA")),r=k(t,0,1).getBoundingClientRect(),n=k(t,1,2).getBoundingClientRect();return M(e),!(!r||r.left==r.right)&&(pt=n.right-r.right<3)}var yt,bt=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),t+=l+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},wt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},xt="oncopy"in(yt=O("div"))||(yt.setAttribute("oncopy","return;"),"function"==typeof yt.oncopy),Ct=null;var St={},Lt={};function kt(e){if("string"==typeof e&&Lt.hasOwnProperty(e))e=Lt[e];else if(e&&"string"==typeof e.name&&Lt.hasOwnProperty(e.name)){var t=Lt[e.name];"string"==typeof t&&(t={name:t}),(e=Q(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return kt("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return kt("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Tt(e,t){t=kt(t);var r=St[t.name];if(!r)return Tt(e,"text/plain");var n=r(e,t);if(Mt.hasOwnProperty(t.name)){var i=Mt[t.name];for(var o in i)i.hasOwnProperty(o)&&(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=i[o])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)n[l]=t.modeProps[l];return n}var Mt={};function Nt(e,t){z(t,Mt.hasOwnProperty(e)?Mt[e]:Mt[e]={})}function Ot(e,t){if(!0===t)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}function At(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function Wt(e,t,r){return!e.startState||e.startState(t,r)}var Dt=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};Dt.prototype.eol=function(){return this.pos>=this.string.length},Dt.prototype.sol=function(){return this.pos==this.lineStart},Dt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Dt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Dt.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Dt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Dt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Dt.prototype.skipToEnd=function(){this.pos=this.string.length},Dt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Dt.prototype.backUp=function(e){this.pos-=e},Dt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=I(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?I(this.string,this.lineStart,this.tabSize):0)},Dt.prototype.indentation=function(){return I(this.string,null,this.tabSize)-(this.lineStart?I(this.string,this.lineStart,this.tabSize):0)},Dt.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Dt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Dt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Dt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Dt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var Ht=function(e,t){this.state=e,this.lookAhead=t},Ft=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function Pt(e,t,r,n){var i=[e.state.modeGen],o={};Kt(e,t.text,e.doc.mode,r,function(e,t){return i.push(e,t)},o,n);for(var l=r.state,s=function(n){r.baseTokens=i;var s=e.state.overlays[n],a=1,u=0;r.state=!0,Kt(e,t.text,s.mode,r,function(e,t){for(var r=a;u<e;){var n=i[a];n>e&&i.splice(a,1,e,i[a+1],n),a+=2,u=Math.min(e,n)}if(t)if(s.opaque)i.splice(r,a-r,e,"overlay "+t),a=r+2;else for(;r<a;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"overlay "+t}},o),r.state=l,r.baseTokens=null,r.baseTokenPos=1},a=0;a<e.state.overlays.length;++a)s(a);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Et(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=zt(e,he(t)),i=t.text.length>e.options.maxHighlightLength&&Ot(e.doc.mode,n.state),o=Pt(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function zt(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new Ft(n,!0,t);var o=function(e,t,r){for(var n,i,o=e.doc,l=r?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;s>l;--s){if(s<=o.first)return o.first;var a=se(o,s-1),u=a.stateAfter;if(u&&(!r||s+(u instanceof Ht?u.lookAhead:0)<=o.modeFrontier))return s;var c=I(a.text,null,e.options.tabSize);(null==i||n>c)&&(i=s-1,n=c)}return i}(e,t,r),l=o>n.first&&se(n,o-1).stateAfter,s=l?Ft.fromSaved(n,l,o):new Ft(n,Wt(n.mode),o);return n.iter(o,t,function(r){It(e,r.text,s);var n=s.line;r.stateAfter=n==t-1||n%5==0||n>=i.viewFrom&&n<i.viewTo?s.save():null,s.nextLine()}),r&&(n.modeFrontier=s.line),s}function It(e,t,r,n){var i=e.doc.mode,o=new Dt(t,e.options.tabSize,r);for(o.start=o.pos=n||0,""==t&&Rt(i,r.state);!o.eol();)Bt(i,o,r.state),o.start=o.pos}function Rt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var r=At(e,t);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function Bt(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=At(e,r).mode);var o=e.token(t,r);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}Ft.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Ft.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Ft.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Ft.fromSaved=function(e,t,r){return t instanceof Ht?new Ft(e,Ot(e.mode,t.state),r,t.lookAhead):new Ft(e,Ot(e.mode,t),r)},Ft.prototype.save=function(e){var t=!1!==e?Ot(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Ht(t,this.maxLookAhead):t};var Gt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Ut(e,t,r,n){var i,o,l=e.doc,s=l.mode,a=se(l,(t=Ce(l,t)).line),u=zt(e,t.line,r),c=new Dt(a.text,e.options.tabSize,u);for(n&&(o=[]);(n||c.pos<t.ch)&&!c.eol();)c.start=c.pos,i=Bt(s,c,u.state),n&&o.push(new Gt(c,i,Ot(l.mode,u.state)));return n?o:new Gt(c,i,u.state)}function Vt(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function Kt(e,t,r,n,i,o,l){var s=r.flattenSpans;null==s&&(s=e.options.flattenSpans);var a,u=0,c=null,h=new Dt(t,e.options.tabSize,n),f=e.options.addModeClass&&[null];for(""==t&&Vt(Rt(r,n.state),o);!h.eol();){if(h.pos>e.options.maxHighlightLength?(s=!1,l&&It(e,t,n,h.pos),h.pos=t.length,a=null):a=Vt(Bt(r,h,n.state,f),o),f){var d=f[0].name;d&&(a="m-"+(a?d+" "+a:d))}if(!s||c!=a){for(;u<h.start;)i(u=Math.min(h.start,u+5e3),c);c=a}h.start=h.pos}for(;u<h.pos;){var p=Math.min(h.pos,u+5e3);i(p,c),u=p}}var jt=function(e,t,r){this.text=e,De(this,t),this.height=r?r(this):1};jt.prototype.lineNo=function(){return he(this)},lt(jt);var Xt={},Yt={};function _t(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Yt:Xt;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function qt(e,t){var r=A("span",null,null,a?"padding-right: .1px":null),n={pre:A("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:(l||a)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,s=void 0;n.pos=0,n.addToken=Zt,mt(e.display.measure)&&(s=Ze(o,e.doc.direction))&&(n.addToken=Qt(n.addToken,s)),n.map=[],er(o,n,Et(e,o,t!=e.display.externalMeasured&&he(o))),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=F(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=F(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(vt(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({}))}if(a){var u=n.content.lastChild;(/\bcm-tab\b/.test(u.className)||u.querySelector&&u.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return rt(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=F(n.pre.className,n.textClass||"")),n}function $t(e){var t=O("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Zt(e,t,r,n,i,o,a){if(t){var u,c=e.splitSpaces?function(e,t){if(e.length>1&&!/  /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}(t,e.trailingSpace):t,h=e.cm.state.specialChars,f=!1;if(h.test(t)){u=document.createDocumentFragment();for(var d=0;;){h.lastIndex=d;var p=h.exec(t),g=p?p.index-d:t.length-d;if(g){var v=document.createTextNode(c.slice(d,d+g));l&&s<9?u.appendChild(O("span",[v])):u.appendChild(v),e.map.push(e.pos,e.pos+g,v),e.col+=g,e.pos+=g}if(!p)break;d+=g+1;var m=void 0;if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;(m=u.appendChild(O("span",_(b),"cm-tab"))).setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),e.col+=b}else"\r"==p[0]||"\n"==p[0]?((m=u.appendChild(O("span","\r"==p[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",p[0]),e.col+=1):((m=e.cm.options.specialCharPlaceholder(p[0])).setAttribute("cm-text",p[0]),l&&s<9?u.appendChild(O("span",[m])):u.appendChild(m),e.col+=1);e.map.push(e.pos,e.pos+1,m),e.pos++}}else e.col+=t.length,u=document.createTextNode(c),e.map.push(e.pos,e.pos+t.length,u),l&&s<9&&(f=!0),e.pos+=t.length;if(e.trailingSpace=32==c.charCodeAt(t.length-1),r||n||i||f||a){var w=r||"";n&&(w+=n),i&&(w+=i);var x=O("span",[u],w,a);return o&&(x.title=o),e.content.appendChild(x)}e.content.appendChild(u)}}function Qt(e,t){return function(r,n,i,o,l,s,a){i=i?i+" cm-force-border":"cm-force-border";for(var u=r.pos,c=u+n.length;;){for(var h=void 0,f=0;f<t.length&&!((h=t[f]).to>u&&h.from<=u);f++);if(h.to>=c)return e(r,n,i,o,l,s,a);e(r,n.slice(0,h.to-u),i,o,null,s,a),o=null,n=n.slice(h.to-u),u=h.to}}}function Jt(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,e.trailingSpace=!1}function er(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var l,s,a,u,c,h,f,d=i.length,p=0,g=1,v="",m=0;;){if(m==p){a=u=c=h=s="",f=null,m=1/0;for(var y=[],b=void 0,w=0;w<n.length;++w){var x=n[w],C=x.marker;"bookmark"==C.type&&x.from==p&&C.widgetNode?y.push(C):x.from<=p&&(null==x.to||x.to>p||C.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&m>x.to&&(m=x.to,u=""),C.className&&(a+=" "+C.className),C.css&&(s=(s?s+";":"")+C.css),C.startStyle&&x.from==p&&(c+=" "+C.startStyle),C.endStyle&&x.to==m&&(b||(b=[])).push(C.endStyle,x.to),C.title&&!h&&(h=C.title),C.collapsed&&(!f||Pe(f.marker,C)<0)&&(f=x)):x.from>p&&m>x.from&&(m=x.from)}if(b)for(var S=0;S<b.length;S+=2)b[S+1]==m&&(u+=" "+b[S]);if(!f||f.from==p)for(var L=0;L<y.length;++L)Jt(t,0,y[L]);if(f&&(f.from||0)==p){if(Jt(t,(null==f.to?d+1:f.to)-p,f.marker,null==f.from),null==f.to)return;f.to==p&&(f=!1)}}if(p>=d)break;for(var k=Math.min(d,m);;){if(v){var T=p+v.length;if(!f){var M=T>k?v.slice(0,k-p):v;t.addToken(t,M,l?l+a:a,c,p+M.length==m?u:"",h,s)}if(T>=k){v=v.slice(k-p),p=k;break}p=T,c=""}v=i.slice(o,o=r[g++]),l=_t(r[g++],t.cm.options)}}else for(var N=1;N<r.length;N+=2)t.addToken(t,i.slice(o,o=r[N]),_t(r[N+1],t.cm.options))}function tr(e,t,r){this.line=t,this.rest=function(e){for(var t,r;t=Ie(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}(t),this.size=this.rest?he(q(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Ve(e,t)}function rr(e,t,r){for(var n,i=[],o=t;o<r;o=n){var l=new tr(e.doc,se(e.doc,o),o);n=o+l.size,i.push(l)}return i}var nr=null;var ir=null;function or(e,t){var r=et(e,t);if(r.length){var n,i=Array.prototype.slice.call(arguments,2);nr?n=nr.delayedCallbacks:ir?n=ir:(n=ir=[],setTimeout(lr,0));for(var o=function(e){n.push(function(){return r[e].apply(null,i)})},l=0;l<r.length;++l)o(l)}}function lr(){var e=ir;ir=null;for(var t=0;t<e.length;++t)e[t]()}function sr(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?cr(e,t):"gutter"==o?fr(e,t,r,n):"class"==o?hr(e,t):"widget"==o&&dr(e,t,n)}t.changes=null}function ar(e){return e.node==e.text&&(e.node=O("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),l&&s<8&&(e.node.style.zIndex=2)),e.node}function ur(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):qt(e,t)}function cr(e,t){var r=t.text.className,n=ur(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,hr(e,t)):r&&(t.text.className=r)}function hr(e,t){!function(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var n=ar(t);t.background=n.insertBefore(O("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?ar(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function fr(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=ar(t);t.gutterBackground=O("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var l=ar(t),s=t.gutter=O("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(s),l.insertBefore(s,t.text),t.line.gutterClass&&(s.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=s.appendChild(O("div",pe(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var a=0;a<e.options.gutters.length;++a){var u=e.options.gutters[a],c=o.hasOwnProperty(u)&&o[u];c&&s.appendChild(O("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[u]+"px; width: "+n.gutterWidth[u]+"px"))}}}function dr(e,t,r){t.alignable&&(t.alignable=null);for(var n=t.node.firstChild,i=void 0;n;n=i)i=n.nextSibling,"CodeMirror-linewidget"==n.className&&t.node.removeChild(n);pr(e,t,r)}function pr(e,t,r){if(gr(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)gr(e,t.rest[n],t,r,!1)}function gr(e,t,r,n,i){if(t.widgets)for(var o=ar(r),l=0,s=t.widgets;l<s.length;++l){var a=s[l],u=O("div",[a.node],"CodeMirror-linewidget");a.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),vr(a,u,r,n),e.display.input.setUneditable(u),i&&a.above?o.insertBefore(u,r.gutter||r.text):o.appendChild(u),or(a,"redraw")}}function vr(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function mr(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!W(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),N(t.display.measure,O("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function yr(e,t){for(var r=ht(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 br(e){return e.lineSpace.offsetTop}function wr(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function xr(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=N(e.measure,O("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function Cr(e){return G-e.display.nativeBarWidth}function Sr(e){return e.display.scroller.clientWidth-Cr(e)-e.display.barWidth}function Lr(e){return e.display.scroller.clientHeight-Cr(e)-e.display.barHeight}function kr(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var i=0;i<e.rest.length;i++)if(he(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Tr(e,t,r,n){return Or(e,Nr(e,t),r,n)}function Mr(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[on(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Nr(e,t){var r=he(t),n=Mr(e,r);n&&!n.text?n=null:n&&n.changes&&(sr(e,n,r,Jr(e)),e.curOp.forceUpdate=!0),n||(n=function(e,t){var r=he(t=Be(t)),n=e.display.externalMeasured=new tr(e.doc,t,r);n.lineN=r;var i=n.built=qt(e,n);return n.text=i.pre,N(e.display.lineMeasure,i.pre),n}(e,t));var i=kr(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Or(e,t,r,n,i){t.before&&(r=-1);var o,a=r+(n||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(!function(e,t,r){var n=e.options.lineWrapping,i=n&&Sr(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var l=t.text.firstChild.getClientRects(),s=0;s<l.length-1;s++){var a=l[s],u=l[s+1];Math.abs(a.bottom-u.bottom)>2&&o.push((a.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,r,n){var i,o=Dr(t.map,r,n),a=o.node,u=o.start,c=o.end,h=o.collapse;if(3==a.nodeType){for(var f=0;f<4;f++){for(;u&&ie(t.line.text.charAt(o.coverStart+u));)--u;for(;o.coverStart+c<o.coverEnd&&ie(t.line.text.charAt(o.coverStart+c));)++c;if((i=l&&s<9&&0==u&&c==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():Hr(k(a,u,c).getClientRects(),n)).left||i.right||0==u)break;c=u,u-=1,h="right"}l&&s<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=Ct)return Ct;var t=N(e,O("span","x")),r=t.getBoundingClientRect(),n=k(t,0,1).getBoundingClientRect();return Ct=Math.abs(r.left-n.left)>1}(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}(e.display.measure,i))}else{var d;u>0&&(h=n="right"),i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==n?d.length-1:0]:a.getBoundingClientRect()}if(l&&s<9&&!u&&(!i||!i.left&&!i.right)){var p=a.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+Qr(e.display),top:p.top,bottom:p.bottom}:Wr}for(var g=i.top-t.rect.top,v=i.bottom-t.rect.top,m=(g+v)/2,y=t.view.measure.heights,b=0;b<y.length-1&&!(m<y[b]);b++);var w=b?y[b-1]:0,x=y[b],C={left:("right"==h?i.right:i.left)-t.rect.left,right:("left"==h?i.left:i.right)-t.rect.left,top:w,bottom:x};i.left||i.right||(C.bogus=!0);e.options.singleCursorHeightPerLine||(C.rtop=g,C.rbottom=v);return C}(e,t,r,n)).bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Ar,Wr={left:0,right:0,top:0,bottom:0};function Dr(e,t,r){for(var n,i,o,l,s,a,u=0;u<e.length;u+=3)if(s=e[u],a=e[u+1],t<s?(i=0,o=1,l="left"):t<a?o=(i=t-s)+1:(u==e.length-3||t==a&&e[u+3]>t)&&(i=(o=a-s)-1,t>=a&&(l="right")),null!=i){if(n=e[u+2],s==a&&r==(n.insertLeft?"left":"right")&&(l=r),"left"==r&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)n=e[2+(u-=3)],l="left";if("right"==r&&i==a-s)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)n=e[(u+=3)+2],l="right";break}return{node:n,start:i,end:o,collapse:l,coverStart:s,coverEnd:a}}function Hr(e,t){var r=Wr;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var i=e.length-1;i>=0&&(r=e[i]).left==r.right;i--);return r}function Fr(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Pr(e){e.display.externalMeasure=null,M(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Fr(e.display.view[t])}function Er(e){Pr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function zr(){return c&&v?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Ir(){return c&&v?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Rr(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=mr(e.widgets[r]));return t}function Br(e,t,r,n,i){if(!i){var o=Rr(t);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var l=je(t);if("local"==n?l+=br(e.display):l-=e.display.viewOffset,"page"==n||"window"==n){var s=e.display.lineSpace.getBoundingClientRect();l+=s.top+("window"==n?0:Ir());var a=s.left+("window"==n?0:zr());r.left+=a,r.right+=a}return r.top+=l,r.bottom+=l,r}function Gr(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=zr(),i-=Ir();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:n-l.left,top:i-l.top}}function Ur(e,t,r,n,i){return n||(n=se(e.doc,t.line)),Br(e,n,Tr(e,n,t.ch,i),r)}function Vr(e,t,r,n,i,o){function l(t,l){var s=Or(e,i,t,l?"right":"left",o);return l?s.left=s.right:s.right=s.left,Br(e,n,s,r)}n=n||se(e.doc,t.line),i||(i=Nr(e,n));var s=Ze(n,e.doc.direction),a=t.ch,u=t.sticky;if(a>=n.text.length?(a=n.text.length,u="before"):a<=0&&(a=0,u="after"),!s)return l("before"==u?a-1:a,"before"==u);function c(e,t,r){return l(r?e-1:e,1==s[t].level!=r)}var h=qe(s,a,u),f=_e,d=c(a,h,"before"==u);return null!=f&&(d.other=c(a,f,"before"!=u)),d}function Kr(e,t){var r=0;t=Ce(e.doc,t),e.options.lineWrapping||(r=Qr(e.display)*t.ch);var n=se(e.doc,t.line),i=je(n)+br(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function jr(e,t,r,n,i){var o=ge(e,t,r);return o.xRel=i,n&&(o.outside=!0),o}function Xr(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return jr(n.first,0,null,!0,-1);var i=fe(n,r),o=n.first+n.size-1;if(i>o)return jr(n.first+n.size-1,se(n,o).text.length,null,!0,1);t<0&&(t=0);for(var l=se(n,i);;){var s=$r(e,l,i,t,r),a=Ie(l),u=a&&a.find(0,!0);if(!a||!(s.ch>u.from.ch||s.ch==u.from.ch&&s.xRel>0))return s;i=he(l=u.to.line)}}function Yr(e,t,r,n){n-=Rr(t);var i=t.text.length,o=le(function(t){return Or(e,r,t-1).bottom<=n},i,0);return{begin:o,end:i=le(function(t){return Or(e,r,t).top>n},o,i)}}function _r(e,t,r,n){return r||(r=Nr(e,t)),Yr(e,t,r,Br(e,t,Or(e,r,n),"line").top)}function qr(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function $r(e,t,r,n,i){i-=je(t);var o=Nr(e,t),l=Rr(t),s=0,a=t.text.length,u=!0,c=Ze(t,e.doc.direction);if(c){var h=(e.options.lineWrapping?function(e,t,r,n,i,o,l){var s=Yr(e,t,n,l),a=s.begin,u=s.end;/\s/.test(t.text.charAt(u-1))&&u--;for(var c=null,h=null,f=0;f<i.length;f++){var d=i[f];if(!(d.from>=u||d.to<=a)){var p=1!=d.level,g=Or(e,n,p?Math.min(u,d.to)-1:Math.max(a,d.from)).right,v=g<o?o-g+1e9:g-o;(!c||h>v)&&(c=d,h=v)}}c||(c=i[i.length-1]);c.from<a&&(c={from:a,to:c.to,level:c.level});c.to>u&&(c={from:c.from,to:u,level:c.level});return c}:function(e,t,r,n,i,o,l){var s=le(function(s){var a=i[s],u=1!=a.level;return qr(Vr(e,ge(r,u?a.to:a.from,u?"before":"after"),"line",t,n),o,l,!0)},0,i.length-1),a=i[s];if(s>0){var u=1!=a.level,c=Vr(e,ge(r,u?a.from:a.to,u?"after":"before"),"line",t,n);qr(c,o,l,!0)&&c.top>l&&(a=i[s-1])}return a})(e,t,r,o,c,n,i);s=(u=1!=h.level)?h.from:h.to-1,a=u?h.to:h.from-1}var f,d,p=null,g=null,v=le(function(t){var r=Or(e,o,t);return r.top+=l,r.bottom+=l,!!qr(r,n,i,!1)&&(r.top<=i&&r.left<=n&&(p=t,g=r),!0)},s,a),m=!1;if(g){var y=n-g.left<g.right-n,b=y==u;v=p+(b?0:1),d=b?"after":"before",f=y?g.left:g.right}else{u||v!=a&&v!=s||v++,d=0==v?"after":v==t.text.length?"before":Or(e,o,v-(u?1:0)).bottom+l<=i==u?"after":"before";var w=Vr(e,ge(r,v,d),"line",t,o);f=w.left,m=i<w.top||i>=w.bottom}return jr(r,v=oe(t.text,v,1),d,m,n-f)}function Zr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Ar){Ar=O("pre");for(var t=0;t<49;++t)Ar.appendChild(document.createTextNode("x")),Ar.appendChild(O("br"));Ar.appendChild(document.createTextNode("x"))}N(e.measure,Ar);var r=Ar.offsetHeight/50;return r>3&&(e.cachedTextHeight=r),M(e.measure),r||1}function Qr(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=O("span","xxxxxxxxxx"),r=O("pre",[t]);N(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function Jr(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,l=0;o;o=o.nextSibling,++l)r[e.options.gutters[l]]=o.offsetLeft+o.clientLeft+i,n[e.options.gutters[l]]=o.clientWidth;return{fixedPos:en(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function en(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function tn(e){var t=Zr(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/Qr(e.display)-3);return function(i){if(Ve(e.doc,i))return 0;var o=0;if(i.widgets)for(var l=0;l<i.widgets.length;l++)i.widgets[l].height&&(o+=i.widgets[l].height);return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function rn(e){var t=e.doc,r=tn(e);t.iter(function(e){var t=r(e);t!=e.height&&ce(e,t)})}function nn(e,t,r,n){var i=e.display;if(!r&&"true"==ht(t).getAttribute("cm-not-content"))return null;var o,l,s=i.lineSpace.getBoundingClientRect();try{o=t.clientX-s.left,l=t.clientY-s.top}catch(t){return null}var a,u=Xr(e,o,l);if(n&&1==u.xRel&&(a=se(e.doc,u.line).text).length==u.ch){var c=I(a,a.length,e.options.tabSize)-a.length;u=ge(u.line,Math.max(0,Math.round((o-xr(e.display).left)/Qr(e.display))-c))}return u}function on(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var r=e.display.view,n=0;n<r.length;n++)if((t-=r[n].size)<0)return n}function ln(e){e.display.input.showSelection(e.display.input.prepareSelection())}function sn(e,t){void 0===t&&(t=!0);for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),l=0;l<r.sel.ranges.length;l++)if(t||l!=r.sel.primIndex){var s=r.sel.ranges[l];if(!(s.from().line>=e.display.viewTo||s.to().line<e.display.viewFrom)){var a=s.empty();(a||e.options.showCursorWhenSelecting)&&an(e,s.head,i),a||cn(e,s,o)}}return n}function an(e,t,r){var n=Vr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(O("div"," ","CodeMirror-cursor"));if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild(O("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function un(e,t){return e.top-t.top||e.left-t.left}function cn(e,t,r){var n=e.display,i=e.doc,o=document.createDocumentFragment(),l=xr(e.display),s=l.left,a=Math.max(n.sizerWidth,Sr(e)-n.sizer.offsetLeft)-l.right,u="ltr"==i.direction;function c(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),o.appendChild(O("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n                             top: "+t+"px; width: "+(null==r?a-e:r)+"px;\n                             height: "+(n-t)+"px"))}function h(t,r,n){var o,l,h=se(i,t),f=h.text.length;function d(r,n){return Ur(e,ge(t,r),"div",h,n)}function p(t,r,n){var i=_r(e,h,null,t),o="ltr"==r==("after"==n)?"left":"right";return d("after"==n?i.begin:i.end-(/\s/.test(h.text.charAt(i.end-1))?2:1),o)[o]}var g=Ze(h,i.direction);return function(e,t,r,n){if(!e)return n(t,r,"ltr",0);for(var i=!1,o=0;o<e.length;++o){var l=e[o];(l.from<r&&l.to>t||t==r&&l.to==t)&&(n(Math.max(l.from,t),Math.min(l.to,r),1==l.level?"rtl":"ltr",o),i=!0)}i||n(t,r,"ltr")}(g,r||0,null==n?f:n,function(e,t,i,h){var v="ltr"==i,m=d(e,v?"left":"right"),y=d(t-1,v?"right":"left"),b=null==r&&0==e,w=null==n&&t==f,x=0==h,C=!g||h==g.length-1;if(y.top-m.top<=3){var S=(u?w:b)&&C,L=(u?b:w)&&x?s:(v?m:y).left,k=S?a:(v?y:m).right;c(L,m.top,k-L,m.bottom)}else{var T,M,N,O;v?(T=u&&b&&x?s:m.left,M=u?a:p(e,i,"before"),N=u?s:p(t,i,"after"),O=u&&w&&C?a:y.right):(T=u?p(e,i,"before"):s,M=!u&&b&&x?a:m.right,N=!u&&w&&C?s:y.left,O=u?p(t,i,"after"):a),c(T,m.top,M-T,m.bottom),m.bottom<y.top&&c(s,m.bottom,null,y.top),c(N,y.top,O-N,y.bottom)}(!o||un(m,o)<0)&&(o=m),un(y,o)<0&&(o=y),(!l||un(m,l)<0)&&(l=m),un(y,l)<0&&(l=y)}),{start:o,end:l}}var f=t.from(),d=t.to();if(f.line==d.line)h(f.line,f.ch,d.ch);else{var p=se(i,f.line),g=se(i,d.line),v=Be(p)==Be(g),m=h(f.line,f.ch,v?p.text.length+1:null).end,y=h(d.line,v?0:null,d.ch).start;v&&(m.top<y.top-2?(c(m.right,m.top,null,m.bottom),c(s,y.top,y.left,y.bottom)):c(m.right,m.top,y.left-m.right,m.bottom)),m.bottom<y.top&&c(s,m.bottom,null,y.top)}r.appendChild(o)}function hn(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval(function(){return t.cursorDiv.style.visibility=(r=!r)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function fn(e){e.state.focused||(e.display.input.focus(),pn(e))}function dn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,gn(e))},100)}function pn(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(rt(e,"focus",e,t),e.state.focused=!0,H(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),a&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),hn(e))}function gn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(rt(e,"blur",e,t),e.state.focused=!1,T(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function vn(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i=t.view[n],o=void 0;if(!i.hidden){if(l&&s<8){var a=i.node.offsetTop+i.node.offsetHeight;o=a-r,r=a}else{var u=i.node.getBoundingClientRect();o=u.bottom-u.top}var c=i.line.height-o;if(o<2&&(o=Zr(t)),(c>.005||c<-.005)&&(ce(i.line,o),mn(i.line),i.rest))for(var h=0;h<i.rest.length;h++)mn(i.rest[h])}}}function mn(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode;n&&(r.height=n.offsetHeight)}}function yn(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-br(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=fe(t,n),l=fe(t,i);if(r&&r.ensure){var s=r.ensure.from.line,a=r.ensure.to.line;s<o?(o=s,l=fe(t,je(se(t,s))+e.wrapper.clientHeight)):Math.min(a,t.lastLine())>=l&&(o=fe(t,je(se(t,a))-e.wrapper.clientHeight),l=a)}return{from:o,to:Math.max(l,o+1)}}function bn(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=en(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",l=0;l<r.length;l++)if(!r[l].hidden){e.options.fixedGutter&&(r[l].gutter&&(r[l].gutter.style.left=o),r[l].gutterBackground&&(r[l].gutterBackground.style.left=o));var s=r[l].alignable;if(s)for(var a=0;a<s.length;a++)s[a].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function wn(e){if(!e.options.lineNumbers)return!1;var t=e.doc,r=pe(e.options,t.first+t.size-1),n=e.display;if(r.length!=n.lineNumChars){var i=n.measure.appendChild(O("div",[O("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,l=i.offsetWidth-o;return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-l)+1,n.lineNumWidth=n.lineNumInnerWidth+l,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",oi(e),!0}return!1}function xn(e,t){var r=e.display,n=Zr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,o=Lr(e),l={};t.bottom-t.top>o&&(t.bottom=t.top+o);var s=e.doc.height+wr(r),a=t.top<n,u=t.bottom>s-n;if(t.top<i)l.scrollTop=a?0:t.top;else if(t.bottom>i+o){var c=Math.min(t.top,(u?s:t.bottom)-o);c!=i&&(l.scrollTop=c)}var h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft,f=Sr(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0),d=t.right-t.left>f;return d&&(t.right=t.left+f),t.left<10?l.scrollLeft=0:t.left<h?l.scrollLeft=Math.max(0,t.left-(d?0:10)):t.right>f+h-3&&(l.scrollLeft=t.right+(d?0:10)-f),l}function Cn(e,t){null!=t&&(kn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Sn(e){kn(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Ln(e,t,r){null==t&&null==r||kn(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function kn(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Tn(e,Kr(e,t.from),Kr(e,t.to),t.margin))}function Tn(e,t,r,n){var i=xn(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n});Ln(e,i.scrollLeft,i.scrollTop)}function Mn(e,t){Math.abs(e.doc.scrollTop-t)<2||(r||ii(e,{top:t}),Nn(e,t,!0),r&&ii(e),Jn(e,100))}function Nn(e,t,r){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function On(e,t,r,n){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,bn(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function An(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+wr(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+Cr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Wn=function(e,t,r){this.cm=r;var n=this.vert=O("div",[O("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=O("div",[O("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(n),e(i),Je(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),Je(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,l&&s<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Wn.prototype.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=Math.max(0,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}},Wn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Wn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Wn.prototype.zeroWidthHack=function(){var e=y&&!d?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new R,this.disableVert=new R},Wn.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto",t.set(1e3,function n(){var i=e.getBoundingClientRect();("vert"==r?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,n)})},Wn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Dn=function(){};function Hn(e,t){t||(t=An(e));var r=e.display.barWidth,n=e.display.barHeight;Fn(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&vn(e),Fn(e,An(e)),r=e.display.barWidth,n=e.display.barHeight}function Fn(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=""}Dn.prototype.update=function(){return{bottom:0,right:0}},Dn.prototype.setScrollLeft=function(){},Dn.prototype.setScrollTop=function(){},Dn.prototype.clear=function(){};var Pn={native:Wn,null:Dn};function En(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&T(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Pn[e.options.scrollbarStyle](function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),Je(t,"mousedown",function(){e.state.focused&&setTimeout(function(){return e.display.input.focus()},0)}),t.setAttribute("cm-not-content","true")},function(t,r){"horizontal"==r?On(e,t):Mn(e,t)},e),e.display.scrollbars.addClass&&H(e.display.wrapper,e.display.scrollbars.addClass)}var zn=0;function In(e){var t;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:++zn},t=e.curOp,nr?nr.ops.push(t):t.ownsGroup=nr={ops:[t],delayedCallbacks:[]}}function Rn(e){!function(e,t){var r=e.ownsGroup;if(r)try{!function(e){var t=e.delayedCallbacks,r=0;do{for(;r<t.length;r++)t[r].call(null);for(var n=0;n<e.ops.length;n++){var i=e.ops[n];if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}(r)}finally{nr=null,t(r)}}(e.curOp,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null;!function(e){for(var t=e.ops,r=0;r<t.length;r++)Bn(t[r]);for(var n=0;n<t.length;n++)(i=t[n]).updatedDisplay=i.mustUpdate&&ri(i.cm,i.update);var i;for(var o=0;o<t.length;o++)Gn(t[o]);for(var l=0;l<t.length;l++)Un(t[l]);for(var s=0;s<t.length;s++)Vn(t[s])}(e)})}function Bn(e){var t,r,n=e.cm,i=n.display;!(r=(t=n).display).scrollbarsClipped&&r.scroller.offsetWidth&&(r.nativeBarWidth=r.scroller.offsetWidth-r.scroller.clientWidth,r.heightForcer.style.height=Cr(t)+"px",r.sizer.style.marginBottom=-r.nativeBarWidth+"px",r.sizer.style.borderRightWidth=Cr(t)+"px",r.scrollbarsClipped=!0),e.updateMaxLine&&Ye(n),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<i.viewFrom||e.scrollToPos.to.line>=i.viewTo)||i.maxLineChanged&&n.options.lineWrapping,e.update=e.mustUpdate&&new ti(n,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Gn(e){var t=e.cm,r=t.display;e.updatedDisplay&&vn(t),e.barMeasure=An(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Tr(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+Cr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Sr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Un(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&On(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==D();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&Hn(t,e.barMeasure),e.updatedDisplay&&li(t,e.barMeasure),e.selectionChanged&&hn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&fn(e.cm)}function Vn(e){var t=e.cm,r=t.display,n=t.doc;(e.updatedDisplay&&ni(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=e.scrollTop&&Nn(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&On(t,e.scrollLeft,!0,!0),e.scrollToPos)&&function(e,t){if(!nt(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&&!p){var o=O("div","​",null,"position: absolute;\n                         top: "+(t.top-r.viewOffset-br(e.display))+"px;\n                         height: "+(t.bottom-t.top+Cr(e)+r.barHeight)+"px;\n                         left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,r,n){var i;null==n&&(n=0),e.options.lineWrapping||t!=r||(r="before"==(t=t.ch?ge(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?ge(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var l=!1,s=Vr(e,t),a=r&&r!=t?Vr(e,r):s,u=xn(e,i={left:Math.min(s.left,a.left),top:Math.min(s.top,a.top)-n,right:Math.max(s.left,a.left),bottom:Math.max(s.bottom,a.bottom)+n}),c=e.doc.scrollTop,h=e.doc.scrollLeft;if(null!=u.scrollTop&&(Mn(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(l=!0)),null!=u.scrollLeft&&(On(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-h)>1&&(l=!0)),!l)break}return i}(t,Ce(n,e.scrollToPos.from),Ce(n,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var l=0;l<i.length;++l)i[l].lines.length||rt(i[l],"hide");if(o)for(var s=0;s<o.length;++s)o[s].lines.length&&rt(o[s],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&rt(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Kn(e,t){if(e.curOp)return t();In(e);try{return t()}finally{Rn(e)}}function jn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);In(e);try{return t.apply(e,arguments)}finally{Rn(e)}}}function Xn(e){return function(){if(this.curOp)return e.apply(this,arguments);In(this);try{return e.apply(this,arguments)}finally{Rn(this)}}}function Yn(e){return function(){var t=this.cm;if(!t||t.curOp)return e.apply(this,arguments);In(t);try{return e.apply(this,arguments)}finally{Rn(t)}}}function _n(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&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)ke&&Ge(e.doc,t)<i.viewTo&&$n(e);else if(r<=i.viewFrom)ke&&Ue(e.doc,r+n)>i.viewFrom?$n(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)$n(e);else if(t<=i.viewFrom){var o=Zn(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):$n(e)}else if(r>=i.viewTo){var l=Zn(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):$n(e)}else{var s=Zn(e,t,t,-1),a=Zn(e,r,r+n,1);s&&a?(i.view=i.view.slice(0,s.index).concat(rr(e,s.lineN,a.lineN)).concat(i.view.slice(a.index)),i.viewTo+=n):$n(e)}var u=i.externalMeasured;u&&(r<u.lineN?u.lineN+=n:t<u.lineN+u.size&&(i.externalMeasured=null))}function qn(e,t,r){e.curOp.viewChanged=!0;var n=e.display,i=e.display.externalMeasured;if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[on(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==B(l,r)&&l.push(r)}}}function $n(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Zn(e,t,r,n){var i,o=on(e,t),l=e.display.view;if(!ke||r==e.doc.first+e.doc.size)return{index:o,lineN:r};for(var s=e.display.viewFrom,a=0;a<o;a++)s+=l[a].size;if(s!=t){if(n>0){if(o==l.length-1)return null;i=s+l[o].size-t,o++}else i=s-t;t+=i,r+=i}for(;Ge(e.doc,r)!=r;){if(o==(n<0?0:l.length-1))return null;r+=n*l[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function Qn(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n];i.hidden||i.node&&!i.changes||++r}return r}function Jn(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,E(ei,e))}function ei(e){var t=e.doc;if(!(t.highlightFrontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=zt(e,t.highlightFrontier),i=[];t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(n.line>=e.display.viewFrom){var l=o.styles,s=o.text.length>e.options.maxHighlightLength?Ot(t.mode,n.state):null,a=Pt(e,o,n,!0);s&&(n.state=s),o.styles=a.styles;var u=o.styleClasses,c=a.classes;c?o.styleClasses=c:u&&(o.styleClasses=null);for(var h=!l||l.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),f=0;!h&&f<l.length;++f)h=l[f]!=o.styles[f];h&&i.push(n.line),o.stateAfter=n.save(),n.nextLine()}else o.text.length<=e.options.maxHighlightLength&&It(e,o.text,n),o.stateAfter=n.line%5==0?n.save():null,n.nextLine();if(+new Date>r)return Jn(e,e.options.workDelay),!0}),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),i.length&&Kn(e,function(){for(var t=0;t<i.length;t++)qn(e,i[t],"text")})}}var ti=function(e,t,r){var n=e.display;this.viewport=t,this.visible=yn(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Sr(e),this.force=r,this.dims=Jr(e),this.events=[]};function ri(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return $n(e),!1;if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==Qn(e))return!1;wn(e)&&($n(e),t.dims=Jr(e));var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),l=Math.min(i,t.visible.to+e.options.viewportMargin);r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>l&&r.viewTo-l<20&&(l=Math.min(i,r.viewTo)),ke&&(o=Ge(e.doc,o),l=Ue(e.doc,l));var s,u,c,h,f=o!=r.viewFrom||l!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;u=o,c=l,0==(h=(s=e).display).view.length||u>=h.viewTo||c<=h.viewFrom?(h.view=rr(s,u,c),h.viewFrom=u):(h.viewFrom>u?h.view=rr(s,u,h.viewFrom).concat(h.view):h.viewFrom<u&&(h.view=h.view.slice(on(s,u))),h.viewFrom=u,h.viewTo<c?h.view=h.view.concat(rr(s,h.viewTo,c)):h.viewTo>c&&(h.view=h.view.slice(0,on(s,c)))),h.viewTo=c,r.viewOffset=je(se(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var d=Qn(e);if(!f&&0==d&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var p=function(e){if(e.hasFocus())return null;var t=D();if(!t||!W(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&W(e.display.lineDiv,n.anchorNode)&&(r.anchorNode=n.anchorNode,r.anchorOffset=n.anchorOffset,r.focusNode=n.focusNode,r.focusOffset=n.focusOffset)}return r}(e);return d>4&&(r.lineDiv.style.display="none"),function(e,t,r){var n=e.display,i=e.options.lineNumbers,o=n.lineDiv,l=o.firstChild;function s(t){var r=t.nextSibling;return a&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var u=n.view,c=n.viewFrom,h=0;h<u.length;h++){var f=u[h];if(f.hidden);else if(f.node&&f.node.parentNode==o){for(;l!=f.node;)l=s(l);var d=i&&null!=t&&t<=c&&f.lineNumber;f.changes&&(B(f.changes,"gutter")>-1&&(d=!1),sr(e,f,c,r)),d&&(M(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(pe(e.options,c)))),l=f.node.nextSibling}else{var p=(m=c,b=r,void 0,w=ur(g=e,v=f),v.text=v.node=w.pre,w.bgClass&&(v.bgClass=w.bgClass),w.textClass&&(v.textClass=w.textClass),hr(g,v),fr(g,v,m,b),pr(g,v,b),v.node);o.insertBefore(p,l)}c+=f.size}var g,v,m,b,w;for(;l;)l=s(l)}(e,r.updateLineNumbers,t.dims),d>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(e){if(e&&e.activeElt&&e.activeElt!=D()&&(e.activeElt.focus(),e.anchorNode&&W(document.body,e.anchorNode)&&W(document.body,e.focusNode))){var t=window.getSelection(),r=document.createRange();r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}(p),M(r.cursorDiv),M(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,f&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,Jn(e,400)),r.updateLineNumbers=null,!0}function ni(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Sr(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+wr(e.display)-Lr(e),r.top)}),t.visible=yn(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&ri(e,t);n=!1){vn(e);var i=An(e);ln(e),Hn(e,i),li(e,i),t.force=!1}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 ii(e,t){var r=new ti(e,t);if(ri(e,r)){vn(e),ni(e,r);var n=An(e);ln(e),Hn(e,n),li(e,n),r.finish()}}function oi(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function li(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+Cr(e)+"px"}function si(e){var t=e.display.gutters,r=e.options.gutters;M(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(O("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&(e.display.lineGutter=o,o.style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none",oi(e)}function ai(e){var t=B(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))}ti.prototype.signal=function(e,t){ot(e,t)&&this.events.push(arguments)},ti.prototype.finish=function(){for(var e=0;e<this.events.length;e++)rt.apply(null,this.events[e])};var ui=0,ci=null;function hi(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}}function fi(e){var t=hi(e);return t.x*=ci,t.y*=ci,t}function di(e,t){var n=hi(t),i=n.x,o=n.y,l=e.display,s=l.scroller,u=s.scrollWidth>s.clientWidth,c=s.scrollHeight>s.clientHeight;if(i&&u||o&&c){if(o&&y&&a)e:for(var f=t.target,d=l.view;f!=s;f=f.parentNode)for(var p=0;p<d.length;p++)if(d[p].node==f){e.display.currentWheelTarget=f;break e}if(i&&!r&&!h&&null!=ci)return o&&c&&Mn(e,Math.max(0,s.scrollTop+o*ci)),On(e,Math.max(0,s.scrollLeft+i*ci)),(!o||o&&c)&&st(t),void(l.wheelStartX=null);if(o&&null!=ci){var g=o*ci,v=e.doc.scrollTop,m=v+l.wrapper.clientHeight;g<0?v=Math.max(0,v+g-50):m=Math.min(e.doc.height,m+g+50),ii(e,{top:v,bottom:m})}ui<20&&(null==l.wheelStartX?(l.wheelStartX=s.scrollLeft,l.wheelStartY=s.scrollTop,l.wheelDX=i,l.wheelDY=o,setTimeout(function(){if(null!=l.wheelStartX){var e=s.scrollLeft-l.wheelStartX,t=s.scrollTop-l.wheelStartY,r=t&&l.wheelDY&&t/l.wheelDY||e&&l.wheelDX&&e/l.wheelDX;l.wheelStartX=l.wheelStartY=null,r&&(ci=(ci*ui+r)/(ui+1),++ui)}},200)):(l.wheelDX+=i,l.wheelDY+=o))}}l?ci=-.53:r?ci=15:c?ci=-.7:f&&(ci=-1/3);var pi=function(e,t){this.ranges=e,this.primIndex=t};pi.prototype.primary=function(){return this.ranges[this.primIndex]},pi.prototype.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<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t];if(!me(r.anchor,n.anchor)||!me(r.head,n.head))return!1}return!0},pi.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new gi(ye(this.ranges[t].anchor),ye(this.ranges[t].head));return new pi(e,this.primIndex)},pi.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},pi.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(ve(t,n.from())>=0&&ve(e,n.to())<=0)return r}return-1};var gi=function(e,t){this.anchor=e,this.head=t};function vi(e,t){var r=e[t];e.sort(function(e,t){return ve(e.from(),t.from())}),t=B(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(ve(o.to(),i.from())>=0){var l=we(o.from(),i.from()),s=be(o.to(),i.to()),a=o.empty()?i.from()==i.head:o.from()==o.head;n<=t&&--t,e.splice(--n,2,new gi(a?s:l,a?l:s))}}return new pi(e,t)}function mi(e,t){return new pi([new gi(e,t||e)],0)}function yi(e){return e.text?ge(e.from.line+e.text.length-1,q(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function bi(e,t){if(ve(e,t.from)<0)return e;if(ve(e,t.to)<=0)return yi(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+=yi(t).ch-t.to.ch),ge(r,n)}function wi(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n];r.push(new gi(bi(i.anchor,t),bi(i.head,t)))}return vi(r,e.sel.primIndex)}function xi(e,t,r){return e.line==t.line?ge(r.line,e.ch-t.ch+r.ch):ge(r.line+(e.line-t.line),e.ch)}function Ci(e){e.doc.mode=Tt(e.options,e.doc.modeOption),Si(e)}function Si(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,Jn(e,100),e.state.modeGen++,e.curOp&&_n(e)}function Li(e,t){return 0==t.from.ch&&0==t.to.ch&&""==q(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function ki(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){!function(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),We(e),De(e,r);var i=n?n(e):1;i!=e.height&&ce(e,i)}(e,r,i,n),or(e,"change",e,t)}function l(e,t){for(var r=[],o=e;o<t;++o)r.push(new jt(u[o],i(o),n));return r}var s=t.from,a=t.to,u=t.text,c=se(e,s.line),h=se(e,a.line),f=q(u),d=i(u.length-1),p=a.line-s.line;if(t.full)e.insert(0,l(0,u.length)),e.remove(u.length,e.size-u.length);else if(Li(e,t)){var g=l(0,u.length-1);o(h,h.text,d),p&&e.remove(s.line,p),g.length&&e.insert(s.line,g)}else if(c==h)if(1==u.length)o(c,c.text.slice(0,s.ch)+f+c.text.slice(a.ch),d);else{var v=l(1,u.length-1);v.push(new jt(f+c.text.slice(a.ch),d,n)),o(c,c.text.slice(0,s.ch)+u[0],i(0)),e.insert(s.line+1,v)}else if(1==u.length)o(c,c.text.slice(0,s.ch)+u[0]+h.text.slice(a.ch),i(0)),e.remove(s.line+1,p);else{o(c,c.text.slice(0,s.ch)+u[0],i(0)),o(h,f+h.text.slice(a.ch),d);var m=l(1,u.length-1);p>1&&e.remove(s.line+1,p-1),e.insert(s.line+1,m)}or(e,"change",e,t)}function Ti(e,t,r){!function e(n,i,o){if(n.linked)for(var l=0;l<n.linked.length;++l){var s=n.linked[l];if(s.doc!=i){var a=o&&s.sharedHist;r&&!a||(t(s.doc,a),e(s.doc,n,a))}}}(e,null,!0)}function Mi(e,t){if(t.cm)throw new Error("This document is already in use.");e.doc=t,t.cm=e,rn(e),Ci(e),Ni(e),e.options.lineWrapping||Ye(e),e.options.mode=t.modeOption,_n(e)}function Ni(e){("rtl"==e.doc.direction?H:T)(e.display.lineDiv,"CodeMirror-rtl")}function Oi(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Ai(e,t){var r={from:ye(t.from),to:yi(t),text:ae(e,t.from,t.to)};return Pi(e,r,t.from.line,t.to.line+1),Ti(e,function(e){return Pi(e,r,t.from.line,t.to.line+1)},!0),r}function Wi(e){for(;e.length;){if(!q(e).ranges)break;e.pop()}}function Di(e,t,r,n){var i=e.history;i.undone.length=0;var o,l,s,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)))&&(s=i,o=i.lastOp==n?(Wi(s.done),q(s.done)):s.done.length&&!q(s.done).ranges?q(s.done):s.done.length>1&&!s.done[s.done.length-2].ranges?(s.done.pop(),q(s.done)):void 0))l=q(o.changes),0==ve(t.from,t.to)&&0==ve(t.from,l.to)?l.to=yi(t):o.changes.push(Ai(e,t));else{var u=q(i.done);for(u&&u.ranges||Fi(e.sel,i.done),o={changes:[Ai(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,l||rt(e,"historyAdded")}function Hi(e,t,r,n){var i,o,l,s,a,u=e.history,c=n&&n.origin;r==u.lastSelOp||c&&u.lastSelOrigin==c&&(u.lastModTime==u.lastSelTime&&u.lastOrigin==c||(i=e,o=c,l=q(u.done),s=t,"*"==(a=o.charAt(0))||"+"==a&&l.ranges.length==s.ranges.length&&l.somethingSelected()==s.somethingSelected()&&new Date-i.history.lastSelTime<=(i.cm?i.cm.options.historyEventDelay:500)))?u.done[u.done.length-1]=t:Fi(t,u.done),u.lastSelTime=+new Date,u.lastSelOrigin=c,u.lastSelOp=r,n&&!1!==n.clearRedo&&Wi(u.undone)}function Fi(e,t){var r=q(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Pi(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 Ei(e){if(!e)return null;for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r]);return t?t.length?t:null:e}function zi(e,t){var r=function(e,t){var r=t["spans_"+e.id];if(!r)return null;for(var n=[],i=0;i<t.text.length;++i)n.push(Ei(r[i]));return n}(e,t),n=Oe(e,t);if(!r)return n;if(!n)return r;for(var i=0;i<r.length;++i){var o=r[i],l=n[i];if(o&&l)e:for(var s=0;s<l.length;++s){for(var a=l[s],u=0;u<o.length;++u)if(o[u].marker==a.marker)continue e;o.push(a)}else l&&(r[i]=l)}return r}function Ii(e,t,r){for(var n=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)n.push(r?pi.prototype.deepCopy.call(o):o);else{var l=o.changes,s=[];n.push({changes:s});for(var a=0;a<l.length;++a){var u=l[a],c=void 0;if(s.push({from:u.from,to:u.to,text:u.text}),t)for(var h in u)(c=h.match(/^spans_(\d+)$/))&&B(t,Number(c[1]))>-1&&(q(s)[h]=u[h],delete u[h])}}}return n}function Ri(e,t,r,n){if(n){var i=e.anchor;if(r){var o=ve(t,i)<0;o!=ve(r,i)<0?(i=t,t=r):o!=ve(t,r)<0&&(t=r)}return new gi(i,t)}return new gi(r||t,t)}function Bi(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),ji(e,new pi([Ri(e.sel.primary(),t,r,i)],0),n)}function Gi(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)n[o]=Ri(e.sel.ranges[o],t[o],null,i);ji(e,vi(n,e.sel.primIndex),r)}function Ui(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,ji(e,vi(i,e.sel.primIndex),n)}function Vi(e,t,r,n){ji(e,mi(t,r),n)}function Ki(e,t,r){var n=e.history.done,i=q(n);i&&i.ranges?(n[n.length-1]=t,Xi(e,t,r)):ji(e,t,r)}function ji(e,t,r){Xi(e,t,r),Hi(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Xi(e,t,r){var n,i,o,l;(ot(e,"beforeSelectionChange")||e.cm&&ot(e.cm,"beforeSelectionChange"))&&(n=e,o=r,l={ranges:(i=t).ranges,update:function(e){this.ranges=[];for(var t=0;t<e.length;t++)this.ranges[t]=new gi(Ce(n,e[t].anchor),Ce(n,e[t].head))},origin:o&&o.origin},rt(n,"beforeSelectionChange",n,l),n.cm&&rt(n.cm,"beforeSelectionChange",n.cm,l),t=l.ranges!=i.ranges?vi(l.ranges,l.ranges.length-1):i),Yi(e,qi(e,t,r&&r.bias||(ve(t.primary().head,e.sel.primary().head)<0?-1:1),!0)),r&&!1===r.scroll||!e.cm||Sn(e.cm)}function Yi(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,it(e.cm)),or(e,"cursorActivity",e))}function _i(e){Yi(e,qi(e,e.sel,null,!1))}function qi(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var l=t.ranges[o],s=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],a=Zi(e,l.anchor,s&&s.anchor,r,n),u=Zi(e,l.head,s&&s.head,r,n);(i||a!=l.anchor||u!=l.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new gi(a,u))}return i?vi(i,t.primIndex):t}function $i(e,t,r,n,i){var o=se(e,t.line);if(o.markedSpans)for(var l=0;l<o.markedSpans.length;++l){var s=o.markedSpans[l],a=s.marker;if((null==s.from||(a.inclusiveLeft?s.from<=t.ch:s.from<t.ch))&&(null==s.to||(a.inclusiveRight?s.to>=t.ch:s.to>t.ch))){if(i&&(rt(a,"beforeCursorEnter"),a.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!a.atomic)continue;if(r){var u=a.find(n<0?1:-1),c=void 0;if((n<0?a.inclusiveRight:a.inclusiveLeft)&&(u=Qi(e,u,-n,u&&u.line==t.line?o:null)),u&&u.line==t.line&&(c=ve(u,r))&&(n<0?c<0:c>0))return $i(e,u,t,n,i)}var h=a.find(n<0?-1:1);return(n<0?a.inclusiveLeft:a.inclusiveRight)&&(h=Qi(e,h,n,h.line==t.line?o:null)),h?$i(e,h,t,n,i):null}}return t}function Zi(e,t,r,n,i){var o=n||1,l=$i(e,t,r,o,i)||!i&&$i(e,t,r,o,!0)||$i(e,t,r,-o,i)||!i&&$i(e,t,r,-o,!0);return l||(e.cantEdit=!0,ge(e.first,0))}function Qi(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?Ce(e,ge(t.line-1)):null:r>0&&t.ch==(n||se(e,t.line)).text.length?t.line<e.first+e.size-1?ge(t.line+1,0):null:new ge(t.line,t.ch+r)}function Ji(e){e.setSelection(ge(e.firstLine(),0),ge(e.lastLine()),V)}function eo(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}};return r&&(n.update=function(t,r,i,o){t&&(n.from=Ce(e,t)),r&&(n.to=Ce(e,r)),i&&(n.text=i),void 0!==o&&(n.origin=o)}),rt(e,"beforeChange",e,n),e.cm&&rt(e.cm,"beforeChange",e.cm,n),n.canceled?null:{from:n.from,to:n.to,text:n.text,origin:n.origin}}function to(e,t,r){if(e.cm){if(!e.cm.curOp)return jn(e.cm,to)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(ot(e,"beforeChange")||e.cm&&ot(e.cm,"beforeChange"))||(t=eo(e,t,!0))){var n=Le&&!r&&function(e,t,r){var n=null;if(e.iter(t.line,r.line+1,function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker;!r.readOnly||n&&-1!=B(n,r)||(n||(n=[])).push(r)}}),!n)return null;for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var l=n[o],s=l.find(0),a=0;a<i.length;++a){var u=i[a];if(!(ve(u.to,s.from)<0||ve(u.from,s.to)>0)){var c=[a,1],h=ve(u.from,s.from),f=ve(u.to,s.to);(h<0||!l.inclusiveLeft&&!h)&&c.push({from:u.from,to:s.from}),(f>0||!l.inclusiveRight&&!f)&&c.push({from:s.to,to:u.to}),i.splice.apply(i,c),a+=c.length-3}}return i}(e,t.from,t.to);if(n)for(var i=n.length-1;i>=0;--i)ro(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else ro(e,t)}}function ro(e,t){if(1!=t.text.length||""!=t.text[0]||0!=ve(t.from,t.to)){var r=wi(e,t);Di(e,t,r,e.cm?e.cm.curOp.id:NaN),oo(e,t,r,Oe(e,t));var n=[];Ti(e,function(e,r){r||-1!=B(n,e.history)||(uo(e.history,t),n.push(e.history)),oo(e,t,null,Oe(e,t))})}}function no(e,t,r){var n=e.cm&&e.cm.state.suppressEdits;if(!n||r){for(var i,o=e.history,l=e.sel,s="undo"==t?o.done:o.undone,a="undo"==t?o.undone:o.done,u=0;u<s.length&&(i=s[u],r?!i.ranges||i.equals(e.sel):i.ranges);u++);if(u!=s.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(!(i=s.pop()).ranges){if(n)return void s.push(i);break}if(Fi(i,a),r&&!i.equals(e.sel))return void ji(e,i,{clearRedo:!1});l=i}var c=[];Fi(l,a),a.push({changes:c,generation:o.generation}),o.generation=i.generation||++o.maxGeneration;for(var h=ot(e,"beforeChange")||e.cm&&ot(e.cm,"beforeChange"),f=function(r){var n=i.changes[r];if(n.origin=t,h&&!eo(e,n,!1))return s.length=0,{};c.push(Ai(e,n));var o=r?wi(e,n):q(s);oo(e,n,o,zi(e,n)),!r&&e.cm&&e.cm.scrollIntoView({from:n.from,to:yi(n)});var l=[];Ti(e,function(e,t){t||-1!=B(l,e.history)||(uo(e.history,n),l.push(e.history)),oo(e,n,null,zi(e,n))})},d=i.changes.length-1;d>=0;--d){var p=f(d);if(p)return p.v}}}}function io(e,t){if(0!=t&&(e.first+=t,e.sel=new pi($(e.sel.ranges,function(e){return new gi(ge(e.anchor.line+t,e.anchor.ch),ge(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){_n(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)qn(e.cm,n,"gutter")}}function oo(e,t,r,n){if(e.cm&&!e.cm.curOp)return jn(e.cm,oo)(e,t,r,n);if(t.to.line<e.first)io(e,t.text.length-1-(t.to.line-t.from.line));else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line);io(e,i),t={from:ge(e.first,0),to:ge(t.to.line+i,t.to.ch),text:[q(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:ge(o,se(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ae(e,t.from,t.to),r||(r=wi(e,t)),e.cm?function(e,t,r){var n=e.doc,i=e.display,o=t.from,l=t.to,s=!1,a=o.line;e.options.lineWrapping||(a=he(Be(se(n,o.line))),n.iter(a,l.line+1,function(e){if(e==i.maxLine)return s=!0,!0}));n.sel.contains(t.from,t.to)>-1&&it(e);ki(n,t,r,tn(e)),e.options.lineWrapping||(n.iter(a,o.line+t.text.length,function(e){var t=Xe(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0));(function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var r=e.first,n=t-1;n>r;n--){var i=se(e,n).stateAfter;if(i&&(!(i instanceof Ht)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}})(n,o.line),Jn(e,400);var u=t.text.length-(l.line-o.line)-1;t.full?_n(e):o.line!=l.line||1!=t.text.length||Li(e.doc,t)?_n(e,o.line,l.line+1,u):qn(e,o.line,"text");var c=ot(e,"changes"),h=ot(e,"change");if(h||c){var f={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};h&&or(e,"change",e,f),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(f)}e.display.selForContextMenu=null}(e.cm,t,n):ki(e,t,n),Xi(e,r,V)}}function lo(e,t,r,n,i){var o;(n||(n=r),ve(n,r)<0)&&(r=(o=[n,r])[0],n=o[1]);"string"==typeof t&&(t=e.splitLines(t)),to(e,{from:r,to:n,text:t,origin:i})}function so(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function ao(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],l=!0;if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0);for(var s=0;s<o.ranges.length;s++)so(o.ranges[s].anchor,t,r,n),so(o.ranges[s].head,t,r,n)}else{for(var a=0;a<o.changes.length;++a){var u=o.changes[a];if(r<u.from.line)u.from=ge(u.from.line+n,u.from.ch),u.to=ge(u.to.line+n,u.to.ch);else if(t<=u.to.line){l=!1;break}}l||(e.splice(0,i+1),i=0)}}}function uo(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;ao(e.done,r,n,i),ao(e.undone,r,n,i)}function co(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=se(e,xe(e,t)):i=he(t),null==i?null:(n(o,i)&&e.cm&&qn(e.cm,i,r),o)}function ho(e){this.lines=e,this.parent=null;for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height;this.height=t}function fo(e){this.children=e;for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n];t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}gi.prototype.from=function(){return we(this.anchor,this.head)},gi.prototype.to=function(){return be(this.anchor,this.head)},gi.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},ho.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r,n=e,i=e+t;n<i;++n){var o=this.lines[n];this.height-=o.height,(r=o).parent=null,We(r),or(o,"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;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}},fo.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var r=0;r<this.children.length;++r){var n=this.children[r],i=n.chunkSize();if(e<i){var o=Math.min(t,i-e),l=n.height;if(n.removeInner(e,o),this.height-=l-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 ho))){var s=[];this.collapse(s),this.children=[new ho(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){this.size+=t.length,this.height+=r;for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<=o){if(i.insertInner(e,t,r),i.lines&&i.lines.length>50){for(var l=i.lines.length%25+25,s=l;s<i.lines.length;){var a=new ho(i.lines.slice(s,s+=25));i.height-=a.height,this.children.splice(++n,0,a),a.parent=this}i.lines=i.lines.slice(0,l),this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=new fo(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var r=B(e.parent.children,e);e.parent.children.splice(r+1,0,t)}else{var n=new fo(e.children);n.parent=e,e.children=[n,t],e=n}t.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize();if(e<o){var l=Math.min(t,o-e);if(i.iterN(e,l,r))return!0;if(0==(t-=l))break;e=0}else e-=o}}};var po=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n]);this.doc=e,this.node=t};function go(e,t,r){je(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Cn(e,r)}po.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=he(r);if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1);t.length||(r.widgets=null);var o=mr(this);ce(r,Math.max(0,r.height-o)),e&&(Kn(e,function(){go(e,r,-o),qn(e,n,"widget")}),or(e,"lineWidgetCleared",e,this,n))}},po.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=mr(this)-t;i&&(ce(n,n.height+i),r&&Kn(r,function(){r.curOp.forceUpdate=!0,go(r,n,i),or(r,"lineWidgetChanged",r,e,he(n))}))},lt(po);var vo=0,mo=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++vo};function yo(e,t,r,n,i){if(n&&n.shared)return function(e,t,r,n,i){(n=z(n)).shared=!1;var o=[yo(e,t,r,n,i)],l=o[0],s=n.widgetNode;return Ti(e,function(e){s&&(n.widgetNode=s.cloneNode(!0)),o.push(yo(e,Ce(e,t),Ce(e,r),n,i));for(var a=0;a<e.linked.length;++a)if(e.linked[a].isParent)return;l=q(o)}),new bo(o,l)}(e,t,r,n,i);if(e.cm&&!e.cm.curOp)return jn(e.cm,yo)(e,t,r,n,i);var o=new mo(e,i),l=ve(t,r);if(n&&z(n,o,!1),l>0||0==l&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=A("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Re(e,t.line,t,r,o)||t.line!=r.line&&Re(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");ke=!0}o.addToHistory&&Di(e,{from:t,to:r,origin:"markText"},e.sel,NaN);var s,a=t.line,u=e.cm;if(e.iter(a,r.line+1,function(e){var n,i;u&&o.collapsed&&!u.options.lineWrapping&&Be(e)==u.display.maxLine&&(s=!0),o.collapsed&&a!=t.line&&ce(e,0),n=e,i=new Te(o,a==t.line?t.ch:null,a==r.line?r.ch:null),n.markedSpans=n.markedSpans?n.markedSpans.concat([i]):[i],i.marker.attachLine(n),++a}),o.collapsed&&e.iter(t.line,r.line+1,function(t){Ve(e,t)&&ce(t,0)}),o.clearOnEnter&&Je(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Le=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++vo,o.atomic=!0),u){if(s&&(u.curOp.updateMaxLine=!0),o.collapsed)_n(u,t.line,r.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var c=t.line;c<=r.line;c++)qn(u,c,"text");o.atomic&&_i(u.doc),or(u,"markerAdded",u,o)}return o}mo.prototype.clear=function(){var e=this;if(!this.explicitlyCleared){var t=this.doc.cm,r=t&&!t.curOp;if(r&&In(t),ot(this,"clear")){var n=this.find();n&&or(this,"clear",n.from,n.to)}for(var i=null,o=null,l=0;l<this.lines.length;++l){var s=e.lines[l],a=Me(s.markedSpans,e);t&&!e.collapsed?qn(t,he(s),"text"):t&&(null!=a.to&&(o=he(s)),null!=a.from&&(i=he(s))),s.markedSpans=Ne(s.markedSpans,a),null==a.from&&e.collapsed&&!Ve(e.doc,s)&&t&&ce(s,Zr(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var u=0;u<this.lines.length;++u){var c=Be(e.lines[u]),h=Xe(c);h>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=h,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&_n(t,i,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&_i(t.doc)),t&&or(t,"markerCleared",t,this,i,o),r&&Rn(t),this.parent&&this.parent.clear()}},mo.prototype.find=function(e,t){var r,n;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i<this.lines.length;++i){var o=this.lines[i],l=Me(o.markedSpans,this);if(null!=l.from&&(r=ge(t?o:he(o),l.from),-1==e))return r;if(null!=l.to&&(n=ge(t?o:he(o),l.to),1==e))return n}return r&&{from:r,to:n}},mo.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm;t&&n&&Kn(n,function(){var i=t.line,o=he(t.line),l=Mr(n,o);if(l&&(Fr(l),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!Ve(r.doc,i)&&null!=r.height){var s=r.height;r.height=null;var a=mr(r)-s;a&&ce(i,i.height+a)}or(n,"markerChanged",n,e)})},mo.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=B(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},mo.prototype.detachLine=function(e){if(this.lines.splice(B(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},lt(mo);var bo=function(e,t){this.markers=e,this.primary=t;for(var r=0;r<e.length;++r)e[r].parent=this};function wo(e){return e.findMarks(ge(e.first,0),e.clipPos(ge(e.lastLine())),function(e){return e.parent})}function xo(e){for(var t=function(t){var r=e[t],n=[r.primary.doc];Ti(r.primary.doc,function(e){return n.push(e)});for(var i=0;i<r.markers.length;i++){var o=r.markers[i];-1==B(n,o.doc)&&(o.parent=null,r.markers.splice(i--,1))}},r=0;r<e.length;r++)t(r)}bo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();or(this,"clear")}},bo.prototype.find=function(e,t){return this.primary.find(e,t)},lt(bo);var Co=0,So=function(e,t,r,n,i){if(!(this instanceof So))return new So(e,t,r,n,i);null==r&&(r=0),fo.call(this,[new ho([new jt("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var o=ge(r,0);this.sel=mi(o),this.history=new Oi(null),this.id=++Co,this.modeOption=t,this.lineSep=n,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),ki(this,{from:o,to:o,text:e}),ji(this,mi(o),V)};So.prototype=Q(fo.prototype,{constructor:So,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<t.length;++n)r+=t[n].height;this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=ue(this,this.first,this.first+this.size);return!1===e?t:t.join(e||this.lineSeparator())},setValue:Yn(function(e){var t=ge(this.first,0),r=this.first+this.size-1;to(this,{from:t,to:ge(r,se(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Ln(this.cm,0,0),ji(this,mi(t),V)}),replaceRange:function(e,t,r,n){lo(this,e,t=Ce(this,t),r=r?Ce(this,r):t,n)},getRange:function(e,t,r){var n=ae(this,Ce(this,e),Ce(this,t));return!1===r?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e);return t&&t.text},getLineHandle:function(e){if(de(this,e))return se(this,e)},getLineNumber:function(e){return he(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=se(this,e)),Be(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return Ce(this,e)},getCursor:function(e){var t=this.sel.primary();return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:Yn(function(e,t,r){Vi(this,Ce(this,"number"==typeof e?ge(e,t||0):e),null,r)}),setSelection:Yn(function(e,t,r){Vi(this,Ce(this,e),Ce(this,t||e),r)}),extendSelection:Yn(function(e,t,r){Bi(this,Ce(this,e),t&&Ce(this,t),r)}),extendSelections:Yn(function(e,t){Gi(this,Se(this,e),t)}),extendSelectionsBy:Yn(function(e,t){Gi(this,Se(this,$(this.sel.ranges,e)),t)}),setSelections:Yn(function(e,t,r){if(e.length){for(var n=[],i=0;i<e.length;i++)n[i]=new gi(Ce(this,e[i].anchor),Ce(this,e[i].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),ji(this,vi(n,t),r)}}),addSelection:Yn(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new gi(Ce(this,e),Ce(this,t||e))),ji(this,vi(n,n.length-1),r)}),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=ae(this,r[n].from(),r[n].to());t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=ae(this,r[n].from(),r[n].to());!1!==e&&(i=i.join(e||this.lineSeparator())),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e;this.replaceSelections(n,t,r||"+input")},replaceSelections:Yn(function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var l=i.ranges[o];n[o]={from:l.from(),to:l.to(),text:this.splitLines(e[o]),origin:r}}for(var s=t&&"end"!=t&&function(e,t,r){for(var n=[],i=ge(e.first,0),o=i,l=0;l<t.length;l++){var s=t[l],a=xi(s.from,i,o),u=xi(yi(s),i,o);if(i=s.to,o=u,"around"==r){var c=e.sel.ranges[l],h=ve(c.head,c.anchor)<0;n[l]=new gi(h?u:a,h?a:u)}else n[l]=new gi(a,a)}return new pi(n,e.sel.primIndex)}(this,n,t),a=n.length-1;a>=0;a--)to(this,n[a]);s?Ki(this,s):this.cm&&Sn(this.cm)}),undo:Yn(function(){no(this,"undo")}),redo:Yn(function(){no(this,"redo")}),undoSelection:Yn(function(){no(this,"undo",!0)}),redoSelection:Yn(function(){no(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.done.length;n++)e.done[n].ranges||++t;for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++r;return{undo:t,redo:r}},clearHistory:function(){this.history=new Oi(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Ii(this.history.done),undone:Ii(this.history.undone)}},setHistory:function(e){var t=this.history=new Oi(this.history.maxGeneration);t.done=Ii(e.done.slice(0),null,!0),t.undone=Ii(e.undone.slice(0),null,!0)},setGutterMarker:Yn(function(e,t,r){return co(this,e,"gutter",function(e){var n=e.gutterMarkers||(e.gutterMarkers={});return n[t]=r,!r&&re(n)&&(e.gutterMarkers=null),!0})}),clearGutter:Yn(function(e){var t=this;this.iter(function(r){r.gutterMarkers&&r.gutterMarkers[e]&&co(t,r,"gutter",function(){return r.gutterMarkers[e]=null,re(r.gutterMarkers)&&(r.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!de(this,e))return null;if(t=e,!(e=se(this,e)))return null}else if(null==(t=he(e)))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}},addLineClass:Yn(function(e,t,r){return co(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass";if(e[n]){if(L(r).test(e[n]))return!1;e[n]+=" "+r}else e[n]=r;return!0})}),removeLineClass:Yn(function(e,t,r){return co(this,e,"gutter"==t?"gutter":"class",function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[n];if(!i)return!1;if(null==r)e[n]=null;else{var o=i.match(L(r));if(!o)return!1;var l=o.index+o[0].length;e[n]=i.slice(0,o.index)+(o.index&&l!=i.length?" ":"")+i.slice(l)||null}return!0})}),addLineWidget:Yn(function(e,t,r){return i=e,o=new po(n=this,t,r),(l=n.cm)&&o.noHScroll&&(l.display.alignWidgets=!0),co(n,i,"widget",function(e){var t=e.widgets||(e.widgets=[]);if(null==o.insertAt?t.push(o):t.splice(Math.min(t.length-1,Math.max(0,o.insertAt)),0,o),o.line=e,l&&!Ve(n,e)){var r=je(e)<n.scrollTop;ce(e,e.height+mr(o)),r&&Cn(l,o.height),l.curOp.forceUpdate=!0}return!0}),l&&or(l,"lineWidgetAdded",l,o,"number"==typeof i?i:he(i)),o;var n,i,o,l}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return yo(this,Ce(this,e),Ce(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents};return yo(this,e=Ce(this,e),e,r,"bookmark")},findMarksAt:function(e){var t=[],r=se(this,(e=Ce(this,e)).line).markedSpans;if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=Ce(this,e),t=Ce(this,t);var n=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var l=o.markedSpans;if(l)for(var s=0;s<l.length;s++){var a=l[s];null!=a.to&&i==e.line&&e.ch>=a.to||null==a.from&&i!=e.line||null!=a.from&&i==t.line&&a.from>=t.ch||r&&!r(a.marker)||n.push(a.marker.parent||a.marker)}++i}),n},getAllMarks:function(){var e=[];return this.iter(function(t){var r=t.markedSpans;if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)}),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length;return this.iter(function(i){var o=i.text.length+n;if(o>e)return t=e,!0;e-=o,++r}),Ce(this,ge(r,t))},indexFromPos:function(e){var t=(e=Ce(this,e)).ch;if(e.line<this.first||e.ch<0)return 0;var r=this.lineSeparator().length;return this.iter(this.first,e.line,function(e){t+=e.text.length+r}),t},copy:function(e){var t=new So(ue(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={});var t=this.first,r=this.first+this.size;null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to);var n=new So(ue(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction);return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),l=e.clipPos(i.to);if(ve(o,l)){var s=yo(e,o,l,n.primary,n.primary.type);n.markers.push(s),s.parent=n}}}(n,wo(this)),n},unlinkDoc:function(e){if(e instanceof wl&&(e=e.doc),this.linked)for(var t=0;t<this.linked.length;++t){if(this.linked[t].doc==e){this.linked.splice(t,1),e.unlinkDoc(this),xo(wo(this));break}}if(e.history==this.history){var r=[e.id];Ti(e,function(e){return r.push(e.id)},!0),e.history=new Oi(null),e.history.done=Ii(this.history.done,r),e.history.undone=Ii(this.history.undone,r)}},iterLinkedDocs:function(e){Ti(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):bt(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Yn(function(e){var t;("rtl"!=e&&(e="ltr"),e!=this.direction)&&(this.direction=e,this.iter(function(e){return e.order=null}),this.cm&&Kn(t=this.cm,function(){Ni(t),_n(t)}))})}),So.prototype.eachLine=So.prototype.iter;var Lo=0;function ko(e){var t=this;if(To(t),!nt(t,e)&&!yr(t.display,e)){st(e),l&&(Lo=+new Date);var r=nn(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),s=0,a=function(e,n){if(!t.options.allowDropFileTypes||-1!=B(t.options.allowDropFileTypes,e.type)){var l=new FileReader;l.onload=jn(t,function(){var e=l.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[n]=e,++s==i){var a={from:r=Ce(t.doc,r),to:r,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};to(t.doc,a),Ki(t.doc,mi(r,yi(a)))}}),l.readAsText(e)}},u=0;u<i;++u)a(n[u],u);else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout(function(){return t.display.input.focus()},20);try{var c=e.dataTransfer.getData("Text");if(c){var h;if(t.state.draggingText&&!t.state.draggingText.copy&&(h=t.listSelections()),Xi(t.doc,mi(r,r)),h)for(var f=0;f<h.length;++f)lo(t.doc,"",h[f].anchor,h[f].head,"drag");t.replaceSelection(c,"around","paste"),t.display.input.focus()}}catch(e){}}}}function To(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Mo(e){if(document.getElementsByClassName)for(var t=document.getElementsByClassName("CodeMirror"),r=0;r<t.length;r++){var n=t[r].CodeMirror;n&&e(n)}}var No=!1;function Oo(){var e;No||(Je(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,Mo(Ao)},100))}),Je(window,"blur",function(){return Mo(gn)}),No=!0)}function Ao(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())}for(var Wo={3:"Pause",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",145:"ScrollLock",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"},Do=0;Do<10;Do++)Wo[Do+48]=Wo[Do+96]=String(Do);for(var Ho=65;Ho<=90;Ho++)Wo[Ho]=String.fromCharCode(Ho);for(var Fo=1;Fo<=12;Fo++)Wo[Fo+111]=Wo[Fo+63235]="F"+Fo;var Po={};function Eo(e){var t,r,n,i,o=e.split(/-(?!$)/);e=o[o.length-1];for(var l=0;l<o.length-1;l++){var s=o[l];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))r=!0;else{if(!/^s(hift)?$/i.test(s))throw new Error("Unrecognized modifier name: "+s);n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function zo(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=$(r.split(" "),Eo),o=0;o<i.length;o++){var l=void 0,s=void 0;o==i.length-1?(s=i.join(" "),l=n):(s=i.slice(0,o+1).join(" "),l="...");var a=t[s];if(a){if(a!=l)throw new Error("Inconsistent bindings for "+s)}else t[s]=l}delete e[r]}for(var u in t)e[u]=t[u];return e}function Io(e,t,r,n){var i=(t=Uo(t)).call?t.call(e,n):t[e];if(!1===i)return"nothing";if("..."===i)return"multi";if(null!=i&&r(i))return"handled";if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Io(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var l=Io(e,t.fallthrough[o],r,n);if(l)return l}}}function Ro(e){var t="string"==typeof e?e:Wo[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Bo(e,t,r){var n=e;return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(C?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(C?t.ctrlKey:t.metaKey)&&"Cmd"!=n&&(e="Cmd-"+e),!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function Go(e,t){if(h&&34==e.keyCode&&e.char)return!1;var r=Wo[e.keyCode];return null!=r&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(r=e.code),Bo(r,e,t))}function Uo(e){return"string"==typeof e?Po[e]:e}function Vo(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&ve(o.from,q(n).to)<=0;){var l=n.pop();if(ve(l.from,o.from)<0){o.from=l.from;break}}n.push(o)}Kn(e,function(){for(var t=n.length-1;t>=0;t--)lo(e.doc,"",n[t].from,n[t].to,"+delete");Sn(e)})}function Ko(e,t,r){var n=oe(e.text,t+r,r);return n<0||n>e.text.length?null:n}function jo(e,t,r){var n=Ko(e,t.ch,r);return null==n?null:new ge(t.line,n,r<0?"after":"before")}function Xo(e,t,r,n,i){if(e){var o=Ze(r,t.doc.direction);if(o){var l,s=i<0?q(o):o[0],a=i<0==(1==s.level)?"after":"before";if(s.level>0||"rtl"==t.doc.direction){var u=Nr(t,r);l=i<0?r.text.length-1:0;var c=Or(t,u,l).top;l=le(function(e){return Or(t,u,e).top==c},i<0==(1==s.level)?s.from:s.to-1,l),"before"==a&&(l=Ko(r,l,1))}else l=i<0?s.to:s.from;return new ge(n,l,a)}}return new ge(n,i<0?r.text.length:0,i<0?"before":"after")}Po.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"},Po.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"},Po.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","Ctrl-O":"openLine"},Po.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"]},Po.default=y?Po.macDefault:Po.pcDefault;var Yo={selectAll:Ji,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),V)},killLine:function(e){return Vo(e,function(t){if(t.empty()){var r=se(e.doc,t.head.line).text.length;return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:ge(t.head.line+1,0)}:{from:t.head,to:ge(t.head.line,r)}}return{from:t.from(),to:t.to()}})},deleteLine:function(e){return Vo(e,function(t){return{from:ge(t.from().line,0),to:Ce(e.doc,ge(t.to().line+1,0))}})},delLineLeft:function(e){return Vo(e,function(e){return{from:ge(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(e){return Vo(e,function(t){var r=e.charCoords(t.head,"div").top+5;return{from:e.coordsChar({left:0,top:r},"div"),to:t.from()}})},delWrappedLineRight:function(e){return Vo(e,function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div");return{from:t.from(),to:n}})},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(ge(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(ge(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy(function(t){return _o(e,t.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy(function(t){return qo(e,t.head)},{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy(function(t){return function(e,t){var r=se(e.doc,t),n=function(e){for(var t;t=Ie(e);)e=t.find(1,!0).line;return e}(r);n!=r&&(t=he(n));return Xo(!0,e,r,t,-1)}(e,t.head.line)},{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")},j)},goLineLeft:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5;return e.coordsChar({left:0,top:r},"div")},j)},goLineLeftSmart:function(e){return e.extendSelectionsBy(function(t){var r=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div");return n.ch<e.getLine(n.line).search(/\S/)?qo(e,t.head):n},j)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"char")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),l=I(e.getLine(o.line),o.ch,n);t.push(_(n-l%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Kn(e,function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++)if(t[n].empty()){var i=t[n].head,o=se(e.doc,i.line).text;if(o)if(i.ch==o.length&&(i=new ge(i.line,i.ch-1)),i.ch>0)i=new ge(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),ge(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var l=se(e.doc,i.line-1).text;l&&(i=new ge(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+l.charAt(l.length-1),ge(i.line-1,l.length-1),i,"+transpose"))}r.push(new gi(i,i))}e.setSelections(r)})},newlineAndIndent:function(e){return Kn(e,function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input");t=e.listSelections();for(var n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,!0);Sn(e)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function _o(e,t){var r=se(e.doc,t),n=Be(r);return n!=r&&(t=he(n)),Xo(!0,e,n,t,1)}function qo(e,t){var r=_o(e,t.line),n=se(e.doc,r.line),i=Ze(n,e.doc.direction);if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),l=t.line==r.line&&t.ch<=o&&t.ch;return ge(r.line,l?0:o,r.sticky)}return r}function $o(e,t,r){if("string"==typeof t&&!(t=Yo[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)!=U}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}var Zo=new R;function Qo(e,t,r,n){var i=e.state.keySeq;if(i){if(Ro(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Zo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),Jo(e,i+" "+t,r,n))return!0}return Jo(e,t,r,n)}function Jo(e,t,r,n){var i=function(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=Io(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&Io(t,e.options.extraKeys,r,e)||Io(t,e.options.keyMap,r,e)}(e,t,n);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&or(e,"keyHandled",e,t,r),"handled"!=i&&"multi"!=i||(st(r),hn(e)),!!i}function el(e,t){var r=Go(t,!0);return!!r&&(t.shiftKey&&!e.state.keySeq?Qo(e,"Shift-"+r,t,function(t){return $o(e,t,!0)})||Qo(e,r,t,function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return $o(e,t)}):Qo(e,r,t,function(t){return $o(e,t)}))}var tl=null;function rl(e){var t=this;if(t.curOp.focus=D(),!nt(t,e)){l&&s<11&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=el(t,e);h&&(tl=n?r:null,!n&&88==r&&!xt&&(y?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||function(e){var t=e.display.lineDiv;function r(e){18!=e.keyCode&&e.altKey||(T(t,"CodeMirror-crosshair"),tt(document,"keyup",r),tt(document,"mouseover",r))}H(t,"CodeMirror-crosshair"),Je(document,"keyup",r),Je(document,"mouseover",r)}(t)}}function nl(e){16==e.keyCode&&(this.doc.sel.shift=!1),nt(this,e)}function il(e){var t=this;if(!(yr(t.display,e)||nt(t,e)||e.ctrlKey&&!e.altKey||y&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(h&&r==tl)return tl=null,void st(e);if(!h||e.which&&!(e.which<10)||!el(t,e)){var i,o=String.fromCharCode(null==n?r:n);if("\b"!=o)if(!Qo(i=t,"'"+o+"'",e,function(e){return $o(i,e,!0)}))t.display.input.onKeyPress(e)}}}var ol,ll,sl=function(e,t,r){this.time=e,this.pos=t,this.button=r};function al(e){var t=this,r=t.display;if(!(nt(t,e)||r.activeTouch&&r.input.supportsTouch()))if(r.input.ensurePolled(),r.shift=e.shiftKey,yr(r,e))a||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));else if(!hl(t,e)){var n,i,o,u=nn(t,e),c=ft(e),h=u?(n=u,i=c,o=+new Date,ll&&ll.compare(o,n,i)?(ol=ll=null,"triple"):ol&&ol.compare(o,n,i)?(ll=new sl(o,n,i),ol=null,"double"):(ol=new sl(o,n,i),ll=null,"single")):"single";window.focus(),1==c&&t.state.selectingText&&t.state.selectingText(e),u&&function(e,t,r,n,i){var o="Click";"double"==n?o="Double"+o:"triple"==n&&(o="Triple"+o);return Qo(e,Bo(o=(1==t?"Left":2==t?"Middle":"Right")+o,i),i,function(t){if("string"==typeof t&&(t=Yo[t]),!t)return!1;var n=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n=t(e,r)!=U}finally{e.state.suppressEdits=!1}return n})}(t,c,u,h,e)||(1==c?u?function(e,t,r,n){l?setTimeout(E(fn,e),0):e.curOp.focus=D();var i,o=function(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(null==i.unit){var o=b?r.shiftKey&&r.metaKey:r.altKey;i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||r.shiftKey);null==i.addNew&&(i.addNew=y?r.metaKey:r.ctrlKey);null==i.moveOnDrag&&(i.moveOnDrag=!(y?r.altKey:r.ctrlKey));return i}(e,r,n),u=e.doc.sel;e.options.dragDrop&&gt&&!e.isReadOnly()&&"single"==r&&(i=u.contains(t))>-1&&(ve((i=u.ranges[i]).from(),t)<0||t.xRel>0)&&(ve(i.to(),t)>0||t.xRel<0)?function(e,t,r,n){var i=e.display,o=!1,u=jn(e,function(t){a&&(i.scroller.draggable=!1),e.state.draggingText=!1,tt(document,"mouseup",u),tt(document,"mousemove",c),tt(i.scroller,"dragstart",h),tt(i.scroller,"drop",u),o||(st(t),n.addNew||Bi(e.doc,r,null,null,n.extend),a||l&&9==s?setTimeout(function(){document.body.focus(),i.input.focus()},20):i.input.focus())}),c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},h=function(){return o=!0};a&&(i.scroller.draggable=!0);e.state.draggingText=u,u.copy=!n.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop();Je(document,"mouseup",u),Je(document,"mousemove",c),Je(i.scroller,"dragstart",h),Je(i.scroller,"drop",u),dn(e),setTimeout(function(){return i.input.focus()},20)}(e,n,t,o):function(e,t,r,n){var i=e.display,o=e.doc;st(t);var l,s,a=o.sel,u=a.ranges;n.addNew&&!n.extend?(s=o.sel.contains(r),l=s>-1?u[s]:new gi(r,r)):(l=o.sel.primary(),s=o.sel.primIndex);if("rectangle"==n.unit)n.addNew||(l=new gi(r,r)),r=nn(e,t,!0,!0),s=-1;else{var c=ul(e,r,n.unit);l=n.extend?Ri(l,c.anchor,c.head,n.extend):c}n.addNew?-1==s?(s=u.length,ji(o,vi(u.concat([l]),s),{scroll:!1,origin:"*mouse"})):u.length>1&&u[s].empty()&&"char"==n.unit&&!n.extend?(ji(o,vi(u.slice(0,s).concat(u.slice(s+1)),0),{scroll:!1,origin:"*mouse"}),a=o.sel):Ui(o,s,l,K):(s=0,ji(o,new pi([l],0),K),a=o.sel);var h=r;function f(t){if(0!=ve(h,t))if(h=t,"rectangle"==n.unit){for(var i=[],u=e.options.tabSize,c=I(se(o,r.line).text,r.ch,u),f=I(se(o,t.line).text,t.ch,u),d=Math.min(c,f),p=Math.max(c,f),g=Math.min(r.line,t.line),v=Math.min(e.lastLine(),Math.max(r.line,t.line));g<=v;g++){var m=se(o,g).text,y=X(m,d,u);d==p?i.push(new gi(ge(g,y),ge(g,y))):m.length>y&&i.push(new gi(ge(g,y),ge(g,X(m,p,u))))}i.length||i.push(new gi(r,r)),ji(o,vi(a.ranges.slice(0,s).concat(i),s),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,w=l,x=ul(e,t,n.unit),C=w.anchor;ve(x.anchor,C)>0?(b=x.head,C=we(w.from(),x.anchor)):(b=x.anchor,C=be(w.to(),x.head));var S=a.ranges.slice(0);S[s]=function(e,t){var r=t.anchor,n=t.head,i=se(e.doc,r.line);if(0==ve(r,n)&&r.sticky==n.sticky)return t;var o=Ze(i);if(!o)return t;var l=qe(o,r.ch,r.sticky),s=o[l];if(s.from!=r.ch&&s.to!=r.ch)return t;var a,u=l+(s.from==r.ch==(1!=s.level)?0:1);if(0==u||u==o.length)return t;if(n.line!=r.line)a=(n.line-r.line)*("ltr"==e.doc.direction?1:-1)>0;else{var c=qe(o,n.ch,n.sticky),h=c-l||(n.ch-r.ch)*(1==s.level?-1:1);a=c==u-1||c==u?h<0:h>0}var f=o[u+(a?-1:0)],d=a==(1==f.level),p=d?f.from:f.to,g=d?"after":"before";return r.ch==p&&r.sticky==g?t:new gi(new ge(r.line,p,g),n)}(e,new gi(Ce(o,C),b)),ji(o,vi(S,s),K)}}var d=i.wrapper.getBoundingClientRect(),p=0;function g(t){e.state.selectingText=!1,p=1/0,st(t),i.input.focus(),tt(document,"mousemove",v),tt(document,"mouseup",m),o.history.lastSelOrigin=null}var v=jn(e,function(t){ft(t)?function t(r){var l=++p;var s=nn(e,r,!0,"rectangle"==n.unit);if(!s)return;if(0!=ve(s,h)){e.curOp.focus=D(),f(s);var a=yn(i,o);(s.line>=a.to||s.line<a.from)&&setTimeout(jn(e,function(){p==l&&t(r)}),150)}else{var u=r.clientY<d.top?-20:r.clientY>d.bottom?20:0;u&&setTimeout(jn(e,function(){p==l&&(i.scroller.scrollTop+=u,t(r))}),50)}}(t):g(t)}),m=jn(e,g);e.state.selectingText=m,Je(document,"mousemove",v),Je(document,"mouseup",m)}(e,n,t,o)}(t,u,h,e):ht(e)==r.scroller&&st(e):2==c?(u&&Bi(t.doc,u),setTimeout(function(){return r.input.focus()},20)):3==c&&(S?fl(t,e):dn(t)))}}function ul(e,t,r){if("char"==r)return new gi(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new gi(ge(t.line,0),Ce(e.doc,ge(t.line+1,0)));var n=r(e,t);return new gi(n.from,n.to)}function cl(e,t,r,n){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;n&&st(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(o>s.bottom||!ot(e,r))return ut(t);o-=s.top-l.viewOffset;for(var a=0;a<e.options.gutters.length;++a){var u=l.gutters.childNodes[a];if(u&&u.getBoundingClientRect().right>=i)return rt(e,r,e,fe(e.doc,o),e.options.gutters[a],t),ut(t)}}function hl(e,t){return cl(e,t,"gutterClick",!0)}function fl(e,t){yr(e.display,t)||function(e,t){if(!ot(e,"gutterContextMenu"))return!1;return cl(e,t,"gutterContextMenu",!1)}(e,t)||nt(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function dl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Er(e)}sl.prototype.compare=function(e,t,r){return this.time+400>e&&0==ve(t,this.pos)&&r==this.button};var pl={toString:function(){return"CodeMirror.Init"}},gl={},vl={};function ml(e){si(e),_n(e),bn(e)}function yl(e,t,r){if(!t!=!(r&&r!=pl)){var n=e.display.dragFunctions,i=t?Je:tt;i(e.display.scroller,"dragstart",n.start),i(e.display.scroller,"dragenter",n.enter),i(e.display.scroller,"dragover",n.over),i(e.display.scroller,"dragleave",n.leave),i(e.display.scroller,"drop",n.drop)}}function bl(e){e.options.lineWrapping?(H(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(T(e.display.wrapper,"CodeMirror-wrap"),Ye(e)),rn(e),_n(e),Er(e),setTimeout(function(){return Hn(e)},100)}function wl(e,t){var n=this;if(!(this instanceof wl))return new wl(e,t);this.options=t=t?z(t):{},z(gl,t,!1),ai(t);var i=t.value;"string"==typeof i&&(i=new So(i,t.mode,null,t.lineSeparator,t.direction)),this.doc=i;var o=new wl.inputStyles[t.inputStyle](this),u=this.display=new function(e,t,n){var i=this;this.input=n,i.scrollbarFiller=O("div",null,"CodeMirror-scrollbar-filler"),i.scrollbarFiller.setAttribute("cm-not-content","true"),i.gutterFiller=O("div",null,"CodeMirror-gutter-filler"),i.gutterFiller.setAttribute("cm-not-content","true"),i.lineDiv=A("div",null,"CodeMirror-code"),i.selectionDiv=O("div",null,null,"position: relative; z-index: 1"),i.cursorDiv=O("div",null,"CodeMirror-cursors"),i.measure=O("div",null,"CodeMirror-measure"),i.lineMeasure=O("div",null,"CodeMirror-measure"),i.lineSpace=A("div",[i.measure,i.lineMeasure,i.selectionDiv,i.cursorDiv,i.lineDiv],null,"position: relative; outline: none");var o=A("div",[i.lineSpace],"CodeMirror-lines");i.mover=O("div",[o],null,"position: relative"),i.sizer=O("div",[i.mover],"CodeMirror-sizer"),i.sizerWidth=null,i.heightForcer=O("div",null,null,"position: absolute; height: "+G+"px; width: 1px;"),i.gutters=O("div",null,"CodeMirror-gutters"),i.lineGutter=null,i.scroller=O("div",[i.sizer,i.heightForcer,i.gutters],"CodeMirror-scroll"),i.scroller.setAttribute("tabIndex","-1"),i.wrapper=O("div",[i.scrollbarFiller,i.gutterFiller,i.scroller],"CodeMirror"),l&&s<8&&(i.gutters.style.zIndex=-1,i.scroller.style.paddingRight=0),a||r&&m||(i.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(i.wrapper):e(i.wrapper)),i.viewFrom=i.viewTo=t.first,i.reportedViewFrom=i.reportedViewTo=t.first,i.view=[],i.renderedView=null,i.externalMeasured=null,i.viewOffset=0,i.lastWrapHeight=i.lastWrapWidth=0,i.updateLineNumbers=null,i.nativeBarWidth=i.barHeight=i.barWidth=0,i.scrollbarsClipped=!1,i.lineNumWidth=i.lineNumInnerWidth=i.lineNumChars=null,i.alignWidgets=!1,i.cachedCharWidth=i.cachedTextHeight=i.cachedPaddingH=null,i.maxLine=null,i.maxLineLength=0,i.maxLineChanged=!1,i.wheelDX=i.wheelDY=i.wheelStartX=i.wheelStartY=null,i.shift=!1,i.selForContextMenu=null,i.activeTouch=null,n.init(i)}(e,i,o);for(var c in u.wrapper.CodeMirror=this,si(this),dl(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),En(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 R,keySeq:null,specialChars:null},t.autofocus&&!m&&u.input.focus(),l&&s<11&&setTimeout(function(){return n.display.input.reset(!0)},20),function(e){var t=e.display;Je(t.scroller,"mousedown",jn(e,al)),Je(t.scroller,"dblclick",l&&s<11?jn(e,function(t){if(!nt(e,t)){var r=nn(e,t);if(r&&!hl(e,t)&&!yr(e.display,t)){st(t);var n=e.findWordAt(r);Bi(e.doc,n.anchor,n.head)}}}):function(t){return nt(e,t)||st(t)});S||Je(t.scroller,"contextmenu",function(t){return fl(e,t)});var r,n={end:0};function i(){t.activeTouch&&(r=setTimeout(function(){return t.activeTouch=null},1e3),(n=t.activeTouch).end=+new Date)}function o(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return r*r+n*n>400}Je(t.scroller,"touchstart",function(i){if(!nt(e,i)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(i)&&!hl(e,i)){t.input.ensurePolled(),clearTimeout(r);var o=+new Date;t.activeTouch={start:o,moved:!1,prev:o-n.end<=300?n:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}}),Je(t.scroller,"touchmove",function(){t.activeTouch&&(t.activeTouch.moved=!0)}),Je(t.scroller,"touchend",function(r){var n=t.activeTouch;if(n&&!yr(t,r)&&null!=n.left&&!n.moved&&new Date-n.start<300){var l,s=e.coordsChar(t.activeTouch,"page");l=!n.prev||o(n,n.prev)?new gi(s,s):!n.prev.prev||o(n,n.prev.prev)?e.findWordAt(s):new gi(ge(s.line,0),Ce(e.doc,ge(s.line+1,0))),e.setSelection(l.anchor,l.head),e.focus(),st(r)}i()}),Je(t.scroller,"touchcancel",i),Je(t.scroller,"scroll",function(){t.scroller.clientHeight&&(Mn(e,t.scroller.scrollTop),On(e,t.scroller.scrollLeft,!0),rt(e,"scroll",e))}),Je(t.scroller,"mousewheel",function(t){return di(e,t)}),Je(t.scroller,"DOMMouseScroll",function(t){return di(e,t)}),Je(t.wrapper,"scroll",function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0}),t.dragFunctions={enter:function(t){nt(e,t)||ct(t)},over:function(t){nt(e,t)||(!function(e,t){var r=nn(e,t);if(r){var n=document.createDocumentFragment();an(e,r,n),e.display.dragCursor||(e.display.dragCursor=O("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),N(e.display.dragCursor,n)}}(e,t),ct(t))},start:function(t){return function(e,t){if(l&&(!e.state.draggingText||+new Date-Lo<100))ct(t);else if(!nt(e,t)&&!yr(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f)){var r=O("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",h&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),h&&r.parentNode.removeChild(r)}}(e,t)},drop:jn(e,ko),leave:function(t){nt(e,t)||To(e)}};var a=t.input.getField();Je(a,"keyup",function(t){return nl.call(e,t)}),Je(a,"keydown",jn(e,rl)),Je(a,"keypress",jn(e,il)),Je(a,"focus",function(t){return pn(e,t)}),Je(a,"blur",function(t){return gn(e,t)})}(this),Oo(),In(this),this.curOp.forceUpdate=!0,Mi(this,i),t.autofocus&&!m||this.hasFocus()?setTimeout(E(pn,this),20):gn(this),vl)vl.hasOwnProperty(c)&&vl[c](n,t[c],pl);wn(this),t.finishInit&&t.finishInit(this);for(var d=0;d<xl.length;++d)xl[d](n);Rn(this),a&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(u.lineDiv).textRendering&&(u.lineDiv.style.textRendering="auto")}wl.defaults=gl,wl.optionHandlers=vl;var xl=[];function Cl(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=zt(e,t).state:r="prev");var l=e.options.tabSize,s=se(o,t),a=I(s.text,null,l);s.stateAfter&&(s.stateAfter=null);var u,c=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&((u=o.mode.indent(i,s.text.slice(c.length),s.text))==U||u>150)){if(!n)return;r="prev"}}else u=0,r="not";"prev"==r?u=t>o.first?I(se(o,t-1).text,null,l):0:"add"==r?u=a+e.options.indentUnit:"subtract"==r?u=a-e.options.indentUnit:"number"==typeof r&&(u=a+r),u=Math.max(0,u);var h="",f=0;if(e.options.indentWithTabs)for(var d=Math.floor(u/l);d;--d)f+=l,h+="\t";if(f<u&&(h+=_(u-f)),h!=c)return lo(o,h,ge(t,0),ge(t,c.length),"+input"),s.stateAfter=null,!0;for(var p=0;p<o.sel.ranges.length;p++){var g=o.sel.ranges[p];if(g.head.line==t&&g.head.ch<c.length){var v=ge(t,c.length);Ui(o,p,new gi(v,v));break}}}wl.defineInitHook=function(e){return xl.push(e)};var Sl=null;function Ll(e){Sl=e}function kl(e,t,r,n,i){var o=e.doc;e.display.shift=!1,n||(n=o.sel);var l,s=e.state.pasteIncoming||"paste"==i,a=bt(t),u=null;if(s&&n.ranges.length>1)if(Sl&&Sl.text.join("\n")==t){if(n.ranges.length%Sl.text.length==0){u=[];for(var c=0;c<Sl.text.length;c++)u.push(o.splitLines(Sl.text[c]))}}else a.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(u=$(a,function(e){return[e]}));for(var h=n.ranges.length-1;h>=0;h--){var f=n.ranges[h],d=f.from(),p=f.to();f.empty()&&(r&&r>0?d=ge(d.line,d.ch-r):e.state.overwrite&&!s?p=ge(p.line,Math.min(se(o,p.line).text.length,p.ch+q(a).length)):Sl&&Sl.lineWise&&Sl.text.join("\n")==t&&(d=p=ge(d.line,0))),l=e.curOp.updateInput;var g={from:d,to:p,text:u?u[h%u.length]:a,origin:i||(s?"paste":e.state.cutIncoming?"cut":"+input")};to(e.doc,g),or(e,"inputRead",e,g)}t&&!s&&Ml(e,t),Sn(e),e.curOp.updateInput=l,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Tl(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Kn(t,function(){return kl(t,r,0,null,"paste")}),!0}function Ml(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),l=!1;if(o.electricChars){for(var s=0;s<o.electricChars.length;s++)if(t.indexOf(o.electricChars.charAt(s))>-1){l=Cl(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(se(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=Cl(e,i.head.line,"smart"));l&&or(e,"electricInput",e,i.head.line)}}}function Nl(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:ge(i,0),head:ge(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function Ol(e,t){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck",!!t)}function Al(){var e=O("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=O("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return a?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),Ol(e),t}function Wl(e,t,r,n,i){var o=t,l=r,s=se(e,t.line);function a(n){var o,l;if(null==(o=i?function(e,t,r,n){var i=Ze(t,e.doc.direction);if(!i)return jo(t,r,n);r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after");var o=qe(i,r.ch,r.sticky),l=i[o];if("ltr"==e.doc.direction&&l.level%2==0&&(n>0?l.to>r.ch:l.from<r.ch))return jo(t,r,n);var s,a=function(e,r){return Ko(t,e instanceof ge?e.ch:e,r)},u=function(r){return e.options.lineWrapping?(s=s||Nr(e,t),_r(e,t,s,r)):{begin:0,end:t.text.length}},c=u("before"==r.sticky?a(r,-1):r.ch);if("rtl"==e.doc.direction||1==l.level){var h=1==l.level==n<0,f=a(r,h?1:-1);if(null!=f&&(h?f<=l.to&&f<=c.end:f>=l.from&&f>=c.begin)){var d=h?"before":"after";return new ge(r.line,f,d)}}var p=function(e,t,n){for(var o=function(e,t){return t?new ge(r.line,a(e,1),"before"):new ge(r.line,e,"after")};e>=0&&e<i.length;e+=t){var l=i[e],s=t>0==(1!=l.level),u=s?n.begin:a(n.end,-1);if(l.from<=u&&u<l.to)return o(u,s);if(u=s?l.from:a(l.to,-1),n.begin<=u&&u<n.end)return o(u,s)}},g=p(o+n,n,c);if(g)return g;var v=n>0?c.end:a(c.begin,-1);return null==v||n>0&&v==t.text.length||!(g=p(n>0?0:i.length-1,n,u(v)))?null:g}(e.cm,s,t,r):jo(s,t,r))){if(n||(l=t.line+r)<e.first||l>=e.first+e.size||(t=new ge(l,t.ch,t.sticky),!(s=se(e,l))))return!1;t=Xo(i,e.cm,s,t.line,r)}else t=o;return!0}if("char"==n)a();else if("column"==n)a(!0);else if("word"==n||"group"==n)for(var u=null,c="group"==n,h=e.cm&&e.cm.getHelper(t,"wordChars"),f=!0;!(r<0)||a(!f);f=!1){var d=s.text.charAt(t.ch)||"\n",p=te(d,h)?"w":c&&"\n"==d?"n":!c||/\s/.test(d)?null:"p";if(!c||f||p||(p="s"),u&&u!=p){r<0&&(r=1,a(),t.sticky="after");break}if(p&&(u=p),r>0&&!a(!f))break}var g=Zi(e,t,o,l,!0);return me(o,g)&&(g.hitSide=!0),g}function Dl(e,t,r,n){var i,o,l=e.doc,s=t.left;if("page"==n){var a=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(a-.5*Zr(e.display),3);i=(r>0?t.bottom:t.top)+r*u}else"line"==n&&(i=r>0?t.bottom+3:t.top-3);for(;(o=Xr(e,s,i)).outside;){if(r<0?i<=0:i>=l.height){o.hitSide=!0;break}i+=5*r}return o}var Hl=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new R,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Fl(e,t){var r=Mr(e,t.line);if(!r||r.hidden)return null;var n=se(e.doc,t.line),i=kr(r,n,t.line),o=Ze(n,e.doc.direction),l="left";o&&(l=qe(o,t.ch)%2?"right":"left");var s=Dr(i.map,t.ch,l);return s.offset="right"==s.collapse?s.end:s.start,s}function Pl(e,t){return t&&(e.bad=!0),e}function El(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return Pl(e.clipPos(ge(e.display.viewTo-1)),!0);t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null;if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i];if(o.node==n)return zl(o,t,r)}}function zl(e,t,r){var n=e.text.firstChild,i=!1;if(!t||!W(n,t))return Pl(ge(he(e.line),0),!0);if(t==n&&(i=!0,t=n.childNodes[r],r=0,!t)){var o=e.rest?q(e.rest):e.line;return Pl(ge(he(o),o.text.length),i)}var l=3==t.nodeType?t:null,s=t;for(l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,r&&(r=l.nodeValue.length));s.parentNode!=n;)s=s.parentNode;var a=e.measure,u=a.maps;function c(t,r,n){for(var i=-1;i<(u?u.length:0);i++)for(var o=i<0?a.map:u[i],l=0;l<o.length;l+=3){var s=o[l+2];if(s==t||s==r){var c=he(i<0?e.line:e.rest[i]),h=o[l]+n;return(n<0||s!=t)&&(h=o[l+(n?1:0)]),ge(c,h)}}}var h=c(l,s,r);if(h)return Pl(h,i);for(var f=s.nextSibling,d=l?l.nodeValue.length-r:0;f;f=f.nextSibling){if(h=c(f,f.firstChild,0))return Pl(ge(h.line,h.ch-d),i);d+=f.textContent.length}for(var p=s.previousSibling,g=r;p;p=p.previousSibling){if(h=c(p,p.firstChild,-1))return Pl(ge(h.line,h.ch+g),i);g+=p.textContent.length}}Hl.prototype.init=function(e){var t=this,r=this,n=r.cm,i=r.div=e.lineDiv;function o(e){if(!nt(n,e)){if(n.somethingSelected())Ll({lineWise:!1,text:n.getSelections()}),"cut"==e.type&&n.replaceSelection("",null,"cut");else{if(!n.options.lineWiseCopyCut)return;var t=Nl(n);Ll({lineWise:!0,text:t.text}),"cut"==e.type&&n.operation(function(){n.setSelections(t.ranges,0,V),n.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var o=Sl.text.join("\n");if(e.clipboardData.setData("Text",o),e.clipboardData.getData("Text")==o)return void e.preventDefault()}var l=Al(),s=l.firstChild;n.display.lineSpace.insertBefore(l,n.display.lineSpace.firstChild),s.value=Sl.text.join("\n");var a=document.activeElement;P(s),setTimeout(function(){n.display.lineSpace.removeChild(l),a.focus(),a==i&&r.showPrimarySelection()},50)}}Ol(i,n.options.spellcheck),Je(i,"paste",function(e){nt(n,e)||Tl(e,n)||s<=11&&setTimeout(jn(n,function(){return t.updateFromDOM()}),20)}),Je(i,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),Je(i,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),Je(i,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),Je(i,"touchstart",function(){return r.forceCompositionEnd()}),Je(i,"input",function(){t.composing||t.readFromDOMSoon()}),Je(i,"copy",o),Je(i,"cut",o)},Hl.prototype.prepareSelection=function(){var e=sn(this.cm,!1);return e.focus=this.cm.state.focused,e},Hl.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Hl.prototype.showPrimarySelection=function(){var e=window.getSelection(),t=this.cm,n=t.doc.sel.primary(),i=n.from(),o=n.to();if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||o.line<t.display.viewFrom)e.removeAllRanges();else{var l=El(t,e.anchorNode,e.anchorOffset),s=El(t,e.focusNode,e.focusOffset);if(!l||l.bad||!s||s.bad||0!=ve(we(l,s),i)||0!=ve(be(l,s),o)){var a=t.display.view,u=i.line>=t.display.viewFrom&&Fl(t,i)||{node:a[0].measure.map[2],offset:0},c=o.line<t.display.viewTo&&Fl(t,o);if(!c){var h=a[a.length-1].measure,f=h.maps?h.maps[h.maps.length-1]:h.map;c={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}if(u&&c){var d,p=e.rangeCount&&e.getRangeAt(0);try{d=k(u.node,u.offset,c.offset,c.node)}catch(e){}d&&(!r&&t.state.focused?(e.collapse(u.node,u.offset),d.collapsed||(e.removeAllRanges(),e.addRange(d))):(e.removeAllRanges(),e.addRange(d)),p&&null==e.anchorNode?e.addRange(p):r&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},Hl.prototype.startGracePeriod=function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){return e.cm.curOp.selectionChanged=!0})},20)},Hl.prototype.showMultipleSelections=function(e){N(this.cm.display.cursorDiv,e.cursors),N(this.cm.display.selectionDiv,e.selection)},Hl.prototype.rememberSelection=function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Hl.prototype.selectionInEditor=function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return W(this.div,t)},Hl.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Hl.prototype.blur=function(){this.div.blur()},Hl.prototype.getField=function(){return this.div},Hl.prototype.supportsTouch=function(){return!0},Hl.prototype.receivedFocus=function(){var e=this;this.selectionInEditor()?this.pollSelection():Kn(this.cm,function(){return e.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))})},Hl.prototype.selectionChanged=function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Hl.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;if(v&&c&&this.cm.options.gutters.length&&function(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0;return!1}(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var r=El(t,e.anchorNode,e.anchorOffset),n=El(t,e.focusNode,e.focusOffset);r&&n&&Kn(t,function(){ji(t.doc,mi(r,n),V),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}}},Hl.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var e,t,r,n=this.cm,i=n.display,o=n.doc.sel.primary(),l=o.from(),s=o.to();if(0==l.ch&&l.line>n.firstLine()&&(l=ge(l.line-1,se(n.doc,l.line-1).length)),s.ch==se(n.doc,s.line).text.length&&s.line<n.lastLine()&&(s=ge(s.line+1,0)),l.line<i.viewFrom||s.line>i.viewTo-1)return!1;l.line==i.viewFrom||0==(e=on(n,l.line))?(t=he(i.view[0].line),r=i.view[0].node):(t=he(i.view[e].line),r=i.view[e-1].node.nextSibling);var a,u,c=on(n,s.line);if(c==i.view.length-1?(a=i.viewTo-1,u=i.lineDiv.lastChild):(a=he(i.view[c+1].line)-1,u=i.view[c+1].node.previousSibling),!r)return!1;for(var h=n.doc.splitLines(function(e,t,r,n,i){var o="",l=!1,s=e.doc.lineSeparator();function a(){l&&(o+=s,l=!1)}function u(e){e&&(a(),o+=e)}function c(t){if(1==t.nodeType){var r=t.getAttribute("cm-text");if(null!=r)return void u(r||t.textContent.replace(/\u200b/g,""));var o,h=t.getAttribute("cm-marker");if(h){var f=e.findMarks(ge(n,0),ge(i+1,0),(g=+h,function(e){return e.id==g}));return void(f.length&&(o=f[0].find(0))&&u(ae(e.doc,o.from,o.to).join(s)))}if("false"==t.getAttribute("contenteditable"))return;var d=/^(pre|div|p)$/i.test(t.nodeName);d&&a();for(var p=0;p<t.childNodes.length;p++)c(t.childNodes[p]);d&&(l=!0)}else 3==t.nodeType&&u(t.nodeValue);var g}for(;c(t),t!=r;)t=t.nextSibling;return o}(n,r,u,t,a)),f=ae(n.doc,ge(t,0),ge(a,se(n.doc,a).text.length));h.length>1&&f.length>1;)if(q(h)==q(f))h.pop(),f.pop(),a--;else{if(h[0]!=f[0])break;h.shift(),f.shift(),t++}for(var d=0,p=0,g=h[0],v=f[0],m=Math.min(g.length,v.length);d<m&&g.charCodeAt(d)==v.charCodeAt(d);)++d;for(var y=q(h),b=q(f),w=Math.min(y.length-(1==h.length?d:0),b.length-(1==f.length?d:0));p<w&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;if(1==h.length&&1==f.length&&t==l.line)for(;d&&d>l.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)d--,p++;h[h.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),h[0]=h[0].slice(d).replace(/\u200b+$/,"");var x=ge(t,d),C=ge(a,f.length?q(f).length-p:0);return h.length>1||h[0]||ve(x,C)?(lo(n.doc,h,x,C,"+input"),!0):void 0},Hl.prototype.ensurePolled=function(){this.forceCompositionEnd()},Hl.prototype.reset=function(){this.forceCompositionEnd()},Hl.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Hl.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout(function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()},80))},Hl.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Kn(this.cm,function(){return _n(e.cm)})},Hl.prototype.setUneditable=function(e){e.contentEditable="false"},Hl.prototype.onKeyPress=function(e){0!=e.charCode&&(e.preventDefault(),this.cm.isReadOnly()||jn(this.cm,kl)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Hl.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Hl.prototype.onContextMenu=function(){},Hl.prototype.resetPosition=function(){},Hl.prototype.needsContentAttribute=!0;var Il,Rl,Bl,Gl=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new R,this.hasSelection=!1,this.composing=null};Gl.prototype.init=function(e){var t=this,r=this,n=this.cm,i=this.wrapper=Al(),o=this.textarea=i.firstChild;function a(e){if(!nt(n,e)){if(n.somethingSelected())Ll({lineWise:!1,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;var t=Nl(n);Ll({lineWise:!0,text:t.text}),"cut"==e.type?n.setSelections(t.ranges,null,V):(r.prevInput="",o.value=t.text.join("\n"),P(o))}"cut"==e.type&&(n.state.cutIncoming=!0)}}e.wrapper.insertBefore(i,e.wrapper.firstChild),g&&(o.style.width="0px"),Je(o,"input",function(){l&&s>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()}),Je(o,"paste",function(e){nt(n,e)||Tl(e,n)||(n.state.pasteIncoming=!0,r.fastPoll())}),Je(o,"cut",a),Je(o,"copy",a),Je(e.scroller,"paste",function(t){yr(e,t)||nt(n,t)||(n.state.pasteIncoming=!0,r.focus())}),Je(e.lineSpace,"selectstart",function(t){yr(e,t)||st(t)}),Je(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"})}}),Je(o,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Gl.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=sn(e);if(e.options.moveInputWithCursor){var i=Vr(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),l=t.lineDiv.getBoundingClientRect();n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+l.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+l.left-o.left))}return n},Gl.prototype.showSelection=function(e){var t=this.cm.display;N(t.cursorDiv,e.cursors),N(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Gl.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var r=t.getSelection();this.textarea.value=r,t.state.focused&&P(this.textarea),l&&s>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",l&&s>=9&&(this.hasSelection=null))}},Gl.prototype.getField=function(){return this.textarea},Gl.prototype.supportsTouch=function(){return!1},Gl.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!m||D()!=this.textarea))try{this.textarea.focus()}catch(e){}},Gl.prototype.blur=function(){this.textarea.blur()},Gl.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Gl.prototype.receivedFocus=function(){this.slowPoll()},Gl.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Gl.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,function r(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,r))})},Gl.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput;if(this.contextMenuPending||!t.state.focused||wt(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=r.value;if(i==n&&!t.somethingSelected())return!1;if(l&&s>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||n||(n="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var a=0,u=Math.min(n.length,i.length);a<u&&n.charCodeAt(a)==i.charCodeAt(a);)++a;return Kn(t,function(){kl(t,i.slice(a),n.length-a,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?r.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},Gl.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Gl.prototype.onKeyPress=function(){l&&s>=9&&(this.hasSelection=null),this.fastPoll()},Gl.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,i=t.textarea,o=nn(r,e),u=n.scroller.scrollTop;if(o&&!h){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(o)&&jn(r,ji)(r.doc,mi(o),V);var c=i.style.cssText,f=t.wrapper.style.cssText;t.wrapper.style.cssText="position: absolute";var d,p=t.wrapper.getBoundingClientRect();if(i.style.cssText="position: absolute; width: 30px; height: 30px;\n      top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n      z-index: 1000; background: "+(l?"rgba(255, 255, 255, .05)":"transparent")+";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",a&&(d=window.scrollY),n.input.focus(),a&&window.scrollTo(null,d),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=!0,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll),l&&s>=9&&v(),S){ct(e);var g=function(){tt(window,"mouseup",g),setTimeout(m,20)};Je(window,"mouseup",g)}else setTimeout(m,50)}function v(){if(null!=i.selectionStart){var e=r.somethingSelected(),o="​"+(e?i.value:"");i.value="⇚",i.value=o,t.prevInput=e?"":"​",i.selectionStart=1,i.selectionEnd=o.length,n.selForContextMenu=r.doc.sel}}function m(){if(t.contextMenuPending=!1,t.wrapper.style.cssText=f,i.style.cssText=c,l&&s<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=u),null!=i.selectionStart){(!l||l&&s<9)&&v();var e=0,o=function(){n.selForContextMenu==r.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&"​"==t.prevInput?jn(r,Ji)(r):e++<10?n.detectingSelectAll=setTimeout(o,500):(n.selForContextMenu=null,n.input.reset())};n.detectingSelectAll=setTimeout(o,200)}}},Gl.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Gl.prototype.setUneditable=function(){},Gl.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function r(r,n,i,o){e.defaults[r]=n,i&&(t[r]=o?function(e,t,r){r!=pl&&i(e,t,r)}:i)}e.defineOption=r,e.Init=pl,r("value","",function(e,t){return e.setValue(t)},!0),r("mode",null,function(e,t){e.doc.modeOption=t,Ci(e)},!0),r("indentUnit",2,Ci,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,function(e){Si(e),Er(e),_n(e)},!0),r("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(ge(n,o))}n++});for(var i=r.length-1;i>=0;i--)lo(e.doc,t,r[i],ge(r[i].line,r[i].ch+t.length))}}),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=pl&&e.refresh()}),r("specialCharPlaceholder",$t,function(e){return e.refresh()},!0),r("electricChars",!0),r("inputStyle",m?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),r("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),r("rtlMoveVisually",!w),r("wholeLineUpdateBefore",!0),r("theme","default",function(e){dl(e),ml(e)},!0),r("keyMap","default",function(e,t,r){var n=Uo(t),i=r!=pl&&Uo(r);i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)}),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,bl,!0),r("gutters",[],function(e){ai(e.options),ml(e)},!0),r("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?en(e.display)+"px":"0",e.refresh()},!0),r("coverGutterNextToScrollbar",!1,function(e){return Hn(e)},!0),r("scrollbarStyle","native",function(e){En(e),Hn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),r("lineNumbers",!1,function(e){ai(e.options),ml(e)},!0),r("firstLineNumber",1,ml,!0),r("lineNumberFormatter",function(e){return e},ml,!0),r("showCursorWhenSelecting",!1,ln,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("readOnly",!1,function(e,t){"nocursor"==t&&(gn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),r("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),r("dragDrop",!0,yl),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,ln,!0),r("singleCursorHeightPerLine",!0,ln,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Si,!0),r("addModeClass",!1,Si,!0),r("pollInterval",100),r("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),r("historyEventDelay",1250),r("viewportMargin",10,function(e){return e.refresh()},!0),r("maxHighlightLength",1e4,Si,!0),r("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),r("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),r("autofocus",null),r("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0)}(wl),Rl=(Il=wl).optionHandlers,Bl=Il.helpers={},Il.prototype={constructor:Il,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,Rl.hasOwnProperty(e)&&jn(this,Rl[e])(this,t,n),rt(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Uo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:Xn(function(e,t){var r=e.token?e:Il.getMode(this.options,e);if(r.startState)throw new Error("Overlays may not be stateful.");!function(e,t,r){for(var n=0,i=r(t);n<e.length&&r(e[n])<=i;)n++;e.splice(n,0,t)}(this.state.overlays,{mode:r,modeSpec:e,opaque:t&&t.opaque,priority:t&&t.priority||0},function(e){return e.priority}),this.state.modeGen++,_n(this)}),removeOverlay:Xn(function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec;if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void _n(this)}}),indentLine:Xn(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),de(this.doc,e)&&Cl(this,e,t,r)}),indentSelection:Xn(function(e){for(var t=this,r=this.doc.sel.ranges,n=-1,i=0;i<r.length;i++){var o=r[i];if(o.empty())o.head.line>n&&(Cl(t,o.head.line,e,!0),n=o.head.line,i==t.doc.sel.primIndex&&Sn(t));else{var l=o.from(),s=o.to(),a=Math.max(n,l.line);n=Math.min(t.lastLine(),s.line-(s.ch?0:1))+1;for(var u=a;u<n;++u)Cl(t,u,e);var c=t.doc.sel.ranges;0==l.ch&&r.length==c.length&&c[i].from().ch>0&&Ui(t.doc,i,new gi(l,c[i].to()),V)}}}),getTokenAt:function(e,t){return Ut(this,e,t)},getLineTokens:function(e,t){return Ut(this,ge(e),t,!0)},getTokenTypeAt:function(e){e=Ce(this.doc,e);var t,r=Et(this,se(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch;if(0==o)t=r[2];else for(;;){var l=n+i>>1;if((l?r[2*l-1]:0)>=o)i=l;else{if(!(r[2*l+1]<o)){t=r[2*l+2];break}n=l+1}}var s=t?t.indexOf("overlay "):-1;return s<0?t:0==s?null:t.slice(0,s-1)},getModeAt:function(e){var t=this.doc.mode;return t.innerMode?Il.innerMode(t,this.getTokenAt(e).state).mode:t},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var r=[];if(!Bl.hasOwnProperty(t))return r;var n=Bl[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;o<i[t].length;o++){var l=n[i[t][o]];l&&r.push(l)}else i.helperType&&n[i.helperType]?r.push(n[i.helperType]):n[i.name]&&r.push(n[i.name]);for(var s=0;s<n._global.length;s++){var a=n._global[s];a.pred(i,this)&&-1==B(r,a.val)&&r.push(a.val)}return r},getStateAfter:function(e,t){var r=this.doc;return zt(this,(e=xe(r,null==e?r.first+r.size-1:e))+1,t).state},cursorCoords:function(e,t){var r=this.doc.sel.primary();return Vr(this,null==e?r.head:"object"==typeof e?Ce(this.doc,e):e?r.from():r.to(),t||"page")},charCoords:function(e,t){return Ur(this,Ce(this.doc,e),t||"page")},coordsChar:function(e,t){return Xr(this,(e=Gr(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Gr(this,{top:e,left:0},t||"page").top,fe(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,r){var n,i=!1;if("number"==typeof e){var o=this.doc.first+this.doc.size-1;e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),n=se(this.doc,e)}else n=e;return Br(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-je(n):0)},defaultTextHeight:function(){return Zr(this.display)},defaultCharWidth:function(){return Qr(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o,l,s,a=this.display,u=(e=Vr(this,Ce(this.doc,e))).bottom,c=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),a.sizer.appendChild(t),"over"==n)u=e.top;else if("above"==n||"near"==n){var h=Math.max(a.wrapper.clientHeight,this.doc.height),f=Math.max(a.sizer.clientWidth,a.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>h)&&e.top>t.offsetHeight?u=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=h&&(u=e.bottom),c+t.offsetWidth>f&&(c=f-t.offsetWidth)}t.style.top=u+"px",t.style.left=t.style.right="","right"==i?(c=a.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?c=0:"middle"==i&&(c=(a.sizer.clientWidth-t.offsetWidth)/2),t.style.left=c+"px"),r&&(o=this,l={left:c,top:u,right:c+t.offsetWidth,bottom:u+t.offsetHeight},null!=(s=xn(o,l)).scrollTop&&Mn(o,s.scrollTop),null!=s.scrollLeft&&On(o,s.scrollLeft))},triggerOnKeyDown:Xn(rl),triggerOnKeyPress:Xn(il),triggerOnKeyUp:nl,triggerOnMouseDown:Xn(al),execCommand:function(e){if(Yo.hasOwnProperty(e))return Yo[e].call(null,this)},triggerElectric:Xn(function(e){Ml(this,e)}),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=Ce(this.doc,e),l=0;l<t&&!(o=Wl(this.doc,o,i,r,n)).hitSide;++l);return o},moveH:Xn(function(e,t){var r=this;this.extendSelectionsBy(function(n){return r.display.shift||r.doc.extend||n.empty()?Wl(r.doc,n.head,e,t,r.options.rtlMoveVisually):e<0?n.from():n.to()},j)}),deleteH:Xn(function(e,t){var r=this.doc.sel,n=this.doc;r.somethingSelected()?n.replaceSelection("",null,"+delete"):Vo(this,function(r){var i=Wl(n,r.head,e,t,!1);return e<0?{from:i,to:r.head}:{from:r.head,to:i}})}),findPosV:function(e,t,r,n){var i=1,o=n;t<0&&(i=-1,t=-t);for(var l=Ce(this.doc,e),s=0;s<t;++s){var a=Vr(this,l,"div");if(null==o?o=a.left:a.left=o,(l=Dl(this,a,i,r)).hitSide)break}return l},moveV:Xn(function(e,t){var r=this,n=this.doc,i=[],o=!this.display.shift&&!n.extend&&n.sel.somethingSelected();if(n.extendSelectionsBy(function(l){if(o)return e<0?l.from():l.to();var s=Vr(r,l.head,"div");null!=l.goalColumn&&(s.left=l.goalColumn),i.push(s.left);var a=Dl(r,s,e,t);return"page"==t&&l==n.sel.primary()&&Cn(r,Ur(r,a,"div").top-s.top),a},j),i.length)for(var l=0;l<n.sel.ranges.length;l++)n.sel.ranges[l].goalColumn=i[l]}),findWordAt:function(e){var t=se(this.doc,e.line).text,r=e.ch,n=e.ch;if(t){var i=this.getHelper(e,"wordChars");"before"!=e.sticky&&n!=t.length||!r?++n:--r;for(var o=t.charAt(r),l=te(o,i)?function(e){return te(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!te(e)};r>0&&l(t.charAt(r-1));)--r;for(;n<t.length&&l(t.charAt(n));)++n}return new gi(ge(e.line,r),ge(e.line,n))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?H(this.display.cursorDiv,"CodeMirror-overwrite"):T(this.display.cursorDiv,"CodeMirror-overwrite"),rt(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==D()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:Xn(function(e,t){Ln(this,e,t)}),getScrollInfo:function(){var e=this.display.scroller;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Cr(this)-this.display.barHeight,width:e.scrollWidth-Cr(this)-this.display.barWidth,clientHeight:Lr(this),clientWidth:Sr(this)}},scrollIntoView:Xn(function(e,t){var r,n;null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:ge(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?(n=e,kn(r=this),r.curOp.scrollToPos=n):Tn(this,e.from,e.to,e.margin)}),setSize:Xn(function(e,t){var r=this,n=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e};null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&Pr(this);var i=this.display.viewFrom;this.doc.iter(i,this.display.viewTo,function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){qn(r,i,"widget");break}++i}),this.curOp.forceUpdate=!0,rt(this,"refresh",this)}),operation:function(e){return Kn(this,e)},startOperation:function(){return In(this)},endOperation:function(){return Rn(this)},refresh:Xn(function(){var e=this.display.cachedTextHeight;_n(this),this.curOp.forceUpdate=!0,Er(this),Ln(this,this.doc.scrollLeft,this.doc.scrollTop),oi(this),(null==e||Math.abs(e-Zr(this.display))>.5)&&rn(this),rt(this,"refresh",this)}),swapDoc:Xn(function(e){var t=this.doc;return t.cm=null,Mi(this,e),Er(this),this.display.input.reset(),Ln(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,or(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}},lt(Il),Il.registerHelper=function(e,t,r){Bl.hasOwnProperty(e)||(Bl[e]=Il[e]={_global:[]}),Bl[e][t]=r},Il.registerGlobalHelper=function(e,t,r,n){Il.registerHelper(e,t,n),Bl[e]._global.push({pred:r,val:n})};var Ul,Vl="iter insert remove copy getEditor constructor".split(" ");for(var Kl in So.prototype)So.prototype.hasOwnProperty(Kl)&&B(Vl,Kl)<0&&(wl.prototype[Kl]=function(e){return function(){return e.apply(this.doc,arguments)}}(So.prototype[Kl]));return lt(So),wl.inputStyles={textarea:Gl,contenteditable:Hl},wl.defineMode=function(e){wl.defaults.mode||"null"==e||(wl.defaults.mode=e),function(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),St[e]=t}.apply(this,arguments)},wl.defineMIME=function(e,t){Lt[e]=t},wl.defineMode("null",function(){return{token:function(e){return e.skipToEnd()}}}),wl.defineMIME("text/plain","null"),wl.defineExtension=function(e,t){wl.prototype[e]=t},wl.defineDocExtension=function(e,t){So.prototype[e]=t},wl.fromTextArea=function(e,t){if((t=t?z(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var r=D();t.autofocus=r==e||null!=e.getAttribute("autofocus")&&r==document.body}function n(){e.value=s.getValue()}var i;if(e.form&&(Je(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var l=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=l}}catch(e){}}t.finishInit=function(t){t.save=n,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,n(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(tt(e.form,"submit",n),"function"==typeof e.form.submit&&(e.form.submit=i))}},e.style.display="none";var s=wl(function(t){return e.parentNode.insertBefore(t,e.nextSibling)},t);return s},(Ul=wl).off=tt,Ul.on=Je,Ul.wheelEventPixels=fi,Ul.Doc=So,Ul.splitLines=bt,Ul.countColumn=I,Ul.findColumn=X,Ul.isWordChar=ee,Ul.Pass=U,Ul.signal=rt,Ul.Line=jt,Ul.changeEnd=yi,Ul.scrollbarModel=Pn,Ul.Pos=ge,Ul.cmpPos=ve,Ul.modes=St,Ul.mimeModes=Lt,Ul.resolveMode=kt,Ul.getMode=Tt,Ul.modeExtensions=Mt,Ul.extendMode=Nt,Ul.copyState=Ot,Ul.startState=Wt,Ul.innerMode=At,Ul.commands=Yo,Ul.keyMap=Po,Ul.keyName=Go,Ul.isModifierKey=Ro,Ul.lookupKey=Io,Ul.normalizeKeyMap=zo,Ul.StringStream=Dt,Ul.SharedTextMarker=bo,Ul.TextMarker=mo,Ul.LineWidget=po,Ul.e_preventDefault=st,Ul.e_stopPropagation=at,Ul.e_stop=ct,Ul.addClass=H,Ul.contains=W,Ul.rmClass=T,Ul.keyNames=Wo,wl.version="5.35.0",wl});
\ No newline at end of file
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.CodeMirror=t()}(this,function(){"use strict";var e=navigator.userAgent,t=navigator.platform,r=/gecko\/\d/i.test(e),n=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),l=n||i||o,s=l&&(n?document.documentMode||6:+(o||i)[1]),a=!o&&/WebKit\//.test(e),u=a&&/Qt\/\d+\.\d+/.test(e),c=!o&&/Chrome\//.test(e),h=/Opera\//.test(e),f=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),g=!o&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),v=/Android/.test(e),m=g||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=g||/Mac/.test(t),b=/\bCrOS\b/.test(e),w=/win/i.test(t),x=h&&e.match(/Version\/(\d*\.\d*)/);x&&(x=Number(x[1])),x&&x>=15&&(h=!1,a=!0);var C=y&&(u||h&&(null==x||x<12.11)),S=r||l&&s>=9;function L(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var k,T=function(e,t){var r=e.className,n=L(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:"")}};function M(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function N(e,t){return M(e).appendChild(t)}function O(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;o<t.length;++o)i.appendChild(t[o]);return i}function A(e,t,r,n){var i=O(e,t,r,n);return i.setAttribute("role","presentation"),i}function D(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)}function W(){var e;try{e=document.activeElement}catch(t){e=document.body||null}for(;e&&e.shadowRoot&&e.shadowRoot.activeElement;)e=e.shadowRoot.activeElement;return e}function H(e,t){var r=e.className;L(t).test(r)||(e.className+=(r?" ":"")+t)}function F(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!L(r[n]).test(t)&&(t+=" "+r[n]);return t}k=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(e){return n}return n.collapse(!0),n.moveEnd("character",r),n.moveStart("character",t),n};var P=function(e){e.select()};function E(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function I(e,t,r){for(var n in t||(t={}),e)!e.hasOwnProperty(n)||!1===r&&t.hasOwnProperty(n)||(t[n]=e[n]);return t}function z(e,t,r,n,i){null==t&&-1==(t=e.search(/[^\s\u00a0]/))&&(t=e.length);for(var o=n||0,l=i||0;;){var s=e.indexOf("\t",o);if(s<0||s>=t)return l+(t-o);l+=s-o,l+=r-l%r,o=s+1}}g?P=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:l&&(P=function(e){try{e.select()}catch(e){}});var R=function(){this.id=null};function B(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}R.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var G=30,U={toString:function(){return"CodeMirror.Pass"}},V={scroll:!1},K={origin:"*mouse"},j={origin:"+move"};function X(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);-1==o&&(o=e.length);var l=o-n;if(o==e.length||i+l>=t)return n+Math.min(l,t-i);if(i+=o-n,n=o+1,(i+=r-i%r)>=t)return n}}var Y=[""];function _(e){for(;Y.length<=e;)Y.push($(Y)+" ");return Y[e]}function $(e){return e[e.length-1]}function q(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n);return r}function Z(){}function Q(e,t){var r;return Object.create?r=Object.create(e):(Z.prototype=e,r=new Z),t&&I(t,r),r}var J=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function ee(e){return/\w/.test(e)||e>"\80"&&(e.toUpperCase()!=e.toLowerCase()||J.test(e))}function te(e,t){return t?!!(t.source.indexOf("\\w")>-1&&ee(e))||t.test(e):ee(e)}function re(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ne=/[\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]/;function ie(e){return e.charCodeAt(0)>=768&&ne.test(e)}function oe(e,t,r){for(;(r<0?t>0:t<e.length)&&ie(e.charAt(t));)t+=r;return t}function le(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t;var i=(t+r)/2,o=n<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:r;e(o)?r=o:t=o+n}}function se(e,t){if((t-=e.first)<0||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(t<o){r=i;break}t-=o}return r.lines[t]}function ae(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 ue(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function ce(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function he(e){if(null==e.parent)return null;for(var t=e.parent,r=B(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 fe(e,t){var r=e.first;e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height;if(t<o){e=i;continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines);for(var l=0;l<e.lines.length;++l){var s=e.lines[l].height;if(t<s)break;t-=s}return r+l}function de(e,t){return t>=e.first&&t<e.first+e.size}function pe(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function ge(e,t,r){if(void 0===r&&(r=null),!(this instanceof ge))return new ge(e,t,r);this.line=e,this.ch=t,this.sticky=r}function ve(e,t){return e.line-t.line||e.ch-t.ch}function me(e,t){return e.sticky==t.sticky&&0==ve(e,t)}function ye(e){return ge(e.line,e.ch)}function be(e,t){return ve(e,t)<0?t:e}function we(e,t){return ve(e,t)<0?e:t}function xe(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function Ce(e,t){if(t.line<e.first)return ge(e.first,0);var r,n,i,o=e.first+e.size-1;return t.line>o?ge(o,se(e,o).text.length):(r=t,n=se(e,t.line).text.length,null==(i=r.ch)||i>n?ge(r.line,n):i<0?ge(r.line,0):r)}function Se(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=Ce(e,t[n]);return r}var Le=!1,ke=!1;function Te(e,t,r){this.marker=e,this.from=t,this.to=r}function Me(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r];if(n.marker==t)return n}}function Ne(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n]);return r}function Oe(e,t){if(t.full)return null;var r=de(e,t.from.line)&&se(e,t.from.line).markedSpans,n=de(e,t.to.line)&&se(e,t.to.line).markedSpans;if(!r&&!n)return null;var i=t.from.ch,o=t.to.ch,l=0==ve(t.from,t.to),s=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker;if(null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==l.type&&(!r||!o.marker.insertLeft)){var s=null==o.to||(l.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new Te(l,o.from,s?null:o.to))}}return n}(r,i,l),a=function(e,t,r){var n;if(e)for(var i=0;i<e.length;++i){var o=e[i],l=o.marker;if(null==o.to||(l.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==l.type&&(!r||o.marker.insertLeft)){var s=null==o.from||(l.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new Te(l,s?null:o.from-t,null==o.to?null:o.to-t))}}return n}(n,o,l),u=1==t.text.length,c=$(t.text).length+(u?i:0);if(s)for(var h=0;h<s.length;++h){var f=s[h];if(null==f.to){var d=Me(a,f.marker);d?u&&(f.to=null==d.to?null:d.to+c):f.to=i}}if(a)for(var p=0;p<a.length;++p){var g=a[p];if(null!=g.to&&(g.to+=c),null==g.from)Me(s,g.marker)||(g.from=c,u&&(s||(s=[])).push(g));else g.from+=c,u&&(s||(s=[])).push(g)}s&&(s=Ae(s)),a&&a!=s&&(a=Ae(a));var v=[s];if(!u){var m,y=t.text.length-2;if(y>0&&s)for(var b=0;b<s.length;++b)null==s[b].to&&(m||(m=[])).push(new Te(s[b].marker,null,null));for(var w=0;w<y;++w)v.push(m);v.push(a)}return v}function Ae(e){for(var t=0;t<e.length;++t){var r=e[t];null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function De(e){var t=e.markedSpans;if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e);e.markedSpans=null}}function We(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e);e.markedSpans=t}}function He(e){return e.inclusiveLeft?-1:0}function Fe(e){return e.inclusiveRight?1:0}function Pe(e,t){var r=e.lines.length-t.lines.length;if(0!=r)return r;var n=e.find(),i=t.find(),o=ve(n.from,i.from)||He(e)-He(t);if(o)return-o;var l=ve(n.to,i.to)||Fe(e)-Fe(t);return l||t.id-e.id}function Ee(e,t){var r,n=ke&&e.markedSpans;if(n)for(var i=void 0,o=0;o<n.length;++o)(i=n[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!r||Pe(r,i.marker)<0)&&(r=i.marker);return r}function Ie(e){return Ee(e,!0)}function ze(e){return Ee(e,!1)}function Re(e,t){var r,n=ke&&e.markedSpans;if(n)for(var i=0;i<n.length;++i){var o=n[i];o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!r||Pe(r,o.marker)<0)&&(r=o.marker)}return r}function Be(e,t,r,n,i){var o=se(e,t),l=ke&&o.markedSpans;if(l)for(var s=0;s<l.length;++s){var a=l[s];if(a.marker.collapsed){var u=a.marker.find(0),c=ve(u.from,r)||He(a.marker)-He(i),h=ve(u.to,n)||Fe(a.marker)-Fe(i);if(!(c>=0&&h<=0||c<=0&&h>=0)&&(c<=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?ve(u.to,r)>=0:ve(u.to,r)>0)||c>=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?ve(u.from,n)<=0:ve(u.from,n)<0)))return!0}}}function Ge(e){for(var t;t=Ie(e);)e=t.find(-1,!0).line;return e}function Ue(e,t){var r=se(e,t),n=Ge(r);return r==n?t:he(n)}function Ve(e,t){if(t>e.lastLine())return t;var r,n=se(e,t);if(!Ke(e,n))return t;for(;r=ze(n);)n=r.find(1,!0).line;return he(n)+1}function Ke(e,t){var r=ke&&t.markedSpans;if(r)for(var n=void 0,i=0;i<r.length;++i)if((n=r[i]).marker.collapsed){if(null==n.from)return!0;if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&je(e,t,n))return!0}}function je(e,t,r){if(null==r.to){var n=r.marker.find(1,!0);return je(e,n.line,Me(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0;for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&je(e,t,i))return!0}function Xe(e){for(var t=0,r=(e=Ge(e)).parent,n=0;n<r.lines.length;++n){var i=r.lines[n];if(i==e)break;t+=i.height}for(var o=r.parent;o;o=(r=o).parent)for(var l=0;l<o.children.length;++l){var s=o.children[l];if(s==r)break;t+=s.height}return t}function Ye(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=Ie(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=ze(n);){var o=t.find(0,!0);r-=n.text.length-o.from.ch,r+=(n=o.to.line).text.length-o.to.ch}return r}function _e(e){var t=e.display,r=e.doc;t.maxLine=se(r,r.first),t.maxLineLength=Ye(t.maxLine),t.maxLineChanged=!0,r.iter(function(e){var r=Ye(e);r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)})}var $e=null;function qe(e,t,r){var n;$e=null;for(var i=0;i<e.length;++i){var o=e[i];if(o.from<t&&o.to>t)return i;o.to==t&&(o.from!=o.to&&"before"==r?n=i:$e=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:$e=i)}return null!=n?n:$e}var Ze=function(){var e="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",t="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";var r=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,n=/[stwN]/,i=/[LRr]/,o=/[Lb1n]/,l=/[1n]/;function s(e,t,r){this.level=e,this.from=t,this.to=r}return function(a,u){var c="ltr"==u?"L":"R";if(0==a.length||"ltr"==u&&!r.test(a))return!1;for(var h,f=a.length,d=[],p=0;p<f;++p)d.push((h=a.charCodeAt(p))<=247?e.charAt(h):1424<=h&&h<=1524?"R":1536<=h&&h<=1785?t.charAt(h-1536):1774<=h&&h<=2220?"r":8192<=h&&h<=8203?"w":8204==h?"b":"L");for(var g=0,v=c;g<f;++g){var m=d[g];"m"==m?d[g]=v:v=m}for(var y=0,b=c;y<f;++y){var w=d[y];"1"==w&&"r"==b?d[y]="n":i.test(w)&&(b=w,"r"==w&&(d[y]="R"))}for(var x=1,C=d[0];x<f-1;++x){var S=d[x];"+"==S&&"1"==C&&"1"==d[x+1]?d[x]="1":","!=S||C!=d[x+1]||"1"!=C&&"n"!=C||(d[x]=C),C=S}for(var L=0;L<f;++L){var k=d[L];if(","==k)d[L]="N";else if("%"==k){var T=void 0;for(T=L+1;T<f&&"%"==d[T];++T);for(var M=L&&"!"==d[L-1]||T<f&&"1"==d[T]?"1":"N",N=L;N<T;++N)d[N]=M;L=T-1}}for(var O=0,A=c;O<f;++O){var D=d[O];"L"==A&&"1"==D?d[O]="L":i.test(D)&&(A=D)}for(var W=0;W<f;++W)if(n.test(d[W])){var H=void 0;for(H=W+1;H<f&&n.test(d[H]);++H);for(var F="L"==(W?d[W-1]:c),P=F==("L"==(H<f?d[H]:c))?F?"L":"R":c,E=W;E<H;++E)d[E]=P;W=H-1}for(var I,z=[],R=0;R<f;)if(o.test(d[R])){var B=R;for(++R;R<f&&o.test(d[R]);++R);z.push(new s(0,B,R))}else{var G=R,U=z.length;for(++R;R<f&&"L"!=d[R];++R);for(var V=G;V<R;)if(l.test(d[V])){G<V&&z.splice(U,0,new s(1,G,V));var K=V;for(++V;V<R&&l.test(d[V]);++V);z.splice(U,0,new s(2,K,V)),G=V}else++V;G<R&&z.splice(U,0,new s(1,G,R))}return"ltr"==u&&(1==z[0].level&&(I=a.match(/^\s+/))&&(z[0].from=I[0].length,z.unshift(new s(0,0,I[0].length))),1==$(z).level&&(I=a.match(/\s+$/))&&($(z).to-=I[0].length,z.push(new s(0,f-I[0].length,f)))),"rtl"==u?z.reverse():z}}();function Qe(e,t){var r=e.order;return null==r&&(r=e.order=Ze(e.text,t)),r}var Je=[],et=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1);else if(e.attachEvent)e.attachEvent("on"+t,r);else{var n=e._handlers||(e._handlers={});n[t]=(n[t]||Je).concat(r)}};function tt(e,t){return e._handlers&&e._handlers[t]||Je}function rt(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1);else if(e.detachEvent)e.detachEvent("on"+t,r);else{var n=e._handlers,i=n&&n[t];if(i){var o=B(i,r);o>-1&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function nt(e,t){var r=tt(e,t);if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function it(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),nt(e,r||t.type,e,t),ct(t)||t.codemirrorIgnore}function ot(e){var t=e._handlers&&e._handlers.cursorActivity;if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==B(r,t[n])&&r.push(t[n])}function lt(e,t){return tt(e,t).length>0}function st(e){e.prototype.on=function(e,t){et(this,e,t)},e.prototype.off=function(e,t){rt(this,e,t)}}function at(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ut(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ct(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function ht(e){at(e),ut(e)}function ft(e){return e.target||e.srcElement}function dt(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var pt,gt,vt=function(){if(l&&s<9)return!1;var e=O("div");return"draggable"in e||"dragDrop"in e}();function mt(e){if(null==pt){var t=O("span","​");N(e,O("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(pt=t.offsetWidth<=1&&t.offsetHeight>2&&!(l&&s<8))}var r=pt?O("span","​"):O("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function yt(e){if(null!=gt)return gt;var t=N(e,document.createTextNode("AخA")),r=k(t,0,1).getBoundingClientRect(),n=k(t,1,2).getBoundingClientRect();return M(e),!(!r||r.left==r.right)&&(gt=n.right-r.right<3)}var bt,wt=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),l=o.indexOf("\r");-1!=l?(r.push(o.slice(0,l)),t+=l+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},xt=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Ct="oncopy"in(bt=O("div"))||(bt.setAttribute("oncopy","return;"),"function"==typeof bt.oncopy),St=null;var Lt={},kt={};function Tt(e){if("string"==typeof e&&kt.hasOwnProperty(e))e=kt[e];else if(e&&"string"==typeof e.name&&kt.hasOwnProperty(e.name)){var t=kt[e.name];"string"==typeof t&&(t={name:t}),(e=Q(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Tt("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Tt("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Mt(e,t){t=Tt(t);var r=Lt[t.name];if(!r)return Mt(e,"text/plain");var n=r(e,t);if(Nt.hasOwnProperty(t.name)){var i=Nt[t.name];for(var o in i)i.hasOwnProperty(o)&&(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=i[o])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var l in t.modeProps)n[l]=t.modeProps[l];return n}var Nt={};function Ot(e,t){I(t,Nt.hasOwnProperty(e)?Nt[e]:Nt[e]={})}function At(e,t){if(!0===t)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}function Dt(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode;return r||{mode:e,state:t}}function Wt(e,t,r){return!e.startState||e.startState(t,r)}var Ht=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r};Ht.prototype.eol=function(){return this.pos>=this.string.length},Ht.prototype.sol=function(){return this.pos==this.lineStart},Ht.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ht.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ht.prototype.eat=function(e){var t=this.string.charAt(this.pos);if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Ht.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ht.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Ht.prototype.skipToEnd=function(){this.pos=this.string.length},Ht.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},Ht.prototype.backUp=function(e){this.pos-=e},Ht.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=z(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Ht.prototype.indentation=function(){return z(this.string,null,this.tabSize)-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Ht.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Ht.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ht.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Ht.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Ht.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var Ft=function(e,t){this.state=e,this.lookAhead=t},Pt=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1};function Et(e,t,r,n){var i=[e.state.modeGen],o={};jt(e,t.text,e.doc.mode,r,function(e,t){return i.push(e,t)},o,n);for(var l=r.state,s=function(n){r.baseTokens=i;var s=e.state.overlays[n],a=1,u=0;r.state=!0,jt(e,t.text,s.mode,r,function(e,t){for(var r=a;u<e;){var n=i[a];n>e&&i.splice(a,1,e,i[a+1],n),a+=2,u=Math.min(e,n)}if(t)if(s.opaque)i.splice(r,a-r,e,"overlay "+t),a=r+2;else for(;r<a;r+=2){var o=i[r+1];i[r+1]=(o?o+" ":"")+"overlay "+t}},o),r.state=l,r.baseTokens=null,r.baseTokenPos=1},a=0;a<e.state.overlays.length;++a)s(a);return{styles:i,classes:o.bgClass||o.textClass?o:null}}function It(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=zt(e,he(t)),i=t.text.length>e.options.maxHighlightLength&&At(e.doc.mode,n.state),o=Et(e,t,n);i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function zt(e,t,r){var n=e.doc,i=e.display;if(!n.mode.startState)return new Pt(n,!0,t);var o=function(e,t,r){for(var n,i,o=e.doc,l=r?-1:t-(e.doc.mode.innerMode?1e3:100),s=t;s>l;--s){if(s<=o.first)return o.first;var a=se(o,s-1),u=a.stateAfter;if(u&&(!r||s+(u instanceof Ft?u.lookAhead:0)<=o.modeFrontier))return s;var c=z(a.text,null,e.options.tabSize);(null==i||n>c)&&(i=s-1,n=c)}return i}(e,t,r),l=o>n.first&&se(n,o-1).stateAfter,s=l?Pt.fromSaved(n,l,o):new Pt(n,Wt(n.mode),o);return n.iter(o,t,function(r){Rt(e,r.text,s);var n=s.line;r.stateAfter=n==t-1||n%5==0||n>=i.viewFrom&&n<i.viewTo?s.save():null,s.nextLine()}),r&&(n.modeFrontier=s.line),s}function Rt(e,t,r,n){var i=e.doc.mode,o=new Ht(t,e.options.tabSize,r);for(o.start=o.pos=n||0,""==t&&Bt(i,r.state);!o.eol();)Gt(i,o,r.state),o.start=o.pos}function Bt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var r=Dt(e,t);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function Gt(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=Dt(e,r).mode);var o=e.token(t,r);if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}Pt.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},Pt.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},Pt.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Pt.fromSaved=function(e,t,r){return t instanceof Ft?new Pt(e,At(e.mode,t.state),r,t.lookAhead):new Pt(e,At(e.mode,t),r)},Pt.prototype.save=function(e){var t=!1!==e?At(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new Ft(t,this.maxLookAhead):t};var Ut=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r};function Vt(e,t,r,n){var i,o,l=e.doc,s=l.mode,a=se(l,(t=Ce(l,t)).line),u=zt(e,t.line,r),c=new Ht(a.text,e.options.tabSize,u);for(n&&(o=[]);(n||c.pos<t.ch)&&!c.eol();)c.start=c.pos,i=Gt(s,c,u.state),n&&o.push(new Ut(c,i,At(l.mode,u.state)));return n?o:new Ut(c,i,u.state)}function Kt(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!r)break;e=e.slice(0,r.index)+e.slice(r.index+r[0].length);var n=r[1]?"bgClass":"textClass";null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function jt(e,t,r,n,i,o,l){var s=r.flattenSpans;null==s&&(s=e.options.flattenSpans);var a,u=0,c=null,h=new Ht(t,e.options.tabSize,n),f=e.options.addModeClass&&[null];for(""==t&&Kt(Bt(r,n.state),o);!h.eol();){if(h.pos>e.options.maxHighlightLength?(s=!1,l&&Rt(e,t,n,h.pos),h.pos=t.length,a=null):a=Kt(Gt(r,h,n.state,f),o),f){var d=f[0].name;d&&(a="m-"+(a?d+" "+a:d))}if(!s||c!=a){for(;u<h.start;)i(u=Math.min(h.start,u+5e3),c);c=a}h.start=h.pos}for(;u<h.pos;){var p=Math.min(h.pos,u+5e3);i(p,c),u=p}}var Xt=function(e,t,r){this.text=e,We(this,t),this.height=r?r(this):1};Xt.prototype.lineNo=function(){return he(this)},st(Xt);var Yt={},_t={};function $t(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?_t:Yt;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function qt(e,t){var r=A("span",null,null,a?"padding-right: .1px":null),n={pre:A("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,l=void 0;n.pos=0,n.addToken=Qt,yt(e.display.measure)&&(l=Qe(o,e.doc.direction))&&(n.addToken=Jt(n.addToken,l)),n.map=[],tr(o,n,It(e,o,t!=e.display.externalMeasured&&he(o))),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=F(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=F(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(mt(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({}))}if(a){var s=n.content.lastChild;(/\bcm-tab\b/.test(s.className)||s.querySelector&&s.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return nt(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=F(n.pre.className,n.textClass||"")),n}function Zt(e){var t=O("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Qt(e,t,r,n,i,o,a){if(t){var u,c=e.splitSpaces?function(e,t){if(e.length>1&&!/  /.test(e))return e;for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i);" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}(t,e.trailingSpace):t,h=e.cm.state.specialChars,f=!1;if(h.test(t)){u=document.createDocumentFragment();for(var d=0;;){h.lastIndex=d;var p=h.exec(t),g=p?p.index-d:t.length-d;if(g){var v=document.createTextNode(c.slice(d,d+g));l&&s<9?u.appendChild(O("span",[v])):u.appendChild(v),e.map.push(e.pos,e.pos+g,v),e.col+=g,e.pos+=g}if(!p)break;d+=g+1;var m=void 0;if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;(m=u.appendChild(O("span",_(b),"cm-tab"))).setAttribute("role","presentation"),m.setAttribute("cm-text","\t"),e.col+=b}else"\r"==p[0]||"\n"==p[0]?((m=u.appendChild(O("span","\r"==p[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",p[0]),e.col+=1):((m=e.cm.options.specialCharPlaceholder(p[0])).setAttribute("cm-text",p[0]),l&&s<9?u.appendChild(O("span",[m])):u.appendChild(m),e.col+=1);e.map.push(e.pos,e.pos+1,m),e.pos++}}else e.col+=t.length,u=document.createTextNode(c),e.map.push(e.pos,e.pos+t.length,u),l&&s<9&&(f=!0),e.pos+=t.length;if(e.trailingSpace=32==c.charCodeAt(t.length-1),r||n||i||f||a){var w=r||"";n&&(w+=n),i&&(w+=i);var x=O("span",[u],w,a);return o&&(x.title=o),e.content.appendChild(x)}e.content.appendChild(u)}}function Jt(e,t){return function(r,n,i,o,l,s,a){i=i?i+" cm-force-border":"cm-force-border";for(var u=r.pos,c=u+n.length;;){for(var h=void 0,f=0;f<t.length&&!((h=t[f]).to>u&&h.from<=u);f++);if(h.to>=c)return e(r,n,i,o,l,s,a);e(r,n.slice(0,h.to-u),i,o,null,s,a),o=null,n=n.slice(h.to-u),u=h.to}}}function er(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,e.trailingSpace=!1}function tr(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var l,s,a,u,c,h,f,d=i.length,p=0,g=1,v="",m=0;;){if(m==p){a=u=c=h=s="",f=null,m=1/0;for(var y=[],b=void 0,w=0;w<n.length;++w){var x=n[w],C=x.marker;"bookmark"==C.type&&x.from==p&&C.widgetNode?y.push(C):x.from<=p&&(null==x.to||x.to>p||C.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&m>x.to&&(m=x.to,u=""),C.className&&(a+=" "+C.className),C.css&&(s=(s?s+";":"")+C.css),C.startStyle&&x.from==p&&(c+=" "+C.startStyle),C.endStyle&&x.to==m&&(b||(b=[])).push(C.endStyle,x.to),C.title&&!h&&(h=C.title),C.collapsed&&(!f||Pe(f.marker,C)<0)&&(f=x)):x.from>p&&m>x.from&&(m=x.from)}if(b)for(var S=0;S<b.length;S+=2)b[S+1]==m&&(u+=" "+b[S]);if(!f||f.from==p)for(var L=0;L<y.length;++L)er(t,0,y[L]);if(f&&(f.from||0)==p){if(er(t,(null==f.to?d+1:f.to)-p,f.marker,null==f.from),null==f.to)return;f.to==p&&(f=!1)}}if(p>=d)break;for(var k=Math.min(d,m);;){if(v){var T=p+v.length;if(!f){var M=T>k?v.slice(0,k-p):v;t.addToken(t,M,l?l+a:a,c,p+M.length==m?u:"",h,s)}if(T>=k){v=v.slice(k-p),p=k;break}p=T,c=""}v=i.slice(o,o=r[g++]),l=$t(r[g++],t.cm.options)}}else for(var N=1;N<r.length;N+=2)t.addToken(t,i.slice(o,o=r[N]),$t(r[N+1],t.cm.options))}function rr(e,t,r){this.line=t,this.rest=function(e){for(var t,r;t=ze(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}(t),this.size=this.rest?he($(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Ke(e,t)}function nr(e,t,r){for(var n,i=[],o=t;o<r;o=n){var l=new rr(e.doc,se(e.doc,o),o);n=o+l.size,i.push(l)}return i}var ir=null;var or=null;function lr(e,t){var r=tt(e,t);if(r.length){var n,i=Array.prototype.slice.call(arguments,2);ir?n=ir.delayedCallbacks:or?n=or:(n=or=[],setTimeout(sr,0));for(var o=function(e){n.push(function(){return r[e].apply(null,i)})},l=0;l<r.length;++l)o(l)}}function sr(){var e=or;or=null;for(var t=0;t<e.length;++t)e[t]()}function ar(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?hr(e,t):"gutter"==o?dr(e,t,r,n):"class"==o?fr(e,t):"widget"==o&&pr(e,t,n)}t.changes=null}function ur(e){return e.node==e.text&&(e.node=O("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),l&&s<8&&(e.node.style.zIndex=2)),e.node}function cr(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):qt(e,t)}function hr(e,t){var r=t.text.className,n=cr(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,fr(e,t)):r&&(t.text.className=r)}function fr(e,t){!function(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass;if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null);else if(r){var n=ur(t);t.background=n.insertBefore(O("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?ur(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="");var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass;t.text.className=r||""}function dr(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=ur(t);t.gutterBackground=O("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var l=ur(t),s=t.gutter=O("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px");if(e.display.input.setUneditable(s),l.insertBefore(s,t.text),t.line.gutterClass&&(s.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=s.appendChild(O("div",pe(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var a=0;a<e.options.gutters.length;++a){var u=e.options.gutters[a],c=o.hasOwnProperty(u)&&o[u];c&&s.appendChild(O("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[u]+"px; width: "+n.gutterWidth[u]+"px"))}}}function pr(e,t,r){t.alignable&&(t.alignable=null);for(var n=t.node.firstChild,i=void 0;n;n=i)i=n.nextSibling,"CodeMirror-linewidget"==n.className&&t.node.removeChild(n);gr(e,t,r)}function gr(e,t,r){if(vr(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)vr(e,t.rest[n],t,r,!1)}function vr(e,t,r,n,i){if(t.widgets)for(var o=ur(r),l=0,s=t.widgets;l<s.length;++l){var a=s[l],u=O("div",[a.node],"CodeMirror-linewidget");a.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),mr(a,u,r,n),e.display.input.setUneditable(u),i&&a.above?o.insertBefore(u,r.gutter||r.text):o.appendChild(u),lr(a,"redraw")}}function mr(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t);var i=n.wrapperWidth;t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function yr(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!D(document.body,e.node)){var r="position: relative;";e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),N(t.display.measure,O("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function br(e,t){for(var r=ft(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 wr(e){return e.lineSpace.offsetTop}function xr(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Cr(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=N(e.measure,O("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)};return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function Sr(e){return G-e.display.nativeBarWidth}function Lr(e){return e.display.scroller.clientWidth-Sr(e)-e.display.barWidth}function kr(e){return e.display.scroller.clientHeight-Sr(e)-e.display.barHeight}function Tr(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]};for(var i=0;i<e.rest.length;i++)if(he(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Mr(e,t,r,n){return Ar(e,Or(e,t),r,n)}function Nr(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[ln(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Or(e,t){var r=he(t),n=Nr(e,r);n&&!n.text?n=null:n&&n.changes&&(ar(e,n,r,en(e)),e.curOp.forceUpdate=!0),n||(n=function(e,t){var r=he(t=Ge(t)),n=e.display.externalMeasured=new rr(e.doc,t,r);n.lineN=r;var i=n.built=qt(e,n);return n.text=i.pre,N(e.display.lineMeasure,i.pre),n}(e,t));var i=Tr(n,t,r);return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Ar(e,t,r,n,i){t.before&&(r=-1);var o,a=r+(n||"");return t.cache.hasOwnProperty(a)?o=t.cache[a]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(!function(e,t,r){var n=e.options.lineWrapping,i=n&&Lr(e);if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[];if(n){t.measure.width=i;for(var l=t.text.firstChild.getClientRects(),s=0;s<l.length-1;s++){var a=l[s],u=l[s+1];Math.abs(a.bottom-u.bottom)>2&&o.push((a.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,r,n){var i,o=Hr(t.map,r,n),a=o.node,u=o.start,c=o.end,h=o.collapse;if(3==a.nodeType){for(var f=0;f<4;f++){for(;u&&ie(t.line.text.charAt(o.coverStart+u));)--u;for(;o.coverStart+c<o.coverEnd&&ie(t.line.text.charAt(o.coverStart+c));)++c;if((i=l&&s<9&&0==u&&c==o.coverEnd-o.coverStart?a.parentNode.getBoundingClientRect():Fr(k(a,u,c).getClientRects(),n)).left||i.right||0==u)break;c=u,u-=1,h="right"}l&&s<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=St)return St;var t=N(e,O("span","x")),r=t.getBoundingClientRect(),n=k(t,0,1).getBoundingClientRect();return St=Math.abs(r.left-n.left)>1}(e))return t;var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}(e.display.measure,i))}else{var d;u>0&&(h=n="right"),i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==n?d.length-1:0]:a.getBoundingClientRect()}if(l&&s<9&&!u&&(!i||!i.left&&!i.right)){var p=a.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+Jr(e.display),top:p.top,bottom:p.bottom}:Wr}for(var g=i.top-t.rect.top,v=i.bottom-t.rect.top,m=(g+v)/2,y=t.view.measure.heights,b=0;b<y.length-1&&!(m<y[b]);b++);var w=b?y[b-1]:0,x=y[b],C={left:("right"==h?i.right:i.left)-t.rect.left,right:("left"==h?i.left:i.right)-t.rect.left,top:w,bottom:x};i.left||i.right||(C.bogus=!0);e.options.singleCursorHeightPerLine||(C.rtop=g,C.rbottom=v);return C}(e,t,r,n)).bogus||(t.cache[a]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Dr,Wr={left:0,right:0,top:0,bottom:0};function Hr(e,t,r){for(var n,i,o,l,s,a,u=0;u<e.length;u+=3)if(s=e[u],a=e[u+1],t<s?(i=0,o=1,l="left"):t<a?o=(i=t-s)+1:(u==e.length-3||t==a&&e[u+3]>t)&&(i=(o=a-s)-1,t>=a&&(l="right")),null!=i){if(n=e[u+2],s==a&&r==(n.insertLeft?"left":"right")&&(l=r),"left"==r&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)n=e[2+(u-=3)],l="left";if("right"==r&&i==a-s)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)n=e[(u+=3)+2],l="right";break}return{node:n,start:i,end:o,collapse:l,coverStart:s,coverEnd:a}}function Fr(e,t){var r=Wr;if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var i=e.length-1;i>=0&&(r=e[i]).left==r.right;i--);return r}function Pr(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Er(e){e.display.externalMeasure=null,M(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Pr(e.display.view[t])}function Ir(e){Er(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function zr(){return c&&v?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Rr(){return c&&v?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Br(e){var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=yr(e.widgets[r]));return t}function Gr(e,t,r,n,i){if(!i){var o=Br(t);r.top+=o,r.bottom+=o}if("line"==n)return r;n||(n="local");var l=Xe(t);if("local"==n?l+=wr(e.display):l-=e.display.viewOffset,"page"==n||"window"==n){var s=e.display.lineSpace.getBoundingClientRect();l+=s.top+("window"==n?0:Rr());var a=s.left+("window"==n?0:zr());r.left+=a,r.right+=a}return r.top+=l,r.bottom+=l,r}function Ur(e,t,r){if("div"==r)return t;var n=t.left,i=t.top;if("page"==r)n-=zr(),i-=Rr();else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect();n+=o.left,i+=o.top}var l=e.display.lineSpace.getBoundingClientRect();return{left:n-l.left,top:i-l.top}}function Vr(e,t,r,n,i){return n||(n=se(e.doc,t.line)),Gr(e,n,Mr(e,n,t.ch,i),r)}function Kr(e,t,r,n,i,o){function l(t,l){var s=Ar(e,i,t,l?"right":"left",o);return l?s.left=s.right:s.right=s.left,Gr(e,n,s,r)}n=n||se(e.doc,t.line),i||(i=Or(e,n));var s=Qe(n,e.doc.direction),a=t.ch,u=t.sticky;if(a>=n.text.length?(a=n.text.length,u="before"):a<=0&&(a=0,u="after"),!s)return l("before"==u?a-1:a,"before"==u);function c(e,t,r){return l(r?e-1:e,1==s[t].level!=r)}