Code Snippets - Version 2.12.1

Version Description

(15 Nov 2018) = * Improved: CodeMirror updated to version 5.41.0 * Improved: Attempt to create database columns that might be missing after a table upgrade * Improved: Streamlined upgrade process * Fixed: Interface layout on sites using right-to-left languages * Improved: Made search box appear at top of page on mobile [#] * Updated screenshots

Download this release

Release Info

Developer bungeshea
Plugin Icon Code Snippets
Version 2.12.1
Comparing to
See all releases

Code changes from version 2.12.0 to 2.12.1

code-snippets.php CHANGED
@@ -20,7 +20,7 @@ Plugin URI: https://github.com/sheabunge/code-snippets
20
  Description: An easy, clean and simple way to add code snippets to your site. No need to edit to your theme's functions.php file again!
21
  Author: Shea Bunge
22
  Author URI: https://bungeshea.com
23
- Version: 2.12.0
24
  License: MIT
25
  License URI: license.txt
26
  Text Domain: code-snippets
@@ -42,7 +42,7 @@ if ( ! defined( 'ABSPATH' ) ) {
42
  * @since 2.0
43
  * @var string A PHP-standardized version number string
44
  */
45
- define( 'CODE_SNIPPETS_VERSION', '2.12.0' );
46
 
47
  /**
48
  * The full path to the main file of this plugin
20
  Description: An easy, clean and simple way to add code snippets to your site. No need to edit to your theme's functions.php file again!
21
  Author: Shea Bunge
22
  Author URI: https://bungeshea.com
23
+ Version: 2.12.1
24
  License: MIT
25
  License URI: license.txt
26
  Text Domain: code-snippets
42
  * @since 2.0
43
  * @var string A PHP-standardized version number string
44
  */
45
+ define( 'CODE_SNIPPETS_VERSION', '2.12.1' );
46
 
47
  /**
48
  * The full path to the main file of this plugin
css/min/_ordering.css DELETED
@@ -1 +0,0 @@
1
- .wp-list-table .ui-sortable tr{cursor:move}.wp-list-table .spo-updating tr,.wp-list-table .ui-sortable tr.inline-editor{cursor:default}.wp-list-table .ui-sortable-placeholder{outline:1px dashed #bbb;background:#f1f1f1;visibility:visible!important}.wp-list-table .ui-sortable-helper{background-color:#fff;outline:1px solid #e1e1e1}.spo-updating-row .check-column{background:url(../../../../../wp-admin/images/spinner.gif) 10px 9px no-repeat}@media print,(-webkit-min-device-pixel-ratio:1.25),(min-resolution:120dpi){.spo-updating-row .check-column{background-image:url(../../../../../wp-admin/images/spinner-2x.gif);background-size:20px 20px}}.spo-updating-row .check-column input{visibility:hidden}
 
css/min/cmthemes/darcula.css CHANGED
@@ -1 +1 @@
1
- .cm-s-darcula span.cm-meta{color:#bbb529}.cm-s-darcula span.cm-number{color:#6897bb}.cm-s-darcula span.cm-keyword{line-height:1em;font-weight:700;color:#cc7832}.cm-s-darcula span.cm-def{color:#ffc66d}.cm-s-darcula span.cm-operator,.cm-s-darcula span.cm-property,.cm-s-darcula span.cm-type,.cm-s-darcula span.cm-variable,.cm-s-darcula span.cm-variable-2,.cm-s-darcula span.cm-variable-3{color:#a9b7c6}.cm-s-darcula span.cm-string,.cm-s-darcula span.cm-string-2{color:#6a8759}.cm-s-darcula span.cm-comment{color:gray}.cm-s-darcula span.cm-link{color:#287bde}.cm-s-darcula span.cm-atom{font-weight:700;color:#cc7832}.cm-s-darcula span.cm-error{color:#bc3f3c}.cm-s-darcula span.cm-tag{color:#cc7832}.cm-s-darcula span.cm-attribute,.cm-s-darcula span.cm-qualifier{color:#6a8759}.cm-s-darcula span.cm-bracket,.cm-s-darcula span.cm-builtin{color:#a9b7c6}.cm-s-darcula.CodeMirror{background:#2b2b2b;color:#a9b7c6}.cm-s-darcula .CodeMirror-cursor{border-left:1px solid #ddd}.cm-s-darcula .CodeMirror-activeline-background{background:#3a3a3a}.cm-s-darcula div.CodeMirror-selected{background:#085a9c}.cm-s-darcula .CodeMirror-gutters{background:#484848;border-right:1px solid gray;color:#606366}.cm-s-darcula{font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif}.cm-s-darcula .CodeMirror-matchingbracket{outline:1px solid #a9b7c6;color:#ff0!important}.CodeMirror-hints{font-family:Menlo,Monaco,Consolas,'Courier New',monospace;color:#9c9e9e;background-color:#3b3e3f!important}.CodeMirror-hint-active{background-color:#494d4e!important;color:#9c9e9e!important}
1
+ .cm-s-darcula span.cm-meta{color:#bbb529}.cm-s-darcula span.cm-number{color:#6897bb}.cm-s-darcula span.cm-keyword{line-height:1em;font-weight:700;color:#cc7832}.cm-s-darcula span.cm-def{color:#ffc66d}.cm-s-darcula span.cm-operator,.cm-s-darcula span.cm-property,.cm-s-darcula span.cm-type,.cm-s-darcula span.cm-variable,.cm-s-darcula span.cm-variable-2,.cm-s-darcula span.cm-variable-3{color:#a9b7c6}.cm-s-darcula span.cm-string,.cm-s-darcula span.cm-string-2{color:#6a8759}.cm-s-darcula span.cm-comment{color:gray}.cm-s-darcula span.cm-link{color:#287bde}.cm-s-darcula span.cm-atom{font-weight:700;color:#cc7832}.cm-s-darcula span.cm-error{color:#bc3f3c}.cm-s-darcula span.cm-tag{color:#cc7832}.cm-s-darcula span.cm-attribute,.cm-s-darcula span.cm-qualifier{color:#6a8759}.cm-s-darcula span.cm-bracket,.cm-s-darcula span.cm-builtin{color:#a9b7c6}.cm-s-darcula.CodeMirror{background:#2b2b2b;color:#a9b7c6}.cm-s-darcula .CodeMirror-cursor{border-left:1px solid #ddd}.cm-s-darcula .CodeMirror-activeline-background{background:#3a3a3a}.cm-s-darcula div.CodeMirror-selected{background:#085a9c}.cm-s-darcula .CodeMirror-gutters{background:#484848;border-right:1px solid gray;color:#606366}.cm-s-darcula{font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif}.cm-s-darcula .CodeMirror-matchingbracket{background-color:#3b514d;color:#ff0!important}.CodeMirror-hints.darcula{font-family:Menlo,Monaco,Consolas,'Courier New',monospace;color:#9c9e9e;background-color:#3b3e3f!important}.CodeMirror-hints.darcula .CodeMirror-hint-active{background-color:#494d4e!important;color:#9c9e9e!important}
css/min/cmthemes/gruvbox-dark.css CHANGED
@@ -1 +1 @@
1
- .cm-s-gruvbox-dark .CodeMirror-gutters,.cm-s-gruvbox-dark.CodeMirror{background-color:#282828;color:#bdae93}.cm-s-gruvbox-dark .CodeMirror-gutters{background:#282828;border-right:0}.cm-s-gruvbox-dark .CodeMirror-linenumber{color:#7c6f64}.cm-s-gruvbox-dark .CodeMirror-cursor{border-left:1px solid #ebdbb2}.cm-s-gruvbox-dark div.CodeMirror-selected{background:#928374}.cm-s-gruvbox-dark span.cm-meta{color:olive}.cm-s-gruvbox-dark span.cm-comment{color:#928374}.cm-s-gruvbox-dark span.cm-number,span.cm-atom{color:#d3869b}.cm-s-gruvbox-dark span.cm-keyword{color:#f84934}.cm-s-gruvbox-dark span.cm-variable,.cm-s-gruvbox-dark span.cm-variable-2{color:#ebdbb2}.cm-s-gruvbox-dark span.cm-type,.cm-s-gruvbox-dark span.cm-variable-3{color:#000}.cm-s-gruvbox-dark span.cm-def,.cm-s-gruvbox-dark span.cm-operator{color:#ebdbb2}.cm-s-gruvbox-dark span.cm-string{color:#b8bb26}.cm-s-gruvbox-dark span.cm-string-2{color:#8ec07c}.cm-s-gruvbox-dark span.cm-qualifier{color:#555}.cm-s-gruvbox-dark span.cm-attribute{color:#8ec07c}.cm-s-gruvbox-dark .CodeMirror-activeline-background{background:#3c3836}.cm-s-gruvbox-dark .CodeMirror-matchingbracket{background:#928374;color:#282828!important}.cm-s-gruvbox-dark span.cm-builtin{color:#fe8019}
1
+ .cm-s-gruvbox-dark .CodeMirror-gutters,.cm-s-gruvbox-dark.CodeMirror{background-color:#282828;color:#bdae93}.cm-s-gruvbox-dark .CodeMirror-gutters{background:#282828;border-right:0}.cm-s-gruvbox-dark .CodeMirror-linenumber{color:#7c6f64}.cm-s-gruvbox-dark .CodeMirror-cursor{border-left:1px solid #ebdbb2}.cm-s-gruvbox-dark div.CodeMirror-selected{background:#928374}.cm-s-gruvbox-dark span.cm-meta{color:#83a598}.cm-s-gruvbox-dark span.cm-comment{color:#928374}.cm-s-gruvbox-dark span.cm-number,span.cm-atom{color:#d3869b}.cm-s-gruvbox-dark span.cm-keyword{color:#f84934}.cm-s-gruvbox-dark span.cm-variable,.cm-s-gruvbox-dark span.cm-variable-2{color:#ebdbb2}.cm-s-gruvbox-dark span.cm-type,.cm-s-gruvbox-dark span.cm-variable-3{color:#fabd2f}.cm-s-gruvbox-dark span.cm-callee,.cm-s-gruvbox-dark span.cm-def,.cm-s-gruvbox-dark span.cm-operator,.cm-s-gruvbox-dark span.cm-property{color:#ebdbb2}.cm-s-gruvbox-dark span.cm-string{color:#b8bb26}.cm-s-gruvbox-dark span.cm-attribute,.cm-s-gruvbox-dark span.cm-qualifier,.cm-s-gruvbox-dark span.cm-string-2{color:#8ec07c}.cm-s-gruvbox-dark .CodeMirror-activeline-background{background:#3c3836}.cm-s-gruvbox-dark .CodeMirror-matchingbracket{background:#928374;color:#282828!important}.cm-s-gruvbox-dark span.cm-builtin,.cm-s-gruvbox-dark span.cm-tag{color:#fe8019}
css/min/cmthemes/idea.css CHANGED
@@ -1 +1 @@
1
- .cm-s-idea span.cm-meta{color:olive}.cm-s-idea span.cm-number{color:#00f}.cm-s-idea span.cm-keyword{line-height:1em;font-weight:700;color:navy}.cm-s-idea span.cm-atom{font-weight:700;color:navy}.cm-s-idea span.cm-def,.cm-s-idea span.cm-operator,.cm-s-idea span.cm-property,.cm-s-idea span.cm-type,.cm-s-idea span.cm-variable,.cm-s-idea span.cm-variable-2,.cm-s-idea span.cm-variable-3{color:#000}.cm-s-idea span.cm-comment{color:gray}.cm-s-idea span.cm-string,.cm-s-idea span.cm-string-2{color:green}.cm-s-idea span.cm-qualifier{color:#555}.cm-s-idea span.cm-error{color:red}.cm-s-idea span.cm-attribute{color:#00f}.cm-s-idea span.cm-tag{color:navy}.cm-s-idea span.cm-link{color:#00f}.cm-s-idea .CodeMirror-activeline-background{background:#fffae3}.cm-s-idea span.cm-builtin{color:#30a}.cm-s-idea span.cm-bracket{color:#cc7}.cm-s-idea{font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif}.cm-s-idea .CodeMirror-matchingbracket{outline:1px solid gray;color:#000!important}.CodeMirror-hints{font-family:Menlo,Monaco,Consolas,'Courier New',monospace;color:#616569;background-color:#ebf3fd!important}.CodeMirror-hint-active{background-color:#a2b8c9!important;color:#5c6065!important}
1
+ .cm-s-idea span.cm-meta{color:olive}.cm-s-idea span.cm-number{color:#00f}.cm-s-idea span.cm-keyword{line-height:1em;font-weight:700;color:navy}.cm-s-idea span.cm-atom{font-weight:700;color:navy}.cm-s-idea span.cm-def,.cm-s-idea span.cm-operator,.cm-s-idea span.cm-property,.cm-s-idea span.cm-type,.cm-s-idea span.cm-variable,.cm-s-idea span.cm-variable-2,.cm-s-idea span.cm-variable-3{color:#000}.cm-s-idea span.cm-comment{color:gray}.cm-s-idea span.cm-string,.cm-s-idea span.cm-string-2{color:green}.cm-s-idea span.cm-qualifier{color:#555}.cm-s-idea span.cm-error{color:red}.cm-s-idea span.cm-attribute{color:#00f}.cm-s-idea span.cm-tag{color:navy}.cm-s-idea span.cm-link{color:#00f}.cm-s-idea .CodeMirror-activeline-background{background:#fffae3}.cm-s-idea span.cm-builtin{color:#30a}.cm-s-idea span.cm-bracket{color:#cc7}.cm-s-idea{font-family:Consolas,Menlo,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New,monospace,serif}.cm-s-idea .CodeMirror-matchingbracket{outline:1px solid gray;color:#000!important}.CodeMirror-hints.idea{font-family:Menlo,Monaco,Consolas,'Courier New',monospace;color:#616569;background-color:#ebf3fd!important}.CodeMirror-hints.idea .CodeMirror-hint-active{background-color:#a2b8c9!important;color:#5c6065!important}
css/min/edit-rtl.css ADDED
@@ -0,0 +1 @@
 
1
+ .form-table th{width:auto}h2{margin:25px 0 15px}h2:first-of-type{margin-top:20px}h2 label{cursor:auto}.active-snippet #title,.inactive-snippet #title{border-right-width:4px}.active-snippet #title{border-right-color:#46b450}.inactive-snippet #title{border-right-color:#dc3232}label[for=snippet_description] h3 div{position:absolute}ul.tagit{background-color:#fff!important}.submit .button{margin-left:.5em}.snippet-scope{margin-top:15px}.snippet-scope label{margin-left:30px;display:inline-block}.snippet-priority{float:left}.snippet-priority label{font-weight:700;cursor:help;font-size:1.1em;padding-left:.5em}.snippet-priority input{width:4em}.CodeMirror{width:100%;height:auto!important;border:1px solid #dfdfdf;border-radius:3px;background-color:#fff}.CodeMirror-code{outline:0;direction:ltr;text-align:left}.CodeMirror-sizer{min-height:300px!important}.CodeMirror-sizer::before{content:"<?php";color:#bbb;display:block;padding-bottom:6px}.CodeMirror-focused .cm-matchhighlight{color:#fff!important;outline:1px solid green}.cm-s-rubyblue .CodeMirror-cursor{border-left:1px solid #fff!important}
css/min/manage-rtl.css ADDED
@@ -0,0 +1 @@
 
1
+ .column-name .dashicons{font-size:16px;width:16px;height:16px}.column-name .dashicons-clock{vertical-align:middle}.active-snippet .column-name>a{font-weight:600}.column-priority input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:0 0;border:0;box-shadow:none;width:4em}.column-priority input:disabled{color:inherit}.snippets .row-actions,.snippets .snippet-name{margin-right:40px}.snippets .row-actions{position:relative;right:0}.snippet-activation-switch{position:absolute;display:inline-block;margin-top:5px;width:30px;height:17px;background-color:#ccc;transition:.4s;border-radius:34px}.snippet-activation-switch::before{content:"";height:13px;width:13px;display:inline-block;margin:1.5px 2px;background-color:#fff;transition:.4s,background-color 1000ms linear;border-radius:50%}.snippets .active-snippet .snippet-activation-switch{background-color:#2196f3}.snippets .active-snippet .snippet-activation-switch::before{-webkit-transform:translateX(-100%);transform:translateX(-100%)}.clear-filters{vertical-align:bottom}.snippets .badge{margin-right:4px;padding:3px 6px;text-decoration:none;border:medium;border-radius:2px;background:#e0e0e0;font-size:smaller;line-height:1.2}.rtl .snippets .badge{float:left}.snippets td,.snippets th{color:#000}.snippets tr{background:#fff}.snippets .row-actions{color:#ddd}.snippets .clear-filters{vertical-align:middle}.snippets tfoot th{border-top:none!important}.snippets tfoot th.check-column{padding:13px 3px 0 0}.snippets .inactive-snippet th.check-column,.snippets tfoot th.check-column,.snippets thead th.check-column{padding-right:5px}.snippets .column-description p{color:#333}.snippets .inactive-snippet a{color:#579}.snippets .active-snippet td,.snippets .active-snippet th,.snippets .inactive-snippet td,.snippets .inactive-snippet th{padding:10px 9px;border:0;box-shadow:inset 0 -1px 0 rgba(0,0,0,.1)}.snippets .active-snippet td,.snippets .active-snippet th{background-color:rgba(120,200,230,.06)}.snippets .active-snippet th.check-column{border-right:2px solid #2ea2cc}.snippets tr.active-snippet+tr.inactive-snippet td,.snippets tr.active-snippet+tr.inactive-snippet th{border-top:1px solid rgba(0,0,0,.03);box-shadow:inset 0 1px 0 rgba(0,0,0,.02),inset 0 -1px 0 #e1e1e1}.snippets #all-snippets-table a.delete:hover,.snippets #search-snippets-table a.delete:hover,.snippets a.delete:hover{border-bottom:1px solid red;color:red}#wpbody-content .snippets .column-name{white-space:nowrap}@media screen and (max-width:782px){p.search-box{float:right;position:static;position:initial;margin:0;height:auto}}
css/min/manage.css CHANGED
@@ -1 +1 @@
1
- .column-name .dashicons{font-size:16px;width:16px;height:16px}.column-name .dashicons-clock{vertical-align:middle}.active-snippet .column-name>a{font-weight:600}.column-priority input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:0 0;border:0;box-shadow:none;width:4em}.column-priority input:disabled{color:inherit}.snippets .row-actions,.snippets .snippet-name{margin-left:40px}.snippets .row-actions{position:relative;left:0}.snippet-activation-switch{position:absolute;display:inline-block;margin-top:5px;width:30px;height:17px;background-color:#ccc;transition:.4s;border-radius:34px}.snippet-activation-switch::before{content:"";height:13px;width:13px;display:inline-block;margin:1.5px 2px;background-color:#fff;transition:.4s,background-color 1000ms linear;border-radius:50%}.snippets .active-snippet .snippet-activation-switch{background-color:#2196f3}.snippets .active-snippet .snippet-activation-switch::before{-webkit-transform:translateX(100%);transform:translateX(100%)}.clear-filters{vertical-align:bottom}.snippets .badge{margin-left:4px;padding:3px 6px;text-decoration:none;border:medium;border-radius:2px;background:#e0e0e0;font-size:smaller}.snippets td,.snippets th{color:#000}.snippets tr{background:#fff}.snippets .row-actions{color:#ddd}.snippets .clear-filters{vertical-align:middle}.snippets tfoot th{border-top:none!important}.snippets tfoot th.check-column{padding:13px 0 0 3px}.snippets .inactive-snippet th.check-column,.snippets tfoot th.check-column,.snippets thead th.check-column{padding-left:5px}.snippets .column-description p{color:#333}.snippets .inactive-snippet a{color:#579}.snippets .active-snippet td,.snippets .active-snippet th,.snippets .inactive-snippet td,.snippets .inactive-snippet th{padding:10px 9px;border:0;box-shadow:inset 0 -1px 0 rgba(0,0,0,.1)}.snippets .active-snippet td,.snippets .active-snippet th{background-color:rgba(120,200,230,.06)}.snippets .active-snippet th.check-column{border-left:2px solid #2ea2cc}.snippets tr.active-snippet+tr.inactive-snippet td,.snippets tr.active-snippet+tr.inactive-snippet th{border-top:1px solid rgba(0,0,0,.03);box-shadow:inset 0 1px 0 rgba(0,0,0,.02),inset 0 -1px 0 #e1e1e1}.snippets #all-snippets-table a.delete:hover,.snippets #search-snippets-table a.delete:hover,.snippets a.delete:hover{border-bottom:1px solid red;color:red}#wpbody-content .snippets .column-name{white-space:nowrap}
1
+ .column-name .dashicons{font-size:16px;width:16px;height:16px}.column-name .dashicons-clock{vertical-align:middle}.active-snippet .column-name>a{font-weight:600}.column-priority input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:0 0;border:0;box-shadow:none;width:4em}.column-priority input:disabled{color:inherit}.snippets .row-actions,.snippets .snippet-name{margin-left:40px}.snippets .row-actions{position:relative;left:0}.snippet-activation-switch{position:absolute;display:inline-block;margin-top:5px;width:30px;height:17px;background-color:#ccc;transition:.4s;border-radius:34px}.snippet-activation-switch::before{content:"";height:13px;width:13px;display:inline-block;margin:1.5px 2px;background-color:#fff;transition:.4s,background-color 1000ms linear;border-radius:50%}.snippets .active-snippet .snippet-activation-switch{background-color:#2196f3}.snippets .active-snippet .snippet-activation-switch::before{-webkit-transform:translateX(100%);transform:translateX(100%)}.clear-filters{vertical-align:bottom}.snippets .badge{margin-left:4px;padding:3px 6px;text-decoration:none;border:medium;border-radius:2px;background:#e0e0e0;font-size:smaller;line-height:1.2}.rtl .snippets .badge{float:left}.snippets td,.snippets th{color:#000}.snippets tr{background:#fff}.snippets .row-actions{color:#ddd}.snippets .clear-filters{vertical-align:middle}.snippets tfoot th{border-top:none!important}.snippets tfoot th.check-column{padding:13px 0 0 3px}.snippets .inactive-snippet th.check-column,.snippets tfoot th.check-column,.snippets thead th.check-column{padding-left:5px}.snippets .column-description p{color:#333}.snippets .inactive-snippet a{color:#579}.snippets .active-snippet td,.snippets .active-snippet th,.snippets .inactive-snippet td,.snippets .inactive-snippet th{padding:10px 9px;border:0;box-shadow:inset 0 -1px 0 rgba(0,0,0,.1)}.snippets .active-snippet td,.snippets .active-snippet th{background-color:rgba(120,200,230,.06)}.snippets .active-snippet th.check-column{border-left:2px solid #2ea2cc}.snippets tr.active-snippet+tr.inactive-snippet td,.snippets tr.active-snippet+tr.inactive-snippet th{border-top:1px solid rgba(0,0,0,.03);box-shadow:inset 0 1px 0 rgba(0,0,0,.02),inset 0 -1px 0 #e1e1e1}.snippets #all-snippets-table a.delete:hover,.snippets #search-snippets-table a.delete:hover,.snippets a.delete:hover{border-bottom:1px solid red;color:red}#wpbody-content .snippets .column-name{white-space:nowrap}@media screen and (max-width:782px){p.search-box{float:left;position:static;position:initial;margin:0;height:auto}}
js/min/codemirror.js CHANGED
@@ -1 +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,g=/gecko\/\d/i.test(e),r=/MSIE \d/.test(e),n=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),i=/Edge\/(\d+)/.exec(e),x=r||n||i,w=x&&(r?document.documentMode||6:+(i||n)[1]),b=!i&&/WebKit\//.test(e),o=b&&/Qt\/\d+\.\d+/.test(e),l=!i&&/Chrome\//.test(e),m=/Opera\//.test(e),a=/Apple Computer/.test(navigator.vendor),s=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),c=/PhantomJS/.test(e),u=!i&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),f=/Android/.test(e),d=u||f||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),_=u||/Mac/.test(t),h=/\bCrOS\b/.test(e),p=/win/i.test(t),v=m&&e.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&15<=v&&(b=!(m=!1));var y=_&&(o||m&&(null==v||v<12.11)),k=g||x&&9<=w;function C(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var S,L=function(e,t){var r=e.className,n=C(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 T(e){for(var t=e.childNodes.length;0<t;--t)e.removeChild(e.firstChild);return e}function M(e,t){return T(e).appendChild(t)}function A(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 N(e,t,r,n){var i=A(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 O(){var t;try{t=document.activeElement}catch(e){t=document.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function W(e,t){var r=e.className;C(t).test(r)||(e.className+=(r?" ":"")+t)}function P(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!C(r[n]).test(t)&&(t+=" "+r[n]);return t}S=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 z=function(e){e.select()};function F(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function q(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 H(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||t<=s)return l+(t-o);l+=s-o,l+=r-l%r,o=s+1}}u?z=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:x&&(z=function(e){try{e.select()}catch(e){}});var E=function(){this.id=null};function I(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}E.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var B=30,R={toString:function(){return"CodeMirror.Pass"}},U={scroll:!1},j={origin:"*mouse"},G={origin:"+move"};function K(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||t<=i+l)return n+Math.min(l,t-i);if(i+=o-n,n=o+1,t<=(i+=r-i%r))return n}}var V=[""];function $(e){for(;V.length<=e;)V.push(X(V)+" ");return V[e]}function X(e){return e[e.length-1]}function Y(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 r=Object.create?Object.create(e):(Z.prototype=e,new Z),t&&q(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&&(e.toUpperCase()!=e.toLowerCase()||J.test(e))}function te(e,t){return t?!!(-1<t.source.indexOf("\\w")&&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 768<=e.charCodeAt(0)&&ne.test(e)}function oe(e,t,r){for(;(r<0?0<t:t<e.length)&&ie(e.charAt(t));)t+=r;return t}function le(e,t,r){for(var n=r<t?-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,r){var n=this;this.input=r,n.scrollbarFiller=A("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=A("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=N("div",null,"CodeMirror-code"),n.selectionDiv=A("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=A("div",null,"CodeMirror-cursors"),n.measure=A("div",null,"CodeMirror-measure"),n.lineMeasure=A("div",null,"CodeMirror-measure"),n.lineSpace=N("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var i=N("div",[n.lineSpace],"CodeMirror-lines");n.mover=A("div",[i],null,"position: relative"),n.sizer=A("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=A("div",null,null,"position: absolute; height: "+B+"px; width: 1px;"),n.gutters=A("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=A("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=A("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),x&&w<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),b||g&&d||(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,r.init(n)}function ae(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 ce(e,r,n){var i=[],o=r.line;return e.iter(r.line,n.line+1,function(e){var t=e.text;o==n.line&&(t=t.slice(0,n.ch)),o==r.line&&(t=t.slice(r.ch)),i.push(t),++o}),i}function ue(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function fe(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function de(e){if(null==e.parent)return null;for(var t=e.parent,r=I(t.lines,e),n=t.parent;n;n=(t=n).parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function he(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 pe(e,t){return t>=e.first&&t<e.first+e.size}function ge(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function me(e,t,r){if(void 0===r&&(r=null),!(this instanceof me))return new me(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 ye(e,t){return e.sticky==t.sticky&&0==ve(e,t)}function be(e){return me(e.line,e.ch)}function _e(e,t){return ve(e,t)<0?t:e}function xe(e,t){return ve(e,t)<0?e:t}function we(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ke(e,t){if(t.line<e.first)return me(e.first,0);var r,n,i,o=e.first+e.size-1;return t.line>o?me(o,ae(e,o).text.length):(n=ae(e,(r=t).line).text.length,null==(i=r.ch)||n<i?me(r.line,n):i<0?me(r.line,0):r)}function Ce(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=ke(e,t[n]);return r}var Se=!1,Le=!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 Ae(e,t){if(t.full)return null;var r=pe(e,t.from.line)&&ae(e,t.from.line).markedSpans,n=pe(e,t.to.line)&&ae(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),c=1==t.text.length,u=X(t.text).length+(c?i:0);if(s)for(var f=0;f<s.length;++f){var d=s[f];if(null==d.to){var h=Me(a,d.marker);h?c&&(d.to=null==h.to?null:h.to+u):d.to=i}}if(a)for(var p=0;p<a.length;++p){var g=a[p];if(null!=g.to&&(g.to+=u),null==g.from)Me(s,g.marker)||(g.from=u,c&&(s||(s=[])).push(g));else g.from+=u,c&&(s||(s=[])).push(g)}s&&(s=De(s)),a&&a!=s&&(a=De(a));var m=[s];if(!c){var v,y=t.text.length-2;if(0<y&&s)for(var b=0;b<s.length;++b)null==s[b].to&&(v||(v=[])).push(new Te(s[b].marker,null,null));for(var _=0;_<y;++_)m.push(v);m.push(a)}return m}function De(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 Oe(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 Pe(e){return e.inclusiveLeft?-1:0}function ze(e){return e.inclusiveRight?1:0}function Fe(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)||Pe(e)-Pe(t);if(o)return-o;var l=ve(n.to,i.to)||ze(e)-ze(t);return l||t.id-e.id}function qe(e,t){var r,n=Le&&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||Fe(r,i.marker)<0)&&(r=i.marker);return r}function He(e){return qe(e,!0)}function Ee(e){return qe(e,!1)}function Ie(e,t){var r,n=Le&&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||Fe(r,o.marker)<0)&&(r=o.marker)}return r}function Be(e,t,r,n,i){var o=ae(e,t),l=Le&&o.markedSpans;if(l)for(var s=0;s<l.length;++s){var a=l[s];if(a.marker.collapsed){var c=a.marker.find(0),u=ve(c.from,r)||Pe(a.marker)-Pe(i),f=ve(c.to,n)||ze(a.marker)-ze(i);if(!(0<=u&&f<=0||u<=0&&0<=f)&&(u<=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?0<=ve(c.to,r):0<ve(c.to,r))||0<=u&&(a.marker.inclusiveRight&&i.inclusiveLeft?ve(c.from,n)<=0:ve(c.from,n)<0)))return!0}}}function Re(e){for(var t;t=He(e);)e=t.find(-1,!0).line;return e}function Ue(e,t){var r=ae(e,t),n=Re(r);return r==n?t:de(n)}function je(e,t){if(t>e.lastLine())return t;var r,n=ae(e,t);if(!Ge(e,n))return t;for(;r=Ee(n);)n=r.find(1,!0).line;return de(n)+1}function Ge(e,t){var r=Le&&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 Ve(e){for(var t=0,r=(e=Re(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 $e(e){if(0==e.height)return 0;for(var t,r=e.text.length,n=e;t=He(n);){var i=t.find(0,!0);n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=Ee(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 Xe(e){var r=e.display,t=e.doc;r.maxLine=ae(t,t.first),r.maxLineLength=$e(r.maxLine),r.maxLineChanged=!0,t.iter(function(e){var t=$e(e);t>r.maxLineLength&&(r.maxLineLength=t,r.maxLine=e)})}var Ye=null;function Ze(e,t,r){var n;Ye=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:Ye=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:Ye=i)}return null!=n?n:Ye}var Qe=function(){var q="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",H="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";var E=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,I=/[stwN]/,B=/[LRr]/,R=/[Lb1n]/,U=/[1n]/;function j(e,t,r){this.level=e,this.from=t,this.to=r}return function(e,t){var r="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!E.test(e))return!1;for(var n,i=e.length,o=[],l=0;l<i;++l)o.push((n=e.charCodeAt(l))<=247?q.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1785?H.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":8204==n?"b":"L");for(var s=0,a=r;s<i;++s){var c=o[s];"m"==c?o[s]=a:a=c}for(var u=0,f=r;u<i;++u){var d=o[u];"1"==d&&"r"==f?o[u]="n":B.test(d)&&"r"==(f=d)&&(o[u]="R")}for(var h=1,p=o[0];h<i-1;++h){var g=o[h];"+"==g&&"1"==p&&"1"==o[h+1]?o[h]="1":","!=g||p!=o[h+1]||"1"!=p&&"n"!=p||(o[h]=p),p=g}for(var m=0;m<i;++m){var v=o[m];if(","==v)o[m]="N";else if("%"==v){var y=void 0;for(y=m+1;y<i&&"%"==o[y];++y);for(var b=m&&"!"==o[m-1]||y<i&&"1"==o[y]?"1":"N",_=m;_<y;++_)o[_]=b;m=y-1}}for(var x=0,w=r;x<i;++x){var k=o[x];"L"==w&&"1"==k?o[x]="L":B.test(k)&&(w=k)}for(var C=0;C<i;++C)if(I.test(o[C])){var S=void 0;for(S=C+1;S<i&&I.test(o[S]);++S);for(var L="L"==(C?o[C-1]:r),T=L==("L"==(S<i?o[S]:r))?L?"L":"R":r,M=C;M<S;++M)o[M]=T;C=S-1}for(var N,A=[],D=0;D<i;)if(R.test(o[D])){var O=D;for(++D;D<i&&R.test(o[D]);++D);A.push(new j(0,O,D))}else{var W=D,P=A.length;for(++D;D<i&&"L"!=o[D];++D);for(var z=W;z<D;)if(U.test(o[z])){W<z&&A.splice(P,0,new j(1,W,z));var F=z;for(++z;z<D&&U.test(o[z]);++z);A.splice(P,0,new j(2,F,z)),W=z}else++z;W<D&&A.splice(P,0,new j(1,W,D))}return"ltr"==t&&(1==A[0].level&&(N=e.match(/^\s+/))&&(A[0].from=N[0].length,A.unshift(new j(0,0,N[0].length))),1==X(A).level&&(N=e.match(/\s+$/))&&(X(A).to-=N[0].length,A.push(new j(0,i-N[0].length,i)))),"rtl"==t?A.reverse():A}}();function Je(e,t){var r=e.order;return null==r&&(r=e.order=Qe(e.text,t)),r}var et=[],tt=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]||et).concat(r)}};function rt(e,t){return e._handlers&&e._handlers[t]||et}function nt(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=I(i,r);-1<o&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function it(e,t){var r=rt(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 ot(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),it(e,r||t.type,e,t),ft(t)||t.codemirrorIgnore}function lt(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==I(r,t[n])&&r.push(t[n])}function st(e,t){return 0<rt(e,t).length}function at(e){e.prototype.on=function(e,t){tt(this,e,t)},e.prototype.off=function(e,t){nt(this,e,t)}}function ct(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ut(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ft(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function dt(e){ct(e),ut(e)}function ht(e){return e.target||e.srcElement}function pt(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),_&&e.ctrlKey&&1==t&&(t=3),t}var gt,mt,vt=function(){if(x&&w<9)return!1;var e=A("div");return"draggable"in e||"dragDrop"in e}();function yt(e){if(null==gt){var t=A("span","​");M(e,A("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(gt=t.offsetWidth<=1&&2<t.offsetHeight&&!(x&&w<8))}var r=gt?A("span","​"):A("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function bt(e){if(null!=mt)return mt;var t=M(e,document.createTextNode("AخA")),r=S(t,0,1).getBoundingClientRect(),n=S(t,1,2).getBoundingClientRect();return T(e),!(!r||r.left==r.right)&&(mt=n.right-r.right<3)}var _t,xt=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)},kt="oncopy"in(_t=A("div"))||(_t.setAttribute("oncopy","return;"),"function"==typeof _t.oncopy),Ct=null;var St={},Lt={};function Tt(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 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=St[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 At(e,t){q(t,Nt.hasOwnProperty(e)?Nt[e]:Nt[e]={})}function Dt(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 Ot(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 Pt=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};Pt.prototype.eol=function(){return this.pos>=this.string.length},Pt.prototype.sol=function(){return this.pos==this.lineStart},Pt.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Pt.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Pt.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},Pt.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Pt.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Pt.prototype.skipToEnd=function(){this.pos=this.string.length},Pt.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(-1<t)return this.pos=t,!0},Pt.prototype.backUp=function(e){this.pos-=e},Pt.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=H(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.indentation=function(){return H(this.string,null,this.tabSize)-(this.lineStart?H(this.string,this.lineStart,this.tabSize):0)},Pt.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&0<n.index?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},Pt.prototype.current=function(){return this.string.slice(this.start,this.pos)},Pt.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Pt.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Pt.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var zt=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 qt(t,r,n,e){var a=[t.state.modeGen],i={};Kt(t,r.text,t.doc.mode,n,function(e,t){return a.push(e,t)},i,e);for(var c=n.state,o=function(e){n.baseTokens=a;var o=t.state.overlays[e],l=1,s=0;n.state=!0,Kt(t,r.text,o.mode,n,function(e,t){for(var r=l;s<e;){var n=a[l];e<n&&a.splice(l,1,e,a[l+1],n),l+=2,s=Math.min(e,n)}if(t)if(o.opaque)a.splice(r,l-r,e,"overlay "+t),l=r+2;else for(;r<l;r+=2){var i=a[r+1];a[r+1]=(i?i+" ":"")+"overlay "+t}},i),n.state=c,n.baseTokens=null,n.baseTokenPos=1},l=0;l<t.state.overlays.length;++l)o(l);return{styles:a,classes:i.bgClass||i.textClass?i:null}}function Ht(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=Et(e,de(t)),i=t.text.length>e.options.maxHighlightLength&&Dt(e.doc.mode,n.state),o=qt(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 Et(r,n,e){var t=r.doc,i=r.display;if(!t.mode.startState)return new Ft(t,!0,n);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;l<s;--s){if(s<=o.first)return o.first;var a=ae(o,s-1),c=a.stateAfter;if(c&&(!r||s+(c instanceof zt?c.lookAhead:0)<=o.modeFrontier))return s;var u=H(a.text,null,e.options.tabSize);(null==i||u<n)&&(i=s-1,n=u)}return i}(r,n,e),l=o>t.first&&ae(t,o-1).stateAfter,s=l?Ft.fromSaved(t,l,o):new Ft(t,Wt(t.mode),o);return t.iter(o,n,function(e){It(r,e.text,s);var t=s.line;e.stateAfter=t==n-1||t%5==0||t>=i.viewFrom&&t<i.viewTo?s.save():null,s.nextLine()}),e&&(t.modeFrontier=s.line),s}function It(e,t,r,n){var i=e.doc.mode,o=new Pt(t,e.options.tabSize,r);for(o.start=o.pos=n||0,""==t&&Bt(i,r.state);!o.eol();)Rt(i,o,r.state),o.start=o.pos}function Bt(e,t){if(e.blankLine)return e.blankLine(t);if(e.innerMode){var r=Ot(e,t);return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function Rt(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=Ot(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++,0<this.maxLookAhead&&this.maxLookAhead--},Ft.fromSaved=function(e,t,r){return t instanceof zt?new Ft(e,Dt(e.mode,t.state),r,t.lookAhead):new Ft(e,Dt(e.mode,t),r)},Ft.prototype.save=function(e){var t=!1!==e?Dt(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new zt(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 jt(e,t,r,n){var i,o,l=e.doc,s=l.mode,a=ae(l,(t=ke(l,t)).line),c=Et(e,t.line,r),u=new Pt(a.text,e.options.tabSize,c);for(n&&(o=[]);(n||u.pos<t.ch)&&!u.eol();)u.start=u.pos,i=Rt(s,u,c.state),n&&o.push(new Ut(u,i,Dt(l.mode,c.state)));return n?o:new Ut(u,i,c.state)}function Gt(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,c=0,u=null,f=new Pt(t,e.options.tabSize,n),d=e.options.addModeClass&&[null];for(""==t&&Gt(Bt(r,n.state),o);!f.eol();){if(a=f.pos>e.options.maxHighlightLength?(s=!1,l&&It(e,t,n,f.pos),f.pos=t.length,null):Gt(Rt(r,f,n.state,d),o),d){var h=d[0].name;h&&(a="m-"+(a?h+" "+a:h))}if(!s||u!=a){for(;c<f.start;)i(c=Math.min(f.start,c+5e3),u);u=a}f.start=f.pos}for(;c<f.pos;){var p=Math.min(f.pos,c+5e3);i(p,u),c=p}}var Vt=function(e,t,r){this.text=e,We(this,t),this.height=r?r(this):1};Vt.prototype.lineNo=function(){return de(this)},at(Vt);var $t={},Xt={};function Yt(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Xt:$t;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Zt(e,t){var r=N("span",null,null,b?"padding-right: .1px":null),n={pre:N("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:(x||b)&&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=Jt,bt(e.display.measure)&&(l=Je(o,e.doc.direction))&&(n.addToken=er(n.addToken,l)),n.map=[],rr(o,n,Ht(e,o,t!=e.display.externalMeasured&&de(o))),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=P(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=P(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(yt(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(b){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 it(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=P(n.pre.className,n.textClass||"")),n}function Qt(e){var t=A("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Jt(e,t,r,n,i,o,l){if(t){var s,a=e.splitSpaces?function(e,t){if(1<e.length&&!/ /.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,c=e.cm.state.specialChars,u=!1;if(c.test(t)){s=document.createDocumentFragment();for(var f=0;;){c.lastIndex=f;var d=c.exec(t),h=d?d.index-f:t.length-f;if(h){var p=document.createTextNode(a.slice(f,f+h));x&&w<9?s.appendChild(A("span",[p])):s.appendChild(p),e.map.push(e.pos,e.pos+h,p),e.col+=h,e.pos+=h}if(!d)break;f+=h+1;var g=void 0;if("\t"==d[0]){var m=e.cm.options.tabSize,v=m-e.col%m;(g=s.appendChild(A("span",$(v),"cm-tab"))).setAttribute("role","presentation"),g.setAttribute("cm-text","\t"),e.col+=v}else"\r"==d[0]||"\n"==d[0]?(g=s.appendChild(A("span","\r"==d[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",d[0]):((g=e.cm.options.specialCharPlaceholder(d[0])).setAttribute("cm-text",d[0]),x&&w<9?s.appendChild(A("span",[g])):s.appendChild(g)),e.col+=1;e.map.push(e.pos,e.pos+1,g),e.pos++}}else e.col+=t.length,s=document.createTextNode(a),e.map.push(e.pos,e.pos+t.length,s),x&&w<9&&(u=!0),e.pos+=t.length;if(e.trailingSpace=32==a.charCodeAt(t.length-1),r||n||i||u||l){var y=r||"";n&&(y+=n),i&&(y+=i);var b=A("span",[s],y,l);return o&&(b.title=o),e.content.appendChild(b)}e.content.appendChild(s)}}function er(f,d){return function(e,t,r,n,i,o,l){r=r?r+" cm-force-border":"cm-force-border";for(var s=e.pos,a=s+t.length;;){for(var c=void 0,u=0;u<d.length&&!((c=d[u]).to>s&&c.from<=s);u++);if(c.to>=a)return f(e,t,r,n,i,o,l);f(e,t.slice(0,c.to-s),r,n,null,o,l),n=null,t=t.slice(c.to-s),s=c.to}}}function tr(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 rr(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var l,s,a,c,u,f,d,h=i.length,p=0,g=1,m="",v=0;;){if(v==p){a=c=u=f=s="",d=null,v=1/0;for(var y=[],b=void 0,_=0;_<n.length;++_){var x=n[_],w=x.marker;"bookmark"==w.type&&x.from==p&&w.widgetNode?y.push(w):x.from<=p&&(null==x.to||x.to>p||w.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),w.className&&(a+=" "+w.className),w.css&&(s=(s?s+";":"")+w.css),w.startStyle&&x.from==p&&(u+=" "+w.startStyle),w.endStyle&&x.to==v&&(b||(b=[])).push(w.endStyle,x.to),w.title&&!f&&(f=w.title),w.collapsed&&(!d||Fe(d.marker,w)<0)&&(d=x)):x.from>p&&v>x.from&&(v=x.from)}if(b)for(var k=0;k<b.length;k+=2)b[k+1]==v&&(c+=" "+b[k]);if(!d||d.from==p)for(var C=0;C<y.length;++C)tr(t,0,y[C]);if(d&&(d.from||0)==p){if(tr(t,(null==d.to?h+1:d.to)-p,d.marker,null==d.from),null==d.to)return;d.to==p&&(d=!1)}}if(h<=p)break;for(var S=Math.min(h,v);;){if(m){var L=p+m.length;if(!d){var T=S<L?m.slice(0,S-p):m;t.addToken(t,T,l?l+a:a,u,p+T.length==v?c:"",f,s)}if(S<=L){m=m.slice(S-p),p=S;break}p=L,u=""}m=i.slice(o,o=r[g++]),l=Yt(r[g++],t.cm.options)}}else for(var M=1;M<r.length;M+=2)t.addToken(t,i.slice(o,o=r[M]),Yt(r[M+1],t.cm.options))}function nr(e,t,r){this.line=t,this.rest=function(e){for(var t,r;t=Ee(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}(t),this.size=this.rest?de(X(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Ge(e,t)}function ir(e,t,r){for(var n,i=[],o=t;o<r;o=n){var l=new nr(e.doc,ae(e.doc,o),o);n=o+l.size,i.push(l)}return i}var or=null;var lr=null;function sr(e,t){var r=rt(e,t);if(r.length){var n,i=Array.prototype.slice.call(arguments,2);or?n=or.delayedCallbacks:lr?n=lr:(n=lr=[],setTimeout(ar,0));for(var o=function(e){n.push(function(){return r[e].apply(null,i)})},l=0;l<r.length;++l)o(l)}}function ar(){var e=lr;lr=null;for(var t=0;t<e.length;++t)e[t]()}function cr(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?dr(e,t):"gutter"==o?pr(e,t,r,n):"class"==o?hr(e,t):"widget"==o&&gr(e,t,n)}t.changes=null}function ur(e){return e.node==e.text&&(e.node=A("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),x&&w<8&&(e.node.style.zIndex=2)),e.node}function fr(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Zt(e,t)}function dr(e,t){var r=t.text.className,n=fr(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=ur(t);t.background=n.insertBefore(A("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 pr(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=A("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=A("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(A("div",ge(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 c=e.options.gutters[a],u=o.hasOwnProperty(c)&&o[c];u&&s.appendChild(A("div",[u],"CodeMirror-gutter-elt","left: "+n.gutterLeft[c]+"px; width: "+n.gutterWidth[c]+"px"))}}}function gr(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);mr(e,t,r)}function mr(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],c=A("div",[a.node],"CodeMirror-linewidget");a.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),yr(a,c,r,n),e.display.input.setUneditable(c),i&&a.above?o.insertBefore(c,r.gutter||r.text):o.appendChild(c),sr(a,"redraw")}}function yr(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 br(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;"),M(t.display.measure,A("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function _r(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 xr(e){return e.lineSpace.offsetTop}function wr(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function kr(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=M(e.measure,A("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 B-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 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(de(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Mr(e,t,r,n){return Dr(e,Ar(e,t),r,n)}function Nr(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[sn(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Ar(e,t){var r=de(t),n=Nr(e,r);n&&!n.text?n=null:n&&n.changes&&(cr(e,n,r,tn(e)),e.curOp.forceUpdate=!0),n||(n=function(e,t){var r=de(t=Re(t)),n=e.display.externalMeasured=new nr(e.doc,t,r);n.lineN=r;var i=n.built=Zt(e,n);return n.text=i.pre,M(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 Dr(e,t,r,n,i){t.before&&(r=-1);var o,l=r+(n||"");return t.cache.hasOwnProperty(l)?o=t.cache[l]:(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],c=l[s+1];2<Math.abs(a.bottom-c.bottom)&&o.push((a.bottom+c.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=Pr(t.map,r,n),l=o.node,s=o.start,a=o.end,c=o.collapse;if(3==l.nodeType){for(var u=0;u<4;u++){for(;s&&ie(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+a<o.coverEnd&&ie(t.line.text.charAt(o.coverStart+a));)++a;if((i=x&&w<9&&0==s&&a==o.coverEnd-o.coverStart?l.parentNode.getBoundingClientRect():zr(S(l,s,a).getClientRects(),n)).left||i.right||0==s)break;a=s,s-=1,c="right"}x&&w<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=Ct)return Ct;var t=M(e,A("span","x")),r=t.getBoundingClientRect(),n=S(t,0,1).getBoundingClientRect();return Ct=1<Math.abs(r.left-n.left)}(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 f;0<s&&(c=n="right"),i=e.options.lineWrapping&&1<(f=l.getClientRects()).length?f["right"==n?f.length-1:0]:l.getBoundingClientRect()}if(x&&w<9&&!s&&(!i||!i.left&&!i.right)){var d=l.parentNode.getClientRects()[0];i=d?{left:d.left,right:d.left+en(e.display),top:d.top,bottom:d.bottom}:Wr}for(var h=i.top-t.rect.top,p=i.bottom-t.rect.top,g=(h+p)/2,m=t.view.measure.heights,v=0;v<m.length-1&&!(g<m[v]);v++);var y=v?m[v-1]:0,b=m[v],_={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:y,bottom:b};i.left||i.right||(_.bogus=!0);e.options.singleCursorHeightPerLine||(_.rtop=h,_.rbottom=p);return _}(e,t,r,n)).bogus||(t.cache[l]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Or,Wr={left:0,right:0,top:0,bottom:0};function Pr(e,t,r){for(var n,i,o,l,s,a,c=0;c<e.length;c+=3)if(s=e[c],a=e[c+1],t<s?(i=0,o=1,l="left"):t<a?o=(i=t-s)+1:(c==e.length-3||t==a&&e[c+3]>t)&&(i=(o=a-s)-1,a<=t&&(l="right")),null!=i){if(n=e[c+2],s==a&&r==(n.insertLeft?"left":"right")&&(l=r),"left"==r&&0==i)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)n=e[2+(c-=3)],l="left";if("right"==r&&i==a-s)for(;c<e.length-3&&e[c+3]==e[c+4]&&!e[c+5].insertLeft;)n=e[(c+=3)+2],l="right";break}return{node:n,start:i,end:o,collapse:l,coverStart:s,coverEnd:a}}function zr(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;0<=i&&(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 qr(e){e.display.externalMeasure=null,T(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Fr(e.display.view[t])}function Hr(e){qr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Er(){return l&&f?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Ir(){return l&&f?-(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+=br(e.widgets[r]));return t}function Rr(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=Ve(t);if("local"==n?l+=xr(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:Er());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-=Er(),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 jr(e,t,r,n,i){return n||(n=ae(e.doc,t.line)),Rr(e,n,Mr(e,n,t.ch,i),r)}function Gr(n,e,i,o,l,s){function a(e,t){var r=Dr(n,l,e,t?"right":"left",s);return t?r.left=r.right:r.right=r.left,Rr(n,o,r,i)}o=o||ae(n.doc,e.line),l||(l=Ar(n,o));var c=Je(o,n.doc.direction),t=e.ch,r=e.sticky;if(t>=o.text.length?(t=o.text.length,r="before"):t<=0&&(t=0,r="after"),!c)return a("before"==r?t-1:t,"before"==r);function u(e,t,r){return a(r?e-1:e,1==c[t].level!=r)}var f=Ze(c,t,r),d=Ye,h=u(t,f,"before"==r);return null!=d&&(h.other=u(t,d,"before"!=r)),h}function Kr(e,t){var r=0;t=ke(e.doc,t),e.options.lineWrapping||(r=en(e.display)*t.ch);var n=ae(e.doc,t.line),i=Ve(n)+xr(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function Vr(e,t,r,n,i){var o=me(e,t,r);return o.xRel=i,n&&(o.outside=!0),o}function $r(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return Vr(n.first,0,null,!0,-1);var i=he(n,r),o=n.first+n.size-1;if(o<i)return Vr(n.first+n.size-1,ae(n,o).text.length,null,!0,1);t<0&&(t=0);for(var l=ae(n,i);;){var s=Qr(e,l,i,t,r),a=Ie(l,s.ch+(0<s.xRel?1:0));if(!a)return s;var c=a.find(1);if(c.line==i)return c;l=ae(n,i=c.line)}}function Xr(t,e,r,n){n-=Br(e);var i=e.text.length,o=le(function(e){return Dr(t,r,e-1).bottom<=n},i,0);return{begin:o,end:i=le(function(e){return Dr(t,r,e).top>n},o,i)}}function Yr(e,t,r,n){return r||(r=Ar(e,t)),Xr(e,t,r,Rr(e,t,Dr(e,r,n),"line").top)}function Zr(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function Qr(r,e,t,n,i){i-=Ve(e);var o=Ar(r,e),l=Br(e),s=0,a=e.text.length,c=!0,u=Je(e,r.doc.direction);if(u){var f=(r.options.lineWrapping?function(e,t,r,n,i,o,l){var s=Xr(e,t,n,l),a=s.begin,c=s.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var u=null,f=null,d=0;d<i.length;d++){var h=i[d];if(!(h.from>=c||h.to<=a)){var p=1!=h.level,g=Dr(e,n,p?Math.min(c,h.to)-1:Math.max(a,h.from)).right,m=g<o?o-g+1e9:g-o;(!u||m<f)&&(u=h,f=m)}}u||(u=i[i.length-1]);u.from<a&&(u={from:a,to:u.to,level:u.level});u.to>c&&(u={from:u.from,to:c,level:u.level});return u}:function(n,i,o,l,s,a,c){var e=le(function(e){var t=s[e],r=1!=t.level;return Zr(Gr(n,me(o,r?t.to:t.from,r?"before":"after"),"line",i,l),a,c,!0)},0,s.length-1),t=s[e];if(0<e){var r=1!=t.level,u=Gr(n,me(o,r?t.from:t.to,r?"after":"before"),"line",i,l);Zr(u,a,c,!0)&&u.top>c&&(t=s[e-1])}return t})(r,e,t,o,u,n,i);s=(c=1!=f.level)?f.from:f.to-1,a=c?f.to:f.from-1}var d,h,p=null,g=null,m=le(function(e){var t=Dr(r,o,e);return t.top+=l,t.bottom+=l,!!Zr(t,n,i,!1)&&(t.top<=i&&t.left<=n&&(p=e,g=t),!0)},s,a),v=!1;if(g){var y=n-g.left<g.right-n,b=y==c;m=p+(b?0:1),h=b?"after":"before",d=y?g.left:g.right}else{c||m!=a&&m!=s||m++,h=0==m?"after":m==e.text.length?"before":Dr(r,o,m-(c?1:0)).bottom+l<=i==c?"after":"before";var _=Gr(r,me(t,m,h),"line",e,o);d=_.left,v=i<_.top||i>=_.bottom}return Vr(t,m=oe(e.text,m,1),h,v,n-d)}function Jr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Or){Or=A("pre");for(var t=0;t<49;++t)Or.appendChild(document.createTextNode("x")),Or.appendChild(A("br"));Or.appendChild(document.createTextNode("x"))}M(e.measure,Or);var r=Or.offsetHeight/50;return 3<r&&(e.cachedTextHeight=r),T(e.measure),r||1}function en(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=A("span","xxxxxxxxxx"),r=A("pre",[t]);M(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return 2<i&&(e.cachedCharWidth=i),i||10}function tn(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:rn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function rn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function nn(n){var i=Jr(n.display),o=n.options.lineWrapping,l=o&&Math.max(5,n.display.scroller.clientWidth/en(n.display)-3);return function(e){if(Ge(n.doc,e))return 0;var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;r++)e.widgets[r].height&&(t+=e.widgets[r].height);return o?t+(Math.ceil(e.text.length/l)||1)*i:t+i}}function on(e){var t=e.doc,r=nn(e);t.iter(function(e){var t=r(e);t!=e.height&&fe(e,t)})}function ln(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,c=$r(e,o,l);if(n&&1==c.xRel&&(a=ae(e.doc,c.line).text).length==c.ch){var u=H(a,a.length,e.options.tabSize)-a.length;c=me(c.line,Math.max(0,Math.round((o-kr(e.display).left)/en(e.display))-u))}return c}function sn(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 an(e){e.display.input.showSelection(e.display.input.prepareSelection())}function cn(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)&&un(e,s.head,i),a||dn(e,s,o)}}return n}function un(e,t,r){var n=Gr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(A("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(A("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 fn(e,t){return e.top-t.top||e.left-t.left}function dn(l,e,t){var r=l.display,n=l.doc,i=document.createDocumentFragment(),o=kr(l.display),L=o.left,T=Math.max(r.sizerWidth,Sr(l)-r.sizer.offsetLeft)-o.right,M="ltr"==n.direction;function N(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),i.appendChild(A("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==r?T-e:r)+"px;\n height: "+(n-t)+"px"))}function s(r,y,b){var _,x,o=ae(n,r),w=o.text.length;function k(e,t){return jr(l,me(r,e),"div",o,t)}function C(e,t,r){var n=Yr(l,o,null,e),i="ltr"==t==("after"==r)?"left":"right";return k("after"==r?n.begin:n.end-(/\s/.test(o.text.charAt(n.end-1))?2:1),i)[i]}var S=Je(o,n.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")}(S,y||0,null==b?w:b,function(e,t,r,n){var i="ltr"==r,o=k(e,i?"left":"right"),l=k(t-1,i?"right":"left"),s=null==y&&0==e,a=null==b&&t==w,c=0==n,u=!S||n==S.length-1;if(l.top-o.top<=3){var f=(M?a:s)&&u,d=(M?s:a)&&c?L:(i?o:l).left,h=f?T:(i?l:o).right;N(d,o.top,h-d,o.bottom)}else{var p,g,m,v;v=i?(p=M&&s&&c?L:o.left,g=M?T:C(e,r,"before"),m=M?L:C(t,r,"after"),M&&a&&u?T:l.right):(p=M?C(e,r,"before"):L,g=!M&&s&&c?T:o.right,m=!M&&a&&u?L:l.left,M?C(t,r,"after"):T),N(p,o.top,g-p,o.bottom),o.bottom<l.top&&N(L,o.bottom,null,l.top),N(m,l.top,v-m,l.bottom)}(!_||fn(o,_)<0)&&(_=o),fn(l,_)<0&&(_=l),(!x||fn(o,x)<0)&&(x=o),fn(l,x)<0&&(x=l)}),{start:_,end:x}}var a=e.from(),c=e.to();if(a.line==c.line)s(a.line,a.ch,c.ch);else{var u=ae(n,a.line),f=ae(n,c.line),d=Re(u)==Re(f),h=s(a.line,a.ch,d?u.text.length+1:null).end,p=s(c.line,d?0:null,c.ch).start;d&&(h.top<p.top-2?(N(h.right,h.top,null,h.bottom),N(L,p.top,p.left,p.bottom)):N(h.right,h.top,p.left-h.right,h.bottom)),h.bottom<p.top&&N(L,h.bottom,null,p.top)}t.appendChild(i)}function hn(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",0<e.options.cursorBlinkRate?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 pn(e){e.state.focused||(e.display.input.focus(),mn(e))}function gn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,vn(e))},100)}function mn(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(it(e,"focus",e,t),e.state.focused=!0,W(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),b&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),hn(e))}function vn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(it(e,"blur",e,t),e.state.focused=!1,L(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function yn(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(x&&w<8){var l=i.node.offsetTop+i.node.offsetHeight;o=l-r,r=l}else{var s=i.node.getBoundingClientRect();o=s.bottom-s.top}var a=i.line.height-o;if(o<2&&(o=Jr(t)),(.005<a||a<-.005)&&(fe(i.line,o),bn(i.line),i.rest))for(var c=0;c<i.rest.length;c++)bn(i.rest[c])}}}function bn(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 _n(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-xr(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=he(t,n),l=he(t,i);if(r&&r.ensure){var s=r.ensure.from.line,a=r.ensure.to.line;s<o?l=he(t,Ve(ae(t,o=s))+e.wrapper.clientHeight):Math.min(a,t.lastLine())>=l&&(o=he(t,Ve(ae(t,a))-e.wrapper.clientHeight),l=a)}return{from:o,to:Math.max(l,o+1)}}function xn(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=rn(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=ge(e.options,t.first+t.size-1),n=e.display;if(r.length==n.lineNumChars)return!1;var i=n.measure.appendChild(A("div",[A("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",si(e),!0}function kn(e,t){var r=e.display,n=Jr(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,c=t.bottom>s-n;if(t.top<i)l.scrollTop=a?0:t.top;else if(t.bottom>i+o){var u=Math.min(t.top,(c?s:t.bottom)-o);u!=i&&(l.scrollTop=u)}var f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft,d=Sr(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0),h=t.right-t.left>d;return h&&(t.right=t.left+d),t.left<10?l.scrollLeft=0:t.left<f?l.scrollLeft=Math.max(0,t.left-(h?0:10)):t.right>d+f-3&&(l.scrollLeft=t.right+(h?0:10)-d),l}function Cn(e,t){null!=t&&(Tn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Sn(e){Tn(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||Tn(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function Tn(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Mn(e,Kr(e,t.from),Kr(e,t.to),t.margin))}function Mn(e,t,r,n){var i=kn(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 Nn(e,t){Math.abs(e.doc.scrollTop-t)<2||(g||li(e,{top:t}),An(e,t,!0),g&&li(e),ti(e,100))}function An(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 Dn(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,xn(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function On(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=A("div",[A("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=A("div",[A("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),tt(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),tt(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,x&&w<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&&0<e.clientHeight&&(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=_&&!s?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new E,this.disableVert=new E},Wn.prototype.enableZeroWidthBar=function(r,n,i){r.style.pointerEvents="auto",n.set(1e3,function e(){var t=r.getBoundingClientRect();("vert"==i?document.elementFromPoint(t.right-1,(t.top+t.bottom)/2):document.elementFromPoint((t.right+t.left)/2,t.bottom-1))!=r?r.style.pointerEvents="none":n.set(1e3,e)})},Wn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Pn=function(){};function zn(e,t){t||(t=On(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&&yn(e),Fn(e,On(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=""}Pn.prototype.update=function(){return{bottom:0,right:0}},Pn.prototype.setScrollLeft=function(){},Pn.prototype.setScrollTop=function(){},Pn.prototype.clear=function(){};var qn={native:Wn,null:Pn};function Hn(r){r.display.scrollbars&&(r.display.scrollbars.clear(),r.display.scrollbars.addClass&&L(r.display.wrapper,r.display.scrollbars.addClass)),r.display.scrollbars=new qn[r.options.scrollbarStyle](function(e){r.display.wrapper.insertBefore(e,r.display.scrollbarFiller),tt(e,"mousedown",function(){r.state.focused&&setTimeout(function(){return r.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,t){"horizontal"==t?Dn(r,e):Nn(r,e)},r),r.display.scrollbars.addClass&&W(r.display.wrapper,r.display.scrollbars.addClass)}var En=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:++En},t=e.curOp,or?or.ops.push(t):t.ownsGroup=or={ops:[t],delayedCallbacks:[]}}function Bn(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{or=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++)Rn(t[r]);for(var n=0;n<t.length;n++)(i=t[n]).updatedDisplay=i.mustUpdate&&ii(i.cm,i.update);var i;for(var o=0;o<t.length;o++)Un(t[o]);for(var l=0;l<t.length;l++)jn(t[l]);for(var s=0;s<t.length;s++)Gn(t[s])}(e)})}function Rn(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&&Xe(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 ni(n,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Un(e){var t=e.cm,r=t.display;e.updatedDisplay&&yn(t),e.barMeasure=On(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Mr(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 jn(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Dn(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1);var r=e.focus&&e.focus==O();e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&zn(t,e.barMeasure),e.updatedDisplay&&ai(t,e.barMeasure),e.selectionChanged&&hn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&pn(e.cm)}function Gn(e){var t=e.cm,r=t.display,n=t.doc;(e.updatedDisplay&&oi(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=e.scrollTop&&An(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&Dn(t,e.scrollLeft,!0,!0),e.scrollToPos)&&function(e,t){if(!ot(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&&!c){var o=A("div","​",null,"position: absolute;\n top: "+(t.top-r.viewOffset-xr(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?me(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?me(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var l=!1,s=Gr(e,t),a=r&&r!=t?Gr(e,r):s,c=kn(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}),u=e.doc.scrollTop,f=e.doc.scrollLeft;if(null!=c.scrollTop&&(Nn(e,c.scrollTop),1<Math.abs(e.doc.scrollTop-u)&&(l=!0)),null!=c.scrollLeft&&(Dn(e,c.scrollLeft),1<Math.abs(e.doc.scrollLeft-f)&&(l=!0)),!l)break}return i}(t,ke(n,e.scrollToPos.from),ke(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||it(i[l],"hide");if(o)for(var s=0;s<o.length;++s)o[s].lines.length&&it(o[s],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&it(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{Bn(e)}}function Vn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);In(e);try{return t.apply(e,arguments)}finally{Bn(e)}}}function $n(e){return function(){if(this.curOp)return e.apply(this,arguments);In(this);try{return e.apply(this,arguments)}finally{Bn(this)}}}function Xn(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);In(e);try{return t.apply(this,arguments)}finally{Bn(e)}}}function Yn(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)Le&&Ue(e.doc,t)<i.viewTo&&Qn(e);else if(r<=i.viewFrom)Le&&je(e.doc,r+n)>i.viewFrom?Qn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)Qn(e);else if(t<=i.viewFrom){var o=Jn(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):Qn(e)}else if(r>=i.viewTo){var l=Jn(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):Qn(e)}else{var s=Jn(e,t,t,-1),a=Jn(e,r,r+n,1);s&&a?(i.view=i.view.slice(0,s.index).concat(ir(e,s.lineN,a.lineN)).concat(i.view.slice(a.index)),i.viewTo+=n):Qn(e)}var c=i.externalMeasured;c&&(r<c.lineN?c.lineN+=n:t<c.lineN+c.size&&(i.externalMeasured=null))}function Zn(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[sn(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==I(l,r)&&l.push(r)}}}function Qn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Jn(e,t,r,n){var i,o=sn(e,t),l=e.display.view;if(!Le||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(0<n){if(o==l.length-1)return null;i=s+l[o].size-t,o++}else i=s-t;t+=i,r+=i}for(;Ue(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 ei(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 ti(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,F(ri,e))}function ri(a){var c=a.doc;if(!(c.highlightFrontier>=a.display.viewTo)){var u=+new Date+a.options.workTime,f=Et(a,c.highlightFrontier),d=[];c.iter(f.line,Math.min(c.first+c.size,a.display.viewTo+500),function(e){if(f.line>=a.display.viewFrom){var t=e.styles,r=e.text.length>a.options.maxHighlightLength?Dt(c.mode,f.state):null,n=qt(a,e,f,!0);r&&(f.state=r),e.styles=n.styles;var i=e.styleClasses,o=n.classes;o?e.styleClasses=o:i&&(e.styleClasses=null);for(var l=!t||t.length!=e.styles.length||i!=o&&(!i||!o||i.bgClass!=o.bgClass||i.textClass!=o.textClass),s=0;!l&&s<t.length;++s)l=t[s]!=e.styles[s];l&&d.push(f.line),e.stateAfter=f.save(),f.nextLine()}else e.text.length<=a.options.maxHighlightLength&&It(a,e.text,f),e.stateAfter=f.line%5==0?f.save():null,f.nextLine();if(+new Date>u)return ti(a,a.options.workDelay),!0}),c.highlightFrontier=f.line,c.modeFrontier=Math.max(c.modeFrontier,f.line),d.length&&Kn(a,function(){for(var e=0;e<d.length;e++)Zn(a,d[e],"text")})}}var ni=function(e,t,r){var n=e.display;this.viewport=t,this.visible=_n(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=tn(e),this.events=[]};function ii(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return Qn(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==ei(e))return!1;wn(e)&&(Qn(e),t.dims=tn(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)),Le&&(o=Ue(e.doc,o),l=je(e.doc,l));var s,a,c,u,f=o!=r.viewFrom||l!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;a=o,c=l,0==(u=(s=e).display).view.length||a>=u.viewTo||c<=u.viewFrom?(u.view=ir(s,a,c),u.viewFrom=a):(u.viewFrom>a?u.view=ir(s,a,u.viewFrom).concat(u.view):u.viewFrom<a&&(u.view=u.view.slice(sn(s,a))),u.viewFrom=a,u.viewTo<c?u.view=u.view.concat(ir(s,u.viewTo,c)):u.viewTo>c&&(u.view=u.view.slice(0,sn(s,c)))),u.viewTo=c,r.viewOffset=Ve(ae(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var d=ei(e);if(!f&&0==d&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var h=function(e){if(e.hasFocus())return null;var t=O();if(!t||!D(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&D(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 4<d&&(r.lineDiv.style.display="none"),function(r,e,t){var n=r.display,i=r.options.lineNumbers,o=n.lineDiv,l=o.firstChild;function s(e){var t=e.nextSibling;return b&&_&&r.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),t}for(var a=n.view,c=n.viewFrom,u=0;u<a.length;u++){var f=a[u];if(f.hidden);else if(f.node&&f.node.parentNode==o){for(;l!=f.node;)l=s(l);var d=i&&null!=e&&e<=c&&f.lineNumber;f.changes&&(-1<I(f.changes,"gutter")&&(d=!1),cr(r,f,c,t)),d&&(T(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(ge(r.options,c)))),l=f.node.nextSibling}else{var h=(m=c,v=t,void 0,y=fr(p=r,g=f),g.text=g.node=y.pre,y.bgClass&&(g.bgClass=y.bgClass),y.textClass&&(g.textClass=y.textClass),hr(p,g),pr(p,g,m,v),mr(p,g,v),g.node);o.insertBefore(h,l)}c+=f.size}var p,g,m,v,y;for(;l;)l=s(l)}(e,r.updateLineNumbers,t.dims),4<d&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(e){if(e&&e.activeElt&&e.activeElt!=O()&&(e.activeElt.focus(),e.anchorNode&&D(document.body,e.anchorNode)&&D(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)}}(h),T(r.cursorDiv),T(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,f&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,ti(e,400)),!(r.updateLineNumbers=null)}function oi(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=_n(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&ii(e,t);n=!1){yn(e);var i=On(e);an(e),zn(e,i),ai(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 li(e,t){var r=new ni(e,t);if(ii(e,r)){yn(e),oi(e,r);var n=On(e);an(e),zn(e,n),ai(e,n),r.finish()}}function si(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function ai(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 ci(e){var t=e.display.gutters,r=e.options.gutters;T(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(A("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&((e.display.lineGutter=o).style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none",si(e)}function ui(e){var t=I(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):-1<t&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}ni.prototype.signal=function(e,t){st(e,t)&&this.events.push(arguments)},ni.prototype.finish=function(){for(var e=0;e<this.events.length;e++)it.apply(null,this.events[e])};var fi=0,di=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 pi(e){var t=hi(e);return t.x*=di,t.y*=di,t}function gi(e,t){var r=hi(t),n=r.x,i=r.y,o=e.display,l=o.scroller,s=l.scrollWidth>l.clientWidth,a=l.scrollHeight>l.clientHeight;if(n&&s||i&&a){if(i&&_&&b)e:for(var c=t.target,u=o.view;c!=l;c=c.parentNode)for(var f=0;f<u.length;f++)if(u[f].node==c){e.display.currentWheelTarget=c;break e}if(n&&!g&&!m&&null!=di)return i&&a&&Nn(e,Math.max(0,l.scrollTop+i*di)),Dn(e,Math.max(0,l.scrollLeft+n*di)),(!i||i&&a)&&ct(t),void(o.wheelStartX=null);if(i&&null!=di){var d=i*di,h=e.doc.scrollTop,p=h+o.wrapper.clientHeight;d<0?h=Math.max(0,h+d-50):p=Math.min(e.doc.height,p+d+50),li(e,{top:h,bottom:p})}fi<20&&(null==o.wheelStartX?(o.wheelStartX=l.scrollLeft,o.wheelStartY=l.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=l.scrollLeft-o.wheelStartX,t=l.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&(di=(di*fi+r)/(fi+1),++fi)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}x?di=-.53:g?di=15:l?di=-.7:a&&(di=-1/3);var mi=function(e,t){this.ranges=e,this.primIndex=t};mi.prototype.primary=function(){return this.ranges[this.primIndex]},mi.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(!ye(r.anchor,n.anchor)||!ye(r.head,n.head))return!1}return!0},mi.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new vi(be(this.ranges[t].anchor),be(this.ranges[t].head));return new mi(e,this.primIndex)},mi.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},mi.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(0<=ve(t,n.from())&&ve(e,n.to())<=0)return r}return-1};var vi=function(e,t){this.anchor=e,this.head=t};function yi(e,t){var r=e[t];e.sort(function(e,t){return ve(e.from(),t.from())}),t=I(e,r);for(var n=1;n<e.length;n++){var i=e[n],o=e[n-1];if(0<=ve(o.to(),i.from())){var l=xe(o.from(),i.from()),s=_e(o.to(),i.to()),a=o.empty()?i.from()==i.head:o.from()==o.head;n<=t&&--t,e.splice(--n,2,new vi(a?s:l,a?l:s))}}return new mi(e,t)}function bi(e,t){return new mi([new vi(e,t||e)],0)}function _i(e){return e.text?me(e.from.line+e.text.length-1,X(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function xi(e,t){if(ve(e,t.from)<0)return e;if(ve(e,t.to)<=0)return _i(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+=_i(t).ch-t.to.ch),me(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 vi(xi(i.anchor,t),xi(i.head,t)))}return yi(r,e.sel.primIndex)}function ki(e,t,r){return e.line==t.line?me(r.line,e.ch-t.ch+r.ch):me(r.line+(e.line-t.line),e.ch)}function Ci(e){e.doc.mode=Mt(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,ti(e,100),e.state.modeGen++,e.curOp&&Yn(e)}function Li(e,t){return 0==t.from.ch&&0==t.to.ch&&""==X(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ti(e,n,t,i){function o(e){return t?t[e]:null}function r(e,t,r){!function(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Oe(e),We(e,r);var i=n?n(e):1;i!=e.height&&fe(e,i)}(e,t,r,i),sr(e,"change",e,n)}function l(e,t){for(var r=[],n=e;n<t;++n)r.push(new Vt(c[n],o(n),i));return r}var s=n.from,a=n.to,c=n.text,u=ae(e,s.line),f=ae(e,a.line),d=X(c),h=o(c.length-1),p=a.line-s.line;if(n.full)e.insert(0,l(0,c.length)),e.remove(c.length,e.size-c.length);else if(Li(e,n)){var g=l(0,c.length-1);r(f,f.text,h),p&&e.remove(s.line,p),g.length&&e.insert(s.line,g)}else if(u==f)if(1==c.length)r(u,u.text.slice(0,s.ch)+d+u.text.slice(a.ch),h);else{var m=l(1,c.length-1);m.push(new Vt(d+u.text.slice(a.ch),h,i)),r(u,u.text.slice(0,s.ch)+c[0],o(0)),e.insert(s.line+1,m)}else if(1==c.length)r(u,u.text.slice(0,s.ch)+c[0]+f.text.slice(a.ch),o(0)),e.remove(s.line+1,p);else{r(u,u.text.slice(0,s.ch)+c[0],o(0)),r(f,d+f.text.slice(a.ch),h);var v=l(1,c.length-1);1<p&&e.remove(s.line+1,p-1),e.insert(s.line+1,v)}sr(e,"change",e,n)}function Mi(e,s,a){!function e(t,r,n){if(t.linked)for(var i=0;i<t.linked.length;++i){var o=t.linked[i];if(o.doc!=r){var l=n&&o.sharedHist;a&&!l||(s(o.doc,l),e(o.doc,t,l))}}}(e,null,!0)}function Ni(e,t){if(t.cm)throw new Error("This document is already in use.");on((e.doc=t).cm=e),Ci(e),Ai(e),e.options.lineWrapping||Xe(e),e.options.mode=t.modeOption,Yn(e)}function Ai(e){("rtl"==e.doc.direction?W:L)(e.display.lineDiv,"CodeMirror-rtl")}function Di(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 Oi(e,t){var r={from:be(t.from),to:_i(t),text:ce(e,t.from,t.to)};return qi(e,r,t.from.line,t.to.line+1),Mi(e,function(e){return qi(e,r,t.from.line,t.to.line+1)},!0),r}function Wi(e){for(;e.length;){if(!X(e).ranges)break;e.pop()}}function Pi(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)&&i.lastModTime>a-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=(s=i).lastOp==n?(Wi(s.done),X(s.done)):s.done.length&&!X(s.done).ranges?X(s.done):1<s.done.length&&!s.done[s.done.length-2].ranges?(s.done.pop(),X(s.done)):void 0))l=X(o.changes),0==ve(t.from,t.to)&&0==ve(t.from,l.to)?l.to=_i(t):o.changes.push(Oi(e,t));else{var c=X(i.done);for(c&&c.ranges||Fi(e.sel,i.done),o={changes:[Oi(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||it(e,"historyAdded")}function zi(e,t,r,n){var i,o,l,s,a,c=e.history,u=n&&n.origin;r==c.lastSelOp||u&&c.lastSelOrigin==u&&(c.lastModTime==c.lastSelTime&&c.lastOrigin==u||(i=e,o=u,l=X(c.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)))?c.done[c.done.length-1]=t:Fi(t,c.done),c.lastSelTime=+new Date,c.lastSelOrigin=u,c.lastSelOp=r,n&&!1!==n.clearRedo&&Wi(c.undone)}function Fi(e,t){var r=X(t);r&&r.ranges&&r.equals(e)||t.push(e)}function qi(t,r,e,n){var i=r["spans_"+t.id],o=0;t.iter(Math.max(t.first,e),Math.min(t.first+t.size,n),function(e){e.markedSpans&&((i||(i=r["spans_"+t.id]={}))[o]=e.markedSpans),++o})}function Hi(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 Ei(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(Hi(r[i]));return n}(e,t),n=Ae(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],c=0;c<o.length;++c)if(o[c].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?mi.prototype.deepCopy.call(o):o);else{var l=o.changes,s=[];n.push({changes:s});for(var a=0;a<l.length;++a){var c=l[a],u=void 0;if(s.push({from:c.from,to:c.to,text:c.text}),t)for(var f in c)(u=f.match(/^spans_(\d+)$/))&&-1<I(t,Number(u[1]))&&(X(s)[f]=c[f],delete c[f])}}}return n}function Bi(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 vi(i,t)}return new vi(r||t,t)}function Ri(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Vi(e,new mi([Bi(e.sel.primary(),t,r,i)],0),n)}function Ui(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]=Bi(e.sel.ranges[o],t[o],null,i);Vi(e,yi(n,e.sel.primIndex),r)}function ji(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Vi(e,yi(i,e.sel.primIndex),n)}function Gi(e,t,r,n){Vi(e,bi(t,r),n)}function Ki(e,t,r){var n=e.history.done,i=X(n);i&&i.ranges?$i(e,n[n.length-1]=t,r):Vi(e,t,r)}function Vi(e,t,r){$i(e,t,r),zi(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function $i(e,t,r){var n,i,o,l;(st(e,"beforeSelectionChange")||e.cm&&st(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 vi(ke(n,e[t].anchor),ke(n,e[t].head))},origin:o&&o.origin},it(n,"beforeSelectionChange",n,l),n.cm&&it(n.cm,"beforeSelectionChange",n.cm,l),t=l.ranges!=i.ranges?yi(l.ranges,l.ranges.length-1):i),Xi(e,Zi(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 Xi(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,lt(e.cm)),sr(e,"cursorActivity",e))}function Yi(e){Xi(e,Zi(e,e.sel,null,!1))}function Zi(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=Ji(e,l.anchor,s&&s.anchor,r,n),c=Ji(e,l.head,s&&s.head,r,n);(i||a!=l.anchor||c!=l.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new vi(a,c))}return i?yi(i,t.primIndex):t}function Qi(e,t,r,n,i){var o=ae(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&&(it(a,"beforeCursorEnter"),a.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!a.atomic)continue;if(r){var c=a.find(n<0?1:-1),u=void 0;if((n<0?a.inclusiveRight:a.inclusiveLeft)&&(c=eo(e,c,-n,c&&c.line==t.line?o:null)),c&&c.line==t.line&&(u=ve(c,r))&&(n<0?u<0:0<u))return Qi(e,c,t,n,i)}var f=a.find(n<0?-1:1);return(n<0?a.inclusiveLeft:a.inclusiveRight)&&(f=eo(e,f,n,f.line==t.line?o:null)),f?Qi(e,f,t,n,i):null}}return t}function Ji(e,t,r,n,i){var o=n||1,l=Qi(e,t,r,o,i)||!i&&Qi(e,t,r,o,!0)||Qi(e,t,r,-o,i)||!i&&Qi(e,t,r,-o,!0);return l||(e.cantEdit=!0,me(e.first,0))}function eo(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?ke(e,me(t.line-1)):null:0<r&&t.ch==(n||ae(e,t.line)).text.length?t.line<e.first+e.size-1?me(t.line+1,0):null:new me(t.line,t.ch+r)}function to(e){e.setSelection(me(e.firstLine(),0),me(e.lastLine()),U)}function ro(i,e,t){var o={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){return o.canceled=!0}};return t&&(o.update=function(e,t,r,n){e&&(o.from=ke(i,e)),t&&(o.to=ke(i,t)),r&&(o.text=r),void 0!==n&&(o.origin=n)}),it(i,"beforeChange",i,o),i.cm&&it(i.cm,"beforeChange",i.cm,o),o.canceled?null:{from:o.from,to:o.to,text:o.text,origin:o.origin}}function no(e,t,r){if(e.cm){if(!e.cm.curOp)return Vn(e.cm,no)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(st(e,"beforeChange")||e.cm&&st(e.cm,"beforeChange"))||(t=ro(e,t,!0))){var n=Se&&!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!=I(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 c=i[a];if(!(ve(c.to,s.from)<0||0<ve(c.from,s.to))){var u=[a,1],f=ve(c.from,s.from),d=ve(c.to,s.to);(f<0||!l.inclusiveLeft&&!f)&&u.push({from:c.from,to:s.from}),(0<d||!l.inclusiveRight&&!d)&&u.push({from:s.to,to:c.to}),i.splice.apply(i,u),a+=u.length-3}}return i}(e,t.from,t.to);if(n)for(var i=n.length-1;0<=i;--i)io(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else io(e,t)}}function io(e,r){if(1!=r.text.length||""!=r.text[0]||0!=ve(r.from,r.to)){var t=wi(e,r);Pi(e,r,t,e.cm?e.cm.curOp.id:NaN),so(e,r,t,Ae(e,r));var n=[];Mi(e,function(e,t){t||-1!=I(n,e.history)||(fo(e.history,r),n.push(e.history)),so(e,r,null,Ae(e,r))})}}function oo(i,o,e){var t=i.cm&&i.cm.state.suppressEdits;if(!t||e){for(var l,r=i.history,n=i.sel,s="undo"==o?r.done:r.undone,a="undo"==o?r.undone:r.done,c=0;c<s.length&&(l=s[c],e?!l.ranges||l.equals(i.sel):l.ranges);c++);if(c!=s.length){for(r.lastOrigin=r.lastSelOrigin=null;;){if(!(l=s.pop()).ranges){if(t)return void s.push(l);break}if(Fi(l,a),e&&!l.equals(i.sel))return void Vi(i,l,{clearRedo:!1});n=l}var u=[];Fi(n,a),a.push({changes:u,generation:r.generation}),r.generation=l.generation||++r.maxGeneration;for(var f=st(i,"beforeChange")||i.cm&&st(i.cm,"beforeChange"),d=function(e){var r=l.changes[e];if(r.origin=o,f&&!ro(i,r,!1))return s.length=0,{};u.push(Oi(i,r));var t=e?wi(i,r):X(s);so(i,r,t,Ei(i,r)),!e&&i.cm&&i.cm.scrollIntoView({from:r.from,to:_i(r)});var n=[];Mi(i,function(e,t){t||-1!=I(n,e.history)||(fo(e.history,r),n.push(e.history)),so(e,r,null,Ei(e,r))})},h=l.changes.length-1;0<=h;--h){var p=d(h);if(p)return p.v}}}}function lo(e,t){if(0!=t&&(e.first+=t,e.sel=new mi(Y(e.sel.ranges,function(e){return new vi(me(e.anchor.line+t,e.anchor.ch),me(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Yn(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)Zn(e.cm,n,"gutter")}}function so(e,t,r,n){if(e.cm&&!e.cm.curOp)return Vn(e.cm,so)(e,t,r,n);if(t.to.line<e.first)lo(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);lo(e,i),t={from:me(e.first,0),to:me(t.to.line+i,t.to.ch),text:[X(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:me(o,ae(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ce(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=de(Re(ae(n,o.line))),n.iter(a,l.line+1,function(e){if(e==i.maxLine)return s=!0}));-1<n.sel.contains(t.from,t.to)&&lt(e);Ti(n,t,r,nn(e)),e.options.lineWrapping||(n.iter(a,o.line+t.text.length,function(e){var t=$e(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;r<n;n--){var i=ae(e,n).stateAfter;if(i&&(!(i instanceof zt)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}})(n,o.line),ti(e,400);var c=t.text.length-(l.line-o.line)-1;t.full?Yn(e):o.line!=l.line||1!=t.text.length||Li(e.doc,t)?Yn(e,o.line,l.line+1,c):Zn(e,o.line,"text");var u=st(e,"changes"),f=st(e,"change");if(f||u){var d={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};f&&sr(e,"change",e,d),u&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(d)}e.display.selForContextMenu=null}(e.cm,t,n):Ti(e,t,n),$i(e,r,U)}}function ao(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)),no(e,{from:r,to:n,text:t,origin:i})}function co(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function uo(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++)co(o.ranges[s].anchor,t,r,n),co(o.ranges[s].head,t,r,n)}else{for(var a=0;a<o.changes.length;++a){var c=o.changes[a];if(r<c.from.line)c.from=me(c.from.line+n,c.from.ch),c.to=me(c.to.line+n,c.to.ch);else if(t<=c.to.line){l=!1;break}}l||(e.splice(0,i+1),i=0)}}}function fo(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;uo(e.done,r,n,i),uo(e.undone,r,n,i)}function ho(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=ae(e,we(e,t)):i=de(t),null==i?null:(n(o,i)&&e.cm&&Zn(e.cm,i,r),o)}function po(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 go(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}vi.prototype.from=function(){return xe(this.anchor,this.head)},vi.prototype.to=function(){return _e(this.anchor,this.head)},vi.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},po.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,Oe(r),sr(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}},go.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&&(1<this.children.length||!(this.children[0]instanceof po))){var s=[];this.collapse(s),this.children=[new po(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&&50<i.lines.length){for(var l=i.lines.length%25+25,s=l;s<i.lines.length;){var a=new po(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 go(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var r=I(e.parent.children,e);e.parent.children.splice(r+1,0,t)}else{var n=new go(e.children);(n.parent=e).children=[n,t],e=n}t.parent=e.parent}while(10<e.children.length);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 mo=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 vo(e,t,r){Ve(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Cn(e,r)}mo.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=de(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=br(this);fe(r,Math.max(0,r.height-o)),e&&(Kn(e,function(){vo(e,r,-o),Zn(e,n,"widget")}),sr(e,"lineWidgetCleared",e,this,n))}},mo.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=br(this)-t;i&&(fe(n,n.height+i),r&&Kn(r,function(){r.curOp.forceUpdate=!0,vo(r,n,i),sr(r,"lineWidgetChanged",r,e,de(n))}))},at(mo);var yo=0,bo=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++yo};function _o(t,n,i,e,r){if(e&&e.shared)return function(e,r,n,i,o){(i=q(i)).shared=!1;var l=[_o(e,r,n,i,o)],s=l[0],a=i.widgetNode;return Mi(e,function(e){a&&(i.widgetNode=a.cloneNode(!0)),l.push(_o(e,ke(e,r),ke(e,n),i,o));for(var t=0;t<e.linked.length;++t)if(e.linked[t].isParent)return;s=X(l)}),new xo(l,s)}(t,n,i,e,r);if(t.cm&&!t.cm.curOp)return Vn(t.cm,_o)(t,n,i,e,r);var o=new bo(t,r),l=ve(n,i);if(e&&q(e,o,!1),0<l||0==l&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=N("span",[o.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Be(t,n.line,n,i,o)||n.line!=i.line&&Be(t,i.line,n,i,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Le=!0}o.addToHistory&&Pi(t,{from:n,to:i,origin:"markText"},t.sel,NaN);var s,a=n.line,c=t.cm;if(t.iter(a,i.line+1,function(e){var t,r;c&&o.collapsed&&!c.options.lineWrapping&&Re(e)==c.display.maxLine&&(s=!0),o.collapsed&&a!=n.line&&fe(e,0),t=e,r=new Te(o,a==n.line?n.ch:null,a==i.line?i.ch:null),t.markedSpans=t.markedSpans?t.markedSpans.concat([r]):[r],r.marker.attachLine(t),++a}),o.collapsed&&t.iter(n.line,i.line+1,function(e){Ge(t,e)&&fe(e,0)}),o.clearOnEnter&&tt(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Se=!0,(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++yo,o.atomic=!0),c){if(s&&(c.curOp.updateMaxLine=!0),o.collapsed)Yn(c,n.line,i.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=n.line;u<=i.line;u++)Zn(c,u,"text");o.atomic&&Yi(c.doc),sr(c,"markerAdded",c,o)}return o}bo.prototype.clear=function(){var e=this;if(!this.explicitlyCleared){var t=this.doc.cm,r=t&&!t.curOp;if(r&&In(t),st(this,"clear")){var n=this.find();n&&sr(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?Zn(t,de(s),"text"):t&&(null!=a.to&&(o=de(s)),null!=a.from&&(i=de(s))),s.markedSpans=Ne(s.markedSpans,a),null==a.from&&e.collapsed&&!Ge(e.doc,s)&&t&&fe(s,Jr(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var c=0;c<this.lines.length;++c){var u=Re(e.lines[c]),f=$e(u);f>t.display.maxLineLength&&(t.display.maxLine=u,t.display.maxLineLength=f,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&Yn(t,i,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Yi(t.doc)),t&&sr(t,"markerCleared",t,this,i,o),r&&Bn(t),this.parent&&this.parent.clear()}},bo.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=me(t?o:de(o),l.from),-1==e))return r;if(null!=l.to&&(n=me(t?o:de(o),l.to),1==e))return n}return r&&{from:r,to:n}},bo.prototype.changed=function(){var o=this,l=this.find(-1,!0),s=this,a=this.doc.cm;l&&a&&Kn(a,function(){var e=l.line,t=de(l.line),r=Nr(a,t);if(r&&(Fr(r),a.curOp.selectionChanged=a.curOp.forceUpdate=!0),a.curOp.updateMaxLine=!0,!Ge(s.doc,e)&&null!=s.height){var n=s.height;s.height=null;var i=br(s)-n;i&&fe(e,e.height+i)}sr(a,"markerChanged",a,o)})},bo.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=I(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},bo.prototype.detachLine=function(e){if(this.lines.splice(I(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},at(bo);var xo=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(me(e.first,0),e.clipPos(me(e.lastLine())),function(e){return e.parent})}function ko(o){for(var e=function(e){var t=o[e],r=[t.primary.doc];Mi(t.primary.doc,function(e){return r.push(e)});for(var n=0;n<t.markers.length;n++){var i=t.markers[n];-1==I(r,i.doc)&&(i.parent=null,t.markers.splice(n--,1))}},t=0;t<o.length;t++)e(t)}xo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();sr(this,"clear")}},xo.prototype.find=function(e,t){return this.primary.find(e,t)},at(xo);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),go.call(this,[new po([new Vt("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var o=me(r,0);this.sel=bi(o),this.history=new Di(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)),Ti(this,{from:o,to:o,text:e}),Vi(this,bi(o),U)};So.prototype=Q(go.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:Xn(function(e){var t=me(this.first,0),r=this.first+this.size-1;no(this,{from:t,to:me(r,ae(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Ln(this.cm,0,0),Vi(this,bi(t),U)}),replaceRange:function(e,t,r,n){ao(this,e,t=ke(this,t),r=r?ke(this,r):t,n)},getRange:function(e,t,r){var n=ce(this,ke(this,e),ke(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(pe(this,e))return ae(this,e)},getLineNumber:function(e){return de(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=ae(this,e)),Re(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return ke(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:Xn(function(e,t,r){Gi(this,ke(this,"number"==typeof e?me(e,t||0):e),null,r)}),setSelection:Xn(function(e,t,r){Gi(this,ke(this,e),ke(this,t||e),r)}),extendSelection:Xn(function(e,t,r){Ri(this,ke(this,e),t&&ke(this,t),r)}),extendSelections:Xn(function(e,t){Ui(this,Ce(this,e),t)}),extendSelectionsBy:Xn(function(e,t){Ui(this,Ce(this,Y(this.sel.ranges,e)),t)}),setSelections:Xn(function(e,t,r){if(e.length){for(var n=[],i=0;i<e.length;i++)n[i]=new vi(ke(this,e[i].anchor),ke(this,e[i].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Vi(this,yi(n,t),r)}}),addSelection:Xn(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new vi(ke(this,e),ke(this,t||e))),Vi(this,yi(n,n.length-1),r)}),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=ce(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=ce(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:Xn(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=me(e.first,0),o=i,l=0;l<t.length;l++){var s=t[l],a=ki(s.from,i,o),c=ki(_i(s),i,o);if(i=s.to,o=c,"around"==r){var u=e.sel.ranges[l],f=ve(u.head,u.anchor)<0;n[l]=new vi(f?c:a,f?a:c)}else n[l]=new vi(a,a)}return new mi(n,e.sel.primIndex)}(this,n,t),a=n.length-1;0<=a;a--)no(this,n[a]);s?Ki(this,s):this.cm&&Sn(this.cm)}),undo:Xn(function(){oo(this,"undo")}),redo:Xn(function(){oo(this,"redo")}),undoSelection:Xn(function(){oo(this,"undo",!0)}),redoSelection:Xn(function(){oo(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 Di(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 Di(this.history.maxGeneration);t.done=Ii(e.done.slice(0),null,!0),t.undone=Ii(e.undone.slice(0),null,!0)},setGutterMarker:Xn(function(e,r,n){return ho(this,e,"gutter",function(e){var t=e.gutterMarkers||(e.gutterMarkers={});return!(t[r]=n)&&re(t)&&(e.gutterMarkers=null),!0})}),clearGutter:Xn(function(t){var r=this;this.iter(function(e){e.gutterMarkers&&e.gutterMarkers[t]&&ho(r,e,"gutter",function(){return e.gutterMarkers[t]=null,re(e.gutterMarkers)&&(e.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!pe(this,e))return null;if(!(e=ae(this,t=e)))return null}else if(null==(t=de(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:Xn(function(e,r,n){return ho(this,e,"gutter"==r?"gutter":"class",function(e){var t="text"==r?"textClass":"background"==r?"bgClass":"gutter"==r?"gutterClass":"wrapClass";if(e[t]){if(C(n).test(e[t]))return!1;e[t]+=" "+n}else e[t]=n;return!0})}),removeLineClass:Xn(function(e,o,l){return ho(this,e,"gutter"==o?"gutter":"class",function(e){var t="text"==o?"textClass":"background"==o?"bgClass":"gutter"==o?"gutterClass":"wrapClass",r=e[t];if(!r)return!1;if(null==l)e[t]=null;else{var n=r.match(C(l));if(!n)return!1;var i=n.index+n[0].length;e[t]=r.slice(0,n.index)+(n.index&&i!=r.length?" ":"")+r.slice(i)||null}return!0})}),addLineWidget:Xn(function(e,t,r){return i=e,o=new mo(n=this,t,r),(l=n.cm)&&o.noHScroll&&(l.display.alignWidgets=!0),ho(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&&!Ge(n,e)){var r=Ve(e)<n.scrollTop;fe(e,e.height+br(o)),r&&Cn(l,o.height),l.curOp.forceUpdate=!0}return!0}),l&&sr(l,"lineWidgetAdded",l,o,"number"==typeof i?i:de(i)),o;var n,i,o,l}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return _o(this,ke(this,e),ke(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 _o(this,e=ke(this,e),e,r,"bookmark")},findMarksAt:function(e){var t=[],r=ae(this,(e=ke(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(i,o,l){i=ke(this,i),o=ke(this,o);var s=[],a=i.line;return this.iter(i.line,o.line+1,function(e){var t=e.markedSpans;if(t)for(var r=0;r<t.length;r++){var n=t[r];null!=n.to&&a==i.line&&i.ch>=n.to||null==n.from&&a!=i.line||null!=n.from&&a==o.line&&n.from>=o.ch||l&&!l(n.marker)||s.push(n.marker.parent||n.marker)}++a}),s},getAllMarks:function(){var n=[];return this.iter(function(e){var t=e.markedSpans;if(t)for(var r=0;r<t.length;++r)null!=t[r].from&&n.push(t[r].marker)}),n},posFromIndex:function(r){var n,i=this.first,o=this.lineSeparator().length;return this.iter(function(e){var t=e.text.length+o;if(r<t)return n=r,!0;r-=t,++i}),ke(this,me(i,n))},indexFromPos:function(e){var t=(e=ke(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=_o(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),ko(wo(this));break}}if(e.history==this.history){var r=[e.id];Mi(e,function(e){return r.push(e.id)},!0),e.history=new Di(null),e.history.done=Ii(this.history.done,r),e.history.undone=Ii(this.history.undone,r)}},iterLinkedDocs:function(e){Mi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):xt(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Xn(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(){Ai(t),Yn(t)}))})}),So.prototype.eachLine=So.prototype.iter;var Lo=0;function To(e){var i=this;if(Mo(i),!ot(i,e)&&!_r(i.display,e)){ct(e),x&&(Lo=+new Date);var o=ln(i,e,!0),t=e.dataTransfer.files;if(o&&!i.isReadOnly())if(t&&t.length&&window.FileReader&&window.File)for(var l=t.length,s=Array(l),a=0,r=function(e,r){if(!i.options.allowDropFileTypes||-1!=I(i.options.allowDropFileTypes,e.type)){var n=new FileReader;n.onload=Vn(i,function(){var e=n.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),s[r]=e,++a==l){var t={from:o=ke(i.doc,o),to:o,text:i.doc.splitLines(s.join(i.doc.lineSeparator())),origin:"paste"};no(i.doc,t),Ki(i.doc,bi(o,_i(t)))}}),n.readAsText(e)}},n=0;n<l;++n)r(t[n],n);else{if(i.state.draggingText&&-1<i.doc.sel.contains(o))return i.state.draggingText(e),void setTimeout(function(){return i.display.input.focus()},20);try{var c=e.dataTransfer.getData("Text");if(c){var u;if(i.state.draggingText&&!i.state.draggingText.copy&&(u=i.listSelections()),$i(i.doc,bi(o,o)),u)for(var f=0;f<u.length;++f)ao(i.doc,"",u[f].anchor,u[f].head,"drag");i.replaceSelection(c,"around","paste"),i.display.input.focus()}}catch(e){}}}}function Mo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function No(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 Ao=!1;function Do(){var e;Ao||(tt(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,No(Oo)},100))}),tt(window,"blur",function(){return No(vn)}),Ao=!0)}function Oo(e){var t=e.display;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"},Po=0;Po<10;Po++)Wo[Po+48]=Wo[Po+96]=String(Po);for(var zo=65;zo<=90;zo++)Wo[zo]=String.fromCharCode(zo);for(var Fo=1;Fo<=12;Fo++)Wo[Fo+111]=Wo[Fo+63235]="F"+Fo;var qo={};function Ho(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 Eo(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=Y(r.split(" "),Ho),o=0;o<i.length;o++){var l=void 0,s=void 0;l=o==i.length-1?(s=i.join(" "),n):(s=i.slice(0,o+1).join(" "),"...");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 c in t)e[c]=t[c];return e}function Io(e,t,r,n){var i=(t=jo(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 Bo(e){var t="string"==typeof e?e:Wo[e.keyCode];return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Ro(e,t,r){var n=e;return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(y?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(y?t.ctrlKey:t.metaKey)&&"Cmd"!=n&&(e="Cmd-"+e),!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function Uo(e,t){if(m&&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),Ro(r,e,t))}function jo(e){return"string"==typeof e?qo[e]:e}function Go(t,e){for(var r=t.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=e(r[i]);n.length&&ve(o.from,X(n).to)<=0;){var l=n.pop();if(ve(l.from,o.from)<0){o.from=l.from;break}}n.push(o)}Kn(t,function(){for(var e=n.length-1;0<=e;e--)ao(t.doc,"",n[e].from,n[e].to,"+delete");Sn(t)})}function Ko(e,t,r){var n=oe(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Vo(e,t,r){var n=Ko(e,t.ch,r);return null==n?null:new me(t.line,n,r<0?"after":"before")}function $o(e,t,r,n,i){if(e){var o=Je(r,t.doc.direction);if(o){var l,s=i<0?X(o):o[0],a=i<0==(1==s.level)?"after":"before";if(0<s.level||"rtl"==t.doc.direction){var c=Ar(t,r);l=i<0?r.text.length-1:0;var u=Dr(t,c,l).top;l=le(function(e){return Dr(t,c,e).top==u},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 me(n,l,a)}}return new me(n,i<0?r.text.length:0,i<0?"before":"after")}qo.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"},qo.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"},qo.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"},qo.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"]},qo.default=_?qo.macDefault:qo.pcDefault;var Xo={selectAll:to,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),U)},killLine:function(r){return Go(r,function(e){if(e.empty()){var t=ae(r.doc,e.head.line).text.length;return e.head.ch==t&&e.head.line<r.lastLine()?{from:e.head,to:me(e.head.line+1,0)}:{from:e.head,to:me(e.head.line,t)}}return{from:e.from(),to:e.to()}})},deleteLine:function(t){return Go(t,function(e){return{from:me(e.from().line,0),to:ke(t.doc,me(e.to().line+1,0))}})},delLineLeft:function(e){return Go(e,function(e){return{from:me(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(r){return Go(r,function(e){var t=r.charCoords(e.head,"div").top+5;return{from:r.coordsChar({left:0,top:t},"div"),to:e.from()}})},delWrappedLineRight:function(n){return Go(n,function(e){var t=n.charCoords(e.head,"div").top+5,r=n.coordsChar({left:n.display.lineDiv.offsetWidth+100,top:t},"div");return{from:e.from(),to:r}})},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(me(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(me(e.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy(function(e){return Yo(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy(function(e){return Zo(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy(function(e){return function(e,t){var r=ae(e.doc,t),n=function(e){for(var t;t=Ee(e);)e=t.find(1,!0).line;return e}(r);n!=r&&(t=de(n));return $o(!0,e,r,t,-1)}(t,e.head.line)},{origin:"+move",bias:-1})},goLineRight:function(r){return r.extendSelectionsBy(function(e){var t=r.cursorCoords(e.head,"div").top+5;return r.coordsChar({left:r.display.lineDiv.offsetWidth+100,top:t},"div")},G)},goLineLeft:function(r){return r.extendSelectionsBy(function(e){var t=r.cursorCoords(e.head,"div").top+5;return r.coordsChar({left:0,top:t},"div")},G)},goLineLeftSmart:function(n){return n.extendSelectionsBy(function(e){var t=n.cursorCoords(e.head,"div").top+5,r=n.coordsChar({left:0,top:t},"div");return r.ch<n.getLine(r.line).search(/\S/)?Zo(n,e.head):r},G)},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=H(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(l){return Kn(l,function(){for(var e=l.listSelections(),t=[],r=0;r<e.length;r++)if(e[r].empty()){var n=e[r].head,i=ae(l.doc,n.line).text;if(i)if(n.ch==i.length&&(n=new me(n.line,n.ch-1)),0<n.ch)n=new me(n.line,n.ch+1),l.replaceRange(i.charAt(n.ch-1)+i.charAt(n.ch-2),me(n.line,n.ch-2),n,"+transpose");else if(n.line>l.doc.first){var o=ae(l.doc,n.line-1).text;o&&(n=new me(n.line,1),l.replaceRange(i.charAt(0)+l.doc.lineSeparator()+o.charAt(o.length-1),me(n.line-1,o.length-1),n,"+transpose"))}t.push(new vi(n,n))}l.setSelections(t)})},newlineAndIndent:function(n){return Kn(n,function(){for(var e=n.listSelections(),t=e.length-1;0<=t;t--)n.replaceRange(n.doc.lineSeparator(),e[t].anchor,e[t].head,"+input");e=n.listSelections();for(var r=0;r<e.length;r++)n.indentLine(e[r].from().line,null,!0);Sn(n)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Yo(e,t){var r=ae(e.doc,t),n=Re(r);return n!=r&&(t=de(n)),$o(!0,e,n,t,1)}function Zo(e,t){var r=Yo(e,t.line),n=ae(e.doc,r.line),i=Je(n,e.doc.direction);if(i&&0!=i[0].level)return r;var o=Math.max(0,n.text.search(/\S/)),l=t.line==r.line&&t.ch<=o&&t.ch;return me(r.line,l?0:o,r.sticky)}function Qo(e,t,r){if("string"==typeof t&&!(t=Xo[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)!=R}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}var Jo=new E;function el(e,t,r,n){var i=e.state.keySeq;if(i){if(Bo(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Jo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),tl(e,i+" "+t,r,n))return!0}return tl(e,t,r,n)}function tl(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&&sr(e,"keyHandled",e,t,r),"handled"!=i&&"multi"!=i||(ct(r),hn(e)),!!i}function rl(t,e){var r=Uo(e,!0);return!!r&&(e.shiftKey&&!t.state.keySeq?el(t,"Shift-"+r,e,function(e){return Qo(t,e,!0)})||el(t,r,e,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return Qo(t,e)}):el(t,r,e,function(e){return Qo(t,e)}))}var nl=null;function il(e){var t=this;if(t.curOp.focus=O(),!ot(t,e)){x&&w<11&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=rl(t,e);m&&(nl=n?r:null,!n&&88==r&&!kt&&(_?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||(L(t,"CodeMirror-crosshair"),nt(document,"keyup",r),nt(document,"mouseover",r))}W(t,"CodeMirror-crosshair"),tt(document,"keyup",r),tt(document,"mouseover",r)}(t)}}function ol(e){16==e.keyCode&&(this.doc.sel.shift=!1),ot(this,e)}function ll(e){var t=this;if(!(_r(t.display,e)||ot(t,e)||e.ctrlKey&&!e.altKey||_&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(m&&r==nl)return nl=null,void ct(e);if(!m||e.which&&!(e.which<10)||!rl(t,e)){var i,o=String.fromCharCode(null==n?r:n);if("\b"!=o)if(!el(i=t,"'"+o+"'",e,function(e){return Qo(i,e,!0)}))t.display.input.onKeyPress(e)}}}var sl,al,cl=function(e,t,r){this.time=e,this.pos=t,this.button=r};function ul(e){var t=this,r=t.display;if(!(ot(t,e)||r.activeTouch&&r.input.supportsTouch()))if(r.input.ensurePolled(),r.shift=e.shiftKey,_r(r,e))b||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));else if(!hl(t,e)){var n,i,o,l=ln(t,e),s=pt(e),a=l?(n=l,i=s,o=+new Date,al&&al.compare(o,n,i)?(sl=al=null,"triple"):sl&&sl.compare(o,n,i)?(al=new cl(o,n,i),sl=null,"double"):(sl=new cl(o,n,i),al=null,"single")):"single";window.focus(),1==s&&t.state.selectingText&&t.state.selectingText(e),l&&function(r,e,n,t,i){var o="Click";"double"==t?o="Double"+o:"triple"==t&&(o="Triple"+o);return el(r,Ro(o=(1==e?"Left":2==e?"Middle":"Right")+o,i),i,function(e){if("string"==typeof e&&(e=Xo[e]),!e)return!1;var t=!1;try{r.isReadOnly()&&(r.state.suppressEdits=!0),t=e(r,n)!=R}finally{r.state.suppressEdits=!1}return t})}(t,s,l,a,e)||(1==s?l?function(e,t,r,n){x?setTimeout(F(pn,e),0):e.curOp.focus=O();var i,o=function(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{};if(null==i.unit){var o=h?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=_?r.metaKey:r.ctrlKey);null==i.moveOnDrag&&(i.moveOnDrag=!(_?r.altKey:r.ctrlKey));return i}(e,r,n),l=e.doc.sel;e.options.dragDrop&&vt&&!e.isReadOnly()&&"single"==r&&-1<(i=l.contains(t))&&(ve((i=l.ranges[i]).from(),t)<0||0<t.xRel)&&(0<ve(i.to(),t)||t.xRel<0)?function(t,r,n,i){var o=t.display,l=!1,s=Vn(t,function(e){b&&(o.scroller.draggable=!1),t.state.draggingText=!1,nt(o.wrapper.ownerDocument,"mouseup",s),nt(o.wrapper.ownerDocument,"mousemove",a),nt(o.scroller,"dragstart",c),nt(o.scroller,"drop",s),l||(ct(e),i.addNew||Ri(t.doc,n,null,null,i.extend),b||x&&9==w?setTimeout(function(){o.wrapper.ownerDocument.body.focus(),o.input.focus()},20):o.input.focus())}),a=function(e){l=l||10<=Math.abs(r.clientX-e.clientX)+Math.abs(r.clientY-e.clientY)},c=function(){return l=!0};b&&(o.scroller.draggable=!0);(t.state.draggingText=s).copy=!i.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop();tt(o.wrapper.ownerDocument,"mouseup",s),tt(o.wrapper.ownerDocument,"mousemove",a),tt(o.scroller,"dragstart",c),tt(o.scroller,"drop",s),gn(t),setTimeout(function(){return o.input.focus()},20)}(e,n,t,o):function(m,e,v,y){var l=m.display,b=m.doc;ct(e);var _,x,w=b.sel,t=w.ranges;y.addNew&&!y.extend?(x=b.sel.contains(v),_=-1<x?t[x]:new vi(v,v)):(_=b.sel.primary(),x=b.sel.primIndex);if("rectangle"==y.unit)y.addNew||(_=new vi(v,v)),v=ln(m,e,!0,!0),x=-1;else{var r=fl(m,v,y.unit);_=y.extend?Bi(_,r.anchor,r.head,y.extend):r}y.addNew?-1==x?(x=t.length,Vi(b,yi(t.concat([_]),x),{scroll:!1,origin:"*mouse"})):1<t.length&&t[x].empty()&&"char"==y.unit&&!y.extend?(Vi(b,yi(t.slice(0,x).concat(t.slice(x+1)),0),{scroll:!1,origin:"*mouse"}),w=b.sel):ji(b,x,_,j):(Vi(b,new mi([_],x=0),j),w=b.sel);var k=v;function s(e){if(0!=ve(k,e))if(k=e,"rectangle"==y.unit){for(var t=[],r=m.options.tabSize,n=H(ae(b,v.line).text,v.ch,r),i=H(ae(b,e.line).text,e.ch,r),o=Math.min(n,i),l=Math.max(n,i),s=Math.min(v.line,e.line),a=Math.min(m.lastLine(),Math.max(v.line,e.line));s<=a;s++){var c=ae(b,s).text,u=K(c,o,r);o==l?t.push(new vi(me(s,u),me(s,u))):c.length>u&&t.push(new vi(me(s,u),me(s,K(c,l,r))))}t.length||t.push(new vi(v,v)),Vi(b,yi(w.ranges.slice(0,x).concat(t),x),{origin:"*mouse",scroll:!1}),m.scrollIntoView(e)}else{var f,d=_,h=fl(m,e,y.unit),p=d.anchor;p=0<ve(h.anchor,p)?(f=h.head,xe(d.from(),h.anchor)):(f=h.anchor,_e(d.to(),h.head));var g=w.ranges.slice(0);g[x]=function(e,t){var r=t.anchor,n=t.head,i=ae(e.doc,r.line);if(0==ve(r,n)&&r.sticky==n.sticky)return t;var o=Je(i);if(!o)return t;var l=Ze(o,r.ch,r.sticky),s=o[l];if(s.from!=r.ch&&s.to!=r.ch)return t;var a,c=l+(s.from==r.ch==(1!=s.level)?0:1);if(0==c||c==o.length)return t;if(n.line!=r.line)a=0<(n.line-r.line)*("ltr"==e.doc.direction?1:-1);else{var u=Ze(o,n.ch,n.sticky),f=u-l||(n.ch-r.ch)*(1==s.level?-1:1);a=u==c-1||u==c?f<0:0<f}var d=o[c+(a?-1:0)],h=a==(1==d.level),p=h?d.from:d.to,g=h?"after":"before";return r.ch==p&&r.sticky==g?t:new vi(new me(r.line,p,g),n)}(m,new vi(ke(b,p),f)),Vi(b,yi(g,x),j)}}var a=l.wrapper.getBoundingClientRect(),c=0;function n(e){m.state.selectingText=!1,c=1/0,ct(e),l.input.focus(),nt(l.wrapper.ownerDocument,"mousemove",i),nt(l.wrapper.ownerDocument,"mouseup",o),b.history.lastSelOrigin=null}var i=Vn(m,function(e){0!==e.buttons&&pt(e)?function e(t){var r=++c;var n=ln(m,t,!0,"rectangle"==y.unit);if(!n)return;if(0!=ve(n,k)){m.curOp.focus=O(),s(n);var i=_n(l,b);(n.line>=i.to||n.line<i.from)&&setTimeout(Vn(m,function(){c==r&&e(t)}),150)}else{var o=t.clientY<a.top?-20:t.clientY>a.bottom?20:0;o&&setTimeout(Vn(m,function(){c==r&&(l.scroller.scrollTop+=o,e(t))}),50)}}(e):n(e)}),o=Vn(m,n);m.state.selectingText=o,tt(l.wrapper.ownerDocument,"mousemove",i),tt(l.wrapper.ownerDocument,"mouseup",o)}(e,n,t,o)}(t,l,a,e):ht(e)==r.scroller&&ct(e):2==s?(l&&Ri(t.doc,l),setTimeout(function(){return r.input.focus()},20)):3==s&&(k?pl(t,e):gn(t)))}}function fl(e,t,r){if("char"==r)return new vi(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new vi(me(t.line,0),ke(e.doc,me(t.line+1,0)));var n=r(e,t);return new vi(n.from,n.to)}function dl(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&&ct(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(o>s.bottom||!st(e,r))return ft(t);o-=s.top-l.viewOffset;for(var a=0;a<e.options.gutters.length;++a){var c=l.gutters.childNodes[a];if(c&&c.getBoundingClientRect().right>=i)return it(e,r,e,he(e.doc,o),e.options.gutters[a],t),ft(t)}}function hl(e,t){return dl(e,t,"gutterClick",!0)}function pl(e,t){var r,n;_r(e.display,t)||(n=t,st(r=e,"gutterContextMenu")&&dl(r,n,"gutterContextMenu",!1))||(ot(e,t,"contextmenu")||e.display.input.onContextMenu(t))}function gl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Hr(e)}cl.prototype.compare=function(e,t,r){return this.time+400>e&&0==ve(t,this.pos)&&r==this.button};var ml={toString:function(){return"CodeMirror.Init"}},vl={},yl={};function bl(e){ci(e),Yn(e),xn(e)}function _l(e,t,r){if(!t!=!(r&&r!=ml)){var n=e.display.dragFunctions,i=t?tt:nt;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 xl(e){e.options.lineWrapping?(W(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(L(e.display.wrapper,"CodeMirror-wrap"),Xe(e)),on(e),Yn(e),Hr(e),setTimeout(function(){return zn(e)},100)}function wl(e,t){var r=this;if(!(this instanceof wl))return new wl(e,t);this.options=t=t?q(t):{},q(vl,t,!1),ui(t);var n=t.value;"string"==typeof n&&(n=new So(n,t.mode,null,t.lineSeparator,t.direction)),this.doc=n;var i=new wl.inputStyles[t.inputStyle](this),o=this.display=new se(e,n,i);for(var l in ci(o.wrapper.CodeMirror=this),gl(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Hn(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 E,keySeq:null,specialChars:null},t.autofocus&&!d&&o.input.focus(),x&&w<11&&setTimeout(function(){return r.display.input.reset(!0)},20),function(i){var o=i.display;tt(o.scroller,"mousedown",Vn(i,ul)),tt(o.scroller,"dblclick",x&&w<11?Vn(i,function(e){if(!ot(i,e)){var t=ln(i,e);if(t&&!hl(i,e)&&!_r(i.display,e)){ct(e);var r=i.findWordAt(t);Ri(i.doc,r.anchor,r.head)}}}):function(e){return ot(i,e)||ct(e)});k||tt(o.scroller,"contextmenu",function(e){return pl(i,e)});var r,n={end:0};function l(){o.activeTouch&&(r=setTimeout(function(){return o.activeTouch=null},1e3),(n=o.activeTouch).end=+new Date)}function s(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return 400<r*r+n*n}tt(o.scroller,"touchstart",function(e){if(!ot(i,e)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(e)&&!hl(i,e)){o.input.ensurePolled(),clearTimeout(r);var t=+new Date;o.activeTouch={start:t,moved:!1,prev:t-n.end<=300?n:null},1==e.touches.length&&(o.activeTouch.left=e.touches[0].pageX,o.activeTouch.top=e.touches[0].pageY)}}),tt(o.scroller,"touchmove",function(){o.activeTouch&&(o.activeTouch.moved=!0)}),tt(o.scroller,"touchend",function(e){var t=o.activeTouch;if(t&&!_r(o,e)&&null!=t.left&&!t.moved&&new Date-t.start<300){var r,n=i.coordsChar(o.activeTouch,"page");r=!t.prev||s(t,t.prev)?new vi(n,n):!t.prev.prev||s(t,t.prev.prev)?i.findWordAt(n):new vi(me(n.line,0),ke(i.doc,me(n.line+1,0))),i.setSelection(r.anchor,r.head),i.focus(),ct(e)}l()}),tt(o.scroller,"touchcancel",l),tt(o.scroller,"scroll",function(){o.scroller.clientHeight&&(Nn(i,o.scroller.scrollTop),Dn(i,o.scroller.scrollLeft,!0),it(i,"scroll",i))}),tt(o.scroller,"mousewheel",function(e){return gi(i,e)}),tt(o.scroller,"DOMMouseScroll",function(e){return gi(i,e)}),tt(o.wrapper,"scroll",function(){return o.wrapper.scrollTop=o.wrapper.scrollLeft=0}),o.dragFunctions={enter:function(e){ot(i,e)||dt(e)},over:function(e){ot(i,e)||(!function(e,t){var r=ln(e,t);if(r){var n=document.createDocumentFragment();un(e,r,n),e.display.dragCursor||(e.display.dragCursor=A("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),M(e.display.dragCursor,n)}}(i,e),dt(e))},start:function(e){return function(e,t){if(x&&(!e.state.draggingText||+new Date-Lo<100))dt(t);else if(!ot(e,t)&&!_r(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!a)){var r=A("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",m&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),m&&r.parentNode.removeChild(r)}}(i,e)},drop:Vn(i,To),leave:function(e){ot(i,e)||Mo(i)}};var e=o.input.getField();tt(e,"keyup",function(e){return ol.call(i,e)}),tt(e,"keydown",Vn(i,il)),tt(e,"keypress",Vn(i,ll)),tt(e,"focus",function(e){return mn(i,e)}),tt(e,"blur",function(e){return vn(i,e)})}(this),Do(),In(this),this.curOp.forceUpdate=!0,Ni(this,n),t.autofocus&&!d||this.hasFocus()?setTimeout(F(mn,this),20):vn(this),yl)yl.hasOwnProperty(l)&&yl[l](r,t[l],ml);wn(this),t.finishInit&&t.finishInit(this);for(var s=0;s<kl.length;++s)kl[s](r);Bn(this),b&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}wl.defaults=vl,wl.optionHandlers=yl;var kl=[];function Cl(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=Et(e,t).state:r="prev");var l=e.options.tabSize,s=ae(o,t),a=H(s.text,null,l);s.stateAfter&&(s.stateAfter=null);var c,u=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&((c=o.mode.indent(i,s.text.slice(u.length),s.text))==R||150<c)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?H(ae(o,t-1).text,null,l):0:"add"==r?c=a+e.options.indentUnit:"subtract"==r?c=a-e.options.indentUnit:"number"==typeof r&&(c=a+r),c=Math.max(0,c);var f="",d=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/l);h;--h)d+=l,f+="\t";if(d<c&&(f+=$(c-d)),f!=u)return ao(o,f,me(t,0),me(t,u.length),"+input"),!(s.stateAfter=null);for(var p=0;p<o.sel.ranges.length;p++){var g=o.sel.ranges[p];if(g.head.line==t&&g.head.ch<u.length){var m=me(t,u.length);ji(o,p,new vi(m,m));break}}}wl.defineInitHook=function(e){return kl.push(e)};var Sl=null;function Ll(e){Sl=e}function Tl(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=xt(t),c=null;if(s&&1<n.ranges.length)if(Sl&&Sl.text.join("\n")==t){if(n.ranges.length%Sl.text.length==0){c=[];for(var u=0;u<Sl.text.length;u++)c.push(o.splitLines(Sl.text[u]))}}else a.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(c=Y(a,function(e){return[e]}));for(var f=n.ranges.length-1;0<=f;f--){var d=n.ranges[f],h=d.from(),p=d.to();d.empty()&&(r&&0<r?h=me(h.line,h.ch-r):e.state.overwrite&&!s?p=me(p.line,Math.min(ae(o,p.line).text.length,p.ch+X(a).length)):Sl&&Sl.lineWise&&Sl.text.join("\n")==t&&(h=p=me(h.line,0))),l=e.curOp.updateInput;var g={from:h,to:p,text:c?c[f%c.length]:a,origin:i||(s?"paste":e.state.cutIncoming?"cut":"+input")};no(e.doc,g),sr(e,"inputRead",e,g)}t&&!s&&Nl(e,t),Sn(e),e.curOp.updateInput=l,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Ml(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Kn(t,function(){return Tl(t,r,0,null,"paste")}),!0}function Nl(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;0<=n;n--){var i=r.ranges[n];if(!(100<i.head.ch||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(-1<t.indexOf(o.electricChars.charAt(s))){l=Cl(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(ae(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=Cl(e,i.head.line,"smart"));l&&sr(e,"electricInput",e,i.head.line)}}}function Al(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:me(i,0),head:me(i+1,0)};r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function Dl(e,t){e.setAttribute("autocorrect","off"),e.setAttribute("autocapitalize","off"),e.setAttribute("spellcheck",!!t)}function Ol(){var e=A("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=A("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return b?e.style.width="1000px":e.setAttribute("wrap","off"),u&&(e.style.border="1px solid black"),Dl(e),t}function Wl(n,i,o,e,l){var t=i,r=o,s=ae(n,i.line);function a(e){var t,r;if(null==(t=l?function(t,r,s,e){var a=Je(r,t.doc.direction);if(!a)return Vo(r,s,e);s.ch>=r.text.length?(s.ch=r.text.length,s.sticky="before"):s.ch<=0&&(s.ch=0,s.sticky="after");var n=Ze(a,s.ch,s.sticky),i=a[n];if("ltr"==t.doc.direction&&i.level%2==0&&(0<e?i.to>s.ch:i.from<s.ch))return Vo(r,s,e);var o,c=function(e,t){return Ko(r,e instanceof me?e.ch:e,t)},l=function(e){return t.options.lineWrapping?(o=o||Ar(t,r),Yr(t,r,o,e)):{begin:0,end:r.text.length}},u=l("before"==s.sticky?c(s,-1):s.ch);if("rtl"==t.doc.direction||1==i.level){var f=1==i.level==e<0,d=c(s,f?1:-1);if(null!=d&&(f?d<=i.to&&d<=u.end:d>=i.from&&d>=u.begin)){var h=f?"before":"after";return new me(s.line,d,h)}}var p=function(e,t,r){for(var n=function(e,t){return t?new me(s.line,c(e,1),"before"):new me(s.line,e,"after")};0<=e&&e<a.length;e+=t){var i=a[e],o=0<t==(1!=i.level),l=o?r.begin:c(r.end,-1);if(i.from<=l&&l<i.to)return n(l,o);if(l=o?i.from:c(i.to,-1),r.begin<=l&&l<r.end)return n(l,o)}},g=p(n+e,e,u);if(g)return g;var m=0<e?u.end:c(u.begin,-1);return null==m||0<e&&m==r.text.length||!(g=p(0<e?0:a.length-1,e,l(m)))?null:g}(n.cm,s,i,o):Vo(s,i,o))){if(e||(r=i.line+o)<n.first||r>=n.first+n.size||(i=new me(r,i.ch,i.sticky),!(s=ae(n,r))))return!1;i=$o(l,n.cm,s,i.line,o)}else i=t;return!0}if("char"==e)a();else if("column"==e)a(!0);else if("word"==e||"group"==e)for(var c=null,u="group"==e,f=n.cm&&n.cm.getHelper(i,"wordChars"),d=!0;!(o<0)||a(!d);d=!1){var h=s.text.charAt(i.ch)||"\n",p=te(h,f)?"w":u&&"\n"==h?"n":!u||/\s/.test(h)?null:"p";if(!u||d||p||(p="s"),c&&c!=p){o<0&&(o=1,a(),i.sticky="after");break}if(p&&(c=p),0<o&&!a(!d))break}var g=Ji(n,i,t,r,!0);return ye(t,g)&&(g.hitSide=!0),g}function Pl(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),c=Math.max(a-.5*Jr(e.display),3);i=(0<r?t.bottom:t.top)+r*c}else"line"==n&&(i=0<r?t.bottom+3:t.top-3);for(;(o=$r(e,s,i)).outside;){if(r<0?i<=0:i>=l.height){o.hitSide=!0;break}i+=5*r}return o}var zl=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new E,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Fl(e,t){var r=Nr(e,t.line);if(!r||r.hidden)return null;var n=ae(e.doc,t.line),i=Tr(r,n,t.line),o=Je(n,e.doc.direction),l="left";o&&(l=Ze(o,t.ch)%2?"right":"left");var s=Pr(i.map,t.ch,l);return s.offset="right"==s.collapse?s.end:s.start,s}function ql(e,t){return t&&(e.bad=!0),e}function Hl(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return ql(e.clipPos(me(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 El(o,t,r)}}function El(c,e,t){var r=c.text.firstChild,n=!1;if(!e||!D(r,e))return ql(me(de(c.line),0),!0);if(e==r&&(n=!0,e=r.childNodes[t],t=0,!e)){var i=c.rest?X(c.rest):c.line;return ql(me(de(i),i.text.length),n)}var o=3==e.nodeType?e:null,l=e;for(o||1!=e.childNodes.length||3!=e.firstChild.nodeType||(o=e.firstChild,t&&(t=o.nodeValue.length));l.parentNode!=r;)l=l.parentNode;var u=c.measure,f=u.maps;function s(e,t,r){for(var n=-1;n<(f?f.length:0);n++)for(var i=n<0?u.map:f[n],o=0;o<i.length;o+=3){var l=i[o+2];if(l==e||l==t){var s=de(n<0?c.line:c.rest[n]),a=i[o]+r;return(r<0||l!=e)&&(a=i[o+(r?1:0)]),me(s,a)}}}var a=s(o,l,t);if(a)return ql(a,n);for(var d=l.nextSibling,h=o?o.nodeValue.length-t:0;d;d=d.nextSibling){if(a=s(d,d.firstChild,0))return ql(me(a.line,a.ch-h),n);h+=d.textContent.length}for(var p=l.previousSibling,g=t;p;p=p.previousSibling){if(a=s(p,p.firstChild,-1))return ql(me(a.line,a.ch+g),n);g+=p.textContent.length}}zl.prototype.init=function(e){var t=this,l=this,s=l.cm,a=l.div=e.lineDiv;function r(e){if(!ot(s,e)){if(s.somethingSelected())Ll({lineWise:!1,text:s.getSelections()}),"cut"==e.type&&s.replaceSelection("",null,"cut");else{if(!s.options.lineWiseCopyCut)return;var t=Al(s);Ll({lineWise:!0,text:t.text}),"cut"==e.type&&s.operation(function(){s.setSelections(t.ranges,0,U),s.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var r=Sl.text.join("\n");if(e.clipboardData.setData("Text",r),e.clipboardData.getData("Text")==r)return void e.preventDefault()}var n=Ol(),i=n.firstChild;s.display.lineSpace.insertBefore(n,s.display.lineSpace.firstChild),i.value=Sl.text.join("\n");var o=document.activeElement;z(i),setTimeout(function(){s.display.lineSpace.removeChild(n),o.focus(),o==a&&l.showPrimarySelection()},50)}}Dl(a,s.options.spellcheck),tt(a,"paste",function(e){ot(s,e)||Ml(e,s)||w<=11&&setTimeout(Vn(s,function(){return t.updateFromDOM()}),20)}),tt(a,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),tt(a,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),tt(a,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),tt(a,"touchstart",function(){return l.forceCompositionEnd()}),tt(a,"input",function(){t.composing||t.readFromDOMSoon()}),tt(a,"copy",r),tt(a,"cut",r)},zl.prototype.prepareSelection=function(){var e=cn(this.cm,!1);return e.focus=this.cm.state.focused,e},zl.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},zl.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},zl.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),i=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||i.line<t.display.viewFrom)e.removeAllRanges();else{var o=Hl(t,e.anchorNode,e.anchorOffset),l=Hl(t,e.focusNode,e.focusOffset);if(!o||o.bad||!l||l.bad||0!=ve(xe(o,l),n)||0!=ve(_e(o,l),i)){var s=t.display.view,a=n.line>=t.display.viewFrom&&Fl(t,n)||{node:s[0].measure.map[2],offset:0},c=i.line<t.display.viewTo&&Fl(t,i);if(!c){var u=s[s.length-1].measure,f=u.maps?u.maps[u.maps.length-1]:u.map;c={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}if(a&&c){var d,h=e.rangeCount&&e.getRangeAt(0);try{d=S(a.node,a.offset,c.offset,c.node)}catch(e){}d&&(!g&&t.state.focused?(e.collapse(a.node,a.offset),d.collapsed||(e.removeAllRanges(),e.addRange(d))):(e.removeAllRanges(),e.addRange(d)),h&&null==e.anchorNode?e.addRange(h):g&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},zl.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)},zl.prototype.showMultipleSelections=function(e){M(this.cm.display.cursorDiv,e.cursors),M(this.cm.display.selectionDiv,e.selection)},zl.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},zl.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return D(this.div,t)},zl.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},zl.prototype.blur=function(){this.div.blur()},zl.prototype.getField=function(){return this.div},zl.prototype.supportsTouch=function(){return!0},zl.prototype.receivedFocus=function(){var t=this;this.selectionInEditor()?this.pollSelection():Kn(this.cm,function(){return t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))})},zl.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},zl.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(f&&l&&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=Hl(t,e.anchorNode,e.anchorOffset),n=Hl(t,e.focusNode,e.focusOffset);r&&n&&Kn(t,function(){Vi(t.doc,bi(r,n),U),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}}},zl.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=me(l.line-1,ae(n.doc,l.line-1).length)),s.ch==ae(n.doc,s.line).text.length&&s.line<n.lastLine()&&(s=me(s.line+1,0)),l.line<i.viewFrom||s.line>i.viewTo-1)return!1;r=l.line==i.viewFrom||0==(e=sn(n,l.line))?(t=de(i.view[0].line),i.view[0].node):(t=de(i.view[e].line),i.view[e-1].node.nextSibling);var a,c,u=sn(n,s.line);if(c=u==i.view.length-1?(a=i.viewTo-1,i.lineDiv.lastChild):(a=de(i.view[u+1].line)-1,i.view[u+1].node.previousSibling),!r)return!1;for(var f=n.doc.splitLines(function(a,e,t,c,u){var r="",f=!1,d=a.doc.lineSeparator(),h=!1;function p(){f&&(r+=d,h&&(r+=d),f=h=!1)}function g(e){e&&(p(),r+=e)}function m(e){if(1==e.nodeType){var t=e.getAttribute("cm-text");if(t)return void g(t);var r,n=e.getAttribute("cm-marker");if(n){var i=a.findMarks(me(c,0),me(u+1,0),(s=+n,function(e){return e.id==s}));return void(i.length&&(r=i[0].find(0))&&g(ce(a.doc,r.from,r.to).join(d)))}if("false"==e.getAttribute("contenteditable"))return;var o=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&0==e.textContent.length)return;o&&p();for(var l=0;l<e.childNodes.length;l++)m(e.childNodes[l]);/^(pre|p)$/i.test(e.nodeName)&&(h=!0),o&&(f=!0)}else 3==e.nodeType&&g(e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var s}for(;m(e),e!=t;)e=e.nextSibling,h=!1;return r}(n,r,c,t,a)),d=ce(n.doc,me(t,0),me(a,ae(n.doc,a).text.length));1<f.length&&1<d.length;)if(X(f)==X(d))f.pop(),d.pop(),a--;else{if(f[0]!=d[0])break;f.shift(),d.shift(),t++}for(var h=0,p=0,g=f[0],m=d[0],v=Math.min(g.length,m.length);h<v&&g.charCodeAt(h)==m.charCodeAt(h);)++h;for(var y=X(f),b=X(d),_=Math.min(y.length-(1==f.length?h:0),b.length-(1==d.length?h:0));p<_&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;if(1==f.length&&1==d.length&&t==l.line)for(;h&&h>l.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)h--,p++;f[f.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),f[0]=f[0].slice(h).replace(/\u200b+$/,"");var x=me(t,h),w=me(a,d.length?X(d).length-p:0);return 1<f.length||f[0]||ve(x,w)?(ao(n.doc,f,x,w,"+input"),!0):void 0},zl.prototype.ensurePolled=function(){this.forceCompositionEnd()},zl.prototype.reset=function(){this.forceCompositionEnd()},zl.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},zl.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))},zl.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Kn(this.cm,function(){return Yn(e.cm)})},zl.prototype.setUneditable=function(e){e.contentEditable="false"},zl.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Vn(this.cm,Tl)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},zl.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},zl.prototype.onContextMenu=function(){},zl.prototype.resetPosition=function(){},zl.prototype.needsContentAttribute=!0;var Il,Bl,Rl,Ul=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new E,this.hasSelection=!1,this.composing=null};Ul.prototype.init=function(t){var e=this,r=this,n=this.cm;this.createField(t);var i=this.textarea;function o(e){if(!ot(n,e)){if(n.somethingSelected())Ll({lineWise:!1,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;var t=Al(n);Ll({lineWise:!0,text:t.text}),"cut"==e.type?n.setSelections(t.ranges,null,U):(r.prevInput="",i.value=t.text.join("\n"),z(i))}"cut"==e.type&&(n.state.cutIncoming=!0)}}t.wrapper.insertBefore(this.wrapper,t.wrapper.firstChild),u&&(i.style.width="0px"),tt(i,"input",function(){x&&9<=w&&e.hasSelection&&(e.hasSelection=null),r.poll()}),tt(i,"paste",function(e){ot(n,e)||Ml(e,n)||(n.state.pasteIncoming=!0,r.fastPoll())}),tt(i,"cut",o),tt(i,"copy",o),tt(t.scroller,"paste",function(e){_r(t,e)||ot(n,e)||(n.state.pasteIncoming=!0,r.focus())}),tt(t.lineSpace,"selectstart",function(e){_r(t,e)||ct(e)}),tt(i,"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"})}}),tt(i,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Ul.prototype.createField=function(e){this.wrapper=Ol(),this.textarea=this.wrapper.firstChild},Ul.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=cn(e);if(e.options.moveInputWithCursor){var i=Gr(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},Ul.prototype.showSelection=function(e){var t=this.cm.display;M(t.cursorDiv,e.cursors),M(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ul.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&&z(this.textarea),x&&9<=w&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",x&&9<=w&&(this.hasSelection=null))}},Ul.prototype.getField=function(){return this.textarea},Ul.prototype.supportsTouch=function(){return!1},Ul.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!d||O()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ul.prototype.blur=function(){this.textarea.blur()},Ul.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ul.prototype.receivedFocus=function(){this.slowPoll()},Ul.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Ul.prototype.fastPoll=function(){var t=!1,r=this;r.pollingFast=!0,r.polling.set(20,function e(){r.poll()||t?(r.pollingFast=!1,r.slowPoll()):(t=!0,r.polling.set(60,e))})},Ul.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(x&&9<=w&&this.hasSelection===i||_&&/[\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 l=0,s=Math.min(n.length,i.length);l<s&&n.charCodeAt(l)==i.charCodeAt(l);)++l;return Kn(t,function(){Tl(t,i.slice(l),n.length-l,null,e.composing?"*compose":null),1e3<i.length||-1<i.indexOf("\n")?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},Ul.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ul.prototype.onKeyPress=function(){x&&9<=w&&(this.hasSelection=null),this.fastPoll()},Ul.prototype.onContextMenu=function(e){var r=this,n=r.cm,i=n.display,o=r.textarea,t=ln(n,e),l=i.scroller.scrollTop;if(t&&!m){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(t)&&Vn(n,Vi)(n.doc,bi(t),U);var s=o.style.cssText,a=r.wrapper.style.cssText;r.wrapper.style.cssText="position: absolute";var c,u=r.wrapper.getBoundingClientRect();if(o.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-u.top-5)+"px; left: "+(e.clientX-u.left-5)+"px;\n z-index: 1000; background: "+(x?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",b&&(c=window.scrollY),i.input.focus(),b&&window.scrollTo(null,c),i.input.reset(),n.somethingSelected()||(o.value=r.prevInput=" "),r.contextMenuPending=!0,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll),x&&9<=w&&d(),k){dt(e);var f=function(){nt(window,"mouseup",f),setTimeout(h,20)};tt(window,"mouseup",f)}else setTimeout(h,50)}function d(){if(null!=o.selectionStart){var e=n.somethingSelected(),t="​"+(e?o.value:"");o.value="⇚",o.value=t,r.prevInput=e?"":"​",o.selectionStart=1,o.selectionEnd=t.length,i.selForContextMenu=n.doc.sel}}function h(){if(r.contextMenuPending=!1,r.wrapper.style.cssText=a,o.style.cssText=s,x&&w<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=l),null!=o.selectionStart){(!x||x&&w<9)&&d();var e=0,t=function(){i.selForContextMenu==n.doc.sel&&0==o.selectionStart&&0<o.selectionEnd&&"​"==r.prevInput?Vn(n,to)(n):e++<10?i.detectingSelectAll=setTimeout(t,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(t,200)}}},Ul.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Ul.prototype.setUneditable=function(){},Ul.prototype.needsContentAttribute=!1,function(i){var o=i.optionHandlers;function e(e,t,n,r){i.defaults[e]=t,n&&(o[e]=r?function(e,t,r){r!=ml&&n(e,t,r)}:n)}i.defineOption=e,i.Init=ml,e("value","",function(e,t){return e.setValue(t)},!0),e("mode",null,function(e,t){e.doc.modeOption=t,Ci(e)},!0),e("indentUnit",2,Ci,!0),e("indentWithTabs",!1),e("smartIndent",!0),e("tabSize",4,function(e){Si(e),Hr(e),Yn(e)},!0),e("lineSeparator",null,function(e,n){if(e.doc.lineSep=n){var i=[],o=e.doc.first;e.doc.iter(function(e){for(var t=0;;){var r=e.text.indexOf(n,t);if(-1==r)break;t=r+n.length,i.push(me(o,r))}o++});for(var t=i.length-1;0<=t;t--)ao(e.doc,n,i[t],me(i[t].line,i[t].ch+n.length))}}),e("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!=ml&&e.refresh()}),e("specialCharPlaceholder",Qt,function(e){return e.refresh()},!0),e("electricChars",!0),e("inputStyle",d?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),e("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),e("rtlMoveVisually",!p),e("wholeLineUpdateBefore",!0),e("theme","default",function(e){gl(e),bl(e)},!0),e("keyMap","default",function(e,t,r){var n=jo(t),i=r!=ml&&jo(r);i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)}),e("extraKeys",null),e("configureMouse",null),e("lineWrapping",!1,xl,!0),e("gutters",[],function(e){ui(e.options),bl(e)},!0),e("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?rn(e.display)+"px":"0",e.refresh()},!0),e("coverGutterNextToScrollbar",!1,function(e){return zn(e)},!0),e("scrollbarStyle","native",function(e){Hn(e),zn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),e("lineNumbers",!1,function(e){ui(e.options),bl(e)},!0),e("firstLineNumber",1,bl,!0),e("lineNumberFormatter",function(e){return e},bl,!0),e("showCursorWhenSelecting",!1,an,!0),e("resetSelectionOnContextMenu",!0),e("lineWiseCopyCut",!0),e("pasteLinesPerSelection",!0),e("readOnly",!1,function(e,t){"nocursor"==t&&(vn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),e("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),e("dragDrop",!0,_l),e("allowDropFileTypes",null),e("cursorBlinkRate",530),e("cursorScrollMargin",0),e("cursorHeight",1,an,!0),e("singleCursorHeightPerLine",!0,an,!0),e("workTime",100),e("workDelay",100),e("flattenSpans",!0,Si,!0),e("addModeClass",!1,Si,!0),e("pollInterval",100),e("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),e("historyEventDelay",1250),e("viewportMargin",10,function(e){return e.refresh()},!0),e("maxHighlightLength",1e4,Si,!0),e("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),e("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),e("autofocus",null),e("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0)}(wl),Bl=(Il=wl).optionHandlers,Rl=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,Bl.hasOwnProperty(e)&&Vn(this,Bl[e])(this,t,n),it(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"](jo(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:$n(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++,Yn(this)}),removeOverlay:$n(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 Yn(this)}}),indentLine:$n(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),pe(this.doc,e)&&Cl(this,e,t,r)}),indentSelection:$n(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 c=a;c<n;++c)Cl(t,c,e);var u=t.doc.sel.ranges;0==l.ch&&r.length==u.length&&0<u[i].from().ch&&ji(t.doc,i,new vi(l,u[i].to()),U)}}}),getTokenAt:function(e,t){return jt(this,e,t)},getLineTokens:function(e,t){return jt(this,me(e),t,!0)},getTokenTypeAt:function(e){e=ke(this.doc,e);var t,r=Ht(this,ae(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(!Rl.hasOwnProperty(t))return r;var n=Rl[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==I(r,a.val)&&r.push(a.val)}return r},getStateAfter:function(e,t){var r=this.doc;return Et(this,(e=we(r,null==e?r.first+r.size-1:e))+1,t).state},cursorCoords:function(e,t){var r=this.doc.sel.primary();return Gr(this,null==e?r.head:"object"==typeof e?ke(this.doc,e):e?r.from():r.to(),t||"page")},charCoords:function(e,t){return jr(this,ke(this.doc,e),t||"page")},coordsChar:function(e,t){return $r(this,(e=Ur(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Ur(this,{top:e,left:0},t||"page").top,he(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:o<e&&(e=o,i=!0),n=ae(this.doc,e)}else n=e;return Rr(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-Ve(n):0)},defaultTextHeight:function(){return Jr(this.display)},defaultCharWidth:function(){return en(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,c=(e=Gr(this,ke(this.doc,e))).bottom,u=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),a.sizer.appendChild(t),"over"==n)c=e.top;else if("above"==n||"near"==n){var f=Math.max(a.wrapper.clientHeight,this.doc.height),d=Math.max(a.sizer.clientWidth,a.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>f)&&e.top>t.offsetHeight?c=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=f&&(c=e.bottom),u+t.offsetWidth>d&&(u=d-t.offsetWidth)}t.style.top=c+"px",t.style.left=t.style.right="","right"==i?(u=a.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?u=0:"middle"==i&&(u=(a.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),r&&(o=this,l={left:u,top:c,right:u+t.offsetWidth,bottom:c+t.offsetHeight},null!=(s=kn(o,l)).scrollTop&&Nn(o,s.scrollTop),null!=s.scrollLeft&&Dn(o,s.scrollLeft))},triggerOnKeyDown:$n(il),triggerOnKeyPress:$n(ll),triggerOnKeyUp:ol,triggerOnMouseDown:$n(ul),execCommand:function(e){if(Xo.hasOwnProperty(e))return Xo[e].call(null,this)},triggerElectric:$n(function(e){Nl(this,e)}),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=ke(this.doc,e),l=0;l<t&&!(o=Wl(this.doc,o,i,r,n)).hitSide;++l);return o},moveH:$n(function(t,r){var n=this;this.extendSelectionsBy(function(e){return n.display.shift||n.doc.extend||e.empty()?Wl(n.doc,e.head,t,r,n.options.rtlMoveVisually):t<0?e.from():e.to()},G)}),deleteH:$n(function(r,n){var e=this.doc.sel,i=this.doc;e.somethingSelected()?i.replaceSelection("",null,"+delete"):Go(this,function(e){var t=Wl(i,e.head,r,n,!1);return r<0?{from:t,to:e.head}:{from:e.head,to:t}})}),findPosV:function(e,t,r,n){var i=1,o=n;t<0&&(i=-1,t=-t);for(var l=ke(this.doc,e),s=0;s<t;++s){var a=Gr(this,l,"div");if(null==o?o=a.left:a.left=o,(l=Pl(this,a,i,r)).hitSide)break}return l},moveV:$n(function(n,i){var o=this,l=this.doc,s=[],a=!this.display.shift&&!l.extend&&l.sel.somethingSelected();if(l.extendSelectionsBy(function(e){if(a)return n<0?e.from():e.to();var t=Gr(o,e.head,"div");null!=e.goalColumn&&(t.left=e.goalColumn),s.push(t.left);var r=Pl(o,t,n,i);return"page"==i&&e==l.sel.primary()&&Cn(o,jr(o,r,"div").top-t.top),r},G),s.length)for(var e=0;e<l.sel.ranges.length;e++)l.sel.ranges[e].goalColumn=s[e]}),findWordAt:function(e){var t=ae(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)};0<r&&l(t.charAt(r-1));)--r;for(;n<t.length&&l(t.charAt(n));)++n}return new vi(me(e.line,r),me(e.line,n))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?W(this.display.cursorDiv,"CodeMirror-overwrite"):L(this.display.cursorDiv,"CodeMirror-overwrite"),it(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==O()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:$n(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:$n(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:me(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,Tn(r=this),r.curOp.scrollToPos=n):Mn(this,e.from,e.to,e.margin)}),setSize:$n(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&&qr(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){Zn(r,i,"widget");break}++i}),this.curOp.forceUpdate=!0,it(this,"refresh",this)}),operation:function(e){return Kn(this,e)},startOperation:function(){return In(this)},endOperation:function(){return Bn(this)},refresh:$n(function(){var e=this.display.cachedTextHeight;Yn(this),this.curOp.forceUpdate=!0,Hr(this),Ln(this,this.doc.scrollLeft,this.doc.scrollTop),si(this),(null==e||.5<Math.abs(e-Jr(this.display)))&&on(this),it(this,"refresh",this)}),swapDoc:$n(function(e){var t=this.doc;return t.cm=null,Ni(this,e),Hr(this),this.display.input.reset(),Ln(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,sr(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}},at(Il),Il.registerHelper=function(e,t,r){Rl.hasOwnProperty(e)||(Rl[e]=Il[e]={_global:[]}),Rl[e][t]=r},Il.registerGlobalHelper=function(e,t,r,n){Il.registerHelper(e,t,n),Rl[e]._global.push({pred:r,val:n})};var jl,Gl="iter insert remove copy getEditor constructor".split(" ");for(var Kl in So.prototype)So.prototype.hasOwnProperty(Kl)&&I(Gl,Kl)<0&&(wl.prototype[Kl]=function(e){return function(){return e.apply(this.doc,arguments)}}(So.prototype[Kl]));return at(So),wl.inputStyles={textarea:Ul,contenteditable:zl},wl.defineMode=function(e){wl.defaults.mode||"null"==e||(wl.defaults.mode=e),function(e,t){2<arguments.length&&(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(t,e){if((e=e?q(e):{}).value=t.value,!e.tabindex&&t.tabIndex&&(e.tabindex=t.tabIndex),!e.placeholder&&t.placeholder&&(e.placeholder=t.placeholder),null==e.autofocus){var r=O();e.autofocus=r==t||null!=t.getAttribute("autofocus")&&r==document.body}function n(){t.value=s.getValue()}var i;if(t.form&&(tt(t.form,"submit",n),!e.leaveSubmitMethodAlone)){var o=t.form;i=o.submit;try{var l=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=l}}catch(e){}}e.finishInit=function(e){e.save=n,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,n(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(nt(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=i))}},t.style.display="none";var s=wl(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},e);return s},(jl=wl).off=nt,jl.on=tt,jl.wheelEventPixels=pi,jl.Doc=So,jl.splitLines=xt,jl.countColumn=H,jl.findColumn=K,jl.isWordChar=ee,jl.Pass=R,jl.signal=it,jl.Line=Vt,jl.changeEnd=_i,jl.scrollbarModel=qn,jl.Pos=me,jl.cmpPos=ve,jl.modes=St,jl.mimeModes=Lt,jl.resolveMode=Tt,jl.getMode=Mt,jl.modeExtensions=Nt,jl.extendMode=At,jl.copyState=Dt,jl.startState=Wt,jl.innerMode=Ot,jl.commands=Xo,jl.keyMap=qo,jl.keyName=Uo,jl.isModifierKey=Bo,jl.lookupKey=Io,jl.normalizeKeyMap=Eo,jl.StringStream=Pt,jl.SharedTextMarker=xo,jl.TextMarker=bo,jl.LineWidget=mo,jl.e_preventDefault=ct,jl.e_stopPropagation=ut,jl.e_stop=dt,jl.addClass=W,jl.contains=D,jl.rmClass=L,jl.keyNames=Wo,wl.version="5.39.0",wl}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(N){"use strict";function A(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.info=n,this.align=i,this.prev=o}function D(e,t,r,n){var i=e.indented;return e.context&&"statement"==e.context.type&&"statement"!=r&&(i=e.context.indented),e.context=new A(i,t,r,n,null,e.context)}function O(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}function W(e,t,r){return"variable"==t.prevToken||"type"==t.prevToken||(!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,r))||(!(!t.typeAtEndOfLine||e.column()!=e.indentation())||void 0))}function P(e){for(;;){if(!e||"top"==e.type)return!0;if("}"==e.type&&"namespace"!=e.prev.info)return!1;e=e.prev}}function e(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function z(e,t){return"function"==typeof e?e(t):e.propertyIsEnumerable(t)}N.defineMode("clike",function(e,s){var l,a,c=e.indentUnit,u=s.statementIndentUnit||c,f=s.dontAlignCalls,d=s.keywords||{},h=s.types||{},p=s.builtin||{},g=s.blockKeywords||{},m=s.defKeywords||{},v=s.atoms||{},y=s.hooks||{},b=s.multiLineStrings,o=!1!==s.indentStatements,t=!1!==s.indentSwitch,_=s.namespaceSeparator,x=s.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,w=s.numberStart||/[\d\.]/,k=s.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,C=s.isOperatorChar||/[+\-*&%=<>!?|\/]/,S=s.isIdentifierChar||/[\w\$_\xa1-\uffff]/;function L(e,t){var o,r=e.next();if(y[r]){var n=y[r](e,t);if(!1!==n)return n}if('"'==r||"'"==r)return t.tokenize=(o=r,function(e,t){for(var r,n=!1,i=!1;null!=(r=e.next());){if(r==o&&!n){i=!0;break}n=!n&&"\\"==r}return(i||!n&&!b)&&(t.tokenize=null),"string"}),t.tokenize(e,t);if(x.test(r))return l=r,null;if(w.test(r)){if(e.backUp(1),e.match(k))return"number";e.next()}if("/"==r){if(e.eat("*"))return(t.tokenize=T)(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(C.test(r)){for(;!e.match(/^\/[\/*]/,!1)&&e.eat(C););return"operator"}if(e.eatWhile(S),_)for(;e.match(_);)e.eatWhile(S);var i=e.current();return z(d,i)?(z(g,i)&&(l="newstatement"),z(m,i)&&(a=!0),"keyword"):z(h,i)?"type":z(p,i)?(z(g,i)&&(l="newstatement"),"builtin"):z(v,i)?"atom":"variable"}function T(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=null;break}n="*"==r}return"comment"}function M(e,t){s.typeFirstDefinitions&&e.eol()&&P(t.context)&&(t.typeAtEndOfLine=W(e,t,e.pos))}return{startState:function(e){return{tokenize:null,context:new A((e||0)-c,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var r=t.context;if(e.sol()&&(null==r.align&&(r.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return M(e,t),null;l=a=null;var n=(t.tokenize||L)(e,t);if("comment"==n||"meta"==n)return n;if(null==r.align&&(r.align=!0),";"==l||":"==l||","==l&&e.match(/^\s*(?:\/\/.*)?$/,!1))for(;"statement"==t.context.type;)O(t);else if("{"==l)D(t,e.column(),"}");else if("["==l)D(t,e.column(),"]");else if("("==l)D(t,e.column(),")");else if("}"==l){for(;"statement"==r.type;)r=O(t);for("}"==r.type&&(r=O(t));"statement"==r.type;)r=O(t)}else l==r.type?O(t):o&&(("}"==r.type||"top"==r.type)&&";"!=l||"statement"==r.type&&"newstatement"==l)&&D(t,e.column(),"statement",e.current());if("variable"==n&&("def"==t.prevToken||s.typeFirstDefinitions&&W(e,t,e.start)&&P(t.context)&&e.match(/^\s*\(/,!1))&&(n="def"),y.token){var i=y.token(e,t,n);void 0!==i&&(n=i)}return"def"==n&&!1===s.styleDefs&&(n="variable"),t.startOfLine=!1,t.prevToken=a?"def":n||l,M(e,t),n},indent:function(e,t){if(e.tokenize!=L&&null!=e.tokenize||e.typeAtEndOfLine)return N.Pass;var r=e.context,n=t&&t.charAt(0);if("statement"==r.type&&"}"==n&&(r=r.prev),s.dontIndentStatements)for(;"statement"==r.type&&s.dontIndentStatements.test(r.info);)r=r.prev;if(y.indent){var i=y.indent(e,r,t);if("number"==typeof i)return i}var o=n==r.type,l=r.prev&&"switch"==r.prev.info;if(s.allmanIndentation&&/[{(]/.test(n)){for(;"top"!=r.type&&"}"!=r.type;)r=r.prev;return r.indented}return"statement"==r.type?r.indented+("{"==n?0:u):!r.align||f&&")"==r.type?")"!=r.type||o?r.indented+(o?0:c)+(o||!l||/^(?:case|default)\b/.test(t)?0:c):r.indented+u:r.column+(o?0:1)},electricInput:t?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:"//",fold:"brace"}});var t="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile",r="int long char short double float unsigned signed void size_t ptrdiff_t";function i(e,t){if(!t.startOfLine)return!1;for(var r,n=null;r=e.peek();){if("\\"==r&&e.match(/^.$/)){n=i;break}if("/"==r&&e.match(/^\/[\/\*]/,!1))break;e.next()}return t.tokenize=n,"meta"}function n(e,t){return"type"==t.prevToken&&"type"}function o(e){return e.eatWhile(/[\w\.']/),"number"}function l(e,t){if(e.backUp(1),e.match(/(R|u8R|uR|UR|LR)/)){var r=e.match(/"([^\s\\()]{0,16})\(/);return!!r&&(t.cpp11RawStringDelim=r[1],(t.tokenize=a)(e,t))}return e.match(/(u8|u|U|L)/)?!!e.match(/["']/,!1)&&"string":(e.next(),!1)}function s(e,t){for(var r;null!=(r=e.next());)if('"'==r&&!e.eat('"')){t.tokenize=null;break}return"string"}function a(e,t){var r=t.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&");return e.match(new RegExp(".*?\\)"+r+'"'))?t.tokenize=null:e.skipToEnd(),"string"}function c(e,t){"string"==typeof e&&(e=[e]);var r=[];function n(e){if(e)for(var t in e)e.hasOwnProperty(t)&&r.push(t)}n(t.keywords),n(t.types),n(t.builtin),n(t.atoms),r.length&&(t.helperType=e[0],N.registerHelper("hintWords",e[0],r));for(var i=0;i<e.length;++i)N.defineMIME(e[i],t)}function u(e,t){for(var r=!1;!e.eol();){if(!r&&e.match('"""')){t.tokenize=null;break}r="\\"==e.next()&&!r}return"string"}c(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:e(t),types:e(r+" bool _Complex _Bool float_t double_t intptr_t intmax_t int8_t int16_t int32_t int64_t uintptr_t uintmax_t uint8_t uint16_t uint32_t uint64_t"),blockKeywords:e("case do else for if switch while struct"),defKeywords:e("struct"),typeFirstDefinitions:!0,atoms:e("NULL true false"),hooks:{"#":i,"*":n},modeProps:{fold:["brace","include"]}}),c(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:e(t+" asm dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast inline public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:e(r+" bool wchar_t"),blockKeywords:e("catch class do else finally for if struct switch try while"),defKeywords:e("class namespace struct enum union"),typeFirstDefinitions:!0,atoms:e("true false NULL"),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,hooks:{"#":i,"*":n,u:l,U:l,L:l,R:l,0:o,1:o,2:o,3:o,4:o,5:o,6:o,7:o,8:o,9:o,token:function(e,t,r){if("variable"==r&&"("==e.peek()&&(";"==t.prevToken||null==t.prevToken||"}"==t.prevToken)&&(n=e.current(),(i=/(\w+)::~?(\w+)$/.exec(n))&&i[1]==i[2]))return"def";var n,i}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),c("text/x-java",{name:"clike",keywords:e("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while @interface"),types:e("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:e("catch class do else finally for if switch try while"),defKeywords:e("class interface enum @interface"),typeFirstDefinitions:!0,atoms:e("true false null"),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(e){return!e.match("interface",!1)&&(e.eatWhile(/[\w\$_]/),"meta")}},modeProps:{fold:["brace","import"]}}),c("text/x-csharp",{name:"clike",keywords:e("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:e("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:e("catch class do else finally for foreach if struct switch try while"),defKeywords:e("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:e("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=s)(e,t):(e.eatWhile(/[\w\$_]/),"meta")}}}),c("text/x-scala",{name:"clike",keywords:e("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble"),types:e("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:e("catch class enum do else finally for forSome if match switch try while"),defKeywords:e("class enum def object package trait type val var"),atoms:e("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return!!e.match('""')&&(t.tokenize=u,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(e,t){var r=t.context;return!("}"!=r.type||!r.align||!e.eat(">"))&&(t.context=new A(r.indented,r.column,r.type,r.info,null,r.prev),"operator")},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=function n(i){return function(e,t){for(var r;r=e.next();){if("*"==r&&e.eat("/")){if(1!=i)return t.tokenize=n(i-1),t.tokenize(e,t);t.tokenize=null;break}if("/"==r&&e.eat("*"))return t.tokenize=n(i+1),t.tokenize(e,t)}return"comment"}}(1),t.tokenize(e,t))}},modeProps:{closeBrackets:{triples:'"'}}}),c("text/x-kotlin",{name:"clike",keywords:e("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam"),types:e("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:e("catch class do else finally for if where try while enum"),defKeywords:e("class val var object interface fun"),atoms:e("true false null this"),hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){var o;return t.tokenize=(o=e.match('""'),function(e,t){for(var r,n=!1,i=!1;!e.eol();){if(!o&&!n&&e.match('"')){i=!0;break}if(o&&e.match('"""')){i=!0;break}r=e.next(),!n&&"$"==r&&e.match("{")&&e.skipTo("}"),n=!n&&"\\"==r&&!o}return!i&&o||(t.tokenize=null),"string"}),t.tokenize(e,t)}},modeProps:{closeBrackets:{triples:'"'}}}),c(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:e("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:e("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:e("for while do if else struct"),builtin:e("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:e("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":i},modeProps:{fold:["brace","include"]}}),c("text/x-nesc",{name:"clike",keywords:e(t+"as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:e(r),blockKeywords:e("case do else for if switch while struct"),atoms:e("null true false"),hooks:{"#":i},modeProps:{fold:["brace","include"]}}),c("text/x-objectivec",{name:"clike",keywords:e(t+"inline restrict _Bool _Complex _Imaginary BOOL Class bycopy byref id IMP in inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),types:e(r),atoms:e("YES NO NULL NILL ON OFF true false"),hooks:{"@":function(e){return e.eatWhile(/[\w\$]/),"keyword"},"#":i,indent:function(e,t,r){if("statement"==t.type&&/^@\w/.test(r))return t.indented}},modeProps:{fold:"brace"}}),c("text/x-squirrel",{name:"clike",keywords:e("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:e(r),blockKeywords:e("case catch class else for foreach if switch try while"),defKeywords:e("function local class"),typeFirstDefinitions:!0,atoms:e("true false null"),hooks:{"#":i},modeProps:{fold:["brace","include"]}});var f=null;c("text/x-ceylon",{name:"clike",keywords:e("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){var t=e.charAt(0);return t===t.toUpperCase()&&t!==t.toLowerCase()},blockKeywords:e("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:e("class dynamic function interface module object package value"),builtin:e("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:e("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return t.tokenize=function o(l){return function(e,t){for(var r,n=!1,i=!1;!e.eol();){if(!n&&e.match('"')&&("single"==l||e.match('""'))){i=!0;break}if(!n&&e.match("``")){f=o(l),i=!0;break}r=e.next(),n="single"==l&&!n&&"\\"==r}return i&&(t.tokenize=null),"string"}}(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return!(!f||!e.match("`"))&&(t.tokenize=f,f=null,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(e,t,r){if(("variable"==r||"type"==r)&&"."==t.prevToken)return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../clike/clike")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],e):e(CodeMirror)}(function(c){"use strict";function e(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function s(i,o,l){return 0==i.length?a(o):function(e,t){for(var r=i[0],n=0;n<r.length;n++)if(e.match(r[n][0]))return t.tokenize=s(i.slice(1),o),r[n][1];return t.tokenize=a(o,l),"string"}}function a(r,n){return function(e,t){return function(e,t,r,n){if(!1!==n&&e.match("${",!1)||e.match("{$",!1))return t.tokenize=null,"string";if(!1!==n&&e.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/))return e.match("[",!1)&&(t.tokenize=s([[["[",null]],[[/\d[\w\.]*/,"number"],[/\$[a-zA-Z_][a-zA-Z0-9_]*/,"variable-2"],[/[\w\$]+/,"variable"]],[["]",null]]],r,n)),e.match(/\-\>\w/,!1)&&(t.tokenize=s([[["->",null]],[[/[\w]+/,"variable"]]],r,n)),"variable-2";var i=!1;for(;!e.eol()&&(i||!1===n||!e.match("{$",!1)&&!e.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!i&&e.match(r)){t.tokenize=null,t.tokStack.pop(),t.tokStack.pop();break}i="\\"==e.next()&&!i}return"string"}(e,t,r,n)}}var t="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally",r="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",n="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";c.registerHelper("hintWords","php",[t,r,n].join(" ").split(" ")),c.registerHelper("wordChars","php",/[\w$]/);var i={name:"clike",helperType:"php",keywords:e(t),blockKeywords:e("catch do else elseif for foreach if switch try while finally"),defKeywords:e("class function interface namespace trait"),atoms:e(r),builtin:e(n),multiLineStrings:!0,hooks:{$:function(e){return e.eatWhile(/[\w\$_]/),"variable-2"},"<":function(e,t){var r;if(r=e.match(/<<\s*/)){var n=e.eat(/['"]/);e.eatWhile(/[\w\.]/);var i=e.current().slice(r[0].length+(n?2:1));if(n&&e.eat(n),i)return(t.tokStack||(t.tokStack=[])).push(i,0),t.tokenize=a(i,"'"!=n),"string"}return!1},"#":function(e){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"},"/":function(e){if(e.eat("/")){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"}return!1},'"':function(e,t){return(t.tokStack||(t.tokStack=[])).push('"',0),t.tokenize=a('"'),"string"},"{":function(e,t){return t.tokStack&&t.tokStack.length&&t.tokStack[t.tokStack.length-1]++,!1},"}":function(e,t){return t.tokStack&&0<t.tokStack.length&&!--t.tokStack[t.tokStack.length-1]&&(t.tokenize=a(t.tokStack[t.tokStack.length-2])),!1}}};c.defineMode("php",function(e,r){var s=c.getMode(e,r&&r.htmlMode||"text/html"),a=c.getMode(e,i);return{startState:function(){var e=c.startState(s),t=r.startOpen?c.startState(a):null;return{html:e,php:t,curMode:r.startOpen?a:s,curState:r.startOpen?t:e,pending:null}},copyState:function(e){var t,r=e.html,n=c.copyState(s,r),i=e.php,o=i&&c.copyState(a,i);return t=e.curMode==s?n:o,{html:n,php:o,curMode:e.curMode,curState:t,pending:e.pending}},token:function(e,t){var r=t.curMode==a;if(e.sol()&&t.pending&&'"'!=t.pending&&"'"!=t.pending&&(t.pending=null),r)return r&&null==t.php.tokenize&&e.match("?>")?(t.curMode=s,t.curState=t.html,t.php.context.prev||(t.php=null),"meta"):a.token(e,t.curState);if(e.match(/^<\?\w*/))return t.curMode=a,t.php||(t.php=c.startState(a,s.indent(t.html,""))),t.curState=t.php,"meta";if('"'==t.pending||"'"==t.pending){for(;!e.eol()&&e.next()!=t.pending;);var n="string"}else n=t.pending&&e.pos<t.pending.end?(e.pos=t.pending.end,t.pending.style):s.token(e,t.curState);t.pending&&(t.pending=null);var i,o=e.current(),l=o.search(/<\?/);return-1!=l&&("string"==n&&(i=o.match(/[\'\"]$/))&&!/\?>/.test(o)?t.pending=i[0]:t.pending={end:e.pos,style:n},e.backUp(o.length-l)),n},indent:function(e,t){return e.curMode!=a&&/^\s*<\//.test(t)||e.curMode==a&&/^\?>/.test(t)?s.indent(e.html,t):e.curMode.indent(e.curState,t)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(e){return{state:e.curState,mode:e.curMode}}}},"htmlmixed","clike"),c.defineMIME("application/x-httpd-php","php"),c.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),c.defineMIME("text/x-php",i)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(n){var u=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),g=n.Pos,m={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"};function f(e,t,r){var n=e.getLineHandle(t.line),i=t.ch-1,o=r&&r.afterCursor;null==o&&(o=/(^| )cm-fat-cursor($| )/.test(e.getWrapperElement().className));var l=!o&&0<=i&&m[n.text.charAt(i)]||m[n.text.charAt(++i)];if(!l)return null;var s=">"==l.charAt(1)?1:-1;if(r&&r.strict&&0<s!=(i==t.ch))return null;var a=e.getTokenTypeAt(g(t.line,i+1)),c=d(e,g(t.line,i+(0<s?1:0)),s,a||null,r);return null==c?null:{from:g(t.line,i),to:c&&c.pos,match:c&&c.ch==l.charAt(0),forward:0<s}}function d(e,t,r,n,i){for(var o=i&&i.maxScanLineLength||1e4,l=i&&i.maxScanLines||1e3,s=[],a=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,c=0<r?Math.min(t.line+l,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-l),u=t.line;u!=c;u+=r){var f=e.getLine(u);if(f){var d=0<r?0:f.length-1,h=0<r?f.length:-1;if(!(f.length>o))for(u==t.line&&(d=t.ch-(r<0?1:0));d!=h;d+=r){var p=f.charAt(d);if(a.test(p)&&(void 0===n||e.getTokenTypeAt(g(u,d+1))==n))if(">"==m[p].charAt(1)==0<r)s.push(p);else{if(!s.length)return{pos:g(u,d),ch:p};s.pop()}}}}return u-r!=(0<r?e.lastLine():e.firstLine())&&null}function t(e,t,r){for(var n=e.state.matchBrackets.maxHighlightLineLength||1e3,i=[],o=e.listSelections(),l=0;l<o.length;l++){var s=o[l].empty()&&f(e,o[l].head,r);if(s&&e.getLine(s.from.line).length<=n){var a=s.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";i.push(e.markText(s.from,g(s.from.line,s.from.ch+1),{className:a})),s.to&&e.getLine(s.to.line).length<=n&&i.push(e.markText(s.to,g(s.to.line,s.to.ch+1),{className:a}))}}if(i.length){u&&e.state.focused&&e.focus();var c=function(){e.operation(function(){for(var e=0;e<i.length;e++)i[e].clear()})};if(!t)return c;setTimeout(c,800)}}function i(e){e.operation(function(){e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null),e.state.matchBrackets.currentlyHighlighted=t(e,!1,e.state.matchBrackets)})}n.defineOption("matchBrackets",!1,function(e,t,r){r&&r!=n.Init&&(e.off("cursorActivity",i),e.state.matchBrackets&&e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null)),t&&(e.state.matchBrackets="object"==typeof t?t:{},e.on("cursorActivity",i))}),n.defineExtension("matchBrackets",function(){t(this,!0)}),n.defineExtension("findMatchingBracket",function(e,t,r){return(r||"boolean"==typeof t)&&(t=r?(r.strict=t,r):t?{strict:!0}:null),f(this,e,t)}),n.defineExtension("scanForBracket",function(e,t,r,n){return d(this,e,t,r,n)})});
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,g=/gecko\/\d/i.test(e),r=/MSIE \d/.test(e),n=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),i=/Edge\/(\d+)/.exec(e),x=r||n||i,w=x&&(r?document.documentMode||6:+(i||n)[1]),b=!i&&/WebKit\//.test(e),o=b&&/Qt\/\d+\.\d+/.test(e),l=!i&&/Chrome\//.test(e),m=/Opera\//.test(e),a=/Apple Computer/.test(navigator.vendor),s=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),c=/PhantomJS/.test(e),u=!i&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),f=/Android/.test(e),d=u||f||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),_=u||/Mac/.test(t),h=/\bCrOS\b/.test(e),p=/win/i.test(t),v=m&&e.match(/Version\/(\d*\.\d*)/);v&&(v=Number(v[1])),v&&15<=v&&(b=!(m=!1));var y=_&&(o||m&&(null==v||v<12.11)),k=g||x&&9<=w;function C(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var S,L=function(e,t){var r=e.className,n=C(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 T(e){for(var t=e.childNodes.length;0<t;--t)e.removeChild(e.firstChild);return e}function M(e,t){return T(e).appendChild(t)}function A(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 N(e,t,r,n){var i=A(e,t,r,n);return i.setAttribute("role","presentation"),i}function O(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 t;try{t=document.activeElement}catch(e){t=document.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function W(e,t){var r=e.className;C(t).test(r)||(e.className+=(r?" ":"")+t)}function E(e,t){for(var r=e.split(" "),n=0;n<r.length;n++)r[n]&&!C(r[n]).test(t)&&(t+=" "+r[n]);return t}S=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 I=function(e){e.select()};function P(e){var t=Array.prototype.slice.call(arguments,1);return function(){return e.apply(null,t)}}function F(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||t<=s)return l+(t-o);l+=s-o,l+=r-l%r,o=s+1}}u?I=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:x&&(I=function(e){try{e.select()}catch(e){}});var q=function(){this.id=null};function H(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r;return-1}q.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)};var R=30,B={toString:function(){return"CodeMirror.Pass"}},U={scroll:!1},j={origin:"*mouse"},G={origin:"+move"};function K(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||t<=i+l)return n+Math.min(l,t-i);if(i+=o-n,n=o+1,t<=(i+=r-i%r))return n}}var V=[""];function $(e){for(;V.length<=e;)V.push(X(V)+" ");return V[e]}function X(e){return e[e.length-1]}function Y(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 r=Object.create?Object.create(e):(Z.prototype=e,new Z),t&&F(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&&(e.toUpperCase()!=e.toLowerCase()||J.test(e))}function te(e,t){return t?!!(-1<t.source.indexOf("\\w")&&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 768<=e.charCodeAt(0)&&ne.test(e)}function oe(e,t,r){for(;(r<0?0<t:t<e.length)&&ie(e.charAt(t));)t+=r;return t}function le(e,t,r){for(var n=r<t?-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,r){var n=this;this.input=r,n.scrollbarFiller=A("div",null,"CodeMirror-scrollbar-filler"),n.scrollbarFiller.setAttribute("cm-not-content","true"),n.gutterFiller=A("div",null,"CodeMirror-gutter-filler"),n.gutterFiller.setAttribute("cm-not-content","true"),n.lineDiv=N("div",null,"CodeMirror-code"),n.selectionDiv=A("div",null,null,"position: relative; z-index: 1"),n.cursorDiv=A("div",null,"CodeMirror-cursors"),n.measure=A("div",null,"CodeMirror-measure"),n.lineMeasure=A("div",null,"CodeMirror-measure"),n.lineSpace=N("div",[n.measure,n.lineMeasure,n.selectionDiv,n.cursorDiv,n.lineDiv],null,"position: relative; outline: none");var i=N("div",[n.lineSpace],"CodeMirror-lines");n.mover=A("div",[i],null,"position: relative"),n.sizer=A("div",[n.mover],"CodeMirror-sizer"),n.sizerWidth=null,n.heightForcer=A("div",null,null,"position: absolute; height: "+R+"px; width: 1px;"),n.gutters=A("div",null,"CodeMirror-gutters"),n.lineGutter=null,n.scroller=A("div",[n.sizer,n.heightForcer,n.gutters],"CodeMirror-scroll"),n.scroller.setAttribute("tabIndex","-1"),n.wrapper=A("div",[n.scrollbarFiller,n.gutterFiller,n.scroller],"CodeMirror"),x&&w<8&&(n.gutters.style.zIndex=-1,n.scroller.style.paddingRight=0),b||g&&d||(n.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(n.wrapper):e(n.wrapper)),n.viewFrom=n.viewTo=t.first,n.reportedViewFrom=n.reportedViewTo=t.first,n.view=[],n.renderedView=null,n.externalMeasured=null,n.viewOffset=0,n.lastWrapHeight=n.lastWrapWidth=0,n.updateLineNumbers=null,n.nativeBarWidth=n.barHeight=n.barWidth=0,n.scrollbarsClipped=!1,n.lineNumWidth=n.lineNumInnerWidth=n.lineNumChars=null,n.alignWidgets=!1,n.cachedCharWidth=n.cachedTextHeight=n.cachedPaddingH=null,n.maxLine=null,n.maxLineLength=0,n.maxLineChanged=!1,n.wheelDX=n.wheelDY=n.wheelStartX=n.wheelStartY=null,n.shift=!1,n.selForContextMenu=null,n.activeTouch=null,r.init(n)}function ae(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 ce(e,r,n){var i=[],o=r.line;return e.iter(r.line,n.line+1,function(e){var t=e.text;o==n.line&&(t=t.slice(0,n.ch)),o==r.line&&(t=t.slice(r.ch)),i.push(t),++o}),i}function ue(e,t,r){var n=[];return e.iter(t,r,function(e){n.push(e.text)}),n}function fe(e,t){var r=t-e.height;if(r)for(var n=e;n;n=n.parent)n.height+=r}function de(e){if(null==e.parent)return null;for(var t=e.parent,r=H(t.lines,e),n=t.parent;n;n=(t=n).parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize();return r+t.first}function he(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 pe(e,t){return t>=e.first&&t<e.first+e.size}function ge(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function me(e,t,r){if(void 0===r&&(r=null),!(this instanceof me))return new me(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 ye(e,t){return e.sticky==t.sticky&&0==ve(e,t)}function be(e){return me(e.line,e.ch)}function _e(e,t){return ve(e,t)<0?t:e}function xe(e,t){return ve(e,t)<0?e:t}function we(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ke(e,t){if(t.line<e.first)return me(e.first,0);var r,n,i,o=e.first+e.size-1;return t.line>o?me(o,ae(e,o).text.length):(n=ae(e,(r=t).line).text.length,null==(i=r.ch)||n<i?me(r.line,n):i<0?me(r.line,0):r)}function Ce(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=ke(e,t[n]);return r}var Se=!1,Le=!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 Ae(e,t){if(t.full)return null;var r=pe(e,t.from.line)&&ae(e,t.from.line).markedSpans,n=pe(e,t.to.line)&&ae(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),c=1==t.text.length,u=X(t.text).length+(c?i:0);if(s)for(var f=0;f<s.length;++f){var d=s[f];if(null==d.to){var h=Me(a,d.marker);h?c&&(d.to=null==h.to?null:h.to+u):d.to=i}}if(a)for(var p=0;p<a.length;++p){var g=a[p];if(null!=g.to&&(g.to+=u),null==g.from)Me(s,g.marker)||(g.from=u,c&&(s||(s=[])).push(g));else g.from+=u,c&&(s||(s=[])).push(g)}s&&(s=Oe(s)),a&&a!=s&&(a=Oe(a));var m=[s];if(!c){var v,y=t.text.length-2;if(0<y&&s)for(var b=0;b<s.length;++b)null==s[b].to&&(v||(v=[])).push(new Te(s[b].marker,null,null));for(var _=0;_<y;++_)m.push(v);m.push(a)}return m}function Oe(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 Ee(e){return e.inclusiveLeft?-1:0}function Ie(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)||Ee(e)-Ee(t);if(o)return-o;var l=ve(n.to,i.to)||Ie(e)-Ie(t);return l||t.id-e.id}function Fe(e,t){var r,n=Le&&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 Fe(e,!0)}function qe(e){return Fe(e,!1)}function He(e,t){var r,n=Le&&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 Re(e,t,r,n,i){var o=ae(e,t),l=Le&&o.markedSpans;if(l)for(var s=0;s<l.length;++s){var a=l[s];if(a.marker.collapsed){var c=a.marker.find(0),u=ve(c.from,r)||Ee(a.marker)-Ee(i),f=ve(c.to,n)||Ie(a.marker)-Ie(i);if(!(0<=u&&f<=0||u<=0&&0<=f)&&(u<=0&&(a.marker.inclusiveRight&&i.inclusiveLeft?0<=ve(c.to,r):0<ve(c.to,r))||0<=u&&(a.marker.inclusiveRight&&i.inclusiveLeft?ve(c.from,n)<=0:ve(c.from,n)<0)))return!0}}}function Be(e){for(var t;t=ze(e);)e=t.find(-1,!0).line;return e}function Ue(e,t){var r=ae(e,t),n=Be(r);return r==n?t:de(n)}function je(e,t){if(t>e.lastLine())return t;var r,n=ae(e,t);if(!Ge(e,n))return t;for(;r=qe(n);)n=r.find(1,!0).line;return de(n)+1}function Ge(e,t){var r=Le&&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 Ve(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 $e(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=qe(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 Xe(e){var r=e.display,t=e.doc;r.maxLine=ae(t,t.first),r.maxLineLength=$e(r.maxLine),r.maxLineChanged=!0,t.iter(function(e){var t=$e(e);t>r.maxLineLength&&(r.maxLineLength=t,r.maxLine=e)})}var Ye=null;function Ze(e,t,r){var n;Ye=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:Ye=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:Ye=i)}return null!=n?n:Ye}var Qe=function(){var F="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",z="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";var q=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,H=/[stwN]/,R=/[LRr]/,B=/[Lb1n]/,U=/[1n]/;function j(e,t,r){this.level=e,this.from=t,this.to=r}return function(e,t){var r="ltr"==t?"L":"R";if(0==e.length||"ltr"==t&&!q.test(e))return!1;for(var n,i=e.length,o=[],l=0;l<i;++l)o.push((n=e.charCodeAt(l))<=247?F.charAt(n):1424<=n&&n<=1524?"R":1536<=n&&n<=1785?z.charAt(n-1536):1774<=n&&n<=2220?"r":8192<=n&&n<=8203?"w":8204==n?"b":"L");for(var s=0,a=r;s<i;++s){var c=o[s];"m"==c?o[s]=a:a=c}for(var u=0,f=r;u<i;++u){var d=o[u];"1"==d&&"r"==f?o[u]="n":R.test(d)&&"r"==(f=d)&&(o[u]="R")}for(var h=1,p=o[0];h<i-1;++h){var g=o[h];"+"==g&&"1"==p&&"1"==o[h+1]?o[h]="1":","!=g||p!=o[h+1]||"1"!=p&&"n"!=p||(o[h]=p),p=g}for(var m=0;m<i;++m){var v=o[m];if(","==v)o[m]="N";else if("%"==v){var y=void 0;for(y=m+1;y<i&&"%"==o[y];++y);for(var b=m&&"!"==o[m-1]||y<i&&"1"==o[y]?"1":"N",_=m;_<y;++_)o[_]=b;m=y-1}}for(var x=0,w=r;x<i;++x){var k=o[x];"L"==w&&"1"==k?o[x]="L":R.test(k)&&(w=k)}for(var C=0;C<i;++C)if(H.test(o[C])){var S=void 0;for(S=C+1;S<i&&H.test(o[S]);++S);for(var L="L"==(C?o[C-1]:r),T=L==("L"==(S<i?o[S]:r))?L?"L":"R":r,M=C;M<S;++M)o[M]=T;C=S-1}for(var N,A=[],O=0;O<i;)if(B.test(o[O])){var D=O;for(++O;O<i&&B.test(o[O]);++O);A.push(new j(0,D,O))}else{var W=O,E=A.length;for(++O;O<i&&"L"!=o[O];++O);for(var I=W;I<O;)if(U.test(o[I])){W<I&&A.splice(E,0,new j(1,W,I));var P=I;for(++I;I<O&&U.test(o[I]);++I);A.splice(E,0,new j(2,P,I)),W=I}else++I;W<O&&A.splice(E,0,new j(1,W,O))}return"ltr"==t&&(1==A[0].level&&(N=e.match(/^\s+/))&&(A[0].from=N[0].length,A.unshift(new j(0,0,N[0].length))),1==X(A).level&&(N=e.match(/\s+$/))&&(X(A).to-=N[0].length,A.push(new j(0,i-N[0].length,i)))),"rtl"==t?A.reverse():A}}();function Je(e,t){var r=e.order;return null==r&&(r=e.order=Qe(e.text,t)),r}var et=[],tt=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]||et).concat(r)}};function rt(e,t){return e._handlers&&e._handlers[t]||et}function nt(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=H(i,r);-1<o&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function it(e,t){var r=rt(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 ot(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),it(e,r||t.type,e,t),ft(t)||t.codemirrorIgnore}function lt(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==H(r,t[n])&&r.push(t[n])}function st(e,t){return 0<rt(e,t).length}function at(e){e.prototype.on=function(e,t){tt(this,e,t)},e.prototype.off=function(e,t){nt(this,e,t)}}function ct(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function ut(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function ft(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function dt(e){ct(e),ut(e)}function ht(e){return e.target||e.srcElement}function pt(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),_&&e.ctrlKey&&1==t&&(t=3),t}var gt,mt,vt=function(){if(x&&w<9)return!1;var e=A("div");return"draggable"in e||"dragDrop"in e}();function yt(e){if(null==gt){var t=A("span","​");M(e,A("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(gt=t.offsetWidth<=1&&2<t.offsetHeight&&!(x&&w<8))}var r=gt?A("span","​"):A("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return r.setAttribute("cm-text",""),r}function bt(e){if(null!=mt)return mt;var t=M(e,document.createTextNode("AخA")),r=S(t,0,1).getBoundingClientRect(),n=S(t,1,2).getBoundingClientRect();return T(e),!(!r||r.left==r.right)&&(mt=n.right-r.right<3)}var _t,xt=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)},kt="oncopy"in(_t=A("div"))||(_t.setAttribute("oncopy","return;"),"function"==typeof _t.oncopy),Ct=null;var St={},Lt={};function Tt(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 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=St[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 At(e,t){F(t,Nt.hasOwnProperty(e)?Nt[e]:Nt[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 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 Et=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};Et.prototype.eol=function(){return this.pos>=this.string.length},Et.prototype.sol=function(){return this.pos==this.lineStart},Et.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Et.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Et.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},Et.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Et.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},Et.prototype.skipToEnd=function(){this.pos=this.string.length},Et.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(-1<t)return this.pos=t,!0},Et.prototype.backUp=function(e){this.pos-=e},Et.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)},Et.prototype.indentation=function(){return z(this.string,null,this.tabSize)-(this.lineStart?z(this.string,this.lineStart,this.tabSize):0)},Et.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e);return n&&0<n.index?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},Et.prototype.current=function(){return this.string.slice(this.start,this.pos)},Et.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},Et.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},Et.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var It=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 Ft(t,r,n,e){var a=[t.state.modeGen],i={};Kt(t,r.text,t.doc.mode,n,function(e,t){return a.push(e,t)},i,e);for(var c=n.state,o=function(e){n.baseTokens=a;var o=t.state.overlays[e],l=1,s=0;n.state=!0,Kt(t,r.text,o.mode,n,function(e,t){for(var r=l;s<e;){var n=a[l];e<n&&a.splice(l,1,e,a[l+1],n),l+=2,s=Math.min(e,n)}if(t)if(o.opaque)a.splice(r,l-r,e,"overlay "+t),l=r+2;else for(;r<l;r+=2){var i=a[r+1];a[r+1]=(i?i+" ":"")+"overlay "+t}},i),n.state=c,n.baseTokens=null,n.baseTokenPos=1},l=0;l<t.state.overlays.length;++l)o(l);return{styles:a,classes:i.bgClass||i.textClass?i:null}}function zt(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=qt(e,de(t)),i=t.text.length>e.options.maxHighlightLength&&Ot(e.doc.mode,n.state),o=Ft(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 qt(r,n,e){var t=r.doc,i=r.display;if(!t.mode.startState)return new Pt(t,!0,n);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;l<s;--s){if(s<=o.first)return o.first;var a=ae(o,s-1),c=a.stateAfter;if(c&&(!r||s+(c instanceof It?c.lookAhead:0)<=o.modeFrontier))return s;var u=z(a.text,null,e.options.tabSize);(null==i||u<n)&&(i=s-1,n=u)}return i}(r,n,e),l=o>t.first&&ae(t,o-1).stateAfter,s=l?Pt.fromSaved(t,l,o):new Pt(t,Wt(t.mode),o);return t.iter(o,n,function(e){Ht(r,e.text,s);var t=s.line;e.stateAfter=t==n-1||t%5==0||t>=i.viewFrom&&t<i.viewTo?s.save():null,s.nextLine()}),e&&(t.modeFrontier=s.line),s}function Ht(e,t,r,n){var i=e.doc.mode,o=new Et(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=Dt(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]=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++,0<this.maxLookAhead&&this.maxLookAhead--},Pt.fromSaved=function(e,t,r){return t instanceof It?new Pt(e,Ot(e.mode,t.state),r,t.lookAhead):new Pt(e,Ot(e.mode,t),r)},Pt.prototype.save=function(e){var t=!1!==e?Ot(this.doc.mode,this.state):this.state;return 0<this.maxLookAhead?new It(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 jt(e,t,r,n){var i,o,l=e.doc,s=l.mode,a=ae(l,(t=ke(l,t)).line),c=qt(e,t.line,r),u=new Et(a.text,e.options.tabSize,c);for(n&&(o=[]);(n||u.pos<t.ch)&&!u.eol();)u.start=u.pos,i=Bt(s,u,c.state),n&&o.push(new Ut(u,i,Ot(l.mode,c.state)));return n?o:new Ut(u,i,c.state)}function Gt(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,c=0,u=null,f=new Et(t,e.options.tabSize,n),d=e.options.addModeClass&&[null];for(""==t&&Gt(Rt(r,n.state),o);!f.eol();){if(a=f.pos>e.options.maxHighlightLength?(s=!1,l&&Ht(e,t,n,f.pos),f.pos=t.length,null):Gt(Bt(r,f,n.state,d),o),d){var h=d[0].name;h&&(a="m-"+(a?h+" "+a:h))}if(!s||u!=a){for(;c<f.start;)i(c=Math.min(f.start,c+5e3),u);u=a}f.start=f.pos}for(;c<f.pos;){var p=Math.min(f.pos,c+5e3);i(p,u),c=p}}var Vt=function(e,t,r){this.text=e,We(this,t),this.height=r?r(this):1};Vt.prototype.lineNo=function(){return de(this)},at(Vt);var $t={},Xt={};function Yt(e,t){if(!e||/^\s*$/.test(e))return null;var r=t.addModeClass?Xt:$t;return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Zt(e,t){var r=N("span",null,null,b?"padding-right: .1px":null),n={pre:N("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=Jt,bt(e.display.measure)&&(l=Je(o,e.doc.direction))&&(n.addToken=er(n.addToken,l)),n.map=[],rr(o,n,zt(e,o,t!=e.display.externalMeasured&&de(o))),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=E(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=E(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(yt(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(b){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 it(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=E(n.pre.className,n.textClass||"")),n}function Qt(e){var t=A("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Jt(e,t,r,n,i,o,l){if(t){var s,a=e.splitSpaces?function(e,t){if(1<e.length&&!/ /.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,c=e.cm.state.specialChars,u=!1;if(c.test(t)){s=document.createDocumentFragment();for(var f=0;;){c.lastIndex=f;var d=c.exec(t),h=d?d.index-f:t.length-f;if(h){var p=document.createTextNode(a.slice(f,f+h));x&&w<9?s.appendChild(A("span",[p])):s.appendChild(p),e.map.push(e.pos,e.pos+h,p),e.col+=h,e.pos+=h}if(!d)break;f+=h+1;var g=void 0;if("\t"==d[0]){var m=e.cm.options.tabSize,v=m-e.col%m;(g=s.appendChild(A("span",$(v),"cm-tab"))).setAttribute("role","presentation"),g.setAttribute("cm-text","\t"),e.col+=v}else"\r"==d[0]||"\n"==d[0]?(g=s.appendChild(A("span","\r"==d[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",d[0]):((g=e.cm.options.specialCharPlaceholder(d[0])).setAttribute("cm-text",d[0]),x&&w<9?s.appendChild(A("span",[g])):s.appendChild(g)),e.col+=1;e.map.push(e.pos,e.pos+1,g),e.pos++}}else e.col+=t.length,s=document.createTextNode(a),e.map.push(e.pos,e.pos+t.length,s),x&&w<9&&(u=!0),e.pos+=t.length;if(e.trailingSpace=32==a.charCodeAt(t.length-1),r||n||i||u||l){var y=r||"";n&&(y+=n),i&&(y+=i);var b=A("span",[s],y,l);return o&&(b.title=o),e.content.appendChild(b)}e.content.appendChild(s)}}function er(f,d){return function(e,t,r,n,i,o,l){r=r?r+" cm-force-border":"cm-force-border";for(var s=e.pos,a=s+t.length;;){for(var c=void 0,u=0;u<d.length&&!((c=d[u]).to>s&&c.from<=s);u++);if(c.to>=a)return f(e,t,r,n,i,o,l);f(e,t.slice(0,c.to-s),r,n,null,o,l),n=null,t=t.slice(c.to-s),s=c.to}}}function tr(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 rr(e,t,r){var n=e.markedSpans,i=e.text,o=0;if(n)for(var l,s,a,c,u,f,d,h=i.length,p=0,g=1,m="",v=0;;){if(v==p){a=c=u=f=s="",d=null,v=1/0;for(var y=[],b=void 0,_=0;_<n.length;++_){var x=n[_],w=x.marker;"bookmark"==w.type&&x.from==p&&w.widgetNode?y.push(w):x.from<=p&&(null==x.to||x.to>p||w.collapsed&&x.to==p&&x.from==p)?(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,c=""),w.className&&(a+=" "+w.className),w.css&&(s=(s?s+";":"")+w.css),w.startStyle&&x.from==p&&(u+=" "+w.startStyle),w.endStyle&&x.to==v&&(b||(b=[])).push(w.endStyle,x.to),w.title&&!f&&(f=w.title),w.collapsed&&(!d||Pe(d.marker,w)<0)&&(d=x)):x.from>p&&v>x.from&&(v=x.from)}if(b)for(var k=0;k<b.length;k+=2)b[k+1]==v&&(c+=" "+b[k]);if(!d||d.from==p)for(var C=0;C<y.length;++C)tr(t,0,y[C]);if(d&&(d.from||0)==p){if(tr(t,(null==d.to?h+1:d.to)-p,d.marker,null==d.from),null==d.to)return;d.to==p&&(d=!1)}}if(h<=p)break;for(var S=Math.min(h,v);;){if(m){var L=p+m.length;if(!d){var T=S<L?m.slice(0,S-p):m;t.addToken(t,T,l?l+a:a,u,p+T.length==v?c:"",f,s)}if(S<=L){m=m.slice(S-p),p=S;break}p=L,u=""}m=i.slice(o,o=r[g++]),l=Yt(r[g++],t.cm.options)}}else for(var M=1;M<r.length;M+=2)t.addToken(t,i.slice(o,o=r[M]),Yt(r[M+1],t.cm.options))}function nr(e,t,r){this.line=t,this.rest=function(e){for(var t,r;t=qe(e);)e=t.find(1,!0).line,(r||(r=[])).push(e);return r}(t),this.size=this.rest?de(X(this.rest))-r+1:1,this.node=this.text=null,this.hidden=Ge(e,t)}function ir(e,t,r){for(var n,i=[],o=t;o<r;o=n){var l=new nr(e.doc,ae(e.doc,o),o);n=o+l.size,i.push(l)}return i}var or=null;var lr=null;function sr(e,t){var r=rt(e,t);if(r.length){var n,i=Array.prototype.slice.call(arguments,2);or?n=or.delayedCallbacks:lr?n=lr:(n=lr=[],setTimeout(ar,0));for(var o=function(e){n.push(function(){return r[e].apply(null,i)})},l=0;l<r.length;++l)o(l)}}function ar(){var e=lr;lr=null;for(var t=0;t<e.length;++t)e[t]()}function cr(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i];"text"==o?dr(e,t):"gutter"==o?pr(e,t,r,n):"class"==o?hr(e,t):"widget"==o&&gr(e,t,n)}t.changes=null}function ur(e){return e.node==e.text&&(e.node=A("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),x&&w<8&&(e.node.style.zIndex=2)),e.node}function fr(e,t){var r=e.display.externalMeasured;return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Zt(e,t)}function dr(e,t){var r=t.text.className,n=fr(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=ur(t);t.background=n.insertBefore(A("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 pr(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=A("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=A("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(A("div",ge(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 c=e.options.gutters[a],u=o.hasOwnProperty(c)&&o[c];u&&s.appendChild(A("div",[u],"CodeMirror-gutter-elt","left: "+n.gutterLeft[c]+"px; width: "+n.gutterWidth[c]+"px"))}}}function gr(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);mr(e,t,r)}function mr(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],c=A("div",[a.node],"CodeMirror-linewidget");a.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),yr(a,c,r,n),e.display.input.setUneditable(c),i&&a.above?o.insertBefore(c,r.gutter||r.text):o.appendChild(c),sr(a,"redraw")}}function yr(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 br(e){if(null!=e.height)return e.height;var t=e.doc.cm;if(!t)return 0;if(!O(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;"),M(t.display.measure,A("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function _r(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 xr(e){return e.lineSpace.offsetTop}function wr(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function kr(e){if(e.cachedPaddingH)return e.cachedPaddingH;var t=M(e.measure,A("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 R-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 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(de(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Mr(e,t,r,n){return Or(e,Ar(e,t),r,n)}function Nr(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[sn(e,t)];var r=e.display.externalMeasured;return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Ar(e,t){var r=de(t),n=Nr(e,r);n&&!n.text?n=null:n&&n.changes&&(cr(e,n,r,tn(e)),e.curOp.forceUpdate=!0),n||(n=function(e,t){var r=de(t=Be(t)),n=e.display.externalMeasured=new nr(e.doc,t,r);n.lineN=r;var i=n.built=Zt(e,n);return n.text=i.pre,M(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 Or(e,t,r,n,i){t.before&&(r=-1);var o,l=r+(n||"");return t.cache.hasOwnProperty(l)?o=t.cache[l]:(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],c=l[s+1];2<Math.abs(a.bottom-c.bottom)&&o.push((a.bottom+c.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=Er(t.map,r,n),l=o.node,s=o.start,a=o.end,c=o.collapse;if(3==l.nodeType){for(var u=0;u<4;u++){for(;s&&ie(t.line.text.charAt(o.coverStart+s));)--s;for(;o.coverStart+a<o.coverEnd&&ie(t.line.text.charAt(o.coverStart+a));)++a;if((i=x&&w<9&&0==s&&a==o.coverEnd-o.coverStart?l.parentNode.getBoundingClientRect():Ir(S(l,s,a).getClientRects(),n)).left||i.right||0==s)break;a=s,s-=1,c="right"}x&&w<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=Ct)return Ct;var t=M(e,A("span","x")),r=t.getBoundingClientRect(),n=S(t,0,1).getBoundingClientRect();return Ct=1<Math.abs(r.left-n.left)}(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 f;0<s&&(c=n="right"),i=e.options.lineWrapping&&1<(f=l.getClientRects()).length?f["right"==n?f.length-1:0]:l.getBoundingClientRect()}if(x&&w<9&&!s&&(!i||!i.left&&!i.right)){var d=l.parentNode.getClientRects()[0];i=d?{left:d.left,right:d.left+en(e.display),top:d.top,bottom:d.bottom}:Wr}for(var h=i.top-t.rect.top,p=i.bottom-t.rect.top,g=(h+p)/2,m=t.view.measure.heights,v=0;v<m.length-1&&!(g<m[v]);v++);var y=v?m[v-1]:0,b=m[v],_={left:("right"==c?i.right:i.left)-t.rect.left,right:("left"==c?i.left:i.right)-t.rect.left,top:y,bottom:b};i.left||i.right||(_.bogus=!0);e.options.singleCursorHeightPerLine||(_.rtop=h,_.rbottom=p);return _}(e,t,r,n)).bogus||(t.cache[l]=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 Er(e,t,r){for(var n,i,o,l,s,a,c=0;c<e.length;c+=3)if(s=e[c],a=e[c+1],t<s?(i=0,o=1,l="left"):t<a?o=(i=t-s)+1:(c==e.length-3||t==a&&e[c+3]>t)&&(i=(o=a-s)-1,a<=t&&(l="right")),null!=i){if(n=e[c+2],s==a&&r==(n.insertLeft?"left":"right")&&(l=r),"left"==r&&0==i)for(;c&&e[c-2]==e[c-3]&&e[c-1].insertLeft;)n=e[2+(c-=3)],l="left";if("right"==r&&i==a-s)for(;c<e.length-3&&e[c+3]==e[c+4]&&!e[c+5].insertLeft;)n=e[(c+=3)+2],l="right";break}return{node:n,start:i,end:o,collapse:l,coverStart:s,coverEnd:a}}function Ir(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;0<=i&&(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 Fr(e){e.display.externalMeasure=null,T(e.display.lineMeasure);for(var t=0;t<e.display.view.length;t++)Pr(e.display.view[t])}function zr(e){Fr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function qr(){return l&&f?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Hr(){return l&&f?-(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+=br(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=Ve(t);if("local"==n?l+=xr(e.display):l-=e.display.viewOffset,"page"==n||"window"==n){var s=e.display.lineSpace.getBoundingClientRect();l+=s.top+("window"==n?0:Hr());var a=s.left+("window"==n?0:qr());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-=qr(),i-=Hr();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 jr(e,t,r,n,i){return n||(n=ae(e.doc,t.line)),Br(e,n,Mr(e,n,t.ch,i),r)}function Gr(n,e,i,o,l,s){function a(e,t){var r=Or(n,l,e,t?"right":"left",s);return t?r.left=r.right:r.right=r.left,Br(n,o,r,i)}o=o||ae(n.doc,e.line),l||(l=Ar(n,o));var c=Je(o,n.doc.direction),t=e.ch,r=e.sticky;if(t>=o.text.length?(t=o.text.length,r="before"):t<=0&&(t=0,r="after"),!c)return a("before"==r?t-1:t,"before"==r);function u(e,t,r){return a(r?e-1:e,1==c[t].level!=r)}var f=Ze(c,t,r),d=Ye,h=u(t,f,"before"==r);return null!=d&&(h.other=u(t,d,"before"!=r)),h}function Kr(e,t){var r=0;t=ke(e.doc,t),e.options.lineWrapping||(r=en(e.display)*t.ch);var n=ae(e.doc,t.line),i=Ve(n)+xr(e.display);return{left:r,right:r,top:i,bottom:i+n.height}}function Vr(e,t,r,n,i){var o=me(e,t,r);return o.xRel=i,n&&(o.outside=!0),o}function $r(e,t,r){var n=e.doc;if((r+=e.display.viewOffset)<0)return Vr(n.first,0,null,!0,-1);var i=he(n,r),o=n.first+n.size-1;if(o<i)return Vr(n.first+n.size-1,ae(n,o).text.length,null,!0,1);t<0&&(t=0);for(var l=ae(n,i);;){var s=Qr(e,l,i,t,r),a=He(l,s.ch+(0<s.xRel?1:0));if(!a)return s;var c=a.find(1);if(c.line==i)return c;l=ae(n,i=c.line)}}function Xr(t,e,r,n){n-=Rr(e);var i=e.text.length,o=le(function(e){return Or(t,r,e-1).bottom<=n},i,0);return{begin:o,end:i=le(function(e){return Or(t,r,e).top>n},o,i)}}function Yr(e,t,r,n){return r||(r=Ar(e,t)),Xr(e,t,r,Br(e,t,Or(e,r,n),"line").top)}function Zr(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function Qr(r,e,t,n,i){i-=Ve(e);var o=Ar(r,e),l=Rr(e),s=0,a=e.text.length,c=!0,u=Je(e,r.doc.direction);if(u){var f=(r.options.lineWrapping?function(e,t,r,n,i,o,l){var s=Xr(e,t,n,l),a=s.begin,c=s.end;/\s/.test(t.text.charAt(c-1))&&c--;for(var u=null,f=null,d=0;d<i.length;d++){var h=i[d];if(!(h.from>=c||h.to<=a)){var p=1!=h.level,g=Or(e,n,p?Math.min(c,h.to)-1:Math.max(a,h.from)).right,m=g<o?o-g+1e9:g-o;(!u||m<f)&&(u=h,f=m)}}u||(u=i[i.length-1]);u.from<a&&(u={from:a,to:u.to,level:u.level});u.to>c&&(u={from:u.from,to:c,level:u.level});return u}:function(n,i,o,l,s,a,c){var e=le(function(e){var t=s[e],r=1!=t.level;return Zr(Gr(n,me(o,r?t.to:t.from,r?"before":"after"),"line",i,l),a,c,!0)},0,s.length-1),t=s[e];if(0<e){var r=1!=t.level,u=Gr(n,me(o,r?t.from:t.to,r?"after":"before"),"line",i,l);Zr(u,a,c,!0)&&u.top>c&&(t=s[e-1])}return t})(r,e,t,o,u,n,i);s=(c=1!=f.level)?f.from:f.to-1,a=c?f.to:f.from-1}var d,h,p=null,g=null,m=le(function(e){var t=Or(r,o,e);return t.top+=l,t.bottom+=l,!!Zr(t,n,i,!1)&&(t.top<=i&&t.left<=n&&(p=e,g=t),!0)},s,a),v=!1;if(g){var y=n-g.left<g.right-n,b=y==c;m=p+(b?0:1),h=b?"after":"before",d=y?g.left:g.right}else{c||m!=a&&m!=s||m++,h=0==m?"after":m==e.text.length?"before":Or(r,o,m-(c?1:0)).bottom+l<=i==c?"after":"before";var _=Gr(r,me(t,m,h),"line",e,o);d=_.left,v=i<_.top||i>=_.bottom}return Vr(t,m=oe(e.text,m,1),h,v,n-d)}function Jr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Dr){Dr=A("pre");for(var t=0;t<49;++t)Dr.appendChild(document.createTextNode("x")),Dr.appendChild(A("br"));Dr.appendChild(document.createTextNode("x"))}M(e.measure,Dr);var r=Dr.offsetHeight/50;return 3<r&&(e.cachedTextHeight=r),T(e.measure),r||1}function en(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=A("span","xxxxxxxxxx"),r=A("pre",[t]);M(e.measure,r);var n=t.getBoundingClientRect(),i=(n.right-n.left)/10;return 2<i&&(e.cachedCharWidth=i),i||10}function tn(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:rn(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function rn(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function nn(n){var i=Jr(n.display),o=n.options.lineWrapping,l=o&&Math.max(5,n.display.scroller.clientWidth/en(n.display)-3);return function(e){if(Ge(n.doc,e))return 0;var t=0;if(e.widgets)for(var r=0;r<e.widgets.length;r++)e.widgets[r].height&&(t+=e.widgets[r].height);return o?t+(Math.ceil(e.text.length/l)||1)*i:t+i}}function on(e){var t=e.doc,r=nn(e);t.iter(function(e){var t=r(e);t!=e.height&&fe(e,t)})}function ln(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,c=$r(e,o,l);if(n&&1==c.xRel&&(a=ae(e.doc,c.line).text).length==c.ch){var u=z(a,a.length,e.options.tabSize)-a.length;c=me(c.line,Math.max(0,Math.round((o-kr(e.display).left)/en(e.display))-u))}return c}function sn(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 an(e){e.display.input.showSelection(e.display.input.prepareSelection())}function cn(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)&&un(e,s.head,i),a||dn(e,s,o)}}return n}function un(e,t,r){var n=Gr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(A("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(A("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 fn(e,t){return e.top-t.top||e.left-t.left}function dn(l,e,t){var r=l.display,n=l.doc,i=document.createDocumentFragment(),o=kr(l.display),L=o.left,T=Math.max(r.sizerWidth,Sr(l)-r.sizer.offsetLeft)-o.right,M="ltr"==n.direction;function N(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),i.appendChild(A("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==r?T-e:r)+"px;\n height: "+(n-t)+"px"))}function s(r,y,b){var _,x,o=ae(n,r),w=o.text.length;function k(e,t){return jr(l,me(r,e),"div",o,t)}function C(e,t,r){var n=Yr(l,o,null,e),i="ltr"==t==("after"==r)?"left":"right";return k("after"==r?n.begin:n.end-(/\s/.test(o.text.charAt(n.end-1))?2:1),i)[i]}var S=Je(o,n.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")}(S,y||0,null==b?w:b,function(e,t,r,n){var i="ltr"==r,o=k(e,i?"left":"right"),l=k(t-1,i?"right":"left"),s=null==y&&0==e,a=null==b&&t==w,c=0==n,u=!S||n==S.length-1;if(l.top-o.top<=3){var f=(M?a:s)&&u,d=(M?s:a)&&c?L:(i?o:l).left,h=f?T:(i?l:o).right;N(d,o.top,h-d,o.bottom)}else{var p,g,m,v;v=i?(p=M&&s&&c?L:o.left,g=M?T:C(e,r,"before"),m=M?L:C(t,r,"after"),M&&a&&u?T:l.right):(p=M?C(e,r,"before"):L,g=!M&&s&&c?T:o.right,m=!M&&a&&u?L:l.left,M?C(t,r,"after"):T),N(p,o.top,g-p,o.bottom),o.bottom<l.top&&N(L,o.bottom,null,l.top),N(m,l.top,v-m,l.bottom)}(!_||fn(o,_)<0)&&(_=o),fn(l,_)<0&&(_=l),(!x||fn(o,x)<0)&&(x=o),fn(l,x)<0&&(x=l)}),{start:_,end:x}}var a=e.from(),c=e.to();if(a.line==c.line)s(a.line,a.ch,c.ch);else{var u=ae(n,a.line),f=ae(n,c.line),d=Be(u)==Be(f),h=s(a.line,a.ch,d?u.text.length+1:null).end,p=s(c.line,d?0:null,c.ch).start;d&&(h.top<p.top-2?(N(h.right,h.top,null,h.bottom),N(L,p.top,p.left,p.bottom)):N(h.right,h.top,p.left-h.right,h.bottom)),h.bottom<p.top&&N(L,h.bottom,null,p.top)}t.appendChild(i)}function hn(e){if(e.state.focused){var t=e.display;clearInterval(t.blinker);var r=!0;t.cursorDiv.style.visibility="",0<e.options.cursorBlinkRate?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 pn(e){e.state.focused||(e.display.input.focus(),mn(e))}function gn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,vn(e))},100)}function mn(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(it(e,"focus",e,t),e.state.focused=!0,W(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),b&&setTimeout(function(){return e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),hn(e))}function vn(e,t){e.state.delayingBlurEvent||(e.state.focused&&(it(e,"blur",e,t),e.state.focused=!1,L(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function yn(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(x&&w<8){var l=i.node.offsetTop+i.node.offsetHeight;o=l-r,r=l}else{var s=i.node.getBoundingClientRect();o=s.bottom-s.top}var a=i.line.height-o;if(o<2&&(o=Jr(t)),(.005<a||a<-.005)&&(fe(i.line,o),bn(i.line),i.rest))for(var c=0;c<i.rest.length;c++)bn(i.rest[c])}}}function bn(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 _n(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop;n=Math.floor(n-xr(e));var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=he(t,n),l=he(t,i);if(r&&r.ensure){var s=r.ensure.from.line,a=r.ensure.to.line;s<o?l=he(t,Ve(ae(t,o=s))+e.wrapper.clientHeight):Math.min(a,t.lastLine())>=l&&(o=he(t,Ve(ae(t,a))-e.wrapper.clientHeight),l=a)}return{from:o,to:Math.max(l,o+1)}}function xn(e){var t=e.display,r=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=rn(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=ge(e.options,t.first+t.size-1),n=e.display;if(r.length==n.lineNumChars)return!1;var i=n.measure.appendChild(A("div",[A("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",si(e),!0}function kn(e,t){var r=e.display,n=Jr(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,c=t.bottom>s-n;if(t.top<i)l.scrollTop=a?0:t.top;else if(t.bottom>i+o){var u=Math.min(t.top,(c?s:t.bottom)-o);u!=i&&(l.scrollTop=u)}var f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft,d=Sr(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0),h=t.right-t.left>d;return h&&(t.right=t.left+d),t.left<10?l.scrollLeft=0:t.left<f?l.scrollLeft=Math.max(0,t.left-(h?0:10)):t.right>d+f-3&&(l.scrollLeft=t.right+(h?0:10)-d),l}function Cn(e,t){null!=t&&(Tn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Sn(e){Tn(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||Tn(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function Tn(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Mn(e,Kr(e,t.from),Kr(e,t.to),t.margin))}function Mn(e,t,r,n){var i=kn(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 Nn(e,t){Math.abs(e.doc.scrollTop-t)<2||(g||li(e,{top:t}),An(e,t,!0),g&&li(e),ti(e,100))}function An(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,xn(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Dn(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=A("div",[A("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=A("div",[A("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");n.tabIndex=i.tabIndex=-1,e(n),e(i),tt(n,"scroll",function(){n.clientHeight&&t(n.scrollTop,"vertical")}),tt(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,x&&w<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&&0<e.clientHeight&&(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=_&&!s?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new q,this.disableVert=new q},Wn.prototype.enableZeroWidthBar=function(r,n,i){r.style.pointerEvents="auto",n.set(1e3,function e(){var t=r.getBoundingClientRect();("vert"==i?document.elementFromPoint(t.right-1,(t.top+t.bottom)/2):document.elementFromPoint((t.right+t.left)/2,t.bottom-1))!=r?r.style.pointerEvents="none":n.set(1e3,e)})},Wn.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var En=function(){};function In(e,t){t||(t=Dn(e));var r=e.display.barWidth,n=e.display.barHeight;Pn(e,t);for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&yn(e),Pn(e,Dn(e)),r=e.display.barWidth,n=e.display.barHeight}function Pn(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=""}En.prototype.update=function(){return{bottom:0,right:0}},En.prototype.setScrollLeft=function(){},En.prototype.setScrollTop=function(){},En.prototype.clear=function(){};var Fn={native:Wn,null:En};function zn(r){r.display.scrollbars&&(r.display.scrollbars.clear(),r.display.scrollbars.addClass&&L(r.display.wrapper,r.display.scrollbars.addClass)),r.display.scrollbars=new Fn[r.options.scrollbarStyle](function(e){r.display.wrapper.insertBefore(e,r.display.scrollbarFiller),tt(e,"mousedown",function(){r.state.focused&&setTimeout(function(){return r.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,t){"horizontal"==t?On(r,e):Nn(r,e)},r),r.display.scrollbars.addClass&&W(r.display.wrapper,r.display.scrollbars.addClass)}var qn=0;function Hn(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:++qn},t=e.curOp,or?or.ops.push(t):t.ownsGroup=or={ops:[t],delayedCallbacks:[]}}function Rn(e){var t=e.curOp;t&&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{or=null,t(r)}}(t,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&&ii(i.cm,i.update);var i;for(var o=0;o<t.length;o++)Un(t[o]);for(var l=0;l<t.length;l++)jn(t[l]);for(var s=0;s<t.length;s++)Gn(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&&Xe(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 ni(n,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Un(e){var t=e.cm,r=t.display;e.updatedDisplay&&yn(t),e.barMeasure=Dn(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Mr(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 jn(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)&&In(t,e.barMeasure),e.updatedDisplay&&ai(t,e.barMeasure),e.selectionChanged&&hn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&pn(e.cm)}function Gn(e){var t=e.cm,r=t.display,n=t.doc;(e.updatedDisplay&&oi(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=e.scrollTop&&An(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&On(t,e.scrollLeft,!0,!0),e.scrollToPos)&&function(e,t){if(!ot(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&&!c){var o=A("div","​",null,"position: absolute;\n top: "+(t.top-r.viewOffset-xr(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?me(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?me(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var l=!1,s=Gr(e,t),a=r&&r!=t?Gr(e,r):s,c=kn(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}),u=e.doc.scrollTop,f=e.doc.scrollLeft;if(null!=c.scrollTop&&(Nn(e,c.scrollTop),1<Math.abs(e.doc.scrollTop-u)&&(l=!0)),null!=c.scrollLeft&&(On(e,c.scrollLeft),1<Math.abs(e.doc.scrollLeft-f)&&(l=!0)),!l)break}return i}(t,ke(n,e.scrollToPos.from),ke(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||it(i[l],"hide");if(o)for(var s=0;s<o.length;++s)o[s].lines.length&&it(o[s],"unhide");r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&it(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Kn(e,t){if(e.curOp)return t();Hn(e);try{return t()}finally{Rn(e)}}function Vn(e,t){return function(){if(e.curOp)return t.apply(e,arguments);Hn(e);try{return t.apply(e,arguments)}finally{Rn(e)}}}function $n(e){return function(){if(this.curOp)return e.apply(this,arguments);Hn(this);try{return e.apply(this,arguments)}finally{Rn(this)}}}function Xn(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);Hn(e);try{return t.apply(this,arguments)}finally{Rn(e)}}}function Yn(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)Le&&Ue(e.doc,t)<i.viewTo&&Qn(e);else if(r<=i.viewFrom)Le&&je(e.doc,r+n)>i.viewFrom?Qn(e):(i.viewFrom+=n,i.viewTo+=n);else if(t<=i.viewFrom&&r>=i.viewTo)Qn(e);else if(t<=i.viewFrom){var o=Jn(e,r,r+n,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):Qn(e)}else if(r>=i.viewTo){var l=Jn(e,t,t,-1);l?(i.view=i.view.slice(0,l.index),i.viewTo=l.lineN):Qn(e)}else{var s=Jn(e,t,t,-1),a=Jn(e,r,r+n,1);s&&a?(i.view=i.view.slice(0,s.index).concat(ir(e,s.lineN,a.lineN)).concat(i.view.slice(a.index)),i.viewTo+=n):Qn(e)}var c=i.externalMeasured;c&&(r<c.lineN?c.lineN+=n:t<c.lineN+c.size&&(i.externalMeasured=null))}function Zn(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[sn(e,t)];if(null!=o.node){var l=o.changes||(o.changes=[]);-1==H(l,r)&&l.push(r)}}}function Qn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Jn(e,t,r,n){var i,o=sn(e,t),l=e.display.view;if(!Le||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(0<n){if(o==l.length-1)return null;i=s+l[o].size-t,o++}else i=s-t;t+=i,r+=i}for(;Ue(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 ei(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 ti(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,P(ri,e))}function ri(a){var c=a.doc;if(!(c.highlightFrontier>=a.display.viewTo)){var u=+new Date+a.options.workTime,f=qt(a,c.highlightFrontier),d=[];c.iter(f.line,Math.min(c.first+c.size,a.display.viewTo+500),function(e){if(f.line>=a.display.viewFrom){var t=e.styles,r=e.text.length>a.options.maxHighlightLength?Ot(c.mode,f.state):null,n=Ft(a,e,f,!0);r&&(f.state=r),e.styles=n.styles;var i=e.styleClasses,o=n.classes;o?e.styleClasses=o:i&&(e.styleClasses=null);for(var l=!t||t.length!=e.styles.length||i!=o&&(!i||!o||i.bgClass!=o.bgClass||i.textClass!=o.textClass),s=0;!l&&s<t.length;++s)l=t[s]!=e.styles[s];l&&d.push(f.line),e.stateAfter=f.save(),f.nextLine()}else e.text.length<=a.options.maxHighlightLength&&Ht(a,e.text,f),e.stateAfter=f.line%5==0?f.save():null,f.nextLine();if(+new Date>u)return ti(a,a.options.workDelay),!0}),c.highlightFrontier=f.line,c.modeFrontier=Math.max(c.modeFrontier,f.line),d.length&&Kn(a,function(){for(var e=0;e<d.length;e++)Zn(a,d[e],"text")})}}var ni=function(e,t,r){var n=e.display;this.viewport=t,this.visible=_n(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=tn(e),this.events=[]};function ii(e,t){var r=e.display,n=e.doc;if(t.editorIsHidden)return Qn(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==ei(e))return!1;wn(e)&&(Qn(e),t.dims=tn(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)),Le&&(o=Ue(e.doc,o),l=je(e.doc,l));var s,a,c,u,f=o!=r.viewFrom||l!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth;a=o,c=l,0==(u=(s=e).display).view.length||a>=u.viewTo||c<=u.viewFrom?(u.view=ir(s,a,c),u.viewFrom=a):(u.viewFrom>a?u.view=ir(s,a,u.viewFrom).concat(u.view):u.viewFrom<a&&(u.view=u.view.slice(sn(s,a))),u.viewFrom=a,u.viewTo<c?u.view=u.view.concat(ir(s,u.viewTo,c)):u.viewTo>c&&(u.view=u.view.slice(0,sn(s,c)))),u.viewTo=c,r.viewOffset=Ve(ae(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px";var d=ei(e);if(!f&&0==d&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1;var h=function(e){if(e.hasFocus())return null;var t=D();if(!t||!O(e.display.lineDiv,t))return null;var r={activeElt:t};if(window.getSelection){var n=window.getSelection();n.anchorNode&&n.extend&&O(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 4<d&&(r.lineDiv.style.display="none"),function(r,e,t){var n=r.display,i=r.options.lineNumbers,o=n.lineDiv,l=o.firstChild;function s(e){var t=e.nextSibling;return b&&_&&r.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),t}for(var a=n.view,c=n.viewFrom,u=0;u<a.length;u++){var f=a[u];if(f.hidden);else if(f.node&&f.node.parentNode==o){for(;l!=f.node;)l=s(l);var d=i&&null!=e&&e<=c&&f.lineNumber;f.changes&&(-1<H(f.changes,"gutter")&&(d=!1),cr(r,f,c,t)),d&&(T(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(ge(r.options,c)))),l=f.node.nextSibling}else{var h=(m=c,v=t,void 0,y=fr(p=r,g=f),g.text=g.node=y.pre,y.bgClass&&(g.bgClass=y.bgClass),y.textClass&&(g.textClass=y.textClass),hr(p,g),pr(p,g,m,v),mr(p,g,v),g.node);o.insertBefore(h,l)}c+=f.size}var p,g,m,v,y;for(;l;)l=s(l)}(e,r.updateLineNumbers,t.dims),4<d&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(e){if(e&&e.activeElt&&e.activeElt!=D()&&(e.activeElt.focus(),e.anchorNode&&O(document.body,e.anchorNode)&&O(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)}}(h),T(r.cursorDiv),T(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,f&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,ti(e,400)),!(r.updateLineNumbers=null)}function oi(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=_n(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&ii(e,t);n=!1){yn(e);var i=Dn(e);an(e),In(e,i),ai(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 li(e,t){var r=new ni(e,t);if(ii(e,r)){yn(e),oi(e,r);var n=Dn(e);an(e),In(e,n),ai(e,n),r.finish()}}function si(e){var t=e.display.gutters.offsetWidth;e.display.sizer.style.marginLeft=t+"px"}function ai(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 ci(e){var t=e.display.gutters,r=e.options.gutters;T(t);for(var n=0;n<r.length;++n){var i=r[n],o=t.appendChild(A("div",null,"CodeMirror-gutter "+i));"CodeMirror-linenumbers"==i&&((e.display.lineGutter=o).style.width=(e.display.lineNumWidth||1)+"px")}t.style.display=n?"":"none",si(e)}function ui(e){var t=H(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):-1<t&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}ni.prototype.signal=function(e,t){st(e,t)&&this.events.push(arguments)},ni.prototype.finish=function(){for(var e=0;e<this.events.length;e++)it.apply(null,this.events[e])};var fi=0,di=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 pi(e){var t=hi(e);return t.x*=di,t.y*=di,t}function gi(e,t){var r=hi(t),n=r.x,i=r.y,o=e.display,l=o.scroller,s=l.scrollWidth>l.clientWidth,a=l.scrollHeight>l.clientHeight;if(n&&s||i&&a){if(i&&_&&b)e:for(var c=t.target,u=o.view;c!=l;c=c.parentNode)for(var f=0;f<u.length;f++)if(u[f].node==c){e.display.currentWheelTarget=c;break e}if(n&&!g&&!m&&null!=di)return i&&a&&Nn(e,Math.max(0,l.scrollTop+i*di)),On(e,Math.max(0,l.scrollLeft+n*di)),(!i||i&&a)&&ct(t),void(o.wheelStartX=null);if(i&&null!=di){var d=i*di,h=e.doc.scrollTop,p=h+o.wrapper.clientHeight;d<0?h=Math.max(0,h+d-50):p=Math.min(e.doc.height,p+d+50),li(e,{top:h,bottom:p})}fi<20&&(null==o.wheelStartX?(o.wheelStartX=l.scrollLeft,o.wheelStartY=l.scrollTop,o.wheelDX=n,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=l.scrollLeft-o.wheelStartX,t=l.scrollTop-o.wheelStartY,r=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,r&&(di=(di*fi+r)/(fi+1),++fi)}},200)):(o.wheelDX+=n,o.wheelDY+=i))}}x?di=-.53:g?di=15:l?di=-.7:a&&(di=-1/3);var mi=function(e,t){this.ranges=e,this.primIndex=t};mi.prototype.primary=function(){return this.ranges[this.primIndex]},mi.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(!ye(r.anchor,n.anchor)||!ye(r.head,n.head))return!1}return!0},mi.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new vi(be(this.ranges[t].anchor),be(this.ranges[t].head));return new mi(e,this.primIndex)},mi.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0;return!1},mi.prototype.contains=function(e,t){t||(t=e);for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r];if(0<=ve(t,n.from())&&ve(e,n.to())<=0)return r}return-1};var vi=function(e,t){this.anchor=e,this.head=t};function yi(e,t,r){var n=e&&e.options.selectionsMayTouch,i=t[r];t.sort(function(e,t){return ve(e.from(),t.from())}),r=H(t,i);for(var o=1;o<t.length;o++){var l=t[o],s=t[o-1],a=ve(s.to(),l.from());if(n&&!l.empty()?0<a:0<=a){var c=xe(s.from(),l.from()),u=_e(s.to(),l.to()),f=s.empty()?l.from()==l.head:s.from()==s.head;o<=r&&--r,t.splice(--o,2,new vi(f?u:c,f?c:u))}}return new mi(t,r)}function bi(e,t){return new mi([new vi(e,t||e)],0)}function _i(e){return e.text?me(e.from.line+e.text.length-1,X(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function xi(e,t){if(ve(e,t.from)<0)return e;if(ve(e,t.to)<=0)return _i(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+=_i(t).ch-t.to.ch),me(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 vi(xi(i.anchor,t),xi(i.head,t)))}return yi(e.cm,r,e.sel.primIndex)}function ki(e,t,r){return e.line==t.line?me(r.line,e.ch-t.ch+r.ch):me(r.line+(e.line-t.line),e.ch)}function Ci(e){e.doc.mode=Mt(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,ti(e,100),e.state.modeGen++,e.curOp&&Yn(e)}function Li(e,t){return 0==t.from.ch&&0==t.to.ch&&""==X(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ti(e,n,t,i){function o(e){return t?t[e]:null}function r(e,t,r){!function(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),De(e),We(e,r);var i=n?n(e):1;i!=e.height&&fe(e,i)}(e,t,r,i),sr(e,"change",e,n)}function l(e,t){for(var r=[],n=e;n<t;++n)r.push(new Vt(c[n],o(n),i));return r}var s=n.from,a=n.to,c=n.text,u=ae(e,s.line),f=ae(e,a.line),d=X(c),h=o(c.length-1),p=a.line-s.line;if(n.full)e.insert(0,l(0,c.length)),e.remove(c.length,e.size-c.length);else if(Li(e,n)){var g=l(0,c.length-1);r(f,f.text,h),p&&e.remove(s.line,p),g.length&&e.insert(s.line,g)}else if(u==f)if(1==c.length)r(u,u.text.slice(0,s.ch)+d+u.text.slice(a.ch),h);else{var m=l(1,c.length-1);m.push(new Vt(d+u.text.slice(a.ch),h,i)),r(u,u.text.slice(0,s.ch)+c[0],o(0)),e.insert(s.line+1,m)}else if(1==c.length)r(u,u.text.slice(0,s.ch)+c[0]+f.text.slice(a.ch),o(0)),e.remove(s.line+1,p);else{r(u,u.text.slice(0,s.ch)+c[0],o(0)),r(f,d+f.text.slice(a.ch),h);var v=l(1,c.length-1);1<p&&e.remove(s.line+1,p-1),e.insert(s.line+1,v)}sr(e,"change",e,n)}function Mi(e,s,a){!function e(t,r,n){if(t.linked)for(var i=0;i<t.linked.length;++i){var o=t.linked[i];if(o.doc!=r){var l=n&&o.sharedHist;a&&!l||(s(o.doc,l),e(o.doc,t,l))}}}(e,null,!0)}function Ni(e,t){if(t.cm)throw new Error("This document is already in use.");on((e.doc=t).cm=e),Ci(e),Ai(e),e.options.lineWrapping||Xe(e),e.options.mode=t.modeOption,Yn(e)}function Ai(e){("rtl"==e.doc.direction?W:L)(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 Di(e,t){var r={from:be(t.from),to:_i(t),text:ce(e,t.from,t.to)};return Fi(e,r,t.from.line,t.to.line+1),Mi(e,function(e){return Fi(e,r,t.from.line,t.to.line+1)},!0),r}function Wi(e){for(;e.length;){if(!X(e).ranges)break;e.pop()}}function Ei(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)&&i.lastModTime>a-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=(s=i).lastOp==n?(Wi(s.done),X(s.done)):s.done.length&&!X(s.done).ranges?X(s.done):1<s.done.length&&!s.done[s.done.length-2].ranges?(s.done.pop(),X(s.done)):void 0))l=X(o.changes),0==ve(t.from,t.to)&&0==ve(t.from,l.to)?l.to=_i(t):o.changes.push(Di(e,t));else{var c=X(i.done);for(c&&c.ranges||Pi(e.sel,i.done),o={changes:[Di(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||it(e,"historyAdded")}function Ii(e,t,r,n){var i,o,l,s,a,c=e.history,u=n&&n.origin;r==c.lastSelOp||u&&c.lastSelOrigin==u&&(c.lastModTime==c.lastSelTime&&c.lastOrigin==u||(i=e,o=u,l=X(c.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)))?c.done[c.done.length-1]=t:Pi(t,c.done),c.lastSelTime=+new Date,c.lastSelOrigin=u,c.lastSelOp=r,n&&!1!==n.clearRedo&&Wi(c.undone)}function Pi(e,t){var r=X(t);r&&r.ranges&&r.equals(e)||t.push(e)}function Fi(t,r,e,n){var i=r["spans_"+t.id],o=0;t.iter(Math.max(t.first,e),Math.min(t.first+t.size,n),function(e){e.markedSpans&&((i||(i=r["spans_"+t.id]={}))[o]=e.markedSpans),++o})}function zi(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 qi(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(zi(r[i]));return n}(e,t),n=Ae(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],c=0;c<o.length;++c)if(o[c].marker==a.marker)continue e;o.push(a)}else l&&(r[i]=l)}return r}function Hi(e,t,r){for(var n=[],i=0;i<e.length;++i){var o=e[i];if(o.ranges)n.push(r?mi.prototype.deepCopy.call(o):o);else{var l=o.changes,s=[];n.push({changes:s});for(var a=0;a<l.length;++a){var c=l[a],u=void 0;if(s.push({from:c.from,to:c.to,text:c.text}),t)for(var f in c)(u=f.match(/^spans_(\d+)$/))&&-1<H(t,Number(u[1]))&&(X(s)[f]=c[f],delete c[f])}}}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 vi(i,t)}return new vi(r||t,t)}function Bi(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Vi(e,new mi([Ri(e.sel.primary(),t,r,i)],0),n)}function Ui(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);Vi(e,yi(e.cm,n,e.sel.primIndex),r)}function ji(e,t,r,n){var i=e.sel.ranges.slice(0);i[t]=r,Vi(e,yi(e.cm,i,e.sel.primIndex),n)}function Gi(e,t,r,n){Vi(e,bi(t,r),n)}function Ki(e,t,r){var n=e.history.done,i=X(n);i&&i.ranges?$i(e,n[n.length-1]=t,r):Vi(e,t,r)}function Vi(e,t,r){$i(e,t,r),Ii(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function $i(e,t,r){var n,i,o,l;(st(e,"beforeSelectionChange")||e.cm&&st(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 vi(ke(n,e[t].anchor),ke(n,e[t].head))},origin:o&&o.origin},it(n,"beforeSelectionChange",n,l),n.cm&&it(n.cm,"beforeSelectionChange",n.cm,l),t=l.ranges!=i.ranges?yi(n.cm,l.ranges,l.ranges.length-1):i),Xi(e,Zi(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 Xi(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=e.cm.curOp.selectionChanged=!0,lt(e.cm)),sr(e,"cursorActivity",e))}function Yi(e){Xi(e,Zi(e,e.sel,null,!1))}function Zi(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=Ji(e,l.anchor,s&&s.anchor,r,n),c=Ji(e,l.head,s&&s.head,r,n);(i||a!=l.anchor||c!=l.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new vi(a,c))}return i?yi(e.cm,i,t.primIndex):t}function Qi(e,t,r,n,i){var o=ae(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&&(it(a,"beforeCursorEnter"),a.explicitlyCleared)){if(o.markedSpans){--l;continue}break}if(!a.atomic)continue;if(r){var c=a.find(n<0?1:-1),u=void 0;if((n<0?a.inclusiveRight:a.inclusiveLeft)&&(c=eo(e,c,-n,c&&c.line==t.line?o:null)),c&&c.line==t.line&&(u=ve(c,r))&&(n<0?u<0:0<u))return Qi(e,c,t,n,i)}var f=a.find(n<0?-1:1);return(n<0?a.inclusiveLeft:a.inclusiveRight)&&(f=eo(e,f,n,f.line==t.line?o:null)),f?Qi(e,f,t,n,i):null}}return t}function Ji(e,t,r,n,i){var o=n||1,l=Qi(e,t,r,o,i)||!i&&Qi(e,t,r,o,!0)||Qi(e,t,r,-o,i)||!i&&Qi(e,t,r,-o,!0);return l||(e.cantEdit=!0,me(e.first,0))}function eo(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?ke(e,me(t.line-1)):null:0<r&&t.ch==(n||ae(e,t.line)).text.length?t.line<e.first+e.size-1?me(t.line+1,0):null:new me(t.line,t.ch+r)}function to(e){e.setSelection(me(e.firstLine(),0),me(e.lastLine()),U)}function ro(i,e,t){var o={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){return o.canceled=!0}};return t&&(o.update=function(e,t,r,n){e&&(o.from=ke(i,e)),t&&(o.to=ke(i,t)),r&&(o.text=r),void 0!==n&&(o.origin=n)}),it(i,"beforeChange",i,o),i.cm&&it(i.cm,"beforeChange",i.cm,o),o.canceled?null:{from:o.from,to:o.to,text:o.text,origin:o.origin}}function no(e,t,r){if(e.cm){if(!e.cm.curOp)return Vn(e.cm,no)(e,t,r);if(e.cm.state.suppressEdits)return}if(!(st(e,"beforeChange")||e.cm&&st(e.cm,"beforeChange"))||(t=ro(e,t,!0))){var n=Se&&!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!=H(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 c=i[a];if(!(ve(c.to,s.from)<0||0<ve(c.from,s.to))){var u=[a,1],f=ve(c.from,s.from),d=ve(c.to,s.to);(f<0||!l.inclusiveLeft&&!f)&&u.push({from:c.from,to:s.from}),(0<d||!l.inclusiveRight&&!d)&&u.push({from:s.to,to:c.to}),i.splice.apply(i,u),a+=u.length-3}}return i}(e,t.from,t.to);if(n)for(var i=n.length-1;0<=i;--i)io(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin});else io(e,t)}}function io(e,r){if(1!=r.text.length||""!=r.text[0]||0!=ve(r.from,r.to)){var t=wi(e,r);Ei(e,r,t,e.cm?e.cm.curOp.id:NaN),so(e,r,t,Ae(e,r));var n=[];Mi(e,function(e,t){t||-1!=H(n,e.history)||(fo(e.history,r),n.push(e.history)),so(e,r,null,Ae(e,r))})}}function oo(i,o,e){var t=i.cm&&i.cm.state.suppressEdits;if(!t||e){for(var l,r=i.history,n=i.sel,s="undo"==o?r.done:r.undone,a="undo"==o?r.undone:r.done,c=0;c<s.length&&(l=s[c],e?!l.ranges||l.equals(i.sel):l.ranges);c++);if(c!=s.length){for(r.lastOrigin=r.lastSelOrigin=null;;){if(!(l=s.pop()).ranges){if(t)return void s.push(l);break}if(Pi(l,a),e&&!l.equals(i.sel))return void Vi(i,l,{clearRedo:!1});n=l}var u=[];Pi(n,a),a.push({changes:u,generation:r.generation}),r.generation=l.generation||++r.maxGeneration;for(var f=st(i,"beforeChange")||i.cm&&st(i.cm,"beforeChange"),d=function(e){var r=l.changes[e];if(r.origin=o,f&&!ro(i,r,!1))return s.length=0,{};u.push(Di(i,r));var t=e?wi(i,r):X(s);so(i,r,t,qi(i,r)),!e&&i.cm&&i.cm.scrollIntoView({from:r.from,to:_i(r)});var n=[];Mi(i,function(e,t){t||-1!=H(n,e.history)||(fo(e.history,r),n.push(e.history)),so(e,r,null,qi(e,r))})},h=l.changes.length-1;0<=h;--h){var p=d(h);if(p)return p.v}}}}function lo(e,t){if(0!=t&&(e.first+=t,e.sel=new mi(Y(e.sel.ranges,function(e){return new vi(me(e.anchor.line+t,e.anchor.ch),me(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){Yn(e.cm,e.first,e.first-t,t);for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)Zn(e.cm,n,"gutter")}}function so(e,t,r,n){if(e.cm&&!e.cm.curOp)return Vn(e.cm,so)(e,t,r,n);if(t.to.line<e.first)lo(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);lo(e,i),t={from:me(e.first,0),to:me(t.to.line+i,t.to.ch),text:[X(t.text)],origin:t.origin}}var o=e.lastLine();t.to.line>o&&(t={from:t.from,to:me(o,ae(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=ce(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=de(Be(ae(n,o.line))),n.iter(a,l.line+1,function(e){if(e==i.maxLine)return s=!0}));-1<n.sel.contains(t.from,t.to)&&lt(e);Ti(n,t,r,nn(e)),e.options.lineWrapping||(n.iter(a,o.line+t.text.length,function(e){var t=$e(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;r<n;n--){var i=ae(e,n).stateAfter;if(i&&(!(i instanceof It)||n+i.lookAhead<t)){r=n+1;break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}})(n,o.line),ti(e,400);var c=t.text.length-(l.line-o.line)-1;t.full?Yn(e):o.line!=l.line||1!=t.text.length||Li(e.doc,t)?Yn(e,o.line,l.line+1,c):Zn(e,o.line,"text");var u=st(e,"changes"),f=st(e,"change");if(f||u){var d={from:o,to:l,text:t.text,removed:t.removed,origin:t.origin};f&&sr(e,"change",e,d),u&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(d)}e.display.selForContextMenu=null}(e.cm,t,n):Ti(e,t,n),$i(e,r,U)}}function ao(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)),no(e,{from:r,to:n,text:t,origin:i})}function co(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function uo(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++)co(o.ranges[s].anchor,t,r,n),co(o.ranges[s].head,t,r,n)}else{for(var a=0;a<o.changes.length;++a){var c=o.changes[a];if(r<c.from.line)c.from=me(c.from.line+n,c.from.ch),c.to=me(c.to.line+n,c.to.ch);else if(t<=c.to.line){l=!1;break}}l||(e.splice(0,i+1),i=0)}}}function fo(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1;uo(e.done,r,n,i),uo(e.undone,r,n,i)}function ho(e,t,r,n){var i=t,o=t;return"number"==typeof t?o=ae(e,we(e,t)):i=de(t),null==i?null:(n(o,i)&&e.cm&&Zn(e.cm,i,r),o)}function po(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 go(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}vi.prototype.from=function(){return xe(this.anchor,this.head)},vi.prototype.to=function(){return _e(this.anchor,this.head)},vi.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},po.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,De(r),sr(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}},go.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&&(1<this.children.length||!(this.children[0]instanceof po))){var s=[];this.collapse(s),this.children=[new po(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&&50<i.lines.length){for(var l=i.lines.length%25+25,s=l;s<i.lines.length;){var a=new po(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 go(e.children.splice(e.children.length-5,5));if(e.parent){e.size-=t.size,e.height-=t.height;var r=H(e.parent.children,e);e.parent.children.splice(r+1,0,t)}else{var n=new go(e.children);(n.parent=e).children=[n,t],e=n}t.parent=e.parent}while(10<e.children.length);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 mo=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 vo(e,t,r){Ve(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Cn(e,r)}mo.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=de(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=br(this);fe(r,Math.max(0,r.height-o)),e&&(Kn(e,function(){vo(e,r,-o),Zn(e,n,"widget")}),sr(e,"lineWidgetCleared",e,this,n))}},mo.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line;this.height=null;var i=br(this)-t;i&&(Ge(this.doc,n)||fe(n,n.height+i),r&&Kn(r,function(){r.curOp.forceUpdate=!0,vo(r,n,i),sr(r,"lineWidgetChanged",r,e,de(n))}))},at(mo);var yo=0,bo=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++yo};function _o(t,n,i,e,r){if(e&&e.shared)return function(e,r,n,i,o){(i=F(i)).shared=!1;var l=[_o(e,r,n,i,o)],s=l[0],a=i.widgetNode;return Mi(e,function(e){a&&(i.widgetNode=a.cloneNode(!0)),l.push(_o(e,ke(e,r),ke(e,n),i,o));for(var t=0;t<e.linked.length;++t)if(e.linked[t].isParent)return;s=X(l)}),new xo(l,s)}(t,n,i,e,r);if(t.cm&&!t.cm.curOp)return Vn(t.cm,_o)(t,n,i,e,r);var o=new bo(t,r),l=ve(n,i);if(e&&F(e,o,!1),0<l||0==l&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=N("span",[o.replacedWith],"CodeMirror-widget"),e.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),e.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Re(t,n.line,n,i,o)||n.line!=i.line&&Re(t,i.line,n,i,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Le=!0}o.addToHistory&&Ei(t,{from:n,to:i,origin:"markText"},t.sel,NaN);var s,a=n.line,c=t.cm;if(t.iter(a,i.line+1,function(e){var t,r;c&&o.collapsed&&!c.options.lineWrapping&&Be(e)==c.display.maxLine&&(s=!0),o.collapsed&&a!=n.line&&fe(e,0),t=e,r=new Te(o,a==n.line?n.ch:null,a==i.line?i.ch:null),t.markedSpans=t.markedSpans?t.markedSpans.concat([r]):[r],r.marker.attachLine(t),++a}),o.collapsed&&t.iter(n.line,i.line+1,function(e){Ge(t,e)&&fe(e,0)}),o.clearOnEnter&&tt(o,"beforeCursorEnter",function(){return o.clear()}),o.readOnly&&(Se=!0,(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++yo,o.atomic=!0),c){if(s&&(c.curOp.updateMaxLine=!0),o.collapsed)Yn(c,n.line,i.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=n.line;u<=i.line;u++)Zn(c,u,"text");o.atomic&&Yi(c.doc),sr(c,"markerAdded",c,o)}return o}bo.prototype.clear=function(){var e=this;if(!this.explicitlyCleared){var t=this.doc.cm,r=t&&!t.curOp;if(r&&Hn(t),st(this,"clear")){var n=this.find();n&&sr(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?Zn(t,de(s),"text"):t&&(null!=a.to&&(o=de(s)),null!=a.from&&(i=de(s))),s.markedSpans=Ne(s.markedSpans,a),null==a.from&&e.collapsed&&!Ge(e.doc,s)&&t&&fe(s,Jr(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var c=0;c<this.lines.length;++c){var u=Be(e.lines[c]),f=$e(u);f>t.display.maxLineLength&&(t.display.maxLine=u,t.display.maxLineLength=f,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&Yn(t,i,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&Yi(t.doc)),t&&sr(t,"markerCleared",t,this,i,o),r&&Rn(t),this.parent&&this.parent.clear()}},bo.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=me(t?o:de(o),l.from),-1==e))return r;if(null!=l.to&&(n=me(t?o:de(o),l.to),1==e))return n}return r&&{from:r,to:n}},bo.prototype.changed=function(){var o=this,l=this.find(-1,!0),s=this,a=this.doc.cm;l&&a&&Kn(a,function(){var e=l.line,t=de(l.line),r=Nr(a,t);if(r&&(Pr(r),a.curOp.selectionChanged=a.curOp.forceUpdate=!0),a.curOp.updateMaxLine=!0,!Ge(s.doc,e)&&null!=s.height){var n=s.height;s.height=null;var i=br(s)-n;i&&fe(e,e.height+i)}sr(a,"markerChanged",a,o)})},bo.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;t.maybeHiddenMarkers&&-1!=H(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},bo.prototype.detachLine=function(e){if(this.lines.splice(H(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},at(bo);var xo=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(me(e.first,0),e.clipPos(me(e.lastLine())),function(e){return e.parent})}function ko(o){for(var e=function(e){var t=o[e],r=[t.primary.doc];Mi(t.primary.doc,function(e){return r.push(e)});for(var n=0;n<t.markers.length;n++){var i=t.markers[n];-1==H(r,i.doc)&&(i.parent=null,t.markers.splice(n--,1))}},t=0;t<o.length;t++)e(t)}xo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var e=0;e<this.markers.length;++e)this.markers[e].clear();sr(this,"clear")}},xo.prototype.find=function(e,t){return this.primary.find(e,t)},at(xo);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),go.call(this,[new po([new Vt("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r;var o=me(r,0);this.sel=bi(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)),Ti(this,{from:o,to:o,text:e}),Vi(this,bi(o),U)};So.prototype=Q(go.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:Xn(function(e){var t=me(this.first,0),r=this.first+this.size-1;no(this,{from:t,to:me(r,ae(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Ln(this.cm,0,0),Vi(this,bi(t),U)}),replaceRange:function(e,t,r,n){ao(this,e,t=ke(this,t),r=r?ke(this,r):t,n)},getRange:function(e,t,r){var n=ce(this,ke(this,e),ke(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(pe(this,e))return ae(this,e)},getLineNumber:function(e){return de(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=ae(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 ke(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:Xn(function(e,t,r){Gi(this,ke(this,"number"==typeof e?me(e,t||0):e),null,r)}),setSelection:Xn(function(e,t,r){Gi(this,ke(this,e),ke(this,t||e),r)}),extendSelection:Xn(function(e,t,r){Bi(this,ke(this,e),t&&ke(this,t),r)}),extendSelections:Xn(function(e,t){Ui(this,Ce(this,e),t)}),extendSelectionsBy:Xn(function(e,t){Ui(this,Ce(this,Y(this.sel.ranges,e)),t)}),setSelections:Xn(function(e,t,r){if(e.length){for(var n=[],i=0;i<e.length;i++)n[i]=new vi(ke(this,e[i].anchor),ke(this,e[i].head));null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Vi(this,yi(this.cm,n,t),r)}}),addSelection:Xn(function(e,t,r){var n=this.sel.ranges.slice(0);n.push(new vi(ke(this,e),ke(this,t||e))),Vi(this,yi(this.cm,n,n.length-1),r)}),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=ce(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=ce(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:Xn(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=me(e.first,0),o=i,l=0;l<t.length;l++){var s=t[l],a=ki(s.from,i,o),c=ki(_i(s),i,o);if(i=s.to,o=c,"around"==r){var u=e.sel.ranges[l],f=ve(u.head,u.anchor)<0;n[l]=new vi(f?c:a,f?a:c)}else n[l]=new vi(a,a)}return new mi(n,e.sel.primIndex)}(this,n,t),a=n.length-1;0<=a;a--)no(this,n[a]);s?Ki(this,s):this.cm&&Sn(this.cm)}),undo:Xn(function(){oo(this,"undo")}),redo:Xn(function(){oo(this,"redo")}),undoSelection:Xn(function(){oo(this,"undo",!0)}),redoSelection:Xn(function(){oo(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:Hi(this.history.done),undone:Hi(this.history.undone)}},setHistory:function(e){var t=this.history=new Oi(this.history.maxGeneration);t.done=Hi(e.done.slice(0),null,!0),t.undone=Hi(e.undone.slice(0),null,!0)},setGutterMarker:Xn(function(e,r,n){return ho(this,e,"gutter",function(e){var t=e.gutterMarkers||(e.gutterMarkers={});return!(t[r]=n)&&re(t)&&(e.gutterMarkers=null),!0})}),clearGutter:Xn(function(t){var r=this;this.iter(function(e){e.gutterMarkers&&e.gutterMarkers[t]&&ho(r,e,"gutter",function(){return e.gutterMarkers[t]=null,re(e.gutterMarkers)&&(e.gutterMarkers=null),!0})})}),lineInfo:function(e){var t;if("number"==typeof e){if(!pe(this,e))return null;if(!(e=ae(this,t=e)))return null}else if(null==(t=de(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:Xn(function(e,r,n){return ho(this,e,"gutter"==r?"gutter":"class",function(e){var t="text"==r?"textClass":"background"==r?"bgClass":"gutter"==r?"gutterClass":"wrapClass";if(e[t]){if(C(n).test(e[t]))return!1;e[t]+=" "+n}else e[t]=n;return!0})}),removeLineClass:Xn(function(e,o,l){return ho(this,e,"gutter"==o?"gutter":"class",function(e){var t="text"==o?"textClass":"background"==o?"bgClass":"gutter"==o?"gutterClass":"wrapClass",r=e[t];if(!r)return!1;if(null==l)e[t]=null;else{var n=r.match(C(l));if(!n)return!1;var i=n.index+n[0].length;e[t]=r.slice(0,n.index)+(n.index&&i!=r.length?" ":"")+r.slice(i)||null}return!0})}),addLineWidget:Xn(function(e,t,r){return i=e,o=new mo(n=this,t,r),(l=n.cm)&&o.noHScroll&&(l.display.alignWidgets=!0),ho(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&&!Ge(n,e)){var r=Ve(e)<n.scrollTop;fe(e,e.height+br(o)),r&&Cn(l,o.height),l.curOp.forceUpdate=!0}return!0}),l&&sr(l,"lineWidgetAdded",l,o,"number"==typeof i?i:de(i)),o;var n,i,o,l}),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return _o(this,ke(this,e),ke(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 _o(this,e=ke(this,e),e,r,"bookmark")},findMarksAt:function(e){var t=[],r=ae(this,(e=ke(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(i,o,l){i=ke(this,i),o=ke(this,o);var s=[],a=i.line;return this.iter(i.line,o.line+1,function(e){var t=e.markedSpans;if(t)for(var r=0;r<t.length;r++){var n=t[r];null!=n.to&&a==i.line&&i.ch>=n.to||null==n.from&&a!=i.line||null!=n.from&&a==o.line&&n.from>=o.ch||l&&!l(n.marker)||s.push(n.marker.parent||n.marker)}++a}),s},getAllMarks:function(){var n=[];return this.iter(function(e){var t=e.markedSpans;if(t)for(var r=0;r<t.length;++r)null!=t[r].from&&n.push(t[r].marker)}),n},posFromIndex:function(r){var n,i=this.first,o=this.lineSeparator().length;return this.iter(function(e){var t=e.text.length+o;if(r<t)return n=r,!0;r-=t,++i}),ke(this,me(i,n))},indexFromPos:function(e){var t=(e=ke(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=_o(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),ko(wo(this));break}}if(e.history==this.history){var r=[e.id];Mi(e,function(e){return r.push(e.id)},!0),e.history=new Oi(null),e.history.done=Hi(this.history.done,r),e.history.undone=Hi(this.history.undone,r)}},iterLinkedDocs:function(e){Mi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):xt(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:Xn(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(){Ai(t),Yn(t)}))})}),So.prototype.eachLine=So.prototype.iter;var Lo=0;function To(e){var i=this;if(Mo(i),!ot(i,e)&&!_r(i.display,e)){ct(e),x&&(Lo=+new Date);var o=ln(i,e,!0),t=e.dataTransfer.files;if(o&&!i.isReadOnly())if(t&&t.length&&window.FileReader&&window.File)for(var l=t.length,s=Array(l),a=0,r=function(e,r){if(!i.options.allowDropFileTypes||-1!=H(i.options.allowDropFileTypes,e.type)){var n=new FileReader;n.onload=Vn(i,function(){var e=n.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),s[r]=e,++a==l){var t={from:o=ke(i.doc,o),to:o,text:i.doc.splitLines(s.join(i.doc.lineSeparator())),origin:"paste"};no(i.doc,t),Ki(i.doc,bi(o,_i(t)))}}),n.readAsText(e)}},n=0;n<l;++n)r(t[n],n);else{if(i.state.draggingText&&-1<i.doc.sel.contains(o))return i.state.draggingText(e),void setTimeout(function(){return i.display.input.focus()},20);try{var c=e.dataTransfer.getData("Text");if(c){var u;if(i.state.draggingText&&!i.state.draggingText.copy&&(u=i.listSelections()),$i(i.doc,bi(o,o)),u)for(var f=0;f<u.length;++f)ao(i.doc,"",u[f].anchor,u[f].head,"drag");i.replaceSelection(c,"around","paste"),i.display.input.focus()}}catch(e){}}}}function Mo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function No(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 Ao=!1;function Oo(){var e;Ao||(tt(window,"resize",function(){null==e&&(e=setTimeout(function(){e=null,No(Do)},100))}),tt(window,"blur",function(){return No(vn)}),Ao=!0)}function Do(e){var t=e.display;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"},Eo=0;Eo<10;Eo++)Wo[Eo+48]=Wo[Eo+96]=String(Eo);for(var Io=65;Io<=90;Io++)Wo[Io]=String.fromCharCode(Io);for(var Po=1;Po<=12;Po++)Wo[Po+111]=Wo[Po+63235]="F"+Po;var Fo={};function zo(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 qo(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=Y(r.split(" "),zo),o=0;o<i.length;o++){var l=void 0,s=void 0;l=o==i.length-1?(s=i.join(" "),n):(s=i.slice(0,o+1).join(" "),"...");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 c in t)e[c]=t[c];return e}function Ho(e,t,r,n){var i=(t=jo(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 Ho(e,t.fallthrough,r,n);for(var o=0;o<t.fallthrough.length;o++){var l=Ho(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),(y?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(y?t.ctrlKey:t.metaKey)&&"Cmd"!=n&&(e="Cmd-"+e),!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function Uo(e,t){if(m&&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 jo(e){return"string"==typeof e?Fo[e]:e}function Go(t,e){for(var r=t.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=e(r[i]);n.length&&ve(o.from,X(n).to)<=0;){var l=n.pop();if(ve(l.from,o.from)<0){o.from=l.from;break}}n.push(o)}Kn(t,function(){for(var e=n.length-1;0<=e;e--)ao(t.doc,"",n[e].from,n[e].to,"+delete");Sn(t)})}function Ko(e,t,r){var n=oe(e.text,t+r,r);return n<0||n>e.text.length?null:n}function Vo(e,t,r){var n=Ko(e,t.ch,r);return null==n?null:new me(t.line,n,r<0?"after":"before")}function $o(e,t,r,n,i){if(e){var o=Je(r,t.doc.direction);if(o){var l,s=i<0?X(o):o[0],a=i<0==(1==s.level)?"after":"before";if(0<s.level||"rtl"==t.doc.direction){var c=Ar(t,r);l=i<0?r.text.length-1:0;var u=Or(t,c,l).top;l=le(function(e){return Or(t,c,e).top==u},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 me(n,l,a)}}return new me(n,i<0?r.text.length:0,i<0?"before":"after")}Fo.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"},Fo.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"},Fo.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"},Fo.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"]},Fo.default=_?Fo.macDefault:Fo.pcDefault;var Xo={selectAll:to,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),U)},killLine:function(r){return Go(r,function(e){if(e.empty()){var t=ae(r.doc,e.head.line).text.length;return e.head.ch==t&&e.head.line<r.lastLine()?{from:e.head,to:me(e.head.line+1,0)}:{from:e.head,to:me(e.head.line,t)}}return{from:e.from(),to:e.to()}})},deleteLine:function(t){return Go(t,function(e){return{from:me(e.from().line,0),to:ke(t.doc,me(e.to().line+1,0))}})},delLineLeft:function(e){return Go(e,function(e){return{from:me(e.from().line,0),to:e.from()}})},delWrappedLineLeft:function(r){return Go(r,function(e){var t=r.charCoords(e.head,"div").top+5;return{from:r.coordsChar({left:0,top:t},"div"),to:e.from()}})},delWrappedLineRight:function(n){return Go(n,function(e){var t=n.charCoords(e.head,"div").top+5,r=n.coordsChar({left:n.display.lineDiv.offsetWidth+100,top:t},"div");return{from:e.from(),to:r}})},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(me(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(me(e.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy(function(e){return Yo(t,e.head.line)},{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy(function(e){return Zo(t,e.head)},{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy(function(e){return function(e,t){var r=ae(e.doc,t),n=function(e){for(var t;t=qe(e);)e=t.find(1,!0).line;return e}(r);n!=r&&(t=de(n));return $o(!0,e,r,t,-1)}(t,e.head.line)},{origin:"+move",bias:-1})},goLineRight:function(r){return r.extendSelectionsBy(function(e){var t=r.cursorCoords(e.head,"div").top+5;return r.coordsChar({left:r.display.lineDiv.offsetWidth+100,top:t},"div")},G)},goLineLeft:function(r){return r.extendSelectionsBy(function(e){var t=r.cursorCoords(e.head,"div").top+5;return r.coordsChar({left:0,top:t},"div")},G)},goLineLeftSmart:function(n){return n.extendSelectionsBy(function(e){var t=n.cursorCoords(e.head,"div").top+5,r=n.coordsChar({left:0,top:t},"div");return r.ch<n.getLine(r.line).search(/\S/)?Zo(n,e.head):r},G)},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=z(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(l){return Kn(l,function(){for(var e=l.listSelections(),t=[],r=0;r<e.length;r++)if(e[r].empty()){var n=e[r].head,i=ae(l.doc,n.line).text;if(i)if(n.ch==i.length&&(n=new me(n.line,n.ch-1)),0<n.ch)n=new me(n.line,n.ch+1),l.replaceRange(i.charAt(n.ch-1)+i.charAt(n.ch-2),me(n.line,n.ch-2),n,"+transpose");else if(n.line>l.doc.first){var o=ae(l.doc,n.line-1).text;o&&(n=new me(n.line,1),l.replaceRange(i.charAt(0)+l.doc.lineSeparator()+o.charAt(o.length-1),me(n.line-1,o.length-1),n,"+transpose"))}t.push(new vi(n,n))}l.setSelections(t)})},newlineAndIndent:function(n){return Kn(n,function(){for(var e=n.listSelections(),t=e.length-1;0<=t;t--)n.replaceRange(n.doc.lineSeparator(),e[t].anchor,e[t].head,"+input");e=n.listSelections();for(var r=0;r<e.length;r++)n.indentLine(e[r].from().line,null,!0);Sn(n)})},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}};function Yo(e,t){var r=ae(e.doc,t),n=Be(r);return n!=r&&(t=de(n)),$o(!0,e,n,t,1)}function Zo(e,t){var r=Yo(e,t.line),n=ae(e.doc,r.line),i=Je(n,e.doc.direction);if(i&&0!=i[0].level)return r;var o=Math.max(0,n.text.search(/\S/)),l=t.line==r.line&&t.ch<=o&&t.ch;return me(r.line,l?0:o,r.sticky)}function Qo(e,t,r){if("string"==typeof t&&!(t=Xo[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)!=B}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}var Jo=new q;function el(e,t,r,n){var i=e.state.keySeq;if(i){if(Ro(t))return"handled";if(/\'$/.test(t)?e.state.keySeq=null:Jo.set(50,function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())}),tl(e,i+" "+t,r,n))return!0}return tl(e,t,r,n)}function tl(e,t,r,n){var i=function(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=Ho(t,e.state.keyMaps[n],r,e);if(i)return i}return e.options.extraKeys&&Ho(t,e.options.extraKeys,r,e)||Ho(t,e.options.keyMap,r,e)}(e,t,n);return"multi"==i&&(e.state.keySeq=t),"handled"==i&&sr(e,"keyHandled",e,t,r),"handled"!=i&&"multi"!=i||(ct(r),hn(e)),!!i}function rl(t,e){var r=Uo(e,!0);return!!r&&(e.shiftKey&&!t.state.keySeq?el(t,"Shift-"+r,e,function(e){return Qo(t,e,!0)})||el(t,r,e,function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return Qo(t,e)}):el(t,r,e,function(e){return Qo(t,e)}))}var nl=null;function il(e){var t=this;if(t.curOp.focus=D(),!ot(t,e)){x&&w<11&&27==e.keyCode&&(e.returnValue=!1);var r=e.keyCode;t.display.shift=16==r||e.shiftKey;var n=rl(t,e);m&&(nl=n?r:null,!n&&88==r&&!kt&&(_?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||(L(t,"CodeMirror-crosshair"),nt(document,"keyup",r),nt(document,"mouseover",r))}W(t,"CodeMirror-crosshair"),tt(document,"keyup",r),tt(document,"mouseover",r)}(t)}}function ol(e){16==e.keyCode&&(this.doc.sel.shift=!1),ot(this,e)}function ll(e){var t=this;if(!(_r(t.display,e)||ot(t,e)||e.ctrlKey&&!e.altKey||_&&e.metaKey)){var r=e.keyCode,n=e.charCode;if(m&&r==nl)return nl=null,void ct(e);if(!m||e.which&&!(e.which<10)||!rl(t,e)){var i,o=String.fromCharCode(null==n?r:n);if("\b"!=o)if(!el(i=t,"'"+o+"'",e,function(e){return Qo(i,e,!0)}))t.display.input.onKeyPress(e)}}}var sl,al,cl=function(e,t,r){this.time=e,this.pos=t,this.button=r};function ul(e){var t=this,r=t.display;if(!(ot(t,e)||r.activeTouch&&r.input.supportsTouch()))if(r.input.ensurePolled(),r.shift=e.shiftKey,_r(r,e))b||(r.scroller.draggable=!1,setTimeout(function(){return r.scroller.draggable=!0},100));else if(!hl(t,e)){var n,i,o,l=ln(t,e),s=pt(e),a=l?(n=l,i=s,o=+new Date,al&&al.compare(o,n,i)?(sl=al=null,"triple"):sl&&sl.compare(o,n,i)?(al=new cl(o,n,i),sl=null,"double"):(sl=new cl(o,n,i),al=null,"single")):"single";window.focus(),1==s&&t.state.selectingText&&t.state.selectingText(e),l&&function(r,e,n,t,i){var o="Click";"double"==t?o="Double"+o:"triple"==t&&(o="Triple"+o);return el(r,Bo(o=(1==e?"Left":2==e?"Middle":"Right")+o,i),i,function(e){if("string"==typeof e&&(e=Xo[e]),!e)return!1;var t=!1;try{r.isReadOnly()&&(r.state.suppressEdits=!0),t=e(r,n)!=B}finally{r.state.suppressEdits=!1}return t})}(t,s,l,a,e)||(1==s?l?function(e,t,r,n){x?setTimeout(P(pn,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=h?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=_?r.metaKey:r.ctrlKey);null==i.moveOnDrag&&(i.moveOnDrag=!(_?r.altKey:r.ctrlKey));return i}(e,r,n),l=e.doc.sel;e.options.dragDrop&&vt&&!e.isReadOnly()&&"single"==r&&-1<(i=l.contains(t))&&(ve((i=l.ranges[i]).from(),t)<0||0<t.xRel)&&(0<ve(i.to(),t)||t.xRel<0)?function(t,r,n,i){var o=t.display,l=!1,s=Vn(t,function(e){b&&(o.scroller.draggable=!1),t.state.draggingText=!1,nt(o.wrapper.ownerDocument,"mouseup",s),nt(o.wrapper.ownerDocument,"mousemove",a),nt(o.scroller,"dragstart",c),nt(o.scroller,"drop",s),l||(ct(e),i.addNew||Bi(t.doc,n,null,null,i.extend),b||x&&9==w?setTimeout(function(){o.wrapper.ownerDocument.body.focus(),o.input.focus()},20):o.input.focus())}),a=function(e){l=l||10<=Math.abs(r.clientX-e.clientX)+Math.abs(r.clientY-e.clientY)},c=function(){return l=!0};b&&(o.scroller.draggable=!0);(t.state.draggingText=s).copy=!i.moveOnDrag,o.scroller.dragDrop&&o.scroller.dragDrop();tt(o.wrapper.ownerDocument,"mouseup",s),tt(o.wrapper.ownerDocument,"mousemove",a),tt(o.scroller,"dragstart",c),tt(o.scroller,"drop",s),gn(t),setTimeout(function(){return o.input.focus()},20)}(e,n,t,o):function(m,e,v,y){var l=m.display,b=m.doc;ct(e);var _,x,w=b.sel,t=w.ranges;y.addNew&&!y.extend?(x=b.sel.contains(v),_=-1<x?t[x]:new vi(v,v)):(_=b.sel.primary(),x=b.sel.primIndex);if("rectangle"==y.unit)y.addNew||(_=new vi(v,v)),v=ln(m,e,!0,!0),x=-1;else{var r=fl(m,v,y.unit);_=y.extend?Ri(_,r.anchor,r.head,y.extend):r}y.addNew?-1==x?(x=t.length,Vi(b,yi(m,t.concat([_]),x),{scroll:!1,origin:"*mouse"})):1<t.length&&t[x].empty()&&"char"==y.unit&&!y.extend?(Vi(b,yi(m,t.slice(0,x).concat(t.slice(x+1)),0),{scroll:!1,origin:"*mouse"}),w=b.sel):ji(b,x,_,j):(Vi(b,new mi([_],x=0),j),w=b.sel);var k=v;function s(e){if(0!=ve(k,e))if(k=e,"rectangle"==y.unit){for(var t=[],r=m.options.tabSize,n=z(ae(b,v.line).text,v.ch,r),i=z(ae(b,e.line).text,e.ch,r),o=Math.min(n,i),l=Math.max(n,i),s=Math.min(v.line,e.line),a=Math.min(m.lastLine(),Math.max(v.line,e.line));s<=a;s++){var c=ae(b,s).text,u=K(c,o,r);o==l?t.push(new vi(me(s,u),me(s,u))):c.length>u&&t.push(new vi(me(s,u),me(s,K(c,l,r))))}t.length||t.push(new vi(v,v)),Vi(b,yi(m,w.ranges.slice(0,x).concat(t),x),{origin:"*mouse",scroll:!1}),m.scrollIntoView(e)}else{var f,d=_,h=fl(m,e,y.unit),p=d.anchor;p=0<ve(h.anchor,p)?(f=h.head,xe(d.from(),h.anchor)):(f=h.anchor,_e(d.to(),h.head));var g=w.ranges.slice(0);g[x]=function(e,t){var r=t.anchor,n=t.head,i=ae(e.doc,r.line);if(0==ve(r,n)&&r.sticky==n.sticky)return t;var o=Je(i);if(!o)return t;var l=Ze(o,r.ch,r.sticky),s=o[l];if(s.from!=r.ch&&s.to!=r.ch)return t;var a,c=l+(s.from==r.ch==(1!=s.level)?0:1);if(0==c||c==o.length)return t;if(n.line!=r.line)a=0<(n.line-r.line)*("ltr"==e.doc.direction?1:-1);else{var u=Ze(o,n.ch,n.sticky),f=u-l||(n.ch-r.ch)*(1==s.level?-1:1);a=u==c-1||u==c?f<0:0<f}var d=o[c+(a?-1:0)],h=a==(1==d.level),p=h?d.from:d.to,g=h?"after":"before";return r.ch==p&&r.sticky==g?t:new vi(new me(r.line,p,g),n)}(m,new vi(ke(b,p),f)),Vi(b,yi(m,g,x),j)}}var a=l.wrapper.getBoundingClientRect(),c=0;function n(e){m.state.selectingText=!1,c=1/0,ct(e),l.input.focus(),nt(l.wrapper.ownerDocument,"mousemove",i),nt(l.wrapper.ownerDocument,"mouseup",o),b.history.lastSelOrigin=null}var i=Vn(m,function(e){0!==e.buttons&&pt(e)?function e(t){var r=++c;var n=ln(m,t,!0,"rectangle"==y.unit);if(!n)return;if(0!=ve(n,k)){m.curOp.focus=D(),s(n);var i=_n(l,b);(n.line>=i.to||n.line<i.from)&&setTimeout(Vn(m,function(){c==r&&e(t)}),150)}else{var o=t.clientY<a.top?-20:t.clientY>a.bottom?20:0;o&&setTimeout(Vn(m,function(){c==r&&(l.scroller.scrollTop+=o,e(t))}),50)}}(e):n(e)}),o=Vn(m,n);m.state.selectingText=o,tt(l.wrapper.ownerDocument,"mousemove",i),tt(l.wrapper.ownerDocument,"mouseup",o)}(e,n,t,o)}(t,l,a,e):ht(e)==r.scroller&&ct(e):2==s?(l&&Bi(t.doc,l),setTimeout(function(){return r.input.focus()},20)):3==s&&(k?t.display.input.onContextMenu(e):gn(t)))}}function fl(e,t,r){if("char"==r)return new vi(t,t);if("word"==r)return e.findWordAt(t);if("line"==r)return new vi(me(t.line,0),ke(e.doc,me(t.line+1,0)));var n=r(e,t);return new vi(n.from,n.to)}function dl(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&&ct(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(o>s.bottom||!st(e,r))return ft(t);o-=s.top-l.viewOffset;for(var a=0;a<e.options.gutters.length;++a){var c=l.gutters.childNodes[a];if(c&&c.getBoundingClientRect().right>=i)return it(e,r,e,he(e.doc,o),e.options.gutters[a],t),ft(t)}}function hl(e,t){return dl(e,t,"gutterClick",!0)}function pl(e,t){var r,n;_r(e.display,t)||(n=t,st(r=e,"gutterContextMenu")&&dl(r,n,"gutterContextMenu",!1))||(ot(e,t,"contextmenu")||k||e.display.input.onContextMenu(t))}function gl(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),zr(e)}cl.prototype.compare=function(e,t,r){return this.time+400>e&&0==ve(t,this.pos)&&r==this.button};var ml={toString:function(){return"CodeMirror.Init"}},vl={},yl={};function bl(e){ci(e),Yn(e),xn(e)}function _l(e,t,r){if(!t!=!(r&&r!=ml)){var n=e.display.dragFunctions,i=t?tt:nt;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 xl(e){e.options.lineWrapping?(W(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(L(e.display.wrapper,"CodeMirror-wrap"),Xe(e)),on(e),Yn(e),zr(e),setTimeout(function(){return In(e)},100)}function wl(e,t){var r=this;if(!(this instanceof wl))return new wl(e,t);this.options=t=t?F(t):{},F(vl,t,!1),ui(t);var n=t.value;"string"==typeof n?n=new So(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n;var i=new wl.inputStyles[t.inputStyle](this),o=this.display=new se(e,n,i);for(var l in ci(o.wrapper.CodeMirror=this),gl(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),zn(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 q,keySeq:null,specialChars:null},t.autofocus&&!d&&o.input.focus(),x&&w<11&&setTimeout(function(){return r.display.input.reset(!0)},20),function(i){var o=i.display;tt(o.scroller,"mousedown",Vn(i,ul)),tt(o.scroller,"dblclick",x&&w<11?Vn(i,function(e){if(!ot(i,e)){var t=ln(i,e);if(t&&!hl(i,e)&&!_r(i.display,e)){ct(e);var r=i.findWordAt(t);Bi(i.doc,r.anchor,r.head)}}}):function(e){return ot(i,e)||ct(e)});tt(o.scroller,"contextmenu",function(e){return pl(i,e)});var r,n={end:0};function l(){o.activeTouch&&(r=setTimeout(function(){return o.activeTouch=null},1e3),(n=o.activeTouch).end=+new Date)}function s(e,t){if(null==t.left)return!0;var r=t.left-e.left,n=t.top-e.top;return 400<r*r+n*n}tt(o.scroller,"touchstart",function(e){if(!ot(i,e)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(e)&&!hl(i,e)){o.input.ensurePolled(),clearTimeout(r);var t=+new Date;o.activeTouch={start:t,moved:!1,prev:t-n.end<=300?n:null},1==e.touches.length&&(o.activeTouch.left=e.touches[0].pageX,o.activeTouch.top=e.touches[0].pageY)}}),tt(o.scroller,"touchmove",function(){o.activeTouch&&(o.activeTouch.moved=!0)}),tt(o.scroller,"touchend",function(e){var t=o.activeTouch;if(t&&!_r(o,e)&&null!=t.left&&!t.moved&&new Date-t.start<300){var r,n=i.coordsChar(o.activeTouch,"page");r=!t.prev||s(t,t.prev)?new vi(n,n):!t.prev.prev||s(t,t.prev.prev)?i.findWordAt(n):new vi(me(n.line,0),ke(i.doc,me(n.line+1,0))),i.setSelection(r.anchor,r.head),i.focus(),ct(e)}l()}),tt(o.scroller,"touchcancel",l),tt(o.scroller,"scroll",function(){o.scroller.clientHeight&&(Nn(i,o.scroller.scrollTop),On(i,o.scroller.scrollLeft,!0),it(i,"scroll",i))}),tt(o.scroller,"mousewheel",function(e){return gi(i,e)}),tt(o.scroller,"DOMMouseScroll",function(e){return gi(i,e)}),tt(o.wrapper,"scroll",function(){return o.wrapper.scrollTop=o.wrapper.scrollLeft=0}),o.dragFunctions={enter:function(e){ot(i,e)||dt(e)},over:function(e){ot(i,e)||(!function(e,t){var r=ln(e,t);if(r){var n=document.createDocumentFragment();un(e,r,n),e.display.dragCursor||(e.display.dragCursor=A("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),M(e.display.dragCursor,n)}}(i,e),dt(e))},start:function(e){return function(e,t){if(x&&(!e.state.draggingText||+new Date-Lo<100))dt(t);else if(!ot(e,t)&&!_r(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!a)){var r=A("img",null,null,"position: fixed; left: 0; top: 0;");r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",m&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),m&&r.parentNode.removeChild(r)}}(i,e)},drop:Vn(i,To),leave:function(e){ot(i,e)||Mo(i)}};var e=o.input.getField();tt(e,"keyup",function(e){return ol.call(i,e)}),tt(e,"keydown",Vn(i,il)),tt(e,"keypress",Vn(i,ll)),tt(e,"focus",function(e){return mn(i,e)}),tt(e,"blur",function(e){return vn(i,e)})}(this),Oo(),Hn(this),this.curOp.forceUpdate=!0,Ni(this,n),t.autofocus&&!d||this.hasFocus()?setTimeout(P(mn,this),20):vn(this),yl)yl.hasOwnProperty(l)&&yl[l](r,t[l],ml);wn(this),t.finishInit&&t.finishInit(this);for(var s=0;s<kl.length;++s)kl[s](r);Rn(this),b&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}wl.defaults=vl,wl.optionHandlers=yl;var kl=[];function Cl(e,t,r,n){var i,o=e.doc;null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=qt(e,t).state:r="prev");var l=e.options.tabSize,s=ae(o,t),a=z(s.text,null,l);s.stateAfter&&(s.stateAfter=null);var c,u=s.text.match(/^\s*/)[0];if(n||/\S/.test(s.text)){if("smart"==r&&((c=o.mode.indent(i,s.text.slice(u.length),s.text))==B||150<c)){if(!n)return;r="prev"}}else c=0,r="not";"prev"==r?c=t>o.first?z(ae(o,t-1).text,null,l):0:"add"==r?c=a+e.options.indentUnit:"subtract"==r?c=a-e.options.indentUnit:"number"==typeof r&&(c=a+r),c=Math.max(0,c);var f="",d=0;if(e.options.indentWithTabs)for(var h=Math.floor(c/l);h;--h)d+=l,f+="\t";if(d<c&&(f+=$(c-d)),f!=u)return ao(o,f,me(t,0),me(t,u.length),"+input"),!(s.stateAfter=null);for(var p=0;p<o.sel.ranges.length;p++){var g=o.sel.ranges[p];if(g.head.line==t&&g.head.ch<u.length){var m=me(t,u.length);ji(o,p,new vi(m,m));break}}}wl.defineInitHook=function(e){return kl.push(e)};var Sl=null;function Ll(e){Sl=e}function Tl(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=xt(t),c=null;if(s&&1<n.ranges.length)if(Sl&&Sl.text.join("\n")==t){if(n.ranges.length%Sl.text.length==0){c=[];for(var u=0;u<Sl.text.length;u++)c.push(o.splitLines(Sl.text[u]))}}else a.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(c=Y(a,function(e){return[e]}));for(var f=n.ranges.length-1;0<=f;f--){var d=n.ranges[f],h=d.from(),p=d.to();d.empty()&&(r&&0<r?h=me(h.line,h.ch-r):e.state.overwrite&&!s?p=me(p.line,Math.min(ae(o,p.line).text.length,p.ch+X(a).length)):s&&Sl&&Sl.lineWise&&Sl.text.join("\n")==t&&(h=p=me(h.line,0))),l=e.curOp.updateInput;var g={from:h,to:p,text:c?c[f%c.length]:a,origin:i||(s?"paste":e.state.cutIncoming?"cut":"+input")};no(e.doc,g),sr(e,"inputRead",e,g)}t&&!s&&Nl(e,t),Sn(e),e.curOp.updateInput=l,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function Ml(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text");if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Kn(t,function(){return Tl(t,r,0,null,"paste")}),!0}function Nl(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;0<=n;n--){var i=r.ranges[n];if(!(100<i.head.ch||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(-1<t.indexOf(o.electricChars.charAt(s))){l=Cl(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(ae(e.doc,i.head.line).text.slice(0,i.head.ch))&&(l=Cl(e,i.head.line,"smart"));l&&sr(e,"electricInput",e,i.head.line)}}}function Al(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:me(i,0),head:me(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 Dl(){var e=A("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=A("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return b?e.style.width="1000px":e.setAttribute("wrap","off"),u&&(e.style.border="1px solid black"),Ol(e),t}function Wl(n,i,o,e,l){var t=i,r=o,s=ae(n,i.line);function a(e){var t,r;if(null==(t=l?function(t,r,s,e){var a=Je(r,t.doc.direction);if(!a)return Vo(r,s,e);s.ch>=r.text.length?(s.ch=r.text.length,s.sticky="before"):s.ch<=0&&(s.ch=0,s.sticky="after");var n=Ze(a,s.ch,s.sticky),i=a[n];if("ltr"==t.doc.direction&&i.level%2==0&&(0<e?i.to>s.ch:i.from<s.ch))return Vo(r,s,e);var o,c=function(e,t){return Ko(r,e instanceof me?e.ch:e,t)},l=function(e){return t.options.lineWrapping?(o=o||Ar(t,r),Yr(t,r,o,e)):{begin:0,end:r.text.length}},u=l("before"==s.sticky?c(s,-1):s.ch);if("rtl"==t.doc.direction||1==i.level){var f=1==i.level==e<0,d=c(s,f?1:-1);if(null!=d&&(f?d<=i.to&&d<=u.end:d>=i.from&&d>=u.begin)){var h=f?"before":"after";return new me(s.line,d,h)}}var p=function(e,t,r){for(var n=function(e,t){return t?new me(s.line,c(e,1),"before"):new me(s.line,e,"after")};0<=e&&e<a.length;e+=t){var i=a[e],o=0<t==(1!=i.level),l=o?r.begin:c(r.end,-1);if(i.from<=l&&l<i.to)return n(l,o);if(l=o?i.from:c(i.to,-1),r.begin<=l&&l<r.end)return n(l,o)}},g=p(n+e,e,u);if(g)return g;var m=0<e?u.end:c(u.begin,-1);return null==m||0<e&&m==r.text.length||!(g=p(0<e?0:a.length-1,e,l(m)))?null:g}(n.cm,s,i,o):Vo(s,i,o))){if(e||(r=i.line+o)<n.first||r>=n.first+n.size||(i=new me(r,i.ch,i.sticky),!(s=ae(n,r))))return!1;i=$o(l,n.cm,s,i.line,o)}else i=t;return!0}if("char"==e)a();else if("column"==e)a(!0);else if("word"==e||"group"==e)for(var c=null,u="group"==e,f=n.cm&&n.cm.getHelper(i,"wordChars"),d=!0;!(o<0)||a(!d);d=!1){var h=s.text.charAt(i.ch)||"\n",p=te(h,f)?"w":u&&"\n"==h?"n":!u||/\s/.test(h)?null:"p";if(!u||d||p||(p="s"),c&&c!=p){o<0&&(o=1,a(),i.sticky="after");break}if(p&&(c=p),0<o&&!a(!d))break}var g=Ji(n,i,t,r,!0);return ye(t,g)&&(g.hitSide=!0),g}function El(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),c=Math.max(a-.5*Jr(e.display),3);i=(0<r?t.bottom:t.top)+r*c}else"line"==n&&(i=0<r?t.bottom+3:t.top-3);for(;(o=$r(e,s,i)).outside;){if(r<0?i<=0:i>=l.height){o.hitSide=!0;break}i+=5*r}return o}var Il=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new q,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Pl(e,t){var r=Nr(e,t.line);if(!r||r.hidden)return null;var n=ae(e.doc,t.line),i=Tr(r,n,t.line),o=Je(n,e.doc.direction),l="left";o&&(l=Ze(o,t.ch)%2?"right":"left");var s=Er(i.map,t.ch,l);return s.offset="right"==s.collapse?s.end:s.start,s}function Fl(e,t){return t&&(e.bad=!0),e}function zl(e,t,r){var n;if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return Fl(e.clipPos(me(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 ql(o,t,r)}}function ql(c,e,t){var r=c.text.firstChild,n=!1;if(!e||!O(r,e))return Fl(me(de(c.line),0),!0);if(e==r&&(n=!0,e=r.childNodes[t],t=0,!e)){var i=c.rest?X(c.rest):c.line;return Fl(me(de(i),i.text.length),n)}var o=3==e.nodeType?e:null,l=e;for(o||1!=e.childNodes.length||3!=e.firstChild.nodeType||(o=e.firstChild,t&&(t=o.nodeValue.length));l.parentNode!=r;)l=l.parentNode;var u=c.measure,f=u.maps;function s(e,t,r){for(var n=-1;n<(f?f.length:0);n++)for(var i=n<0?u.map:f[n],o=0;o<i.length;o+=3){var l=i[o+2];if(l==e||l==t){var s=de(n<0?c.line:c.rest[n]),a=i[o]+r;return(r<0||l!=e)&&(a=i[o+(r?1:0)]),me(s,a)}}}var a=s(o,l,t);if(a)return Fl(a,n);for(var d=l.nextSibling,h=o?o.nodeValue.length-t:0;d;d=d.nextSibling){if(a=s(d,d.firstChild,0))return Fl(me(a.line,a.ch-h),n);h+=d.textContent.length}for(var p=l.previousSibling,g=t;p;p=p.previousSibling){if(a=s(p,p.firstChild,-1))return Fl(me(a.line,a.ch+g),n);g+=p.textContent.length}}Il.prototype.init=function(e){var t=this,l=this,s=l.cm,a=l.div=e.lineDiv;function r(e){if(!ot(s,e)){if(s.somethingSelected())Ll({lineWise:!1,text:s.getSelections()}),"cut"==e.type&&s.replaceSelection("",null,"cut");else{if(!s.options.lineWiseCopyCut)return;var t=Al(s);Ll({lineWise:!0,text:t.text}),"cut"==e.type&&s.operation(function(){s.setSelections(t.ranges,0,U),s.replaceSelection("",null,"cut")})}if(e.clipboardData){e.clipboardData.clearData();var r=Sl.text.join("\n");if(e.clipboardData.setData("Text",r),e.clipboardData.getData("Text")==r)return void e.preventDefault()}var n=Dl(),i=n.firstChild;s.display.lineSpace.insertBefore(n,s.display.lineSpace.firstChild),i.value=Sl.text.join("\n");var o=document.activeElement;I(i),setTimeout(function(){s.display.lineSpace.removeChild(n),o.focus(),o==a&&l.showPrimarySelection()},50)}}Ol(a,s.options.spellcheck),tt(a,"paste",function(e){ot(s,e)||Ml(e,s)||w<=11&&setTimeout(Vn(s,function(){return t.updateFromDOM()}),20)}),tt(a,"compositionstart",function(e){t.composing={data:e.data,done:!1}}),tt(a,"compositionupdate",function(e){t.composing||(t.composing={data:e.data,done:!1})}),tt(a,"compositionend",function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)}),tt(a,"touchstart",function(){return l.forceCompositionEnd()}),tt(a,"input",function(){t.composing||t.readFromDOMSoon()}),tt(a,"copy",r),tt(a,"cut",r)},Il.prototype.prepareSelection=function(){var e=cn(this.cm,!1);return e.focus=this.cm.state.focused,e},Il.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Il.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Il.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),n=r.from(),i=r.to();if(t.display.viewTo==t.display.viewFrom||n.line>=t.display.viewTo||i.line<t.display.viewFrom)e.removeAllRanges();else{var o=zl(t,e.anchorNode,e.anchorOffset),l=zl(t,e.focusNode,e.focusOffset);if(!o||o.bad||!l||l.bad||0!=ve(xe(o,l),n)||0!=ve(_e(o,l),i)){var s=t.display.view,a=n.line>=t.display.viewFrom&&Pl(t,n)||{node:s[0].measure.map[2],offset:0},c=i.line<t.display.viewTo&&Pl(t,i);if(!c){var u=s[s.length-1].measure,f=u.maps?u.maps[u.maps.length-1]:u.map;c={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}if(a&&c){var d,h=e.rangeCount&&e.getRangeAt(0);try{d=S(a.node,a.offset,c.offset,c.node)}catch(e){}d&&(!g&&t.state.focused?(e.collapse(a.node,a.offset),d.collapsed||(e.removeAllRanges(),e.addRange(d))):(e.removeAllRanges(),e.addRange(d)),h&&null==e.anchorNode?e.addRange(h):g&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},Il.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)},Il.prototype.showMultipleSelections=function(e){M(this.cm.display.cursorDiv,e.cursors),M(this.cm.display.selectionDiv,e.selection)},Il.prototype.rememberSelection=function(){var e=this.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Il.prototype.selectionInEditor=function(){var e=this.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return O(this.div,t)},Il.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Il.prototype.blur=function(){this.div.blur()},Il.prototype.getField=function(){return this.div},Il.prototype.supportsTouch=function(){return!0},Il.prototype.receivedFocus=function(){var t=this;this.selectionInEditor()?this.pollSelection():Kn(this.cm,function(){return t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))})},Il.prototype.selectionChanged=function(){var e=this.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Il.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm;if(f&&l&&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=zl(t,e.anchorNode,e.anchorOffset),n=zl(t,e.focusNode,e.focusOffset);r&&n&&Kn(t,function(){Vi(t.doc,bi(r,n),U),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)})}}},Il.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=me(l.line-1,ae(n.doc,l.line-1).length)),s.ch==ae(n.doc,s.line).text.length&&s.line<n.lastLine()&&(s=me(s.line+1,0)),l.line<i.viewFrom||s.line>i.viewTo-1)return!1;r=l.line==i.viewFrom||0==(e=sn(n,l.line))?(t=de(i.view[0].line),i.view[0].node):(t=de(i.view[e].line),i.view[e-1].node.nextSibling);var a,c,u=sn(n,s.line);if(c=u==i.view.length-1?(a=i.viewTo-1,i.lineDiv.lastChild):(a=de(i.view[u+1].line)-1,i.view[u+1].node.previousSibling),!r)return!1;for(var f=n.doc.splitLines(function(a,e,t,c,u){var r="",f=!1,d=a.doc.lineSeparator(),h=!1;function p(){f&&(r+=d,h&&(r+=d),f=h=!1)}function g(e){e&&(p(),r+=e)}function m(e){if(1==e.nodeType){var t=e.getAttribute("cm-text");if(t)return void g(t);var r,n=e.getAttribute("cm-marker");if(n){var i=a.findMarks(me(c,0),me(u+1,0),(s=+n,function(e){return e.id==s}));return void(i.length&&(r=i[0].find(0))&&g(ce(a.doc,r.from,r.to).join(d)))}if("false"==e.getAttribute("contenteditable"))return;var o=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&0==e.textContent.length)return;o&&p();for(var l=0;l<e.childNodes.length;l++)m(e.childNodes[l]);/^(pre|p)$/i.test(e.nodeName)&&(h=!0),o&&(f=!0)}else 3==e.nodeType&&g(e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var s}for(;m(e),e!=t;)e=e.nextSibling,h=!1;return r}(n,r,c,t,a)),d=ce(n.doc,me(t,0),me(a,ae(n.doc,a).text.length));1<f.length&&1<d.length;)if(X(f)==X(d))f.pop(),d.pop(),a--;else{if(f[0]!=d[0])break;f.shift(),d.shift(),t++}for(var h=0,p=0,g=f[0],m=d[0],v=Math.min(g.length,m.length);h<v&&g.charCodeAt(h)==m.charCodeAt(h);)++h;for(var y=X(f),b=X(d),_=Math.min(y.length-(1==f.length?h:0),b.length-(1==d.length?h:0));p<_&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p;if(1==f.length&&1==d.length&&t==l.line)for(;h&&h>l.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)h--,p++;f[f.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),f[0]=f[0].slice(h).replace(/\u200b+$/,"");var x=me(t,h),w=me(a,d.length?X(d).length-p:0);return 1<f.length||f[0]||ve(x,w)?(ao(n.doc,f,x,w,"+input"),!0):void 0},Il.prototype.ensurePolled=function(){this.forceCompositionEnd()},Il.prototype.reset=function(){this.forceCompositionEnd()},Il.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Il.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))},Il.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Kn(this.cm,function(){return Yn(e.cm)})},Il.prototype.setUneditable=function(e){e.contentEditable="false"},Il.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||Vn(this.cm,Tl)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Il.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Il.prototype.onContextMenu=function(){},Il.prototype.resetPosition=function(){},Il.prototype.needsContentAttribute=!0;var Hl,Rl,Bl,Ul=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new q,this.hasSelection=!1,this.composing=null};Ul.prototype.init=function(t){var e=this,r=this,n=this.cm;this.createField(t);var i=this.textarea;function o(e){if(!ot(n,e)){if(n.somethingSelected())Ll({lineWise:!1,text:n.getSelections()});else{if(!n.options.lineWiseCopyCut)return;var t=Al(n);Ll({lineWise:!0,text:t.text}),"cut"==e.type?n.setSelections(t.ranges,null,U):(r.prevInput="",i.value=t.text.join("\n"),I(i))}"cut"==e.type&&(n.state.cutIncoming=!0)}}t.wrapper.insertBefore(this.wrapper,t.wrapper.firstChild),u&&(i.style.width="0px"),tt(i,"input",function(){x&&9<=w&&e.hasSelection&&(e.hasSelection=null),r.poll()}),tt(i,"paste",function(e){ot(n,e)||Ml(e,n)||(n.state.pasteIncoming=!0,r.fastPoll())}),tt(i,"cut",o),tt(i,"copy",o),tt(t.scroller,"paste",function(e){_r(t,e)||ot(n,e)||(n.state.pasteIncoming=!0,r.focus())}),tt(t.lineSpace,"selectstart",function(e){_r(t,e)||ct(e)}),tt(i,"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"})}}),tt(i,"compositionend",function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)})},Ul.prototype.createField=function(e){this.wrapper=Dl(),this.textarea=this.wrapper.firstChild},Ul.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=cn(e);if(e.options.moveInputWithCursor){var i=Gr(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},Ul.prototype.showSelection=function(e){var t=this.cm.display;M(t.cursorDiv,e.cursors),M(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ul.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&&I(this.textarea),x&&9<=w&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",x&&9<=w&&(this.hasSelection=null))}},Ul.prototype.getField=function(){return this.textarea},Ul.prototype.supportsTouch=function(){return!1},Ul.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!d||D()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ul.prototype.blur=function(){this.textarea.blur()},Ul.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ul.prototype.receivedFocus=function(){this.slowPoll()},Ul.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},Ul.prototype.fastPoll=function(){var t=!1,r=this;r.pollingFast=!0,r.polling.set(20,function e(){r.poll()||t?(r.pollingFast=!1,r.slowPoll()):(t=!0,r.polling.set(60,e))})},Ul.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(x&&9<=w&&this.hasSelection===i||_&&/[\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 l=0,s=Math.min(n.length,i.length);l<s&&n.charCodeAt(l)==i.charCodeAt(l);)++l;return Kn(t,function(){Tl(t,i.slice(l),n.length-l,null,e.composing?"*compose":null),1e3<i.length||-1<i.indexOf("\n")?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},Ul.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ul.prototype.onKeyPress=function(){x&&9<=w&&(this.hasSelection=null),this.fastPoll()},Ul.prototype.onContextMenu=function(e){var r=this,n=r.cm,i=n.display,o=r.textarea,t=ln(n,e),l=i.scroller.scrollTop;if(t&&!m){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(t)&&Vn(n,Vi)(n.doc,bi(t),U);var s=o.style.cssText,a=r.wrapper.style.cssText;r.wrapper.style.cssText="position: absolute";var c,u=r.wrapper.getBoundingClientRect();if(o.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-u.top-5)+"px; left: "+(e.clientX-u.left-5)+"px;\n z-index: 1000; background: "+(x?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",b&&(c=window.scrollY),i.input.focus(),b&&window.scrollTo(null,c),i.input.reset(),n.somethingSelected()||(o.value=r.prevInput=" "),r.contextMenuPending=!0,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll),x&&9<=w&&d(),k){dt(e);var f=function(){nt(window,"mouseup",f),setTimeout(h,20)};tt(window,"mouseup",f)}else setTimeout(h,50)}function d(){if(null!=o.selectionStart){var e=n.somethingSelected(),t="​"+(e?o.value:"");o.value="⇚",o.value=t,r.prevInput=e?"":"​",o.selectionStart=1,o.selectionEnd=t.length,i.selForContextMenu=n.doc.sel}}function h(){if(r.contextMenuPending=!1,r.wrapper.style.cssText=a,o.style.cssText=s,x&&w<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=l),null!=o.selectionStart){(!x||x&&w<9)&&d();var e=0,t=function(){i.selForContextMenu==n.doc.sel&&0==o.selectionStart&&0<o.selectionEnd&&"​"==r.prevInput?Vn(n,to)(n):e++<10?i.detectingSelectAll=setTimeout(t,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(t,200)}}},Ul.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Ul.prototype.setUneditable=function(){},Ul.prototype.needsContentAttribute=!1,function(i){var o=i.optionHandlers;function e(e,t,n,r){i.defaults[e]=t,n&&(o[e]=r?function(e,t,r){r!=ml&&n(e,t,r)}:n)}i.defineOption=e,i.Init=ml,e("value","",function(e,t){return e.setValue(t)},!0),e("mode",null,function(e,t){e.doc.modeOption=t,Ci(e)},!0),e("indentUnit",2,Ci,!0),e("indentWithTabs",!1),e("smartIndent",!0),e("tabSize",4,function(e){Si(e),zr(e),Yn(e)},!0),e("lineSeparator",null,function(e,n){if(e.doc.lineSep=n){var i=[],o=e.doc.first;e.doc.iter(function(e){for(var t=0;;){var r=e.text.indexOf(n,t);if(-1==r)break;t=r+n.length,i.push(me(o,r))}o++});for(var t=i.length-1;0<=t;t--)ao(e.doc,n,i[t],me(i[t].line,i[t].ch+n.length))}}),e("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!=ml&&e.refresh()}),e("specialCharPlaceholder",Qt,function(e){return e.refresh()},!0),e("electricChars",!0),e("inputStyle",d?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),e("spellcheck",!1,function(e,t){return e.getInputField().spellcheck=t},!0),e("rtlMoveVisually",!p),e("wholeLineUpdateBefore",!0),e("theme","default",function(e){gl(e),bl(e)},!0),e("keyMap","default",function(e,t,r){var n=jo(t),i=r!=ml&&jo(r);i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)}),e("extraKeys",null),e("configureMouse",null),e("lineWrapping",!1,xl,!0),e("gutters",[],function(e){ui(e.options),bl(e)},!0),e("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?rn(e.display)+"px":"0",e.refresh()},!0),e("coverGutterNextToScrollbar",!1,function(e){return In(e)},!0),e("scrollbarStyle","native",function(e){zn(e),In(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),e("lineNumbers",!1,function(e){ui(e.options),bl(e)},!0),e("firstLineNumber",1,bl,!0),e("lineNumberFormatter",function(e){return e},bl,!0),e("showCursorWhenSelecting",!1,an,!0),e("resetSelectionOnContextMenu",!0),e("lineWiseCopyCut",!0),e("pasteLinesPerSelection",!0),e("selectionsMayTouch",!1),e("readOnly",!1,function(e,t){"nocursor"==t&&(vn(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)}),e("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),e("dragDrop",!0,_l),e("allowDropFileTypes",null),e("cursorBlinkRate",530),e("cursorScrollMargin",0),e("cursorHeight",1,an,!0),e("singleCursorHeightPerLine",!0,an,!0),e("workTime",100),e("workDelay",100),e("flattenSpans",!0,Si,!0),e("addModeClass",!1,Si,!0),e("pollInterval",100),e("undoDepth",200,function(e,t){return e.doc.history.undoDepth=t}),e("historyEventDelay",1250),e("viewportMargin",10,function(e){return e.refresh()},!0),e("maxHighlightLength",1e4,Si,!0),e("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),e("tabindex",null,function(e,t){return e.display.input.getField().tabIndex=t||""}),e("autofocus",null),e("direction","ltr",function(e,t){return e.doc.setDirection(t)},!0),e("phrases",null)}(wl),Rl=(Hl=wl).optionHandlers,Bl=Hl.helpers={},Hl.prototype={constructor:Hl,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)&&Vn(this,Rl[e])(this,t,n),it(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"](jo(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:$n(function(e,t){var r=e.token?e:Hl.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++,Yn(this)}),removeOverlay:$n(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 Yn(this)}}),indentLine:$n(function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),pe(this.doc,e)&&Cl(this,e,t,r)}),indentSelection:$n(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 c=a;c<n;++c)Cl(t,c,e);var u=t.doc.sel.ranges;0==l.ch&&r.length==u.length&&0<u[i].from().ch&&ji(t.doc,i,new vi(l,u[i].to()),U)}}}),getTokenAt:function(e,t){return jt(this,e,t)},getLineTokens:function(e,t){return jt(this,me(e),t,!0)},getTokenTypeAt:function(e){e=ke(this.doc,e);var t,r=zt(this,ae(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?Hl.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==H(r,a.val)&&r.push(a.val)}return r},getStateAfter:function(e,t){var r=this.doc;return qt(this,(e=we(r,null==e?r.first+r.size-1:e))+1,t).state},cursorCoords:function(e,t){var r=this.doc.sel.primary();return Gr(this,null==e?r.head:"object"==typeof e?ke(this.doc,e):e?r.from():r.to(),t||"page")},charCoords:function(e,t){return jr(this,ke(this.doc,e),t||"page")},coordsChar:function(e,t){return $r(this,(e=Ur(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Ur(this,{top:e,left:0},t||"page").top,he(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:o<e&&(e=o,i=!0),n=ae(this.doc,e)}else n=e;return Br(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-Ve(n):0)},defaultTextHeight:function(){return Jr(this.display)},defaultCharWidth:function(){return en(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,c=(e=Gr(this,ke(this.doc,e))).bottom,u=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),a.sizer.appendChild(t),"over"==n)c=e.top;else if("above"==n||"near"==n){var f=Math.max(a.wrapper.clientHeight,this.doc.height),d=Math.max(a.sizer.clientWidth,a.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>f)&&e.top>t.offsetHeight?c=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=f&&(c=e.bottom),u+t.offsetWidth>d&&(u=d-t.offsetWidth)}t.style.top=c+"px",t.style.left=t.style.right="","right"==i?(u=a.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?u=0:"middle"==i&&(u=(a.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),r&&(o=this,l={left:u,top:c,right:u+t.offsetWidth,bottom:c+t.offsetHeight},null!=(s=kn(o,l)).scrollTop&&Nn(o,s.scrollTop),null!=s.scrollLeft&&On(o,s.scrollLeft))},triggerOnKeyDown:$n(il),triggerOnKeyPress:$n(ll),triggerOnKeyUp:ol,triggerOnMouseDown:$n(ul),execCommand:function(e){if(Xo.hasOwnProperty(e))return Xo[e].call(null,this)},triggerElectric:$n(function(e){Nl(this,e)}),findPosH:function(e,t,r,n){var i=1;t<0&&(i=-1,t=-t);for(var o=ke(this.doc,e),l=0;l<t&&!(o=Wl(this.doc,o,i,r,n)).hitSide;++l);return o},moveH:$n(function(t,r){var n=this;this.extendSelectionsBy(function(e){return n.display.shift||n.doc.extend||e.empty()?Wl(n.doc,e.head,t,r,n.options.rtlMoveVisually):t<0?e.from():e.to()},G)}),deleteH:$n(function(r,n){var e=this.doc.sel,i=this.doc;e.somethingSelected()?i.replaceSelection("",null,"+delete"):Go(this,function(e){var t=Wl(i,e.head,r,n,!1);return r<0?{from:t,to:e.head}:{from:e.head,to:t}})}),findPosV:function(e,t,r,n){var i=1,o=n;t<0&&(i=-1,t=-t);for(var l=ke(this.doc,e),s=0;s<t;++s){var a=Gr(this,l,"div");if(null==o?o=a.left:a.left=o,(l=El(this,a,i,r)).hitSide)break}return l},moveV:$n(function(n,i){var o=this,l=this.doc,s=[],a=!this.display.shift&&!l.extend&&l.sel.somethingSelected();if(l.extendSelectionsBy(function(e){if(a)return n<0?e.from():e.to();var t=Gr(o,e.head,"div");null!=e.goalColumn&&(t.left=e.goalColumn),s.push(t.left);var r=El(o,t,n,i);return"page"==i&&e==l.sel.primary()&&Cn(o,jr(o,r,"div").top-t.top),r},G),s.length)for(var e=0;e<l.sel.ranges.length;e++)l.sel.ranges[e].goalColumn=s[e]}),findWordAt:function(e){var t=ae(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)};0<r&&l(t.charAt(r-1));)--r;for(;n<t.length&&l(t.charAt(n));)++n}return new vi(me(e.line,r),me(e.line,n))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?W(this.display.cursorDiv,"CodeMirror-overwrite"):L(this.display.cursorDiv,"CodeMirror-overwrite"),it(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==D()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:$n(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:$n(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:me(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,Tn(r=this),r.curOp.scrollToPos=n):Mn(this,e.from,e.to,e.margin)}),setSize:$n(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&&Fr(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){Zn(r,i,"widget");break}++i}),this.curOp.forceUpdate=!0,it(this,"refresh",this)}),operation:function(e){return Kn(this,e)},startOperation:function(){return Hn(this)},endOperation:function(){return Rn(this)},refresh:$n(function(){var e=this.display.cachedTextHeight;Yn(this),this.curOp.forceUpdate=!0,zr(this),Ln(this,this.doc.scrollLeft,this.doc.scrollTop),si(this),(null==e||.5<Math.abs(e-Jr(this.display)))&&on(this),it(this,"refresh",this)}),swapDoc:$n(function(e){var t=this.doc;return t.cm=null,Ni(this,e),zr(this),this.display.input.reset(),Ln(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,sr(this,"swapDoc",this,t),t}),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},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}},at(Hl),Hl.registerHelper=function(e,t,r){Bl.hasOwnProperty(e)||(Bl[e]=Hl[e]={_global:[]}),Bl[e][t]=r},Hl.registerGlobalHelper=function(e,t,r,n){Hl.registerHelper(e,t,n),Bl[e]._global.push({pred:r,val:n})};var jl,Gl="iter insert remove copy getEditor constructor".split(" ");for(var Kl in So.prototype)So.prototype.hasOwnProperty(Kl)&&H(Gl,Kl)<0&&(wl.prototype[Kl]=function(e){return function(){return e.apply(this.doc,arguments)}}(So.prototype[Kl]));return at(So),wl.inputStyles={textarea:Ul,contenteditable:Il},wl.defineMode=function(e){wl.defaults.mode||"null"==e||(wl.defaults.mode=e),function(e,t){2<arguments.length&&(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(t,e){if((e=e?F(e):{}).value=t.value,!e.tabindex&&t.tabIndex&&(e.tabindex=t.tabIndex),!e.placeholder&&t.placeholder&&(e.placeholder=t.placeholder),null==e.autofocus){var r=D();e.autofocus=r==t||null!=t.getAttribute("autofocus")&&r==document.body}function n(){t.value=s.getValue()}var i;if(t.form&&(tt(t.form,"submit",n),!e.leaveSubmitMethodAlone)){var o=t.form;i=o.submit;try{var l=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=l}}catch(e){}}e.finishInit=function(e){e.save=n,e.getTextArea=function(){return t},e.toTextArea=function(){e.toTextArea=isNaN,n(),t.parentNode.removeChild(e.getWrapperElement()),t.style.display="",t.form&&(nt(t.form,"submit",n),"function"==typeof t.form.submit&&(t.form.submit=i))}},t.style.display="none";var s=wl(function(e){return t.parentNode.insertBefore(e,t.nextSibling)},e);return s},(jl=wl).off=nt,jl.on=tt,jl.wheelEventPixels=pi,jl.Doc=So,jl.splitLines=xt,jl.countColumn=z,jl.findColumn=K,jl.isWordChar=ee,jl.Pass=B,jl.signal=it,jl.Line=Vt,jl.changeEnd=_i,jl.scrollbarModel=Fn,jl.Pos=me,jl.cmpPos=ve,jl.modes=St,jl.mimeModes=Lt,jl.resolveMode=Tt,jl.getMode=Mt,jl.modeExtensions=Nt,jl.extendMode=At,jl.copyState=Ot,jl.startState=Wt,jl.innerMode=Dt,jl.commands=Xo,jl.keyMap=Fo,jl.keyName=Uo,jl.isModifierKey=Ro,jl.lookupKey=Ho,jl.normalizeKeyMap=qo,jl.StringStream=Et,jl.SharedTextMarker=xo,jl.TextMarker=bo,jl.LineWidget=mo,jl.e_preventDefault=ct,jl.e_stopPropagation=ut,jl.e_stop=dt,jl.addClass=W,jl.contains=O,jl.rmClass=L,jl.keyNames=Wo,wl.version="5.41.0",wl}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(A){"use strict";function O(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.info=n,this.align=i,this.prev=o}function D(e,t,r,n){var i=e.indented;return e.context&&"statement"==e.context.type&&"statement"!=r&&(i=e.context.indented),e.context=new O(i,t,r,n,null,e.context)}function W(e){var t=e.context.type;return")"!=t&&"]"!=t&&"}"!=t||(e.indented=e.context.indented),e.context=e.context.prev}function E(e,t,r){return"variable"==t.prevToken||"type"==t.prevToken||(!!/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(e.string.slice(0,r))||(!(!t.typeAtEndOfLine||e.column()!=e.indentation())||void 0))}function I(e){for(;;){if(!e||"top"==e.type)return!0;if("}"==e.type&&"namespace"!=e.prev.info)return!1;e=e.prev}}function e(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function P(e,t){return"function"==typeof e?e(t):e.propertyIsEnumerable(t)}A.defineMode("clike",function(e,s){var l,a,c=e.indentUnit,u=s.statementIndentUnit||c,f=s.dontAlignCalls,d=s.keywords||{},h=s.types||{},p=s.builtin||{},g=s.blockKeywords||{},m=s.defKeywords||{},v=s.atoms||{},y=s.hooks||{},b=s.multiLineStrings,o=!1!==s.indentStatements,t=!1!==s.indentSwitch,_=s.namespaceSeparator,x=s.isPunctuationChar||/[\[\]{}\(\),;\:\.]/,w=s.numberStart||/[\d\.]/,k=s.number||/^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,C=s.isOperatorChar||/[+\-*&%=<>!?|\/]/,S=s.isIdentifierChar||/[\w\$_\xa1-\uffff]/,L=s.isReservedIdentifier||!1;function T(e,t){var o,r=e.next();if(y[r]){var n=y[r](e,t);if(!1!==n)return n}if('"'==r||"'"==r)return t.tokenize=(o=r,function(e,t){for(var r,n=!1,i=!1;null!=(r=e.next());){if(r==o&&!n){i=!0;break}n=!n&&"\\"==r}return(i||!n&&!b)&&(t.tokenize=null),"string"}),t.tokenize(e,t);if(x.test(r))return l=r,null;if(w.test(r)){if(e.backUp(1),e.match(k))return"number";e.next()}if("/"==r){if(e.eat("*"))return(t.tokenize=M)(e,t);if(e.eat("/"))return e.skipToEnd(),"comment"}if(C.test(r)){for(;!e.match(/^\/[\/*]/,!1)&&e.eat(C););return"operator"}if(e.eatWhile(S),_)for(;e.match(_);)e.eatWhile(S);var i=e.current();return P(d,i)?(P(g,i)&&(l="newstatement"),P(m,i)&&(a=!0),"keyword"):P(h,i)?"type":P(p,i)||L&&L(i)?(P(g,i)&&(l="newstatement"),"builtin"):P(v,i)?"atom":"variable"}function M(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=null;break}n="*"==r}return"comment"}function N(e,t){s.typeFirstDefinitions&&e.eol()&&I(t.context)&&(t.typeAtEndOfLine=E(e,t,e.pos))}return{startState:function(e){return{tokenize:null,context:new O((e||0)-c,0,"top",null,!1),indented:0,startOfLine:!0,prevToken:null}},token:function(e,t){var r=t.context;if(e.sol()&&(null==r.align&&(r.align=!1),t.indented=e.indentation(),t.startOfLine=!0),e.eatSpace())return N(e,t),null;l=a=null;var n=(t.tokenize||T)(e,t);if("comment"==n||"meta"==n)return n;if(null==r.align&&(r.align=!0),";"==l||":"==l||","==l&&e.match(/^\s*(?:\/\/.*)?$/,!1))for(;"statement"==t.context.type;)W(t);else if("{"==l)D(t,e.column(),"}");else if("["==l)D(t,e.column(),"]");else if("("==l)D(t,e.column(),")");else if("}"==l){for(;"statement"==r.type;)r=W(t);for("}"==r.type&&(r=W(t));"statement"==r.type;)r=W(t)}else l==r.type?W(t):o&&(("}"==r.type||"top"==r.type)&&";"!=l||"statement"==r.type&&"newstatement"==l)&&D(t,e.column(),"statement",e.current());if("variable"==n&&("def"==t.prevToken||s.typeFirstDefinitions&&E(e,t,e.start)&&I(t.context)&&e.match(/^\s*\(/,!1))&&(n="def"),y.token){var i=y.token(e,t,n);void 0!==i&&(n=i)}return"def"==n&&!1===s.styleDefs&&(n="variable"),t.startOfLine=!1,t.prevToken=a?"def":n||l,N(e,t),n},indent:function(e,t){if(e.tokenize!=T&&null!=e.tokenize||e.typeAtEndOfLine)return A.Pass;var r=e.context,n=t&&t.charAt(0),i=n==r.type;if("statement"==r.type&&"}"==n&&(r=r.prev),s.dontIndentStatements)for(;"statement"==r.type&&s.dontIndentStatements.test(r.info);)r=r.prev;if(y.indent){var o=y.indent(e,r,t,c);if("number"==typeof o)return o}var l=r.prev&&"switch"==r.prev.info;if(s.allmanIndentation&&/[{(]/.test(n)){for(;"top"!=r.type&&"}"!=r.type;)r=r.prev;return r.indented}return"statement"==r.type?r.indented+("{"==n?0:u):!r.align||f&&")"==r.type?")"!=r.type||i?r.indented+(i?0:c)+(i||!l||/^(?:case|default)\b/.test(t)?0:c):r.indented+u:r.column+(i?0:1)},electricInput:t?/^\s*(?:case .*?:|default:|\{\}?|\})$/:/^\s*[{}]$/,blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * ",lineComment:"//",fold:"brace"}});var t="auto if break case register continue return default do sizeof static else struct switch extern typedef union for goto while enum const volatile inline restrict asm fortran",r=e("int long char short double float unsigned signed void bool"),n=e("SEL instancetype id Class Protocol BOOL");function i(e){return P(r,e)||/.+_t/.test(e)}var o="case do else for if switch while struct enum union",l="struct enum union";function s(e,t){if(!t.startOfLine)return!1;for(var r,n=null;r=e.peek();){if("\\"==r&&e.match(/^.$/)){n=s;break}if("/"==r&&e.match(/^\/[\/\*]/,!1))break;e.next()}return t.tokenize=n,"meta"}function a(e,t){return"type"==t.prevToken&&"type"}function c(e){return!(!e||e.length<2)&&("_"==e[0]&&("_"==e[1]||e[1]!==e[1].toLowerCase()))}function u(e){return e.eatWhile(/[\w\.']/),"number"}function f(e,t){if(e.backUp(1),e.match(/(R|u8R|uR|UR|LR)/)){var r=e.match(/"([^\s\\()]{0,16})\(/);return!!r&&(t.cpp11RawStringDelim=r[1],(t.tokenize=h)(e,t))}return e.match(/(u8|u|U|L)/)?!!e.match(/["']/,!1)&&"string":(e.next(),!1)}function d(e,t){for(var r;null!=(r=e.next());)if('"'==r&&!e.eat('"')){t.tokenize=null;break}return"string"}function h(e,t){var r=t.cpp11RawStringDelim.replace(/[^\w\s]/g,"\\$&");return e.match(new RegExp(".*?\\)"+r+'"'))?t.tokenize=null:e.skipToEnd(),"string"}function p(e,t){"string"==typeof e&&(e=[e]);var r=[];function n(e){if(e)for(var t in e)e.hasOwnProperty(t)&&r.push(t)}n(t.keywords),n(t.types),n(t.builtin),n(t.atoms),r.length&&(t.helperType=e[0],A.registerHelper("hintWords",e[0],r));for(var i=0;i<e.length;++i)A.defineMIME(e[i],t)}function g(e,t){for(var r=!1;!e.eol();){if(!r&&e.match('"""')){t.tokenize=null;break}r="\\"==e.next()&&!r}return"string"}p(["text/x-csrc","text/x-c","text/x-chdr"],{name:"clike",keywords:e(t),types:i,blockKeywords:e(o),defKeywords:e(l),typeFirstDefinitions:!0,atoms:e("NULL true false"),isReservedIdentifier:c,hooks:{"#":s,"*":a},modeProps:{fold:["brace","include"]}}),p(["text/x-c++src","text/x-c++hdr"],{name:"clike",keywords:e(t+" dynamic_cast namespace reinterpret_cast try explicit new static_cast typeid catch operator template typename class friend private this using const_cast public throw virtual delete mutable protected alignas alignof constexpr decltype nullptr noexcept thread_local final static_assert override"),types:i,blockKeywords:e(o+" class try catch finally"),defKeywords:e(l+" class namespace"),typeFirstDefinitions:!0,atoms:e("true false NULL"),dontIndentStatements:/^template$/,isIdentifierChar:/[\w\$_~\xa1-\uffff]/,isReservedIdentifier:c,hooks:{"#":s,"*":a,u:f,U:f,L:f,R:f,0:u,1:u,2:u,3:u,4:u,5:u,6:u,7:u,8:u,9:u,token:function(e,t,r){if("variable"==r&&"("==e.peek()&&(";"==t.prevToken||null==t.prevToken||"}"==t.prevToken)&&(n=e.current(),(i=/(\w+)::~?(\w+)$/.exec(n))&&i[1]==i[2]))return"def";var n,i}},namespaceSeparator:"::",modeProps:{fold:["brace","include"]}}),p("text/x-java",{name:"clike",keywords:e("abstract assert break case catch class const continue default do else enum extends final finally float for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while @interface"),types:e("byte short int long float double boolean char void Boolean Byte Character Double Float Integer Long Number Object Short String StringBuffer StringBuilder Void"),blockKeywords:e("catch class do else finally for if switch try while"),defKeywords:e("class interface enum @interface"),typeFirstDefinitions:!0,atoms:e("true false null"),number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,hooks:{"@":function(e){return!e.match("interface",!1)&&(e.eatWhile(/[\w\$_]/),"meta")}},modeProps:{fold:["brace","import"]}}),p("text/x-csharp",{name:"clike",keywords:e("abstract as async await base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual void volatile while add alias ascending descending dynamic from get global group into join let orderby partial remove select set value var yield"),types:e("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32 UInt64 bool byte char decimal double short int long object sbyte float string ushort uint ulong"),blockKeywords:e("catch class do else finally for foreach if struct switch try while"),defKeywords:e("class interface namespace struct var"),typeFirstDefinitions:!0,atoms:e("true false null"),hooks:{"@":function(e,t){return e.eat('"')?(t.tokenize=d)(e,t):(e.eatWhile(/[\w\$_]/),"meta")}}}),p("text/x-scala",{name:"clike",keywords:e("abstract case catch class def do else extends final finally for forSome if implicit import lazy match new null object override package private protected return sealed super this throw trait try type val var while with yield _ assert assume require print println printf readLine readBoolean readByte readShort readChar readInt readLong readFloat readDouble"),types:e("AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"),multiLineStrings:!0,blockKeywords:e("catch class enum do else finally for forSome if match switch try while"),defKeywords:e("class enum def object package trait type val var"),atoms:e("true false null"),indentStatements:!1,indentSwitch:!1,isOperatorChar:/[+\-*&%=<>!?|\/#:@]/,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return!!e.match('""')&&(t.tokenize=g,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},"=":function(e,t){var r=t.context;return!("}"!=r.type||!r.align||!e.eat(">"))&&(t.context=new O(r.indented,r.column,r.type,r.info,null,r.prev),"operator")},"/":function(e,t){return!!e.eat("*")&&(t.tokenize=function n(i){return function(e,t){for(var r;r=e.next();){if("*"==r&&e.eat("/")){if(1!=i)return t.tokenize=n(i-1),t.tokenize(e,t);t.tokenize=null;break}if("/"==r&&e.eat("*"))return t.tokenize=n(i+1),t.tokenize(e,t)}return"comment"}}(1),t.tokenize(e,t))}},modeProps:{closeBrackets:{pairs:'()[]{}""',triples:'"'}}}),p("text/x-kotlin",{name:"clike",keywords:e("package as typealias class interface this super val operator var fun for is in This throw return annotation break continue object if else while do try when !in !is as? file import where by get set abstract enum open inner override private public internal protected catch finally out final vararg reified dynamic companion constructor init sealed field property receiver param sparam lateinit data inline noinline tailrec external annotation crossinline const operator infix suspend actual expect setparam"),types:e("Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable Compiler Double Exception Float Integer Long Math Number Object Package Pair Process Runtime Runnable SecurityManager Short StackTraceElement StrictMath String StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy LazyThreadSafetyMode LongArray Nothing ShortArray Unit"),intendSwitch:!1,indentStatements:!1,multiLineStrings:!0,number:/^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,blockKeywords:e("catch class do else finally for if where try while enum"),defKeywords:e("class val var object interface fun"),atoms:e("true false null this"),hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){var o;return t.tokenize=(o=e.match('""'),function(e,t){for(var r,n=!1,i=!1;!e.eol();){if(!o&&!n&&e.match('"')){i=!0;break}if(o&&e.match('"""')){i=!0;break}r=e.next(),!n&&"$"==r&&e.match("{")&&e.skipTo("}"),n=!n&&"\\"==r&&!o}return!i&&o||(t.tokenize=null),"string"}),t.tokenize(e,t)},indent:function(e,t,r,n){var i=r&&r.charAt(0);return"}"!=e.prevToken&&")"!=e.prevToken||""!=r?"operator"==e.prevToken&&"}"!=r||"variable"==e.prevToken&&"."==i||("}"==e.prevToken||")"==e.prevToken)&&"."==i?2*n+t.indented:t.align&&"}"==t.type?t.indented+(e.context.type==(r||"").charAt(0)?0:n):void 0:e.indented}},modeProps:{closeBrackets:{triples:'"'}}}),p(["x-shader/x-vertex","x-shader/x-fragment"],{name:"clike",keywords:e("sampler1D sampler2D sampler3D samplerCube sampler1DShadow sampler2DShadow const attribute uniform varying break continue discard return for while do if else struct in out inout"),types:e("float int bool void vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 mat2 mat3 mat4"),blockKeywords:e("for while do if else struct"),builtin:e("radians degrees sin cos tan asin acos atan pow exp log exp2 sqrt inversesqrt abs sign floor ceil fract mod min max clamp mix step smoothstep length distance dot cross normalize ftransform faceforward reflect refract matrixCompMult lessThan lessThanEqual greaterThan greaterThanEqual equal notEqual any all not texture1D texture1DProj texture1DLod texture1DProjLod texture2D texture2DProj texture2DLod texture2DProjLod texture3D texture3DProj texture3DLod texture3DProjLod textureCube textureCubeLod shadow1D shadow2D shadow1DProj shadow2DProj shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod dFdx dFdy fwidth noise1 noise2 noise3 noise4"),atoms:e("true false gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 gl_FogCoord gl_PointCoord gl_Position gl_PointSize gl_ClipVertex gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor gl_TexCoord gl_FogFragCoord gl_FragCoord gl_FrontFacing gl_FragData gl_FragDepth gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse gl_TexureMatrixTranspose gl_ModelViewMatrixInverseTranspose gl_ProjectionMatrixInverseTranspose gl_ModelViewProjectionMatrixInverseTranspose gl_TextureMatrixInverseTranspose gl_NormalScale gl_DepthRange gl_ClipPlane gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel gl_FrontLightModelProduct gl_BackLightModelProduct gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ gl_FogParameters gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits gl_MaxDrawBuffers"),indentSwitch:!1,hooks:{"#":s},modeProps:{fold:["brace","include"]}}),p("text/x-nesc",{name:"clike",keywords:e(t+" as atomic async call command component components configuration event generic implementation includes interface module new norace nx_struct nx_union post provides signal task uses abstract extends"),types:i,blockKeywords:e(o),atoms:e("null true false"),hooks:{"#":s},modeProps:{fold:["brace","include"]}}),p("text/x-objectivec",{name:"clike",keywords:e(t+" bycopy byref in inout oneway out self super atomic nonatomic retain copy readwrite readonly strong weak assign typeof nullable nonnull null_resettable _cmd @interface @implementation @end @protocol @encode @property @synthesize @dynamic @class @public @package @private @protected @required @optional @try @catch @finally @import @selector @encode @defs @synchronized @autoreleasepool @compatibility_alias @available"),types:function(e){return i(e)||P(n,e)},builtin:e("FOUNDATION_EXPORT FOUNDATION_EXTERN NS_INLINE NS_FORMAT_FUNCTION NS_RETURNS_RETAINED NS_ERROR_ENUM NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER NS_DESIGNATED_INITIALIZER NS_ENUM NS_OPTIONS NS_REQUIRES_NIL_TERMINATION NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_SWIFT_NAME NS_REFINED_FOR_SWIFT"),blockKeywords:e(o+" @synthesize @try @catch @finally @autoreleasepool @synchronized"),defKeywords:e(l+" @interface @implementation @protocol @class"),dontIndentStatements:/^@.*$/,typeFirstDefinitions:!0,atoms:e("YES NO NULL Nil nil true false nullptr"),isReservedIdentifier:c,hooks:{"#":s,"*":a},modeProps:{fold:["brace","include"]}}),p("text/x-squirrel",{name:"clike",keywords:e("base break clone continue const default delete enum extends function in class foreach local resume return this throw typeof yield constructor instanceof static"),types:i,blockKeywords:e("case catch class else for foreach if switch try while"),defKeywords:e("function local class"),typeFirstDefinitions:!0,atoms:e("true false null"),hooks:{"#":s},modeProps:{fold:["brace","include"]}});var m=null;p("text/x-ceylon",{name:"clike",keywords:e("abstracts alias assembly assert assign break case catch class continue dynamic else exists extends finally for function given if import in interface is let module new nonempty object of out outer package return satisfies super switch then this throw try value void while"),types:function(e){var t=e.charAt(0);return t===t.toUpperCase()&&t!==t.toLowerCase()},blockKeywords:e("case catch class dynamic else finally for function if interface module new object switch try while"),defKeywords:e("class dynamic function interface module object package value"),builtin:e("abstract actual aliased annotation by default deprecated doc final formal late license native optional sealed see serializable shared suppressWarnings tagged throws variable"),isPunctuationChar:/[\[\]{}\(\),;\:\.`]/,isOperatorChar:/[+\-*&%=<>!?|^~:\/]/,numberStart:/[\d#$]/,number:/^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,multiLineStrings:!0,typeFirstDefinitions:!0,atoms:e("true false null larger smaller equal empty finished"),indentSwitch:!1,styleDefs:!1,hooks:{"@":function(e){return e.eatWhile(/[\w\$_]/),"meta"},'"':function(e,t){return t.tokenize=function o(l){return function(e,t){for(var r,n=!1,i=!1;!e.eol();){if(!n&&e.match('"')&&("single"==l||e.match('""'))){i=!0;break}if(!n&&e.match("``")){m=o(l),i=!0;break}r=e.next(),n="single"==l&&!n&&"\\"==r}return i&&(t.tokenize=null),"string"}}(e.match('""')?"triple":"single"),t.tokenize(e,t)},"`":function(e,t){return!(!m||!e.match("`"))&&(t.tokenize=m,m=null,t.tokenize(e,t))},"'":function(e){return e.eatWhile(/[\w\$_\xa1-\uffff]/),"atom"},token:function(e,t,r){if(("variable"==r||"type"==r)&&"."==t.prevToken)return"variable-2"}},modeProps:{fold:["brace","import"],closeBrackets:{triples:'"'}}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../htmlmixed/htmlmixed"),require("../clike/clike")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../htmlmixed/htmlmixed","../clike/clike"],e):e(CodeMirror)}(function(c){"use strict";function e(e){for(var t={},r=e.split(" "),n=0;n<r.length;++n)t[r[n]]=!0;return t}function s(i,o,l){return 0==i.length?a(o):function(e,t){for(var r=i[0],n=0;n<r.length;n++)if(e.match(r[n][0]))return t.tokenize=s(i.slice(1),o),r[n][1];return t.tokenize=a(o,l),"string"}}function a(r,n){return function(e,t){return function(e,t,r,n){if(!1!==n&&e.match("${",!1)||e.match("{$",!1))return t.tokenize=null,"string";if(!1!==n&&e.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/))return e.match("[",!1)&&(t.tokenize=s([[["[",null]],[[/\d[\w\.]*/,"number"],[/\$[a-zA-Z_][a-zA-Z0-9_]*/,"variable-2"],[/[\w\$]+/,"variable"]],[["]",null]]],r,n)),e.match(/\-\>\w/,!1)&&(t.tokenize=s([[["->",null]],[[/[\w]+/,"variable"]]],r,n)),"variable-2";var i=!1;for(;!e.eol()&&(i||!1===n||!e.match("{$",!1)&&!e.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/,!1));){if(!i&&e.match(r)){t.tokenize=null,t.tokStack.pop(),t.tokStack.pop();break}i="\\"==e.next()&&!i}return"string"}(e,t,r,n)}}var t="abstract and array as break case catch class clone const continue declare default do else elseif enddeclare endfor endforeach endif endswitch endwhile extends final for foreach function global goto if implements interface instanceof namespace new or private protected public static switch throw trait try use var while xor die echo empty exit eval include include_once isset list require require_once return print unset __halt_compiler self static parent yield insteadof finally",r="true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__",n="func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";c.registerHelper("hintWords","php",[t,r,n].join(" ").split(" ")),c.registerHelper("wordChars","php",/[\w$]/);var i={name:"clike",helperType:"php",keywords:e(t),blockKeywords:e("catch do else elseif for foreach if switch try while finally"),defKeywords:e("class function interface namespace trait"),atoms:e(r),builtin:e(n),multiLineStrings:!0,hooks:{$:function(e){return e.eatWhile(/[\w\$_]/),"variable-2"},"<":function(e,t){var r;if(r=e.match(/<<\s*/)){var n=e.eat(/['"]/);e.eatWhile(/[\w\.]/);var i=e.current().slice(r[0].length+(n?2:1));if(n&&e.eat(n),i)return(t.tokStack||(t.tokStack=[])).push(i,0),t.tokenize=a(i,"'"!=n),"string"}return!1},"#":function(e){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"},"/":function(e){if(e.eat("/")){for(;!e.eol()&&!e.match("?>",!1);)e.next();return"comment"}return!1},'"':function(e,t){return(t.tokStack||(t.tokStack=[])).push('"',0),t.tokenize=a('"'),"string"},"{":function(e,t){return t.tokStack&&t.tokStack.length&&t.tokStack[t.tokStack.length-1]++,!1},"}":function(e,t){return t.tokStack&&0<t.tokStack.length&&!--t.tokStack[t.tokStack.length-1]&&(t.tokenize=a(t.tokStack[t.tokStack.length-2])),!1}}};c.defineMode("php",function(e,r){var s=c.getMode(e,r&&r.htmlMode||"text/html"),a=c.getMode(e,i);return{startState:function(){var e=c.startState(s),t=r.startOpen?c.startState(a):null;return{html:e,php:t,curMode:r.startOpen?a:s,curState:r.startOpen?t:e,pending:null}},copyState:function(e){var t,r=e.html,n=c.copyState(s,r),i=e.php,o=i&&c.copyState(a,i);return t=e.curMode==s?n:o,{html:n,php:o,curMode:e.curMode,curState:t,pending:e.pending}},token:function(e,t){var r=t.curMode==a;if(e.sol()&&t.pending&&'"'!=t.pending&&"'"!=t.pending&&(t.pending=null),r)return r&&null==t.php.tokenize&&e.match("?>")?(t.curMode=s,t.curState=t.html,t.php.context.prev||(t.php=null),"meta"):a.token(e,t.curState);if(e.match(/^<\?\w*/))return t.curMode=a,t.php||(t.php=c.startState(a,s.indent(t.html,""))),t.curState=t.php,"meta";if('"'==t.pending||"'"==t.pending){for(;!e.eol()&&e.next()!=t.pending;);var n="string"}else n=t.pending&&e.pos<t.pending.end?(e.pos=t.pending.end,t.pending.style):s.token(e,t.curState);t.pending&&(t.pending=null);var i,o=e.current(),l=o.search(/<\?/);return-1!=l&&("string"==n&&(i=o.match(/[\'\"]$/))&&!/\?>/.test(o)?t.pending=i[0]:t.pending={end:e.pos,style:n},e.backUp(o.length-l)),n},indent:function(e,t){return e.curMode!=a&&/^\s*<\//.test(t)||e.curMode==a&&/^\?>/.test(t)?s.indent(e.html,t):e.curMode.indent(e.curState,t)},blockCommentStart:"/*",blockCommentEnd:"*/",lineComment:"//",innerMode:function(e){return{state:e.curState,mode:e.curMode}}}},"htmlmixed","clike"),c.defineMIME("application/x-httpd-php","php"),c.defineMIME("application/x-httpd-php-open",{name:"php",startOpen:!0}),c.defineMIME("text/x-php",i)}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(n){var u=/MSIE \d/.test(navigator.userAgent)&&(null==document.documentMode||document.documentMode<8),g=n.Pos,m={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"};function f(e,t,r){var n=e.getLineHandle(t.line),i=t.ch-1,o=r&&r.afterCursor;null==o&&(o=/(^| )cm-fat-cursor($| )/.test(e.getWrapperElement().className));var l=!o&&0<=i&&m[n.text.charAt(i)]||m[n.text.charAt(++i)];if(!l)return null;var s=">"==l.charAt(1)?1:-1;if(r&&r.strict&&0<s!=(i==t.ch))return null;var a=e.getTokenTypeAt(g(t.line,i+1)),c=d(e,g(t.line,i+(0<s?1:0)),s,a||null,r);return null==c?null:{from:g(t.line,i),to:c&&c.pos,match:c&&c.ch==l.charAt(0),forward:0<s}}function d(e,t,r,n,i){for(var o=i&&i.maxScanLineLength||1e4,l=i&&i.maxScanLines||1e3,s=[],a=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,c=0<r?Math.min(t.line+l,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-l),u=t.line;u!=c;u+=r){var f=e.getLine(u);if(f){var d=0<r?0:f.length-1,h=0<r?f.length:-1;if(!(f.length>o))for(u==t.line&&(d=t.ch-(r<0?1:0));d!=h;d+=r){var p=f.charAt(d);if(a.test(p)&&(void 0===n||e.getTokenTypeAt(g(u,d+1))==n))if(">"==m[p].charAt(1)==0<r)s.push(p);else{if(!s.length)return{pos:g(u,d),ch:p};s.pop()}}}}return u-r!=(0<r?e.lastLine():e.firstLine())&&null}function t(e,t,r){for(var n=e.state.matchBrackets.maxHighlightLineLength||1e3,i=[],o=e.listSelections(),l=0;l<o.length;l++){var s=o[l].empty()&&f(e,o[l].head,r);if(s&&e.getLine(s.from.line).length<=n){var a=s.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket";i.push(e.markText(s.from,g(s.from.line,s.from.ch+1),{className:a})),s.to&&e.getLine(s.to.line).length<=n&&i.push(e.markText(s.to,g(s.to.line,s.to.ch+1),{className:a}))}}if(i.length){u&&e.state.focused&&e.focus();var c=function(){e.operation(function(){for(var e=0;e<i.length;e++)i[e].clear()})};if(!t)return c;setTimeout(c,800)}}function i(e){e.operation(function(){e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null),e.state.matchBrackets.currentlyHighlighted=t(e,!1,e.state.matchBrackets)})}n.defineOption("matchBrackets",!1,function(e,t,r){r&&r!=n.Init&&(e.off("cursorActivity",i),e.state.matchBrackets&&e.state.matchBrackets.currentlyHighlighted&&(e.state.matchBrackets.currentlyHighlighted(),e.state.matchBrackets.currentlyHighlighted=null)),t&&(e.state.matchBrackets="object"==typeof t?t:{},e.on("cursorActivity",i))}),n.defineExtension("matchBrackets",function(){t(this,!0)}),n.defineExtension("findMatchingBracket",function(e,t,r){return(r||"boolean"==typeof t)&&(t=r?(r.strict=t,r):t?{strict:!0}:null),f(this,e,t)}),n.defineExtension("scanForBracket",function(e,t,r,n){return d(this,e,t,r,n)})});
languages/code-snippets.pot CHANGED
@@ -6,9 +6,9 @@
6
  #, fuzzy
7
  msgid ""
8
  msgstr ""
9
- "Project-Id-Version: code-snippets 2.12.0\n"
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2018-09-23 23:48+1000\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -18,12 +18,12 @@ msgstr ""
18
  "Content-Transfer-Encoding: 8bit\n"
19
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
20
 
21
- #: php/admin-menus/class-admin-menu.php:103
22
  msgid "You are not authorized to access this page."
23
  msgstr ""
24
 
25
  #: php/admin-menus/class-edit-menu.php:13
26
- #: php/admin-menus/class-edit-menu.php:14 php/views/edit.php:31
27
  msgid "Edit Snippet"
28
  msgstr ""
29
 
@@ -32,122 +32,122 @@ msgctxt "menu label"
32
  msgid "Add New"
33
  msgstr ""
34
 
35
- #: php/admin-menus/class-edit-menu.php:40 php/views/edit.php:37
36
  msgid "Add New Snippet"
37
  msgstr ""
38
 
39
- #: php/admin-menus/class-edit-menu.php:164
40
  msgid "Don't Panic"
41
  msgstr ""
42
 
43
- #: php/admin-menus/class-edit-menu.php:165
44
  #, php-format
45
  msgid ""
46
  "The code snippet you are trying to save produced a fatal error on line %d:"
47
  msgstr ""
48
 
49
- #: php/admin-menus/class-edit-menu.php:167
50
  msgid ""
51
  "The previous version of the snippet is unchanged, and the rest of this site "
52
  "should be functioning normally as before."
53
  msgstr ""
54
 
55
- #: php/admin-menus/class-edit-menu.php:168
56
  msgid ""
57
  "Please use the back button in your browser to return to the previous page "
58
  "and try to fix the code error."
59
  msgstr ""
60
 
61
- #: php/admin-menus/class-edit-menu.php:169
62
  msgid ""
63
  "If you prefer, you can close this page and discard the changes you just "
64
  "made. No changes will be made to this site."
65
  msgstr ""
66
 
67
- #: php/admin-menus/class-edit-menu.php:309 php/class-list-table.php:332
68
  msgid "Description"
69
  msgstr ""
70
 
71
- #: php/admin-menus/class-edit-menu.php:342 php/class-list-table.php:333
72
  msgid "Tags"
73
  msgstr ""
74
 
75
- #: php/admin-menus/class-edit-menu.php:347
76
  msgid "Enter a list of tags; separated by commas"
77
  msgstr ""
78
 
79
- #: php/admin-menus/class-edit-menu.php:369
80
  msgid ""
81
  "Snippets with a lower priority number will run before those with a higher "
82
  "number."
83
  msgstr ""
84
 
85
- #: php/admin-menus/class-edit-menu.php:370 php/class-list-table.php:334
86
  msgid "Priority"
87
  msgstr ""
88
 
89
- #: php/admin-menus/class-edit-menu.php:387
90
  msgid "Run snippet everywhere"
91
  msgstr ""
92
 
93
- #: php/admin-menus/class-edit-menu.php:388
94
  msgid "Only run in administration area"
95
  msgstr ""
96
 
97
- #: php/admin-menus/class-edit-menu.php:389
98
  msgid "Only run on site front-end"
99
  msgstr ""
100
 
101
- #: php/admin-menus/class-edit-menu.php:390
102
  msgid "Only run once"
103
  msgstr ""
104
 
105
- #: php/admin-menus/class-edit-menu.php:393
106
  msgid "Scope"
107
  msgstr ""
108
 
109
- #: php/admin-menus/class-edit-menu.php:413
110
  msgid "Sharing Settings"
111
  msgstr ""
112
 
113
- #: php/admin-menus/class-edit-menu.php:417
114
  msgid "Allow this snippet to be activated on individual sites on the network"
115
  msgstr ""
116
 
117
- #: php/admin-menus/class-edit-menu.php:477
118
  #, php-format
119
  msgid "The snippet has been deactivated due to an error on line %d:"
120
  msgstr ""
121
 
122
- #: php/admin-menus/class-edit-menu.php:482
123
  msgid "The snippet has been deactivated due to an error in the code."
124
  msgstr ""
125
 
126
- #: php/admin-menus/class-edit-menu.php:489
127
  msgid "An error occurred when saving the snippet."
128
  msgstr ""
129
 
130
- #: php/admin-menus/class-edit-menu.php:494
131
  msgid "Snippet <strong>added</strong>."
132
  msgstr ""
133
 
134
- #: php/admin-menus/class-edit-menu.php:495
135
  msgid "Snippet <strong>updated</strong>."
136
  msgstr ""
137
 
138
- #: php/admin-menus/class-edit-menu.php:496
139
  msgid "Snippet <strong>added</strong> and <strong>activated</strong>."
140
  msgstr ""
141
 
142
- #: php/admin-menus/class-edit-menu.php:497
143
  msgid "Snippet <strong>added</strong> and <strong>executed</strong>."
144
  msgstr ""
145
 
146
- #: php/admin-menus/class-edit-menu.php:498
147
  msgid "Snippet <strong>updated</strong> and <strong>activated</strong>."
148
  msgstr ""
149
 
150
- #: php/admin-menus/class-edit-menu.php:499
151
  msgid "Snippet <strong>updated</strong> and <strong>deactivated</strong>."
152
  msgstr ""
153
 
@@ -156,7 +156,7 @@ msgctxt "menu label"
156
  msgid "Import"
157
  msgstr ""
158
 
159
- #: php/admin-menus/class-import-menu.php:16 php/views/import.php:21
160
  msgid "Import Snippets"
161
  msgstr ""
162
 
@@ -176,14 +176,14 @@ msgstr ""
176
  msgid "No snippets were imported."
177
  msgstr ""
178
 
179
- #: php/admin-menus/class-import-menu.php:131
180
  #, php-format
181
  msgid ""
182
- "Successfully imported <strong>%d</strong> snippet. <a href=\"%s\">Have fun!</"
183
- "a>"
184
  msgid_plural ""
185
- "Successfully imported <strong>%d</strong> snippets. <a href=\"%s\">Have fun!"
186
- "</a>"
187
  msgstr[0] ""
188
  msgstr[1] ""
189
 
@@ -194,7 +194,7 @@ msgstr ""
194
 
195
  #: php/admin-menus/class-manage-menu.php:23
196
  #: php/admin-menus/class-manage-menu.php:46 php/class-admin.php:61
197
- #: php/class-admin.php:150 php/views/manage.php:21
198
  msgid "Snippets"
199
  msgstr ""
200
 
@@ -268,7 +268,7 @@ msgstr ""
268
  msgid "Reset to Default"
269
  msgstr ""
270
 
271
- #: php/admin-menus/class-settings-menu.php:103 php/settings/settings.php:204
272
  msgid "Settings saved."
273
  msgstr ""
274
 
@@ -276,46 +276,46 @@ msgstr ""
276
  msgid "Snippets &raquo; Settings"
277
  msgstr ""
278
 
279
- #: php/class-admin.php:149
280
  msgid "Manage your existing snippets"
281
  msgstr ""
282
 
283
- #: php/class-admin.php:180
284
  msgid "Visit the WordPress.org plugin page"
285
  msgstr ""
286
 
287
- #: php/class-admin.php:181
288
  msgid "About"
289
  msgstr ""
290
 
291
- #: php/class-admin.php:185
292
  msgid "Visit the support forums"
293
  msgstr ""
294
 
295
- #: php/class-admin.php:186
296
  msgid "Support"
297
  msgstr ""
298
 
299
- #: php/class-admin.php:190
300
  msgid "Support this plugin's development"
301
  msgstr ""
302
 
303
- #: php/class-admin.php:191
304
  msgid "Donate"
305
  msgstr ""
306
 
307
- #: php/class-admin.php:222
308
  msgid ""
309
  "<strong>Have feedback on Code Snippets?</strong> Please take the time to "
310
  "answer a short survey on how you use this plugin and what you'd like to see "
311
  "changed or added in the future."
312
  msgstr ""
313
 
314
- #: php/class-admin.php:226
315
  msgid "Take the survey now"
316
  msgstr ""
317
 
318
- #: php/class-admin.php:229
319
  msgid "Dismiss"
320
  msgstr ""
321
 
@@ -339,8 +339,8 @@ msgstr ""
339
  msgid "Plugin Website"
340
  msgstr ""
341
 
342
- #: php/class-contextual-help.php:55 php/class-contextual-help.php:81
343
- #: php/class-contextual-help.php:121
344
  msgid "Overview"
345
  msgstr ""
346
 
@@ -357,14 +357,14 @@ msgstr ""
357
  msgid "Safe Mode"
358
  msgstr ""
359
 
360
- #: php/class-contextual-help.php:62
361
  msgid ""
362
  "Be sure to check your snippets for errors before you activate them, as a "
363
  "faulty snippet could bring your whole blog down. If your site starts doing "
364
  "strange things, deactivate all your snippets and activate them one at a time."
365
  msgstr ""
366
 
367
- #: php/class-contextual-help.php:63
368
  msgid ""
369
  "If something goes wrong with a snippet and you can't use WordPress, you can "
370
  "cause all snippets to stop executing by adding "
@@ -374,11 +374,11 @@ msgid ""
374
  "strong> with <strong>false</strong>."
375
  msgstr ""
376
 
377
- #: php/class-contextual-help.php:68
378
  msgid "Uninstall"
379
  msgstr ""
380
 
381
- #: php/class-contextual-help.php:69
382
  #, php-format
383
  msgid ""
384
  "When you delete Code Snippets through the Plugins menu in WordPress it will "
@@ -388,14 +388,14 @@ msgid ""
388
  "FTP."
389
  msgstr ""
390
 
391
- #: php/class-contextual-help.php:70
392
  msgid ""
393
  "Even if you're sure that you don't want to use Code Snippets ever again on "
394
  "this WordPress installation, you may want to use the export feature to back "
395
  "up your snippets."
396
  msgstr ""
397
 
398
- #: php/class-contextual-help.php:82
399
  msgid ""
400
  "Snippets are similar to plugins - they both extend and expand the "
401
  "functionality of WordPress. Snippets are more light-weight, just a few lines "
@@ -403,67 +403,67 @@ msgid ""
403
  "snippet, or edit an existing one."
404
  msgstr ""
405
 
406
- #: php/class-contextual-help.php:86
407
  msgid "WP-Snippets"
408
  msgstr ""
409
 
410
- #: php/class-contextual-help.php:86
411
  msgid "http://wp-snippets.com"
412
  msgstr ""
413
 
414
- #: php/class-contextual-help.php:87
415
  msgid "WP Snipp"
416
  msgstr ""
417
 
418
- #: php/class-contextual-help.php:87
419
  msgid "http://wpsnipp.com"
420
  msgstr ""
421
 
422
- #: php/class-contextual-help.php:88
423
  msgid "Cats Who Code"
424
  msgstr ""
425
 
426
- #: php/class-contextual-help.php:88
427
  msgid "http://www.catswhocode.com/blog/snippets"
428
  msgstr ""
429
 
430
- #: php/class-contextual-help.php:89
431
  msgid "WP Function Me"
432
  msgstr ""
433
 
434
- #: php/class-contextual-help.php:89
435
  msgid "http://www.wpfunction.me"
436
  msgstr ""
437
 
438
- #: php/class-contextual-help.php:99
439
  msgid "Finding Snippets"
440
  msgstr ""
441
 
442
- #: php/class-contextual-help.php:100
443
  msgid ""
444
  "Here are some links to websites which host a large number of snippets that "
445
  "you can add to your site:"
446
  msgstr ""
447
 
448
- #: php/class-contextual-help.php:102
449
  msgid ""
450
  "More places to find snippets, as well as a selection of example snippets, "
451
  "can be found in the <a href=\"https://github.com/sheabunge/code-snippets/"
452
  "wiki/Finding-snippets\">plugin documentation</a>."
453
  msgstr ""
454
 
455
- #: php/class-contextual-help.php:107
456
  msgid "Adding Snippets"
457
  msgstr ""
458
 
459
- #: php/class-contextual-help.php:108
460
  msgid ""
461
  "You need to fill out the name and code fields for your snippet to be added. "
462
  "While the description field will add more information about how your snippet "
463
  "works, what is does and where you found it, it is completely optional."
464
  msgstr ""
465
 
466
- #: php/class-contextual-help.php:109
467
  msgid ""
468
  "Please be sure to check that your snippet is valid PHP code and will not "
469
  "produce errors before adding it through this page. While doing so will not "
@@ -471,7 +471,7 @@ msgid ""
471
  "snippet becoming active on your site."
472
  msgstr ""
473
 
474
- #: php/class-contextual-help.php:122
475
  msgid ""
476
  "Snippets are similar to plugins - they both extend and expand the "
477
  "functionality of WordPress. Snippets are more light-weight, just a few lines "
@@ -480,17 +480,17 @@ msgid ""
480
  "existing snippets."
481
  msgstr ""
482
 
483
- #: php/class-contextual-help.php:127
484
  msgid "Importing"
485
  msgstr ""
486
 
487
- #: php/class-contextual-help.php:128
488
  msgid ""
489
  "You can load your snippets from a code snippets (.xml) export file using "
490
  "this page."
491
  msgstr ""
492
 
493
- #: php/class-contextual-help.php:129
494
  #, php-format
495
  msgid ""
496
  "Snippets will be added to the database along with your existing snippets. "
@@ -499,203 +499,203 @@ msgid ""
499
  "\">All Snippets</a> page.</p>"
500
  msgstr ""
501
 
502
- #: php/class-contextual-help.php:134
503
  msgid "Exporting"
504
  msgstr ""
505
 
506
- #: php/class-contextual-help.php:135
507
  #, php-format
508
  msgid ""
509
  "You can save your snippets to a Code Snippets (.xml) export file using the "
510
  "<a href=\"%s\">Manage Snippets</a> page."
511
  msgstr ""
512
 
513
- #: php/class-db.php:168
514
- msgid "Example HTML shortcode"
515
- msgstr ""
516
-
517
- #: php/class-db.php:171
518
- msgid "write your HTML shortcode content here"
519
- msgstr ""
520
-
521
- #: php/class-db.php:173
522
- msgid ""
523
- "This is an example snippet for demonstrating how to add an HTML shortcode."
524
- msgstr ""
525
-
526
- #: php/class-db.php:178
527
- msgid "Example CSS snippet"
528
- msgstr ""
529
-
530
- #: php/class-db.php:181
531
- msgid "write your CSS code here"
532
- msgstr ""
533
-
534
- #: php/class-db.php:183
535
- msgid ""
536
- "This is an example snippet for demonstrating how to add custom CSS code to "
537
- "your website."
538
- msgstr ""
539
-
540
- #: php/class-db.php:189
541
- msgid "Example JavaScript snippet"
542
- msgstr ""
543
-
544
- #: php/class-db.php:192
545
- msgid "write your JavaScript code here"
546
- msgstr ""
547
-
548
- #: php/class-db.php:194
549
- msgid ""
550
- "This is an example snippet for demonstrating how to add custom JavaScript "
551
- "code to your website."
552
- msgstr ""
553
-
554
- #: php/class-db.php:202
555
- msgid "You can remove it, or edit it to add your own content."
556
- msgstr ""
557
-
558
  #: php/class-list-table.php:58
559
  msgid "Snippets per page"
560
  msgstr ""
561
 
562
- #: php/class-list-table.php:147
563
  msgid "Network Active"
564
  msgstr ""
565
 
566
- #: php/class-list-table.php:149
567
  msgid "Network Only"
568
  msgstr ""
569
 
570
- #: php/class-list-table.php:155
571
  msgid "Edit"
572
  msgstr ""
573
 
574
- #: php/class-list-table.php:156 php/class-list-table.php:373
575
  msgid "Clone"
576
  msgstr ""
577
 
578
- #: php/class-list-table.php:157 php/class-list-table.php:375
579
- #: php/views/edit.php:130
580
  msgid "Export"
581
  msgstr ""
582
 
583
- #: php/class-list-table.php:166 php/class-list-table.php:376
584
- #: php/views/edit.php:143
585
  msgid "Delete"
586
  msgstr ""
587
 
588
- #: php/class-list-table.php:170
589
  msgid "You are about to permanently delete the selected item."
590
  msgstr ""
591
 
592
- #: php/class-list-table.php:171 php/views/edit.php:138
593
  msgid "'Cancel' to stop, 'OK' to delete."
594
  msgstr ""
595
 
596
- #: php/class-list-table.php:230
597
  #, php-format
598
  msgid "Untitled #%d"
599
  msgstr ""
600
 
601
- #: php/class-list-table.php:254
602
  msgid "Shared on Network"
603
  msgstr ""
604
 
605
- #: php/class-list-table.php:330 php/views/edit.php:54
606
  msgid "Name"
607
  msgstr ""
608
 
609
- #: php/class-list-table.php:331
610
  msgid "ID"
611
  msgstr ""
612
 
613
- #: php/class-list-table.php:371
614
  msgid "Network Activate"
615
  msgstr ""
616
 
617
- #: php/class-list-table.php:371
618
  msgid "Activate"
619
  msgstr ""
620
 
621
- #: php/class-list-table.php:372
622
  msgid "Network Deactivate"
623
  msgstr ""
624
 
625
- #: php/class-list-table.php:372
626
  msgid "Deactivate"
627
  msgstr ""
628
 
629
- #: php/class-list-table.php:374 php/views/edit.php:125
630
  msgid "Download"
631
  msgstr ""
632
 
633
- #: php/class-list-table.php:416
634
  #, php-format
635
  msgid "All <span class=\"count\">(%s)</span>"
636
  msgid_plural "All <span class=\"count\">(%s)</span>"
637
  msgstr[0] ""
638
  msgstr[1] ""
639
 
640
- #: php/class-list-table.php:417
641
  #, php-format
642
  msgid "Active <span class=\"count\">(%s)</span>"
643
  msgid_plural "Active <span class=\"count\">(%s)</span>"
644
  msgstr[0] ""
645
  msgstr[1] ""
646
 
647
- #: php/class-list-table.php:418
648
  #, php-format
649
  msgid "Inactive <span class=\"count\">(%s)</span>"
650
  msgid_plural "Inactive <span class=\"count\">(%s)</span>"
651
  msgstr[0] ""
652
  msgstr[1] ""
653
 
654
- #: php/class-list-table.php:419
655
  #, php-format
656
  msgid "Recently Active <span class=\"count\">(%s)</span>"
657
  msgid_plural "Recently Active <span class=\"count\">(%s)</span>"
658
  msgstr[0] ""
659
  msgstr[1] ""
660
 
661
- #: php/class-list-table.php:488
662
  msgid "Show all tags"
663
  msgstr ""
664
 
665
- #: php/class-list-table.php:502
666
  msgid "Filter"
667
  msgstr ""
668
 
669
- #: php/class-list-table.php:510
670
  msgid "Clear List"
671
  msgstr ""
672
 
673
- #: php/class-list-table.php:725
674
  msgid "It looks like you don't have any snippets."
675
  msgstr ""
676
 
677
- #: php/class-list-table.php:729
678
  msgid "Perhaps you would like to add a new one?"
679
  msgstr ""
680
 
681
- #: php/class-list-table.php:1025
682
  msgid "Search results"
683
  msgstr ""
684
 
685
- #: php/class-list-table.php:1028
686
  #, php-format
687
- msgid " for &#8220;%s&#8221;"
688
  msgstr ""
689
 
690
- #: php/class-list-table.php:1032
691
  #, php-format
692
- msgid " in tag &#8220;%s&#8221;"
693
  msgstr ""
694
 
695
- #: php/class-list-table.php:1040
696
  msgid "Clear Filters"
697
  msgstr ""
698
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
699
  #: php/settings/settings-fields.php:42
700
  msgid "Activate by Default"
701
  msgstr ""
@@ -743,207 +743,201 @@ msgstr ""
743
  msgid "Complete Uninstall"
744
  msgstr ""
745
 
746
- #: php/settings/settings-fields.php:80
747
  #, php-format
748
  msgid ""
749
  "When the plugin is deleted from the <a href=\"%s\">Plugins</a> menu, also "
750
  "delete all snippets and plugin settings."
751
  msgstr ""
752
 
753
- #: php/settings/settings-fields.php:95
754
  msgid "Row Height"
755
  msgstr ""
756
 
757
- #: php/settings/settings-fields.php:97
758
  msgid "rows"
759
  msgstr ""
760
 
761
- #: php/settings/settings-fields.php:103
762
  msgid "Use Full Editor"
763
  msgstr ""
764
 
765
- #: php/settings/settings-fields.php:105
766
  msgid "Enable all features of the visual editor"
767
  msgstr ""
768
 
769
- #: php/settings/settings-fields.php:110
770
  msgid "Media Buttons"
771
  msgstr ""
772
 
773
- #: php/settings/settings-fields.php:112
774
  msgid "Enable the add media buttons"
775
  msgstr ""
776
 
777
- #: php/settings/settings-fields.php:121
778
  msgid "Theme"
779
  msgstr ""
780
 
781
- #: php/settings/settings-fields.php:128
782
  msgid "Indent With Tabs"
783
  msgstr ""
784
 
785
- #: php/settings/settings-fields.php:130
786
  msgid "Use hard tabs (not spaces) for indentation."
787
  msgstr ""
788
 
789
- #: php/settings/settings-fields.php:136
790
  msgid "Tab Size"
791
  msgstr ""
792
 
793
- #: php/settings/settings-fields.php:138
794
  msgid "The width of a tab character."
795
  msgstr ""
796
 
797
- #: php/settings/settings-fields.php:145
798
  msgid "Indent Unit"
799
  msgstr ""
800
 
801
- #: php/settings/settings-fields.php:147
802
  msgid "How many spaces a block should be indented."
803
  msgstr ""
804
 
805
- #: php/settings/settings-fields.php:154
806
  msgid "Wrap Lines"
807
  msgstr ""
808
 
809
- #: php/settings/settings-fields.php:156
810
  msgid "Whether the editor should scroll or wrap for long lines."
811
  msgstr ""
812
 
813
- #: php/settings/settings-fields.php:162
814
  msgid "Line Numbers"
815
  msgstr ""
816
 
817
- #: php/settings/settings-fields.php:164
818
  msgid "Show line numbers to the left of the editor."
819
  msgstr ""
820
 
821
- #: php/settings/settings-fields.php:170
822
  msgid "Auto Close Brackets"
823
  msgstr ""
824
 
825
- #: php/settings/settings-fields.php:172
826
  msgid "Auto-close brackets and quotes when typed."
827
  msgstr ""
828
 
829
- #: php/settings/settings-fields.php:178
830
  msgid "Highlight Selection Matches"
831
  msgstr ""
832
 
833
- #: php/settings/settings-fields.php:179
834
  msgid "Highlight all instances of a currently selected word."
835
  msgstr ""
836
 
837
- #: php/settings/settings.php:88
838
  msgid "General"
839
  msgstr ""
840
 
841
- #: php/settings/settings.php:89
842
  msgid "Description Editor"
843
  msgstr ""
844
 
845
- #: php/settings/settings.php:90
846
  msgid "Code Editor"
847
  msgstr ""
848
 
849
- #: php/settings/settings.php:147
850
  msgid "Editor Preview"
851
  msgstr ""
852
 
853
- #: php/views/edit.php:34 php/views/manage.php:24
854
  msgctxt "snippet"
855
  msgid "Add New"
856
  msgstr ""
857
 
858
- #: php/views/edit.php:55
859
  msgid "Enter title here"
860
  msgstr ""
861
 
862
- #: php/views/edit.php:60
863
  msgid "Code"
864
  msgstr ""
865
 
866
- #: php/views/edit.php:85
867
  msgid "Save Changes and Execute Once"
868
  msgstr ""
869
 
870
- #: php/views/edit.php:94 php/views/edit.php:108
871
  msgid "Save Changes and Activate"
872
  msgstr ""
873
 
874
- #: php/views/edit.php:114
875
  msgid "Save Changes and Deactivate"
876
  msgstr ""
877
 
878
- #: php/views/edit.php:137
879
  msgid "You are about to permanently delete this snippet."
880
  msgstr ""
881
 
882
- #: php/views/import.php:25
883
  msgid ""
884
  "Upload one or more Code Snippets export files and the snippets will be "
885
  "imported."
886
  msgstr ""
887
 
888
- #: php/views/import.php:29
889
  #, php-format
890
  msgid ""
891
  "Afterwards, you will need to visit the <a href=\"%s\">All Snippets</a> page "
892
  "to activate the imported snippets."
893
  msgstr ""
894
 
895
- #: php/views/import.php:36
896
- msgid ""
897
- "Before you can upload your import file, you will need to fix the following "
898
- "error:"
899
- msgstr ""
900
-
901
- #: php/views/import.php:46
902
  msgid "Duplicate Snippets"
903
  msgstr ""
904
 
905
- #: php/views/import.php:49
906
  msgid ""
907
  "What should happen if an existing snippet is found with an identical name to "
908
  "an imported snippet?"
909
  msgstr ""
910
 
911
- #: php/views/import.php:56
912
  msgid ""
913
  "Ignore any duplicate snippets: import all snippets from the file regardless "
914
  "and leave all existing snippets unchanged."
915
  msgstr ""
916
 
917
- #: php/views/import.php:63
918
  msgid ""
919
  "Replace any existing snippets with a newly imported snippet of the same name."
920
  msgstr ""
921
 
922
- #: php/views/import.php:70
923
  msgid ""
924
  "Do not import any duplicate snippets; leave all existing snippets unchanged."
925
  msgstr ""
926
 
927
- #: php/views/import.php:75
928
  msgid "Upload Files"
929
  msgstr ""
930
 
931
- #: php/views/import.php:78
932
  msgid ""
933
  "Choose one or more Code Snippets (.xml or .json) files to upload, then click "
934
  "\"Upload files and import\"."
935
  msgstr ""
936
 
937
- #: php/views/import.php:83
938
  msgid "Choose files from your computer:"
939
  msgstr ""
940
 
941
- #: php/views/import.php:84
942
  #, php-format
943
  msgid "(Maximum size: %s)"
944
  msgstr ""
945
 
946
- #: php/views/import.php:93
947
  msgid "Upload files and import"
948
  msgstr ""
949
 
6
  #, fuzzy
7
  msgid ""
8
  msgstr ""
9
+ "Project-Id-Version: code-snippets 2.12.1\n"
10
  "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2018-11-15 23:41+1100\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
18
  "Content-Transfer-Encoding: 8bit\n"
19
  "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
20
 
21
+ #: php/admin-menus/class-admin-menu.php:105
22
  msgid "You are not authorized to access this page."
23
  msgstr ""
24
 
25
  #: php/admin-menus/class-edit-menu.php:13
26
+ #: php/admin-menus/class-edit-menu.php:14 php/views/edit.php:32
27
  msgid "Edit Snippet"
28
  msgstr ""
29
 
32
  msgid "Add New"
33
  msgstr ""
34
 
35
+ #: php/admin-menus/class-edit-menu.php:40 php/views/edit.php:38
36
  msgid "Add New Snippet"
37
  msgstr ""
38
 
39
+ #: php/admin-menus/class-edit-menu.php:165
40
  msgid "Don't Panic"
41
  msgstr ""
42
 
43
+ #: php/admin-menus/class-edit-menu.php:167
44
  #, php-format
45
  msgid ""
46
  "The code snippet you are trying to save produced a fatal error on line %d:"
47
  msgstr ""
48
 
49
+ #: php/admin-menus/class-edit-menu.php:169
50
  msgid ""
51
  "The previous version of the snippet is unchanged, and the rest of this site "
52
  "should be functioning normally as before."
53
  msgstr ""
54
 
55
+ #: php/admin-menus/class-edit-menu.php:170
56
  msgid ""
57
  "Please use the back button in your browser to return to the previous page "
58
  "and try to fix the code error."
59
  msgstr ""
60
 
61
+ #: php/admin-menus/class-edit-menu.php:171
62
  msgid ""
63
  "If you prefer, you can close this page and discard the changes you just "
64
  "made. No changes will be made to this site."
65
  msgstr ""
66
 
67
+ #: php/admin-menus/class-edit-menu.php:311 php/class-list-table.php:337
68
  msgid "Description"
69
  msgstr ""
70
 
71
+ #: php/admin-menus/class-edit-menu.php:344 php/class-list-table.php:338
72
  msgid "Tags"
73
  msgstr ""
74
 
75
+ #: php/admin-menus/class-edit-menu.php:349
76
  msgid "Enter a list of tags; separated by commas"
77
  msgstr ""
78
 
79
+ #: php/admin-menus/class-edit-menu.php:371
80
  msgid ""
81
  "Snippets with a lower priority number will run before those with a higher "
82
  "number."
83
  msgstr ""
84
 
85
+ #: php/admin-menus/class-edit-menu.php:372 php/class-list-table.php:339
86
  msgid "Priority"
87
  msgstr ""
88
 
89
+ #: php/admin-menus/class-edit-menu.php:389
90
  msgid "Run snippet everywhere"
91
  msgstr ""
92
 
93
+ #: php/admin-menus/class-edit-menu.php:390
94
  msgid "Only run in administration area"
95
  msgstr ""
96
 
97
+ #: php/admin-menus/class-edit-menu.php:391
98
  msgid "Only run on site front-end"
99
  msgstr ""
100
 
101
+ #: php/admin-menus/class-edit-menu.php:392
102
  msgid "Only run once"
103
  msgstr ""
104
 
105
+ #: php/admin-menus/class-edit-menu.php:395
106
  msgid "Scope"
107
  msgstr ""
108
 
109
+ #: php/admin-menus/class-edit-menu.php:416
110
  msgid "Sharing Settings"
111
  msgstr ""
112
 
113
+ #: php/admin-menus/class-edit-menu.php:420
114
  msgid "Allow this snippet to be activated on individual sites on the network"
115
  msgstr ""
116
 
117
+ #: php/admin-menus/class-edit-menu.php:481
118
  #, php-format
119
  msgid "The snippet has been deactivated due to an error on line %d:"
120
  msgstr ""
121
 
122
+ #: php/admin-menus/class-edit-menu.php:486
123
  msgid "The snippet has been deactivated due to an error in the code."
124
  msgstr ""
125
 
126
+ #: php/admin-menus/class-edit-menu.php:493
127
  msgid "An error occurred when saving the snippet."
128
  msgstr ""
129
 
130
+ #: php/admin-menus/class-edit-menu.php:499
131
  msgid "Snippet <strong>added</strong>."
132
  msgstr ""
133
 
134
+ #: php/admin-menus/class-edit-menu.php:500
135
  msgid "Snippet <strong>updated</strong>."
136
  msgstr ""
137
 
138
+ #: php/admin-menus/class-edit-menu.php:501
139
  msgid "Snippet <strong>added</strong> and <strong>activated</strong>."
140
  msgstr ""
141
 
142
+ #: php/admin-menus/class-edit-menu.php:502
143
  msgid "Snippet <strong>added</strong> and <strong>executed</strong>."
144
  msgstr ""
145
 
146
+ #: php/admin-menus/class-edit-menu.php:503
147
  msgid "Snippet <strong>updated</strong> and <strong>activated</strong>."
148
  msgstr ""
149
 
150
+ #: php/admin-menus/class-edit-menu.php:504
151
  msgid "Snippet <strong>updated</strong> and <strong>deactivated</strong>."
152
  msgstr ""
153
 
156
  msgid "Import"
157
  msgstr ""
158
 
159
+ #: php/admin-menus/class-import-menu.php:16 php/views/import.php:19
160
  msgid "Import Snippets"
161
  msgstr ""
162
 
176
  msgid "No snippets were imported."
177
  msgstr ""
178
 
179
+ #: php/admin-menus/class-import-menu.php:132
180
  #, php-format
181
  msgid ""
182
+ "Successfully imported <strong>%1$d</strong> snippet. <a href=\"%2$s\">Have "
183
+ "fun!</a>"
184
  msgid_plural ""
185
+ "Successfully imported <strong>%1$d</strong> snippets. <a href=\"%2$s\">Have "
186
+ "fun!</a>"
187
  msgstr[0] ""
188
  msgstr[1] ""
189
 
194
 
195
  #: php/admin-menus/class-manage-menu.php:23
196
  #: php/admin-menus/class-manage-menu.php:46 php/class-admin.php:61
197
+ #: php/class-admin.php:153 php/views/manage.php:21
198
  msgid "Snippets"
199
  msgstr ""
200
 
268
  msgid "Reset to Default"
269
  msgstr ""
270
 
271
+ #: php/admin-menus/class-settings-menu.php:103 php/settings/settings.php:209
272
  msgid "Settings saved."
273
  msgstr ""
274
 
276
  msgid "Snippets &raquo; Settings"
277
  msgstr ""
278
 
279
+ #: php/class-admin.php:152
280
  msgid "Manage your existing snippets"
281
  msgstr ""
282
 
283
+ #: php/class-admin.php:183
284
  msgid "Visit the WordPress.org plugin page"
285
  msgstr ""
286
 
287
+ #: php/class-admin.php:184
288
  msgid "About"
289
  msgstr ""
290
 
291
+ #: php/class-admin.php:188
292
  msgid "Visit the support forums"
293
  msgstr ""
294
 
295
+ #: php/class-admin.php:189
296
  msgid "Support"
297
  msgstr ""
298
 
299
+ #: php/class-admin.php:193
300
  msgid "Support this plugin's development"
301
  msgstr ""
302
 
303
+ #: php/class-admin.php:194
304
  msgid "Donate"
305
  msgstr ""
306
 
307
+ #: php/class-admin.php:226
308
  msgid ""
309
  "<strong>Have feedback on Code Snippets?</strong> Please take the time to "
310
  "answer a short survey on how you use this plugin and what you'd like to see "
311
  "changed or added in the future."
312
  msgstr ""
313
 
314
+ #: php/class-admin.php:230
315
  msgid "Take the survey now"
316
  msgstr ""
317
 
318
+ #: php/class-admin.php:233
319
  msgid "Dismiss"
320
  msgstr ""
321
 
339
  msgid "Plugin Website"
340
  msgstr ""
341
 
342
+ #: php/class-contextual-help.php:55 php/class-contextual-help.php:84
343
+ #: php/class-contextual-help.php:126
344
  msgid "Overview"
345
  msgstr ""
346
 
357
  msgid "Safe Mode"
358
  msgstr ""
359
 
360
+ #: php/class-contextual-help.php:63
361
  msgid ""
362
  "Be sure to check your snippets for errors before you activate them, as a "
363
  "faulty snippet could bring your whole blog down. If your site starts doing "
364
  "strange things, deactivate all your snippets and activate them one at a time."
365
  msgstr ""
366
 
367
+ #: php/class-contextual-help.php:64
368
  msgid ""
369
  "If something goes wrong with a snippet and you can't use WordPress, you can "
370
  "cause all snippets to stop executing by adding "
374
  "strong> with <strong>false</strong>."
375
  msgstr ""
376
 
377
+ #: php/class-contextual-help.php:69
378
  msgid "Uninstall"
379
  msgstr ""
380
 
381
+ #: php/class-contextual-help.php:72
382
  #, php-format
383
  msgid ""
384
  "When you delete Code Snippets through the Plugins menu in WordPress it will "
388
  "FTP."
389
  msgstr ""
390
 
391
+ #: php/class-contextual-help.php:73
392
  msgid ""
393
  "Even if you're sure that you don't want to use Code Snippets ever again on "
394
  "this WordPress installation, you may want to use the export feature to back "
395
  "up your snippets."
396
  msgstr ""
397
 
398
+ #: php/class-contextual-help.php:85
399
  msgid ""
400
  "Snippets are similar to plugins - they both extend and expand the "
401
  "functionality of WordPress. Snippets are more light-weight, just a few lines "
403
  "snippet, or edit an existing one."
404
  msgstr ""
405
 
406
+ #: php/class-contextual-help.php:89
407
  msgid "WP-Snippets"
408
  msgstr ""
409
 
410
+ #: php/class-contextual-help.php:89
411
  msgid "http://wp-snippets.com"
412
  msgstr ""
413
 
414
+ #: php/class-contextual-help.php:90
415
  msgid "WP Snipp"
416
  msgstr ""
417
 
418
+ #: php/class-contextual-help.php:90
419
  msgid "http://wpsnipp.com"
420
  msgstr ""
421
 
422
+ #: php/class-contextual-help.php:91
423
  msgid "Cats Who Code"
424
  msgstr ""
425
 
426
+ #: php/class-contextual-help.php:91
427
  msgid "http://www.catswhocode.com/blog/snippets"
428
  msgstr ""
429
 
430
+ #: php/class-contextual-help.php:92
431
  msgid "WP Function Me"
432
  msgstr ""
433
 
434
+ #: php/class-contextual-help.php:92
435
  msgid "http://www.wpfunction.me"
436
  msgstr ""
437
 
438
+ #: php/class-contextual-help.php:102
439
  msgid "Finding Snippets"
440
  msgstr ""
441
 
442
+ #: php/class-contextual-help.php:104
443
  msgid ""
444
  "Here are some links to websites which host a large number of snippets that "
445
  "you can add to your site:"
446
  msgstr ""
447
 
448
+ #: php/class-contextual-help.php:106
449
  msgid ""
450
  "More places to find snippets, as well as a selection of example snippets, "
451
  "can be found in the <a href=\"https://github.com/sheabunge/code-snippets/"
452
  "wiki/Finding-snippets\">plugin documentation</a>."
453
  msgstr ""
454
 
455
+ #: php/class-contextual-help.php:111
456
  msgid "Adding Snippets"
457
  msgstr ""
458
 
459
+ #: php/class-contextual-help.php:113
460
  msgid ""
461
  "You need to fill out the name and code fields for your snippet to be added. "
462
  "While the description field will add more information about how your snippet "
463
  "works, what is does and where you found it, it is completely optional."
464
  msgstr ""
465
 
466
+ #: php/class-contextual-help.php:114
467
  msgid ""
468
  "Please be sure to check that your snippet is valid PHP code and will not "
469
  "produce errors before adding it through this page. While doing so will not "
471
  "snippet becoming active on your site."
472
  msgstr ""
473
 
474
+ #: php/class-contextual-help.php:127
475
  msgid ""
476
  "Snippets are similar to plugins - they both extend and expand the "
477
  "functionality of WordPress. Snippets are more light-weight, just a few lines "
480
  "existing snippets."
481
  msgstr ""
482
 
483
+ #: php/class-contextual-help.php:132
484
  msgid "Importing"
485
  msgstr ""
486
 
487
+ #: php/class-contextual-help.php:134
488
  msgid ""
489
  "You can load your snippets from a code snippets (.xml) export file using "
490
  "this page."
491
  msgstr ""
492
 
493
+ #: php/class-contextual-help.php:136
494
  #, php-format
495
  msgid ""
496
  "Snippets will be added to the database along with your existing snippets. "
499
  "\">All Snippets</a> page.</p>"
500
  msgstr ""
501
 
502
+ #: php/class-contextual-help.php:141
503
  msgid "Exporting"
504
  msgstr ""
505
 
506
+ #: php/class-contextual-help.php:143
507
  #, php-format
508
  msgid ""
509
  "You can save your snippets to a Code Snippets (.xml) export file using the "
510
  "<a href=\"%s\">Manage Snippets</a> page."
511
  msgstr ""
512
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
513
  #: php/class-list-table.php:58
514
  msgid "Snippets per page"
515
  msgstr ""
516
 
517
+ #: php/class-list-table.php:148
518
  msgid "Network Active"
519
  msgstr ""
520
 
521
+ #: php/class-list-table.php:150
522
  msgid "Network Only"
523
  msgstr ""
524
 
525
+ #: php/class-list-table.php:156
526
  msgid "Edit"
527
  msgstr ""
528
 
529
+ #: php/class-list-table.php:157 php/class-list-table.php:378
530
  msgid "Clone"
531
  msgstr ""
532
 
533
+ #: php/class-list-table.php:158 php/class-list-table.php:380
534
+ #: php/views/edit.php:133
535
  msgid "Export"
536
  msgstr ""
537
 
538
+ #: php/class-list-table.php:167 php/class-list-table.php:381
539
+ #: php/views/edit.php:146
540
  msgid "Delete"
541
  msgstr ""
542
 
543
+ #: php/class-list-table.php:171
544
  msgid "You are about to permanently delete the selected item."
545
  msgstr ""
546
 
547
+ #: php/class-list-table.php:172 php/views/edit.php:141
548
  msgid "'Cancel' to stop, 'OK' to delete."
549
  msgstr ""
550
 
551
+ #: php/class-list-table.php:234
552
  #, php-format
553
  msgid "Untitled #%d"
554
  msgstr ""
555
 
556
+ #: php/class-list-table.php:258
557
  msgid "Shared on Network"
558
  msgstr ""
559
 
560
+ #: php/class-list-table.php:335 php/views/edit.php:55
561
  msgid "Name"
562
  msgstr ""
563
 
564
+ #: php/class-list-table.php:336
565
  msgid "ID"
566
  msgstr ""
567
 
568
+ #: php/class-list-table.php:376
569
  msgid "Network Activate"
570
  msgstr ""
571
 
572
+ #: php/class-list-table.php:376
573
  msgid "Activate"
574
  msgstr ""
575
 
576
+ #: php/class-list-table.php:377
577
  msgid "Network Deactivate"
578
  msgstr ""
579
 
580
+ #: php/class-list-table.php:377
581
  msgid "Deactivate"
582
  msgstr ""
583
 
584
+ #: php/class-list-table.php:379 php/views/edit.php:128
585
  msgid "Download"
586
  msgstr ""
587
 
588
+ #: php/class-list-table.php:423
589
  #, php-format
590
  msgid "All <span class=\"count\">(%s)</span>"
591
  msgid_plural "All <span class=\"count\">(%s)</span>"
592
  msgstr[0] ""
593
  msgstr[1] ""
594
 
595
+ #: php/class-list-table.php:426
596
  #, php-format
597
  msgid "Active <span class=\"count\">(%s)</span>"
598
  msgid_plural "Active <span class=\"count\">(%s)</span>"
599
  msgstr[0] ""
600
  msgstr[1] ""
601
 
602
+ #: php/class-list-table.php:429
603
  #, php-format
604
  msgid "Inactive <span class=\"count\">(%s)</span>"
605
  msgid_plural "Inactive <span class=\"count\">(%s)</span>"
606
  msgstr[0] ""
607
  msgstr[1] ""
608
 
609
+ #: php/class-list-table.php:432
610
  #, php-format
611
  msgid "Recently Active <span class=\"count\">(%s)</span>"
612
  msgid_plural "Recently Active <span class=\"count\">(%s)</span>"
613
  msgstr[0] ""
614
  msgstr[1] ""
615
 
616
+ #: php/class-list-table.php:501
617
  msgid "Show all tags"
618
  msgstr ""
619
 
620
+ #: php/class-list-table.php:515
621
  msgid "Filter"
622
  msgstr ""
623
 
624
+ #: php/class-list-table.php:523
625
  msgid "Clear List"
626
  msgstr ""
627
 
628
+ #: php/class-list-table.php:738
629
  msgid "It looks like you don't have any snippets."
630
  msgstr ""
631
 
632
+ #: php/class-list-table.php:742
633
  msgid "Perhaps you would like to add a new one?"
634
  msgstr ""
635
 
636
+ #: php/class-list-table.php:1039
637
  msgid "Search results"
638
  msgstr ""
639
 
640
+ #: php/class-list-table.php:1043
641
  #, php-format
642
+ msgid " for &ldquo;%s&rdquo;"
643
  msgstr ""
644
 
645
+ #: php/class-list-table.php:1048
646
  #, php-format
647
+ msgid " in tag &ldquo;%s&rdquo;"
648
  msgstr ""
649
 
650
+ #: php/class-list-table.php:1057
651
  msgid "Clear Filters"
652
  msgstr ""
653
 
654
+ #: php/class-upgrade.php:146
655
+ msgid "Example HTML shortcode"
656
+ msgstr ""
657
+
658
+ #: php/class-upgrade.php:149
659
+ msgid "write your HTML shortcode content here"
660
+ msgstr ""
661
+
662
+ #: php/class-upgrade.php:151
663
+ msgid ""
664
+ "This is an example snippet for demonstrating how to add an HTML shortcode."
665
+ msgstr ""
666
+
667
+ #: php/class-upgrade.php:156
668
+ msgid "Example CSS snippet"
669
+ msgstr ""
670
+
671
+ #: php/class-upgrade.php:159
672
+ msgid "write your CSS code here"
673
+ msgstr ""
674
+
675
+ #: php/class-upgrade.php:161
676
+ msgid ""
677
+ "This is an example snippet for demonstrating how to add custom CSS code to "
678
+ "your website."
679
+ msgstr ""
680
+
681
+ #: php/class-upgrade.php:167
682
+ msgid "Example JavaScript snippet"
683
+ msgstr ""
684
+
685
+ #: php/class-upgrade.php:170
686
+ msgid "write your JavaScript code here"
687
+ msgstr ""
688
+
689
+ #: php/class-upgrade.php:172
690
+ msgid ""
691
+ "This is an example snippet for demonstrating how to add custom JavaScript "
692
+ "code to your website."
693
+ msgstr ""
694
+
695
+ #: php/class-upgrade.php:180
696
+ msgid "You can remove it, or edit it to add your own content."
697
+ msgstr ""
698
+
699
  #: php/settings/settings-fields.php:42
700
  msgid "Activate by Default"
701
  msgstr ""
743
  msgid "Complete Uninstall"
744
  msgstr ""
745
 
746
+ #: php/settings/settings-fields.php:81
747
  #, php-format
748
  msgid ""
749
  "When the plugin is deleted from the <a href=\"%s\">Plugins</a> menu, also "
750
  "delete all snippets and plugin settings."
751
  msgstr ""
752
 
753
+ #: php/settings/settings-fields.php:96
754
  msgid "Row Height"
755
  msgstr ""
756
 
757
+ #: php/settings/settings-fields.php:98
758
  msgid "rows"
759
  msgstr ""
760
 
761
+ #: php/settings/settings-fields.php:104
762
  msgid "Use Full Editor"
763
  msgstr ""
764
 
765
+ #: php/settings/settings-fields.php:106
766
  msgid "Enable all features of the visual editor"
767
  msgstr ""
768
 
769
+ #: php/settings/settings-fields.php:111
770
  msgid "Media Buttons"
771
  msgstr ""
772
 
773
+ #: php/settings/settings-fields.php:113
774
  msgid "Enable the add media buttons"
775
  msgstr ""
776
 
777
+ #: php/settings/settings-fields.php:122
778
  msgid "Theme"
779
  msgstr ""
780
 
781
+ #: php/settings/settings-fields.php:129
782
  msgid "Indent With Tabs"
783
  msgstr ""
784
 
785
+ #: php/settings/settings-fields.php:131
786
  msgid "Use hard tabs (not spaces) for indentation."
787
  msgstr ""
788
 
789
+ #: php/settings/settings-fields.php:137
790
  msgid "Tab Size"
791
  msgstr ""
792
 
793
+ #: php/settings/settings-fields.php:139
794
  msgid "The width of a tab character."
795
  msgstr ""
796
 
797
+ #: php/settings/settings-fields.php:146
798
  msgid "Indent Unit"
799
  msgstr ""
800
 
801
+ #: php/settings/settings-fields.php:148
802
  msgid "How many spaces a block should be indented."
803
  msgstr ""
804
 
805
+ #: php/settings/settings-fields.php:155
806
  msgid "Wrap Lines"
807
  msgstr ""
808
 
809
+ #: php/settings/settings-fields.php:157
810
  msgid "Whether the editor should scroll or wrap for long lines."
811
  msgstr ""
812
 
813
+ #: php/settings/settings-fields.php:163
814
  msgid "Line Numbers"
815
  msgstr ""
816
 
817
+ #: php/settings/settings-fields.php:165
818
  msgid "Show line numbers to the left of the editor."
819
  msgstr ""
820
 
821
+ #: php/settings/settings-fields.php:171
822
  msgid "Auto Close Brackets"
823
  msgstr ""
824
 
825
+ #: php/settings/settings-fields.php:173
826
  msgid "Auto-close brackets and quotes when typed."
827
  msgstr ""
828
 
829
+ #: php/settings/settings-fields.php:179
830
  msgid "Highlight Selection Matches"
831
  msgstr ""
832
 
833
+ #: php/settings/settings-fields.php:180
834
  msgid "Highlight all instances of a currently selected word."
835
  msgstr ""
836
 
837
+ #: php/settings/settings.php:92
838
  msgid "General"
839
  msgstr ""
840
 
841
+ #: php/settings/settings.php:93
842
  msgid "Description Editor"
843
  msgstr ""
844
 
845
+ #: php/settings/settings.php:94
846
  msgid "Code Editor"
847
  msgstr ""
848
 
849
+ #: php/settings/settings.php:151
850
  msgid "Editor Preview"
851
  msgstr ""
852
 
853
+ #: php/views/edit.php:35 php/views/manage.php:24
854
  msgctxt "snippet"
855
  msgid "Add New"
856
  msgstr ""
857
 
858
+ #: php/views/edit.php:56
859
  msgid "Enter title here"
860
  msgstr ""
861
 
862
+ #: php/views/edit.php:62
863
  msgid "Code"
864
  msgstr ""
865
 
866
+ #: php/views/edit.php:88
867
  msgid "Save Changes and Execute Once"
868
  msgstr ""
869
 
870
+ #: php/views/edit.php:97 php/views/edit.php:111
871
  msgid "Save Changes and Activate"
872
  msgstr ""
873
 
874
+ #: php/views/edit.php:117
875
  msgid "Save Changes and Deactivate"
876
  msgstr ""
877
 
878
+ #: php/views/edit.php:140
879
  msgid "You are about to permanently delete this snippet."
880
  msgstr ""
881
 
882
+ #: php/views/import.php:23
883
  msgid ""
884
  "Upload one or more Code Snippets export files and the snippets will be "
885
  "imported."
886
  msgstr ""
887
 
888
+ #: php/views/import.php:28
889
  #, php-format
890
  msgid ""
891
  "Afterwards, you will need to visit the <a href=\"%s\">All Snippets</a> page "
892
  "to activate the imported snippets."
893
  msgstr ""
894
 
895
+ #: php/views/import.php:35
 
 
 
 
 
 
896
  msgid "Duplicate Snippets"
897
  msgstr ""
898
 
899
+ #: php/views/import.php:38
900
  msgid ""
901
  "What should happen if an existing snippet is found with an identical name to "
902
  "an imported snippet?"
903
  msgstr ""
904
 
905
+ #: php/views/import.php:45
906
  msgid ""
907
  "Ignore any duplicate snippets: import all snippets from the file regardless "
908
  "and leave all existing snippets unchanged."
909
  msgstr ""
910
 
911
+ #: php/views/import.php:52
912
  msgid ""
913
  "Replace any existing snippets with a newly imported snippet of the same name."
914
  msgstr ""
915
 
916
+ #: php/views/import.php:59
917
  msgid ""
918
  "Do not import any duplicate snippets; leave all existing snippets unchanged."
919
  msgstr ""
920
 
921
+ #: php/views/import.php:64
922
  msgid "Upload Files"
923
  msgstr ""
924
 
925
+ #: php/views/import.php:67
926
  msgid ""
927
  "Choose one or more Code Snippets (.xml or .json) files to upload, then click "
928
  "\"Upload files and import\"."
929
  msgstr ""
930
 
931
+ #: php/views/import.php:72
932
  msgid "Choose files from your computer:"
933
  msgstr ""
934
 
935
+ #: php/views/import.php:75
936
  #, php-format
937
  msgid "(Maximum size: %s)"
938
  msgstr ""
939
 
940
+ #: php/views/import.php:86
941
  msgid "Upload files and import"
942
  msgstr ""
943
 
php/admin-menus/class-admin-menu.php CHANGED
@@ -9,7 +9,8 @@ class Code_Snippets_Admin_Menu {
9
 
10
  /**
11
  * Constructor
12
- * @param string $name The snippet page shortname
 
13
  * @param string $label The label shown in the admin menu
14
  * @param string $title The text used for the page title
15
  */
@@ -30,7 +31,8 @@ class Code_Snippets_Admin_Menu {
30
  /**
31
  * Add a sub-menu to the Snippets menu
32
  * @uses add_submenu_page() to register a submenu
33
- * @param string $slug The slug of the menu
 
34
  * @param string $label The label shown in the admin menu
35
  * @param string $title The page title
36
  */
@@ -104,6 +106,8 @@ class Code_Snippets_Admin_Menu {
104
  }
105
 
106
  /* Create the snippet tables if they don't exist */
107
- code_snippets()->db->create_tables();
 
 
108
  }
109
  }
9
 
10
  /**
11
  * Constructor
12
+ *
13
+ * @param string $name The snippet page shortname
14
  * @param string $label The label shown in the admin menu
15
  * @param string $title The text used for the page title
16
  */
31
  /**
32
  * Add a sub-menu to the Snippets menu
33
  * @uses add_submenu_page() to register a submenu
34
+ *
35
+ * @param string $slug The slug of the menu
36
  * @param string $label The label shown in the admin menu
37
  * @param string $title The page title
38
  */
106
  }
107
 
108
  /* Create the snippet tables if they don't exist */
109
+ $db = code_snippets()->db;
110
+ $db->create_missing_table( $db->ms_table );
111
+ $db->create_missing_table( $db->table );
112
  }
113
  }
php/admin-menus/class-edit-menu.php CHANGED
@@ -96,7 +96,7 @@ class Code_Snippets_Edit_Menu extends Code_Snippets_Admin_Menu {
96
  }
97
 
98
  if ( isset( $_POST['save_snippet'] ) || isset( $_POST['save_snippet_execute'] ) ||
99
- isset( $_POST['save_snippet_activate'] ) || isset( $_POST['save_snippet_deactivate'] ) ) {
100
  $this->save_posted_snippet();
101
  }
102
 
@@ -123,6 +123,7 @@ class Code_Snippets_Edit_Menu extends Code_Snippets_Admin_Menu {
123
 
124
  /**
125
  * Remove the sharing status from a network snippet
 
126
  * @param int $snippet_id
127
  */
128
  private function unshare_network_snippet( $snippet_id ) {
@@ -162,6 +163,7 @@ class Code_Snippets_Edit_Menu extends Code_Snippets_Admin_Menu {
162
  }
163
 
164
  $m = '<h3>' . __( "Don't Panic", 'code-snippets' ) . '</h3>';
 
165
  $m .= '<p>' . sprintf( __( 'The code snippet you are trying to save produced a fatal error on line %d:', 'code-snippets' ), $error['line'] ) . '</p>';
166
  $m .= '<strong>' . $error['message'] . '</strong>';
167
  $m .= '<p>' . __( 'The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before.', 'code-snippets' ) . '</p>';
@@ -323,17 +325,17 @@ class Code_Snippets_Edit_Menu extends Code_Snippets_Admin_Menu {
323
  apply_filters( 'code_snippets/admin/description_editor_settings', array(
324
  'textarea_name' => 'snippet_description',
325
  'textarea_rows' => $settings['rows'],
326
- 'teeny' => ! $settings['use_full_mce'],
327
  'media_buttons' => $settings['media_buttons'],
328
  ) )
329
  );
330
  }
331
 
332
  /**
333
- * Render the interface for editing snippet tags
334
- *
335
- * @param Code_Snippet $snippet the snippet currently being edited
336
- */
337
  function render_tags_editor( Code_Snippet $snippet ) {
338
 
339
  ?>
@@ -344,16 +346,16 @@ class Code_Snippets_Edit_Menu extends Code_Snippets_Admin_Menu {
344
  </h2>
345
 
346
  <input type="text" id="snippet_tags" name="snippet_tags" style="width: 100%;"
347
- placeholder="<?php esc_html_e( 'Enter a list of tags; separated by commas', 'code-snippets' ); ?>"
348
- value="<?php echo esc_attr( $snippet->tags_list ); ?>" />
349
 
350
  <script type="text/javascript">
351
- jQuery('#snippet_tags').tagit({
352
- availableTags: <?php echo wp_json_encode( get_all_snippet_tags() ); ?>,
353
- allowSpaces: true,
354
- removeConfirmation: true,
355
- showAutocompleteOnFocus: true,
356
- });
357
  </script>
358
  <?php
359
  }
@@ -384,9 +386,9 @@ class Code_Snippets_Edit_Menu extends Code_Snippets_Admin_Menu {
384
  $icons = Code_Snippet::get_scope_icons();
385
 
386
  $labels = array(
387
- 'global' => __( 'Run snippet everywhere', 'code-snippets' ),
388
- 'admin' => __( 'Only run in administration area', 'code-snippets' ),
389
- 'front-end' => __( 'Only run on site front-end', 'code-snippets' ),
390
  'single-use' => __( 'Only run once', 'code-snippets' ),
391
  );
392
 
@@ -395,7 +397,7 @@ class Code_Snippets_Edit_Menu extends Code_Snippets_Admin_Menu {
395
  foreach ( Code_Snippet::get_all_scopes() as $scope ) {
396
  printf( '<label><input type="radio" name="snippet_scope" value="%s"', $scope );
397
  checked( $scope, $snippet->scope );
398
- printf( '> <span class="dashicons dashicons-%s"></span> %s</label>', $icons[ $scope ], esc_html( $labels[ $scope ] ) );
399
  }
400
 
401
  echo '</p>';
@@ -403,6 +405,7 @@ class Code_Snippets_Edit_Menu extends Code_Snippets_Admin_Menu {
403
 
404
  /**
405
  * Render the setting for shared network snippets
 
406
  * @param object $snippet The snippet currently being edited
407
  */
408
  function render_multisite_sharing_setting( $snippet ) {
@@ -413,7 +416,7 @@ class Code_Snippets_Edit_Menu extends Code_Snippets_Admin_Menu {
413
  <h2 class="screen-reader-text"><?php _e( 'Sharing Settings', 'code-snippets' ); ?></h2>
414
  <label for="snippet_sharing">
415
  <input type="checkbox" name="snippet_sharing"
416
- <?php checked( in_array( $snippet->id, $shared_snippets ) ); ?>>
417
  <?php esc_html_e( 'Allow this snippet to be activated on individual sites on the network', 'code-snippets' ); ?>
418
  </label>
419
  </div>
@@ -474,6 +477,7 @@ class Code_Snippets_Edit_Menu extends Code_Snippets_Admin_Menu {
474
 
475
  printf(
476
  '<div id="message" class="error fade"><p>%s</p><p><strong>%s</strong></p></div>',
 
477
  sprintf( __( 'The snippet has been deactivated due to an error on line %d:', 'code-snippets' ), $error['line'] ),
478
  $error['message']
479
  );
@@ -487,15 +491,16 @@ class Code_Snippets_Edit_Menu extends Code_Snippets_Admin_Menu {
487
 
488
  if ( 'save-error' === $result ) {
489
  echo '<div id="message" class="error fade"><p>', __( 'An error occurred when saving the snippet.', 'code-snippets' ), '</p></div>';
 
490
  return;
491
  }
492
 
493
  $messages = array(
494
- 'added' => __( 'Snippet <strong>added</strong>.', 'code-snippets' ),
495
- 'updated' => __( 'Snippet <strong>updated</strong>.', 'code-snippets' ),
496
- 'added-and-activated' => __( 'Snippet <strong>added</strong> and <strong>activated</strong>.', 'code-snippets' ),
497
- 'updated-and-executed' => __( 'Snippet <strong>added</strong> and <strong>executed</strong>.', 'code-snippets' ),
498
- 'updated-and-activated' => __( 'Snippet <strong>updated</strong> and <strong>activated</strong>.', 'code-snippets' ),
499
  'updated-and-deactivated' => __( 'Snippet <strong>updated</strong> and <strong>deactivated</strong>.', 'code-snippets' ),
500
  );
501
 
96
  }
97
 
98
  if ( isset( $_POST['save_snippet'] ) || isset( $_POST['save_snippet_execute'] ) ||
99
+ isset( $_POST['save_snippet_activate'] ) || isset( $_POST['save_snippet_deactivate'] ) ) {
100
  $this->save_posted_snippet();
101
  }
102
 
123
 
124
  /**
125
  * Remove the sharing status from a network snippet
126
+ *
127
  * @param int $snippet_id
128
  */
129
  private function unshare_network_snippet( $snippet_id ) {
163
  }
164
 
165
  $m = '<h3>' . __( "Don't Panic", 'code-snippets' ) . '</h3>';
166
+ /* translators: %d: line where error was produced */
167
  $m .= '<p>' . sprintf( __( 'The code snippet you are trying to save produced a fatal error on line %d:', 'code-snippets' ), $error['line'] ) . '</p>';
168
  $m .= '<strong>' . $error['message'] . '</strong>';
169
  $m .= '<p>' . __( 'The previous version of the snippet is unchanged, and the rest of this site should be functioning normally as before.', 'code-snippets' ) . '</p>';
325
  apply_filters( 'code_snippets/admin/description_editor_settings', array(
326
  'textarea_name' => 'snippet_description',
327
  'textarea_rows' => $settings['rows'],
328
+ 'teeny' => ! $settings['use_full_mce'],
329
  'media_buttons' => $settings['media_buttons'],
330
  ) )
331
  );
332
  }
333
 
334
  /**
335
+ * Render the interface for editing snippet tags
336
+ *
337
+ * @param Code_Snippet $snippet the snippet currently being edited
338
+ */
339
  function render_tags_editor( Code_Snippet $snippet ) {
340
 
341
  ?>
346
  </h2>
347
 
348
  <input type="text" id="snippet_tags" name="snippet_tags" style="width: 100%;"
349
+ placeholder="<?php esc_html_e( 'Enter a list of tags; separated by commas', 'code-snippets' ); ?>"
350
+ value="<?php echo esc_attr( $snippet->tags_list ); ?>" />
351
 
352
  <script type="text/javascript">
353
+ jQuery('#snippet_tags').tagit({
354
+ availableTags: <?php echo wp_json_encode( get_all_snippet_tags() ); ?>,
355
+ allowSpaces: true,
356
+ removeConfirmation: true,
357
+ showAutocompleteOnFocus: true,
358
+ });
359
  </script>
360
  <?php
361
  }
386
  $icons = Code_Snippet::get_scope_icons();
387
 
388
  $labels = array(
389
+ 'global' => __( 'Run snippet everywhere', 'code-snippets' ),
390
+ 'admin' => __( 'Only run in administration area', 'code-snippets' ),
391
+ 'front-end' => __( 'Only run on site front-end', 'code-snippets' ),
392
  'single-use' => __( 'Only run once', 'code-snippets' ),
393
  );
394
 
397
  foreach ( Code_Snippet::get_all_scopes() as $scope ) {
398
  printf( '<label><input type="radio" name="snippet_scope" value="%s"', $scope );
399
  checked( $scope, $snippet->scope );
400
+ printf( '> <span class="dashicons dashicons-%s"></span> %s</label>', $icons[ $scope ], esc_html( $labels[ $scope ] ) );
401
  }
402
 
403
  echo '</p>';
405
 
406
  /**
407
  * Render the setting for shared network snippets
408
+ *
409
  * @param object $snippet The snippet currently being edited
410
  */
411
  function render_multisite_sharing_setting( $snippet ) {
416
  <h2 class="screen-reader-text"><?php _e( 'Sharing Settings', 'code-snippets' ); ?></h2>
417
  <label for="snippet_sharing">
418
  <input type="checkbox" name="snippet_sharing"
419
+ <?php checked( in_array( $snippet->id, $shared_snippets ) ); ?>>
420
  <?php esc_html_e( 'Allow this snippet to be activated on individual sites on the network', 'code-snippets' ); ?>
421
  </label>
422
  </div>
477
 
478
  printf(
479
  '<div id="message" class="error fade"><p>%s</p><p><strong>%s</strong></p></div>',
480
+ /* translators: %d: line of file where error originated */
481
  sprintf( __( 'The snippet has been deactivated due to an error on line %d:', 'code-snippets' ), $error['line'] ),
482
  $error['message']
483
  );
491
 
492
  if ( 'save-error' === $result ) {
493
  echo '<div id="message" class="error fade"><p>', __( 'An error occurred when saving the snippet.', 'code-snippets' ), '</p></div>';
494
+
495
  return;
496
  }
497
 
498
  $messages = array(
499
+ 'added' => __( 'Snippet <strong>added</strong>.', 'code-snippets' ),
500
+ 'updated' => __( 'Snippet <strong>updated</strong>.', 'code-snippets' ),
501
+ 'added-and-activated' => __( 'Snippet <strong>added</strong> and <strong>activated</strong>.', 'code-snippets' ),
502
+ 'updated-and-executed' => __( 'Snippet <strong>added</strong> and <strong>executed</strong>.', 'code-snippets' ),
503
+ 'updated-and-activated' => __( 'Snippet <strong>updated</strong> and <strong>activated</strong>.', 'code-snippets' ),
504
  'updated-and-deactivated' => __( 'Snippet <strong>updated</strong> and <strong>deactivated</strong>.', 'code-snippets' ),
505
  );
506
 
php/admin-menus/class-import-menu.php CHANGED
@@ -127,9 +127,10 @@ class Code_Snippets_Import_Menu extends Code_Snippets_Admin_Menu {
127
  } else {
128
 
129
  printf(
 
130
  _n(
131
- 'Successfully imported <strong>%d</strong> snippet. <a href="%s">Have fun!</a>',
132
- 'Successfully imported <strong>%d</strong> snippets. <a href="%s">Have fun!</a>',
133
  $imported, 'code-snippets'
134
  ),
135
  $imported,
127
  } else {
128
 
129
  printf(
130
+ /* translators: 1: amount of snippets imported, 2: link to Snippets menu */
131
  _n(
132
+ 'Successfully imported <strong>%1$d</strong> snippet. <a href="%2$s">Have fun!</a>',
133
+ 'Successfully imported <strong>%1$d</strong> snippets. <a href="%2$s">Have fun!</a>',
134
  $imported, 'code-snippets'
135
  ),
136
  $imported,
php/class-admin.php CHANGED
@@ -18,7 +18,7 @@ class Code_Snippets_Admin {
18
 
19
  public function load_classes() {
20
  $this->menus['manage'] = new Code_Snippets_Manage_Menu();
21
- $this->menus['edit'] = new Code_Snippets_Edit_Menu();
22
  $this->menus['import'] = new Code_Snippets_Import_Menu();
23
 
24
  if ( is_network_admin() === code_snippets_unified_settings() ) {
@@ -60,6 +60,7 @@ class Code_Snippets_Admin {
60
  function mu_menu_items( $menu_items ) {
61
  $menu_items['snippets'] = __( 'Snippets', 'code-snippets' );
62
  $menu_items['snippets_settings'] = __( 'Snippets &raquo; Settings', 'code-snippets' );
 
63
  return $menu_items;
64
  }
65
 
@@ -91,14 +92,16 @@ class Code_Snippets_Admin {
91
  }
92
 
93
  $hooks = array_combine( $hooks, $pages );
94
- $page = $hooks[ $hook ];
95
 
96
  // add snippet page uses edit stylesheet
97
  'add' === $page && $page = 'edit';
98
 
 
 
99
  wp_enqueue_style(
100
  "code-snippets-$page",
101
- plugins_url( "css/min/$page.css", CODE_SNIPPETS_FILE ),
102
  false,
103
  CODE_SNIPPETS_VERSION
104
  );
@@ -108,8 +111,8 @@ class Code_Snippets_Admin {
108
  * Prevent the snippet currently being saved from being executed
109
  * so it is not run twice (once normally, once
110
  *
111
- * @param bool $exec Whether the snippet will be executed
112
- * @param int $exec_id The ID of the snippet being executed
113
  * @param string $table_name
114
  *
115
  * @return bool Whether the snippet will be executed
@@ -158,7 +161,7 @@ class Code_Snippets_Admin {
158
  *
159
  * @since 2.0
160
  *
161
- * @param array $links The existing plugin info links
162
  * @param string $file The plugin the links are for
163
  *
164
  * @return array The modified plugin info links
@@ -215,9 +218,10 @@ class Code_Snippets_Admin {
215
 
216
  ?>
217
 
218
- <br/>
219
 
220
- <div class="updated"><p>
 
221
 
222
  <?php _e( "<strong>Have feedback on Code Snippets?</strong> Please take the time to answer a short survey on how you use this plugin and what you'd like to see changed or added in the future.", 'code-snippets' ); ?>
223
 
@@ -228,7 +232,8 @@ class Code_Snippets_Admin {
228
 
229
  <a href="<?php echo esc_url( wp_nonce_url( add_query_arg( $key, true ), $key ) ); ?>"><?php esc_html_e( 'Dismiss', 'code-snippets' ); ?></a>
230
 
231
- </p></div>
 
232
 
233
  <?php
234
  }
18
 
19
  public function load_classes() {
20
  $this->menus['manage'] = new Code_Snippets_Manage_Menu();
21
+ $this->menus['edit'] = new Code_Snippets_Edit_Menu();
22
  $this->menus['import'] = new Code_Snippets_Import_Menu();
23
 
24
  if ( is_network_admin() === code_snippets_unified_settings() ) {
60
  function mu_menu_items( $menu_items ) {
61
  $menu_items['snippets'] = __( 'Snippets', 'code-snippets' );
62
  $menu_items['snippets_settings'] = __( 'Snippets &raquo; Settings', 'code-snippets' );
63
+
64
  return $menu_items;
65
  }
66
 
92
  }
93
 
94
  $hooks = array_combine( $hooks, $pages );
95
+ $page = $hooks[ $hook ];
96
 
97
  // add snippet page uses edit stylesheet
98
  'add' === $page && $page = 'edit';
99
 
100
+ $rtl = is_rtl() && ( 'edit' === $page || 'manage' === $page ) ? '-rtl' : '';
101
+
102
  wp_enqueue_style(
103
  "code-snippets-$page",
104
+ plugins_url( "css/min/{$page}{$rtl}.css", CODE_SNIPPETS_FILE ),
105
  false,
106
  CODE_SNIPPETS_VERSION
107
  );
111
  * Prevent the snippet currently being saved from being executed
112
  * so it is not run twice (once normally, once
113
  *
114
+ * @param bool $exec Whether the snippet will be executed
115
+ * @param int $exec_id The ID of the snippet being executed
116
  * @param string $table_name
117
  *
118
  * @return bool Whether the snippet will be executed
161
  *
162
  * @since 2.0
163
  *
164
+ * @param array $links The existing plugin info links
165
  * @param string $file The plugin the links are for
166
  *
167
  * @return array The modified plugin info links
218
 
219
  ?>
220
 
221
+ <br />
222
 
223
+ <div class="updated">
224
+ <p>
225
 
226
  <?php _e( "<strong>Have feedback on Code Snippets?</strong> Please take the time to answer a short survey on how you use this plugin and what you'd like to see changed or added in the future.", 'code-snippets' ); ?>
227
 
232
 
233
  <a href="<?php echo esc_url( wp_nonce_url( add_query_arg( $key, true ), $key ) ); ?>"><?php esc_html_e( 'Dismiss', 'code-snippets' ); ?></a>
234
 
235
+ </p>
236
+ </div>
237
 
238
  <?php
239
  }
php/class-code-snippets.php CHANGED
@@ -33,7 +33,7 @@ class Code_Snippets {
33
  * Class constructor
34
  *
35
  * @param string $version The current plugin version
36
- * @param string $file The main plugin file
37
  */
38
  function __construct( $version, $file ) {
39
  $this->version = $version;
@@ -59,9 +59,6 @@ class Code_Snippets {
59
  require_once $includes_path . '/snippet-ops.php';
60
  require_once $includes_path . '/import-export.php';
61
 
62
- /* Upgrade function */
63
- require_once $includes_path . '/upgrade.php';
64
-
65
  /* CodeMirror editor functions */
66
  require_once $includes_path . '/editor.php';
67
 
@@ -80,6 +77,9 @@ class Code_Snippets {
80
  require_once $includes_path . '/settings/settings.php';
81
 
82
  $this->shortcode = new Code_Snippets_Shortcode();
 
 
 
83
  }
84
 
85
  public function disable_snippet_execution( $execute_snippets ) {
@@ -98,7 +98,9 @@ class Code_Snippets {
98
 
99
  /**
100
  * Fetch the admin menu slug for a snippets menu
 
101
  * @param string $menu The menu to retrieve the slug for
 
102
  * @return string The menu's slug
103
  */
104
  public function get_menu_slug( $menu = '' ) {
@@ -122,8 +124,10 @@ class Code_Snippets {
122
 
123
  /**
124
  * Fetch the URL to a snippets admin menu
125
- * @param string $menu The menu to retrieve the URL to
 
126
  * @param string $context The URL scheme to use
 
127
  * @return string The menu's URL
128
  */
129
  public function get_menu_url( $menu = '', $context = 'self' ) {
@@ -141,19 +145,24 @@ class Code_Snippets {
141
 
142
  /**
143
  * Fetch the admin menu hook for a snippets menu
 
144
  * @param string $menu The menu to retrieve the hook for
 
145
  * @return string The menu's hook
146
  */
147
  public function get_menu_hook( $menu = '' ) {
148
  $slug = $this->get_menu_slug( $menu );
 
149
  return get_plugin_page_hookname( $slug, 'snippets' );
150
  }
151
 
152
  /**
153
  * Fetch the admin menu slug for a snippets menu
154
- * @param int $snippet_id The snippet
155
- * @param string $context The URL scheme to use
156
- * @return string The URL to the edit snippet page for that snippet
 
 
157
  */
158
  public function get_snippet_edit_url( $snippet_id, $context = 'self' ) {
159
  return add_query_arg(
@@ -240,9 +249,11 @@ class Code_Snippets {
240
  * @return string
241
  */
242
  function add_safe_mode_query_var( $url ) {
 
243
  if ( isset( $_REQUEST['snippets-safe-mode'] ) ) {
244
  return add_query_arg( 'snippets-safe-mode', $_REQUEST['snippets-safe-mode'], $url );
245
  }
 
246
  return $url;
247
  }
248
  }
33
  * Class constructor
34
  *
35
  * @param string $version The current plugin version
36
+ * @param string $file The main plugin file
37
  */
38
  function __construct( $version, $file ) {
39
  $this->version = $version;
59
  require_once $includes_path . '/snippet-ops.php';
60
  require_once $includes_path . '/import-export.php';
61
 
 
 
 
62
  /* CodeMirror editor functions */
63
  require_once $includes_path . '/editor.php';
64
 
77
  require_once $includes_path . '/settings/settings.php';
78
 
79
  $this->shortcode = new Code_Snippets_Shortcode();
80
+
81
+ $upgrade = new Code_Snippets_Upgrade( $this->db );
82
+ add_action( 'plugins_loaded', array( $upgrade, 'run' ), 0 );
83
  }
84
 
85
  public function disable_snippet_execution( $execute_snippets ) {
98
 
99
  /**
100
  * Fetch the admin menu slug for a snippets menu
101
+ *
102
  * @param string $menu The menu to retrieve the slug for
103
+ *
104
  * @return string The menu's slug
105
  */
106
  public function get_menu_slug( $menu = '' ) {
124
 
125
  /**
126
  * Fetch the URL to a snippets admin menu
127
+ *
128
+ * @param string $menu The menu to retrieve the URL to
129
  * @param string $context The URL scheme to use
130
+ *
131
  * @return string The menu's URL
132
  */
133
  public function get_menu_url( $menu = '', $context = 'self' ) {
145
 
146
  /**
147
  * Fetch the admin menu hook for a snippets menu
148
+ *
149
  * @param string $menu The menu to retrieve the hook for
150
+ *
151
  * @return string The menu's hook
152
  */
153
  public function get_menu_hook( $menu = '' ) {
154
  $slug = $this->get_menu_slug( $menu );
155
+
156
  return get_plugin_page_hookname( $slug, 'snippets' );
157
  }
158
 
159
  /**
160
  * Fetch the admin menu slug for a snippets menu
161
+ *
162
+ * @param int $snippet_id The snippet
163
+ * @param string $context The URL scheme to use
164
+ *
165
+ * @return string The URL to the edit snippet page for that snippet
166
  */
167
  public function get_snippet_edit_url( $snippet_id, $context = 'self' ) {
168
  return add_query_arg(
249
  * @return string
250
  */
251
  function add_safe_mode_query_var( $url ) {
252
+
253
  if ( isset( $_REQUEST['snippets-safe-mode'] ) ) {
254
  return add_query_arg( 'snippets-safe-mode', $_REQUEST['snippets-safe-mode'], $url );
255
  }
256
+
257
  return $url;
258
  }
259
  }
php/class-contextual-help.php CHANGED
@@ -59,15 +59,18 @@ class Code_Snippets_Contextual_Help {
59
  $this->screen->add_help_tab( array(
60
  'id' => 'safe-mode',
61
  'title' => __( 'Safe Mode', 'code-snippets' ),
62
- 'content' => '<p>' . __( 'Be sure to check your snippets for errors before you activate them, as a faulty snippet could bring your whole blog down. If your site starts doing strange things, deactivate all your snippets and activate them one at a time.', 'code-snippets' ) . '</p>' .
63
- '<p>' . __( "If something goes wrong with a snippet and you can't use WordPress, you can cause all snippets to stop executing by adding <code>define('CODE_SNIPPETS_SAFE_MODE', true);</code> to your <code>wp-config.php</code> file. After you have deactivated the offending snippet, you can turn off safe mode by removing this line or replacing <strong>true</strong> with <strong>false</strong>.", 'code-snippets' ) . '</p>',
 
64
  ) );
65
 
66
  $this->screen->add_help_tab( array(
67
  'id' => 'uninstall',
68
  'title' => __( 'Uninstall', 'code-snippets' ),
69
- 'content' => '<p>' . sprintf( __( 'When you delete Code Snippets through the Plugins menu in WordPress it will clear up the <code>%1$s</code> table and a few other bits of data stored in the database. If you want to keep this data (ie: you are only temporally uninstalling Code Snippets) then remove the <code>%2$s</code> folder using FTP.', 'code-snippets' ), code_snippets()->db->get_table_name(), dirname( CODE_SNIPPETS_FILE ) ) .
70
- '<p>' . __( "Even if you're sure that you don't want to use Code Snippets ever again on this WordPress installation, you may want to use the export feature to back up your snippets.", 'code-snippets' ) . '</p>',
 
 
71
  ) );
72
  }
73
 
@@ -97,16 +100,18 @@ class Code_Snippets_Contextual_Help {
97
  $this->screen->add_help_tab( array(
98
  'id' => 'finding',
99
  'title' => __( 'Finding Snippets', 'code-snippets' ),
100
- 'content' => '<p>' . __( 'Here are some links to websites which host a large number of snippets that you can add to your site:', 'code-snippets' ) .
101
- '<ul>' . $snippet_host_list . '</ul>' .
102
- __( 'More places to find snippets, as well as a selection of example snippets, can be found in the <a href="https://github.com/sheabunge/code-snippets/wiki/Finding-snippets">plugin documentation</a>.', 'code-snippets' ) . '</p>',
 
103
  ) );
104
 
105
  $this->screen->add_help_tab( array(
106
  'id' => 'adding',
107
  'title' => __( 'Adding Snippets', 'code-snippets' ),
108
- 'content' => '<p>' . __( 'You need to fill out the name and code fields for your snippet to be added. While the description field will add more information about how your snippet works, what is does and where you found it, it is completely optional.', 'code-snippets' ) . '</p>' .
109
- '<p>' . __( 'Please be sure to check that your snippet is valid PHP code and will not produce errors before adding it through this page. While doing so will not become active straight away, it will help to minimise the chance of a faulty snippet becoming active on your site.', 'code-snippets' ) . '</p>',
 
110
  ) );
111
  }
112
 
@@ -125,13 +130,16 @@ class Code_Snippets_Contextual_Help {
125
  $this->screen->add_help_tab( array(
126
  'id' => 'import',
127
  'title' => __( 'Importing', 'code-snippets' ),
128
- 'content' => '<p>' . __( 'You can load your snippets from a code snippets (.xml) export file using this page.', 'code-snippets' ) .
129
- sprintf( __( 'Snippets will be added to the database along with your existing snippets. Regardless of whether the snippets were active on the previous site, imported snippets are always inactive until activated using the <a href="%s">All Snippets</a> page.</p>', 'code-snippets' ), $manage_url ) . '</p>',
 
 
130
  ) );
131
 
132
  $this->screen->add_help_tab( array(
133
  'id' => 'export',
134
  'title' => __( 'Exporting', 'code-snippets' ),
 
135
  'content' => '<p>' . sprintf( __( 'You can save your snippets to a Code Snippets (.xml) export file using the <a href="%s">Manage Snippets</a> page.', 'code-snippets' ), $manage_url ) . '</p>',
136
  ) );
137
  }
59
  $this->screen->add_help_tab( array(
60
  'id' => 'safe-mode',
61
  'title' => __( 'Safe Mode', 'code-snippets' ),
62
+ 'content' =>
63
+ '<p>' . __( 'Be sure to check your snippets for errors before you activate them, as a faulty snippet could bring your whole blog down. If your site starts doing strange things, deactivate all your snippets and activate them one at a time.', 'code-snippets' ) . '</p>' .
64
+ '<p>' . __( "If something goes wrong with a snippet and you can't use WordPress, you can cause all snippets to stop executing by adding <code>define('CODE_SNIPPETS_SAFE_MODE', true);</code> to your <code>wp-config.php</code> file. After you have deactivated the offending snippet, you can turn off safe mode by removing this line or replacing <strong>true</strong> with <strong>false</strong>.", 'code-snippets' ) . '</p>',
65
  ) );
66
 
67
  $this->screen->add_help_tab( array(
68
  'id' => 'uninstall',
69
  'title' => __( 'Uninstall', 'code-snippets' ),
70
+ 'content' =>
71
+ /* translators: 1: snippets table name, 2: Code Snippets plugin directory */
72
+ '<p>' . sprintf( __( 'When you delete Code Snippets through the Plugins menu in WordPress it will clear up the <code>%1$s</code> table and a few other bits of data stored in the database. If you want to keep this data (ie: you are only temporally uninstalling Code Snippets) then remove the <code>%2$s</code> folder using FTP.', 'code-snippets' ), code_snippets()->db->get_table_name(), dirname( CODE_SNIPPETS_FILE ) ) .
73
+ '<p>' . __( "Even if you're sure that you don't want to use Code Snippets ever again on this WordPress installation, you may want to use the export feature to back up your snippets.", 'code-snippets' ) . '</p>',
74
  ) );
75
  }
76
 
100
  $this->screen->add_help_tab( array(
101
  'id' => 'finding',
102
  'title' => __( 'Finding Snippets', 'code-snippets' ),
103
+ 'content' =>
104
+ '<p>' . __( 'Here are some links to websites which host a large number of snippets that you can add to your site:', 'code-snippets' ) .
105
+ '<ul>' . $snippet_host_list . '</ul>' .
106
+ __( 'More places to find snippets, as well as a selection of example snippets, can be found in the <a href="https://github.com/sheabunge/code-snippets/wiki/Finding-snippets">plugin documentation</a>.', 'code-snippets' ) . '</p>',
107
  ) );
108
 
109
  $this->screen->add_help_tab( array(
110
  'id' => 'adding',
111
  'title' => __( 'Adding Snippets', 'code-snippets' ),
112
+ 'content' =>
113
+ '<p>' . __( 'You need to fill out the name and code fields for your snippet to be added. While the description field will add more information about how your snippet works, what is does and where you found it, it is completely optional.', 'code-snippets' ) . '</p>' .
114
+ '<p>' . __( 'Please be sure to check that your snippet is valid PHP code and will not produce errors before adding it through this page. While doing so will not become active straight away, it will help to minimise the chance of a faulty snippet becoming active on your site.', 'code-snippets' ) . '</p>',
115
  ) );
116
  }
117
 
130
  $this->screen->add_help_tab( array(
131
  'id' => 'import',
132
  'title' => __( 'Importing', 'code-snippets' ),
133
+ 'content' =>
134
+ '<p>' . __( 'You can load your snippets from a code snippets (.xml) export file using this page.', 'code-snippets' ) .
135
+ /* translators: %s: URL to Snippets admin menu */
136
+ sprintf( __( 'Snippets will be added to the database along with your existing snippets. Regardless of whether the snippets were active on the previous site, imported snippets are always inactive until activated using the <a href="%s">All Snippets</a> page.</p>', 'code-snippets' ), $manage_url ) . '</p>',
137
  ) );
138
 
139
  $this->screen->add_help_tab( array(
140
  'id' => 'export',
141
  'title' => __( 'Exporting', 'code-snippets' ),
142
+ /* translators: %s: URL to Import Snippets admin menu */
143
  'content' => '<p>' . sprintf( __( 'You can save your snippets to a Code Snippets (.xml) export file using the <a href="%s">Manage Snippets</a> page.', 'code-snippets' ), $manage_url ) . '</p>',
144
  ) );
145
  }
php/class-db.php CHANGED
@@ -27,16 +27,12 @@ class Code_Snippets_DB {
27
  function set_table_vars() {
28
  global $wpdb;
29
 
30
- $this->table = 'snippets';
31
- $this->ms_table = 'ms_snippets';
32
 
33
  /* Register the snippet table names with WordPress */
34
- $wpdb->tables[] = $this->table;
35
- $wpdb->ms_global_tables[] = $this->ms_table;
36
-
37
- /* Setup initial table variables */
38
- $wpdb->snippets = $this->table = $wpdb->prefix . $this->table;
39
- $wpdb->ms_snippets = $this->ms_table = $wpdb->base_prefix . $this->ms_table;
40
  }
41
 
42
  /**
@@ -64,14 +60,13 @@ class Code_Snippets_DB {
64
  /**
65
  * Return the appropriate snippet table name
66
  *
67
- * @since 2.0
68
  *
69
- * @param string|bool|null $multisite Retrieve the multisite table name or the site table name?
70
  *
71
- * @return string The snippet table name
72
  */
73
  function get_table_name( $multisite = null ) {
74
- global $wpdb;
75
 
76
  /* If the first parameter is a string, assume it is a table name */
77
  if ( is_string( $multisite ) ) {
@@ -83,37 +78,47 @@ class Code_Snippets_DB {
83
 
84
  /* Retrieve the table name from $wpdb depending on the value of $multisite */
85
 
86
- return ( $multisite ? $wpdb->ms_snippets : $wpdb->snippets );
87
  }
88
 
89
  /**
90
- * Create the snippet tables
91
- * This function will only execute once per page load, except if $redo is true
92
- *
93
- * @since 1.7.1
94
- *
95
- * @param bool $upgrade Run the table creation code even if the table exists
96
  */
97
- function create_tables( $upgrade = false ) {
98
  global $wpdb;
99
 
100
- /* Set the table name variables if not yet defined */
101
- if ( ! isset( $wpdb->snippets, $wpdb->ms_snippets ) ) {
102
- $this->set_table_vars();
103
  }
104
 
105
- if ( is_multisite() ) {
106
-
107
- /* Create the network snippets table if it doesn't exist, or upgrade it */
108
- if ( $upgrade || $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->ms_snippets'" ) !== $wpdb->ms_snippets ) {
109
- $this->create_table( $wpdb->ms_snippets );
110
- }
111
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
- /* Create the table if it doesn't exist, or upgrade it */
114
- if ( $upgrade || $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->snippets'" ) !== $wpdb->snippets ) {
115
- $this->create_table( $wpdb->snippets );
116
  }
 
 
117
  }
118
 
119
  /**
@@ -126,20 +131,20 @@ class Code_Snippets_DB {
126
  *
127
  * @return bool whether the table creation was successful
128
  */
129
- function create_table( $table_name ) {
130
  global $wpdb;
131
  $charset_collate = $wpdb->get_charset_collate();
132
 
133
  /* Create the database table */
134
  $sql = "CREATE TABLE $table_name (
135
- id bigint(20) NOT NULL AUTO_INCREMENT,
136
- name tinytext NOT NULL default '',
137
- description text NOT NULL default '',
138
- code longtext NOT NULL default '',
139
- tags longtext NOT NULL default '',
140
- scope varchar(15) NOT NULL default 'global',
141
- priority smallint NOT NULL default 10,
142
- active tinyint(1) NOT NULL default 0,
143
  PRIMARY KEY (id)
144
  ) $charset_collate;";
145
 
@@ -156,53 +161,22 @@ class Code_Snippets_DB {
156
  }
157
 
158
  /**
159
- * Add sample snippet content to the database
 
160
  *
161
- * @param bool $network
162
  */
163
- public function create_sample_content( $network = false ) {
164
-
165
- $snippets = array(
166
-
167
- array(
168
- 'name' => __( 'Example HTML shortcode', 'code-snippets' ),
169
- 'code' => sprintf(
170
- "\nadd_shortcode( 'shortcode_name', function () { ?>\n\n\t<p>%s</p>\n\n<?php } );",
171
- strip_tags( __( 'write your HTML shortcode content here', 'code-snippets' ) )
172
- ),
173
- 'desc' => __( 'This is an example snippet for demonstrating how to add an HTML shortcode.', 'code-snippets' ),
174
- 'tags' => array( 'shortcode' ),
175
- ),
176
-
177
- array(
178
- 'name' => __( 'Example CSS snippet', 'code-snippets' ),
179
- 'code' => sprintf(
180
- "\nadd_action( 'wp_head', function () { ?>\n\t<style>\n\n\t\t/* %s */\n\n\t</style>\n<?php } );\n",
181
- strip_tags( __( 'write your CSS code here', 'code-snippets' ) )
182
- ),
183
- 'desc' => __( 'This is an example snippet for demonstrating how to add custom CSS code to your website.', 'code-snippets' ),
184
- 'tags' => array( 'css' ),
185
- 'scope' => 'front-end',
186
- ),
187
-
188
- array(
189
- 'name' => __( 'Example JavaScript snippet', 'code-snippets' ),
190
- 'code' => sprintf(
191
- "\nadd_action( 'wp_head', function () { ?>\n\t<script>\n\n\t\t/* %s */\n\n\t</script>\n<?php } );\n",
192
- strip_tags( __( 'write your JavaScript code here', 'code-snippets' ) )
193
- ),
194
- 'desc' => __( 'This is an example snippet for demonstrating how to add custom JavaScript code to your website.', 'code-snippets' ),
195
- 'tags' => array( 'javascript' ),
196
- 'scope' => 'front-end',
197
- ),
198
- );
199
 
200
- foreach ( $snippets as $snippet ) {
201
- $snippet = new Code_Snippet( $snippet );
202
- $snippet->desc .= ' ' . __( 'You can remove it, or edit it to add your own content.', 'code-snippets' );
203
- $snippet->network = $network;
204
 
205
- save_snippet( $snippet );
 
 
 
206
  }
207
  }
208
  }
27
  function set_table_vars() {
28
  global $wpdb;
29
 
30
+ $this->table = $wpdb->prefix . 'snippets';
31
+ $this->ms_table = $wpdb->base_prefix . 'ms_snippets';
32
 
33
  /* Register the snippet table names with WordPress */
34
+ $wpdb->tables[] = $wpdb->snippets = $this->table;
35
+ $wpdb->ms_global_tables[] = $wpdb->ms_snippets = $this->ms_table;
 
 
 
 
36
  }
37
 
38
  /**
60
  /**
61
  * Return the appropriate snippet table name
62
  *
63
+ * @since 2.0
64
  *
65
+ * @param string|bool|null $multisite Retrieve the multisite table name or the site table name?
66
  *
67
+ * @return string The snippet table name
68
  */
69
  function get_table_name( $multisite = null ) {
 
70
 
71
  /* If the first parameter is a string, assume it is a table name */
72
  if ( is_string( $multisite ) ) {
78
 
79
  /* Retrieve the table name from $wpdb depending on the value of $multisite */
80
 
81
+ return ( $multisite ? $this->ms_table : $this->table );
82
  }
83
 
84
  /**
85
+ * Create the snippet tables if they do not already exist
 
 
 
 
 
86
  */
87
+ public function create_missing_tables() {
88
  global $wpdb;
89
 
90
+ /* Create the network snippets table if it doesn't exist */
91
+ if ( is_multisite() && $wpdb->get_var( "SHOW TABLES LIKE '$this->ms_table'" ) !== $this->ms_table ) {
92
+ $this->create_table( $this->ms_table );
93
  }
94
 
95
+ /* Create the table if it doesn't exist */
96
+ if ( $wpdb->get_var( "SHOW TABLES LIKE '$this->table'" ) !== $this->table ) {
97
+ $this->create_table( $this->table );
 
 
 
98
  }
99
+ }
100
+
101
+ /**
102
+ * Create the snippet tables, or upgrade them if they already exist
103
+ */
104
+ public function create_or_upgrade_tables() {
105
+ $this->create_table( $this->ms_table );
106
+ $this->create_table( $this->table );
107
+ }
108
+
109
+ /**
110
+ * Create a snippet table if it does not already exist
111
+ *
112
+ * @param $table_name
113
+ */
114
+ public static function create_missing_table( $table_name ) {
115
+ global $wpdb;
116
 
117
+ if ( $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) === $table_name ) {
118
+ return;
 
119
  }
120
+
121
+ self::create_table( $table_name );
122
  }
123
 
124
  /**
131
  *
132
  * @return bool whether the table creation was successful
133
  */
134
+ public static function create_table( $table_name ) {
135
  global $wpdb;
136
  $charset_collate = $wpdb->get_charset_collate();
137
 
138
  /* Create the database table */
139
  $sql = "CREATE TABLE $table_name (
140
+ id BIGINT(20) NOT NULL AUTO_INCREMENT,
141
+ name TINYTEXT NOT NULL DEFAULT '',
142
+ description TEXT NOT NULL DEFAULT '',
143
+ code LONGTEXT NOT NULL DEFAULT '',
144
+ tags LONGTEXT NOT NULL DEFAULT '',
145
+ scope VARCHAR(15) NOT NULL DEFAULT 'global',
146
+ priority SMALLINT NOT NULL DEFAULT 10,
147
+ active TINYINT(1) NOT NULL DEFAULT 0,
148
  PRIMARY KEY (id)
149
  ) $charset_collate;";
150
 
161
  }
162
 
163
  /**
164
+ * Occasionally the dbDelta process seems to fail to create new columns on some sites,
165
+ * so attempt to create columns which appear to be missing
166
  *
167
+ * @param string $table_name
168
  */
169
+ public function create_missing_columns( $table_name ) {
170
+ global $wpdb;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
 
172
+ $columns = array(
173
+ 'priority' => 'SMALLINT NOT NULL DEFAULT 10',
174
+ );
 
175
 
176
+ foreach ( $columns as $column => $creation_sql ) {
177
+ if ( $wpdb->get_var( "SHOW COLUMNS FROM {$table_name} LIKE '{$column}';" ) !== $column ) {
178
+ $wpdb->query( "ALTER TABLE {$table_name} ADD {$column} {$creation_sql};" );
179
+ }
180
  }
181
  }
182
  }
php/class-list-table.php CHANGED
@@ -127,6 +127,7 @@ class Code_Snippets_List_Table extends WP_List_Table {
127
  $query_args = array( 'action' => $action, 'id' => $snippet->id );
128
 
129
  $url = $network_redirect ? add_query_arg( $query_args, code_snippets()->get_menu_url( 'manage', 'network' ) ) : add_query_arg( $query_args );
 
130
  return $escape ? esc_url( $url ) : $url;
131
  }
132
 
@@ -178,7 +179,9 @@ class Code_Snippets_List_Table extends WP_List_Table {
178
 
179
  /**
180
  * Retrieve the code for a snippet activation switch
 
181
  * @param Code_Snippet $snippet
 
182
  * @return string
183
  */
184
  protected function get_activation_switch( $snippet ) {
@@ -227,6 +230,7 @@ class Code_Snippets_List_Table extends WP_List_Table {
227
  */
228
  protected function column_name( $snippet ) {
229
 
 
230
  $title = empty( $snippet->name ) ? sprintf( __( 'Untitled #%d', 'code-snippets' ), $snippet->id ) : $snippet->name;
231
 
232
  $row_actions = $this->row_actions(
@@ -255,8 +259,9 @@ class Code_Snippets_List_Table extends WP_List_Table {
255
  }
256
 
257
  /* Return the name contents */
258
- return $this->get_activation_switch( $snippet ) .
259
- apply_filters( 'code_snippets/list_table/column_name', $out, $snippet ) . $row_actions;
 
260
  }
261
 
262
  /**
@@ -413,9 +418,17 @@ class Code_Snippets_List_Table extends WP_List_Table {
413
 
414
  /* Define the labels for each view */
415
  $labels = array(
416
- 'all' => _n( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'code-snippets' ),
417
- 'active' => _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count, 'code-snippets' ),
418
- 'inactive' => _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count, 'code-snippets' ),
 
 
 
 
 
 
 
 
419
  'recently_activated' => _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count, 'code-snippets' ),
420
  );
421
 
@@ -736,6 +749,7 @@ class Code_Snippets_List_Table extends WP_List_Table {
736
  private function fetch_shared_network_snippets() {
737
  /** @var wpdb $wpdb */
738
  global $snippets, $wpdb;
 
739
 
740
  if ( ! is_multisite() || ! $ids = get_site_option( 'shared_network_snippets', false ) ) {
741
  return;
@@ -758,7 +772,7 @@ class Code_Snippets_List_Table extends WP_List_Table {
758
 
759
  $active_shared_snippets = get_option( 'active_shared_network_snippets', array() );
760
 
761
- $sql = sprintf( "SELECT * FROM {$wpdb->ms_snippets} WHERE id IN (%s)",
762
  implode( ',', array_fill( 0, count( $ids ), '%d' ) )
763
  );
764
 
@@ -1025,16 +1039,19 @@ class Code_Snippets_List_Table extends WP_List_Table {
1025
  echo '<span class="subtitle">' . __( 'Search results', 'code-snippets' );
1026
 
1027
  if ( ! empty( $_REQUEST['s'] ) ) {
1028
- echo sprintf( __( ' for &#8220;%s&#8221;', 'code-snippets' ), esc_html( $_REQUEST['s'] ) );
 
1029
  }
1030
 
1031
  if ( ! empty( $_GET['tag'] ) ) {
1032
- echo sprintf( __( ' in tag &#8220;%s&#8221;', 'code-snippets' ), esc_html( $_GET['tag'] ) );
 
1033
  }
1034
 
1035
  echo '</span>';
1036
 
1037
  printf(
 
1038
  '&nbsp;<a class="button clear-filters" href="%s">%s</a>',
1039
  esc_url( remove_query_arg( array( 's', 'tag' ) ) ),
1040
  __( 'Clear Filters', 'code-snippets' )
@@ -1065,6 +1082,7 @@ class Code_Snippets_List_Table extends WP_List_Table {
1065
 
1066
  /**
1067
  * Clone a selection of snippets
 
1068
  * @param array $ids
1069
  */
1070
  private function clone_snippets( $ids ) {
127
  $query_args = array( 'action' => $action, 'id' => $snippet->id );
128
 
129
  $url = $network_redirect ? add_query_arg( $query_args, code_snippets()->get_menu_url( 'manage', 'network' ) ) : add_query_arg( $query_args );
130
+
131
  return $escape ? esc_url( $url ) : $url;
132
  }
133
 
179
 
180
  /**
181
  * Retrieve the code for a snippet activation switch
182
+ *
183
  * @param Code_Snippet $snippet
184
+ *
185
  * @return string
186
  */
187
  protected function get_activation_switch( $snippet ) {
230
  */
231
  protected function column_name( $snippet ) {
232
 
233
+ /* translators: %d: snippet identifier */
234
  $title = empty( $snippet->name ) ? sprintf( __( 'Untitled #%d', 'code-snippets' ), $snippet->id ) : $snippet->name;
235
 
236
  $row_actions = $this->row_actions(
259
  }
260
 
261
  /* Return the name contents */
262
+
263
+ $out = apply_filters( 'code_snippets/list_table/column_name', $out, $snippet );
264
+ return $this->get_activation_switch( $snippet ) . $out . $row_actions;
265
  }
266
 
267
  /**
418
 
419
  /* Define the labels for each view */
420
  $labels = array(
421
+
422
+ /* translators: %s: total number of snippets */
423
+ 'all' => _n( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'code-snippets' ),
424
+
425
+ /* translators: %s: total number of active snippets */
426
+ 'active' => _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count, 'code-snippets' ),
427
+
428
+ /* translators: %s: total number of inactive snippets */
429
+ 'inactive' => _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count, 'code-snippets' ),
430
+
431
+ /* translators: %s: total number of recently activated snippets */
432
  'recently_activated' => _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count, 'code-snippets' ),
433
  );
434
 
749
  private function fetch_shared_network_snippets() {
750
  /** @var wpdb $wpdb */
751
  global $snippets, $wpdb;
752
+ $db = code_snippets()->db;
753
 
754
  if ( ! is_multisite() || ! $ids = get_site_option( 'shared_network_snippets', false ) ) {
755
  return;
772
 
773
  $active_shared_snippets = get_option( 'active_shared_network_snippets', array() );
774
 
775
+ $sql = sprintf( "SELECT * FROM {$db->ms_table} WHERE id IN (%s)",
776
  implode( ',', array_fill( 0, count( $ids ), '%d' ) )
777
  );
778
 
1039
  echo '<span class="subtitle">' . __( 'Search results', 'code-snippets' );
1040
 
1041
  if ( ! empty( $_REQUEST['s'] ) ) {
1042
+ /* translators: %s: search query */
1043
+ echo sprintf( __( ' for &ldquo;%s&rdquo;', 'code-snippets' ), esc_html( $_REQUEST['s'] ) );
1044
  }
1045
 
1046
  if ( ! empty( $_GET['tag'] ) ) {
1047
+ /* translators: %s: tag name */
1048
+ echo sprintf( __( ' in tag &ldquo;%s&rdquo;', 'code-snippets' ), esc_html( $_GET['tag'] ) );
1049
  }
1050
 
1051
  echo '</span>';
1052
 
1053
  printf(
1054
+ /* translators: 1: link URL, 2: link text */
1055
  '&nbsp;<a class="button clear-filters" href="%s">%s</a>',
1056
  esc_url( remove_query_arg( array( 's', 'tag' ) ) ),
1057
  __( 'Clear Filters', 'code-snippets' )
1082
 
1083
  /**
1084
  * Clone a selection of snippets
1085
+ *
1086
  * @param array $ids
1087
  */
1088
  private function clone_snippets( $ids ) {
php/class-shortcode.php CHANGED
@@ -48,7 +48,7 @@ class Code_Snippets_Shortcode {
48
 
49
  $atts = shortcode_atts(
50
  array(
51
- 'id' => 0,
52
  'network' => false,
53
  ),
54
  $atts, 'code_snippet'
48
 
49
  $atts = shortcode_atts(
50
  array(
51
+ 'id' => 0,
52
  'network' => false,
53
  ),
54
  $atts, 'code_snippet'
php/class-upgrade.php ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Manages upgrade tasks such as deleting and updating options
5
+ */
6
+ class Code_Snippets_Upgrade {
7
+
8
+ /**
9
+ * Instance of database class
10
+ * @var Code_Snippets_DB
11
+ */
12
+ private $db;
13
+
14
+ /**
15
+ * Class constructor
16
+ *
17
+ * @param Code_Snippets_DB $db Instance of database class
18
+ */
19
+ public function __construct( Code_Snippets_DB $db ) {
20
+ $this->db = $db;
21
+ }
22
+
23
+ /**
24
+ * Run the upgrade functions
25
+ */
26
+ public function run() {
27
+
28
+ /* Always run multisite upgrades, even if not on the main site, as subsites depend on the network snippet table */
29
+ if ( is_multisite() ) {
30
+ $this->do_multisite_upgrades();
31
+ }
32
+
33
+ $this->do_site_upgrades();
34
+ }
35
+
36
+ /**
37
+ * Perform upgrades for the current site
38
+ */
39
+ private function do_site_upgrades() {
40
+ $table_name = $this->db->table;
41
+ $prev_version = get_option( 'code_snippets_version' );
42
+
43
+ /* Do nothing if the plugin has not been updated or installed */
44
+ if ( ! version_compare( $prev_version, CODE_SNIPPETS_VERSION, '<' ) ) {
45
+ return;
46
+ }
47
+
48
+ $this->db->create_table( $table_name );
49
+
50
+ if ( false !== $prev_version ) {
51
+ $this->db->create_missing_columns( $table_name );
52
+ }
53
+
54
+ /* Update the plugin version stored in the database */
55
+ update_option( 'code_snippets_version', CODE_SNIPPETS_VERSION );
56
+
57
+ /* Update the scope column of the database */
58
+ if ( version_compare( $prev_version, '2.10.0', '<' ) ) {
59
+ $this->migrate_scope_data( $table_name );
60
+ }
61
+
62
+ /* Custom capabilities were removed after version 2.9.5 */
63
+ if ( version_compare( $prev_version, '2.9.5', '<=' ) ) {
64
+ $role = get_role( apply_filters( 'code_snippets_role', 'administrator' ) );
65
+ $role->remove_cap( apply_filters( 'code_snippets_cap', 'manage_snippets' ) );
66
+ }
67
+
68
+ if ( false === $prev_version ) {
69
+ $this->create_sample_content();
70
+ }
71
+ }
72
+
73
+ /**
74
+ * Perform multisite-only upgrades
75
+ */
76
+ private function do_multisite_upgrades() {
77
+ $table_name = $this->db->ms_table;
78
+ $prev_version = get_site_option( 'code_snippets_version' );
79
+
80
+ /* Do nothing if the plugin has not been updated or installed */
81
+ if ( ! version_compare( $prev_version, CODE_SNIPPETS_VERSION, '<' ) ) {
82
+ return;
83
+ }
84
+
85
+ /* Always attempt to create or upgrade the database tables */
86
+ $this->db->create_table( $table_name );
87
+
88
+ /* If the plugin has been upgraded, also attempt to create the new columns */
89
+ if ( false !== $prev_version ) {
90
+ $this->db->create_missing_columns( $table_name );
91
+ }
92
+
93
+ /* Update the plugin version stored in the database */
94
+ update_site_option( 'code_snippets_version', CODE_SNIPPETS_VERSION );
95
+
96
+ /* Update the scope column of the database */
97
+ if ( version_compare( $prev_version, '2.10.0', '<' ) ) {
98
+ $this->migrate_scope_data( $table_name );
99
+ }
100
+
101
+ /* Custom capabilities were removed after version 2.9.5 */
102
+ if ( version_compare( $prev_version, '2.9.5', '<=' ) ) {
103
+ $network_cap = apply_filters( 'code_snippets_network_cap', 'manage_network_snippets' );
104
+
105
+ foreach ( get_super_admins() as $admin ) {
106
+ $user = new WP_User( 0, $admin );
107
+ $user->remove_cap( $network_cap );
108
+ }
109
+ }
110
+ }
111
+
112
+ /**
113
+ * Migrate data from the old integer method of storing scopes to the new string method
114
+ *
115
+ * @param string $table_name
116
+ */
117
+ private function migrate_scope_data( $table_name ) {
118
+ global $wpdb;
119
+
120
+ $scopes = array(
121
+ 0 => 'global',
122
+ 1 => 'admin',
123
+ 2 => 'front-end',
124
+ );
125
+
126
+ foreach ( $scopes as $scope_number => $scope_name ) {
127
+ $wpdb->query( sprintf(
128
+ "UPDATE %s SET scope = '%s' WHERE scope = %d",
129
+ $table_name, $scope_name, $scope_number
130
+ ) );
131
+ }
132
+ }
133
+
134
+ /**
135
+ * Add sample snippet content to the database
136
+ */
137
+ public function create_sample_content() {
138
+
139
+ if ( ! apply_filters( 'code_snippets/create_sample_content', true ) ) {
140
+ return;
141
+ }
142
+
143
+ $snippets = array(
144
+
145
+ array(
146
+ 'name' => __( 'Example HTML shortcode', 'code-snippets' ),
147
+ 'code' => sprintf(
148
+ "\nadd_shortcode( 'shortcode_name', function () { ?>\n\n\t<p>%s</p>\n\n<?php } );",
149
+ strip_tags( __( 'write your HTML shortcode content here', 'code-snippets' ) )
150
+ ),
151
+ 'desc' => __( 'This is an example snippet for demonstrating how to add an HTML shortcode.', 'code-snippets' ),
152
+ 'tags' => array( 'shortcode' ),
153
+ ),
154
+
155
+ array(
156
+ 'name' => __( 'Example CSS snippet', 'code-snippets' ),
157
+ 'code' => sprintf(
158
+ "\nadd_action( 'wp_head', function () { ?>\n\t<style>\n\n\t\t/* %s */\n\n\t</style>\n<?php } );\n",
159
+ strip_tags( __( 'write your CSS code here', 'code-snippets' ) )
160
+ ),
161
+ 'desc' => __( 'This is an example snippet for demonstrating how to add custom CSS code to your website.', 'code-snippets' ),
162
+ 'tags' => array( 'css' ),
163
+ 'scope' => 'front-end',
164
+ ),
165
+
166
+ array(
167
+ 'name' => __( 'Example JavaScript snippet', 'code-snippets' ),
168
+ 'code' => sprintf(
169
+ "\nadd_action( 'wp_head', function () { ?>\n\t<script>\n\n\t\t/* %s */\n\n\t</script>\n<?php } );\n",
170
+ strip_tags( __( 'write your JavaScript code here', 'code-snippets' ) )
171
+ ),
172
+ 'desc' => __( 'This is an example snippet for demonstrating how to add custom JavaScript code to your website.', 'code-snippets' ),
173
+ 'tags' => array( 'javascript' ),
174
+ 'scope' => 'front-end',
175
+ ),
176
+ );
177
+
178
+ foreach ( $snippets as $snippet ) {
179
+ $snippet = new Code_Snippet( $snippet );
180
+ $snippet->desc .= ' ' . __( 'You can remove it, or edit it to add your own content.', 'code-snippets' );
181
+ save_snippet( $snippet );
182
+ }
183
+ }
184
+ }
php/editor.php CHANGED
@@ -3,9 +3,10 @@
3
  /**
4
  * Get the attributes for the code editor
5
  *
6
- * @param array $override_atts Pass an array of attributes to override the saved ones
7
- * @param bool $json_encode Encode the data as JSON
8
- * @return array|string Array if $json_encode is false, JSON string if it is true
 
9
  */
10
  function code_snippets_get_editor_atts( $override_atts, $json_encode ) {
11
  $settings = code_snippets_get_settings();
@@ -46,7 +47,7 @@ function code_snippets_get_editor_atts( $override_atts, $json_encode ) {
46
  * @uses wp_enqueue_script() to add the scripts to the queue
47
  */
48
  function code_snippets_enqueue_codemirror() {
49
- $codemirror_version = '5.40.2';
50
  $url = plugin_dir_url( CODE_SNIPPETS_FILE );
51
 
52
  /* Remove other CodeMirror styles */
3
  /**
4
  * Get the attributes for the code editor
5
  *
6
+ * @param array $override_atts Pass an array of attributes to override the saved ones
7
+ * @param bool $json_encode Encode the data as JSON
8
+ *
9
+ * @return array|string Array if $json_encode is false, JSON string if it is true
10
  */
11
  function code_snippets_get_editor_atts( $override_atts, $json_encode ) {
12
  $settings = code_snippets_get_settings();
47
  * @uses wp_enqueue_script() to add the scripts to the queue
48
  */
49
  function code_snippets_enqueue_codemirror() {
50
+ $codemirror_version = '5.41.0';
51
  $url = plugin_dir_url( CODE_SNIPPETS_FILE );
52
 
53
  /* Remove other CodeMirror styles */
php/functions.php CHANGED
@@ -2,9 +2,12 @@
2
 
3
  /**
4
  * Fetch the admin menu slug for a snippets menu
 
5
  * @deprecated Use code_snippets()->get_menu_slug() instead
6
- * @param string $menu The menu to retrieve the slug for
7
- * @return string The menu's slug
 
 
8
  */
9
  function code_snippets_get_menu_slug( $menu = '' ) {
10
  return code_snippets()->get_menu_slug( $menu );
@@ -12,12 +15,13 @@ function code_snippets_get_menu_slug( $menu = '' ) {
12
 
13
  /**
14
  * Fetch the URL to a snippets admin menu
 
15
  * @deprecated Use code_snippets()->get_menu_url() instead
16
  *
17
- * @param string $menu The menu to retrieve the URL to
18
- * @param string $context The URL scheme to use
19
  *
20
- * @return string The menu's URL
21
  */
22
  function code_snippets_get_menu_url( $menu = '', $context = 'self' ) {
23
  return code_snippets()->get_menu_url( $menu, $context );
@@ -25,9 +29,12 @@ function code_snippets_get_menu_url( $menu = '', $context = 'self' ) {
25
 
26
  /**
27
  * Fetch the admin menu hook for a snippets menu
 
28
  * @deprecated Use code_snippets()->get_menu_hook() instead
 
29
  * @param string $menu The menu to retrieve the hook for
30
- * @return string The menu's hook
 
31
  */
32
  function code_snippets_get_menu_hook( $menu = '' ) {
33
  return code_snippets()->get_menu_hook( $menu );
@@ -39,7 +46,7 @@ function code_snippets_get_menu_hook( $menu = '' ) {
39
  * @deprecated Use code_snippets()->get_snippet_edit_url() instead
40
  *
41
  * @param int $snippet_id The snippet
42
- * @param string $context The URL scheme to use
43
  *
44
  * @return string The URL to the edit snippet page for that snippet
45
  */
@@ -67,7 +74,9 @@ function get_snippets_cap() {
67
  *
68
  * @deprecated Use code_snippets()->db->get_table_name() instead
69
  * @since 2.0
 
70
  * @param string|bool|null $multisite Retrieve the multisite table name or the site table name?
 
71
  * @return string The snippet table name
72
  */
73
  function get_snippets_table_name( $multisite = null ) {
2
 
3
  /**
4
  * Fetch the admin menu slug for a snippets menu
5
+ *
6
  * @deprecated Use code_snippets()->get_menu_slug() instead
7
+ *
8
+ * @param string $menu The menu to retrieve the slug for
9
+ *
10
+ * @return string The menu slug
11
  */
12
  function code_snippets_get_menu_slug( $menu = '' ) {
13
  return code_snippets()->get_menu_slug( $menu );
15
 
16
  /**
17
  * Fetch the URL to a snippets admin menu
18
+ *
19
  * @deprecated Use code_snippets()->get_menu_url() instead
20
  *
21
+ * @param string $menu The menu to retrieve the URL to
22
+ * @param string $context The URL scheme to use
23
  *
24
+ * @return string The menu URL
25
  */
26
  function code_snippets_get_menu_url( $menu = '', $context = 'self' ) {
27
  return code_snippets()->get_menu_url( $menu, $context );
29
 
30
  /**
31
  * Fetch the admin menu hook for a snippets menu
32
+ *
33
  * @deprecated Use code_snippets()->get_menu_hook() instead
34
+ *
35
  * @param string $menu The menu to retrieve the hook for
36
+ *
37
+ * @return string The menu hook
38
  */
39
  function code_snippets_get_menu_hook( $menu = '' ) {
40
  return code_snippets()->get_menu_hook( $menu );
46
  * @deprecated Use code_snippets()->get_snippet_edit_url() instead
47
  *
48
  * @param int $snippet_id The snippet
49
+ * @param string $context The URL scheme to use
50
  *
51
  * @return string The URL to the edit snippet page for that snippet
52
  */
74
  *
75
  * @deprecated Use code_snippets()->db->get_table_name() instead
76
  * @since 2.0
77
+ *
78
  * @param string|bool|null $multisite Retrieve the multisite table name or the site table name?
79
+ *
80
  * @return string The snippet table name
81
  */
82
  function get_snippets_table_name( $multisite = null ) {
php/import-export.php CHANGED
@@ -6,7 +6,6 @@
6
 
7
 
8
  /**
9
- *
10
  * @access private
11
  *
12
  * @param $snippets
@@ -62,9 +61,9 @@ function _code_snippets_save_imported_snippets( $snippets, $multisite = null, $d
62
  *
63
  * @uses save_snippet() to add the snippets to the database
64
  *
65
- * @param string $file The path to the file to import
66
- * @param bool|null $multisite Import into network-wide table or site-wide table?
67
- * @param string $dup_action Action to take if duplicate snippets are detected. Can be 'skip', 'ignore', or 'replace'
68
  *
69
  * @return array|bool An array of imported snippet IDs on success, false on failure
70
  */
@@ -87,6 +86,7 @@ function import_snippets_json( $file, $multisite = null, $dup_action = 'ignore'
87
 
88
  $imported = _code_snippets_save_imported_snippets( $snippets, $multisite, $dup_action );
89
  do_action( 'code_snippets/import/json', $file, $multisite );
 
90
  return $imported;
91
  }
92
 
@@ -97,9 +97,9 @@ function import_snippets_json( $file, $multisite = null, $dup_action = 'ignore'
97
  *
98
  * @uses save_snippet() to add the snippets to the database
99
  *
100
- * @param string $file The path to the file to import
101
- * @param bool|null $multisite Import into network-wide table or site-wide table?
102
- * @param string $dup_action Action to take if duplicate snippets are detected. Can be 'skip', 'ignore', or 'replace'
103
  *
104
  * @return array|bool An array of imported snippet IDs on success, false on failure
105
  */
@@ -147,6 +147,7 @@ function import_snippets_xml( $file, $multisite = null, $dup_action = 'ignore' )
147
 
148
  $imported = _code_snippets_save_imported_snippets( $snippets, $dup_action, $multisite );
149
  do_action( 'code_snippets/import/xml', $file, $multisite );
 
150
  return $imported;
151
  }
152
 
@@ -202,6 +203,7 @@ function code_snippets_prepare_export( $format, $ids, $table_name = '', $mime_ty
202
  }
203
 
204
  /* Return the retrieved snippets to build the rest of the export file */
 
205
  return $snippets;
206
  }
207
 
@@ -239,7 +241,7 @@ function download_snippets( $ids, $table_name = '' ) {
239
  /**
240
  * Export snippets in JSON format
241
  *
242
- * @param array $ids list of snippet IDs to export
243
  * @param string $table_name name of the database table to fetch snippets from
244
  */
245
  function export_snippets( $ids, $table_name = '' ) {
@@ -264,9 +266,9 @@ function export_snippets( $ids, $table_name = '' ) {
264
  }
265
 
266
  $data = array(
267
- 'generator' => 'Code Snippets v' . CODE_SNIPPETS_VERSION,
268
  'date_created' => date( 'Y-m-d H:i' ),
269
- 'snippets' => $final_snippets,
270
  );
271
 
272
  echo wp_json_encode( $data, apply_filters( 'code_snippets/export/json_encode_options', 0 ) );
6
 
7
 
8
  /**
 
9
  * @access private
10
  *
11
  * @param $snippets
61
  *
62
  * @uses save_snippet() to add the snippets to the database
63
  *
64
+ * @param string $file The path to the file to import
65
+ * @param bool|null $multisite Import into network-wide table or site-wide table?
66
+ * @param string $dup_action Action to take if duplicate snippets are detected. Can be 'skip', 'ignore', or 'replace'
67
  *
68
  * @return array|bool An array of imported snippet IDs on success, false on failure
69
  */
86
 
87
  $imported = _code_snippets_save_imported_snippets( $snippets, $multisite, $dup_action );
88
  do_action( 'code_snippets/import/json', $file, $multisite );
89
+
90
  return $imported;
91
  }
92
 
97
  *
98
  * @uses save_snippet() to add the snippets to the database
99
  *
100
+ * @param string $file The path to the file to import
101
+ * @param bool|null $multisite Import into network-wide table or site-wide table?
102
+ * @param string $dup_action Action to take if duplicate snippets are detected. Can be 'skip', 'ignore', or 'replace'
103
  *
104
  * @return array|bool An array of imported snippet IDs on success, false on failure
105
  */
147
 
148
  $imported = _code_snippets_save_imported_snippets( $snippets, $dup_action, $multisite );
149
  do_action( 'code_snippets/import/xml', $file, $multisite );
150
+
151
  return $imported;
152
  }
153
 
203
  }
204
 
205
  /* Return the retrieved snippets to build the rest of the export file */
206
+
207
  return $snippets;
208
  }
209
 
241
  /**
242
  * Export snippets in JSON format
243
  *
244
+ * @param array $ids list of snippet IDs to export
245
  * @param string $table_name name of the database table to fetch snippets from
246
  */
247
  function export_snippets( $ids, $table_name = '' ) {
266
  }
267
 
268
  $data = array(
269
+ 'generator' => 'Code Snippets v' . CODE_SNIPPETS_VERSION,
270
  'date_created' => date( 'Y-m-d H:i' ),
271
+ 'snippets' => $final_snippets,
272
  );
273
 
274
  echo wp_json_encode( $data, apply_filters( 'code_snippets/export/json_encode_options', 0 ) );
php/settings/editor-preview.php CHANGED
@@ -90,7 +90,7 @@ add_filter( 'admin_footer_text', 'example_custom_admin_footer_text' );
90
  ";
91
 
92
  $atts = array(
93
- 'mode' => 'text/x-php',
94
  'value' => $example_content,
95
  );
96
 
@@ -99,60 +99,61 @@ add_filter( 'admin_footer_text', 'example_custom_admin_footer_text' );
99
  <div style="max-width: 800px" id="code_snippets_editor_preview"></div>
100
 
101
  <script>
102
- (function () {
103
- 'use strict';
104
 
105
- // Load CodeMirror
106
- var atts = [];
107
- atts = <?php echo code_snippets_get_editor_atts( $atts, true ); ?>;
108
- atts['viewportMargin'] = Infinity;
109
 
110
- var editor = CodeMirror(document.getElementById('code_snippets_editor_preview'), atts);
111
 
112
- // Dynamically change editor settings
113
- <?php
114
 
115
- /* Retrieve editor settings */
116
- $fields = code_snippets_get_settings_fields();
117
- $fields = $fields['editor'];
118
 
119
- foreach ( $fields as $setting => $field ) {
120
 
121
- /* Only output settings which have a CodeMirror attribute */
122
- if ( empty( $field['codemirror'] ) ) {
123
- continue;
124
- }
125
 
126
- $att_name = addslashes( $field['codemirror'] );
127
 
128
- switch ( $field['type'] ) {
129
 
130
- case 'codemirror_theme_select': ?>
131
-
132
- document.querySelector('select[name="code_snippets_settings[editor][<?php echo $setting; ?>]"]').onchange = function () {
133
- editor.setOption('<?php echo $att_name; ?>', this.options[this.selectedIndex].value);
134
- };
135
 
136
  <?php break;
137
- case 'checkbox': ?>
138
 
139
- document.querySelector('input[name="code_snippets_settings[editor][<?php echo $setting; ?>]"]').onchange = function () {
140
- editor.setOption('<?php echo $att_name; ?>', this.checked);
141
- };
 
 
142
 
143
  <?php break;
144
- case 'number': ?>
145
-
146
- document.querySelector('input[name="code_snippets_settings[editor][<?php echo $setting; ?>]"]').onchange = function () {
147
- editor.setOption( '<?php echo $att_name; ?>', this.value);
148
- };
149
 
150
  <?php break;
151
- }
152
- }
153
 
154
- ?>
155
- }());
156
  </script>
157
 
158
  <?php
90
  ";
91
 
92
  $atts = array(
93
+ 'mode' => 'text/x-php',
94
  'value' => $example_content,
95
  );
96
 
99
  <div style="max-width: 800px" id="code_snippets_editor_preview"></div>
100
 
101
  <script>
102
+ (function () {
103
+ 'use strict';
104
 
105
+ // Load CodeMirror
106
+ var atts = [];
107
+ atts = <?php echo code_snippets_get_editor_atts( $atts, true ); ?>;
108
+ atts['viewportMargin'] = Infinity;
109
 
110
+ var editor = CodeMirror(document.getElementById('code_snippets_editor_preview'), atts);
111
 
112
+ // Dynamically change editor settings
113
+ <?php
114
 
115
+ /* Retrieve editor settings */
116
+ $fields = code_snippets_get_settings_fields();
117
+ $fields = $fields['editor'];
118
 
119
+ foreach ( $fields as $setting => $field ) {
120
 
121
+ /* Only output settings which have a CodeMirror attribute */
122
+ if ( empty( $field['codemirror'] ) ) {
123
+ continue;
124
+ }
125
 
126
+ $att_name = addslashes( $field['codemirror'] );
127
 
128
+ switch ( $field['type'] ) {
129
 
130
+ case 'codemirror_theme_select':
131
+ ?>
132
+ document.querySelector('select[name="code_snippets_settings[editor][<?php echo $setting; ?>]"]').onchange = function () {
133
+ editor.setOption('<?php echo $att_name; ?>', this.options[this.selectedIndex].value);
134
+ };
135
 
136
  <?php break;
 
137
 
138
+ case 'checkbox':
139
+ ?>
140
+ document.querySelector('input[name="code_snippets_settings[editor][<?php echo $setting; ?>]"]').onchange = function () {
141
+ editor.setOption('<?php echo $att_name; ?>', this.checked);
142
+ };
143
 
144
  <?php break;
145
+ case 'number':
146
+ ?>
147
+ document.querySelector('input[name="code_snippets_settings[editor][<?php echo $setting; ?>]"]').onchange = function () {
148
+ editor.setOption('<?php echo $att_name; ?>', this.value);
149
+ };
150
 
151
  <?php break;
152
+ }
153
+ }
154
 
155
+ ?>
156
+ }());
157
  </script>
158
 
159
  <?php
php/settings/render-fields.php CHANGED
@@ -11,6 +11,7 @@
11
  * Render a checkbox field for a setting
12
  *
13
  * @since 2.0.0
 
14
  * @param array $atts The setting field's attributes
15
  */
16
  function code_snippets_checkbox_field( $atts ) {
@@ -40,6 +41,7 @@ function code_snippets_checkbox_field( $atts ) {
40
  * Render a number select field for an editor setting
41
  *
42
  * @since 2.0.0
 
43
  * @param array $atts The setting field's attributes
44
  */
45
  function code_snippets_number_field( $atts ) {
11
  * Render a checkbox field for a setting
12
  *
13
  * @since 2.0.0
14
+ *
15
  * @param array $atts The setting field's attributes
16
  */
17
  function code_snippets_checkbox_field( $atts ) {
41
  * Render a number select field for an editor setting
42
  *
43
  * @since 2.0.0
44
+ *
45
  * @param array $atts The setting field's attributes
46
  */
47
  function code_snippets_number_field( $atts ) {
php/settings/settings-fields.php CHANGED
@@ -39,44 +39,45 @@ function code_snippets_get_settings_fields() {
39
 
40
  $fields['general'] = array(
41
  'activate_by_default' => array(
42
- 'name' => __( 'Activate by Default', 'code-snippets' ),
43
- 'type' => 'checkbox',
44
- 'label' => __( "Make the 'Save and Activate' button the default action when saving a snippet.", 'code-snippets' ),
45
  'default' => true,
46
  ),
47
 
48
  'snippet_scope_enabled' => array(
49
- 'name' => __( 'Enable Scope Selector', 'code-snippets' ),
50
- 'type' => 'checkbox',
51
- 'label' => __( 'Enable the scope selector when editing a snippet', 'code-snippets' ),
52
  'default' => true,
53
  ),
54
 
55
  'enable_tags' => array(
56
- 'name' => __( 'Enable Snippet Tags', 'code-snippets' ),
57
- 'type' => 'checkbox',
58
- 'label' => __( 'Show snippet tags on admin pages', 'code-snippets' ),
59
  'default' => true,
60
  ),
61
 
62
  'enable_description' => array(
63
- 'name' => __( 'Enable Snippet Descriptions', 'code-snippets' ),
64
- 'type' => 'checkbox',
65
- 'label' => __( 'Show snippet descriptions on admin pages', 'code-snippets' ),
66
  'default' => true,
67
  ),
68
 
69
  'disable_prism' => array(
70
- 'name' => __( 'Disable Shortcode Syntax Highlighter', 'code-snippets' ),
71
- 'type' => 'checkbox',
72
- 'label' => __( 'Disable the syntax highlighting for the [code_snippet] shortcode on the front-end', 'code-snippets' ),
73
  'default' => false,
74
  ),
75
 
76
  'complete_uninstall' => array(
77
- 'name' => __( 'Complete Uninstall', 'code-snippets' ),
78
- 'type' => 'checkbox',
79
- 'label' => sprintf(
 
80
  __( 'When the plugin is deleted from the <a href="%s">Plugins</a> menu, also delete all snippets and plugin settings.', 'code-snippets' ),
81
  self_admin_url( 'plugins.php' )
82
  ),
@@ -92,24 +93,24 @@ function code_snippets_get_settings_fields() {
92
  $fields['description_editor'] = array(
93
 
94
  'rows' => array(
95
- 'name' => __( 'Row Height', 'code-snippets' ),
96
- 'type' => 'number',
97
- 'label' => __( 'rows', 'code-snippets' ),
98
  'default' => 5,
99
- 'min' => 0,
100
  ),
101
 
102
  'use_full_mce' => array(
103
- 'name' => __( 'Use Full Editor', 'code-snippets' ),
104
- 'type' => 'checkbox',
105
- 'label' => __( 'Enable all features of the visual editor', 'code-snippets' ),
106
  'default' => false,
107
  ),
108
 
109
  'media_buttons' => array(
110
- 'name' => __( 'Media Buttons', 'code-snippets' ),
111
- 'type' => 'checkbox',
112
- 'label' => __( 'Enable the add media buttons', 'code-snippets' ),
113
  'default' => false,
114
  ),
115
  );
@@ -118,71 +119,72 @@ function code_snippets_get_settings_fields() {
118
 
119
  $fields['editor'] = array(
120
  'theme' => array(
121
- 'name' => __( 'Theme', 'code-snippets' ),
122
- 'type' => 'codemirror_theme_select',
123
- 'default' => 'default',
124
  'codemirror' => 'theme',
125
  ),
126
 
127
  'indent_with_tabs' => array(
128
- 'name' => __( 'Indent With Tabs', 'code-snippets' ),
129
- 'type' => 'checkbox',
130
- 'label' => __( 'Use hard tabs (not spaces) for indentation.', 'code-snippets' ),
131
- 'default' => true,
132
  'codemirror' => 'indentWithTabs',
133
  ),
134
 
135
  'tab_size' => array(
136
- 'name' => __( 'Tab Size', 'code-snippets' ),
137
- 'type' => 'number',
138
- 'desc' => __( 'The width of a tab character.', 'code-snippets' ),
139
- 'default' => 4,
140
  'codemirror' => 'tabSize',
141
- 'min' => 0,
142
  ),
143
 
144
  'indent_unit' => array(
145
- 'name' => __( 'Indent Unit', 'code-snippets' ),
146
- 'type' => 'number',
147
- 'desc' => __( 'How many spaces a block should be indented.', 'code-snippets' ),
148
- 'default' => 2,
149
  'codemirror' => 'indentUnit',
150
- 'min' => 0,
151
  ),
152
 
153
  'wrap_lines' => array(
154
- 'name' => __( 'Wrap Lines', 'code-snippets' ),
155
- 'type' => 'checkbox',
156
- 'label' => __( 'Whether the editor should scroll or wrap for long lines.', 'code-snippets' ),
157
- 'default' => true,
158
  'codemirror' => 'lineWrapping',
159
  ),
160
 
161
  'line_numbers' => array(
162
- 'name' => __( 'Line Numbers', 'code-snippets' ),
163
- 'type' => 'checkbox',
164
- 'label' => __( 'Show line numbers to the left of the editor.', 'code-snippets' ),
165
- 'default' => true,
166
  'codemirror' => 'lineNumbers',
167
  ),
168
 
169
  'auto_close_brackets' => array(
170
- 'name' => __( 'Auto Close Brackets', 'code-snippets' ),
171
- 'type' => 'checkbox',
172
- 'label' => __( 'Auto-close brackets and quotes when typed.', 'code-snippets' ),
173
- 'default' => true,
174
  'codemirror' => 'autoCloseBrackets',
175
  ),
176
 
177
  'highlight_selection_matches' => array(
178
- 'name' => __( 'Highlight Selection Matches', 'code-snippets' ),
179
- 'label' => __( 'Highlight all instances of a currently selected word.', 'code-snippets' ),
180
- 'type' => 'checkbox',
181
- 'default' => true,
182
  'codemirror' => 'highlightSelectionMatches',
183
  ),
184
  );
185
 
186
  $fields = apply_filters( 'code_snippets_settings_fields', $fields );
 
187
  return $fields;
188
  }
39
 
40
  $fields['general'] = array(
41
  'activate_by_default' => array(
42
+ 'name' => __( 'Activate by Default', 'code-snippets' ),
43
+ 'type' => 'checkbox',
44
+ 'label' => __( "Make the 'Save and Activate' button the default action when saving a snippet.", 'code-snippets' ),
45
  'default' => true,
46
  ),
47
 
48
  'snippet_scope_enabled' => array(
49
+ 'name' => __( 'Enable Scope Selector', 'code-snippets' ),
50
+ 'type' => 'checkbox',
51
+ 'label' => __( 'Enable the scope selector when editing a snippet', 'code-snippets' ),
52
  'default' => true,
53
  ),
54
 
55
  'enable_tags' => array(
56
+ 'name' => __( 'Enable Snippet Tags', 'code-snippets' ),
57
+ 'type' => 'checkbox',
58
+ 'label' => __( 'Show snippet tags on admin pages', 'code-snippets' ),
59
  'default' => true,
60
  ),
61
 
62
  'enable_description' => array(
63
+ 'name' => __( 'Enable Snippet Descriptions', 'code-snippets' ),
64
+ 'type' => 'checkbox',
65
+ 'label' => __( 'Show snippet descriptions on admin pages', 'code-snippets' ),
66
  'default' => true,
67
  ),
68
 
69
  'disable_prism' => array(
70
+ 'name' => __( 'Disable Shortcode Syntax Highlighter', 'code-snippets' ),
71
+ 'type' => 'checkbox',
72
+ 'label' => __( 'Disable the syntax highlighting for the [code_snippet] shortcode on the front-end', 'code-snippets' ),
73
  'default' => false,
74
  ),
75
 
76
  'complete_uninstall' => array(
77
+ 'name' => __( 'Complete Uninstall', 'code-snippets' ),
78
+ 'type' => 'checkbox',
79
+ 'label' => sprintf(
80
+ /* translators: %s: URL for Plugins admin menu */
81
  __( 'When the plugin is deleted from the <a href="%s">Plugins</a> menu, also delete all snippets and plugin settings.', 'code-snippets' ),
82
  self_admin_url( 'plugins.php' )
83
  ),
93
  $fields['description_editor'] = array(
94
 
95
  'rows' => array(
96
+ 'name' => __( 'Row Height', 'code-snippets' ),
97
+ 'type' => 'number',
98
+ 'label' => __( 'rows', 'code-snippets' ),
99
  'default' => 5,
100
+ 'min' => 0,
101
  ),
102
 
103
  'use_full_mce' => array(
104
+ 'name' => __( 'Use Full Editor', 'code-snippets' ),
105
+ 'type' => 'checkbox',
106
+ 'label' => __( 'Enable all features of the visual editor', 'code-snippets' ),
107
  'default' => false,
108
  ),
109
 
110
  'media_buttons' => array(
111
+ 'name' => __( 'Media Buttons', 'code-snippets' ),
112
+ 'type' => 'checkbox',
113
+ 'label' => __( 'Enable the add media buttons', 'code-snippets' ),
114
  'default' => false,
115
  ),
116
  );
119
 
120
  $fields['editor'] = array(
121
  'theme' => array(
122
+ 'name' => __( 'Theme', 'code-snippets' ),
123
+ 'type' => 'codemirror_theme_select',
124
+ 'default' => 'default',
125
  'codemirror' => 'theme',
126
  ),
127
 
128
  'indent_with_tabs' => array(
129
+ 'name' => __( 'Indent With Tabs', 'code-snippets' ),
130
+ 'type' => 'checkbox',
131
+ 'label' => __( 'Use hard tabs (not spaces) for indentation.', 'code-snippets' ),
132
+ 'default' => true,
133
  'codemirror' => 'indentWithTabs',
134
  ),
135
 
136
  'tab_size' => array(
137
+ 'name' => __( 'Tab Size', 'code-snippets' ),
138
+ 'type' => 'number',
139
+ 'desc' => __( 'The width of a tab character.', 'code-snippets' ),
140
+ 'default' => 4,
141
  'codemirror' => 'tabSize',
142
+ 'min' => 0,
143
  ),
144
 
145
  'indent_unit' => array(
146
+ 'name' => __( 'Indent Unit', 'code-snippets' ),
147
+ 'type' => 'number',
148
+ 'desc' => __( 'How many spaces a block should be indented.', 'code-snippets' ),
149
+ 'default' => 2,
150
  'codemirror' => 'indentUnit',
151
+ 'min' => 0,
152
  ),
153
 
154
  'wrap_lines' => array(
155
+ 'name' => __( 'Wrap Lines', 'code-snippets' ),
156
+ 'type' => 'checkbox',
157
+ 'label' => __( 'Whether the editor should scroll or wrap for long lines.', 'code-snippets' ),
158
+ 'default' => true,
159
  'codemirror' => 'lineWrapping',
160
  ),
161
 
162
  'line_numbers' => array(
163
+ 'name' => __( 'Line Numbers', 'code-snippets' ),
164
+ 'type' => 'checkbox',
165
+ 'label' => __( 'Show line numbers to the left of the editor.', 'code-snippets' ),
166
+ 'default' => true,
167
  'codemirror' => 'lineNumbers',
168
  ),
169
 
170
  'auto_close_brackets' => array(
171
+ 'name' => __( 'Auto Close Brackets', 'code-snippets' ),
172
+ 'type' => 'checkbox',
173
+ 'label' => __( 'Auto-close brackets and quotes when typed.', 'code-snippets' ),
174
+ 'default' => true,
175
  'codemirror' => 'autoCloseBrackets',
176
  ),
177
 
178
  'highlight_selection_matches' => array(
179
+ 'name' => __( 'Highlight Selection Matches', 'code-snippets' ),
180
+ 'label' => __( 'Highlight all instances of a currently selected word.', 'code-snippets' ),
181
+ 'type' => 'checkbox',
182
+ 'default' => true,
183
  'codemirror' => 'highlightSelectionMatches',
184
  ),
185
  );
186
 
187
  $fields = apply_filters( 'code_snippets_settings_fields', $fields );
188
+
189
  return $fields;
190
  }
php/settings/settings.php CHANGED
@@ -21,6 +21,7 @@ function code_snippets_unified_settings() {
21
  }
22
 
23
  $menu_perms = get_site_option( 'menu_items', array() );
 
24
  return empty( $menu_perms['snippets_settings'] );
25
  }
26
 
@@ -64,6 +65,7 @@ function code_snippets_get_settings() {
64
  }
65
 
66
  wp_cache_set( 'code_snippets_settings', $settings );
 
67
  return $settings;
68
  }
69
 
@@ -71,11 +73,13 @@ function code_snippets_get_settings() {
71
  * Retrieve an individual setting field value
72
  *
73
  * @param string $section The ID of the section the setting belongs to
74
- * @param string $field The ID of the setting field
 
75
  * @return array
76
  */
77
  function code_snippets_get_setting( $section, $field ) {
78
  $settings = code_snippets_get_settings();
 
79
  return $settings[ $section ][ $field ];
80
  }
81
 
@@ -85,9 +89,9 @@ function code_snippets_get_setting( $section, $field ) {
85
  */
86
  function code_snippets_get_settings_sections() {
87
  $sections = array(
88
- 'general' => __( 'General', 'code-snippets' ),
89
  'description_editor' => __( 'Description Editor', 'code-snippets' ),
90
- 'editor' => __( 'Code Editor', 'code-snippets' ),
91
  );
92
 
93
  return apply_filters( 'code_snippets_settings_sections', $sections );
@@ -157,6 +161,7 @@ add_action( 'admin_init', 'code_snippets_register_settings' );
157
  * Validate the settings
158
  *
159
  * @param array $input The sent settings
 
160
  * @return array The validated settings
161
  */
162
  function code_snippets_settings_validate( array $input ) {
21
  }
22
 
23
  $menu_perms = get_site_option( 'menu_items', array() );
24
+
25
  return empty( $menu_perms['snippets_settings'] );
26
  }
27
 
65
  }
66
 
67
  wp_cache_set( 'code_snippets_settings', $settings );
68
+
69
  return $settings;
70
  }
71
 
73
  * Retrieve an individual setting field value
74
  *
75
  * @param string $section The ID of the section the setting belongs to
76
+ * @param string $field The ID of the setting field
77
+ *
78
  * @return array
79
  */
80
  function code_snippets_get_setting( $section, $field ) {
81
  $settings = code_snippets_get_settings();
82
+
83
  return $settings[ $section ][ $field ];
84
  }
85
 
89
  */
90
  function code_snippets_get_settings_sections() {
91
  $sections = array(
92
+ 'general' => __( 'General', 'code-snippets' ),
93
  'description_editor' => __( 'Description Editor', 'code-snippets' ),
94
+ 'editor' => __( 'Code Editor', 'code-snippets' ),
95
  );
96
 
97
  return apply_filters( 'code_snippets_settings_sections', $sections );
161
  * Validate the settings
162
  *
163
  * @param array $input The sent settings
164
+ *
165
  * @return array The validated settings
166
  */
167
  function code_snippets_settings_validate( array $input ) {
php/snippet-ops.php CHANGED
@@ -159,7 +159,8 @@ function get_snippet( $id = 0, $multisite = null ) {
159
  function activate_snippet( $id, $multisite = null ) {
160
  /** @var wpdb $wpdb */
161
  global $wpdb;
162
- $table = code_snippets()->db->get_table_name( $multisite );
 
163
 
164
  $wpdb->update(
165
  $table,
@@ -170,7 +171,7 @@ function activate_snippet( $id, $multisite = null ) {
170
  );
171
 
172
  /* Remove snippet from shared network snippet list if it was Network Activated */
173
- if ( $table == $wpdb->ms_snippets && $shared_network_snippets = get_site_option( 'shared_network_snippets', false ) ) {
174
  $shared_network_snippets = array_diff( $shared_network_snippets, array( $id ) );
175
  update_site_option( 'shared_network_snippets', $shared_network_snippets );
176
  }
@@ -191,7 +192,8 @@ function activate_snippet( $id, $multisite = null ) {
191
  function deactivate_snippet( $id, $multisite = null ) {
192
  /** @var wpdb $wpdb */
193
  global $wpdb;
194
- $table = code_snippets()->db->get_table_name( $multisite );
 
195
 
196
  /* Set the snippet to active */
197
 
@@ -207,13 +209,13 @@ function deactivate_snippet( $id, $multisite = null ) {
207
 
208
  $recently_active = array( $id => time() );
209
 
210
- if ( $table === $wpdb->ms_snippets ) {
211
 
212
  update_site_option(
213
  'recently_activated_snippets',
214
  $recently_active + (array) get_site_option( 'recently_activated_snippets' )
215
  );
216
- } elseif ( $table === $wpdb->snippets ) {
217
 
218
  update_option(
219
  'recently_activated_snippets',
@@ -376,6 +378,7 @@ function execute_active_snippets() {
376
 
377
  /** @var wpdb $wpdb */
378
  global $wpdb;
 
379
 
380
  $current_scope = is_admin() ? 'admin' : 'front-end';
381
  $queries = array();
@@ -384,12 +387,12 @@ function execute_active_snippets() {
384
  $order = 'ORDER BY priority ASC, id ASC';
385
 
386
  /* Fetch snippets from site table */
387
- if ( $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->snippets'" ) === $wpdb->snippets ) {
388
- $queries[ $wpdb->snippets ] = $wpdb->prepare( sprintf( $sql_format, $wpdb->snippets ) . 'AND active=1 ' . $order, $current_scope );
389
  }
390
 
391
  /* Fetch snippets from the network table */
392
- if ( is_multisite() && $wpdb->get_var( "SHOW TABLES LIKE '$wpdb->ms_snippets'" ) === $wpdb->ms_snippets ) {
393
  $active_shared_ids = get_option( 'active_shared_network_snippets', array() );
394
 
395
  /* If there are active shared snippets, include them in the query */
@@ -399,15 +402,15 @@ function execute_active_snippets() {
399
  $active_shared_ids_format = implode( ',', array_fill( 0, count( $active_shared_ids ), '%d' ) );
400
 
401
  /* Include them in the query */
402
- $sql = sprintf( $sql_format, $wpdb->ms_snippets ) . " AND (active=1 OR id IN ($active_shared_ids_format)) $order";
403
 
404
  /* Add the scope number to the IDs array, so that it is the first variable in the query */
405
  array_unshift( $active_shared_ids, $current_scope );
406
- $queries[ $wpdb->ms_snippets ] = $wpdb->prepare( $sql, $active_shared_ids );
407
 
408
  } else {
409
- $sql = sprintf( $sql_format, $wpdb->ms_snippets ) . 'AND active=1 ' . $order;
410
- $queries[ $wpdb->ms_snippets ] = $wpdb->prepare( $sql, $current_scope );
411
  }
412
  }
413
 
159
  function activate_snippet( $id, $multisite = null ) {
160
  /** @var wpdb $wpdb */
161
  global $wpdb;
162
+ $db = code_snippets()->db;
163
+ $table = $db->get_table_name( $multisite );
164
 
165
  $wpdb->update(
166
  $table,
171
  );
172
 
173
  /* Remove snippet from shared network snippet list if it was Network Activated */
174
+ if ( $table === $db && $shared_network_snippets = get_site_option( 'shared_network_snippets', false ) ) {
175
  $shared_network_snippets = array_diff( $shared_network_snippets, array( $id ) );
176
  update_site_option( 'shared_network_snippets', $shared_network_snippets );
177
  }
192
  function deactivate_snippet( $id, $multisite = null ) {
193
  /** @var wpdb $wpdb */
194
  global $wpdb;
195
+ $db = code_snippets()->db;
196
+ $table = $db->get_table_name( $multisite );
197
 
198
  /* Set the snippet to active */
199
 
209
 
210
  $recently_active = array( $id => time() );
211
 
212
+ if ( $table === $db->table ) {
213
 
214
  update_site_option(
215
  'recently_activated_snippets',
216
  $recently_active + (array) get_site_option( 'recently_activated_snippets' )
217
  );
218
+ } elseif ( $table === $db->ms_table ) {
219
 
220
  update_option(
221
  'recently_activated_snippets',
378
 
379
  /** @var wpdb $wpdb */
380
  global $wpdb;
381
+ $db = code_snippets()->db;
382
 
383
  $current_scope = is_admin() ? 'admin' : 'front-end';
384
  $queries = array();
387
  $order = 'ORDER BY priority ASC, id ASC';
388
 
389
  /* Fetch snippets from site table */
390
+ if ( $wpdb->get_var( "SHOW TABLES LIKE '$db->table'" ) === $db->table ) {
391
+ $queries[ $db->table ] = $wpdb->prepare( sprintf( $sql_format, $db->table ) . 'AND active=1 ' . $order, $current_scope );
392
  }
393
 
394
  /* Fetch snippets from the network table */
395
+ if ( is_multisite() && $wpdb->get_var( "SHOW TABLES LIKE '$db->ms_table'" ) === $db->ms_table ) {
396
  $active_shared_ids = get_option( 'active_shared_network_snippets', array() );
397
 
398
  /* If there are active shared snippets, include them in the query */
402
  $active_shared_ids_format = implode( ',', array_fill( 0, count( $active_shared_ids ), '%d' ) );
403
 
404
  /* Include them in the query */
405
+ $sql = sprintf( $sql_format, $db->ms_table ) . " AND (active=1 OR id IN ($active_shared_ids_format)) $order";
406
 
407
  /* Add the scope number to the IDs array, so that it is the first variable in the query */
408
  array_unshift( $active_shared_ids, $current_scope );
409
+ $queries[ $db->ms_table ] = $wpdb->prepare( $sql, $active_shared_ids );
410
 
411
  } else {
412
+ $sql = sprintf( $sql_format, $db->ms_table ) . 'AND active=1 ' . $order;
413
+ $queries[ $db->ms_table ] = $wpdb->prepare( $sql, $current_scope );
414
  }
415
  }
416
 
php/upgrade.php DELETED
@@ -1,83 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * This file manages upgrades to the database between plugin versions
5
- */
6
-
7
- /* Bail on direct access */
8
- if ( ! defined( 'ABSPATH' ) ) {
9
- return;
10
- }
11
-
12
- /**
13
- * Preform upgrade tasks such as deleting and updating options
14
- * @since 2.0
15
- */
16
- function code_snippets_upgrader() {
17
- global $wpdb;
18
- $db = code_snippets()->db;
19
-
20
- /* Get the current plugin version from the database */
21
- $prev_version = get_option( 'code_snippets_version' );
22
-
23
- /* Check if we have upgraded from an older version */
24
- if ( version_compare( $prev_version, CODE_SNIPPETS_VERSION, '<' ) ) {
25
-
26
- /* Upgrade the database tables */
27
- $db->create_tables( true );
28
-
29
- /* Update the plugin version stored in the database */
30
- update_option( 'code_snippets_version', CODE_SNIPPETS_VERSION );
31
-
32
- /* Update the scope column of the database */
33
- if ( version_compare( $prev_version, '2.10.0', '<' ) ) {
34
- $wpdb->query( "UPDATE {$wpdb->snippets} SET scope = 'global' WHERE scope = 0" );
35
- $wpdb->query( "UPDATE {$wpdb->snippets} SET scope = 'admin' WHERE scope = 1" );
36
- $wpdb->query( "UPDATE {$wpdb->snippets} SET scope = 'front-end' WHERE scope = 2" );
37
- }
38
-
39
- /* Custom capabilities were removed after version 2.9.5 */
40
- if ( version_compare( $prev_version, '2.9.5', '<=' ) ) {
41
- $role = get_role( apply_filters( 'code_snippets_role', 'administrator' ) );
42
- $role->remove_cap( apply_filters( 'code_snippets_cap', 'manage_snippets' ) );
43
- }
44
- }
45
-
46
- if ( false === $prev_version ) {
47
- $db->create_sample_content();
48
- }
49
-
50
- /* Run multisite-only upgrades */
51
-
52
- if ( is_multisite() && is_main_site() ) {
53
-
54
- /* Get the current plugin version from the database */
55
- $prev_ms_version = get_site_option( 'code_snippets_version' );
56
-
57
- /* Check if we have upgraded from an older version */
58
- if ( version_compare( $prev_ms_version, CODE_SNIPPETS_VERSION, '<' ) ) {
59
-
60
- /* Update the plugin version stored in the database */
61
- update_site_option( 'code_snippets_version', CODE_SNIPPETS_VERSION );
62
-
63
- /* Update the scope column of the database */
64
- if ( version_compare( $prev_version, '2.10.0', '<' ) ) {
65
- $wpdb->query( "UPDATE {$wpdb->ms_snippets} SET scope = 'global' WHERE scope = 0" );
66
- $wpdb->query( "UPDATE {$wpdb->ms_snippets} SET scope = 'admin' WHERE scope = 1" );
67
- $wpdb->query( "UPDATE {$wpdb->ms_snippets} SET scope = 'front-end' WHERE scope = 2" );
68
- }
69
-
70
- /* Custom capabilities were removed after version 2.9.5 */
71
- if ( version_compare( $prev_ms_version, '2.9.5', '<=' ) ) {
72
- $network_cap = apply_filters( 'code_snippets_network_cap', 'manage_network_snippets' );
73
-
74
- foreach ( get_super_admins() as $admin ) {
75
- $user = new WP_User( 0, $admin );
76
- $user->remove_cap( $network_cap );
77
- }
78
- }
79
- }
80
- }
81
- }
82
-
83
- add_action( 'plugins_loaded', 'code_snippets_upgrader', 0 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
php/views/edit.php CHANGED
@@ -27,16 +27,17 @@ if ( $edit_id ) {
27
  ?>
28
  <div class="wrap">
29
  <h1><?php
30
- if ( $edit_id ) {
31
- esc_html_e( 'Edit Snippet', 'code-snippets' );
32
- printf( ' <a href="%1$s" class="page-title-action add-new-h2">%2$s</a>',
33
- code_snippets()->get_menu_url( 'add' ),
34
- esc_html_x( 'Add New', 'snippet', 'code-snippets' )
35
- );
36
- } else {
37
- esc_html_e( 'Add New Snippet', 'code-snippets' );
38
- }
39
- ?></h1>
 
40
 
41
  <form method="post" id="snippet-form" action="" style="margin-top: 10px;" class="<?php echo implode( ' ', $classes ); ?>">
42
  <?php
@@ -56,9 +57,11 @@ if ( $edit_id ) {
56
  </div>
57
  </div>
58
 
59
- <h2><label for="snippet_code">
60
- <?php _e( 'Code', 'code-snippets' ); ?>
61
- </label></h2>
 
 
62
 
63
  <textarea id="snippet_code" name="snippet_code" rows="200" spellcheck="false" style="font-family: monospace; width: 100%;"><?php
64
  echo esc_textarea( $snippet->code );
@@ -154,12 +157,12 @@ if ( $edit_id ) {
154
  <script>
155
  'use strict';
156
  /* Loads CodeMirror on the snippet editor */
157
- var code_snippet_editor = (function() {
158
 
159
  var atts = [];
160
  atts = <?php
161
- $atts = array( 'mode' => 'text/x-php' );
162
- echo code_snippets_get_editor_atts( $atts, true );
163
  ?>;
164
  atts['viewportMargin'] = Infinity;
165
 
@@ -175,7 +178,10 @@ if ( $edit_id ) {
175
  var matches = window.location.href.match(/[?&]cursor=(\d+)_(\d+)/);
176
  if (matches) {
177
  editor.focus();
178
- editor.setCursor({line: matches[1], ch: matches[2]});
 
 
 
179
  }
180
 
181
  // send the current cursor position to the next page
27
  ?>
28
  <div class="wrap">
29
  <h1><?php
30
+
31
+ if ( $edit_id ) {
32
+ esc_html_e( 'Edit Snippet', 'code-snippets' );
33
+ printf( ' <a href="%1$s" class="page-title-action add-new-h2">%2$s</a>',
34
+ code_snippets()->get_menu_url( 'add' ),
35
+ esc_html_x( 'Add New', 'snippet', 'code-snippets' )
36
+ );
37
+ } else {
38
+ esc_html_e( 'Add New Snippet', 'code-snippets' );
39
+ }
40
+ ?></h1>
41
 
42
  <form method="post" id="snippet-form" action="" style="margin-top: 10px;" class="<?php echo implode( ' ', $classes ); ?>">
43
  <?php
57
  </div>
58
  </div>
59
 
60
+ <h2>
61
+ <label for="snippet_code">
62
+ <?php _e( 'Code', 'code-snippets' ); ?>
63
+ </label>
64
+ </h2>
65
 
66
  <textarea id="snippet_code" name="snippet_code" rows="200" spellcheck="false" style="font-family: monospace; width: 100%;"><?php
67
  echo esc_textarea( $snippet->code );
157
  <script>
158
  'use strict';
159
  /* Loads CodeMirror on the snippet editor */
160
+ var code_snippet_editor = (function () {
161
 
162
  var atts = [];
163
  atts = <?php
164
+ $atts = array( 'mode' => 'text/x-php' );
165
+ echo code_snippets_get_editor_atts( $atts, true );
166
  ?>;
167
  atts['viewportMargin'] = Infinity;
168
 
178
  var matches = window.location.href.match(/[?&]cursor=(\d+)_(\d+)/);
179
  if (matches) {
180
  editor.focus();
181
+ editor.setCursor({
182
+ line: matches[1],
183
+ ch: matches[2]
184
+ });
185
  }
186
 
187
  // send the current cursor position to the next page
php/views/import.php CHANGED
@@ -13,8 +13,6 @@ if ( ! defined( 'ABSPATH' ) ) {
13
  }
14
 
15
  $max_size_bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
16
- $upload_dir = wp_upload_dir();
17
-
18
 
19
  ?>
20
  <div class="wrap">
@@ -26,20 +24,11 @@ $upload_dir = wp_upload_dir();
26
 
27
  <p><?php
28
  printf(
 
29
  __( 'Afterwards, you will need to visit the <a href="%s">All Snippets</a> page to activate the imported snippets.', 'code-snippets' ),
30
  code_snippets()->get_menu_url( 'manage' )
31
  ); ?></p>
32
 
33
- <?php if ( ! empty( $upload_dir['error'] ) ) : ?>
34
-
35
- <div class="error">
36
- <p><?php _e( 'Before you can upload your import file, you will need to fix the following error:' ); ?></p>
37
- <p>
38
- <strong><?php echo $upload_dir['error']; ?></strong>
39
- </p>
40
- </div>
41
-
42
- <?php else : ?>
43
 
44
  <form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form" name="code_snippets_import">
45
 
@@ -81,7 +70,11 @@ $upload_dir = wp_upload_dir();
81
  <fieldset>
82
  <p>
83
  <label for="upload"><?php esc_html_e( 'Choose files from your computer:', 'code-snippets' ); ?></label>
84
- <?php printf( esc_html__( '(Maximum size: %s)', 'code-snippets' ), size_format( $max_size_bytes ) ); ?>
 
 
 
 
85
  <input type="file" id="upload" name="code_snippets_import_files[]" size="25" accept="application/json,.json,text/xml" multiple="multiple">
86
  <input type="hidden" name="action" value="save">
87
  <input type="hidden" name="max_file_size" value="<?php echo esc_attr( $max_size_bytes ); ?>">
@@ -93,6 +86,5 @@ $upload_dir = wp_upload_dir();
93
  submit_button( __( 'Upload files and import', 'code-snippets' ) );
94
  ?>
95
  </form>
96
- <?php endif; ?>
97
  </div>
98
  </div>
13
  }
14
 
15
  $max_size_bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
 
 
16
 
17
  ?>
18
  <div class="wrap">
24
 
25
  <p><?php
26
  printf(
27
+ /* translators: %s: link to snippets admin menu */
28
  __( 'Afterwards, you will need to visit the <a href="%s">All Snippets</a> page to activate the imported snippets.', 'code-snippets' ),
29
  code_snippets()->get_menu_url( 'manage' )
30
  ); ?></p>
31
 
 
 
 
 
 
 
 
 
 
 
32
 
33
  <form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form" name="code_snippets_import">
34
 
70
  <fieldset>
71
  <p>
72
  <label for="upload"><?php esc_html_e( 'Choose files from your computer:', 'code-snippets' ); ?></label>
73
+ <?php printf(
74
+ /* translators: %s: size in bytes */
75
+ esc_html__( '(Maximum size: %s)', 'code-snippets' ),
76
+ size_format( $max_size_bytes )
77
+ ); ?>
78
  <input type="file" id="upload" name="code_snippets_import_files[]" size="25" accept="application/json,.json,text/xml" multiple="multiple">
79
  <input type="hidden" name="action" value="save">
80
  <input type="hidden" name="max_file_size" value="<?php echo esc_attr( $max_size_bytes ); ?>">
86
  submit_button( __( 'Upload files and import', 'code-snippets' ) );
87
  ?>
88
  </form>
 
89
  </div>
90
  </div>
php/views/manage.php CHANGED
@@ -31,22 +31,22 @@ if ( ! defined( 'ABSPATH' ) ) {
31
  );
32
 
33
  $this->list_table->search_notice();
34
- ?></h1>
35
 
36
  <?php $this->list_table->views(); ?>
37
 
38
  <form method="get" action="">
39
  <?php
40
- $this->list_table->required_form_fields( 'search_box' );
41
- $this->list_table->search_box( __( 'Search Installed Snippets', 'code-snippets' ), 'search_id' );
42
  ?>
43
  </form>
44
  <form method="post" action="">
45
  <input type="hidden" id="code_snippets_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'code_snippets_manage' ) ); ?>">
46
 
47
  <?php
48
- $this->list_table->required_form_fields();
49
- $this->list_table->display();
50
  ?>
51
  </form>
52
 
31
  );
32
 
33
  $this->list_table->search_notice();
34
+ ?></h1>
35
 
36
  <?php $this->list_table->views(); ?>
37
 
38
  <form method="get" action="">
39
  <?php
40
+ $this->list_table->required_form_fields( 'search_box' );
41
+ $this->list_table->search_box( __( 'Search Installed Snippets', 'code-snippets' ), 'search_id' );
42
  ?>
43
  </form>
44
  <form method="post" action="">
45
  <input type="hidden" id="code_snippets_ajax_nonce" value="<?php echo esc_attr( wp_create_nonce( 'code_snippets_manage' ) ); ?>">
46
 
47
  <?php
48
+ $this->list_table->required_form_fields();
49
+ $this->list_table->display();
50
  ?>
51
  </form>
52
 
readme.txt CHANGED
@@ -3,9 +3,9 @@ Contributors: bungeshea
3
  Donate link: https://bungeshea.com/donate
4
  Tags: code-snippets, snippets, code, php, network, multisite
5
  Requires at least: 3.6
6
- Tested up to: 4.9.8
7
  Requires PHP: 5.2
8
- Stable tag: 2.12.0
9
  License: MIT
10
  License URI: license.txt
11
 
@@ -19,9 +19,13 @@ A snippet is a small chunk of PHP code that you can use to extend the functional
19
  Most snippet-hosting sites tell you to add snippet code to your active theme's `functions.php` file, which can get rather long and messy after a while.
20
  Code Snippets changes that by providing a GUI interface for adding snippets and **actually running them on your site** just as if they were in your theme's `functions.php` file.
21
 
22
- Code Snippets provides graphical interface, similar to the Plugins menu, for managing snippets. Snippets can can be activated and deactivated, just like plugins. The snippet editor includes fields for a name, a visual editor-enabled description, tags to allow you to categorize snippets, and a full-featured code editor. Snippets can be exported for transfer to another side, either in XML for later importing by the Code Snippets plugin, or in PHP for creating your own plugin or theme
23
 
24
- If you have any feedback, issues, or suggestions for improvements please leave a topic in the [Support Forum](http://wordpress.org/support/plugin/code-snippets). If you like this plugin, or it is useful to you in any way, please review it on [WordPress.org](http://wordpress.org/support/view/plugin-reviews/code-snippets). If you'd like to contribute to the plugin's code or translate it into another language, please [fork the plugin on GitHub](https://github.com/sheabunge/code-snippets).
 
 
 
 
25
 
26
  = Translations =
27
 
@@ -109,10 +113,18 @@ That's fantastic! Fork the [repository on GitHub](http://github.com/sheabunge/co
109
  1. Managing existing snippets
110
  2. Adding a new snippet
111
  3. Editing a snippet
112
- 4. Importing snippets from an XML file
113
 
114
  == Changelog ==
115
 
 
 
 
 
 
 
 
 
116
  = 2.12.0 (23 Sep 2018) =
117
  * Fixed: Prevented hidden columns setting from reverting to default
118
  * Improved: Updated import page to improve usability
3
  Donate link: https://bungeshea.com/donate
4
  Tags: code-snippets, snippets, code, php, network, multisite
5
  Requires at least: 3.6
6
+ Tested up to: 5.0
7
  Requires PHP: 5.2
8
+ Stable tag: 2.12.1
9
  License: MIT
10
  License URI: license.txt
11
 
19
  Most snippet-hosting sites tell you to add snippet code to your active theme's `functions.php` file, which can get rather long and messy after a while.
20
  Code Snippets changes that by providing a GUI interface for adding snippets and **actually running them on your site** just as if they were in your theme's `functions.php` file.
21
 
22
+ Code Snippets provides graphical interface, similar to the Plugins menu, for managing snippets. Snippets can can be activated and deactivated, just like plugins. The snippet editor includes fields for a name, a visual editor-enabled description, tags to allow you to categorize snippets, and a full-featured code editor. Snippets can be exported for transfer to another side, either in JSON for later importing by the Code Snippets plugin, or in PHP for creating your own plugin or theme.
23
 
24
+ If you have any feedback, issues, or suggestions for improvements please leave a topic in the [Support Forum](http://wordpress.org/support/plugin/code-snippets), or [join the community on Facebook](https://facebook.com/groups/codesnippetsplugin).
25
+
26
+ If you like this plugin, or it is useful to you in some way, please consider reviewing it on [WordPress.org](http://wordpress.org/support/view/plugin-reviews/code-snippets).
27
+
28
+ If you'd like to contribute to the plugin's code or translate it into another language, you can [fork the plugin on GitHub](https://github.com/sheabunge/code-snippets).
29
 
30
  = Translations =
31
 
113
  1. Managing existing snippets
114
  2. Adding a new snippet
115
  3. Editing a snippet
116
+ 4. Importing snippets from an export file
117
 
118
  == Changelog ==
119
 
120
+ = 2.12.1 (15 Nov 2018) =
121
+ * Improved: CodeMirror updated to version 5.41.0
122
+ * Improved: Attempt to create database columns that might be missing after a table upgrade
123
+ * Improved: Streamlined upgrade process
124
+ * Fixed: Interface layout on sites using right-to-left languages
125
+ * Improved: Made search box appear at top of page on mobile [[#](https://wordpress.org/support/topic/small-modification-for-mobile-ux/)]
126
+ * Updated screenshots
127
+
128
  = 2.12.0 (23 Sep 2018) =
129
  * Fixed: Prevented hidden columns setting from reverting to default
130
  * Improved: Updated import page to improve usability
uninstall.php CHANGED
@@ -33,7 +33,7 @@ function code_snippets_uninstall_site() {
33
  global $wpdb;
34
 
35
  /* Remove snippets database table */
36
- $wpdb->query( "DROP TABLE IF EXISTS $wpdb->snippets" );
37
 
38
  /* Remove saved options */
39
  delete_option( 'code_snippets_version' );
@@ -44,15 +44,12 @@ function code_snippets_uninstall_site() {
44
 
45
  global $wpdb;
46
 
47
- $wpdb->snippets = $wpdb->prefix . 'snippets';
48
- $wpdb->ms_snippets = $wpdb->prefix . 'ms_snippets';
49
-
50
  /* Multisite uninstall */
51
 
52
  if ( is_multisite() ) {
53
 
54
  /* Loop through sites */
55
- $blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
56
 
57
  if ( $blog_ids ) {
58
 
@@ -65,7 +62,7 @@ if ( is_multisite() ) {
65
  }
66
 
67
  /* Remove multisite snippets database table */
68
- $wpdb->query( "DROP TABLE IF EXISTS $wpdb->ms_snippets" );
69
 
70
  /* Remove saved options */
71
  delete_site_option( 'code_snippets_version' );
33
  global $wpdb;
34
 
35
  /* Remove snippets database table */
36
+ $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}snippets" );
37
 
38
  /* Remove saved options */
39
  delete_option( 'code_snippets_version' );
44
 
45
  global $wpdb;
46
 
 
 
 
47
  /* Multisite uninstall */
48
 
49
  if ( is_multisite() ) {
50
 
51
  /* Loop through sites */
52
+ $blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
53
 
54
  if ( $blog_ids ) {
55
 
62
  }
63
 
64
  /* Remove multisite snippets database table */
65
+ $wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}ms_snippets" );
66
 
67
  /* Remove saved options */
68
  delete_site_option( 'code_snippets_version' );