﻿!function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define("mode/javascript/javascript.js",["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.defineMode("javascript",function(t,r){function n(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return;"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}function a(e,t,r){return Ue=e,Be=r,t}function i(e,t){var r=e.next();if('"'==r||"'"==r)return t.tokenize=o(r),t.tokenize(e,t);if("."==r&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return a("number","number");if("."==r&&e.match(".."))return a("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(r))return a(r);if("="==r&&e.eat(">"))return a("=>","operator");if("0"==r&&e.match(/^(?:x[\da-f]+|o[0-7]+|b[01]+)n?/i))return a("number","number");if(/\d/.test(r))return e.match(/^\d*(?:n|(?:\.\d*)?(?:[eE][+\-]?\d+)?)?/),a("number","number");if("/"==r)return e.eat("*")?(t.tokenize=c,c(e,t)):e.eat("/")?(e.skipToEnd(),a("comment","comment")):Ne(e,t,1)?(n(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),a("regexp","string-2")):(e.eat("="),a("operator","operator",e.current()));if("`"==r)return t.tokenize=s,s(e,t);if("#"==r)return e.skipToEnd(),a("error","error");if(Le.test(r))return">"==r&&t.lexical&&">"==t.lexical.type||(e.eat("=")?"!"!=r&&"="!=r||e.eat("="):/[<>*+\-]/.test(r)&&(e.eat(r),">"==r&&e.eat(r))),a("operator","operator",e.current());if(Ge.test(r)){e.eatWhile(Ge);var i=e.current();if("."!=t.lastType){if(Ke.propertyIsEnumerable(i)){var u=Ke[i];return a(u.type,u.style,i)}if("async"==i&&e.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return a("async","keyword",i)}return a("variable","variable",i)}}function o(e){return function(t,r){var n,o=!1;if(We&&"@"==t.peek()&&t.match(Qe))return r.tokenize=i,a("jsonld-keyword","meta");for(;null!=(n=t.next())&&(n!=e||o);)o=!o&&"\\"==n;return o||(r.tokenize=i),a("string","string")}}function c(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=i;break}n="*"==r}return a("comment","comment")}function s(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=i;break}n=!n&&"\\"==r}return a("quasi","string-2",e.current())}function u(e,t){t.fatArrowAt&&(t.fatArrowAt=null);var r=e.string.indexOf("=>",e.start);if(!(r<0)){if(Fe){var n=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,r));n&&(r=n.index)}for(var a=0,i=!1,o=r-1;o>=0;--o){var c=e.string.charAt(o),s=Re.indexOf(c);if(s>=0&&s<3){if(!a){++o;break}if(0==--a){"("==c&&(i=!0);break}}else if(s>=3&&s<6)++a;else if(Ge.test(c))i=!0;else{if(/["'\/]/.test(c))return;if(i&&!a){++o;break}}}i&&!a&&(t.fatArrowAt=o)}}function f(e,t,r,n,a,i){this.indented=e,this.column=t,this.type=r,this.prev=a,this.info=i,null!=n&&(this.align=n)}function l(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0;for(var n=e.context;n;n=n.prev)for(var r=n.vars;r;r=r.next)if(r.name==t)return!0}function d(e,t,r,n,a){var i=e.cc;for(Ye.state=e,Ye.stream=a,Ye.marked=null,Ye.cc=i,Ye.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){if((i.length?i.pop():De?I:E)(r,n)){for(;i.length&&i[i.length-1].lex;)i.pop()();return Ye.marked?Ye.marked:"variable"==r&&l(e,n)?"variable-2":t}}}function p(){for(var e=arguments.length-1;e>=0;e--)Ye.cc.push(arguments[e])}function m(){return p.apply(null,arguments),!0}function v(e,t){for(var r=t;r;r=r.next)if(r.name==e)return!0;return!1}function k(e){var t=Ye.state;if(Ye.marked="def",t.context)if("var"==t.lexical.info&&t.context&&t.context.block){var n=y(e,t.context);if(null!=n)return void(t.context=n)}else if(!v(e,t.localVars))return void(t.localVars=new x(e,t.localVars));r.globalVars&&!v(e,t.globalVars)&&(t.globalVars=new x(e,t.globalVars))}function y(e,t){if(t){if(t.block){var r=y(e,t.prev);return r?r==t.prev?t:new b(r,t.vars,!0):null}return v(e,t.vars)?t:new b(t.prev,new x(e,t.vars),!1)}return null}function w(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function b(e,t,r){this.prev=e,this.vars=t,this.block=r}function x(e,t){this.name=e,this.next=t}function h(){Ye.state.context=new b(Ye.state.context,Ye.state.localVars,!1),Ye.state.localVars=Ze}function g(){Ye.state.context=new b(Ye.state.context,Ye.state.localVars,!0),Ye.state.localVars=null}function j(){Ye.state.localVars=Ye.state.context.vars,Ye.state.context=Ye.state.context.prev}function M(e,t){var r=function(){var r=Ye.state,n=r.indented;if("stat"==r.lexical.type)n=r.lexical.indented;else for(var a=r.lexical;a&&")"==a.type&&a.align;a=a.prev)n=a.indented;r.lexical=new f(n,Ye.stream.column(),e,null,r.lexical,t)};return r.lex=!0,r}function V(){var e=Ye.state;e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function A(e){function t(r){return r==e?m():";"==e||"}"==r||")"==r||"]"==r?p():m(t)}return t}function E(e,t){return"var"==e?m(M("vardef",t),se,A(";"),V):"keyword a"==e?m(M("form"),$,E,V):"keyword b"==e?m(M("form"),E,V):"keyword d"==e?Ye.stream.match(/^\s*$/,!1)?m():m(M("stat"),q,A(";"),V):"debugger"==e?m(A(";")):"{"==e?m(M("}"),g,X,V,j):";"==e?m():"if"==e?("else"==Ye.state.lexical.info&&Ye.state.cc[Ye.state.cc.length-1]==V&&Ye.state.cc.pop()(),m(M("form"),$,E,V,pe)):"function"==e?m(be):"for"==e?m(M("form"),me,E,V):"class"==e||Fe&&"interface"==t?(Ye.marked="keyword",m(M("form"),ge,V)):"variable"==e?Fe&&"declare"==t?(Ye.marked="keyword",m(E)):Fe&&("module"==t||"enum"==t||"type"==t)&&Ye.stream.match(/^\s*\w/,!1)?(Ye.marked="keyword","enum"==t?m(Oe):"type"==t?m(ee,A("operator"),ee,A(";")):m(M("form"),ue,A("{"),M("}"),X,V,V)):Fe&&"namespace"==t?(Ye.marked="keyword",m(M("form"),I,X,V)):Fe&&"abstract"==t?(Ye.marked="keyword",m(E)):m(M("stat"),D):"switch"==e?m(M("form"),$,A("{"),M("}","switch"),g,X,V,V,j):"case"==e?m(I,A(":")):"default"==e?m(A(":")):"catch"==e?m(M("form"),h,z,E,V,j):"export"==e?m(M("stat"),Ae,V):"import"==e?m(M("stat"),ze,V):"async"==e?m(E):"@"==t?m(I,E):p(M("stat"),I,A(";"),V)}function z(e){if("("==e)return m(xe,A(")"))}function I(e,t){return C(e,t,!1)}function T(e,t){return C(e,t,!0)}function $(e){return"("!=e?p():m(M(")"),I,A(")"),V)}function C(e,t,r){if(Ye.state.fatArrowAt==Ye.stream.start){var n=r?B:U;if("("==e)return m(h,M(")"),Q(xe,")"),V,A("=>"),n,j);if("variable"==e)return p(h,ue,A("=>"),n,j)}var a=r?P:O;return Xe.hasOwnProperty(e)?m(a):"function"==e?m(be,a):"class"==e||Fe&&"interface"==t?(Ye.marked="keyword",m(M("form"),he,V)):"keyword c"==e||"async"==e?m(r?T:I):"("==e?m(M(")"),q,A(")"),V,a):"operator"==e||"spread"==e?m(r?T:I):"["==e?m(M("]"),qe,V,a):"{"==e?R(G,"}",null,a):"quasi"==e?p(S,a):"new"==e?m(H(r)):"import"==e?m(I):m()}function q(e){return e.match(/[;\}\)\],]/)?p():p(I)}function O(e,t){return","==e?m(I):P(e,t,!1)}function P(e,t,r){var n=0==r?O:P,a=0==r?I:T;return"=>"==e?m(h,r?B:U,j):"operator"==e?/\+\+|--/.test(t)||Fe&&"!"==t?m(n):Fe&&"<"==t&&Ye.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?m(M(">"),Q(ee,">"),V,n):"?"==t?m(I,A(":"),a):m(a):"quasi"==e?p(S,n):";"!=e?"("==e?R(T,")","call",n):"."==e?m(F,n):"["==e?m(M("]"),q,A("]"),V,n):Fe&&"as"==t?(Ye.marked="keyword",m(ee,n)):"regexp"==e?(Ye.state.lastType=Ye.marked="operator",Ye.stream.backUp(Ye.stream.pos-Ye.stream.start-1),m(a)):void 0:void 0}function S(e,t){return"quasi"!=e?p():"${"!=t.slice(t.length-2)?m(S):m(I,N)}function N(e){if("}"==e)return Ye.marked="string-2",Ye.state.tokenize=s,m(S)}function U(e){return u(Ye.stream,Ye.state),p("{"==e?E:I)}function B(e){return u(Ye.stream,Ye.state),p("{"==e?E:T)}function H(e){return function(t){return"."==t?m(e?W:J):"variable"==t&&Fe?m(ie,e?P:O):p(e?T:I)}}function J(e,t){if("target"==t)return Ye.marked="keyword",m(O)}function W(e,t){if("target"==t)return Ye.marked="keyword",m(P)}function D(e){return":"==e?m(V,E):p(O,A(";"),V)}function F(e){if("variable"==e)return Ye.marked="property",m()}function G(e,t){if("async"==e)return Ye.marked="property",m(G);if("variable"==e||"keyword"==Ye.style){if(Ye.marked="property","get"==t||"set"==t)return m(K);var r;return Fe&&Ye.state.fatArrowAt==Ye.stream.start&&(r=Ye.stream.match(/^\s*:\s*/,!1))&&(Ye.state.fatArrowAt=Ye.stream.pos+r[0].length),m(L)}return"number"==e||"string"==e?(Ye.marked=We?"property":Ye.style+" property",m(L)):"jsonld-keyword"==e?m(L):Fe&&w(t)?(Ye.marked="keyword",m(G)):"["==e?m(I,Y,A("]"),L):"spread"==e?m(T,L):"*"==t?(Ye.marked="keyword",m(G)):":"==e?p(L):void 0}function K(e){return"variable"!=e?p(L):(Ye.marked="property",m(be))}function L(e){return":"==e?m(T):"("==e?p(be):void 0}function Q(e,t,r){function n(a,i){if(r?r.indexOf(a)>-1:","==a){var o=Ye.state.lexical;return"call"==o.info&&(o.pos=(o.pos||0)+1),m(function(r,n){return r==t||n==t?p():p(e)},n)}return a==t||i==t?m():m(A(t))}return function(r,a){return r==t||a==t?m():p(e,n)}}function R(e,t,r){for(var n=3;n<arguments.length;n++)Ye.cc.push(arguments[n]);return m(M(t,r),Q(e,t),V)}function X(e){return"}"==e?m():p(E,X)}function Y(e,t){if(Fe){if(":"==e)return m(ee);if("?"==t)return m(Y)}}function Z(e){if(Fe&&":"==e)return Ye.stream.match(/^\s*\w+\s+is\b/,!1)?m(I,_,ee):m(ee)}function _(e,t){if("is"==t)return Ye.marked="keyword",m()}function ee(e,t){return"keyof"==t||"typeof"==t?(Ye.marked="keyword",m("keyof"==t?ee:T)):"variable"==e||"void"==t?(Ye.marked="type",m(ae)):"string"==e||"number"==e||"atom"==e?m(ae):"["==e?m(M("]"),Q(ee,"]",","),V,ae):"{"==e?m(M("}"),Q(re,"}",",;"),V,ae):"("==e?m(Q(ne,")"),te):"<"==e?m(Q(ee,">"),ee):void 0}function te(e){if("=>"==e)return m(ee)}function re(e,t){return"variable"==e||"keyword"==Ye.style?(Ye.marked="property",m(re)):"?"==t?m(re):":"==e?m(ee):"["==e?m(I,Y,A("]"),re):void 0}function ne(e,t){return"variable"==e&&Ye.stream.match(/^\s*[?:]/,!1)||"?"==t?m(ne):":"==e?m(ee):p(ee)}function ae(e,t){return"<"==t?m(M(">"),Q(ee,">"),V,ae):"|"==t||"."==e||"&"==t?m(ee):"["==e?m(A("]"),ae):"extends"==t||"implements"==t?(Ye.marked="keyword",m(ee)):void 0}function ie(e,t){if("<"==t)return m(M(">"),Q(ee,">"),V,ae)}function oe(){return p(ee,ce)}function ce(e,t){if("="==t)return m(ee)}function se(e,t){return"enum"==t?(Ye.marked="keyword",m(Oe)):p(ue,Y,le,de)}function ue(e,t){return Fe&&w(t)?(Ye.marked="keyword",m(ue)):"variable"==e?(k(t),m()):"spread"==e?m(ue):"["==e?R(ue,"]"):"{"==e?R(fe,"}"):void 0}function fe(e,t){return"variable"!=e||Ye.stream.match(/^\s*:/,!1)?("variable"==e&&(Ye.marked="property"),"spread"==e?m(ue):"}"==e?p():m(A(":"),ue,le)):(k(t),m(le))}function le(e,t){if("="==t)return m(T)}function de(e){if(","==e)return m(se)}function pe(e,t){if("keyword b"==e&&"else"==t)return m(M("form","else"),E,V)}function me(e,t){return"await"==t?m(me):"("==e?m(M(")"),ve,A(")"),V):void 0}function ve(e){return"var"==e?m(se,A(";"),ye):";"==e?m(ye):"variable"==e?m(ke):p(I,A(";"),ye)}function ke(e,t){return"in"==t||"of"==t?(Ye.marked="keyword",m(I)):m(O,ye)}function ye(e,t){return";"==e?m(we):"in"==t||"of"==t?(Ye.marked="keyword",m(I)):p(I,A(";"),we)}function we(e){")"!=e&&m(I)}function be(e,t){return"*"==t?(Ye.marked="keyword",m(be)):"variable"==e?(k(t),m(be)):"("==e?m(h,M(")"),Q(xe,")"),V,Z,E,j):Fe&&"<"==t?m(M(">"),Q(oe,">"),V,be):void 0}function xe(e,t){return"@"==t&&m(I,xe),"spread"==e?m(xe):Fe&&w(t)?(Ye.marked="keyword",m(xe)):p(ue,Y,le)}function he(e,t){return"variable"==e?ge(e,t):je(e,t)}function ge(e,t){if("variable"==e)return k(t),m(je)}function je(e,t){return"<"==t?m(M(">"),Q(oe,">"),V,je):"extends"==t||"implements"==t||Fe&&","==e?("implements"==t&&(Ye.marked="keyword"),m(Fe?ee:I,je)):"{"==e?m(M("}"),Me,V):void 0}function Me(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||Fe&&w(t))&&Ye.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(Ye.marked="keyword",m(Me)):"variable"==e||"keyword"==Ye.style?(Ye.marked="property",m(Fe?Ve:be,Me)):"["==e?m(I,Y,A("]"),Fe?Ve:be,Me):"*"==t?(Ye.marked="keyword",m(Me)):";"==e?m(Me):"}"==e?m():"@"==t?m(I,Me):void 0}function Ve(e,t){return"?"==t?m(Ve):":"==e?m(ee,le):"="==t?m(T):p(be)}function Ae(e,t){return"*"==t?(Ye.marked="keyword",m(Ce,A(";"))):"default"==t?(Ye.marked="keyword",m(I,A(";"))):"{"==e?m(Q(Ee,"}"),Ce,A(";")):p(E)}function Ee(e,t){return"as"==t?(Ye.marked="keyword",m(A("variable"))):"variable"==e?p(T,Ee):void 0}function ze(e){return"string"==e?m():"("==e?p(I):p(Ie,Te,Ce)}function Ie(e,t){return"{"==e?R(Ie,"}"):("variable"==e&&k(t),"*"==t&&(Ye.marked="keyword"),m($e))}function Te(e){if(","==e)return m(Ie,Te)}function $e(e,t){if("as"==t)return Ye.marked="keyword",m(Ie)}function Ce(e,t){if("from"==t)return Ye.marked="keyword",m(I)}function qe(e){return"]"==e?m():p(Q(T,"]"))}function Oe(){return p(M("form"),ue,A("{"),M("}"),Q(Pe,"}"),V,V)}function Pe(){return p(ue,le)}function Se(e,t){return"operator"==e.lastType||","==e.lastType||Le.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}function Ne(e,t,r){return t.tokenize==i&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}var Ue,Be,He=t.indentUnit,Je=r.statementIndent,We=r.jsonld,De=r.json||We,Fe=r.typescript,Ge=r.wordCharacters||/[\w$\xa1-\uffff]/,Ke=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),a=e("keyword d"),i=e("operator"),o={type:"atom",style:"atom"};return{if:e("if"),while:t,with:t,else:r,do:r,try:r,finally:r,return:a,break:a,continue:a,new:e("new"),delete:n,void:n,throw:n,debugger:e("debugger"),var:e("var"),const:e("var"),let:e("var"),function:e("function"),catch:e("catch"),for:e("for"),switch:e("switch"),case:e("case"),default:e("default"),in:i,typeof:i,instanceof:i,true:o,false:o,null:o,undefined:o,NaN:o,Infinity:o,this:e("this"),class:e("class"),super:e("atom"),yield:n,export:e("export"),import:e("import"),extends:n,await:n}}(),Le=/[+\-*&%=<>!?|~^@]/,Qe=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/,Re="([{}])",Xe={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0},Ye={state:null,column:null,marked:null,cc:null},Ze=new x("this",new x("arguments",null));return j.lex=!0,V.lex=!0,{startState:function(e){var t={tokenize:i,lastType:"sof",cc:[],lexical:new f((e||0)-He,0,"block",!1),localVars:r.localVars,context:r.localVars&&new b(null,null,!1),indented:e||0};return r.globalVars&&"object"==typeof r.globalVars&&(t.globalVars=r.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),u(e,t)),t.tokenize!=c&&e.eatSpace())return null;var r=t.tokenize(e,t);return"comment"==Ue?r:(t.lastType="operator"!=Ue||"++"!=Be&&"--"!=Be?Ue:"incdec",d(t,r,Ue,Be,e))},indent:function(t,n){if(t.tokenize==c)return e.Pass;if(t.tokenize!=i)return 0;var a,o=n&&n.charAt(0),s=t.lexical;if(!/^\s*else\b/.test(n))for(var u=t.cc.length-1;u>=0;--u){var f=t.cc[u];if(f==V)s=s.prev;else if(f!=pe)break}for(;("stat"==s.type||"form"==s.type)&&("}"==o||(a=t.cc[t.cc.length-1])&&(a==O||a==P)&&!/^[,\.=+\-*:?[\(]/.test(n));)s=s.prev;Je&&")"==s.type&&"stat"==s.prev.type&&(s=s.prev);var l=s.type,d=o==l;return"vardef"==l?s.indented+("operator"==t.lastType||","==t.lastType?s.info.length+1:0):"form"==l&&"{"==o?s.indented:"form"==l?s.indented+He:"stat"==l?s.indented+(Se(t,n)?Je||He:0):"switch"!=s.info||d||0==r.doubleIndentSwitch?s.align?s.column+(d?0:1):s.indented+(d?0:He):s.indented+(/^(?:case|default)\b/.test(n)?He:2*He)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:De?null:"/*",blockCommentEnd:De?null:"*/",blockCommentContinue:De?null:" * ",lineComment:De?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:De?"json":"javascript",jsonldMode:We,jsonMode:De,expressionAllowed:Ne,skipExpression:function(e){var t=e.cc[e.cc.length-1];t!=I&&t!=T||e.cc.pop()}}}),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}),function(e){"function"==typeof e.define&&e.define("modeJs",["mode/javascript/javascript.js"],function(){})}(this);
