CodeMirror.defineMode("javascript",function(U,q){function J(a,d){for(var b=!1,e;null!=(e=a.next());){if(e==d&&!b)return!1;b=!b&&"\\"==e}return b}function n(a,d,b){s=a;t=b;return d}function u(a,d){var b=a.next();if('"'==b||"'"==b)return b=V(b),d.tokenize=b,b(a,d);if(/[\[\]{}\(\),;\:\.]/.test(b))return n(b);if("0"==b&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),n("number","number");if(/\d/.test(b)||"-"==b&&a.eat(/\d/))return a.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),n("number","number");if("/"==b){if(a.eat("*"))return b=
A,d.tokenize=b,b(a,d);if(a.eat("/"))return a.skipToEnd(),n("comment","comment");if("operator"==d.lastType||"keyword c"==d.lastType||/^[\[{}\(,;:]$/.test(d.lastType))return J(a,"/"),a.eatWhile(/[gimy]/),n("regexp","string-2");a.eatWhile(B);return n("operator",null,a.current())}if("#"==b)return a.skipToEnd(),n("error","error");if(B.test(b))return a.eatWhile(B),n("operator",null,a.current());a.eatWhile(/[\w\$_]/);var b=a.current(),e=K.propertyIsEnumerable(b)&&K[b];return e&&"."!=d.lastType?n(e.type,
e.style,b):n("variable","variable",b)}function V(a){return function(d,b){J(d,a)||(b.tokenize=u);return n("string","string")}}function A(a,d){for(var b=!1,e;e=a.next();){if("/"==e&&b){d.tokenize=u;break}b="*"==e}return n("comment","comment")}function C(a,d,b,e,c,f){this.indented=a;this.column=d;this.type=b;this.prev=c;this.info=f;null!=e&&(this.align=e)}function m(){for(var a=arguments.length-1;0<=a;a--)f.cc.push(arguments[a])}function c(){m.apply(null,arguments);return!0}function D(a){function d(b){for(;b;b=
b.next)if(b.name==a)return!0;return!1}var b=f.state;b.context?(f.marked="def",d(b.localVars)||(b.localVars={name:a,next:b.localVars})):d(b.globalVars)||(b.globalVars={name:a,next:b.globalVars})}function L(){f.state.context={prev:f.state.context,vars:f.state.localVars};f.state.localVars=W}function M(){f.state.localVars=f.state.context.vars;f.state.context=f.state.context.prev}function l(a,d){var b=function(){var b=f.state;b.lexical=new C(b.indented,f.stream.column(),a,null,b.lexical,d)};b.lex=!0;return b}
function g(){var a=f.state;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function h(a){return function(d){return d==a?c():";"==a?m():c(arguments.callee)}}function p(a){return"var"==a?c(l("vardef"),E,h(";"),g):"keyword a"==a?c(l("form"),k,p,g):"keyword b"==a?c(l("form"),p,g):"{"==a?c(l("}"),F,g):";"==a?c():"if"==a?c(l("form"),k,p,g,X(f.state.indented)):"function"==a?c(v):"for"==a?c(l("form"),h("("),l(")"),Y,h(")"),g,p,g):"variable"==a?c(l("stat"),Z):
"switch"==a?c(l("form"),k,l("}","switch"),h("{"),F,g,g):"case"==a?c(k,h(":")):"default"==a?c(h(":")):"catch"==a?c(l("form"),L,h("("),N,h(")"),p,g,M):m(l("stat"),k,h(";"),g)}function k(a){return O(a,w)}function x(a){return O(a,G)}function O(a,d){return P.hasOwnProperty(a)?c(d):"function"==a?c(v):"keyword c"==a?c(Q):"("==a?c(l(")"),Q,h(")"),g,d):"operator"==a?c(k):"["==a?c(l("]"),y(x,"]"),g,d):"{"==a?c(l("}"),y($,"}"),g,d):c()}function Q(a){return a.match(/[;\}\)\],]/)?m():m(k)}function w(a,d){return","==
a?c(k):G(a,d,w)}function G(a,d,b){b||(b=G);if("operator"==a)return/\+\+|--/.test(d)?c(b):"?"==d?c(k,h(":"),k):c(k);if(";"!=a){if("("==a)return c(l(")","call"),y(x,")"),g,b);if("."==a)return c(aa,b);if("["==a)return c(l("]"),k,h("]"),g,b)}}function Z(a){return":"==a?c(g,p):m(w,h(";"),g)}function aa(a){if("variable"==a)return f.marked="property",c()}function $(a,d){if("variable"==a){if(f.marked="property","get"==d||"set"==d)return c(ba)}else if("number"==a||"string"==a)f.marked=a+" property";if(P.hasOwnProperty(a))return c(h(":"),
x)}function ba(a){if(":"==a)return c(k);if("variable"!=a)return c(h(":"),k);f.marked="property";return c(v)}function y(a,d){function b(e){return","==e?(e=f.state.lexical,"call"==e.info&&(e.pos=(e.pos||0)+1),c(a,b)):e==d?c():c(h(d))}return function(e){return e==d?c():m(a,b)}}function F(a){return"}"==a?c():m(p,F)}function R(a){return":"==a?c(ca):m()}function ca(a){return"variable"==a?(f.marked="variable-3",c()):m()}function E(a,d){return"variable"==a?(D(d),H?c(R,I):c(I)):m()}function I(a,d){if("="==
d)return c(x,I);if(","==a)return c(E)}function X(a){return function(d,b){return"keyword b"==d&&"else"==b?(f.state.lexical=new C(a,0,"form",null,f.state.lexical),c(p,g)):m()}}function Y(a){return"var"==a?c(E,h(";"),z):";"==a?c(z):"variable"==a?c(da):m(k,h(";"),z)}function da(a,d){return"in"==d?c(k):c(w,z)}function z(a,d){return";"==a?c(S):"in"==d?c(k):m(k,h(";"),S)}function S(a){")"!=a&&c(k)}function v(a,d){if("variable"==a)return D(d),c(v);if("("==a)return c(l(")"),L,y(N,")"),g,p,M)}function N(a,
d){if("variable"==a)return D(d),H?c(R):c()}var r=U.indentUnit,T=q.json,H=q.typescript,K=function(){function a(a){return{type:a,style:"keyword"}}var d=a("keyword a"),b=a("keyword b"),c=a("keyword c"),f=a("operator"),g={type:"atom",style:"atom"},d={"if":a("if"),"while":d,"with":d,"else":b,"do":b,"try":b,"finally":b,"return":c,"break":c,"continue":c,"new":c,"delete":c,"throw":c,"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":f,"typeof":f,"instanceof":f,"true":g,"false":g,"null":g,undefined:g,NaN:g,Infinity:g,"this":a("this")};if(H){var b={type:"variable",style:"variable-3"},b={"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:b,number:b,bool:b,any:b},k;for(k in b)d[k]=b[k]}return d}(),B=/[+\-*&%=<>!?|~^]/,s,t,
P={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0},f={state:null,column:null,marked:null,cc:null},W={name:"this",next:{name:"arguments"}};g.lex=!0;return{startState:function(a){return{tokenize:u,lastType:null,cc:[],lexical:new C((a||0)-r,0,"block",!1),localVars:q.localVars,globalVars:q.globalVars,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(d.tokenize!=A&&a.eatSpace())return null;
var b=d.tokenize(a,d);if("comment"==s)return b;d.lastType="operator"!=s||"++"!=t&&"--"!=t?s:"incdec";a:{var c=s,g=t,h=d.cc;f.state=d;f.stream=a;f.marked=null;f.cc=h;d.lexical.hasOwnProperty("align")||(d.lexical.align=!0);for(;;)if((h.length?h.pop():T?k:p)(c,g)){for(;h.length&&h[h.length-1].lex;)h.pop()();if(f.marked){b=f.marked;break a}if(c="variable"==c)b:{for(c=d.localVars;c;c=c.next)if(c.name==g){c=!0;break b}c=void 0}if(c){b="variable-2";break a}break a}}return b},indent:function(a,c){if(a.tokenize==
A)return CodeMirror.Pass;if(a.tokenize!=u)return 0;var b=c&&c.charAt(0),e=a.lexical;"stat"==e.type&&"}"==b&&(e=e.prev);var f=e.type,g=b==f;return null!=q.statementIndent&&(")"==f&&e.prev&&"stat"==e.prev.type&&(e=e.prev),"stat"==e.type)?e.indented+q.statementIndent:"vardef"==f?e.indented+("operator"==a.lastType||","==a.lastType?4:0):"form"==f&&"{"==b?e.indented:"form"==f?e.indented+r:"stat"==f?e.indented+("operator"==a.lastType||","==a.lastType?r:0):"switch"!=e.info||g?e.align?e.column+(g?0:1):e.indented+
(g?0:r):e.indented+(/^(?:case|default)\b/.test(c)?r:2*r)},electricChars:":{}",jsonMode:T}});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});CodeMirror.defineMIME("text/typescript",{name:"javascript",typescript:!0});
CodeMirror.defineMIME("application/typescript",{name:"javascript",typescript:!0});
