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