'use strict';(function(q){"object"==typeof exports&&"object"==typeof module?q(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],q):q(CodeMirror)})(function(q){q.defineMode("javascript",function(Aa,u){function n(a,c,b){M=a;R=b;return c}function A(a,c){var b=a.next();if('"'==b||"'"==b)return c.tokenize=Ba(b),c.tokenize(a,c);if("."==b&&a.match(/^\d+(?:[eE][+\-]?\d+)?/))return n("number","number");if("."==b&&a.match(".."))return n("spread","meta");
if(/[\[\]{}\(\),;\:\.]/.test(b))return n(b);if("="==b&&a.eat(">"))return n("=>","operator");if("0"==b&&a.eat(/x/i))return a.eatWhile(/[\da-f]/i),n("number","number");if("0"==b&&a.eat(/o/i))return a.eatWhile(/[0-7]/i),n("number","number");if("0"==b&&a.eat(/b/i))return a.eatWhile(/[01]/i),n("number","number");if(/\d/.test(b))return a.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),n("number","number");if("/"==b){if(a.eat("*"))return c.tokenize=S,S(a,c);if(a.eat("/"))return a.skipToEnd(),n("comment","comment");
if(ja(a,c,1)){a:for(var b=!1,e,d=!1;null!=(e=a.next());){if(!b){if("/"==e&&!d)break a;"["==e?d=!0:d&&"]"==e&&(d=!1)}b=!b&&"\\"==e}a.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/);return n("regexp","string-2")}a.eat("=");return n("operator","operator",a.current())}if("`"==b)return c.tokenize=ba,ba(a,c);if("#"==b)return a.skipToEnd(),n("error","error");if(ka.test(b))return">"==b&&c.lexical&&">"==c.lexical.type||(a.eat("=")?"!"!=b&&"="!=b||a.eat("="):/[<>*+\-]/.test(b)&&(a.eat(b),">"==b&&a.eat(b))),n("operator",
"operator",a.current());if(ca.test(b)){a.eatWhile(ca);b=a.current();if("."!=c.lastType){if(la.propertyIsEnumerable(b))return e=la[b],n(e.type,e.style,b);if("async"==b&&a.match(/^(\s|\/\*.*?\*\/)*[\(\w]/,!1))return n("async","keyword",b)}return n("variable","variable",b)}}function Ba(a){return function(c,b){var e=!1,d;if(T&&"@"==c.peek()&&c.match(Ca))return b.tokenize=A,n("jsonld-keyword","meta");for(;null!=(d=c.next())&&(d!=a||e);)e=!e&&"\\"==d;e||(b.tokenize=A);return n("string","string")}}function S(a,
c){for(var b=!1,e;e=a.next();){if("/"==e&&b){c.tokenize=A;break}b="*"==e}return n("comment","comment")}function ba(a,c){for(var b=!1,e;null!=(e=a.next());){if(!b&&("`"==e||"$"==e&&a.eat("{"))){c.tokenize=A;break}b=!b&&"\\"==e}return n("quasi","string-2",a.current())}function da(a,b){b.fatArrowAt&&(b.fatArrowAt=null);var d=a.string.indexOf("=>",a.start);if(!(0>d)){if(m){var e=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(a.string.slice(a.start,d));e&&(d=e.index)}for(var e=0,z=!1,d=d-1;0<=d;--d){var f=
a.string.charAt(d),g="([{}])".indexOf(f);if(0<=g&&3>g){if(!e){++d;break}if(0==--e){"("==f&&(z=!0);break}}else if(3<=g&&6>g)++e;else if(ca.test(f))z=!0;else{if(/["'\/]/.test(f))return;if(z&&!e){++d;break}}}z&&!e&&(b.fatArrowAt=d)}}function ma(a,b,d,e,f,g){this.indented=a;this.column=b;this.type=d;this.prev=f;this.info=g;null!=e&&(this.align=e)}function h(){for(var a=arguments.length-1;0<=a;a--)d.cc.push(arguments[a])}function b(){h.apply(null,arguments);return!0}function G(a,b){function f(b){for(;b;b=
b.next)if(b.name==a)return!0;return!1}var e=d.state;d.marked="function"==b?"deffunc":"argument"==b?"defarg":"def";e.context?f(e.localVars)||(e.localVars={name:a,next:e.localVars}):!f(e.globalVars)&&u.globalVars&&(e.globalVars={name:a,next:e.globalVars})}function U(a){return"public"==a||"private"==a||"protected"==a||"abstract"==a||"readonly"==a}function N(){d.state.context={prev:d.state.context,vars:d.state.localVars};d.state.localVars=Da}function O(){d.state.localVars=d.state.context.vars;d.state.context=
d.state.context.prev}function g(a,b){var f=function(){var e=d.state,f=e.indented;if("stat"==e.lexical.type)f=e.lexical.indented;else for(var g=e.lexical;g&&")"==g.type&&g.align;g=g.prev)f=g.indented;e.lexical=new ma(f,d.stream.column(),a,null,e.lexical,b)};f.lex=!0;return f}function f(){var a=d.state;a.lexical.prev&&(")"==a.lexical.type&&(a.indented=a.lexical.indented),a.lexical=a.lexical.prev)}function k(a){function c(d){return d==a?b():";"==a?h():b(c)}return c}function r(a,c){return"var"==a?b(g("vardef",
c.length),ea,k(";"),f):"keyword a"==a?b(g("form"),fa,r,f):"keyword b"==a?b(g("form"),r,f):"keyword d"==a?d.stream.match(/^\s*$/,!1)?b():b(g("stat"),ga,k(";"),f):"debugger"==a?b(k(";")):"{"==a?b(g("}"),P,f):";"==a?b():"if"==a?("else"==d.state.lexical.info&&d.state.cc[d.state.cc.length-1]==f&&d.state.cc.pop()(),b(g("form"),fa,r,f,na)):"function"==a?b(x):"for"==a?b(g("form"),oa,r,f):"class"==a||m&&"interface"==c?(d.marked="keyword",b(g("form"),pa,f)):"variable"==a?m&&"declare"==c?(d.marked="keyword",
b(r)):m&&("module"==c||"enum"==c||"type"==c)&&d.stream.match(/^\s*\w/,!1)?(d.marked="keyword","enum"==c?b(qa):"type"==c?b(p,k("operator"),p,k(";")):b(g("form"),w,k("{"),g("}"),P,f,f)):m&&"namespace"==c?(d.marked="keyword",b(g("form"),l,P,f)):b(g("stat"),Ea):"switch"==a?b(g("form"),fa,k("{"),g("}","switch"),P,f,f):"case"==a?b(l,k(":")):"default"==a?b(k(":")):"catch"==a?b(g("form"),N,k("("),H,k(")"),r,f,O):"export"==a?b(g("stat"),Fa,f):"import"==a?b(g("stat"),Ga,f):"async"==a?b(r):"@"==c?b(l,r):h(g("stat"),
l,k(";"),f)}function l(a,b){return ra(a,b,!1)}function v(a,b){return ra(a,b,!0)}function fa(a){return"("!=a?h():b(g(")"),l,k(")"),f)}function ra(a,c,y){if(d.state.fatArrowAt==d.stream.start){var e=y?sa:ta;if("("==a)return b(N,g(")"),t(H,")"),f,k("=>"),e,O);if("variable"==a)return h(N,w,k("=>"),e,O)}e=y?I:B;return Ha.hasOwnProperty(a)?b(e):"function"==a?b(x,e):"class"==a||m&&"interface"==c?(d.marked="keyword",b(g("form"),Ia,f)):"keyword c"==a||"async"==a?b(y?v:l):"("==a?b(g(")"),ga,k(")"),f,e):"operator"==
a||"spread"==a?b(y?v:l):"["==a?b(g("]"),Ja,f,e):"{"==a?Q(V,"}",null,e):"quasi"==a?h(W,e):"new"==a?b(Ka(y)):"import"==a?b(l):b()}function ga(a){return a.match(/[;\}\)\],]/)?h():h(l)}function B(a,c){return","==a?b(l):I(a,c,!1)}function I(a,c,y){var e=0==y?B:I,z=0==y?l:v;if("=>"==a)return b(N,y?sa:ta,O);if("operator"==a)return/\+\+|--/.test(c)||m&&"!"==c?b(e):m&&"<"==c&&d.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?b(g(">"),t(p,">"),f,e):"?"==c?b(l,k(":"),z):b(z);if("quasi"==a)return h(W,e);if(";"!=a){if("("==
a)return Q(v,")","call",e);if("."==a)return b(La,e);if("["==a)return b(g("]"),ga,k("]"),f,e);if(m&&"as"==c)return d.marked="keyword",b(p,e);if("regexp"==a)return d.state.lastType=d.marked="operator",d.stream.backUp(d.stream.pos-d.stream.start-1),b(z)}}function W(a,c){return"quasi"!=a?h():"${"!=c.slice(c.length-2)?b(W):b(l,Ma)}function Ma(a){if("}"==a)return d.marked="string-2",d.state.tokenize=ba,b(W)}function ta(a){da(d.stream,d.state);return h("{"==a?r:l)}function sa(a){da(d.stream,d.state);return h("{"==
a?r:v)}function Ka(a){return function(c){return"."==c?b(a?Na:Oa):"variable"==c&&m?b(Pa,a?I:B):h(a?v:l)}}function Oa(a,c){if("target"==c)return d.marked="keyword",b(B)}function Na(a,c){if("target"==c)return d.marked="keyword",b(I)}function Ea(a){return":"==a?b(f,r):h(B,k(";"),f)}function La(a){if("variable"==a)return d.marked="property",b()}function V(a,c){if("async"==a)return d.marked="property",b(V);if("variable"==a||"keyword"==d.style){d.marked="objprop";if("get"==c||"set"==c)return b(Qa);var f;
m&&d.state.fatArrowAt==d.stream.start&&(f=d.stream.match(/^\s*:\s*/,!1))&&(d.state.fatArrowAt=d.stream.pos+f[0].length);return b(C)}if("number"==a||"string"==a)return d.marked=T?"property":d.style+" property",b(C);if("jsonld-keyword"==a)return b(C);if(m&&U(c))return d.marked="keyword",b(V);if("["==a)return b(l,J,k("]"),C);if("spread"==a)return b(v,C);if("*"==c)return d.marked="keyword",b(V);if(":"==a)return h(C)}function Qa(a){if("variable"!=a)return h(C);d.marked="property";return b(x)}function C(a){if(":"==
a)return b(v);if("("==a)return h(x)}function t(a,c,f){function e(g,l){if(f?-1<f.indexOf(g):","==g){var m=d.state.lexical;"call"==m.info&&(m.pos=(m.pos||0)+1);return b(function(b,e){return b==c||e==c?h():h(a)},e)}return g==c||l==c?b():b(k(c))}return function(d,f){return d==c||f==c?b():h(a,e)}}function Q(a,c,h){for(var e=3;e<arguments.length;e++)d.cc.push(arguments[e]);return b(g(c,h),t(a,c),f)}function P(a){return"}"==a?b():h(r,P)}function J(a,c){if(m){if(":"==a)return b(p);if("?"==c)return b(J)}}
function Ra(a){if(m&&":"==a)return d.stream.match(/^\s*\w+\s+is\b/,!1)?b(l,Sa,p):b(p)}function Sa(a,c){if("is"==c)return d.marked="keyword",b()}function p(a,c){if("variable"==a||"void"==c){if("keyof"==c)return d.marked="keyword",b(p);d.marked="type";return b(D)}if("string"==a||"number"==a||"atom"==a)return b(D);if("["==a)return b(g("]"),t(p,"]",","),f,D);if("{"==a)return b(g("}"),t(X,"}",",;"),f,D);if("("==a)return b(t(ua,")"),Ta)}function Ta(a){if("=>"==a)return b(p)}function X(a,c){if("variable"==
a||"keyword"==d.style)return d.marked="property",b(X);if("?"==c)return b(X);if(":"==a)return b(p);if("["==a)return b(l,J,k("]"),X)}function ua(a){if("variable"==a)return b(ua);if(":"==a)return b(p)}function D(a,c){if("<"==c)return b(g(">"),t(p,">"),f,D);if("|"==c||"."==a||"&"==c)return b(p);if("["==a)return b(k("]"),D);if("extends"==c||"implements"==c)return d.marked="keyword",b(p)}function Pa(a,c){if("<"==c)return b(g(">"),t(p,">"),f,D)}function va(){return h(p,Ua)}function Ua(a,c){if("="==c)return b(p)}
function ea(a,c){return"enum"==c?(d.marked="keyword",b(qa)):h(w,J,K,Va)}function w(a,c){if(m&&U(c))return d.marked="keyword",b(w);if("function"==a)return G(c),b();if("variable"==a)return G(c,")"!=d.state.lexical.type||d.state.lexical.prev&&"form"==d.state.lexical.prev.type?null:"argument"),b();if("spread"==a)return b(w);if("["==a)return Q(w,"]");if("{"==a)return Q(Wa,"}")}function Wa(a,c){if("variable"==a&&!d.stream.match(/^\s*:/,!1))return G(c),b(K);"variable"==a&&(d.marked="property");return"spread"==
a?b(w):"}"==a?h():b(k(":"),w,K)}function K(a,c){if("="==c)return b(v)}function Va(a){if(","==a)return b(ea)}function na(a,c){if("keyword b"==a&&"else"==c)return b(g("form","else"),r,f)}function oa(a,c){if("await"==c)return b(oa);if("("==a)return b(g(")"),Xa,k(")"),f)}function Xa(a){return"var"==a?b(ea,k(";"),Y):";"==a?b(Y):"variable"==a?b(Ya):h(l,k(";"),Y)}function Ya(a,c){return"in"==c||"of"==c?(d.marked="keyword",b(l)):b(B,Y)}function Y(a,c){return";"==a?b(wa):"in"==c||"of"==c?(d.marked="keyword",
b(l)):h(l,k(";"),wa)}function wa(a){")"!=a&&b(l)}function x(a,c){if("*"==c)return d.marked="keyword",b(x);if("variable"==a)return G(c,"function"),b(x);if("("==a)return b(N,g(")"),t(H,")"),f,Ra,r,O);if(m&&"<"==c)return b(g(">"),t(va,">"),f,x)}function H(a,c){"@"==c&&b(l,H);return"spread"==a?b(H):m&&U(c)?(d.marked="keyword",b(H)):h(w,J,K)}function Ia(a,b){return"variable"==a?pa(a,b):Z(a,b)}function pa(a,c){if("variable"==a)return G(c),b(Z)}function Z(a,c){if("<"==c)return b(g(">"),t(va,">"),f,Z);if("extends"==
c||"implements"==c||m&&","==a)return"implements"==c&&(d.marked="keyword"),b(m?p:l,Z);if("{"==a)return b(g("}"),E,f)}function E(a,c){if("async"==a||"variable"==a&&("static"==c||"get"==c||"set"==c||m&&U(c))&&d.stream.match(/^\s+[\w$\xa1-\uffff]/,!1))return d.marked="keyword",b(E);if("variable"==a||"keyword"==d.style)return d.marked="property",b(m?ha:x,E);if("["==a)return b(l,J,k("]"),m?ha:x,E);if("*"==c)return d.marked="keyword",b(E);if(";"==a)return b(E);if("}"==a)return b();if("@"==c)return b(l,E)}
function ha(a,c){return"?"==c?b(ha):":"==a?b(p,K):"="==c?b(v):h(x)}function Fa(a,c){return"*"==c?(d.marked="keyword",b(ia,k(";"))):"default"==c?(d.marked="keyword",b(l,k(";"))):"{"==a?b(t(xa,"}"),ia,k(";")):h(r)}function xa(a,c){if("as"==c)return d.marked="keyword",b(k("variable"));if("variable"==a)return h(v,xa)}function Ga(a){return"string"==a?b():"("==a?h(l):h(aa,ya,ia)}function aa(a,c){if("{"==a)return Q(aa,"}");"variable"==a&&G(c);"*"==c&&(d.marked="keyword");return b(Za)}function ya(a){if(","==
a)return b(aa,ya)}function Za(a,c){if("as"==c)return d.marked="keyword",b(aa)}function ia(a,c){if("from"==c)return d.marked="keyword",b(l)}function Ja(a){return"]"==a?b():h(t(v,"]"))}function qa(){return h(g("form"),w,k("{"),g("}"),t($a,"}"),f,f)}function $a(){return h(w,K)}function ja(a,b,d){return b.tokenize==A&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(b.lastType)||"quasi"==b.lastType&&/\{\s*$/.test(a.string.slice(0,a.pos-(d||0)))}var L=Aa.indentUnit,
za=u.statementIndent,T=u.jsonld,F=u.json||T,m=u.typescript,ca=u.wordCharacters||/[\w$\xa1-\uffff]/,la=function(){function a(a){return{type:a,style:"keyword"}}var b=a("keyword a"),d=a("keyword b"),e=a("keyword c"),f=a("keyword d"),g=a("operator"),h={type:"atom",style:"atom"};return{"if":a("if"),"while":b,"with":b,"else":d,"do":d,"try":d,"finally":d,"return":f,"break":f,"continue":f,"new":a("new"),"delete":e,"void":e,"throw":e,"debugger":a("debugger"),"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":g,"typeof":g,"instanceof":g,"true":h,"false":h,"null":h,undefined:h,NaN:h,Infinity:h,"this":a("this"),"class":a("class"),"super":a("atom"),yield:e,"export":a("export"),"import":a("import"),"extends":e,await:e}}(),ka=/[+\-*&%=<>!?|~^@]/,Ca=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,M,R,Ha={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,"this":!0,"jsonld-keyword":!0},
d={state:null,column:null,marked:null,cc:null},Da={name:"this",next:{name:"arguments"}};f.lex=!0;return{startState:function(a){a={tokenize:A,lastType:"sof",cc:[],lexical:new ma((a||0)-L,0,"block",!1),localVars:u.localVars,context:u.localVars&&{vars:u.localVars},indented:a||0};u.globalVars&&"object"==typeof u.globalVars&&(a.globalVars=u.globalVars);return a},token:function(a,b){a.sol()&&(b.lexical.hasOwnProperty("align")||(b.lexical.align=!1),b.indented=a.indentation(),da(a,b));if(b.tokenize!=S&&a.eatSpace())return null;
var f=b.tokenize(a,b);if("comment"==M)return f;b.lastType="operator"!=M||"++"!=R&&"--"!=R?M:"incdec";a:{var e=M,g=R,h=b.cc;d.state=b;d.stream=a;d.marked=null;d.cc=h;d.style=f;b.lexical.hasOwnProperty("align")||(b.lexical.align=!0);for(;;)if((h.length?h.pop():F?l:r)(e,g)){for(;h.length&&h[h.length-1].lex;)h.pop()();if(d.marked){f=d.marked;break a}if(e="variable"==e)b:{for(e=b.localVars;e;e=e.next)if(e.name==g){e=!0;break b}for(h=b.context;h;h=h.prev)for(e=h.vars;e;e=e.next)if(e.name==g){e=!0;break b}e=
void 0}if(e){f="variable-2";break a}break a}}return f},indent:function(a,b){if(a.tokenize==S)return q.Pass;if(a.tokenize!=A)return 0;var d=b&&b.charAt(0),e=a.lexical,g;if(!/^\s*else\b/.test(b))for(var h=a.cc.length-1;0<=h;--h){var k=a.cc[h];if(k==f)e=e.prev;else if(k!=na)break}for(;!("stat"!=e.type&&"form"!=e.type||"}"!=d&&(!(g=a.cc[a.cc.length-1])||g!=B&&g!=I||/^[,\.=+\-*:?[\(]/.test(b)));)e=e.prev;za&&")"==e.type&&"stat"==e.prev.type&&(e=e.prev);g=e.type;h=d==g;return"vardef"==g?e.indented+("operator"==
a.lastType||","==a.lastType?e.info+1:0):"form"==g&&"{"==d?e.indented:"form"==g?e.indented+L:"stat"==g?(d=e.indented,e="operator"==a.lastType||","==a.lastType||ka.test(b.charAt(0))||/[,.]/.test(b.charAt(0)),d+(e?za||L:0)):"switch"!=e.info||h||0==u.doubleIndentSwitch?e.align?e.column+(h?0:1):e.indented+(h?0:L):e.indented+(/^(?:case|default)\b/.test(b)?L:2*L)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:F?null:"/*",blockCommentEnd:F?null:"*/",blockCommentContinue:F?null:" * ",
lineComment:F?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:F?"json":"javascript",jsonldMode:T,jsonMode:F,expressionAllowed:ja,skipExpression:function(a){var b=a.cc[a.cc.length-1];b!=l&&b!=v||a.cc.pop()}}});q.registerHelper("wordChars","javascript",/[\w$]/);q.defineMIME("text/javascript","javascript");q.defineMIME("text/ecmascript","javascript");q.defineMIME("application/javascript","javascript");q.defineMIME("application/x-javascript","javascript");q.defineMIME("application/ecmascript",
"javascript");q.defineMIME("application/json",{name:"javascript",json:!0});q.defineMIME("application/x-json",{name:"javascript",json:!0});q.defineMIME("application/ld+json",{name:"javascript",jsonld:!0});q.defineMIME("text/typescript",{name:"javascript",typescript:!0});q.defineMIME("application/typescript",{name:"javascript",typescript:!0})});
