oculus 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.travis.yml +7 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +34 -0
- data/Rakefile +18 -0
- data/TODO.md +12 -0
- data/bin/oculus +32 -0
- data/features/query.feature +26 -0
- data/features/step_definitions/query_steps.rb +35 -0
- data/features/support/env.rb +22 -0
- data/lib/oculus/connection/mysql2.rb +22 -0
- data/lib/oculus/connection.rb +7 -0
- data/lib/oculus/presenters/query_presenter.rb +40 -0
- data/lib/oculus/presenters.rb +1 -0
- data/lib/oculus/query.rb +61 -0
- data/lib/oculus/server/public/css/bootstrap.min.css +689 -0
- data/lib/oculus/server/public/css/codemirror.css +112 -0
- data/lib/oculus/server/public/css/reset.css +47 -0
- data/lib/oculus/server/public/css/style.css +107 -0
- data/lib/oculus/server/public/img/glyphicons-halflings-white.png +0 -0
- data/lib/oculus/server/public/img/glyphicons-halflings.png +0 -0
- data/lib/oculus/server/public/js/application.js +160 -0
- data/lib/oculus/server/public/js/bootstrap.min.js +6 -0
- data/lib/oculus/server/public/js/codemirror.min.js +1 -0
- data/lib/oculus/server/public/js/jquery.min.js +4 -0
- data/lib/oculus/server/public/js/spin.min.js +2 -0
- data/lib/oculus/server/views/history.erb +35 -0
- data/lib/oculus/server/views/index.erb +97 -0
- data/lib/oculus/server/views/layout.erb +37 -0
- data/lib/oculus/server/views/show.erb +59 -0
- data/lib/oculus/server.rb +88 -0
- data/lib/oculus/storage/file_store.rb +129 -0
- data/lib/oculus/storage.rb +7 -0
- data/lib/oculus/version.rb +3 -0
- data/lib/oculus.rb +29 -0
- data/oculus.gemspec +26 -0
- data/spec/connection_spec.rb +61 -0
- data/spec/file_store_spec.rb +111 -0
- data/spec/query_presenter_spec.rb +54 -0
- data/spec/query_spec.rb +107 -0
- metadata +173 -0
@@ -0,0 +1,112 @@
|
|
1
|
+
.CodeMirror {
|
2
|
+
line-height: 1em;
|
3
|
+
font-family: monospace;
|
4
|
+
}
|
5
|
+
|
6
|
+
.CodeMirror-scroll {
|
7
|
+
overflow: auto;
|
8
|
+
height: 300px;
|
9
|
+
/* This is needed to prevent an IE[67] bug where the scrolled content
|
10
|
+
is visible outside of the scrolling box. */
|
11
|
+
position: relative;
|
12
|
+
outline: none;
|
13
|
+
}
|
14
|
+
|
15
|
+
.CodeMirror-gutter {
|
16
|
+
position: absolute; left: 0; top: 0;
|
17
|
+
z-index: 10;
|
18
|
+
background-color: #f7f7f7;
|
19
|
+
border-right: 1px solid #eee;
|
20
|
+
min-width: 2em;
|
21
|
+
height: 100%;
|
22
|
+
}
|
23
|
+
.CodeMirror-gutter-text {
|
24
|
+
color: #aaa;
|
25
|
+
text-align: right;
|
26
|
+
padding: .4em .2em .4em .4em;
|
27
|
+
white-space: pre !important;
|
28
|
+
}
|
29
|
+
.CodeMirror-lines {
|
30
|
+
padding: .4em;
|
31
|
+
white-space: pre;
|
32
|
+
}
|
33
|
+
|
34
|
+
.CodeMirror pre {
|
35
|
+
-moz-border-radius: 0;
|
36
|
+
-webkit-border-radius: 0;
|
37
|
+
-o-border-radius: 0;
|
38
|
+
border-radius: 0;
|
39
|
+
border-width: 0; margin: 0; padding: 0; background: transparent;
|
40
|
+
font-family: inherit;
|
41
|
+
font-size: inherit;
|
42
|
+
padding: 0; margin: 0;
|
43
|
+
white-space: pre;
|
44
|
+
word-wrap: normal;
|
45
|
+
}
|
46
|
+
|
47
|
+
.CodeMirror-wrap pre {
|
48
|
+
word-wrap: break-word;
|
49
|
+
white-space: pre-wrap;
|
50
|
+
}
|
51
|
+
.CodeMirror-wrap .CodeMirror-scroll {
|
52
|
+
overflow-x: hidden;
|
53
|
+
}
|
54
|
+
|
55
|
+
.CodeMirror textarea {
|
56
|
+
outline: none !important;
|
57
|
+
}
|
58
|
+
|
59
|
+
.CodeMirror pre.CodeMirror-cursor {
|
60
|
+
z-index: 10;
|
61
|
+
position: absolute;
|
62
|
+
visibility: hidden;
|
63
|
+
border-left: 1px solid black;
|
64
|
+
border-right:none;
|
65
|
+
width:0;
|
66
|
+
}
|
67
|
+
.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
|
68
|
+
.CodeMirror-focused pre.CodeMirror-cursor {
|
69
|
+
visibility: visible;
|
70
|
+
}
|
71
|
+
|
72
|
+
div.CodeMirror-selected { background: #d9d9d9; }
|
73
|
+
.CodeMirror-focused div.CodeMirror-selected { background: #d7d4f0; }
|
74
|
+
|
75
|
+
.CodeMirror-searching {
|
76
|
+
background: #ffa;
|
77
|
+
background: rgba(255, 255, 0, .4);
|
78
|
+
}
|
79
|
+
|
80
|
+
/* Default theme */
|
81
|
+
|
82
|
+
.cm-s-default span.cm-keyword {color: #708;}
|
83
|
+
.cm-s-default span.cm-atom {color: #219;}
|
84
|
+
.cm-s-default span.cm-number {color: #164;}
|
85
|
+
.cm-s-default span.cm-def {color: #00f;}
|
86
|
+
.cm-s-default span.cm-variable {color: black;}
|
87
|
+
.cm-s-default span.cm-variable-2 {color: #05a;}
|
88
|
+
.cm-s-default span.cm-variable-3 {color: #085;}
|
89
|
+
.cm-s-default span.cm-property {color: black;}
|
90
|
+
.cm-s-default span.cm-operator {color: black;}
|
91
|
+
.cm-s-default span.cm-comment {color: #a50;}
|
92
|
+
.cm-s-default span.cm-string {color: #a11;}
|
93
|
+
.cm-s-default span.cm-string-2 {color: #f50;}
|
94
|
+
.cm-s-default span.cm-meta {color: #555;}
|
95
|
+
.cm-s-default span.cm-error {color: #f00;}
|
96
|
+
.cm-s-default span.cm-qualifier {color: #555;}
|
97
|
+
.cm-s-default span.cm-builtin {color: #30a;}
|
98
|
+
.cm-s-default span.cm-bracket {color: #cc7;}
|
99
|
+
.cm-s-default span.cm-tag {color: #170;}
|
100
|
+
.cm-s-default span.cm-attribute {color: #00c;}
|
101
|
+
.cm-s-default span.cm-header {color: #a0a;}
|
102
|
+
.cm-s-default span.cm-quote {color: #090;}
|
103
|
+
.cm-s-default span.cm-hr {color: #999;}
|
104
|
+
.cm-s-default span.cm-link {color: #00c;}
|
105
|
+
|
106
|
+
span.cm-header, span.cm-strong {font-weight: bold;}
|
107
|
+
span.cm-em {font-style: italic;}
|
108
|
+
span.cm-emstrong {font-style: italic; font-weight: bold;}
|
109
|
+
span.cm-link {text-decoration: underline;}
|
110
|
+
|
111
|
+
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
|
112
|
+
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
/* http://meyerweb.com/eric/tools/css/reset/
|
2
|
+
v2.0 | 20110126
|
3
|
+
License: none (public domain)
|
4
|
+
*/
|
5
|
+
html, body, div, span, applet, object, iframe,
|
6
|
+
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
7
|
+
a, abbr, acronym, address, big, cite, code,
|
8
|
+
del, dfn, em, img, ins, kbd, q, s, samp,
|
9
|
+
small, strike, strong, sub, sup, tt, var,
|
10
|
+
b, u, i, center,
|
11
|
+
dl, dt, dd, ol, ul, li,
|
12
|
+
fieldset, form, label, legend,
|
13
|
+
table, caption, tbody, tfoot, thead, tr, th, td,
|
14
|
+
article, aside, canvas, details, embed,
|
15
|
+
figure, figcaption, footer, header, hgroup,
|
16
|
+
menu, nav, output, ruby, section, summary,
|
17
|
+
time, mark, audio, video {
|
18
|
+
margin: 0;
|
19
|
+
padding: 0;
|
20
|
+
border: 0;
|
21
|
+
font-size: 100%;
|
22
|
+
font: inherit;
|
23
|
+
vertical-align: baseline;
|
24
|
+
}
|
25
|
+
/* HTML5 display-role reset for older browsers */
|
26
|
+
article, aside, details, figcaption, figure,
|
27
|
+
footer, header, hgroup, menu, nav, section {
|
28
|
+
display: block;
|
29
|
+
}
|
30
|
+
body {
|
31
|
+
line-height: 1;
|
32
|
+
}
|
33
|
+
ol, ul {
|
34
|
+
list-style: none;
|
35
|
+
}
|
36
|
+
blockquote, q {
|
37
|
+
quotes: none;
|
38
|
+
}
|
39
|
+
blockquote:before, blockquote:after,
|
40
|
+
q:before, q:after {
|
41
|
+
content: '';
|
42
|
+
content: none;
|
43
|
+
}
|
44
|
+
table {
|
45
|
+
border-collapse: collapse;
|
46
|
+
border-spacing: 0;
|
47
|
+
}
|
@@ -0,0 +1,107 @@
|
|
1
|
+
body {
|
2
|
+
padding-top: 60px;
|
3
|
+
}
|
4
|
+
|
5
|
+
.CodeMirror {
|
6
|
+
width: 930px;
|
7
|
+
font-size: 16px;
|
8
|
+
cursor: text;
|
9
|
+
|
10
|
+
/* ported from Bootstrap 2.0.2 */
|
11
|
+
background: #fff;
|
12
|
+
margin: 0;
|
13
|
+
overflow: auto;
|
14
|
+
vertical-align: top;
|
15
|
+
line-height: 18px;
|
16
|
+
display: inline-block;
|
17
|
+
padding: 4px;
|
18
|
+
border: 1px solid #cccccc;
|
19
|
+
-webkit-border-radius: 3px;
|
20
|
+
-moz-border-radius: 3px;
|
21
|
+
border-radius: 3px;
|
22
|
+
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
23
|
+
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
24
|
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
25
|
+
-webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
|
26
|
+
-moz-transition: border linear 0.2s, box-shadow linear 0.2s;
|
27
|
+
-ms-transition: border linear 0.2s, box-shadow linear 0.2s;
|
28
|
+
-o-transition: border linear 0.2s, box-shadow linear 0.2s;
|
29
|
+
transition: border linear 0.2s, box-shadow linear 0.2s;
|
30
|
+
}
|
31
|
+
|
32
|
+
.CodeMirror-focused {
|
33
|
+
/* ported from Bootstrap 2.0.2 */
|
34
|
+
border-color: rgba(82, 168, 236, 0.8);
|
35
|
+
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
|
36
|
+
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
|
37
|
+
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(82, 168, 236, 0.6);
|
38
|
+
outline: 0;
|
39
|
+
outline: thin dotted \9;
|
40
|
+
/* IE6-9 */
|
41
|
+
|
42
|
+
}
|
43
|
+
|
44
|
+
#results-table {
|
45
|
+
margin-top: 20px;
|
46
|
+
width: 100%;
|
47
|
+
}
|
48
|
+
|
49
|
+
#results-table th {
|
50
|
+
font-weight: bold;
|
51
|
+
text-align: left;
|
52
|
+
border-bottom: 1px solid #000;
|
53
|
+
}
|
54
|
+
|
55
|
+
#results-table th, #results-table td {
|
56
|
+
font-family: Courier, fixed;
|
57
|
+
font-size: 14px;
|
58
|
+
}
|
59
|
+
|
60
|
+
.status .indicator {
|
61
|
+
text-indent: -9999px;
|
62
|
+
display: inline-block;
|
63
|
+
width: 6px;
|
64
|
+
height: 6px;
|
65
|
+
margin-bottom: 2px;
|
66
|
+
-webkit-border-radius: 3px;
|
67
|
+
-moz-border-radius: 3px;
|
68
|
+
border-radius: 3px;
|
69
|
+
}
|
70
|
+
|
71
|
+
.status .indicator-error {
|
72
|
+
background: #e00;
|
73
|
+
}
|
74
|
+
|
75
|
+
.status .indicator-done {
|
76
|
+
background: #080;
|
77
|
+
}
|
78
|
+
|
79
|
+
.status .indicator-loading {
|
80
|
+
background: #fc0;
|
81
|
+
}
|
82
|
+
|
83
|
+
#query-form .actions {
|
84
|
+
margin-top: 10px;
|
85
|
+
}
|
86
|
+
|
87
|
+
#spinner {
|
88
|
+
display: block;
|
89
|
+
float: left;
|
90
|
+
padding-top: 3px;
|
91
|
+
width: 13px;
|
92
|
+
height: 13px;
|
93
|
+
margin-right: 10px;
|
94
|
+
}
|
95
|
+
|
96
|
+
.deemphasized {
|
97
|
+
color: #999;
|
98
|
+
}
|
99
|
+
|
100
|
+
#query-actions {
|
101
|
+
float: right;
|
102
|
+
margin-top: 1em;
|
103
|
+
}
|
104
|
+
|
105
|
+
#query-properties-form {
|
106
|
+
display: none;
|
107
|
+
}
|
Binary file
|
Binary file
|
@@ -0,0 +1,160 @@
|
|
1
|
+
$(function() {
|
2
|
+
$('#history .delete').click(function(e) {
|
3
|
+
e.preventDefault();
|
4
|
+
|
5
|
+
var row = $(this).closest('tr');
|
6
|
+
|
7
|
+
$.ajax({
|
8
|
+
url: this.href,
|
9
|
+
type: 'DELETE',
|
10
|
+
success: function() {
|
11
|
+
row.remove();
|
12
|
+
}
|
13
|
+
});
|
14
|
+
});
|
15
|
+
|
16
|
+
$('#query-properties-form').submit(function(e) {
|
17
|
+
e.preventDefault();
|
18
|
+
|
19
|
+
var form = $(this);
|
20
|
+
|
21
|
+
$.ajax({
|
22
|
+
url: this.href,
|
23
|
+
type: 'PUT',
|
24
|
+
data: form.serialize(),
|
25
|
+
success: function() {
|
26
|
+
form.hide();
|
27
|
+
|
28
|
+
$('.description').text(form.find('.name').val());
|
29
|
+
$('.author').text(form.find('.author').val());
|
30
|
+
$('#query-actions .edit').removeClass('active');
|
31
|
+
}
|
32
|
+
});
|
33
|
+
});
|
34
|
+
|
35
|
+
$('#query-actions .edit').click(function() {
|
36
|
+
$('#query-properties-form').toggle();
|
37
|
+
});
|
38
|
+
|
39
|
+
if ($('#query-actions .edit').hasClass('active')) {
|
40
|
+
$('#query-properties-form').show();
|
41
|
+
}
|
42
|
+
});
|
43
|
+
|
44
|
+
function QueryEditor(form, options) {
|
45
|
+
this._monitorQueryId = null;
|
46
|
+
this._form = form;
|
47
|
+
this._options = options || {};
|
48
|
+
this.initCodeMirror();
|
49
|
+
this.bindEvents();
|
50
|
+
}
|
51
|
+
|
52
|
+
QueryEditor.MONITOR_TIMEOUT = 1000;
|
53
|
+
|
54
|
+
QueryEditor.prototype.getQueryField = function() {
|
55
|
+
return document.getElementById('query-field');
|
56
|
+
}
|
57
|
+
|
58
|
+
QueryEditor.prototype.focus = function() {
|
59
|
+
this._codeMirror.focus();
|
60
|
+
}
|
61
|
+
|
62
|
+
QueryEditor.prototype.initCodeMirror = function() {
|
63
|
+
this._codeMirror = CodeMirror.fromTextArea(this.getQueryField(), {
|
64
|
+
tabSize: 2
|
65
|
+
});
|
66
|
+
}
|
67
|
+
|
68
|
+
QueryEditor.prototype.bindEvents = function() {
|
69
|
+
var self = this;
|
70
|
+
$(document).on('keydown', 'form', function(e) {
|
71
|
+
if (e.keyCode === 13 && (e.ctrlKey || e.metaKey)) {
|
72
|
+
e.preventDefault();
|
73
|
+
|
74
|
+
// CodeMirror normally saves itself automatically, but since there is no
|
75
|
+
// 'submit' event fired, we need to notify CodeMirror manually.
|
76
|
+
self._codeMirror.save();
|
77
|
+
|
78
|
+
self.submit();
|
79
|
+
}
|
80
|
+
});
|
81
|
+
this._form.on('submit', function(e) {
|
82
|
+
e.preventDefault();
|
83
|
+
self.submit();
|
84
|
+
});
|
85
|
+
}
|
86
|
+
|
87
|
+
QueryEditor.prototype.submit = function() {
|
88
|
+
if(this._options.onQueryStart) this._options.onQueryStart();
|
89
|
+
|
90
|
+
var self = this;
|
91
|
+
$.ajax({
|
92
|
+
url: this._form.attr('action'),
|
93
|
+
type: 'POST',
|
94
|
+
data: this._form.serialize(),
|
95
|
+
dataType: 'json',
|
96
|
+
success: function(data) {
|
97
|
+
self.monitorQuery(data.id);
|
98
|
+
},
|
99
|
+
error: function() {
|
100
|
+
if (self._options.onQueryError) self._options.onQueryError();
|
101
|
+
}
|
102
|
+
});
|
103
|
+
}
|
104
|
+
|
105
|
+
QueryEditor.prototype.monitorQuery = function(id) {
|
106
|
+
this._monitorQueryId = id;
|
107
|
+
|
108
|
+
var self = this;
|
109
|
+
setTimeout(function() {
|
110
|
+
self._tick();
|
111
|
+
}, QueryEditor.MONITOR_TIMEOUT);
|
112
|
+
}
|
113
|
+
|
114
|
+
QueryEditor.prototype._tick = function() {
|
115
|
+
if (this._monitorQueryId !== null) {
|
116
|
+
var queryId = this._monitorQueryId,
|
117
|
+
self = this;
|
118
|
+
|
119
|
+
$.ajax({
|
120
|
+
url: '/queries/' + queryId + '/status',
|
121
|
+
type: 'GET',
|
122
|
+
success: function(status) {
|
123
|
+
// Ignore responses for queries we're no longer interested in
|
124
|
+
if (queryId === self._monitorQueryId) {
|
125
|
+
if (status !== 'loading') {
|
126
|
+
self._loadQueryResult(queryId);
|
127
|
+
} else {
|
128
|
+
setTimeout(function() {
|
129
|
+
self._tick();
|
130
|
+
}, QueryEditor.MONITOR_TIMEOUT);
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}
|
134
|
+
});
|
135
|
+
}
|
136
|
+
}
|
137
|
+
|
138
|
+
QueryEditor.prototype._loadQueryResult = function(id) {
|
139
|
+
var self = this;
|
140
|
+
$.ajax({
|
141
|
+
url: '/queries/' + id + '.json',
|
142
|
+
type: 'GET',
|
143
|
+
dataType: 'json',
|
144
|
+
success: function(data) {
|
145
|
+
// Ignore responses for queries we're no longer interested in
|
146
|
+
if (id === self._monitorQueryId) {
|
147
|
+
if (data.results) {
|
148
|
+
if (self._options.onQuerySuccess) self._options.onQuerySuccess(data);
|
149
|
+
} else {
|
150
|
+
if (self._options.onQueryError) self._options.onQueryError(data.error);
|
151
|
+
}
|
152
|
+
}
|
153
|
+
},
|
154
|
+
error: function() {
|
155
|
+
if (id === self._monitorQueryId && self._options.onQueryError) {
|
156
|
+
self._options.onQueryError("Failed to load results");
|
157
|
+
}
|
158
|
+
}
|
159
|
+
});
|
160
|
+
}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
/**
|
2
|
+
* Bootstrap.js by @fat & @mdo
|
3
|
+
* Copyright 2012 Twitter, Inc.
|
4
|
+
* http://www.apache.org/licenses/LICENSE-2.0.txt
|
5
|
+
*/
|
6
|
+
!function(a){a(function(){"use strict",a.support.transition=function(){var b=document.body||document.documentElement,c=b.style,d=c.transition!==undefined||c.WebkitTransition!==undefined||c.MozTransition!==undefined||c.MsTransition!==undefined||c.OTransition!==undefined;return d&&{end:function(){var b="TransitionEnd";return a.browser.webkit?b="webkitTransitionEnd":a.browser.mozilla?b="transitionend":a.browser.opera&&(b="oTransitionEnd"),b}()}}()})}(window.jQuery),!function(a){"use strict";var b='[data-dismiss="alert"]',c=function(c){a(c).on("click",b,this.close)};c.prototype={constructor:c,close:function(b){function f(){e.trigger("closed").remove()}var c=a(this),d=c.attr("data-target"),e;d||(d=c.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,"")),e=a(d),e.trigger("close"),b&&b.preventDefault(),e.length||(e=c.hasClass("alert")?c:c.parent()),e.trigger("close").removeClass("in"),a.support.transition&&e.hasClass("fade")?e.on(a.support.transition.end,f):f()}},a.fn.alert=function(b){return this.each(function(){var d=a(this),e=d.data("alert");e||d.data("alert",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.alert.Constructor=c,a(function(){a("body").on("click.alert.data-api",b,c.prototype.close)})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.button.defaults,c)};b.prototype={constructor:b,setState:function(a){var b="disabled",c=this.$element,d=c.data(),e=c.is("input")?"val":"html";a+="Text",d.resetText||c.data("resetText",c[e]()),c[e](d[a]||this.options[a]),setTimeout(function(){a=="loadingText"?c.addClass(b).attr(b,b):c.removeClass(b).removeAttr(b)},0)},toggle:function(){var a=this.$element.parent('[data-toggle="buttons-radio"]');a&&a.find(".active").removeClass("active"),this.$element.toggleClass("active")}},a.fn.button=function(c){return this.each(function(){var d=a(this),e=d.data("button"),f=typeof c=="object"&&c;e||d.data("button",e=new b(this,f)),c=="toggle"?e.toggle():c&&e.setState(c)})},a.fn.button.defaults={loadingText:"loading..."},a.fn.button.Constructor=b,a(function(){a("body").on("click.button.data-api","[data-toggle^=button]",function(b){var c=a(b.target);c.hasClass("btn")||(c=c.closest(".btn")),c.button("toggle")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.carousel.defaults,c),this.options.slide&&this.slide(this.options.slide),this.options.pause=="hover"&&this.$element.on("mouseenter",a.proxy(this.pause,this)).on("mouseleave",a.proxy(this.cycle,this))};b.prototype={cycle:function(){return this.interval=setInterval(a.proxy(this.next,this),this.options.interval),this},to:function(b){var c=this.$element.find(".active"),d=c.parent().children(),e=d.index(c),f=this;if(b>d.length-1||b<0)return;return this.sliding?this.$element.one("slid",function(){f.to(b)}):e==b?this.pause().cycle():this.slide(b>e?"next":"prev",a(d[b]))},pause:function(){return clearInterval(this.interval),this.interval=null,this},next:function(){if(this.sliding)return;return this.slide("next")},prev:function(){if(this.sliding)return;return this.slide("prev")},slide:function(b,c){var d=this.$element.find(".active"),e=c||d[b](),f=this.interval,g=b=="next"?"left":"right",h=b=="next"?"first":"last",i=this;this.sliding=!0,f&&this.pause(),e=e.length?e:this.$element.find(".item")[h]();if(e.hasClass("active"))return;return!a.support.transition&&this.$element.hasClass("slide")?(this.$element.trigger("slide"),d.removeClass("active"),e.addClass("active"),this.sliding=!1,this.$element.trigger("slid")):(e.addClass(b),e[0].offsetWidth,d.addClass(g),e.addClass(g),this.$element.trigger("slide"),this.$element.one(a.support.transition.end,function(){e.removeClass([b,g].join(" ")).addClass("active"),d.removeClass(["active",g].join(" ")),i.sliding=!1,setTimeout(function(){i.$element.trigger("slid")},0)})),f&&this.cycle(),this}},a.fn.carousel=function(c){return this.each(function(){var d=a(this),e=d.data("carousel"),f=typeof c=="object"&&c;e||d.data("carousel",e=new b(this,f)),typeof c=="number"?e.to(c):typeof c=="string"||(c=f.slide)?e[c]():e.cycle()})},a.fn.carousel.defaults={interval:5e3,pause:"hover"},a.fn.carousel.Constructor=b,a(function(){a("body").on("click.carousel.data-api","[data-slide]",function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=!e.data("modal")&&a.extend({},e.data(),c.data());e.carousel(f),b.preventDefault()})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.collapse.defaults,c),this.options.parent&&(this.$parent=a(this.options.parent)),this.options.toggle&&this.toggle()};b.prototype={constructor:b,dimension:function(){var a=this.$element.hasClass("width");return a?"width":"height"},show:function(){var b=this.dimension(),c=a.camelCase(["scroll",b].join("-")),d=this.$parent&&this.$parent.find(".in"),e;d&&d.length&&(e=d.data("collapse"),d.collapse("hide"),e||d.data("collapse",null)),this.$element[b](0),this.transition("addClass","show","shown"),this.$element[b](this.$element[0][c])},hide:function(){var a=this.dimension();this.reset(this.$element[a]()),this.transition("removeClass","hide","hidden"),this.$element[a](0)},reset:function(a){var b=this.dimension();return this.$element.removeClass("collapse")[b](a||"auto")[0].offsetWidth,this.$element[a?"addClass":"removeClass"]("collapse"),this},transition:function(b,c,d){var e=this,f=function(){c=="show"&&e.reset(),e.$element.trigger(d)};this.$element.trigger(c)[b]("in"),a.support.transition&&this.$element.hasClass("collapse")?this.$element.one(a.support.transition.end,f):f()},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}},a.fn.collapse=function(c){return this.each(function(){var d=a(this),e=d.data("collapse"),f=typeof c=="object"&&c;e||d.data("collapse",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.collapse.defaults={toggle:!0},a.fn.collapse.Constructor=b,a(function(){a("body").on("click.collapse.data-api","[data-toggle=collapse]",function(b){var c=a(this),d,e=c.attr("data-target")||b.preventDefault()||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,""),f=a(e).data("collapse")?"toggle":c.data();a(e).collapse(f)})})}(window.jQuery),!function(a){function d(){a(b).parent().removeClass("open")}"use strict";var b='[data-toggle="dropdown"]',c=function(b){var c=a(b).on("click.dropdown.data-api",this.toggle);a("html").on("click.dropdown.data-api",function(){c.parent().removeClass("open")})};c.prototype={constructor:c,toggle:function(b){var c=a(this),e=c.attr("data-target"),f,g;return e||(e=c.attr("href"),e=e&&e.replace(/.*(?=#[^\s]*$)/,"")),f=a(e),f.length||(f=c.parent()),g=f.hasClass("open"),d(),!g&&f.toggleClass("open"),!1}},a.fn.dropdown=function(b){return this.each(function(){var d=a(this),e=d.data("dropdown");e||d.data("dropdown",e=new c(this)),typeof b=="string"&&e[b].call(d)})},a.fn.dropdown.Constructor=c,a(function(){a("html").on("click.dropdown.data-api",d),a("body").on("click.dropdown.data-api",b,c.prototype.toggle)})}(window.jQuery),!function(a){function c(){var b=this,c=setTimeout(function(){b.$element.off(a.support.transition.end),d.call(b)},500);this.$element.one(a.support.transition.end,function(){clearTimeout(c),d.call(b)})}function d(a){this.$element.hide().trigger("hidden"),e.call(this)}function e(b){var c=this,d=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var e=a.support.transition&&d;this.$backdrop=a('<div class="modal-backdrop '+d+'" />').appendTo(document.body),this.options.backdrop!="static"&&this.$backdrop.click(a.proxy(this.hide,this)),e&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),e?this.$backdrop.one(a.support.transition.end,b):b()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(a.support.transition.end,a.proxy(f,this)):f.call(this)):b&&b()}function f(){this.$backdrop.remove(),this.$backdrop=null}function g(){var b=this;this.isShown&&this.options.keyboard?a(document).on("keyup.dismiss.modal",function(a){a.which==27&&b.hide()}):this.isShown||a(document).off("keyup.dismiss.modal")}"use strict";var b=function(b,c){this.options=c,this.$element=a(b).delegate('[data-dismiss="modal"]',"click.dismiss.modal",a.proxy(this.hide,this))};b.prototype={constructor:b,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var b=this;if(this.isShown)return;a("body").addClass("modal-open"),this.isShown=!0,this.$element.trigger("show"),g.call(this),e.call(this,function(){var c=a.support.transition&&b.$element.hasClass("fade");!b.$element.parent().length&&b.$element.appendTo(document.body),b.$element.show(),c&&b.$element[0].offsetWidth,b.$element.addClass("in"),c?b.$element.one(a.support.transition.end,function(){b.$element.trigger("shown")}):b.$element.trigger("shown")})},hide:function(b){b&&b.preventDefault();if(!this.isShown)return;var e=this;this.isShown=!1,a("body").removeClass("modal-open"),g.call(this),this.$element.trigger("hide").removeClass("in"),a.support.transition&&this.$element.hasClass("fade")?c.call(this):d.call(this)}},a.fn.modal=function(c){return this.each(function(){var d=a(this),e=d.data("modal"),f=a.extend({},a.fn.modal.defaults,d.data(),typeof c=="object"&&c);e||d.data("modal",e=new b(this,f)),typeof c=="string"?e[c]():f.show&&e.show()})},a.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},a.fn.modal.Constructor=b,a(function(){a("body").on("click.modal.data-api",'[data-toggle="modal"]',function(b){var c=a(this),d,e=a(c.attr("data-target")||(d=c.attr("href"))&&d.replace(/.*(?=#[^\s]+$)/,"")),f=e.data("modal")?"toggle":a.extend({},e.data(),c.data());b.preventDefault(),e.modal(f)})})}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("tooltip",a,b)};b.prototype={constructor:b,init:function(b,c,d){var e,f;this.type=b,this.$element=a(c),this.options=this.getOptions(d),this.enabled=!0,this.options.trigger!="manual"&&(e=this.options.trigger=="hover"?"mouseenter":"focus",f=this.options.trigger=="hover"?"mouseleave":"blur",this.$element.on(e,this.options.selector,a.proxy(this.enter,this)),this.$element.on(f,this.options.selector,a.proxy(this.leave,this))),this.options.selector?this._options=a.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(b){return b=a.extend({},a.fn[this.type].defaults,b,this.$element.data()),b.delay&&typeof b.delay=="number"&&(b.delay={show:b.delay,hide:b.delay}),b},enter:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);!c.options.delay||!c.options.delay.show?c.show():(c.hoverState="in",setTimeout(function(){c.hoverState=="in"&&c.show()},c.options.delay.show))},leave:function(b){var c=a(b.currentTarget)[this.type](this._options).data(this.type);!c.options.delay||!c.options.delay.hide?c.hide():(c.hoverState="out",setTimeout(function(){c.hoverState=="out"&&c.hide()},c.options.delay.hide))},show:function(){var a,b,c,d,e,f,g;if(this.hasContent()&&this.enabled){a=this.tip(),this.setContent(),this.options.animation&&a.addClass("fade"),f=typeof this.options.placement=="function"?this.options.placement.call(this,a[0],this.$element[0]):this.options.placement,b=/in/.test(f),a.remove().css({top:0,left:0,display:"block"}).appendTo(b?this.$element:document.body),c=this.getPosition(b),d=a[0].offsetWidth,e=a[0].offsetHeight;switch(b?f.split(" ")[1]:f){case"bottom":g={top:c.top+c.height,left:c.left+c.width/2-d/2};break;case"top":g={top:c.top-e,left:c.left+c.width/2-d/2};break;case"left":g={top:c.top+c.height/2-e/2,left:c.left-d};break;case"right":g={top:c.top+c.height/2-e/2,left:c.left+c.width}}a.css(g).addClass(f).addClass("in")}},setContent:function(){var a=this.tip();a.find(".tooltip-inner").html(this.getTitle()),a.removeClass("fade in top bottom left right")},hide:function(){function d(){var b=setTimeout(function(){c.off(a.support.transition.end).remove()},500);c.one(a.support.transition.end,function(){clearTimeout(b),c.remove()})}var b=this,c=this.tip();c.removeClass("in"),a.support.transition&&this.$tip.hasClass("fade")?d():c.remove()},fixTitle:function(){var a=this.$element;(a.attr("title")||typeof a.attr("data-original-title")!="string")&&a.attr("data-original-title",a.attr("title")||"").removeAttr("title")},hasContent:function(){return this.getTitle()},getPosition:function(b){return a.extend({},b?{top:0,left:0}:this.$element.offset(),{width:this.$element[0].offsetWidth,height:this.$element[0].offsetHeight})},getTitle:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-original-title")||(typeof c.title=="function"?c.title.call(b[0]):c.title),a=(a||"").toString().replace(/(^\s*|\s*$)/,""),a},tip:function(){return this.$tip=this.$tip||a(this.options.template)},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(){this[this.tip().hasClass("in")?"hide":"show"]()}},a.fn.tooltip=function(c){return this.each(function(){var d=a(this),e=d.data("tooltip"),f=typeof c=="object"&&c;e||d.data("tooltip",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.tooltip.Constructor=b,a.fn.tooltip.defaults={animation:!0,delay:0,selector:!1,placement:"top",trigger:"hover",title:"",template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'}}(window.jQuery),!function(a){"use strict";var b=function(a,b){this.init("popover",a,b)};b.prototype=a.extend({},a.fn.tooltip.Constructor.prototype,{constructor:b,setContent:function(){var b=this.tip(),c=this.getTitle(),d=this.getContent();b.find(".popover-title")[a.type(c)=="object"?"append":"html"](c),b.find(".popover-content > *")[a.type(d)=="object"?"append":"html"](d),b.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var a,b=this.$element,c=this.options;return a=b.attr("data-content")||(typeof c.content=="function"?c.content.call(b[0]):c.content),a=a.toString().replace(/(^\s*|\s*$)/,""),a},tip:function(){return this.$tip||(this.$tip=a(this.options.template)),this.$tip}}),a.fn.popover=function(c){return this.each(function(){var d=a(this),e=d.data("popover"),f=typeof c=="object"&&c;e||d.data("popover",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.popover.Constructor=b,a.fn.popover.defaults=a.extend({},a.fn.tooltip.defaults,{placement:"right",content:"",template:'<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'})}(window.jQuery),!function(a){function b(b,c){var d=a.proxy(this.process,this),e=a(b).is("body")?a(window):a(b),f;this.options=a.extend({},a.fn.scrollspy.defaults,c),this.$scrollElement=e.on("scroll.scroll.data-api",d),this.selector=(this.options.target||(f=a(b).attr("href"))&&f.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=a("body").on("click.scroll.data-api",this.selector,d),this.refresh(),this.process()}"use strict",b.prototype={constructor:b,refresh:function(){this.targets=this.$body.find(this.selector).map(function(){var b=a(this).attr("href");return/^#\w/.test(b)&&a(b).length?b:null}),this.offsets=a.map(this.targets,function(b){return a(b).position().top})},process:function(){var a=this.$scrollElement.scrollTop()+this.options.offset,b=this.offsets,c=this.targets,d=this.activeTarget,e;for(e=b.length;e--;)d!=c[e]&&a>=b[e]&&(!b[e+1]||a<=b[e+1])&&this.activate(c[e])},activate:function(a){var b;this.activeTarget=a,this.$body.find(this.selector).parent(".active").removeClass("active"),b=this.$body.find(this.selector+'[href="'+a+'"]').parent("li").addClass("active"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active")}},a.fn.scrollspy=function(c){return this.each(function(){var d=a(this),e=d.data("scrollspy"),f=typeof c=="object"&&c;e||d.data("scrollspy",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.scrollspy.Constructor=b,a.fn.scrollspy.defaults={offset:10},a(function(){a('[data-spy="scroll"]').each(function(){var b=a(this);b.scrollspy(b.data())})})}(window.jQuery),!function(a){"use strict";var b=function(b){this.element=a(b)};b.prototype={constructor:b,show:function(){var b=this.element,c=b.closest("ul:not(.dropdown-menu)"),d=b.attr("data-target"),e,f;d||(d=b.attr("href"),d=d&&d.replace(/.*(?=#[^\s]*$)/,""));if(b.parent("li").hasClass("active"))return;e=c.find(".active a").last()[0],b.trigger({type:"show",relatedTarget:e}),f=a(d),this.activate(b.parent("li"),c),this.activate(f,f.parent(),function(){b.trigger({type:"shown",relatedTarget:e})})},activate:function(b,c,d){function g(){e.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),b.addClass("active"),f?(b[0].offsetWidth,b.addClass("in")):b.removeClass("fade"),b.parent(".dropdown-menu")&&b.closest("li.dropdown").addClass("active"),d&&d()}var e=c.find("> .active"),f=d&&a.support.transition&&e.hasClass("fade");f?e.one(a.support.transition.end,g):g(),e.removeClass("in")}},a.fn.tab=function(c){return this.each(function(){var d=a(this),e=d.data("tab");e||d.data("tab",e=new b(this)),typeof c=="string"&&e[c]()})},a.fn.tab.Constructor=b,a(function(){a("body").on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(b){b.preventDefault(),a(this).tab("show")})})}(window.jQuery),!function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=a.extend({},a.fn.typeahead.defaults,c),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.$menu=a(this.options.menu).appendTo("body"),this.source=this.options.source,this.shown=!1,this.listen()};b.prototype={constructor:b,select:function(){var a=this.$menu.find(".active").attr("data-value");return this.$element.val(a),this.$element.change(),this.hide()},show:function(){var b=a.extend({},this.$element.offset(),{height:this.$element[0].offsetHeight});return this.$menu.css({top:b.top+b.height,left:b.left}),this.$menu.show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(b){var c=this,d,e;return this.query=this.$element.val(),this.query?(d=a.grep(this.source,function(a){if(c.matcher(a))return a}),d=this.sorter(d),d.length?this.render(d.slice(0,this.options.items)).show():this.shown?this.hide():this):this.shown?this.hide():this},matcher:function(a){return~a.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(a){var b=[],c=[],d=[],e;while(e=a.shift())e.toLowerCase().indexOf(this.query.toLowerCase())?~e.indexOf(this.query)?c.push(e):d.push(e):b.push(e);return b.concat(c,d)},highlighter:function(a){return a.replace(new RegExp("("+this.query+")","ig"),function(a,b){return"<strong>"+b+"</strong>"})},render:function(b){var c=this;return b=a(b).map(function(b,d){return b=a(c.options.item).attr("data-value",d),b.find("a").html(c.highlighter(d)),b[0]}),b.first().addClass("active"),this.$menu.html(b),this},next:function(b){var c=this.$menu.find(".active").removeClass("active"),d=c.next();d.length||(d=a(this.$menu.find("li")[0])),d.addClass("active")},prev:function(a){var b=this.$menu.find(".active").removeClass("active"),c=b.prev();c.length||(c=this.$menu.find("li").last()),c.addClass("active")},listen:function(){this.$element.on("blur",a.proxy(this.blur,this)).on("keypress",a.proxy(this.keypress,this)).on("keyup",a.proxy(this.keyup,this)),(a.browser.webkit||a.browser.msie)&&this.$element.on("keydown",a.proxy(this.keypress,this)),this.$menu.on("click",a.proxy(this.click,this)).on("mouseenter","li",a.proxy(this.mouseenter,this))},keyup:function(a){switch(a.keyCode){case 40:case 38:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}a.stopPropagation(),a.preventDefault()},keypress:function(a){if(!this.shown)return;switch(a.keyCode){case 9:case 13:case 27:a.preventDefault();break;case 38:a.preventDefault(),this.prev();break;case 40:a.preventDefault(),this.next()}a.stopPropagation()},blur:function(a){var b=this;setTimeout(function(){b.hide()},150)},click:function(a){a.stopPropagation(),a.preventDefault(),this.select()},mouseenter:function(b){this.$menu.find(".active").removeClass("active"),a(b.currentTarget).addClass("active")}},a.fn.typeahead=function(c){return this.each(function(){var d=a(this),e=d.data("typeahead"),f=typeof c=="object"&&c;e||d.data("typeahead",e=new b(this,f)),typeof c=="string"&&e[c]()})},a.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>'},a.fn.typeahead.Constructor=b,a(function(){a("body").on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(b){var c=a(this);if(c.data("typeahead"))return;b.preventDefault(),c.typeahead(c.data())})})}(window.jQuery);
|
@@ -0,0 +1 @@
|
|
1
|
+
var CodeMirror=function(){function a(d,e){function Wb(a){return a>=0&&a<tb.size}function Yb(a){return v(tb,a)}function Zb(a,b){Kb=!0;var c=b-a.height;for(var d=a;d;d=d.parent)d.height+=c}function $b(a){var b={line:0,ch:0};oc(b,{line:tb.size-1,ch:Yb(tb.size-1).text.length},fb(a),b,b),Eb=!0}function _b(a){var b=[];return tb.iter(0,tb.size,function(a){b.push(a.text)}),b.join("\n")}function ac(a){function j(a){var b=Hd(a,!0);if(b&&!Z(b,g)){vb||mc(),g=b,Pc(d,b),Eb=!1;var c=Ic();if(b.line>=c.to||b.line<c.from)h=setTimeout(Ud(function(){j(a)}),150)}}function k(a){clearTimeout(h);var b=Hd(a);b&&Pc(d,b),C(a),Ec(),Eb=!0,l(),i()}Oc(H(a,"shiftKey"));for(var b=F(a);b!=s;b=b.parentNode)if(b.parentNode==U&&b!=V)return;for(var b=F(a);b!=s;b=b.parentNode)if(b.parentNode==ib)return f.onGutterClick&&f.onGutterClick(Xb,db(ib.childNodes,b)+Nb,a),C(a);var d=Hd(a);switch(G(a)){case 3:L&&!c&&Id(a);return;case 2:d&&Sc(d.line,d.ch,!0);return}if(!d){F(a)==T&&C(a);return}vb||mc();var e=+(new Date);if(zb&&zb.time>e-400&&Z(zb.pos,d))return C(a),setTimeout(Ec,20),_c(d.line);if(yb&&yb.time>e-400&&Z(yb.pos,d))return zb={time:e,pos:d},C(a),$c(d);yb={time:e,pos:d};var g=d,h;if(f.dragDrop&&S&&!f.readOnly&&!Z(wb.from,wb.to)&&!$(d,wb.from)&&!$(wb.to,d)){P&&(jb.draggable=!0);var i=I(document,"mouseup",Ud(function(b){P&&(jb.draggable=!1),Bb=!1,i(),Math.abs(a.clientX-b.clientX)+Math.abs(a.clientY-b.clientY)<10&&(C(b),Sc(d.line,d.ch,!0),Ec())}),!0);Bb=!0,jb.dragDrop&&jb.dragDrop();return}C(a),Sc(d.line,d.ch,!0);var l=I(document,"mousemove",Ud(function(a){clearTimeout(h),C(a),!M&&!G(a)?k(a):j(a)}),!0),i=I(document,"mouseup",Ud(k),!0)}function bc(a){for(var b=F(a);b!=s;b=b.parentNode)if(b.parentNode==ib)return C(a);var c=Hd(a);if(!c)return;zb={time:+(new Date),pos:c},C(a),$c(c)}function cc(a){a.preventDefault();var b=Hd(a,!0),c=a.dataTransfer.files;if(!b||f.readOnly)return;if(c&&c.length&&window.FileReader&&window.File){function d(a,c){var d=new FileReader;d.onload=function(){g[c]=d.result,++h==e&&(b=Uc(b),Ud(function(){var a=tc(g.join(""),b,b);Pc(b,a)})())},d.readAsText(a)}var e=c.length,g=Array(e),h=0;for(var i=0;i<e;++i)d(c[i],i)}else try{var g=a.dataTransfer.getData("Text");if(g){var j=wb.from,k=wb.to;Pc(b,b),Bb&&tc("",j,k),uc(g),Ec()}}catch(a){}}function dc(a){var b=xc();a.dataTransfer.setData("Text",b);if(L||Q){var c=document.createElement("img");c.scr="data:image/gif;base64,R0lGODdhAgACAIAAAAAAAP///ywAAAAAAgACAAACAoRRADs=",a.dataTransfer.setDragImage(c,0,0)}}function ec(a,b){if(typeof a=="string"){a=h[a];if(!a)return!1}var c=xb;try{f.readOnly&&(Db=!0),b&&(xb=null),a(Xb)}catch(d){if(d!=K)throw d;return!1}finally{xb=c,Db=!1}return!0}function fc(a){var b=j(f.keyMap),c=b.auto;clearTimeout(ic),c&&!l(a)&&(ic=setTimeout(function(){j(f.keyMap)==b&&(f.keyMap=c.call?c.call(null,Xb):c)},50));var d=hb[H(a,"keyCode")],e=!1;return d==null||a.altGraphKey?!1:(H(a,"altKey")&&(d="Alt-"+d),H(a,"ctrlKey")&&(d="Ctrl-"+d),H(a,"metaKey")&&(d="Cmd-"+d),H(a,"shiftKey")?e=k("Shift-"+d,f.extraKeys,f.keyMap,function(a){return ec(a,!0)})||k(d,f.extraKeys,f.keyMap,function(a){if(typeof a=="string"&&/^go[A-Z]/.test(a))return ec(a)}):e=k(d,f.extraKeys,f.keyMap,ec),e&&(C(a),M&&(a.oldKeyCode=a.keyCode,a.keyCode=0)),e)}function gc(a,b){var c=k("'"+b+"'",f.extraKeys,f.keyMap,ec);return c&&C(a),c}function jc(a){vb||mc(),M&&a.keyCode==27&&(a.returnValue=!1),yc&&Cc()&&(yc=!1);if(f.onKeyEvent&&f.onKeyEvent(Xb,B(a)))return;var b=H(a,"keyCode");Oc(b==16||H(a,"shiftKey"));var d=fc(a);window.opera&&(hc=d?b:null,!d&&b==88&&H(a,c?"metaKey":"ctrlKey")&&uc(""))}function kc(a){yc&&Cc();if(f.onKeyEvent&&f.onKeyEvent(Xb,B(a)))return;var b=H(a,"keyCode"),c=H(a,"charCode");if(window.opera&&b==hc){hc=null,C(a);return}if((window.opera&&!a.which||R)&&fc(a))return;var d=String.fromCharCode(c==null?b:c);f.electricChars&&sb.electricChars&&f.smartIndent&&!f.readOnly&&sb.electricChars.indexOf(d)>-1&&setTimeout(Ud(function(){bd(wb.to.line,"smart")}),75);if(gc(a,d))return;Ac()}function lc(a){if(f.onKeyEvent&&f.onKeyEvent(Xb,B(a)))return;H(a,"keyCode")==16&&(xb=null)}function mc(){if(f.readOnly=="nocursor")return;vb||(f.onFocus&&f.onFocus(Xb),vb=!0,s.className.search(/\bCodeMirror-focused\b/)==-1&&(s.className+=" CodeMirror-focused"),Jb||Dc(!0)),zc(),Jd()}function nc(){vb&&(f.onBlur&&f.onBlur(Xb),vb=!1,Qb&&Ud(function(){Qb&&(Qb(),Qb=null)})(),s.className=s.className.replace(" CodeMirror-focused","")),clearInterval(rb),setTimeout(function(){vb||(xb=null)},150)}function oc(a,b,c,d,e){if(Db)return;if(Ub){var g=[];tb.iter(a.line,b.line+1,function(a){g.push(a.text)}),Ub.addChange(a.line,c.length,g);while(Ub.done.length>f.undoDepth)Ub.done.shift()}sc(a,b,c,d,e)}function pc(a,b){if(!a.length)return;var c=a.pop(),d=[];for(var e=c.length-1;e>=0;e-=1){var f=c[e],g=[],h=f.start+f.added;tb.iter(f.start,h,function(a){g.push(a.text)}),d.push({start:f.start,added:f.old.length,old:g});var i=Uc({line:f.start+f.old.length-1,ch:cb(g[g.length-1],f.old[f.old.length-1])});sc({line:f.start,ch:0},{line:h-1,ch:Yb(h-1).text.length},f.old,i,i)}Eb=!0,b.push(d)}function qc(){pc(Ub.done,Ub.undone)}function rc(){pc(Ub.undone,Ub.done)}function sc(a,b,c,d,e){function y(a){return a<=Math.min(b.line,b.line+s)?a:a+s}if(Db)return;var g=!1,h=Rb.length;f.lineWrapping||tb.iter(a.line,b.line,function(a){if(a.text.length==h)return g=!0,!0});if(a.line!=b.line||c.length>1)Kb=!0;var i=b.line-a.line,j=Yb(a.line),k=Yb(b.line);if(a.ch==0&&b.ch==0&&c[c.length-1]==""){var l=[],m=null;a.line?(m=Yb(a.line-1),m.fixMarkEnds(k)):k.fixMarkStarts();for(var n=0,o=c.length-1;n<o;++n)l.push(r.inheritMarks(c[n],m));i&&tb.remove(a.line,i,Lb),l.length&&tb.insert(a.line,l)}else if(j==k)if(c.length==1)j.replace(a.ch,b.ch,c[0]);else{k=j.split(b.ch,c[c.length-1]),j.replace(a.ch,null,c[0]),j.fixMarkEnds(k);var l=[];for(var n=1,o=c.length-1;n<o;++n)l.push(r.inheritMarks(c[n],j));l.push(k),tb.insert(a.line+1,l)}else if(c.length==1)j.replace(a.ch,null,c[0]),k.replace(null,b.ch,""),j.append(k),tb.remove(a.line+1,i,Lb);else{var l=[];j.replace(a.ch,null,c[0]),k.replace(null,b.ch,c[c.length-1]),j.fixMarkEnds(k);for(var n=1,o=c.length-1;n<o;++n)l.push(r.inheritMarks(c[n],j));i>1&&tb.remove(a.line+1,i-1,Lb),tb.insert(a.line+1,l)}if(f.lineWrapping){var p=Math.max(5,T.clientWidth/Ed()-3);tb.iter(a.line,a.line+c.length,function(a){if(a.hidden)return;var b=Math.ceil(a.text.length/p)||1;b!=a.height&&Zb(a,b)})}else tb.iter(a.line,n+c.length,function(a){var b=a.text;b.length>h&&(Rb=b,h=b.length,Sb=null,g=!1)}),g&&(h=0,Rb="",Sb=null,tb.iter(0,tb.size,function(a){var b=a.text;b.length>h&&(h=b.length,Rb=b)}));var q=[],s=c.length-i-1;for(var n=0,t=ub.length;n<t;++n){var u=ub[n];u<a.line?q.push(u):u>b.line&&q.push(u+s)}var v=a.line+Math.min(c.length,500);Od(a.line,v),q.push(v),ub=q,Qd(100),Gb.push({from:a.line,to:b.line+1,diff:s});var w={from:a,to:b,text:c};if(Hb){for(var x=Hb;x.next;x=x.next);x.next=w}else Hb=w;Qc(d,e,y(wb.from.line),y(wb.to.line)),T.clientHeight&&(U.style.height=tb.height*Bd()+2*Fd()+"px")}function tc(a,b,c){function d(d){if($(d,b))return d;if(!$(c,d))return e;var f=d.line+a.length-(c.line-b.line)-1,g=d.ch;return d.line==c.line&&(g+=a[a.length-1].length-(c.ch-(c.line==b.line?b.ch:0))),{line:f,ch:g}}b=Uc(b),c?c=Uc(c):c=b,a=fb(a);var e;return vc(a,b,c,function(a){return e=a,{from:d(wb.from),to:d(wb.to)}}),e}function uc(a,b){vc(fb(a),wb.from,wb.to,function(a){return b=="end"?{from:a,to:a}:b=="start"?{from:wb.from,to:wb.from}:{from:wb.from,to:a}})}function vc(a,b,c,d){var e=a.length==1?a[0].length+b.ch:a[a.length-1].length,f=d({line:b.line+a.length-1,ch:e});oc(b,c,a,f.from,f.to)}function wc(a,b){var c=a.line,d=b.line;if(c==d)return Yb(c).text.slice(a.ch,b.ch);var e=[Yb(c).text.slice(a.ch)];return tb.iter(c+1,d,function(a){e.push(a.text)}),e.push(Yb(d).text.slice(0,b.ch)),e.join("\n")}function xc(){return wc(wb.from,wb.to)}function zc(){if(yc)return;pb.set(f.pollInterval,function(){Rd(),Cc(),vb&&zc(),Sd()})}function Ac(){function b(){Rd();var c=Cc();!c&&!a?(a=!0,pb.set(60,b)):(yc=!1,zc()),Sd()}var a=!1;yc=!0,pb.set(20,b)}function Cc(){if(Jb||!vb||gb(D)||f.readOnly)return!1;var a=D.value;if(a==Bc)return!1;xb=null;var b=0,c=Math.min(Bc.length,a.length);while(b<c&&Bc[b]==a[b])++b;return b<Bc.length?wb.from={line:wb.from.line,ch:wb.from.ch-(Bc.length-b)}:Cb&&Z(wb.from,wb.to)&&(wb.to={line:wb.to.line,ch:Math.min(Yb(wb.to.line).text.length,wb.to.ch+(a.length-b))}),uc(a.slice(b),"end"),Bc=a,!0}function Dc(a){Z(wb.from,wb.to)?a&&(Bc=D.value=""):(Bc="",D.value=xc(),Y(D))}function Ec(){f.readOnly!="nocursor"&&D.focus()}function Fc(){if(!lb.getBoundingClientRect)return;var a=lb.getBoundingClientRect();if(M&&a.top==a.bottom)return;var b=window.innerHeight||Math.max(document.body.offsetHeight,document.documentElement.offsetHeight);(a.top<0||a.bottom>b)&&lb.scrollIntoView()}function Gc(){var a=vd(wb.inverted?wb.from:wb.to),b=f.lineWrapping?Math.min(a.x,jb.offsetWidth):a.x;return Hc(b,a.y,b,a.yBot)}function Hc(a,b,c,d){var e=Gd(),g=Fd();b+=g,d+=g,a+=e,c+=e;var h=T.clientHeight,i=T.scrollTop,j=!1,k=!0;b<i?(T.scrollTop=Math.max(0,b),j=!0):d>i+h&&(T.scrollTop=d-h,j=!0);var l=T.clientWidth,m=T.scrollLeft,n=f.fixedGutter?ab.clientWidth:0;return a<m+n?(a<50&&(a=0),T.scrollLeft=Math.max(0,a-10-n),j=!0):c>l+m-3&&(T.scrollLeft=c+10-l,j=!0,c>U.clientWidth&&(k=!1)),j&&f.onScroll&&f.onScroll(Xb),k}function Ic(){var a=Bd(),b=T.scrollTop-Fd(),c=Math.max(0,Math.floor(b/a)),d=Math.ceil((b+T.clientHeight)/a);return{from:x(tb,c),to:x(tb,d)}}function Jc(a,b){function n(){Sb=T.clientWidth;var a=nb.firstChild,b=!1;return tb.iter(Nb,Ob,function(c){if(!c.hidden){var d=Math.round(a.offsetHeight/k)||1;c.height!=d&&(Zb(c,d),Kb=b=!0)}a=a.nextSibling}),b&&(U.style.height=tb.height*k+2*Fd()+"px"),b}if(!T.clientWidth){Nb=Ob=Mb=0;return}var c=Ic();if(a!==!0&&a.length==0&&c.from>Nb&&c.to<Ob)return;var d=Math.max(c.from-100,0),e=Math.min(tb.size,c.to+100);Nb<d&&d-Nb<20&&(d=Nb),Ob>e&&Ob-e<20&&(e=Math.min(tb.size,Ob));var g=a===!0?[]:Kc([{from:Nb,to:Ob,domStart:0}],a),h=0;for(var i=0;i<g.length;++i){var j=g[i];j.from<d&&(j.domStart+=d-j.from,j.from=d),j.to>e&&(j.to=e),j.from>=j.to?g.splice(i--,1):h+=j.to-j.from}if(h==e-d)return;g.sort(function(a,b){return a.domStart-b.domStart});var k=Bd(),l=ab.style.display;nb.style.display="none",Lc(d,e,g),nb.style.display=ab.style.display="";var m=d!=Nb||e!=Ob||Pb!=T.clientHeight+k;m&&(Pb=T.clientHeight+k),Nb=d,Ob=e,Mb=y(tb,d),V.style.top=Mb*k+"px",T.clientHeight&&(U.style.height=tb.height*k+2*Fd()+"px");if(nb.childNodes.length!=Ob-Nb)throw new Error("BAD PATCH! "+JSON.stringify(g)+" size="+(Ob-Nb)+" nodes="+nb.childNodes.length);return f.lineWrapping?n():(Sb==null&&(Sb=rd(Rb)),Sb>T.clientWidth?(jb.style.width=Sb+"px",U.style.width="",U.style.width=T.scrollWidth+"px"):jb.style.width=U.style.width=""),ab.style.display=l,(m||Kb)&&Mc()&&f.lineWrapping&&n()&&Mc(),Nc(),!b&&f.onUpdate&&f.onUpdate(Xb),!0}function Kc(a,b){for(var c=0,d=b.length||0;c<d;++c){var e=b[c],f=[],g=e.diff||0;for(var h=0,i=a.length;h<i;++h){var j=a[h];e.to<=j.from&&e.diff?f.push({from:j.from+g,to:j.to+g,domStart:j.domStart}):e.to<=j.from||e.from>=j.to?f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from,domStart:j.domStart}),e.to<j.to&&f.push({from:e.to+g,to:j.to+g,domStart:j.domStart+(e.to-j.from)}))}a=f}return a}function Lc(a,b,c){if(!c.length)nb.innerHTML="";else{function d(a){var b=a.nextSibling;return a.parentNode.removeChild(a),b}var e=0,f=nb.firstChild,g;for(var h=0;h<c.length;++h){var i=c[h];while(i.domStart>e)f=d(f),e++;for(var j=0,k=i.to-i.from;j<k;++j)f=f.nextSibling,e++}while(f)f=d(f)}var l=c.shift(),f=nb.firstChild,j=a,m=document.createElement("div");tb.iter(a,b,function(a){l&&l.to==j&&(l=c.shift());if(!l||l.from>j){if(a.hidden)var b=m.innerHTML="<pre></pre>";else{var b="<pre"+(a.className?' class="'+a.className+'"':"")+">"+a.getHTML(fd)+"</pre>";a.bgClassName&&(b='<div style="position: relative"><pre class="'+a.bgClassName+'" style="position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: -2"> </pre>'+b+"</div>")}m.innerHTML=b,nb.insertBefore(m.firstChild,f)}else f=f.nextSibling;++j})}function Mc(){if(!f.gutter&&!f.lineNumbers)return;var a=V.offsetHeight,b=T.clientHeight;ab.style.height=(a-b<2?b:a)+"px";var c=[],d=Nb,e;tb.iter(Nb,Math.max(Ob,Nb+1),function(a){if(a.hidden)c.push("<pre></pre>");else{var b=a.gutterMarker,g=f.lineNumbers?d+f.firstLineNumber:null;b&&b.text?g=b.text.replace("%N%",g!=null?g:""):g==null&&(g="\u00a0"),c.push(b&&b.style?'<pre class="'+b.style+'">':"<pre>",g);for(var h=1;h<a.height;++h)c.push("<br/> ");c.push("</pre>"),b||(e=d)}++d}),ab.style.display="none",ib.innerHTML=c.join("");if(e!=null){var g=ib.childNodes[e-Nb],h=String(tb.size).length,i=X(g),j="";while(i.length+j.length<h)j+="\u00a0";j&&g.insertBefore(document.createTextNode(j),g.firstChild)}ab.style.display="";var k=Math.abs((parseInt(jb.style.marginLeft)||0)-ab.offsetWidth)>2;return jb.style.marginLeft=ab.offsetWidth+"px",Kb=!1,k}function Nc(){var a=Z(wb.from,wb.to),b=vd(wb.from,!0),c=a?b:vd(wb.to,!0),d=wb.inverted?b:c,e=Bd(),g=W(s),h=W(nb);A.style.top=Math.max(0,Math.min(T.offsetHeight,d.y+h.top-g.top))+"px",A.style.left=Math.max(0,Math.min(T.offsetWidth,d.x+h.left-g.left))+"px";if(a)lb.style.top=d.y+"px",lb.style.left=(f.lineWrapping?Math.min(d.x,jb.offsetWidth):d.x)+"px",lb.style.display="",mb.style.display="none";else{var i=b.y==c.y,j="",k=jb.clientWidth||jb.offsetWidth,l=jb.clientHeight||jb.offsetHeight;function m(a,b,c,d){var e=O?"width: "+(c?k-c-a:k)+"px":"right: "+c+"px";j+='<div class="CodeMirror-selected" style="position: absolute; left: '+a+"px; top: "+b+"px; "+e+"; height: "+d+'px"></div>'}if(wb.from.ch&&b.y>=0){var n=i?k-c.x:0;m(b.x,b.y,n,e)}var o=Math.max(0,b.y+(wb.from.ch?e:0)),p=Math.min(c.y,l)-o;p>.2*e&&m(0,o,0,p),(!i||!wb.from.ch)&&c.y<l-.5*e&&m(0,c.y,k-c.x,e),mb.innerHTML=j,lb.style.display="none",mb.style.display=""}}function Oc(a){a?xb=xb||(wb.inverted?wb.to:wb.from):xb=null}function Pc(a,b){var c=xb&&Uc(xb);c&&($(c,a)?a=c:$(b,c)&&(b=c)),Qc(a,b),Fb=!0}function Qc(a,b,c,d){Yc=null,c==null&&(c=wb.from.line,d=wb.to.line);if(Z(wb.from,a)&&Z(wb.to,b))return;if($(b,a)){var e=b;b=a,a=e}if(a.line!=c){var g=Rc(a,c,wb.from.ch);g?a=g:pd(a.line,!1)}b.line!=d&&(b=Rc(b,d,wb.to.ch)),Z(a,b)?wb.inverted=!1:Z(a,wb.to)?wb.inverted=!1:Z(b,wb.from)&&(wb.inverted=!0);if(f.autoClearEmptyLines&&Z(wb.from,wb.to)){var h=wb.inverted?a:b;if(h.line!=wb.from.line&&wb.from.line<tb.size){var i=Yb(wb.from.line);/^\s+$/.test(i.text)&&setTimeout(Ud(function(){if(i.parent&&/^\s+$/.test(i.text)){var a=w(i);tc("",{line:a,ch:0},{line:a,ch:i.text.length})}},10))}}wb.from=a,wb.to=b,Ib=!0}function Rc(a,b,c){function d(b){var d=a.line+b,e=b==1?tb.size:-1;while(d!=e){var f=Yb(d);if(!f.hidden){var g=a.ch;if(g>c||g>f.text.length)g=f.text.length;return{line:d,ch:g}}d+=b}}var e=Yb(a.line);return e.hidden?a.line>=b?d(1)||d(-1):d(-1)||d(1):a}function Sc(a,b,c){var d=Uc({line:a,ch:b||0});(c?Pc:Qc)(d,d)}function Tc(a){return Math.max(0,Math.min(a,tb.size-1))}function Uc(a){if(a.line<0)return{line:0,ch:0};if(a.line>=tb.size)return{line:tb.size-1,ch:Yb(tb.size-1).text.length};var b=a.ch,c=Yb(a.line).text.length;return b==null||b>c?{line:a.line,ch:c}:b<0?{line:a.line,ch:0}:a}function Vc(a,b){function g(){for(var b=d+a,c=a<0?-1:tb.size;b!=c;b+=a){var e=Yb(b);if(!e.hidden)return d=b,f=e,!0}}function h(b){if(e==(a<0?0:f.text.length)){if(!!b||!g())return!1;e=a<0?f.text.length:0}else e+=a;return!0}var c=wb.inverted?wb.from:wb.to,d=c.line,e=c.ch,f=Yb(d);if(b=="char")h();else if(b=="column")h(!0);else if(b=="word"){var i=!1;for(;;){if(a<0&&!h())break;if(eb(f.text.charAt(e)))i=!0;else if(i){a<0&&(a=1,h());break}if(a>0&&!h())break}}return{line:d,ch:e}}function Wc(a,b){var c=a<0?wb.from:wb.to;if(xb||Z(wb.from,wb.to))c=Vc(a,b);Sc(c.line,c.ch,!0)}function Xc(a,b){Z(wb.from,wb.to)?a<0?tc("",Vc(a,b),wb.to):tc("",wb.from,Vc(a,b)):tc("",wb.from,wb.to),Fb=!0}function Zc(a,b){var c=0,d=vd(wb.inverted?wb.from:wb.to,!0);Yc!=null&&(d.x=Yc),b=="page"?c=Math.min(T.clientHeight,window.innerHeight||document.documentElement.clientHeight):b=="line"&&(c=Bd());var e=wd(d.x,d.y+c*a+2);b=="page"&&(T.scrollTop+=vd(e,!0).y-d.y),Sc(e.line,e.ch,!0),Yc=d.x}function $c(a){var b=Yb(a.line).text,c=a.ch,d=a.ch;while(c>0&&eb(b.charAt(c-1)))--c;while(d<b.length&&eb(b.charAt(d)))++d;Pc({line:a.line,ch:c},{line:a.line,ch:d})}function _c(a){Pc({line:a,ch:0},Uc({line:a+1,ch:0}))}function ad(a){if(Z(wb.from,wb.to))return bd(wb.from.line,a);var b=wb.to.line-(wb.to.ch?0:1);for(var c=wb.from.line;c<=b;++c)bd(c,a)}function bd(a,b){b||(b="add");if(b=="smart")if(!sb.indent)b="prev";else var c=Nd(a);var d=Yb(a),e=d.indentation(f.tabSize),g=d.text.match(/^\s*/)[0],h;b=="prev"?a?h=Yb(a-1).indentation(f.tabSize):h=0:b=="smart"?h=sb.indent(c,d.text.slice(g.length),d.text):b=="add"?h=e+f.indentUnit:b=="subtract"&&(h=e-f.indentUnit),h=Math.max(0,h);var i=h-e;if(!i){if(wb.from.line!=a&&wb.to.line!=a)return;var j=g}else{var j="",k=0;if(f.indentWithTabs)for(var l=Math.floor(h/f.tabSize);l;--l)k+=f.tabSize,j+=" ";while(k<h)++k,j+=" "}tc(j,{line:a,ch:0},{line:a,ch:g.length})}function cd(){sb=a.getMode(f,f.mode),tb.iter(0,tb.size,function(a){a.stateAfter=null}),ub=[0],Qd()}function dd(){var a=f.gutter||f.lineNumbers;ab.style.display=a?"":"none",a?Kb=!0:nb.parentNode.style.marginLeft=0}function ed(a,b){if(f.lineWrapping){s.className+=" CodeMirror-wrap";var c=T.clientWidth/Ed()-3;tb.iter(0,tb.size,function(a){if(a.hidden)return;var b=Math.ceil(a.text.length/c)||1;b!=1&&Zb(a,b)}),jb.style.width=U.style.width=""}else s.className=s.className.replace(" CodeMirror-wrap",""),Sb=null,Rb="",tb.iter(0,tb.size,function(a){a.height!=1&&!a.hidden&&Zb(a,1),a.text.length>Rb.length&&(Rb=a.text)});Gb.push({from:0,to:tb.size})}function fd(a){var b=f.tabSize-a%f.tabSize,c=Tb[b];if(c)return c;for(var d='<span class="cm-tab">',e=0;e<b;++e)d+=" ";return Tb[b]={html:d+"</span>",width:b}}function gd(){T.className=T.className.replace(/\s*cm-s-\w+/g,"")+f.theme.replace(/(^|\s)\s*/g," cm-s-")}function hd(){this.set=[]}function id(a,b,c){function e(a,b,c,e){Yb(a).addMark(new p(b,c,e,d))}a=Uc(a),b=Uc(b);var d=new hd;if(!$(a,b))return d;if(a.line==b.line)e(a.line,a.ch,b.ch,c);else{e(a.line,a.ch,null,c);for(var f=a.line+1,g=b.line;f<g;++f)e(f,null,null,c);e(b.line,null,b.ch,c)}return Gb.push({from:a.line,to:b.line+1}),d}function jd(a){a=Uc(a);var b=new q(a.ch);return Yb(a.line).addMark(b),b}function kd(a){a=Uc(a);var b=[],c=Yb(a.line).marked;if(!c)return b;for(var d=0,e=c.length;d<e;++d){var f=c[d];(f.from==null||f.from<=a.ch)&&(f.to==null||f.to>=a.ch)&&b.push(f.marker||f)}return b}function ld(a,b,c){return typeof a=="number"&&(a=Yb(Tc(a))),a.gutterMarker={text:b,style:c},Kb=!0,a}function md(a){typeof a=="number"&&(a=Yb(Tc(a))),a.gutterMarker=null,Kb=!0}function nd(a,b){var c=a,d=a;return typeof a=="number"?d=Yb(Tc(a)):c=w(a),c==null?null:b(d,c)?(Gb.push({from:c,to:c+1}),d):null}function od(a,b,c){return nd(a,function(a){if(a.className!=b||a.bgClassName!=c)return a.className=b,a.bgClassName=c,!0})}function pd(a,b){return nd(a,function(a,c){if(a.hidden!=b){a.hidden=b,Zb(a,b?0:1);var d=wb.from.line,e=wb.to.line;if(b&&(d==c||e==c)){var f=d==c?Rc({line:d,ch:0},d,0):wb.from,g=e==c?Rc({line:e,ch:0},e,0):wb.to;if(!g)return;Qc(f,g)}return Kb=!0}})}function qd(a){if(typeof a=="number"){if(!Wb(a))return null;var b=a;a=Yb(a);if(!a)return null}else{var b=w(a);if(b==null)return null}var c=a.gutterMarker;return{line:b,handle:a,text:a.text,markerText:c&&c.text,markerClass:c&&c.style,lineClass:a.className,bgClass:a.bgClassName}}function rd(a){return kb.innerHTML="<pre><span>x</span></pre>",kb.firstChild.firstChild.firstChild.nodeValue=a,kb.firstChild.firstChild.offsetWidth||10}function sd(a,b){function e(a){return kb.innerHTML="<pre><span>"+c.getHTML(fd,a)+"</span></pre>",kb.firstChild.firstChild.offsetWidth}if(b<=0)return 0;var c=Yb(a),d=c.text,f=0,g=0,h=d.length,i,j=Math.min(h,Math.ceil(b/Ed()));for(;;){var k=e(j);if(!(k<=b&&j<h)){i=k,h=j;break}j=Math.min(h,Math.ceil(j*1.2))}if(b>i)return h;j=Math.floor(h*.8),k=e(j),k<b&&(f=j,g=k);for(;;){if(h-f<=1)return i-b>b-g?f:h;var l=Math.ceil((f+h)/2),m=e(l);m>b?(h=l,i=m):(f=l,g=m)}}function ud(a,b){if(b==0)return{top:0,left:0};var c="";if(f.lineWrapping){var d=a.text.indexOf(" ",b+6);c=bb(a.text.slice(b+1,d<0?a.text.length:d+(M?5:0)))}kb.innerHTML="<pre>"+a.getHTML(fd,b)+'<span id="CodeMirror-temp-'+td+'">'+bb(a.text.charAt(b)||" ")+"</span>"+c+"</pre>";var e=document.getElementById("CodeMirror-temp-"+td),g=e.offsetTop,h=e.offsetLeft;if(M&&g==0&&h==0){var i=document.createElement("span");i.innerHTML="x",e.parentNode.insertBefore(i,e.nextSibling),g=i.offsetTop}return{top:g,left:h}}function vd(a,b){var c,d=Bd(),e=d*(y(tb,a.line)-(b?Mb:0));if(a.ch==0)c=0;else{var g=ud(Yb(a.line),a.ch);c=g.left,f.lineWrapping&&(e+=Math.max(0,g.top))}return{x:c,y:e,yBot:e+d}}function wd(a,b){function l(a){var b=ud(h,a);if(j){var d=Math.round(b.top/c);return Math.max(0,b.left+(d-k)*T.clientWidth)}return b.left}b<0&&(b=0);var c=Bd(),d=Ed(),e=Mb+Math.floor(b/c),g=x(tb,e);if(g>=tb.size)return{line:tb.size-1,ch:Yb(tb.size-1).text.length};var h=Yb(g),i=h.text,j=f.lineWrapping,k=j?e-y(tb,g):0;if(a<=0&&k==0)return{line:g,ch:0};var m=0,n=0,o=i.length,p,q=Math.min(o,Math.ceil((a+k*T.clientWidth*.9)/d));for(;;){var r=l(q);if(!(r<=a&&q<o)){p=r,o=q;break}q=Math.min(o,Math.ceil(q*1.2))}if(a>p)return{line:g,ch:o};q=Math.floor(o*.8),r=l(q),r<a&&(m=q,n=r);for(;;){if(o-m<=1)return{line:g,ch:p-a>a-n?m:o};var s=Math.ceil((m+o)/2),t=l(s);t>a?(o=s,p=t):(m=s,n=t)}}function xd(a){var b=vd(a,!0),c=W(jb);return{x:c.left+b.x,y:c.top+b.y,yBot:c.top+b.yBot}}function Bd(){if(Ad==null){Ad="<pre>";for(var a=0;a<49;++a)Ad+="x<br/>";Ad+="x</pre>"}var b=nb.clientHeight;return b==zd?yd:(zd=b,kb.innerHTML=Ad,yd=kb.firstChild.offsetHeight/50||1,kb.innerHTML="",yd)}function Ed(){return T.clientWidth==Dd?Cd:(Dd=T.clientWidth,Cd=rd("x"))}function Fd(){return jb.offsetTop}function Gd(){return jb.offsetLeft}function Hd(a,b){var c=W(T,!0),d,e;try{d=a.clientX,e=a.clientY}catch(a){return null}if(!b&&(d-c.left>T.clientWidth||e-c.top>T.clientHeight))return null;var f=W(jb,!0);return wd(d-f.left,e-f.top)}function Id(a){function f(){var a=fb(D.value).join("\n");a!=e&&Ud(uc)(a,"end"),A.style.position="relative",D.style.cssText=d,N&&(T.scrollTop=c),Jb=!1,Dc(!0),zc()}var b=Hd(a),c=T.scrollTop;if(!b||window.opera)return;(Z(wb.from,wb.to)||$(b,wb.from)||!$(b,wb.to))&&Ud(Sc)(b.line,b.ch);var d=D.style.cssText;A.style.position="absolute",D.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(a.clientY-5)+"px; left: "+(a.clientX-5)+"px; z-index: 1000; background: white; "+"border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",Jb=!0;var e=D.value=xc();Ec(),Y(D);if(L){E(a);var g=I(window,"mouseup",function(){g(),setTimeout(f,20)},!0)}else setTimeout(f,50)}function Jd(){clearInterval(rb);var a=!0;lb.style.visibility="",rb=setInterval(function(){lb.style.visibility=(a=!a)?"":"hidden"},650)}function Ld(a){function p(a,b,c){if(!a.text)return;var d=a.styles,e=g?0:a.text.length-1,f;for(var i=g?0:d.length-2,j=g?d.length:-2;i!=j;i+=2*h){var k=d[i];if(d[i+1]!=null&&d[i+1]!=m){e+=h*k.length;continue}for(var l=g?0:k.length-1,p=g?k.length:-1;l!=p;l+=h,e+=h)if(e>=b&&e<c&&o.test(f=k.charAt(l))){var q=Kd[f];if(q.charAt(1)==">"==g)n.push(f);else{if(n.pop()!=q.charAt(0))return{pos:e,match:!1};if(!n.length)return{pos:e,match:!0}}}}}var b=wb.inverted?wb.from:wb.to,c=Yb(b.line),d=b.ch-1,e=d>=0&&Kd[c.text.charAt(d)]||Kd[c.text.charAt(++d)];if(!e)return;var f=e.charAt(0),g=e.charAt(1)==">",h=g?1:-1,i=c.styles;for(var j=d+1,k=0,l=i.length;k<l;k+=2)if((j-=i[k].length)<=0){var m=i[k+1];break}var n=[c.text.charAt(d)],o=/[(){}[\]]/;for(var k=b.line,l=g?Math.min(k+100,tb.size):Math.max(-1,k-100);k!=l;k+=h){var c=Yb(k),q=k==b.line,r=p(c,q&&g?d+1:0,q&&!g?d:c.text.length);if(r)break}r||(r={pos:null,match:!1});var m=r.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",s=id({line:b.line,ch:d},{line:b.line,ch:d+1},m),t=r.pos!=null&&id({line:k,ch:r.pos},{line:k,ch:r.pos+1},m),u=Ud(function(){s.clear(),t&&t.clear()});a?setTimeout(u,800):Qb=u}function Md(a){var b,c;for(var d=a,e=a-40;d>e;--d){if(d==0)return 0;var g=Yb(d-1);if(g.stateAfter)return d;var h=g.indentation(f.tabSize);if(c==null||b>h)c=d-1,b=h}return c}function Nd(a){var b=Md(a),c=b&&Yb(b-1).stateAfter;return c?c=m(sb,c):c=n(sb),tb.iter(b,a,function(a){a.highlight(sb,c,f.tabSize),a.stateAfter=m(sb,c)}),b<a&&Gb.push({from:b,to:a}),a<tb.size&&!Yb(a).stateAfter&&ub.push(a),c}function Od(a,b){var c=Nd(a);tb.iter(a,b,function(a){a.highlight(sb,c,f.tabSize),a.stateAfter=m(sb,c)})}function Pd(){var a=+(new Date)+f.workTime,b=ub.length;while(ub.length){if(!Yb(Nb).stateAfter)var c=Nb;else var c=ub.pop();if(c>=tb.size)continue;var d=Md(c),e=d&&Yb(d-1).stateAfter;e?e=m(sb,e):e=n(sb);var g=0,h=sb.compareStates,i=!1,j=d,k=!1;tb.iter(j,tb.size,function(b){var d=b.stateAfter;if(+(new Date)>a)return ub.push(j),Qd(f.workDelay),i&&Gb.push({from:c,to:j+1}),k=!0;var l=b.highlight(sb,e,f.tabSize);l&&(i=!0),b.stateAfter=m(sb,e);var n=null;if(h){var o=d&&h(d,e);o!=K&&(n=!!o)}n==null&&(l!==!1||!d?g=0:++g>3&&(!sb.indent||sb.indent(d,"")==sb.indent(e,""))&&(n=!0));if(n)return!0;++j});if(k)return;i&&Gb.push({from:c,to:j+1})}b&&f.onHighlightComplete&&f.onHighlightComplete(Xb)}function Qd(a){if(!ub.length)return;qb.set(a,Ud(Pd))}function Rd(){Eb=Fb=Hb=null,Gb=[],Ib=!1,Lb=[]}function Sd(){var a=!1,b;Ib&&(a=!Gc()),Gb.length?b=Jc(Gb,!0):(Ib&&Nc(),Kb&&Mc()),a&&Gc(),Ib&&(Fc(),Jd()),vb&&!Jb&&(Eb===!0||Eb!==!1&&Ib)&&Dc(Fb),Ib&&f.matchBrackets&&setTimeout(Ud(function(){Qb&&(Qb(),Qb=null),Z(wb.from,wb.to)&&Ld(!1)}),20);var c=Hb,d=Lb;Ib&&f.onCursorActivity&&f.onCursorActivity(Xb),c&&f.onChange&&Xb&&f.onChange(Xb,c);for(var e=0;e<d.length;++e)d[e](Xb);b&&f.onUpdate&&f.onUpdate(Xb)}function Ud(a){return function(){Td++||Rd();try{var b=a.apply(this,arguments)}finally{--Td||Sd()}return b}}var f={},i=a.defaults;for(var o in i)i.hasOwnProperty(o)&&(f[o]=(e&&e.hasOwnProperty(o)?e:i)[o]);var s=document.createElement("div");s.className="CodeMirror"+(f.lineWrapping?" CodeMirror-wrap":""),s.innerHTML='<div style="overflow: hidden; position: relative; width: 3px; height: 0px;"><textarea style="position: absolute; padding: 0; width: 1px; height: 1em" wrap="off" autocorrect="off" autocapitalize="off"></textarea></div><div class="CodeMirror-scroll" tabindex="-1"><div style="position: relative"><div style="position: relative"><div class="CodeMirror-gutter"><div class="CodeMirror-gutter-text"></div></div><div class="CodeMirror-lines"><div style="position: relative; z-index: 0"><div style="position: absolute; width: 100%; height: 0; overflow: hidden; visibility: hidden;"></div><pre class="CodeMirror-cursor"> </pre><div style="position: relative; z-index: -1"></div><div></div></div></div></div></div></div>',d.appendChild?d.appendChild(s):d(s);var A=s.firstChild,D=A.firstChild,T=s.lastChild,U=T.firstChild,V=U.firstChild,ab=V.firstChild,ib=ab.firstChild,jb=ab.nextSibling.firstChild,kb=jb.firstChild,lb=kb.nextSibling,mb=lb.nextSibling,nb=mb.nextSibling;gd(),b&&(D.style.width="0px"),P||(jb.draggable=!0),jb.style.outline="none",f.tabindex!=null&&(D.tabIndex=f.tabindex),f.autofocus&&Ec(),!f.gutter&&!f.lineNumbers&&(ab.style.display="none"),R&&(A.style.height="1px",A.style.position="absolute");try{rd("x")}catch(ob){throw ob.message.match(/runtime/i)&&(ob=new Error("A CodeMirror inside a P-style element does not work in Internet Explorer. (innerHTML bug)")),ob}var pb=new J,qb=new J,rb,sb,tb=new u([new t([new r("")])]),ub,vb;cd();var wb={from:{line:0,ch:0},to:{line:0,ch:0},inverted:!1},xb,yb,zb,Ab=0,Bb,Cb=!1,Db=!1,Eb,Fb,Gb,Hb,Ib,Jb,Kb,Lb,Mb=0,Nb=0,Ob=0,Pb=0,Qb,Rb="",Sb,Tb={};Ud(function(){$b(f.value||""),Eb=!1})();var Ub=new z;I(T,"mousedown",Ud(ac)),I(T,"dblclick",Ud(bc)),I(jb,"selectstart",C),L||I(T,"contextmenu",Id),I(T,"scroll",function(){Ab=T.scrollTop,Jc([]),f.fixedGutter&&(ab.style.left=T.scrollLeft+"px"),f.onScroll&&f.onScroll(Xb)}),I(window,"resize",function(){Jc(!0)}),I(D,"keyup",Ud(lc)),I(D,"input",Ac),I(D,"keydown",Ud(jc)),I(D,"keypress",Ud(kc)),I(D,"focus",mc),I(D,"blur",nc),f.dragDrop&&(I(jb,"dragstart",dc),I(T,"dragenter",E),I(T,"dragover",E),I(T,"drop",Ud(cc))),I(T,"paste",function(){Ec(),Ac()}),I(D,"paste",Ac),I(D,"cut",Ud(function(){f.readOnly||uc("")})),R&&I(U,"mouseup",function(){document.activeElement==D&&D.blur(),Ec()});var Vb;try{Vb=document.activeElement==D}catch(ob){}Vb||f.autofocus?setTimeout(mc,20):nc();var Xb=s.CodeMirror={getValue:_b,setValue:Ud($b),getSelection:xc,replaceSelection:Ud(uc),focus:function(){window.focus(),Ec(),mc(),Ac()},setOption:function(a,b){var c=f[a];f[a]=b,a=="mode"||a=="indentUnit"?cd():a=="readOnly"&&b=="nocursor"?(nc(),D.blur()):a=="readOnly"&&!b?Dc(!0):a=="theme"?gd():a=="lineWrapping"&&c!=b?Ud(ed)():a=="tabSize"&&Jc(!0);if(a=="lineNumbers"||a=="gutter"||a=="firstLineNumber"||a=="theme")dd(),Jc(!0)},getOption:function(a){return f[a]},undo:Ud(qc),redo:Ud(rc),indentLine:Ud(function(a,b){typeof b!="string"&&(b==null?b=f.smartIndent?"smart":"prev":b=b?"add":"subtract"),Wb(a)&&bd(a,b)}),indentSelection:Ud(ad),historySize:function(){return{undo:Ub.done.length,redo:Ub.undone.length}},clearHistory:function(){Ub=new z},matchBrackets:Ud(function(){Ld(!0)}),getTokenAt:Ud(function(a){return a=Uc(a),Yb(a.line).getTokenAt(sb,Nd(a.line),a.ch)}),getStateAfter:function(a){return a=Tc(a==null?tb.size-1:a),Nd(a+1)},cursorCoords:function(a,b){return a==null&&(a=wb.inverted),this.charCoords(a?wb.from:wb.to,b)},charCoords:function(a,b){return a=Uc(a),b=="local"?vd(a,!1):b=="div"?vd(a,!0):xd(a)},coordsChar:function(a){var b=W(jb);return wd(a.x-b.left,a.y-b.top)},markText:Ud(id),setBookmark:jd,findMarksAt:kd,setMarker:Ud(ld),clearMarker:Ud(md),setLineClass:Ud(od),hideLine:Ud(function(a){return pd(a,!0)}),showLine:Ud(function(a){return pd(a,!1)}),onDeleteLine:function(a,b){if(typeof a=="number"){if(!Wb(a))return null;a=Yb(a)}return(a.handlers||(a.handlers=[])).push(b),a},lineInfo:qd,addWidget:function(a,b,c,d,e){a=vd(Uc(a));var f=a.yBot,g=a.x;b.style.position="absolute",U.appendChild(b);if(d=="over")f=a.y;else if(d=="near"){var h=Math.max(T.offsetHeight,tb.height*Bd()),i=Math.max(U.clientWidth,jb.clientWidth)-Gd();a.yBot+b.offsetHeight>h&&a.y>b.offsetHeight&&(f=a.y-b.offsetHeight),g+b.offsetWidth>i&&(g=i-b.offsetWidth)}b.style.top=f+Fd()+"px",b.style.left=b.style.right="",e=="right"?(g=U.clientWidth-b.offsetWidth,b.style.right="0px"):(e=="left"?g=0:e=="middle"&&(g=(U.clientWidth-b.offsetWidth)/2),b.style.left=g+Gd()+"px"),c&&Hc(g,f,g+b.offsetWidth,f+b.offsetHeight)},lineCount:function(){return tb.size},clipPos:Uc,getCursor:function(a){return a==null&&(a=wb.inverted),_(a?wb.from:wb.to)},somethingSelected:function(){return!Z(wb.from,wb.to)},setCursor:Ud(function(a,b,c){b==null&&typeof a.line=="number"?Sc(a.line,a.ch,c):Sc(a,b,c)}),setSelection:Ud(function(a,b,c){(c?Pc:Qc)(Uc(a),Uc(b||a))}),getLine:function(a){if(Wb(a))return Yb(a).text},getLineHandle:function(a){if(Wb(a))return Yb(a)},setLine:Ud(function(a,b){Wb(a)&&tc(b,{line:a,ch:0},{line:a,ch:Yb(a).text.length})}),removeLine:Ud(function(a){Wb(a)&&tc("",{line:a,ch:0},Uc({line:a+1,ch:0}))}),replaceRange:Ud(tc),getRange:function(a,b){return wc(Uc(a),Uc(b))},triggerOnKeyDown:Ud(jc),execCommand:function(a){return h[a](Xb)},moveH:Ud(Wc),deleteH:Ud(Xc),moveV:Ud(Zc),toggleOverwrite:function(){Cb?(Cb=!1,lb.className=lb.className.replace(" CodeMirror-overwrite","")):(Cb=!0,lb.className+=" CodeMirror-overwrite")},posFromIndex:function(a){var b=0,c;return tb.iter(0,tb.size,function(d){var e=d.text.length+1;if(e>a)return c=a,!0;a-=e,++b}),Uc({line:b,ch:c})},indexFromPos:function(a){if(a.line<0||a.ch<0)return 0;var b=a.ch;return tb.iter(0,a.line,function(a){b+=a.text.length+1}),b},scrollTo:function(a,b){a!=null&&(T.scrollLeft=a),b!=null&&(T.scrollTop=b),Jc([])},operation:function(a){return Ud(a)()},refresh:function(){Jc(!0),T.scrollHeight>Ab&&(T.scrollTop=Ab)},getInputField:function(){return D},getWrapperElement:function(){return s},getScrollerElement:function(){return T},getGutterElement:function(){return ab}},hc=null,ic,yc=!1,Bc="",Yc=null;hd.prototype.clear=Ud(function(){var a=Infinity,b=-Infinity;for(var c=0,d=this.set.length;c<d;++c){var e=this.set[c],f=e.marked;if(!f||!e.parent)continue;var g=w(e);a=Math.min(a,g),b=Math.max(b,g);for(var h=0;h<f.length;++h)f[h].marker==this&&f.splice(h--,1)}a!=Infinity&&Gb.push({from:a,to:b+1})}),hd.prototype.find=function(){var a,b;for(var c=0,d=this.set.length;c<d;++c){var e=this.set[c],f=e.marked;for(var g=0;g<f.length;++g){var h=f[g];if(h.marker==this)if(h.from!=null||h.to!=null){var i=w(e);i!=null&&(h.from!=null&&(a={line:i,ch:h.from}),h.to!=null&&(b={line:i,ch:h.to}))}}}return{from:a,to:b}};var td=Math.floor(Math.random()*16777215).toString(16),yd,zd,Ad,Cd,Dd=0,Kd={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},Td=0;for(var Vd in g)g.propertyIsEnumerable(Vd)&&!Xb.propertyIsEnumerable(Vd)&&(Xb[Vd]=g[Vd]);return Xb}function j(a){return typeof a=="string"?i[a]:a}function k(a,b,c,d){function e(b){b=j(b);var c=b[a];if(c!=null&&d(c))return!0;if(b.catchall)return d(b.catchall);var f=b.fallthrough;if(f==null)return!1;if(Object.prototype.toString.call(f)!="[object Array]")return e(f);for(var g=0,h=f.length;g<h;++g)if(e(f[g]))return!0;return!1}return b&&e(b)?!0:e(c)}function l(a){var b=hb[H(a,"keyCode")];return b=="Ctrl"||b=="Alt"||b=="Shift"||b=="Mod"}function m(a,b){if(b===!0)return b;if(a.copyState)return a.copyState(b);var c={};for(var d in b){var e=b[d];e instanceof Array&&(e=e.concat([])),c[d]=e}return c}function n(a,b,c){return a.startState?a.startState(b,c):!0}function o(a,b){this.pos=this.start=0,this.string=a,this.tabSize=b||8}function p(a,b,c,d){this.from=a,this.to=b,this.style=c,this.marker=d}function q(a){this.from=a,this.to=a,this.line=null}function r(a,b){this.styles=b||[a,null],this.text=a,this.height=1,this.marked=this.gutterMarker=this.className=this.bgClassName=this.handlers=null,this.stateAfter=this.parent=this.hidden=null}function s(a,b,c,d){for(var e=0,f=0,g=0;f<b;e+=2){var h=c[e],i=f+h.length;g==0?(i>a&&d.push(h.slice(a-f,Math.min(h.length,b-f)),c[e+1]),i>=a&&(g=1)):g==1&&(i>b?d.push(h.slice(0,b-f),c[e+1]):d.push(h,c[e+1])),f=i}}function t(a){this.lines=a,this.parent=null;for(var b=0,c=a.length,d=0;b<c;++b)a[b].parent=this,d+=a[b].height;this.height=d}function u(a){this.children=a;var b=0,c=0;for(var d=0,e=a.length;d<e;++d){var f=a[d];b+=f.chunkSize(),c+=f.height,f.parent=this}this.size=b,this.height=c,this.parent=null}function v(a,b){while(!a.lines)for(var c=0;;++c){var d=a.children[c],e=d.chunkSize();if(b<e){a=d;break}b-=e}return a.lines[b]}function w(a){if(a.parent==null)return null;var b=a.parent,c=db(b.lines,a);for(var d=b.parent;d;b=d,d=d.parent)for(var e=0,f=d.children.length;;++e){if(d.children[e]==b)break;c+=d.children[e].chunkSize()}return c}function x(a,b){var c=0;a:do{for(var d=0,e=a.children.length;d<e;++d){var f=a.children[d],g=f.height;if(b<g){a=f;continue a}b-=g,c+=f.chunkSize()}return c}while(!a.lines);for(var d=0,e=a.lines.length;d<e;++d){var h=a.lines[d],i=h.height;if(b<i)break;b-=i}return c+d}function y(a,b){var c=0;a:do{for(var d=0,e=a.children.length;d<e;++d){var f=a.children[d],g=f.chunkSize();if(b<g){a=f;continue a}b-=g,c+=f.height}return c}while(!a.lines);for(var d=0;d<b;++d)c+=a.lines[d].height;return c}function z(){this.time=0,this.done=[],this.undone=[]}function A(){E(this)}function B(a){return a.stop||(a.stop=A),a}function C(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function D(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function E(a){C(a),D(a)}function F(a){return a.target||a.srcElement}function G(a){if(a.which)return a.which;if(a.button&1)return 1;if(a.button&2)return 3;if(a.button&4)return 2}function H(a,b){var c=a.override&&a.override.hasOwnProperty(b);return c?a.override[b]:a[b]}function I(a,b,c,d){if(typeof a.addEventListener=="function"){a.addEventListener(b,c,!1);if(d)return function(){a.removeEventListener(b,c,!1)}}else{var e=function(a){c(a||window.event)};a.attachEvent("on"+b,e);if(d)return function(){a.detachEvent("on"+b,e)}}}function J(){this.id=null}function U(a,b,c){b==null&&(b=a.search(/[^\s\u00a0]/),b==-1&&(b=a.length));for(var d=0,e=0;d<b;++d)a.charAt(d)==" "?e+=c-e%c:++e;return e}function V(a){return a.currentStyle?a.currentStyle:window.getComputedStyle(a,null)}function W(a,b){var c=a.ownerDocument.body,d=0,e=0,f=!1;for(var g=a;g;g=g.offsetParent){var h=g.offsetLeft,i=g.offsetTop;g==c?(d+=Math.abs(h),e+=Math.abs(i)):(d+=h,e+=i),b&&V(g).position=="fixed"&&(f=!0)}var j=b&&!f?null:c;for(var g=a.parentNode;g!=j;g=g.parentNode)g.scrollLeft!=null&&(d-=g.scrollLeft,e-=g.scrollTop);return{left:d,top:e}}function X(a){return a.textContent||a.innerText||a.nodeValue||""}function Y(a){b?(a.selectionStart=0,a.selectionEnd=a.value.length):a.select()}function Z(a,b){return a.line==b.line&&a.ch==b.ch}function $(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch}function _(a){return{line:a.line,ch:a.ch}}function bb(a){return ab.textContent=a,ab.innerHTML}function cb(a,b){if(!b)return 0;if(!a)return b.length;for(var c=a.length,d=b.length;c>=0&&d>=0;--c,--d)if(a.charAt(c)!=b.charAt(d))break;return d+1}function db(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0,d=a.length;c<d;++c)if(a[c]==b)return c;return-1}function eb(a){return/\w/.test(a)||a.toUpperCase()!=a.toLowerCase()}a.defaults={value:"",mode:null,theme:"default",indentUnit:2,indentWithTabs:!1,smartIndent:!0,tabSize:4,keyMap:"default",extraKeys:null,electricChars:!0,autoClearEmptyLines:!1,onKeyEvent:null,lineWrapping:!1,lineNumbers:!1,gutter:!1,fixedGutter:!1,firstLineNumber:1,readOnly:!1,dragDrop:!0,onChange:null,onCursorActivity:null,onGutterClick:null,onHighlightComplete:null,onUpdate:null,onFocus:null,onBlur:null,onScroll:null,matchBrackets:!1,workTime:100,workDelay:200,pollInterval:100,undoDepth:40,tabindex:null,autofocus:null};var b=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),c=b||/Mac/.test(navigator.platform),d=/Win/.test(navigator.platform),e=a.modes={},f=a.mimeModes={};a.defineMode=function(b,c){!a.defaults.mode&&b!="null"&&(a.defaults.mode=b);if(arguments.length>2){c.dependencies=[];for(var d=2;d<arguments.length;++d)c.dependencies.push(arguments[d])}e[b]=c},a.defineMIME=function(a,b){f[a]=b},a.resolveMode=function(b){if(typeof b=="string"&&f.hasOwnProperty(b))b=f[b];else if(typeof b=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(b))return a.resolveMode("application/xml");return typeof b=="string"?{name:b}:b||{name:"null"}},a.getMode=function(b,c){var c=a.resolveMode(c),d=e[c.name];return d?d(b,c):a.getMode(b,"text/plain")},a.listModes=function(){var a=[];for(var b in e)e.propertyIsEnumerable(b)&&a.push(b);return a},a.listMIMEs=function(){var a=[];for(var b in f)f.propertyIsEnumerable(b)&&a.push({mime:b,mode:f[b]});return a};var g=a.extensions={};a.defineExtension=function(a,b){g[a]=b};var h=a.commands={selectAll:function(a){a.setSelection({line:0,ch:0},{line:a.lineCount()-1})},killLine:function(a){var b=a.getCursor(!0),c=a.getCursor(!1),d=!Z(b,c);!d&&a.getLine(b.line).length==b.ch?a.replaceRange("",b,{line:b.line+1,ch:0}):a.replaceRange("",b,d?c:{line:b.line})},deleteLine:function(a){var b=a.getCursor().line;a.replaceRange("",{line:b,ch:0},{line:b})},undo:function(a){a.undo()},redo:function(a){a.redo()},goDocStart:function(a){a.setCursor(0,0,!0)},goDocEnd:function(a){a.setSelection({line:a.lineCount()-1},null,!0)},goLineStart:function(a){a.setCursor(a.getCursor().line,0,!0)},goLineStartSmart:function(a){var b=a.getCursor(),c=a.getLine(b.line),d=Math.max(0,c.search(/\S/));a.setCursor(b.line,b.ch<=d&&b.ch?0:d,!0)},goLineEnd:function(a){a.setSelection({line:a.getCursor().line},null,!0)},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,"line")},goPageUp:function(a){a.moveV(-1,"page")},goPageDown:function(a){a.moveV(1,"page")},goCharLeft:function(a){a.moveH(-1,"char")},goCharRight:function(a){a.moveH(1,"char")},goColumnLeft:function(a){a.moveH(-1,"column")},goColumnRight:function(a){a.moveH(1,"column")},goWordLeft:function(a){a.moveH(-1,"word")},goWordRight:function(a){a.moveH(1,"word")},delCharLeft:function(a){a.deleteH(-1,"char")},delCharRight:function(a){a.deleteH(1,"char")},delWordLeft:function(a){a.deleteH(-1,"word")},delWordRight:function(a){a.deleteH(1,"word")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection(" ","end")},transposeChars:function(a){var b=a.getCursor(),c=a.getLine(b.line);b.ch>0&&b.ch<c.length-1&&a.replaceRange(c.charAt(b.ch)+c.charAt(b.ch-1),{line:b.line,ch:b.ch-1},{line:b.line,ch:b.ch+1})},newlineAndIndent:function(a){a.replaceSelection("\n","end"),a.indentLine(a.getCursor().line)},toggleOverwrite:function(a){a.toggleOverwrite()}},i=a.keyMap={};i.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharRight",Backspace:"delCharLeft",Tab:"insertTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"},i.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Alt-Up":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Down":"goDocEnd","Ctrl-Left":"goWordLeft","Ctrl-Right":"goWordRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delWordLeft","Ctrl-Delete":"delWordRight","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",fallthrough:"basic"},i.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goWordLeft","Alt-Right":"goWordRight","Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delWordLeft","Ctrl-Alt-Backspace":"delWordRight","Alt-Delete":"delWordRight","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",fallthrough:["basic","emacsy"]},i["default"]=c?i.macDefault:i.pcDefault,i.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":"goPageUp","Shift-Ctrl-V":"goPageDown","Ctrl-D":"delCharRight","Ctrl-H":"delCharLeft","Alt-D":"delWordRight","Alt-Backspace":"delWordLeft","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},a.fromTextArea=function(b,c){function d(){b.value=h.getValue()}c||(c={}),c.value=b.value,!c.tabindex&&b.tabindex&&(c.tabindex=b.tabindex),c.autofocus==null&&b.getAttribute("autofocus")!=null&&(c.autofocus=!0);if(b.form){var e=I(b.form,"submit",d,!0);if(typeof b.form.submit=="function"){var f=b.form.submit;function g(){d(),b.form.submit=f,b.form.submit(),b.form.submit=g}b.form.submit=g}}b.style.display="none";var h=a(function(a){b.parentNode.insertBefore(a,b.nextSibling)},c);return h.save=d,h.getTextArea=function(){return b},h.toTextArea=function(){d(),b.parentNode.removeChild(h.getWrapperElement()),b.style.display="",b.form&&(e(),typeof b.form.submit=="function"&&(b.form.submit=f))},h},a.copyState=m,a.startState=n,o.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return this.pos==0},peek:function(){return this.string.charAt(this.pos)},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},eat:function(a){var b=this.string.charAt(this.pos);if(typeof a=="string")var c=b==a;else var c=b&&(a.test?a.test(b):a(b));if(c)return++this.pos,b},eatWhile:function(a){var b=this.pos;while(this.eat(a));return this.pos>b},eatSpace:function(){var a=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos)))++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){var b=this.string.indexOf(a,this.pos);if(b>-1)return this.pos=b,!0},backUp:function(a){this.pos-=a},column:function(){return U(this.string,this.start,this.tabSize)},indentation:function(){return U(this.string,null,this.tabSize)},match:function(a,b,c){if(typeof a!="string"){var e=this.string.slice(this.pos).match(a);return e&&b!==!1&&(this.pos+=e[0].length),e}function d(a){return c?a.toLowerCase():a}if(d(this.string).indexOf(d(a),this.pos)==this.pos)return b!==!1&&(this.pos+=a.length),!0},current:function(){return this.string.slice(this.start,this.pos)}},a.StringStream=o,p.prototype={attach:function(a){this.marker.set.push(a)},detach:function(a){var b=db(this.marker.set,a);b>-1&&this.marker.set.splice(b,1)},split:function(a,b){if(this.to<=a&&this.to!=null)return null;var c=this.from<a||this.from==null?null:this.from-a+b,d=this.to==null?null:this.to-a+b;return new p(c,d,this.style,this.marker)},dup:function(){return new p(null,null,this.style,this.marker)},clipTo:function(a,b,c,d,e){a&&d>this.from&&(d<this.to||this.to==null)?this.from=null:this.from!=null&&this.from>=b&&(this.from=Math.max(d,this.from)+e),c&&(b<this.to||this.to==null)&&(b>this.from||this.from==null)?this.to=null:this.to!=null&&this.to>b&&(this.to=d<this.to?this.to+e:b)},isDead:function(){return this.from!=null&&this.to!=null&&this.from>=this.to},sameSet:function(a){return this.marker==a.marker}},q.prototype={attach:function(a){this.line=a},detach:function(a){this.line==a&&(this.line=null)},split:function(a,b){if(a<this.from)return this.from=this.to=this.from-a+b,this},isDead:function(){return this.from>this.to},clipTo:function(a,b,c,d,e){(a||b<this.from)&&(c||d>this.to)?(this.from=0,this.to=-1):this.from>b&&(this.from=this.to=Math.max(d,this.from)+e)},sameSet:function(a){return!1},find:function(){return!this.line||!this.line.parent?null:{line:w(this.line),ch:this.from}},clear:function(){if(this.line){var a=db(this.line.marked,this);a!=-1&&this.line.marked.splice(a,1),this.line=null}}},r.inheritMarks=function(a,b){var c=new r(a),d=b&&b.marked;if(d)for(var e=0;e<d.length;++e)if(d[e].to==null&&d[e].style){var f=c.marked||(c.marked=[]),g=d[e],h=g.dup();f.push(h),h.attach(c)}return c},r.prototype={replace:function(a,b,c){var d=[],e=this.marked,f=b==null?this.text.length:b;s(0,a,this.styles,d),c&&d.push(c,null),s(f,this.text.length,this.styles,d),this.styles=d,this.text=this.text.slice(0,a)+c+this.text.slice(f),this.stateAfter=null;if(e){var g=c.length-(f-a);for(var h=0;h<e.length;++h){var i=e[h];i.clipTo(a==null,a||0,b==null,f,g),i.isDead()&&(i.detach(this),e.splice(h--,1))}}},split:function(a,b){var c=[b,null],d=this.marked;s(a,this.text.length,this.styles,c);var e=new r(b+this.text.slice(a),c);if(d)for(var f=0;f<d.length;++f){var g=d[f],h=g.split(a,b.length);h&&(e.marked||(e.marked=[]),e.marked.push(h),h.attach(e),h==g&&d.splice(f--,1))}return e},append:function(a){var b=this.text.length,c=a.marked,d=this.marked;this.text+=a.text,s(0,a.text.length,a.styles,this.styles);if(d)for(var e=0;e<d.length;++e)d[e].to==null&&(d[e].to=b);if(c&&c.length){d||(this.marked=d=[]);a:for(var e=0;e<c.length;++e){var f=c[e];if(!f.from)for(var g=0;g<d.length;++g){var h=d[g];if(h.to==b&&h.sameSet(f)){h.to=f.to==null?null:f.to+b,h.isDead()&&(h.detach(this),c.splice(e--,1));continue a}}d.push(f),f.attach(this),f.from+=b,f.to!=null&&(f.to+=b)}}},fixMarkEnds:function(a){var b=this.marked,c=a.marked;if(!b)return;for(var d=0;d<b.length;++d){var e=b[d],f=e.to==null;if(f&&c)for(var g=0;g<c.length;++g)if(c[g].sameSet(e)){f=!1;break}f&&(e.to=this.text.length)}},fixMarkStarts:function(){var a=this.marked;if(!a)return;for(var b=0;b<a.length;++b)a[b].from==null&&(a[b].from=0)},addMark:function(a){a.attach(this),this.marked==null&&(this.marked=[]),this.marked.push(a),this.marked.sort(function(a,b){return(a.from||0)-(b.from||0)})},highlight:function(a,b,c){var d=new o(this.text,c),e=this.styles,f=0,g=!1,h=e[0],i;this.text==""&&a.blankLine&&a.blankLine(b);while(!d.eol()){var j=a.token(d,b),k=this.text.slice(d.start,d.pos);d.start=d.pos,f&&e[f-1]==j?e[f-2]+=k:k&&(!g&&(e[f+1]!=j||f&&e[f-2]!=i)&&(g=!0),e[f++]=k,e[f++]=j,i=h,h=e[f]);if(d.pos>5e3){e[f++]=this.text.slice(d.pos),e[f++]=null;break}}return e.length!=f&&(e.length=f,g=!0),f&&e[f-2]!=i&&(g=!0),g||(e.length<5&&this.text.length<10?null:!1)},getTokenAt:function(a,b,c){var d=this.text,e=new o(d);while(e.pos<c&&!e.eol()){e.start=e.pos;var f=a.token(e,b)}return{start:e.start,end:e.pos,string:e.current(),className:f||null,state:b}},indentation:function(a){return U(this.text,null,a)},getHTML:function(a,b){function f(b,f){if(!b)return;d&&M&&b.charAt(0)==" "&&(b="\u00a0"+b.slice(1)),d=!1;if(b.indexOf(" ")==-1){e+=b.length;var g=bb(b)}else{var g="";for(var h=0;;){var i=b.indexOf(" ",h);if(i==-1){g+=bb(b.slice(h)),e+=b.length-h;break}e+=i-h;var j=a(e);g+=bb(b.slice(h,i))+j.html,e+=j.width,h=i+1}}f?c.push('<span class="',f,'">',g,"</span>"):c.push(g)}function k(a){return a?"cm-"+a.replace(/ +/g," cm-"):null}var c=[],d=!0,e=0,g=this.styles,h=this.text,i=this.marked,j=h.length;b!=null&&(j=Math.min(b,j));if(!h&&b==null)f(" ");else if(!i||!i.length)for(var l=0,m=0;m<j;l+=2){var n=g[l],o=g[l+1],p=n.length;m+p>j&&(n=n.slice(0,j-m)),m+=p,f(n,k(o))}else{var q=0,l=0,r="",o,s=0,t=i[0].from||0,u=[],v=0;function w(){var a;while(v<i.length&&((a=i[v]).from==q||a.from==null))a.style!=null&&u.push(a),++v;t=v<i.length?i[v].from:Infinity;for(var b=0;b<u.length;++b){var c=u[b].to||Infinity;c==q?u.splice(b--,1):t=Math.min(c,t)}}var x=0;while(q<j){t==q&&w();var y=Math.min(j,t);for(;;){if(r){var z=q+r.length,A=o;for(var B=0;B<u.length;++B)A=(A?A+" ":"")+u[B].style;f(z>y?r.slice(0,y-q):r,A);if(z>=y){r=r.slice(y-q),q=y;break}q=z}r=g[l++],o=k(g[l++])}}}return c.join("")},cleanUp:function(){this.parent=null;if(this.marked)for(var a=0,b=this.marked.length;a<b;++a)this.marked[a].detach(this)}},t.prototype={chunkSize:function(){return this.lines.length},remove:function(a,b,c){for(var d=a,e=a+b;d<e;++d){var f=this.lines[d];this.height-=f.height,f.cleanUp();if(f.handlers)for(var g=0;g<f.handlers.length;++g)c.push(f.handlers[g])}this.lines.splice(a,b)},collapse:function(a){a.splice.apply(a,[a.length,0].concat(this.lines))},insertHeight:function(a,b,c){this.height+=c,M?this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a)):this.lines.splice.apply(this.lines,[a,0].concat(b));for(var d=0,e=b.length;d<e;++d)b[d].parent=this},iterN:function(a,b,c){for(var d=a+b;a<d;++a)if(c(this.lines[a]))return!0}},u.prototype={chunkSize:function(){return this.size},remove:function(a,b,c){this.size-=b;for(var d=0;d<this.children.length;++d){var e=this.children[d],f=e.chunkSize();if(a<f){var g=Math.min(b,f-a),h=e.height;e.remove(a,g,c),this.height-=h-e.height,f==g&&(this.children.splice(d--,1),e.parent=null);if((b-=g)==0)break;a=0}else a-=f}if(this.size-b<25){var i=[];this.collapse(i),this.children=[new t(i)],this.children[0].parent=this}},collapse:function(a){for(var b=0,c=this.children.length;b<c;++b)this.children[b].collapse(a)},insert:function(a,b){var c=0;for(var d=0,e=b.length;d<e;++d)c+=b[d].height;this.insertHeight(a,b,c)},insertHeight:function(a,b,c){this.size+=b.length,this.height+=c;for(var d=0,e=this.children.length;d<e;++d){var f=this.children[d],g=f.chunkSize();if(a<=g){f.insertHeight(a,b,c);if(f.lines&&f.lines.length>50){while(f.lines.length>50){var h=f.lines.splice(f.lines.length-25,25),i=new t(h);f.height-=i.height,this.children.splice(d+1,0,i),i.parent=this}this.maybeSpill()}break}a-=g}},maybeSpill:function(){if(this.children.length<=10)return;var a=this;do{var b=a.children.splice(a.children.length-5,5),c=new u(b);if(!a.parent){var d=new u(a.children);d.parent=a,a.children=[d,c],a=d}else{a.size-=c.size,a.height-=c.height;var e=db(a.parent.children,a);a.parent.children.splice(e+1,0,c)}c.parent=a.parent}while(a.children.length>10);a.parent.maybeSpill()},iter:function(a,b,c){this.iterN(a,b-a,c)},iterN:function(a,b,c){for(var d=0,e=this.children.length;d<e;++d){var f=this.children[d],g=f.chunkSize();if(a<g){var h=Math.min(b,g-a);if(f.iterN(a,h,c))return!0;if((b-=h)==0)break;a=0}else a-=g}}},z.prototype={addChange:function(a,b,c){this.undone.length=0;var d=+(new Date),e=this.done[this.done.length-1],f=e&&e[e.length-1],g=d-this.time;if(g>400||!f)this.done.push([{start:a,added:b,old:c}]);else if(f.start>a+c.length||f.start+f.added<a-f.added+f.old.length)e.push({start:a,added:b,old:c});else{var h=0;if(a<f.start){for(var i=f.start-a-1;i>=0;--i)f.old.unshift(c[i]);h=Math.min(0,b-c.length),f.added+=f.start-a+h,f.start=a}else f.start<a&&(h=a-f.start,b+=h);for(var i=f.added-h,j=c.length;i<j;++i)f.old.push(c[i]);f.added<b&&(f.added=b)}this.time=d}},a.e_stop=E,a.e_preventDefault=C,a.e_stopPropagation=D,a.connect=I,J.prototype={set:function(a,b){clearTimeout(this.id),this.id=setTimeout(b,a)}};var K=a.Pass={toString:function(){return"CodeMirror.Pass"}},L=/gecko\/\d{7}/i.test(navigator.userAgent),M=/MSIE \d/.test(navigator.userAgent),N=/MSIE [1-8]\b/.test(navigator.userAgent),O=M&&document.documentMode==5,P=/WebKit\//.test(navigator.userAgent),Q=/Chrome\//.test(navigator.userAgent),R=/KHTML\//.test(navigator.userAgent),S=function(){if(N)return!1;var a=document.createElement("div");return"draggable"in a||"dragDrop"in a}(),T="\n";(function(){var a=document.createElement("textarea");a.value="foo\nbar",a.value.indexOf("\r")>-1&&(T="\r\n")})(),document.documentElement.getBoundingClientRect!=null&&(W=function(a,b){try{var c=a.getBoundingClientRect();c={top:c.top,left:c.left}}catch(d){c={top:0,left:0}}if(!b)if(window.pageYOffset==null){var e=document.documentElement||document.body.parentNode;e.scrollTop==null&&(e=document.body),c.top+=e.scrollTop,c.left+=e.scrollLeft}else c.top+=window.pageYOffset,c.left+=window.pageXOffset;return c});var ab=document.createElement("pre");bb("a")=="\na"?bb=function(a){return ab.textContent=a,ab.innerHTML.slice(1)}:bb(" ")!=" "&&(bb=function(a){return ab.innerHTML="",ab.appendChild(document.createTextNode(a)),ab.innerHTML}),a.htmlEscape=bb;var fb="\n\nb".split(/\n/).length!=3?function(a){var b=0,c,d=[];while((c=a.indexOf("\n",b))>-1)d.push(a.slice(b,a.charAt(c-1)=="\r"?c-1:c)),b=c+1;return d.push(a.slice(b)),d}:function(a){return a.split(/\r?\n/)};a.splitLines=fb;var gb=window.getSelection?function(a){try{return a.selectionStart!=a.selectionEnd}catch(b){return!1}}:function(a){try{var b=a.ownerDocument.selection.createRange()}catch(c){}return!b||b.parentElement()!=a?!1:b.compareEndPoints("StartToEnd",b)!=0};a.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}}),a.defineMIME("text/plain","null");var hb={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",127:"Delete",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63276:"PageUp",63277:"PageDown",63275:"End",63273:"Home",63234:"Left",63232:"Up",63235:"Right",63233:"Down",63302:"Insert",63272:"Delete"};return a.keyNames=hb,function(){for(var a=0;a<10;a++)hb[a+48]=String(a);for(var a=65;a<=90;a++)hb[a]=String.fromCharCode(a);for(var a=1;a<=12;a++)hb[a+111]=hb[a+63235]="F"+a}(),a}();CodeMirror.defineMode("mysql",function(a){function d(a){return new RegExp("^(?:"+a.join("|")+")$","i")}function h(a,b){var d=a.next();c=null;if(d=="$"||d=="?")return a.match(/^[\w\d]*/),"variable-2";if(d=="<"&&!a.match(/^[\s\u00a0=]/,!1))return a.match(/^[^\s\u00a0>]*>?/),"atom";if(d=='"'||d=="'")return b.tokenize=i(d),b.tokenize(a,b);if(d=="`")return b.tokenize=j(d),b.tokenize(a,b);if(/[{}\(\),\.;\[\]]/.test(d))return c=d,null;if(d!="-"){if(g.test(d))return a.eatWhile(g),null;if(d==":")return a.eatWhile(/[\w\d\._\-]/),"atom";a.eatWhile(/[_\w\d]/);if(a.eat(":"))return a.eatWhile(/[\w\d_\-]/),"atom";var h=a.current(),k;return e.test(h)?null:f.test(h)?"keyword":"variable"}ch2=a.next();if(ch2=="-")return a.skipToEnd(),"comment"}function i(a){return function(b,c){var d=!1,e;while((e=b.next())!=null){if(e==a&&!d){c.tokenize=h;break}d=!d&&e=="\\"}return"string"}}function j(a){return function(b,c){var d=!1,e;while((e=b.next())!=null){if(e==a&&!d){c.tokenize=h;break}d=!d&&e=="\\"}return"variable-2"}}function k(a,b,c){a.context={prev:a.context,indent:a.indent,col:c,type:b}}function l(a){a.indent=a.context.indent,a.context=a.context.prev}var b=a.indentUnit,c,e=d(["str","lang","langmatches","datatype","bound","sameterm","isiri","isuri","isblank","isliteral","union","a"]),f=d(["ACCESSIBLE","ALTER","AS","BEFORE","BINARY","BY","CASE","CHARACTER","COLUMN","CONTINUE","CROSS","CURRENT_TIMESTAMP","DATABASE","DAY_MICROSECOND","DEC","DEFAULT","DESC","DISTINCT","DOUBLE","EACH","ENCLOSED","EXIT","FETCH","FLOAT8","FOREIGN","GRANT","HIGH_PRIORITY","HOUR_SECOND","IN","INNER","INSERT","INT2","INT8","INTO","JOIN","KILL","LEFT","LINEAR","LOCALTIME","LONG","LOOP","MATCH","MEDIUMTEXT","MINUTE_SECOND","NATURAL","NULL","OPTIMIZE","OR","OUTER","PRIMARY","RANGE","READ_WRITE","REGEXP","REPEAT","RESTRICT","RIGHT","SCHEMAS","SENSITIVE","SHOW","SPECIFIC","SQLSTATE","SQL_CALC_FOUND_ROWS","STARTING","TERMINATED","TINYINT","TRAILING","UNDO","UNLOCK","USAGE","UTC_DATE","VALUES","VARCHARACTER","WHERE","WRITE","ZEROFILL","ALL","AND","ASENSITIVE","BIGINT","BOTH","CASCADE","CHAR","COLLATE","CONSTRAINT","CREATE","CURRENT_TIME","CURSOR","DAY_HOUR","DAY_SECOND","DECLARE","DELETE","DETERMINISTIC","DIV","DUAL","ELSEIF","EXISTS","FALSE","FLOAT4","FORCE","FULLTEXT","HAVING","HOUR_MINUTE","IGNORE","INFILE","INSENSITIVE","INT1","INT4","INTERVAL","ITERATE","KEYS","LEAVE","LIMIT","LOAD","LOCK","LONGTEXT","MASTER_SSL_VERIFY_SERVER_CERT","MEDIUMINT","MINUTE_MICROSECOND","MODIFIES","NO_WRITE_TO_BINLOG","ON","OPTIONALLY","OUT","PRECISION","PURGE","READS","REFERENCES","RENAME","REQUIRE","REVOKE","SCHEMA","SELECT","SET","SPATIAL","SQLEXCEPTION","SQL_BIG_RESULT","SSL","TABLE","TINYBLOB","TO","TRUE","UNIQUE","UPDATE","USING","UTC_TIMESTAMP","VARCHAR","WHEN","WITH","YEAR_MONTH","ADD","ANALYZE","ASC","BETWEEN","BLOB","CALL","CHANGE","CHECK","CONDITION","CONVERT","CURRENT_DATE","CURRENT_USER","DATABASES","DAY_MINUTE","DECIMAL","DELAYED","DESCRIBE","DISTINCTROW","DROP","ELSE","ESCAPED","EXPLAIN","FLOAT","FOR","FROM","GROUP","HOUR_MICROSECOND","IF","INDEX","INOUT","INT","INT3","INTEGER","IS","KEY","LEADING","LIKE","LINES","LOCALTIMESTAMP","LONGBLOB","LOW_PRIORITY","MEDIUMBLOB","MIDDLEINT","MOD","NOT","NUMERIC","OPTION","ORDER","OUTFILE","PROCEDURE","READ","REAL","RELEASE","REPLACE","RETURN","RLIKE","SECOND_MICROSECOND","SEPARATOR","SMALLINT","SQL","SQLWARNING","SQL_SMALL_RESULT","STRAIGHT_JOIN","THEN","TINYTEXT","TRIGGER","UNION","UNSIGNED","USE","UTC_TIME","VARBINARY","VARYING","WHILE","XOR","FULL","COLUMNS","MIN","MAX","STDEV","COUNT"]),g=/[*+\-<>=&|]/;return{startState:function(a){return{tokenize:h,context:null,indent:0,col:0}},token:function(a,b){a.sol()&&(b.context&&b.context.align==null&&(b.context.align=!1),b.indent=a.indentation());if(a.eatSpace())return null;var d=b.tokenize(a,b);d!="comment"&&b.context&&b.context.align==null&&b.context.type!="pattern"&&(b.context.align=!0);if(c=="(")k(b,")",a.column());else if(c=="[")k(b,"]",a.column());else if(c=="{")k(b,"}",a.column());else if(/[\]\}\)]/.test(c)){while(b.context&&b.context.type=="pattern")l(b);b.context&&c==b.context.type&&l(b)}else c=="."&&b.context&&b.context.type=="pattern"?l(b):/atom|string|variable/.test(d)&&b.context&&(/[\}\]]/.test(b.context.type)?k(b,"pattern",a.column()):b.context.type=="pattern"&&!b.context.align&&(b.context.align=!0,b.context.col=a.column()));return d},indent:function(a,c){var d=c&&c.charAt(0),e=a.context;if(/[\]\}]/.test(d))while(e&&e.type=="pattern")e=e.prev;var f=e&&d==e.type;return e?e.type=="pattern"?e.col:e.align?e.col+(f?0:1):e.indent+(f?0:b):0}}}),CodeMirror.defineMIME("text/x-mysql","mysql"),CodeMirror.runMode=function(a,b,c,d){var e=CodeMirror.getMode(CodeMirror.defaults,b),f=c.nodeType==1,g=d&&d.tabSize||CodeMirror.defaults.tabSize;if(f){var h=c,i=[],j=0;c=function(a,b){if(a=="\n"){i.push("<br>"),j=0;return}var c="";for(var d=0;;){var e=a.indexOf(" ",d);if(e==-1){c+=CodeMirror.htmlEscape(a.slice(d)),j+=a.length-d;break}j+=e-d,c+=CodeMirror.htmlEscape(a.slice(d,e));var f=g-j%g;j+=f;for(var h=0;h<f;++h)c+=" ";d=e+1}b?i.push('<span class="cm-'+CodeMirror.htmlEscape(b)+'">'+c+"</span>"):i.push(c)}}var k=CodeMirror.splitLines(a),l=CodeMirror.startState(e);for(var m=0,n=k.length;m<n;++m){m&&c("\n");var o=new CodeMirror.StringStream(k[m]);while(!o.eol()){var p=e.token(o,l);c(o.current(),p,m,o.start),o.start=o.pos}}f&&(h.innerHTML=i.join(""))}
|