UNPKG

87.4 kBJavaScriptView Raw
1var F=Symbol.for("#__init__"),hr=Symbol.for("#__initor__"),an=Symbol.for("#__inited__"),ur=Symbol.for("#__hooks__");var Oe=Symbol.for("imba");var cs={SUPERCALLS:1<<3,CONSTRUCTOR:1<<4},ge={IsExtension:1<<0,IsTag:1<<1,HasDescriptors:1<<2,HasSuperCalls:1<<3,HasConstructor:1<<4,HasFields:1<<5,HasMixins:1<<6,HasInitor:1<<7,HasDecorators:1<<8,IsObjectExtension:1<<9},re=new Map,ln=globalThis[Oe]||(globalThis[Oe]={counter:0,classes:re});function pe(s,e={}){var t;return re.has(s)||re.set(s,{symbol:Symbol(),parent:(t=Object.getPrototypeOf(s.prototype))==null?void 0:t.constructor,for:s,uses:[],inits:[],id:ln.counter++,...e}),re.get(s)}function R(s,e){var t;return typeof e=="string"?typeof s===e:(t=e==null?void 0:e[Symbol.hasInstance])==null?void 0:t.call(e,s)}function I(s){var e;return((e=s==null?void 0:s.toIterable)==null?void 0:e.call(s))||s}function cn(s,e){if(!s||!e)return!1;if(s.get)return e.get===s.get;if(s.set)return e.set===s.set;if(s.value)return s.value===e.value}function mr(s,e,t){let r=s.constructor;t!=null||(t=Object.getOwnPropertyDescriptors(e));let n=Object.getOwnPropertyDescriptors(s);delete t.constructor,t[F]&&delete t[F],Object.defineProperties(s,t);let i=pe(r);if(i&&i.augments)for(let a of i.augments){let o=Object.getOwnPropertyDescriptors(a.prototype),p={};for(let c of Object.keys(t)){let l=t[c];o[c]&&!cn(n[c],o[c])?console.warn("wont extend",c):p[c]=l}Object.keys(p).length&&mr(a.prototype,null,p)}return s}function dr(s,e){let t=pe(s),r=pe(e);if(r.parent&&!(s.prototype instanceof r.parent))throw new Error(`Mixin ${r.name} has superclass not present in target class`);if(!r.augments){r.augments=new Set;let i=r.ref=Symbol(),a=Object[Symbol.hasInstance];e.prototype[i]=!0,Object.defineProperty(e,Symbol.hasInstance,{value:function(o){return this===e?o&&!!o[i]:a.call(this,o)}})}if(s.prototype[r.ref])return s;for(let i of r.uses)dr(s,i,t);r.augments.add(s),t.uses.push(e);let n=Object.getOwnPropertyDescriptors(e.prototype);delete n.constructor,n[F]&&(t.inits.push(e.prototype[F]),delete n[F]),Object.defineProperties(s.prototype,n);try{t.top.version++}catch{}return s}var X={cache:{},self:null,target:null,proxy:new Proxy({},{apply:(s,e,...t)=>X.target[e].apply(X.self,t),get:(s,e)=>Reflect.get(X.target,e,X.self),set:(s,e,t,r)=>Reflect.set(X.target,e,t,X.self)})};function $(s,e,t,r,n=null){var p;let i=Object.getPrototypeOf(s.prototype);if(r&ge.HasMixins&&(re.set(s,re.get(i.constructor)),i=Object.getPrototypeOf(i)),n){let c=r&ge.IsObjectExtension?n:n.prototype,l=pe(s);if((p=l.uses)!=null&&p.length){n===c&&console.warn("Cannot extend object with mixins");for(let f of l.uses)dr(n,f)}return r&ge.HasSuperCalls&&(X.cache[e]=Object.create(Object.getPrototypeOf(c),Object.getOwnPropertyDescriptors(c))),mr(c,s.prototype),n}let a=i==null?void 0:i.constructor,o=pe(s,{symbol:e});return t&&s.name!==t&&Object.defineProperty(s,"name",{value:t,configurable:!0}),o.flags=r,r&ge.HasConstructor&&(s.prototype[hr]=e),(a==null?void 0:a.inherited)instanceof Function&&a.inherited(s),s}function N(s,e){var t;s[hr]===e&&((t=s[an])==null||t.call(s),s[ur]&&s[ur].inited(s))}var ne=Symbol.for("#source"),pn=Symbol.for("#lineText"),fn=Symbol.for("#version"),gr=new WeakMap,yr=Symbol(),Ae=class{[F](e=null,t=!0,r=!0){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[F](),this.line=e,this.character=t,this.offset=r,this[fn]=n,N(this,yr)}toString(){return""+this.line+":"+this.character}valueOf(){return this.offset}},Q=Ae;(()=>{$(Ae,yr,"Position",16)})();var _r=Symbol(),Ee=class{[F](e=null,t=!0,r=!0){this.start=e?e.start:void 0,this.end=e?e.end:void 0}constructor(e,t){this[F](),this.start=e,this.end=t,N(this,_r)}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}},H=Ee;(()=>{$(Ee,_r,"Range",16)})();var un={Error:1,Warning:2,Information:3,Hint:4,error:1,warning:2,warn:2,info:3,hint:4},br=Symbol(),Me=class{constructor(e,t=null){this.range=e.range,this.severity=un[e.severity]||e.severity,this.code=e.code,this.source=e.source,this.message=e.message,gr.set(this,t),N(this,br)}get[ne](){return gr.get(this)}get[pn](){return this[ne].doc.getLineText(this.range.start.line)}toSnippet(){let e=this.range.start,t=this.range.end,r=""+this[ne].sourcePath+":"+(e.line+1)+":"+(e.character+1)+": "+this.message,n=this[ne].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(`
2`).replace(/\t/g," ")+`
3`}toError(){let e=this.range.start,t=this.range.end,r=""+this[ne].sourcePath+":"+(e.line+1)+":"+(e.character+1)+": "+this.message,n=new SyntaxError(r),i=this[ne].doc.getLineText(e.line),a=[r,i];return a.push(i.replace(/[^\t]/g," ").slice(0,e.character)+"^".repeat(t.character-e.character)),n.stack=`
4`+a.join(`
5`).replace(/\t/g," ")+`
6`,n}raise(){throw this.toError()}},xr=Me;(()=>{$(Me,br,"Diagnostic",16)})();var kr=Symbol(),Be=class{constructor(e,t){this.cache={},this.rules=e,this.matcher=t,N(this,kr)}convert(e){for(let t=0,r=I(this.rules),n=r.length;t<n;t++){let i=r[t];if(this.matcher&&this.matcher(i[0],e))return e[1]}return 0}},wr=Be;(()=>{$(Be,kr,"Converter",16)})();function ye(s,e,t=1e5){let r=s;for(;r&&t>0;){if(r.match(e))return r;t--,r=r.prev}return null}function ze(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 $r(s){var e=s.start,t=s.end;return e.line>t.line||e.line===t.line&&e.character>t.character?new H(t,e):R(s,H)?s:new H(e,t)}function vr(s){return s!=null&&typeof s.text=="string"&&s.range===void 0}function Sr(s){let e=s.split(/\n/),t=[],r={indent:-1,children:[]},n=r,i,a=Date.now();for(let o=0,p=I(e),c=p.length;o<c;o++){let l=p[o];if(l.match(/^\s*$/))continue;let f=l.match(/^\t*/)[0].length;for(;r.indent>=f;)r=r.parent||n;if(i=l.match(/^(\t*((?:export )?(?:static )?(?:extend )?)(class|tag|def|get|set|prop|attr) )(\@?[\w\-\$\:]+(?:\.[\w\-\$]+)?)/),i){let u=i[3],h=i[4],v=r.name?r.name+".":"",S=i[2].trim().split(/\s+/),E="",y={start:{line:o,character:i[1].length},end:{line:o,character:i[0].length}},m={kind:u,ownName:h,name:v+h,span:y,indent:f,modifiers:S,children:[],parent:r==n?null:r,type:u,data:{},static:S.indexOf("static")>=0,extends:S.indexOf("extend")>=0};m.static&&(m.containerName="static"),m.containerName=i[2]+i[3],u=="tag"&&(i=l.match(/\<\s+([\w\-\$\:]+(?:\.[\w\-\$]+)?)/))&&(m.superclass=i[1]),r.type=="tag"&&(E="```html\n<"+r.name+" "+h+">\n```\n",m.description={kind:"markdown",value:E}),r.children.push(m),r=m,t.push(m)}}return n.all=t,console.log("fast outline",s.length,Date.now()-a),n}var Le=[/^/,{token:"@rematch",next:"@pop"}],Cr={token:"@rematch",next:"@pop"},Ir={token:"white.indent",next:"@>illegal_indent"};function hn(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 A(s,e,t,r={}){var o;var n;s==null?s=Ir:s==1?s={next:"@>"}:s==2?s={next:"@>_indent&-_indent"}:typeof s=="string"&&(s={next:s}),e==-1&&(e=Cr),t==-1?t=Cr:t==0&&((o=r.comment)!=null||(r.comment=!0),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 p of["next","switchTo"]){let c=n++;s[p]&&s[p].indexOf("*")==-1&&(s[p]+="*$1")}let a=[/^(\t*)(?=[^ \t\n])/,{cases:i}];if(r.comment){let p={};for(let c=0,l=Object.keys(i),f=l.length,u,h;c<f;c++){u=l[c],h=i[u];let v=Object.assign({},h);!v.next&&!v.switchTo&&(v.next="@>_comment"),p[u]=v}return[[/^(\t*)(?=#\s|#$)/,{cases:p}],a]}return a}var Pe={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:[A()],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"],A("@>_paren_indent&-_indent",null,null),[/^(\t+)(?=[\r\n]|$)/,"white.tabs"],"whitespace"],_indent:[A(2,-1,0),"block_"],_paren_indent:[A(2,-1,0),"block_",[/\)|\}|\]/,"@rematch","@pop"]],block:[A("@>",-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:[Le,[/\)|\}|\]|\>/,"@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:[Le,[/,|\}|\]|\)/,"@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:[A("@>block",-1,0),"block_"],_try:[A("@>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:[A(null,-1,-1),[/\(/,"(",{switchTo:"@_do_params"}],[/./,"@rematch",{switchTo:"@_do"}]],do_piped:[A(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:[A(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:[A(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:[A(null,-1,0),[/["']/,"path.open","@_path=$#"],Le],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:[A(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:[A({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:[A(2,-1,0),"block_"],for_start:[A({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:[A({switchTo:"@>for_body"},-1,{switchTo:"@for_body"}),"expr_",[/[ \t]+/,"white"]],for_body:[A(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:[A(null,-1,-1),"type_",[/(\s*=)(?!\=)/,["operator.assign","@>_field_value&field"]],[/(\s*(?:\@)set\s*)/,["keyword.spy","@>_def&spy"]]],_field_value:[A(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:[A(Ir,-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:[A(2,-1,-1),"block_"],_def:[A(2,-1,0),"block_"],_flow:[A(2,-1,0),"block_"],_varblock:[A(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:[A(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"],A({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:[A(-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:[A(null,-1,0),[/(?=@cssPropertyKey)/,"","@css_property&-_styleprop-_stylepropkey"],[/#(\s.*)?\n?$/,"comment"],[/(?=[\%\*\w\&\$\>\.\[\@\!]|\#[\w\-])/,"","@>css_selector&rule-_sel"],[/\s+/,"white"]],css_selector:[A({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:[A(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:[A({switchTo:"@>css_multiline_value"},-1,-1),[/@cssPropertyKey/,"@rematch","@pop"],[/;/,"style.delimiter","@pop"],[/(\}|\)|\])/,"@rematch","@pop"],"css_value_"],css_multiline_value:[A(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:[A(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 _e(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=be(s),s[0]==">"&&(e[1]="$S6 ",s=s.slice(1));for(let t=0,r=I(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 be(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 Fe(s,e){if(typeof s=="string"&&(s={token:s}),s&&s.token!=null)s.token=be(s.token),typeof e=="string"?s.next=e:e&&Object.assign(s,e),s.next&&(s.next=_e(s.next)),s.switchTo&&(s.switchTo=_e(s.switchTo));else if(s&&s.cases){let t={};for(let r=s.cases,n=0,i=Object.keys(r),a=i.length,o,p;n<a;n++){o=i[n],p=r[o];let c=be(o);t[c]=Fe(p)}s.cases=t}else if(R(s,Array)){let t=[],r=null;for(let n=0,i=I(s),a=i.length;n<a;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:be(o)})}s=t}if(R(s,Array))for(let t=0,r=I(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=_e(i.next)),i.switchTo&&(i.switchTo=_e(i.switchTo))}return s}for(let s=0,e=Object.keys(Pe),t=e.length,r,n;s<t;s++){r=e[s],n=Pe[r];let i=0;for(;i<n.length;){let a=n[i];if(R(a[0],Array)){n.splice(i,1,...a);continue}else typeof a=="string"?n[i]={include:a}:R(a[1],Array)?a[1]=Fe(a[1]):R(a,Array)&&a.splice(1,2,Fe(a[1],a[2]));i++}}var Re={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:hn("... . .. + * ++ --"),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:Pe};function mn(s){return Array.isArray(s)}function Or(s){return!mn(s)}function je(s){return typeof s=="string"}function Ar(s){return!je(s)}function Er(s){return!s}function Y(s,e){return s.ignoreCase&&e?e.toLowerCase():e}function Ve(s){return s.replace(/[&<>'"_]/g,"-")}function Mr(s,e){console.log(`${s.languageId}: ${e}`)}function M(s,e){return new Error(`${s.languageId}: ${e}`)}var zr={};function dn(s){let e=[],t=0,r=s.length,n="",i=0;for(;t<r;){let a=s[t++];if(a=="$"){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+=a}return n&&e.push(n),zr[s]=e,e}function Z(s,e,t,r,n){let i=null,a=zr[e]||dn(e),o="";for(let p=0;p<a.length;p++){let c=a[p];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 Ne={};function xe(s,e){let t=e;if(Ne[t])return s.tokenizer[Ne[t]];for(;t&&t.length>0;){let r=s.tokenizer[t];if(r)return Ne[e]=t,r;let n=t.lastIndexOf(".");n<0?t=null:t=t.substr(0,n)}return null}function Br(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 yn(s,e){if(!e||!Array.isArray(e))return!1;for(let t of e)if(!s(t))return!1;return!0}function Pr(s,e){return typeof s=="boolean"?s:e}function Fr(s,e){return typeof s=="string"?s:e}function _n(s){let e={};for(let t of s)e[t]=!0;return e}function Rr(s,e=!1){e&&(s=s.map(function(r){return r.toLowerCase()}));let t=_n(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 De(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?M(s,"language definition does not contain attribute '"+n+"', used at: "+e):M(s,"attribute reference '"+n+"' must be a string, used at: "+e);return Er(i)?"":"(?:"+i+")"});return new RegExp(e,s.ignoreCase?"i":"")}function bn(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 xn(s,e,t,r){let n=-1,i=t,a=t.match(/^\$(([sS]?)(\d\d?)|#)(.*)$/);a&&(a[3]&&(n=parseInt(a[3]),a[2]&&(n=n+100)),i=a[4]);let o="~",p=i;!i||i.length===0?(o="!=",p=""):/^\w*$/.test(p)?o="==":(a=i.match(/^(@|!@|~|!~|==|!=)(.*)$/),a&&(o=a[1],p=a[2]));let c;if((o==="~"||o==="!~")&&/^(\w|\|)*$/.test(p)){let l=Rr(p.split("|"),s.ignoreCase);c=function(f){return o==="~"?l(f):!l(f)}}else if(o==="@"||o==="!@"){let l=s[p];if(!l)throw M(s,"the @ match target '"+p+"' is not defined, in rule: "+e);if(!yn(function(u){return typeof u=="string"},l))throw M(s,"the @ match target '"+p+"' must be an array of strings, in rule: "+e);let f=Rr(l,s.ignoreCase);c=function(u){return o==="@"?f(u):!f(u)}}else if(o==="~"||o==="!~")if(p.indexOf("$")<0){let l=De(s,"^"+p+"$");c=function(f){return o==="~"?l.test(f):!l.test(f)}}else c=function(l,f,u,h){return De(s,"^"+Z(s,p,f,u,h)+"$").test(l)};else if(p.indexOf("$")<0){let l=Y(s,p);c=function(f){return o==="=="?f===l:f!==l}}else{let l=Y(s,p);c=function(f,u,h,v,S){let E=Z(s,l,u,h,v);return o==="=="?f===E:f!==E}}return n===-1?{name:t,value:r,test:function(l,f,u,h){return c(l,l,f,u,h)}}:{name:t,value:r,test:function(l,f,u,h){let v=bn(l,f,u,n);return c(v||"",l,f,u,h)}}}function Ke(s,e,t){if(t){if(typeof t=="string")return t;if(t.token||t.token===""){if(typeof t.token!="string")throw M(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 M(s,"a 'bracket' attribute must be either '@open' or '@close', in rule: "+e);if(t.next){if(typeof t.next!="string")throw M(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&&!Br(s,Z(s,n,"",[],""))))throw M(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]=Ke(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 a=Ke(s,e,t.cases[i]);i==="@default"||i==="@"||i===""?r.push({test:void 0,value:a,name:i}):i==="@eos"?r.push({test:function(o,p,c,l){return l},value:a,name:i}):r.push(xn(s,e,i,a))}let n=s.defaultToken;return{test:function(i,a,o,p){for(let c of r)if(!c.test||c.test(i,a,o,p))return c.value;return n}}}else throw M(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 qe=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 M(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=De(e,"^(?:"+(this.matchOnlyAtLineStart?r.substr(1):r)+")")}setAction(e,t){this.action=Ke(e,this.name,t)}};function ke(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=Pr(e.ignoreCase,!1),t.tokenPostfix=Fr(e.tokenPostfix,"."+t.languageId),t.defaultToken=Fr(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(a,o,p){for(let c of p){let l=c.include;if(l){if(typeof l!="string")throw M(t,"an 'include' attribute must be a string at: "+a);if(l[0]==="@"&&(l=l.substr(1)),!e.tokenizer[l])throw M(t,"include target '"+l+"' is not defined at: "+a);n(a+"."+l,o,e.tokenizer[l])}else{let f=new qe(a);if(Array.isArray(c)&&c.length>=1&&c.length<=3)if(f.setRegex(r,c[0]),c.length>=3)if(typeof c[1]=="string")f.setAction(r,{token:c[1],next:c[2]});else if(typeof c[1]=="object"){let u=c[1];u.next=c[2],f.setAction(r,u)}else throw M(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: "+a);else f.setAction(r,c[1]);else{if(!c.regex)throw M(t,"a rule must either be an array, or an object with a 'regex' or 'include' field at: "+a);c.name&&typeof c.name=="string"&&(f.name=c.name),c.matchOnlyAtStart&&(f.matchOnlyAtLineStart=Pr(c.matchOnlyAtLineStart,!1)),f.setRegex(r,c.regex),f.setAction(r,c.action)}o.push(f)}}}if(!e.tokenizer||typeof e.tokenizer!="object")throw M(t,"a language definition must define the 'tokenizer' attribute as an object");t.tokenizer=[];for(let a in e.tokenizer)if(e.tokenizer.hasOwnProperty(a)){t.start||(t.start=a);let o=e.tokenizer[a];t.tokenizer[a]=new Array,n("tokenizer."+a,t.tokenizer[a],o)}if(t.usesEmbedded=r.usesEmbedded,e.brackets){if(!Array.isArray(e.brackets))throw M(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 a of e.brackets){let o=a;if(o&&Array.isArray(o)&&o.length===3&&(o={token:o[2],open:o[0],close:o[1]}),o.open===o.close)throw M(t,"open and close brackets in a 'brackets' attribute must be different: "+o.open+`
7 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:Y(t,o.open),close:Y(t,o.close)});else throw M(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 K=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 K(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}},we=class{constructor(e,t){this.tokens=e,this.endState=t}};var Nr=10;function fe(s,e){return s.split(".")[e]}var He=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 J(e,t);let r=J.getStackElementId(e);r.length>0&&(r+="|"),r+=t;let n=this._entries[r];return n||(n=new J(e,t),this._entries[r]=n,n)}},se=He;se._INSTANCE=new He(Nr);var J=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 J._equals(this,e)}push(e){return se.create(this,e)}pop(){return this.parent}popall(){let e=this;for(;e.parent;)e=e.parent;return e}switchTo(e){return se.create(this.parent,e)}},Ze=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 oe(e);let t=J.getStackElementId(e),r=this._entries[t];return r||(r=new oe(e),this._entries[t]=r,r)}},ie=Ze;ie._INSTANCE=new Ze(Nr);var oe=class{constructor(e){this.stack=e}clone(){return ie.create(this.stack)}equals(e){return!(!(e instanceof oe)||!this.stack.equals(e.stack))}},Ge=class{constructor(){this._tokens=[],this._language=null,this._lastToken=new K(0,"start","imba"),this._lastTokenType=null}enterMode(e,t){this._language=t}emit(e,t,r){this._lastTokenType;let n=new K(e,t,this._language);return this._lastTokenType=t,this._lastToken=n,this._tokens.push(n),n}finalize(e){return new we(this._tokens,e)}},ae=class{constructor(e,t){this._modeId=e,this._lexer=t,this._profile=!1}dispose(){}getLoadStatus(){return{loaded:!0}}getInitialState(){let e=se.create(null,this._lexer.start);return ie.create(e)}tokenize(e,t,r){let n=new Ge,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("-"),a=(t||"").split("-");if(e==t)return;let o=1;for(;i[o]&&i[o]==a[o];)o++;let p=i.length;for(;p>o;)r.push("pop."+i[--p]+"."+p);for(;a.length>o;){let c="push."+a[o++]+"."+(o-1);if(n){let l=fe(n,1);c+="."+l}r.push(c)}}_myTokenize(e,t,r,n){n.enterMode(r,this._modeId);let i=e.length,a=t.stack,o=null,p=0,c=this._profile,l=null,f=!0,u=[],h=0,v=[],S=null,E=-1;for(;f||p<i;){if(h++,h>1e3){if(p==E)throw console.log("infinite recursion",p,i,a,n),"infinite recursion in tokenizer?";E=p,h=0}let y=p,m=a.depth,b=l?l.groups.length:0,w=a.state,x=null,k=null,_=null,z=null;if(l){x=l.matches;let T=l.groups.shift();k=T.matched,_=T.action,z=l.rule,l.groups.length===0&&(l=null)}else{if(!f&&p>=i)break;if(f=!1,v=this._lexer.tokenizer[w],!v&&(v=xe(this._lexer,w),!v))throw M(this._lexer,"tokenizer state is not defined: "+w);let T=e.substr(p);for(let C of v)if(C.string!==void 0){if(T[0]===C.string){x=[C.string],k=C.string,_=C.action;break}}else if(p===0||!C.matchOnlyAtLineStart){if(c){C.stats.count++;let D=performance.now();x=T.match(C.regex),C.stats.time+=performance.now()-D,x&&C.stats.hits++}else x=T.match(C.regex);if(x){k=x[0],_=C.action;break}}}if(x||(x=[""],k=""),_||(p<i&&(x=[e.charAt(p)],k=x[0]),_=this._lexer.defaultToken),k===null)break;for(p+=k.length;Or(_)&&Ar(_)&&_.test;)_=_.test(k,x,w,p===i);let O=null;if(typeof _=="string"||Array.isArray(_))O=_;else if(_.group)O=_.group;else if(_.token!==null&&_.token!==void 0){if(_.tokenSubst?O=Z(this._lexer,_.token,k,x,w):O=_.token,_.goBack&&(p=Math.max(0,p-_.goBack)),_.switchTo&&typeof _.switchTo=="string"){let T=Z(this._lexer,_.switchTo,k,x,w);if(T[0]==="@"&&(T=T.substr(1)),xe(this._lexer,T)){let C=a.scope,D=fe(T,2);C!==D&&this._rescope(C,D,u,T),a=a.switchTo(T)}else throw M(this._lexer,"trying to switch to a state '"+T+"' that is undefined in rule: "+this._safeRuleName(z))}else{if(_.transform&&typeof _.transform=="function")throw M(this._lexer,"action.transform not supported");if(_.next)if(_.next==="@push"){if(a.depth>=this._lexer.maxStack)throw M(this._lexer,"maximum tokenizer stack size reached: ["+a.state+","+a.parent.state+",...]");a=a.push(w)}else if(_.next==="@pop"){if(a.depth<=1)throw M(this._lexer,"trying to pop an empty stack in rule: "+this._safeRuleName(z));{let T=a;a=a.pop();let C=fe(T.state,2),D=fe(a.state,2);C!==D&&this._rescope(C,D,u,a.state)}}else if(_.next==="@popall")a=a.popall();else{let T=Z(this._lexer,_.next,k,x,w);T[0]==="@"&&(T=T.substr(1));let C=fe(T,2);if(xe(this._lexer,T))C!=a.scope&&this._rescope(a.scope||"",C,u,T),a=a.push(T);else throw M(this._lexer,"trying to set a next state '"+T+"' that is undefined in rule: "+this._safeRuleName(z))}}_.log&&typeof _.log=="string"&&Mr(this._lexer,this._lexer.languageId+": "+Z(this._lexer,_.log,k,x,w)),_.mark&&n.emit(y+r,_.mark,a)}if(O===null)throw M(this._lexer,"lexer rule has no well-defined action in rule: "+this._safeRuleName(z));if(Array.isArray(O)){if(l&&l.groups.length>0)throw M(this._lexer,"groups cannot be nested: "+this._safeRuleName(z));if(x.length!==O.length+1)throw M(this._lexer,"matched number of groups does not match the number of actions in rule: "+this._safeRuleName(z));let T=0;for(let C=1;C<x.length;C++)T+=x[C].length;if(T!==k.length)throw M(this._lexer,"with groups, all characters should be matched in consecutive groups in rule: "+this._safeRuleName(z));l={rule:z,matches:x,groups:[]};for(let C=0;C<O.length;C++)l.groups[C]={action:O[C],matched:x[C+1]};p-=k.length;continue}else{if(O==="@rematch"&&(p-=k.length,k="",x=null,O=""),k.length===0)if(i===0||m!==a.depth||w!==a.state||(l?l.groups.length:0)!==b){for(typeof O=="string"&&O&&n.emit(p+r,O,a);u.length>0;)n.emit(p+r,u.shift(),a);continue}else throw M(this._lexer,"no progress in tokenizer in rule: "+this._safeRuleName(z));let T=null;if(je(O)&&O.indexOf("@brackets")===0){let D=O.substr(9),P=kn(this._lexer,k);if(!P)throw M(this._lexer,"@brackets token returned but no bracket defined as: "+k);T=Ve(P.token+D)}else{let D=O===""?"":O+this._lexer.tokenPostfix;T=Ve(D)}let C=n.emit(y+r,T,a);for(C.stack=a,o&&o!=C&&(o.value=e.slice(o.offset-r,y)),o=C;u.length>0;)n.emit(p+r,u.shift(),a)}}return o&&!o.value&&(o.value=e.slice(o.offset-r)),ie.create(a)}};function kn(s,e){if(!e)return null;e=Y(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}var jr=Symbol(),ve=class{constructor(e=null){this[F](e),N(this,jr)}[F](e=null,t=!0,r=!0){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=I(this.tokens),a=i.length;n<a;n++){let o=i[n],p=o.clone();p.offset=o.offset+r,t.push(p)}return new ve({offset:e,startState:this.startState,endState:this.endState,text:this.text,tokens:t})}},$e=ve;(()=>{$(ve,jr,"LexedLine",16)})();var wn=ke("imba",Re),le=new ae("imba",wn);var ue=["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=I(ue),t=e.length;s<t;s++){let r=e[s];ue[r]=s}var L={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},$n=Object.keys(L).map(function(s){return s.toLowerCase()});for(let s=0,e=I(Object.keys(L)),t=e.length;s<t;s++){let r=e[s];L[r.toLowerCase()]=L[r]}var V={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},Se={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},j={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(j),t=e.length,r,n;s<t;s++)r=e[s],n=j[r],j[n]=r;var he=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 Vr=[["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]],We={},Dr=Symbol(),Ue=class{[F](e=null,t=!0,r=!0){var n;this.value=e?e.value:void 0,this.body=e&&(n=e.body)!==void 0?n:null}static typeMatch(e){if(We[e]!=null)return We[e];for(let t=0,r=I(Vr),n=r.length;t<n;t++){let[i,a,o,p]=r[t];if(e.indexOf(i)>=0)return We[e]=Vr[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[F](),this.flags=e,this.name=t,this.node=r,this.desc=n,N(this,Dr)}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(){var i;let e,t=this.desc&&this.desc.datatype;if(t)return t;if(this[he])return this[he];let r=this.node&&this.node.nextNode;if(r&&r.type=="type")return r;let n=this.scope;if(n&&((i=this.desc)==null?void 0:i.kind)=="for"){let a=n.doc.getDestructuredPath(this.node,[[n.expression,"__@iterable"]]);return this[he]||(this[he]=a)}return(e=this.importInfo)?e:null}get staticΦ(){return this.node&&this.node.mods&L.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(){var e,t;return(t=(e=this.node)==null?void 0:e.context)==null?void 0:t.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Φ?j.Variable:this.flags&d.Class?j.Class:this.flags&d.Component?j.Class:this.flags&d.Property?j.Field:this.flags&d.Method?this.escapedName=="constructor"?j.Constructor:j.Method:this.flags&d.Function?j.Function:j.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|=L.ReadOnly),this.staticΦ&&(e|=L.Static),this.flags&d.IsImport&&(e|=L.Import),this.flags&d.IsGlobal&&(e|=L.Global),this.flags&d.IsRoot&&(e|=L.Root),this.flags&d.IsSpecial&&(e|=L.Special),e}},G=Ue;(()=>{$(Ue,Dr,"Sym",16)})();var vn=Symbol(),Je=class extends G{},Kr=Je;(()=>{$(Je,vn,"ForVar",0)})();var Sn=Symbol(),Xe=class{},qr=Xe;(()=>{$(Xe,Sn,"SymbolMap",0)})();var Gr={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"}},Hr=Symbol(),$t=class{[F](e=null,t=!0,r=!0){var n;this.type=e&&(n=e.type)!==void 0?n:"",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[F](),this.doc=e,this.start=t,this.end=null,this.type=n,this.parent=r,this.$name=null,t.scope=this,N(this,Hr)}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:R(e,RegExp)?e.test(this.type):R(e,Function)?e(this):!0}},me=$t;(()=>{$($t,Hr,"Node",16)})();var Zr=Symbol(),vt=class extends me{constructor(e,t,r,n,i=[]){super(e,t,r,n),N(this,Zr)}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)}},B=vt;(()=>{$(vt,Zr,"Group",16)})();var Tn=Symbol(),St=class extends B{},Qe=St;(()=>{$(St,Tn,"ValueNode",0)})();var Cn=Symbol(),Tt=class extends B{},Ye=Tt;(()=>{$(Tt,Cn,"StringNode",0)})();var In=Symbol(),Ct=class extends B{get properties(){return this.findChildren("styleprop")}},et=Ct;(()=>{$(Ct,In,"StyleNode",0)})();var On=Symbol(),It=class extends B{},tt=It;(()=>{$(It,On,"StyleRuleNode",0)})();var Wr=Symbol(),Ot=class extends me{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:{}),R(this,ee))for(let a=0,o=Object.keys(Gr),p=o.length,c,l;a<p;a++){c=o[a],l=Gr[c];let f={value:c,offset:-1,mods:0};this.varmap[c]=new G(d.GlobalVar,c,f,l)}return this.indent=i[3]&&i[3][0]==" "?i[3].length:0,this.setup(),this;N(this,Wr)}setup(){if(this.handlerΦ&&(this.varmap.e=new G(d.SpecialVar,"e",null,"eventReference")),(this.classΦ||this.propertyΦ)&&(this.ident=this.token=ye(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 R(this,ee)}get topΦ(){return R(this,ee)}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&L.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}}},q=Ot;(()=>{$(Ot,Wr,"Scope",16)})();var An=Symbol(),At=class extends q{},ee=At;(()=>{$(At,An,"Root",0)})();var En=Symbol(),Et=class extends q{},Ur=Et;(()=>{$(Et,En,"Class",0)})();var Mn=Symbol(),Mt=class extends q{},Jr=Mt;(()=>{$(Mt,Mn,"Method",0)})();var zn=Symbol(),zt=class extends q{},Xr=zt;(()=>{$(zt,zn,"Flow",0)})();var Bn=Symbol(),Bt=class extends q{get expression(){return this.find("keyword.in keyword.of").next.next}get forvars(){return Object.values(this.varmap).filter(function(e){return e.itervarΦ})}},rt=Bt;(()=>{$(Bt,Bn,"ForScope",0)})();var Ln=Symbol(),Lt=class extends q{register(e){return this.parent.register(e)}lookup(...e){return this.parent.lookup(...e)}},nt=Lt;(()=>{$(Lt,Ln,"WeakScope",0)})();var Pn=Symbol(),Pt=class extends q{get selfScope(){return this}},st=Pt;(()=>{$(Pt,Pn,"FieldScope",0)})();var Fn=Symbol(),Ft=class extends B{},it=Ft;(()=>{$(Ft,Fn,"SelectorNode",0)})();var Rn=Symbol(),Rt=class extends B{get propertyName(){var e;return this.start.next.match("style.property.name")?this.start.next.value:(e=this.parent.prevProperty)==null?void 0:e.propertyName}get modifier(){if(this.start.next.match("style.property.modifier"))return this.start.next.value}get styleValue(){return!0}},ot=Rt;(()=>{$(Rt,Rn,"StylePropKey",0)})();var Nn=Symbol(),Nt=class extends B{get key(){return this.parent.key}get propertyName(){return this.parent.propertyName}get modifier(){return this.parent.modifier}},at=Nt;(()=>{$(Nt,Nn,"StylePropValue",0)})();var jn=Symbol(),jt=class extends B{get key(){return this.find("stylepropkey")}get prevProperty(){return this.start.prev.pops?this.start.prev.pops:null}get propertyName(){var e;return(e=this.key)==null?void 0:e.propertyName}get modifier(){var e;return(e=this.key)==null?void 0:e.modifier}},lt=jt;(()=>{$(jt,jn,"StylePropNode",0)})();var Vn=Symbol(),Vt=class extends B{},ct=Vt;(()=>{$(Vt,Vn,"StyleInterpolation",0)})();var Dn=Symbol(),Dt=class extends B{get innerText(){return this.value.slice(1,-1)}},pt=Dt;(()=>{$(Dt,Dn,"PathNode",0)})();var Kn=Symbol(),Kt=class extends B{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(){var e;return(e=this.closest("tagcontent"))==null?void 0:e.ownerTag}get ancestorTags(){var e;return(e=this.closest("tagcontent"))==null?void 0:e.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("")}},ft=Kt;(()=>{$(Kt,Kn,"TagNode",0)})();var qn=Symbol(),qt=class extends B{get propertyName(){return this.start.next.match("tag.attr")?this.start.next.value:""}get tagName(){return this.parent.name}},ut=qt;(()=>{$(qt,qn,"TagAttrNode",0)})();var Gn=Symbol(),Gt=class extends B{get propertyName(){return this.parent.propertyName}get tagName(){return this.parent.tagName}},ht=Gt;(()=>{$(Gt,Gn,"TagAttrValueNode",0)})();var Hn=Symbol(),Ht=class extends nt{get ownerTag(){return this.start.prev.pops}get ownerTags(){let e=[this.ownerTag],t;for(;t=e[0].parentTag;)e.unshift(t);return e}},mt=Ht;(()=>{$(Ht,Hn,"TagContent",0)})();var Zn=Symbol(),Zt=class extends B{get name(){return this.findChildren("tag.event.name").join("").replace("@","")}},dt=Zt;(()=>{$(Zt,Zn,"Listener",0)})();var Wn=Symbol(),Wt=class extends B{},Te=Wt;(()=>{$(Wt,Wn,"ParensNode",0)})();var Un=Symbol(),Ut=class extends B{static build(e,t,r,n,i){let a=this,o=e.content[t.offset-1];return!o||` [{(|=&-;
8 :/*%+-`.indexOf(o)>=0?(n="array",a=yt):(n="index",a=_t),new a(e,t,r,n,i)}},ce=Ut;(()=>{$(Ut,Un,"BracketsNode",0)})();var Jn=Symbol(),Jt=class extends B{},de=Jt;(()=>{$(Jt,Jn,"BracesNode",0)})();var Xn=Symbol(),Xt=class extends de{},gt=Xt;(()=>{$(Xt,Xn,"SpecifiersNode",0)})();var Qn=Symbol(),Qt=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 I(r)){let a=t++;e.offset>i.offset&&n++}return n}},yt=Qt;(()=>{$(Qt,Qn,"ArrayNode",0)})();var Yn=Symbol(),Yt=class extends ce{},_t=Yt;(()=>{$(Yt,Yn,"IndexNode",0)})();var Qr=Symbol(),er=class extends B{constructor(){super(...arguments),this.prev.datatype=this,N(this,Qr)}toString(){return this.value}},bt=er;(()=>{$(er,Qr,"TypeAnnotationNode",16)})();var es=Symbol(),tr=class extends B{},xt=tr;(()=>{$(tr,es,"InterpolatedValueNode",0)})();var ts=Symbol(),rr=class extends de{},kt=rr;(()=>{$(rr,ts,"ObjectNode",0)})();var rs=Symbol(),nr=class extends B{get isTypeOnly(){return this.start.prev.match("keyword.type")}get sourcePath(){let e=this.childNodes.find(function(t){return t.match("path")});return e==null?void 0:e.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")})}},wt=nr;(()=>{$(nr,rs,"ImportsNode",0)})();var W={style:et,array:ce,stylerule:tt,sel:it,path:pt,value:Qe,tag:ft,forscope:rt,field:st,type:bt,parens:Te,brackets:ce,object:kt,braces:de,specifiers:gt,string:Ye,tagattr:ut,imports:wt,interpolation:xt,tagattrvalue:ht,tagcontent:mt,listener:dt,styleinterpolation:ct,styleprop:lt,stylepropkey:ot,stylevalue:at,args:Te};var sr=Symbol.for("#ins"),ir=Symbol.for("#del"),Yr=Symbol.for("#version"),en=Symbol.for("#multiline"),tn=Symbol.for("#significant"),or=Symbol.for("#body"),te=Symbol.for("#lexed"),ns=Symbol(),lr=class{get node(){return this.scope&&this.scope.start==this?this.scope:this.pops?this.pops:this}get nextNode(){var e;return(e=this.next)==null?void 0:e.node}get prevNode(){var e;return(e=this.prev)==null?void 0:e.node}},rn=lr;(()=>{$(lr,ns,"Token",1,K)})();var nn=Symbol(),Ce=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 K(0,"eol","imba"),this.initialState=le.getInitialState(),this.seed.stack=le.getInitialState(),this.history=[],this.lexer=le,this.versionToHistoryMap={},this.versionToHistoryMap[r]=-1,n&&n.match(/^\#[^\n]+imba1/m)&&(this.isLegacy=!0),N(this,nn)}log(...e){return console.log(...e)}get lineCount(){return this.lineOffsets.length}get lineOffsets(){return this._lineOffsets||(this._lineOffsets=ze(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(R(e,Q))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 Q(0,e,e,this.version);for(;r<n;){let a=Math.floor((r+n)/2);t[a]>e?n=a:r=a+1}let i=r-1;return new Q(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 H(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[sr]="",r[ir]="";for(let o=0,p=I(e),c=p.length;o<c;o++){let l=p[o];if(vr(l)){this.overwrite(l.text,t),r.push([0,this.content.length,l.text]),n=!0;continue}let f=$r(l.range),u=this.offsetAt(f.start),h=this.offsetAt(f.end);l.range=f,l.offset=u,l.length=h-u,f.start.offset=u,f.end.offset=h;let S=h-u?this.content.slice(u,h):"";r[ir]+=S,r[sr]+=l.text||"",this.applyEdit(l,t,e),r.push([u,h-u,l.text||"",S]);let E=Math.max(f.start.line,0),y=Math.max(f.end.line,0),m=this.lineOffsets,b=ze(l.text,!1,u);if(y-E===b.length)for(let x=0,k=I(b),_=k.length;x<_;x++){let z=k[x];m[x+E+1]=b[o]}else b.length<1e4?m.splice.apply(m,[E+1,y-E].concat(b)):this._lineOffsets=m=m.slice(0,E+1).concat(b,m.slice(y+1));let w=l.text.length-(h-u);if(w!==0){let x=E+1+b.length;for(;x<m.length;)m[x]=m[x]+w,x++}}this.history.push(r),r[Yr]=t;let i=this.history[this.history.length-2];return(r[sr]+r[ir]).indexOf(`
9`)>=0&&(r[en]=!0,i&&!i[en]&&(r[tn]=!0,r[or]=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[tn])return t[Yr]}return null}editsSinceVersion(e){let t=this.versionToHistoryMap[e],r=[];for(let n=0,i=I(this.history.slice(t+1)),a=i.length;n<a;n++){let o=i[n];r.push(...o)}return r}contentAtVersion(e){let t=this.versionToHistoryMap[e],r=this.history[t];return r[or]!=null?r[or]:null}offsetAtVersion(e,t,r=this.version,n=!1){let i=this.versionToHistoryMap[t],a=this.versionToHistoryMap[r],o=e,p=!1;if(i<a)for(;i<a;){let c=this.history[++i];for(let l=0,f=I(c),u=f.length;l<u;l++){let[h,v,S]=f[l];h>o||(n&&(h-=1),o>h&&o>h+v&&(o+=S.length-v))}}else if(a<i)for(;a<i;){let c=this.history[i--];for(let l=0,f=I(c),u=f.length;l<u;l++){let[h,v,S]=f[l];h>o||o>h&&o>h+v&&(o-=S.length-v)}}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 R(t,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 a=this.tokens[n++];a.scope&&a.scope!=e?(i.push(a.scope),n=a.scope.endIndex+1):i.push(a)}return i}getSymbols(){var e;return this.astify(),(e=this[te]).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=I(t),a=i.length;n<a;n++){let o=i[n],p=o.symbol;if(!(p&&(!e||p.flags&e)))continue;let c=ue[p.semanticKind],l=o.mods|p.semanticFlags;r.push([o.offset,o.value.length,c,l])}return r}getEncodedSemanticTokens(){let e=this.getSemanticTokens(),t=[],r=0,n=0;for(let i=0,a=I(e),o=a.length;i<o;i++){let p=a[i],c=this.positionAt(p[0]),l=c.line-r,f=l?c.character:c.character-n;t.push(l,f,p[1],p[2],p[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),[a,o=""]=r.split(/[\d\.]+/),p=parseFloat(r.slice(a.length).slice(0,o.length?-o.length:1e3));return Number.isNaN(p)?null:(p+=t,[n+a.length,r.length-a.length-o.length,String(p)])}contextAtOffset(e){var t;this.ensureParsed();let r=this.positionAt(e),n=this.tokenAtOffset(e),i=this.lineOffsets[r.line],a=e-n.offset,o=n.context,p={character:this.content[e-1],line:this.content.slice(i,e),token:n.value.slice(0,a)},c={character:this.content[e],token:n.value.slice(a),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 l=ye(n,"white.tabs"),f=l?l.value.length:0,u=o,h=o.scope,v={},S=n,E=n.stack.state||"",y=V;u&&(u.start&&(p.group=this.content.slice(u.start.offset,e)),u.end&&(c.group=this.content.slice(e,u.end.offset)));let m={keywords:[]},b=0;if(n==l&&(f=a),n.match("br white.tabs"))for(;h.indent>f;)h=h.parent;if(u.type=="tag",n.match("entity string regexp comment style.")&&(b=0),n.match("tag.event.name tag.event-modifier.name")&&(S=n.prev),(n.type=="path"||n.type=="path.open")&&(b|=V.Path,m.paths=1),n.match("identifier tag.operator.equals br white delimiter array operator ( self")&&(b|=V.Value,S=null),n.match("operator.access")&&(b|=V.Access,S=n),n.match("accessor")&&(b|=V.Access,S=n.prev),n.match("delimiter.type.prefix type")&&(b|=V.Type),n.match("tag.name tag.open")?b|=V.TagName:n.match("tag.attr tag.white")?b|=V.TagProp:n.match("tag.flag")?b|=V.TagFlag:n.match("tag.event.modifier")?b|=V.TagEventModifier:n.match("tag.event")?b|=V.TagEvent:n.match("operator.equals.tagop")&&(b|=V.Value),n.match("style.property.operator")||u.closest("stylevalue")){b|=y.StyleValue;try{m.styleProperty=u.closest("styleprop").propertyName}catch{}}n.match("style.open style.property.name")&&(b|=y.StyleProp),(n.match("style.value.white")||n.prev&&n.prev.match("style.value.white"))&&(b|=y.StyleProp),n.match("style.selector.element")&&c.line.match(/^\s*$/)&&(b|=y.StyleProp),h.closest("rule")&&(b|=y.StyleProp,b&=~y.Value),n.match("style.property.operator")&&(b&=~y.StyleProp),u.match("stylevalue")&&p.group.indexOf(" ")==-1&&(b=y.StyleValue),n.match("style.selector.modifier style.property.modifier")&&(b=y.StyleModifier),n.match("style.selector.element")&&(b|=y.StyleSelector),h.closest("rule")&&p.line.match(/^\s*$/)&&(b|=y.StyleSelector,b&=~y.StyleValue),n.match("operator.access accessor white.classname white.tagname")&&(b&=~y.Value),u.closest("imports")&&(b&=~y.Value,b|=y.ImportName),(E.match(/\.decl-(let|var|const|param|for)/)||n.match(/\.decl-(for|let|var|const|param)/))&&(b&=~y.Value,b|=y.VarName);let w=h.allowedKeywordTypes;t=[];for(let k=0,_=Object.keys(Se),z=_.length,O,T;k<z;k++)O=_[k],T=Se[O],T&w&&t.push(O);m.keywords=t,m.flags=b;for(let k=0,_=Object.keys(y),z=_.length,O,T;k<z;k++)O=_[k],T=y[O],b&T&&(m[O]||(m[O]=!0));return{token:n,offset:e,position:r,linePos:i,scope:h,indent:f,group:o,mode:"",target:S,path:h.path,suggest:m,before:p,after:c}}textBefore(e){let t=this.content.slice(0,e),r=t.lastIndexOf(`
10`);return t.slice(r+1)}varsAtOffset(e,t=!1){let r=this.tokenAtOffset(e),n=[],i=r.context.scope,a={};for(;i;){for(let o=0,p=I(Object.values(i.varmap)),c=p.length;o<c;o++){let l=p[o];l.globalΦ&&!t||a[l.name]||(!l.node||l.node.offset<e)&&(n.push(l),a[l.name]=l)}i=i.parent}return n}getOutline(e=null){var t,r,n,i;if(this.isLegacy){let y=Sr(this.content);for(let m=0,b=I(y.all),w=b.length;m<w;m++){let x=b[m];t=x.parent,delete x.parent,x.path=x.name,x.name=x.ownName,e&&e(x,y.all)}return y}this.ensureParsed();let a=Date.now(),o=[],p={children:[]},c=p,l=null,f={},u=new Set,h=null;function v(y,m){return R(y,G)&&(u.add(y),y={name:y.name,kind:y.kind}),f=y,y.token=m,y.children||(y.children=[]),y.span||(y.span=m.span),y.name||(y.name=m.value),o.push(y),c.children.push(y)}function S(y){return f.children||(f.children=[]),f.parent||(f.parent=c),c=f,c.end=y}function E(y){return c=c.parent}for(let y=0,m=I(this.tokens),b=m.length;y<b;y++){let w=m[y],x=w.symbol,k=w.scope;if(w.type=="key")v({kind:j.Key},w);else if(x){if(x.parameterΦ)continue;u.has(x)||v(x,w),x.body&&(h=x.body.start)}else if(k&&k.type=="do"){let _=this.textBefore(w.offset-3).replace(/^\s*(return\s*)?/,"");_+=" callback",v({kind:j.Function,name:_},w.prev),h=w}else k&&k.type=="tag"&&v({kind:j.Field,name:k.outline},w);w==h&&S(w.end),w==c.end&&E()}for(let y=0,m=I(o),b=m.length;y<b;y++){let w=m[y];if(w.span){let x=w.span.length;w.span.start=this.positionAt(w.span.offset),w.span.end=x?this.positionAt(w.span.offset+x):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 p}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 f;let t=this[te]||{lines:[],version:-1};if(t.version==this.version&&!e)return t;let r=this.content;this.isLegacy&&(r=r.replace(/\@\w/g,function(u){return"¶"+u.slice(1)}),r=r.replace(/\w\:(?=\w)/g,function(u){return u[0]+"."}),r=r.replace(/(do)(\s?)\|([^\|]*)\|/g,function(u,h,v,S){return h+"("+(v||"")+S+")"}));let n=this.lineOffsets,i=[],o=this.seed,p=Date.now(),c=this.initialState;this[te]={version:this.version,lines:[],tokens:i};let l={};this[te].cache=l;for(let u=0,h=I(t.lines),v=h.length;u<v;u++){let S=h[u];(l[f=S.text]||(l[f]=[])).push(S)}for(let u=0,h=I(n),v=h.length;u<v;u++){let S=h[u],y=n[u+1]||r.length,m=r.slice(S,y),b=c,w=l[m],x=w&&w.filter(function(z){return z.startState==b}),k=x&&(x.find(function(z){return z.offset==S})||x[0]),_=null;if(k&&(k.offset==S,_=k.clone(S)),!_){let z=le.tokenize(m,b,S);_=new $e({offset:S,text:m,startState:b,endState:z.endState,tokens:z.tokens})}for(let z=0,O=I(_.tokens),T=O.length;z<T;z++){let C=O[z];i.push(C)}this[te].lines.push(_),c=_.endState}return this[te]}get tokens(){return this.astify(),this[te].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(),a=null,o=e.root=new ee(this,this.seed,null,"root"),p=this.content,c=console.log.bind(console),l=null,f=null,u=null,h=null,v=0;for(let S=0,E=I(e.tokens),y=E.length;S<y;S++){let m=E[S],b=m.type.split("."),w=m.value,x=e.tokens[S+1],[k,_,z]=b,O=b[b.length-1],T=b[b.length-2],C=null,D=0;if(k=="ivar"&&(w=m.value="@"+w.slice(1)),h&&(h.next=m),m.prev=h,m.context=o,k=="("&&h){let P=p[m.offset-1]||"";n.test(P)&&(o=m.scope=W.args.build(this,m,o,"args",b))}if(k=="operator"&&(m.op=m.value.trim()),k=="keyword"&&(L[_]&&(v|=L[_]),(w=="let"||w=="const")&&(f=m,u=null)),k=="entity"&&(m.mods|=v,v=0),k=="push"){let P=_,U=_.lastIndexOf("_"),Ie=U>=0?B:q;U>=0?(P=P.slice(U+1),Ie=W[P]||B):W[P]&&(Ie=W[P]),o=m.scope=new Ie(this,m,o,P,b),l&&(l.body=o,o.symbol=l,l=null),o==o.scope&&(f=null,u=null)}else k=="pop"?(_=="value"&&(u=null),o=o.pop(m)):(_=="open"||r[_])&&W[k]?o=m.scope=W[k].build(this,m,o,k,b):O=="open"&&(C=W[T])?o=m.scope=C.build(this,m,o,T,b):(O=="close"&&o.type==T||_=="close"&&W[k]||t[k]&&o&&o.start.value==t[k])&&(o=o.pop(m));if(m.match(/entity\.name|decl-/)){let P=G.forToken(m,m.type,m.mods);P&&(l=m.symbol=P,m.symbol.keyword=f,o.register(m.symbol)),m.mods|=L.Declaration}if(_=="declval"&&(u=m),m.match("identifier")&&!m.symbol){let P=o.lookup(m,f);if(P&&P.scopedΦ&&(u&&P.keyword==f||P.addReference(m)),h&&h.op=="="&&P){let U=h.prev;U&&U.symbol==P&&(U.mods&L.Declaration?P.dereference(m):(!x||x.match("br"))&&P.dereference(U))}}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,a,o,p){var c,l;let f={};p.split(/,\s*/).map(function(h){return h.split(/\:\s*/)}).map(function(h){return f[h[0]]=h[1]});let u=""+a+" "+o;return f.watch&&f.watch[0].match(/[\'\"\:]/)?u="@watch("+f.watch+") "+u:f.watch&&(u="@watch "+u),c=f.watch,delete f.watch,f.default&&(u=""+u+" = "+f.default,l=f.default,delete f.default),Object.keys(f).length&&console.log("more prop values",i,f),u});let r=Ce.tmp(e).getTokens(),n="";for(let i=0,a=I(r),o=a.length;i<o;i++){let p=a[i],c=r[i+1],{value:l,type:f,offset:u}=p,h=u+l.length;f=="operator.dot.legacy"&&(l=".",c&&(c.access=!0)),f=="operator.spread.legacy"&&(l="..."),f=="identifier.tagname"&&l.indexOf(":")>=0&&(l=l.replace(":","-")),f=="identifier.def.propname"&&l=="initialize"&&(l="constructor"),f=="decorator"&&!e.slice(h).match(/^\s(prop|def|get|set)/)&&(l=n+l.slice(1)),f=="property"&&(l[0]=="@"?(l=l.replace(/^\@/,n),p.access=!0):l=="len"?l="length":/^(\n|\s\:|\)|\,|\.)/.test(e.slice(h))&&!p.access&&l[0]==l[0].toLowerCase()&&(l=l+"!")),f=="identifier"&&!p.access&&l[0]==l[0].toLowerCase()&&l[0]!="_"&&!p.variable&&/^(\n|\s\:|\)|\,|\.)/.test(e.slice(h))&&l!="new"&&(l=l+"!"),p.value=l}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="",a=0,o=[],p={changes:o};if(this.getImportedSymbols().map(function(f){return f.importInfo}).find(function(f){return f.path==e&&f.name==r&&f.exportName==t}))return p;t!="default"&&t!="*"&&(n=n.filter(function(c){return c.specifiers||!c.ns}));for(let c=0,l=I(n),f=l.length;c<f;c++){let u=l[c],h=u.default,v=u.specifiers,S=u.namespace;if(t=="default")if(a=u.start.offset+1,h){if(h.value==r)return p;p.alias=h.value,a=0;continue}else i=r,(S||v)&&(i+=", ");else if(t=="*"){if(v)continue;h?(a=h.endOffset,i=", * as "+r):(a=u.start.offset+1,i="* as "+r+" ")}else if(S){p.alias=""+S.value+"."+t;continue}else{let E=t;r!=t&&(E+=" as "+r),v?(a=v.start.offset+1,i=" "+E+","):h?(a=h.endOffset,i=", { "+E+" }"):(i="{ "+E+" }",a=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+=`
11`),o.push({newText:i,range:this.rangeAt(a,a)}),p}},ar=Ce;(()=>{$(Ce,nn,"ImbaDocument",16)})();var sn={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 cr={},ss=Symbol(),fr=class{static getTokenizer(e){return e=="xml"&&!cr[e]?this.createTokenizer("xml",sn):cr[e]}static createTokenizer(e,t){let r=ke(e,t);return cr[e]=new ae(e,r)}},pr=fr;(()=>{$(fr,ss,"Monarch",0)})();var is={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},os={"[":"square open","]":"square close","{":"curly open","}":"curly close","(":"paren open",")":"paren close"};function on(s){return s.replace(/[\&\<\>]/g,function(e){return is[e]})}function as(s){return s.join(" ").replace(/[\[\]\{\}\(\)]/g,function(e){return os[e]})}function ls(s,{verbose:e=!1}){let t=[],r=0,n=0,i=[];for(let a=0,o=I(s),p=o.length;a<p;a++){let c=o[a],l=c.value,f=c.type.split("."),[u,h]=f,v=c.mods;if(c.var){let S=i.indexOf(c.var);S==-1&&(S=i.push(c.var)-1),f.push("vref"),f.push("var"+S),f.push(c.var.type+"-ref"),v|=c.var.mods}if(v&L.Declaration&&f.push("decl"),v&L.Root&&f.push("root"),v&L.Local&&f.push("local"),c.end&&c.end.start==c&&t.push("<b>"),!((h=="start"||h=="open")&&(t.push("<b class='"+u+"'>"),!l))){if((h=="end"||h=="close")&&!l){t.push("</b>");continue}if(u=="push"){l=String(++r);let S=h.indexOf("_")>=0?"group":"scope",E=c.scope&&c.scope.end;t.push("<div class='"+S+"-"+h.split("_").pop()+" _"+h+" l"+r+" o"+c.offset+" e"+(E&&E.offset)+"'>");continue}else if(u=="pop"){l=String(--r),t.push("</div>");continue}u!="white"&&u!="line"?l="<i class='"+as(f)+" o"+c.offset+"'>"+on(l||"")+"</i>":u=="white"&&l!=`
12`&&(l="<i raw='"+JSON.stringify(l)+"'>"+on(l||"")+"</i>"),t.push(l),(h=="end"||h=="close"||c.start)&&t.push("</b>")}}return t.join("")}export{V as CompletionTypes,B as Group,ar as ImbaDocument,g as KeywordTypes,Se as Keywords,L as M,pr as Monarch,me as Node,Q as Position,H as Range,q as Scope,$n as SemanticTokenModifiers,ue as SemanticTokenTypes,G as Sym,d as SymbolFlags,j as SymbolKind,K as Token,Re as grammar,ls as highlight,le as lexer};