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