rich 1.4.2 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. data/lib/rich/version.rb +1 -1
  2. data/vendor/assets/ckeditor/ckeditor/CHANGES.md +60 -56
  3. data/vendor/assets/ckeditor/ckeditor/README.md +1 -1
  4. data/vendor/assets/ckeditor/ckeditor/build-config.js +2 -1
  5. data/vendor/assets/ckeditor/ckeditor/ckeditor.js +15 -10
  6. data/vendor/assets/ckeditor/ckeditor/config.js +1 -1
  7. data/vendor/assets/ckeditor/ckeditor/plugins/autogrow/plugin.js +178 -0
  8. data/vendor/assets/ckeditor/ckeditor/plugins/autogrow/samples/autogrow.html +99 -0
  9. data/vendor/assets/ckeditor/ckeditor/plugins/codemirror/css/codemirror.css +10 -9
  10. data/vendor/assets/ckeditor/ckeditor/plugins/codemirror/js/addon/edit/closetag.js +3 -0
  11. data/vendor/assets/ckeditor/ckeditor/plugins/codemirror/js/addon/edit/continuecomment.js +2 -0
  12. data/vendor/assets/ckeditor/ckeditor/plugins/codemirror/js/addon/edit/continuelist.js +1 -0
  13. data/vendor/assets/ckeditor/ckeditor/plugins/codemirror/js/addon/edit/matchbrackets.js +4 -0
  14. data/vendor/assets/ckeditor/ckeditor/plugins/codemirror/js/addon/format/formatting.js +5 -0
  15. data/vendor/assets/ckeditor/ckeditor/plugins/codemirror/js/codemirror.js +168 -160
  16. data/vendor/assets/ckeditor/ckeditor/plugins/codemirror/js/css.js +3 -3
  17. data/vendor/assets/ckeditor/ckeditor/plugins/codemirror/js/javascript.js +13 -12
  18. data/vendor/assets/ckeditor/ckeditor/plugins/codemirror/theme/rubyblue.css +1 -1
  19. data/vendor/assets/ckeditor/ckeditor/plugins/icons.png +0 -0
  20. data/vendor/assets/ckeditor/ckeditor/samples/assets/posteddata.php +59 -59
  21. data/vendor/assets/ckeditor/ckeditor/samples/index.html +3 -0
  22. data/vendor/assets/ckeditor/ckeditor/samples/plugins/autogrow/autogrow.html +99 -0
  23. data/vendor/assets/ckeditor/ckeditor/skins/moono/dialog_iequirks.css +1 -1
  24. data/vendor/assets/ckeditor/ckeditor/skins/moono/icons.png +0 -0
  25. metadata +10 -2
@@ -39,14 +39,14 @@
39
39
 
40
40
  /* CURSOR */
41
41
 
42
- .CodeMirror pre.CodeMirror-cursor {
42
+ .CodeMirror div.CodeMirror-cursor {
43
43
  border-left: 1px solid black;
44
44
  }
45
45
  /* Shown when moving in bi-directional text */
46
- .CodeMirror pre.CodeMirror-secondarycursor {
46
+ .CodeMirror div.CodeMirror-secondarycursor {
47
47
  border-left: 1px solid silver;
48
48
  }
49
- .cm-keymap-fat-cursor pre.CodeMirror-cursor {
49
+ .CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
50
50
  width: auto;
51
51
  border: 0;
52
52
  background: transparent;
@@ -54,11 +54,11 @@
54
54
  filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800);
55
55
  }
56
56
  /* Kludge to turn off filter in ie9+, which also accepts rgba */
57
- .cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) {
57
+ .CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor:not(#nonsense_id) {
58
58
  filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
59
59
  }
60
60
  /* Can style cursor different in overwrite (non-insert) mode */
61
- .CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
61
+ .CodeMirror div.CodeMirror-cursor.CodeMirror-overwrite {}
62
62
 
63
63
  /* DEFAULT THEME */
64
64
  .cm-s-default { font:13px/1.4em monospace; }
@@ -196,6 +196,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
196
196
  .CodeMirror-linewidget {
197
197
  position: relative;
198
198
  z-index: 2;
199
+ overflow: auto;
199
200
  }
200
201
 
201
202
  .CodeMirror-wrap .CodeMirror-scroll {
@@ -210,20 +211,20 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
210
211
  }
211
212
  .CodeMirror-measure pre { position: static; }
212
213
 
213
- .CodeMirror pre.CodeMirror-cursor {
214
+ .CodeMirror div.CodeMirror-cursor {
214
215
  position: absolute;
215
216
  visibility: hidden;
216
217
  border-right: none;
217
218
  width: 0;
218
219
  }
219
- .CodeMirror-focused pre.CodeMirror-cursor {
220
+ .CodeMirror-focused div.CodeMirror-cursor {
220
221
  visibility: visible;
221
222
  }
222
223
 
223
224
  .CodeMirror-selected { background: #d9d9d9; }
224
225
  .CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
225
226
 
226
- .CodeMirror-searching {
227
+ .cm-searching {
227
228
  background: #ffa;
228
229
  background: rgba(255, 255, 0, .4);
229
230
  }
@@ -233,7 +234,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
233
234
 
234
235
  @media print {
235
236
  /* Hide the cursor when printing */
236
- .CodeMirror pre.CodeMirror-cursor {
237
+ .CodeMirror div.CodeMirror-cursor {
237
238
  visibility: hidden;
238
239
  }
239
240
  }
@@ -0,0 +1,3 @@
1
+ (function(){function g(b,d){var a=b.getCursor(),c=b.getTokenAt(a),f=CodeMirror.innerMode(b.getMode(),c.state),h=f.state;if("xml"!=f.mode.name)throw CodeMirror.Pass;var e=b.getOption("autoCloseTags"),i="html"==f.mode.configuration,f="object"==typeof e&&e.dontCloseTags||i&&k,i="object"==typeof e&&e.indentTags||i&&l;if(">"==d&&h.tagName){e=h.tagName;c.end>a.ch&&(e=e.slice(0,e.length-c.end+a.ch));var g=e.toLowerCase();if("tag"==c.type&&"closeTag"==h.type||/\/\s*$/.test(c.string)||f&&-1<j(f,g))throw CodeMirror.Pass;
2
+ c=i&&-1<j(i,g);b.replaceSelection(">"+(c?"\n\n":"")+"</"+e+">",c?{line:a.line+1,ch:0}:{line:a.line,ch:a.ch+1});c&&(b.indentLine(a.line+1),b.indentLine(a.line+2))}else if("/"==d&&"tag"==c.type&&"<"==c.string)(e=h.context&&h.context.tagName)&&b.replaceSelection("/"+e+">","end");else throw CodeMirror.Pass;}function j(b,d){if(b.indexOf)return b.indexOf(d);for(var a=0,c=b.length;a<c;++a)if(b[a]==d)return a;return-1}CodeMirror.defineOption("autoCloseTags",!1,function(b,d,a){if(d&&(a==CodeMirror.Init||!a)){a=
3
+ {name:"autoCloseTags"};if(typeof d!="object"||d.whenClosing)a["'/'"]=function(a){g(a,"/")};if(typeof d!="object"||d.whenOpening)a["'>'"]=function(a){g(a,">")};b.addKeyMap(a)}else!d&&(a!=CodeMirror.Init&&a)&&b.removeKeyMap("autoCloseTags")});var k="area base br col command embed hr img input keygen link meta param source track wbr".split(" "),l="applet blockquote body button div dl fieldset form frameset h1 h2 h3 h4 h5 h6 head html iframe layer legend object ol p select table ul".split(" ")})();
@@ -0,0 +1,2 @@
1
+ (function(){for(var i=["clike","css","javascript"],h=0;h<i.length;++h)CodeMirror.extendMode(i[h],{blockCommentStart:"/*",blockCommentEnd:"*/",blockCommentContinue:" * "});CodeMirror.commands.newlineAndIndentContinueComment=function(e){var b=e.getCursor(),a=e.getTokenAt(b),d=CodeMirror.innerMode(e.getMode(),a.state).mode,c;if("comment"==a.type&&d.blockCommentStart){var f=a.string.indexOf(d.blockCommentEnd),b=e.getRange({line:b.line,ch:0},{line:b.line,ch:a.end}),g;if(!(-1!=f&&f==a.string.length-d.blockCommentEnd.length))if(0==
2
+ a.string.indexOf(d.blockCommentStart)){if(c=b.slice(0,a.start),!/^\s*$/.test(c)){c="";for(f=0;f<a.start;++f)c+=" "}}else if(-1!=(g=b.indexOf(d.blockCommentContinue))&&g+d.blockCommentContinue.length>a.start&&/^\s*$/.test(b.slice(0,g)))c=b.slice(0,g)}null!=c?e.replaceSelection("\n"+c+d.blockCommentContinue,"end"):e.execCommand("newlineAndIndent")}})();
@@ -0,0 +1 @@
1
+ (function(){CodeMirror.commands.newlineAndIndentContinueMarkdownList=function(c){var a=c.getCursor(),d=c.getTokenAt(a),b;if("string"==d.className){var a=c.getRange({line:a.line,ch:0},{line:a.line,ch:d.end}),e;if(0==d.string.search(/\*|\d+\./)&&(e=(b=/^[\W]*(\d+)\./g.exec(a))?parseInt(b[1])+1+". ":"* ",b=a.slice(0,d.start),!/^\s*$/.test(b))){b="";for(a=0;a<d.start;++a)b+=" "}}null!=b?c.replaceSelection("\n"+b+e,"end"):c.execCommand("newlineAndIndent")}})();
@@ -0,0 +1,4 @@
1
+ (function(){function k(b){function e(a,c,d){if(a.text){var g=i?0:a.text.length-1,f=i?a.text.length:-1;for(null!=d&&(g=d+h);g!=f;g+=h)if(d=a.text.charAt(g),l.test(d)&&b.getTokenAt({line:c,ch:g+1}).type==k){var e=n[d];if(">"==e.charAt(1)==i)o.push(d);else{if(o.pop()!=e.charAt(0))return{pos:g,match:!1};if(!o.length)return{pos:g,match:!0}}}}}var a=b.getCursor(),f=b.getLineHandle(a.line),d=a.ch-1,c=0<=d&&n[f.text.charAt(d)]||n[f.text.charAt(++d)];if(!c)return null;for(var i=">"==c.charAt(1),h=i?1:-1,k=
2
+ b.getTokenAt({line:a.line,ch:d+1}).type,o=[f.text.charAt(d)],l=/[(){}[\]]/,c=a.line,j,m=i?Math.min(c+100,b.lineCount()):Math.max(-1,c-100);c!=m&&!(j=c==a.line?e(f,c,d):e(b.getLineHandle(c),c));c+=h);return{from:{line:a.line,ch:d},to:j&&{line:c,ch:j.pos},match:j&&j.match}}function l(b,e){var a=k(b);if(a){var f=a.match?"CodeMirror-matchingbracket":"CodeMirror-nonmatchingbracket",d=b.markText(a.from,{line:a.from.line,ch:a.from.ch+1},{className:f}),c=a.to&&b.markText(a.to,{line:a.to.line,ch:a.to.ch+1},
3
+ {className:f}),a=function(){b.operation(function(){d.clear();c&&c.clear()})};if(e)setTimeout(a,800);else return a}}function m(b){b.operation(function(){h&&(h(),h=null);b.somethingSelected()||(h=l(b,!1))})}var n={"(":")>",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},h=null;CodeMirror.defineOption("matchBrackets",!1,function(b,e){if(e)b.on("cursorActivity",m);else b.off("cursorActivity",m)});CodeMirror.defineExtension("matchBrackets",function(){l(this,!0)});CodeMirror.defineExtension("findMatchingBracket",
4
+ function(){return k(this)})})();
@@ -0,0 +1,5 @@
1
+ (function(){CodeMirror.extendMode("css",{commentStart:"/*",commentEnd:"*/",newlineAfterToken:function(d,b){return/^[;{}]$/.test(b)}});CodeMirror.extendMode("javascript",{commentStart:"/*",commentEnd:"*/",newlineAfterToken:function(d,b,e,a){return this.jsonMode?/^[\[,{]$/.test(b)||/^}/.test(e):";"==b&&a.lexical&&")"==a.lexical.type?!1:/^[;{}]$/.test(b)&&!/^;/.test(e)}});var m=/^(a|abbr|acronym|area|base|bdo|big|br|button|caption|cite|code|col|colgroup|dd|del|dfn|em|frame|hr|iframe|img|input|ins|kbd|label|legend|link|map|object|optgroup|option|param|q|samp|script|select|small|span|strong|sub|sup|textarea|tt|var)$/;
2
+ CodeMirror.extendMode("xml",{commentStart:"<\!--",commentEnd:"--\>",newlineAfterToken:function(d,b,e,a){var c=!1;"html"==this.configuration&&(c=a.context?m.test(a.context.tagName):!1);return!c&&("tag"==d&&/>$/.test(b)&&a.context||/^</.test(e))}});CodeMirror.defineExtension("commentRange",function(d,b,e){var a=this,c=CodeMirror.innerMode(a.getMode(),a.getTokenAt(b).state).mode;a.operation(function(){if(d)a.replaceRange(c.commentEnd,e),a.replaceRange(c.commentStart,b),b.line==e.line&&b.ch==e.ch&&a.setCursor(b.line,
3
+ b.ch+c.commentStart.length);else{var f=a.getRange(b,e),g=f.indexOf(c.commentStart),j=f.lastIndexOf(c.commentEnd);-1<g&&(-1<j&&j>g)&&(f=f.substr(0,g)+f.substring(g+c.commentStart.length,j)+f.substr(j+c.commentEnd.length));a.replaceRange(f,b,e)}})});CodeMirror.defineExtension("autoIndentRange",function(d,b){var e=this;this.operation(function(){for(var a=d.line;a<=b.line;a++)e.indentLine(a,"smart")})});CodeMirror.defineExtension("autoFormatRange",function(d,b,e){for(var a=this,c=a.getMode(),f=a.getRange(d,
4
+ b).split("\n"),g=CodeMirror.copyState(c,a.getTokenAt(d).state),j=a.getOption("tabSize"),i="",n=0,k=0==d.ch,l=0;l<f.length;++l){for(var h=new CodeMirror.StringStream(f[l],j);!h.eol();){var o=CodeMirror.innerMode(c,g),m=c.token(h,g),p=h.current();h.start=h.pos;if(!k||/\S/.test(p))i+=p,k=!1;if(!k&&o.mode.newlineAfterToken&&o.mode.newlineAfterToken(m,p,h.string.slice(h.pos)||f[l+1]||"",o.state))i+="\n",k=!0,++n}!h.pos&&c.blankLine&&c.blankLine(g);!k&&l<f.length-1&&(i+="\n",k=!0,++n)}a.operation(function(){a.replaceRange(i,
5
+ d,b);for(var c=d.line+1,f=d.line+n;c<=f;++c)a.indentLine(c,"smart");e?a.setCursor({line:0,ch:0}):a.setSelection(d,a.getCursor(!1))})})})();
@@ -1,160 +1,168 @@
1
- window.CodeMirror=function(){function n(a,b){if(!(this instanceof n))return new n(a,b);this.options=b=b||{};for(var c in ob)!b.hasOwnProperty(c)&&ob.hasOwnProperty(c)&&(b[c]=ob[c]);pb(b);c=this.display=Sc(a);c.wrapper.CodeMirror=this;Rb(this);b.autofocus&&!Sb&&E(this);this.view=Tc(new Ha([new Ia([ma("",null,X(c))])]));this.nextOpId=0;Ja(this);Tb(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");this.setValue(b.value||"");P&&setTimeout(J(ba,this,!0),20);this.view.history=qb();
2
- Uc(this);var d;try{d=document.activeElement==c.input}catch(e){}d||b.autofocus&&!Sb?setTimeout(J(Y,this),20):rb(this);o(this,function(){for(var a in ca)if(ca.propertyIsEnumerable(a))ca[a](this,b[a],Ub);for(a=0;a<sb.length;++a)sb[a](this)})()}function Sc(a){var b={},c=b.input=r("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none;");c.setAttribute("wrap","off");c.setAttribute("autocorrect","off");c.setAttribute("autocapitalize","off");b.inputDiv=r("div",[c],null,
3
- "overflow: hidden; position: relative; width: 3px; height: 0px;");b.scrollbarH=r("div",[r("div",null,null,"height: 1px")],"CodeMirror-hscrollbar");b.scrollbarV=r("div",[r("div",null,null,"width: 1px")],"CodeMirror-vscrollbar");b.scrollbarFiller=r("div",null,"CodeMirror-scrollbar-filler");b.lineDiv=r("div");b.selectionDiv=r("div",null,null,"position: relative; z-index: 1");b.cursor=r("pre"," ","CodeMirror-cursor");b.otherCursor=r("pre"," ","CodeMirror-cursor CodeMirror-secondarycursor");b.measure=
4
- r("div",null,"CodeMirror-measure");b.lineSpace=r("div",[b.measure,b.selectionDiv,b.lineDiv,b.cursor,b.otherCursor],null,"position: relative; outline: none");b.mover=r("div",[r("div",[b.lineSpace],"CodeMirror-lines")],null,"position: relative");b.sizer=r("div",[b.mover],"CodeMirror-sizer");b.heightForcer=r("div"," ",null,"position: absolute; height: "+na+"px");b.gutters=r("div",null,"CodeMirror-gutters");b.lineGutter=null;var d=r("div",[b.sizer,b.heightForcer,b.gutters],null,"position: relative; min-height: 100%");
5
- b.scroller=r("div",[d],"CodeMirror-scroll");b.scroller.setAttribute("tabIndex","-1");b.wrapper=r("div",[b.inputDiv,b.scrollbarH,b.scrollbarV,b.scrollbarFiller,b.scroller],"CodeMirror");da&&(b.gutters.style.zIndex=-1,b.scroller.style.paddingRight=0);a.appendChild?a.appendChild(b.wrapper):a(b.wrapper);Ka&&(c.style.width="0px");Q||(b.scroller.draggable=!0);tb?(b.inputDiv.style.height="1px",b.inputDiv.style.position="absolute"):da&&(b.scrollbarH.style.minWidth=b.scrollbarV.style.minWidth="18px");b.viewOffset=
6
- b.showingFrom=b.showingTo=b.lastSizeC=0;b.lineNumWidth=b.lineNumInnerWidth=b.lineNumChars=null;b.prevInput="";b.alignWidgets=!1;b.pollingFast=!1;b.poll=new ub;b.draggingText=!1;b.cachedCharWidth=b.cachedTextHeight=null;b.measureLineCache=[];b.measureLineCachePos=0;b.inaccurateSelection=!1;b.pasteIncoming=!1;return b}function Tc(a){var b={line:0,ch:0};return{doc:a,frontier:0,highlight:new ub,sel:{from:b,to:b,head:b,anchor:b,shift:!1,extend:!1},scrollTop:0,scrollLeft:0,overwrite:!1,focused:!1,maxLine:q(a,
7
- 0),maxLineLength:0,maxLineChanged:!1,suppressEdits:!1,goalColumn:null,cantEdit:!1,keyMaps:[]}}function Ja(a){var b=a.view.doc;a.view.mode=n.getMode(a.options,a.options.mode);b.iter(0,b.size,function(a){a.stateAfter=null});a.view.frontier=0;La(a,100)}function Tb(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+a.options.theme.replace(/(^|\s)\s*/g," cm-s-");oa(a)}function pa(a){Rb(a);K(a,!0)}function Rb(a){var b=a.display.gutters,c=a.options.gutters;Ma(b);for(var d=
8
- 0;d<c.length;++d){var e=c[d],f=b.appendChild(r("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none"}function Na(a,b){if(0==b.height)return 0;for(var c=b.text.length,d,e=b;d=qa(e);)d=d.find(),e=q(a,d.from.line),c+=d.from.ch-d.to.ch;for(e=b;d=Oa(e);)d=d.find(),c-=e.text.length-d.from.ch,e=q(a,d.to.line),c+=e.text.length-d.to.ch;return c}function Vb(a){a.maxLine=q(a.doc,0);a.maxLineLength=
9
- Na(a.doc,a.maxLine);a.maxLineChanged=!0;a.doc.iter(1,a.doc.size,function(b){var c=Na(a.doc,b);c>a.maxLineLength&&(a.maxLineLength=c,a.maxLine=b)})}function pb(a){for(var b=!1,c=0;c<a.gutters.length;++c)"CodeMirror-linenumbers"==a.gutters[c]&&(a.lineNumbers?b=!0:a.gutters.splice(c--,1));!b&&a.lineNumbers&&a.gutters.push("CodeMirror-linenumbers")}function Wb(a,b){var c=b+2*a.lineSpace.offsetTop;a.sizer.style.minHeight=a.heightForcer.style.top=c+"px";var c=Math.max(c,a.scroller.scrollHeight),d=a.scroller.scrollWidth>
10
- a.scroller.clientWidth,e=c>a.scroller.clientHeight;e?(a.scrollbarV.style.display="block",a.scrollbarV.style.bottom=d?Pa(a.measure)+"px":"0",a.scrollbarV.firstChild.style.height=c-a.scroller.clientHeight+a.scrollbarV.clientHeight+"px"):a.scrollbarV.style.display="";d?(a.scrollbarH.style.display="block",a.scrollbarH.style.right=e?Pa(a.measure)+"px":"0",a.scrollbarH.firstChild.style.width=a.scroller.scrollWidth-a.scroller.clientWidth+a.scrollbarH.clientWidth+"px"):a.scrollbarH.style.display="";d&&e?
11
- (a.scrollbarFiller.style.display="block",a.scrollbarFiller.style.height=a.scrollbarFiller.style.width=Pa(a.measure)+"px"):a.scrollbarFiller.style.display="";Vc&&0===Pa(a.measure)&&(a.scrollbarV.style.minWidth=a.scrollbarH.style.minHeight=Wc?"18px":"12px")}function Xb(a,b,c){var d=a.scroller.scrollTop,e=a.wrapper.clientHeight;"number"==typeof c?d=c:c&&(d=c.top,e=c.bottom-c.top);d=Math.floor(d-a.lineSpace.offsetTop);a=Math.ceil(d+e);return{from:Qa(b,d),to:Qa(b,a)}}function Xc(a){if(!a.options.lineNumbers)return!1;
12
- var b=""+a.options.lineNumberFormatter(a.view.doc.size-1+a.options.firstLineNumber),a=a.display;if(b.length!=a.lineNumChars){var c=a.measure.appendChild(r("div",[r("div",b)],"CodeMirror-linenumber CodeMirror-gutter-elt")),d=c.firstChild.offsetWidth,c=c.offsetWidth-d;a.lineGutter.style.width="";a.lineNumInnerWidth=Math.max(d,a.lineGutter.offsetWidth-c);a.lineNumWidth=a.lineNumInnerWidth+c;a.lineNumChars=a.lineNumInnerWidth?b.length:-1;a.lineGutter.style.width=a.lineNumWidth+"px";return!0}return!1}
13
- function K(a,b,c){var d=a.display.showingFrom,e=a.display.showingTo;if(b=Yc(a,b,c))ea(a,a,"update",a),(a.display.showingFrom!=d||a.display.showingTo!=e)&&ea(a,a,"viewportChange",a,a.display.showingFrom,a.display.showingTo);vb(a);Wb(a.display,a.view.doc.height);return b}function Yc(a,b,c){var d=a.display,e=a.view.doc;if(d.wrapper.clientWidth){var f=Xb(d,e,c);if(!(!0!==b&&0==b.length&&f.from>d.showingFrom&&f.to<d.showingTo)){b&&Xc(a)&&(b=!0);d.sizer.style.marginLeft=d.scrollbarH.style.left=d.gutters.offsetWidth+
14
- "px";if(!0!==b&&ra)for(var g=0;g<b.length;++g)for(var h=b[g];c=qa(q(e,h.from));)c=c.find().from.line,h.diff&&(h.diff-=h.from-c),h.from=c;h=!0===b?0:Infinity;if(a.options.lineNumbers&&b&&!0!==b)for(g=0;g<b.length;++g)if(b[g].diff){h=b[g].from;break}c=Math.max(f.from-a.options.viewportMargin,0);f=Math.min(e.size,f.to+a.options.viewportMargin);d.showingFrom<c&&20>c-d.showingFrom&&(c=d.showingFrom);d.showingTo>f&&20>d.showingTo-f&&(f=Math.min(e.size,d.showingTo));if(ra)for(c=G(Ra(e,q(e,c)));f<e.size&&
15
- R(q(e,f));)++f;for(var b=!0===b?[]:Zc([{from:d.showingFrom,to:d.showingTo}],b),k=0,g=0;g<b.length;++g){var j=b[g];j.from<c&&(j.from=c);j.to>f&&(j.to=f);j.from>=j.to?b.splice(g--,1):k+=j.to-j.from}if(!(k==f-c&&c==d.showingFrom&&f==d.showingTo)){b.sort(function(a,b){return a.from-b.from});k<0.7*(f-c)&&(d.lineDiv.style.display="none");$c(a,c,f,b,h);d.lineDiv.style.display="";if(c!=d.showingFrom||f!=d.showingTo||d.lastSizeC!=d.wrapper.clientHeight)d.lastSizeC=d.wrapper.clientHeight;d.showingFrom=c;d.showingTo=
16
- f;La(a,100);g=d.lineDiv.offsetTop;for(b=d.lineDiv.firstChild;b;b=b.nextSibling)b.lineObj&&(da?(f=b.offsetTop+b.offsetHeight,h=f-g,g=f):(h=b.getBoundingClientRect(),h=h.bottom-h.top),f=b.lineObj.height-h,2>h&&(h=X(d)),(0.001<f||-0.001>f)&&S(b.lineObj,h));d.viewOffset=sa(a,q(e,c));d.mover.style.top=d.viewOffset+"px";return!0}}}else d.showingFrom=d.showingTo=d.viewOffset=0}function Zc(a,b){for(var c=0,d=b.length||0;c<d;++c){for(var e=b[c],f=[],g=e.diff||0,h=0,k=a.length;h<k;++h){var j=a[h];e.to<=j.from&&
17
- e.diff?f.push({from:j.from+g,to:j.to+g}):e.to<=j.from||e.from>=j.to?f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from}),e.to<j.to&&f.push({from:e.to+g,to:j.to+g}))}a=f}return a}function ad(a){for(var b=a.display,c={},d={},e=b.gutters.firstChild,f=0;e;e=e.nextSibling,++f)c[a.options.gutters[f]]=e.offsetLeft,d[a.options.gutters[f]]=e.offsetWidth;return{fixedPos:b.scroller.getBoundingClientRect().left-b.sizer.getBoundingClientRect().left,gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,
18
- wrapperWidth:b.wrapper.clientWidth}}function $c(a,b,c,d,e){function f(b){var c=b.nextSibling;Q&&fa&&a.display.currentWheelTarget==b?(b.style.display="none",b.lineObj=null):j.removeChild(b);return c}var g=ad(a),h=a.display,k=a.options.lineNumbers;!d.length&&(!P&&(!Q||!a.display.currentWheelTarget))&&Ma(h.lineDiv);var j=h.lineDiv,i=j.firstChild,m=d.shift(),l=b;for(a.view.doc.iter(b,c,function(b){m&&m.to==l&&(m=d.shift());if(R(b))0!=b.height&&S(b,0);else if(m&&m.from<=l&&m.to>l){for(;i.lineObj!=b;)i=
19
- f(i);k&&(e<=l&&i.lineNumber)&&Yb(i.lineNumber,""+a.options.lineNumberFormatter(l+a.options.firstLineNumber));i=i.nextSibling}else{var c;c=a;var h=l,n=Zb(c,b),u=b.gutterMarkers,q=c.display;if(!c.options.lineNumbers&&!u&&!b.bgClass&&!b.wrapClass&&(!b.widgets||!b.widgets.length))c=n;else{var o=r("div",null,b.wrapClass,"position: relative");if(c.options.lineNumbers||u){var Sa=o.appendChild(r("div",null,null,"position: absolute; left: "+g.fixedPos+"px"));o.alignable=[Sa];if(c.options.lineNumbers&&(!u||
20
- !u["CodeMirror-linenumbers"]))o.lineNumber=Sa.appendChild(r("div",""+c.options.lineNumberFormatter(h+c.options.firstLineNumber),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+g.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+q.lineNumInnerWidth+"px"));if(u)for(h=0;h<c.options.gutters.length;++h){var q=c.options.gutters[h],y=u.hasOwnProperty(q)&&u[q];y&&Sa.appendChild(r("div",[y],"CodeMirror-gutter-elt","left: "+g.gutterLeft[q]+"px; width: "+g.gutterWidth[q]+"px"))}}b.bgClass&&o.appendChild(r("div",
21
- " ",b.bgClass+" CodeMirror-linebackground"));o.appendChild(n);if(b.widgets){u=0;for(h=b.widgets;u<h.length;++u){q=h[u];y=r("div",[q.node],"CodeMirror-linewidget");y.widget=q;if(q.noHScroll){(o.alignable||(o.alignable=[])).push(y);var z=g.wrapperWidth;y.style.left=g.fixedPos+"px";q.coverGutter||(z-=g.gutterTotalWidth,y.style.paddingLeft=g.gutterTotalWidth+"px");y.style.width=z+"px"}q.coverGutter&&(y.style.zIndex=5,y.style.position="relative",q.noHScroll||(y.style.marginLeft=-g.gutterTotalWidth+"px"));
22
- q.above?o.insertBefore(y,c.options.lineNumbers&&0!=b.height?Sa:n):o.appendChild(y)}}da&&(o.style.zIndex=2);c=o}j.insertBefore(c,i);c.lineObj=b}++l});i;)i=f(i)}function vb(a){var b=a.display,c=x(a.view.sel.from,a.view.sel.to);if(c||a.options.showCursorWhenSelecting){var d=a.display,e=T(a,a.view.sel.head,"div");d.cursor.style.left=e.left+"px";d.cursor.style.top=e.top+"px";d.cursor.style.height=Math.max(0,e.bottom-e.top)*a.options.cursorHeight+"px";d.cursor.style.display="";e.other?(d.otherCursor.style.display=
23
- "",d.otherCursor.style.left=e.other.left+"px",d.otherCursor.style.top=e.other.top+"px",d.otherCursor.style.height=0.85*(e.other.bottom-e.other.top)+"px"):d.otherCursor.style.display="none"}else b.cursor.style.display=b.otherCursor.style.display="none";c?b.selectionDiv.style.display="none":bd(a);a=T(a,a.view.sel.head,"div");c=b.wrapper.getBoundingClientRect();d=b.lineDiv.getBoundingClientRect();b.inputDiv.style.top=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+d.top-c.top))+"px";b.inputDiv.style.left=
24
- Math.max(0,Math.min(b.wrapper.clientWidth-10,a.left+d.left-c.left))+"px"}function bd(a){function b(a,b,c,d){0>b&&(b=0);g.appendChild(r("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?h-a:c)+"px; height: "+(d-b)+"px"))}function c(c,d,f,g){var j=q(e,c),i=j.text.length,l=g?Infinity:-Infinity;cd(L(j),d||0,null==f?i:f,function(e,m,q){var o=Ta(a,{line:c,ch:"rtl"==q?m-1:e},"div",j),q=Ta(a,{line:c,ch:"rtl"==q?e:m-1},"div",j),r=o.left,n=q.right;3<q.top-
25
- o.top&&(b(r,o.top,null,o.bottom),r=k,o.bottom<q.top&&b(r,o.bottom,null,q.top));null==f&&m==i&&(n=h);null==d&&0==e&&(r=k);l=g?Math.min(q.top,l):Math.max(q.bottom,l);r<k+1&&(r=k);b(r,q.top,n-r,q.bottom)});return l}var d=a.display,e=a.view.doc,f=a.view.sel,g=document.createDocumentFragment(),h=d.lineSpace.offsetWidth,k=bc(a.display);if(f.from.line==f.to.line)c(f.from.line,f.from.ch,f.to.ch);else{for(var j=q(e,f.from.line),i=j,m=[f.from.line,f.from.ch],l;i=Oa(i);){i=i.find();m.push(i.from.ch,i.to.line,
26
- i.to.ch);if(i.to.line==f.to.line){m.push(f.to.ch);l=!0;break}i=q(e,i.to.line)}if(l)for(f=0;f<m.length;f+=3)c(m[f],m[f+1],m[f+2]);else m=q(e,f.to.line),j=f.from.ch?c(f.from.line,f.from.ch,null,!1):sa(a,j)-d.viewOffset,f=f.to.ch?c(f.to.line,qa(m)?null:0,f.to.ch,!0):sa(a,m)-d.viewOffset,j<f&&b(k,j,null,f)}Z(d.selectionDiv,g);d.selectionDiv.style.display=""}function Ua(a){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursor.style.visibility=b.otherCursor.style.visibility="";b.blinker=setInterval(function(){b.cursor.offsetHeight&&
27
- (b.cursor.style.visibility=b.otherCursor.style.visibility=(c=!c)?"":"hidden")},a.options.cursorBlinkRate)}function La(a,b){a.view.frontier<a.display.showingTo&&a.view.highlight.set(b,J(dd,a))}function dd(a){var b=a.view,c=b.doc;if(!(b.frontier>=a.display.showingTo)){var d=+new Date+a.options.workTime,e=ga(b.mode,ta(a,b.frontier)),f=[],g;c.iter(b.frontier,Math.min(c.size,a.display.showingTo+500),function(c){b.frontier>=a.display.showingFrom?(cc(a,c,e)&&b.frontier>=a.display.showingFrom&&(g&&g.end==
28
- b.frontier?g.end++:f.push(g={start:b.frontier,end:b.frontier+1})),c.stateAfter=ga(b.mode,e)):(dc(a,c,e),c.stateAfter=0==b.frontier%5?ga(b.mode,e):null);++b.frontier;if(+new Date>d)return La(a,a.options.workDelay),!0});f.length&&o(a,function(){for(var a=0;a<f.length;++a)U(this,f[a].start,f[a].end)})()}}function ed(a,b){for(var c,d,e=a.view.doc,f=b,g=b-100;f>g;--f){if(0==f)return 0;var h=q(e,f-1);if(h.stateAfter)return f;h=ha(h.text,null,a.options.tabSize);if(null==d||c>h)d=f-1,c=h}return d}function ta(a,
29
- b){var c=a.view,d=ed(a,b),e=d&&q(c.doc,d-1).stateAfter,e=e?ga(c.mode,e):ec(c.mode);c.doc.iter(d,b,function(f){dc(a,f,e);f.stateAfter=d==b-1||0==d%5||d>=c.showingFrom&&d<c.showingTo?ga(c.mode,e):null;++d});return e}function bc(a){return Z(a.measure,r("pre")).appendChild(r("span","x")).offsetLeft}function wb(a,b,c,d){d=d||xb(a,b);a=-1;for(b=c;;b+=a){var e=d[b];if(e)break;0>a&&0==b&&(a=1)}return{left:b<c?e.right:e.left,right:b>c?e.left:e.right,top:e.top,bottom:e.bottom}}function xb(a,b){for(var c=a.display,
30
- d=a.display.measureLineCache,e=0;e<d.length;++e){var f=d[e];if(f.text==b.text&&f.markedSpans==b.markedSpans&&c.scroller.clientWidth==f.width)return f.measure}var g=a.display,e=fc(b.text.length),h=Zb(a,b,e);if(P&&!da&&!a.options.lineWrapping&&100<h.childNodes.length){for(var k=document.createDocumentFragment(),j=h.childNodes.length,f=0,i=Math.ceil(j/10);f<i;++f){for(var m=r("div",null,null,"display: inline-block"),l=0;10>l&&j;++l)m.appendChild(h.firstChild),--j;k.appendChild(m)}h.appendChild(k)}Z(g.measure,
31
- h);j=g.lineDiv.getBoundingClientRect();k=[];g=fc(b.text.length);h=h.offsetHeight;for(f=0;f<e.length;++f)if(l=e[f]){for(var i=l.getBoundingClientRect(),m=Math.max(0,i.top-j.top),p=Math.min(i.bottom-j.top,h),l=0;l<k.length;l+=2){var q=k[l],o=k[l+1];if(!(q>p||o<m))if(q<=m&&o>=p||m<=q&&p>=o||Math.min(p,o)-Math.max(m,q)>=p-m>>1){k[l]=Math.min(m,q);k[l+1]=Math.max(p,o);break}}l==k.length&&k.push(m,p);g[f]={left:i.left-j.left,right:i.right-j.left,top:l}}for(f=0;f<g.length;++f)if(l=g[f])e=l.top,l.top=k[e],
32
- l.bottom=k[e+1];f={text:b.text,width:c.scroller.clientWidth,markedSpans:b.markedSpans,measure:g};16==d.length?d[++c.measureLineCachePos%16]=f:d.push(f);return g}function oa(a){a.display.measureLineCache.length=a.display.measureLineCachePos=0;a.display.cachedCharWidth=a.display.cachedTextHeight=null;a.view.maxLineChanged=!0}function gc(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=b.widgets[e].node.offsetHeight;c.top+=f;c.bottom+=f}if("line"==d)return c;d||(d=
33
- "local");b=sa(a,b);"local"!=d&&(b-=a.display.viewOffset);"page"==d&&(a=a.display.lineSpace.getBoundingClientRect(),b+=a.top+(window.pageYOffset||(document.documentElement||document.body).scrollTop),a=a.left+(window.pageXOffset||(document.documentElement||document.body).scrollLeft),c.left+=a,c.right+=a);c.top+=b;c.bottom+=b;return c}function Ta(a,b,c,d){d||(d=q(a.view.doc,b.line));return gc(a,d,wb(a,d,b.ch),c)}function T(a,b,c,d,e){function f(b,f){var g=wb(a,d,b,e);f?g.left=g.right:g.right=g.left;
34
- return gc(a,d,g,c)}d=d||q(a.view.doc,b.line);e||(e=xb(a,d));var g=L(d),b=b.ch;if(!g)return f(b);for(var h,k,j=g[0].level,i=0;i<g.length;++i){var m=g[i],l=m.level%2,p;if(m.from<b&&m.to>b)return f(b,l);var o=l?m.from:m.to;if((l?m.to:m.from)==b)m=i&&m.level<(p=g[i-1]).level?f(p.level%2?p.from:p.to-1,!0):f(l&&m.from!=m.to?b-1:b),l==j?h=m:k=m;else if(o==b&&(p=i<g.length-1&&g[i+1],l||!(p&&p.from==p.to)))m=p&&m.level<p.level?f(p.level%2?p.to-1:p.from):f(l?b:b-1,!0),l==j?h=m:k=m}j&&!b&&(k=f(g[0].to-1));if(!h)return k;
35
- k&&(h.other=k);return h}function yb(a,b,c){var d=a.view.doc,c=c+a.display.viewOffset;if(0>c)return{line:0,ch:0,outside:!0};var e=Qa(d,c);if(e>=d.size)return{line:d.size-1,ch:q(d,d.size-1).text.length};for(0>b&&(b=0);;){var f=q(d,e),e=fd(a,f,e,b,c),g=Oa(f);if(g&&e.ch==ua(f))e=g.find().to.line;else return e}}function fd(a,b,c,d,e){function f(d){d=T(a,{line:c,ch:d},"line",b,j);h=!0;if(g>d.bottom)return Math.max(0,d.left-k);if(g<d.top)return d.left+k;h=!1;return d.left}var g=e-sa(a,b),h=!1,k=a.display.wrapper.clientWidth,
36
- j=xb(a,b),i=L(b),m=b.text.length,e=Va(b),l=ua(b),p=bc(a.display),q=f(l);if(d>q)return{line:c,ch:l,outside:h};for(;;){if(i?l==e||l==zb(b,e,1):1>=l-e){for(e=(d=d-p<q-d)?e:l;Ab.test(b.text.charAt(e));)++e;return{line:c,ch:e,after:d,outside:h}}var o=Math.ceil(m/2),r=e+o;if(i)for(var r=e,n=0;n<o;++n)r=zb(b,r,1);n=f(r);n>d?(l=r,q=n,h&&(q+=1E3),m-=o):(e=r,p=n,m=o)}}function X(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==$){$=r("pre");for(var b=0;49>b;++b)$.appendChild(document.createTextNode("x")),
37
- $.appendChild(r("br"));$.appendChild(document.createTextNode("x"))}Z(a.measure,$);b=$.offsetHeight/50;3<b&&(a.cachedTextHeight=b);Ma(a.measure);return b||1}function hc(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=r("span","x"),c=r("pre",[b]);Z(a.measure,c);b=b.offsetWidth;2<b&&(a.cachedCharWidth=b);return b||10}function Bb(a){a.curOp?++a.curOp.depth:a.curOp={depth:1,changes:[],delayedCallbacks:[],updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,updateMaxLine:!1,
38
- id:++a.nextOpId}}function Cb(a){var b=a.curOp;if(!--b.depth){a.curOp=null;var c=a.view,d=a.display;b.updateMaxLine&&Vb(c);if(c.maxLineChanged&&!a.options.lineWrapping){var e=wb(a,c.maxLine,c.maxLine.text.length).right;d.sizer.style.minWidth=e+3+na+"px";c.maxLineChanged=!1}var f,g;b.selectionChanged&&(d=T(a,c.sel.head),f=Db(a,d.left,d.top,d.left,d.bottom));if(b.changes.length||f&&null!=f.scrollTop)g=K(a,b.changes,f&&f.scrollTop);!g&&b.selectionChanged&&vb(a);if(f&&(d=a.view,g=ic(a,d.sel.head),d.focused)){d=
39
- a.display;f=d.sizer.getBoundingClientRect();e=null;if(0>g.top+f.top)e=!0;else if(g.bottom+f.top>(window.innerHeight||document.documentElement.clientHeight))e=!1;if(null!=e&&!gd){if(f="none"==d.cursor.style.display)d.cursor.style.display="",d.cursor.style.left=g.left+"px",d.cursor.style.top=g.top-d.viewOffset+"px";d.cursor.scrollIntoView(e);f&&(d.cursor.style.display="none")}}b.selectionChanged&&Ua(a);c.focused&&b.updateInput&&ba(a,b.userSelChange);b.textChanged&&ia(a,"change",a,b.textChanged);b.selectionChanged&&
40
- ia(a,"cursorActivity",a);for(c=0;c<b.delayedCallbacks.length;++c)b.delayedCallbacks[c](a)}}function o(a,b){return function(){var c=a||this;Bb(c);try{var d=b.apply(c,arguments)}finally{Cb(c)}return d}}function U(a,b,c,d){a.curOp.changes.push({from:b,to:c,diff:d})}function Wa(a){a.view.pollingFast||a.display.poll.set(a.options.pollInterval,function(){Eb(a);a.view.focused&&Wa(a)})}function va(a){function b(){!Eb(a)&&!c?(c=!0,a.display.poll.set(60,b)):(a.display.pollingFast=!1,Wa(a))}var c=!1;a.display.pollingFast=
41
- !0;a.display.poll.set(20,b)}function Eb(a){var b=a.display.input,c=a.display.prevInput,d=a.view,e=d.sel;if(!d.focused||hd(b)||wa(a))return!1;var f=b.value;if(f==c&&x(e.from,e.to))return!1;Bb(a);d.sel.shift=!1;for(var g=0,h=Math.min(c.length,f.length);g<h&&c[g]==f[g];)++g;h=e.from;e=e.to;g<c.length?h={line:h.line,ch:h.ch-(c.length-g)}:d.overwrite&&(x(h,e)&&!a.display.pasteIncoming)&&(e={line:e.line,ch:Math.min(q(a.view.doc,e.line).text.length,e.ch+(f.length-g))});c=a.curOp.updateInput;Fb(a,h,e,xa(f.slice(g)),
42
- "end",a.display.pasteIncoming?"paste":"input",{from:h,to:e});a.curOp.updateInput=c;1E3<f.length?b.value=a.display.prevInput="":a.display.prevInput=f;Cb(a);a.display.pasteIncoming=!1;return!0}function ba(a,b){var c=a.view,d,e;x(c.sel.from,c.sel.to)?b&&(a.display.prevInput=a.display.input.value=""):(a.display.prevInput="",d=jc&&(100<c.sel.to.line-c.sel.from.line||1E3<(e=a.getSelection()).length),a.display.input.value=d?"-":e||a.getSelection(),c.focused&&kc(a.display.input));a.display.inaccurateSelection=
43
- d}function E(a){"nocursor"!=a.options.readOnly&&(P||document.activeElement!=a.display.input)&&a.display.input.focus()}function wa(a){return a.options.readOnly||a.view.cantEdit}function Uc(a){function b(){a.view.focused&&setTimeout(J(E,a),0)}function c(b){(!a.options.onDragEvent||!a.options.onDragEvent(a,ya(b)))&&Xa(b)}function d(){e.inaccurateSelection&&(e.prevInput="",e.inaccurateSelection=!1,e.input.value=a.getSelection(),kc(e.input))}var e=a.display;t(e.scroller,"mousedown",o(a,id));t(e.scroller,
44
- "dblclick",o(a,A));t(e.lineSpace,"selectstart",function(a){lc(e,a)||A(a)});V||t(e.scroller,"contextmenu",function(b){mc(a,b)});t(e.scroller,"scroll",function(){za(a,e.scroller.scrollTop);Aa(a,e.scroller.scrollLeft,!0);ia(a,"scroll",a)});t(e.scrollbarV,"scroll",function(){za(a,e.scrollbarV.scrollTop)});t(e.scrollbarH,"scroll",function(){Aa(a,e.scrollbarH.scrollLeft)});t(e.scroller,"mousewheel",function(b){nc(a,b)});t(e.scroller,"DOMMouseScroll",function(b){nc(a,b)});t(e.scrollbarH,"mousedown",b);t(e.scrollbarV,
45
- "mousedown",b);t(e.wrapper,"scroll",function(){e.wrapper.scrollTop=e.wrapper.scrollLeft=0});t(window,"resize",function g(){e.cachedCharWidth=e.cachedTextHeight=null;oa(a);e.wrapper.parentNode?K(a,!0):M(window,"resize",g)});t(e.input,"keyup",o(a,function(b){if((!a.options.onKeyEvent||!a.options.onKeyEvent(a,ya(b)))&&16==C(b,"keyCode"))a.view.sel.shift=!1}));t(e.input,"input",J(va,a));t(e.input,"keydown",o(a,oc));t(e.input,"keypress",o(a,jd));t(e.input,"focus",J(Y,a));t(e.input,"blur",J(rb,a));a.options.dragDrop&&
46
- (t(e.scroller,"dragstart",function(b){var c=a.getSelection();b.dataTransfer.setData("Text",c);b.dataTransfer.setDragImage&&!Gb&&b.dataTransfer.setDragImage(r("img"),0,0)}),t(e.scroller,"dragenter",c),t(e.scroller,"dragover",c),t(e.scroller,"drop",o(a,kd)));t(e.scroller,"paste",function(){E(a);va(a)});t(e.input,"paste",function(){e.pasteIncoming=true;va(a)});t(e.input,"cut",d);t(e.input,"copy",d);tb&&t(e.sizer,"mouseup",function(){document.activeElement==e.input&&e.input.blur();E(a)})}function lc(a,
47
- b){for(var c=b.target||b.srcElement;c!=a.wrapper;c=c.parentNode)if(/\bCodeMirror-(?:line)?widget\b/.test(c.className)||c.parentNode==a.sizer&&c!=a.mover)return!0}function Ba(a,b,c){var d=a.display;if(!c&&(c=b.target||b.srcElement,c==d.scrollbarH||c==d.scrollbarH.firstChild||c==d.scrollbarV||c==d.scrollbarV.firstChild||c==d.scrollbarFiller))return null;var e,f,d=d.lineSpace.getBoundingClientRect();try{e=b.clientX,f=b.clientY}catch(g){return null}return yb(a,e-d.left,f-d.top)}function id(a){function b(a){if("single"==
48
- m)B(e,s(k,j),a);else if(r=s(k,r),n=s(k,n),"double"==m){var b=pc(q(k,a.line).text,a);w(a,r)?B(e,b.from,n):B(e,r,b.to)}else"triple"==m&&(w(a,r)?B(e,n,s(k,{line:a.line,ch:0})):B(e,r,s(k,{line:a.line+1,ch:0})))}function c(a){var d=++u,h=Ba(e,a,!0);if(h)if(x(h,l)){var j=a.clientY<v.top?-20:a.clientY>v.bottom?20:0;j&&setTimeout(o(e,function(){u==d&&(f.scroller.scrollTop+=j,c(a))}),50)}else{g.focused||Y(e);l=h;b(h);var i=Xb(f,k);(h.line>=i.to||h.line<i.from)&&setTimeout(o(e,function(){u==d&&c(a)}),150)}}
49
- function d(a){u=Infinity;var c=Ba(e,a);c&&b(c);A(a);E(e);M(document,"mousemove",$b);M(document,"mouseup",ac)}var e=this,f=e.display,g=e.view,h=g.sel,k=g.doc;h.shift=C(a,"shiftKey");if(lc(f,a))Q||(f.scroller.draggable=!1,setTimeout(function(){f.scroller.draggable=!0},100));else if(!ld(e,a)){var j=Ba(e,a);switch(qc(a)){case 3:V&&mc.call(e,e,a);return;case 2:j&&B(e,j);setTimeout(J(E,e),20);A(a);return}if(j){g.focused||Y(e);var i=+new Date,m="single";Ya&&Ya.time>i-400&&x(Ya.pos,j)?(m="triple",A(a),setTimeout(J(E,
50
- e),20),md(e,j.line)):Za&&Za.time>i-400&&x(Za.pos,j)?(m="double",Ya={time:i,pos:j},A(a),i=pc(q(k,j.line).text,j),B(e,i.from,i.to)):Za={time:i,pos:j};var l=j;if(e.options.dragDrop&&nd&&!wa(e)&&!x(h.from,h.to)&&!w(j,h.from)&&!w(h.to,j)&&"single"==m){var p=o(e,function(b){if(Q)f.scroller.draggable=false;g.draggingText=false;M(document,"mouseup",p);M(f.scroller,"drop",p);if(Math.abs(a.clientX-b.clientX)+Math.abs(a.clientY-b.clientY)<10){A(b);B(e,j);E(e)}});Q&&(f.scroller.draggable=!0);g.draggingText=p;
51
- f.scroller.dragDrop&&f.scroller.dragDrop();t(document,"mouseup",p);t(f.scroller,"drop",p)}else{A(a);"single"==m&&B(e,s(k,j));var r=h.from,n=h.to,v=f.wrapper.getBoundingClientRect(),u=0,$b=o(e,function(a){!P&&!qc(a)?d(a):c(a)}),ac=o(e,d);t(document,"mousemove",$b);t(document,"mouseup",ac)}}else(a.target||a.srcElement)==f.scroller&&A(a)}}function kd(a){var b=this;if(!b.options.onDragEvent||!b.options.onDragEvent(b,ya(a))){A(a);var c=Ba(b,a,!0),d=a.dataTransfer.files;if(c&&!wa(b))if(d&&d.length&&window.FileReader&&
52
- window.File)for(var e=d.length,f=Array(e),g=0,a=function(a,d){var h=new FileReader;h.onload=function(){f[d]=h.result;++g==e&&(c=s(b.view.doc,c),o(b,function(){var a=W(b,f.join(""),c,c,"paste");N(b,c,a)})())};h.readAsText(a)},h=0;h<e;++h)a(d[h],h);else if(b.view.draggingText&&!w(c,b.view.sel.from)&&!w(b.view.sel.to,c))b.view.draggingText(a),P&&setTimeout(J(E,b),50);else try{if(f=a.dataTransfer.getData("Text")){var h=b.view.sel.from,k=b.view.sel.to;N(b,c,c);b.view.draggingText&&W(b,"",h,k,"paste");
53
- b.replaceSelection(f,null,"paste");E(b);Y(b)}}catch(j){}}}function ld(a,b){var c=a.display;try{var d=b.clientX,e=b.clientY}catch(f){return!1}if(d>=Math.floor(c.gutters.getBoundingClientRect().right))return!1;A(b);if(!rc(a,"gutterClick"))return!0;var g=c.lineDiv.getBoundingClientRect();if(e>g.bottom)return!0;e-=g.top-c.viewOffset;for(g=0;g<a.options.gutters.length;++g){var h=c.gutters.childNodes[g];if(h&&h.getBoundingClientRect().right>=d){c=Qa(a.view.doc,e);ea(a,a,"gutterClick",a,c,a.options.gutters[g],
54
- b);break}}return!0}function za(a,b){2>Math.abs(a.view.scrollTop-b)||(a.view.scrollTop=b,V||K(a,[],b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b),a.display.scrollbarV.scrollTop!=b&&(a.display.scrollbarV.scrollTop=b),V&&K(a,[]))}function Aa(a,b,c){if(!(c?b==a.view.scrollLeft:2>Math.abs(a.view.scrollLeft-b))){a.view.scrollLeft=b;c=a.display;if(c.alignWidgets||c.gutters.firstChild){for(var d=c.scroller.getBoundingClientRect().left-c.sizer.getBoundingClientRect().left-c.scroller.scrollLeft+
55
- a.view.scrollLeft,e=c.gutters.offsetWidth,f=d+"px",g=c.lineDiv.firstChild;g;g=g.nextSibling)if(g.alignable)for(var h=0,k=g.alignable;h<k.length;++h)k[h].style.left=f;c.gutters.style.left=d+e+"px"}a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b);a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b)}}function nc(a,b){var c=b.wheelDeltaX,d=b.wheelDeltaY;null==c&&(b.detail&&b.axis==b.HORIZONTAL_AXIS)&&(c=b.detail);null==d&&b.detail&&b.axis==b.VERTICAL_AXIS?d=b.detail:
56
- null==d&&(d=b.wheelDelta);if(d&&fa&&Q)for(var e=b.target;e!=f;e=e.parentNode)if(e.lineObj){a.display.currentWheelTarget=e;break}var f=a.display.scroller;if(c&&!V&&!ja&&null!=H)d&&za(a,Math.max(0,Math.min(f.scrollTop+d*H,f.scrollHeight-f.clientHeight))),Aa(a,Math.max(0,Math.min(f.scrollLeft+c*H,f.scrollWidth-f.clientWidth))),A(b),ka=null;else{if(d&&null!=H){var e=d*H,g=a.view.scrollTop,h=g+a.display.wrapper.clientHeight;0>e?g=Math.max(0,g+e-50):h=Math.min(a.view.doc.height,h+e+50);K(a,[],{top:g,bottom:h})}20>
57
- $a&&(null==ka?(ka=f.scrollLeft,Hb=f.scrollTop,Ca=c,Da=d,setTimeout(function(){if(ka!=null){var a=f.scrollLeft-ka,b=f.scrollTop-Hb,a=b&&Da&&b/Da||a&&Ca&&a/Ca;ka=Hb=null;if(a){H=(H*$a+a)/($a+1);++$a}}},200)):(Ca+=c,Da+=d))}}function ab(a,b,c){if("string"==typeof b&&(b=Ib[b],!b))return!1;a.display.pollingFast&&Eb(a)&&(a.display.pollingFast=!1);var d=a.view,e=d.sel.shift;try{wa(a)&&(d.suppressEdits=!0),c&&(d.sel.shift=!1),b(a)}catch(f){if(f!=sc)throw f;return!1}finally{d.sel.shift=e,d.suppressEdits=!1}return!0}
58
- function tc(a){var b=a.view.keyMaps.slice(0);b.push(a.options.keyMap);a.options.extraKeys&&b.unshift(a.options.extraKeys);return b}function uc(a,b){function c(){h=!0}var d=Jb(a.options.keyMap),e=d.auto;clearTimeout(vc);e&&!wc(b)&&(vc=setTimeout(function(){Jb(a.options.keyMap)==d&&(a.options.keyMap=e.call?e.call(null,a):e)},50));var f=aa[C(b,"keyCode")],g=!1,g=fa&&(ja||od);if(null==f||b.altGraphKey)return!1;C(b,"altKey")&&(f="Alt-"+f);if(C(b,g?"metaKey":"ctrlKey"))f="Ctrl-"+f;if(C(b,g?"ctrlKey":"metaKey"))f=
59
- "Cmd-"+f;var h=!1,g=tc(a),g=C(b,"shiftKey")?bb("Shift-"+f,g,function(b){return ab(a,b,!0)},c)||bb(f,g,function(b){if("string"==typeof b&&/^go[A-Z]/.test(b))return ab(a,b)},c):bb(f,g,function(b){return ab(a,b)},c);h&&(g=!1);g&&(A(b),Ua(a),cb&&(b.oldKeyCode=b.keyCode,b.keyCode=0));return g}function pd(a,b,c){if(c=bb("'"+c+"'",tc(a),function(b){return ab(a,b,!0)}))A(b),Ua(a);return c}function oc(a){this.view.focused||Y(this);P&&27==a.keyCode&&(a.returnValue=!1);if(!this.options.onKeyEvent||!this.options.onKeyEvent(this,
60
- ya(a))){var b=C(a,"keyCode");this.view.sel.shift=16==b||C(a,"shiftKey");var c=uc(this,a);ja&&(Kb=c?b:null,!c&&(88==b&&!jc&&C(a,fa?"metaKey":"ctrlKey"))&&this.replaceSelection(""))}}function jd(a){var b=this;if(!b.options.onKeyEvent||!b.options.onKeyEvent(b,ya(a))){var c=C(a,"keyCode"),d=C(a,"charCode");if(ja&&c==Kb)Kb=null,A(a);else if(!(ja&&(!a.which||10>a.which)||tb)||!uc(b,a))c=String.fromCharCode(null==d?c:d),this.options.electricChars&&(this.view.mode.electricChars&&this.options.smartIndent&&
61
- !wa(this)&&-1<this.view.mode.electricChars.indexOf(c))&&setTimeout(o(b,function(){db(b,b.view.sel.to.line,"smart")}),75),pd(b,a,c)||va(b)}}function Y(a){"nocursor"!=a.options.readOnly&&(a.view.focused||(ia(a,"focus",a),a.view.focused=!0,-1==a.display.scroller.className.search(/\bCodeMirror-focused\b/)&&(a.display.scroller.className+=" CodeMirror-focused"),ba(a,!0)),Wa(a),Ua(a))}function rb(a){a.view.focused&&(ia(a,"blur",a),a.view.focused=!1,a.display.scroller.className=a.display.scroller.className.replace(" CodeMirror-focused",
62
- ""));clearInterval(a.display.blinker);setTimeout(function(){if(!a.view.focused)a.view.sel.shift=false},150)}function mc(a,b){function c(){d.inputDiv.style.position="relative";d.input.style.cssText=h;cb&&(d.scrollbarV.scrollTop=d.scroller.scrollTop=g);Wa(a);if(null!=d.input.selectionStart){clearTimeout(Lb);var b=d.input.value=" "+(x(e.from,e.to)?"":d.input.value),c=0;d.prevInput=" ";d.input.selectionStart=1;d.input.selectionEnd=b.length;Lb=setTimeout(function m(){d.prevInput==" "&&d.input.selectionStart==
63
- 0?o(a,Ib.selectAll)(a):c++<10?Lb=setTimeout(m,500):ba(a)},200)}}var d=a.display,e=a.view.sel,f=Ba(a,b),g=d.scroller.scrollTop;if(f&&!ja){(x(e.from,e.to)||w(f,e.from)||!w(f,e.to))&&o(a,N)(a,f,f);var h=d.input.style.cssText;d.inputDiv.style.position="absolute";d.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(b.clientY-5)+"px; left: "+(b.clientX-5)+"px; z-index: 1000; background: white; outline: none;border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
64
- E(a);ba(a,!0);x(e.from,e.to)&&(d.input.value=d.prevInput=" ");V?(Xa(b),t(window,"mouseup",function j(){M(window,"mouseup",j);setTimeout(c,20)})):setTimeout(c,50)}}function Fb(a,b,c,d,e,f){var g=xc&&qd(a.view.doc,b,c);if(g){for(b=g.length-1;1<=b;--b)eb(a,g[b].from,g[b].to,[""],f);if(g.length)return eb(a,g[0].from,g[0].to,d,e,f)}else return eb(a,b,c,d,e,f)}function eb(a,b,c,d,e,f){if(!a.view.suppressEdits){var g=a.view,h=[];g.doc.iter(b.line,c.line+1,function(a){h.push(Ea(a.text,a.markedSpans))});var k=
65
- g.sel.from,j=g.sel.to,i=rd(F(h[0]),F(I(h)),b.ch,c.ch,d),c=yc(a,b,c,i,e,f);g.history&&sd(a,b.line,d.length,h,f,k,j,g.sel.from,g.sel.to);return c}}function zc(a,b){var c=a.view.doc,d=a.view.history,e=("undo"==b?d.done:d.undone).pop();if(e){for(var f={events:[],fromBefore:e.fromAfter,toBefore:e.toAfter,fromAfter:e.fromBefore,toAfter:e.toBefore},g=e.events.length-1;0<=g;g-=1){d.dirtyCounter+="undo"==b?-1:1;var h=e.events[g],k=[],j=h.start+h.added;c.iter(h.start,j,function(a){k.push(Ea(a.text,a.markedSpans))});
66
- f.events.push({start:h.start,added:h.old.length,old:k});var i=g?null:{from:e.fromBefore,to:e.toBefore};yc(a,{line:h.start,ch:0},{line:j-1,ch:q(c,j-1).text.length},h.old,i,b)}("undo"==b?d.undone:d.done).push(f)}}function yc(a,b,c,d,e,f){var g=a.view,h=g.doc,k=a.display;if(!g.suppressEdits){var j=c.line-b.line,i=q(h,b.line),m=q(h,c.line),l=!1,p=b.line;a.options.lineWrapping||(p=G(Ra(h,i)),h.iter(p,c.line+1,function(a){if(Na(h,a)==g.maxLineLength)return l=!0}));var o=I(d),r=X(k);if(0==b.ch&&0==c.ch&&
67
- ""==D(o)){for(var n=[],u=0,t=d.length-1;u<t;++u)n.push(ma(D(d[u]),F(d[u]),r));la(a,m,m.text,F(o));j&&h.remove(b.line,j,a);n.length&&h.insert(b.line,n)}else if(i==m)if(1==d.length)la(a,i,i.text.slice(0,b.ch)+D(d[0])+i.text.slice(c.ch),F(d[0]));else{n=[];u=1;for(t=d.length-1;u<t;++u)n.push(ma(D(d[u]),F(d[u]),r));n.push(ma(D(o)+i.text.slice(c.ch),F(o),r));la(a,i,i.text.slice(0,b.ch)+D(d[0]),F(d[0]));h.insert(b.line+1,n)}else if(1==d.length)la(a,i,i.text.slice(0,b.ch)+D(d[0])+m.text.slice(c.ch),F(d[0])),
68
- h.remove(b.line+1,j,a);else{n=[];la(a,i,i.text.slice(0,b.ch)+D(d[0]),F(d[0]));la(a,m,D(o)+m.text.slice(c.ch),F(o));u=1;for(t=d.length-1;u<t;++u)n.push(ma(D(d[u]),F(d[u]),r));1<j&&h.remove(b.line+1,j-1,a);h.insert(b.line+1,n)}if(a.options.lineWrapping){var v=Math.max(5,k.scroller.clientWidth/hc(k)-3);h.iter(b.line,b.line+d.length,function(a){if(a.height!=0){var b=(Math.ceil(a.text.length/v)||1)*r;b!=a.height&&S(a,b)}})}else h.iter(p,b.line+d.length,function(a){var b=Na(h,a);if(b>g.maxLineLength){g.maxLine=
69
- a;g.maxLineLength=b;g.maxLineChanged=true;l=false}}),l&&(a.curOp.updateMaxLine=!0);g.frontier=Math.min(g.frontier,b.line);La(a,400);var s=d.length-j-1;U(a,b.line,c.line+1,s);if(rc(a,"change")){for(u=0;u<d.length;++u)"string"!=typeof d[u]&&(d[u]=d[u].text);f={from:b,to:c,text:d,origin:f};if(a.curOp.textChanged){for(k=a.curOp.textChanged;k.next;k=k.next);k.next=f}else a.curOp.textChanged=f}var y={line:b.line+d.length-1,ch:D(o).length+(1==d.length?b.ch:0)};e&&"string"!=typeof e?e.from?(d=e.from,e=e.to):
70
- d=e:"end"==e?d=e=y:"start"==e?d=e=b:"around"==e?(d=b,e=y):(e=function(a){if(w(a,b))return a;if(!w(c,a))return y;var d=a.line+s,e=a.ch;a.line==c.line&&(e=e+(D(o).length-(c.ch-(c.line==b.line?b.ch:0))));return{line:d,ch:e}},d=e(g.sel.from),e=e(g.sel.to));N(a,d,e,null,!0);return y}}function W(a,b,c,d,e){d||(d=c);if(w(d,c))var f=d,d=c,c=f;return Fb(a,c,d,xa(b),null,e)}function x(a,b){return a.line==b.line&&a.ch==b.ch}function w(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch}function s(a,b){if(0>
71
- b.line)return{line:0,ch:0};if(b.line>=a.size)return{line:a.size-1,ch:q(a,a.size-1).text.length};var c=b.ch,d=q(a,b.line).text.length;return null==c||c>d?{line:b.line,ch:d}:0>c?{line:b.line,ch:0}:b}function B(a,b,c,d){var e=a.view.sel;if(e.shift||e.extend){e=e.anchor;if(c){var f=w(b,e);f!=w(c,e)?(e=b,b=c):f!=w(b,c)&&(b=c)}N(a,e,b,d)}else N(a,b,c||b,d);a.curOp.userSelChange=!0}function N(a,b,c,d,e){a.view.goalColumn=null;var f=a.view.sel;if(e||!x(b,f.anchor))b=fb(a,b,d,"push"!=e);if(e||!x(c,f.head))c=
72
- fb(a,c,d,"push"!=e);if(!x(f.anchor,b)||!x(f.head,c))f.anchor=b,f.head=c,d=w(c,b),f.from=d?c:b,f.to=d?b:c,a.curOp.updateInput=!0,a.curOp.selectionChanged=!0}function Ac(a){N(a,a.view.sel.from,a.view.sel.to,null,"push")}function fb(a,b,c,d){var e=a.view.doc,f=!1,g=b,h=c||1;a.view.cantEdit=!1;a:for(;;){var k=q(e,g.line),j;if(k.markedSpans){for(var i=0;i<k.markedSpans.length;++i){var m=k.markedSpans[i],l=m.marker;if((null==m.from||(l.inclusiveLeft?m.from<=g.ch:m.from<g.ch))&&(null==m.to||(l.inclusiveRight?
73
- m.to>=g.ch:m.to>g.ch)))if(d&&l.clearOnEnter)(j||(j=[])).push(l);else if(l.atomic){i=l.find()[0>h?"from":"to"];if(x(i,g)&&(i.ch+=h,0>i.ch?i=i.line?s(e,{line:i.line-1}):null:i.ch>k.text.length&&(i=i.line<e.size-1?{line:i.line+1,ch:0}:null),!i)){if(f){if(!d)return fb(a,b,c,!0);a.view.cantEdit=!0;return{line:0,ch:0}}f=!0;i=b;h=-h}g=i;continue a}}if(j)for(i=0;i<j.length;++i)j[i].clear()}return g}}function ic(a,b){for(;;){var c=!1,d=T(a,b),e=Db(a,d.left,d.top,d.left,d.bottom),f=a.view.scrollTop,g=a.view.scrollLeft;
74
- null!=e.scrollTop&&(za(a,e.scrollTop),1<Math.abs(a.view.scrollTop-f)&&(c=!0));null!=e.scrollLeft&&(Aa(a,e.scrollLeft),1<Math.abs(a.view.scrollLeft-g)&&(c=!0));if(!c)return d}}function Db(a,b,c,d,e){var f=a.display,g=f.lineSpace.offsetTop,c=c+g,e=e+g,h=f.scroller.clientHeight-na,k=f.scroller.scrollTop,j={},a=a.view.doc.height+2*g,i=c<g+10,g=e+g>a-10;c<k?j.scrollTop=i?0:Math.max(0,c):e>k+h&&(j.scrollTop=(g?a:e)-h);c=f.scroller.clientWidth-na;e=f.scroller.scrollLeft;b+=f.gutters.offsetWidth;d+=f.gutters.offsetWidth;
75
- f=f.gutters.offsetWidth;h=b<f+10;b<e+f||h?(h&&(b=0),j.scrollLeft=Math.max(0,b-10-f)):d>c+e-3&&(j.scrollLeft=d+10-c);return j}function db(a,b,c,d){var e=a.view.doc;c||(c="add");if("smart"==c)if(a.view.mode.indent)var f=ta(a,b);else c="prev";var g=a.options.tabSize,h=q(e,b),k=ha(h.text,null,g),j=h.text.match(/^\s*/)[0],i;if("smart"==c&&(i=a.view.mode.indent(f,h.text.slice(j.length),h.text),i==sc)){if(!d)return;c="prev"}"prev"==c?i=b?ha(q(e,b-1).text,null,g):0:"add"==c?i=k+a.options.indentUnit:"subtract"==
76
- c&&(i=k-a.options.indentUnit);i=Math.max(0,i);c="";d=0;if(a.options.indentWithTabs)for(e=Math.floor(i/g);e;--e)d+=g,c+="\t";d<i&&(c+=Bc(i-d));c!=j&&W(a,c,{line:b,ch:0},{line:b,ch:j.length},"input");h.stateAfter=null}function gb(a,b,c){var d=b,e=b,f=a.view.doc;"number"==typeof b?e=q(f,Math.max(0,Math.min(b,f.size-1))):d=G(b);if(null!=d&&c(e,d))U(a,d,d+1);else return null;return e}function Cc(a,b,c,d){function e(a){var c=(d?zb:Dc)(j,k,b,!0);if(null==c){if(a=!a)a=h+b,0>a||a==f.size?a=!1:(h=a,a=j=q(f,
77
- a));if(a)k=d?(0>b?ua:Va)(j):0>b?j.text.length:0;else return!1}else k=c;return!0}var f=a.view.doc,g=a.view.sel.head,h=g.line,k=g.ch,j=q(f,h);if("char"==c)e();else if("column"==c)e(!0);else if("word"==c)for(c=!1;!(0>b)||e();){if(hb(j.text.charAt(k)))c=!0;else if(c){0>b&&(b=1,e());break}if(0<b&&!e())break}return fb(a,{line:h,ch:k},b,!0)}function pc(a,b){var c=b.ch,d=b.ch;if(a){!1===b.after||d==a.length?--c:++d;for(var e=a.charAt(c),e=hb(e)?hb:/\s/.test(e)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&
78
- !hb(a)};0<c&&e(a.charAt(c-1));)--c;for(;d<a.length&&e(a.charAt(d));)++d}return{from:{line:b.line,ch:c},to:{line:b.line,ch:d}}}function md(a,b){B(a,{line:b,ch:0},s(a.view.doc,{line:b+1,ch:0}))}function v(a,b,c,d){n.defaults[a]=b;c&&(ca[a]=d?function(a,b,d){d!=Ub&&c(a,b,d)}:c)}function ga(a,b){if(!0===b)return b;if(a.copyState)return a.copyState(b);var c={},d;for(d in b){var e=b[d];e instanceof Array&&(e=e.concat([]));c[d]=e}return c}function ec(a,b,c){return a.startState?a.startState(b,c):!0}function Jb(a){return"string"==
79
- typeof a?O[a]:a}function bb(a,b,c,d){function e(b){var b=Jb(b),f=b[a];if(!1===f)return d&&d(),!0;if(null!=f&&c(f))return!0;if(b.nofallthrough)return d&&d(),!0;b=b.fallthrough;if(null==b)return!1;if("[object Array]"!=Object.prototype.toString.call(b))return e(b);for(var f=0,k=b.length;f<k;++f)if(e(b[f]))return!0;return!1}for(var f=0;f<b.length;++f)if(e(b[f]))return!0}function wc(a){a=aa[C(a,"keyCode")];return"Ctrl"==a||"Alt"==a||"Shift"==a||"Mod"==a}function Fa(a,b){this.pos=this.start=0;this.string=
80
- a;this.tabSize=b||8}function Mb(a,b){this.lines=[];this.type=b;this.cm=a}function Ec(a,b,c,d,e){var f=a.view.doc,g=new Mb(a,e);if("range"==e&&!w(b,c))return g;if(d)for(var h in d)d.hasOwnProperty(h)&&(g[h]=d[h]);g.replacedWith&&(g.collapsed=!0,g.replacedWith=r("span",[g.replacedWith],"CodeMirror-widget"));g.collapsed&&(ra=!0);var k=b.line,j=0,i,m;f.iter(k,c.line+1,function(a){var d={from:null,to:null,marker:g};j=j+a.text.length;if(k==b.line){d.from=b.ch;j=j-b.ch}if(k==c.line){d.to=c.ch;j=j-(a.text.length-
81
- c.ch)}if(g.collapsed){k==c.line&&(m=ib(a,c.ch));k==b.line?i=ib(a,b.ch):S(a,0)}a.markedSpans=a.markedSpans?a.markedSpans.concat([d]):[d];d.marker.lines.push(a);g.collapsed&&(k==b.line&&R(a))&&S(a,0);++k});g.readOnly&&(xc=!0,(a.view.history.done.length||a.view.history.undone.length)&&a.clearHistory());if(g.collapsed){if(i!=m)throw Error("Inserting collapsed marker overlapping an existing one");g.size=j;g.atomic=!0}(g.className||g.startStyle||g.endStyle||g.collapsed)&&U(a,b.line,c.line+1);g.atomic&&
82
- Ac(a);return g}function jb(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==b)return d}}function rd(a,b,c,d,e){if(!a&&!b)return e;if(a)for(var f=0,g;f<a.length;++f){var h=a[f],k=h.marker;if(null==h.from||(k.inclusiveLeft?h.from<=c:h.from<c)||"bookmark"==k.type&&h.from==c){var j=null==h.to||(k.inclusiveRight?h.to>=c:h.to>c);(g||(g=[])).push({from:h.from,to:j?null:h.to,marker:k})}}a=g;if(b)for(var f=0,i;f<b.length;++f)if(g=b[f],h=g.marker,null==g.to||(h.inclusiveRight?g.to>=d:g.to>d)||
83
- "bookmark"==h.type&&g.from==d&&g.from!=c)k=null==g.from||(h.inclusiveLeft?g.from<=d:g.from<d),(i||(i=[])).push({from:k?null:g.from-d,to:null==g.to?null:g.to-d,marker:h});b=i;i=1==e.length;f=I(e).length+(i?c:0);if(a)for(d=0;d<a.length;++d)g=a[d],null==g.to&&((h=jb(b,g.marker))?i&&(g.to=null==h.to?null:h.to+f):g.to=c);if(b)for(d=0;d<b.length;++d)(g=b[d],null!=g.to&&(g.to+=f),null==g.from)?(h=jb(a,g.marker),h||(g.from=f,i&&(a||(a=[])).push(g))):(g.from+=f,i&&(a||(a=[])).push(g));c=[Ea(e[0],a)];if(!i){i=
84
- e.length-2;var m;if(0<i&&a)for(d=0;d<a.length;++d)null==a[d].to&&(m||(m=[])).push({from:null,to:null,marker:a[d].marker});for(d=0;d<i;++d)c.push(Ea(e[d+1],m));c.push(Ea(I(e),b))}return c}function qd(a,b,c){var d=null;a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;if(c.readOnly&&(!d||-1==kb(d,c)))(d||(d=[])).push(c)}});if(!d)return null;a=[{from:b,to:c}];for(b=0;b<d.length;++b)for(var c=d[b].find(),e=0;e<a.length;++e){var f=
85
- a[e];if(w(c.from,f.to)&&!w(c.to,f.from)){var g=[e,1];w(f.from,c.from)&&g.push({from:f.from,to:c.from});w(c.to,f.to)&&g.push({from:c.to,to:f.to});a.splice.apply(a,g);e+=g.length-1}}return a}function ib(a,b){var c=ra&&a.markedSpans,d;if(c)for(var e,f=0;f<c.length;++f)if(e=c[f],e.marker.collapsed&&(null==e.from||e.from<b)&&(null==e.to||e.to>b)&&(!d||d.width<e.marker.width))d=e.marker;return d}function qa(a){return ib(a,-1)}function Oa(a){return ib(a,a.text.length+1)}function Ra(a,b){for(var c;c=qa(b);)b=
86
- q(a,c.find().from.line);return b}function R(a){var b=ra&&a.markedSpans;if(b)for(var c,d=0;d<b.length;++d)if(c=b[d],c.marker.collapsed&&(null==c.from||0==c.from&&c.marker.inclusiveLeft&&Fc(a,c)))return!0}function Fc(a,b){if(null==b.to||b.marker.inclusiveRight&&b.to==a.text.length)return!0;for(var c,d=0;d<a.markedSpans.length;++d)if(c=a.markedSpans[d],c.marker.collapsed&&c.from==b.to&&(c.marker.inclusiveLeft||b.marker.inclusiveRight)&&Fc(a,c))return!0}function D(a){return"string"==typeof a?a:a.text}
87
- function F(a){if("string"==typeof a)return null;for(var a=a.markedSpans,b=null,c=0;c<a.length;++c)a[c].marker.explicitlyCleared?b||(b=a.slice(0,c)):b&&b.push(a[c]);return!b?a:b.length?b:null}function Ea(a,b){return b?{text:a,markedSpans:b}:a}function Gc(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c){var d=b[c].marker.lines,e=kb(d,a);d.splice(e,1)}a.markedSpans=null}}function Hc(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.lines.push(a);a.markedSpans=b}}function ma(a,b,c){a={text:a,
88
- height:c};Hc(a,b);R(a)&&(a.height=0);return a}function la(a,b,c,d){b.text=c;b.stateAfter=b.styles=null;null!=b.order&&(b.order=null);Gc(b);Hc(b,d);R(b)?b.height=0:b.height||(b.height=X(a.display));ea(a,b,"change")}function cc(a,b,c){var d=a.view.mode,e=a.options.flattenSpans,f=!b.styles,g=0,h="",k=null,a=new Fa(b.text,a.options.tabSize),j=b.styles||(b.styles=[]);for(""==b.text&&d.blankLine&&d.blankLine(c);!a.eol();){var i=d.token(a,c),m=a.current();a.start=a.pos;!e||k!=i?(h&&(f=f||g>=j.length||h!=
89
- j[g]||k!=j[g+1],j[g++]=h,j[g++]=k),h=m,k=i):h+=m;if(5E3<a.pos)break}h&&(f=f||g>=j.length||h!=j[g]||k!=j[g+1],j[g++]=h,j[g++]=k);5E3<a.pos&&(j[g++]=b.text.slice(a.pos),j[g++]=null);g!=j.length&&(j.length=g,f=!0);return f}function dc(a,b,c){var d=a.view.mode,a=new Fa(b.text,a.options.tabSize);for(""==b.text&&d.blankLine&&d.blankLine(c);!a.eol()&&5E3>=a.pos;)d.token(a,c),a.start=a.pos}function Ic(a){return!a?null:Jc[a]||(Jc[a]="cm-"+a.replace(/ +/g," cm-"))}function Zb(a,b,c){for(var d,e=b,f,g,h=!0;d=
90
- qa(e);)h=!1,e=q(a.view.doc,d.find().from.line),f||(f=e);d={pre:r("pre"),col:0,pos:0,display:!c,measure:null,addedOne:!1,cm:a};e.textClass&&(d.pre.className=e.textClass);do{e.styles||cc(a,e,e.stateAfter=ta(a,G(e)));d.measure=e==b&&c;d.pos=0;d.addToken=d.measure?td:Kc;c&&(g&&e!=b&&!d.addedOne)&&(c[0]=d.pre.appendChild(Lc(a.display.measure)),d.addedOne=!0);var k;a:{var j=e;g=d;k=j.styles;var i=j.markedSpans;if(i)for(var j=j.text.length,m=0,l=0,p="",o=void 0,n=0,t=void 0,u=void 0,v=void 0,s=void 0;;){if(n==
91
- m){for(var t=u=v="",s=null,n=Infinity,x=null,y=0;y<i.length;++y){var z=i[y],w=z.marker;if(z.from<=m&&(null==z.to||z.to>m)){if(null!=z.to&&n>z.to&&(n=z.to,u=""),w.className&&(t+=" "+w.className),w.startStyle&&z.from==m&&(v+=" "+w.startStyle),w.endStyle&&z.to==n&&(u+=" "+w.endStyle),w.collapsed&&(!s||s.marker.width<w.width))s=z}else z.from>m&&n>z.from&&(n=z.from);"bookmark"==w.type&&(z.from==m&&w.replacedWith)&&(x=w.replacedWith)}if(s&&(s.from||0)==m)if(Mc(g,(null==s.to?j:s.to)-m,null!=s.from&&s.marker.replacedWith),
92
- null==s.to){k=s.marker.find();break a}x&&!s&&Mc(g,0,x)}if(m>=j)break;for(x=Math.min(j,n);;){if(p){y=m+p.length;s||(z=y>x?p.slice(0,x-m):p,g.addToken(g,z,o+t,v,m+z.length==n?u:""));if(y>=x){p=p.slice(x-m);m=x;break}m=y;v=""}p=k[l++];o=Ic(k[l++])}}else for(var l=0;l<k.length;l+=2)g.addToken(g,k[l],Ic(k[l+1]));k=void 0}g=e==f;k&&(e=q(a.view.doc,k.to.line),h=!1)}while(k);c&&!d.addedOne&&(c[0]=d.pre.appendChild(h?r("span"," "):Lc(a.display.measure)));!d.pre.firstChild&&!R(b)&&d.pre.appendChild(document.createTextNode(" "));
93
- return d.pre}function Kc(a,b,c,d,e){if(b){if(Nb.test(b))for(var f=document.createDocumentFragment(),g=0;;){Nb.lastIndex=g;var h=Nb.exec(b),k=h?h.index-g:b.length-g;k&&(f.appendChild(document.createTextNode(b.slice(g,g+k))),a.col+=k);if(!h)break;g+=k+1;"\t"==h[0]?(h=a.cm.options.tabSize,h-=a.col%h,f.appendChild(r("span",Bc(h),"cm-tab")),a.col+=h):(k=r("span","•","cm-invalidchar"),k.title="\\u"+h[0].charCodeAt(0).toString(16),f.appendChild(k),a.col+=1)}else{a.col+=b.length;var f=document.createTextNode(b)}if(c||
94
- d||e||a.measure)return b=c||"",d&&(b+=d),e&&(b+=e),a.pre.appendChild(r("span",[f],b));a.pre.appendChild(f)}}function td(a,b,c,d,e){for(var f=0;f<b.length;++f)f&&(f<b.length-1&&a.cm.options.lineWrapping&&lb.test(b.slice(f-1,f+1)))&&a.pre.appendChild(r("wbr")),a.measure[a.pos++]=Kc(a,b.charAt(f),c,0==f&&d,f==b.length-1&&e);b.length&&(a.addedOne=!0)}function Mc(a,b,c){c&&(a.display||(c=c.cloneNode(!0)),a.pre.appendChild(c),a.measure&&b&&(a.measure[a.pos]=c,a.addedOne=!0));a.pos+=b}function Ia(a){this.lines=
95
- 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 Ha(a){this.children=a;for(var b=0,c=0,d=0,e=a.length;d<e;++d){var f=a[d],b=b+f.chunkSize(),c=c+f.height;f.parent=this}this.size=b;this.height=c;this.parent=null}function q(a,b){for(;!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 S(a,b){for(var c=b-a.height,d=a;d;d=d.parent)d.height+=c}function G(a){if(null==a.parent)return null;
96
- for(var b=a.parent,a=kb(b.lines,a),c=b.parent;c;b=c,c=c.parent)for(var d=0;c.children[d]!=b;++d)a+=c.children[d].chunkSize();return a}function Qa(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);d=0;for(e=a.lines.length;d<e;++d){f=a.lines[d].height;if(b<f)break;b-=f}return c+d}function sa(a,b){for(var b=Ra(a.view.doc,b),c=0,d=b.parent,e=0;e<d.lines.length;++e){var f=d.lines[e];if(f==b)break;
97
- else c+=f.height}for(f=d.parent;f;d=f,f=d.parent)for(e=0;e<f.children.length;++e){var g=f.children[e];if(g==d)break;else c+=g.height}return c}function L(a){var b=a.order;null==b&&(b=a.order=ud(a.text));return b}function qb(){return{done:[],undone:[],lastTime:0,lastOp:null,lastOrigin:null,dirtyCounter:0}}function sd(a,b,c,d,e,f,g,h,k){var j=a.view.history;j.undone.length=0;var i=+new Date,m=I(j.done);if(m&&(j.lastOp==a.curOp.id||j.lastOrigin==e&&("input"==e||"delete"==e)&&j.lastTime>i-600)){f=I(m.events);
98
- if(f.start>b+d.length||f.start+f.added<b)m.events.push({start:b,added:c,old:d});else{for(var g=Math.max(0,f.start-b),l=Math.max(0,b+d.length-(f.start+f.added)),p=g;0<p;--p)f.old.unshift(d[p-1]);for(p=l;0<p;--p)f.old.push(d[d.length-p]);g&&(f.start=b);f.added+=c-(d.length-g-l)}m.fromAfter=h;m.toAfter=k}else{m={events:[{start:b,added:c,old:d}],fromBefore:f,toBefore:g,fromAfter:h,toAfter:k};for(j.done.push(m);j.done.length>a.options.undoDepth;)j.done.shift();0>j.dirtyCounter?j.dirtyCounter=NaN:j.dirtyCounter++}j.lastTime=
99
- i;j.lastOp=a.curOp.id;j.lastOrigin=e}function vd(){Xa(this)}function ya(a){a.stop||(a.stop=vd);return a}function A(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function Nc(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function Xa(a){A(a);Nc(a)}function qc(a){var b=a.which;null==b&&(a.button&1?b=1:a.button&2?b=3:a.button&4&&(b=2));fa&&(a.ctrlKey&&1==b)&&(b=3);return b}function C(a,b){return a.override&&a.override.hasOwnProperty(b)?a.override[b]:a[b]}function t(a,b,c){a.addEventListener?
100
- a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):(a=a._handlers||(a._handlers={}),(a[b]||(a[b]=[])).push(c))}function M(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else if(a=a._handlers&&a._handlers[b])for(b=0;b<a.length;++b)if(a[b]==c){a.splice(b,1);break}}function ia(a,b){var c=a._handlers&&a._handlers[b];if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)}function ea(a,b,c){function d(a){return function(){a.apply(null,
101
- f)}}var e=b._handlers&&b._handlers[c];if(e)for(var f=Array.prototype.slice.call(arguments,3),g=a.curOp&&a.curOp.delayedCallbacks,h=0;h<e.length;++h)g?g.push(d(e[h])):e[h].apply(null,f)}function rc(a,b){var c=a._handlers&&a._handlers[b];return c&&0<c.length}function ub(){this.id=null}function ha(a,b,c){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));for(var d=0,e=0;d<b;++d)"\t"==a.charAt(d)?e+=c-e%c:++e;return e}function Bc(a){for(;mb.length<=a;)mb.push(I(mb)+" ");return mb[a]}function I(a){return a[a.length-
102
- 1]}function kc(a){Ka?(a.selectionStart=0,a.selectionEnd=a.value.length):a.select()}function kb(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 fc(a){for(var b=[],c=0;c<a;++c)b.push(void 0);return b}function J(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function hb(a){return/\w/.test(a)||"€"<a&&(a.toUpperCase()!=a.toLowerCase()||wd.test(a))}function Oc(a){var b=0,c;for(c in a)a.hasOwnProperty(c)&&
103
- a[c]&&++b;return!b}function r(a,b,c,d){a=document.createElement(a);c&&(a.className=c);d&&(a.style.cssText=d);if("string"==typeof b)Yb(a,b);else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);return a}function Ma(a){a.innerHTML="";return a}function Z(a,b){return Ma(a).appendChild(b)}function Yb(a,b){cb?(a.innerHTML="",a.appendChild(document.createTextNode(b))):a.textContent=b}function Pa(a){if(null!=nb)return nb;var b=r("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");Z(a,b);b.offsetWidth&&
104
- (nb=b.offsetHeight-b.clientHeight);return nb||0}function Lc(a){if(null==Ob){var b=r("span","​");Z(a,r("span",[b,document.createTextNode("x")]));0!=a.firstChild.offsetHeight&&(Ob=1>=b.offsetWidth&&2<b.offsetHeight&&!da)}return Ob?r("span","​"):r("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function cd(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=0;e<a.length;++e){var f=a[e];f.from<c&&f.to>b&&d(Math.max(f.from,b),Math.min(f.to,c),1==f.level?"rtl":"ltr")}}function Pb(a){return a.level%
105
- 2?a.from:a.to}function Va(a){return(a=L(a))?a[0].level%2?a[0].to:a[0].from:0}function ua(a){var b=L(a);return!b?a.text.length:Pb(I(b))}function Pc(a,b){var c=q(a.view.doc,b),d=Ra(a.view.doc,c);d!=c&&(b=G(d));c=L(d);d=!c?0:c[0].level%2?ua(d):Va(d);return{line:b,ch:d}}function xd(a,b){for(var c,d;c=Oa(d=q(a.view.doc,b));)b=c.find().to.line;c=L(d);d=!c?d.text.length:c[0].level%2?Va(d):ua(d);return{line:b,ch:d}}function zb(a,b,c,d){var e=L(a);if(!e)return Dc(a,b,c,d);for(var d=d?function(b,c){do b+=c;
106
- while(0<b&&Ab.test(a.text.charAt(b)));return b}:function(a,b){return a+b},f=e[0].level,g=0;g<e.length;++g){var h=e[g],k=h.level%2==f;if(h.from<b&&h.to>b||k&&(h.from==b||h.to==b))break}for(b=d(b,h.level%2?-c:c);null!=b;)if(h.level%2==f)if(b<h.from||b>h.to)b=(h=e[g+=c])&&(0<c==h.level%2?d(h.to,-1):d(h.from,1));else break;else if(b==(h.level%2?h.to:h.from))b=(h=e[--g])&&Pb(h);else if(b==Pb(h))b=(h=e[++g])&&(h.level%2?h.to:h.from);else break;return 0>b||b>a.text.length?null:b}function Dc(a,b,c,d){b+=
107
- c;if(d)for(;0<b&&Ab.test(a.text.charAt(b));)b+=c;return 0>b||b>a.text.length?null:b}var V=/gecko\/\d/i.test(navigator.userAgent),P=/MSIE \d/.test(navigator.userAgent),da=/MSIE [1-7]\b/.test(navigator.userAgent),cb=/MSIE [1-8]\b/.test(navigator.userAgent),Q=/WebKit\//.test(navigator.userAgent),od=Q&&/Qt\/\d+\.\d+/.test(navigator.userAgent),Qc=/Chrome\//.test(navigator.userAgent),ja=/Opera\//.test(navigator.userAgent),Gb=/Apple Computer/.test(navigator.vendor),tb=/KHTML\//.test(navigator.userAgent),
108
- Vc=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),Wc=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),gd=/PhantomJS/.test(navigator.userAgent),Ka=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),Sb=Ka||/Android|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent),fa=Ka||/Mac/.test(navigator.platform),xc=!1,ra=!1,$,Za,Ya,$a=0,Ca,Da,ka,Hb,H=null;P?H=-0.53:V?H=15:Qc?H=-0.7:Gb&&(H=-1/3);var vc,Kb=null,Lb;n.prototype={getValue:function(a){var b=
109
- [],c=this.view.doc;c.iter(0,c.size,function(a){b.push(a.text)});return b.join(a||"\n")},setValue:o(null,function(a){var b=this.view.doc,c={line:0,ch:0},d=q(b,b.size-1).text.length;eb(this,c,{line:b.size-1,ch:d},xa(a),c,c,"setValue")}),getSelection:function(a){return this.getRange(this.view.sel.from,this.view.sel.to,a)},replaceSelection:o(null,function(a,b,c){var d=this.view.sel;Fb(this,d.from,d.to,xa(a),b||"around",c)}),focus:function(){window.focus();E(this);Y(this);va(this)},setOption:function(a,
110
- b){var c=this.options,d=c[a];c[a]==b&&"mode"!=a||(c[a]=b,ca.hasOwnProperty(a)&&o(this,ca[a])(this,b,d))},getOption:function(a){return this.options[a]},getMode:function(){return this.view.mode},addKeyMap:function(a){this.view.keyMaps.push(a)},removeKeyMap:function(a){for(var b=this.view.keyMaps,c=0;c<b.length;++c)if(("string"==typeof a?b[c].name:b[c])==a)return b.splice(c,1),!0},undo:o(null,function(){zc(this,"undo")}),redo:o(null,function(){zc(this,"redo")}),indentLine:o(null,function(a,b,c){"string"!=
111
- typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract");0<=a&&a<this.view.doc.size&&db(this,a,b,c)}),indentSelection:o(null,function(a){var b=this.view.sel;if(x(b.from,b.to))return db(this,b.from.line,a);for(var c=b.to.line-(b.to.ch?0:1),b=b.from.line;b<=c;++b)db(this,b,a)}),historySize:function(){var a=this.view.history;return{undo:a.done.length,redo:a.undone.length}},clearHistory:function(){this.view.history=qb()},markClean:function(){this.view.history.dirtyCounter=0;this.view.history.lastOp=
112
- this.view.history.lastOrigin=null},isClean:function(){return 0==this.view.history.dirtyCounter},getHistory:function(){function a(a){for(var b=0,e=[],f;b<a.length;++b){var g=a[b];e.push({events:f=[],fromBefore:g.fromBefore,toBefore:g.toBefore,fromAfter:g.fromAfter,toAfter:g.toAfter});for(var h=0,g=g.events;h<g.length;++h){var k=[],j=g[h];f.push({start:j.start,added:j.added,old:k});for(var i=0;i<j.old.length;++i)k.push(D(j.old[i]))}}return e}var b=this.view.history;return{done:a(b.done),undone:a(b.undone)}},
113
- setHistory:function(a){var b=this.view.history=qb();b.done=a.done;b.undone=a.undone},getTokenAt:function(a){for(var b=this.view.doc,a=s(b,a),c=ta(this,a.line),d=this.view.mode,b=q(b,a.line),b=new Fa(b.text,this.options.tabSize);b.pos<a.ch&&!b.eol();){b.start=b.pos;var e=d.token(b,c)}return{start:b.start,end:b.pos,string:b.current(),className:e||null,type:e||null,state:c}},getStateAfter:function(a){var b=this.view.doc,a=Math.max(0,Math.min(null==a?b.size-1:a,b.size-1));return ta(this,a+1)},cursorCoords:function(a,
114
- b){var c;c=this.view.sel;c=null==a?c.head:"object"==typeof a?s(this.view.doc,a):a?c.from:c.to;return T(this,c,b||"page")},charCoords:function(a,b){return Ta(this,s(this.view.doc,a),b||"page")},coordsChar:function(a){var b=this.display.lineSpace.getBoundingClientRect();return yb(this,a.left-b.left,a.top-b.top)},defaultTextHeight:function(){return X(this.display)},markText:o(null,function(a,b,c){return Ec(this,s(this.view.doc,a),s(this.view.doc,b),c,"range")}),setBookmark:o(null,function(a,b){a=s(this.view.doc,
115
- a);return Ec(this,a,a,b?{replacedWith:b}:{},"bookmark")}),findMarksAt:function(a){var b=this.view.doc,a=s(b,a),c=[];if(b=q(b,a.line).markedSpans)for(var d=0;d<b.length;++d){var e=b[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&c.push(e.marker)}return c},setGutterMarker:o(null,function(a,b,c){return gb(this,a,function(a){var e=a.gutterMarkers||(a.gutterMarkers={});e[b]=c;!c&&Oc(e)&&(a.gutterMarkers=null);return!0})}),clearGutter:o(null,function(a){var b=0,c=this,d=c.view.doc;d.iter(0,
116
- d.size,function(d){d.gutterMarkers&&d.gutterMarkers[a]&&(d.gutterMarkers[a]=null,U(c,b,b+1),Oc(d.gutterMarkers)&&(d.gutterMarkers=null));++b})}),addLineClass:o(null,function(a,b,c){return gb(this,a,function(a){var e="text"==b?"textClass":"background"==b?"bgClass":"wrapClass";if(a[e]){if(RegExp("\\b"+c+"\\b").test(a[e]))return!1;a[e]+=" "+c}else a[e]=c;return!0})}),removeLineClass:o(null,function(a,b,c){return gb(this,a,function(a){var e="text"==b?"textClass":"background"==b?"bgClass":"wrapClass",
117
- f=a[e];if(f)if(null==c)a[e]=null;else{var g=f.replace(RegExp("^"+c+"\\b\\s*|\\s*\\b"+c+"\\b"),"");if(g==f)return!1;a[e]=g||null}else return!1;return!0})}),addLineWidget:o(null,function(a,b,c){var d=c||{};d.node=b;d.noHScroll&&(this.display.alignWidgets=!0);gb(this,a,function(a){(a.widgets||(a.widgets=[])).push(d);d.line=a;return true});return d}),removeLineWidget:o(null,function(a){var b=a.line.widgets,c=G(a.line);if(null!=c){for(var d=0;d<b.length;++d)b[d]==a&&b.splice(d--,1);U(this,c,c+1)}}),lineInfo:function(a){if("number"==
118
- typeof a){if(!(0<=a&&a<this.view.doc.size))return null;var b=a,a=q(this.view.doc,a);if(!a)return null}else if(b=G(a),null==b)return null;return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(a,b,c,d,e){var f=this.display,a=T(this,s(this.view.doc,a)),g=a.top,h=a.left;b.style.position="absolute";f.sizer.appendChild(b);
119
- if("over"==d)g=a.top;else if("near"==d){var d=Math.max(f.wrapper.clientHeight,this.view.doc.height),k=Math.max(f.sizer.clientWidth,f.lineSpace.clientWidth);a.bottom+b.offsetHeight>d&&a.top>b.offsetHeight&&(g=a.top-b.offsetHeight);h+b.offsetWidth>k&&(h=k-b.offsetWidth)}b.style.top=g+f.lineSpace.offsetTop+"px";b.style.left=b.style.right="";"right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px");c&&
120
- (a=Db(this,h,g,h+b.offsetWidth,g+b.offsetHeight),null!=a.scrollTop&&za(this,a.scrollTop),null!=a.scrollLeft&&Aa(this,a.scrollLeft))},lineCount:function(){return this.view.doc.size},clipPos:function(a){return s(this.view.doc,a)},getCursor:function(a){var b=this.view.sel,a=null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||!1===a?b.to:b.from;return{line:a.line,ch:a.ch}},somethingSelected:function(){return!x(this.view.sel.from,this.view.sel.to)},setCursor:o(null,function(a,b,c){a=s(this.view.doc,
121
- "number"==typeof a?{line:a,ch:b||0}:a);c?B(this,a):N(this,a,a)}),setSelection:o(null,function(a,b){var c=this.view.doc;N(this,s(c,a),s(c,b||a))}),extendSelection:o(null,function(a,b){var c=this.view.doc;B(this,s(c,a),b&&s(c,b))}),setExtending:function(a){this.view.sel.extend=a},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},getLineHandle:function(a){var b=this.view.doc;if(0<=a&&a<b.size)return q(b,a)},getLineNumber:function(a){return G(a)},setLine:o(null,function(a,b){0<=a&&a<this.view.doc.size&&
122
- W(this,b,{line:a,ch:0},{line:a,ch:q(this.view.doc,a).text.length})}),removeLine:o(null,function(a){0<=a&&a<this.view.doc.size&&W(this,"",{line:a,ch:0},s(this.view.doc,{line:a+1,ch:0}))}),replaceRange:o(null,function(a,b,c){var d=this.view.doc,b=s(d,b),c=c?s(d,c):b;return W(this,a,b,c)}),getRange:function(a,b,c){var d=this.view.doc,a=s(d,a),b=s(d,b),e=a.line,f=b.line;if(e==f)return q(d,e).text.slice(a.ch,b.ch);var g=[q(d,e).text.slice(a.ch)];d.iter(e+1,f,function(a){g.push(a.text)});g.push(q(d,f).text.slice(0,
123
- b.ch));return g.join(c||"\n")},triggerOnKeyDown:o(null,oc),execCommand:function(a){return Ib[a](this)},moveH:o(null,function(a,b){var c=this.view.sel,d=0>a?c.from:c.to;if(c.shift||c.extend||x(c.from,c.to))d=Cc(this,a,b,!0);B(this,d,d,a)}),deleteH:o(null,function(a,b){var c=this.view.sel;x(c.from,c.to)?W(this,"",c.from,Cc(this,a,b,!1),"delete"):W(this,"",c.from,c.to,"delete");this.curOp.userSelChange=!0}),moveV:o(null,function(a,b){var c=this.view,d=c.doc,e=this.display,f=T(this,c.sel.head,"div"),
124
- g=f.left,h;null!=c.goalColumn&&(g=c.goalColumn);"page"==b?(h=Math.min(e.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),h=f.top+a*h):"line"==b&&(h=0<a?f.bottom+3:f.top-3);do{var k=yb(this,g,h);h+=5*a}while(k.outside&&(0>a?0<h:h<d.height));"page"==b&&(e.scrollbarV.scrollTop+=Ta(this,k,"div").top-f.top);B(this,k,k,a);c.goalColumn=g}),toggleOverwrite:function(){this.display.cursor.className=(this.view.overwrite=!this.view.overwrite)?this.display.cursor.className+" CodeMirror-overwrite":
125
- this.display.cursor.className.replace(" CodeMirror-overwrite","")},posFromIndex:function(a){var b=0,c,d=this.view.doc;d.iter(0,d.size,function(d){d=d.text.length+1;if(d>a)return c=a,!0;a-=d;++b});return s(d,{line:b,ch:c})},indexFromPos:function(a){if(0>a.line||0>a.ch)return 0;var b=a.ch;this.view.doc.iter(0,a.line,function(a){b+=a.text.length+1});return b},scrollTo:function(a,b){null!=a&&(this.display.scrollbarH.scrollLeft=this.display.scroller.scrollLeft=a);null!=b&&(this.display.scrollbarV.scrollTop=
126
- this.display.scroller.scrollTop=b);K(this,[])},getScrollInfo:function(){var a=this.display.scroller,b=na;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:function(a){"number"==typeof a&&(a={line:a,ch:0});a=a?s(this.view.doc,a):this.view.sel.head;ic(this,a)},setSize:function(a,b){function c(a){return"number"==typeof a||/^\d+$/.test(""+a)?a+"px":a}null!=a&&(this.display.wrapper.style.width=
127
- c(a));null!=b&&(this.display.wrapper.style.height=c(b));this.refresh()},on:function(a,b){t(this,a,b)},off:function(a,b){M(this,a,b)},operation:function(a){return o(this,a)()},refresh:function(){oa(this);this.display.scroller.scrollHeight>this.view.scrollTop&&(this.display.scrollbarV.scrollTop=this.display.scroller.scrollTop=this.view.scrollTop);K(this,!0)},getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},
128
- getGutterElement:function(){return this.display.gutters}};var ca=n.optionHandlers={},ob=n.defaults={},Ub=n.Init={toString:function(){return"CodeMirror.Init"}};v("value","",function(a,b){a.setValue(b)},!0);v("mode",null,Ja,!0);v("indentUnit",2,Ja,!0);v("indentWithTabs",!1);v("smartIndent",!0);v("tabSize",4,function(a){Ja(a);oa(a);K(a,!0)},!0);v("electricChars",!0);v("theme","default",function(a){Tb(a);pa(a)},!0);v("keyMap","default",function(a){var b=O[a.options.keyMap].style;a.display.wrapper.className=
129
- a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(b?" cm-keymap-"+b:"")});v("extraKeys",null);v("onKeyEvent",null);v("onDragEvent",null);v("lineWrapping",!1,function(a){var b=a.view.doc,c=X(a.display);if(a.options.lineWrapping){a.display.wrapper.className=a.display.wrapper.className+" CodeMirror-wrap";var d=a.display.scroller.clientWidth/hc(a.display)-3;b.iter(0,b.size,function(a){if(a.height!=0){var b=Math.ceil(a.text.length/d)||1;b!=1&&S(a,b*c)}});a.display.sizer.style.minWidth=""}else{a.display.wrapper.className=
130
- a.display.wrapper.className.replace(" CodeMirror-wrap","");Vb(a.view);b.iter(0,b.size,function(a){a.height!=0&&S(a,c)})}U(a,0,b.size);oa(a);setTimeout(function(){Wb(a.display,a.view.doc.height)},100)},!0);v("gutters",[],function(a){pb(a.options);pa(a)},!0);v("lineNumbers",!1,function(a){pb(a.options);pa(a)},!0);v("firstLineNumber",1,pa,!0);v("lineNumberFormatter",function(a){return a},pa,!0);v("showCursorWhenSelecting",!1,vb,!0);v("readOnly",!1,function(a,b){if(b=="nocursor"){rb(a);a.display.input.blur()}else b||
131
- ba(a,true)});v("dragDrop",!0);v("cursorBlinkRate",530);v("cursorHeight",1);v("workTime",100);v("workDelay",100);v("flattenSpans",!0);v("pollInterval",100);v("undoDepth",40);v("viewportMargin",10,function(a){a.refresh()},!0);v("tabindex",null,function(a,b){a.display.input.tabIndex=b||""});v("autofocus",null);var Rc=n.modes={},Qb=n.mimeModes={};n.defineMode=function(a,b){!n.defaults.mode&&"null"!=a&&(n.defaults.mode=a);if(2<arguments.length){b.dependencies=[];for(var c=2;c<arguments.length;++c)b.dependencies.push(arguments[c])}Rc[a]=
132
- b};n.defineMIME=function(a,b){Qb[a]=b};n.resolveMode=function(a){if("string"==typeof a&&Qb.hasOwnProperty(a))a=Qb[a];else if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return n.resolveMode("application/xml");return"string"==typeof a?{name:a}:a||{name:"null"}};n.getMode=function(a,b){var b=n.resolveMode(b),c=Rc[b.name];if(!c)return n.getMode(a,"text/plain");c=c(a,b);if(Ga.hasOwnProperty(b.name)){var d=Ga[b.name],e;for(e in d)d.hasOwnProperty(e)&&(c.hasOwnProperty(e)&&(c["_"+e]=c[e]),c[e]=
133
- d[e])}c.name=b.name;return c};n.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}});n.defineMIME("text/plain","null");var Ga=n.modeExtensions={};n.extendMode=function(a,b){var c=Ga.hasOwnProperty(a)?Ga[a]:Ga[a]={},d;for(d in b)b.hasOwnProperty(d)&&(c[d]=b[d])};n.defineExtension=function(a,b){n.prototype[a]=b};n.defineOption=v;var sb=[];n.defineInitHook=function(a){sb.push(a)};n.copyState=ga;n.startState=ec;n.innerMode=function(a,b){for(;a.innerMode;)var c=a.innerMode(b),b=c.state,
134
- a=c.mode;return c||{mode:a,state:b}};var Ib=n.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=!x(b,c);!d&&a.getLine(b.line).length==b.ch?a.replaceRange("",b,{line:b.line+1,ch:0},"delete"):a.replaceRange("",b,d?c:{line:b.line},"delete")},deleteLine:function(a){var b=a.getCursor().line;a.replaceRange("",{line:b,ch:0},{line:b},"delete")},undo:function(a){a.undo()},redo:function(a){a.redo()},goDocStart:function(a){a.extendSelection({line:0,
135
- ch:0})},goDocEnd:function(a){a.extendSelection({line:a.lineCount()-1})},goLineStart:function(a){a.extendSelection(Pc(a,a.getCursor().line))},goLineStartSmart:function(a){var b=a.getCursor(),c=Pc(a,b.line),d=a.getLineHandle(c.line),e=L(d);!e||0==e[0].level?(d=Math.max(0,d.text.search(/\S/)),a.extendSelection({line:c.line,ch:b.line==c.line&&b.ch<=d&&b.ch?0:d})):a.extendSelection(c)},goLineEnd:function(a){a.extendSelection(xd(a,a.getCursor().line))},goLineUp:function(a){a.moveV(-1,"line")},goLineDown:function(a){a.moveV(1,
136
- "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")},delCharBefore:function(a){a.deleteH(-1,"char")},delCharAfter:function(a){a.deleteH(1,"char")},delWordBefore:function(a){a.deleteH(-1,"word")},delWordAfter:function(a){a.deleteH(1,
137
- "word")},indentAuto:function(a){a.indentSelection("smart")},indentMore:function(a){a.indentSelection("add")},indentLess:function(a){a.indentSelection("subtract")},insertTab:function(a){a.replaceSelection("\t","end","input")},defaultTab:function(a){a.somethingSelected()?a.indentSelection("add"):a.replaceSelection("\t","end","input")},transposeChars:function(a){var b=a.getCursor(),c=a.getLine(b.line);0<b.ch&&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,
138
- ch:b.ch+1})},newlineAndIndent:function(a){o(a,function(){a.replaceSelection("\n","end","input");a.indentLine(a.getCursor().line,null,!0)})()},toggleOverwrite:function(a){a.toggleOverwrite()}},O=n.keyMap={};O.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"};
139
- O.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":"delWordBefore","Ctrl-Delete":"delWordAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess",
140
- "Ctrl-]":"indentMore",fallthrough:"basic"};O.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":"delWordBefore","Ctrl-Alt-Backspace":"delWordAfter","Alt-Delete":"delWordAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace",
141
- "Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore",fallthrough:["basic","emacsy"]};O["default"]=fa?O.macDefault:O.pcDefault;O.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine",
142
- "Ctrl-T":"transposeChars"};n.isModifierKey=wc;n.fromTextArea=function(a,b){function c(){a.value=k.getValue()}b||(b={});b.value=a.value;!b.tabindex&&a.tabindex&&(b.tabindex=a.tabindex);if(null==b.autofocus){var d=document.body;try{d=document.activeElement}catch(e){}b.autofocus=d==a||null!=a.getAttribute("autofocus")&&d==document.body}if(a.form){t(a.form,"submit",c);var f=a.form,g=f.submit;try{f.submit=function i(){c();f.submit=g;f.submit();f.submit=i}}catch(h){}}a.style.display="none";var k=n(function(b){a.parentNode.insertBefore(b,
143
- a.nextSibling)},b);k.save=c;k.getTextArea=function(){return a};k.toTextArea=function(){c();a.parentNode.removeChild(k.getWrapperElement());a.style.display="";if(a.form){M(a.form,"submit",c);if(typeof a.form.submit=="function")a.form.submit=g}};return k};Fa.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},
144
- eat:function(a){var b=this.string.charAt(this.pos);if("string"==typeof a?b==a:b&&(a.test?a.test(b):a(b)))return++this.pos,b},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0},backUp:function(a){this.pos-=a},column:function(){return ha(this.string,
145
- this.start,this.tabSize)},indentation:function(){return ha(this.string,null,this.tabSize)},match:function(a,b,c){if("string"==typeof a){if((c?this.string.toLowerCase():this.string).indexOf(c?a.toLowerCase():a,this.pos)==this.pos)return!1!==b&&(this.pos+=a.length),!0}else{if((a=this.string.slice(this.pos).match(a))&&0<a.index)return null;a&&!1!==b&&(this.pos+=a[0].length);return a}},current:function(){return this.string.slice(this.start,this.pos)}};n.StringStream=Fa;Mb.prototype.clear=function(){if(!this.explicitlyCleared){Bb(this.cm);
146
- for(var a=null,b=null,c=0;c<this.lines.length;++c){var d=this.lines[c],e=jb(d.markedSpans,this);null!=e.to&&(b=G(d));for(var f=d,g=d.markedSpans,h=e,k=void 0,j=0;j<g.length;++j)g[j]!=h&&(k||(k=[])).push(g[j]);f.markedSpans=k;null!=e.from?a=G(d):this.collapsed&&!R(d)&&S(d,X(this.cm.display))}null!=a&&U(this.cm,a,b+1);this.lines.length=0;this.explicitlyCleared=!0;this.collapsed&&this.cm.view.cantEdit&&(this.cm.view.cantEdit=!1,Ac(this.cm));Cb(this.cm);ea(this.cm,this,"clear")}};Mb.prototype.find=function(){for(var a,
147
- b,c=0;c<this.lines.length;++c){var d=this.lines[c],e=jb(d.markedSpans,this);if(null!=e.from||null!=e.to)d=G(d),null!=e.from&&(a={line:d,ch:e.from}),null!=e.to&&(b={line:d,ch:e.to})}return"bookmark"==this.type?a:a&&{from:a,to:b}};window.lineIsHidden=R;var Jc={},Nb=/[\t\u0000-\u0019\u200b\u2028\u2029\uFEFF]/g;Ia.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;var g=f;g.parent=null;Gc(g);ea(c,f,"delete")}this.lines.splice(a,
148
- b)},collapse:function(a){a.splice.apply(a,[a.length,0].concat(this.lines))},insertHeight:function(a,b,c){this.height+=c;this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));a=0;for(c=b.length;a<c;++a)b[a].parent=this},iterN:function(a,b,c){for(b=a+b;a<b;++a)if(c(this.lines[a]))return!0}};Ha.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-
149
- 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(0==(b-=g))break;a=0}else a-=f}25>this.size-b&&(a=[],this.collapse(a),this.children=[new Ia(a)],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){for(var c=0,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=
150
- 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&&50<f.lines.length){for(;50<f.lines.length;)a=f.lines.splice(f.lines.length-25,25),a=new Ia(a),f.height-=a.height,this.children.splice(d+1,0,a),a.parent=this;this.maybeSpill()}break}a-=g}},maybeSpill:function(){if(!(10>=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5),b=new Ha(b);if(a.parent){a.size-=b.size;a.height-=b.height;var c=kb(a.parent.children,
151
- a);a.parent.children.splice(c+1,0,b)}else c=new Ha(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10<a.children.length);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){g=Math.min(b,g-a);if(f.iterN(a,g,c))return!0;if(0==(b-=g))break;a=0}else a-=g}}};n.e_stop=Xa;n.e_preventDefault=A;n.e_stopPropagation=Nc;n.on=t;n.off=M;n.signal=ia;var na=30,sc=n.Pass=
152
- {toString:function(){return"CodeMirror.Pass"}};ub.prototype={set:function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)}};n.countColumn=ha;var mb=[""],wd=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc]/,Ab=/[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\uA670-\uA672\uA674-\uA67D\uA69F]/,nd=function(){if(cb)return!1;var a=r("div");return"draggable"in a||
153
- "dragDrop"in a}(),lb=/^$/;V?lb=/$'/:Gb?lb=/\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/:Qc&&(lb=/\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/);var nb,Ob,xa=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)};n.splitLines=xa;var hd=window.getSelection?
154
- 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:0!=b.compareEndPoints("StartToEnd",b)},jc=function(){var a=r("div");if("oncopy"in a)return!0;a.setAttribute("oncopy","return;");return"function"==typeof a.oncopy}(),aa={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",
155
- 36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",91:"Mod",92:"Mod",93:"Mod",109:"-",107:"=",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"};n.keyNames=aa;(function(){for(var a=0;10>a;a++)aa[a+48]=""+a;for(a=65;90>=a;a++)aa[a]=String.fromCharCode(a);for(a=1;12>=a;a++)aa[a+
156
- 111]=aa[a+63235]="F"+a})();var ud=function(){function a(a){return 255>=a?b.charAt(a):1424<=a&&1524>=a?"R":1536<=a&&1791>=a?c.charAt(a-1536):1792<=a&&2220>=a?"r":"L"}var b="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",c="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",
157
- d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,e=/[stwN]/,f=/[LRr]/,g=/[Lb1n]/,h=/[1n]/;return function(b){if(!d.test(b))return!1;for(var c=b.length,i=[],m=null,l=0,p;l<c;++l)if(i.push(p=a(b.charCodeAt(l))),null==m)if("L"==p)m="L";else if("R"==p||"r"==p)m="R";null==m&&(m="L");for(var l=0,n=m;l<c;++l)p=i[l],"m"==p?i[l]=n:n=p;l=0;for(n=m;l<c;++l)p=i[l],"1"==p&&"r"==n?i[l]="n":f.test(p)&&(n=p,"r"==p&&(i[l]="R"));l=1;for(n=i[0];l<c-1;++l){p=i[l];if("+"==p&&"1"==n&&"1"==i[l+1])i[l]="1";else if(","==p&&
158
- n==i[l+1]&&("1"==n||"n"==n))i[l]=n;n=p}for(l=0;l<c;++l)if(p=i[l],","==p)i[l]="N";else if("%"==p){for(n=l+1;n<c&&"%"==i[n];++n);var o=l&&"!"==i[l-1]||n<c-1&&"1"==i[n]?"1":"N";for(p=l;p<n;++p)i[p]=o;l=n-1}l=0;for(n=m;l<c;++l)p=i[l],"L"==n&&"1"==p?i[l]="L":f.test(p)&&(n=p);for(l=0;l<c;++l)if(e.test(i[l])){for(n=l+1;n<c&&e.test(i[n]);++n);p="L"==(n<c-1?i[n]:m);o="L"==(l?i[l-1]:m)||p?"L":"R";for(p=l;p<n;++p)i[p]=o;l=n-1}for(var m=[],q,l=0;l<c;)if(g.test(i[l])){p=l;for(++l;l<c&&g.test(i[l]);++l);m.push({from:p,
159
- to:l,level:0})}else{o=l;n=m.length;for(++l;l<c&&"L"!=i[l];++l);for(p=o;p<l;)if(h.test(i[p])){o<p&&m.splice(n,0,{from:o,to:p,level:1});o=p;for(++p;p<l&&h.test(i[p]);++p);m.splice(n,0,{from:o,to:p,level:2});o=p}else++p;o<l&&m.splice(n,0,{from:o,to:l,level:1})}if(1==m[0].level&&(q=b.match(/^\s+/)))m[0].from=q[0].length,m.unshift({from:0,to:q[0].length,level:0});if(1==I(m).level&&(q=b.match(/\s+$/)))I(m).to-=q[0].length,m.push({from:c-q[0].length,to:c,level:0});m[0].level!=I(m).level&&m.push({from:c,
160
- to:c,level:m[0].level});return m}}();n.version="3.0";return n}();
1
+ window.CodeMirror=function(){function l(a,b){if(!(this instanceof l))return new l(a,b);this.options=b=b||{};for(var c in rb)!b.hasOwnProperty(c)&&rb.hasOwnProperty(c)&&(b[c]=rb[c]);sb(b);c=this.display=Xc(a);c.wrapper.CodeMirror=this;Ub(this);b.autofocus&&!Vb&&E(this);this.view=Yc(new Ia([new Ja([pa("",null,Z(c))])]));this.nextOpId=0;Ka(this);Wb(this);b.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap");this.setValue(b.value||"");M&&setTimeout(L(ca,this,!0),20);this.view.history=tb();
2
+ Zc(this);var d;try{d=document.activeElement==c.input}catch(e){}d||b.autofocus&&!Vb?setTimeout(L($,this),20):ub(this);q(this,function(){for(var a in da)if(da.propertyIsEnumerable(a))da[a](this,b[a],Xb);for(a=0;a<vb.length;++a)vb[a](this)})()}function Xc(a){var b={},c=b.input=n("textarea",null,null,"position: absolute; padding: 0; width: 1px; height: 1em; outline: none;");N?c.style.width="1000px":c.setAttribute("wrap","off");c.setAttribute("autocorrect","off");c.setAttribute("autocapitalize","off");
3
+ b.inputDiv=n("div",[c],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");b.scrollbarH=n("div",[n("div",null,null,"height: 1px")],"CodeMirror-hscrollbar");b.scrollbarV=n("div",[n("div",null,null,"width: 1px")],"CodeMirror-vscrollbar");b.scrollbarFiller=n("div",null,"CodeMirror-scrollbar-filler");b.lineDiv=n("div");b.selectionDiv=n("div",null,null,"position: relative; z-index: 1");b.cursor=n("div"," ","CodeMirror-cursor");b.otherCursor=n("div"," ","CodeMirror-cursor CodeMirror-secondarycursor");
4
+ b.measure=n("div",null,"CodeMirror-measure");b.lineSpace=n("div",[b.measure,b.selectionDiv,b.lineDiv,b.cursor,b.otherCursor],null,"position: relative; outline: none");b.mover=n("div",[n("div",[b.lineSpace],"CodeMirror-lines")],null,"position: relative");b.sizer=n("div",[b.mover],"CodeMirror-sizer");b.heightForcer=n("div"," ",null,"position: absolute; height: "+qa+"px");b.gutters=n("div",null,"CodeMirror-gutters");b.lineGutter=null;var d=n("div",[b.sizer,b.heightForcer,b.gutters],null,"position: relative; min-height: 100%");
5
+ b.scroller=n("div",[d],"CodeMirror-scroll");b.scroller.setAttribute("tabIndex","-1");b.wrapper=n("div",[b.inputDiv,b.scrollbarH,b.scrollbarV,b.scrollbarFiller,b.scroller],"CodeMirror");ea&&(b.gutters.style.zIndex=-1,b.scroller.style.paddingRight=0);a.appendChild?a.appendChild(b.wrapper):a(b.wrapper);La&&(c.style.width="0px");N||(b.scroller.draggable=!0);wb?(b.inputDiv.style.height="1px",b.inputDiv.style.position="absolute"):ea&&(b.scrollbarH.style.minWidth=b.scrollbarV.style.minWidth="18px");b.viewOffset=
6
+ b.showingFrom=b.showingTo=b.lastSizeC=0;b.lineNumWidth=b.lineNumInnerWidth=b.lineNumChars=null;b.prevInput="";b.alignWidgets=!1;b.pollingFast=!1;b.poll=new xb;b.draggingText=!1;b.cachedCharWidth=b.cachedTextHeight=null;b.measureLineCache=[];b.measureLineCachePos=0;b.inaccurateSelection=!1;b.pasteIncoming=!1;b.wheelDX=b.wheelDY=b.wheelStartX=b.wheelStartY=null;return b}function Yc(a){var b={line:0,ch:0};return{doc:a,frontier:0,highlight:new xb,sel:{from:b,to:b,head:b,anchor:b,shift:!1,extend:!1},scrollTop:0,
7
+ scrollLeft:0,overwrite:!1,focused:!1,maxLine:o(a,0),maxLineLength:0,maxLineChanged:!1,suppressEdits:!1,goalColumn:null,cantEdit:!1,keyMaps:[],overlays:[],modeGen:0}}function Ka(a){var b=a.view.doc;a.view.mode=l.getMode(a.options,a.options.mode);b.iter(0,b.size,function(a){a.stateAfter&&(a.stateAfter=null);a.styles&&(a.styles=null)});a.view.frontier=0;Ma(a,100);a.view.modeGen++;a.curOp&&F(a,0,b.size)}function Wb(a){a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+
8
+ a.options.theme.replace(/(^|\s)\s*/g," cm-s-");ra(a)}function sa(a){Ub(a);O(a,!0)}function Ub(a){var b=a.display.gutters,c=a.options.gutters;Na(b);for(var d=0;d<c.length;++d){var e=c[d],f=b.appendChild(n("div",null,"CodeMirror-gutter "+e));"CodeMirror-linenumbers"==e&&(a.display.lineGutter=f,f.style.width=(a.display.lineNumWidth||1)+"px")}b.style.display=d?"":"none"}function Oa(a,b){if(0==b.height)return 0;for(var c=b.text.length,d,e=b;d=ta(e);)d=d.find(),e=o(a,d.from.line),c+=d.from.ch-d.to.ch;for(e=
9
+ b;d=Pa(e);)d=d.find(),c-=e.text.length-d.from.ch,e=o(a,d.to.line),c+=e.text.length-d.to.ch;return c}function Yb(a){a.maxLine=o(a.doc,0);a.maxLineLength=Oa(a.doc,a.maxLine);a.maxLineChanged=!0;a.doc.iter(1,a.doc.size,function(b){var c=Oa(a.doc,b);c>a.maxLineLength&&(a.maxLineLength=c,a.maxLine=b)})}function sb(a){for(var b=!1,c=0;c<a.gutters.length;++c)"CodeMirror-linenumbers"==a.gutters[c]&&(a.lineNumbers?b=!0:a.gutters.splice(c--,1));!b&&a.lineNumbers&&a.gutters.push("CodeMirror-linenumbers")}function Zb(a,
10
+ b){var c=b+2*a.lineSpace.offsetTop;a.sizer.style.minHeight=a.heightForcer.style.top=c+"px";var c=Math.max(c,a.scroller.scrollHeight),d=a.scroller.scrollWidth>a.scroller.clientWidth,e=c>a.scroller.clientHeight;e?(a.scrollbarV.style.display="block",a.scrollbarV.style.bottom=d?Qa(a.measure)+"px":"0",a.scrollbarV.firstChild.style.height=c-a.scroller.clientHeight+a.scrollbarV.clientHeight+"px"):a.scrollbarV.style.display="";d?(a.scrollbarH.style.display="block",a.scrollbarH.style.right=e?Qa(a.measure)+
11
+ "px":"0",a.scrollbarH.firstChild.style.width=a.scroller.scrollWidth-a.scroller.clientWidth+a.scrollbarH.clientWidth+"px"):a.scrollbarH.style.display="";d&&e?(a.scrollbarFiller.style.display="block",a.scrollbarFiller.style.height=a.scrollbarFiller.style.width=Qa(a.measure)+"px"):a.scrollbarFiller.style.display="";$c&&0===Qa(a.measure)&&(a.scrollbarV.style.minWidth=a.scrollbarH.style.minHeight=ad?"18px":"12px")}function yb(a,b,c){var d=a.scroller.scrollTop,e=a.wrapper.clientHeight;"number"==typeof c?
12
+ d=c:c&&(d=c.top,e=c.bottom-c.top);d=Math.floor(d-a.lineSpace.offsetTop);a=Math.ceil(d+e);return{from:Ra(b,d),to:Ra(b,a)}}function bd(a){if(!a.options.lineNumbers)return!1;var b=""+a.options.lineNumberFormatter(a.view.doc.size-1+a.options.firstLineNumber),a=a.display;if(b.length!=a.lineNumChars){var c=a.measure.appendChild(n("div",[n("div",b)],"CodeMirror-linenumber CodeMirror-gutter-elt")),d=c.firstChild.offsetWidth,c=c.offsetWidth-d;a.lineGutter.style.width="";a.lineNumInnerWidth=Math.max(d,a.lineGutter.offsetWidth-
13
+ c);a.lineNumWidth=a.lineNumInnerWidth+c;a.lineNumChars=a.lineNumInnerWidth?b.length:-1;a.lineGutter.style.width=a.lineNumWidth+"px";return!0}return!1}function zb(a){return a.scroller.getBoundingClientRect().left-a.sizer.getBoundingClientRect().left}function O(a,b,c){var d=a.display.showingFrom,e=a.display.showingTo;if(b=$b(a,b,c))fa(a,a,"update",a),(a.display.showingFrom!=d||a.display.showingTo!=e)&&fa(a,a,"viewportChange",a,a.display.showingFrom,a.display.showingTo);Ab(a);Zb(a.display,a.view.doc.height);
14
+ return b}function $b(a,b,c){var d=a.display,e=a.view.doc;if(d.wrapper.clientWidth){var f=yb(d,e,c);if(!(!0!==b&&0==b.length&&f.from>d.showingFrom&&f.to<d.showingTo)){b&&bd(a)&&(b=!0);var g=d.sizer.style.marginLeft=d.gutters.offsetWidth+"px";d.scrollbarH.style.left=a.options.fixedGutter?g:"0";if(!0!==b&&ua)for(var h=0;h<b.length;++h)for(var m=b[h];g=ta(o(e,m.from));)g=g.find().from.line,m.diff&&(m.diff-=m.from-g),m.from=g;m=!0===b?0:Infinity;if(a.options.lineNumbers&&b&&!0!==b)for(h=0;h<b.length;++h)if(b[h].diff){m=
15
+ b[h].from;break}g=Math.max(f.from-a.options.viewportMargin,0);f=Math.min(e.size,f.to+a.options.viewportMargin);d.showingFrom<g&&20>g-d.showingFrom&&(g=d.showingFrom);d.showingTo>f&&20>d.showingTo-f&&(f=Math.min(e.size,d.showingTo));if(ua)for(g=G(ga(e,o(e,g)));f<e.size&&U(o(e,f));)++f;for(var b=!0===b?[]:cd([{from:d.showingFrom,to:d.showingTo}],b),j=0,h=0;h<b.length;++h){var i=b[h];i.from<g&&(i.from=g);i.to>f&&(i.to=f);i.from>=i.to?b.splice(h--,1):j+=i.to-i.from}if(!(j==f-g&&g==d.showingFrom&&f==d.showingTo)){b.sort(function(a,
16
+ b){return a.from-b.from});h=document.activeElement;j<0.7*(f-g)&&(d.lineDiv.style.display="none");dd(a,g,f,b,m);d.lineDiv.style.display="";document.activeElement!=h&&h.offsetHeight&&h.focus();if(g!=d.showingFrom||f!=d.showingTo||d.lastSizeC!=d.wrapper.clientHeight)d.lastSizeC=d.wrapper.clientHeight;d.showingFrom=g;d.showingTo=f;Ma(a,100);m=d.lineDiv.offsetTop;for(b=d.lineDiv.firstChild;b;b=b.nextSibling)if(b.lineObj&&(ea?(j=b.offsetTop+b.offsetHeight,h=j-m,m=j):(h=b.getBoundingClientRect(),h=h.bottom-
17
+ h.top),j=b.lineObj.height-h,2>h&&(h=Z(d)),0.001<j||-0.001>j))if(I(b.lineObj,h),j=b.lineObj.widgets)for(h=0;h<j.length;++h)j[h].height=j[h].node.offsetHeight;d.viewOffset=ha(a,o(e,g));d.mover.style.top=d.viewOffset+"px";yb(d,e,c).to>=f&&$b(a,[],c);return!0}}}else d.showingFrom=d.showingTo=d.viewOffset=0}function cd(a,b){for(var c=0,d=b.length||0;c<d;++c){for(var e=b[c],f=[],g=e.diff||0,h=0,m=a.length;h<m;++h){var j=a[h];e.to<=j.from&&e.diff?f.push({from:j.from+g,to:j.to+g}):e.to<=j.from||e.from>=j.to?
18
+ f.push(j):(e.from>j.from&&f.push({from:j.from,to:e.from}),e.to<j.to&&f.push({from:e.to+g,to:j.to+g}))}a=f}return a}function ed(a){for(var b=a.display,c={},d={},e=b.gutters.firstChild,f=0;e;e=e.nextSibling,++f)c[a.options.gutters[f]]=e.offsetLeft,d[a.options.gutters[f]]=e.offsetWidth;return{fixedPos:zb(b),gutterTotalWidth:b.gutters.offsetWidth,gutterLeft:c,gutterWidth:d,wrapperWidth:b.wrapper.clientWidth}}function dd(a,b,c,d,e){function f(b){var c=b.nextSibling;N&&ia&&a.display.currentWheelTarget==
19
+ b?(b.style.display="none",b.lineObj=null):b.parentNode.removeChild(b);return c}var g=ed(a),h=a.display,m=a.options.lineNumbers;!d.length&&(!N||!a.display.currentWheelTarget)&&Na(h.lineDiv);var j=h.lineDiv,i=j.firstChild,k=d.shift(),r=b;for(a.view.doc.iter(b,c,function(b){k&&k.to==r&&(k=d.shift());if(U(b)){if(0!=b.height&&I(b,0),b.widgets&&i.previousSibling)for(var c=0;c<b.widgets.length;++c)if(b.widgets[c].showIfHidden){var h=i.previousSibling;if("pre"==h.nodeType){var A=n("div",null,null,"position: relative");
20
+ h.parentNode.replaceChild(A,h);A.appendChild(h);h=A}h.appendChild(ac(b.widgets[c],h,g))}}else if(k&&k.from<=r&&k.to>r){for(;i.lineObj!=b;)i=f(i);m&&(e<=r&&i.lineNumber)&&bc(i.lineNumber,""+a.options.lineNumberFormatter(r+a.options.firstLineNumber));i=i.nextSibling}else{var c=a,v=r,h=cc(c,b),l=b.gutterMarkers,o=c.display;if(!c.options.lineNumbers&&!l&&!b.bgClass&&!b.wrapClass&&(!b.widgets||!b.widgets.length))c=h;else{A=n("div",null,b.wrapClass,"position: relative");if(c.options.lineNumbers||l){var Sa=
21
+ A.appendChild(n("div",null,null,"position: absolute; left: "+(c.options.fixedGutter?g.fixedPos:-g.gutterTotalWidth)+"px"));c.options.fixedGutter&&(A.alignable=[Sa]);if(c.options.lineNumbers&&(!l||!l["CodeMirror-linenumbers"]))A.lineNumber=Sa.appendChild(n("div",""+c.options.lineNumberFormatter(v+c.options.firstLineNumber),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+g.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+o.lineNumInnerWidth+"px"));if(l)for(v=0;v<c.options.gutters.length;++v){var o=
22
+ c.options.gutters[v],q=l.hasOwnProperty(o)&&l[o];q&&Sa.appendChild(n("div",[q],"CodeMirror-gutter-elt","left: "+g.gutterLeft[o]+"px; width: "+g.gutterWidth[o]+"px"))}}b.bgClass&&A.appendChild(n("div"," ",b.bgClass+" CodeMirror-linebackground"));A.appendChild(h);if(b.widgets){l=0;for(v=b.widgets;l<v.length;++l)o=v[l],q=ac(o,A,g),o.above?A.insertBefore(q,c.options.lineNumbers&&0!=b.height?Sa:h):A.appendChild(q)}ea&&(A.style.zIndex=2);c=A}j.insertBefore(c,i);c.lineObj=b}++r});i;)i=f(i)}function ac(a,
23
+ b,c){var d=n("div",[a.node],"CodeMirror-linewidget");d.widget=a;a.noHScroll&&((b.alignable||(b.alignable=[])).push(d),b=c.wrapperWidth,d.style.left=c.fixedPos+"px",a.coverGutter||(b-=c.gutterTotalWidth,d.style.paddingLeft=c.gutterTotalWidth+"px"),d.style.width=b+"px");a.coverGutter&&(d.style.zIndex=5,d.style.position="relative",a.noHScroll||(d.style.marginLeft=-c.gutterTotalWidth+"px"));return d}function Ab(a){var b=a.display,c=u(a.view.sel.from,a.view.sel.to);if(c||a.options.showCursorWhenSelecting){var d=
24
+ a.display,e=V(a,a.view.sel.head,"div");d.cursor.style.left=e.left+"px";d.cursor.style.top=e.top+"px";d.cursor.style.height=Math.max(0,e.bottom-e.top)*a.options.cursorHeight+"px";d.cursor.style.display="";e.other?(d.otherCursor.style.display="",d.otherCursor.style.left=e.other.left+"px",d.otherCursor.style.top=e.other.top+"px",d.otherCursor.style.height=0.85*(e.other.bottom-e.other.top)+"px"):d.otherCursor.style.display="none"}else b.cursor.style.display=b.otherCursor.style.display="none";c?b.selectionDiv.style.display=
25
+ "none":fd(a);a=V(a,a.view.sel.head,"div");c=b.wrapper.getBoundingClientRect();d=b.lineDiv.getBoundingClientRect();b.inputDiv.style.top=Math.max(0,Math.min(b.wrapper.clientHeight-10,a.top+d.top-c.top))+"px";b.inputDiv.style.left=Math.max(0,Math.min(b.wrapper.clientWidth-10,a.left+d.left-c.left))+"px"}function fd(a){function b(a,b,c,d){0>b&&(b=0);g.appendChild(n("div",null,"CodeMirror-selected","position: absolute; left: "+a+"px; top: "+b+"px; width: "+(null==c?h-a:c)+"px; height: "+(d-b)+"px"))}function c(c,
26
+ d,f,g){var j=o(e,c),i=j.text.length,k=g?Infinity:-Infinity;gd(P(j),d||0,null==f?i:f,function(e,r,l){var o=Ta(a,{line:c,ch:"rtl"==l?r-1:e},"div",j),l=Ta(a,{line:c,ch:"rtl"==l?e:r-1},"div",j),n=o.left,q=l.right;3<l.top-o.top&&(b(n,o.top,null,o.bottom),n=m,o.bottom<l.top&&b(n,o.bottom,null,l.top));null==f&&r==i&&(q=h);null==d&&0==e&&(n=m);k=g?Math.min(l.top,k):Math.max(l.bottom,k);n<m+1&&(n=m);b(n,l.top,q-n,l.bottom)});return k}var d=a.display,e=a.view.doc,f=a.view.sel,g=document.createDocumentFragment(),
27
+ h=d.lineSpace.offsetWidth,m=ec(a.display);if(f.from.line==f.to.line)c(f.from.line,f.from.ch,f.to.ch);else{for(var j=o(e,f.from.line),i=j,k=[f.from.line,f.from.ch],r;i=Pa(i);){i=i.find();k.push(i.from.ch,i.to.line,i.to.ch);if(i.to.line==f.to.line){k.push(f.to.ch);r=!0;break}i=o(e,i.to.line)}if(r)for(f=0;f<k.length;f+=3)c(k[f],k[f+1],k[f+2]);else k=o(e,f.to.line),j=f.from.ch?c(f.from.line,f.from.ch,null,!1):ha(a,j)-d.viewOffset,f=f.to.ch?c(f.to.line,ta(k)?null:0,f.to.ch,!0):ha(a,k)-d.viewOffset,j<f&&
28
+ b(m,j,null,f)}W(d.selectionDiv,g);d.selectionDiv.style.display=""}function Ua(a){var b=a.display;clearInterval(b.blinker);var c=!0;b.cursor.style.visibility=b.otherCursor.style.visibility="";b.blinker=setInterval(function(){b.cursor.offsetHeight&&(b.cursor.style.visibility=b.otherCursor.style.visibility=(c=!c)?"":"hidden")},a.options.cursorBlinkRate)}function Ma(a,b){a.view.mode.startState&&a.view.frontier<a.display.showingTo&&a.view.highlight.set(b,L(hd,a))}function hd(a){var b=a.view,c=b.doc;if(!(b.frontier>=
29
+ a.display.showingTo)){var d=+new Date+a.options.workTime,e=ja(b.mode,va(a,b.frontier)),f=[],g;c.iter(b.frontier,Math.min(c.size,a.display.showingTo+500),function(c){if(b.frontier>=a.display.showingFrom){var m=c.styles;c.styles=fc(a,c,e);for(var j=!m||m.length!=c.styles.length,i=0;!j&&i<m.length;++i)j=m[i]!=c.styles[i];j&&(g&&g.end==b.frontier?g.end++:f.push(g={start:b.frontier,end:b.frontier+1}));c.stateAfter=ja(b.mode,e)}else gc(a,c,e),c.stateAfter=0==b.frontier%5?ja(b.mode,e):null;++b.frontier;
30
+ if(+new Date>d)return Ma(a,a.options.workDelay),!0});f.length&&q(a,function(){for(var a=0;a<f.length;++a)F(this,f[a].start,f[a].end)})()}}function id(a,b){for(var c,d,e=a.view.doc,f=b,g=b-100;f>g;--f){if(0==f)return 0;var h=o(e,f-1);if(h.stateAfter)return f;h=ka(h.text,null,a.options.tabSize);if(null==d||c>h)d=f-1,c=h}return d}function va(a,b){var c=a.view;if(!c.mode.startState)return!0;var d=id(a,b),e=d&&o(c.doc,d-1).stateAfter,e=e?ja(c.mode,e):hc(c.mode);c.doc.iter(d,b,function(f){gc(a,f,e);f.stateAfter=
31
+ d==b-1||0==d%5||d>=c.showingFrom&&d<c.showingTo?ja(c.mode,e):null;++d});return e}function ec(a){return W(a.measure,n("pre")).appendChild(n("span","x")).offsetLeft}function Bb(a,b,c,d){for(var e=-1,d=d||Cb(a,b),a=c;;a+=e){var f=d[a];if(f)break;0>e&&0==a&&(e=1)}return{left:a<c?f.right:f.left,right:a>c?f.left:f.right,top:f.top,bottom:f.bottom}}function Cb(a,b){for(var c=a.display,d=a.display.measureLineCache,e=0;e<d.length;++e){var f=d[e];if(f.text==b.text&&f.markedSpans==b.markedSpans&&c.scroller.clientWidth==
32
+ f.width)return f.measure}var g=a.display,e=ic(b.text.length),h=cc(a,b,e);if(M&&!ea&&!a.options.lineWrapping&&100<h.childNodes.length){for(var m=document.createDocumentFragment(),j=h.childNodes.length,f=0,i=Math.ceil(j/10);f<i;++f){for(var k=n("div",null,null,"display: inline-block"),r=0;10>r&&j;++r)k.appendChild(h.firstChild),--j;m.appendChild(k)}h.appendChild(m)}W(g.measure,h);j=g.lineDiv.getBoundingClientRect();m=[];g=ic(b.text.length);h=h.offsetHeight;for(f=0;f<e.length;++f)if(r=e[f]){for(var i=
33
+ r.getBoundingClientRect(),k=Math.max(0,i.top-j.top),p=Math.min(i.bottom-j.top,h),r=0;r<m.length;r+=2){var l=m[r],o=m[r+1];if(!(l>p||o<k))if(l<=k&&o>=p||k<=l&&p>=o||Math.min(p,o)-Math.max(k,l)>=p-k>>1){m[r]=Math.min(k,l);m[r+1]=Math.max(p,o);break}}r==m.length&&m.push(k,p);g[f]={left:i.left-j.left,right:i.right-j.left,top:r}}for(f=0;f<g.length;++f)if(r=g[f])e=r.top,r.top=m[e],r.bottom=m[e+1];f={text:b.text,width:c.scroller.clientWidth,markedSpans:b.markedSpans,measure:g};16==d.length?d[++c.measureLineCachePos%
34
+ 16]=f:d.push(f);return g}function ra(a){a.display.measureLineCache.length=a.display.measureLineCachePos=0;a.display.cachedCharWidth=a.display.cachedTextHeight=null;a.view.maxLineChanged=!0}function jc(a,b,c,d){if(b.widgets)for(var e=0;e<b.widgets.length;++e)if(b.widgets[e].above){var f=Va(b.widgets[e]);c.top+=f;c.bottom+=f}if("line"==d)return c;d||(d="local");b=ha(a,b);"local"!=d&&(b-=a.display.viewOffset);"page"==d&&(a=a.display.lineSpace.getBoundingClientRect(),b+=a.top+(window.pageYOffset||(document.documentElement||
35
+ document.body).scrollTop),a=a.left+(window.pageXOffset||(document.documentElement||document.body).scrollLeft),c.left+=a,c.right+=a);c.top+=b;c.bottom+=b;return c}function Ta(a,b,c,d){d||(d=o(a.view.doc,b.line));return jc(a,d,Bb(a,d,b.ch),c)}function V(a,b,c,d,e){function f(b,f){var g=Bb(a,d,b,e);f?g.left=g.right:g.right=g.left;return jc(a,d,g,c)}d=d||o(a.view.doc,b.line);e||(e=Cb(a,d));var g=P(d),b=b.ch;if(!g)return f(b);for(var h,m,j=g[0].level,i=0;i<g.length;++i){var k=g[i],r=k.level%2,p;if(k.from<
36
+ b&&k.to>b)return f(b,r);var l=r?k.from:k.to;if((r?k.to:k.from)==b)k=i&&k.level<(p=g[i-1]).level?f(p.level%2?p.from:p.to-1,!0):f(r&&k.from!=k.to?b-1:b),r==j?h=k:m=k;else if(l==b&&(p=i<g.length-1&&g[i+1],r||!(p&&p.from==p.to)))k=p&&k.level<p.level?f(p.level%2?p.to-1:p.from):f(r?b:b-1,!0),r==j?h=k:m=k}j&&!b&&(m=f(g[0].to-1));if(!h)return m;m&&(h.other=m);return h}function Db(a,b,c){var d=a.view.doc,c=c+a.display.viewOffset;if(0>c)return{line:0,ch:0,outside:!0};var e=Ra(d,c);if(e>=d.size)return{line:d.size-
37
+ 1,ch:o(d,d.size-1).text.length};for(0>b&&(b=0);;){var f=o(d,e),e=jd(a,f,e,b,c),g=(f=Pa(f))&&f.find();if(f&&e.ch>=g.from.ch)e=g.to.line;else return e}}function jd(a,b,c,d,e){function f(d){d=V(a,{line:c,ch:d},"line",b,j);h=!0;if(g>d.bottom)return Math.max(0,d.left-m);if(g<d.top)return d.left+m;h=!1;return d.left}var g=e-ha(a,b),h=!1,m=a.display.wrapper.clientWidth,j=Cb(a,b),i=P(b),k=b.text.length,e=Wa(b),r=Xa(b),p=ec(a.display),l=f(r);if(d>l)return{line:c,ch:r,outside:h};for(;;){if(i?r==e||r==Eb(b,
38
+ e,1):1>=r-e){for(e=(d=d-p<l-d)?e:r;Fb.test(b.text.charAt(e));)++e;return{line:c,ch:e,after:d,outside:h}}var o=Math.ceil(k/2),n=e+o;if(i)for(var n=e,q=0;q<o;++q)n=Eb(b,n,1);q=f(n);q>d?(r=n,l=q,h&&(l+=1E3),k-=o):(e=n,p=q,k=o)}}function Z(a){if(null!=a.cachedTextHeight)return a.cachedTextHeight;if(null==aa){aa=n("pre");for(var b=0;49>b;++b)aa.appendChild(document.createTextNode("x")),aa.appendChild(n("br"));aa.appendChild(document.createTextNode("x"))}W(a.measure,aa);b=aa.offsetHeight/50;3<b&&(a.cachedTextHeight=
39
+ b);Na(a.measure);return b||1}function kc(a){if(null!=a.cachedCharWidth)return a.cachedCharWidth;var b=n("span","x"),c=n("pre",[b]);W(a.measure,c);b=b.offsetWidth;2<b&&(a.cachedCharWidth=b);return b||10}function Ya(a){a.curOp?++a.curOp.depth:a.curOp={depth:1,changes:[],delayedCallbacks:[],updateInput:null,userSelChange:null,textChanged:null,selectionChanged:!1,updateMaxLine:!1,id:++a.nextOpId}}function Za(a){var b=a.curOp;if(!--b.depth){a.curOp=null;var c=a.view,d=a.display;b.updateMaxLine&&Yb(c);
40
+ if(c.maxLineChanged&&!a.options.lineWrapping){var e=Bb(a,c.maxLine,c.maxLine.text.length).right;d.sizer.style.minWidth=e+3+qa+"px";c.maxLineChanged=!1;e=Math.max(0,d.sizer.offsetLeft+d.sizer.offsetWidth-d.scroller.clientWidth);e<c.scrollLeft&&la(a,Math.min(d.scroller.scrollLeft,e),!0)}var f,g;b.selectionChanged&&(d=V(a,c.sel.head),f=Gb(a,d.left,d.top,d.left,d.bottom));if(b.changes.length||f&&null!=f.scrollTop)g=O(a,b.changes,f&&f.scrollTop);!g&&b.selectionChanged&&Ab(a);if(f&&(d=a.view,g=lc(a,d.sel.head),
41
+ d.focused)){d=a.display;e=d.sizer.getBoundingClientRect();f=null;if(0>g.top+e.top)f=!0;else if(g.bottom+e.top>(window.innerHeight||document.documentElement.clientHeight))f=!1;if(null!=f&&!kd){if(e="none"==d.cursor.style.display)d.cursor.style.display="",d.cursor.style.left=g.left+"px",d.cursor.style.top=g.top-d.viewOffset+"px";d.cursor.scrollIntoView(f);e&&(d.cursor.style.display="none")}}b.selectionChanged&&Ua(a);c.focused&&b.updateInput&&ca(a,b.userSelChange);b.textChanged&&ma(a,"change",a,b.textChanged);
42
+ b.selectionChanged&&ma(a,"cursorActivity",a);for(c=0;c<b.delayedCallbacks.length;++c)b.delayedCallbacks[c](a)}}function q(a,b){return function(){var c=a||this;Ya(c);try{var d=b.apply(c,arguments)}finally{Za(c)}return d}}function F(a,b,c,d){a.curOp.changes.push({from:b,to:c,diff:d})}function $a(a){a.view.pollingFast||a.display.poll.set(a.options.pollInterval,function(){Hb(a);a.view.focused&&$a(a)})}function wa(a){function b(){!Hb(a)&&!c?(c=!0,a.display.poll.set(60,b)):(a.display.pollingFast=!1,$a(a))}
43
+ var c=!1;a.display.pollingFast=!0;a.display.poll.set(20,b)}function Hb(a){var b=a.display.input,c=a.display.prevInput,d=a.view,e=d.sel;if(!d.focused||ld(b)||xa(a))return!1;var f=b.value;if(f==c&&u(e.from,e.to))return!1;Ya(a);d.sel.shift=!1;for(var g=0,h=Math.min(c.length,f.length);g<h&&c[g]==f[g];)++g;h=e.from;e=e.to;g<c.length?h={line:h.line,ch:h.ch-(c.length-g)}:d.overwrite&&(u(h,e)&&!a.display.pasteIncoming)&&(e={line:e.line,ch:Math.min(o(a.view.doc,e.line).text.length,e.ch+(f.length-g))});c=a.curOp.updateInput;
44
+ Ib(a,h,e,ya(f.slice(g)),"end",a.display.pasteIncoming?"paste":"input",{from:h,to:e});a.curOp.updateInput=c;1E3<f.length?b.value=a.display.prevInput="":a.display.prevInput=f;Za(a);a.display.pasteIncoming=!1;return!0}function ca(a,b){var c=a.view,d,e;u(c.sel.from,c.sel.to)?b&&(a.display.prevInput=a.display.input.value=""):(a.display.prevInput="",d=mc&&(100<c.sel.to.line-c.sel.from.line||1E3<(e=a.getSelection()).length),a.display.input.value=d?"-":e||a.getSelection(),c.focused&&nc(a.display.input));
45
+ a.display.inaccurateSelection=d}function E(a){"nocursor"!=a.options.readOnly&&(M||document.activeElement!=a.display.input)&&a.display.input.focus()}function xa(a){return a.options.readOnly||a.view.cantEdit}function Zc(a){function b(){a.view.focused&&setTimeout(L(E,a),0)}function c(){f.cachedCharWidth=f.cachedTextHeight=null;ra(a);O(a,!0)}function d(b){(!a.options.onDragEvent||!a.options.onDragEvent(a,za(b)))&&ab(b)}function e(){f.inaccurateSelection&&(f.prevInput="",f.inaccurateSelection=!1,f.input.value=
46
+ a.getSelection(),nc(f.input))}var f=a.display;s(f.scroller,"mousedown",q(a,md));s(f.scroller,"dblclick",q(a,z));s(f.lineSpace,"selectstart",function(a){na(f,a)||z(a)});X||s(f.scroller,"contextmenu",function(b){oc(a,b)});s(f.scroller,"scroll",function(){Aa(a,f.scroller.scrollTop);la(a,f.scroller.scrollLeft,!0);ma(a,"scroll",a)});s(f.scrollbarV,"scroll",function(){Aa(a,f.scrollbarV.scrollTop)});s(f.scrollbarH,"scroll",function(){la(a,f.scrollbarH.scrollLeft)});s(f.scroller,"mousewheel",function(b){pc(a,
47
+ b)});s(f.scroller,"DOMMouseScroll",function(b){pc(a,b)});s(f.scrollbarH,"mousedown",b);s(f.scrollbarV,"mousedown",b);s(f.wrapper,"scroll",function(){f.wrapper.scrollTop=f.wrapper.scrollLeft=0});window.registered||(window.registered=0);++window.registered;s(window,"resize",c);setTimeout(function h(){for(var a=f.wrapper.parentNode;a&&a!=document.body;a=a.parentNode);if(a)setTimeout(h,5E3);else{--window.registered;Q(window,"resize",c)}},5E3);s(f.input,"keyup",q(a,function(b){if((!a.options.onKeyEvent||
48
+ !a.options.onKeyEvent(a,za(b)))&&C(b,"keyCode")==16)a.view.sel.shift=false}));s(f.input,"input",L(wa,a));s(f.input,"keydown",q(a,qc));s(f.input,"keypress",q(a,nd));s(f.input,"focus",L($,a));s(f.input,"blur",L(ub,a));a.options.dragDrop&&(s(f.scroller,"dragstart",function(b){var c=a;if(!na(c.display,b)){var d=c.getSelection();b.dataTransfer.setData("Text",d);if(b.dataTransfer.setDragImage&&!Jb){d=n("img",null,null,"position: fixed; left: 0; top: 0;");if(R){d.width=d.height=1;c.display.wrapper.appendChild(d);
49
+ d._top=d.offsetTop}b.dataTransfer.setDragImage(d,0,0);R&&d.parentNode.removeChild(d)}}}),s(f.scroller,"dragenter",d),s(f.scroller,"dragover",d),s(f.scroller,"drop",q(a,od)));s(f.scroller,"paste",function(b){if(!na(f,b)){E(a);wa(a)}});s(f.input,"paste",function(){f.pasteIncoming=true;wa(a)});s(f.input,"cut",e);s(f.input,"copy",e);wb&&s(f.sizer,"mouseup",function(){document.activeElement==f.input&&f.input.blur();E(a)})}function na(a,b){for(var c=b.target||b.srcElement;c!=a.wrapper;c=c.parentNode)if(!c||
50
+ /\bCodeMirror-(?:line)?widget\b/.test(c.className)||c.parentNode==a.sizer&&c!=a.mover)return!0}function Ba(a,b,c){var d=a.display;if(!c&&(c=b.target||b.srcElement,c==d.scrollbarH||c==d.scrollbarH.firstChild||c==d.scrollbarV||c==d.scrollbarV.firstChild||c==d.scrollbarFiller))return null;var e,f,d=d.lineSpace.getBoundingClientRect();try{e=b.clientX,f=b.clientY}catch(g){return null}return Db(a,e-d.left,f-d.top)}function md(a){function b(a){if("single"==k)y(e,w(m,j),a);else if(l=w(m,l),n=w(m,n),"double"==
51
+ k){var b=rc(o(m,a.line).text,a);x(a,l)?y(e,b.from,n):y(e,l,b.to)}else"triple"==k&&(x(a,l)?y(e,n,w(m,{line:a.line,ch:0})):y(e,l,w(m,{line:a.line+1,ch:0})))}function c(a){var d=++v,h=Ba(e,a,!0);if(h)if(u(h,r)){var i=a.clientY<A.top?-20:a.clientY>A.bottom?20:0;i&&setTimeout(q(e,function(){v==d&&(f.scroller.scrollTop+=i,c(a))}),50)}else{g.focused||$(e);r=h;b(h);var j=yb(f,m);(h.line>=j.to||h.line<j.from)&&setTimeout(q(e,function(){v==d&&c(a)}),150)}}function d(a){v=Infinity;var c=Ba(e,a);c&&b(c);z(a);
52
+ E(e);Q(document,"mousemove",t);Q(document,"mouseup",dc)}var e=this,f=e.display,g=e.view,h=g.sel,m=g.doc;h.shift=C(a,"shiftKey");if(na(f,a))N||(f.scroller.draggable=!1,setTimeout(function(){f.scroller.draggable=!0},100));else if(!pd(e,a)){var j=Ba(e,a);switch(sc(a)){case 3:X&&oc.call(e,e,a);return;case 2:j&&y(e,j);setTimeout(L(E,e),20);z(a);return}if(j){g.focused||$(e);var i=+new Date,k="single";bb&&bb.time>i-400&&u(bb.pos,j)?(k="triple",z(a),setTimeout(L(E,e),20),qd(e,j.line)):cb&&cb.time>i-400&&
53
+ u(cb.pos,j)?(k="double",bb={time:i,pos:j},z(a),i=rc(o(m,j.line).text,j),y(e,i.from,i.to)):cb={time:i,pos:j};var r=j;if(e.options.dragDrop&&rd&&!xa(e)&&!u(h.from,h.to)&&!x(j,h.from)&&!x(h.to,j)&&"single"==k){var p=q(e,function(b){if(N)f.scroller.draggable=false;g.draggingText=false;Q(document,"mouseup",p);Q(f.scroller,"drop",p);if(Math.abs(a.clientX-b.clientX)+Math.abs(a.clientY-b.clientY)<10){z(b);y(e,j);E(e)}});N&&(f.scroller.draggable=!0);g.draggingText=p;f.scroller.dragDrop&&f.scroller.dragDrop();
54
+ s(document,"mouseup",p);s(f.scroller,"drop",p)}else{z(a);"single"==k&&y(e,w(m,j));var l=h.from,n=h.to,A=f.wrapper.getBoundingClientRect(),v=0,t=q(e,function(a){!M&&!sc(a)?d(a):c(a)}),dc=q(e,d);s(document,"mousemove",t);s(document,"mouseup",dc)}}else(a.target||a.srcElement)==f.scroller&&z(a)}}function od(a){var b=this;if(!(na(b.display,a)||b.options.onDragEvent&&b.options.onDragEvent(b,za(a)))){z(a);var c=Ba(b,a,!0),d=a.dataTransfer.files;if(c&&!xa(b))if(d&&d.length&&window.FileReader&&window.File)for(var e=
55
+ d.length,f=Array(e),g=0,a=function(a,d){var h=new FileReader;h.onload=function(){f[d]=h.result;++g==e&&(c=w(b.view.doc,c),q(b,function(){var a=Y(b,f.join(""),c,c,"paste");S(b,c,a)})())};h.readAsText(a)},h=0;h<e;++h)a(d[h],h);else if(b.view.draggingText&&!x(c,b.view.sel.from)&&!x(b.view.sel.to,c))b.view.draggingText(a),setTimeout(L(E,b),20);else try{if(f=a.dataTransfer.getData("Text")){var h=b.view.sel.from,m=b.view.sel.to;S(b,c,c);b.view.draggingText&&Y(b,"",h,m,"paste");b.replaceSelection(f,null,
56
+ "paste");E(b);$(b)}}catch(j){}}}function pd(a,b){var c=a.display;try{var d=b.clientX,e=b.clientY}catch(f){return!1}if(d>=Math.floor(c.gutters.getBoundingClientRect().right))return!1;z(b);if(!tc(a,"gutterClick"))return!0;var g=c.lineDiv.getBoundingClientRect();if(e>g.bottom)return!0;e-=g.top-c.viewOffset;for(g=0;g<a.options.gutters.length;++g){var h=c.gutters.childNodes[g];if(h&&h.getBoundingClientRect().right>=d){c=Ra(a.view.doc,e);fa(a,a,"gutterClick",a,c,a.options.gutters[g],b);break}}return!0}
57
+ function Aa(a,b){2>Math.abs(a.view.scrollTop-b)||(a.view.scrollTop=b,X||O(a,[],b),a.display.scroller.scrollTop!=b&&(a.display.scroller.scrollTop=b),a.display.scrollbarV.scrollTop!=b&&(a.display.scrollbarV.scrollTop=b),X&&O(a,[]))}function la(a,b,c){if(!(c?b==a.view.scrollLeft:2>Math.abs(a.view.scrollLeft-b))){b=Math.min(b,a.display.scroller.scrollWidth-a.display.scroller.clientWidth);a.view.scrollLeft=b;c=a.display;if(c.alignWidgets||c.gutters.firstChild&&a.options.fixedGutter){for(var d=zb(c)-c.scroller.scrollLeft+
58
+ a.view.scrollLeft,e=c.gutters.offsetWidth,f=d+"px",g=c.lineDiv.firstChild;g;g=g.nextSibling)if(g.alignable)for(var h=0,m=g.alignable;h<m.length;++h)m[h].style.left=f;a.options.fixedGutter&&(c.gutters.style.left=d+e+"px")}a.display.scroller.scrollLeft!=b&&(a.display.scroller.scrollLeft=b);a.display.scrollbarH.scrollLeft!=b&&(a.display.scrollbarH.scrollLeft=b)}}function pc(a,b){var c=b.wheelDeltaX,d=b.wheelDeltaY;null==c&&(b.detail&&b.axis==b.HORIZONTAL_AXIS)&&(c=b.detail);null==d&&b.detail&&b.axis==
59
+ b.VERTICAL_AXIS?d=b.detail:null==d&&(d=b.wheelDelta);if(d&&ia&&N)for(var e=b.target;e!=g;e=e.parentNode)if(e.lineObj){a.display.currentWheelTarget=e;break}var f=a.display,g=f.scroller;if(c&&!X&&!R&&null!=J)d&&Aa(a,Math.max(0,Math.min(g.scrollTop+d*J,g.scrollHeight-g.clientHeight))),la(a,Math.max(0,Math.min(g.scrollLeft+c*J,g.scrollWidth-g.clientWidth))),z(b),f.wheelStartX=null;else{if(d&&null!=J){var e=d*J,h=a.view.scrollTop,m=h+f.wrapper.clientHeight;0>e?h=Math.max(0,h+e-50):m=Math.min(a.view.doc.height,
60
+ m+e+50);O(a,[],{top:h,bottom:m})}20>db&&(null==f.wheelStartX?(f.wheelStartX=g.scrollLeft,f.wheelStartY=g.scrollTop,f.wheelDX=c,f.wheelDY=d,setTimeout(function(){if(f.wheelStartX!=null){var a=g.scrollLeft-f.wheelStartX,b=g.scrollTop-f.wheelStartY,a=b&&f.wheelDY&&b/f.wheelDY||a&&f.wheelDX&&a/f.wheelDX;f.wheelStartX=f.wheelStartY=null;if(a){J=(J*db+a)/(db+1);++db}}},200)):(f.wheelDX+=c,f.wheelDY+=d))}}function eb(a,b,c){if("string"==typeof b&&(b=Kb[b],!b))return!1;a.display.pollingFast&&Hb(a)&&(a.display.pollingFast=
61
+ !1);var d=a.view,e=d.sel.shift;try{xa(a)&&(d.suppressEdits=!0),c&&(d.sel.shift=!1),b(a)}catch(f){if(f!=uc)throw f;return!1}finally{d.sel.shift=e,d.suppressEdits=!1}return!0}function vc(a){var b=a.view.keyMaps.slice(0);b.push(a.options.keyMap);a.options.extraKeys&&b.unshift(a.options.extraKeys);return b}function wc(a,b){function c(){h=!0}var d=Lb(a.options.keyMap),e=d.auto;clearTimeout(xc);e&&!yc(b)&&(xc=setTimeout(function(){Lb(a.options.keyMap)==d&&(a.options.keyMap=e.call?e.call(null,a):e)},50));
62
+ var f=ba[C(b,"keyCode")],g=!1;if(null==f||b.altGraphKey)return!1;C(b,"altKey")&&(f="Alt-"+f);if(C(b,zc?"metaKey":"ctrlKey"))f="Ctrl-"+f;if(C(b,zc?"ctrlKey":"metaKey"))f="Cmd-"+f;var h=!1,g=vc(a),g=C(b,"shiftKey")?fb("Shift-"+f,g,function(b){return eb(a,b,!0)},c)||fb(f,g,function(b){if("string"==typeof b&&/^go[A-Z]/.test(b))return eb(a,b)},c):fb(f,g,function(b){return eb(a,b)},c);h&&(g=!1);g&&(z(b),Ua(a),gb&&(b.oldKeyCode=b.keyCode,b.keyCode=0));return g}function sd(a,b,c){if(c=fb("'"+c+"'",vc(a),
63
+ function(b){return eb(a,b,!0)}))z(b),Ua(a);return c}function qc(a){this.view.focused||$(this);M&&27==a.keyCode&&(a.returnValue=!1);if(!this.options.onKeyEvent||!this.options.onKeyEvent(this,za(a))){var b=C(a,"keyCode");this.view.sel.shift=16==b||C(a,"shiftKey");var c=wc(this,a);R&&(Mb=c?b:null,!c&&(88==b&&!mc&&C(a,ia?"metaKey":"ctrlKey"))&&this.replaceSelection(""))}}function nd(a){var b=this;if(!b.options.onKeyEvent||!b.options.onKeyEvent(b,za(a))){var c=C(a,"keyCode"),d=C(a,"charCode");if(R&&c==
64
+ Mb)Mb=null,z(a);else if(!(R&&(!a.which||10>a.which)||wb)||!wc(b,a))c=String.fromCharCode(null==d?c:d),this.options.electricChars&&(this.view.mode.electricChars&&this.options.smartIndent&&!xa(this)&&-1<this.view.mode.electricChars.indexOf(c))&&setTimeout(q(b,function(){hb(b,b.view.sel.to.line,"smart")}),75),sd(b,a,c)||wa(b)}}function $(a){"nocursor"!=a.options.readOnly&&(a.view.focused||(ma(a,"focus",a),a.view.focused=!0,-1==a.display.scroller.className.search(/\bCodeMirror-focused\b/)&&(a.display.scroller.className+=
65
+ " CodeMirror-focused"),ca(a,!0)),$a(a),Ua(a))}function ub(a){a.view.focused&&(ma(a,"blur",a),a.view.focused=!1,a.display.scroller.className=a.display.scroller.className.replace(" CodeMirror-focused",""));clearInterval(a.display.blinker);setTimeout(function(){if(!a.view.focused)a.view.sel.shift=false},150)}function oc(a,b){function c(){d.inputDiv.style.position="relative";d.input.style.cssText=h;gb&&(d.scrollbarV.scrollTop=d.scroller.scrollTop=g);$a(a);if(null!=d.input.selectionStart){clearTimeout(Nb);
66
+ var b=d.input.value=" "+(u(e.from,e.to)?"":d.input.value),c=0;d.prevInput=" ";d.input.selectionStart=1;d.input.selectionEnd=b.length;Nb=setTimeout(function k(){d.prevInput==" "&&d.input.selectionStart==0?q(a,Kb.selectAll)(a):c++<10?Nb=setTimeout(k,500):ca(a)},200)}}var d=a.display;if(!na(d,b)){var e=a.view.sel,f=Ba(a,b),g=d.scroller.scrollTop;if(f&&!R){(u(e.from,e.to)||x(f,e.from)||!x(f,e.to))&&q(a,S)(a,f,f);var h=d.input.style.cssText;d.inputDiv.style.position="absolute";d.input.style.cssText="position: fixed; width: 30px; height: 30px; top: "+
67
+ (b.clientY-5)+"px; left: "+(b.clientX-5)+"px; z-index: 1000; background: white; outline: none;border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";E(a);ca(a,!0);u(e.from,e.to)&&(d.input.value=d.prevInput=" ");X?(ab(b),s(window,"mouseup",function j(){Q(window,"mouseup",j);setTimeout(c,20)})):setTimeout(c,50)}}}function Ib(a,b,c,d,e,f){var g=Ac&&td(a.view.doc,b,c);if(g){for(b=g.length-1;1<=b;--b)ib(a,g[b].from,g[b].to,[""],f);if(g.length)return ib(a,g[0].from,g[0].to,
68
+ d,e,f)}else return ib(a,b,c,d,e,f)}function ib(a,b,c,d,e,f){if(!a.view.suppressEdits){var g=a.view,h=[];g.doc.iter(b.line,c.line+1,function(a){h.push(Ca(a.text,a.markedSpans))});var m=g.sel.from,j=g.sel.to,i=ud(H(h[0]),H(K(h)),b.ch,c.ch,d),c=Bc(a,b,c,i,e,f);g.history&&vd(a,b.line,d.length,h,f,m,j,g.sel.from,g.sel.to);return c}}function Cc(a,b){var c=a.view.doc,d=a.view.history,e=("undo"==b?d.done:d.undone).pop();if(e){for(var f={events:[],fromBefore:e.fromAfter,toBefore:e.toAfter,fromAfter:e.fromBefore,
69
+ toAfter:e.toBefore},g=e.events.length-1;0<=g;g-=1){d.dirtyCounter+="undo"==b?-1:1;var h=e.events[g],m=[],j=h.start+h.added;c.iter(h.start,j,function(a){m.push(Ca(a.text,a.markedSpans))});f.events.push({start:h.start,added:h.old.length,old:m});var i=g?null:{from:e.fromBefore,to:e.toBefore};Bc(a,{line:h.start,ch:0},{line:j-1,ch:o(c,j-1).text.length},h.old,i,b)}("undo"==b?d.undone:d.done).push(f)}}function Bc(a,b,c,d,e,f){var g=a.view,h=g.doc,m=a.display;if(!g.suppressEdits){var j=c.line-b.line,i=o(h,
70
+ b.line),k=o(h,c.line),r=!1,p=b.line;a.options.lineWrapping||(p=G(ga(h,i)),h.iter(p,c.line+1,function(a){if(a==g.maxLine)return r=!0}));var l=K(d),n=Z(m);if(0==b.ch&&0==c.ch&&""==D(l)){for(var q=[],v=0,s=d.length-1;v<s;++v)q.push(pa(D(d[v]),H(d[v]),n));oa(a,k,k.text,H(l));j&&h.remove(b.line,j,a);q.length&&h.insert(b.line,q)}else if(i==k)if(1==d.length)oa(a,i,i.text.slice(0,b.ch)+D(d[0])+i.text.slice(c.ch),H(d[0]));else{q=[];v=1;for(s=d.length-1;v<s;++v)q.push(pa(D(d[v]),H(d[v]),n));q.push(pa(D(l)+
71
+ i.text.slice(c.ch),H(l),n));oa(a,i,i.text.slice(0,b.ch)+D(d[0]),H(d[0]));h.insert(b.line+1,q)}else if(1==d.length)oa(a,i,i.text.slice(0,b.ch)+D(d[0])+k.text.slice(c.ch),H(d[0])),h.remove(b.line+1,j,a);else{q=[];oa(a,i,i.text.slice(0,b.ch)+D(d[0]),H(d[0]));oa(a,k,D(l)+k.text.slice(c.ch),H(l));v=1;for(s=d.length-1;v<s;++v)q.push(pa(D(d[v]),H(d[v]),n));1<j&&h.remove(b.line+1,j-1,a);h.insert(b.line+1,q)}if(a.options.lineWrapping){var t=Math.max(5,m.scroller.clientWidth/kc(m)-3);h.iter(b.line,b.line+d.length,
72
+ function(a){if(a.height!=0){var b=(Math.ceil(a.text.length/t)||1)*n;b!=a.height&&I(a,b)}})}else h.iter(p,b.line+d.length,function(a){var b=Oa(h,a);if(b>g.maxLineLength){g.maxLine=a;g.maxLineLength=b;g.maxLineChanged=true;r=false}}),r&&(a.curOp.updateMaxLine=!0);g.frontier=Math.min(g.frontier,b.line);Ma(a,400);var w=d.length-j-1;F(a,b.line,c.line+1,w);if(tc(a,"change")){for(v=0;v<d.length;++v)"string"!=typeof d[v]&&(d[v]=d[v].text);f={from:b,to:c,text:d,origin:f};if(a.curOp.textChanged){for(m=a.curOp.textChanged;m.next;m=
73
+ m.next);m.next=f}else a.curOp.textChanged=f}var u={line:b.line+d.length-1,ch:D(l).length+(1==d.length?b.ch:0)};e&&"string"!=typeof e?e.from?(d=e.from,e=e.to):d=e:"end"==e?d=e=u:"start"==e?d=e=b:"around"==e?(d=b,e=u):(e=function(a){if(x(a,b))return a;if(!x(c,a))return u;var d=a.line+w,e=a.ch;a.line==c.line&&(e=e+(D(l).length-(c.ch-(c.line==b.line?b.ch:0))));return{line:d,ch:e}},d=e(g.sel.from),e=e(g.sel.to));S(a,d,e,null,!0);return u}}function Y(a,b,c,d,e){d||(d=c);if(x(d,c))var f=d,d=c,c=f;return Ib(a,
74
+ c,d,ya(b),null,e)}function u(a,b){return a.line==b.line&&a.ch==b.ch}function x(a,b){return a.line<b.line||a.line==b.line&&a.ch<b.ch}function w(a,b){if(0>b.line)return{line:0,ch:0};if(b.line>=a.size)return{line:a.size-1,ch:o(a,a.size-1).text.length};var c=b.ch,d=o(a,b.line).text.length;return null==c||c>d?{line:b.line,ch:d}:0>c?{line:b.line,ch:0}:b}function y(a,b,c,d){var e=a.view.sel;if(e.shift||e.extend){e=e.anchor;if(c){var f=x(b,e);f!=x(c,e)?(e=b,b=c):f!=x(b,c)&&(b=c)}S(a,e,b,d)}else S(a,b,c||
75
+ b,d);a.curOp.userSelChange=!0}function S(a,b,c,d,e){a.view.goalColumn=null;var f=a.view.sel;if(e||!u(b,f.anchor))b=jb(a,b,d,"push"!=e);if(e||!u(c,f.head))c=jb(a,c,d,"push"!=e);if(!u(f.anchor,b)||!u(f.head,c))f.anchor=b,f.head=c,d=x(c,b),f.from=d?c:b,f.to=d?b:c,a.curOp.updateInput=!0,a.curOp.selectionChanged=!0}function Dc(a){S(a,a.view.sel.from,a.view.sel.to,null,"push")}function jb(a,b,c,d){var e=a.view.doc,f=!1,g=b,h=c||1;a.view.cantEdit=!1;a:for(;;){var m=o(e,g.line),j;if(m.markedSpans){for(var i=
76
+ 0;i<m.markedSpans.length;++i){var k=m.markedSpans[i],r=k.marker;if((null==k.from||(r.inclusiveLeft?k.from<=g.ch:k.from<g.ch))&&(null==k.to||(r.inclusiveRight?k.to>=g.ch:k.to>g.ch)))if(d&&r.clearOnEnter)(j||(j=[])).push(r);else if(r.atomic){i=r.find()[0>h?"from":"to"];if(u(i,g)&&(i.ch+=h,0>i.ch?i=i.line?w(e,{line:i.line-1}):null:i.ch>m.text.length&&(i=i.line<e.size-1?{line:i.line+1,ch:0}:null),!i)){if(f){if(!d)return jb(a,b,c,!0);a.view.cantEdit=!0;return{line:0,ch:0}}f=!0;i=b;h=-h}g=i;continue a}}if(j)for(i=
77
+ 0;i<j.length;++i)j[i].clear()}return g}}function lc(a,b){for(;;){var c=!1,d=V(a,b),e=Gb(a,d.left,d.top,d.left,d.bottom),f=a.view.scrollTop,g=a.view.scrollLeft;null!=e.scrollTop&&(Aa(a,e.scrollTop),1<Math.abs(a.view.scrollTop-f)&&(c=!0));null!=e.scrollLeft&&(la(a,e.scrollLeft),1<Math.abs(a.view.scrollLeft-g)&&(c=!0));if(!c)return d}}function Ec(a,b,c,d,e){b=Gb(a,b,c,d,e);null!=b.scrollTop&&Aa(a,b.scrollTop);null!=b.scrollLeft&&la(a,b.scrollLeft)}function Gb(a,b,c,d,e){var f=a.display,g=f.lineSpace.offsetTop,
78
+ c=c+g,e=e+g,h=f.scroller.clientHeight-qa,m=f.scroller.scrollTop,j={},a=a.view.doc.height+2*g,i=c<g+10,g=e+g>a-10;c<m?j.scrollTop=i?0:Math.max(0,c):e>m+h&&(j.scrollTop=(g?a:e)-h);c=f.scroller.clientWidth-qa;e=f.scroller.scrollLeft;b+=f.gutters.offsetWidth;d+=f.gutters.offsetWidth;f=f.gutters.offsetWidth;h=b<f+10;b<e+f||h?(h&&(b=0),j.scrollLeft=Math.max(0,b-10-f)):d>c+e-3&&(j.scrollLeft=d+10-c);return j}function hb(a,b,c,d){var e=a.view.doc;c||(c="add");if("smart"==c)if(a.view.mode.indent)var f=va(a,
79
+ b);else c="prev";var g=a.options.tabSize,h=o(e,b),m=ka(h.text,null,g),j=h.text.match(/^\s*/)[0],i;if("smart"==c&&(i=a.view.mode.indent(f,h.text.slice(j.length),h.text),i==uc)){if(!d)return;c="prev"}"prev"==c?i=b?ka(o(e,b-1).text,null,g):0:"add"==c?i=m+a.options.indentUnit:"subtract"==c&&(i=m-a.options.indentUnit);i=Math.max(0,i);c="";d=0;if(a.options.indentWithTabs)for(e=Math.floor(i/g);e;--e)d+=g,c+="\t";d<i&&(c+=Fc(i-d));c!=j&&Y(a,c,{line:b,ch:0},{line:b,ch:j.length},"input");h.stateAfter=null}
80
+ function kb(a,b,c){var d=b,e=b,f=a.view.doc;"number"==typeof b?e=o(f,Math.max(0,Math.min(b,f.size-1))):d=G(b);if(null!=d&&c(e,d))F(a,d,d+1);else return null;return e}function Gc(a,b,c,d){function e(a){var c=(d?Eb:Hc)(j,m,b,!0);if(null==c){if(a=!a)a=h+b,0>a||a==f.size?a=!1:(h=a,a=j=o(f,a));if(a)m=d?(0>b?Xa:Wa)(j):0>b?j.text.length:0;else return!1}else m=c;return!0}var f=a.view.doc,g=a.view.sel.head,h=g.line,m=g.ch,j=o(f,h);if("char"==c)e();else if("column"==c)e(!0);else if("word"==c)for(c=!1;!(0>b)||
81
+ e();){if(lb(j.text.charAt(m)))c=!0;else if(c){0>b&&(b=1,e());break}if(0<b&&!e())break}return jb(a,{line:h,ch:m},b,!0)}function rc(a,b){var c=b.ch,d=b.ch;if(a){!1===b.after||d==a.length?--c:++d;for(var e=a.charAt(c),e=lb(e)?lb:/\s/.test(e)?function(a){return/\s/.test(a)}:function(a){return!/\s/.test(a)&&!lb(a)};0<c&&e(a.charAt(c-1));)--c;for(;d<a.length&&e(a.charAt(d));)++d}return{from:{line:b.line,ch:c},to:{line:b.line,ch:d}}}function qd(a,b){y(a,{line:b,ch:0},w(a.view.doc,{line:b+1,ch:0}))}function t(a,
82
+ b,c,d){l.defaults[a]=b;c&&(da[a]=d?function(a,b,d){d!=Xb&&c(a,b,d)}:c)}function ja(a,b){if(!0===b)return b;if(a.copyState)return a.copyState(b);var c={},d;for(d in b){var e=b[d];e instanceof Array&&(e=e.concat([]));c[d]=e}return c}function hc(a,b,c){return a.startState?a.startState(b,c):!0}function Lb(a){return"string"==typeof a?T[a]:a}function fb(a,b,c,d){function e(b){var b=Lb(b),f=b[a];if(!1===f)return d&&d(),!0;if(null!=f&&c(f))return!0;if(b.nofallthrough)return d&&d(),!0;b=b.fallthrough;if(null==
83
+ b)return!1;if("[object Array]"!=Object.prototype.toString.call(b))return e(b);for(var f=0,m=b.length;f<m;++f)if(e(b[f]))return!0;return!1}for(var f=0;f<b.length;++f)if(e(b[f]))return!0}function yc(a){a=ba[C(a,"keyCode")];return"Ctrl"==a||"Alt"==a||"Shift"==a||"Mod"==a}function Da(a,b){this.pos=this.start=0;this.string=a;this.tabSize=b||8}function Ea(a,b){this.lines=[];this.type=b;this.cm=a}function Ic(a,b,c,d,e){var f=a.view.doc,g=new Ea(a,e);if("range"==e&&!x(b,c))return g;if(d)for(var h in d)d.hasOwnProperty(h)&&
84
+ (g[h]=d[h]);g.replacedWith&&(g.collapsed=!0,g.replacedWith=n("span",[g.replacedWith],"CodeMirror-widget"));g.collapsed&&(ua=!0);var m=b.line,j=0,i,k;f.iter(m,c.line+1,function(d){if(g.collapsed&&!a.options.lineWrapping&&ga(f,d)==a.view.maxLine)a.curOp.updateMaxLine=true;var e={from:null,to:null,marker:g};j=j+d.text.length;if(m==b.line){e.from=b.ch;j=j-b.ch}if(m==c.line){e.to=c.ch;j=j-(d.text.length-c.ch)}if(g.collapsed){m==c.line&&(k=mb(d,c.ch));m==b.line?i=mb(d,b.ch):I(d,0)}d.markedSpans=d.markedSpans?
85
+ d.markedSpans.concat([e]):[e];e.marker.lines.push(d);++m});g.collapsed&&f.iter(b.line,c.line+1,function(a){U(a)&&I(a,0)});g.readOnly&&(Ac=!0,(a.view.history.done.length||a.view.history.undone.length)&&a.clearHistory());if(g.collapsed){if(i!=k)throw Error("Inserting collapsed marker overlapping an existing one");g.size=j;g.atomic=!0}(g.className||g.startStyle||g.endStyle||g.collapsed)&&F(a,b.line,c.line+1);g.atomic&&Dc(a);return g}function Fa(a,b){if(a)for(var c=0;c<a.length;++c){var d=a[c];if(d.marker==
86
+ b)return d}}function ud(a,b,c,d,e){if(!a&&!b)return e;if(a)for(var f=0,g;f<a.length;++f){var h=a[f],m=h.marker;if(null==h.from||(m.inclusiveLeft?h.from<=c:h.from<c)||"bookmark"==m.type&&h.from==c){var j=null==h.to||(m.inclusiveRight?h.to>=c:h.to>c);(g||(g=[])).push({from:h.from,to:j?null:h.to,marker:m})}}a=g;if(b)for(var f=0,i;f<b.length;++f)if(g=b[f],h=g.marker,null==g.to||(h.inclusiveRight?g.to>=d:g.to>d)||"bookmark"==h.type&&g.from==d&&g.from!=c)m=null==g.from||(h.inclusiveLeft?g.from<=d:g.from<
87
+ d),(i||(i=[])).push({from:m?null:g.from-d,to:null==g.to?null:g.to-d,marker:h});b=i;i=1==e.length;f=K(e).length+(i?c:0);if(a)for(d=0;d<a.length;++d)g=a[d],null==g.to&&((h=Fa(b,g.marker))?i&&(g.to=null==h.to?null:h.to+f):g.to=c);if(b)for(d=0;d<b.length;++d)(g=b[d],null!=g.to&&(g.to+=f),null==g.from)?(h=Fa(a,g.marker),h||(g.from=f,i&&(a||(a=[])).push(g))):(g.from+=f,i&&(a||(a=[])).push(g));c=[Ca(e[0],a)];if(!i){i=e.length-2;var k;if(0<i&&a)for(d=0;d<a.length;++d)null==a[d].to&&(k||(k=[])).push({from:null,
88
+ to:null,marker:a[d].marker});for(d=0;d<i;++d)c.push(Ca(e[d+1],k));c.push(Ca(K(e),b))}return c}function td(a,b,c){var d=null;a.iter(b.line,c.line+1,function(a){if(a.markedSpans)for(var b=0;b<a.markedSpans.length;++b){var c=a.markedSpans[b].marker;if(c.readOnly&&(!d||-1==nb(d,c)))(d||(d=[])).push(c)}});if(!d)return null;a=[{from:b,to:c}];for(b=0;b<d.length;++b)for(var c=d[b].find(),e=0;e<a.length;++e){var f=a[e];if(x(c.from,f.to)&&!x(c.to,f.from)){var g=[e,1];x(f.from,c.from)&&g.push({from:f.from,to:c.from});
89
+ x(c.to,f.to)&&g.push({from:c.to,to:f.to});a.splice.apply(a,g);e+=g.length-1}}return a}function mb(a,b){var c=ua&&a.markedSpans,d;if(c)for(var e,f=0;f<c.length;++f)if(e=c[f],e.marker.collapsed&&(null==e.from||e.from<b)&&(null==e.to||e.to>b)&&(!d||d.width<e.marker.width))d=e.marker;return d}function ta(a){return mb(a,-1)}function Pa(a){return mb(a,a.text.length+1)}function ga(a,b){for(var c;c=ta(b);)b=o(a,c.find().from.line);return b}function U(a){var b=ua&&a.markedSpans;if(b)for(var c,d=0;d<b.length;++d)if(c=
90
+ b[d],c.marker.collapsed&&(null==c.from||0==c.from&&c.marker.inclusiveLeft&&Ob(a,c)))return!0}function Ob(a,b){if(null==b.to){for(var c=b.marker.find().to,d=a.parent;d.parent;d=d.parent);c=o(d,c.line);return Ob(c,Fa(c.markedSpans,b.marker))}if(b.marker.inclusiveRight&&b.to==a.text.length)return!0;for(d=0;d<a.markedSpans.length;++d)if(c=a.markedSpans[d],c.marker.collapsed&&c.from==b.to&&(c.marker.inclusiveLeft||b.marker.inclusiveRight)&&Ob(a,c))return!0}function D(a){return"string"==typeof a?a:a.text}
91
+ function H(a){if("string"==typeof a)return null;for(var a=a.markedSpans,b=null,c=0;c<a.length;++c)a[c].marker.explicitlyCleared?b||(b=a.slice(0,c)):b&&b.push(a[c]);return!b?a:b.length?b:null}function Ca(a,b){return b?{text:a,markedSpans:b}:a}function Jc(a){var b=a.markedSpans;if(b){for(var c=0;c<b.length;++c){var d=b[c].marker.lines,e=nb(d,a);d.splice(e,1)}a.markedSpans=null}}function Kc(a,b){if(b){for(var c=0;c<b.length;++c)b[c].marker.lines.push(a);a.markedSpans=b}}function Lc(a){return function(){Ya(this.cm);
92
+ try{var b=a.apply(this,arguments)}finally{Za(this.cm)}return b}}function Va(a){if(null!=a.height)return a.height;(!a.node.parentNode||1!=a.node.parentNode.nodeType)&&W(a.cm.display.measure,n("div",[a.node],null,"position: relative"));return a.height=a.node.offsetHeight}function wd(a,b,c,d){var e=new Pb(a,c,d);e.noHScroll&&(a.display.alignWidgets=!0);kb(a,b,function(b){(b.widgets||(b.widgets=[])).push(e);e.line=b;if(!U(b)||e.showIfHidden){var c=ha(a,b)<a.display.scroller.scrollTop;I(b,b.height+Va(e));
93
+ c&&setTimeout(function(){a.display.scroller.scrollTop=a.display.scroller.scrollTop+e.height})}return true});return e}function pa(a,b,c){a={text:a,height:c};Kc(a,b);U(a)&&(a.height=0);return a}function oa(a,b,c,d){b.text=c;b.stateAfter&&(b.stateAfter=null);b.styles&&(b.styles=null);null!=b.order&&(b.order=null);Jc(b);Kc(b,d);U(b)?b.height=0:b.height||(b.height=Z(a.display));fa(a,b,"change")}function Mc(a,b,c,d,e){var f=a.options.flattenSpans,g="",h=null,a=new Da(b,a.options.tabSize);for(""==b&&c.blankLine&&
94
+ c.blankLine(d);!a.eol();){var m=c.token(a,d);5E3<a.pos&&(f=!1,a.pos=Math.min(b.length,a.start+5E4),m=null);var j=a.current();a.start=a.pos;!f||h!=m?(g&&e(g,h),g=j,h=m):g+=j}g&&e(g,h)}function fc(a,b,c){var d=[a.view.modeGen];Mc(a,b.text,a.view.mode,c,function(a,b){d.push(a,b)});for(c=0;c<a.view.overlays.length;++c){var e=a.view.overlays[c],f=1;Mc(a,b.text,e.mode,!0,function(a,b){for(var c=f,j=a.length;j;){var i=d[f],k=i.length;if(k<=j)j=j-k;else{d.splice(f,1,i.slice(0,j),d[f+1],i.slice(j));j=0}f=
95
+ f+2}if(b)if(e.opaque){d.splice(c,f-c,a,b);f=c+2}else for(;c<f;c=c+2){i=d[c+1];d[c+1]=i?i+" "+b:b}})}return d}function gc(a,b,c){var d=a.view.mode,a=new Da(b.text,a.options.tabSize);for(""==b.text&&d.blankLine&&d.blankLine(c);!a.eol()&&5E3>=a.pos;)d.token(a,c),a.start=a.pos}function Nc(a){return!a?null:Oc[a]||(Oc[a]="cm-"+a.replace(/ +/g," cm-"))}function cc(a,b,c){for(var d,e=b,f,g,h=!0;d=ta(e);)h=!1,e=o(a.view.doc,d.find().from.line),f||(f=e);d={pre:n("pre"),col:0,pos:0,display:!c,measure:null,addedOne:!1,
96
+ cm:a};e.textClass&&(d.pre.className=e.textClass);do{d.measure=e==b&&c;d.pos=0;d.addToken=d.measure?xd:Pc;c&&(g&&e!=b&&!d.addedOne)&&(c[0]=d.pre.appendChild(Qc(a.display.measure)),d.addedOne=!0);var m=e;g=d;var j=e;if(!j.styles||j.styles[0]!=a.view.modeGen)j.styles=fc(a,j,j.stateAfter=va(a,G(j)));a:{var i=m,j=j.styles;if(m=i.markedSpans)for(var i=i.text.length,k=0,r=1,l="",q=void 0,s=0,t=void 0,v=void 0,w=void 0,u=void 0;;){if(s==k){for(var t=v=w="",u=null,s=Infinity,x=null,z=0;z<m.length;++z){var B=
97
+ m[z],y=B.marker;if(B.from<=k&&(null==B.to||B.to>k)){if(null!=B.to&&s>B.to&&(s=B.to,v=""),y.className&&(t+=" "+y.className),y.startStyle&&B.from==k&&(w+=" "+y.startStyle),y.endStyle&&B.to==s&&(v+=" "+y.endStyle),y.collapsed&&(!u||u.marker.width<y.width))u=B}else B.from>k&&s>B.from&&(s=B.from);"bookmark"==y.type&&(B.from==k&&y.replacedWith)&&(x=y.replacedWith)}if(u&&(u.from||0)==k)if(Rc(g,(null==u.to?i:u.to)-k,null!=u.from&&u.marker.replacedWith),null==u.to){j=u.marker.find();break a}x&&!u&&Rc(g,0,
98
+ x)}if(k>=i)break;for(x=Math.min(i,s);;){if(l){z=k+l.length;u||(B=z>x?l.slice(0,x-k):l,g.addToken(g,B,q+t,w,k+B.length==s?v:""));if(z>=x){l=l.slice(x-k);k=x;break}k=z;w=""}l=j[r++];q=Nc(j[r++])}}else for(var r=1;r<j.length;r+=2)g.addToken(g,j[r],Nc(j[r+1]));j=void 0}g=e==f;j&&(e=o(a.view.doc,j.to.line),h=!1)}while(j);c&&!d.addedOne&&(c[0]=d.pre.appendChild(h?n("span"," "):Qc(a.display.measure)));!d.pre.firstChild&&!U(b)&&d.pre.appendChild(document.createTextNode(" "));return d.pre}function Pc(a,b,
99
+ c,d,e){if(b){if(Qb.test(b))for(var f=document.createDocumentFragment(),g=0;;){Qb.lastIndex=g;var h=Qb.exec(b),m=h?h.index-g:b.length-g;m&&(f.appendChild(document.createTextNode(b.slice(g,g+m))),a.col+=m);if(!h)break;g+=m+1;"\t"==h[0]?(h=a.cm.options.tabSize,h-=a.col%h,f.appendChild(n("span",Fc(h),"cm-tab")),a.col+=h):(m=n("span","•","cm-invalidchar"),m.title="\\u"+h[0].charCodeAt(0).toString(16),f.appendChild(m),a.col+=1)}else{a.col+=b.length;var f=document.createTextNode(b)}if(c||d||e||a.measure)return b=
100
+ c||"",d&&(b+=d),e&&(b+=e),a.pre.appendChild(n("span",[f],b));a.pre.appendChild(f)}}function xd(a,b,c,d,e){for(var f=0;f<b.length;++f)f&&(f<b.length&&a.cm.options.lineWrapping&&ob.test(b.slice(f-1,f+1)))&&a.pre.appendChild(n("wbr")),a.measure[a.pos++]=Pc(a,b.charAt(f),c,0==f&&d,f==b.length-1&&e);b.length&&(a.addedOne=!0)}function Rc(a,b,c){c&&(a.display||(c=c.cloneNode(!0)),a.pre.appendChild(c),a.measure&&b&&(a.measure[a.pos]=c,a.addedOne=!0));a.pos+=b}function Ja(a){this.lines=a;this.parent=null;
101
+ for(var b=0,c=a.length,d=0;b<c;++b)a[b].parent=this,d+=a[b].height;this.height=d}function Ia(a){this.children=a;for(var b=0,c=0,d=0,e=a.length;d<e;++d){var f=a[d],b=b+f.chunkSize(),c=c+f.height;f.parent=this}this.size=b;this.height=c;this.parent=null}function o(a,b){for(;!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 I(a,b){for(var c=b-a.height,d=a;d;d=d.parent)d.height+=c}function G(a){if(null==a.parent)return null;for(var b=a.parent,
102
+ a=nb(b.lines,a),c=b.parent;c;b=c,c=c.parent)for(var d=0;c.children[d]!=b;++d)a+=c.children[d].chunkSize();return a}function Ra(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);d=0;for(e=a.lines.length;d<e;++d){f=a.lines[d].height;if(b<f)break;b-=f}return c+d}function ha(a,b){for(var b=ga(a.view.doc,b),c=0,d=b.parent,e=0;e<d.lines.length;++e){var f=d.lines[e];if(f==b)break;else c+=f.height}for(f=
103
+ d.parent;f;d=f,f=d.parent)for(e=0;e<f.children.length;++e){var g=f.children[e];if(g==d)break;else c+=g.height}return c}function P(a){var b=a.order;null==b&&(b=a.order=yd(a.text));return b}function tb(){return{done:[],undone:[],lastTime:0,lastOp:null,lastOrigin:null,dirtyCounter:0}}function vd(a,b,c,d,e,f,g,h,m){var j=a.view.history;j.undone.length=0;var i=+new Date,k=K(j.done);if(k&&(j.lastOp==a.curOp.id||j.lastOrigin==e&&("input"==e||"delete"==e)&&j.lastTime>i-600)){f=K(k.events);if(f.start>b+d.length||
104
+ f.start+f.added<b)k.events.push({start:b,added:c,old:d});else{for(var g=Math.max(0,f.start-b),r=Math.max(0,b+d.length-(f.start+f.added)),l=g;0<l;--l)f.old.unshift(d[l-1]);for(l=r;0<l;--l)f.old.push(d[d.length-l]);g&&(f.start=b);f.added+=c-(d.length-g-r)}k.fromAfter=h;k.toAfter=m}else{k={events:[{start:b,added:c,old:d}],fromBefore:f,toBefore:g,fromAfter:h,toAfter:m};for(j.done.push(k);j.done.length>a.options.undoDepth;)j.done.shift();0>j.dirtyCounter?j.dirtyCounter=NaN:j.dirtyCounter++}j.lastTime=
105
+ i;j.lastOp=a.curOp.id;j.lastOrigin=e}function zd(){ab(this)}function za(a){a.stop||(a.stop=zd);return a}function z(a){a.preventDefault?a.preventDefault():a.returnValue=!1}function Sc(a){a.stopPropagation?a.stopPropagation():a.cancelBubble=!0}function ab(a){z(a);Sc(a)}function sc(a){var b=a.which;null==b&&(a.button&1?b=1:a.button&2?b=3:a.button&4&&(b=2));ia&&(a.ctrlKey&&1==b)&&(b=3);return b}function C(a,b){return a.override&&a.override.hasOwnProperty(b)?a.override[b]:a[b]}function s(a,b,c){a.addEventListener?
106
+ a.addEventListener(b,c,!1):a.attachEvent?a.attachEvent("on"+b,c):(a=a._handlers||(a._handlers={}),(a[b]||(a[b]=[])).push(c))}function Q(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,!1);else if(a.detachEvent)a.detachEvent("on"+b,c);else if(a=a._handlers&&a._handlers[b])for(b=0;b<a.length;++b)if(a[b]==c){a.splice(b,1);break}}function ma(a,b){var c=a._handlers&&a._handlers[b];if(c)for(var d=Array.prototype.slice.call(arguments,2),e=0;e<c.length;++e)c[e].apply(null,d)}function fa(a,b,c){function d(a){return function(){a.apply(null,
107
+ f)}}var e=b._handlers&&b._handlers[c];if(e)for(var f=Array.prototype.slice.call(arguments,3),g=a.curOp&&a.curOp.delayedCallbacks,h=0;h<e.length;++h)g?g.push(d(e[h])):e[h].apply(null,f)}function tc(a,b){var c=a._handlers&&a._handlers[b];return c&&0<c.length}function xb(){this.id=null}function ka(a,b,c){null==b&&(b=a.search(/[^\s\u00a0]/),-1==b&&(b=a.length));for(var d=0,e=0;d<b;++d)"\t"==a.charAt(d)?e+=c-e%c:++e;return e}function Fc(a){for(;pb.length<=a;)pb.push(K(pb)+" ");return pb[a]}function K(a){return a[a.length-
108
+ 1]}function nc(a){La?(a.selectionStart=0,a.selectionEnd=a.value.length):a.select()}function nb(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 ic(a){for(var b=[],c=0;c<a;++c)b.push(void 0);return b}function L(a){var b=Array.prototype.slice.call(arguments,1);return function(){return a.apply(null,b)}}function lb(a){return/\w/.test(a)||"€"<a&&(a.toUpperCase()!=a.toLowerCase()||Ad.test(a))}function Tc(a){var b=0,c;for(c in a)a.hasOwnProperty(c)&&
109
+ a[c]&&++b;return!b}function n(a,b,c,d){a=document.createElement(a);c&&(a.className=c);d&&(a.style.cssText=d);if("string"==typeof b)bc(a,b);else if(b)for(c=0;c<b.length;++c)a.appendChild(b[c]);return a}function Na(a){if(M)for(;a.firstChild;)a.removeChild(a.firstChild);else a.innerHTML="";return a}function W(a,b){return Na(a).appendChild(b)}function bc(a,b){gb?(a.innerHTML="",a.appendChild(document.createTextNode(b))):a.textContent=b}function Qa(a){if(null!=qb)return qb;var b=n("div",null,null,"width: 50px; height: 50px; overflow-x: scroll");
110
+ W(a,b);b.offsetWidth&&(qb=b.offsetHeight-b.clientHeight);return qb||0}function Qc(a){if(null==Rb){var b=n("span","​");W(a,n("span",[b,document.createTextNode("x")]));0!=a.firstChild.offsetHeight&&(Rb=1>=b.offsetWidth&&2<b.offsetHeight&&!ea)}return Rb?n("span","​"):n("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")}function gd(a,b,c,d){if(!a)return d(b,c,"ltr");for(var e=0;e<a.length;++e){var f=a[e];if(f.from<c&&f.to>b||b==c&&f.to==b)d(Math.max(f.from,b),Math.min(f.to,c),1==
111
+ f.level?"rtl":"ltr")}}function Sb(a){return a.level%2?a.from:a.to}function Wa(a){return(a=P(a))?a[0].level%2?a[0].to:a[0].from:0}function Xa(a){var b=P(a);return!b?a.text.length:Sb(K(b))}function Uc(a,b){var c=o(a.view.doc,b),d=ga(a.view.doc,c);d!=c&&(b=G(d));c=P(d);d=!c?0:c[0].level%2?Xa(d):Wa(d);return{line:b,ch:d}}function Bd(a,b){for(var c,d;c=Pa(d=o(a.view.doc,b));)b=c.find().to.line;c=P(d);d=!c?d.text.length:c[0].level%2?Wa(d):Xa(d);return{line:b,ch:d}}function Eb(a,b,c,d){var e=P(a);if(!e)return Hc(a,
112
+ b,c,d);for(var d=d?function(b,c){do b+=c;while(0<b&&Fb.test(a.text.charAt(b)));return b}:function(a,b){return a+b},f=e[0].level,g=0;g<e.length;++g){var h=e[g],m=h.level%2==f;if(h.from<b&&h.to>b||m&&(h.from==b||h.to==b))break}for(b=d(b,h.level%2?-c:c);null!=b;)if(h.level%2==f)if(b<h.from||b>h.to)b=(h=e[g+=c])&&(0<c==h.level%2?d(h.to,-1):d(h.from,1));else break;else if(b==(h.level%2?h.to:h.from))b=(h=e[--g])&&Sb(h);else if(b==Sb(h))b=(h=e[++g])&&(h.level%2?h.to:h.from);else break;return 0>b||b>a.text.length?
113
+ null:b}function Hc(a,b,c,d){b+=c;if(d)for(;0<b&&Fb.test(a.text.charAt(b));)b+=c;return 0>b||b>a.text.length?null:b}var X=/gecko\/\d/i.test(navigator.userAgent),M=/MSIE \d/.test(navigator.userAgent),ea=M&&(null==document.documentMode||8>document.documentMode),gb=M&&(null==document.documentMode||9>document.documentMode),N=/WebKit\//.test(navigator.userAgent),Cd=N&&/Qt\/\d+\.\d+/.test(navigator.userAgent),Vc=/Chrome\//.test(navigator.userAgent),R=/Opera\//.test(navigator.userAgent),Jb=/Apple Computer/.test(navigator.vendor),
114
+ wb=/KHTML\//.test(navigator.userAgent),$c=/Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent),ad=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),kd=/PhantomJS/.test(navigator.userAgent),La=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),Vb=La||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),ia=La||/Mac/.test(navigator.platform),Dd=/windows/i.test(navigator.platform),Ga=R&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);
115
+ Ga&&(Ga=Number(Ga[1]));var zc=ia&&(Cd||R&&(null==Ga||12.11>Ga)),Ac=!1,ua=!1,aa,cb,bb,db=0,J=null;M?J=-0.53:X?J=15:Vc?J=-0.7:Jb&&(J=-1/3);var xc,Mb=null,Nb;l.prototype={getValue:function(a){var b=[],c=this.view.doc;c.iter(0,c.size,function(a){b.push(a.text)});return b.join(a||"\n")},setValue:q(null,function(a){var b=this.view.doc,c={line:0,ch:0},d=o(b,b.size-1).text.length;ib(this,c,{line:b.size-1,ch:d},ya(a),c,c,"setValue")}),getSelection:function(a){return this.getRange(this.view.sel.from,this.view.sel.to,
116
+ a)},replaceSelection:q(null,function(a,b,c){var d=this.view.sel;Ib(this,d.from,d.to,ya(a),b||"around",c)}),focus:function(){window.focus();E(this);$(this);wa(this)},setOption:function(a,b){var c=this.options,d=c[a];c[a]==b&&"mode"!=a||(c[a]=b,da.hasOwnProperty(a)&&q(this,da[a])(this,b,d))},getOption:function(a){return this.options[a]},getMode:function(){return this.view.mode},addKeyMap:function(a){this.view.keyMaps.push(a)},removeKeyMap:function(a){for(var b=this.view.keyMaps,c=0;c<b.length;++c)if(("string"==
117
+ typeof a?b[c].name:b[c])==a)return b.splice(c,1),!0},addOverlay:q(null,function(a,b){var c=a.token?a:l.getMode(this.options,a);if(c.startState)throw Error("Overlays may not be stateful.");this.view.overlays.push({mode:c,modeSpec:a,opaque:b&&b.opaque});this.view.modeGen++;F(this,0,this.view.doc.size)}),removeOverlay:q(null,function(a){for(var b=this.view.overlays,c=0;c<b.length;++c)if(b[c].modeSpec==a){b.splice(c,1);this.view.modeGen++;F(this,0,this.view.doc.size);break}}),undo:q(null,function(){Cc(this,
118
+ "undo")}),redo:q(null,function(){Cc(this,"redo")}),indentLine:q(null,function(a,b,c){"string"!=typeof b&&(b=null==b?this.options.smartIndent?"smart":"prev":b?"add":"subtract");0<=a&&a<this.view.doc.size&&hb(this,a,b,c)}),indentSelection:q(null,function(a){var b=this.view.sel;if(u(b.from,b.to))return hb(this,b.from.line,a);for(var c=b.to.line-(b.to.ch?0:1),b=b.from.line;b<=c;++b)hb(this,b,a)}),historySize:function(){var a=this.view.history;return{undo:a.done.length,redo:a.undone.length}},clearHistory:function(){this.view.history=
119
+ tb()},markClean:function(){this.view.history.dirtyCounter=0;this.view.history.lastOp=this.view.history.lastOrigin=null},isClean:function(){return 0==this.view.history.dirtyCounter},getHistory:function(){function a(a){for(var b=0,e=[],f;b<a.length;++b){var g=a[b];e.push({events:f=[],fromBefore:g.fromBefore,toBefore:g.toBefore,fromAfter:g.fromAfter,toAfter:g.toAfter});for(var h=0,g=g.events;h<g.length;++h){var m=[],j=g[h];f.push({start:j.start,added:j.added,old:m});for(var i=0;i<j.old.length;++i)m.push(D(j.old[i]))}}return e}
120
+ var b=this.view.history;return{done:a(b.done),undone:a(b.undone)}},setHistory:function(a){var b=this.view.history=tb();b.done=a.done;b.undone=a.undone},getTokenAt:function(a){for(var b=this.view.doc,a=w(b,a),c=va(this,a.line),d=this.view.mode,b=o(b,a.line),b=new Da(b.text,this.options.tabSize);b.pos<a.ch&&!b.eol();){b.start=b.pos;var e=d.token(b,c)}return{start:b.start,end:b.pos,string:b.current(),className:e||null,type:e||null,state:c}},getStateAfter:function(a){var b=this.view.doc,a=Math.max(0,
121
+ Math.min(null==a?b.size-1:a,b.size-1));return va(this,a+1)},cursorCoords:function(a,b){var c;c=this.view.sel;c=null==a?c.head:"object"==typeof a?w(this.view.doc,a):a?c.from:c.to;return V(this,c,b||"page")},charCoords:function(a,b){return Ta(this,w(this.view.doc,a),b||"page")},coordsChar:function(a){var b=this.display.lineSpace.getBoundingClientRect();return Db(this,a.left-b.left,a.top-b.top)},defaultTextHeight:function(){return Z(this.display)},markText:q(null,function(a,b,c){return Ic(this,w(this.view.doc,
122
+ a),w(this.view.doc,b),c,"range")}),setBookmark:q(null,function(a,b){a=w(this.view.doc,a);return Ic(this,a,a,b?{replacedWith:b}:{},"bookmark")}),findMarksAt:function(a){var b=this.view.doc,a=w(b,a),c=[];if(b=o(b,a.line).markedSpans)for(var d=0;d<b.length;++d){var e=b[d];(null==e.from||e.from<=a.ch)&&(null==e.to||e.to>=a.ch)&&c.push(e.marker)}return c},setGutterMarker:q(null,function(a,b,c){return kb(this,a,function(a){var e=a.gutterMarkers||(a.gutterMarkers={});e[b]=c;!c&&Tc(e)&&(a.gutterMarkers=null);
123
+ return!0})}),clearGutter:q(null,function(a){var b=0,c=this,d=c.view.doc;d.iter(0,d.size,function(d){d.gutterMarkers&&d.gutterMarkers[a]&&(d.gutterMarkers[a]=null,F(c,b,b+1),Tc(d.gutterMarkers)&&(d.gutterMarkers=null));++b})}),addLineClass:q(null,function(a,b,c){return kb(this,a,function(a){var e="text"==b?"textClass":"background"==b?"bgClass":"wrapClass";if(a[e]){if(RegExp("\\b"+c+"\\b").test(a[e]))return!1;a[e]+=" "+c}else a[e]=c;return!0})}),removeLineClass:q(null,function(a,b,c){return kb(this,
124
+ a,function(a){var e="text"==b?"textClass":"background"==b?"bgClass":"wrapClass",f=a[e];if(f)if(null==c)a[e]=null;else{var g=f.replace(RegExp("^"+c+"\\b\\s*|\\s*\\b"+c+"\\b"),"");if(g==f)return!1;a[e]=g||null}else return!1;return!0})}),addLineWidget:q(null,function(a,b,c){return wd(this,a,b,c)}),removeLineWidget:function(a){a.clear()},lineInfo:function(a){if("number"==typeof a){if(!(0<=a&&a<this.view.doc.size))return null;var b=a,a=o(this.view.doc,a);if(!a)return null}else if(b=G(a),null==b)return null;
125
+ return{line:b,handle:a,text:a.text,gutterMarkers:a.gutterMarkers,textClass:a.textClass,bgClass:a.bgClass,wrapClass:a.wrapClass,widgets:a.widgets}},getViewport:function(){return{from:this.display.showingFrom,to:this.display.showingTo}},addWidget:function(a,b,c,d,e){var f=this.display,a=V(this,w(this.view.doc,a)),g=a.top,h=a.left;b.style.position="absolute";f.sizer.appendChild(b);if("over"==d)g=a.top;else if("near"==d){var d=Math.max(f.wrapper.clientHeight,this.view.doc.height),m=Math.max(f.sizer.clientWidth,
126
+ f.lineSpace.clientWidth);a.bottom+b.offsetHeight>d&&a.top>b.offsetHeight&&(g=a.top-b.offsetHeight);h+b.offsetWidth>m&&(h=m-b.offsetWidth)}b.style.top=g+f.lineSpace.offsetTop+"px";b.style.left=b.style.right="";"right"==e?(h=f.sizer.clientWidth-b.offsetWidth,b.style.right="0px"):("left"==e?h=0:"middle"==e&&(h=(f.sizer.clientWidth-b.offsetWidth)/2),b.style.left=h+"px");c&&Ec(this,h,g,h+b.offsetWidth,g+b.offsetHeight)},lineCount:function(){return this.view.doc.size},clipPos:function(a){return w(this.view.doc,
127
+ a)},getCursor:function(a){var b=this.view.sel,a=null==a||"head"==a?b.head:"anchor"==a?b.anchor:"end"==a||!1===a?b.to:b.from;return{line:a.line,ch:a.ch}},somethingSelected:function(){return!u(this.view.sel.from,this.view.sel.to)},setCursor:q(null,function(a,b,c){a=w(this.view.doc,"number"==typeof a?{line:a,ch:b||0}:a);c?y(this,a):S(this,a,a)}),setSelection:q(null,function(a,b){var c=this.view.doc;S(this,w(c,a),w(c,b||a))}),extendSelection:q(null,function(a,b){var c=this.view.doc;y(this,w(c,a),b&&w(c,
128
+ b))}),setExtending:function(a){this.view.sel.extend=a},getLine:function(a){return(a=this.getLineHandle(a))&&a.text},getLineHandle:function(a){var b=this.view.doc;if(0<=a&&a<b.size)return o(b,a)},getLineNumber:function(a){return G(a)},setLine:q(null,function(a,b){0<=a&&a<this.view.doc.size&&Y(this,b,{line:a,ch:0},{line:a,ch:o(this.view.doc,a).text.length})}),removeLine:q(null,function(a){0<=a&&a<this.view.doc.size&&Y(this,"",{line:a,ch:0},w(this.view.doc,{line:a+1,ch:0}))}),replaceRange:q(null,function(a,
129
+ b,c){var d=this.view.doc,b=w(d,b),c=c?w(d,c):b;return Y(this,a,b,c)}),getRange:function(a,b,c){var d=this.view.doc,a=w(d,a),b=w(d,b),e=a.line,f=b.line;if(e==f)return o(d,e).text.slice(a.ch,b.ch);var g=[o(d,e).text.slice(a.ch)];d.iter(e+1,f,function(a){g.push(a.text)});g.push(o(d,f).text.slice(0,b.ch));return g.join(c||"\n")},triggerOnKeyDown:q(null,qc),execCommand:function(a){return Kb[a](this)},moveH:q(null,function(a,b){var c=this.view.sel,d=0>a?c.from:c.to;if(c.shift||c.extend||u(c.from,c.to))d=
130
+ Gc(this,a,b,this.options.rtlMoveVisually);y(this,d,d,a)}),deleteH:q(null,function(a,b){var c=this.view.sel;u(c.from,c.to)?Y(this,"",c.from,Gc(this,a,b,!1),"delete"):Y(this,"",c.from,c.to,"delete");this.curOp.userSelChange=!0}),moveV:q(null,function(a,b){var c=this.view,d=c.doc,e=this.display,f=V(this,c.sel.head,"div"),g=f.left,h;null!=c.goalColumn&&(g=c.goalColumn);"page"==b?(h=Math.min(e.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),h=f.top+a*h):"line"==b&&(h=0<
131
+ a?f.bottom+3:f.top-3);do{var m=Db(this,g,h);h+=5*a}while(m.outside&&(0>a?0<h:h<d.height));"page"==b&&(e.scrollbarV.scrollTop+=Ta(this,m,"div").top-f.top);y(this,m,m,a);c.goalColumn=g}),toggleOverwrite:function(){this.display.cursor.className=(this.view.overwrite=!this.view.overwrite)?this.display.cursor.className+" CodeMirror-overwrite":this.display.cursor.className.replace(" CodeMirror-overwrite","")},posFromIndex:function(a){var b=0,c,d=this.view.doc;d.iter(0,d.size,function(d){d=d.text.length+
132
+ 1;if(d>a)return c=a,!0;a-=d;++b});return w(d,{line:b,ch:c})},indexFromPos:function(a){var a=w(this.view.doc,a),b=a.ch;this.view.doc.iter(0,a.line,function(a){b+=a.text.length+1});return b},scrollTo:function(a,b){null!=a&&(this.display.scrollbarH.scrollLeft=this.display.scroller.scrollLeft=a);null!=b&&(this.display.scrollbarV.scrollTop=this.display.scroller.scrollTop=b);O(this,[])},getScrollInfo:function(){var a=this.display.scroller,b=qa;return{left:a.scrollLeft,top:a.scrollTop,height:a.scrollHeight-
133
+ b,width:a.scrollWidth-b,clientHeight:a.clientHeight-b,clientWidth:a.clientWidth-b}},scrollIntoView:function(a){"number"==typeof a&&(a={line:a,ch:0});!a||null!=a.line?(a=a?w(this.view.doc,a):this.view.sel.head,lc(this,a)):Ec(this,a.left,a.top,a.right,a.bottom)},setSize:function(a,b){function c(a){return"number"==typeof a||/^\d+$/.test(""+a)?a+"px":a}null!=a&&(this.display.wrapper.style.width=c(a));null!=b&&(this.display.wrapper.style.height=c(b));this.refresh()},on:function(a,b){s(this,a,b)},off:function(a,
134
+ b){Q(this,a,b)},operation:function(a){return q(this,a)()},refresh:function(){ra(this);var a=this.view.scrollTop,b=this.view.scrollLeft;this.display.scroller.scrollHeight>a&&(this.display.scrollbarV.scrollTop=this.display.scroller.scrollTop=a);this.display.scroller.scrollWidth>b&&(this.display.scrollbarH.scrollLeft=this.display.scroller.scrollLeft=b);O(this,!0)},getInputField:function(){return this.display.input},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},
135
+ getGutterElement:function(){return this.display.gutters}};var da=l.optionHandlers={},rb=l.defaults={},Xb=l.Init={toString:function(){return"CodeMirror.Init"}};t("value","",function(a,b){a.setValue(b)},!0);t("mode",null,Ka,!0);t("indentUnit",2,Ka,!0);t("indentWithTabs",!1);t("smartIndent",!0);t("tabSize",4,function(a){Ka(a);ra(a);O(a,!0)},!0);t("electricChars",!0);t("rtlMoveVisually",!Dd);t("theme","default",function(a){Wb(a);sa(a)},!0);t("keyMap","default",function(a){var b=T[a.options.keyMap].style;
136
+ a.display.wrapper.className=a.display.wrapper.className.replace(/\s*cm-keymap-\S+/g,"")+(b?" cm-keymap-"+b:"")});t("extraKeys",null);t("onKeyEvent",null);t("onDragEvent",null);t("lineWrapping",!1,function(a){var b=a.view.doc,c=Z(a.display);if(a.options.lineWrapping){a.display.wrapper.className=a.display.wrapper.className+" CodeMirror-wrap";var d=a.display.scroller.clientWidth/kc(a.display)-3;b.iter(0,b.size,function(a){if(a.height!=0){var b=Math.ceil(a.text.length/d)||1;b!=1&&I(a,b*c)}});a.display.sizer.style.minWidth=
137
+ ""}else{a.display.wrapper.className=a.display.wrapper.className.replace(" CodeMirror-wrap","");Yb(a.view);b.iter(0,b.size,function(a){a.height!=0&&I(a,c)})}F(a,0,b.size);ra(a);setTimeout(function(){Zb(a.display,a.view.doc.height)},100)},!0);t("gutters",[],function(a){sb(a.options);sa(a)},!0);t("fixedGutter",!0,function(a,b){a.display.gutters.style.left=b?zb(a.display)+"px":"0";a.refresh()},!0);t("lineNumbers",!1,function(a){sb(a.options);sa(a)},!0);t("firstLineNumber",1,sa,!0);t("lineNumberFormatter",
138
+ function(a){return a},sa,!0);t("showCursorWhenSelecting",!1,Ab,!0);t("readOnly",!1,function(a,b){if(b=="nocursor"){ub(a);a.display.input.blur()}else b||ca(a,true)});t("dragDrop",!0);t("cursorBlinkRate",530);t("cursorHeight",1);t("workTime",100);t("workDelay",100);t("flattenSpans",!0);t("pollInterval",100);t("undoDepth",40);t("viewportMargin",10,function(a){a.refresh()},!0);t("tabindex",null,function(a,b){a.display.input.tabIndex=b||""});t("autofocus",null);var Wc=l.modes={},Tb=l.mimeModes={};l.defineMode=
139
+ function(a,b){!l.defaults.mode&&"null"!=a&&(l.defaults.mode=a);if(2<arguments.length){b.dependencies=[];for(var c=2;c<arguments.length;++c)b.dependencies.push(arguments[c])}Wc[a]=b};l.defineMIME=function(a,b){Tb[a]=b};l.resolveMode=function(a){if("string"==typeof a&&Tb.hasOwnProperty(a))a=Tb[a];else if("string"==typeof a&&/^[\w\-]+\/[\w\-]+\+xml$/.test(a))return l.resolveMode("application/xml");return"string"==typeof a?{name:a}:a||{name:"null"}};l.getMode=function(a,b){var b=l.resolveMode(b),c=Wc[b.name];
140
+ if(!c)return l.getMode(a,"text/plain");c=c(a,b);if(Ha.hasOwnProperty(b.name)){var d=Ha[b.name],e;for(e in d)d.hasOwnProperty(e)&&(c.hasOwnProperty(e)&&(c["_"+e]=c[e]),c[e]=d[e])}c.name=b.name;return c};l.defineMode("null",function(){return{token:function(a){a.skipToEnd()}}});l.defineMIME("text/plain","null");var Ha=l.modeExtensions={};l.extendMode=function(a,b){var c=Ha.hasOwnProperty(a)?Ha[a]:Ha[a]={},d;for(d in b)b.hasOwnProperty(d)&&(c[d]=b[d])};l.defineExtension=function(a,b){l.prototype[a]=b};
141
+ l.defineOption=t;var vb=[];l.defineInitHook=function(a){vb.push(a)};l.copyState=ja;l.startState=hc;l.innerMode=function(a,b){for(;a.innerMode;)var c=a.innerMode(b),b=c.state,a=c.mode;return c||{mode:a,state:b}};var Kb=l.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=!u(b,c);!d&&a.getLine(b.line).length==b.ch?a.replaceRange("",b,{line:b.line+1,ch:0},"delete"):a.replaceRange("",b,d?c:{line:b.line},
142
+ "delete")},deleteLine:function(a){var b=a.getCursor().line;a.replaceRange("",{line:b,ch:0},{line:b},"delete")},undo:function(a){a.undo()},redo:function(a){a.redo()},goDocStart:function(a){a.extendSelection({line:0,ch:0})},goDocEnd:function(a){a.extendSelection({line:a.lineCount()-1})},goLineStart:function(a){a.extendSelection(Uc(a,a.getCursor().line))},goLineStartSmart:function(a){var b=a.getCursor(),c=Uc(a,b.line),d=a.getLineHandle(c.line),e=P(d);!e||0==e[0].level?(d=Math.max(0,d.text.search(/\S/)),
143
+ a.extendSelection({line:c.line,ch:b.line==c.line&&b.ch<=d&&b.ch?0:d})):a.extendSelection(c)},goLineEnd:function(a){a.extendSelection(Bd(a,a.getCursor().line))},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")},
144
+ goWordLeft:function(a){a.moveH(-1,"word")},goWordRight:function(a){a.moveH(1,"word")},delCharBefore:function(a){a.deleteH(-1,"char")},delCharAfter:function(a){a.deleteH(1,"char")},delWordBefore:function(a){a.deleteH(-1,"word")},delWordAfter: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("\t","end","input")},defaultTab:function(a){a.somethingSelected()?
145
+ a.indentSelection("add"):a.replaceSelection("\t","end","input")},transposeChars:function(a){var b=a.getCursor(),c=a.getLine(b.line);0<b.ch&&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){q(a,function(){a.replaceSelection("\n","end","input");a.indentLine(a.getCursor().line,null,!0)})()},toggleOverwrite:function(a){a.toggleOverwrite()}},T=l.keyMap={};T.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",
146
+ Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite"};T.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",
147
+ "Alt-Right":"goLineEnd","Ctrl-Backspace":"delWordBefore","Ctrl-Delete":"delWordAfter","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"};T.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",
148
+ "Cmd-Left":"goLineStart","Cmd-Right":"goLineEnd","Alt-Backspace":"delWordBefore","Ctrl-Alt-Backspace":"delWordAfter","Alt-Delete":"delWordAfter","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"]};T["default"]=ia?T.macDefault:T.pcDefault;T.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight",
149
+ "Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"};l.isModifierKey=yc;l.fromTextArea=function(a,b){function c(){a.value=m.getValue()}b||(b={});b.value=a.value;!b.tabindex&&a.tabindex&&(b.tabindex=a.tabindex);if(null==b.autofocus){var d=document.body;try{d=document.activeElement}catch(e){}b.autofocus=
150
+ d==a||null!=a.getAttribute("autofocus")&&d==document.body}if(a.form){s(a.form,"submit",c);var f=a.form,g=f.submit;try{f.submit=function i(){c();f.submit=g;f.submit();f.submit=i}}catch(h){}}a.style.display="none";var m=l(function(b){a.parentNode.insertBefore(b,a.nextSibling)},b);m.save=c;m.getTextArea=function(){return a};m.toTextArea=function(){c();a.parentNode.removeChild(m.getWrapperElement());a.style.display="";if(a.form){Q(a.form,"submit",c);if(typeof a.form.submit=="function")a.form.submit=g}};
151
+ return m};Da.prototype={eol:function(){return this.pos>=this.string.length},sol:function(){return 0==this.pos},peek:function(){return this.string.charAt(this.pos)||void 0},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("string"==typeof a?b==a:b&&(a.test?a.test(b):a(b)))return++this.pos,b},eatWhile:function(a){for(var b=this.pos;this.eat(a););return this.pos>b},eatSpace:function(){for(var a=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;
152
+ return this.pos>a},skipToEnd:function(){this.pos=this.string.length},skipTo:function(a){a=this.string.indexOf(a,this.pos);if(-1<a)return this.pos=a,!0},backUp:function(a){this.pos-=a},column:function(){return ka(this.string,this.start,this.tabSize)},indentation:function(){return ka(this.string,null,this.tabSize)},match:function(a,b,c){if("string"==typeof a){if((c?this.string.toLowerCase():this.string).indexOf(c?a.toLowerCase():a,this.pos)==this.pos)return!1!==b&&(this.pos+=a.length),!0}else{if((a=
153
+ this.string.slice(this.pos).match(a))&&0<a.index)return null;a&&!1!==b&&(this.pos+=a[0].length);return a}},current:function(){return this.string.slice(this.start,this.pos)}};l.StringStream=Da;l.TextMarker=Ea;Ea.prototype.clear=function(){if(!this.explicitlyCleared){Ya(this.cm);for(var a=this.cm.view,b=null,c=null,d=0;d<this.lines.length;++d){var e=this.lines[d],f=Fa(e.markedSpans,this);null!=f.to&&(c=G(e));for(var g=e,h=e.markedSpans,m=f,j=void 0,i=0;i<h.length;++i)h[i]!=m&&(j||(j=[])).push(h[i]);
154
+ g.markedSpans=j;null!=f.from?b=G(e):this.collapsed&&!U(e)&&I(e,Z(this.cm.display))}if(this.collapsed&&!this.cm.options.lineWrapping)for(d=0;d<this.lines.length;++d)e=ga(a.doc,this.lines[d]),f=Oa(a.doc,e),f>a.maxLineLength&&(a.maxLine=e,a.maxLineLength=f,a.maxLineChanged=!0);null!=b&&F(this.cm,b,c+1);this.lines.length=0;this.explicitlyCleared=!0;this.collapsed&&this.cm.view.cantEdit&&(this.cm.view.cantEdit=!1,Dc(this.cm));Za(this.cm);fa(this.cm,this,"clear")}};Ea.prototype.find=function(){for(var a,
155
+ b,c=0;c<this.lines.length;++c){var d=this.lines[c],e=Fa(d.markedSpans,this);if(null!=e.from||null!=e.to)d=G(d),null!=e.from&&(a={line:d,ch:e.from}),null!=e.to&&(b={line:d,ch:e.to})}return"bookmark"==this.type?a:a&&{from:a,to:b}};Ea.prototype.getOptions=function(a){var b=this.replacedWith;return{className:this.className,inclusiveLeft:this.inclusiveLeft,inclusiveRight:this.inclusiveRight,atomic:this.atomic,collapsed:this.collapsed,clearOnEnter:this.clearOnEnter,replacedWith:a?b&&b.cloneNode(!0):b,readOnly:this.readOnly,
156
+ startStyle:this.startStyle,endStyle:this.endStyle}};var Pb=l.LineWidget=function(a,b,c){for(var d in c)c.hasOwnProperty(d)&&(this[d]=c[d]);this.cm=a;this.node=b};Pb.prototype.clear=Lc(function(){var a=this.line.widgets,b=G(this.line);if(null!=b&&a){for(var c=0;c<a.length;++c)a[c]==this&&a.splice(c--,1);I(this.line,Math.max(0,this.line.height-Va(this)));F(this.cm,b,b+1)}});Pb.prototype.changed=Lc(function(){var a=this.height;this.height=null;if(a=Va(this)-a)I(this.line,this.line.height+a),a=G(this.line),
157
+ F(this.cm,a,a+1)});var Oc={},Qb=/[\t\u0000-\u0019\u200b\u2028\u2029\uFEFF]/g;Ja.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;var g=f;g.parent=null;Jc(g);fa(c,f,"delete")}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;this.lines=this.lines.slice(0,a).concat(b).concat(this.lines.slice(a));a=0;for(c=b.length;a<
158
+ c;++a)b[a].parent=this},iterN:function(a,b,c){for(b=a+b;a<b;++a)if(c(this.lines[a]))return!0}};Ia.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(0==(b-=g))break;a=0}else a-=f}25>this.size-b&&(a=[],this.collapse(a),this.children=[new Ja(a)],this.children[0].parent=
159
+ this)},collapse:function(a){for(var b=0,c=this.children.length;b<c;++b)this.children[b].collapse(a)},insert:function(a,b){for(var c=0,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&&50<f.lines.length){for(;50<f.lines.length;)a=f.lines.splice(f.lines.length-25,25),a=new Ja(a),f.height-=a.height,
160
+ this.children.splice(d+1,0,a),a.parent=this;this.maybeSpill()}break}a-=g}},maybeSpill:function(){if(!(10>=this.children.length)){var a=this;do{var b=a.children.splice(a.children.length-5,5),b=new Ia(b);if(a.parent){a.size-=b.size;a.height-=b.height;var c=nb(a.parent.children,a);a.parent.children.splice(c+1,0,b)}else c=new Ia(a.children),c.parent=a,a.children=[c,b],a=c;b.parent=a.parent}while(10<a.children.length);a.parent.maybeSpill()}},iter:function(a,b,c){this.iterN(a,b-a,c)},iterN:function(a,b,
161
+ c){for(var d=0,e=this.children.length;d<e;++d){var f=this.children[d],g=f.chunkSize();if(a<g){g=Math.min(b,g-a);if(f.iterN(a,g,c))return!0;if(0==(b-=g))break;a=0}else a-=g}}};l.e_stop=ab;l.e_preventDefault=z;l.e_stopPropagation=Sc;l.on=s;l.off=Q;l.signal=ma;var qa=30,uc=l.Pass={toString:function(){return"CodeMirror.Pass"}};xb.prototype={set:function(a,b){clearTimeout(this.id);this.id=setTimeout(b,a)}};l.countColumn=ka;var pb=[""],Ad=/[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc]/,Fb=/[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\uA670-\uA672\uA674-\uA67D\uA69F]/,
162
+ rd=function(){if(gb)return!1;var a=n("div");return"draggable"in a||"dragDrop"in a}(),ob=/^$/;X?ob=/$'/:Jb?ob=/\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/:Vc&&(ob=/\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/);var qb,Rb,ya=3!="\n\nb".split(/\n/).length?function(a){for(var b=0,c=[],d=a.length;b<=d;){var e=a.indexOf("\n",b);-1==e&&(e=a.length);var f=a.slice(b,"\r"==a.charAt(e-1)?e-1:e),g=f.indexOf("\r");-1!=g?(c.push(f.slice(0,g)),b+=g+1):(c.push(f),b=e+1)}return c}:function(a){return a.split(/\r\n?|\n/)};
163
+ l.splitLines=ya;var ld=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:0!=b.compareEndPoints("StartToEnd",b)},mc=function(){var a=n("div");if("oncopy"in a)return!0;a.setAttribute("oncopy","return;");return"function"==typeof a.oncopy}(),ba={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",
164
+ 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",109:"-",107:"=",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"};l.keyNames=ba;(function(){for(var a=0;10>a;a++)ba[a+48]=""+a;for(a=65;90>=a;a++)ba[a]=
165
+ String.fromCharCode(a);for(a=1;12>=a;a++)ba[a+111]=ba[a+63235]="F"+a})();var yd=function(){function a(a){return 255>=a?b.charAt(a):1424<=a&&1524>=a?"R":1536<=a&&1791>=a?c.charAt(a-1536):1792<=a&&2220>=a?"r":"L"}var b="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL",c="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr",
166
+ d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,e=/[stwN]/,f=/[LRr]/,g=/[Lb1n]/,h=/[1n]/;return function(b){if(!d.test(b))return!1;for(var c=b.length,i=[],k=0,l;k<c;++k)i.push(a(b.charCodeAt(k)));for(var k=0,p="L";k<c;++k)l=i[k],"m"==l?i[k]=p:p=l;k=0;for(p="L";k<c;++k)l=i[k],"1"==l&&"r"==p?i[k]="n":f.test(l)&&(p=l,"r"==l&&(i[k]="R"));k=1;for(p=i[0];k<c-1;++k){l=i[k];if("+"==l&&"1"==p&&"1"==i[k+1])i[k]="1";else if(","==l&&p==i[k+1]&&("1"==p||"n"==p))i[k]=p;p=l}for(k=0;k<c;++k)if(l=i[k],","==l)i[k]="N";
167
+ else if("%"==l){for(p=k+1;p<c&&"%"==i[p];++p);var n=k&&"!"==i[k-1]||p<c-1&&"1"==i[p]?"1":"N";for(l=k;l<p;++l)i[l]=n;k=p-1}k=0;for(p="L";k<c;++k)l=i[k],"L"==p&&"1"==l?i[k]="L":f.test(l)&&(p=l);for(k=0;k<c;++k)if(e.test(i[k])){for(p=k+1;p<c&&e.test(i[p]);++p);l="L"==(p<c-1?i[p]:"L");n="L"==(k?i[k-1]:"L")||l?"L":"R";for(l=k;l<p;++l)i[l]=n;k=p-1}for(var p=[],q,k=0;k<c;)if(g.test(i[k])){l=k;for(++k;k<c&&g.test(i[k]);++k);p.push({from:l,to:k,level:0})}else{var o=k,n=p.length;for(++k;k<c&&"L"!=i[k];++k);
168
+ for(l=o;l<k;)if(h.test(i[l])){o<l&&p.splice(n,0,{from:o,to:l,level:1});o=l;for(++l;l<k&&h.test(i[l]);++l);p.splice(n,0,{from:o,to:l,level:2});o=l}else++l;o<k&&p.splice(n,0,{from:o,to:k,level:1})}if(1==p[0].level&&(q=b.match(/^\s+/)))p[0].from=q[0].length,p.unshift({from:0,to:q[0].length,level:0});if(1==K(p).level&&(q=b.match(/\s+$/)))K(p).to-=q[0].length,p.push({from:c-q[0].length,to:c,level:0});p[0].level!=K(p).level&&p.push({from:c,to:c,level:p[0].level});return p}}();l.version="3.02";return l}();
@@ -1,7 +1,7 @@
1
1
  CodeMirror.defineMode("css",function(n){function g(a){for(var c={},b=0;b<a.length;++b)c[a[b]]=!0;return c}function e(a,c){f=c;return a}function h(a,c){var b=a.next();if("@"==b)return a.eatWhile(/[\w\\\-]/),e("def",a.current());if("/"==b&&a.eat("*"))return c.tokenize=j,j(a,c);if("<"==b&&a.eat("!"))return c.tokenize=k,k(a,c);if("="==b)e(null,"compare");else{if(("~"==b||"|"==b)&&a.eat("="))return e(null,"compare");if('"'==b||"'"==b)return c.tokenize=l(b),c.tokenize(a,c);if("#"==b)return a.eatWhile(/[\w\\\-]/),
2
- e("atom","hash");if("!"==b)return a.match(/^\s*\w*/),e("keyword","important");if(/\d/.test(b))return a.eatWhile(/[\w.%]/),e("number","unit");if("-"===b){if(/\d/.test(a.peek()))return a.eatWhile(/[\w.%]/),e("number","unit");if(a.match(/^[^-]+-/))return e("meta",f)}else{if(/[,+>*\/]/.test(b))return e(null,"select-op");if("."==b&&a.match(/^-?[_a-z][_a-z0-9-]*/i))return e("qualifier",f);if(":"==b)return e("operator",b);if(/[;{}\[\]\(\)]/.test(b))return e(null,b);"u"==b&&a.match("rl(")?(a.backUp(1),c.tokenize=
3
- o):a.eatWhile(/[\w\\\-]/);return e("property","variable")}}}function j(a,c){for(var b=!1,d;null!=(d=a.next());){if(b&&"/"==d){c.tokenize=h;break}b="*"==d}return e("comment","comment")}function k(a,c){for(var b=0,d;null!=(d=a.next());){if(2<=b&&">"==d){c.tokenize=h;break}b="-"==d?b+1:0}return e("comment","comment")}function l(a,c){return function(b,d){for(var f=!1,g;null!=(g=b.next())&&(g!=a||f);)f=!f&&"\\"==g;f||(c&&b.backUp(1),d.tokenize=h);return e("string","string")}}function o(a,c){a.next();c.tokenize=
4
- a.match(/\s*[\"\']/,!1)?h:l(")",!0);return e(null,"(")}var p=n.indentUnit,f,i=g("all aural braille handheld print projection screen tty tv embossed".split(" ")),q=g("width min-width max-width height min-height max-height device-width min-device-width max-device-width device-height min-device-height max-device-height aspect-ratio min-aspect-ratio max-aspect-ratio device-aspect-ratio min-device-aspect-ratio max-device-aspect-ratio color min-color max-color color-index min-color-index max-color-index monochrome min-monochrome max-monochrome resolution min-resolution max-resolution scan grid".split(" ")),
2
+ e("atom","hash");if("!"==b)return a.match(/^\s*\w*/),e("keyword","important");if(/\d/.test(b))return a.eatWhile(/[\w.%]/),e("number","unit");if("-"===b){if(/\d/.test(a.peek()))return a.eatWhile(/[\w.%]/),e("number","unit");if(a.match(/^[^-]+-/))return e("meta","meta")}else{if(/[,+>*\/]/.test(b))return e(null,"select-op");if("."==b&&a.match(/^-?[_a-z][_a-z0-9-]*/i))return e("qualifier","qualifier");if(":"==b)return e("operator",b);if(/[;{}\[\]\(\)]/.test(b))return e(null,b);"u"==b&&a.match("rl(")?
3
+ (a.backUp(1),c.tokenize=o):a.eatWhile(/[\w\\\-]/);return e("property","variable")}}}function j(a,c){for(var b=!1,d;null!=(d=a.next());){if(b&&"/"==d){c.tokenize=h;break}b="*"==d}return e("comment","comment")}function k(a,c){for(var b=0,d;null!=(d=a.next());){if(2<=b&&">"==d){c.tokenize=h;break}b="-"==d?b+1:0}return e("comment","comment")}function l(a,c){return function(b,d){for(var f=!1,g;null!=(g=b.next())&&(g!=a||f);)f=!f&&"\\"==g;f||(c&&b.backUp(1),d.tokenize=h);return e("string","string")}}function o(a,
4
+ c){a.next();c.tokenize=a.match(/\s*[\"\']/,!1)?h:l(")",!0);return e(null,"(")}var p=n.indentUnit,f,i=g("all aural braille handheld print projection screen tty tv embossed".split(" ")),q=g("width min-width max-width height min-height max-height device-width min-device-width max-device-width device-height min-device-height max-device-height aspect-ratio min-aspect-ratio max-aspect-ratio device-aspect-ratio min-device-aspect-ratio max-device-aspect-ratio color min-color max-color color-index min-color-index max-color-index monochrome min-monochrome max-monochrome resolution min-resolution max-resolution scan grid".split(" ")),
5
5
  m=g("align-content align-items align-self alignment-adjust alignment-baseline anchor-point animation animation-delay animation-direction animation-duration animation-iteration-count animation-name animation-play-state animation-timing-function appearance azimuth backface-visibility background background-attachment background-clip background-color background-image background-origin background-position background-repeat background-size baseline-shift binding bleed bookmark-label bookmark-level bookmark-state bookmark-target border border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice border-image-source border-image-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-spacing border-style border-top border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width border-width bottom box-decoration-break box-shadow box-sizing break-after break-before break-inside caption-side clear clip color color-profile column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns content counter-increment counter-reset crop cue cue-after cue-before cursor direction display dominant-baseline drop-initial-after-adjust drop-initial-after-align drop-initial-before-adjust drop-initial-before-align drop-initial-size drop-initial-value elevation empty-cells fit fit-position flex flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap float float-offset font font-feature-settings font-family font-kerning font-language-override font-size font-size-adjust font-stretch font-style font-synthesis font-variant font-variant-alternates font-variant-caps font-variant-east-asian font-variant-ligatures font-variant-numeric font-variant-position font-weight grid-cell grid-column grid-column-align grid-column-sizing grid-column-span grid-columns grid-flow grid-row grid-row-align grid-row-sizing grid-row-span grid-rows grid-template hanging-punctuation height hyphens icon image-orientation image-rendering image-resolution inline-box-align justify-content left letter-spacing line-break line-height line-stacking line-stacking-ruby line-stacking-shift line-stacking-strategy list-style list-style-image list-style-position list-style-type margin margin-bottom margin-left margin-right margin-top marker-offset marks marquee-direction marquee-loop marquee-play-count marquee-speed marquee-style max-height max-width min-height min-width move-to nav-down nav-index nav-left nav-right nav-up opacity order orphans outline outline-color outline-offset outline-style outline-width overflow overflow-style overflow-wrap overflow-x overflow-y padding padding-bottom padding-left padding-right padding-top page page-break-after page-break-before page-break-inside page-policy pause pause-after pause-before perspective perspective-origin pitch pitch-range play-during position presentation-level punctuation-trim quotes rendering-intent resize rest rest-after rest-before richness right rotation rotation-point ruby-align ruby-overhang ruby-position ruby-span size speak speak-as speak-header speak-numeral speak-punctuation speech-rate stress string-set tab-size table-layout target target-name target-new target-position text-align text-align-last text-decoration text-decoration-color text-decoration-line text-decoration-skip text-decoration-style text-emphasis text-emphasis-color text-emphasis-position text-emphasis-style text-height text-indent text-justify text-outline text-shadow text-space-collapse text-transform text-underline-position text-wrap top transform transform-origin transform-style transition transition-delay transition-duration transition-property transition-timing-function unicode-bidi vertical-align visibility voice-balance voice-duration voice-family voice-pitch voice-range voice-rate voice-stress voice-volume volume white-space widows width word-break word-spacing word-wrap z-index".split(" ")),
6
6
  r=g("black silver gray white maroon red purple fuchsia green lime olive yellow navy blue teal aqua".split(" ")),s=g("above absolute activeborder activecaption afar after-white-space ahead alias all all-scroll alternate always amharic amharic-abegede antialiased appworkspace arabic-indic armenian asterisks auto avoid background backwards baseline below bidi-override binary bengali blink block block-axis bold bolder border border-box both bottom break-all break-word button button-bevel buttonface buttonhighlight buttonshadow buttontext cambodian capitalize caps-lock-indicator caption captiontext caret cell center checkbox circle cjk-earthly-branch cjk-heavenly-stem cjk-ideographic clear clip close-quote col-resize collapse compact condensed contain content content-box context-menu continuous copy cover crop cross crosshair currentcolor cursive dashed decimal decimal-leading-zero default default-button destination-atop destination-in destination-out destination-over devanagari disc discard document dot-dash dot-dot-dash dotted double down e-resize ease ease-in ease-in-out ease-out element ellipsis embed end ethiopic ethiopic-abegede ethiopic-abegede-am-et ethiopic-abegede-gez ethiopic-abegede-ti-er ethiopic-abegede-ti-et ethiopic-halehame-aa-er ethiopic-halehame-aa-et ethiopic-halehame-am-et ethiopic-halehame-gez ethiopic-halehame-om-et ethiopic-halehame-sid-et ethiopic-halehame-so-et ethiopic-halehame-ti-er ethiopic-halehame-ti-et ethiopic-halehame-tig ew-resize expanded extra-condensed extra-expanded fantasy fast fill fixed flat footnotes forwards from geometricPrecision georgian graytext groove gujarati gurmukhi hand hangul hangul-consonant hebrew help hidden hide higher highlight highlighttext hiragana hiragana-iroha horizontal hsl hsla icon ignore inactiveborder inactivecaption inactivecaptiontext infinite infobackground infotext inherit initial inline inline-axis inline-block inline-table inset inside intrinsic invert italic justify kannada katakana katakana-iroha khmer landscape lao large larger left level lighter line-through linear lines list-item listbox listitem local logical loud lower lower-alpha lower-armenian lower-greek lower-hexadecimal lower-latin lower-norwegian lower-roman lowercase ltr malayalam match media-controls-background media-current-time-display media-fullscreen-button media-mute-button media-play-button media-return-to-realtime-button media-rewind-button media-seek-back-button media-seek-forward-button media-slider media-sliderthumb media-time-remaining-display media-volume-slider media-volume-slider-container media-volume-sliderthumb medium menu menulist menulist-button menulist-text menulist-textfield menutext message-box middle min-intrinsic mix mongolian monospace move multiple myanmar n-resize narrower navy ne-resize nesw-resize no-close-quote no-drop no-open-quote no-repeat none normal not-allowed nowrap ns-resize nw-resize nwse-resize oblique octal open-quote optimizeLegibility optimizeSpeed oriya oromo outset outside overlay overline padding padding-box painted paused persian plus-darker plus-lighter pointer portrait pre pre-line pre-wrap preserve-3d progress push-button radio read-only read-write read-write-plaintext-only relative repeat repeat-x repeat-y reset reverse rgb rgba ridge right round row-resize rtl run-in running s-resize sans-serif scroll scrollbar se-resize searchfield searchfield-cancel-button searchfield-decoration searchfield-results-button searchfield-results-decoration semi-condensed semi-expanded separate serif show sidama single skip-white-space slide slider-horizontal slider-vertical sliderthumb-horizontal sliderthumb-vertical slow small small-caps small-caption smaller solid somali source-atop source-in source-out source-over space square square-button start static status-bar stretch stroke sub subpixel-antialiased super sw-resize table table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group telugu text text-bottom text-top textarea textfield thai thick thin threeddarkshadow threedface threedhighlight threedlightshadow threedshadow tibetan tigre tigrinya-er tigrinya-er-abegede tigrinya-et tigrinya-et-abegede to top transparent ultra-condensed ultra-expanded underline up upper-alpha upper-armenian upper-greek upper-hexadecimal upper-latin upper-norwegian upper-roman uppercase urdu url vertical vertical-text visible visibleFill visiblePainted visibleStroke visual w-resize wait wave white wider window windowframe windowtext x-large x-small xor xx-large xx-small yellow".split(" "));
7
7
  return{startState:function(a){return{tokenize:h,baseIndent:a||0,stack:[]}},token:function(a,c){if(c.tokenize==h&&a.eatSpace())return null;var b=c.tokenize(a,c),d=c.stack[c.stack.length-1];"property"==b?"propertyValue"==d?b=s[a.current()]?"string-2":r[a.current()]?"keyword":"variable-2":"rule"==d?m[a.current()]||(b+=" error"):!d||"@media{"==d?b="tag":"@media"==d?b=i[a.current()]?"attribute":/^(only|not)$/i.test(a.current())?"keyword":"and"==a.current().toLowerCase()?"error":q[a.current()]?"error":
@@ -1,13 +1,14 @@
1
- CodeMirror.defineMode("javascript",function(R,q){var v,j,n,w;function E(a,d){for(var c=!1,f;null!=(f=a.next());){if(f==d&&!c)return!1;c=!c&&"\\"==f}return c}function k(a,d,c){r=a;F=c;return d}function s(a,d){var c=a.next();if('"'==c||"'"==c)return c=S(c),d.tokenize=c,c(a,d);if(/[\[\]{}\(\),;\:\.]/.test(c))return k(c);if("0"==c&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),k("number","number");if(/\d/.test(c)||"-"==c&&a.eat(/\d/))return a.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),k("number","number");
1
+ CodeMirror.defineMode("javascript",function(R,p){var v,j,n,w;function E(a,d){for(var c=!1,f;null!=(f=a.next());){if(f==d&&!c)return!1;c=!c&&"\\"==f}return c}function k(a,d,c){r=a;F=c;return d}function s(a,d){var c=a.next();if('"'==c||"'"==c)return c=S(c),d.tokenize=c,c(a,d);if(/[\[\]{}\(\),;\:\.]/.test(c))return k(c);if("0"==c&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),k("number","number");if(/\d/.test(c)||"-"==c&&a.eat(/\d/))return a.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),k("number","number");
2
2
  if("/"==c){if(a.eat("*"))return c=G,d.tokenize=c,c(a,d);if(a.eat("/"))return a.skipToEnd(),k("comment","comment");if("operator"==d.lastType||"keyword c"==d.lastType||/^[\[{}\(,;:]$/.test(d.lastType))return E(a,"/"),a.eatWhile(/[gimy]/),k("regexp","string-2");a.eatWhile(x);return k("operator",null,a.current())}if("#"==c)return a.skipToEnd(),k("error","error");if(x.test(c))return a.eatWhile(x),k("operator",null,a.current());a.eatWhile(/[\w\$_]/);var c=a.current(),f=H.propertyIsEnumerable(c)&&H[c];return f&&
3
- "."!=d.lastType?k(f.type,f.style,c):k("variable","variable",c)}function S(a){return function(d,c){E(d,a)||(c.tokenize=s);return k("string","string")}}function G(a,d){for(var c=!1,f;f=a.next();){if("/"==f&&c){d.tokenize=s;break}c="*"==f}return k("comment","comment")}function I(a,d,c,f,b,e){this.indented=a;this.column=d;this.type=c;this.prev=b;this.info=e;null!=f&&(this.align=f)}function l(){for(var a=arguments.length-1;0<=a;a--)v.push(arguments[a])}function b(){l.apply(null,arguments);return!0}function y(a){var d=
4
- j;if(d.context){n="def";for(var c=d.localVars;c;c=c.next)if(c.name==a)return;d.localVars={name:a,next:d.localVars}}}function J(){j.context={prev:j.context,vars:j.localVars};j.localVars=T}function K(){j.localVars=j.context.vars;j.context=j.context.prev}function i(a,d){var c=function(){var c=j;c.lexical=new I(c.indented,w.column(),a,null,c.lexical,d)};c.lex=!0;return c}function e(){var a=j;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function g(a){return function(d){return d==
5
- a?b():";"==a?l():b(arguments.callee)}}function o(a){return"var"==a?b(i("vardef"),z,g(";"),e):"keyword a"==a?b(i("form"),h,o,e):"keyword b"==a?b(i("form"),o,e):"{"==a?b(i("}"),A,e):";"==a?b():"function"==a?b(B):"for"==a?b(i("form"),g("("),i(")"),U,g(")"),e,o,e):"variable"==a?b(i("stat"),V):"switch"==a?b(i("form"),h,i("}","switch"),g("{"),A,e,e):"case"==a?b(h,g(":")):"default"==a?b(g(":")):"catch"==a?b(i("form"),J,g("("),L,g(")"),o,e,K):l(i("stat"),h,g(";"),e)}function h(a){return M.hasOwnProperty(a)?
6
- b(m):"function"==a?b(B):"keyword c"==a?b(N):"("==a?b(i(")"),N,g(")"),e,m):"operator"==a?b(h):"["==a?b(i("]"),t(h,"]"),e,m):"{"==a?b(i("}"),t(W,"}"),e,m):b()}function N(a){return a.match(/[;\}\)\],]/)?l():l(h)}function m(a,d){if("operator"==a&&/\+\+|--/.test(d))return b(m);if("operator"==a&&"?"==d)return b(h,g(":"),h);if(";"!=a){if("("==a)return b(i(")"),t(h,")"),e,m);if("."==a)return b(X,m);if("["==a)return b(i("]"),h,g("]"),e,m)}}function V(a){return":"==a?b(e,o):l(m,g(";"),e)}function X(a){if("variable"==
7
- a)return n="property",b()}function W(a){"variable"==a&&(n="property");if(M.hasOwnProperty(a))return b(g(":"),h)}function t(a,d){function c(f){return","==f?b(a,c):f==d?b():b(g(d))}return function(f){return f==d?b():l(a,c)}}function A(a){return"}"==a?b():l(o,A)}function O(a){return":"==a?b(Y):l()}function Y(a){return"variable"==a?(n="variable-3",b()):l()}function z(a,d){return"variable"==a?(y(d),C?b(O,D):b(D)):l()}function D(a,d){if("="==d)return b(h,D);if(","==a)return b(z)}function U(a){return"var"==
8
- a?b(z,g(";"),u):";"==a?b(u):"variable"==a?b(Z):b(u)}function Z(a,d){return"in"==d?b(h):b(m,u)}function u(a,d){return";"==a?b(P):"in"==d?b(h):b(h,g(";"),P)}function P(a){")"!=a&&b(h)}function B(a,d){if("variable"==a)return y(d),b(B);if("("==a)return b(i(")"),J,t(L,")"),e,o,K)}function L(a,d){if("variable"==a)return y(d),C?b(O):b()}var p=R.indentUnit,Q=q.json,C=q.typescript,H=function(){function a(a){return{type:a,style:"keyword"}}var d=a("keyword a"),c=a("keyword b"),b=a("keyword c"),e=a("operator"),
9
- h={type:"atom",style:"atom"},d={"if":d,"while":d,"with":d,"else":c,"do":c,"try":c,"finally":c,"return":b,"break":b,"continue":b,"new":b,"delete":b,"throw":b,"var":a("var"),"const":a("var"),let:a("var"),"function":a("function"),"catch":a("catch"),"for":a("for"),"switch":a("switch"),"case":a("case"),"default":a("default"),"in":e,"typeof":e,"instanceof":e,"true":h,"false":h,"null":h,undefined:h,NaN:h,Infinity:h};if(C){var c={type:"variable",style:"variable-3"},c={"interface":a("interface"),"class":a("class"),
10
- "extends":a("extends"),constructor:a("constructor"),"public":a("public"),"private":a("private"),"protected":a("protected"),"static":a("static"),"super":a("super"),string:c,number:c,bool:c,any:c},i;for(i in c)d[i]=c[i]}return d}(),x=/[+\-*&%=<>!?|]/,r,F,M={atom:!0,number:!0,variable:!0,string:!0,regexp:!0};v=n=j=null;w=void 0;var T={name:"this",next:{name:"arguments"}};e.lex=!0;return{startState:function(a){return{tokenize:s,lastType:null,cc:[],lexical:new I((a||0)-p,0,"block",!1),localVars:q.localVars,
11
- context:q.localVars&&{vars:q.localVars},indented:0}},token:function(a,d){a.sol()&&(d.lexical.hasOwnProperty("align")||(d.lexical.align=!1),d.indented=a.indentation());if(a.eatSpace())return null;var c=d.tokenize(a,d);if("comment"==r)return c;d.lastType=r;var b;a:{var e=r,i=F,g=d.cc;j=d;w=a;n=null;v=g;d.lexical.hasOwnProperty("align")||(d.lexical.align=!0);for(;;)if((g.length?g.pop():Q?h:o)(e,i)){for(;g.length&&g[g.length-1].lex;)g.pop()();if(n){b=n;break a}if(b="variable"==e)b:{for(b=d.localVars;b;b=
12
- b.next)if(b.name==i){b=!0;break b}b=void 0}if(b){b="variable-2";break a}b=c;break a}}return b},indent:function(a,b){if(a.tokenize==G)return CodeMirror.Pass;if(a.tokenize!=s)return 0;var c=b&&b.charAt(0),f=a.lexical;"stat"==f.type&&"}"==c&&(f=f.prev);var e=f.type,g=c==e;return"vardef"==e?f.indented+("operator"==a.lastType||","==a.lastType?4:0):"form"==e&&"{"==c?f.indented:"form"==e?f.indented+p:"stat"==e?f.indented+("operator"==a.lastType||","==a.lastType?p:0):"switch"==f.info&&!g?f.indented+(/^(?:case|default)\b/.test(b)?
13
- p:2*p):f.align?f.column+(g?0:1):f.indented+(g?0:p)},electricChars:":{}",jsonMode:Q}});CodeMirror.defineMIME("text/javascript","javascript");CodeMirror.defineMIME("application/json",{name:"javascript",json:!0});CodeMirror.defineMIME("text/typescript",{name:"javascript",typescript:!0});CodeMirror.defineMIME("application/typescript",{name:"javascript",typescript:!0});
3
+ "."!=d.lastType?k(f.type,f.style,c):k("variable","variable",c)}function S(a){return function(d,c){E(d,a)||(c.tokenize=s);return k("string","string")}}function G(a,d){for(var c=!1,f;f=a.next();){if("/"==f&&c){d.tokenize=s;break}c="*"==f}return k("comment","comment")}function I(a,d,c,f,b,e){this.indented=a;this.column=d;this.type=c;this.prev=b;this.info=e;null!=f&&(this.align=f)}function l(){for(var a=arguments.length-1;0<=a;a--)v.push(arguments[a])}function b(){l.apply(null,arguments);return!0}function y(a){function d(c){for(;c;c=
4
+ c.next)if(c.name==a)return!0;return!1}var c=j;c.context?(n="def",d(c.localVars)||(c.localVars={name:a,next:c.localVars})):d(c.globalVars)||(c.globalVars={name:a,next:c.globalVars})}function J(){j.context={prev:j.context,vars:j.localVars};j.localVars=T}function K(){j.localVars=j.context.vars;j.context=j.context.prev}function i(a,d){var c=function(){var c=j;c.lexical=new I(c.indented,w.column(),a,null,c.lexical,d)};c.lex=!0;return c}function e(){var a=j;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=
5
+ a.lexical.indented),a.lexical=a.lexical.prev)}function g(a){return function(d){return d==a?b():";"==a?l():b(arguments.callee)}}function o(a){return"var"==a?b(i("vardef"),z,g(";"),e):"keyword a"==a?b(i("form"),h,o,e):"keyword b"==a?b(i("form"),o,e):"{"==a?b(i("}"),A,e):";"==a?b():"function"==a?b(B):"for"==a?b(i("form"),g("("),i(")"),U,g(")"),e,o,e):"variable"==a?b(i("stat"),V):"switch"==a?b(i("form"),h,i("}","switch"),g("{"),A,e,e):"case"==a?b(h,g(":")):"default"==a?b(g(":")):"catch"==a?b(i("form"),
6
+ J,g("("),L,g(")"),o,e,K):l(i("stat"),h,g(";"),e)}function h(a){return M.hasOwnProperty(a)?b(m):"function"==a?b(B):"keyword c"==a?b(N):"("==a?b(i(")"),N,g(")"),e,m):"operator"==a?b(h):"["==a?b(i("]"),t(h,"]"),e,m):"{"==a?b(i("}"),t(W,"}"),e,m):b()}function N(a){return a.match(/[;\}\)\],]/)?l():l(h)}function m(a,d){if("operator"==a&&/\+\+|--/.test(d))return b(m);if("operator"==a&&"?"==d)return b(h,g(":"),h);if(";"!=a){if("("==a)return b(i(")"),t(h,")"),e,m);if("."==a)return b(X,m);if("["==a)return b(i("]"),
7
+ h,g("]"),e,m)}}function V(a){return":"==a?b(e,o):l(m,g(";"),e)}function X(a){if("variable"==a)return n="property",b()}function W(a){"variable"==a&&(n="property");if(M.hasOwnProperty(a))return b(g(":"),h)}function t(a,d){function c(f){return","==f?b(a,c):f==d?b():b(g(d))}return function(f){return f==d?b():l(a,c)}}function A(a){return"}"==a?b():l(o,A)}function O(a){return":"==a?b(Y):l()}function Y(a){return"variable"==a?(n="variable-3",b()):l()}function z(a,d){return"variable"==a?(y(d),C?b(O,D):b(D)):
8
+ l()}function D(a,d){if("="==d)return b(h,D);if(","==a)return b(z)}function U(a){return"var"==a?b(z,g(";"),u):";"==a?b(u):"variable"==a?b(Z):b(u)}function Z(a,d){return"in"==d?b(h):b(m,u)}function u(a,d){return";"==a?b(P):"in"==d?b(h):b(h,g(";"),P)}function P(a){")"!=a&&b(h)}function B(a,d){if("variable"==a)return y(d),b(B);if("("==a)return b(i(")"),J,t(L,")"),e,o,K)}function L(a,d){if("variable"==a)return y(d),C?b(O):b()}var q=R.indentUnit,Q=p.json,C=p.typescript,H=function(){function a(a){return{type:a,
9
+ style:"keyword"}}var d=a("keyword a"),c=a("keyword b"),b=a("keyword c"),e=a("operator"),h={type:"atom",style:"atom"},d={"if":d,"while":d,"with":d,"else":c,"do":c,"try":c,"finally":c,"return":b,"break":b,"continue":b,"new":b,"delete":b,"throw":b,"var":a("var"),"const":a("var"),let:a("var"),"function":a("function"),"catch":a("catch"),"for":a("for"),"switch":a("switch"),"case":a("case"),"default":a("default"),"in":e,"typeof":e,"instanceof":e,"true":h,"false":h,"null":h,undefined:h,NaN:h,Infinity:h};
10
+ if(C){var c={type:"variable",style:"variable-3"},c={"interface":a("interface"),"class":a("class"),"extends":a("extends"),constructor:a("constructor"),"public":a("public"),"private":a("private"),"protected":a("protected"),"static":a("static"),"super":a("super"),string:c,number:c,bool:c,any:c},i;for(i in c)d[i]=c[i]}return d}(),x=/[+\-*&%=<>!?|]/,r,F,M={atom:!0,number:!0,variable:!0,string:!0,regexp:!0};v=n=j=null;w=void 0;var T={name:"this",next:{name:"arguments"}};e.lex=!0;return{startState:function(a){return{tokenize:s,
11
+ lastType:null,cc:[],lexical:new I((a||0)-q,0,"block",!1),localVars:p.localVars,globalVars:p.globalVars,context:p.localVars&&{vars:p.localVars},indented:0}},token:function(a,d){a.sol()&&(d.lexical.hasOwnProperty("align")||(d.lexical.align=!1),d.indented=a.indentation());if(a.eatSpace())return null;var c=d.tokenize(a,d);if("comment"==r)return c;d.lastType=r;var b;a:{var e=r,i=F,g=d.cc;j=d;w=a;n=null;v=g;d.lexical.hasOwnProperty("align")||(d.lexical.align=!0);for(;;)if((g.length?g.pop():Q?h:o)(e,i)){for(;g.length&&
12
+ g[g.length-1].lex;)g.pop()();if(n){b=n;break a}if(b="variable"==e)b:{for(b=d.localVars;b;b=b.next)if(b.name==i){b=!0;break b}b=void 0}if(b){b="variable-2";break a}b=c;break a}}return b},indent:function(a,b){if(a.tokenize==G)return CodeMirror.Pass;if(a.tokenize!=s)return 0;var c=b&&b.charAt(0),f=a.lexical;"stat"==f.type&&"}"==c&&(f=f.prev);var e=f.type,g=c==e;return"vardef"==e?f.indented+("operator"==a.lastType||","==a.lastType?4:0):"form"==e&&"{"==c?f.indented:"form"==e?f.indented+q:"stat"==e?f.indented+
13
+ ("operator"==a.lastType||","==a.lastType?q:0):"switch"==f.info&&!g?f.indented+(/^(?:case|default)\b/.test(b)?q:2*q):f.align?f.column+(g?0:1):f.indented+(g?0:q)},electricChars:":{}",jsonMode:Q}});CodeMirror.defineMIME("text/javascript","javascript");CodeMirror.defineMIME("text/ecmascript","javascript");CodeMirror.defineMIME("application/javascript","javascript");CodeMirror.defineMIME("application/ecmascript","javascript");CodeMirror.defineMIME("application/json",{name:"javascript",json:!0});
14
+ CodeMirror.defineMIME("text/typescript",{name:"javascript",typescript:!0});CodeMirror.defineMIME("application/typescript",{name:"javascript",typescript:!0});