You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
81 KiB
12 lines
81 KiB
var $e=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var Yt=Object.getOwnPropertyNames;var er=Object.prototype.hasOwnProperty;var tr=(s,e)=>{for(var t in e)$e(s,t,{get:e[t],enumerable:!0})},rr=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Yt(e))!er.call(s,n)&&n!==t&&$e(s,n,{get:()=>e[n],enumerable:!(r=Qt(e,n))||r.enumerable});return s};var nr=s=>rr($e({},"__esModule",{value:!0}),s);var Cr={};tr(Cr,{CompletionTypes:()=>P,Group:()=>E,ImbaDocument:()=>pe,KeywordTypes:()=>g,Keywords:()=>ue,M:()=>z,Monarch:()=>Se,Node:()=>ae,Position:()=>Z,Range:()=>V,Scope:()=>j,SemanticTokenModifiers:()=>Nt,SemanticTokenTypes:()=>ie,Sym:()=>K,SymbolFlags:()=>d,SymbolKind:()=>L,Token:()=>R,grammar:()=>_e,highlight:()=>Xt,lexer:()=>J});module.exports=nr(Cr);var me=Symbol.for("#__init__");var Y=Symbol.for("#source"),sr=Symbol.for("#lineText"),ir=Symbol.for("#version"),_t=new WeakMap,Z=class{[me](e=null){this.line=e?e.line:void 0,this.character=e?e.character:void 0,this.offset=e?e.offset:void 0}constructor(e,t,r,n=null){this[me](),this.line=e,this.character=t,this.offset=r,this[ir]=n}toString(){return""+this.line+":"+this.character}valueOf(){return this.offset}},V=class{[me](e=null){this.start=e?e.start:void 0,this.end=e?e.end:void 0}constructor(e,t){this[me](),this.start=e,this.end=t}get offset(){return this.start.offset}get length(){return this.end.offset-this.start.offset}get 0(){return this.start.offset}get 1(){return this.end.offset}getText(e){return e.slice(this.start,this.end)}equals(e){return e.offset==this.offset&&e.length==this.length}},or={Error:1,Warning:2,Information:3,Hint:4,error:1,warning:2,warn:2,info:3,hint:4},kt=class{constructor(e,t=null){this.range=e.range,this.severity=or[e.severity]||e.severity,this.code=e.code,this.source=e.source,this.message=e.message,_t.set(this,t)}get[Y](){return _t.get(this)}get[sr](){return this[Y].doc.getLineText(this.range.start.line)}toSnippet(){let e=this.range.start,t=this.range.end,r=""+this[Y].sourcePath+":"+(e.line+1)+":"+(e.character+1)+": "+this.message,n=this[Y].doc.getLineText(e.line),i=[r,n];return i.push(n.replace(/[^\t]/g," ").slice(0,e.character)+"^".repeat(t.character-e.character)),i.join(`
|
|
`).replace(/\t/g," ")+`
|
|
`}toError(){let e=this.range.start,t=this.range.end,r=""+this[Y].sourcePath+":"+(e.line+1)+":"+(e.character+1)+": "+this.message,n=new SyntaxError(r),i=this[Y].doc.getLineText(e.line),l=[r,i];return l.push(i.replace(/[^\t]/g," ").slice(0,e.character)+"^".repeat(t.character-e.character)),n.stack=`
|
|
`+l.join(`
|
|
`).replace(/\t/g," ")+`
|
|
`,n}raise(){throw this.toError()}};function lr(s){let e;return s?(e=s.toIterable)?e.call(s):s:[]}function de(s,e,t=1e5){let r=s;for(;r&&t>0;){if(r.match(e))return r;t--,r=r.prev}return null}function Ie(s,e,t){t===void 0&&(t=0);for(var r=e?[t]:[],n=0;n<s.length;){var i=s.charCodeAt(n);(i===13||i===10)&&(i===13&&n+1<s.length&&s.charCodeAt(n+1)===10&&n++,r.push(t+n+1)),n++}return r}function bt(s){var e=s.start,t=s.end;return e.line>t.line||e.line===t.line&&e.character>t.character?new V(t,e):s instanceof V?s:new V(e,t)}function xt(s){return s!=null&&typeof s.text=="string"&&s.range===void 0}function wt(s){let e=s.split(/\n/),t=[],r={indent:-1,children:[]},n=r,i,l=Date.now();for(let o=0,f=lr(e),c=f.length;o<c;o++){let a=f[o];if(a.match(/^\s*$/))continue;let p=a.match(/^\t*/)[0].length;for(;r.indent>=p;)r=r.parent||n;if(i=a.match(/^(\t*((?:export )?(?:static )?(?:extend )?)(class|tag|def|get|set|prop|attr) )(\@?[\w\-\$\:]+(?:\.[\w\-\$]+)?)/),i){let u=i[3],h=i[4],T=r.name?r.name+".":"",v=i[2].trim().split(/\s+/),A="",_={start:{line:o,character:i[1].length},end:{line:o,character:i[0].length}},m={kind:u,ownName:h,name:T+h,span:_,indent:p,modifiers:v,children:[],parent:r==n?null:r,type:u,data:{},static:v.indexOf("static")>=0,extends:v.indexOf("extend")>=0};m.static&&(m.containerName="static"),m.containerName=i[2]+i[3],u=="tag"&&(i=a.match(/\<\s+([\w\-\$\:]+(?:\.[\w\-\$]+)?)/))&&(m.superclass=i[1]),r.type=="tag"&&(A="```html\n<"+r.name+" "+h+">\n```\n",m.description={kind:"markdown",value:A}),r.children.push(m),r=m,t.push(m)}}return n.all=t,console.log("fast outline",s.length,Date.now()-l),n}function Oe(s){let e;return s?(e=s.toIterable)?e.call(s):s:[]}var Ae=[/^/,{token:"@rematch",next:"@pop"}],Tt={token:"@rematch",next:"@pop"},St={token:"white.indent",next:"@>illegal_indent"};function ar(s,e="#"){typeof s=="string"&&(s=s.split(" "));let t=s.slice().sort(function(r,n){return n.length-r.length});return t=t.map(function(r){let n=r.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&");return e.replace("#",n)}),new RegExp("(?:"+t.join("|")+")")}function I(s,e,t,r={}){var n;s==null?s=St:s==1?s={next:"@>"}:s==2?s={next:"@>_indent&-_indent"}:typeof s=="string"&&(s={next:s}),e==-1&&(e=Tt),t==-1?t=Tt:t==0&&(r.comment==null?r.comment=!0:r.comment,t={}),s=Object.assign({token:"white.tabs"},s||{}),t=Object.assign({token:"white.tabs"},t||{}),e=Object.assign({token:"@rematch",next:"@pop"},e||{});let i={"$1==$S2 ":s,"$1==$S2":{cases:{"$1==$S6":t,"@default":{token:"@rematch",switchTo:"@*$1"}}},"@default":e};n=0;for(let o of["next","switchTo"]){let f=n++;s[o]&&s[o].indexOf("*")==-1&&(s[o]+="*$1")}let l=[/^(\t*)(?=[^ \t\n])/,{cases:i}];if(r.comment){let o={};for(let f=0,c=Object.keys(i),a=c.length,p,u;f<a;f++){p=c[f],u=i[p];let h=Object.assign({},u);!h.next&&!h.switchTo&&(h.next="@>_comment"),o[p]=h}return[[/^(\t*)(?=#\s|#$)/,{cases:o}],l]}return l}var Ee={root:[[/^@comment/,"comment","@>_comment"],[/^(\t+)(?=[^\t\n])/,{cases:{"$1==$S2 ":{token:"white.indent",next:"@>_indent*$1"},"@default":"white.indent"}}],"block_"],_comment:[[/^([\t\s\n]*)$/,"comment"],[/^(\t*)([\S\s]*)/,{cases:{"$1~$S2 *":{token:"comment"},"@default":{token:"@rematch",next:"@pop"}}}],[/[\S\s]+/,"comment"]],illegal_indent:[I()],identifier_:[[/\$\w+\$/,"identifier.env"],[/\$\d+/,"identifier.special"],[/\#+@id/,"identifier.symbol"],[/\¶@id/,"ivar"],[/@id\!?/,{cases:{this:"this",self:"self","@keywords":"keyword.$#","$0~[A-Z].*":"identifier.uppercase.$F","@default":"identifier.$F"}}]],block_:[[/^(\t+)(?=[\r\n]|$)/,"white.tabs"],"class_","tagclass_","var_","func_","import_","export_","flow_","for_","try_","catch_","while_","css_","tag_","do_","block_comment_","expr_",[/[ ]+/,"white"],"common_"],indentable_:[[/^[ ]+/,"white"],I("@>_paren_indent&-_indent",null,null),[/^(\t+)(?=[\r\n]|$)/,"white.tabs"],"whitespace"],_indent:[I(2,-1,0),"block_"],_paren_indent:[I(2,-1,0),"block_",[/\)|\}|\]/,"@rematch","@pop"]],block:[I("@>",-1,0),"block_"],bool_:[[/(true|false|yes|no|undefined|null)(?![\:\-\w\.\_])/,"boolean"]],op_:[[/\s+\:\s+/,"operator.ternary"],[/(@unspaced_ops)/,{cases:{"@spread":"operator.spread","@access":"operator.access","@default":"operator"}}],[/\/(?!\/)/,"operator.math"],[/\&(?=[,\)])/,"operator.special.blockparam"],[/(\s*)(@symbols)(\s*)/,{cases:{"$2@assignments":"operator.assign","$2@math":"operator.math","$2@operators":"operator","$2@logic":"operator.logic","$2@access":"operator.access","@default":"delimiter"}}],[/\&\b/,"operator"]],keyword_:[[/new@B/,"keyword.new"],[/isa@B/,"keyword.isa"],[/is@B/,"keyword.is"],[/(switch|when|throw|continue|break|then|await|typeof|by)@B/,"keyword.$1"],[/delete@B/,"keyword.delete"],[/and@B|or@B/,"operator.flow"]],return_:[[/return@B/,"keyword.new"]],primitive_:["string_","number_","regexp_","bool_"],value_:["primitive_","keyword_","implicit_call_","parens_","key_","access_","identifier_","array_","object_"],expr_:["comment_","inline_var_","return_","value_","tag_","op_","type_","spread_"],attr_expr_:["primitive_","parens_","access_","identifier_","array_","object_","tag_","op_"],access_:[[/(\.\.?)(@propid\!?)/,{cases:{"$2~[A-Z].*":["operator.access","accessor.uppercase"],"$2~#.*":["operator.access","accessor.symbol"],"@default":["operator.access","accessor"]}}]],call_:[[/\(/,"(","@call_body"]],key_:[[/(\#+@id)(\:\s*)/,["key.symbol","operator.assign.key-value"]],[/(@propid)(\:\s*)/,{cases:{"@default":["key","operator.assign.key-value"]}}]],implicit_call_:[[/(\.\.?)(@propid)@implicitCall/,{cases:{"$2~[A-Z].*":["operator.access","accessor.uppercase","@implicit_call_body"],"@default":["operator.access","accessor","@implicit_call_body"]}}],[/(@propid)@implicitCall/,{cases:{"$2~[A-Z].*":["identifier.uppercase","@implicit_call_body"],"@default":["identifier","@implicit_call_body"]}}]],implicit_call_body:[Ae,[/\)|\}|\]|\>/,"@rematch","@pop"],"arglist_","whitespace"],arglist_:["do_","expr_",[/\s*\,\s*/,"delimiter.comma"]],params_:[[/\[/,"array.[","@array_var_body=decl-param"],[/\{/,"object.{","@object_body=decl-param"],[/(@variable)/,"identifier.decl-param"],"spread_","type_",[/\s*\=\s*/,"operator","@var_value="],[/\s*\,\s*/,"separator"]],object_:[[/\{/,"object.{","@object_body"]],parens_:[[/\(/,"parens.(","@parens_body"]],parens_body:[[/\)/,")","@pop"],"indentable_","arglist_"],array_:[[/\[/,"array.[","@array_body"]],array_body:[[/\]@implicitCall/,{token:"]",switchTo:"@implicit_call_body="}],[/\]/,"]","@pop"],[/\)|\}/,"invalid"],"indentable_","expr_",[",","delimiter"]],object_body:[[/\}/,"}","@pop"],[/(@id)(\s*:\s*)/,["key","operator.assign.key-value","@object_value"]],[/(@id)/,"identifier.$F"],[/\[/,"[","@object_dynamic_key="],[/\s*=\s*/,"operator.assign","@object_value="],[/:/,"operator.assign.key-value","@object_value="],[/\,/,"delimiter.comma"],"indentable_","expr_"],object_value:[Ae,[/,|\}|\]|\)/,"@rematch","@pop"],"expr_"],object_dynamic_key:[["]","]","@pop"],"expr_"],comment_:[[/#(\s.*)?(\n|$)/,"comment"]],block_comment_:[[/###/,"comment.start","@_block_comment"]],_block_comment:[[/###/,"comment.end","@pop"],[/[^#]+/,"comment"],[/#(?!##)/,"comment"]],try_:[[/try@B/,"keyword.try","@>_try&try"]],catch_:[[/(catch\s+)(?=@id(\s|$))/,"keyword.catch","@catch_start&catch"],[/catch@B/,"keyword.catch","@catch_start&catch"]],catch_start:[[/@id/,"identifier.decl-const",{switchTo:"@>_catch"}],[/.?/,"@rematch",{switchTo:"@>_catch"}]],_catch:[I("@>block",-1,0),"block_"],_try:[I("@>block",-1,0),"block_"],do_:[[/do(?=\()/,"keyword.do","@>do_start&do"],[/do(?=\s*\|)/,"keyword.do","@>do_piped&do"],[/do@B/,"keyword.do","@>_do&do"]],do_start:[I(null,-1,-1),[/\(/,"(",{switchTo:"@_do_params"}],[/./,"@rematch",{switchTo:"@_do"}]],do_piped:[I(null,-1,-1),[/\s*\|/,"args.open",{switchTo:"@_do_piped_params"}],[/./,"@rematch",{switchTo:"@_do"}]],_do_piped_params:[[/\|/,"args.close",{switchTo:"@_do"}],"params_"],_do_params:[[/\)/,")",{switchTo:"@_do"}],"params_"],_do:[I(2,-1,0),[/(\}|\)|\])/,"@rematch","@pop"],"block_"],class_:[[/(extend)(?=\s+class )/,"keyword.$1"],[/(global)(?=\s+class )/,"keyword.$1"],[/(class)(\s)(@id)/,["keyword.$1","white.$1name","entity.name.class.decl-const","@class_start="]],[/(class)(?=\n)/,"keyword.$1","@>_class&class="]],class_start:[[/(\s+\<\s+)(@id)/,["keyword.extends","identifier.superclass"]],[/@comment/,"comment"],[/^/,"@rematch",{switchTo:"@>_class&class="}]],tagclass_:[[/(extend)(?=\s+tag )/,"keyword.$1"],[/(global)(?=\s+tag )/,"keyword.$1"],[/(tag)(\s)(@constant)/,["keyword.tag","white.tagname","entity.name.component.local","@tagclass_start="]],[/(tag)(\s)(@id)/,["keyword.tag","white.tagname","entity.name.component.global","@tagclass_start="]]],tagclass_start:[[/(\s+\<\s+)(@id)/,["keyword.extends","identifier.superclass"]],[/@comment/,"comment"],[/^/,"@rematch",{switchTo:"@>_tagclass&component="}]],import_:[[/(import)(?=\s+['"])/,"keyword.import","@>import_source"],[/(import)(\s+type)(?=\s[\w\$\@\{])/,["keyword.import","keyword.type","@>import_body&-_imports=decl-import/part"]],[/(import)@B/,"keyword.import","@>import_body&-_imports=decl-import/part"]],import_body:[I(null,-1,0),[/(@esmIdentifier)( +from)/,["identifier.$F.default","keyword.from",{switchTo:"@import_source"}]],[/(\*)(\s+as\s+)(@esmIdentifier)(\s+from)/,["keyword.star","keyword.as","identifier.$F.ns","keyword.from",{switchTo:"@import_source"}]],[/(@esmIdentifier)(\s*,\s*)(\*)(\s+as\s+)(@esmIdentifier)(from)/,["identifier.$F.default","delimiter.comma","keyword.star","keyword.as","identifier.$F.ns","keyword.from",{switchTo:"@import_source"}]],[/\ *from/,"keyword.from",{switchTo:"@import_source"}],[/\{/,"specifiers.{","@esm_specifiers/part"],[/(@esmIdentifier)/,"identifier.$F",{switchTo:"@/delim"}],[/\s*\,\s*/,"delimiter.comma",{switchTo:"@/part"}],"comma_","common_"],import_source:[I(null,-1,0),[/["']/,"path.open","@_path=$#"],Ae],export_:[[/(export)( +)(default)@B/,["keyword.export","white","keyword.default"]],[/(export)(?= +(let|const|var|class|tag)@B)/,"keyword.export"],[/(export)( +)(global)@B/,["keyword.export","white","keyword.global"]],[/(export)(\s+\*\s+)(from)@B/,["keyword.export","operator.star","keyword.from","@>import_source"]],[/(export)@B/,"keyword.export","@>export_body"]],export_body:[I(null,-1,0),[/(\*)(\s+as\s+)(@esmIdentifier)/,["keyword.star","keyword.as","identifier.const.export"]],[/(@esmIdentifier)(\s+as\s+)(default)/,["alias","keyword.as","alias.default"]],[/(@esmIdentifier)(\s+as\s+)(@esmIdentifier)/,["alias","keyword.as","identifier.const.export"]],[/from/,"keyword.from",{switchTo:"@import_source"}],[/\{/,"{","@esm_specifiers=export/part"],[/(@esmIdentifier)/,"identifier.const.export"],[/\*/,"operator.star"],"comma_","common_"],esm_specifiers:[[/\}/,"}","@pop"],[/(@esmIdentifier)(\s+as\s+)(@esmIdentifier)/,["alias","keyword.as","identifier.const.$F",{switchTo:"@/delim"}]],[/@esmIdentifier/,{cases:{"$/==part":{token:"identifier.const.$S4",switchTo:"@/delim"},"@default":{token:"invalid"}}}],[/\s*\,\s*/,"delimiter.comma",{switchTo:"@/part"}],"whitespace"],_path:[[/[^"'\`\{\\]+/,"path"],[/@escapes/,"path.escape"],[/\./,"path.escape.invalid"],[/\{/,"invalid"],[/["'`]/,{cases:{"$#==$F":{token:"path.close",next:"@pop"},"@default":"path"}}]],member_:[[/(constructor)@B/,"entity.name.constructor","@>def_params&def/def"],[/(def|get|set)(\s)(@defid)/,["keyword.$1","white.entity","entity.name.$1","@>def_params&$1/$1"]],[/(def|get|set)(\s)(\[)/,["keyword.$1","white.entity","$$","@>def_dynamic_name/$1"]]],func_:[[/export(?=\s+(get|set|def|global) )/,"keyword.export"],[/global(?=\s+(get|set|def) )/,"keyword.global"],[/(def)(\s)(@id)(\.)(@defid)/,["keyword.$1","white.entity","identifier.target","operator","entity.name.def","@>def_params&$1/$1"]],[/(def)(\s)(@defid)/,["keyword.$1","white.entity","entity.name.function.decl-const-func","@>def_params&$1/$1"]]],flow_:[[/(if|else|elif|unless)(?=\s|$)/,["keyword.$1","@flow_start=$1"]]],flow_start:[I({switchTo:"@>_flow&$F"},-1,-1),[/[ \t]+/,"white"],"expr_"],for_:[[/for(?: own)?@B/,"keyword.$#","@for_start&forscope=decl-for"]],while_:[[/(while|until)@B/,"keyword.$#","@>while_body"]],while_body:[I(2,-1,0),"block_"],for_start:[I({switchTo:"@>for_body"},-1,-1),[/\[/,"array.[","@array_var_body"],[/\{/,"object.{","@object_body"],[/(@variable)/,"identifier.$F"],[/(\s*\,\s*)/,"separator","@=decl-for-index"],[/\s(in|of)@B/,"keyword.$1",{switchTo:"@>for_source="}],[/[ \t]+/,"white"],"type_"],for_source:[I({switchTo:"@>for_body"},-1,{switchTo:"@for_body"}),"expr_",[/[ \t]+/,"white"]],for_body:[I(2,-1,0),"block_"],decorator_:[[/(@decid)(\()/,["decorator","$2","@_decorator_params"]],[/(@decid)/,"decorator"]],_decorator_params:[[/\)/,")","@pop"],"params_"],field_:[[/((?:lazy )?)((?:static )?)(const|let|attr)(?=\s|$)/,["keyword.lazy","keyword.static","keyword.$1","@_vardecl=field-$3"]],[/(static\s+)(?=@fieldid)/,"keyword.static"],[/(@fieldid)(?=$)/,"entity.name.field"],[/(@fieldid)/,["entity.name.field","@_field_1"]]],_field_1:[I(null,-1,-1),"type_",[/(\s*=)(?!\=)/,["operator.assign","@>_field_value&field"]],[/(\s*(?:\@)set\s*)/,["keyword.spy","@>_def&spy"]]],_field_value:[I(2,-1,0),"block_",[/(\s*(?:\@)set\s*)/,["@rematch","@pop"]]],var_:[[/((?:export )?)(const|let)(?=\s[\[\{\$a-zA-Z]|\s*$)/,["keyword.export","keyword.$1","@_vardecl=decl-$2"]],[/((?:export )?)(const|let)(?=\s|$)/,["keyword.export","keyword.$1"]]],inline_var_:[[/(const|let)(?=\s[\[\{\$a-zA-Z]|\s*$)/,["keyword.$1","@inline_var_body=decl-$1"]]],string_:[[/"""/,"string",'@_herestring="""'],[/'''/,"string","@_herestring='''"],[/["'`]/,"string.open","@_string=$#"]],number_:[[/0[xX][0-9a-fA-F_]+/,"number.hex"],[/0[b][01_]+/,"number.binary"],[/0[o][0-9_]+/,"number.octal"],[/(\d+)([a-z]+|\%)/,["number","unit"]],[/(\d*\.\d+(?:[eE][\-+]?\d+)?)([a-z]+|\%)/,["number.float","unit"]],[/\d+[eE]([\-+]?\d+)?/,"number.float"],[/\d[\d_]*\.\d[\d_]*([eE][\-+]?\d+)?/,"number.float"],[/\d[\d_]*/,"number.integer"],[/0[0-7]+(?!\d)/,"number.octal"],[/\d+/,"number"]],_string:[[/[^"'\`\{\\]+/,"string"],[/@escapes/,"string.escape"],[/\./,"string.escape.invalid"],[/\{/,{cases:{"$F=='":"string","@default":{token:"string.bracket.open",next:"@interpolation_body"}}}],[/["'`]/,{cases:{"$#==$F":{token:"string.close",next:"@pop"},"@default":"string"}}],[/#/,"string"]],_herestring:[[/("""|''')/,{cases:{"$1==$F":{token:"string",next:"@pop"},"@default":"string"}}],[/[^#\\'"\{]+/,"string"],[/['"]+/,"string"],[/@escapes/,"string.escape"],[/\./,"string.escape.invalid"],[/\{/,{cases:{'$F=="""':{token:"string",next:"@interpolation_body"},"@default":"string"}}],[/#/,"string"]],interpolation_body:[[/\}/,"string.bracket.close","@pop"],"expr_"],_class:[I(St,-1,0),"css_","member_","comment_","decorator_",[/(get|set|def|static|prop|attr)@B/,"keyword.$0"],"field_","common_"],_tagclass:["_class",[/(?=\<self)/,"entity.name.def.render","@_render&def"]],def_params:[[/\(/,"(","@def_parens"],[/^/,"@rematch",{switchTo:"@_def"}],[/do@B/,"keyword.do",{switchTo:"@_def"}],"params_",[/@comment/,"comment"]],def_parens:[[/\)/,")","@pop"],"params_"],def_dynamic_name:[["]",{token:"square.close",switchTo:"@def_params&$/"}],"expr_"],_render:[I(2,-1,-1),"block_"],_def:[I(2,-1,0),"block_"],_flow:[I(2,-1,0),"block_"],_varblock:[I(1,-1,-1),[/\[/,"array.[","@array_var_body"],[/\{/,"object.{","@object_body"],[/(@variable)/,"identifier.$F"],[/\s*\,\s*/,"separator"],[/(\s*\=\s*)(?=(for|while|until|if|unless|try)\s)/,"operator","@pop"],[/(\s*\=\s*)/,"operator","@var_value="],"type_",[/#(\s.*)?\n?$/,"comment"]],_vardecl:[I(null,-1,-1),[/\[/,"array.[","@array_var_body"],[/\{/,"object.{","@object_body"],[/(@variable)(?=\n|,|$)/,"identifier.$F","@pop"],[/(@variable)/,"identifier.$F"],[/(\s*\=\s*)/,"operator.declval",{switchTo:"@var_value&value="}],"type_"],array_var_body:[[/\]/,"]","@pop"],[/\{/,"object.{","@object_body"],[/\[/,"array.[","@array_var_body"],"spread_",[/(@variable)/,"identifier.$F"],[/(\s*\=\s*)/,"operator.assign","@array_var_body_value="],[",","delimiter"]],array_var_body_value:[[/(?=,|\)|]|})/,"delimiter","@pop"],"expr_"],inline_var_body:[[/\[/,"array.[","@array_var_body"],[/\{/,"object.{","@object_body"],[/(@variable)/,"identifier.$F"],[/(\s*\=\s*)/,"operator","@pop"],"type_"],var_value:[[/(?=,|\)|]|})/,"delimiter","@pop"],I({switchTo:"@>block"},-1,-1),"block_"],common_:[[/^(\t+)(?=\n|$)/,"white.tabs"],"whitespace"],comma_:[[/\s*,\s*/,"delimiter.comma"]],spread_:[[/\.\.\./,"operator.spread"]],type_:[[/\\/,"@rematch","@_type&-_type/0"]],_type:[I(-1,-1,-1),[/\\/,"delimiter.type.prefix"],[/\[/,"delimiter.type","@/]"],[/\(/,"delimiter.type","@/)"],[/\{/,"delimiter.type","@/}"],[/\</,"delimiter.type","@/>"],[/\|/,"delimiter.type.union"],[/\,|\s|\=|\./,{cases:{"$/==0":{token:"@rematch",next:"@pop"},"@default":"type"}}],[/[\]\}\)\>]/,{cases:{"$#==$/":{token:"delimiter.type",next:"@pop"},"@default":{token:"@rematch",next:"@pop"}}}],[/[\w\-\$]+/,"type"]],css_:[[/global(?=\s+css@B)/,"keyword.$#"],[/css(?:\s+)?/,"keyword.css","@>css_selector&rule-_sel"]],sel_:[[/(\%)((?:@id)?)/,["style.selector.mixin.prefix","style.selector.mixin"]],[/(\@)(\.{0,2}[\w\-\<\>\!]*\+?)/,"style.selector.modifier"],[/(\@)(\.{0,2}[\w\-\<\>\!]*)/,"style.selector.modifier"],[/\.([\w\-]+)/,"style.selector.class-name"],[/\#([\w\-]+)/,"style.selector.id"],[/([\w\-]+)/,"style.selector.element"],[/(>+|~|\+)/,"style.selector.operator"],[/(\*+)/,"style.selector.element.any"],[/(\$)((?:@id)?)/,["style.selector.reference.prefix","style.selector.reference"]],[/\&/,"style.selector.context"],[/\(/,"delimiter.selector.parens.open","@css_selector_parens"],[/\[/,"delimiter.selector.attr.open","@css_selector_attr"],[/\s+/,"white"],[/,/,"style.selector.delimiter"],[/#(\s.*)?\n?$/,"comment"]],css_props:[I(null,-1,0),[/(?=@cssPropertyKey)/,"","@css_property&-_styleprop-_stylepropkey"],[/#(\s.*)?\n?$/,"comment"],[/(?=[\%\*\w\&\$\>\.\[\@\!]|\#[\w\-])/,"","@>css_selector&rule-_sel"],[/\s+/,"white"]],css_selector:[I({switchTo:"@css_props"},-1,{token:"@rematch",switchTo:"@css_props&_props"}),[/(\}|\)|\])/,"@rematch","@pop"],[/(?=\s*@cssPropertyKey)/,"",{switchTo:"@css_props&_props"}],[/\s*#\s/,"@rematch",{switchTo:"@css_props&_props"}],"sel_"],css_inline:[[/\]/,"style.close","@pop"],[/(?=@cssPropertyKey)/,"","@css_property&-_styleprop-_stylepropkey"],[/(?=@cssPropertyPath\])/,"","@css_property&-_styleprop-_stylepropkey"]],css_selector_parens:[[/\)/,"delimiter.selector.parens.close","@pop"],"sel_"],css_selector_attr:[[/\]/,"delimiter.selector.parens.close","@pop"],"sel_"],css_property:[I(null,-1,-1),[/\]/,"@rematch","@pop"],[/(\d+)(@id)/,["style.property.unit.number","style.property.unit.name"]],[/((--|\$)@id)/,"style.property.var"],[/(-*@id)/,"style.property.name"],[/@cssModifier/,"style.property.modifier"],[/(\@+|\.+)(@id\-?)/,["style.property.modifier.start","style.property.modifier"]],[/\+(@id)/,"style.property.scope"],[/\s*([\:\=]\s*)(?=@br|$)/,"style.property.operator",{switchTo:"@>css_multiline_value&_stylevalue"}],[/\s*([\:\=]\s*)/,"style.property.operator",{switchTo:"@>css_value&_stylevalue"}]],css_value_:[[/(x?xs|sm\-?|md\-?|lg\-?|xx*l|\dxl|hg|x+h)\b/,"style.value.size"],[/\#[0-9a-fA-F]+/,"style.value.color.hex"],[/((--|\$)@id)/,"style.value.var"],[/(@optid)(\@+|\.+)(@optid)/,["style.property.name","style.property.modifier.prefix","style.property.modifier"]],"op_","string_","number_","comment_",[/\s+/,"style.value.white"],[/\(/,"delimiter.style.parens.open","@css_expressions"],[/\{/,"delimiter.style.curly.open","@css_interpolation&-_styleinterpolation"],[/(@id)/,"style.value"]],css_value:[I({switchTo:"@>css_multiline_value"},-1,-1),[/@cssPropertyKey/,"@rematch","@pop"],[/;/,"style.delimiter","@pop"],[/(\}|\)|\])/,"@rematch","@pop"],"css_value_"],css_multiline_value:[I(null,-1,0),[/@cssPropertyKey/,"invalid"],"css_value_"],css_expressions:[[/\)/,"delimiter.style.parens.close","@pop"],[/\(/,"delimiter.style.parens.open","@css_expressions"],"css_value"],css_interpolation:[[/\}/,"delimiter.style.curly.close","@pop"],"expr_"],expressions:[[/\,/,"delimiter.comma"]],whitespace:[[/[\r\n]+/,"br"],[/[ \t\r\n]+/,"white"]],space:[[/[ \t]+/,"white"]],tag_:[[/(\s*)(<)(?=\.)/,["white","tag.open","@_tag/flag"]],[/(\s*)(<)(?=\w|\{|\[|\%|\#|>)/,["white","tag.open","@_tag/name"]]],tag_content:[I(2,-1,0),[/\)|\}|\]/,"@rematch","@pop"],"common_","flow_","var_","for_","css_","expr_","do_"],tag_children:[],_tag:[[/\/>/,"tag.close","@pop"],[/>/,"tag.close",{switchTo:"@>tag_content=&-_tagcontent"}],[/>/,"tag.close","@pop"],[/(\-?\d+)/,"tag.$S3"],[/(\%)(@id)/,["tag.mixin.prefix","tag.mixin"]],[/\#@id/,"tag.id"],[/\./,{cases:{"$/==event":{token:"tag.event-modifier.start",switchTo:"@/event-modifier"},"$/==event-modifier":{token:"tag.event-modifier.start",switchTo:"@/event-modifier"},"$/==modifier":{token:"tag.modifier.start",switchTo:"@/modifier"},"$/==rule":{token:"tag.rule-modifier.start",switchTo:"@/rule-modifier"},"$/==rule-modifier":{token:"tag.rule-modifier.start",switchTo:"@/rule-modifier"},"@default":{token:"tag.flag.start",switchTo:"@/flag"}}}],[/(\$@id)/,{cases:{"$/==name":"tag.reference","@default":"tag.$/"}}],[/\{/,"tag.$/.interpolation.open","@_tag_interpolation"],[/\[/,"style.open","@css_inline"],[/(\s*\=\s*)/,"operator.equals.tagop.tag-$/","@_tag_value&-value"],[/\:/,{token:"tag.event.start",switchTo:"@/event"}],"tag_event_",[/(\-?@tagIdentifier)(\:@id)?/,{cases:{"$/==attr":{token:"@rematch",next:"@_tag_attr&-_tagattr"},"@default":{token:"tag.$/"}}}],[/\(/,{token:"tag.$/.parens.open",next:"@_tag_parens/0"}],[/\s+/,{token:"tag.white",switchTo:"@/attr"}],"comment_"],tag_event_:[[/(?=\@@optid)/,"","@_tag_event&-_listener"]],_tag_part:[[/\)|\}|\]|\>/,"@rematch","@pop"]],_tag_event:["_tag_part",[/(\@)(@optid)/,["tag.event.start","tag.event.name"]],[/(\.)(@optid)/,["tag.event-modifier.start","tag.event-modifier.name"]],[/\(/,{token:"tag.$/.parens.open",next:"@_tag_parens/0"}],[/(\s*\=\s*)/,"operator.equals.tagop.tag-$/","@_tag_value&handler"],[/\s+/,"@rematch","@pop"]],tag_attr_:[[/(?=@tagIdentifier(\:@id)?)/,"","@_tag_attr&-_attribute"]],_tag_attr:["_tag_part",[/(\-?@tagIdentifier)(\:@id)?/,"tag.attr"],[/\.(@optid)/,"tag.event-modifierzz"],[/\(/,{token:"tag.parens.open.$/",next:"@_tag_parens/0"}],[/(\s*\=\s*)/,"operator.equals.tagop.tag-$/","@_tag_value&-tagattrvalue"],[/\s+/,"@rematch","@pop"]],_tag_interpolation:[[/\}/,"tag.$/.interpolation.close","@pop"],"expr_",[/\)|\]/,"invalid"]],_tag_parens:[[/\)/,"tag.$/.parens.close","@pop"],"arglist_",[/\]|\}/,"invalid"]],_tag_value:[[/(?=(\/?\>|\s))/,"","@pop"],"attr_expr_"],regexp_:[[/\/(?!\ )(?=([^\\\/]|\\.)+\/)/,{token:"regexp.slash.open",bracket:"@open",next:"@_regexp"}],[/\/\/\//,{token:"regexp.slash.open",bracket:"@open",next:"@_hereregexp"}],[/(\/)(\/)/,["regexp.slash.open","regexp.slash.close"]]],_regexp:[[/(\{)(\d+(?:,\d*)?)(\})/,["regexp.escape.control","regexp.escape.control","regexp.escape.control"]],[/(\[)(\^?)(?=(?:[^\]\\\/]|\\.)+)/,["regexp.escape.control",{token:"regexp.escape.control",next:"@_regexrange"}]],[/(\()(\?:|\?=|\?!)/,["regexp.escape.control","regexp.escape.control"]],[/[()]/,"regexp.escape.control"],[/@regexpctl/,"regexp.escape.control"],[/[^\\\/]/,"regexp"],[/@regexpesc/,"regexp.escape"],[/\\:/,"regexp.escape"],[/\\\./,"regexp.invalid"],[/(\/)(\w+)/,[{token:"regexp.slash.close"},{token:"regexp.flags",next:"@pop"}]],["/",{token:"regexp.slash.close",next:"@pop"}],[/./,"regexp.invalid"]],_regexrange:[[/-/,"regexp.escape.control"],[/\^/,"regexp.invalid"],[/@regexpesc/,"regexp.escape"],[/[^\]]/,"regexp"],[/\]/,"regexp.escape.control","@pop"]],_hereregexp:[[/[^\\\/#]/,"regexp"],[/\\./,"regexp"],[/#.*$/,"comment"],["///[igm]*","regexp","@pop"],[/\//,"regexp"],"comment_"]};function ge(s){let e=["$S1","$S2","$S3","$S4","$S5","$S6"];if(s.match(/\@(pop|push|popall)/)||(s[0]=="@"&&(s=s.slice(1)),s.indexOf(".")>=0))return s;s=ye(s),s[0]==">"&&(e[1]="$S6 ",s=s.slice(1));for(let t=0,r=Oe(s.split(/(?=[\/\&\=\*])/)),n=r.length;t<n;t++){let i=r[t];i[0]=="&"?i[1]=="-"||i[1]=="_"?e[2]="$S3"+i.slice(1):e[2]="$S3-"+i.slice(1):i[0]=="+"?e[3]="$S4-"+i.slice(1):i[0]=="="?e[3]=i.slice(1):i[0]=="/"?e[4]=i.slice(1):i[0]=="*"?e[5]=i.slice(1):e[0]=i}return e.join(".")}function ye(s){let e=s;return s=s.replace("$/","$S5"),s=s.replace("$F","$S4"),s=s.replace("$&","$S3"),s=s.replace("$I","$S2"),s=s.replace("$T","$S2"),s}function Me(s,e){if(typeof s=="string"&&(s={token:s}),s&&s.token!=null)s.token=ye(s.token),typeof e=="string"?s.next=e:e&&Object.assign(s,e),s.next&&(s.next=ge(s.next)),s.switchTo&&(s.switchTo=ge(s.switchTo));else if(s&&s.cases){let t={};for(let r=s.cases,n=0,i=Object.keys(r),l=i.length,o,f;n<l;n++){o=i[n],f=r[o];let c=ye(o);t[c]=Me(f)}s.cases=t}else if(s instanceof Array){let t=[],r=null;for(let n=0,i=Oe(s),l=i.length;n<l;n++){let o=i[n];o[0]=="@"&&n==s.length-1&&r&&(o={next:o}),typeof o=="object"?o.token!=null||o.cases?t.push(r=Object.assign({},o)):Object.assign(r,o):typeof o=="string"&&t.push(r={token:ye(o)})}s=t}if(s instanceof Array)for(let t=0,r=Oe(s),n=r.length;t<n;t++){let i=r[t];i.token&&i.token.indexOf("$$")>=0&&(i.token=i.token.replace("$$","$"+(t+1))),i.next&&(i.next=ge(i.next)),i.switchTo&&(i.switchTo=ge(i.switchTo))}return s}for(let s=0,e=Object.keys(Ee),t=e.length,r,n;s<t;s++){r=e[s],n=Ee[r];let i=0;for(;i<n.length;){let l=n[i];if(l[0]instanceof Array){n.splice(i,1,...l);continue}else typeof l=="string"?n[i]={include:l}:l[1]instanceof Array?l[1]=Me(l[1]):l instanceof Array&&l.splice(1,2,Me(l[1],l[2]));i++}}var _e={defaultToken:"invalid",ignoreCase:!1,tokenPostfix:"",brackets:[{open:"{",close:"}",token:"bracket.curly"},{open:"[",close:"]",token:"bracket.square"},{open:"(",close:")",token:"bracket.parenthesis"}],keywords:["def","and","or","is","isnt","not","on","yes","@","no","off","true","false","null","this","self","as","new","delete","typeof","in","instanceof","return","throw","break","continue","debugger","if","elif","else","switch","for","while","do","try","catch","finally","class","extends","super","undefined","then","unless","until","loop","of","by","when","tag","prop","attr","export","import","extend","var","let","const","require","isa","await"],boolean:["true","false","yes","no","undefined","null"],operators:["=","!","~","?",":","!!","??","&","|","^","%","<<","!&",">>",">>>","+=","-=","*=","/=","&=","|=","??=","^=","%=","~=","<<=",">>=",">>>=","..","...","||=","&&=","**=","**","|=?","~=?","^=?","=?","and","or"],assignments:["=","|=?","~=?","^=?","=?","^=","%=","~=","<<=",">>=",">>>=","||=","&&=","??=","+=","-=","*=","/=","&=","|=","**="],logic:[">","<","==","<=",">=","!=","&&","||","===","!=="],ranges:["..","..."],spread:["..."],dot:["."],access:[".",".."],math:["+","-","*","/","++","--"],unspaced_ops:ar("... . .. + * ++ --"),comment:/#(\s.*)?(\n|$)/,symbols:/[=><!~?&%|+\-*\^,]+/,escapes:/\\(?:[abfnrtv\\"'$]|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,postaccess:/(:(?=\w))?/,ivar:/\@[a-zA-Z_]\w*/,B:/(?=\s|$)/,br:/[\r\n]+/,constant:/[A-Z][\w\$]*(?:\-+[\w\$]+)*/,id:/[A-Za-z_\$][\w\$]*(?:\-+[\w\$]+)*\??/,plainid:/[A-Za-z_\$][\w\$]*(?:\-+[\w\$]+)*\??/,fieldid:/[\@\#]*@plainid/,propid:/[\@\#]*@plainid/,defid:/[\@\#]*@plainid/,decid:/\@@plainid/,symid:/\#+@plainid/,symref:/\#\#@plainid/,optid:/(?:@id)?/,esmIdentifier:/[A-Za-z_\$\@][\w\$]*(?:\-+[\w\$]+)*\??/,propertyPath:/(?:[A-Za-z_\$][A-Za-z\d\-\_\$]*\.)?(?:[A-Za-z_\$][A-Za-z\d\-\_\$]*)/,tagNameIdentifier:/(?:[\w\-]+\:)?\w+(?:\-\w+)*/,variable:/[\w\$]+(?:-[\w\$]*)*\??/,varKeyword:/var|let|const/,tagIdentifier:/-*[a-zA-Z][\w\-]*/,implicitCall:/(?!\s(?:and|or|is|isa)\s)(?=\s[\w\'\"\/\[\{])/,cssModifier:/(?:\@+[\<\>\!]?[\w\-]+\+?|\.+@id\-?)/,cssPropertyPath:/[\@\.]*[\w\-\$]+(?:[\@\.]+[\w\-\$]+)*/,cssVariable:/(?:--|\$)[\w\-\$]+/,cssPropertyName:/[\w\-\$]+/,cssPropertyKey:/(?:@cssPropertyName(?:@cssModifier)*|@cssModifier+)(?:\s*[\:\=])/,cssUpModifier:/\.\.[\w\-\$]+/,cssIsModifier:/\.[\w\-\$]+/,regEx:/\/(?!\/\/)(?:[^\/\\]|\\.)*\/[igm]*/,regexpctl:/[(){}\[\]\$\^|\-*+?\.]/,regexpesc:/\\(?:[bBdDfnrstvwWn0\\\/]|@regexpctl|c[A-Z]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})/,tokenizer:Ee};function cr(s){return Array.isArray(s)}function Ct(s){return!cr(s)}function Be(s){return typeof s=="string"}function $t(s){return!Be(s)}function It(s){return!s}function U(s,e){return s.ignoreCase&&e?e.toLowerCase():e}function Le(s){return s.replace(/[&<>'"_]/g,"-")}function At(s,e){console.log(`${s.languageId}: ${e}`)}function O(s,e){return new Error(`${s.languageId}: ${e}`)}var Ot={};function pr(s){let e=[],t=0,r=s.length,n="",i=0;for(;t<r;){let l=s[t++];if(l=="$"){let o=s[t++];if(o=="$"){n+="$";continue}n&&e.push(n),n="",o=="#"?e.push(0):o=="S"?e.push(parseInt(s[t++])+100):e.push(parseInt(o)+1)}else n+=l}return n&&e.push(n),Ot[s]=e,e}function q(s,e,t,r,n){let i=null,l=Ot[e]||pr(e),o="";for(let f=0;f<l.length;f++){let c=l[f];typeof c=="string"?o+=c:c>100?(i===null&&(i=n.split(".")),o+=i[c-101]||""):c===100?o+=n:c===0?o+=t:c>0&&(o+=r[c-1])}return o}var ze={};function ke(s,e){let t=e;if(ze[t])return s.tokenizer[ze[t]];for(;t&&t.length>0;){let r=s.tokenizer[t];if(r)return ze[e]=t,r;let n=t.lastIndexOf(".");n<0?t=null:t=t.substr(0,n)}return null}function Et(s,e){let t=e;for(;t&&t.length>0;){if(s.stateNames[t])return!0;let n=t.lastIndexOf(".");n<0?t=null:t=t.substr(0,n)}return!1}function ur(s,e){if(!e||!Array.isArray(e))return!1;for(let t of e)if(!s(t))return!1;return!0}function zt(s,e){return typeof s=="boolean"?s:e}function Bt(s,e){return typeof s=="string"?s:e}function hr(s){let e={};for(let t of s)e[t]=!0;return e}function Lt(s,e=!1){e&&(s=s.map(function(r){return r.toLowerCase()}));let t=hr(s);return e?function(r){return t[r.toLowerCase()]!==void 0&&t.hasOwnProperty(r.toLowerCase())}:function(r){return t[r]!==void 0&&t.hasOwnProperty(r)}}function Fe(s,e){let t=0;for(;e.indexOf("@")>=0&&t<5;)t++,e=e.replace(/@(\w+)/g,function(r,n){let i="";if(typeof s[n]=="string")i=s[n];else if(s[n]&&s[n]instanceof RegExp)i=s[n].source;else throw s[n]===void 0?O(s,"language definition does not contain attribute '"+n+"', used at: "+e):O(s,"attribute reference '"+n+"' must be a string, used at: "+e);return It(i)?"":"(?:"+i+")"});return new RegExp(e,s.ignoreCase?"i":"")}function mr(s,e,t,r){if(r<0)return s;if(r<e.length)return e[r];if(r>=100){r=r-100;let n=t.split(".");if(n.unshift(t),r<n.length)return n[r]}return null}function dr(s,e,t,r){let n=-1,i=t,l=t.match(/^\$(([sS]?)(\d\d?)|#)(.*)$/);l&&(l[3]&&(n=parseInt(l[3]),l[2]&&(n=n+100)),i=l[4]);let o="~",f=i;!i||i.length===0?(o="!=",f=""):/^\w*$/.test(f)?o="==":(l=i.match(/^(@|!@|~|!~|==|!=)(.*)$/),l&&(o=l[1],f=l[2]));let c;if((o==="~"||o==="!~")&&/^(\w|\|)*$/.test(f)){let a=Lt(f.split("|"),s.ignoreCase);c=function(p){return o==="~"?a(p):!a(p)}}else if(o==="@"||o==="!@"){let a=s[f];if(!a)throw O(s,"the @ match target '"+f+"' is not defined, in rule: "+e);if(!ur(function(u){return typeof u=="string"},a))throw O(s,"the @ match target '"+f+"' must be an array of strings, in rule: "+e);let p=Lt(a,s.ignoreCase);c=function(u){return o==="@"?p(u):!p(u)}}else if(o==="~"||o==="!~")if(f.indexOf("$")<0){let a=Fe(s,"^"+f+"$");c=function(p){return o==="~"?a.test(p):!a.test(p)}}else c=function(a,p,u,h){return Fe(s,"^"+q(s,f,p,u,h)+"$").test(a)};else if(f.indexOf("$")<0){let a=U(s,f);c=function(p){return o==="=="?p===a:p!==a}}else{let a=U(s,f);c=function(p,u,h,T,v){let A=q(s,a,u,h,T);return o==="=="?p===A:p!==A}}return n===-1?{name:t,value:r,test:function(a,p,u,h){return c(a,a,p,u,h)}}:{name:t,value:r,test:function(a,p,u,h){let T=mr(a,p,u,n);return c(T||"",a,p,u,h)}}}function Pe(s,e,t){if(t){if(typeof t=="string")return t;if(t.token||t.token===""){if(typeof t.token!="string")throw O(s,"a 'token' attribute must be of type string, in rule: "+e);{let r={token:t.token};if(t.token.indexOf("$")>=0&&(r.tokenSubst=!0),typeof t.bracket=="string")if(t.bracket==="@open")r.bracket=1;else if(t.bracket==="@close")r.bracket=-1;else throw O(s,"a 'bracket' attribute must be either '@open' or '@close', in rule: "+e);if(t.next){if(typeof t.next!="string")throw O(s,"the next state must be a string value in rule: "+e);{let n=t.next;if(!/^(@pop|@push|@popall)$/.test(n)&&(n[0]==="@"&&(n=n.substr(1)),n.indexOf("$")<0&&!Et(s,q(s,n,"",[],""))))throw O(s,"the next state '"+t.next+"' is not defined in rule: "+e);r.next=n}}return typeof t.goBack=="number"&&(r.goBack=t.goBack),typeof t.switchTo=="string"&&(r.switchTo=t.switchTo),typeof t.log=="string"&&(r.log=t.log),typeof t._push=="string"&&(r._push=t._push),typeof t._pop=="string"&&(r._pop=t._pop),typeof t.mark=="string"&&(r.mark=t.mark),typeof t.fn=="string"&&(r.fn=t.fn),typeof t.nextEmbedded=="string"&&(r.nextEmbedded=t.nextEmbedded,s.usesEmbedded=!0),r}}else if(Array.isArray(t)){let r=[];for(let n=0,i=t.length;n<i;n++)r[n]=Pe(s,e,t[n]);return{group:r}}else if(t.cases){let r=[];for(let i in t.cases)if(t.cases.hasOwnProperty(i)){let l=Pe(s,e,t.cases[i]);i==="@default"||i==="@"||i===""?r.push({test:void 0,value:l,name:i}):i==="@eos"?r.push({test:function(o,f,c,a){return a},value:l,name:i}):r.push(dr(s,e,i,l))}let n=s.defaultToken;return{test:function(i,l,o,f){for(let c of r)if(!c.test||c.test(i,l,o,f))return c.value;return n}}}else throw O(s,"an action must be a string, an object with a 'token' or 'cases' attribute, or an array of actions; in rule: "+e)}else return{token:""}}var Re=class{constructor(e){this.regex=new RegExp("");this.action={token:""};this.matchOnlyAtLineStart=!1;this.name="";this.name=e,this.stats={time:0,count:0,hits:0}}setRegex(e,t){let r;if(typeof t=="string")r=t;else if(t instanceof RegExp)r=t.source;else throw O(e,"rules must start with a match string or regular expression: "+this.name);r.length==2&&r[0]=="\\"&&/[\{\}\(\)\[\]]/.test(r[1])&&(this.string=r[1]),this.matchOnlyAtLineStart=r.length>0&&r[0]==="^",this.name=this.name+": "+r,this.regex=Fe(e,"^(?:"+(this.matchOnlyAtLineStart?r.substr(1):r)+")")}setAction(e,t){this.action=Pe(e,this.name,t)}};function be(s,e){if(!e||typeof e!="object")throw new Error("Monarch: expecting a language definition object");let t={};t.languageId=s,t.noThrow=!1,t.maxStack=100,t.start=typeof e.start=="string"?e.start:null,t.ignoreCase=zt(e.ignoreCase,!1),t.tokenPostfix=Bt(e.tokenPostfix,"."+t.languageId),t.defaultToken=Bt(e.defaultToken,"source"),t.usesEmbedded=!1;let r=e;r.languageId=s,r.ignoreCase=t.ignoreCase,r.noThrow=t.noThrow,r.usesEmbedded=t.usesEmbedded,r.stateNames=e.tokenizer,r.defaultToken=t.defaultToken;function n(l,o,f){for(let c of f){let a=c.include;if(a){if(typeof a!="string")throw O(t,"an 'include' attribute must be a string at: "+l);if(a[0]==="@"&&(a=a.substr(1)),!e.tokenizer[a])throw O(t,"include target '"+a+"' is not defined at: "+l);n(l+"."+a,o,e.tokenizer[a])}else{let p=new Re(l);if(Array.isArray(c)&&c.length>=1&&c.length<=3)if(p.setRegex(r,c[0]),c.length>=3)if(typeof c[1]=="string")p.setAction(r,{token:c[1],next:c[2]});else if(typeof c[1]=="object"){let u=c[1];u.next=c[2],p.setAction(r,u)}else throw O(t,"a next state as the last element of a rule can only be given if the action is either an object or a string, at: "+l);else p.setAction(r,c[1]);else{if(!c.regex)throw O(t,"a rule must either be an array, or an object with a 'regex' or 'include' field at: "+l);c.name&&typeof c.name=="string"&&(p.name=c.name),c.matchOnlyAtStart&&(p.matchOnlyAtLineStart=zt(c.matchOnlyAtLineStart,!1)),p.setRegex(r,c.regex),p.setAction(r,c.action)}o.push(p)}}}if(!e.tokenizer||typeof e.tokenizer!="object")throw O(t,"a language definition must define the 'tokenizer' attribute as an object");t.tokenizer=[];for(let l in e.tokenizer)if(e.tokenizer.hasOwnProperty(l)){t.start||(t.start=l);let o=e.tokenizer[l];t.tokenizer[l]=new Array,n("tokenizer."+l,t.tokenizer[l],o)}if(t.usesEmbedded=r.usesEmbedded,e.brackets){if(!Array.isArray(e.brackets))throw O(t,"the 'brackets' attribute must be defined as an array")}else e.brackets=[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"},{open:"<",close:">",token:"delimiter.angle"}];let i=[];for(let l of e.brackets){let o=l;if(o&&Array.isArray(o)&&o.length===3&&(o={token:o[2],open:o[0],close:o[1]}),o.open===o.close)throw O(t,"open and close brackets in a 'brackets' attribute must be different: "+o.open+`
|
|
hint: use the 'bracket' attribute if matching on equal brackets is required.`);if(typeof o.open=="string"&&typeof o.token=="string"&&typeof o.close=="string")i.push({token:o.token+t.tokenPostfix,open:U(t,o.open),close:U(t,o.close)});else throw O(t,"every element in the 'brackets' array must be a '{open,close,token}' object or array")}return t.brackets=i,t.noThrow=!0,t}var R=class{constructor(e,t,r){this.offset=e|0,this.type=t,this.language=r,this.kind=0,this.mods=0,this.value=null,this.stack=null}toString(){return this.value||""}get span(){return{offset:this.offset,length:this.value?this.value.length:0}}get indent(){return 0}get startOffset(){return this.offset}get endOffset(){return this.offset+(this.value?this.value.length:0)}clone(){let e=new R(this.offset,this.type,this.language);return e.value=this.value,e.stack=this.stack,e}match(e){if(typeof e=="string")if(e.indexOf(" ")>0)e=e.split(" ");else{let t=this.type.indexOf(e);return e[0]=="."?t>=0:t==0}if(e instanceof Array)for(let t of e){let r=this.type.indexOf(t);if(t[0]=="."?r>=0:r==0)return!0}return e instanceof RegExp?e.test(this.type):!1}},xe=class{constructor(e,t){this.tokens=e,this.endState=t}};var Ft=10;function fe(s,e){return s.split(".")[e]}var je=class{static create(e,t){return this._INSTANCE.create(e,t)}constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}create(e,t){if(e!==null&&e.depth>=this._maxCacheDepth)return new H(e,t);let r=H.getStackElementId(e);r.length>0&&(r+="|"),r+=t;let n=this._entries[r];return n||(n=new H(e,t),this._entries[r]=n,n)}},ee=je;ee._INSTANCE=new je(Ft);var H=class{constructor(e,t){this.parent=e,this.state=t,this.depth=(this.parent?this.parent.depth:0)+1}static getStackElementId(e){let t="";for(;e!==null;)t.length>0&&(t+="|"),t+=e.state,e=e.parent;return t}static _equals(e,t){for(;e!==null&&t!==null;){if(e===t)return!0;if(e.state!==t.state)return!1;e=e.parent,t=t.parent}return e===null&&t===null}get indent(){return this.state.lastIndexOf(" ")-this.state.indexOf(" ")}get scope(){return this.part(2)}get detail(){return this.part(2)}part(e){return this.state.split(".")[e]}equals(e){return H._equals(this,e)}push(e){return ee.create(this,e)}pop(){return this.parent}popall(){let e=this;for(;e.parent;)e=e.parent;return e}switchTo(e){return ee.create(this.parent,e)}},Ve=class{static create(e){return this._INSTANCE.create(e)}constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}create(e){if(e!==null&&e.depth>=this._maxCacheDepth)return new re(e);let t=H.getStackElementId(e),r=this._entries[t];return r||(r=new re(e),this._entries[t]=r,r)}},te=Ve;te._INSTANCE=new Ve(Ft);var re=class{constructor(e){this.stack=e}clone(){return te.create(this.stack)}equals(e){return!(!(e instanceof re)||!this.stack.equals(e.stack))}},Ne=class{constructor(){this._tokens=[],this._language=null,this._lastToken=new R(0,"start","imba"),this._lastTokenType=null}enterMode(e,t){this._language=t}emit(e,t,r){this._lastTokenType;let n=new R(e,t,this._language);return this._lastTokenType=t,this._lastToken=n,this._tokens.push(n),n}finalize(e){return new xe(this._tokens,e)}},ne=class{constructor(e,t){this._modeId=e,this._lexer=t,this._profile=!1}dispose(){}getLoadStatus(){return{loaded:!0}}getInitialState(){let e=ee.create(null,this._lexer.start);return te.create(e)}tokenize(e,t,r){let n=new Ne,i=this._tokenize(e,t,r,n);return n.finalize(i)}_tokenize(e,t,r,n){return this._myTokenize(e,t,r,n)}_safeRuleName(e){return e?e.name:"(unknown)"}_rescope(e,t,r,n){let i=(e||"").split("-"),l=(t||"").split("-");if(e==t)return;let o=1;for(;i[o]&&i[o]==l[o];)o++;let f=i.length;for(;f>o;)r.push("pop."+i[--f]+"."+f);for(;l.length>o;){let c="push."+l[o++]+"."+(o-1);if(n){let a=fe(n,1);c+="."+a}r.push(c)}}_myTokenize(e,t,r,n){n.enterMode(r,this._modeId);let i=e.length,l=t.stack,o=null,f=0,c=this._profile,a=null,p=!0,u=[],h=0,T=[],v=null,A=-1;for(;p||f<i;){if(h++,h>1e3){if(f==A)throw console.log("infinite recursion",f,i,l,n),"infinite recursion in tokenizer?";A=f,h=0}let _=f,m=l.depth,k=a?a.groups.length:0,w=l.state,b=null,x=null,y=null,M=null;if(a){b=a.matches;let S=a.groups.shift();x=S.matched,y=S.action,M=a.rule,a.groups.length===0&&(a=null)}else{if(!p&&f>=i)break;if(p=!1,T=this._lexer.tokenizer[w],!T&&(T=ke(this._lexer,w),!T))throw O(this._lexer,"tokenizer state is not defined: "+w);let S=e.substr(f);for(let C of T)if(C.string!==void 0){if(S[0]===C.string){b=[C.string],x=C.string,y=C.action;break}}else if(f===0||!C.matchOnlyAtLineStart){if(c){C.stats.count++;let N=performance.now();b=S.match(C.regex),C.stats.time+=performance.now()-N,b&&C.stats.hits++}else b=S.match(C.regex);if(b){x=b[0],y=C.action;break}}}if(b||(b=[""],x=""),y||(f<i&&(b=[e.charAt(f)],x=b[0]),y=this._lexer.defaultToken),x===null)break;for(f+=x.length;Ct(y)&&$t(y)&&y.test;)y=y.test(x,b,w,f===i);let $=null;if(typeof y=="string"||Array.isArray(y))$=y;else if(y.group)$=y.group;else if(y.token!==null&&y.token!==void 0){if(y.tokenSubst?$=q(this._lexer,y.token,x,b,w):$=y.token,y.goBack&&(f=Math.max(0,f-y.goBack)),y.switchTo&&typeof y.switchTo=="string"){let S=q(this._lexer,y.switchTo,x,b,w);if(S[0]==="@"&&(S=S.substr(1)),ke(this._lexer,S)){let C=l.scope,N=fe(S,2);C!==N&&this._rescope(C,N,u,S),l=l.switchTo(S)}else throw O(this._lexer,"trying to switch to a state '"+S+"' that is undefined in rule: "+this._safeRuleName(M))}else{if(y.transform&&typeof y.transform=="function")throw O(this._lexer,"action.transform not supported");if(y.next)if(y.next==="@push"){if(l.depth>=this._lexer.maxStack)throw O(this._lexer,"maximum tokenizer stack size reached: ["+l.state+","+l.parent.state+",...]");l=l.push(w)}else if(y.next==="@pop"){if(l.depth<=1)throw O(this._lexer,"trying to pop an empty stack in rule: "+this._safeRuleName(M));{let S=l;l=l.pop();let C=fe(S.state,2),N=fe(l.state,2);C!==N&&this._rescope(C,N,u,l.state)}}else if(y.next==="@popall")l=l.popall();else{let S=q(this._lexer,y.next,x,b,w);S[0]==="@"&&(S=S.substr(1));let C=fe(S,2);if(ke(this._lexer,S))C!=l.scope&&this._rescope(l.scope||"",C,u,S),l=l.push(S);else throw O(this._lexer,"trying to set a next state '"+S+"' that is undefined in rule: "+this._safeRuleName(M))}}y.log&&typeof y.log=="string"&&At(this._lexer,this._lexer.languageId+": "+q(this._lexer,y.log,x,b,w)),y.mark&&n.emit(_+r,y.mark,l)}if($===null)throw O(this._lexer,"lexer rule has no well-defined action in rule: "+this._safeRuleName(M));if(Array.isArray($)){if(a&&a.groups.length>0)throw O(this._lexer,"groups cannot be nested: "+this._safeRuleName(M));if(b.length!==$.length+1)throw O(this._lexer,"matched number of groups does not match the number of actions in rule: "+this._safeRuleName(M));let S=0;for(let C=1;C<b.length;C++)S+=b[C].length;if(S!==x.length)throw O(this._lexer,"with groups, all characters should be matched in consecutive groups in rule: "+this._safeRuleName(M));a={rule:M,matches:b,groups:[]};for(let C=0;C<$.length;C++)a.groups[C]={action:$[C],matched:b[C+1]};f-=x.length;continue}else{if($==="@rematch"&&(f-=x.length,x="",b=null,$=""),x.length===0)if(i===0||m!==l.depth||w!==l.state||(a?a.groups.length:0)!==k){for(typeof $=="string"&&$&&n.emit(f+r,$,l);u.length>0;)n.emit(f+r,u.shift(),l);continue}else throw O(this._lexer,"no progress in tokenizer in rule: "+this._safeRuleName(M));let S=null;if(Be($)&&$.indexOf("@brackets")===0){let N=$.substr(9),B=gr(this._lexer,x);if(!B)throw O(this._lexer,"@brackets token returned but no bracket defined as: "+x);S=Le(B.token+N)}else{let N=$===""?"":$+this._lexer.tokenPostfix;S=Le(N)}let C=n.emit(_+r,S,l);for(C.stack=l,o&&o!=C&&(o.value=e.slice(o.offset-r,_)),o=C;u.length>0;)n.emit(f+r,u.shift(),l)}}return o&&!o.value&&(o.value=e.slice(o.offset-r)),te.create(l)}};function gr(s,e){if(!e)return null;e=U(s,e);let t=s.brackets;for(let r of t){if(r.open===e)return{token:r.token,bracketType:1};if(r.close===e)return{token:r.token,bracketType:-1}}return null}function yr(s){let e;return s?(e=s.toIterable)?e.call(s):s:[]}var Pt=Symbol.for("#__init__");var se=class{constructor(e=null){this[Pt](e)}[Pt](e=null){this.offset=e?e.offset:void 0,this.text=e?e.text:void 0,this.tokens=e?e.tokens:void 0,this.startState=e?e.startState:void 0,this.endState=e?e.endState:void 0}clone(e=this.offset){let t=[],r=e-this.offset;for(let n=0,i=yr(this.tokens),l=i.length;n<l;n++){let o=i[n],f=o.clone();f.offset=o.offset+r,t.push(f)}return new se({offset:e,startState:this.startState,endState:this.endState,text:this.text,tokens:t})}},_r=be("imba",_e),J=new ne("imba",_r);function Rt(s){let e;return s?(e=s.toIterable)?e.call(s):s:[]}var ie=["comment","string","keyword","number","regexp","operator","namespace","type","struct","class","interface","enum","typeParameter","function","member","macro","variable","parameter","property","label"];for(let s=0,e=Rt(ie),t=e.length;s<t;s++){let r=e[s];ie[r]=s}var z={Declaration:1<<0,Import:1<<1,Export:1<<2,Global:1<<3,ReadOnly:1<<4,Static:1<<5,Modification:1<<6,Deprecated:1<<7,Access:1<<8,Root:1<<9,Special:1<<10,Class:1<<11,Member:1<<12,Function:1<<13,Def:1<<14,Var:1<<15,Let:1<<16,Const:1<<17,Get:1<<18,Set:1<<19},Nt=Object.keys(z).map(function(s){return s.toLowerCase()});for(let s=0,e=Rt(Object.keys(z)),t=e.length;s<t;s++){let r=e[s];z[r.toLowerCase()]=z[r]}var P={Keyword:1<<0,Access:1<<1,Key:1<<2,TagName:1<<3,TagEvent:1<<4,TagFlag:1<<5,TagProp:1<<6,TagEventModifier:1<<7,Value:1<<8,Path:1<<9,StyleProp:1<<10,StyleValue:1<<11,Type:1<<12,StyleModifier:1<<13,StyleSelector:1<<14,VarName:1<<15,ImportName:1<<16},g={Keyword:1<<0,Root:1<<1,Class:1<<2,Block:1<<3},ue={and:g.Block,await:g.Block,begin:g.Block,break:g.Block,by:g.Block,case:g.Block,catch:g.Block,class:g.Block,const:g.Block,continue:g.Block,css:g.Class|g.Root,debugger:g.Block,def:g.Class|g.Block,get:g.Class,set:g.Class,delete:g.Block,do:g.Block,elif:g.Block,else:g.Block,export:g.Root,extends:g.Block,false:g.Block,finally:g.Block,for:g.Block,if:g.Block,import:g.Root,in:g.Block,instanceof:g.Block,is:g.Block,isa:g.Block,isnt:g.Block,let:g.Block,loop:g.Block,module:g.Block,nil:g.Block,no:g.Block,not:g.Block,null:g.Block,of:g.Block,or:g.Block,require:g.Block,return:g.Block,self:g.Block,static:g.Block|g.Class,super:g.Block,switch:g.Block,tag:g.Root,then:g.Block,this:g.Block,throw:g.Block,true:g.Block,try:g.Block,typeof:g.Block,undefined:g.Block,unless:g.Block,until:g.Block,var:g.Block,when:g.Block,while:g.Block,yes:g.Block},L={File:1,Module:2,Namespace:3,Package:4,Class:5,Method:6,Property:7,Field:8,Constructor:9,Enum:10,Interface:11,Function:12,Variable:13,Constant:14,String:15,Number:16,Boolean:17,Array:18,Object:19,Key:20,Null:21,EnumMember:22,Struct:23,Event:24,Operator:25,TypeParameter:26};for(let s=0,e=Object.keys(L),t=e.length,r,n;s<t;s++)r=e[s],n=L[r],L[n]=r;function kr(s){let e;return s?(e=s.toIterable)?e.call(s):s:[]}var jt=Symbol.for("#__init__");var we=Symbol.for("#datatype"),d={None:0,ConstVariable:1<<0,LetVariable:1<<1,Property:1<<2,EnumMember:1<<3,Function:1<<4,Class:1<<5,LocalComponent:1<<6,GlobalComponent:1<<7,RegularEnum:1<<8,ValueModule:1<<9,Parameter:1<<10,TypeLiteral:1<<11,ObjectLiteral:1<<12,Method:1<<13,Constructor:1<<14,GetAccessor:1<<15,SetAccessor:1<<16,Signature:1<<17,TypeParameter:1<<18,TypeAlias:1<<19,ExportValue:1<<20,Alias:1<<21,Prototype:1<<22,ExportStar:1<<23,Optional:1<<24,IsSpecial:1<<27,IsImport:1<<28,IsStatic:1<<29,IsGlobal:1<<30,IsRoot:1<<31};d.Component=d.LocalComponent|d.GlobalComponent;d.Variable=d.LetVariable|d.ConstVariable|d.Parameter;d.Accessor=d.GetAccessor|d.SetAccessor;d.ClassMember=d.Method|d.Accessor|d.Property;d.Scoped=d.Function|d.Variable|d.Class|d.Enum|d.LocalComponent;d.Type=d.Component|d.Class;d.GlobalVar=d.ConstVariable|d.IsGlobal;d.SpecialVar=d.ConstVariable|d.IsSpecial;var Vt=[["entity.name.component.local",0,d.LocalComponent],["entity.name.component.global",0,d.GlobalComponent],["entity.name.function",0,d.Function],["entity.name.class",0,d.Class],["entity.name.constructor",0,d.Method],["entity.name.def",0,d.Method],["entity.name.get",0,d.GetAccessor],["entity.name.set",0,d.SetAccessor],["field",0,d.Property],["decl-let",0,d.LetVariable],["decl-for-index",0,d.LetVariable,{datatype:"\\number"}],["decl-for",0,d.LetVariable,{kind:"for"}],["decl-var",0,d.LetVariable],["decl-param",0,d.Parameter],["decl-const",0,d.ConstVariable],["decl-import",0,d.ConstVariable|d.IsImport]],Ke={},K=class{[jt](e=null){var t;this.value=e?e.value:void 0,this.body=e&&(t=e.body)!==void 0?t:null}static typeMatch(e){if(Ke[e]!=null)return Ke[e];for(let t=0,r=kr(Vt),n=r.length;t<n;t++){let[i,l,o,f]=r[t];if(e.indexOf(i)>=0)return Ke[e]=Vt[t]}return null}static forToken(e,t,r=0){let n=this.typeMatch(t);return n?new this(n[2],e.value,e,n[3]):null}constructor(e,t,r,n=null){this[jt](),this.flags=e,this.name=t,this.node=r,this.desc=n}get importSource(){return this.importedΦ?this.node.context.closest("imports").sourcePath:null}get exportName(){return this.node.prev.match("keyword.as")?this.node.prev.prev.value:this.node.match(".default")?"default":this.node.value}get importInfo(){if(!this.importedΦ)return null;let e=this.node.context.closest("imports");return{exportName:this.exportName,name:this.node.value,isTypeOnly:e.isTypeOnly,path:e.sourcePath}}get datatype(){let e,t=this.desc&&this.desc.datatype;if(t)return t;if(this[we])return this[we];let r=this.node&&this.node.nextNode;if(r&&r.type=="type")return r;let n=this.scope;if(n&&this.desc?.kind=="for"){let i=n.doc.getDestructuredPath(this.node,[[n.expression,"__@iterable"]]);return this[we]||(this[we]=i)}return(e=this.importInfo)?e:null}get staticΦ(){return this.node&&this.node.mods&z.Static}get itervarΦ(){return this.node&&this.node.match(".decl-for")}get variableΦ(){return this.flags&d.Variable}get parameterΦ(){return this.flags&d.Parameter}get memberΦ(){return this.flags&d.ClassMember}get scopedΦ(){return this.flags&d.Scoped}get typeΦ(){return this.flags&d.Type}get globalΦ(){return this.flags&d.IsGlobal}get importedΦ(){return this.flags&d.IsImport}get componentΦ(){return this.flags&d.Component}get escapedName(){return this.name}get scope(){return this.node?.context?.scope}addReference(e){return this.references||(this.references=[]),this.references.push(e),e.symbol=this,this}dereference(e){let t=this.references.indexOf(e);return t>=0&&(e.symbol=null,this.references.splice(t,1)),this}get kind(){return this.variableΦ?L.Variable:this.flags&d.Class?L.Class:this.flags&d.Component?L.Class:this.flags&d.Property?L.Field:this.flags&d.Method?this.escapedName=="constructor"?L.Constructor:L.Method:this.flags&d.Function?L.Function:L.Method}get semanticKind(){return this.flags&d.Parameter?"parameter":this.variableΦ?"variable":this.typeΦ?"type":this.flags&d.Function?"function":this.memberΦ?"member":this.componentΦ?"component":"variable"}get semanticFlags(){let e=0;return this.flags&d.ConstVariable&&(e|=z.ReadOnly),this.staticΦ&&(e|=z.Static),this.flags&d.IsImport&&(e|=z.Import),this.flags&d.IsGlobal&&(e|=z.Global),this.flags&d.IsRoot&&(e|=z.Root),this.flags&d.IsSpecial&&(e|=z.Special),e}};function br(s){let e;return s?(e=s.toIterable)?e.call(s):s:[]}var W=Symbol.for("#__init__"),oe=Symbol.for("#__initor__"),le=Symbol.for("#__inited__"),Kt=Symbol(),qt=Symbol(),Dt=Symbol(),Gt={global:{datatype:"globalThis"},imba:{datatype:"globalThis.imba"},module:{},window:{datatype:"globalThis.window"},document:{datatype:"globalThis.document"},exports:{},console:{datatype:"globalThis.console"},process:{datatype:"globalThis.process"},parseInt:{datatype:"globalThis.parseInt"},parseFloat:{datatype:"globalThis.parseFloat"},setTimeout:{datatype:"globalThis.setTimeout"},setInterval:{datatype:"globalThis.setInterval"},setImmediate:{datatype:"globalThis.setImmediate"},clearTimeout:{datatype:"globalThis.clearTimeout"},clearInterval:{datatype:"globalThis.clearInterval"},clearImmediate:{datatype:"globalThis.clearImmediate"},globalThis:{datatype:"globalThis"},isNaN:{datatype:"globalThis.isNaN"},isFinite:{datatype:"globalThis.isFinite"},__dirname:{datatype:"\\string"},__filename:{datatype:"\\string"},__realname:{datatype:"\\string"}},ae=class{[W](e=null){var t;this.type=e&&(t=e.type)!==void 0?t:"",this.start=e?e.start:void 0,this.end=e?e.end:void 0,this.parent=e?e.parent:void 0}static build(e,t,r,n,i){return new this(e,t,r,n,i)}constructor(e,t,r,n){this[W](),this.doc=e,this.start=t,this.end=null,this.type=n,this.parent=r,this.$name=null,t.scope=this}pop(e){return this.end=e,e.start=this.start,e.pops=this,this.start.end=e,this.visit(),this.parent}find(e){return this.findChildren(e,!0)[0]}get childNodes(){return this.doc.getNodesInScope(this)}findChildren(e,t=!1){let r=[],n=this.start;for(;n;){if(t&&r.length)return r;if(n.scope&&n.scope!=this){n.scope.match(e)&&r.push(n.scope),n=n.scope.next;continue}if(n.match(e)&&r.push(n),n==this.end)break;n=n.next}return r}closest(e){return this.match(e)?this:this.parent?this.parent.closest(e):null}visit(){return this}get memberΦ(){return!1}get topΦ(){return!1}get selfScope(){return this.memberΦ||this.topΦ?this:this.parent.selfScope}get name(){return this.$name||""}get value(){return this.doc.content.slice(this.start.offset,this.next?this.next.offset:-1)}get next(){return this.end?this.end.next:null}get prev(){return this.start?this.start.prev:null}match(e){return typeof e=="string"?this.type==e:e instanceof RegExp?e.test(this.type):e instanceof Function?e(this):!0}},E=class extends ae{static[W](){return this.prototype[oe]=Kt,this}constructor(e,t,r,n,i=[]){super(e,t,r,n),this[oe]===Kt&&this[le]&&this[le]()}get scope(){return this.parent.scope}get varmap(){return this.parent.varmap}register(e){return this.parent.register(e)}lookup(...e){return this.parent.lookup(...e)}};E[W]();var qe=class extends E{},De=class extends E{},Ge=class extends E{get properties(){return this.findChildren("styleprop")}},Ze=class extends E{},j=class extends ae{static[W](){return this.prototype[oe]=qt,this}constructor(e,t,r,n,i=[]){if(super(e,t,r,n),this.children=[],this.entities=[],this.refs=[],this.varmap=Object.create(r?r.varmap:{}),this instanceof X)for(let l=0,o=Object.keys(Gt),f=o.length,c,a;l<f;l++){c=o[l],a=Gt[c];let p={value:c,offset:-1,mods:0};this.varmap[c]=new K(d.GlobalVar,c,p,a)}return this.indent=i[3]&&i[3][0]==" "?i[3].length:0,this.setup(),this;this[oe]===qt&&this[le]&&this[le]()}setup(){if(this.handlerΦ&&(this.varmap.e=new K(d.SpecialVar,"e",null,"eventReference")),(this.classΦ||this.propertyΦ)&&(this.ident=this.token=de(this.start,"entity."),this.ident&&(this.ident.body=this),this.ident&&this.ident.type=="entity.name.def.render"&&(this.$name="render",this.ident.symbol)))return this.ident.symbol.name="render"}get selfPath(){let e=this.path;return this.propertyΦ?e.slice(0,e.lastIndexOf(".")):e}get path(){let e=this.parent?this.parent.path:"";if(this.propertyΦ){let t=this.staticΦ?".":".prototype.";return this.parent?""+this.parent.path+t+this.name:this.name}return this.componentΦ?this.name[0]==this.name[0].toLowerCase()?this.name.replace(/\-/g,"_")+"$$TAG$$":this.name:this.classΦ?this.name:e}get allowedKeywordTypes(){return this.classΦ?g.Class:this.rootΦ?g.Root|g.Block:g.Block}get componentΦ(){return!!this.type.match(/^component/)}get rootΦ(){return this instanceof X}get topΦ(){return this instanceof X}get classΦ(){return!!this.type.match(/^class/)||this.componentΦ}get defΦ(){return!!this.type.match(/def|get|set/)}get staticΦ(){return!!(this.ident&&this.ident.mods&z.Static)}get handlerΦ(){return!!this.type.match(/handler|spy/)}get memberΦ(){return!!this.type.match(/def|get|set/)}get propertyΦ(){return!!this.type.match(/def|get|set|field/)}get flowΦ(){return!!this.type.match(/if|else|elif|unless|for|while|until/)}get closureΦ(){return!!this.type.match(/class|component|def|get|set|do/)}get scope(){return this}get name(){return this.$name||(this.ident?this.ident.value:"")}visit(){return this}register(e){return e.scopedΦ&&(this.varmap[e.name]=e,this.rootΦ&&(e.flags|=d.IsRoot)),e}lookup(e,t=d.Scoped){let r,n=e.value;return n[n.length-1]=="!"&&(n=n.slice(0,-1)),(r=this.varmap[n])?r:null}toOutline(){return{kind:this.type,name:this.name,children:[],span:this.ident?this.ident.span:this.start.span}}};j[W]();var X=class extends j{};var He=class extends j{get expression(){return this.find("keyword.in keyword.of").next.next}get forvars(){return Object.values(this.varmap).filter(function(e){return e.itervarΦ})}},We=class extends j{register(e){return this.parent.register(e)}lookup(...e){return this.parent.lookup(...e)}},Ue=class extends j{get selfScope(){return this}},Je=class extends E{},Xe=class extends E{get propertyName(){return this.start.next.match("style.property.name")?this.start.next.value:this.parent.prevProperty?.propertyName}get modifier(){if(this.start.next.match("style.property.modifier"))return this.start.next.value}get styleValue(){return!0}},Qe=class extends E{get key(){return this.parent.key}get propertyName(){return this.parent.propertyName}get modifier(){return this.parent.modifier}},Ye=class extends E{get key(){return this.find("stylepropkey")}get prevProperty(){return this.start.prev.pops?this.start.prev.pops:null}get propertyName(){return this.key?.propertyName}get modifier(){return this.key?.modifier}},et=class extends E{},tt=class extends E{get innerText(){return this.value.slice(1,-1)}},rt=class extends E{get name(){let e=this.findChildren("tag.name").join("");return e=="self"?this.closest("component").name:e}get localΦ(){return this.name[0]==this.name[0].toUpperCase()}get tagName(){return this.name}get parentTag(){return this.closest("tagcontent")?.ownerTag}get ancestorTags(){return this.closest("tagcontent")?.ownerTags}get ancestorPath(){return this.ancestorTags.map(function(e){return e.tagName}).join(".")}get pathName(){return"<"+this.name+">"}get outline(){return this.findChildren(/tag\.(reference|name|id|white|flag|event(?!\-))/).join("")}},nt=class extends E{get propertyName(){return this.start.next.match("tag.attr")?this.start.next.value:""}get tagName(){return this.parent.name}},st=class extends E{get propertyName(){return this.parent.propertyName}get tagName(){return this.parent.tagName}},it=class extends We{get ownerTag(){return this.start.prev.pops}get ownerTags(){let e=[this.ownerTag],t;for(;t=e[0].parentTag;)e.unshift(t);return e}},ot=class extends E{get name(){return this.findChildren("tag.event.name").join("").replace("@","")}},ve=class extends E{},ce=class extends E{static build(e,t,r,n,i){let l=this,o=e.content[t.offset-1];return!o||` [{(|=&-;
|
|
:/*%+-`.indexOf(o)>=0?(n="array",l=at):(n="index",l=ct),new l(e,t,r,n,i)}},he=class extends E{},lt=class extends he{},at=class extends ce{get delimiters(){return this.childNodes.filter(function(e){return e.match("delimiter")})}indexOfNode(e){var t;let r=this.delimiters,n=0;t=0;for(let i of br(r)){let l=t++;e.offset>i.offset&&n++}return n}},ct=class extends ce{},Te=class extends E{static[W](){return this.prototype[oe]=Dt,this}constructor(){super(...arguments),this.prev.datatype=this,this[oe]===Dt&&this[le]&&this[le]()}toString(){return this.value}};Te[W]();var pt=class extends E{},ft=class extends he{},ut=class extends E{get isTypeOnly(){return this.start.prev.match("keyword.type")}get sourcePath(){return this.childNodes.find(function(t){return t.match("path")})?.innerText}get specifiers(){return this.childNodes.find(function(e){return e.match("specifiers")})}get default(){return this.childNodes.find(function(e){return e.match(".default")})}get namespace(){return this.childNodes.find(function(e){return e.match(".ns")})}},D={style:Ge,array:ce,stylerule:Ze,sel:Je,path:tt,value:qe,tag:rt,forscope:He,field:Ue,type:Te,parens:ve,brackets:ce,object:ft,braces:he,specifiers:lt,string:De,tagattr:nt,imports:ut,interpolation:pt,tagattrvalue:st,tagcontent:it,listener:ot,styleinterpolation:et,styleprop:Ye,stylepropkey:Xe,stylevalue:Qe,args:ve};function xr(s,e){let t=Object.getOwnPropertyDescriptors(e);return delete t.constructor,Object.defineProperties(s,t),s}function F(s){let e;return s?(e=s.toIterable)?e.call(s):s:[]}var ht=Symbol.for("#ins"),mt=Symbol.for("#del"),Zt=Symbol.for("#version"),Ht=Symbol.for("#multiline"),Wt=Symbol.for("#significant"),dt=Symbol.for("#body"),Q=Symbol.for("#lexed"),gt=class{get node(){return this.scope&&this.scope.start==this?this.scope:this.pops?this.pops:this}get nextNode(){return this.next?.node}get prevNode(){return this.prev?.node}};xr(R.prototype,gt.prototype);var pe=class{static tmp(e){return new this("file://temporary.imba","imba",0,e)}static from(e,t,r,n){return new this(e,t,r,n)}constructor(e,t,r,n){this.uri=e,this.languageId=t,this.version=r,this.content=n,this.connection=null,this.lineTokens=[],this.isLegacy=t=="imba1"||e&&e.match(/\.imba1$/),this.head=this.seed=new R(0,"eol","imba"),this.initialState=J.getInitialState(),this.seed.stack=J.getInitialState(),this.history=[],this.lexer=J,this.versionToHistoryMap={},this.versionToHistoryMap[r]=-1,n&&n.match(/^\#[^\n]+imba1/m)&&(this.isLegacy=!0)}log(...e){return console.log(...e)}get lineCount(){return this.lineOffsets.length}get lineOffsets(){return this._lineOffsets||(this._lineOffsets=Ie(this.content,!0))}getText(e=null){if(e){let t=this.offsetAt(e.start),r=this.offsetAt(e.end);return this.content.substring(t,r)}return this.content}getLineText(e){let t=this.lineOffsets[e],r=this.lineOffsets[e+1];return this.content.substring(t,r).replace(/[\r\n]/g,"")}positionAt(e){if(e instanceof Z)return e;typeof e=="object"&&(e=e.offset),e=Math.max(Math.min(e,this.content.length),0);let t=this.lineOffsets,r=0,n=t.length;if(n===0)return new Z(0,e,e,this.version);for(;r<n;){let l=Math.floor((r+n)/2);t[l]>e?n=l:r=l+1}let i=r-1;return new Z(i,e-t[i],e,this.version)}offsetAt(e){if(e.offset)return e.offset;let t=this.lineOffsets;if(e.line>=t.length)return this.content.length;if(e.line<0)return 0;let r=t[e.line],n=e.line+1<t.length?t[e.line+1]:this.content.length;return e.offset=Math.max(Math.min(r+e.character,n),r)}rangeAt(e,t=e){return new V(this.positionAt(e),this.positionAt(t))}overwrite(e,t){return this.version=t||this.version+1,this.content=e,this._lineOffsets=null,this.invalidateFromLine(0),this}update(e,t){t==null&&(t=this.version+1);let r=[],n=!1;r[ht]="",r[mt]="";for(let o=0,f=F(e),c=f.length;o<c;o++){let a=f[o];if(xt(a)){this.overwrite(a.text,t),r.push([0,this.content.length,a.text]),n=!0;continue}let p=bt(a.range),u=this.offsetAt(p.start),h=this.offsetAt(p.end);a.range=p,a.offset=u,a.length=h-u,p.start.offset=u,p.end.offset=h;let v=h-u?this.content.slice(u,h):"";r[mt]+=v,r[ht]+=a.text||"",this.applyEdit(a,t,e),r.push([u,h-u,a.text||"",v]);let A=Math.max(p.start.line,0),_=Math.max(p.end.line,0),m=this.lineOffsets,k=Ie(a.text,!1,u);if(_-A===k.length)for(let b=0,x=F(k),y=x.length;b<y;b++){let M=x[b];m[b+A+1]=k[o]}else k.length<1e4?m.splice.apply(m,[A+1,_-A].concat(k)):this._lineOffsets=m=m.slice(0,A+1).concat(k,m.slice(_+1));let w=a.text.length-(h-u);if(w!==0){let b=A+1+k.length;for(;b<m.length;)m[b]=m[b]+w,b++}}this.history.push(r),r[Zt]=t;let i=this.history[this.history.length-2];return(r[ht]+r[mt]).indexOf(`
|
|
`)>=0&&(r[Ht]=!0,i&&!i[Ht]&&(r[Wt]=!0,r[dt]=this.content)),this.versionToHistoryMap[t]=this.history.length-1,this.updated(e,t)}get lastSignificantVersion(){let e=this.history.length;for(;e>0;){let t=this.history[--e];if(t&&t[Wt])return t[Zt]}return null}editsSinceVersion(e){let t=this.versionToHistoryMap[e],r=[];for(let n=0,i=F(this.history.slice(t+1)),l=i.length;n<l;n++){let o=i[n];r.push(...o)}return r}contentAtVersion(e){let t=this.versionToHistoryMap[e],r=this.history[t];return r[dt]!=null?r[dt]:null}offsetAtVersion(e,t,r=this.version,n=!1){let i=this.versionToHistoryMap[t],l=this.versionToHistoryMap[r],o=e,f=!1;if(i<l)for(;i<l;){let c=this.history[++i];for(let a=0,p=F(c),u=p.length;a<u;a++){let[h,T,v]=p[a];h>o||(n&&(h-=1),o>h&&o>h+T&&(o+=v.length-T))}}else if(l<i)for(;l<i;){let c=this.history[i--];for(let a=0,p=F(c),u=p.length;a<u;a++){let[h,T,v]=p[a];h>o||o>h&&o>h+T&&(o-=v.length-T)}}return o}historicalOffset(e,t){return this.offsetAtVersion(e,this.version,t,!0)}applyEdit(e,t,r){this.content=this.content.substring(0,e.range.start.offset)+e.text+this.content.substring(e.range.end.offset,this.content.length);let n=e.range.start.line;this.invalidateFromLine(n)}updated(e,t){return this.version=t,this}invalidateFromLine(e){return this.head=this.seed,this}after(e,t){let r=this.tokens.indexOf(e);if(t){for(;r<this.tokens.length;){let n=this.tokens[++r];if(n&&this.matchToken(n,t))return n}return null}return this.tokens[r+1]}matchToken(e,t){return t instanceof RegExp?e.type.match(t):typeof t=="string"?e.type==t:!1}before(e,t,r=0){let n=this.tokens.indexOf(e)+r;if(t){for(;n>0;){let i=this.tokens[--n];if(this.matchToken(i,t))return i}return null}return this.tokens[n-1]}getTokenRange(e){return{start:this.positionAt(e.offset),end:this.positionAt(e.offset+e.value.length)}}getTokensInScope(e){let t=this.tokens.indexOf(e.start),r=e.end?this.tokens.indexOf(e.end):this.tokens.length,n=t,i=[];for(;n<r;){let l=this.tokens[n++];l.scope&&l.scope!=e?(i.push(l.scope),n=l.scope.endIndex+1):i.push(l)}return i}getSymbols(){var e;return this.astify(),(e=this[Q]).symbols||(e.symbols=this.tokens.map(function(t){return t.symbol}).filter(function(t){return t}).filter(function(t,r,n){return n.indexOf(t)==r}))}getImportedSymbols(){return this.getSymbols().filter(function(e){return e.importedΦ})}getImportNodes(){return this.tokens.filter(function(t){return t.match("push._imports")}).map(function(t){return t.scope})}getNodesInScope(e,t=!1){let r=e.start,n=e.end;t?n=n.next:r=r.next;let i=[];for(;r&&r!=n;){if(r.scope&&r.scope!=e){i.push(r.scope),r=r.scope.end.next;continue}else r.type!="white"&&i.push(r);r=r.next}return i}getTokenAtOffset(e,t=!1){return this.tokenAtOffset(e)}getSemanticTokens(e=d.Scoped){let t=this.parse(),r=[];for(let n=0,i=F(t),l=i.length;n<l;n++){let o=i[n],f=o.symbol;if(!(f&&(!e||f.flags&e)))continue;let c=ie[f.semanticKind],a=o.mods|f.semanticFlags;r.push([o.offset,o.value.length,c,a])}return r}getEncodedSemanticTokens(){let e=this.getSemanticTokens(),t=[],r=0,n=0;for(let i=0,l=F(e),o=l.length;i<o;i++){let f=l[i],c=this.positionAt(f[0]),a=c.line-r,p=a?c.character:c.character-n;t.push(a,p,f[1],f[2],f[3]),r=c.line,n=c.character}return t}getDestructuredPath(e,t=[],r=null){if(e.context.type=="array")return this.getDestructuredPath(e.context.start,t,r),t.push(e.context.indexOfNode(e)),t;let n=e.value;return e.prev.match("operator.assign.key-value")&&(n=e.prev.prev.value),e.context.type=="object"&&(this.getDestructuredPath(e.context.start,t,r),t.push(n)),t}tokenAtOffset(e){let t=this.tokens[0];for(;t;){let r=t.next;if(t.offset>=e)return t.prev;if(t.end&&t.end.offset<e)t=t.end;else if(r)t=r;else return t}return t}patternAtOffset(e,t=/[\w\-\.\%]/){let r=e,n=e,i=this.content;for(;r>0&&t.test(this.content[r-1]);)r--;for(;t.test(this.content[n+1]||"");)n++;return[i.slice(r,n+1),r,n]}adjustmentAtOffset(e,t=1){let[r,n,i]=this.patternAtOffset(e),[l,o=""]=r.split(/[\d\.]+/),f=parseFloat(r.slice(l.length).slice(0,o.length?-o.length:1e3));return Number.isNaN(f)?null:(f+=t,[n+l.length,r.length-l.length-o.length,String(f)])}contextAtOffset(e){var t;this.ensureParsed();let r=this.positionAt(e),n=this.tokenAtOffset(e),i=this.lineOffsets[r.line],l=e-n.offset,o=n.context,f={character:this.content[e-1],line:this.content.slice(i,e),token:n.value.slice(0,l)},c={character:this.content[e],token:n.value.slice(l),line:this.content.slice(e,this.lineOffsets[r.line+1]).replace(/[\r\n]+/,"")};n.scope&&!c.token&&(o=n.scope),n.next&&n.next.value==null&&n.next.scope&&!c.token&&n.match("operator.assign")&&(o=n.next.scope);let a=de(n,"white.tabs"),p=a?a.value.length:0,u=o,h=o.scope,T={},v=n,A=n.stack.state||"",_=P;u&&(u.start&&(f.group=this.content.slice(u.start.offset,e)),u.end&&(c.group=this.content.slice(e,u.end.offset)));let m={keywords:[]},k=0;if(n==a&&(p=l),n.match("br white.tabs"))for(;h.indent>p;)h=h.parent;if(u.type=="tag",n.match("entity string regexp comment style.")&&(k=0),n.match("tag.event.name tag.event-modifier.name")&&(v=n.prev),(n.type=="path"||n.type=="path.open")&&(k|=P.Path,m.paths=1),n.match("identifier tag.operator.equals br white delimiter array operator ( self")&&(k|=P.Value,v=null),n.match("operator.access")&&(k|=P.Access,v=n),n.match("accessor")&&(k|=P.Access,v=n.prev),n.match("delimiter.type.prefix type")&&(k|=P.Type),n.match("tag.name tag.open")?k|=P.TagName:n.match("tag.attr tag.white")?k|=P.TagProp:n.match("tag.flag")?k|=P.TagFlag:n.match("tag.event.modifier")?k|=P.TagEventModifier:n.match("tag.event")?k|=P.TagEvent:n.match("operator.equals.tagop")&&(k|=P.Value),n.match("style.property.operator")||u.closest("stylevalue")){k|=_.StyleValue;try{m.styleProperty=u.closest("styleprop").propertyName}catch{}}n.match("style.open style.property.name")&&(k|=_.StyleProp),(n.match("style.value.white")||n.prev&&n.prev.match("style.value.white"))&&(k|=_.StyleProp),n.match("style.selector.element")&&c.line.match(/^\s*$/)&&(k|=_.StyleProp),h.closest("rule")&&(k|=_.StyleProp,k&=~_.Value),n.match("style.property.operator")&&(k&=~_.StyleProp),u.match("stylevalue")&&f.group.indexOf(" ")==-1&&(k=_.StyleValue),n.match("style.selector.modifier style.property.modifier")&&(k=_.StyleModifier),n.match("style.selector.element")&&(k|=_.StyleSelector),h.closest("rule")&&f.line.match(/^\s*$/)&&(k|=_.StyleSelector,k&=~_.StyleValue),n.match("operator.access accessor white.classname white.tagname")&&(k&=~_.Value),u.closest("imports")&&(k&=~_.Value,k|=_.ImportName),(A.match(/\.decl-(let|var|const|param|for)/)||n.match(/\.decl-(for|let|var|const|param)/))&&(k&=~_.Value,k|=_.VarName);let w=h.allowedKeywordTypes;t=[];for(let x=0,y=Object.keys(ue),M=y.length,$,S;x<M;x++)$=y[x],S=ue[$],S&w&&t.push($);m.keywords=t,m.flags=k;for(let x=0,y=Object.keys(_),M=y.length,$,S;x<M;x++)$=y[x],S=_[$],k&S&&(m[$]||(m[$]=!0));return{token:n,offset:e,position:r,linePos:i,scope:h,indent:p,group:o,mode:"",target:v,path:h.path,suggest:m,before:f,after:c}}textBefore(e){let t=this.content.slice(0,e),r=t.lastIndexOf(`
|
|
`);return t.slice(r+1)}varsAtOffset(e,t=!1){let r=this.tokenAtOffset(e),n=[],i=r.context.scope,l={};for(;i;){for(let o=0,f=F(Object.values(i.varmap)),c=f.length;o<c;o++){let a=f[o];a.globalΦ&&!t||l[a.name]||(!a.node||a.node.offset<e)&&(n.push(a),l[a.name]=a)}i=i.parent}return n}getOutline(e=null){var t,r,n,i;if(this.isLegacy){let _=wt(this.content);for(let m=0,k=F(_.all),w=k.length;m<w;m++){let b=k[m];t=b.parent,delete b.parent,b.path=b.name,b.name=b.ownName,e&&e(b,_.all)}return _}this.ensureParsed();let l=Date.now(),o=[],f={children:[]},c=f,a=null,p={},u=new Set,h=null;function T(_,m){return _ instanceof K&&(u.add(_),_={name:_.name,kind:_.kind}),p=_,_.token=m,_.children||(_.children=[]),_.span||(_.span=m.span),_.name||(_.name=m.value),o.push(_),c.children.push(_)}function v(_){return p.children||(p.children=[]),p.parent||(p.parent=c),c=p,c.end=_}function A(_){return c=c.parent}for(let _=0,m=F(this.tokens),k=m.length;_<k;_++){let w=m[_],b=w.symbol,x=w.scope;if(w.type=="key")T({kind:L.Key},w);else if(b){if(b.parameterΦ)continue;u.has(b)||T(b,w),b.body&&(h=b.body.start)}else if(x&&x.type=="do"){let y=this.textBefore(w.offset-3).replace(/^\s*(return\s*)?/,"");y+=" callback",T({kind:L.Function,name:y},w.prev),h=w}else x&&x.type=="tag"&&T({kind:L.Field,name:x.outline},w);w==h&&v(w.end),w==c.end&&A()}for(let _=0,m=F(o),k=m.length;_<k;_++){let w=m[_];if(w.span){let b=w.span.length;w.span.start=this.positionAt(w.span.offset),w.span.end=b?this.positionAt(w.span.offset+b):w.span.start}e&&e(w,o),r=w.parent,delete w.parent,n=w.end,delete w.end,i=w.token,delete w.token}return f}getContextAtOffset(e,t=!1){return this.contextAtOffset(e)}ensureParsed(){return this.parse(),this}reparse(){return this.invalidateFromLine(0),this.parse()}profileReparse(){let e=Date.now(),t=this.reparse();return console.log("took",Date.now()-e),t}tokenize(e=!1){var t;let r=this[Q]||{lines:[],version:-1};if(r.version==this.version&&!e)return r;let n=this.content;this.isLegacy&&(n=n.replace(/\@\w/g,function(u){return"¶"+u.slice(1)}),n=n.replace(/\w\:(?=\w)/g,function(u){return u[0]+"."}),n=n.replace(/(do)(\s?)\|([^\|]*)\|/g,function(u,h,T,v){return h+"("+(T||"")+v+")"}));let i=this.lineOffsets,l=[],f=this.seed,c=Date.now(),a=this.initialState;this[Q]={version:this.version,lines:[],tokens:l};let p={};this[Q].cache=p;for(let u=0,h=F(r.lines),T=h.length;u<T;u++){let v=h[u];(p[t=v.text]||(p[t]=[])).push(v)}for(let u=0,h=F(i),T=h.length;u<T;u++){let v=h[u],_=i[u+1]||n.length,m=n.slice(v,_),k=a,w=p[m],b=w&&w.filter(function(M){return M.startState==k}),x=b&&(b.find(function(M){return M.offset==v})||b[0]),y=null;if(x&&(x.offset==v,y=x.clone(v)),!y){let M=J.tokenize(m,k,v);y=new se({offset:v,text:m,startState:k,endState:M.endState,tokens:M.tokens})}for(let M=0,$=F(y.tokens),S=$.length;M<S;M++){let C=$[M];l.push(C)}this[Q].lines.push(y),a=y.endState}return this[Q]}get tokens(){return this.astify(),this[Q].tokens}getTokens(e=null){return this.tokens}astify(){let e=this.tokenize();if(e.root)return this;let t={"]":"[",")":"(","}":"{",">":"<"},r={"[":"]","(":")","{":"}","<":">"},n=/[\w\$\)\]\?]/,i=Date.now(),l=null,o=e.root=new X(this,this.seed,null,"root"),f=this.content,c=console.log.bind(console),a=null,p=null,u=null,h=null,T=0;for(let v=0,A=F(e.tokens),_=A.length;v<_;v++){let m=A[v],k=m.type.split("."),w=m.value,b=e.tokens[v+1],[x,y,M]=k,$=k[k.length-1],S=k[k.length-2],C=null,N=0;if(x=="ivar"&&(w=m.value="@"+w.slice(1)),h&&(h.next=m),m.prev=h,m.context=o,x=="("&&h){let B=f[m.offset-1]||"";n.test(B)&&(o=m.scope=D.args.build(this,m,o,"args",k))}if(x=="operator"&&(m.op=m.value.trim()),x=="keyword"&&(z[y]&&(T|=z[y]),(w=="let"||w=="const")&&(p=m,u=null)),x=="entity"&&(m.mods|=T,T=0),x=="push"){let B=y,G=y.lastIndexOf("_"),Ce=G>=0?E:j;G>=0?(B=B.slice(G+1),Ce=D[B]||E):D[B]&&(Ce=D[B]),o=m.scope=new Ce(this,m,o,B,k),a&&(a.body=o,o.symbol=a,a=null),o==o.scope&&(p=null,u=null)}else x=="pop"?(y=="value"&&(u=null),o=o.pop(m)):(y=="open"||r[y])&&D[x]?o=m.scope=D[x].build(this,m,o,x,k):$=="open"&&(C=D[S])?o=m.scope=C.build(this,m,o,S,k):($=="close"&&o.type==S||y=="close"&&D[x]||t[x]&&o&&o.start.value==t[x])&&(o=o.pop(m));if(m.match(/entity\.name|decl-/)){let B=K.forToken(m,m.type,m.mods);B&&(a=m.symbol=B,m.symbol.keyword=p,o.register(m.symbol)),m.mods|=z.Declaration}if(y=="declval"&&(u=m),m.match("identifier")&&!m.symbol){let B=o.lookup(m,p);if(B&&B.scopedΦ&&(u&&B.keyword==p||B.addReference(m)),h&&h.op=="="&&B){let G=h.prev;G&&G.symbol==B&&(G.mods&z.Declaration?B.dereference(m):(!b||b.match("br"))&&B.dereference(G))}}h=m}return this}parse(){return this.tokens}getMatchingTokens(e){let t=this.getTokens();return t=t.slice(0).filter(function(r){return r.match(e)}),t}migrateToImba2(){let e=this.content;e=e.replace(/\bdef self\./g,"static def "),e=e.replace(/\b(var|let|const) def /g,"def "),e=e.replace(/\?\./g,".."),e=e.replace(/def ([\w\-]+)\=/g,"set $1"),e=e.replace(/do\s?\|([^\|]+)\|/g,"do($1)"),e=e.replace(/(prop) ([\w\-]+) (.+)$/gm,function(i,l,o,f){var c,a;let p={};f.split(/,\s*/).map(function(h){return h.split(/\:\s*/)}).map(function(h){return p[h[0]]=h[1]});let u=""+l+" "+o;return p.watch&&p.watch[0].match(/[\'\"\:]/)?u="@watch("+p.watch+") "+u:p.watch&&(u="@watch "+u),c=p.watch,delete p.watch,p.default&&(u=""+u+" = "+p.default,a=p.default,delete p.default),Object.keys(p).length&&console.log("more prop values",i,p),u});let r=pe.tmp(e).getTokens(),n="";for(let i=0,l=F(r),o=l.length;i<o;i++){let f=l[i],c=r[i+1],{value:a,type:p,offset:u}=f,h=u+a.length;p=="operator.dot.legacy"&&(a=".",c&&(c.access=!0)),p=="operator.spread.legacy"&&(a="..."),p=="identifier.tagname"&&a.indexOf(":")>=0&&(a=a.replace(":","-")),p=="identifier.def.propname"&&a=="initialize"&&(a="constructor"),p=="decorator"&&!e.slice(h).match(/^\s(prop|def|get|set)/)&&(a=n+a.slice(1)),p=="property"&&(a[0]=="@"?(a=a.replace(/^\@/,n),f.access=!0):a=="len"?a="length":/^(\n|\s\:|\)|\,|\.)/.test(e.slice(h))&&!f.access&&a[0]==a[0].toLowerCase()&&(a=a+"!")),p=="identifier"&&!f.access&&a[0]==a[0].toLowerCase()&&a[0]!="_"&&!f.variable&&/^(\n|\s\:|\)|\,|\.)/.test(e.slice(h))&&a!="new"&&(a=a+"!"),f.value=a}return r.map(function(i){return i.value}).join("")}createImportEdit(e,t,r=t){e=e.replace(/\.imba$/,"");let n=this.getImportNodes().filter(function(c){return c.sourcePath==e}),i="",l=0,o=[],f={changes:o};if(this.getImportedSymbols().map(function(p){return p.importInfo}).find(function(p){return p.path==e&&p.name==r&&p.exportName==t}))return f;t!="default"&&t!="*"&&(n=n.filter(function(c){return c.specifiers||!c.ns}));for(let c=0,a=F(n),p=a.length;c<p;c++){let u=a[c],h=u.default,T=u.specifiers,v=u.namespace;if(t=="default")if(l=u.start.offset+1,h){if(h.value==r)return f;f.alias=h.value,l=0;continue}else i=r,(v||T)&&(i+=", ");else if(t=="*"){if(T)continue;h?(l=h.endOffset,i=", * as "+r):(l=u.start.offset+1,i="* as "+r+" ")}else if(v){f.alias=""+v.value+"."+t;continue}else{let A=t;r!=t&&(A+=" as "+r),T?(l=T.start.offset+1,i=" "+A+","):h?(l=h.endOffset,i=", { "+A+" }"):(i="{ "+A+" }",l=u.start.offset+1)}if(i)break}return i||(t=="default"?i="import "+r+" from '"+e+"'":t=="*"?i="import * as "+r+" from '"+e+"'":r!=t?i="import { "+t+" as "+r+" } from '"+e+"'":i="import { "+t+" } from '"+e+"'",i+=`
|
|
`),o.push({newText:i,range:this.rangeAt(l,l)}),f}};var Ut={defaultToken:"",tokenPostfix:".xml",ignoreCase:!0,qualifiedName:/(?:[\w\.\-]+:)?[\w\.\-]+/,tokenizer:{root:[[/[^<&]+/,""],{include:"@whitespace"},[/(<)(@qualifiedName)/,[{token:"delimiter"},{token:"tag",next:"@tag"}]],[/(<\/)(@qualifiedName)(\s*)(>)/,[{token:"delimiter"},{token:"tag"},"",{token:"delimiter"}]],[/(<\?)(@qualifiedName)/,[{token:"delimiter"},{token:"metatag",next:"@tag"}]],[/(<\!)(@qualifiedName)/,[{token:"delimiter"},{token:"metatag",next:"@tag"}]],[/<\!\[CDATA\[/,{token:"delimiter.cdata",next:"@cdata"}],[/&\w+;/,"string.escape"]],cdata:[[/[^\]]+/,""],[/\]\]>/,{token:"delimiter.cdata",next:"@pop"}],[/\]/,""]],tag:[[/[ \t\r\n]+/,""],[/(@qualifiedName)(\s*=\s*)("[^"]*"|'[^']*')/,["attribute.name","","attribute.value"]],[/(@qualifiedName)(\s*=\s*)("[^">?\/]*|'[^'>?\/]*)(?=[\?\/]\>)/,["attribute.name","","attribute.value"]],[/(@qualifiedName)(\s*=\s*)("[^">]*|'[^'>]*)/,["attribute.name","","attribute.value"]],[/@qualifiedName/,"attribute.name"],[/\?>/,{token:"delimiter",next:"@pop"}],[/(\/)(>)/,[{token:"tag"},{token:"delimiter",next:"@pop"}]],[/>/,{token:"delimiter",next:"@pop"}]],whitespace:[[/[ \t\r\n]+/,""],[/<!--/,{token:"comment",next:"@comment"}]],comment:[[/[^<\-]+/,"comment.content"],[/-->/,{token:"comment",next:"@pop"}],[/<!--/,"comment.content.invalid"],[/[<\-]/,"comment.content"]]}};var yt={},Se=class{static getTokenizer(e){return e=="xml"&&!yt[e]?this.createTokenizer("xml",Ut):yt[e]}static createTokenizer(e,t){let r=be(e,t);return yt[e]=new ne(e,r)}};function wr(s){let e;return s?(e=s.toIterable)?e.call(s):s:[]}var vr={"&":"&","<":"<",">":">",'"':""","'":"'"},Tr={"[":"square open","]":"square close","{":"curly open","}":"curly close","(":"paren open",")":"paren close"};function Jt(s){return s.replace(/[\&\<\>]/g,function(e){return vr[e]})}function Sr(s){return s.join(" ").replace(/[\[\]\{\}\(\)]/g,function(e){return Tr[e]})}function Xt(s,{verbose:e=!1}){let t=[],r=0,n=0,i=[];for(let l=0,o=wr(s),f=o.length;l<f;l++){let c=o[l],a=c.value,p=c.type.split("."),[u,h]=p,T=c.mods;if(c.var){let v=i.indexOf(c.var);v==-1&&(v=i.push(c.var)-1),p.push("vref"),p.push("var"+v),p.push(c.var.type+"-ref"),T|=c.var.mods}if(T&z.Declaration&&p.push("decl"),T&z.Root&&p.push("root"),T&z.Local&&p.push("local"),c.end&&c.end.start==c&&t.push("<b>"),!((h=="start"||h=="open")&&(t.push("<b class='"+u+"'>"),!a))){if((h=="end"||h=="close")&&!a){t.push("</b>");continue}if(u=="push"){a=String(++r);let v=h.indexOf("_")>=0?"group":"scope",A=c.scope&&c.scope.end;t.push("<div class='"+v+"-"+h.split("_").pop()+" _"+h+" l"+r+" o"+c.offset+" e"+(A&&A.offset)+"'>");continue}else if(u=="pop"){a=String(--r),t.push("</div>");continue}u!="white"&&u!="line"?a="<i class='"+Sr(p)+" o"+c.offset+"'>"+Jt(a||"")+"</i>":u=="white"&&a!=`
|
|
`&&(a="<i raw='"+JSON.stringify(a)+"'>"+Jt(a||"")+"</i>"),t.push(a),(h=="end"||h=="close"||c.start)&&t.push("</b>")}}return t.join("")}0&&(module.exports={CompletionTypes,Group,ImbaDocument,KeywordTypes,Keywords,M,Monarch,Node,Position,Range,Scope,SemanticTokenModifiers,SemanticTokenTypes,Sym,SymbolFlags,SymbolKind,Token,grammar,highlight,lexer});
|
|
|